From fe47ff909096722ba8e9172c3e1f0f7910b16909 Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期二, 21 十月 2025 14:49:18 +0800
Subject: [PATCH] 结束出院日期格式
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 280 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 263 insertions(+), 17 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 de6eb96..c41df45 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -15,7 +15,6 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.ListOperations;
@@ -24,6 +23,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.Duration;
@@ -854,7 +854,7 @@
//鏈変笅涓�棰�
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES);
IvrTaskTemplateScriptVO nextQuestion = getNextQuestion(IvrTaskTemplateScriptVOs, nowQuestion);
- // 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
+ // 闂锛� 鍘昏皟鐢�"tts鍚堟垚鍜屾挱鏀�"鎺ュ彛
String date = simpleDateFormat1.format(new Date());
log.info("鍘昏皟鐢╰ts鍚堟垚鍜屾挱鏀炬帴鍙�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
phoneUtils.ttsPlayback(nowQuestion.getIvrtext(), phoneCallBackVO.getUuid());
@@ -863,7 +863,7 @@
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", noVoice + 1, 120, TimeUnit.MINUTES);
//璋冪敤ivrLibaTemplateScriptVO涓殑slienceText(闈欓粯璇濇湳)
String slienceText = nowQuestion.getSlienceText();
- //闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
+ //闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢�"tts鍚堟垚鍜屾挱鏀�"鎺ュ彛
String date = simpleDateFormat1.format(new Date());
log.info("闈欓粯璇濇湳 + 闂,鍘昏皟鐢╰ts鍚堟垚鍜屾挱鏀炬帴鍙�: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
phoneUtils.ttsPlayback(slienceText + nowQuestion.getIvrtext(), phoneCallBackVO.getUuid());
@@ -1028,9 +1028,9 @@
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES);
redisCache.setCacheObject(phoneCallBackVO.getUuid() + "isOver", 1, 120, TimeUnit.MINUTES);
}
- //璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback鈥濆皢缁撴灉浼犲洖
+ //璋冪敤"15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback"灏嗙粨鏋滀紶鍥�
String date = simpleDateFormat1.format(new Date());
- log.info("璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀�------: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
+ log.info("璋冪敤tts鍚堟垚鍜屾挱鏀�------: {},uuid涓猴細{}", date, phoneCallBackVO.getUuid());
phoneUtils.ttsPlayback(nowQuestion.getIvrtext() + ivrTaskTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid());
}
break;
@@ -1061,7 +1061,7 @@
if ("AsrCallback".equals(phoneCallReqYQVO.getOperate()) && phoneCallReqYQVO.getEnd_time() != null && phoneCallReqYQVO.getEnd_time() != -1) {
//澶勭悊鎸傛柇
if (phoneCallReqYQVO.getAsrtext().contains("鎷ㄥ彨鐨勭敤鎴锋蹇�")) {
- //鍒ゆ柇 recordAccept-hungup 鏄惁鏈夊�硷紝濡傛灉鏈夛紝鍒欒鏄庝笉鐢ㄥ鐞嗕簡锛屼箣鍓嶅凡缁忓鐞嗚繃浜嗭紙recordAccept-hungup杩欎釜涓昏鏄粰鈥滈�氳瘽璁板綍鐢ㄧ殑锛屸�濓級
+ //鍒ゆ柇 recordAccept-hungup 鏄惁鏈夊�硷紝濡傛灉鏈夛紝鍒欒鏄庝笉鐢ㄥ鐞嗕簡锛屼箣鍓嶅凡缁忓鐞嗚繃浜嗭紙recordAccept-hungup杩欎釜涓昏鏄粰"閫氳瘽璁板綍鐢ㄧ殑锛�"锛�
Object cacheObject = redisCache.getCacheObject(phoneCallReqYQVO.getTaskid() + "recordAccept-hungup");
if (ObjectUtils.isNotEmpty(cacheObject) && String.valueOf(cacheObject).equals("1")) {
return new PhoneCallBackYQVO();
@@ -1918,14 +1918,14 @@
// //鏈変笅涓�棰�
// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", 0, 120, TimeUnit.MINUTES);
// IvrLibaTemplateScriptVO nextQuestion = getNextQuestion(ivrLibaTemplateScriptVOs, nowQuestion);
-// // 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
+// // 闂锛� 鍘昏皟鐢�"tts鍚堟垚鍜屾挱鏀�"鎺ュ彛
// phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid());
// }
// } else {
// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", noVoice + 1, 120, TimeUnit.MINUTES);
// //璋冪敤ivrLibaTemplateScriptVO涓殑slienceText(闈欓粯璇濇湳)
// String slienceText = nowQuestion.getSlienceText();
-// //闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢ㄢ�渢ts鍚堟垚鍜屾挱鏀锯�濇帴鍙�
+// //闈欓粯璇濇湳 + 闂锛� 鍘昏皟鐢�"tts鍚堟垚鍜屾挱鏀�"鎺ュ彛
// phoneUtils.ttsPlayback(slienceText + nowQuestion.getQuestionText(), phoneCallBackVO.getUuid());
// return new PhoneCallBackVO();
// }
@@ -2035,7 +2035,7 @@
// redisCache.setCacheObject(phoneCallBackVO.getUuid() + "isOver", 1, 120, TimeUnit.MINUTES);
// }
//
-// //璋冪敤鈥�15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback鈥濆皢缁撴灉浼犲洖
+// //璋冪敤"15銆乼ts鍚堟垚鍜屾挱鏀撅紝 tts_playback"灏嗙粨鏋滀紶鍥�
//
//
// }
@@ -2187,6 +2187,37 @@
}
/**
+ * 鏈嶅姟缁熻鏌ヨ - 鎸夋椂闂寸淮搴︾粺璁″嚭闄�/闂ㄨ瘖闅忚鏁版嵁
+ *
+ * @param request 缁熻璇锋眰鍙傛暟
+ * @return 缁熻缁撴灉鍒楄〃
+ */
+ @Override
+ public List<ServiceStatisticsResponse> getServiceStatistics(ServiceStatisticsRequest request) {
+ log.info("getServiceStatistics鐨勫叆鍙備负锛歿}", request);
+
+ // 鍙傛暟鏍¢獙
+ if (request.getStartDate() == null || request.getEndDate() == null) {
+ throw new IllegalArgumentException("寮�濮嬫棩鏈熷拰缁撴潫鏃ユ湡涓嶈兘涓虹┖");
+ }
+
+ if (request.getStartDate().after(request.getEndDate())) {
+ throw new IllegalArgumentException("寮�濮嬫棩鏈熶笉鑳芥櫄浜庣粨鏉熸棩鏈�");
+ }
+
+ // 濡傛灉timeType涓虹┖锛岄粯璁ゆ寜澶╃粺璁�
+ if (StringUtils.isEmpty(request.getTimeType())) {
+ request.setTimeType("day");
+ }
+
+ List<ServiceStatisticsResponse> result = serviceSubtaskMapper.getServiceStatistics(request);
+
+
+ log.info("getServiceStatistics杩斿洖缁撴灉鏁伴噺锛歿}", result.size());
+ return result;
+ }
+
+ /**
* 鑾峰彇闅忚缁熻姣斾緥
*
* @param serviceSubtaskCountReq
@@ -2196,14 +2227,25 @@
public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
log.error("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
- //Map<String, List<ServiceSubtask>> collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
+ List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
+
+ // 鏍规嵁鏉′欢杩涜鍒嗙粍
Map<String, List<ServiceSubtask>> collect = new HashMap<>();
+
if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && serviceSubtaskCountReq.getLeavehospitaldistrictcodes().size() > 0) {
- collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
-
+ if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown")));
+ } else {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
+ }
} else if (serviceSubtaskCountReq.getDeptcodes() != null && serviceSubtaskCountReq.getDeptcodes().size() > 0) {
- collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptname()).orElse("Unknown")));
+ if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown")));
+ } else {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptname()).orElse("Unknown")));
+ }
}
+
for (List<ServiceSubtask> serviceSubtaskList : collect.values()) {
if (CollectionUtils.isEmpty(serviceSubtaskList)) {
continue;
@@ -2213,11 +2255,86 @@
//鍙婃椂鐜�
ServiceSubtask ss = new ServiceSubtask();
ss.setOrgid(serviceSubtaskList.get(0).getOrgid());
- if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) {
- ss.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
- } else {
- ss.setDeptcode(serviceSubtaskList.get(0).getDeptcode());
+
+ // 濡傛灉鏈夊尰鐢熺紪鐮侊紝璁剧疆鍖荤敓缂栫爜鐢ㄤ簬鍙婃椂鐜囨煡璇�
+ if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
+ ss.setDrcode(serviceSubtaskList.get(0).getDrcode());
+ }else {
+ if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) {
+ ss.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
+ } else if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) {
+ ss.setDeptcode(serviceSubtaskList.get(0).getDeptcode());
+ }
}
+
+ ss.setStarttime(serviceSubtaskCountReq.getStartTime());
+ ss.setEndtime(serviceSubtaskCountReq.getEndTime());
+ if (serviceSubtaskCountReq.getEndTime() != null && new Date().before(serviceSubtaskCountReq.getEndTime())) {
+ ss.setEndtime(new Date());
+ }
+ Double jsRate = serviceSubtaskMapper.selectTimelyRate(ss);
+ statistic.setRate(jsRate);
+
+ if (ObjectUtils.isNotEmpty(statistic)) {
+ serviceSubtaskStatistics.add(statistic);
+ }
+ }
+ return serviceSubtaskStatistics;
+ }
+
+ /**
+ * 鑾峰彇闅忚缁熻姣斾緥
+ *
+ * @param serviceSubtaskCountReq
+ * @return
+ */
+ @Override
+ public List<ServiceSubtaskStatistic> getSfStatisticsJoy(ServiceSubtaskCountReq serviceSubtaskCountReq) {
+ log.error("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
+ List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
+
+ // 鏍规嵁鏉′欢杩涜鍒嗙粍
+ Map<String, List<ServiceSubtask>> collect = new HashMap<>();
+
+ if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && serviceSubtaskCountReq.getLeavehospitaldistrictcodes().size() > 0) {
+ if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown")));
+
+ } else {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown")));
+ }
+ } else if (serviceSubtaskCountReq.getDeptcodes() != null && serviceSubtaskCountReq.getDeptcodes().size() > 0) {
+ if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown")));
+ } else {
+ collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptname()).orElse("Unknown")));
+ }
+ }
+ List<ServiceSubtaskCount> joySubCount=serviceSubtaskMapper.getSfStatisticsJoy(serviceSubtaskCountReq);
+ for (List<ServiceSubtask> serviceSubtaskList : collect.values()) {
+ if (CollectionUtils.isEmpty(serviceSubtaskList)) {
+ continue;
+ }
+ ServiceSubtaskStatistic statistic = getStatisticJoy(serviceSubtaskList,joySubCount);
+ if(statistic.getJoyCount()!=0&&statistic.getJoyAllCount()!=0) {
+ Double joyTotal = Double.parseDouble(statistic.getJoyCount() + "") / Double.parseDouble(statistic.getJoyAllCount() + "") * 100;
+ statistic.setJoyTotal(String.format("%.2f", joyTotal)+"%");
+ }
+ //鍙婃椂鐜�
+ ServiceSubtask ss = new ServiceSubtask();
+ ss.setOrgid(serviceSubtaskList.get(0).getOrgid());
+
+ // 濡傛灉鏈夊尰鐢熺紪鐮侊紝璁剧疆鍖荤敓缂栫爜鐢ㄤ簬鍙婃椂鐜囨煡璇�
+ if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
+ ss.setDrcode(serviceSubtaskList.get(0).getDrcode());
+ }else {
+ if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) {
+ ss.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
+ } else if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) {
+ ss.setDeptcode(serviceSubtaskList.get(0).getDeptcode());
+ }
+ }
+
ss.setStarttime(serviceSubtaskCountReq.getStartTime());
ss.setEndtime(serviceSubtaskCountReq.getEndTime());
if (serviceSubtaskCountReq.getEndTime() != null && new Date().before(serviceSubtaskCountReq.getEndTime())) {
@@ -2241,6 +2358,8 @@
serviceSubtaskStatistic.setDeptcode(serviceSubtaskList.get(0).getDeptcode());
serviceSubtaskStatistic.setLeavehospitaldistrictname(serviceSubtaskList.get(0).getLeavehospitaldistrictname());
serviceSubtaskStatistic.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
+ serviceSubtaskStatistic.setDrcode(serviceSubtaskList.get(0).getDrcode());
+ serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
//鍑洪櫌浜烘
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
@@ -2261,7 +2380,130 @@
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L);
}
+ if (serviceSubtask.getSendstate() != null && ( serviceSubtask.getSendstate() == 6)) {
+ serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
+ serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L);
+ }
+ if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
+ double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
+ serviceSubtaskStatistic.setFollowUpRate(percentFormat.format(rate));
+ } else {
+ serviceSubtaskStatistic.setFollowUpRate("0.00%");
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) {
+ serviceSubtaskStatistic.setAbnormal(serviceSubtaskStatistic.getAbnormal() + 1L);
+ }
+ }//浜屾鍑洪櫌闅忚
+ else if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() > 1) {
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
+ serviceSubtaskStatistic.setNeedFollowUpAgain(serviceSubtaskStatistic.getNeedFollowUpAgain() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
+ serviceSubtaskStatistic.setPendingFollowUpAgain(serviceSubtaskStatistic.getPendingFollowUpAgain() + 1L);
+ }
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) {
+ serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
+ serviceSubtaskStatistic.setFollowUpFailAgain(serviceSubtaskStatistic.getFollowUpFailAgain() + 1L);
+ }
+ if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
+ double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
+ serviceSubtaskStatistic.setFollowUpRateAgain(percentFormat.format(rate));
+ } else {
+ serviceSubtaskStatistic.setFollowUpRateAgain("0.00%");
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) {
+ serviceSubtaskStatistic.setAbnormalAgain(serviceSubtaskStatistic.getAbnormalAgain() + 1L);
+ }
+ }
+ //闅忚鎯呭喌
+ if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==1) {
+ serviceSubtaskStatistic.setTaskSituation1(serviceSubtaskStatistic.getTaskSituation1() + 1);
+ }
+ if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==2) {
+ serviceSubtaskStatistic.setTaskSituation2(serviceSubtaskStatistic.getTaskSituation2() + 1);
+ }
+ if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==3) {
+ serviceSubtaskStatistic.setTaskSituation3(serviceSubtaskStatistic.getTaskSituation3() + 1);
+ }
+ if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==4) {
+ serviceSubtaskStatistic.setTaskSituation4(serviceSubtaskStatistic.getTaskSituation4() + 1);
+ }
+ if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==5) {
+ serviceSubtaskStatistic.setTaskSituation5(serviceSubtaskStatistic.getTaskSituation5() + 1);
+ }
+ if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() ==6) {
+ serviceSubtaskStatistic.setTaskSituation6(serviceSubtaskStatistic.getTaskSituation6() + 1);
+ }
+ }
+
+
+ return serviceSubtaskStatistic;
+ }
+
+ private ServiceSubtaskStatistic getStatisticJoy(List<ServiceSubtask> serviceSubtaskList,List<ServiceSubtaskCount> joySubCount) {
+ ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic();
+ //鏍煎紡鍖栦负涓や綅灏忔暟鐨勭櫨鍒嗘瘮
+ DecimalFormat percentFormat = new DecimalFormat("##.##%");
+ serviceSubtaskStatistic.setDeptname(serviceSubtaskList.get(0).getDeptname());
+ serviceSubtaskStatistic.setDeptcode(serviceSubtaskList.get(0).getDeptcode());
+ serviceSubtaskStatistic.setLeavehospitaldistrictname(serviceSubtaskList.get(0).getLeavehospitaldistrictname());
+ serviceSubtaskStatistic.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
+ serviceSubtaskStatistic.setDrcode(serviceSubtaskList.get(0).getDrcode());
+ serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
+ //鍑洪櫌浜烘
+ serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
+ serviceSubtaskStatistic.setJoyCount(0);
+ serviceSubtaskStatistic.setJoyAllCount(0);
+ for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
+ //婊℃剰搴�
+ List<ServiceSubtaskCount> joyCountTemp= joySubCount.stream().filter(r->r.getSubTaskId().equals(serviceSubtask.getId()))
+ .collect(Collectors.toList());
+ if(joyCountTemp!=null&&joyCountTemp.size()>0){
+ if(ObjectUtils.isNotEmpty(joyCountTemp.get(0).getJoyCount()))
+ serviceSubtaskStatistic.setJoyCount(serviceSubtaskStatistic.getJoyCount()+joyCountTemp.get(0).getJoyCount());
+ if(ObjectUtils.isNotEmpty(joyCountTemp.get(0).getJoyAllCount()))
+ serviceSubtaskStatistic.setJoyAllCount(serviceSubtaskStatistic.getJoyAllCount()+joyCountTemp.get(0).getJoyAllCount());
+ }
+ //鏃犻渶闅忚浜烘
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
+ serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
+ }
+ //搴旈殢璁夸汉娆�
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
+ serviceSubtaskStatistic.setFollowUpNeeded(serviceSubtaskStatistic.getFollowUpNeeded() + 1L);
+ }
+
+ //棣栨鍑洪櫌闅忚
+ if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) {
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
+ serviceSubtaskStatistic.setNeedFollowUp(serviceSubtaskStatistic.getNeedFollowUp() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
+ serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L);
+ }
+ if (serviceSubtask.getSendstate() != null && ( serviceSubtask.getSendstate() == 6)) {
serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
@@ -2438,4 +2680,8 @@
int remainingCalls = (int) (remainingHours * phoneUpEveryHour);
return remainingCalls;
}
+
+ public List<ServiceSubtaskCount> getSfStatisticsJoydetails(ServiceSubtaskCountReq serviceSubtaskCountReq) {
+ return serviceSubtaskMapper.getSfStatisticsJoydetails(serviceSubtaskCountReq);
+ }
}
--
Gitblit v1.9.3