From 664a2be2c744123181f9dda3a21f026bcb9f5692 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 22 四月 2026 09:47:11 +0800
Subject: [PATCH] 【丽水】获取随访及时率 增加serviceType

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 1d0753e..1c33426 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -263,7 +263,7 @@
     <select id="selectServiceSubtaskList" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
             resultMap="ServiceSubtaskResult">
         <include refid="selectServiceSubtaskVo"/>
-        where  del_flag = 0
+        where del_flag = 0
         <if test="continueFlag != null ">and continue_flag = #{continueFlag}</if>
         <if test="continueTimeNow != null ">and continue_time_now = #{continueTimeNow,jdbcType=TIMESTAMP}</if>
         <if test="continueCount != null ">and continue_count = #{continueCount}</if>
@@ -344,8 +344,9 @@
             </if>
         </if>
         <if test="deptOrDistrict==2">
+            AND (1=1
             <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
-                AND (leavehospitaldistrictcode IN
+                AND leavehospitaldistrictcode IN
                 <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                          separator=","
                          close=")">
@@ -355,14 +356,15 @@
             <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
                 OR deptcode IN
                 <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
-                         close="))">
+                         close=")">
                     #{leaveldeptcode}
                 </foreach>
-            </if>
+            </if>)
         </if>
         <if test="deptOrDistrict==3">
+            AND (1=1
             <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
-                AND (leavehospitaldistrictcode IN
+                AND leavehospitaldistrictcode IN
                 <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                          separator=","
                          close=")">
@@ -370,17 +372,19 @@
                 </foreach>
             </if>
             <if test=" visitDeptCodes != null and visitDeptCodes.size()>0">
-                and visit_dept_code IN
+                AND visit_dept_code IN
                 <foreach collection="visitDeptCodes" item="visitDeptCode" open="(" separator=","
-                         close="))">
+                         close=")">
                     #{visitDeptCode}
                 </foreach>
             </if>
+            )
         </if>
 
         <if test="deptOrDistrict==4">
+            AND (1=1
             <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
-                AND (leavehospitaldistrictcode IN
+                AND leavehospitaldistrictcode IN
                 <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                          separator=","
                          close=")">
@@ -390,10 +394,11 @@
             <if test=" visitDeptCodes != null and visitDeptCodes.size()>0">
                 OR visit_dept_code IN
                 <foreach collection="visitDeptCodes" item="visitDeptCode" open="(" separator=","
-                         close="))">
+                         close=")">
                     #{visitDeptCode}
                 </foreach>
             </if>
+            )
         </if>
 
         <if test="visitTime != null">
@@ -641,6 +646,8 @@
             AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
         </if>
         <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
+        <if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
         <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
         <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
         <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
@@ -720,6 +727,8 @@
             AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
         </if>
         <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
+        <if test="serviceType != null and serviceType != ''">and service_type = #{serviceType}</if>
+        <if test="serviceTypes != null and serviceTypes != ''">and service_type IN (#{serviceTypes})</if>
         <if test="isabnormal != null ">and isabnormal = #{isabnormal}</if>
         <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
         <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
@@ -1238,6 +1247,9 @@
             <if test="continueContent != null ">continue_content = #{continueContent},</if>
         </trim>
         where patid = #{patid} and taskid = #{taskid}
+        <if test="id != null ">
+            and id = #{id}
+        </if>
     </update>
 
     <update id="updateServiceSubtaskByTaskGuid" parameterType="com.smartor.domain.ServiceSubtask">
@@ -2127,7 +2139,8 @@
         SUM(CASE WHEN sendstate = 2 THEN 1 ELSE 0 END) AS dsf,
         SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq,
         SUM(CASE WHEN excep IS NOT NULL AND excep = '1' THEN 1 ELSE 0 END) AS yc,
-        SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg
+        SUM(CASE WHEN excep IS NOT NULL AND excep = '2' THEN 1 ELSE 0 END) AS jg,
+        COUNT(1) as total
         FROM service_subtask
         where 1=1
         and del_flag = 0
@@ -2413,4 +2426,62 @@
         </if>
     </select>
 
+    <!--
+        鎸夌梾鍖烘垨绉戝鍒嗙粍缁熻 continue_flag 鏁伴噺
+        浼犱簡 leavehospitaldistrictcodes 鈫� 鎸夌梾鍖虹淮搴�
+        浼犱簡 deptcodes              鈫� 鎸夌瀹ょ淮搴�
+        閮戒笉浼�                     鈫� 鎸夌梾鍖虹淮搴︾粺璁″叏閲�
+    -->
+    <!-- 鎸夌梾鍖哄垎缁勭粺璁″欢缁姢鐞嗘暟閲� -->
+    <select id="getContinueNurseCount"
+            parameterType="com.smartor.domain.VO.ServiceSubtaskCotinueCountVO"
+            resultType="java.util.Map">
+        SELECT
+        leavehospitaldistrictcode AS groupCode,
+        leavehospitaldistrictname AS groupName,
+        SUM(CASE WHEN continue_flag = 1 THEN 1 ELSE 0 END) AS noContinueCnt,
+        SUM(CASE WHEN continue_flag = 2 THEN 1 ELSE 0 END) AS continueCnt
+        FROM service_subtask
+        WHERE del_flag = 0
+        AND continue_flag IN (1, 2)
+        AND leavehospitaldistrictcode IS NOT NULL AND leavehospitaldistrictcode != ''
+        <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="code" open="(" separator="," close=")">
+                #{code}
+            </foreach>
+        </if>
+        GROUP BY leavehospitaldistrictcode, leavehospitaldistrictname
+        ORDER BY groupCode
+    </select>
+
+    <!-- 鎸夌瀹ゅ垎缁勭粺璁″欢缁姢鐞嗘暟閲� -->
+    <select id="getContinueNurseCountByDept"
+            parameterType="com.smartor.domain.VO.ServiceSubtaskCotinueCountVO"
+            resultType="java.util.Map">
+        SELECT
+        deptcode AS groupCode,
+        deptname AS groupName,
+        SUM(CASE WHEN continue_flag = 1 THEN 1 ELSE 0 END) AS noContinueCnt,
+        SUM(CASE WHEN continue_flag = 2 THEN 1 ELSE 0 END) AS continueCnt
+        FROM service_subtask
+        WHERE del_flag = 0
+        AND continue_flag IN (1, 2)
+        AND deptcode IS NOT NULL AND deptcode != ''
+        <if test="orgid != null and orgid != ''">
+            AND orgid = #{orgid}
+        </if>
+        <if test="deptcodes != null and deptcodes.size() > 0">
+            AND deptcode IN
+            <foreach collection="deptcodes" item="code" open="(" separator="," close=")">
+                #{code}
+            </foreach>
+        </if>
+        GROUP BY deptcode, deptname
+        ORDER BY groupCode
+    </select>
+
 </mapper>

--
Gitblit v1.9.3