From 78c9129e9045fafe4c2f7333b3dcafde6b20b96d Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 05 十二月 2024 15:20:51 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index 079bde5..997a089 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -49,6 +49,7 @@
         <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"/>
@@ -112,6 +113,7 @@
     <select id="selectPatMedInhospList" parameterType="com.smartor.domain.PatMedInhosp" resultMap="PatMedInhospResult">
         select CONCAT( a.age, a.age_unit ) AS age,
         a.telcode as telcode,
+        a.sex,
         b.inhospid,
         b.nurse_id,
         b.nurse_name,
@@ -168,6 +170,20 @@
             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>
@@ -176,10 +192,15 @@
                 concat('%', #{hospitaldistrictname}, '%')
             </if>
             <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>
@@ -191,8 +212,25 @@
             <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
                 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 b.inhospid desc
@@ -276,14 +314,14 @@
                 #{leavediagname}, '%')
             </if>
             <if test="drname != null  and drname != ''">and b.drname like concat('%', #{drname}, '%')</if>
-            <if test="leavehospitaldistrictcodes != null">
+            <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">
+            <if test="leaveldeptcodes != null and leaveldeptcodes.size()>0">
                 AND b.leaveldeptcode IN
                 <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                          close=")">
@@ -455,11 +493,21 @@
     </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