123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.xinxin.topro.pubservice.mysqlmapper.InpMyPatientMapper" >
- <resultMap id="BaseResultMap" type="com.xinxin.topro.pubservice.mysqlModel.InpMyPatient" >
- <id column="IMP_ID" property="impId" jdbcType="INTEGER" />
- <result column="PatientNo" property="patientno" jdbcType="VARCHAR" />
- <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
- <result column="DD_DepDm" property="ddDepdm" jdbcType="VARCHAR" />
- <result column="DW_WardDm" property="dwWarddm" jdbcType="VARCHAR" />
- <result column="DB_BedNo" property="dbBedno" jdbcType="VARCHAR" />
- <result column="IMP_User" property="impUser" jdbcType="VARCHAR" />
- <result column="IMP_Recordor" property="impRecordor" jdbcType="VARCHAR" />
- <result column="IMP_Record_Time" property="impRecordTime" jdbcType="TIMESTAMP" />
- <result column="IMP_IsDel" property="impIsdel" jdbcType="INTEGER" />
- </resultMap>
- <sql id="Base_Column_List" >
- IMP_ID, PatientNo, HI_ID, DD_DepDm, DW_WardDm, DB_BedNo, IMP_User, IMP_Recordor,
- IMP_Record_Time, IMP_IsDel
- </sql>
- <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
- select
- <include refid="Base_Column_List" />
- from inp_mypatient
- where IMP_ID = #{impId,jdbcType=INTEGER}
- </select>
- <select id="selectByDepartNo" resultMap="BaseResultMap" parameterType="java.lang.String" >
- SELECT a.DB_BedNo dbBedno,b.ptName,b.age,b.gender,b.VisitNo AS patientno,
- case when b.AdmitTime is null then DATEDIFF(sysdate(),b.BirthDay) + 1 else DATEDIFF(sysdate(),b.AdmitTime) + 1 end admitDays
- from inp_mypatient a INNER JOIN v_patientinfo b on a.PatientNo = b.visitNo
- where a.DW_WardDm = #{departNo,jdbcType=VARCHAR} AND a.IMP_User = #{userCode,jdbcType=VARCHAR} AND a.IMP_IsDel = 0 and b.InHospitalStatus = 0
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
- delete from inp_mypatient
- where IMP_ID = #{impId,jdbcType=INTEGER}
- </delete>
- <insert id="insert" parameterType="com.xinxin.topro.pubservice.mysqlModel.InpMyPatient" >
- insert into inp_mypatient (IMP_ID, PatientNo, HI_ID,
- DD_DepDm, DW_WardDm, DB_BedNo,
- IMP_User, IMP_Recordor, IMP_Record_Time,
- IMP_IsDel)
- values (#{impId,jdbcType=INTEGER}, #{patientno,jdbcType=VARCHAR}, #{hiId,jdbcType=INTEGER},
- #{ddDepdm,jdbcType=VARCHAR}, #{dwWarddm,jdbcType=VARCHAR}, #{dbBedno,jdbcType=VARCHAR},
- #{impUser,jdbcType=VARCHAR}, #{impRecordor,jdbcType=VARCHAR}, #{impRecordTime,jdbcType=TIMESTAMP},
- #{impIsdel,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" parameterType="com.xinxin.topro.pubservice.mysqlModel.InpMyPatient" >
- insert into inp_mypatient
- <trim prefix="(" suffix=")" suffixOverrides="," >
- <if test="impId != null" >
- IMP_ID,
- </if>
- <if test="patientno != null" >
- PatientNo,
- </if>
- <if test="hiId != null" >
- HI_ID,
- </if>
- <if test="ddDepdm != null" >
- DD_DepDm,
- </if>
- <if test="dwWarddm != null" >
- DW_WardDm,
- </if>
- <if test="dbBedno != null" >
- DB_BedNo,
- </if>
- <if test="impUser != null" >
- IMP_User,
- </if>
- <if test="impRecordor != null" >
- IMP_Recordor,
- </if>
- <if test="impRecordTime != null" >
- IMP_Record_Time,
- </if>
- <if test="impIsdel != null" >
- IMP_IsDel,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides="," >
- <if test="impId != null" >
- #{impId,jdbcType=INTEGER},
- </if>
- <if test="patientno != null" >
- #{patientno,jdbcType=VARCHAR},
- </if>
- <if test="hiId != null" >
- #{hiId,jdbcType=INTEGER},
- </if>
- <if test="ddDepdm != null" >
- #{ddDepdm,jdbcType=VARCHAR},
- </if>
- <if test="dwWarddm != null" >
- #{dwWarddm,jdbcType=VARCHAR},
- </if>
- <if test="dbBedno != null" >
- #{dbBedno,jdbcType=VARCHAR},
- </if>
- <if test="impUser != null" >
- #{impUser,jdbcType=VARCHAR},
- </if>
- <if test="impRecordor != null" >
- #{impRecordor,jdbcType=VARCHAR},
- </if>
- <if test="impRecordTime != null" >
- #{impRecordTime,jdbcType=TIMESTAMP},
- </if>
- <if test="impIsdel != null" >
- #{impIsdel,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.pubservice.mysqlModel.InpMyPatient" >
- update inp_mypatient
- <set >
- <if test="patientno != null" >
- PatientNo = #{patientno,jdbcType=VARCHAR},
- </if>
- <if test="hiId != null" >
- HI_ID = #{hiId,jdbcType=INTEGER},
- </if>
- <if test="ddDepdm != null" >
- DD_DepDm = #{ddDepdm,jdbcType=VARCHAR},
- </if>
- <if test="dwWarddm != null" >
- DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
- </if>
- <if test="dbBedno != null" >
- DB_BedNo = #{dbBedno,jdbcType=VARCHAR},
- </if>
- <if test="impUser != null" >
- IMP_User = #{impUser,jdbcType=VARCHAR},
- </if>
- <if test="impRecordor != null" >
- IMP_Recordor = #{impRecordor,jdbcType=VARCHAR},
- </if>
- <if test="impRecordTime != null" >
- IMP_Record_Time = #{impRecordTime,jdbcType=TIMESTAMP},
- </if>
- <if test="impIsdel != null" >
- IMP_IsDel = #{impIsdel,jdbcType=INTEGER},
- </if>
- </set>
- where IMP_ID = #{impId,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.pubservice.mysqlModel.InpMyPatient" >
- update inp_mypatient
- set PatientNo = #{patientno,jdbcType=VARCHAR},
- HI_ID = #{hiId,jdbcType=INTEGER},
- DD_DepDm = #{ddDepdm,jdbcType=VARCHAR},
- DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
- DB_BedNo = #{dbBedno,jdbcType=VARCHAR},
- IMP_User = #{impUser,jdbcType=VARCHAR},
- IMP_Recordor = #{impRecordor,jdbcType=VARCHAR},
- IMP_Record_Time = #{impRecordTime,jdbcType=TIMESTAMP},
- IMP_IsDel = #{impIsdel,jdbcType=INTEGER}
- where IMP_ID = #{impId,jdbcType=INTEGER}
- </update>
- <update id="updateMyPatient" >
- update inp_mypatient
- set IMP_IsDel = -1
- where IMP_User = #{userCode,jdbcType=VARCHAR} AND PatientNo = #{visitNo,jdbcType=VARCHAR} AND IMP_IsDel = 0
- </update>
- <select id="selectLastUserByPatients" resultMap="BaseResultMap">
- select <include refid="Base_Column_List"/>
- from inp_mypatient
- where IMP_IsDel = 0
- and HI_ID = #{hiId,jdbcType=INTEGER}
- and PatientNo in
- <foreach collection="patientNos" item="item" open="(" close=")" separator=",">
- #{item,jdbcType=VARCHAR}
- </foreach>
- order by IMP_Record_Time desc
- </select>
- </mapper>
|