From 88d4cd31fa5b197a91ed081ba1df292420af2d05 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 22 十月 2026 16:48:52 +0800
Subject: [PATCH] 【丽水】随访统计增加一列,及时随访,统计未超时且已完成的随访人次

---
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java         |    7 +++++++
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java |   36 ++++++++++++++++++++++++++++++++++++
 smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java          |    6 ++++++
 smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml            |    7 ++++++-
 4 files changed, 55 insertions(+), 1 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
index 43b826b..bb9903c 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -165,6 +165,12 @@
     private String excep;
 
     /**
+     * 瀹屾垚鏃剁姸鎬� - 瓒呴摼鎺ョ粺璁★紙1-姝e父瀹屾垚 2-寤舵湡瀹屾垚 3-瓒呮椂瀹屾垚锛�
+     */
+    @ApiModelProperty(value = "瀹屾垚鏃剁姸鎬侊細1姝e父瀹屾垚 2寤舵湡瀹屾垚 3瓒呮椂瀹屾垚")
+    private Long finishState;
+
+    /**
      * 褰撳墠鍙戦�佹柟寮� - 瓒呴摼鎺ョ粺璁�
      */
     @ApiModelProperty("褰撳墠鍙戦�佹柟寮�")
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
index 744af7f..d57277b 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskStatistic.java
@@ -125,6 +125,10 @@
     @Excel(name = " 棣栨闅忚澶辫触 ")
     private Long followUpFail = 0L;
 
+    @ApiModelProperty(value = "鍙婃椂闅忚浜烘锛堝凡瀹屾垚涓旀湭瓒呮椂锛宖inish_state=1锛�")
+    @Excel(name = " 鍙婃椂闅忚浜烘 ")
+    private Long timelyFollowUp = 0L;
+
     @ApiModelProperty(value = "鍑洪櫌浜烘璇︽儏")
     private List<ServiceSubtask> dischargeCountInfo;
 
@@ -146,6 +150,9 @@
     @ApiModelProperty(value = "棣栨闅忚澶辫触璇︽儏")
     private List<ServiceSubtask> followUpFailInfo;
 
+    @ApiModelProperty(value = "鍙婃椂闅忚璇︽儏")
+    private List<ServiceSubtask> timelyFollowUpInfo;
+
     @ApiModelProperty(value = "棣栨闅忚浜哄伐璇︽儏")
     private List<ServiceSubtask> manualInfo;
 
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 301c40a..152cc66 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -3618,6 +3618,10 @@
                 if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
                     serviceSubtaskStatistic.setFollowUpNeeded(serviceSubtaskStatistic.getFollowUpNeeded() + 1L);
                 }
