From 9b27e22beac4f247f0a703f1e8a8bb661dbc31f3 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 30 十月 2026 11:13:07 +0800
Subject: [PATCH] 【丽水】patItem筛选当前执行方式

---
 smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

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 79afd05..a2be971 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -448,7 +448,7 @@
             if (StringUtils.isEmpty(serviceSubtask.getCurrentPreachform())) {
                 if (StringUtils.isNotEmpty(serviceSubtask.getPreachform())) {
                     //榛樿鍙栫涓�涓�
-                    serviceSubtaskRes.setCurrentPreachform(serviceSubtask.getPreachform().split(",")[0]);
+                    serviceSubtaskRes.setCurrentPreachform(serviceSubtask.getPreachform().split(",")[0].trim());
                 }
             }
             PatMedInhosp inhosp = patMedInhospMapper.selectPatMedInhospByInhospid(serviceSubtask.getInhospid());
@@ -3761,6 +3761,8 @@
             serviceSubtaskStatistic.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
             serviceSubtaskStatistic.setDrcode(serviceSubtaskList.get(0).getDrcode());
             serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
+            //闅忚涓績绉戝锛岀敤浜庣粺璁″啀娆¢殢璁挎帹閫佸埌闅忚涓績鐨勪汉鏁�
+            String centerDept = configService.selectConfigByKey("sys.smartor.center.dept", serviceSubtaskList.get(0).getOrgid());
             //鍑洪櫌浜烘
             serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
             for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
@@ -3778,6 +3780,17 @@
                 //鍙婃椂闅忚浜烘锛氬凡瀹屾垚涓旀湭瓒呮椂
                 if (isTimelyFollowUp(serviceSubtask)) {
                     serviceSubtaskStatistic.setTimelyFollowUp(serviceSubtaskStatistic.getTimelyFollowUp() + 1L);
+                }
+
+                //棣栨鍑洪櫌浜烘锛歷isitCount = 1锛屼綔涓哄啀娆¢殢璁挎帹閫佺巼鐨勫垎姣�
+                if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) {
+                    serviceSubtaskStatistic.setFirstDischargeCount(serviceSubtaskStatistic.getFirstDischargeCount() + 1L);
+                }
+                //鍐嶆闅忚鎺ㄩ�佷汉鏁帮細棣栦釜鍐嶆闅忚锛坴isitCount = 2锛変笖鎵ц绉戝涓洪殢璁夸腑蹇冪瀹�
+                if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 2
+                        && StringUtils.isNotEmpty(centerDept)
+                        && StringUtils.equals(StringUtils.trim(centerDept), StringUtils.trim(serviceSubtask.getVisitDeptCode()))) {
+                    serviceSubtaskStatistic.setAgainFollowUpPushCount(serviceSubtaskStatistic.getAgainFollowUpPushCount() + 1L);
                 }
 
                 //浜哄伐宸叉嫧閫氭�婚噺
@@ -4794,6 +4807,8 @@
      * 鑾峰彇闅忚缁熻瓒呴摼鎺�
      * dischargeCountInfo
      * followUpNeededAllInfo - sendstate != 4 (1,2,3,5,6,7)
+     * firstDischargeCountInfo - visitCount = 1
+     * againFollowUpPushCountInfo - visitCount = 2 && visitDeptCode = sys.smartor.center.dept锛堥殢璁夸腑蹇冪瀹わ級
      * nonFollowUpInfo - sendstate = 4
      * needFollowUpInfo - visitCount = 1 && sendstate != 4
      * pendingFollowUpInfo - visitCount = 1 && sendstate = 2
