From a8e7794212a6283a4a0633e5cb6ad9620e3bbc26 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 25 十一月 2026 16:53:45 +0800
Subject: [PATCH] 【丽水】随访统计及时率修正

---
 ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml b/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml
index 93d3c3d..ffc858d 100644
--- a/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml
+++ b/ruoyi-task/src/main/resources/mapper/task/ServiceSubtaskMapper.xml
@@ -1013,7 +1013,9 @@
         ), '%y%m%d' ) )
         THEN 1 ELSE 0 END ) finished,1 AS tasknumber FROM service_subtask
         WHERE del_flag=0
-        <if test="starttime == null and endtime==null">
+        <!-- 鍙湁鏈寚瀹氫换浣曟椂闂磋寖鍥存椂鎵嶉粯璁ゅ彧缁熻宸插埌鏈熶换鍔★紱
+             鍙寜鍑洪櫌鏃堕棿鏌ヨ鏃朵笉鑳藉啀鎺掗櫎鏈潵 visit_time锛屽惁鍒欏強鏃剁巼鍒嗘瘝涓庝富琛ㄤ笉涓�鑷淬�� -->
+        <if test="starttime == null and endtime == null and startOutHospTime == null and endOutHospTime == null">
             AND visit_time &lt; NOW()
         </if>
         <if test="starttime != null and endtime!=null">
@@ -1105,7 +1107,9 @@
         WHERE ss.del_flag = 0
         AND ss.visit_time IS NOT NULL
         AND ss.sendstate != 4
-        <if test="starttime == null and endtime==null">
+        <!-- 鍙湁鏈寚瀹氫换浣曟椂闂磋寖鍥存椂鎵嶉粯璁ゅ彧缁熻宸插埌鏈熶换鍔★紱
+             鍙寜鍑洪櫌鏃堕棿鏌ヨ鏃朵笉鑳藉啀鎺掗櫎鏈潵 visit_time锛屽惁鍒欏強鏃剁巼鍒嗘瘝涓庝富琛ㄤ笉涓�鑷淬�� -->
+        <if test="starttime == null and endtime == null and startOutHospTime == null and endOutHospTime == null">
             AND DATE(ss.visit_time) &lt; DATE(NOW())
         </if>
         <if test="starttime != null and endtime!=null">
@@ -2130,10 +2134,28 @@
         where 1=1
         and a.del_flag = '0'
         and b.del_flag = '0'
-        and a.appltype = '3'
+        <!-- 涓撶梾缁熻锛氬崟鐥呯浠诲姟(appltype=3) + 涓撶梾浠诲姟缁�(appltype=5) -->
+        and (
+            a.appltype = '3'
+            or (
+                a.appltype = '5'
+                and (
+                    a.hosp_type = '3'
+                    or (a.diag_type is not null and a.diag_type &lt;&gt; '')
+                    or exists (
+                        select 1
+                        from service_task_schedule s
+                        where s.taskid = a.taskid
+                          and s.del_flag = '0'
+                          and s.icd10_codes is not null
+                          and s.icd10_codes &lt;&gt; ''
+                    )
+                )
+            )
+        )
         <if test="orgid != null and orgid != ''">and a.orgid = #{orgid}</if>
         <if test="campusid != null and campusid != ''">and b.campusid = #{campusid}</if>
-        <if test="taskId != null">and a.task_id = #{taskId}</if>
+        <if test="taskId != null">and a.taskid = #{taskId}</if>
         <if test="taskName != null and taskName != ''">
             and a.task_name like concat('%', #{taskName}, '%')
         </if>
@@ -2141,7 +2163,7 @@
             and a.diag_type = #{diagType}
         </if>
         <if test="taskIds != null and taskIds.size() > 0">
-            AND a.task_id IN
+            AND a.taskid IN
             <foreach collection="taskIds" item="taskIdItem" open="(" separator=","
                      close=")">
                 #{taskIdItem}

--
Gitblit v1.9.3