From cf8712a9c0816559f50644f15672e7359028c4c4 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期三, 11 十一月 2026 14:02:58 +0800
Subject: [PATCH] 妇幼-住院完成生成
---
ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java | 60 +++++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 43 insertions(+), 17 deletions(-)
diff --git a/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java b/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
index eb6683c..3ed3fd6 100644
--- a/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
+++ b/ruoyi-task/src/main/java/com/ruoyi/task/service/impl/ServiceSubtaskServiceImpl.java
@@ -126,6 +126,7 @@
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.mapper.ext.SysDept2Mapper;
import com.ruoyi.task.api.contract.OperationSubtaskWriter;
+import com.ruoyi.task.event.FollowupCompletedEventPublisher;
/**
* 鍗曚竴浠诲姟锛堥殢璁匡級Service涓氬姟灞傚鐞�
@@ -145,6 +146,9 @@
*/
@Autowired
private OperationSubtaskWriter operationSubtaskWriter;
+
+ @Autowired
+ private FollowupCompletedEventPublisher followupCompletedEventPublisher;
/**
* 婊℃剰搴︽ā鍧楀澶栭棬闈紙甯搁┗ Bean锛夈��
@@ -913,7 +917,7 @@
serviceOutPath.setSubId(serviceSubtask1.getId());
List<ServiceOutPath> serviceOutPaths = serviceOutPathMapper.selectServiceOutPathList(serviceOutPath);
if (CollectionUtils.isNotEmpty(serviceOutPaths))
- format = String.format("%03X", serviceOutPaths.get(0).getId());
+ format = ShortCode.encode(serviceOutPaths.get(0).getId());
else format = getOutPath(serviceSubtask1, rsaPublicKeyExample);
serviceSubtask = serviceSubtask1;
} else {
@@ -965,7 +969,7 @@
serviceOutPath.setSubId(serviceSubtask.getId());
iServiceOutPathService.insertServiceOutPath(serviceOutPath);
//杞垚16杩涘埗
- format = String.format("%03X", serviceOutPath.getId());
+ format = ShortCode.encode(serviceOutPath.getId());
serviceOutPath.setRadix(format);
serviceOutPath.setUpdateTime(new Date());
iServiceOutPathService.updateServiceOutPath(serviceOutPath);
@@ -1544,7 +1548,12 @@
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 6)
serviceSubtask.setFinishtime(new Date());
- return serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ Boolean updated = serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ if (Boolean.TRUE.equals(updated) && serviceSubtask.getSendstate() != null
+ && serviceSubtask.getSendstate() == 6 && serviceSubtask.getId() != null) {
+ followupCompletedEventPublisher.publish(serviceSubtask.getId());
+ }
+ return updated;
}
@Override
@@ -2459,7 +2468,10 @@
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
groupKey = drcode;
} else {
- groupKey = "deptcode";
+ // 2026-11 瀛楁閲嶅懡鍚嶅悗锛歞eptcode 鏄湪闄㈢瀹わ紙鍘嗗彶鏁版嵁涓虹┖锛夛紝
+ // 鍑洪櫌绉戝宸叉敼鍚嶄负 leaveldeptcode锛屽垎缁勫繀椤荤敤鍚庤�咃紝
+ // 鍚﹀垯 getSfStatisticsGroupKey 浼氳繑鍥� NULL锛屾嫾鎴� IN (NULL) 瀵艰嚧鏁磋〃鏌ョ┖銆�
+ groupKey = "leaveldeptcode";
}
} else if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 3) {
// 鐥呯缁熻锛氭寜浠诲姟ID鍒嗙粍锛屾瘡涓换鍔″嵆涓�涓梾绉嶉殢璁夸换鍔�
@@ -2470,6 +2482,17 @@
Map<String, List<ServiceSubtask>> collect = new HashMap<>();
serviceSubtaskCountReq.setGroupKey(groupKey);
List<String> groupKeyList = serviceSubtaskMapper.getSfStatisticsGroupKey(serviceSubtaskCountReq);
+ /*
+ * 鍒嗙粍閿彲鑳戒负 NULL锛堝巻鍙叉暟鎹�佹垨閲嶅懡鍚嶅悗灏氭湭鍥炲~鐨勫湪闄㈢淮搴﹀垪锛夛紝
+ * 鐩存帴鎷艰繘 SQL 浼氬彉鎴� `AND IFNULL(鍒�,'Unknown') IN (NULL)`锛屾亽涓嶆垚绔嬶紝鏁村紶缁熻琛ㄤ负绌恒��
+ * 杩欓噷缁熶竴鎴� 'Unknown'锛屼笌鑱氬悎 SQL 鐨� IFNULL(鍒�,'Unknown') 鍙e緞瀵归綈銆�
+ */
+ if (groupKeyList != null) {
+ groupKeyList = groupKeyList.stream()
+ .map(key -> key == null ? "Unknown" : key)
+ .distinct()
+ .collect(Collectors.toList());
+ }
serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
switch (groupKey) {
@@ -2484,6 +2507,7 @@
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getManagementDoctorCode()).orElse("Unknown")));
break;
case "deptcode":
+ case "leaveldeptcode":
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeaveldeptcode()).orElse("Unknown")));
break;
case "leavehospitaldistrictcode":
@@ -3100,7 +3124,7 @@
}
/**
- * 鍐嶆闅忚闄勫姞缁熻锛氬緟闅忚銆佸凡鍙戦�併�佷汉宸ョ數璇濊秴鏃跺強鍥為櫌澶嶈瘖澶嶆煡锛坰uggest=6锛夈��
+ * 鍐嶆闅忚闄勫姞缁熻锛氬緟闅忚銆佸凡鍙戦�併�佷汉宸ョ數璇濊秴鏃跺強鍥為櫌澶嶈瘖澶嶆煡锛坰uggest=7锛夈��
*/
private void applyAgainFollowUpExtraStatistics(ServiceSubtaskStatistic statistic, ServiceSubtask serviceSubtask) {
if (serviceSubtask.getVisitCount() == null || serviceSubtask.getVisitCount() <= 1) {
@@ -3110,9 +3134,9 @@
return;
}
Long sendstate = serviceSubtask.getSendstate();
- // 鍥為櫌澶嶈瘖澶嶆煡锛氬啀娆¢殢璁夸腑鎸夊鐞嗘剰瑙� suggest=6 缁熻
- if (StringUtils.equals("6", StringUtils.trim(serviceSubtask.getSuggest()))) {
- statistic.setSuggest6CountAgain(statistic.getSuggest6CountAgain() + 1L);
+ // 鍥為櫌澶嶈瘖澶嶆煡锛氬啀娆¢殢璁夸腑鎸夊鐞嗘剰瑙� suggest=7 缁熻
+ if (StringUtils.equals("7", StringUtils.trim(serviceSubtask.getSuggest()))) {
+ statistic.setSuggest7CountAgain(statistic.getSuggest7CountAgain() + 1L);
}
if (sendstate.equals(3L)) {
statistic.setSentAgain(statistic.getSentAgain() + 1L);
@@ -3758,7 +3782,7 @@
* pendingFollowUpSentAgainInfo - visitCount > 1 && sendstate in (3,7)
* sentInfo - visitCount = 1 && sendstate = 3
* sentAgainInfo - visitCount > 1 && sendstate = 3
- * suggest6CountAgainInfo - visitCount > 1 && suggest = 6
+ * suggest7CountAgainInfo - visitCount > 1 && suggest = 7
* filterCountList - taskSituation = 6 && sendstate = 4
*
*/
@@ -3943,10 +3967,10 @@
serviceSubtaskCountReq.setVisitCount(2);
serviceSubtaskCountReq.setExcep("1");
break;
- case "suggest6CountAgainInfo":
- // 鍐嶆闅忚鍥為櫌澶嶈瘖澶嶆煡锛歷isitCount > 1 涓� suggest = 6
+ case "suggest7CountAgainInfo":
+ // 鍐嶆闅忚鍥為櫌澶嶈瘖澶嶆煡锛歷isitCount > 1 涓� suggest = 7
serviceSubtaskCountReq.setVisitCount(2);
- serviceSubtaskCountReq.setSuggest("6");
+ serviceSubtaskCountReq.setSuggest("7");
break;
case "taskSituation1Info":
serviceSubtaskCountReq.setTaskSituation(1);
@@ -4505,7 +4529,7 @@
total.setSentAgain(0L);
total.setFollowUpSuccessAgain(0L);
total.setFollowUpFailAgain(0L);
- total.setSuggest6CountAgain(0L);
+ total.setSuggest7CountAgain(0L);
total.setManualAgain(0L);
total.setSmsAgain(0L);
total.setWeChatAgain(0L);
@@ -4550,7 +4574,7 @@
total.setSentAgain(total.getSentAgain() + (stat.getSentAgain() != null ? stat.getSentAgain() : 0L));
total.setFollowUpSuccessAgain(total.getFollowUpSuccessAgain() + (stat.getFollowUpSuccessAgain() != null ? stat.getFollowUpSuccessAgain() : 0L));
total.setFollowUpFailAgain(total.getFollowUpFailAgain() + (stat.getFollowUpFailAgain() != null ? stat.getFollowUpFailAgain() : 0L));
- total.setSuggest6CountAgain(total.getSuggest6CountAgain() + (stat.getSuggest6CountAgain() != null ? stat.getSuggest6CountAgain() : 0L));
+ total.setSuggest7CountAgain(total.getSuggest7CountAgain() + (stat.getSuggest7CountAgain() != null ? stat.getSuggest7CountAgain() : 0L));
total.setManualAgain(total.getManualAgain() + (stat.getManualAgain() != null ? stat.getManualAgain() : 0L));
total.setSmsAgain(total.getSmsAgain() + (stat.getSmsAgain() != null ? stat.getSmsAgain() : 0L));
total.setWeChatAgain(total.getWeChatAgain() + (stat.getWeChatAgain() != null ? stat.getWeChatAgain() : 0L));
@@ -4802,6 +4826,7 @@
serviceSubtask.setSendstate(6L);
serviceSubtask.setPreachform("1");
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ followupCompletedEventPublisher.publish(serviceSubtask.getId());
}
}
@@ -4946,6 +4971,7 @@
if (subtaskUpdated == 0) {
throw new BaseException("寰俊鍏紬鍙烽粯璁ゅ畬鎴愬け璐ワ細瀛愪换鍔$姸鎬佸凡鍙樺寲锛宻ubid=" + current.getId());
}
+ followupCompletedEventPublisher.publish(current.getId());
log.info("銆愬井淇″叕浼楀彿榛樿瀹屾垚銆憇ubid锛歿}锛屽凡鎸夐粯璁ら�夐」瀹屾垚锛屽~鍏呴鐩暟锛歿}", current.getId(), filled);
return true;
@@ -5128,7 +5154,7 @@
serviceOutPath.setCreateTime(new Date());
serviceOutPath.setOrgid(serviceSubtask.getOrgid());
iServiceOutPathService.insertServiceOutPath(serviceOutPath);
- String format = String.format("%03X", serviceOutPath.getId());
+ String format = ShortCode.encode(serviceOutPath.getId());
String url = "";
SendMagParam sendMagParam = new SendMagParam();
sendMagParam.setType("4");
@@ -5212,7 +5238,7 @@
serviceOutPath.setCreateTime(new Date());
serviceOutPath.setOrgid(serviceSubtask.getOrgid());
iServiceOutPathService.insertServiceOutPath(serviceOutPath);
- String format = String.format("%03X", serviceOutPath.getId());
+ String format = ShortCode.encode(serviceOutPath.getId());
serviceOutPath.setRadix(format);
serviceOutPath.setUpdateTime(new Date());
serviceOutPath.setUrl(url);
@@ -5427,7 +5453,7 @@
serviceOutPath.setCreateTime(new Date());
serviceOutPath.setOrgid(serviceTask.getOrgid());
iServiceOutPathService.insertServiceOutPath(serviceOutPath);
- String format = String.format("%03X", serviceOutPath.getId());
+ String format = ShortCode.encode(serviceOutPath.getId());
serviceOutPath.setRadix(format);
serviceOutPath.setUpdateTime(new Date());
String url = StringUtils.isNotEmpty(req_path) ? ip + ":" + req_path + "/wt?p=" + format : ip + "/wt?p=" + format;
--
Gitblit v1.9.3