+                //鍙婃椂闅忚浜烘锛氬凡瀹屾垚涓旀湭瓒呮椂
+                if (isTimelyFollowUp(serviceSubtask)) {
+                    serviceSubtaskStatistic.setTimelyFollowUp(serviceSubtaskStatistic.getTimelyFollowUp() + 1L);
+                }
 
                 //浜哄伐宸叉嫧閫氭�婚噺
                 if (ObjectUtils.isNotEmpty(serviceSubtask.getIsManuallyCalled())
@@ -3886,6 +3890,19 @@
     }
 
     /**
+     * 鏄惁灞炰簬銆屽強鏃堕殢璁裤�嶏細闅忚宸插畬鎴愪笖瀹屾垚鏃剁姸鎬佷负姝e父瀹屾垚锛堟湭瓒呮椂锛夈��
+     * <p>
+     * finish_state锛�1-姝e父瀹屾垚 2-寤舵湡瀹屾垚 3-瓒呮椂瀹屾垚锛屽彧鏈� 1 璁″叆鍙婃椂闅忚銆�
+     *
+     * @param serviceSubtask 闅忚瀛愪换鍔�
+     * @return true-璁″叆鍙婃椂闅忚浜烘
+     */
+    private boolean isTimelyFollowUp(ServiceSubtask serviceSubtask) {
+        return serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L)
+                && serviceSubtask.getFinishState() != null && serviceSubtask.getFinishState().equals(1L);
+    }
+
+    /**
      * 棣栨闅忚缁熻
      *
      * @param serviceSubtaskList
@@ -3916,6 +3933,10 @@
             //搴旈殢璁夸汉娆�
             if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
                 serviceSubtaskStatistic.setFollowUpNeeded(serviceSubtaskStatistic.getFollowUpNeeded() + 1L);
+            }
+            //鍙婃椂闅忚浜烘锛氬凡瀹屾垚涓旀湭瓒呮椂
+            if (isTimelyFollowUp(serviceSubtask)) {
+                serviceSubtaskStatistic.setTimelyFollowUp(serviceSubtaskStatistic.getTimelyFollowUp() + 1L);
             }
 
             //棣栨鍑洪櫌闅忚
@@ -4085,6 +4106,10 @@
             //搴旈殢璁夸汉娆�
             if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
                 serviceSubtaskStatistic.setFollowUpNeeded(serviceSubtaskStatistic.getFollowUpNeeded() + 1L);
+            }
+            //鍙婃椂闅忚浜烘锛氬凡瀹屾垚涓旀湭瓒呮椂
+            if (isTimelyFollowUp(serviceSubtask)) {
+                serviceSubtaskStatistic.setTimelyFollowUp(serviceSubtaskStatistic.getTimelyFollowUp() + 1L);
             }
 
             //鍐嶆鍑洪櫌闅忚
@@ -4616,6 +4641,7 @@
      * pendingFollowUpInfo - visitCount = 1 && sendstate = 2
      * followUpSuccessInfo - visitCount = 1 && sendstate = 6
      * followUpFailInfo - visitCount = 1 && (sendstate = 5 || sendstate = 7)
+     * timelyFollowUpInfo - sendstate = 6 && finish_state = 1锛堟部鐢ㄨ姹傜殑 visitCount 鍙e緞锛�
      * manualInfo - visitCount = 1 && currentPreachForm = "1"
      * voiceInfo - visitCount = 1 && currentPreachForm = "3"
      * smsInfo - visitCount = 1 && currentPreachForm = "4"
@@ -4674,14 +4700,22 @@
     }
 
     private void applyHyperLinkInfoType(ServiceSubtaskCountReq serviceSubtaskCountReq, String hyperLinkInfoType) {
+        //鍙婃椂闅忚鏄庣粏闇�瑕佹部鐢ㄨ姹傜殑棣栨/鍐嶆鍙e緞
+        Integer originVisitCount = serviceSubtaskCountReq.getVisitCount();
         serviceSubtaskCountReq.setVisitCount(null);
         serviceSubtaskCountReq.setSendstates(null);
         serviceSubtaskCountReq.setCurrentPreachform(null);
         serviceSubtaskCountReq.setExcep(null);
         serviceSubtaskCountReq.setTaskSituation(null);
+        serviceSubtaskCountReq.setFinishState(null);
 
         switch (hyperLinkInfoType) {
             case "dischargeCountInfo":
+                break;
+            case "timelyFollowUpInfo":
+                serviceSubtaskCountReq.setVisitCount(originVisitCount);
+                serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+                serviceSubtaskCountReq.setFinishState(1L);
                 break;
             case "followUpNeededAllInfo":
                 serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 6L, 7L)));
@@ -5151,6 +5185,7 @@
         total.setPendingFollowUp(0L);
         total.setFollowUpSuccess(0L);
         total.setFollowUpFail(0L);
+        total.setTimelyFollowUp(0L);
         total.setManual(0L);
         total.setSms(0L);
         total.setWeChat(0L);
@@ -5182,6 +5217,7 @@
             total.setPendingFollowUp(total.getPendingFollowUp() + (stat.getPendingFollowUp() != null ? stat.getPendingFollowUp() : 0L));
             total.setFollowUpSuccess(total.getFollowUpSuccess() + (stat.getFollowUpSuccess() != null ? stat.getFollowUpSuccess() : 0L));
             total.setFollowUpFail(total.getFollowUpFail() + (stat.getFollowUpFail() != null ? stat.getFollowUpFail() : 0L));
+            total.setTimelyFollowUp(total.getTimelyFollowUp() + (stat.getTimelyFollowUp() != null ? stat.getTimelyFollowUp() : 0L));
             total.setManual(total.getManual() + (stat.getManual() != null ? stat.getManual() : 0L));
             total.setSms(total.getSms() + (stat.getSms() != null ? stat.getSms() : 0L));
             total.setWeChat(total.getWeChat() + (stat.getWeChat() != null ? stat.getWeChat() : 0L));
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 1948988..0f34f88 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -255,7 +255,7 @@
         from service_subtask
     </sql>
 
-    <!-- 瀹屾垚鏃剁姸鎬�(finish_state)璁$畻锛氫粎褰撴湰娆℃洿鏂版妸 sendstate 缃负 6锛堥殢璁垮畬鎴愶級鏃朵娇鐢ㄣ��
+    <!-- 瓒呮椂瀹屾垚銆佸欢鏈熷畬鎴愰�昏緫 瀹屾垚鏃剁姸鎬�(finish_state)璁$畻锛氫粎褰撴湰娆℃洿鏂版妸 sendstate 缃负 6锛堥殢璁垮畬鎴愶級鏃朵娇鐢ㄣ��
          鍩哄噯鎴鏃堕棿 base = endtime + send_day(缂虹渷1) + (危 service_subtask_preachform.compensate_time + 1) 澶╋紝
          涓� RyTask/RedisMqReceiver 鐨� isSubtaskDeadline 鍙e緞淇濇寔涓�鑷达紱
          delay = COALESCE(service_task.delay_finish_days, 0)锛�
@@ -1681,6 +1681,7 @@
         continue_count,
         continue_time_next,
         task_situation,
+        finish_state,
         is_manually_called
         from service_subtask
         where 1=1
@@ -1970,6 +1971,7 @@
         task_situation,
         remark,
         doctor_opinion,
+        finish_state,
         is_manually_called
         from service_subtask
         where 1=1
@@ -2052,6 +2054,9 @@
         <if test="taskSituation != null">
             AND task_situation = #{taskSituation}
         </if>
+        <if test="finishState != null">
+            AND finish_state = #{finishState}
+        </if>
         <if test="drcode != null and drcode != ''">
             AND drcode = #{drcode}
         </if>

--
Gitblit v1.9.3