From 6f7e8d037e84b692ebcf786883138f5b35fb7343 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 02 四月 2026 11:14:53 +0800
Subject: [PATCH] 【丽水】门诊统计和首页数据对齐

---
 smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
index d44dd96..d6a5473 100644
--- a/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatMedInhospMapper.xml
@@ -212,8 +212,6 @@
         pat_med_inhosp b
         JOIN
         pat_archive a ON a.id = b.patid
-        LEFT JOIN
-        pat_archivetag c ON c.patid = a.id AND (c.del_flag = 0 OR c.del_flag IS NULL)
         where 1=1
         AND a.del_flag = 0
         AND b.del_flag = 0
@@ -871,28 +869,31 @@
         0 AS zbsf
         FROM
         pat_med_inhosp
+        JOIN
+        pat_archive ON pat_archive.id = pat_med_inhosp.patid
         where 1=1
-        and del_flag=0
+        and pat_med_inhosp.del_flag=0
         <if test="orgid != null and orgid != ''">
-            and orgid = #{orgid}
+            and pat_med_inhosp.orgid = #{orgid}
         </if>
+        AND pat_archive.idcardno IS NOT NULL
         <if test="zy != null">
-            and inhospstate=0
-            and date_format(starttime,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
-            and date_format(starttime,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
+            and pat_med_inhosp.inhospstate=0
+            and date_format(pat_med_inhosp.starttime,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
+            and date_format(pat_med_inhosp.starttime,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
             <if test="deptcodeList != null   and deptcodeList.size() > 0">
-                and deptcode in
+                and pat_med_inhosp.deptcode in
                 <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
                     #{deptcode}
                 </foreach>
             </if>
         </if>
         <if test="cy != null">
-            and inhospstate=1
-            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')
+            and pat_med_inhosp.inhospstate=1
+            and date_format(pat_med_inhosp.endtime,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
+            and date_format(pat_med_inhosp.endtime,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
             <if test="deptcodeList != null   and deptcodeList.size() > 0">
-                and leaveldeptcode in
+                and pat_med_inhosp.leaveldeptcode in
                 <foreach collection="deptcodeList" item="deptcode" open="(" separator="," close=")">
                     #{deptcode}
                 </foreach>

--
Gitblit v1.9.3