From 5da61001a1cbd8beaa44a28eec0779793979f4a3 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 29 十月 2026 17:26:58 +0800
Subject: [PATCH] 【丽水】丽水中 新增 追踪随访推送率:再次随访推送人数/首次出院人次
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 81 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 77 insertions(+), 4 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 b0f5b1f..15940be 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -1312,6 +1312,20 @@
}
/**
+ * 绉戝缂栫爜鍘婚噸锛屼繚鎸佸師椤哄簭锛岄伩鍏� service_task.deptcode 瓒呴暱鍜� service_taskdept 閲嶅缁戝畾
+ */
+ private String normalizeDeptCodes(String deptCodes) {
+ if (StringUtils.isEmpty(deptCodes)) {
+ return deptCodes;
+ }
+ return Arrays.stream(deptCodes.split(","))
+ .map(String::trim)
+ .filter(code -> StringUtils.isNotEmpty(code))
+ .distinct()
+ .collect(Collectors.joining(","));
+ }
+
+ /**
* 鍗曚竴浠诲姟
*
* @return 缁撴灉
@@ -1323,6 +1337,8 @@
log.info("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
throw new BaseException("浠诲姟鍏ュ弬涓虹┖锛岃妫�鏌ュ叆鍙�");
}
+ // 绉戝缂栫爜鍘婚噸锛岄伩鍏� service_task.deptcode 瓒呴暱鍙� service_taskdept 閲嶅缁戝畾
+ serviceTaskVO.setDeptcode(normalizeDeptCodes(serviceTaskVO.getDeptcode()));
ServiceTask serviceTask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceTask.class);
if (CollectionUtils.isEmpty(serviceTaskVO.getPreachformList())) throw new BaseException("浠诲姟鐨勫彂閫佹柟寮忎负绌�");
//灏唒reachfromList鏀惧埌serviceTask涓殑preachfrom涓�
@@ -1557,7 +1573,12 @@
serviceSubtask.setInhospid(patTaskRelevance.getHospid());
//鏂板缓瀹屾垚灏辨槸寰呭彂閫佺姸鎬�
serviceSubtask.setSendstate(2L);
- serviceSubtask.setDeptcode(StringUtils.isNotEmpty(patTaskRelevance.getDeptcode()) ? patTaskRelevance.getDeptcode() : serviceTaskVO.getDeptcode());
+ String subtaskDeptCode = patTaskRelevance.getDeptcode();
+ if (StringUtils.isEmpty(subtaskDeptCode) && StringUtils.isNotEmpty(serviceTaskVO.getDeptcode())) {
+ // service_subtask.deptcode 涓哄崟鍊煎瓧娈碉紝涓嶈兘鍐欏叆浠诲姟鐨勫绉戝鎷兼帴涓诧紝鍙栫涓�涓瀹ゅ厹搴�
+ subtaskDeptCode = serviceTaskVO.getDeptcode().split(",")[0].trim();
+ }
+ serviceSubtask.setDeptcode(subtaskDeptCode);
serviceSubtask.setDeptname(StringUtils.isNotEmpty(patTaskRelevance.getDeptName()) ? patTaskRelevance.getDeptName() : serviceTaskVO.getDeptname());
serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode());
serviceSubtask.setLeavehospitaldistrictname(patTaskRelevance.getLeavehospitaldistrictname());
@@ -1697,6 +1718,11 @@
if (StringUtils.isNotEmpty(serviceTaskVO.getAppltype())) {
if (serviceTaskVO.getAppltype().equals("1") || serviceTaskVO.getAppltype().equals("2")) {
if (StringUtils.isNotEmpty(serviceTaskVO.getDeptcode())) {
+ // 淇敼浠诲姟鏃跺厛杞垹闄ゆ棫鐨勭瀹ょ粦瀹氾紝閬垮厤鏃х瀹ゆ畫鐣�
+ ServiceTaskdept oldDept = new ServiceTaskdept();
+ oldDept.setTaskId(serviceTask.getTaskid());
+ oldDept.setDeptType("1");
+ serviceTaskdeptService.deleteServiceTaskdeptByTaskId(oldDept);
String[] deptcodes = serviceTaskVO.getDeptcode().split(",");
for (String deptCode : deptcodes) {
ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
@@ -3735,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) {
@@ -3752,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);
}
//浜哄伐宸叉嫧閫氭�婚噺
@@ -4768,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
@@ -4810,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();
@@ -4831,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);
@@ -4844,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)));
@@ -4995,6 +5055,7 @@
default:
break;
}
+ return true;
}
@@ -5336,6 +5397,8 @@
// 鍒濆鍖栨暟鍊煎瓧娈�
total.setDischargeCount(0);
+ total.setFirstDischargeCount(0L);
+ total.setAgainFollowUpPushCount(0L);
total.setNonFollowUp(0L);
total.setFilterCount(0L);
total.setFollowUpNeeded(0L);
@@ -5368,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));
@@ -5762,7 +5827,15 @@
return resultMap;
}
- if (StringUtils.isEmpty(serviceSubtask.getPatidHis())) {
+ if (patArchive == null) {
+ resultMap.put("code", -1);
+ resultMap.put("message", "鍙戦�佸紓甯革細" + "銆愬叕浼楀彿銆戞湭鏌ヨ鍒版偅鑰呮。妗堜俊鎭紝鏃犳硶閫氳繃鍏紬鍙峰彂閫�");
+ return resultMap;
+ }
+
+ // his绯荤粺鐨勬偅鑰卛d鍙栬嚜鎮h�呮。妗坧at_archive.patid_his锛�
+ // service_subtask鏌ヨ鏈叧鑱旇瀛楁锛坰erviceSubtask.getPatidHis()鎭掍负绌猴級锛屼笉鑳界敤浜庢牎楠�
+ if (StringUtils.isEmpty(patArchive.getPatidHis())) {
resultMap.put("code", -1);
resultMap.put("message", "鍙戦�佸紓甯革細" + "銆愬叕浼楀彿銆戝叕浼楀彿鍙戦�佸け璐�,his绯荤粺鐨勬偅鑰卛d涓虹┖");
return resultMap;
--
Gitblit v1.9.3