From 10aaa035f5be0312304d20f022bdb714a8f4900a Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 11 十二月 2024 22:16:23 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml |  258 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 245 insertions(+), 13 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index 373f395..997a089 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -48,14 +48,27 @@
         <result property="patno" column="patno"/>
         <result property="inhospstate" column="inhospstate"/>
         <result property="checkFlag" column="check_flag"/>
+        <result property="age" column="age"/>
+        <result property="sex" column="sex"/>
+        <result property="telcode" column="telcode"/>
+        <result property="longTaskReason" column="long_task_reason"/>
+        <result property="nurseId" column="nurse_id"/>
+        <result property="nurseName" column="nurse_name"/>
+        <result property="outWayId" column="out_way_id"/>
+        <result property="outWayName" column="out_way_name"/>
     </resultMap>
 
     <sql id="selectPatMedInhospVo">
         select inhospid,
                patname,
+               out_way_id,
+               out_way_name,
+               nurse_id,
+               nurse_name,
                check_flag,
                inhospstate,
                patno,
+               long_task_reason,
                inhospno,
                serialnum,
                hospitalname,
@@ -98,8 +111,79 @@
     </sql>
 
     <select id="selectPatMedInhospList" parameterType="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult">
-        <include refid="selectPatMedInhospVo"/>
+        select CONCAT( a.age, a.age_unit ) AS age,
+        a.telcode as telcode,
+        a.sex,
+        b.inhospid,
+        b.nurse_id,
+        b.nurse_name,
+        b.patname,
+        b.out_way_id,
+        b.out_way_name,
+        b.check_flag,
+        b.inhospstate,
+        b.patno,
+        b.inhospno,
+        b.serialnum,
+        b.hospitalname,
+        b.hospitalcode,
+        b.hospitaldistrictcode,
+        b.hospitaldistrictname,
+        b.icd10code,
+        b.diagname,
+        b.starttime,
+        b.endtime,
+        b.deptcode,
+        b.deptname,
+        b.roomno,
+        b.bed_no,
+        b.orgid,
+        b.del_flag,
+        b.update_by,
+        b.update_time,
+        b.create_by,
+        b.create_time,
+        b.isupload,
+        b.upload_time,
+        b.patid,
+        b.leavediagname,
+        b.leaveicd10code,
+        b.drcode,
+        b.drname,
+        b.schemestatus,
+        b.generalschemestatus,
+        b.leaveldeptcode,
+        b.leaveldeptname,
+        b.hospitaldistrictid,
+        b.leavehospitaldistrictcode,
+        b.leavehospitaldistrictname,
+        b.leavehospitaldistrictid,
+        b.deptid,
+        b.leaveldeptid,
+        b.long_task_reason,
+        b.schemetime
+        FROM
+        pat_med_inhosp b,
+        pat_archive a
         <where>
