From f2fae5a8c221528977fe90789f00a895ced212c3 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 23 三月 2026 17:16:03 +0800
Subject: [PATCH] 新增病区与科室组合

---
 smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml |  116 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
index ea37b26..ed9d355 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveOutMapper.xml
@@ -76,35 +76,34 @@
     <select id="selectPatArchiveOutList" parameterType="com.smartor.domain.PatArchiveOut"
             resultMap="PatArchiveOutResult">
         <include refid="selectPatArchiveOutVo"/>
-        <where>
-            <if test="patientno != null  and patientno != ''">and patientno = #{patientno}</if>
-            <if test="pattype != null  and pattype != ''">and pattype = #{pattype}</if>
-            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
-            <if test="sex != null ">and sex = #{sex}</if>
-            <if test="nation != null  and nation != ''">and nation = #{nation}</if>
-            <if test="nativePlace != null  and nativePlace != ''">and native_place = #{nativePlace}</if>
-            <if test="placeOfResidence != null  and placeOfResidence != ''">and place_of_residence =
-                #{placeOfResidence}
-            </if>
-            <if test="birthplace != null  and birthplace != ''">and birthplace = #{birthplace}</if>
-            <if test="idcardno != null  and idcardno != ''">and idcardno = #{idcardno}</if>
-            <if test="birthdate != null ">and birthdate = #{birthdate}</if>
-            <if test="age != null ">and age = #{age}</if>
-            <if test="archivetime != null ">and archivetime = #{archivetime}</if>
-            <if test="archiveby != null  and archiveby != ''">and archiveby = #{archiveby}</if>
-            <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
-            <if test="relativetelcode != null  and relativetelcode != ''">and relativetelcode = #{relativetelcode}</if>
-            <if test="idcardtype != null  and idcardtype != ''">and idcardtype = #{idcardtype}</if>
-            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
-            <if test="openid != null  and openid != ''">and openid = #{openid}</if>
-            <if test="dduserid != null  and dduserid != ''">and dduserid = #{dduserid}</if>
-            <if test="source != null ">and source = #{source}</if>
-            <if test="isupload != null ">and isupload = #{isupload}</if>
-            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
-            <if test="pid != null ">and pid = #{pid}</if>
-            <if test="guid != null  and guid != ''">and guid = #{guid}</if>
-            <if test="membertype != null  and membertype != ''">and membertype = #{membertype}</if>
-        </where>
+        where 1=1
+        <if test="patientno != null  and patientno != ''">and patientno = #{patientno}</if>
+        <if test="pattype != null  and pattype != ''">and pattype = #{pattype}</if>
+        <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
+        <if test="sex != null ">and sex = #{sex}</if>
+        <if test="nation != null  and nation != ''">and nation = #{nation}</if>
+        <if test="nativePlace != null  and nativePlace != ''">and native_place = #{nativePlace}</if>
+        <if test="placeOfResidence != null  and placeOfResidence != ''">and place_of_residence =
+            #{placeOfResidence}
+        </if>
+        <if test="birthplace != null  and birthplace != ''">and birthplace = #{birthplace}</if>
+        <if test="idcardno != null  and idcardno != ''">and idcardno = #{idcardno}</if>
+        <if test="birthdate != null ">and birthdate = #{birthdate}</if>
+        <if test="age != null ">and age = #{age}</if>
+        <if test="archivetime != null ">and archivetime = #{archivetime}</if>
+        <if test="archiveby != null  and archiveby != ''">and archiveby = #{archiveby}</if>
+        <if test="telcode != null  and telcode != ''">and telcode = #{telcode}</if>
+        <if test="relativetelcode != null  and relativetelcode != ''">and relativetelcode = #{relativetelcode}</if>
+        <if test="idcardtype != null  and idcardtype != ''">and idcardtype = #{idcardtype}</if>
+        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="openid != null  and openid != ''">and openid = #{openid}</if>
+        <if test="dduserid != null  and dduserid != ''">and dduserid = #{dduserid}</if>
+        <if test="source != null ">and source = #{source}</if>
+        <if test="isupload != null ">and isupload = #{isupload}</if>
+        <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
+        <if test="pid != null ">and pid = #{pid}</if>
+        <if test="guid != null  and guid != ''">and guid = #{guid}</if>
+        <if test="membertype != null  and membertype != ''">and membertype = #{membertype}</if>
     </select>
 
     <select id="selectPatArchiveOutByPatid" parameterType="Long" resultMap="PatArchiveOutResult">
@@ -116,37 +115,38 @@
         select aa.name1 as name, aa.count as count
         from (
         SELECT "浣忛櫌" as name1, count(1) as count FROM `pat_med_inhosp`
-        <where>
-            del_flag = 0 and endtime = null
-            <if test="deptIds != null ">and deptId in
-                <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
-                    #{deptId}
-                </foreach>
-            </if>
-            <if test="drCodes != null ">and drcode in
-                <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
-                    #{drCode}
-                </foreach>
-            </if>
-        </where>
+        where 1=1
+        and del_flag = 0 and endtime = null
+        <if test="orgid != null and orgid != ''">
+            AND orgid = #{orgid}
+        </if>
+        <if test="deptcodes != null ">and deptcode in
+            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+                #{deptcode}
+            </foreach>
+        </if>
+        <if test="drCodes != null ">and drcode in
+            <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
+                #{drCode}
+            </foreach>
+        </if>
         union
         select "鍑洪櫌" name1, count(1) as count FROM `pat_med_inhosp`
-        <where>
-            del_flag=0 and endtime != null
-            <if test="deptIds != null ">and deptId in
-                <foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
-                    #{deptId}
-                </foreach>
-            </if>
-            <if test="drCodes != null ">and drcode in
-                <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
-                    #{drCode}
-                </foreach>
-            </if>
-        </where>
-        union
-        select "闂ㄨ瘖" name1, count(1) as count FROM `pat_med_outhosp`
-        where del_flag=0
+        where 1=1
+        and del_flag = 0 and endtime != null
+        <if test="orgid != null and orgid != ''">
+            AND orgid = #{orgid}
+        </if>
+        <if test="deptcodes != null ">and leaveldeptcode in
+            <foreach collection="deptcodes" item="deptcode" open="(" separator="," close=")">
+                #{deptcode}
+            </foreach>
+        </if>
+        <if test="drCodes != null ">and drcode in
+            <foreach collection="drCodes" item="drCode" open="(" separator="," close=")">
+                #{drCode}
+            </foreach>
+        </if>
         ) aa
 
     </select>

--
Gitblit v1.9.3