From eb845e8be695ed1280a7cbf854a4d1dedf9db30d Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期五, 30 十月 2026 15:02:55 +0800
Subject: [PATCH] 【丽水】/smartor/serviceSubtask/getSfStatisticsHyperlink 和 /smartor/serviceSubtask/getSfStatistics 统计的时候,对于 service_subtask.current_preachForm 为空的数据 当成 service_subtask.preachform 字符串的第一个执行方式、首次待随访全部(visitCount = 1 && sendstate in (1、2、3、7)) 区别于原先的待随访,这个是给市一使用的 再次待随访全部(visitCount > 1 && sendstate in (1、2、3、7)) 区别于原先的待随访,这个是给市一使用的 首次待随访待发送(visitCount = 1 && sendstate in (1、2)) 再次待随访待发送(visitCount > 1 && sendstate in (1、2)) 首次待随访已发送(visitCount = 1 && sendstate = in (3、7)) 再次待随访已发送(visitCount > 1 && sendstate = in (3、7)) 首次已发送(visitCount = 1 && sendstate = 3) 再次已发送(visitCount > 1 && sendstate = 3)
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 312 ++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 243 insertions(+), 69 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 715c712..34497eb 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());
@@ -908,25 +908,21 @@
}
String config = configService.selectConfigByKey("visit.early.day");
Integer type = 1;
- String visitType = resolveAgainVisitType(request, serviceSubtask);
- if (StringUtils.isEmpty(visitType)) {
- String requestVisitType = request == null ? null : request.getVisitType();
- log.error("鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛岄殢璁挎柟寮忎笉鍚堟硶, visitType = {}, subTaskId = {}", requestVisitType, serviceSubtask.getId());
- return "鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛岄殢璁挎柟寮忎笉鍚堟硶, visitType = " + requestVisitType + ", 鍐嶈娆¢噸璇�";
+ String resource = resolveAgainResource(request);
+ if (StringUtils.isEmpty(resource)) {
+ String requestResource = request == null ? null : request.getResource();
+ log.error("鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛屽啀娆¢殢璁挎柟寮忎笉鍚堟硶, resource = {}, subTaskId = {}", requestResource, serviceSubtask.getId());
+ return "鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛屽啀娆¢殢璁挎柟寮忎笉鍚堟硶, resource = " + requestResource + ", 鍐嶈娆¢噸璇�";
}
String visitDeptCode;
String visitDeptName;
- if ("1".equals(visitType)) {
- // 鏈瀹ら殢璁匡細璇锋眰鍊� > 鍘熶换鍔℃湰绉戝闅忚绉戝 > 鍘熶换鍔″嚭闄㈢瀹�
- String requestDeptCode = request == null ? null : request.getVisitDeptCode();
- String requestDeptName = request == null ? null : request.getVisitDeptName();
- String oldVisitType = serviceSubtask.getVisitType();
- String oldOwnDeptCode = "1".equals(oldVisitType) ? serviceSubtask.getVisitDeptCode() : null;
- String oldOwnDeptName = "1".equals(oldVisitType) ? serviceSubtask.getVisitDeptName() : null;
- String preferredDeptCode = firstNonBlank(requestDeptCode, oldOwnDeptCode);
- if (StringUtils.isNotEmpty(preferredDeptCode)) {
- visitDeptCode = preferredDeptCode;
- visitDeptName = firstNonBlank(requestDeptName, oldOwnDeptName);
+ if ("1".equals(resource)) {
+ // 鏈瀹ら殢璁匡細璇锋眰绉戝浼樺厛锛屾湭浼犳椂浣跨敤鍘熶换鍔″嚭闄㈢瀹わ紱涓嶄緷璧栧師浠诲姟 visitType
+ String requestDeptCode = firstNonBlank(request == null ? null : request.getVisitDeptCode());
+ String requestDeptName = firstNonBlank(request == null ? null : request.getVisitDeptName());
+ if (StringUtils.isNotEmpty(requestDeptCode)) {
+ visitDeptCode = requestDeptCode;
+ visitDeptName = requestDeptName;
} else {
visitDeptCode = serviceSubtask.getDeptcode();
visitDeptName = serviceSubtask.getDeptname();
@@ -985,7 +981,8 @@
// 浜屾闅忚鏃堕棿锛氫笂娆¢殢璁垮畬鎴愭椂闂达紙鏈畬鎴愬垯褰撳墠鏃堕棿锛�+ 涓嬩竴浠诲姟鍙戦�佸ぉ鏁帮紱杩囧幓鏃堕棿鍏滃簳涓哄綋鍓嶆椂闂�
applyAgainVisitTime(serviceSubtaskAgain, serviceSubtask, nextServiceTask, config, now);
- serviceSubtaskAgain.setVisitType(visitType);
+ // 鏂颁换鍔$殑闅忚鏂瑰紡璁板綍鏈閫夋嫨鐨勫啀娆¢殢璁挎柟寮忥紱resource 鏈韩涓嶈惤搴�
+ serviceSubtaskAgain.setVisitType(resource);
serviceSubtaskAgain.setVisitDeptCode(visitDeptCode);
serviceSubtaskAgain.setVisitDeptName(visitDeptName);
int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtaskAgain);
@@ -1006,20 +1003,17 @@
}
/**
- * 瑙f瀽鍐嶆闅忚鏂瑰紡锛氳姹傚弬鏁颁紭鍏堬紝鍘熶换鍔″厹搴曪紝鏈厤缃椂榛樿闅忚涓績銆�
+ * 瑙f瀽鍐嶆闅忚鏂瑰紡锛氫粎鍙栬姹傚弬鏁� resource锛屼笉浣跨敤鍘熶换鍔� visitType锛涙湭浼犳椂榛樿闅忚涓績銆�
*
* @return 1-鏈瀹ら殢璁匡紱2-闅忚涓績闅忚锛沶ull-闈炴硶鍊�
*/
- private String resolveAgainVisitType(ServiceSubtask request, ServiceSubtask old) {
- String visitType = request == null ? null : request.getVisitType();
- if (StringUtils.isEmpty(visitType) || StringUtils.isEmpty(visitType.trim())) {
- visitType = old == null ? null : old.getVisitType();
- }
- if (StringUtils.isEmpty(visitType) || StringUtils.isEmpty(visitType.trim())) {
+ private String resolveAgainResource(ServiceSubtask request) {
+ String resource = request == null ? null : request.getResource();
+ if (StringUtils.isEmpty(resource) || StringUtils.isEmpty(resource.trim())) {
return "2";
}
- visitType = visitType.trim();
- return ("1".equals(visitType) || "2".equals(visitType)) ? visitType : null;
+ resource = resource.trim();
+ return ("1".equals(resource) || "2".equals(resource)) ? resource : null;
}
private String firstNonBlank(String... values) {
@@ -1091,8 +1085,8 @@
* 棣栨闅忚浠诲姟瓒呮椂鍚庯紝鎸変笅涓�浠诲姟鑷姩鐢熸垚鍐嶆闅忚浠诲姟銆�
* <p>
* 瀹氭椂浠诲姟鍏ュ彛 {@code RyTask#dealSubtaskDeadline} 浣跨敤銆備笌鎵嬪姩鍏ュ彛涓�鑷寸殑閮ㄥ垎锛�
- * 琛ㄥ崟/鍙戦�佹柟寮忓彇涓嬩竴浠诲姟銆侀摼璺� upid + visit_count銆佸彂閫佹柟寮忔槑缁嗗垵濮嬪寲銆佹寜 visitType 閫夋嫨闅忚绉戝锛�
- * 宸紓锛氶殢璁夸腑蹇冪瀹ゆ湭閰嶇疆鏃跺洖閫�鍘熶换鍔$瀹わ紝鍘熶换鍔$疆涓哄彂閫佸け璐ワ紙sendstate=5锛夈��
+ * 琛ㄥ崟/鍙戦�佹柟寮忓彇涓嬩竴浠诲姟銆侀摼璺� upid + visit_count銆佸彂閫佹柟寮忔槑缁嗗垵濮嬪寲锛�
+ * 宸紓锛氳秴鏃跺啀娆¢殢璁垮浐瀹氳蛋闅忚涓績绉戝锛堥殢璁夸腑蹇冩湭閰嶇疆鏃跺洖閫�鍘熶换鍔$瀹わ級锛屽師浠诲姟缃负鍙戦�佸け璐ワ紙sendstate=5锛夈��
* <p>
* 骞傜瓑锛氬悓涓�鍘熶换鍔″彧鍏佽鐢熸垚涓�鏉″啀娆¢殢璁匡紙Redis 閿� + upid 鏍¢獙 + 鍘熶换鍔℃潯浠舵洿鏂帮級锛�
* 澶氳妭鐐�/澶氱嚎绋嬪悓鏃舵壂鎻忔椂锛屽悗鍒扮殑浜嬪姟浼氬湪鏉′欢鏇存柊澶勬嬁鍒� 0 琛屽苟鍥炴粴鏈鎻掑叆銆�
@@ -1144,47 +1138,21 @@
return "鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛屾湭鎵惧埌鎮h�呮。妗�, subTaskId = " + serviceSubtask.getId();
}
String config = configService.selectConfigByKey("visit.early.day");
- String visitType = resolveAgainVisitType(null, serviceSubtask);
- if (StringUtils.isEmpty(visitType)) {
- return "鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛岄殢璁挎柟寮忎笉鍚堟硶, visitType = " + serviceSubtask.getVisitType();
- }
String visitDeptCode;
String visitDeptName;
- if ("1".equals(visitType)) {
- // 鏈瀹ら殢璁匡細鍘熶换鍔¢殢璁跨瀹� > 鍘熶换鍔″嚭闄㈢瀹�
- String ownDeptCode = firstNonBlank(serviceSubtask.getVisitDeptCode());
- if (StringUtils.isNotEmpty(ownDeptCode)) {
- visitDeptCode = ownDeptCode;
+ // 闅忚涓績绉戝锛氭湭閰嶇疆锛堟垨绉戝涓嶅瓨鍦級鏃跺洖閫�鍘熶换鍔$瀹わ紝淇濇寔瓒呮椂鍏ュ彛鍘熸湁琛屼负
+ SysDept centerDept = selectCenterDept(serviceSubtask.getOrgid());
+ if (ObjectUtils.isNotEmpty(centerDept)) {
+ visitDeptCode = centerDept.getDeptCode();
+ visitDeptName = centerDept.getDeptName();
+ } else {
+ String fallbackDeptCode = firstNonBlank(serviceSubtask.getVisitDeptCode());
+ if (StringUtils.isNotEmpty(fallbackDeptCode)) {
+ visitDeptCode = fallbackDeptCode;
visitDeptName = serviceSubtask.getVisitDeptName();
} else {
visitDeptCode = serviceSubtask.getDeptcode();
visitDeptName = serviceSubtask.getDeptname();
- }
- if (StringUtils.isEmpty(visitDeptCode)) {
- return "鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛屾湰绉戝闅忚鏈壘鍒伴殢璁跨瀹�, subTaskId = " + serviceSubtask.getId();
- }
- SysDept ownDept = selectDeptByCode(serviceSubtask.getOrgid(), visitDeptCode);
- if (ObjectUtils.isNotEmpty(ownDept)) {
- visitDeptCode = ownDept.getDeptCode();
- visitDeptName = ownDept.getDeptName();
- } else if (StringUtils.isEmpty(visitDeptName)) {
- return "鍐嶆闅忚浠诲姟鍒涘缓澶辫触锛屾湰绉戝闅忚绉戝涓嶅瓨鍦�, deptCode = " + visitDeptCode + ", subTaskId = " + serviceSubtask.getId();
- }
- } else {
- // 闅忚涓績绉戝锛氭湭閰嶇疆锛堟垨绉戝涓嶅瓨鍦級鏃跺洖閫�鍘熶换鍔$瀹わ紝淇濇寔瓒呮椂鍏ュ彛鍘熸湁琛屼负
- SysDept centerDept = selectCenterDept(serviceSubtask.getOrgid());
- if (ObjectUtils.isNotEmpty(centerDept)) {
- visitDeptCode = centerDept.getDeptCode();
- visitDeptName = centerDept.getDeptName();
- } else {
- String fallbackDeptCode = firstNonBlank(serviceSubtask.getVisitDeptCode());
- if (StringUtils.isNotEmpty(fallbackDeptCode)) {
- visitDeptCode = fallbackDeptCode;
- visitDeptName = serviceSubtask.getVisitDeptName();
- } else {
- visitDeptCode = serviceSubtask.getDeptcode();
- visitDeptName = serviceSubtask.getDeptname();
- }
}
}
ServiceSubtask serviceSubtaskAgain = patMedInhospService.boxedServiceSubtask(nextServiceTask,
@@ -1201,7 +1169,8 @@
serviceSubtaskAgain.setIsVisitAgain(1);
serviceSubtaskAgain.setCreateTime(now);
serviceSubtaskAgain.setUpdateTime(now);
- serviceSubtaskAgain.setVisitType(visitType);
+ // 瓒呮椂鍐嶆闅忚鍥哄畾涓洪殢璁夸腑蹇冮殢璁�
+ serviceSubtaskAgain.setVisitType("2");
serviceSubtaskAgain.setVisitDeptCode(visitDeptCode);
serviceSubtaskAgain.setVisitDeptName(visitDeptName);
if (serviceSubtaskMapper.insertServiceSubtask(serviceSubtaskAgain) != 1) {
@@ -1343,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 缁撴灉
@@ -1354,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涓�
@@ -1588,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());
@@ -1661,6 +1651,8 @@
ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceTask.getTaskid());
ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
serviceSubtaskVO.setTaskid(serviceTask1.getTaskid());
+ //鍙垹闄ら娆¢殢璁挎湭瀹屾垚鐨�
+ serviceSubtaskVO.setVisitCount(1);
serviceSubtaskVO.setSendstate(2L);
List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
serviceSubtaskVO.setSendstate(1L);
@@ -1726,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();
@@ -3764,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) {
@@ -3783,6 +3782,17 @@
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);
+ }
+
//浜哄伐宸叉嫧閫氭�婚噺
if (ObjectUtils.isNotEmpty(serviceSubtask.getIsManuallyCalled())
&& serviceSubtask.getIsManuallyCalled().equals(1L)) {
@@ -3791,6 +3801,7 @@
//棣栨鍑洪櫌闅忚
if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) {
+ applyFirstFollowUpExtraStatistics(serviceSubtaskStatistic, serviceSubtask);
//棣栨搴旈殢璁�
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L)) {
serviceSubtaskStatistic.setNeedFollowUp(serviceSubtaskStatistic.getNeedFollowUp() + 1L);
@@ -3912,6 +3923,7 @@
}
}//浜屾鍑洪櫌闅忚
else if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() > 1) {
+ applyAgainFollowUpExtraStatistics(serviceSubtaskStatistic, serviceSubtask);
//鍐嶆搴旈殢璁�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUpAgain(serviceSubtaskStatistic.getNeedFollowUpAgain() + 1L);
@@ -4063,6 +4075,60 @@
}
/**
+ * 甯備竴缁熻鍙e緞锛氶娆″緟闅忚銆佸凡鍙戦�佸強浜哄伐鐢佃瘽瓒呮椂銆�
+ */
+ private void applyFirstFollowUpExtraStatistics(ServiceSubtaskStatistic statistic, ServiceSubtask serviceSubtask) {
+ if (serviceSubtask.getVisitCount() == null || serviceSubtask.getVisitCount() != 1 || serviceSubtask.getSendstate() == null) {
+ return;
+ }
+ Long sendstate = serviceSubtask.getSendstate();
+ if (sendstate.equals(3L)) {
+ statistic.setSent(statistic.getSent() + 1L);
+ }
+ if (sendstate.equals(7L) && isManuallyNotCalled(serviceSubtask)) {
+ statistic.setManualCallTimeout(statistic.getManualCallTimeout() + 1L);
+ }
+ if (sendstate.equals(1L) || sendstate.equals(2L) || sendstate.equals(3L) || sendstate.equals(7L)) {
+ statistic.setPendingFollowUpAll(statistic.getPendingFollowUpAll() + 1L);
+ }
+ if (sendstate.equals(1L) || sendstate.equals(2L)) {
+ statistic.setPendingFollowUpWaitSend(statistic.getPendingFollowUpWaitSend() + 1L);
+ }
+ if (sendstate.equals(3L) || sendstate.equals(7L)) {
+ statistic.setPendingFollowUpSent(statistic.getPendingFollowUpSent() + 1L);
+ }
+ }
+
+ /**
+ * 甯備竴缁熻鍙e緞锛氬啀娆″緟闅忚銆佸凡鍙戦�佸強浜哄伐鐢佃瘽瓒呮椂銆�
+ */
+ private void applyAgainFollowUpExtraStatistics(ServiceSubtaskStatistic statistic, ServiceSubtask serviceSubtask) {
+ if (serviceSubtask.getVisitCount() == null || serviceSubtask.getVisitCount() <= 1 || serviceSubtask.getSendstate() == null) {
+ return;
+ }
+ Long sendstate = serviceSubtask.getSendstate();
+ if (sendstate.equals(3L)) {
+ statistic.setSentAgain(statistic.getSentAgain() + 1L);
+ }
+ if (sendstate.equals(7L) && isManuallyNotCalled(serviceSubtask)) {
+ statistic.setManualCallTimeoutAgain(statistic.getManualCallTimeoutAgain() + 1L);
+ }
+ if (sendstate.equals(1L) || sendstate.equals(2L) || sendstate.equals(3L) || sendstate.equals(7L)) {
+ statistic.setPendingFollowUpAllAgain(statistic.getPendingFollowUpAllAgain() + 1L);
+ }
+ if (sendstate.equals(1L) || sendstate.equals(2L)) {
+ statistic.setPendingFollowUpWaitSendAgain(statistic.getPendingFollowUpWaitSendAgain() + 1L);
+ }
+ if (sendstate.equals(3L) || sendstate.equals(7L)) {
+ statistic.setPendingFollowUpSentAgain(statistic.getPendingFollowUpSentAgain() + 1L);
+ }
+ }
+
+ private boolean isManuallyNotCalled(ServiceSubtask serviceSubtask) {
+ return serviceSubtask.getIsManuallyCalled() != null && serviceSubtask.getIsManuallyCalled().equals(0L);
+ }
+
+ /**
* 棣栨闅忚缁熻
*
* @param serviceSubtaskList
@@ -4083,6 +4149,7 @@
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+ applyFirstFollowUpExtraStatistics(serviceSubtaskStatistic, serviceSubtask);
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
@@ -4256,6 +4323,7 @@
//鍑洪櫌浜烘
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+ applyAgainFollowUpExtraStatistics(serviceSubtaskStatistic, serviceSubtask);
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
@@ -4797,6 +4865,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
@@ -4832,6 +4902,16 @@
* taskSituation5Info - taskSituation = 5
* taskSituation6Info - taskSituation = 7
* manuallyCalledInfo - isManuallyCalled = 1L
+ * manualCallTimeoutInfo - visitCount = 1 && sendstate = 7 && isManuallyCalled = 0
+ * manualCallTimeoutAgainInfo - visitCount > 1 && sendstate = 7 && isManuallyCalled = 0
+ * pendingFollowUpAllInfo - visitCount = 1 && sendstate in (1,2,3,7)
+ * pendingFollowUpAllAgainInfo - visitCount > 1 && sendstate in (1,2,3,7)
+ * pendingFollowUpWaitSendInfo - visitCount = 1 && sendstate in (1,2)
+ * pendingFollowUpWaitSendAgainInfo - visitCount > 1 && sendstate in (1,2)
+ * pendingFollowUpSentInfo - visitCount = 1 && sendstate in (3,7)
+ * pendingFollowUpSentAgainInfo - visitCount > 1 && sendstate in (3,7)
+ * sentInfo - visitCount = 1 && sendstate = 3
+ * sentAgainInfo - visitCount > 1 && sendstate = 3
* filterCountList - taskSituation = 6 && sendstate = 4
*
*/
@@ -4839,7 +4919,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();
@@ -4860,7 +4943,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);
@@ -4873,6 +4956,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,9 +5120,52 @@
case "manuallyCalledInfo":
serviceSubtaskCountReq.setIsManuallyCalled(1L);
break;
+ case "manualCallTimeoutInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(7L)));
+ serviceSubtaskCountReq.setIsManuallyCalled(0L);
+ break;
+ case "manualCallTimeoutAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(7L)));
+ serviceSubtaskCountReq.setIsManuallyCalled(0L);
+ break;
+ case "pendingFollowUpAllInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 7L)));
+ break;
+ case "pendingFollowUpAllAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 7L)));
+ break;
+ case "pendingFollowUpWaitSendInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L)));
+ break;
+ case "pendingFollowUpWaitSendAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L)));
+ break;
+ case "pendingFollowUpSentInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(3L, 7L)));
+ break;
+ case "pendingFollowUpSentAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(3L, 7L)));
+ break;
+ case "sentInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(3L)));
+ break;
+ case "sentAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(3L)));
+ break;
default:
break;
}
+ return true;
}
@@ -5365,6 +5507,8 @@
// 鍒濆鍖栨暟鍊煎瓧娈�
total.setDischargeCount(0);
+ total.setFirstDischargeCount(0L);
+ total.setAgainFollowUpPushCount(0L);
total.setNonFollowUp(0L);
total.setFilterCount(0L);
total.setFollowUpNeeded(0L);
@@ -5379,6 +5523,16 @@
total.setAbnormal(0L);
total.setNeedFollowUpAgain(0L);
total.setPendingFollowUpAgain(0L);
+ total.setManualCallTimeout(0L);
+ total.setManualCallTimeoutAgain(0L);
+ total.setPendingFollowUpAll(0L);
+ total.setPendingFollowUpAllAgain(0L);
+ total.setPendingFollowUpWaitSend(0L);
+ total.setPendingFollowUpWaitSendAgain(0L);
+ total.setPendingFollowUpSent(0L);
+ total.setPendingFollowUpSentAgain(0L);
+ total.setSent(0L);
+ total.setSentAgain(0L);
total.setFollowUpSuccessAgain(0L);
total.setFollowUpFailAgain(0L);
total.setManualAgain(0L);
@@ -5397,6 +5551,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));
@@ -5411,6 +5567,16 @@
total.setAbnormal(total.getAbnormal() + (stat.getAbnormal() != null ? stat.getAbnormal() : 0L));
total.setNeedFollowUpAgain(total.getNeedFollowUpAgain() + (stat.getNeedFollowUpAgain() != null ? stat.getNeedFollowUpAgain() : 0L));
total.setPendingFollowUpAgain(total.getPendingFollowUpAgain() + (stat.getPendingFollowUpAgain() != null ? stat.getPendingFollowUpAgain() : 0L));
+ total.setManualCallTimeout(total.getManualCallTimeout() + (stat.getManualCallTimeout() != null ? stat.getManualCallTimeout() : 0L));
+ total.setManualCallTimeoutAgain(total.getManualCallTimeoutAgain() + (stat.getManualCallTimeoutAgain() != null ? stat.getManualCallTimeoutAgain() : 0L));
+ total.setPendingFollowUpAll(total.getPendingFollowUpAll() + (stat.getPendingFollowUpAll() != null ? stat.getPendingFollowUpAll() : 0L));
+ total.setPendingFollowUpAllAgain(total.getPendingFollowUpAllAgain() + (stat.getPendingFollowUpAllAgain() != null ? stat.getPendingFollowUpAllAgain() : 0L));
+ total.setPendingFollowUpWaitSend(total.getPendingFollowUpWaitSend() + (stat.getPendingFollowUpWaitSend() != null ? stat.getPendingFollowUpWaitSend() : 0L));
+ total.setPendingFollowUpWaitSendAgain(total.getPendingFollowUpWaitSendAgain() + (stat.getPendingFollowUpWaitSendAgain() != null ? stat.getPendingFollowUpWaitSendAgain() : 0L));
+ total.setPendingFollowUpSent(total.getPendingFollowUpSent() + (stat.getPendingFollowUpSent() != null ? stat.getPendingFollowUpSent() : 0L));
+ total.setPendingFollowUpSentAgain(total.getPendingFollowUpSentAgain() + (stat.getPendingFollowUpSentAgain() != null ? stat.getPendingFollowUpSentAgain() : 0L));
+ total.setSent(total.getSent() + (stat.getSent() != null ? stat.getSent() : 0L));
+ 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.setManualAgain(total.getManualAgain() + (stat.getManualAgain() != null ? stat.getManualAgain() : 0L));
@@ -5791,7 +5957,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