From 38e0cad3107b0a43e9afac4e5e55cf769e84d01c Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期三, 09 七月 2025 16:58:18 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 533dd4c..5e154e3 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -909,10 +909,15 @@
             </if>
             <if test="patid != null  and patid != ''">AND a.id = #{patid}</if>
             <if test="telcode != null  and telcode != ''">AND a.telcode LIKE concat('%', #{telcode}, '%')</if>
-            <if test="notrequiredFlag != null and notrequiredFlag != ''">AND a.notrequired_flag = #{notrequiredFlag}</if>
+            <if test="notrequiredFlag != null and notrequiredFlag != ''">AND a.notrequired_flag = #{notrequiredFlag}
+            </if>
             <if test="hospitalname != null and hospitalname != ''">AND d.hospitalname = #{hospitalname}</if>
-            <if test="hospitaldistrictname != null and hospitaldistrictname != ''">AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')</if>
-            <if test="leaveicd10code != null and leaveicd10code != ''">AND d.leaveicd10code LIKE concat('%',#{leaveicd10code}, '%')</if>
+            <if test="hospitaldistrictname != null and hospitaldistrictname != ''">AND d.hospitaldistrictname LIKE
+                concat('%',#{hospitaldistrictname}, '%')
+            </if>
+            <if test="leaveicd10code != null and leaveicd10code != ''">AND d.leaveicd10code LIKE
+                concat('%',#{leaveicd10code}, '%')
+            </if>
             <if test="endtime != null">AND d.endtime = #{endtime}</if>
             <if test="cry != null and cry == 0 ">AND d.endtime IS NULL</if>
             <if test="cry != null and cry == 1 ">AND d.endtime IS NOT NULL</if>
@@ -922,11 +927,18 @@
             <if test="diagname != null and diagname != ''">AND d.diagname LIKE concat('%',#{diagname}, '%')</if>
             <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
                 AND d.leavehospitaldistrictcode IN
-                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator="," close=")">
+                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+                         close=")">
                     #{leavehospitaldistrictcode}
                 </foreach>
             </if>
-            <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0">
+            <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0 and leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size()>0">
+                OR d.leaveldeptcode IN
+                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")">
+                    #{leaveldeptcode}
+                </foreach>
+            </if>
+            <if test="leaveldeptcodes != null and leaveldeptcodes.size() > 0 and leavehospitaldistrictcodes == null">
                 AND d.leaveldeptcode IN
                 <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator="," close=")">
                     #{leaveldeptcode}
@@ -934,7 +946,8 @@
             </if>
             <if test="hospitaldistrictcodes != null and hospitaldistrictcodes.size()>0">
                 AND d.hospitaldistrictcode IN
-                <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator="," close=")">
+                <foreach collection="hospitaldistrictcodes" item="hospitaldistrictcode" open="(" separator=","
+                         close=")">
                     #{hospitaldistrictcode}
                 </foreach>
             </if>

--
Gitblit v1.9.3