From ec23ec3d3dc4ec1ba7d79ba4f46ae2c31d5a16a9 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 07 一月 2026 10:49:10 +0800
Subject: [PATCH] 【市一】调整mapper获取ordid

---
 smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
index 68bc33f..2034557 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -121,19 +121,20 @@
         pmo.patname,
         pmo.mainsuit
         from pat_med_outhosp pmo
-        <where>
-            pmo.del_flag=0
+        WHERE 1=1
+
+            AND pmo.del_flag=0
             <if test="orgid != null ">and pmo.orgid = #{orgid}</if>
             <if test="serialnum != null ">and pmo.serialnum = #{serialnum}</if>
             <if test="serverState != null ">and pmo.server_state = #{serverState}</if>
             <if test="hospitalname != null  and hospitalname != ''">and pmo.hospitalname like concat('%',
                 #{hospitalname},
-                '%')
+                AND '%')
             </if>
             <if test="deptcodes != null and deptcodes.size()>0">
                 AND pmo.deptcode IN
                 <foreach collection="deptcodes" item="deptcode" open="(" separator=","
-                         close=")">
+                         AND close=")">
                     #{deptcode}
                 </foreach>
             </if>
@@ -141,10 +142,10 @@
             <if test="drname != null  and drname != ''">and pmo.drname like concat('%', #{drname}, '%')</if>
             <if test="patname != null  and patname != ''">and pmo.patname like concat('%', #{patname}, '%')</if>
             <if test="beginTime != null ">and date_format(pmo.admitdate,'%y%m%d') &gt;=
-                date_format(#{beginTime},'%y%m%d')
+                AND date_format(#{beginTime},'%y%m%d')
             </if>
             <if test="endTime != null ">and date_format(pmo.admitdate,'%y%m%d') &lt;=
-                date_format(#{endTime},'%y%m%d')
+                AND date_format(#{endTime},'%y%m%d')
             </if>
             <if test="patid != null ">and pmo.patid = #{patid}</if>
             <if test="campusid != null ">and pmo.campusid = #{campusid}</if>
@@ -153,7 +154,7 @@
             <if test="outhospno != null  and outhospno != ''">and pmo.outhospno = #{outhospno}</if>
             <if test="diagcheckFlag != null  and diagcheckFlag != ''">and pmo.diagcheck_flag = #{diagcheckFlag}</if>
             <if test="diagname != null  and diagname != ''">and pmo.diagname like concat('%',#{diagname}, '%')</if>
-        </where>
+        
         order by pmo.update_time desc
     </select>
 
@@ -460,8 +461,9 @@
         0 AS rs
         FROM
         pat_med_outhosp
-        <where>
-            del_flag=0
+        WHERE 1=1
+
+            AND del_flag=0
             <if test="orgid != null">
                 and orgid = #{orgid}
             </if>
@@ -473,15 +475,16 @@
                     #{deptcode}
                 </foreach>
             </if>
-        </where>
+        
         union all
         select
         0 AS rc,
         count(1) AS rs
         FROM
         service_subtask
-        <where>
-            del_flag = 0
+        WHERE 1=1
+
+            AND del_flag = 0
             and service_type=3
             <if test="orgid != null">
                 and orgid = #{orgid}
@@ -498,15 +501,16 @@
                     #{deptcode}
                 </foreach>
             </if>
-        </where>
+        
         ) AS combined_data
     </select>
 
     <select id="getDeptRanking" parameterType="com.smartor.domain.PatMedReq" resultType="com.smartor.domain.PatMedRes">
         SELECT deptname, COUNT(1) AS rc
         FROM pat_med_outhosp
-        <where>
-            del_flag=0
+        WHERE 1=1
+
+            AND del_flag=0
             <if test="inhospstate != null">
                 and inhospstate= #{inhospstate}
             </if>
@@ -519,7 +523,7 @@
                     #{deptcode}
                 </foreach>
             </if>
-        </where>
+        
     </select>
 
     <!-- PatMedOuthospMapper.xml -->

--
Gitblit v1.9.3