From 67d934b740862de1db1951137b5590410f3eb92b Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 15 八月 2025 13:34:39 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index c02bd2d..e1d9330 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1227,8 +1227,12 @@
         0 AS pmiCount,
         0 AS pmoCount
         FROM service_subtask
-        WHERE visit_time BETWEEN #{startDate} AND #{endDate}
-        AND del_flag = '0'
+        WHERE
+        del_flag = '0'
+        <if test="startDate != null and endDate != null">
+            and date_format(visit_time,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
+            and date_format(visit_time,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
+        </if>
 
         <if test="orgid != null">
             AND orgid = #{orgid}
@@ -1297,12 +1301,16 @@
         </choose>
         0 AS dischargeFollowCount,
         0 AS outpatientFollowCount,
-        COUNT(DISTINCT patid) AS pmiCount,
+        COUNT( patid) AS pmiCount,
         0 AS pmoCount
         FROM pat_med_inhosp
-        WHERE endtime BETWEEN #{startDate} AND #{endDate}
-        AND del_flag = '0'
+        WHERE del_flag = '0'
+        <if test="startDate != null and endDate != null">
+            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>
 
+        AND inhospstate=1
         <if test="orgid != null">
             AND orgid = #{orgid}
         </if>
@@ -1364,11 +1372,13 @@
         0 AS dischargeFollowCount,
         0 AS outpatientFollowCount,
         0 AS pmiCount,
-        COUNT(DISTINCT patid) AS pmoCount
+        COUNT( patid) AS pmoCount
         FROM pat_med_outhosp
-        WHERE admitdate BETWEEN #{startDate} AND #{endDate}
-        AND del_flag = '0'
-
+        WHERE del_flag = '0'
+        <if test="startDate != null and endDate != null">
+            and date_format(admitdate,'%y%m%d') &gt;= date_format(#{startDate},'%y%m%d')
+            and date_format(admitdate,'%y%m%d') &lt;= date_format(#{endDate},'%y%m%d')
+        </if>
         <if test="orgid != null">
             AND orgid = #{orgid}
         </if>

--
Gitblit v1.9.3