From a77bf9fb4718d1b657f8ef8c6edfaffa1a53683f Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期五, 06 二月 2026 17:01:20 +0800
Subject: [PATCH] 处理数据查询慢的问题

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

diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index a479da0..2ed1573 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -567,6 +567,8 @@
         SUM(CASE WHEN DATE(visit_time) &lt; DATE(IFNULL(finishtime, NOW())) THEN 1 ELSE 0 END) / COUNT(*) as rate
         FROM service_subtask
         WHERE del_flag = 0
+        AND visit_time IS NOT NULL
+        AND finishtime IS NOT NULL
         <if test="orgid != null">AND orgid = #{orgid}</if>
         <if test="starttime == null and endtime==null">
             AND visit_time &lt; NOW()
@@ -1216,7 +1218,39 @@
 
     <select id="getSfStatistics" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
             resultMap="ServiceSubtaskResult">
-        <include refid="selectServiceSubtaskVo"/>
+        select id,
+        visit_count,
+        is_visit_again,
+        type,
+        orgid,
+        drcode,
+        drname,
+        leavehospitaldistrictcode,
+        leavehospitaldistrictname,
+        deptcode,
+        deptname,
+        sendstate,
+        preachform,
+        excep,
+        nurse_id,
+        nurse_name,
+        taskid,
+        task_name,
+        visit_time,
+        finishtime,
+        endtime,
+        senddate,
+        suggest,
+        result,
+        templateid,
+        templatename,
+        patid,
+        sendname,
+        send_type,
+        recordid,
+        exrecallcount,
+        task_situation
+        from service_subtask
         where 1=1
         and del_flag = 0
         <if test="orgid != null and orgid != ''">
@@ -1983,7 +2017,8 @@
         SUM(CASE WHEN sendstate >= 3 OR sendstate = 1 THEN 1 ELSE 0 END) AS yfs,
         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 != '0' THEN 1 ELSE 0 END) AS yc
+        SUM(CASE WHEN excep IS NOT NULL AND excep != '0' THEN 1 ELSE 0 END) AS yc,
+        SUM(CASE WHEN isabnormal IS NOT NULL AND isabnormal = 2 THEN 1 ELSE 0 END) AS jg
         FROM service_subtask
         where 1=1
         and del_flag = 0

--
Gitblit v1.9.3