@@ -4836,7 +4851,10 @@
     public List<ServiceSubtask> getSfStatisticsHyperlink(ServiceSubtaskCountReq serviceSubtaskCountReq) {
         String hyperLinkInfoType = serviceSubtaskCountReq.getHyperLinkInfoType();
         if (StringUtils.isNotEmpty(hyperLinkInfoType)) {
-            applyHyperLinkInfoType(serviceSubtaskCountReq, hyperLinkInfoType);
+            if (!applyHyperLinkInfoType(serviceSubtaskCountReq, hyperLinkInfoType)) {
+                // 涓嬮捇渚濊禆鐨勯厤缃己澶辨椂杩斿洖绌烘槑缁嗭紝閬垮厤閫�鍖栨垚鏃犺繃婊ゆ潯浠剁殑鏌ヨ
+                return new ArrayList<>();
+            }
         }
 
         String followUpCountStyle = serviceSubtaskCountReq.getFollowUpCountStyle();
@@ -4857,7 +4875,7 @@
         return serviceSubtasks;
     }
 
-    private void applyHyperLinkInfoType(ServiceSubtaskCountReq serviceSubtaskCountReq, String hyperLinkInfoType) {
+    private boolean applyHyperLinkInfoType(ServiceSubtaskCountReq serviceSubtaskCountReq, String hyperLinkInfoType) {
         //鍙婃椂闅忚鏄庣粏闇�瑕佹部鐢ㄨ姹傜殑棣栨/鍐嶆鍙e緞
         Integer originVisitCount = serviceSubtaskCountReq.getVisitCount();
         serviceSubtaskCountReq.setVisitCount(null);
@@ -4870,6 +4888,22 @@
         switch (hyperLinkInfoType) {
             case "dischargeCountInfo":
                 break;
+            case "firstDischargeCountInfo":
+                //棣栨鍑洪櫌浜烘锛歷isitCount = 1
+                serviceSubtaskCountReq.setVisitCount(1);
+                break;
+            case "againFollowUpPushCountInfo": {
+                //鍐嶆闅忚鎺ㄩ�佷汉鏁帮細visitCount = 2 涓旀墽琛岀瀹や负闅忚涓績绉戝
+                String centerDept = configService.selectConfigByKey("sys.smartor.center.dept", serviceSubtaskCountReq.getOrgid());
+                if (StringUtils.isBlank(centerDept)) {
+                    log.warn("鑾峰彇鍐嶆闅忚鎺ㄩ�佹槑缁嗗け璐ワ紝鏈厤缃殢璁夸腑蹇冪瀹ゅ弬鏁� sys.smartor.center.dept, orgid={}", serviceSubtaskCountReq.getOrgid());
+                    return false;
+                }
+                serviceSubtaskCountReq.setVisitCount(2);
+                serviceSubtaskCountReq.setVisitDeptCode(centerDept.trim());
+                serviceSubtaskCountReq.setVisitDeptName(null);
+                break;
+            }
             case "timelyFollowUpInfo":
                 serviceSubtaskCountReq.setVisitCount(originVisitCount);
                 serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
@@ -5021,6 +5055,7 @@
             default:
                 break;
         }
+        return true;
     }
 
 
@@ -5362,6 +5397,8 @@
 
         // 鍒濆鍖栨暟鍊煎瓧娈�
         total.setDischargeCount(0);
+        total.setFirstDischargeCount(0L);
+        total.setAgainFollowUpPushCount(0L);
         total.setNonFollowUp(0L);
         total.setFilterCount(0L);
         total.setFollowUpNeeded(0L);
@@ -5394,6 +5431,8 @@
             if (stat.getDischargeCount() != null) {
                 total.setDischargeCount(total.getDischargeCount() + stat.getDischargeCount());
             }
+            total.setFirstDischargeCount(total.getFirstDischargeCount() + (stat.getFirstDischargeCount() != null ? stat.getFirstDischargeCount() : 0L));
+            total.setAgainFollowUpPushCount(total.getAgainFollowUpPushCount() + (stat.getAgainFollowUpPushCount() != null ? stat.getAgainFollowUpPushCount() : 0L));
             total.setNonFollowUp(total.getNonFollowUp() + (stat.getNonFollowUp() != null ? stat.getNonFollowUp() : 0L));
             total.setFilterCount(total.getFilterCount() + (stat.getFilterCount() != null ? stat.getFilterCount() : 0L));
             total.setFollowUpNeeded(total.getFollowUpNeeded() + (stat.getFollowUpNeeded() != null ? stat.getFollowUpNeeded() : 0L));

--
Gitblit v1.9.3