+            a.del_flag=0
+            and b.del_flag=0
+            and a.id = b.patid
+            AND a.idcardno != ''
+            <if test="startOutHospTime != null">
+                AND date_format(b.endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
+            </if>
+            <if test="endOutHospTime != null">
+                AND date_format(b.endtime,'%y%m%d') &lt;= date_format(#{endOutHospTime},'%y%m%d')
+            </if>
+
+
+                <if test="startInHospTime != null">
+                AND date_format(b.starttime,'%y%m%d') &gt;= date_format(#{startInHospTime},'%y%m%d')
+            </if>
+            <if test="endInHospTime != null">
+                AND date_format(b.starttime,'%y%m%d') &lt;= date_format(#{endInHospTime},'%y%m%d')
+            </if>
             <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
                 '%')
             </if>
@@ -107,24 +191,147 @@
             <if test="hospitaldistrictname != null  and hospitaldistrictname != ''">and hospitaldistrictname like
                 concat('%', #{hospitaldistrictname}, '%')
             </if>
-            <if test="endtime != null ">and endtime = #{endtime}</if>
-            <if test="patno != null ">and patno = #{patno}</if>
-            <if test="checkFlag != null ">and check_flag = #{checkFlag}</if>
-            <if test="inhospstate != null ">and inhospstate = #{inhospstate}</if>
-            <if test="schemestatus != null ">and schemestatus = #{schemestatus}</if>
-            <if test="leavediagname != null  and leavediagname != ''">and leavediagname like concat('%',
+            <if test="endtime != null ">and b.endtime = #{endtime}</if>
+            <if test="inhospno != null ">and b.inhospno = #{inhospno}</if>
+            <if test="serialnum != null ">and b.serialnum = #{serialnum}</if>
+            <if test="endtime != null ">and b.endtime = #{endtime}</if>
+            <if test="patno != null ">and b.patno = #{patno}</if>
+            <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
+            <if test="nurseName != null ">and b.nurse_name = #{nurseName}</if>
+            <if test="checkFlag != null ">and b.check_flag = #{checkFlag}</if>
+            <if test="cry != null and cry == 0 ">and b.endtime is null</if>
+            <if test="cry != null and cry == 1 ">and b.endtime is not null</if>
+            <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
+            <if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
+            <if test="outWayId != null ">and b.out_way_id = #{outWayId}</if>
+            <if test="outWayName != null ">and b.out_way_name = #{outWayName}</if>
+            <if test="leavediagname != null  and leavediagname != ''">and b.leavediagname like concat('%',
                 #{leavediagname}, '%')
             </if>
-            <if test="drname != null  and drname != ''">and drname like concat('%', #{drname}, '%')</if>
-            <if test="leaveldeptname != null  and leaveldeptname != ''">and leaveldeptname like concat('%',
+            <if test="drname != null  and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
+            <if test="leaveldeptname != null  and leaveldeptname != ''">and b.leaveldeptname like concat('%',
                 #{leaveldeptname}, '%')
             </if>
+            <if test="patid != null  and patid != ''">and a.id =#{patid}
+            </if>
             <if test="leavehospitaldistrictname != null  and leavehospitaldistrictname != ''">and
-                leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
+                b.leavehospitaldistrictname like concat('%', #{leavehospitaldistrictname}, '%')
+            </if>
+
+            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
+                AND b.leavehospitaldistrictcode IN
+                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+                         close=")">
+                    #{leavehospitaldistrictcode}
+                </foreach>
+            </if>
+            <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
+                AND b.leaveldeptcode IN
+                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
+                         close=")">
+                    #{leaveldeptcode}
+                </foreach>
             </if>
         </where>
-        order by update_time desc
+        order by b.inhospid desc
     </select>
+
+    <select id="selectPatMedInhospListByCondition" parameterType="com.smartor.domain.PatMedInhospVO"
+            resultMap="PatMedInhospResult">
+        select CONCAT( a.age, a.age_unit ) AS age,
+        a.telcode as telcode,
+        b.inhospid,
+        b.patname,
+        b.out_way_id,
+        b.out_way_name,
+        b.nurse_id,
+        b.nurse_name,
+        b.check_flag,
+        b.inhospstate,
+        b.patno,
+        b.inhospno,
+        b.serialnum,
+        b.hospitalname,
+        b.hospitalcode,
+        b.hospitaldistrictcode,
+        b.hospitaldistrictname,
+        b.icd10code,
+        b.diagname,
+        b.starttime,
+        b.endtime,
+        b.deptcode,
+        b.deptname,
+        b.roomno,
+        b.bed_no,
+        b.orgid,
+        b.del_flag,
+        b.update_by,
+        b.update_time,
+        b.create_by,
+        b.create_time,
+        b.isupload,
+        b.upload_time,
+        b.patid,
+        b.leavediagname,
+        b.leaveicd10code,
+        b.drcode,
+        b.drname,
+        b.schemestatus,
+        b.generalschemestatus,
+        b.leaveldeptcode,
+        b.leaveldeptname,
+        b.hospitaldistrictid,
+        b.leavehospitaldistrictcode,
+        b.leavehospitaldistrictname,
+        b.leavehospitaldistrictid,
+        b.deptid,
+        b.leaveldeptid,
+        b.long_task_reason,
+        b.schemetime
+        FROM
+        pat_med_inhosp b,
+        pat_archive a
+        <where>
+            a.del_flag=0
+            and b.del_flag=0
+            and a.id = b.patid
+            AND a.idcardno != ''
+            <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
+                '%')
+            </if>
+            <if test="patname != null  and patname != ''">and patname like concat('%', #{patname}, '%')</if>
+            <if test="hospitaldistrictname != null  and hospitaldistrictname != ''">and hospitaldistrictname like
+                concat('%', #{hospitaldistrictname}, '%')
+            </if>
+            <if test="endtime != null ">and b.endtime = #{endtime}</if>
+            <if test="nurseId != null ">and b.nurse_id = #{nurseId}</if>
+            <if test="nurseName != null ">and b.nurse_name = #{nurseName}</if>
+            <if test="patno != null ">and b.patno = #{patno}</if>
+            <if test="checkFlag != null ">and b.check_flag = #{checkFlag}</if>
+            <if test="inhospstate != null ">and b.inhospstate = #{inhospstate}</if>
+            <if test="schemestatus != null ">and b.schemestatus = #{schemestatus}</if>
+            <if test="leavediagname != null  and leavediagname != ''">and b.leavediagname like concat('%',
+                #{leavediagname}, '%')
+            </if>
+            <if test="drname != null  and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
+            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
+                AND b.leavehospitaldistrictcode IN
+                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+                         close=")">
+                    #{leavehospitaldistrictcode}
+                </foreach>
+            </if>
+            <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
+                AND b.leaveldeptcode IN
+                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
+                         close=")">
+                    #{leaveldeptcode}
+                </foreach>
+            </if>
+        </where>
+        order by b.inhospid desc
+    </select>
+
 
     <select id="selectPatMedInhospByInhospid" parameterType="Long" resultMap="PatMedInhospResult">
         <include refid="selectPatMedInhospVo"/>
@@ -176,6 +383,11 @@
             <if test="patno != null">patno,</if>
             <if test="inhospstate != null">inhospstate,</if>
             <if test="checkFlag != null">check_flag,</if>
+            <if test="longTaskReason != null">long_task_reason,</if>
+            <if test="nurseId != null ">nurse_id,</if>
+            <if test="nurseName != null ">nurse_name,</if>
+            <if test="outWayId != null ">out_way_id,</if>
+            <if test="outWayName != null ">out_way_name,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="serialnum != null">#{serialnum},</if>
@@ -219,6 +431,11 @@
             <if test="patno != null">#{patno},</if>
             <if test="inhospstate != null">#{inhospstate},</if>
             <if test="checkFlag != null">#{checkFlag},</if>
+            <if test="longTaskReason != null">#{longTaskReason},</if>
+            <if test="nurseId != null ">#{nurseId},</if>
+            <if test="nurseName != null ">#{nurseName},</if>
+            <if test="outWayId != null ">#{outWayId},</if>
+            <if test="outWayName != null ">#{outWayName},</if>
         </trim>
     </insert>
 
@@ -266,16 +483,31 @@
             <if test="patno != null">patno = #{patno},</if>
             <if test="inhospstate != null">inhospstate = #{inhospstate},</if>
             <if test="checkFlag != null">check_flag = #{checkFlag},</if>
+            <if test="longTaskReason != null">long_task_reason = #{longTaskReason},</if>
+            <if test="nurseId != null ">nurse_id = #{nurseId},</if>
+            <if test="nurseName != null ">nurse_name = #{nurseName},</if>
+            <if test="outWayId != null ">out_way_id = #{outWayId},</if>
+            <if test="outWayName != null ">out_way_name = #{outWayName},</if>
         </trim>
         where inhospid = #{inhospid}
     </update>
 
     <delete id="deletePatMedInhospByInhospid" parameterType="Long">
-        delete
-        from pat_med_inhosp
+        update pat_med_inhosp
+        <trim prefix="SET" suffixOverrides=",">
+            del_flag =1
+        </trim>
         where inhospid = #{inhospid}
     </delete>
 
+    <delete id="deletePatMedInhospByInhospno" parameterType="String">
+        update pat_med_inhosp
+        <trim prefix="SET" suffixOverrides=",">
+            del_flag =1
+        </trim>
+        where inhospno = #{inhospno}
+    </delete>
+
     <delete id="deletePatMedInhospByInhospids" parameterType="String">
         delete from pat_med_inhosp where inhospid in
         <foreach item="inhospid" collection="array" open="(" separator="," close=")">

--
Gitblit v1.9.3