From 2935cf3cf897c02ce6ec90a5d42cce346e3e6630 Mon Sep 17 00:00:00 2001
From: zhs <zhs18203887318@163.com>
Date: 星期四, 31 七月 2025 19:23:47 +0800
Subject: [PATCH] 0731zhs

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

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index 053c52c..7d2406d 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -259,12 +259,16 @@
             <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="leaveldeptcode != null ">and b.leaveldeptcode = #{leaveldeptcode}</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="leaveldeptname != null  and leaveldeptname != ''">and b.leaveldeptname like concat('%',
                 #{leaveldeptname}, '%')
+            </if>
+            <if test="deptname != null  and deptname != ''">and b.deptname like concat('%',
+                #{deptname}, '%')
             </if>
             <if test="patid != null  and patid != ''">and a.id =#{patid}
             </if>
@@ -294,7 +298,12 @@
         a.telcode,
         a.id,
         a.sex
-        order by b.inhospid desc
+        <if test="cry==1">
+            order by b.endtime desc
+        </if>
+        <if test="cry==0">
+            order by b.starttime desc
+        </if>
     </select>
     <select id="selectPatMedInhospListByCondition" parameterType="com.smartor.domain.PatMedInhospVO"
             resultMap="PatMedInhospResult">
@@ -419,6 +428,9 @@
         <include refid="selectPatMedInhospVo"/>
         where inhospid = #{inhospid}
     </select>
+
+
+
 
     <insert id="insertPatMedInhosp" parameterType="com.smartor.domain.PatMedInhosp" useGeneratedKeys="true"
             keyProperty="inhospid">
@@ -549,6 +561,40 @@
         </trim>
     </insert>
 
+
+    <insert id="insertPatMedInhospBatch" parameterType="java.util.List"  useGeneratedKeys="true" keyProperty="item.inhospid">
+        insert into pat_med_inhosp (
+        serialnum, hospitalname, hospitalcode, hospitaldistrictcode, hospitaldistrictname,
+        icd10code, diagname, starttime, endtime, deptcode, deptname, roomno, bed_no,
+        orgid, del_flag, update_by, update_time, create_by, create_time, isupload,
+        upload_time, patid, leavediagname, leaveicd10code, drcode, drname,
+        schemestatus, generalschemestatus, leaveldeptcode, leaveldeptname, hospitaldistrictid,
+        leavehospitaldistrictcode, leavehospitaldistrictname, leavehospitaldistrictid,
+        deptid, leaveldeptid, schemetime, patname, patno, inhospstate,
+        deptcheck_flag, wardcheck_flag, diagcheck_flag, long_task_reason,
+        nurse_id, nurse_name, out_way_id, out_way_name, guid,
+        operator, operator_id, inhospno, remark,
+        fuflag, fudate, fuperiod, futypecode, futypedesc, fuadvice, fuspecialadvice
+        )
+        values
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.serialnum}, #{item.hospitalname}, #{item.hospitalcode}, #{item.hospitaldistrictcode}, #{item.hospitaldistrictname},
+            #{item.icd10code}, #{item.diagname}, #{item.starttime}, #{item.endtime}, #{item.deptcode}, #{item.deptname}, #{item.roomno}, #{item.bedNo},
+            #{item.orgid}, #{item.delFlag}, #{item.updateBy}, #{item.updateTime}, #{item.createBy}, #{item.createTime}, #{item.isupload},
+            #{item.uploadTime}, #{item.patid}, #{item.leavediagname}, #{item.leaveicd10code}, #{item.drcode}, #{item.drname},
+            #{item.schemestatus}, #{item.generalschemestatus}, #{item.leaveldeptcode}, #{item.leaveldeptname}, #{item.hospitaldistrictid},
+            #{item.leavehospitaldistrictcode}, #{item.leavehospitaldistrictname}, #{item.leavehospitaldistrictid},
+            #{item.deptid}, #{item.leaveldeptid}, #{item.schemetime}, #{item.patname}, #{item.patno}, #{item.inhospstate},
+            #{item.deptcheckFlag}, #{item.wardcheckFlag}, #{item.diagcheckFlag}, #{item.longTaskReason},
+            #{item.nurseId}, #{item.nurseName}, #{item.outWayId}, #{item.outWayName}, #{item.guid},
+            #{item.operator}, #{item.operatorId}, #{item.inhospno}, #{item.remark},
+            #{item.fuflag}, #{item.fudate}, #{item.fuperiod}, #{item.futypecode}, #{item.futypedesc}, #{item.fuadvice}, #{item.fuspecialadvice}
+            )
+        </foreach>
+    </insert>
+
+
     <update id="updatePatMedInhosp" parameterType="com.smartor.domain.PatMedInhosp">
         update pat_med_inhosp
         <trim prefix="SET" suffixOverrides=",">
@@ -646,7 +692,7 @@
             FROM pat_med_outhosp
             <where>
                 del_flag=0
-                <if test="deptcodeList != null">
+                <if test="deptcodeList != null   and deptcodeList.size() > 0">
                     and deptcode in
                     <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
                         #{deptcode}
@@ -663,7 +709,7 @@
             <where>
                 del_flag=0
                 and inhospstate=0
-                <if test="deptcodeList != null">
+                <if test="deptcodeList != null   and deptcodeList.size() > 0">
                     and deptcode in
                     <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
                         #{deptcode}
@@ -678,7 +724,7 @@
             <where>
                 del_flag=0
                 and inhospstate=1
-                <if test="deptcodeList != null">
+                <if test="deptcodeList != null   and deptcodeList.size() > 0">
                     and deptcode in
                     <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
                         #{deptcode}
@@ -693,7 +739,7 @@
             <where>
                 del_flag=0
                 and inhospstate=1
-                <if test="deptcodeList != null">
+                <if test="deptcodeList != null   and deptcodeList.size() > 0">
                     and deptcode in
                     <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
                         #{deptcode}
@@ -703,8 +749,6 @@
         </if>
         ) AS combined
         GROUP BY deptname;
-
-
     </select>
     <select id="selectPatMedInhospCount" parameterType="com.smartor.domain.PatMedReq"
             resultType="com.smartor.domain.PatMedRes">
@@ -725,7 +769,7 @@
                 and date_format(endtime,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
                 and date_format(endtime,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
             </if>
-            <if test="deptcodeList != null">
+            <if test="deptcodeList != null   and deptcodeList.size() > 0">
                 and deptcode in
                 <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
                     #{deptcode}

--
Gitblit v1.9.3