From c3395d01203fd57d191b36f3410f8ae6e6aafd09 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 22 一月 2026 16:41:00 +0800
Subject: [PATCH] 【丽水】getSfStatistics、getSfStatisticsScript 优化

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 30e4c15..b5588c7 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -1255,6 +1255,61 @@
             <!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
             <if test="type != null">
                 and type = #{type}
+        </if>
+        <if test="groupKey != null and groupKey != '' and groupKeyList != null and groupKeyList.size>0">
+            AND ${groupKey} IN
+            <foreach collection="groupKeyList" item="key" open="(" separator=","
+                     close=")">
+                #{key}
+            </foreach>
+        </if>
+    </select>
+    <select id="getSfStatisticsGroupKey" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
+            resultType="String">
+            select
+            <if test="groupKey != null and groupKey != ''">
+                ${groupKey} as groupKey
+            </if>
+            from service_subtask
+            where 1=1
+            and del_flag = 0
+            <if test="orgid != null and orgid != ''">
+            and orgid = #{orgid}
+            </if>
+            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
+            AND leavehospitaldistrictcode IN
+            <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="(" separator=","
+                     close=")">
+                #{leavehospitaldistrictcode}
+            </foreach>
+            </if>
+            <if test="deptcodes != null and deptcodes.size() > 0">
+            AND deptcode IN
+            <foreach collection="deptcodes" item="deptcode" open="(" separator=","
+                     close=")">
+                #{deptcode}
+            </foreach>
+            </if>
+            <if test="serviceType != null and serviceType.size() > 0">
+            AND service_type IN
+            <foreach collection="serviceType" item="serviceType" open="(" separator=","
+                     close=")">
+                #{serviceType}
+            </foreach>
+            </if>
+            <if test="startTime != null and endTime!=null">
+            AND visit_time >= DATE(#{startTime})
+            AND visit_time &lt; DATE_ADD(DATE(#{endTime}), INTERVAL 1 DAY)
+            </if>
+            <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
+            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
+            <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
+            <!-- 鐩墠鍙粺璁¤闊冲拰闂嵎 -->
+            <if test="type != null">
+            and type = #{type}
+            </if>
+            <if test="groupKey != null and groupKey != ''">
+                group by ${groupKey}
             </if>
             <if test="pageSize != null  and pageNum != null">
                 limit ${pageSize} OFFSET ${pageNum}

--
Gitblit v1.9.3