From fbe0fc0d9ee2012f6083bd802670453d788002d6 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 22 九月 2026 11:36:04 +0800
Subject: [PATCH] 【丽水】导出时间格式问题处理
---
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 3302 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 2,609 insertions(+), 693 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 007e5af..7afbcc6 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -6,18 +6,29 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
+import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.core.service.IConfigService;
import com.ruoyi.common.dx.MessageSend;
+import com.ruoyi.common.enums.WxGZHEnum;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
-import com.ruoyi.common.core.service.IConfigService;
+import com.ruoyi.common.utils.http.HttpUtils;
+import com.ruoyi.common.utils.sms.smsUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
+import com.ruoyi.system.service.ISysConfigService;
import com.smartor.common.FtpService;
+import com.smartor.common.MtSubmitSmUtil;
+import com.smartor.common.ScheduleSubtaskBuilder;
import com.smartor.config.PhoneUtils;
+import com.smartor.domain.DTO.MydTrendReqDTO;
+import com.smartor.domain.DTO.MzMydScoreRankDTO;
+import com.smartor.domain.DTO.QuestionCountKsOrBqDTO;
import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
import com.smartor.domain.*;
-import com.smartor.domain.VO.HeLibraryCountVO;
-import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO;
+import com.smartor.domain.VO.*;
import com.smartor.domain.entity.ServiceSubtaskEntity;
import com.smartor.mapper.*;
import com.smartor.service.*;
@@ -25,6 +36,7 @@
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
+import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
@@ -36,18 +48,21 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.ZoneId;
+import java.time.*;
import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+
+import static cn.hutool.core.convert.Convert.toHex;
/**
* 鍗曚竴浠诲姟锛堥殢璁匡級Service涓氬姟灞傚鐞�
@@ -78,6 +93,8 @@
@Autowired
private IServiceTaskdeptService serviceTaskdeptService;
+ @Autowired
+ private IServiceTaskmedicalService serviceTaskmedicalService;
@Autowired
private IServiceTaskdiagService serviceTaskdiagService;
@@ -113,6 +130,15 @@
private IServiceSubtaskDetailTraceService traceService;
@Autowired
+ private IServiceTaskScheduleService serviceTaskScheduleService;
+
+ @Autowired
+ private IPatArchiveService patArchiveService;
+
+ @Autowired
+ private ScheduleSubtaskBuilder scheduleSubtaskBuilder;
+
+ @Autowired
private FtpService ftpService;
@Autowired
@@ -127,6 +153,9 @@
@Autowired
private SvyLibScriptCategoryMapper svyLibScriptCategoryMapper;
+ @Autowired
+ private IPatMedInhospService patMedInhospService;
+
@Value("${pri_key}")
private String pri_key;
@@ -135,6 +164,15 @@
@Value("${ASRCallBackPath}")
private String ASRCallBackPath;
+
+ @Autowired
+ private ISysConfigService configService;
+
+ @Autowired
+ private MtSubmitSmUtil mtSubmitSmUtil;
+
+ @Autowired
+ private SysConfigMapper sysConfigMapper;
@Autowired
private RedisTemplate redisTemplate;
@@ -166,10 +204,19 @@
private Integer phoneEndHour;
@Autowired
- private Icd10Mapper icd10Mapper;
+ private IPatMedOuthospService patMedOuthospService;
+ @Autowired
+ private SysDept2Mapper sysDept2Mapper;
@Value("${spring.profiles.active}")
private String active;
+
+ @Autowired
+ private ServiceOutPathMapper serviceOutPathMapper;
+
+ private static final String KEY_SEP = "\u0001";
+ @Autowired
+ private PatMedOperationItemMapper patMedOperationItemMapper;
/**
* 鏌ヨ鍗曚竴浠诲姟锛堥殢璁匡級
@@ -236,6 +283,7 @@
e.printStackTrace();
}
+ findServiceTaskScheduleVO(serviceTaskVO);
return serviceTaskVO;
}
@@ -329,35 +377,49 @@
}
//鑾峰彇璇ユ偅鑰呮墍鏈夌殑鎵ц鐘舵��
- List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream().filter((item -> item.getSubid().equals(serviceSubtask1.getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
- List<Map<String, Object>> resultList = serviceSubtaskPreachformList.stream().map(item -> {
- Map<String, Object> map = new HashMap<>();
- map.put("sort", item.getSort());
- map.put("preachform", item.getPreachform());
- map.put("compensateTime", item.getCompensateTime());
- return map;
- }).collect(Collectors.toList());
- serviceTaskVO.setPreachformList(resultList);
+// List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream().filter((item -> item.getSubid().equals(serviceSubtask1.getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
+// List<Map<String, Object>> resultList = serviceSubtaskPreachformList.stream().map(item -> {
+// Map<String, Object> map = new HashMap<>();
+// map.put("sort", item.getSort());
+// map.put("preachform", item.getPreachform());
+// map.put("compensateTime", item.getCompensateTime());
+// return map;
+// }).collect(Collectors.toList());
+// serviceTaskVO.setPreachformList(resultList);
// String result = resultList.stream().map(mapList1 -> mapList1.get("preachform")).map(String::valueOf).collect(Collectors.joining(","));
// serviceTaskVO.setPreachform(result);
}
+
+ if (StringUtils.isNotEmpty(serviceTaskVO.getPreachformDesc())) {
+ //鐩存帴閫氳繃PreachformDesc鐢熸垚List杩斿洖
+ try {
+ List<Map<String, Object>> mapList = objectMapper.readValue(serviceTaskVO.getPreachformDesc(), List.class);
+ serviceTaskVO.setPreachformList(mapList);
+ } catch (Exception e) {
+ }
+ } else {
+ if (CollectionUtils.isNotEmpty(list)) {
+ //鑾峰彇璇ユ偅鑰呮墍鏈夌殑鎵ц鐘舵��
+ List<ServiceSubtaskPreachform> serviceSubtaskPreachformList = serviceSubtaskPreachformLists.stream().filter((item -> item.getSubid().equals(list.get(0).getId()) && item.getTaskid().equals(serviceTask.getTaskid()))).collect(Collectors.toList());
+ List<Map<String, Object>> resultList = serviceSubtaskPreachformList.stream().map(item -> {
+ Map<String, Object> map = new HashMap<>();
+ map.put("sort", item.getSort());
+ map.put("preachform", item.getPreachform());
+ map.put("compensateTime", item.getCompensateTime());
+ return map;
+ }).collect(Collectors.toList());
+ serviceTaskVO.setPreachformList(resultList);
+ }
+ }
serviceTaskVO.setPatTaskRelevances(patTaskRelevances);
+ findServiceTaskScheduleVO(serviceTaskVO);
return serviceTaskVO;
}
@Override
public List<ServiceSubtaskRes> patItem(ServiceSubtaskEntity serviceSubtaskEntity) {
- if (serviceSubtaskEntity.getSendstateView() != null) {
- // 1锛氬緟闅忚锛�2 寰呭彂閫侊級锛�2锛氶殢璁夸腑锛�3 宸插彂閫併��1 琚鍙栵級銆�3锛氭湭瀹屾垚锛�5 鍙戦�佸け璐ャ��7銆佽秴鏃讹級銆�4锛氬凡瀹屾垚锛� 6 宸插畬鎴愶級銆�5锛氭棤闇�闅忚锛�4 涓嶆墽琛岋級
- if (serviceSubtaskEntity.getSendstateView() == 1) serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(2L)));
- if (serviceSubtaskEntity.getSendstateView() == 2) serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(1L, 3L)));
- if (serviceSubtaskEntity.getSendstateView() == 3) serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(5L, 7L)));
- if (serviceSubtaskEntity.getSendstateView() == 4) serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(6L)));
- if (serviceSubtaskEntity.getSendstateView() == 5) serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(4L)));
- }
-
- List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskEntity);
+ List<ServiceSubtask> selectServiceSubtaskList = getServiceSubtasks(serviceSubtaskEntity);
List<ServiceSubtaskRes> serviceSubtaskResList = new ArrayList<>();
for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
@@ -366,16 +428,131 @@
serviceSubtaskRes.setContinueContent(serviceSubtask.getContinueContent());
}
// 1锛氬緟闅忚锛�2 寰呭彂閫侊級锛�2锛氶殢璁夸腑锛�3 宸插彂閫併��1 琚鍙栵級銆�3锛氭湭瀹屾垚锛�5 鍙戦�佸け璐ャ��7銆佽秴鏃讹級銆�4锛氬凡瀹屾垚锛� 6 宸插畬鎴愶級銆�5锛氭棤闇�闅忚锛�4 涓嶆墽琛岋級
- if (serviceSubtaskRes.getSendstate() == 2) serviceSubtaskRes.setSendstateView(1L);
- if (serviceSubtaskRes.getSendstate() == 1 || serviceSubtaskRes.getSendstate() == 3L)
- serviceSubtaskRes.setSendstateView(2L);
- if (serviceSubtaskRes.getSendstate() == 5 || serviceSubtaskRes.getSendstate() == 7L)
- serviceSubtaskRes.setSendstateView(3L);
- if (serviceSubtaskRes.getSendstate() == 6) serviceSubtaskRes.setSendstateView(4L);
- if (serviceSubtaskRes.getSendstate() == 4) serviceSubtaskRes.setSendstateView(5L);
+ if (serviceSubtaskRes.getSendstate() == 1 || serviceSubtaskRes.getSendstate() == 2L || serviceSubtaskRes.getSendstate() == 3L || serviceSubtaskRes.getSendstate() == 5 || serviceSubtaskRes.getSendstate() == 7L)
+ serviceSubtaskRes.setSendstateView(1L);
+ if (serviceSubtaskRes.getSendstate() == 6) serviceSubtaskRes.setSendstateView(2L);
+ if (serviceSubtaskRes.getSendstate() == 4) serviceSubtaskRes.setSendstateView(3L);
+ // 濉厖褰撳墠琛ュ伩
+ if (StringUtils.isEmpty(serviceSubtask.getCurrentPreachform())) {
+ if (StringUtils.isNotEmpty(serviceSubtask.getPreachform())) {
+ //榛樿鍙栫涓�涓�
+ serviceSubtaskRes.setCurrentPreachform(serviceSubtask.getPreachform().split(",")[0]);
+ }
+ }
+ PatMedInhosp inhosp = patMedInhospMapper.selectPatMedInhospByInhospid(serviceSubtask.getInhospid());
+ if (ObjectUtils.isNotEmpty(inhosp)) {
+ PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(inhosp.getPatid());
+ if (ObjectUtils.isNotEmpty(patArchive)) {
+ Map<String, String> stringStringMap = calculateAge(patArchive.getBirthdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now());
+ serviceSubtaskRes.setAge(StringUtils.isNotEmpty(stringStringMap.get("age")) ? Long.valueOf(stringStringMap.get("age")) : null);
+ serviceSubtaskRes.setSex(patArchive.getSex());
+ serviceSubtaskRes.setSexName(patArchive.getSex() != null ? (patArchive.getSex() == 1 ? "鐢�" : "濂�") : null);
+ }
+ serviceSubtaskRes.setHospno(inhosp.getInhospno());
+ serviceSubtaskRes.setPatno(inhosp.getPatno());
+ }
+
serviceSubtaskResList.add(serviceSubtaskRes);
}
return serviceSubtaskResList;
+ }
+
+ public List<ServiceSubtask> getServiceSubtasks(ServiceSubtaskEntity serviceSubtaskEntity) {
+ if (serviceSubtaskEntity.getSendstateView() != null) {
+ // 1锛氬緟闅忚锛�1 琚鍙栥��2 寰呭彂閫併��3 宸插彂閫併��5 鍙戦�佸け璐ャ��7銆佽秴鏃讹級锛�2锛氬凡瀹屾垚锛� 6 宸插畬鎴愶級銆�3锛氭棤闇�闅忚锛�4 涓嶆墽琛岋級
+ if (serviceSubtaskEntity.getSendstateView() == 1)
+ serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 7L)));
+ if (serviceSubtaskEntity.getSendstateView() == 2)
+ serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(6L)));
+ if (serviceSubtaskEntity.getSendstateView() == 3)
+ serviceSubtaskEntity.setSendstates(new ArrayList<>(Arrays.asList(4L)));
+ }
+ //鎮h�呰幏鍙栭殢璁夸换鍔�-闇�瑕佹煡璇㈠悓涓偅鑰咃紙韬唤璇侊級鎵�鏈夌殑浠诲姟 鏅畞
+ if (StringUtils.isNotEmpty(serviceSubtaskEntity.getOrgid()) && serviceSubtaskEntity.getOrgid().equals("47255004333112711A1001")) {
+ if (ObjectUtils.isNotEmpty(serviceSubtaskEntity.getPatid())) {
+ PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtaskEntity.getPatid());
+ if (ObjectUtils.isNotEmpty(patArchive) && StringUtils.isNotEmpty(patArchive.getIdcardno())) {
+ serviceSubtaskEntity.setPatid(null);
+ serviceSubtaskEntity.setSfzh(patArchive.getIdcardno());
+ }
+ }
+ }
+ List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskEntity);
+ return selectServiceSubtaskList;
+ }
+
+ @Override
+ public Integer transferDept(TransferDeptVO transferDeptVO) {
+ log.info("transferDept鐨勫叆鍙備负锛歿}", transferDeptVO);
+ //鏌ヨ璇ユ偅鑰呯殑瀛愪换鍔′俊鎭�
+ ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(transferDeptVO.getSubId());
+ if (ObjectUtils.isEmpty(serviceSubtask)) throw new BaseException("杞偅鑰呭け璐ワ紝璇疯仈绯荤鐞嗗憳澶勭悊");
+ //鍒犻櫎璇ユ偅鑰呯殑淇℃伅閫氳繃subid
+ serviceSubtaskMapper.deleteServiceSubtaskById(transferDeptVO.getSubId());
+
+ //淇敼鎮h�呯殑绂婚櫌绉戝鐥呭尯閫氳繃inhospid鍜屾偅鑰呯殑浠诲姟鐢熸垚鐘舵��
+ PatMedInhosp patMedInhosp = new PatMedInhosp();
+ patMedInhosp.setInhospid(serviceSubtask.getInhospid());
+ patMedInhosp.setLeaveldeptcode(transferDeptVO.getLeavelDeptCode());
+ patMedInhosp.setLeaveldeptname(transferDeptVO.getLeavelDeptName());
+ patMedInhosp.setLeavehospitaldistrictcode(transferDeptVO.getLeavehospitaldistrictcode());
+ patMedInhosp.setLeavehospitaldistrictname(transferDeptVO.getLeavehospitaldistrictname());
+ patMedInhosp.setDeptcheckFlag("0");
+ patMedInhosp.setWardcheckFlag("0");
+ patMedInhosp.setDiagcheckFlag("0");
+ return patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
+ }
+
+ public Map<String, String> calculateAge(LocalDate birthdate, LocalDate today) {
+ if (birthdate == null || today.isBefore(birthdate)) {
+ return null;
+ }
+ Map<String, String> ageMap = new HashMap<>();
+
+ Period period = Period.between(birthdate, today);
+ long totalDays = ChronoUnit.DAYS.between(birthdate, today);
+ long totalMonths = ChronoUnit.MONTHS.between(birthdate, today);
+
+ int years = period.getYears();
+ int months = period.getMonths();
+ int days = period.getDays();
+
+ String ageUnit;
+ Integer age;
+ String ageUnit2 = null;
+ Integer age2 = null;
+
+ if (totalDays < 90) {
+ // 灏忎簬 1 涓湀锛屾寜澶╄绠�
+ ageUnit = "澶�";
+ age = (int) totalDays;
+ ageMap.put("age", age != null ? age.toString() : null);
+ ageMap.put("ageUnit", ageUnit);
+ ageMap.put("age2", null);
+ ageMap.put("ageUnit2", null);
+ } else if (totalMonths < 36) {
+ // 灏忎簬 1 骞达紝鎸夋湀 + 澶╄绠�
+ ageUnit = "鏈�";
+ age = (int) totalMonths;
+ ageUnit2 = "澶�";
+ age2 = days;
+ ageMap.put("age", age != null ? age.toString() : null);
+ ageMap.put("ageUnit", ageUnit);
+ ageMap.put("age2", age2 != null ? age2.toString() : null);
+ ageMap.put("ageUnit2", ageUnit2);
+ } else {
+ // 澶т簬 1 骞达紝鎸夊勾 + 鏈堣绠�
+ ageUnit = "宀�";
+ age = years;
+ ageUnit2 = "鏈�";
+ age2 = months;
+ ageMap.put("age", age != null ? age.toString() : null);
+ ageMap.put("ageUnit", ageUnit);
+ ageMap.put("age2", age2 != null ? age2.toString() : null);
+ ageMap.put("ageUnit2", ageUnit2);
+ }
+
+ return ageMap;
}
@Override
@@ -447,13 +624,16 @@
// MyBatis 鐨� SUM 鍦ㄦ病鏈夊尮閰嶈鏃朵細杩斿洖 null
result.putIfAbsent("wzx", 0);
result.putIfAbsent("ysf", 0);
- result.putIfAbsent("yc", 0);
- result.putIfAbsent("jg", 0);
result.putIfAbsent("fssb", 0);
result.putIfAbsent("yfs", 0);
result.putIfAbsent("blq", 0);
- result.putIfAbsent("dsf", 0);
result.putIfAbsent("total", 0);
+ result.putIfAbsent("wxsf", 0);
+ result.putIfAbsent("xsf", 0);
+ result.putIfAbsent("dsf", 0);
+ result.putIfAbsent("ywc", 0);
+ result.putIfAbsent("yc", 0);
+ result.putIfAbsent("jg", 0);
}
return result;
}
@@ -465,9 +645,83 @@
* @return 缁撴灉
*/
@Override
- public int insertServiceSubtask(ServiceSubtask serviceSubtask) {
- serviceSubtask.setCreateTime(DateUtils.getNowDate());
- return serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
+ public Map<String, Object> insertServiceSubtask(ServiceSubtask serviceSubtask) {
+ List<ServiceSubtask> serviceSubtasks = null;
+ //鍏堟煡璇竴涓嬭鎮h�呮槸鍚﹀凡缁忓垱寤烘牴鎹畇erviceType,sendstate,inhospid,patid,orgid
+ //杩欐牱鍒ゆ柇涓昏鏄负浜嗘兂璁╂柊鍗庡尰闄㈢殑澶栭儴瀵煎叆鎮h�呭垱寤轰换鍔★紝涔熻兘鐢ㄨ繖涓帴鍙�
+ if (StringUtils.isEmpty(serviceSubtask.getPatfrom()) || !serviceSubtask.getPatfrom().equals("2")) {
+ ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
+ serviceSubtaskVO.setServiceType(serviceSubtask.getServiceType());
+ serviceSubtaskVO.setInhospid(serviceSubtask.getInhospid());
+ serviceSubtaskVO.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 7L)));
+ serviceSubtaskVO.setPatid(serviceSubtask.getPatid());
+ serviceSubtaskVO.setOrgid(serviceSubtask.getOrgid());
+ serviceSubtaskVO.setCampusid(serviceSubtask.getCampusid());
+ serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+ }
+ RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+ String format = null;
+ if (CollectionUtils.isNotEmpty(serviceSubtasks)) {
+ ServiceSubtask serviceSubtask1 = serviceSubtasks.get(0);
+ ServiceOutPath serviceOutPath = new ServiceOutPath();
+ serviceOutPath.setSubId(serviceSubtask1.getId());
+ List<ServiceOutPath> serviceOutPaths = serviceOutPathMapper.selectServiceOutPathList(serviceOutPath);
+ if (CollectionUtils.isNotEmpty(serviceOutPaths))
+ format = String.format("%03X", serviceOutPaths.get(0).getId());
+ else format = getOutPath(serviceSubtask1, rsaPublicKeyExample);
+ serviceSubtask = serviceSubtask1;
+ } else {
+ //濡傛灉涓嶅瓨鍦紝鍒欐柊澧�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ if (ObjectUtils.isNotEmpty(serviceTask)) {
+ serviceSubtask.setTaskDesc(serviceTask.getTaskDesc());
+ serviceSubtask.setTaskName(serviceTask.getTaskName());
+ serviceSubtask.setTemplatename(serviceTask.getTemplatename());
+ }
+
+ serviceSubtask.setCreateTime(DateUtils.getNowDate());
+ serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
+ //淇敼浣忛櫌婊℃剰搴︾姸鎬侊紙閬垮厤閲嶅鏌ヨ锛�
+ if (serviceSubtask.getServiceType() != null && "6".equals(serviceSubtask.getServiceType())) {
+ Long inhospid = serviceSubtask.getInhospid();
+ if (inhospid != null) {
+ PatMedInhosp patMedInhosp = new PatMedInhosp();
+ patMedInhosp.setInhospMydFlag("1");
+ patMedInhosp.setInhospid(inhospid);
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
+ }
+ }
+ format = getOutPath(serviceSubtask, rsaPublicKeyExample);
+ }
+
+ Map<String, Object> result = new HashMap<>();
+ if (StringUtils.isNotEmpty(format))
+ result.put("url", StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format);
+ else result.put("url", null);
+ result.put("subId", serviceSubtask.getId());
+ return result;
+ }
+
+ private String getOutPath(ServiceSubtask serviceSubtask, RSAPublicKeyExample rsaPublicKeyExample) {
+ String format;
+ String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
+ String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
+ String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
+ ServiceOutPath serviceOutPath = new ServiceOutPath();
+ serviceOutPath.setParam1(taskId);
+ serviceOutPath.setParam2(patid);
+ serviceOutPath.setCreateTime(new Date());
+ serviceOutPath.setParam6(subId);
+ serviceOutPath.setOrgid(serviceSubtask.getOrgid());
+ serviceOutPath.setTaskId(serviceSubtask.getTaskid());
+ serviceOutPath.setSubId(serviceSubtask.getId());
+ iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+ //杞垚16杩涘埗
+ format = String.format("%03X", serviceOutPath.getId());
+ serviceOutPath.setRadix(format);
+ serviceOutPath.setUpdateTime(new Date());
+ iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+ return format;
}
/**
@@ -484,10 +738,15 @@
patMedInhosp.setInhospstate("0");
List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp);
PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(serviceSubtask1.getPatid());
-
- if (patMedInhospList.size() > 0) {
+ //鏅畞 鏂板鍐嶆闅忚涓嶈兘瑙﹀彂鎮h�呭啀鍏ラ櫌
+ boolean inhospAgain = true;
+ if (serviceSubtask1.getOrgid().equals("47255004333112711A1001")) {
+ inhospAgain = false;
+ }
+ if (patMedInhospList.size() > 0 && inhospAgain) {
serviceSubtask1.setIsVisitAgain(2);
serviceSubtask1.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";鎮h�呭啀鍏ラ櫌浜�" : "鎮h�呭啀鍏ラ櫌浜�");
+ serviceSubtask1.setSendstate(4L);
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1);
return "鏃犻渶鍐嶆闅忚锛屾偅鑰呭啀鍏ラ櫌浜�";
} else if (serviceSubtask1.getSendstate() == 4L) {
@@ -535,6 +794,7 @@
serviceSubtask.setUpdateTime(DateUtils.getNowDate());
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 6)
serviceSubtask.setFinishtime(new Date());
+
return serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
}
@@ -543,9 +803,16 @@
ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(serviceSubtaskTemplateVO.getSubId());
if (serviceSubtask == null || serviceSubtask.getSendstate() != 2L)
throw new BaseException("璇ヤ换鍔″凡鍙戦�佺粰鎮h�咃紝涓嶈兘鍐嶈繘琛屼慨鏀规ā鏉�");
-
+ serviceSubtaskTemplateVO.getSvyTaskTemplateVO().setIntroduce("璇ラ棶鍗锋槸鏇挎崲鍚庣殑闂锛屾浛鎹㈠墠鐨勯棶棰樻槸锛�" + serviceSubtask.getTemplateid());
Integer taskTempid = svyTaskTemplateService.saveOrUpdateTemplate(serviceSubtaskTemplateVO.getSvyTaskTemplateVO());
if (taskTempid == null) return false;
+
+ //姣忔閮芥柊寤轰竴涓篃鍙互锛屼絾鏂板缓涔嬪悗瑕佹妸涔嬪墠鐨勫垹闄�
+ if (serviceSubtask.getType().equals("2")) {
+ svyTaskTemplateService.deleteSvyTaskTemplateBySvyid(serviceSubtask.getTemplateid());
+ } else if (serviceSubtask.getType().equals("1"))
+ ivrTaskTemplateService.deleteIvrTaskTemplateByID(serviceSubtask.getTemplateid());
+
String tempName = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(Long.valueOf(taskTempid)).getSvyname();
serviceSubtask.setTemplateid(taskTempid.longValue());
@@ -644,7 +911,10 @@
serviceTask.setTemplatename(tempName);
}
serviceTask.setLeaveldeptcodes(serviceTaskVO.getLeaveldeptcodes());
- serviceTask.setLeavehospitaldistrictcode(serviceTask.getLeavehospitaldistrictcode());
+ if (StringUtils.isEmpty(serviceTask.getLeavehospitaldistrictname()) && StringUtils.isNotEmpty(serviceTask.getLeavehospitaldistrictcode())) {
+ SysDept sysDept = sysDept2Mapper.selectDeptByCode(serviceTask.getLeavehospitaldistrictcode(), null);
+ serviceTask.setLeavehospitaldistrictname(sysDept.getDeptName());
+ }
if (serviceTaskVO.getLongTask() == 1) serviceTask.setSendState(2L);
serviceTask.setCreateTime(new Date());
serviceTask.setUpdateTime(new Date());
@@ -682,18 +952,81 @@
ServiceTaskoper serviceTaskoper = new ServiceTaskoper();
serviceTaskoper.setOpcode(serviceTaskVO.getOpcode());
serviceTaskoper.setOpdesc(serviceTaskVO.getOpdesc());
- serviceTaskoper.setOplevelcode(serviceTaskVO.getOplevelcode());
+// serviceTaskoper.setOplevelcode(serviceTaskVO.getOplevelcode());
serviceTaskoper.setTaskId(serviceTask.getTaskid());
serviceTaskoper.setTaskName(serviceTask.getTaskName());
serviceTaskoper.setLongtask(Long.valueOf(serviceTask.getLongTask()));
serviceTaskoper.setGuid(serviceTask.getGuid());
serviceTaskoper.setOrgid(serviceTask.getOrgid());
serviceTaskoper.setCreateTime(new Date());
+ //閰嶇疆绉戝銆佺梾鍖�
+ serviceTaskoper.setDeptCode(serviceTaskVO.getDeptcode());
+ serviceTaskoper.setDeptName(serviceTaskVO.getDeptname());
+ serviceTaskoper.setWardCode(serviceTaskVO.getLeavehospitaldistrictcode());
+ serviceTaskoper.setWardName(serviceTaskVO.getLeavehospitaldistrictname());
+ //澶氶�夋墜鏈瓑绾�
if (StringUtils.isNotEmpty(serviceTaskVO.getOplevelcode())) {
- log.info("----serviceTaskoper鐨勫�间负锛歿}", serviceTaskoper);
- serviceTaskoperService.insertServiceTaskoper(serviceTaskoper);
+ String[] opLevelcodes = serviceTaskVO.getOplevelcode().split(",");
+ for (String opLevelcode : opLevelcodes) {
+ //鍏堟煡璇竴涓嬫槸鍚﹀瓨鍦�
+ log.info("----serviceTaskoper鐨勫�间负锛歿}", serviceTaskoper);
+ serviceTaskoper.setOplevelcode(opLevelcode);
+ serviceTaskoperService.insertServiceTaskoper(serviceTaskoper);
+ }
}
+ } else if (serviceTaskVO.getAppltype().equals("5")) {
+ // 浠诲姟缁勶細蹇呴』涓洪暱鏈熶换鍔★紙鍚﹀垯 findMatchingTaskIds 鎵笉鍒帮紝鏃犳硶鑷姩绾冲叆鏂板嚭闄㈡偅鑰咃級
+ if (serviceTaskVO.getLongTask() == null || serviceTaskVO.getLongTask() != 1) {
+ throw new BaseException("appltype=5 浠诲姟缁勫繀椤讳负闀挎湡浠诲姟锛坙ongTask=1锛�");
+ }
+ // 淇濆瓨璁″垝 + 鏄庣粏
+ ServiceTaskScheduleVO scheduleVO = serviceTaskVO.getServiceTaskScheduleVO();
+ if (scheduleVO == null) {
+ throw new BaseException("appltype=5 浠诲姟缁勶細serviceTaskScheduleVO 涓嶈兘涓虹┖");
+ }
+ scheduleVO.setTaskid(serviceTask.getTaskid());
+ scheduleVO.setOrgid(serviceTask.getOrgid());
+ scheduleVO.setCampusid(serviceTask.getCampusid());
+ scheduleVO.setCreateBy(serviceTask.getCreateBy());
+
+ scheduleVO.setDeptCodes(serviceTaskVO.getDeptcode());
+ scheduleVO.setWardCodes(serviceTaskVO.getLeavehospitaldistrictcode());
+ scheduleVO.setIcd10Codes(serviceTaskVO.getIcd10code());
+ scheduleVO.setOplevelCodes(serviceTaskVO.getOplevelcode());
+
+ log.info("----serviceTaskSchedule鐨勫�间负锛歿}", scheduleVO);
+ serviceTaskScheduleService.saveScheduleWithDetail(scheduleVO);
+ } else if (serviceTaskVO.getAppltype().equals("6")) {
+ ServiceTaskmedical serviceTaskmedical = new ServiceTaskmedical();
+ serviceTaskmedical.setTaskId(serviceTask.getTaskid());
+ serviceTaskmedical.setTaskName(serviceTask.getTaskName());
+ serviceTaskmedical.setServiceType(serviceTaskVO.getServiceType());
+ serviceTaskmedical.setLongtask(Long.valueOf(serviceTask.getLongTask()));
+ if (serviceTaskVO.getLongTask() == 1) serviceTaskmedical.setLongtask(1L);
+ serviceTaskmedical.setMedicalCode(serviceTaskVO.getIcd10code());
+ serviceTaskmedical.setMedicalName(serviceTaskVO.getIcd10name());
+ serviceTaskmedical.setGuid(serviceTask.getGuid());
+ serviceTaskmedical.setOrgid(serviceTask.getOrgid());
+ serviceTaskmedical.setCreateTime(new Date());
+ serviceTaskmedical.setDeptCode(serviceTaskVO.getDeptcode());
+ serviceTaskmedical.setDeptName(serviceTaskVO.getDeptname());
+ serviceTaskmedical.setWardCode(serviceTaskVO.getLeavehospitaldistrictcode());
+ serviceTaskmedical.setWardName(serviceTaskVO.getLeavehospitaldistrictname());
+ //鍗楀崕闄勪竴鐨刬cd10code鏄湁閲嶅鐨勶紝鎵�浠ヤ笉鑳界敤鍗楀崕闄勪竴鐨刬cd10code鍘绘煡璇�
+ log.info("----serviceTaskmedical鐨勫�间负锛歿}", serviceTaskmedical);
+ if (!StringUtils.isEmpty(serviceTaskVO.getMedicalName())) {
+ String[] medicalNames = serviceTaskVO.getMedicalName().split(",");
+ String[] medicalcodes = serviceTaskVO.getMedicalCode().split(",");
+ String[] medicalCompanys = serviceTaskVO.getMedicalCompany().split(",");
+ for (int i = 0; i < medicalNames.length; i++) {
+ serviceTaskmedical.setMedicalCode(medicalNames[i]);
+ serviceTaskmedical.setMedicalName(medicalcodes[i]);
+ if (ObjectUtils.isNotEmpty(medicalCompanys))
+ serviceTaskmedical.setMedicalCompany(medicalCompanys[i]);
+ serviceTaskmedicalService.insertServiceTaskmedical(serviceTaskmedical);
+ }
+ }
} else {
ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
serviceTaskdept.setTaskId(serviceTask.getTaskid());
@@ -730,8 +1063,8 @@
//灏嗕换鍔′俊鎭斁鍒版湇鍔¤〃涓�
ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceSubtask.class);
serviceSubtask.setTaskid(serviceTask.getTaskid().longValue());
- serviceSubtask.setTemplatename(tempName);
- serviceSubtask.setTemplateid(tempid);
+ serviceSubtask.setTemplatename(ObjectUtils.isNotEmpty(tempid) ? tempName : serviceTask.getTemplatename());
+ serviceSubtask.setTemplateid(ObjectUtils.isNotEmpty(tempid) ? tempid : serviceTask.getTemplateid());
serviceSubtask.setLibtemplateid(ObjectUtils.isEmpty(serviceTask.getLibtemplateid()) ? null : Long.valueOf(serviceTask.getLibtemplateid()));
serviceSubtask.setLibtemplatename(serviceTask.getLibtemplatename());
//鏂板
@@ -747,11 +1080,10 @@
serviceSubtask.setPatid(patTaskRelevance.getPatid());
serviceSubtask.setCreateTime(DateUtils.getNowDate());
serviceSubtask.setInhospid(patTaskRelevance.getHospid());
- serviceSubtask.setSendstate(1L);
- if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
- serviceSubtask.setSendstate(2L);
- serviceSubtask.setDeptcode(patTaskRelevance.getDeptcode());
- serviceSubtask.setDeptname(patTaskRelevance.getDeptName());
+ //鏂板缓瀹屾垚灏辨槸寰呭彂閫佺姸鎬�
+ serviceSubtask.setSendstate(2L);
+ serviceSubtask.setDeptcode(StringUtils.isNotEmpty(patTaskRelevance.getDeptcode()) ? patTaskRelevance.getDeptcode() : serviceTaskVO.getDeptcode());
+ serviceSubtask.setDeptname(StringUtils.isNotEmpty(patTaskRelevance.getDeptName()) ? patTaskRelevance.getDeptName() : serviceTaskVO.getDeptname());
serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode());
serviceSubtask.setLeavehospitaldistrictname(patTaskRelevance.getLeavehospitaldistrictname());
serviceSubtask.setType(serviceTaskVO.getType());
@@ -772,9 +1104,26 @@
serviceSubtask.setContinueTimeNow(patTaskRelevance.getContinueTimeNow());
serviceSubtask.setCreateBy(serviceTask.getCreateBy());
serviceSubtask.setUpdateBy(serviceTask.getCreateBy());
- serviceSubtask.setVisitTime(patTaskRelevance.getVisittime());
- if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1)
+ serviceSubtask.setVisitTime(DateUtils.parseDate(serviceTaskVO.getShowTimeMorn()));
+ //濡傛灉绔嬪嵆鎵ц锛屾椂闂村氨鏄綋鍓嶆椂闂�
+ if (serviceTaskVO.getSendType() != null && serviceTaskVO.getSendType() == 2)
+ serviceSubtask.setVisitTime(new Date());
+ if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1) {
serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime());
+ serviceSubtask.setVisitTime(patTaskRelevance.getVisittime());
+ }
+
+ // ===== appltype=5 浠诲姟缁勶細鎸� schedule 鐨� detailList 娲剧敓澶氭潯 subtask =====
+ if ("5".equals(serviceTaskVO.getAppltype())) {
+ ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTask.getTaskid());
+ if (schedule == null) {
+ throw new BaseException("appltype=5 浠诲姟缁勶細鏈壘鍒� taskid=" + serviceTask.getTaskid() + " 鐨勮鍒�");
+ }
+ List<ServiceTaskScheduleDetail> detailList = serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
+ scheduleSubtaskBuilder.buildSubtasksForPatient(serviceTask, serviceTaskVO.getPreachformList(), schedule, detailList, patTaskRelevance, serviceSubtask);
+ continue;
+ }
+
serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
serviceSubtask.getId().intValue();
@@ -804,7 +1153,6 @@
serviceTask.setSendTimeSlot(JSON.toJSONString(serviceTaskVO.getSendTimeslot()));
//淇敼鎿嶄綔锛岄渶瑕佸皢stopState鐘舵��+1
ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceTask.getTaskid());
- //鑾峰彇鍒拌浠诲姟鎵�鏈夌殑鏈嶅姟锛屽苟浠庨槦鍒楅噷鍒犻櫎
ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
serviceSubtaskVO.setTaskid(serviceTask1.getTaskid());
serviceSubtaskVO.setSendstate(2L);
@@ -826,6 +1174,40 @@
redisCache.removeElementFromList("cache-2", serviceSubtask.getId().toString());
redisCache.removeElementFromList("cache-3", serviceSubtask.getId().toString());
redisCache.removeElementFromList("cache-4", serviceSubtask.getId().toString());
+ //灏嗗嚭鍏ラ櫌琛ㄧ殑鏁版嵁锛岃繕鍘熸垚杩樻湭澶勭悊鐨勭姸鎬�
+ if (serviceSubtask.getServiceType().equals("2") || serviceSubtask.getServiceType().equals("13")) {
+ ServiceTask st = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ //濡傛灉浠诲姟鏄暱鏈熶换鍔★紝闇�瑕佸皢璇ユ偅鑰呯殑鍑哄叆闄㈡暟鎹繕鍘熸垚杩樻湭澶勭悊鐨勭姸鎬�
+ if (st != null && st.getLongTask() == 1) {
+ PatMedInhosp patMedInhosp = new PatMedInhosp();
+ patMedInhosp.setDeptcheckFlag("0");
+ patMedInhosp.setWardcheckFlag("0");
+ patMedInhosp.setDiagcheckFlag("0");
+ patMedInhosp.setInhospid(serviceSubtask.getInhospid());
+ patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
+ }
+ } else if (serviceSubtask.getServiceType().equals("3")) {
+ if (serviceSubtask.getInhospid() != null) {
+ PatMedOuthospQueryReq req = new PatMedOuthospQueryReq();
+ req.setOuthospno(serviceSubtask.getHospno());
+ List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.callSpQueryOuthosp(req);
+ if (CollectionUtils.isNotEmpty(patMedOuthosps)) {
+ PatMedOuthosp patMedOuthosp = patMedOuthosps.get(0);
+ patMedOuthosp.setServerState("0");
+ patMedOuthospService.updatePatMedOuthosp(patMedOuthosp);
+ }
+ }
+ } else if (serviceSubtask.getServiceType().equals("19")) {
+ ServiceTask st = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ //濡傛灉浠诲姟鏄暱鏈熶换鍔★紝闇�瑕佸皢璇ユ偅鑰呯殑鍑洪櫌璇︽儏鐘舵�佽繕鍘熸垚杩樻湭澶勭悊鐨勭姸鎬�
+ if (st != null && st.getLongTask() == 1
+ && ObjectUtils.isNotEmpty(serviceSubtask.getOperationItemId())) {
+ PatMedOperationItem patMedOperationItem = new PatMedOperationItem();
+ patMedOperationItem.setOpercheckFlag("0");
+ patMedOperationItem.setId(serviceSubtask.getOperationItemId());
+ patMedOperationItemMapper.updatePatMedOperationItem(patMedOperationItem);
+ }
+ }
}
}
@@ -891,18 +1273,21 @@
}
serviceTaskdiag.setLongtask(Long.valueOf(serviceTask.getLongTask()));
serviceTaskdiag.setIcd10name(serviceTaskVO.getIcd10name());
- serviceTaskdiag.setGuid(serviceTask.getGuid());
- serviceTaskdiag.setOrgid(serviceTask.getOrgid());
- serviceTaskdiag.setDeptCode(serviceTaskVO.getDeptcode());
- serviceTaskdiag.setDeptName(serviceTaskVO.getDeptname());
- serviceTaskdiag.setWardCode(serviceTaskVO.getLeavehospitaldistrictcode());
- serviceTaskdiag.setWardName(serviceTaskVO.getLeavehospitaldistrictname());
+ serviceTaskdiag.setGuid(serviceTask1.getGuid());
+ serviceTaskdiag.setServiceType(serviceTask1.getServiceType());
+ serviceTaskdiag.setOrgid(serviceTask1.getOrgid());
+ serviceTaskdiag.setDeptCode(serviceTask1.getDeptcode());
+ serviceTaskdiag.setDeptName(serviceTask1.getDeptname());
+ serviceTaskdiag.setWardCode(serviceTask1.getLeavehospitaldistrictcode());
+ serviceTaskdiag.setWardName(serviceTask1.getLeavehospitaldistrictname());
serviceTaskdiag.setUpdateTime(new Date());
if (StringUtils.isNotEmpty(serviceTaskVO.getIcd10code())) {
String[] icd10codes = serviceTaskVO.getIcd10code().split(",");
String[] icd10names = serviceTaskVO.getIcd10name().split(",");
- if (icd10codes.length != icd10names.length) {
- throw new BaseException("鐤剧梾缂栫爜鍜岀柧鐥呭悕绉版暟閲忎笉涓�鑷�");
+ if (!active.equals("nhfy") && !active.equals("druid")) {
+ if (icd10codes.length != icd10names.length) {
+ throw new BaseException("鐤剧梾缂栫爜鍜岀柧鐥呭悕绉版暟閲忎笉涓�鑷�");
+ }
}
for (int i = 0; i < icd10codes.length; i++) {
//鍏堟煡璇竴涓嬫槸鍚﹀瓨鍦�
@@ -923,6 +1308,54 @@
}
}
+ } else if (serviceTaskVO.getAppltype().equals("6")) {
+ ServiceTaskmedical serviceTaskmedical = new ServiceTaskmedical();
+ serviceTaskmedical.setTaskId(serviceTask.getTaskid());
+ serviceTaskmedical.setTaskName(serviceTask.getTaskName());
+ if (StringUtils.isEmpty(serviceTaskVO.getMedicalCode())) {
+ throw new BaseException("鑽搧缂栫爜涓虹┖");
+ }
+ serviceTaskmedical.setLongtask(Long.valueOf(serviceTask.getLongTask()));
+ serviceTaskmedical.setMedicalName(serviceTaskVO.getMedicalName());
+ serviceTaskmedical.setGuid(serviceTask1.getGuid());
+ serviceTaskmedical.setServiceType(serviceTask1.getServiceType());
+ serviceTaskmedical.setOrgid(serviceTask1.getOrgid());
+ serviceTaskmedical.setDeptCode(serviceTask1.getDeptcode());
+ serviceTaskmedical.setDeptName(serviceTask1.getDeptname());
+ serviceTaskmedical.setWardCode(serviceTask1.getLeavehospitaldistrictcode());
+ serviceTaskmedical.setWardName(serviceTask1.getLeavehospitaldistrictname());
+ serviceTaskmedical.setUpdateTime(new Date());
+ if (StringUtils.isNotEmpty(serviceTaskVO.getMedicalCode())) {
+ String[] medicalCodes = serviceTaskVO.getMedicalCode().split(",");
+ String[] medicalNames = serviceTaskVO.getMedicalName().split(",");
+ String[] medicalCompanys = serviceTaskVO.getMedicalCompany().split(",");
+ if (!active.equals("nhfy") && !active.equals("druid")) {
+ if (medicalCodes.length != medicalNames.length && medicalNames.length != medicalCompanys.length) {
+ throw new BaseException("鑽搧缂栫爜鍜岃嵂鍝佸悕绉版暟閲忎笉涓�鑷存垨鑰呰嵂鍝佸悕绉板拰鑽搧鍏徃鏁伴噺涓嶄竴鑷�");
+ }
+ }
+
+ for (int i = 0; i < medicalCodes.length; i++) {
+ //鍏堟煡璇竴涓嬫槸鍚﹀瓨鍦�
+ ServiceTaskmedical serviceTaskmedical1 = new ServiceTaskmedical();
+ serviceTaskmedical1.setTaskId(serviceTaskVO.getTaskid());
+ serviceTaskmedical1.setMedicalCode(medicalCodes[i]);
+ serviceTaskmedical1.setMedicalName(medicalNames[i]);
+ serviceTaskmedical1.setMedicalCompany(medicalCompanys[i]);
+ List<ServiceTaskmedical> serviceTaskmedicals = serviceTaskmedicalService.selectServiceTaskmedicalList(serviceTaskmedical1);
+ serviceTaskmedical.setMedicalCode(medicalCodes[i]);
+ serviceTaskmedical.setMedicalName(medicalNames[i]);
+ serviceTaskmedical.setMedicalCompany(medicalCompanys[i]);
+ log.info("----serviceTaskmedical鏇存柊鐨勫�间负锛歿}", serviceTaskmedical);
+ if (CollectionUtils.isNotEmpty(serviceTaskmedicals)) {
+ serviceTaskmedical.setId(serviceTaskmedicals.get(0).getId());
+ serviceTaskmedicalService.updateServiceTaskmedical(serviceTaskmedical);
+ } else {
+ serviceTaskmedicalService.insertServiceTaskmedical(serviceTaskmedical);
+ }
+ }
+ }
+
} else if (serviceTaskVO.getAppltype().equals("4")) {
ServiceTaskoper serviceTaskoper = new ServiceTaskoper();
// if (StringUtils.isEmpty(serviceTaskVO.getOpcode())) {
@@ -930,44 +1363,57 @@
// }
// serviceTaskoper.setOpcode(serviceTaskVO.getOpcode());
serviceTaskoper.setOpdesc(serviceTaskVO.getOpdesc());
- serviceTaskoper.setOplevelcode(serviceTaskVO.getOplevelcode());
+// serviceTaskoper.setOplevelcode(serviceTaskVO.getOplevelcode());
serviceTaskoper.setTaskId(serviceTask.getTaskid());
serviceTaskoper.setTaskName(serviceTask.getTaskName());
serviceTaskoper.setLongtask(Long.valueOf(serviceTask.getLongTask()));
serviceTaskoper.setGuid(serviceTask.getGuid());
serviceTaskoper.setOrgid(serviceTask.getOrgid());
- serviceTaskoper.setCreateTime(new Date());
-// if (StringUtils.isNotEmpty(serviceTaskVO.getOpcode())) {
-// String[] opcodes = serviceTaskVO.getOpcode().split(",");
-// for (String opcode : opcodes) {
-// //鍏堟煡璇竴涓嬫槸鍚﹀瓨鍦�
-// ServiceTaskoper serviceTaskoper2 = new ServiceTaskoper();
-// serviceTaskoper2.setTaskId(serviceTaskVO.getTaskid());
-// serviceTaskoper2.setOpcode(serviceTaskVO.getOpcode());
-// List<ServiceTaskoper> serviceTaskopers = serviceTaskoperService.selectServiceTaskoperList(serviceTaskoper2);
-//
-// serviceTaskoper.setOpcode(opcode);
-// log.info("----serviceTaskoper鐨勫�间负锛歿}", serviceTaskoper);
-// if (CollectionUtils.isNotEmpty(serviceTaskopers)) {
-// serviceTaskoper.setId(serviceTaskopers.get(0).getId());
-// serviceTaskoperService.updateServiceTaskoper(serviceTaskoper);
-// } else {
-// serviceTaskoperService.insertServiceTaskoper(serviceTaskoper);
-// }
-// }
-// }
- ServiceTaskoper serviceTaskoper2 = new ServiceTaskoper();
- serviceTaskoper2.setTaskId(serviceTaskVO.getTaskid());
- serviceTaskoper2.setOrgid(serviceTask.getOrgid());
-// serviceTaskoper2.setOplevelcode(serviceTaskVO.getOplevelcode());
- List<ServiceTaskoper> serviceTaskopers = serviceTaskoperService.selectServiceTaskoperList(serviceTaskoper2);
- if (CollectionUtils.isNotEmpty(serviceTaskopers)) {
- serviceTaskoper.setId(serviceTaskopers.get(0).getId());
- serviceTaskoperService.updateServiceTaskoper(serviceTaskoper);
- } else {
- serviceTaskoperService.insertServiceTaskoper(serviceTaskoper);
+ serviceTaskoper.setDeptCode(serviceTask1.getDeptcode());
+ serviceTaskoper.setDeptName(serviceTask1.getDeptname());
+ serviceTaskoper.setWardCode(serviceTask1.getLeavehospitaldistrictcode());
+ serviceTaskoper.setWardName(serviceTask1.getLeavehospitaldistrictname());
+
+ serviceTaskoper.setCreateTime(new Date());
+ if (StringUtils.isNotEmpty(serviceTaskVO.getOplevelcode())) {
+ String[] opLevelcodes = serviceTaskVO.getOplevelcode().split(",");
+ for (String opLevelcode : opLevelcodes) {
+ //鍏堟煡璇竴涓嬫槸鍚﹀瓨鍦�
+ log.info("----serviceTaskoper鐨勫�间负锛歿}", serviceTaskoper);
+ ServiceTaskoper serviceTaskoper2 = new ServiceTaskoper();
+ serviceTaskoper2.setTaskId(serviceTaskVO.getTaskid());
+ serviceTaskoper2.setOrgid(serviceTask.getOrgid());
+ serviceTaskoper2.setOplevelcode(opLevelcode);
+ List<ServiceTaskoper> serviceTaskopers = serviceTaskoperService.selectServiceTaskoperList(serviceTaskoper2);
+
+ serviceTaskoper.setOplevelcode(opLevelcode);
+ if (CollectionUtils.isNotEmpty(serviceTaskopers)) {
+ serviceTaskoper.setId(serviceTaskopers.get(0).getId());
+ serviceTaskoperService.updateServiceTaskoper(serviceTaskoper);
+ } else {
+ serviceTaskoperService.insertServiceTaskoper(serviceTaskoper);
+ }
+ }
}
+ } else if (serviceTaskVO.getAppltype().equals("5")) {
+ // 浠诲姟缁勪慨鏀癸細鍒犳棫 schedule + 鏄庣粏锛岄噸寤恒�俿ubtask 涓婇潰宸叉壒閲忔竻鐞嗐��
+ if (serviceTaskVO.getLongTask() == null || serviceTaskVO.getLongTask() != 1) {
+ throw new BaseException("appltype=5 浠诲姟缁勫繀椤讳负闀挎湡浠诲姟锛坙ongTask=1锛�");
+ }
+ ServiceTaskScheduleVO scheduleVO = serviceTaskVO.getServiceTaskScheduleVO();
+ if (scheduleVO == null) {
+ throw new BaseException("appltype=5 浠诲姟缁勶細serviceTaskScheduleVO 涓嶈兘涓虹┖");
+ }
+ scheduleVO.setTaskid(serviceTask.getTaskid());
+ scheduleVO.setOrgid(serviceTask.getOrgid());
+ scheduleVO.setCampusid(serviceTask.getCampusid());
+ scheduleVO.setDeptCodes(serviceTaskVO.getDeptcode());
+ scheduleVO.setWardCodes(serviceTaskVO.getLeavehospitaldistrictcode());
+ scheduleVO.setIcd10Codes(serviceTaskVO.getIcd10code());
+ scheduleVO.setOplevelCodes(serviceTaskVO.getOplevelcode());
+ scheduleVO.setCreateBy(serviceTask.getUpdateBy());
+ serviceTaskScheduleService.saveScheduleWithDetail(scheduleVO);
}
}
if (ObjectUtils.isNotEmpty(serviceTaskVO.getIvrTaskTemplateVO())) {
@@ -993,6 +1439,8 @@
ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceSubtask.class);
serviceSubtask.setLibtemplateid(ObjectUtils.isEmpty(serviceTaskVO.getLibtemplateid()) ? null : Long.valueOf(serviceTaskVO.getLibtemplateid()));
serviceSubtask.setLibtemplatename(serviceTaskVO.getLibtemplatename());
+ serviceSubtask.setTemplateid(serviceTask.getTemplateid());
+ serviceSubtask.setTemplatename(serviceTask.getTemplatename());
serviceSubtask.setSendname(patTaskRelevance.getName());
serviceSubtask.setAge(patTaskRelevance.getAge());
serviceSubtask.setSfzh(patTaskRelevance.getSfzh());
@@ -1021,6 +1469,18 @@
serviceSubtask.setVisitTime(patTaskRelevance.getVisittime());
serviceSubtask.setTextParam(new Gson().toJson(serviceTaskVO.getTextParam()));
if (patTaskRelevance.getIsoperation() != null) {
+ // appltype=5 浠诲姟缁勶細杩藉姞鎮h�咃紙isoperation=1锛夎蛋璁″垝娲剧敓锛涗慨鏀癸紙2锛�/鍒犻櫎锛�3锛変粛璧板師閫昏緫
+ if ("5".equals(serviceTaskVO.getAppltype()) && patTaskRelevance.getIsoperation() == 1) {
+ ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTask.getTaskid());
+ if (schedule == null) {
+ throw new BaseException("appltype=5 浠诲姟缁勶細鏈壘鍒� taskid=" + serviceTask.getTaskid() + " 鐨勮鍒�");
+ }
+ List<ServiceTaskScheduleDetail> detailList = serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
+ serviceSubtask.setUpdateBy(serviceTask.getUpdateBy());
+ serviceSubtask.setCreateBy(serviceTask.getUpdateBy());
+ scheduleSubtaskBuilder.buildSubtasksForPatient(serviceTask, serviceTaskVO.getPreachformList(), schedule, detailList, patTaskRelevance, serviceSubtask);
+ continue;
+ }
if (patTaskRelevance.getIsoperation() == 2) {
serviceSubtask.setUpdateBy(serviceTask.getUpdateBy());
serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
@@ -1073,7 +1533,6 @@
map.put("taskId", serviceTask.getTaskid().intValue());
return map;
}
-
@Override
public void phoneCallBack(PhoneCallBackVO phoneCallBackVO) {
@@ -1481,7 +1940,7 @@
Long id = serviceSubtask.getId();
//鍏堟洿鏂颁竴涓嬪垎鏁�
double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
- serviceSubtask.setScore(BigDecimal.valueOf(score));
+ serviceSubtask.setScore(String.valueOf(score));
serviceSubtask.setFinishtime(new Date());
serviceSubtask.setUpdateTime(new Date());
log.error("鍏堟洿鏂颁竴涓嬪垎鏁�,鐢佃瘽鐨剆erviceSubtask鐨勫�间负锛歿}", serviceSubtask);
@@ -1574,221 +2033,49 @@
if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) {
//鐢ㄦ潵鏍囪锛屾槸鍚︽湁鍖归厤涓婄殑
Integer flag = 0;
- //鏄�夋嫨棰�
- for (int j = 0; j < ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size(); j++) {
- log.error("phoneCallReqYQVO.getAsrtext()鐨勫�间负锛歿}", phoneCallReqYQVO.getAsrtext());
- if (StringUtils.isEmpty(phoneCallReqYQVO.getAsrtext())) {
- continue;
+ //1-AI璇嗗埆
+ String url = configService.selectConfigByKey("sys.voice.match.ai.url", phoneCallReqYQVO.getOrgid());
+
+ if (ObjectUtils.isNotEmpty(url)) {
+ PhoneCallBackYQVO aiMatchResult = AiMatch(url, phoneCallReqYQVO, phoneCallBackYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate, ivrTaskTemplateScripts, scriptId, flag, phoneCallReqYQVO.getUuid());
+ if (aiMatchResult != null) {
+ return aiMatchResult;
}
- //鍖呭惈
- Matcher matcher = null;
- if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
- Pattern pattern = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex());
- matcher = pattern.matcher(phoneCallReqYQVO.getAsrtext());
- }
- //涓嶅寘鍚�
- Matcher matcher2 = null;
- if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2())) {
- Pattern pattern2 = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
- matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
- }
- if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) {
+ } else {
+ //鏄�夋嫨棰�
+ for (int j = 0; j < ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size(); j++) {
+ log.error("phoneCallReqYQVO.getAsrtext()鐨勫�间负锛歿}", phoneCallReqYQVO.getAsrtext());
+ if (StringUtils.isEmpty(phoneCallReqYQVO.getAsrtext())) {
+ continue;
+ }
+ boolean matchedFlag = false;
+ //鍖呭惈
+ Matcher matcher = null;
+ if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
+ Pattern pattern = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex());
+ matcher = pattern.matcher(phoneCallReqYQVO.getAsrtext());
+ }
+ //涓嶅寘鍚�
+ Matcher matcher2 = null;
+ if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2())) {
+ Pattern pattern2 = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
+ matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
+ }
+
+ if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) {
+ matchedFlag = true;
+ }
//璇存槑鍖归厤姝g‘浜�
- //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
- log.info("鍖归厤姝g‘浜嗗悧--------------");
- ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).setIsUserOperation(1);
- serviceTaskScriptTargetoptionMapper.updateIvrTaskTemplateTargetoption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j));
+ if (matchedFlag) {
+ //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
+ log.info("鍖归厤姝g‘浜嗗悧--------------");
+ ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).setIsUserOperation(1);
+ serviceTaskScriptTargetoptionMapper.updateIvrTaskTemplateTargetoption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j));
- //灏嗘偅鑰呯殑鍥炵鍐欒繘service_subtask_detail涓�
- ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
- List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
- ivrTaskTemplateScriptVO.setQuestionResult(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getOptiondesc());
- ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
- //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
- if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
- String questionvoice = serviceSubtaskDetail.getQuestionvoice();
- String[] split = questionvoice.split("\\\\");
- if (split.length > 0) {
- String lastPart = split[split.length - 1];
- serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
- }
- }
- serviceSubtaskDetailList.add(serviceSubtaskDetail);
- serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
- serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
- serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
- saveQuestionAnswerPhone(serviceSubTaskDetailReq);
-
- //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
- if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getIsabnormal()) {
- ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
- //鐢╰askid銆乻ubid鍜宻criptid鍘昏幏鍙杁etailid
- ServiceSubtaskDetail ssd = new ServiceSubtaskDetail();
- ssd.setSubId(serviceSubtask.getId());
- ssd.setTaskid(serviceSubtask.getTaskid());
- ssd.setScriptid(StringUtils.isNotEmpty(scriptId) ? Long.valueOf(scriptId) : null);
- List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(ssd);
- subtaskDetailTrace.setDetailId(CollectionUtils.isNotEmpty(serviceSubtaskDetails) ? serviceSubtaskDetails.get(0).getId() : null);
-
- subtaskDetailTrace.setSubId(serviceSubtask.getId());
- subtaskDetailTrace.setTaskid(serviceSubtask.getTaskid());
- subtaskDetailTrace.setTemplateid(ivrTaskTemplateScriptVO.getId());
- subtaskDetailTrace.setTemplatequestionnum(ivrTaskTemplateScriptVO.getScriptno());
- subtaskDetailTrace.setSwitchid(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getId());
- subtaskDetailTrace.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
- subtaskDetailTrace.setQuestionvoice(null);
- subtaskDetailTrace.setCategoryname(ivrTaskTemplateScriptVO.getScriptAssortname());
- subtaskDetailTrace.setCategoryid(ivrTaskTemplateScriptVO.getScriptAssortid());
- //鑾峰彇鎵�鏈夐�夐」
- String optionDescStr = Optional.ofNullable(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()).filter(list -> !list.isEmpty()).map(list -> list.stream().map(IvrTaskTemplateTargetoption::getOptiondesc).filter(Objects::nonNull).collect(Collectors.joining("&"))).orElse("");
- subtaskDetailTrace.setTargetid(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getId());
- subtaskDetailTrace.setTargetvalue(optionDescStr);
- subtaskDetailTrace.setMatchedtext(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getOptiondesc());
- subtaskDetailTrace.setValueType(serviceSubtaskDetails.get(0).getValueType());
- subtaskDetailTrace.setTemplateType(1);
-
- SvyLibScriptCategory svyLibScriptCategory = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryById(ivrTaskTemplateScriptVO.getScriptAssortid());
- subtaskDetailTrace.setType(svyLibScriptCategory.getType());
- subtaskDetailTrace.setScriptid(ivrTaskTemplateScriptVO.getId());
- subtaskDetailTrace.setAsrtext(phoneCallReqYQVO.getAsrtext());
- subtaskDetailTrace.setRecordpath(phoneCallReqYQVO.getRecordpath());
- subtaskDetailTrace.setPatid(serviceSubtask.getPatid());
- JSONObject patdescJson = new JSONObject();
- patdescJson.put("sendname", serviceSubtask.getSendname());
- patdescJson.put("phone", serviceSubtask.getPhone());
- patdescJson.put("age", serviceSubtask.getAge());
- patdescJson.put("sex", serviceSubtask.getSex() != null ? serviceSubtask.getSex() == 1 ? "鐢�" : "濂�" : null);
- subtaskDetailTrace.setPatdesc(patdescJson.toJSONString());
- subtaskDetailTrace.setTodeptcode(ivrTaskTemplateScriptVO.getDutyDeptCode());
- subtaskDetailTrace.setTodeptname(ivrTaskTemplateScriptVO.getDutyDeptName());
- subtaskDetailTrace.setOrgid(serviceSubtask.getOrgid());
- subtaskDetailTrace.setHandleFlag("0");
- subtaskDetailTrace.setGuid(phoneCallReqYQVO.getGuid());
- subtaskDetailTrace.setCreateTime(new Date());
- subtaskDetailTrace.setUpdateTime(new Date());
- subtaskDetailTrace.setOrgid(phoneCallReqYQVO.getOrgid());
- traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
- }
-
- //鍒ゆ柇涓�涓嬶紝杩欎釜閫夐」缁撴灉鏄笉鏄繕鏈夌户缁棶涓嬪幓鐨勫繀瑕侊紝渚嬪閫夐」缁撴灉鏄埆浜轰笉鎯崇户缁洖绛旈棶棰橈紝灏辫缁撴潫鎺�
- if (ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getIsEnd() == 1) {
- redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
- //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
- ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
- phoneCallBackYQVO.setType("text");
- phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
- //璁板綍鐘舵��
- setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
- return phoneCallBackYQVO;
- }
-
- flag = 1;
- //灏嗗綋鍓嶅墠鐨勬挱鎶ョ姸鎬佸垹闄わ紝缁欎笅涓�棰樿浣�
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
-// //鑾峰彇涓嬩竴棰�
- log.error("鑾峰彇涓嬩竴棰樼殑淇℃伅锛歿}", ivrTaskTemplateScriptVO);
- if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
- Long nextQuestion = null;
- if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1")) {
- nextQuestion = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getNextQuestion();
- //鏇存柊鍒嗘暟
- double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
- score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getScore()).doubleValue();
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score);
- } else {
- nextQuestion = ivrTaskTemplateScriptVO.getNextScriptno();
- //鏇存柊鍒嗘暟
- Object obj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
- Double score = (obj == null ? new Double(0.00) : new Double(((Double) obj).doubleValue()));
- score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getScore()).doubleValue();
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
- }
- if (nextQuestion == null || nextQuestion == 0L) {
- //濡傛灉涓嬩竴棰樹负绌猴紝鎴栬�呬负0锛屽垯鎸傛満
- ServiceSubtask ss = new ServiceSubtask();
- ss.setId(serviceSubtask.getId());
- ss.setSendstate(6L);
- ss.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
- serviceSubtaskMapper.updateServiceSubtask(ss);
- //璁板綍鐘舵��
- setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
-
- redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
- //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
- ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
- phoneCallBackYQVO.setType("text");
- phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
- //灏嗙粨鏋滃啓杩沝etail琛�
- ServiceSubTaskDetailReq ssdReq = new ServiceSubTaskDetailReq();
- List<ServiceSubtaskDetail> serviceSubtaskDetailList2 = new ArrayList<>();
- serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
- serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList2);
- ssdReq.setGuid(phoneCallReqYQVO.getGuid());
- ssdReq.setOrgid(phoneCallReqYQVO.getOrgid());
- saveQuestionAnswerPhone(ssdReq);
- return phoneCallBackYQVO;
- }
-
- for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
- if (script.getSort() == nextQuestion.intValue()) {
- phoneCallBackYQVO.setType("text");
- phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- String scriptContent = StringUtils.isNotEmpty(script.getIvrtext()) ? script.getIvrtext() : script.getScriptContent();
- log.error("涓嬩竴棰橀棶棰橈細{}", scriptContent);
- log.error("涓嬩竴棰樼殑瀛愪换鍔℃槸锛歿}", serviceSubtask);
- phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
- //灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
- redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
- //鍒犻櫎鏃犲搷搴�
- redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
- }
- }
- } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
- ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
- phoneCallBackYQVO.setType("text");
- phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
- //鏇存柊涓�涓嬪垎鏁�
- double score = 0.0;
- Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
- if (ObjectUtils.isNotEmpty(scoreObj)) score = (double) scoreObj;
- serviceSubtask.setScore(BigDecimal.valueOf(score));
- serviceSubtask.setFinishtime(new Date());
- serviceSubtask.setSendstate(6L);
- serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
- serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
- //璁板綍鐘舵��
- setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
- //璁剧疆缁撴潫璇�
- phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
- Long id = serviceSubtask.getId();
- Map<String, String> map = delRedisValue(null, id.toString());
- log.error("map鐨勫�间负锛歿}", map);
- if (ObjectUtils.isNotEmpty(map))
- redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
- redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
- redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
- redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
- //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
- ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
- redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
-// return phoneCallBackYQVO;
-
- }
- } else {
- log.info("娌℃湁鍖归厤涓�----------------------------");
- //flag=0,璇存槑娌� 鍖归厤涓婏紝涔熻鎶婃偅鑰呰鐨勮瘽璁板綍涓嬫潵
- if (j == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
+ //灏嗘偅鑰呯殑鍥炵鍐欒繘service_subtask_detail涓�
ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ ivrTaskTemplateScriptVO.setQuestionResult(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getOptiondesc());
ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
//淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
@@ -1800,14 +2087,201 @@
}
}
serviceSubtaskDetailList.add(serviceSubtaskDetail);
- //濡傛灉娌℃湁 鍖归厤涓婏紝杩欎釜蹇呴』涓簄ull
- serviceSubtaskDetailList.get(0).setMatchedtext("");
serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+
+ //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
+ if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getIsabnormal()) {
+ ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
+ //鐢╰askid銆乻ubid鍜宻criptid鍘昏幏鍙杁etailid
+ ServiceSubtaskDetail ssd = new ServiceSubtaskDetail();
+ ssd.setSubId(serviceSubtask.getId());
+ ssd.setTaskid(serviceSubtask.getTaskid());
+ ssd.setScriptid(StringUtils.isNotEmpty(scriptId) ? Long.valueOf(scriptId) : null);
+ List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(ssd);
+ subtaskDetailTrace.setDetailId(CollectionUtils.isNotEmpty(serviceSubtaskDetails) ? serviceSubtaskDetails.get(0).getId() : null);
+
+ subtaskDetailTrace.setSubId(serviceSubtask.getId());
+ subtaskDetailTrace.setTaskid(serviceSubtask.getTaskid());
+ subtaskDetailTrace.setTemplateid(ivrTaskTemplateScriptVO.getId());
+ subtaskDetailTrace.setTemplatequestionnum(ivrTaskTemplateScriptVO.getScriptno());
+ subtaskDetailTrace.setSwitchid(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getId());
+ subtaskDetailTrace.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
+ subtaskDetailTrace.setQuestionvoice(null);
+ subtaskDetailTrace.setCategoryname(ivrTaskTemplateScriptVO.getScriptAssortname());
+ subtaskDetailTrace.setCategoryid(ivrTaskTemplateScriptVO.getScriptAssortid());
+ //鑾峰彇鎵�鏈夐�夐」
+ String optionDescStr = Optional.ofNullable(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()).filter(list -> !list.isEmpty()).map(list -> list.stream().map(IvrTaskTemplateTargetoption::getOptiondesc).filter(Objects::nonNull).collect(Collectors.joining("&"))).orElse("");
+ subtaskDetailTrace.setTargetid(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getId());
+ subtaskDetailTrace.setTargetvalue(optionDescStr);
+ subtaskDetailTrace.setMatchedtext(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getOptiondesc());
+ subtaskDetailTrace.setValueType(serviceSubtaskDetails.get(0).getValueType());
+ subtaskDetailTrace.setTemplateType(1);
+
+ SvyLibScriptCategory svyLibScriptCategory = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryById(ivrTaskTemplateScriptVO.getScriptAssortid());
+ subtaskDetailTrace.setType(svyLibScriptCategory.getType());
+ subtaskDetailTrace.setScriptid(ivrTaskTemplateScriptVO.getId());
+ subtaskDetailTrace.setAsrtext(phoneCallReqYQVO.getAsrtext());
+ subtaskDetailTrace.setRecordpath(phoneCallReqYQVO.getRecordpath());
+ subtaskDetailTrace.setPatid(serviceSubtask.getPatid());
+ JSONObject patdescJson = new JSONObject();
+ patdescJson.put("sendname", serviceSubtask.getSendname());
+ patdescJson.put("phone", serviceSubtask.getPhone());
+ patdescJson.put("age", serviceSubtask.getAge());
+ patdescJson.put("sex", serviceSubtask.getSex() != null ? serviceSubtask.getSex() == 1 ? "鐢�" : "濂�" : null);
+ subtaskDetailTrace.setPatdesc(patdescJson.toJSONString());
+ subtaskDetailTrace.setTodeptcode(ivrTaskTemplateScriptVO.getDutyDeptCode());
+ subtaskDetailTrace.setTodeptname(ivrTaskTemplateScriptVO.getDutyDeptName());
+ subtaskDetailTrace.setOrgid(serviceSubtask.getOrgid());
+ subtaskDetailTrace.setHandleFlag("0");
+ subtaskDetailTrace.setGuid(phoneCallReqYQVO.getGuid());
+ subtaskDetailTrace.setCreateTime(new Date());
+ subtaskDetailTrace.setUpdateTime(new Date());
+ subtaskDetailTrace.setOrgid(phoneCallReqYQVO.getOrgid());
+ traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
+ }
+
+ //鍒ゆ柇涓�涓嬶紝杩欎釜閫夐」缁撴灉鏄笉鏄繕鏈夌户缁棶涓嬪幓鐨勫繀瑕侊紝渚嬪閫夐」缁撴灉鏄埆浜轰笉鎯崇户缁洖绛旈棶棰橈紝灏辫缁撴潫鎺�
+ if (ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getIsEnd() == 1) {
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
+ //璁板綍鐘舵��
+ setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+ return phoneCallBackYQVO;
+ }
+
+ flag = 1;
+ //灏嗗綋鍓嶅墠鐨勬挱鎶ョ姸鎬佸垹闄わ紝缁欎笅涓�棰樿浣�
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+// //鑾峰彇涓嬩竴棰�
+ log.error("鑾峰彇涓嬩竴棰樼殑淇℃伅锛歿}", ivrTaskTemplateScriptVO);
+ if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
+ Long nextQuestion = null;
+ if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1")) {
+ nextQuestion = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getNextQuestion();
+ //鏇存柊鍒嗘暟
+ double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ score = BigDecimal.valueOf(score).add(new BigDecimal(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getScore())).doubleValue();
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score);
+ } else {
+ nextQuestion = ivrTaskTemplateScriptVO.getNextScriptno();
+ //鏇存柊鍒嗘暟
+ Object obj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ Double score = (obj == null ? new Double(0.00) : new Double(((Double) obj).doubleValue()));
+ score = BigDecimal.valueOf(score).add(new BigDecimal(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getScore())).doubleValue();
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
+ }
+ if (nextQuestion == null || nextQuestion == 0L) {
+ //濡傛灉涓嬩竴棰樹负绌猴紝鎴栬�呬负0锛屽垯鎸傛満
+ ServiceSubtask ss = new ServiceSubtask();
+ ss.setId(serviceSubtask.getId());
+ ss.setSendstate(6L);
+ ss.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+ serviceSubtaskMapper.updateServiceSubtask(ss);
+ //璁板綍鐘舵��
+ setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
+ //灏嗙粨鏋滃啓杩沝etail琛�
+ ServiceSubTaskDetailReq ssdReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList2 = new ArrayList<>();
+ serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList2);
+ ssdReq.setGuid(phoneCallReqYQVO.getGuid());
+ ssdReq.setOrgid(phoneCallReqYQVO.getOrgid());
+ saveQuestionAnswerPhone(ssdReq);
+ return phoneCallBackYQVO;
+ }
+
+ for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
+ if (script.getSort() == nextQuestion.intValue()) {
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ String scriptContent = StringUtils.isNotEmpty(script.getIvrtext()) ? script.getIvrtext() : script.getScriptContent();
+ log.error("涓嬩竴棰橀棶棰橈細{}", scriptContent);
+ log.error("涓嬩竴棰樼殑瀛愪换鍔℃槸锛歿}", serviceSubtask);
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
+ //灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
+ redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
+ //鍒犻櫎鏃犲搷搴�
+ redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+ }
+ }
+ } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
+ ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ //鏇存柊涓�涓嬪垎鏁�
+ double score = 0.0;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (double) scoreObj;
+ serviceSubtask.setScore(String.valueOf(score));
+ serviceSubtask.setFinishtime(new Date());
+ serviceSubtask.setSendstate(6L);
+ serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ //璁板綍鐘舵��
+ setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+ //璁剧疆缁撴潫璇�
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
+ Long id = serviceSubtask.getId();
+ Map<String, String> map = delRedisValue(null, id.toString());
+ log.error("map鐨勫�间负锛歿}", map);
+ if (ObjectUtils.isNotEmpty(map))
+ redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+// return phoneCallBackYQVO;
+
+ }
+ } else {
+ log.info("娌℃湁鍖归厤涓�----------------------------");
+ //flag=0,璇存槑娌� 鍖归厤涓婏紝涔熻鎶婃偅鑰呰鐨勮瘽璁板綍涓嬫潵
+ if (j == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
+ ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
+ //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
+ if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
+ String questionvoice = serviceSubtaskDetail.getQuestionvoice();
+ String[] split = questionvoice.split("\\\\");
+ if (split.length > 0) {
+ String lastPart = split[split.length - 1];
+ serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+ }
+ }
+ serviceSubtaskDetailList.add(serviceSubtaskDetail);
+ //濡傛灉娌℃湁 鍖归厤涓婏紝杩欎釜蹇呴』涓簄ull
+ serviceSubtaskDetailList.get(0).setMatchedtext("");
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+ serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
+ serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
+ saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+ }
+ continue;
}
- continue;
}
}
//閮芥病鏈夊尮閰嶅埌
@@ -1831,7 +2305,7 @@
Double score = null;
Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
- serviceSubtask.setScore(BigDecimal.valueOf(score));
+ serviceSubtask.setScore(String.valueOf(score));
serviceSubtask.setFinishtime(new Date());
serviceSubtask.setSendstate(6L);
serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
@@ -1865,7 +2339,7 @@
Double score = null;
Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
- score = BigDecimal.valueOf(score).add(script.getScore()).doubleValue();
+ score = BigDecimal.valueOf(score).add(new BigDecimal(script.getScore())).doubleValue();
redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
}
@@ -1920,7 +2394,7 @@
Double score = null;
Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
- score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getScore()).doubleValue();
+ score = BigDecimal.valueOf(score).add(new BigDecimal(ivrTaskTemplateScriptVO.getScore())).doubleValue();
redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
}
@@ -1936,7 +2410,7 @@
Double score = null;
Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
if (ObjectUtils.isNotEmpty(scoreObj)) score = (Double) scoreObj;
- serviceSubtask.setScore(BigDecimal.valueOf(score));
+ serviceSubtask.setScore(String.valueOf(score));
serviceSubtask.setFinishtime(new Date());
serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
serviceSubtask.setSendstate(6L);
@@ -2193,6 +2667,8 @@
IvrTaskTemplateScript ivrTaskTemplateScript = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptByID(serviceSubtaskDetail.getScriptid());
if (ivrTaskTemplateScript != null)
serviceSubtaskDetail.setCategoryid(ivrTaskTemplateScript.getScriptAssortid());
+ serviceSubtaskDetail.setIsMydException(ivrTaskTemplateScript.getIsMydException());
+ serviceSubtaskDetail.setDimension(ivrTaskTemplateScript.getDimension());
}
serviceSubtaskDetail.setSubId(selectServiceSubtaskList.get(0).getId());
@@ -2282,7 +2758,6 @@
serviceSubtask.setRemark("鐢佃瘽鎺ラ�氭垚鍔燂紝鎮h�呮嫆缁濋殢璁�");
serviceSubtask.setId(Long.valueOf(phoneCallRecordVO.getTaskid()));
serviceSubtask.setSendstate(6L);
- serviceSubtask.setFinishtime(new Date());
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
// int startIndex = phoneCallRecordVO.getRecord_path().indexOf("voice") + "voice".length() + 1; // 鍔�1鏄烦杩�/绗﹀彿
// int endIndex = phoneCallRecordVO.getRecord_path().lastIndexOf("/");
@@ -2430,16 +2905,21 @@
@Cacheable(value = "sfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
log.info("getSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
- String groupKey = "drcode";
+ String drcode = "drcode";
+ //缂欎簯浜烘皯 鏍规嵁缁忕鍖荤敓鍒嗙粍
+ if (serviceSubtaskCountReq.getOrgid().equals("47246116333112211A1001")) {
+ drcode = "management_doctor_code";
+ }
+ String groupKey = drcode;
if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 1) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKey = "drcode";
+ groupKey = drcode;
} else {
groupKey = "leavehospitaldistrictcode";
}
} else if (serviceSubtaskCountReq.getStatisticaltype() != null && serviceSubtaskCountReq.getStatisticaltype() == 2) {
if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
- groupKey = "drcode";
+ groupKey = drcode;
} else {
groupKey = "deptcode";
}
@@ -2452,11 +2932,18 @@
serviceSubtaskCountReq.setGroupKeyList(groupKeyList);
List<ServiceSubtask> rawData = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
switch (groupKey) {
- case "deptcode":
- collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
- break;
case "drcode":
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrcode()).orElse("Unknown")));
+ break;
+ case "management_doctor_code":
+ rawData = rawData.stream().peek(item -> {
+ item.setDrname(item.getManagementDoctor());
+ item.setDrcode(item.getManagementDoctorCode());
+ }).collect(Collectors.toList());
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getManagementDoctorCode()).orElse("Unknown")));
+ break;
+ case "deptcode":
+ collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptcode()).orElse("Unknown")));
break;
case "leavehospitaldistrictcode":
collect = rawData.stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictcode()).orElse("Unknown")));
@@ -2487,6 +2974,29 @@
serviceSubtaskStatistics.add(statistic);
}
}
+ return serviceSubtaskStatistics;
+ }
+
+ /**
+ * 鑾峰彇涓撶梾闅忚缁熻姣斾緥
+ *
+ * @param serviceSubtaskCountReq
+ * @return
+ */
+ @Override
+// @Cacheable(value = "specialSfStatistics", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()")
+ public List<ServiceSubtaskStatistic> getSpecialSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) {
+ log.info("getSpecialSfStatistics鐨勫叆鍙備负锛歿}", serviceSubtaskCountReq);
+ String groupKey = "drcode";
+ if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) {
+ groupKey = "drcode";
+ } else {
+ groupKey = "task_name";
+ }
+ List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>();
+ serviceSubtaskCountReq.setGroupKey(groupKey);
+ serviceSubtaskStatistics = serviceSubtaskMapper.getSpecialSfStatistics(serviceSubtaskCountReq);
+
return serviceSubtaskStatistics;
}
@@ -2568,7 +3078,6 @@
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")));
}
@@ -2747,62 +3256,12 @@
serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
//鍑洪櫌浜烘
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
- //鍑洪櫌浜烘璇︽儏
- serviceSubtaskStatistic.setDischargeCountInfo(serviceSubtaskList);
- //鏃犻渶闅忚璇︽儏
- List<ServiceSubtask> nonFollowUpInfo = new ArrayList<>();
- //璁板綍杩囨护鎮h�呰鎯�
- List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
- //璁板綍棣栨搴旈殢璁胯鎯�
- List<ServiceSubtask> needFollowUpInfo = new ArrayList<>();
- //璁板綍棣栨寰呴殢璁胯鎯�
- List<ServiceSubtask> pendingFollowUpInfo = new ArrayList<>();
- //璁板綍棣栨闅忚鎴愬姛璇︽儏
- List<ServiceSubtask> followUpSuccessInfo = new ArrayList<>();
- //璁板綍棣栨闅忚澶辫触璇︽儏
- List<ServiceSubtask> followUpFailInfo = new ArrayList<>();
- //璁板綍棣栨闅忚浜哄伐璇︽儏
- List<ServiceSubtask> manualInfo = new ArrayList<>();
- //璁板綍棣栨闅忚璇煶璇︽儏
- List<ServiceSubtask> voiceInfo = new ArrayList<>();
- //璁板綍棣栨闅忚鐭俊璇︽儏
- List<ServiceSubtask> smsInfo = new ArrayList<>();
- //璁板綍棣栨闅忚寰俊璇︽儏
- List<ServiceSubtask> wechatInfo = new ArrayList<>();
-
- //璁板綍鍐嶆搴旈殢璁胯鎯�
- List<ServiceSubtask> needFollowUpAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆寰呴殢璁胯鎯�
- List<ServiceSubtask> pendingFollowUpAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚鎴愬姛璇︽儏
- List<ServiceSubtask> followUpSuccessAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚澶辫触璇︽儏
- List<ServiceSubtask> followUpFailAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚浜哄伐璇︽儏
- List<ServiceSubtask> manualAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚璇煶璇︽儏
- List<ServiceSubtask> voiceAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚鐭俊璇︽儏
- List<ServiceSubtask> smsAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚寰俊璇︽儏
- List<ServiceSubtask> wechatAgainInfo = new ArrayList<>();
-
- //璁板綍闅忚鎯呭喌璇︽儏
- List<ServiceSubtask> taskSituation1Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation2Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation3Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation4Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation5Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation6Info = new ArrayList<>();
-
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
- nonFollowUpInfo.add(serviceSubtask);
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
- filterServiceSubtasks.add(serviceSubtask);
}
}
//搴旈殢璁夸汉娆�
@@ -2813,76 +3272,114 @@
//棣栨鍑洪櫌闅忚
if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) {
//棣栨搴旈殢璁�
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
+ if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L)) {
serviceSubtaskStatistic.setNeedFollowUp(serviceSubtaskStatistic.getNeedFollowUp() + 1L);
- needFollowUpInfo.add(serviceSubtask);
}
- //棣栨寰呴殢璁�
- if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
- serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L);
- pendingFollowUpInfo.add(serviceSubtask);
+ //棣栨鏃犻渶闅忚
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(4L)) {
+ serviceSubtaskStatistic.setNonFollowUpFirst(serviceSubtaskStatistic.getNonFollowUpFirst() + 1L);
}
//棣栨闅忚澶辫触(鍖呮嫭闅忚澶辫触+浜哄伐瓒呮椂)
- if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 5 || serviceSubtask.getSendstate() == 7)) {
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(5L) || serviceSubtask.getSendstate().equals(7L))) {
serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L);
- followUpFailInfo.add(serviceSubtask);
}
/**
* 涓嶅悓缁熻鏂瑰紡涓嬩笉鍚岀殑闅忚鎴愬姛鏁� 鍙傛暟 followUpCountStyle 鎺у埗
*/
if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("1")) {
//棣栨闅忚鎴愬姛
- if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6L)) {
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L))) {
serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
- followUpSuccessInfo.add(serviceSubtask);
+ }
+ //棣栨鏃犻渶闅忚
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(4L))) {
+ serviceSubtaskStatistic.setNonFollowUpFirst(serviceSubtaskStatistic.getNonFollowUpFirst() + 1L);
}
//棣栨闅忚浜哄伐 (涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
- manualInfo.add(serviceSubtask);
}
//棣栨闅忚璇煶 (涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoice(serviceSubtaskStatistic.getVoice() + 1L);
- voiceInfo.add(serviceSubtask);
}
//棣栨闅忚鐭俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
- smsInfo.add(serviceSubtask);
}
//棣栨闅忚寰俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
- wechatInfo.add(serviceSubtask);
+ }
+ } else if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) {
+ //棣栨闅忚鎴愬姛
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L))) {
+ serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
+ }
+ //棣栨鏃犻渶闅忚
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(4L))) {
+ serviceSubtaskStatistic.setNonFollowUpFirst(serviceSubtaskStatistic.getNonFollowUpFirst() + 1L);
+ }
+ //棣栨闅忚浜哄伐 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
+ }
+ //棣栨闅忚璇煶 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoice(serviceSubtaskStatistic.getVoice() + 1L);
+ }
+ //棣栨闅忚鐭俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
+ }
+ //棣栨闅忚寰俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
}
} else {
//棣栨闅忚鎴愬姛 - 缁熻鏃跺�欏姞涓婁笉鎵ц鐨勶紝宸插彂閫佺殑
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L) || serviceSubtask.getSendstate().equals(3L) || serviceSubtask.getSendstate().equals(4L))) {
serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
- followUpSuccessInfo.add(serviceSubtask);
+ }
+ //棣栨鏃犻渶闅忚
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(4L))) {
+ serviceSubtaskStatistic.setNonFollowUpFirst(serviceSubtaskStatistic.getNonFollowUpFirst() + 1L);
}
//棣栨闅忚浜哄伐 (缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
- manualInfo.add(serviceSubtask);
}
//棣栨闅忚璇煶 (缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoice(serviceSubtaskStatistic.getVoice() + 1L);
- voiceInfo.add(serviceSubtask);
}
//棣栨闅忚鐭俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
- smsInfo.add(serviceSubtask);
}
//棣栨闅忚寰俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
- wechatInfo.add(serviceSubtask);
}
}
+
+ //棣栨闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualSuccess(serviceSubtaskStatistic.getManualSuccess() + 1L);
+ }
+ //棣栨闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceSuccess(serviceSubtaskStatistic.getVoiceSuccess() + 1L);
+ }
+ //棣栨闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsSuccess(serviceSubtaskStatistic.getSmsSuccess() + 1L);
+ }
+ //棣栨闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatSuccess(serviceSubtaskStatistic.getWeChatSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
serviceSubtaskStatistic.setFollowUpRate(percentFormat.format(rate));
@@ -2898,74 +3395,104 @@
//鍐嶆搴旈殢璁�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUpAgain(serviceSubtaskStatistic.getNeedFollowUpAgain() + 1L);
- needFollowUpAgainInfo.add(serviceSubtask);
+ }
+ //鍐嶆鏃犻渶闅忚
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
+ serviceSubtaskStatistic.setNonFollowUpAgain(serviceSubtaskStatistic.getNonFollowUpAgain() + 1L);
}
//鍐嶆寰呴殢璁�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUpAgain(serviceSubtaskStatistic.getPendingFollowUpAgain() + 1L);
- pendingFollowUpAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚澶辫触
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
serviceSubtaskStatistic.setFollowUpFailAgain(serviceSubtaskStatistic.getFollowUpFailAgain() + 1L);
- followUpFailAgainInfo.add(serviceSubtask);
}
/**
* 涓嶅悓缁熻鏂瑰紡涓嬩笉鍚岀殑闅忚鎴愬姛鏁� 鍙傛暟 followUpCountStyle 鎺у埗
*/
if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("1")) {
//鍐嶆闅忚鎴愬姛
- if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) {
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L)) {
serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
- followUpSuccessAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚浜哄伐(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
- manualAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚璇煶(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoiceAgain(serviceSubtaskStatistic.getVoiceAgain() + 1L);
- voiceAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚鐭俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
- smsAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚寰俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
- wechatAgainInfo.add(serviceSubtask);
+ }
+ } else if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) {
+ //鍐嶆闅忚鎴愬姛
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L))) {
+ serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
+ }
+ //鍐嶆闅忚浜哄伐 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
+ }
+ //鍐嶆闅忚璇煶 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceAgain(serviceSubtaskStatistic.getVoiceAgain() + 1L);
+ }
+ //鍐嶆闅忚鐭俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
+ }
+ //鍐嶆闅忚寰俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
}
} else {
//鍐嶆闅忚鎴愬姛
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(1L) || serviceSubtask.getSendstate().equals(6L) || serviceSubtask.getSendstate().equals(3L) || serviceSubtask.getSendstate().equals(4L))) {
serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
- followUpSuccessAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚浜哄伐(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
- manualAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚璇煶(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoiceAgain(serviceSubtaskStatistic.getVoiceAgain() + 1L);
- voiceAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚鐭俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
- smsAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚寰俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
- wechatAgainInfo.add(serviceSubtask);
}
}
+
+ //鍐嶆闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualAgainSuccess(serviceSubtaskStatistic.getManualAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceAgainSuccess(serviceSubtaskStatistic.getVoiceAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsAgainSuccess(serviceSubtaskStatistic.getSmsAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatAgainSuccess(serviceSubtaskStatistic.getWeChatAgainSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
serviceSubtaskStatistic.setFollowUpRateAgain(percentFormat.format(rate));
@@ -2980,72 +3507,23 @@
//闅忚鎯呭喌
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 1) {
serviceSubtaskStatistic.setTaskSituation1(serviceSubtaskStatistic.getTaskSituation1() + 1);
- taskSituation1Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 2) {
serviceSubtaskStatistic.setTaskSituation2(serviceSubtaskStatistic.getTaskSituation2() + 1);
- taskSituation2Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 3) {
serviceSubtaskStatistic.setTaskSituation3(serviceSubtaskStatistic.getTaskSituation3() + 1);
- taskSituation3Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 4) {
serviceSubtaskStatistic.setTaskSituation4(serviceSubtaskStatistic.getTaskSituation4() + 1);
- taskSituation4Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 5) {
serviceSubtaskStatistic.setTaskSituation5(serviceSubtaskStatistic.getTaskSituation5() + 1);
- taskSituation5Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 7) {
serviceSubtaskStatistic.setTaskSituation6(serviceSubtaskStatistic.getTaskSituation6() + 1);
- taskSituation6Info.add(serviceSubtask);
}
}
- serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
- //璁板綍鏃犻渶闅忚璇︽儏
- serviceSubtaskStatistic.setNonFollowUpInfo(nonFollowUpInfo);
- //璁板綍棣栨搴旈殢璁胯鎯�
- serviceSubtaskStatistic.setNeedFollowUpInfo(needFollowUpInfo);
- //璁板綍棣栨寰呴殢璁胯鎯�
- serviceSubtaskStatistic.setPendingFollowUpInfo(pendingFollowUpInfo);
- //璁板綍棣栨闅忚鎴愬姛璇︽儏
- serviceSubtaskStatistic.setFollowUpSuccessInfo(followUpSuccessInfo);
- //璁板綍棣栨闅忚澶辫触璇︽儏
- serviceSubtaskStatistic.setFollowUpFailInfo(followUpFailInfo);
- //璁板綍棣栨闅忚浜哄伐璇︽儏
- serviceSubtaskStatistic.setManualInfo(manualInfo);
- //璁板綍棣栨闅忚璇煶璇︽儏
- serviceSubtaskStatistic.setVoiceInfo(voiceInfo);
- //璁板綍棣栨闅忚鐭俊璇︽儏
- serviceSubtaskStatistic.setSmsInfo(smsInfo);
- //璁板綍棣栨闅忚寰俊璇︽儏
- serviceSubtaskStatistic.setWechatInfo(wechatInfo);
- //璁板綍鍐嶆搴旈殢璁胯鎯�
- serviceSubtaskStatistic.setNeedFollowUpAgainInfo(needFollowUpAgainInfo);
- //璁板綍鍐嶆寰呴殢璁胯鎯�
- serviceSubtaskStatistic.setPendingFollowUpAgainInfo(pendingFollowUpAgainInfo);
- //璁板綍鍐嶆闅忚鎴愬姛璇︽儏
- serviceSubtaskStatistic.setFollowUpSuccessAgainInfo(followUpSuccessAgainInfo);
- //璁板綍鍐嶆闅忚澶辫触璇︽儏
- serviceSubtaskStatistic.setFollowUpFailAgainInfo(followUpFailAgainInfo);
- //璁板綍鍐嶆闅忚浜哄伐璇︽儏
- serviceSubtaskStatistic.setManualAgainInfo(manualAgainInfo);
- //璁板綍鍐嶆闅忚璇煶璇︽儏
- serviceSubtaskStatistic.setVoiceAgainInfo(voiceAgainInfo);
- //璁板綍鍐嶆闅忚鐭俊璇︽儏
- serviceSubtaskStatistic.setSmsAgainInfo(smsAgainInfo);
- //璁板綍鍐嶆闅忚寰俊璇︽儏
- serviceSubtaskStatistic.setWechatAgainInfo(wechatAgainInfo);
-
- //闅忚鎯呭喌璇︽儏
- serviceSubtaskStatistic.setTaskSituation1Info(taskSituation1Info);
- serviceSubtaskStatistic.setTaskSituation2Info(taskSituation2Info);
- serviceSubtaskStatistic.setTaskSituation3Info(taskSituation3Info);
- serviceSubtaskStatistic.setTaskSituation4Info(taskSituation4Info);
- serviceSubtaskStatistic.setTaskSituation5Info(taskSituation5Info);
- serviceSubtaskStatistic.setTaskSituation6Info(taskSituation6Info);
return serviceSubtaskStatistic;
}
return serviceSubtaskStatistic;
@@ -3070,45 +3548,13 @@
serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
//鍑洪櫌浜烘
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
- //鍑洪櫌浜烘璇︽儏
- serviceSubtaskStatistic.setDischargeCountInfo(serviceSubtaskList);
- //鏃犻渶闅忚璇︽儏
- List<ServiceSubtask> nonFollowUpInfo = new ArrayList<>();
- //璁板綍杩囨护鎮h�呰鎯�
- List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
- //璁板綍棣栨搴旈殢璁胯鎯�
- List<ServiceSubtask> needFollowUpInfo = new ArrayList<>();
- //璁板綍棣栨寰呴殢璁胯鎯�
- List<ServiceSubtask> pendingFollowUpInfo = new ArrayList<>();
- //璁板綍棣栨闅忚鎴愬姛璇︽儏
- List<ServiceSubtask> followUpSuccessInfo = new ArrayList<>();
- //璁板綍棣栨闅忚澶辫触璇︽儏
- List<ServiceSubtask> followUpFailInfo = new ArrayList<>();
- //璁板綍棣栨闅忚浜哄伐璇︽儏
- List<ServiceSubtask> manualInfo = new ArrayList<>();
- //璁板綍棣栨闅忚璇煶璇︽儏
- List<ServiceSubtask> voiceInfo = new ArrayList<>();
- //璁板綍棣栨闅忚鐭俊璇︽儏
- List<ServiceSubtask> smsInfo = new ArrayList<>();
- //璁板綍棣栨闅忚寰俊璇︽儏
- List<ServiceSubtask> wechatInfo = new ArrayList<>();
-
- //璁板綍闅忚鎯呭喌璇︽儏
- List<ServiceSubtask> taskSituation1Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation2Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation3Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation4Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation5Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation6Info = new ArrayList<>();
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
- nonFollowUpInfo.add(serviceSubtask);
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
- filterServiceSubtasks.add(serviceSubtask);
}
}
//搴旈殢璁夸汉娆�
@@ -3121,74 +3567,104 @@
//棣栨搴旈殢璁�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUp(serviceSubtaskStatistic.getNeedFollowUp() + 1L);
- needFollowUpInfo.add(serviceSubtask);
+ }
+ //棣栨鏃犻渶闅忚
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(4L))) {
+ serviceSubtaskStatistic.setNonFollowUpFirst(serviceSubtaskStatistic.getNonFollowUpFirst() + 1L);
}
//棣栨寰呴殢璁�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L);
- pendingFollowUpInfo.add(serviceSubtask);
}
//棣栨闅忚澶辫触(鍖呮嫭闅忚澶辫触+浜哄伐瓒呮椂)
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 5 || serviceSubtask.getSendstate() == 7)) {
serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L);
- followUpFailInfo.add(serviceSubtask);
}
/**
* 涓嶅悓缁熻鏂瑰紡涓嬩笉鍚岀殑闅忚鎴愬姛鏁� 鍙傛暟 followUpCountStyle 鎺у埗
*/
if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("1")) {
//棣栨闅忚鎴愬姛
- if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6L)) {
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L))) {
serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
- followUpSuccessInfo.add(serviceSubtask);
}
//棣栨闅忚浜哄伐 (涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
- manualInfo.add(serviceSubtask);
}
//棣栨闅忚璇煶 (涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoice(serviceSubtaskStatistic.getVoice() + 1L);
- voiceInfo.add(serviceSubtask);
}
//棣栨闅忚鐭俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
- smsInfo.add(serviceSubtask);
}
//棣栨闅忚寰俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
- wechatInfo.add(serviceSubtask);
+ }
+ } else if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) {
+ //棣栨闅忚鎴愬姛
+ if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L))) {
+ serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
+ }
+ //棣栨闅忚浜哄伐 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
+ }
+ //棣栨闅忚璇煶 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoice(serviceSubtaskStatistic.getVoice() + 1L);
+ }
+ //棣栨闅忚鐭俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
+ }
+ //棣栨闅忚寰俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
}
} else {
//棣栨闅忚鎴愬姛 - 缁熻鏃跺�欏姞涓婁笉鎵ц鐨勶紝宸插彂閫佺殑
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L) || serviceSubtask.getSendstate().equals(3L) || serviceSubtask.getSendstate().equals(4L))) {
serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
- followUpSuccessInfo.add(serviceSubtask);
}
//棣栨闅忚浜哄伐 (缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
- manualInfo.add(serviceSubtask);
}
//棣栨闅忚璇煶 (缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoice(serviceSubtaskStatistic.getVoice() + 1L);
- voiceInfo.add(serviceSubtask);
}
//棣栨闅忚鐭俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
- smsInfo.add(serviceSubtask);
}
//棣栨闅忚寰俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
- wechatInfo.add(serviceSubtask);
}
}
+
+ //棣栨闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualSuccess(serviceSubtaskStatistic.getManualSuccess() + 1L);
+ }
+ //棣栨闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceSuccess(serviceSubtaskStatistic.getVoiceSuccess() + 1L);
+ }
+ //棣栨闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsSuccess(serviceSubtaskStatistic.getSmsSuccess() + 1L);
+ }
+ //棣栨闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatSuccess(serviceSubtaskStatistic.getWeChatSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
serviceSubtaskStatistic.setFollowUpRate(percentFormat.format(rate));
@@ -3203,56 +3679,23 @@
//闅忚鎯呭喌
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 1) {
serviceSubtaskStatistic.setTaskSituation1(serviceSubtaskStatistic.getTaskSituation1() + 1);
- taskSituation1Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 2) {
serviceSubtaskStatistic.setTaskSituation2(serviceSubtaskStatistic.getTaskSituation2() + 1);
- taskSituation2Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 3) {
serviceSubtaskStatistic.setTaskSituation3(serviceSubtaskStatistic.getTaskSituation3() + 1);
- taskSituation3Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 4) {
serviceSubtaskStatistic.setTaskSituation4(serviceSubtaskStatistic.getTaskSituation4() + 1);
- taskSituation4Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 5) {
serviceSubtaskStatistic.setTaskSituation5(serviceSubtaskStatistic.getTaskSituation5() + 1);
- taskSituation5Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 7) {
serviceSubtaskStatistic.setTaskSituation6(serviceSubtaskStatistic.getTaskSituation6() + 1);
- taskSituation6Info.add(serviceSubtask);
}
}
- serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
- //璁板綍鏃犻渶闅忚璇︽儏
- serviceSubtaskStatistic.setNonFollowUpInfo(nonFollowUpInfo);
- //璁板綍棣栨搴旈殢璁胯鎯�
- serviceSubtaskStatistic.setNeedFollowUpInfo(needFollowUpInfo);
- //璁板綍棣栨寰呴殢璁胯鎯�
- serviceSubtaskStatistic.setPendingFollowUpInfo(pendingFollowUpInfo);
- //璁板綍棣栨闅忚鎴愬姛璇︽儏
- serviceSubtaskStatistic.setFollowUpSuccessInfo(followUpSuccessInfo);
- //璁板綍棣栨闅忚澶辫触璇︽儏
- serviceSubtaskStatistic.setFollowUpFailInfo(followUpFailInfo);
- //璁板綍棣栨闅忚浜哄伐璇︽儏
- serviceSubtaskStatistic.setManualInfo(manualInfo);
- //璁板綍棣栨闅忚璇煶璇︽儏
- serviceSubtaskStatistic.setVoiceInfo(voiceInfo);
- //璁板綍棣栨闅忚鐭俊璇︽儏
- serviceSubtaskStatistic.setSmsInfo(smsInfo);
- //璁板綍棣栨闅忚寰俊璇︽儏
- serviceSubtaskStatistic.setWechatInfo(wechatInfo);
-
- //闅忚鎯呭喌璇︽儏
- serviceSubtaskStatistic.setTaskSituation1Info(taskSituation1Info);
- serviceSubtaskStatistic.setTaskSituation2Info(taskSituation2Info);
- serviceSubtaskStatistic.setTaskSituation3Info(taskSituation3Info);
- serviceSubtaskStatistic.setTaskSituation4Info(taskSituation4Info);
- serviceSubtaskStatistic.setTaskSituation5Info(taskSituation5Info);
- serviceSubtaskStatistic.setTaskSituation6Info(taskSituation6Info);
return serviceSubtaskStatistic;
}
@@ -3275,46 +3718,12 @@
serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
//鍑洪櫌浜烘
serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
- //鍑洪櫌浜烘璇︽儏
- serviceSubtaskStatistic.setDischargeCountInfo(serviceSubtaskList);
- //鏃犻渶闅忚璇︽儏
- List<ServiceSubtask> nonFollowUpInfo = new ArrayList<>();
- //璁板綍杩囨护鎮h�呰鎯�
- List<ServiceSubtask> filterServiceSubtasks = new ArrayList<>();
-
- //璁板綍鍐嶆搴旈殢璁胯鎯�
- List<ServiceSubtask> needFollowUpAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆寰呴殢璁胯鎯�
- List<ServiceSubtask> pendingFollowUpAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚鎴愬姛璇︽儏
- List<ServiceSubtask> followUpSuccessAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚澶辫触璇︽儏
- List<ServiceSubtask> followUpFailAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚浜哄伐璇︽儏
- List<ServiceSubtask> manualAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚璇煶璇︽儏
- List<ServiceSubtask> voiceAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚鐭俊璇︽儏
- List<ServiceSubtask> smsAgainInfo = new ArrayList<>();
- //璁板綍鍐嶆闅忚寰俊璇︽儏
- List<ServiceSubtask> wechatAgainInfo = new ArrayList<>();
-
- //璁板綍闅忚鎯呭喌璇︽儏
- List<ServiceSubtask> taskSituation1Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation2Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation3Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation4Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation5Info = new ArrayList<>();
- List<ServiceSubtask> taskSituation6Info = new ArrayList<>();
-
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
- nonFollowUpInfo.add(serviceSubtask);
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 6) {
serviceSubtaskStatistic.setFilterCount(serviceSubtaskStatistic.getFilterCount() + 1L);
- filterServiceSubtasks.add(serviceSubtask);
}
}
//搴旈殢璁夸汉娆�
@@ -3327,74 +3736,104 @@
//鍐嶆搴旈殢璁�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUpAgain(serviceSubtaskStatistic.getNeedFollowUpAgain() + 1L);
- needFollowUpAgainInfo.add(serviceSubtask);
+ }
+ //鍐嶆鏃犻渶闅忚
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
+ serviceSubtaskStatistic.setNonFollowUpAgain(serviceSubtaskStatistic.getNonFollowUpAgain() + 1L);
}
//鍐嶆寰呴殢璁�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUpAgain(serviceSubtaskStatistic.getPendingFollowUpAgain() + 1L);
- pendingFollowUpAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚澶辫触
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
serviceSubtaskStatistic.setFollowUpFailAgain(serviceSubtaskStatistic.getFollowUpFailAgain() + 1L);
- followUpFailAgainInfo.add(serviceSubtask);
}
/**
* 涓嶅悓缁熻鏂瑰紡涓嬩笉鍚岀殑闅忚鎴愬姛鏁� 鍙傛暟 followUpCountStyle 鎺у埗
*/
if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("1")) {
//鍐嶆闅忚鎴愬姛
- if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) {
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L)) {
serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
- followUpSuccessAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚浜哄伐(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
- manualAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚璇煶(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoiceAgain(serviceSubtaskStatistic.getVoiceAgain() + 1L);
- voiceAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚鐭俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
- smsAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚寰俊(涓嶇粺璁′笉鎵ц)
if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
- wechatAgainInfo.add(serviceSubtask);
+ }
+ } else if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) {
+ //鍐嶆闅忚鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L)) {
+ serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
+ }
+ //鍐嶆闅忚浜哄伐 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
+ }
+ //鍐嶆闅忚璇煶 (鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceAgain(serviceSubtaskStatistic.getVoiceAgain() + 1L);
+ }
+ //鍐嶆闅忚鐭俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
+ }
+ //棣栨闅忚寰俊(鍙粺璁″凡瀹屾垚)
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
}
} else {
//鍐嶆闅忚鎴愬姛
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(1L) || serviceSubtask.getSendstate().equals(6L) || serviceSubtask.getSendstate().equals(3L) || serviceSubtask.getSendstate().equals(4L))) {
serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
- followUpSuccessAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚浜哄伐(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
- manualAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚璇煶(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoiceAgain(serviceSubtaskStatistic.getVoiceAgain() + 1L);
- voiceAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚鐭俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
- smsAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚寰俊(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
- wechatAgainInfo.add(serviceSubtask);
}
}
+
+ //鍐嶆闅忚浜哄伐鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
+ serviceSubtaskStatistic.setManualAgainSuccess(serviceSubtaskStatistic.getManualAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚璇煶鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
+ serviceSubtaskStatistic.setVoiceAgainSuccess(serviceSubtaskStatistic.getVoiceAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚鐭俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
+ serviceSubtaskStatistic.setSmsAgainSuccess(serviceSubtaskStatistic.getSmsAgainSuccess() + 1L);
+ }
+ //鍐嶆闅忚寰俊鎴愬姛
+ if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
+ serviceSubtaskStatistic.setWeChatAgainSuccess(serviceSubtaskStatistic.getWeChatAgainSuccess() + 1L);
+ }
+
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
serviceSubtaskStatistic.setFollowUpRateAgain(percentFormat.format(rate));
@@ -3409,56 +3848,23 @@
//闅忚鎯呭喌
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 1) {
serviceSubtaskStatistic.setTaskSituation1(serviceSubtaskStatistic.getTaskSituation1() + 1);
- taskSituation1Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 2) {
serviceSubtaskStatistic.setTaskSituation2(serviceSubtaskStatistic.getTaskSituation2() + 1);
- taskSituation2Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 3) {
serviceSubtaskStatistic.setTaskSituation3(serviceSubtaskStatistic.getTaskSituation3() + 1);
- taskSituation3Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 4) {
serviceSubtaskStatistic.setTaskSituation4(serviceSubtaskStatistic.getTaskSituation4() + 1);
- taskSituation4Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 5) {
serviceSubtaskStatistic.setTaskSituation5(serviceSubtaskStatistic.getTaskSituation5() + 1);
- taskSituation5Info.add(serviceSubtask);
}
if (serviceSubtask.getTaskSituation() != null && serviceSubtask.getTaskSituation() == 7) {
serviceSubtaskStatistic.setTaskSituation6(serviceSubtaskStatistic.getTaskSituation6() + 1);
- taskSituation6Info.add(serviceSubtask);
}
}
- serviceSubtaskStatistic.setFilterCountList(filterServiceSubtasks);
- //璁板綍鏃犻渶闅忚璇︽儏
- serviceSubtaskStatistic.setNonFollowUpInfo(nonFollowUpInfo);
- //璁板綍鍐嶆搴旈殢璁胯鎯�
- serviceSubtaskStatistic.setNeedFollowUpAgainInfo(needFollowUpAgainInfo);
- //璁板綍鍐嶆寰呴殢璁胯鎯�
- serviceSubtaskStatistic.setPendingFollowUpAgainInfo(pendingFollowUpAgainInfo);
- //璁板綍鍐嶆闅忚鎴愬姛璇︽儏
- serviceSubtaskStatistic.setFollowUpSuccessAgainInfo(followUpSuccessAgainInfo);
- //璁板綍鍐嶆闅忚澶辫触璇︽儏
- serviceSubtaskStatistic.setFollowUpFailAgainInfo(followUpFailAgainInfo);
- //璁板綍鍐嶆闅忚浜哄伐璇︽儏
- serviceSubtaskStatistic.setManualAgainInfo(manualAgainInfo);
- //璁板綍鍐嶆闅忚璇煶璇︽儏
- serviceSubtaskStatistic.setVoiceAgainInfo(voiceAgainInfo);
- //璁板綍鍐嶆闅忚鐭俊璇︽儏
- serviceSubtaskStatistic.setSmsAgainInfo(smsAgainInfo);
- //璁板綍鍐嶆闅忚寰俊璇︽儏
- serviceSubtaskStatistic.setWechatAgainInfo(wechatAgainInfo);
-
- //闅忚鎯呭喌璇︽儏
- serviceSubtaskStatistic.setTaskSituation1Info(taskSituation1Info);
- serviceSubtaskStatistic.setTaskSituation2Info(taskSituation2Info);
- serviceSubtaskStatistic.setTaskSituation3Info(taskSituation3Info);
- serviceSubtaskStatistic.setTaskSituation4Info(taskSituation4Info);
- serviceSubtaskStatistic.setTaskSituation5Info(taskSituation5Info);
- serviceSubtaskStatistic.setTaskSituation6Info(taskSituation6Info);
return serviceSubtaskStatistic;
}
@@ -3578,10 +3984,6 @@
serviceSubtaskStatistic.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode());
serviceSubtaskStatistic.setDrcode(serviceSubtaskList.get(0).getDrcode());
serviceSubtaskStatistic.setDrname(serviceSubtaskList.get(0).getDrname());
-// //鍑洪櫌浜烘
-// serviceSubtaskStatistic.setDischargeCount(serviceSubtaskList.size());
-// //鍑洪櫌浜烘璇︽儏
-// serviceSubtaskStatistic.setDischargeCountInfo(serviceSubtaskList);
serviceSubtaskStatistic.setJoyCount(0);
serviceSubtaskStatistic.setJoyAllCount(0);
@@ -3589,49 +3991,6 @@
if (subCounts == null) {
subCounts = new ArrayList<>();
}
-
-// //鏃犻渶闅忚璇︽儏
-// List<ServiceSubtask> nonFollowUpInfo = new ArrayList<>();
-// //搴旈殢璁胯鎯�
-// List<ServiceSubtask> followUpNeededAllInfo = new ArrayList<>();
-// //璁板綍棣栨搴旈殢璁胯鎯�
-// List<ServiceSubtask> needFollowUpInfo = new ArrayList<>();
-// //璁板綍棣栨寰呴殢璁胯鎯�
-// List<ServiceSubtask> pendingFollowUpInfo = new ArrayList<>();
-// //璁板綍棣栨闅忚鎴愬姛璇︽儏
-// List<ServiceSubtask> followUpSuccessInfo = new ArrayList<>();
-// //璁板綍棣栨闅忚澶辫触璇︽儏
-// List<ServiceSubtask> followUpFailInfo = new ArrayList<>();
-// //璁板綍棣栨闅忚浜哄伐璇︽儏
-// List<ServiceSubtask> manualInfo = new ArrayList<>();
-// //璁板綍棣栨闅忚璇煶璇︽儏
-// List<ServiceSubtask> voiceInfo = new ArrayList<>();
-// //璁板綍棣栨闅忚鐭俊璇︽儏
-// List<ServiceSubtask> smsInfo = new ArrayList<>();
-// //璁板綍棣栨闅忚寰俊璇︽儏
-// List<ServiceSubtask> wechatInfo = new ArrayList<>();
-//
-// //璁板綍棣栨缁撴灉寮傚父璇︽儏
-// List<ServiceSubtask> abnormalInfo = new ArrayList<>();
-//
-// //璁板綍鍐嶆搴旈殢璁胯鎯�
-// List<ServiceSubtask> needFollowUpAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆寰呴殢璁胯鎯�
-// List<ServiceSubtask> pendingFollowUpAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆闅忚鎴愬姛璇︽儏
-// List<ServiceSubtask> followUpSuccessAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆闅忚澶辫触璇︽儏
-// List<ServiceSubtask> followUpFailAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆闅忚浜哄伐璇︽儏
-// List<ServiceSubtask> manualAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆闅忚璇煶璇︽儏
-// List<ServiceSubtask> voiceAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆闅忚鐭俊璇︽儏
-// List<ServiceSubtask> smsAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆闅忚寰俊璇︽儏
-// List<ServiceSubtask> wechatAgainInfo = new ArrayList<>();
-// //璁板綍鍐嶆缁撴灉寮傚父璇︽儏
-// List<ServiceSubtask> abnormalAgainInfo = new ArrayList<>();
for (ServiceSubtask serviceSubtask : serviceSubtaskList) {
@@ -3647,31 +4006,25 @@
//鏃犻渶闅忚浜烘
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) {
serviceSubtaskStatistic.setNonFollowUp(serviceSubtaskStatistic.getNonFollowUp() + 1L);
-// nonFollowUpInfo.add(serviceSubtask);
}
//搴旈殢璁夸汉娆�
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setFollowUpNeeded(serviceSubtaskStatistic.getFollowUpNeeded() + 1L);
-// followUpNeededAllInfo.add(serviceSubtask);
}
//棣栨鍑洪櫌闅忚
if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() == 1) {
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUp(serviceSubtaskStatistic.getNeedFollowUp() + 1L);
-// needFollowUpInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUp(serviceSubtaskStatistic.getPendingFollowUp() + 1L);
-// pendingFollowUpInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 6)) {
serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L);
-// followUpSuccessInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 5 || serviceSubtask.getSendstate() == 7)) {
serviceSubtaskStatistic.setFollowUpFail(serviceSubtaskStatistic.getFollowUpFail() + 1L);
-// followUpFailInfo.add(serviceSubtask);
}
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccess() + serviceSubtaskStatistic.getFollowUpFail()) / serviceSubtaskStatistic.getNeedFollowUp();
@@ -3681,41 +4034,32 @@
}
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L);
-// manualInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoice(serviceSubtaskStatistic.getVoice() + 1L);
-// voiceInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L);
-// smsInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L);
-// wechatInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) {
serviceSubtaskStatistic.setAbnormal(serviceSubtaskStatistic.getAbnormal() + 1L);
-// abnormalInfo.add(serviceSubtask);
}
}//浜屾鍑洪櫌闅忚
else if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() > 1) {
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) {
serviceSubtaskStatistic.setNeedFollowUpAgain(serviceSubtaskStatistic.getNeedFollowUpAgain() + 1L);
-// needFollowUpAgainInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) {
serviceSubtaskStatistic.setPendingFollowUpAgain(serviceSubtaskStatistic.getPendingFollowUpAgain() + 1L);
-// pendingFollowUpAgainInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate() == 1 || serviceSubtask.getSendstate() == 3 || serviceSubtask.getSendstate() == 6)) {
serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L);
-// followUpSuccessAgainInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) {
serviceSubtaskStatistic.setFollowUpFailAgain(serviceSubtaskStatistic.getFollowUpFailAgain() + 1L);
-// followUpFailAgainInfo.add(serviceSubtask);
}
if (serviceSubtaskStatistic.getNeedFollowUp() > 0) {
double rate = (double) (serviceSubtaskStatistic.getFollowUpSuccessAgain() + serviceSubtaskStatistic.getFollowUpFailAgain()) / serviceSubtaskStatistic.getNeedFollowUpAgain();
@@ -3725,24 +4069,19 @@
}
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("1")) {
serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L);
-// manualAgainInfo.add(serviceSubtask);
}
//鍐嶆闅忚璇煶(缁熻涓嶆墽琛�)
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("3")) {
serviceSubtaskStatistic.setVoiceAgain(serviceSubtaskStatistic.getVoiceAgain() + 1L);
-// voiceAgainInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("4")) {
serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L);
-// smsAgainInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) {
serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L);
-// wechatAgainInfo.add(serviceSubtask);
}
if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) {
serviceSubtaskStatistic.setAbnormalAgain(serviceSubtaskStatistic.getAbnormalAgain() + 1L);
-// abnormalAgainInfo.add(serviceSubtask);
}
}
}
@@ -3828,19 +4167,23 @@
serviceOutPath.setParam2(patid);
serviceOutPath.setCreateTime(new Date());
serviceOutPath.setParam6(subId);
+ serviceOutPath.setOrgid(serviceSubtask.getOrgid());
iServiceOutPathService.insertServiceOutPath(serviceOutPath);
//杞垚16杩涘埗
String format = String.format("%03X", serviceOutPath.getId());
+ String url = "";
+ SendMagParam sendMagParam = new SendMagParam();
+ url = localIP + ":" + req_path + "/sf?p=" + format;
+ sendMagParam.setUrl(url);
+ sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌闅忚璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "濉啓銆傛劅璋㈡偍閰嶅悎锛�");
serviceOutPath.setRadix(format);
serviceOutPath.setUpdateTime(new Date());
+ serviceOutPath.setUrl(url);
iServiceOutPathService.updateServiceOutPath(serviceOutPath);
- SendMagParam sendMagParam = new SendMagParam();
- sendMagParam.setUrl(localIP + ":" + req_path + "/sf?p=" + format);
- sendMagParam.setContent("銆愭柊鍗庡尰闄€�戞偍濂斤紝閭�璇锋偍濉啓鍑洪櫌闅忚璋冩煡琛紝璇风偣鍑�" + sendMagParam.getUrl() + "濉啓銆傛劅璋㈡偍閰嶅悎锛�");
Map<String, String> map = new HashMap<>();
map.put("phone", serviceSubtask.getPhone());
map.put("content", sendMagParam.getContent());
- String result = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(map));
+ HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(map));
redisCache.setCacheObject(subTaskId + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES);
if (StringUtils.isNotEmpty(serviceSubtask.getRemark()))
serviceSubtask.setRemark("鐢佃瘽鍙戦�佹嫆鎺�,鐭俊琛ュ伩鍙戦�佹垚鍔�");
@@ -3908,10 +4251,224 @@
return serviceSubtaskMapper.getSfStatisticsJoydetails(serviceSubtaskCountReq);
}
+ /**
+ * 鑾峰彇闅忚缁熻瓒呴摼鎺�
+ * dischargeCountInfo
+ * followUpNeededAllInfo - sendstate != 4 (1,2,3,5,6,7)
+ * nonFollowUpInfo - sendstate = 4
+ * needFollowUpInfo - visitCount = 1 && sendstate != 4
+ * pendingFollowUpInfo - visitCount = 1 && sendstate = 2
+ * followUpSuccessInfo - visitCount = 1 && sendstate = 6
+ * followUpFailInfo - visitCount = 1 && (sendstate = 5 || sendstate = 7)
+ * manualInfo - visitCount = 1 && currentPreachForm = "1"
+ * voiceInfo - visitCount = 1 && currentPreachForm = "3"
+ * smsInfo - visitCount = 1 && currentPreachForm = "4"
+ * wechatInfo - visitCount = 1 && currentPreachForm = "5"
+ * manualSuccessInfo - visitCount = 1 && currentPreachForm = "1" && sendstate = 6
+ * voiceSuccessInfo - visitCount = 1 && currentPreachForm = "3" && sendstate = 6
+ * smsSuccessInfo - visitCount = 1 && currentPreachForm = "4" && sendstate = 6
+ * wechatSuccessInfo - visitCount = 1 && currentPreachForm = "5" && sendstate = 6
+ * abnormalInfo - visitCount = 1 && excep = "1"
+ * needFollowUpAgainInfo - visitCount > 1 && sendstate != 4
+ * pendingFollowUpAgainInfo - visitCount > 1 && sendstate = 2
+ * followUpSuccessAgainInfo - visitCount > 1 && sendstate =6
+ * followUpFailAgainInfo - visitCount > 1 && (sendstate = 5 || sendstate = 7)
+ * manualAgainInfo - visitCount > 1 && currentPreachForm = "1"
+ * voiceAgainInfo - visitCount > 1 && currentPreachForm = "3"
+ * smsAgainInfo - visitCount > 1 && currentPreachForm = "4"
+ * wechatAgainInfo - visitCount > 1 && currentPreachForm = "5"
+ * manualAgainSuccessInfo - visitCount > 1 && currentPreachForm = "1" && sendstate = 6
+ * voiceAgainSuccessInfo - visitCount > 1 && currentPreachForm = "3" && sendstate = 6
+ * smsAgainSuccessInfo - visitCount > 1 && currentPreachForm = "4" && sendstate = 6
+ * wechatAgainSuccessInfo - visitCount > 1&& currentPreachForm = "5" && sendstate = 6
+ * abnormalAgainInfo- visitCount = 1 && excep = "1"
+ * taskSituation1Info - taskSituation = 1
+ * taskSituation2Info - taskSituation = 2
+ * taskSituation3Info - taskSituation = 3
+ * taskSituation4Info - taskSituation = 4
+ * taskSituation5Info - taskSituation = 5
+ * taskSituation6Info - taskSituation = 7
+ * filterCountList - taskSituation = 6 && sendstate = 4
+ *
+ */
@Override
public List<ServiceSubtask> getSfStatisticsHyperlink(ServiceSubtaskCountReq serviceSubtaskCountReq) {
- List<ServiceSubtask> subtasks = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq);
- return subtasks;
+ String hyperLinkInfoType = serviceSubtaskCountReq.getHyperLinkInfoType();
+ if (StringUtils.isNotEmpty(hyperLinkInfoType)) {
+ applyHyperLinkInfoType(serviceSubtaskCountReq, hyperLinkInfoType);
+ }
+
+ String followUpCountStyle = serviceSubtaskCountReq.getFollowUpCountStyle();
+ /**
+ * 缁熻鏃剁畻涓婁笉鍙戦�佺殑
+ */
+ if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("2")) {
+ List<Long> sendstates = serviceSubtaskCountReq.getSendstates();
+ if (CollectionUtils.isNotEmpty(sendstates) && sendstates.get(0).equals(6L)) {
+ List<Long> sendstates1 = new ArrayList<>();
+ sendstates1.add(3L);
+ sendstates1.add(4L);
+ sendstates1.add(6L);
+ serviceSubtaskCountReq.setSendstates(sendstates1);
+ }
+ }
+ List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.getSfStatisticsHyperlink(serviceSubtaskCountReq);
+ return serviceSubtasks;
+ }
+
+ private void applyHyperLinkInfoType(ServiceSubtaskCountReq serviceSubtaskCountReq, String hyperLinkInfoType) {
+ serviceSubtaskCountReq.setVisitCount(null);
+ serviceSubtaskCountReq.setSendstates(null);
+ serviceSubtaskCountReq.setCurrentPreachform(null);
+ serviceSubtaskCountReq.setExcep(null);
+ serviceSubtaskCountReq.setTaskSituation(null);
+
+ switch (hyperLinkInfoType) {
+ case "dischargeCountInfo":
+ break;
+ case "followUpNeededAllInfo":
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 6L, 7L)));
+ break;
+ case "nonFollowUpInfo":
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(4L)));
+ break;
+ case "needFollowUpInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 6L, 7L)));
+ break;
+ case "pendingFollowUpInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(2L)));
+ break;
+ case "followUpSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ break;
+ case "followUpFailInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(5L, 7L)));
+ break;
+ case "manualInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setCurrentPreachform("1");
+ break;
+ case "voiceInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setCurrentPreachform("3");
+ break;
+ case "smsInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setCurrentPreachform("4");
+ break;
+ case "wechatInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setCurrentPreachform("5");
+ break;
+ case "manualSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("1");
+ break;
+ case "voiceSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("3");
+ break;
+ case "smsSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("4");
+ break;
+ case "wechatSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("5");
+ break;
+ case "abnormalInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setExcep("1");
+ break;
+ case "needFollowUpAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 6L, 7L)));
+ break;
+ case "pendingFollowUpAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(2L)));
+ break;
+ case "followUpSuccessAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ break;
+ case "followUpFailAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Arrays.asList(5L, 7L)));
+ break;
+ case "manualAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setCurrentPreachform("1");
+ break;
+ case "voiceAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setCurrentPreachform("3");
+ break;
+ case "smsAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setCurrentPreachform("4");
+ break;
+ case "wechatAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setCurrentPreachform("5");
+ break;
+ case "manualAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(1);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("1");
+ break;
+ case "voiceAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("3");
+ break;
+ case "smsAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("4");
+ break;
+ case "wechatAgainSuccessInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(6L)));
+ serviceSubtaskCountReq.setCurrentPreachform("5");
+ break;
+ case "abnormalAgainInfo":
+ serviceSubtaskCountReq.setVisitCount(2);
+ serviceSubtaskCountReq.setExcep("1");
+ break;
+ case "taskSituation1Info":
+ serviceSubtaskCountReq.setTaskSituation(1);
+ break;
+ case "taskSituation2Info":
+ serviceSubtaskCountReq.setTaskSituation(2);
+ break;
+ case "taskSituation3Info":
+ serviceSubtaskCountReq.setTaskSituation(3);
+ break;
+ case "taskSituation4Info":
+ serviceSubtaskCountReq.setTaskSituation(4);
+ break;
+ case "taskSituation5Info":
+ serviceSubtaskCountReq.setTaskSituation(5);
+ break;
+ case "taskSituation6Info":
+ serviceSubtaskCountReq.setTaskSituation(7);
+ break;
+ case "filterCountList":
+ serviceSubtaskCountReq.setTaskSituation(6);
+ serviceSubtaskCountReq.setSendstates(new ArrayList<>(Collections.singletonList(4L)));
+ break;
+ default:
+ break;
+ }
}
@@ -3964,10 +4521,7 @@
//鑾峰彇鍙婃椂鐜囩粺璁″悎闆�
Map<String, Map<String, Object>> jsRates = getSsRateForSfStatistics(serviceSubtaskCountReq, collect);
//涓�娆℃�ф煡璇㈡墍鏈夊垎缁勭殑棰樼洰缁熻锛岄伩鍏嶆瘡涓垎缁勪竴娆QL锛圢+1锛�
- List<Long> allSubTaskIds = rawData.stream().map(ServiceSubtask::getId)
- .filter(Objects::nonNull)
- .distinct()
- .collect(Collectors.toList());
+ List<Long> allSubTaskIds = rawData.stream().map(ServiceSubtask::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
List<ServiceSubtaskCount> subCounts = new ArrayList<>();
if (CollectionUtils.isNotEmpty(allSubTaskIds)) {
serviceSubtaskCountReq.setSubTaskIds(allSubTaskIds);
@@ -4176,7 +4730,7 @@
if (serviceSubtaskPreachform1.getSort() == spSize.size() && failSendstate.equals("4")) {
serviceSubtask.setCurrentPreachform(preachform);
serviceSubtask.setSendstate(5L);
- serviceSubtask.setRemark(remark + ";鎵�鏈夊彂閫佹柟寮忓潎鏈幏鍙栫粨鏋滐紝浠诲姟澶辫触");
+ serviceSubtask.setRemark(remark + ";鎵�鏈夋墽琛屾柟寮忓潎鏈幏鍙栫粨鏋滐紝浠诲姟澶辫触");
serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
return true;
} else {
@@ -4512,6 +5066,415 @@
return resultMap;
}
+ @Override
+ public List<ServiceSubtask> gethelibraryCountHyperlink(HeLibraryCountVO heLibraryCountVO) {
+ String hyperLinkInfoType = heLibraryCountVO.getHyperLinkInfoType();
+ if (StringUtils.isNotEmpty(hyperLinkInfoType)) {
+ heLibraryCountVO.setSendstate(null);
+ heLibraryCountVO.setIsFinished(null);
+ switch (hyperLinkInfoType) {
+ case "totalCountInfo":
+ break;
+ case "sendSuccessCountInfo":
+ heLibraryCountVO.setSendstate(6L);
+ break;
+ case "readCountInfo":
+ heLibraryCountVO.setIsFinished("1");
+ break;
+ default:
+ break;
+ }
+ }
+ List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.gethelibraryCountHyperlink(heLibraryCountVO);
+ return serviceSubtasks;
+ }
+
+ @Override
+ public Map<String, Object> smsSubTask(Long subid) {
+ log.info("smsSubTask鐨勫叆鍙備负锛歿}", subid);
+ Map<String, Object> resultMap = new HashMap<>();
+ resultMap.put("code", "500");
+ resultMap.put("msg", "鍙戦�佸け璐�");
+
+ //鑾峰彇鎮h�呯殑鍩烘湰淇℃伅
+ ServiceSubtask serviceSubtask = selectServiceSubtaskById(subid);
+ RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+ String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
+ String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
+ String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
+
+ //涓芥按涓尰闄㈠彂閫佺殑鏄井淇″叕浼楀彿
+ if (StringUtils.isNotEmpty(serviceSubtask.getOrgid()) && serviceSubtask.getOrgid().equals("47231022633110211A2101")) {
+ resultMap = wechatSubTask(subid);
+ return resultMap;
+ }
+
+ //鍙戦�佹暟鎹殑灏佽
+ ServiceOutPath serviceOutPath = new ServiceOutPath();
+ serviceOutPath.setParam1(taskId);
+ serviceOutPath.setParam2(patid);
+ serviceOutPath.setParam3(serviceSubtask.getTaskName());
+ serviceOutPath.setParam6(subId);
+ serviceOutPath.setCreateTime(new Date());
+ serviceOutPath.setOrgid(serviceSubtask.getOrgid());
+ iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+ String format = String.format("%03X", serviceOutPath.getId());
+ String url = "";
+ SendMagParam sendMagParam = new SendMagParam();
+ sendMagParam.setType("4");
+ sendMagParam.setPhone(serviceSubtask.getPhone());
+ url = StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format;
+ sendMagParam.setUrl(url);
+
+ serviceOutPath.setRadix(format);
+ serviceOutPath.setUpdateTime(new Date());
+ serviceOutPath.setUrl(url);
+ iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+ SysConfig sysConfig = new SysConfig();
+
+ sysConfig = sysConfigMapper.checkConfigKeyUnique("wj.sms.template");
+
+ if (!Objects.isNull(sysConfig)) {
+ String smsContemt = sysConfig.getConfigValue();
+ sendMagParam.setContent(smsContemt.replace("${wjurl}", sendMagParam.getUrl()));
+ }
+
+ if (active.equals("nhfy")) {
+ Map<String, Object> smsResult = mtSubmitSmUtil.submitSm(sendMagParam.getPhone(), sendMagParam.getContent());
+ if (smsResult != null && smsResult.get("result") != null && smsResult.get("result").toString().equals("0")) {
+ resultMap.put("code", "200");
+ resultMap.put("msg", "鍙戦�佹垚鍔�");
+ serviceSubtask.setRemark(StringUtils.isNotEmpty(serviceSubtask.getRemark()) ? serviceSubtask.getRemark() + ";鐭俊鍙戦�佹垚鍔�(鎵嬪姩鎻愪氦)" : "鐭俊鍙戦�佹垚鍔�(鎵嬪姩鎻愪氦)");
+ log.info("鏄惁鍙戦�佹垚鍔燂細{}", serviceSubtask.getRemark());
+ serviceSubtask.setSendstate(3L);
+ serviceSubtask.setCurrentPreachform("4");
+ }
+ }
+ return resultMap;
+ }
+
+ public Map<String,Object> wechatSubTask(Long subid){
+ log.info("wechatSubTask鐨勫叆鍙備负锛歿}", subid);
+ Map<String, Object> resultMap = new HashMap<>();
+ resultMap.put("code", "500");
+ resultMap.put("msg", "鍙戦�佸け璐�");
+ try{
+ //鑾峰彇闅忚鐨勫熀鏈俊鎭�
+ ServiceSubtask serviceSubtask = selectServiceSubtaskById(subid);
+ //鑾峰彇鎮h�呬俊鎭�
+ PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(serviceSubtask.getPatid());
+
+ RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+ String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
+ String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
+ String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
+ String url = localIP + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3="
+ + URLEncoder.encode(serviceSubtask.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"
+ + "$param6=" + subId;
+
+ ServiceOutPath serviceOutPath = new ServiceOutPath();
+ serviceOutPath.setParam1(taskId);
+ serviceOutPath.setParam2(patid);
+ serviceOutPath.setParam3(serviceSubtask.getTaskName());
+ serviceOutPath.setParam6(subId);
+ serviceOutPath.setCreateTime(new Date());
+ serviceOutPath.setOrgid(serviceSubtask.getOrgid());
+ iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+ String format = String.format("%03X", serviceOutPath.getId());
+ serviceOutPath.setRadix(format);
+ serviceOutPath.setUpdateTime(new Date());
+ serviceOutPath.setUrl(url);
+ iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+
+
+ //鑾峰彇寰俊鍏紬鍙疯姹備俊鎭牴鎹満鏋処D
+ List<String> wxqqxx = WxGZHEnum.getDescByCode(serviceSubtask.getOrgid());
+ if (CollectionUtils.isEmpty(wxqqxx) || wxqqxx.size() < 4) {
+ resultMap.put("code", -1);
+ resultMap.put("message", "鍙戦�佸紓甯革細" + "銆愬叕浼楀彿銆戣鏈烘瀯鐨勫叕浼楀彿閰嶇疆淇℃伅涓嶅叏锛屾棤娉曢�氳繃鍏紬鍙峰彂閫�");
+ return resultMap;
+ }
+
+ if (StringUtils.isEmpty(serviceSubtask.getPatidHis())) {
+ resultMap.put("code", -1);
+ resultMap.put("message", "鍙戦�佸紓甯革細" + "銆愬叕浼楀彿銆戝叕浼楀彿鍙戦�佸け璐�,his绯荤粺鐨勬偅鑰卛d涓虹┖");
+ return resultMap;
+ }
+ String wxCode = "";
+ wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), patArchive.getTelcode(), serviceSubtask.getSendname(), patArchive.getPatidHis(), wxqqxx);
+ Map map = JSONObject.parseObject(wxCode, Map.class);
+ Boolean wxCodeSuccess = false;
+ if (!map.isEmpty() && map.get("succ") != null) {
+ wxCodeSuccess = (boolean) map.get("succ");
+ }
+
+ //鍙戦�佸畬鎴愬悗锛屼慨鏀圭姸鎬�
+ serviceSubtask.setSendstate(3L);
+ if (wxCodeSuccess) {
+ serviceSubtask.setResult("success");
+ resultMap.put("code", "200");
+ resultMap.put("msg", "鍙戦�佹垚鍔�");
+ } else {
+ log.error("銆恠fHandlle銆戝叕浼楀彿鍙戦�佸け璐ワ紝鎮h�呬俊鎭細{}锛岄敊璇俊鎭細{}", serviceSubtask, map.get("msg"));
+ resultMap.put("code", -1);
+ resultMap.put("message", "銆愬叕浼楀彿銆戝叕浼楀彿鍙戦�佸け璐�");
+ return resultMap;
+ }
+ } catch (Exception e) {
+ String guid = UUID.randomUUID().toString();
+ log.error("銆恠fHandlle銆戦暱鏈熶换鍔″叕浼楀彿鍙戦�佸け璐ワ紝鍘熷洜锛歿}锛孏UID锛歿}", e.getMessage(), guid);
+ resultMap.put("code", -1);
+ resultMap.put("message", "銆愬叕浼楀彿銆戦暱鏈熶换鍔″叕浼楀彿鍙戦�佸け璐ワ紝鍘熷洜锛�" + e.getMessage());
+ return resultMap;
+ }
+ return resultMap;
+ }
+ @Override
+ public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startFinishTime, Date endFinishTime, Date startOutHospTime, Date endOutHospTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType) {
+ //鍏堟竻鐞嗕竴涓嬮噸澶嶆暟鎹�
+ List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds();
+ if (!CollectionUtils.isEmpty(repeatIds)) {
+ serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds);
+ }
+ List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = serviceSubtaskMapper.statQuestionOption(taskIds, startOutHospTime, endOutHospTime, startFinishTime, endFinishTime, scoreStart, scoreEnd, scriptContent, valueType);
+
+ // 澶勭悊 targetvalue锛氭寜 & 鍒嗗壊鎴愬鏉¤褰�
+ List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>();
+ for (ServiceSubtaskDetailRatioExport export : serviceSubtaskDetailRatioExports) {
+ if (StringUtils.isNotEmpty(export.getTargetvalue()) && export.getTargetvalue().contains("&")) {
+ String[] values = export.getTargetvalue().split("&");
+ // 濡傛灉鏈夊鏉$洰鏍囧�硷紝鎷嗗垎鎴愬琛�
+ for (String value : values) {
+ //鍏堝幓 result 涓煡涓�涓嬶紝鏈夋病鏈夎繖涓� questiontext 鍜屽搴旂殑 targetvalue
+ ServiceSubtaskDetailRatioExport existingExport = result.stream().filter(e -> e.getQuestiontext().equals(export.getQuestiontext()) && value.trim().equals(e.getTargetvalue())).findFirst().orElse(null);
+ if (existingExport != null && existingExport.getRatio().equals("0") && existingExport.getCount().equals("0")) {
+ //濡傛灉瀛樺湪锛屽垯灏� result 閲岀殑杩欎釜闂鎵�瀵瑰簲鐨� Targetvalue=value 杩欐潯鏁版嵁鏇存柊鎴愬綋鍓嶈繖鏉℃暟鎹�
+ if (value.equals(export.getOptionresult())) {
+ existingExport.setRatio(export.getRatio());
+ existingExport.setScore(export.getScore());
+ existingExport.setCount(export.getCount());
+ existingExport.setOptionresult(export.getOptionresult());
+ }
+ } else if (existingExport != null && !existingExport.getRatio().equals("0")) {
+ continue;
+ } else {
+ ServiceSubtaskDetailRatioExport newExport = DtoConversionUtils.sourceToTarget(export, ServiceSubtaskDetailRatioExport.class);
+ newExport.setTargetvalue(value.trim()); // targetvalue 鏄剧ず鍗曚釜閫夐」
+ if (!value.equals(export.getOptionresult())) {
+ newExport.setOptionresult(null);
+ newExport.setCount("0");
+ newExport.setRatio("0");
+ }
+ result.add(newExport);
+ }
+ }
+ } else {
+ // targetvalue 涓嶅寘鍚� &锛岀洿鎺ユ坊鍔犲埌缁撴灉
+ result.add(export);
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * 鏍规嵁绉戝鎴栫梾鍖虹粺璁¢棶鍗烽�夐」(绉戝銆侀鐩煡璇㈢殑绉戝璇勫垎琛�)
+ */
+ @Override
+ public Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> statQuestionOptionByKsOrBq(QuestionCountKsOrBqVO vo) {
+
+ // 1. 鏌ユ槑缁�
+ List<QuestionCountKsOrBqDTO> sourceList = serviceSubtaskMapper.statQuestionOptionByKsOrBq(vo);
+ if (CollectionUtils.isEmpty(sourceList)) {
+ return Collections.emptyMap();
+ }
+
+ // 2. 鍒ゆ柇鎸夌瀹よ繕鏄寜鐥呭尯
+ boolean byDept = vo.getLeaveldeptcodes() != null;
+ boolean byDistrict = !byDept && vo.getLeavehospitaldistrictcodes() != null;
+ if (!byDept && !byDistrict) {
+ return Collections.emptyMap();
+ }
+
+ // 3. key = 绉戝/鐥呭尯 + 棰樼洰 + 閫夐」
+ Map<String, QuestionCountKsOrBqDTO> map = new LinkedHashMap<>();
+
+ for (QuestionCountKsOrBqDTO dto : sourceList) {
+
+ if (StringUtils.isEmpty(dto.getTargetvalue())) {
+ continue;
+ }
+
+ // 鍒嗙粍鍚嶏細绉戝 鎴� 鐥呭尯
+ String groupName = byDept ? dto.getDeptname() : dto.getLeavehospitaldistrictname();
+ if (StringUtils.isEmpty(groupName)) {
+ continue;
+ }
+
+ String asrtext = trimAll(dto.getAsrtext()); // 鐢ㄦ埛瀹為檯閫変腑鐨勯�夐」
+ String questionText = trimAll(dto.getQuestionText()); // 棰樼洰
+ if (StringUtils.isEmpty(questionText)) {
+ continue;
+ }
+
+ // 鎷嗗垎 targetvalue锛屾瘡涓�夐」閮借鏈変竴鏉¤褰�
+ for (String raw : dto.getTargetvalue().split("&")) {
+
+ String option = trimAll(raw);
+ if (option.isEmpty()) {
+ continue;
+ }
+
+ // key = 绉戝/鐥呭尯 + 棰樼洰 + 閫夐」
+ String key = buildKey(groupName, questionText, option);
+
+ QuestionCountKsOrBqDTO item = map.get(key);
+ if (item == null) {
+ item = DtoConversionUtils.sourceToTarget(dto, QuestionCountKsOrBqDTO.class);
+ item.setTargetvalue(option);
+ item.setAsrtext(option);
+ item.setQuestionText(dto.getQuestionText());
+ item.setAnswerCount("0");
+ item.setSingleScore("0");
+ map.put(key, item);
+ }
+
+ // 鍙湁褰撳墠閫夐」 == 鐢ㄦ埛瀹為檯閫変腑鐨勯�夐」锛屾墠绱姞
+ if (option.equals(asrtext)) {
+ int count = parseCount(item.getAnswerCount()) + 1;
+ item.setAnswerCount(String.valueOf(count));
+
+ BigDecimal totalScore = new BigDecimal(item.getSingleScore())
+ .add(new BigDecimal(dto.getSingleScore() == null ? "0" : dto.getSingleScore()));
+ item.setSingleScore(totalScore.toPlainString());
+ }
+ }
+ }
+
+ // 4. 璁$畻骞冲潎鍒�
+ for (QuestionCountKsOrBqDTO dto : map.values()) {
+ String answerCount = dto.getAnswerCount();
+ String singleScore = dto.getSingleScore();
+
+ BigDecimal avg;
+ if (StringUtils.isEmpty(answerCount)
+ || BigDecimal.ZERO.compareTo(new BigDecimal(answerCount.trim())) == 0) {
+ avg = BigDecimal.ZERO;
+ } else {
+ avg = new BigDecimal(singleScore == null ? "0" : singleScore)
+ .divide(new BigDecimal(answerCount.trim()), 2, RoundingMode.HALF_UP);
+ }
+ dto.setAvgScore(avg.toPlainString());
+ }
+
+ // 5. 杞垚 Map<String, Map<String, List<QuestionCountKsOrBqDTO>>>
+ // 绗竴灞� key锛氱瀹�/鐥呭尯
+ // 绗簩灞� key锛氶鐩�
+ // 绗簩灞� value锛氳棰樼洰涓嬬殑鎵�鏈夐�夐」鍒楄〃
+ Map<String, Map<String, List<QuestionCountKsOrBqDTO>>> result = new LinkedHashMap<>();
+
+ for (QuestionCountKsOrBqDTO dto : map.values()) {
+
+ // 鍒嗙粍鍚�
+ String groupName = byDept ? dto.getDeptname() : dto.getLeavehospitaldistrictname();
+ if (StringUtils.isEmpty(groupName)) {
+ continue;
+ }
+
+ // 棰樼洰鍚�
+ String questionText = dto.getQuestionText();
+ if (StringUtils.isEmpty(questionText)) {
+ continue;
+ }
+
+ // 绗竴灞傦細绉戝/鐥呭尯
+ Map<String, List<QuestionCountKsOrBqDTO>> questionMap =
+ result.computeIfAbsent(groupName, k -> new LinkedHashMap<>());
+
+ // 绗簩灞傦細棰樼洰
+ List<QuestionCountKsOrBqDTO> optionList =
+ questionMap.computeIfAbsent(questionText, k -> new ArrayList<>());
+
+ optionList.add(dto);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime, Date startFinishTime, Date endFinishTime, String scriptContent, Double scoreStart, Double scoreEnd, String valueType) {
+ //鍏堟竻鐞嗕竴涓嬮噸澶嶆暟鎹�
+ List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds();
+ if (!CollectionUtils.isEmpty(repeatIds)) {
+ serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds);
+ }
+
+ List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = serviceSubtaskMapper.statQuestionOptionBySubtaskIds(subtaskIds, startOutHospTime, endOutHospTime, startFinishTime, endFinishTime, scoreStart, scoreEnd, scriptContent, valueType);
+ // 澶勭悊 targetvalue锛氭寜 & 鍒嗗壊鎴愬鏉¤褰�
+ List<ServiceSubtaskDetailRatioExport> result = new ArrayList<>();
+ for (ServiceSubtaskDetailRatioExport export : serviceSubtaskDetailRatioExports) {
+ if (StringUtils.isNotEmpty(export.getTargetvalue()) && export.getTargetvalue().contains("&")) {
+ String[] values = export.getTargetvalue().split("&");
+ // 濡傛灉鏈夊鏉$洰鏍囧�硷紝鎷嗗垎鎴愬琛�
+ for (String value : values) {
+ //鍏堝幓 result 涓煡涓�涓嬶紝鏈夋病鏈夎繖涓� questiontext 鍜屽搴旂殑 targetvalue
+ ServiceSubtaskDetailRatioExport existingExport = result.stream().filter(e -> {
+ if (e == null || export == null) {
+ return false;
+ }
+ String q1 = e.getQuestiontext() != null ? e.getQuestiontext() : "";
+ String q2 = export.getQuestiontext() != null ? export.getQuestiontext() : "";
+ String t1 = value.trim();
+ String t2 = e.getTargetvalue() != null ? e.getTargetvalue() : "";
+ return q1.equals(q2) && t1.equals(t2);
+ }).findFirst().orElse(null);
+ if (existingExport != null && "0".equals(existingExport.getRatio()) && "0".equals(existingExport.getCount())) {
+ //濡傛灉瀛樺湪锛屽垯灏� result 閲岀殑杩欎釜闂鎵�瀵瑰簲鐨� Targetvalue=value 杩欐潯鏁版嵁鏇存柊鎴愬綋鍓嶈繖鏉℃暟鎹�
+ if (value.equals(export.getOptionresult())) {
+ existingExport.setRatio(export.getRatio());
+ existingExport.setScore(export.getScore());
+ existingExport.setCount(export.getCount());
+ existingExport.setOptionresult(export.getOptionresult());
+ }
+ } else if (existingExport != null && !"0".equals(existingExport.getRatio())) {
+ continue;
+ } else {
+ ServiceSubtaskDetailRatioExport newExport = DtoConversionUtils.sourceToTarget(export, ServiceSubtaskDetailRatioExport.class);
+ newExport.setTargetvalue(value.trim()); // targetvalue 鏄剧ず鍗曚釜閫夐」
+ if (!value.equals(export.getOptionresult())) {
+ newExport.setOptionresult(null);
+ newExport.setCount("0");
+ newExport.setRatio("0");
+ }
+ result.add(newExport);
+ }
+ }
+ } else {
+ // targetvalue 涓嶅寘鍚� &锛岀洿鎺ユ坊鍔犲埌缁撴灉
+ result.add(export);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * 鏍囧噯鍖栭棶鍗风瓟妗堟枃鏈細鍘绘帀 A/B/C/D 鍗曞瓧姣嶅墠缂�鍜屽悗缁┖鏍�
+ * 渚嬪 "A 鏄�" -> "鏄�"锛�"B 鍚�" -> "鍚�"
+ */
+ private String normalizeOptionAnswer(String answer) {
+ if (StringUtils.isBlank(answer)) {
+ return "";
+ }
+ String trimmed = answer.trim();
+ if (trimmed.length() >= 3 && trimmed.charAt(1) == ' ') {
+ char firstChar = trimmed.charAt(0);
+ if (firstChar >= 'A' && firstChar <= 'Z') {
+ return trimmed.substring(2).trim();
+ }
+ }
+ return trimmed;
+ }
private Boolean saveServiceSubtaskDetail(ServiceSubtask serviceSubtask) {
Boolean result = true;
@@ -4656,4 +5619,957 @@
}
}
+ public String scanGenerateSubtask(ServiceTask serviceTaskVo) {
+ String content = "";
+ String ip = localIP;
+ ServiceTask serviceTask = new ServiceTask();
+ serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceTaskVo.getTaskid());
+ if (ObjectUtils.isNotEmpty(serviceTask)) {
+ try {
+ ServiceTaskdept serviceTaskdept = new ServiceTaskdept();
+ if (ObjectUtils.isNotEmpty(serviceTaskVo.getDeptcode())) {
+ serviceTaskdept.setDeptType("1");
+ serviceTaskdept.setDeptCode(serviceTaskVo.getDeptcode());
+ }
+ if (ObjectUtils.isNotEmpty(serviceTaskVo.getLeavehospitaldistrictcode())) {
+ serviceTaskdept.setDeptType("2");
+ serviceTaskdept.setDeptCode(serviceTaskVo.getLeavehospitaldistrictcode());
+ }
+ serviceTaskdept.setServiceType(serviceTask.getServiceType());
+ serviceTaskdept.setOrgid(serviceTask.getOrgid());
+ serviceTaskdept.setTaskId(serviceTaskVo.getTaskid());
+ List<ServiceTaskdept> serviceTaskdepts = serviceTaskdeptService.selectServiceTaskdeptList(serviceTaskdept);
+
+ if (!CollectionUtils.isEmpty(serviceTaskdepts)) {
+ PatArchive patArchive = new PatArchive();
+ patArchive.setId(999999999L);
+ patArchive.setName("铏氭嫙鎮h��");
+ //灏佽serviceSubtask
+ ServiceSubtask serviceSubtask = boxedServiceSubtask(serviceTask, serviceTaskdepts.get(0), patArchive);
+ int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
+ //鏍规嵁鐢熸垚澶栭摼
+ if (ObjectUtils.isNotEmpty(serviceSubtask.getTaskid()) && ObjectUtils.isNotEmpty(serviceSubtask.getPatid()) && ObjectUtils.isNotEmpty(serviceSubtask.getId())) {
+ RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
+ String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
+ String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
+ String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
+ ServiceOutPath serviceOutPath = new ServiceOutPath();
+ serviceOutPath.setParam1(taskId);
+ serviceOutPath.setParam2(patid);
+ serviceOutPath.setParam3(serviceTask.getTaskName());
+ serviceOutPath.setParam6(subId);
+ serviceOutPath.setCreateTime(new Date());
+ serviceOutPath.setOrgid(serviceTask.getOrgid());
+ iServiceOutPathService.insertServiceOutPath(serviceOutPath);
+ String format = String.format("%03X", 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;
+ content = url;
+ serviceOutPath.setUrl(url);
+ iServiceOutPathService.updateServiceOutPath(serviceOutPath);
+
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("銆愭壂鐮佺敓鎴愪换鍔°�戝鐞嗗紓甯革細{}", e.getMessage());
+ }
+ }
+ return content;
+ }
+
+ /**
+ * 婊℃剰搴﹁秼鍔挎煡璇�
+ *
+ * @param mydTrendReqVO
+ * @return
+ */
+ @Override
+ public List<MydTrendReqDTO> mydTrend(MydTrendReqVO mydTrendReqVO) {
+ List<MydTrendReqDTO> list = serviceSubtaskMapper.mydTrend(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType());
+ if (mydTrendReqVO.getType().equals("week")) list = getWeekDate(mydTrendReqVO, list);
+ if (mydTrendReqVO.getType().equals("year")) list = getYearDate(mydTrendReqVO, list);
+ if (mydTrendReqVO.getType().equals("month")) list = getMonthDate(mydTrendReqVO, list);
+ if (mydTrendReqVO.getType().equals("day")) list = getDayDate(mydTrendReqVO, list);
+ return list;
+ }
+
+ @Override
+ public List<MydTrendReqDTO> sltdMydTotalByDimension(MydTrendReqVO mydTrendReqVO) {
+ List<MydTrendReqDTO> list = null;
+ if (mydTrendReqVO.getDimensionType().equals("1"))
+ list = serviceSubtaskMapper.sltdMydTotalByDimension(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType());
+ else if (mydTrendReqVO.getDimensionType().equals("2"))
+ list = serviceSubtaskMapper.sltdMydTotalByYQ(mydTrendReqVO.getStartFinishTime(), mydTrendReqVO.getEndFinishTime(), mydTrendReqVO.getType());
+
+ return list;
+ }
+
+
+ public ServiceSubtask boxedServiceSubtask(ServiceTask serviceTask, ServiceTaskdept serviceTaskdept, PatArchive patArchive) {
+ ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class);
+ serviceSubtask.setTaskid(serviceTask.getTaskid());
+ if (StringUtils.isNotEmpty(serviceTask.getLibtemplateid()))
+ serviceSubtask.setLibtemplateid(Long.valueOf(serviceTask.getLibtemplateid()));
+// serviceSubtask.setNurseId(patMedInhosp1.getNurseId());
+// serviceSubtask.setNurseName(patMedInhosp1.getNurseName());
+// serviceSubtask.setDrcode(patMedInhosp1.getDrcode());
+// serviceSubtask.setDrname(patMedInhosp1.getDrname());
+ if (StringUtils.isNotEmpty(serviceTaskdept.getDeptType()) && serviceTaskdept.getDeptType().equals("1")) {
+ serviceSubtask.setDeptcode(serviceTaskdept.getDeptCode());
+ serviceSubtask.setDeptname(serviceTaskdept.getDeptName());
+ } else {
+ serviceSubtask.setLeavehospitaldistrictcode(serviceTaskdept.getDeptCode());
+ serviceSubtask.setLeavehospitaldistrictname(serviceTaskdept.getDeptName());
+ }
+ serviceSubtask.setTemplateid(serviceTask.getTemplateid());
+ serviceSubtask.setTemplatename(serviceTask.getTemplatename());
+ serviceSubtask.setPatid(patArchive.getId());
+ serviceSubtask.setSendname(patArchive.getName());
+ serviceSubtask.setSfzh(patArchive.getIdcardno());
+ serviceSubtask.setPhone(patArchive.getTelcode());
+ if (StringUtils.isBlank(patArchive.getTelcode())) serviceSubtask.setPhone(patArchive.getRelativetelcode());
+ serviceSubtask.setSex(patArchive.getSex());
+ serviceSubtask.setAge(patArchive.getAge());
+ serviceSubtask.setSendstate(3L);
+// serviceSubtask.setManagementDoctor(patMedInhosp1.getManagementDoctor());
+// serviceSubtask.setManagementDoctorCode(patMedInhosp1.getManagementDoctorCode());
+ serviceSubtask.setServiceType(serviceTask.getServiceType());
+ serviceSubtask.setPreachform(serviceTask.getPreachform());
+ serviceSubtask.setHospType("8");
+ serviceSubtask.setCreateTime(new Date());
+ serviceSubtask.setUpdateTime(new Date());
+// serviceSubtask.setCreateBy(patMedInhosp1.getNurseName());
+// serviceSubtask.setLeavehospitaldistrictcode(patMedInhosp1.getLeavehospitaldistrictcode());
+// serviceSubtask.setLeavehospitaldistrictname(patMedInhosp1.getLeavehospitaldistrictname());
+ serviceSubtask.setUpdateBy(serviceTask.getUpdateBy());
+ serviceSubtask.setUpdateTime(new Date());
+ serviceTask.setSendDay(1L);
+ Date newDate = new Date();
+ serviceSubtask.setLongSendTime(newDate);
+ serviceSubtask.setVisitTime(newDate);
+ return serviceSubtask;
+ }
+
+ /**
+ * Ai 鍖归厤閫夐」
+ *
+ * @param questionText
+ * @param voiceText
+ * @param options
+ * @return
+ */
+ @Override
+ public Integer matchOptionIndex(String url, String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid) {
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("userQuestion", questionText);
+ jsonObject.put("userAnswer", voiceText);
+ jsonObject.put("options", options);
+ jsonObject.put("uuid", uuid);
+ String jsonString = jsonObject.toJSONString();
+ String result = null;
+
+// String url = "http://localhost:8099/matchOptionIndex";
+ if (StringUtils.isNotEmpty(url)) {
+ try {
+ Map<String, String> headers = new HashMap<>();
+ headers.put("Content-Type", "application/json");
+
+ result = HttpUtils.sendPostByHeader(url, jsonString, headers);
+ } catch (Exception e) {
+ log.error("AI璇嗗埆澶辫触", e);
+ }
+ }
+ if (StringUtils.isNotEmpty(result) && result.matches("^-?\\d+$")) {
+ return Integer.parseInt(result);
+ } else {
+ return -1;
+ }
+ }
+
+
+ public PhoneCallBackSHVO getFirstQues(PhoneCallReqYQVO phoneCallReqYQVO) {
+ //鐢ㄤ簬杩斿洖
+ PhoneCallBackSHVO phoneCallBackSHVO = new PhoneCallBackSHVO();
+
+ //鏍规嵁鎵嬫満鍙疯幏鍙栫敤鎴风殑鐨勫瓙浠诲姟淇℃伅
+ ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
+ serviceSubtaskVO.setPhone(phoneCallReqYQVO.getPhone());
+ serviceSubtaskVO.setType("1");
+ serviceSubtaskVO.setSendstate(2L);
+ List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
+ if (CollectionUtils.isNotEmpty(serviceSubtasks)) {
+ ServiceSubtask serviceSubtask = serviceSubtasks.get(0);
+ IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
+
+ //閫氳繃浠诲姟妯℃澘涓殑"绗竴娆¢棶棰樼紪鍙�"鑾峰彇绗竴涓棶棰�;
+ IvrTaskTemplateScript ivrTaskTemplateScript = null;
+ IvrTaskTemplateScript ivrTaskTemplateScript1 = new IvrTaskTemplateScript();
+ ivrTaskTemplateScript1.setTemplateID(ivrTaskTemplate.getId());
+ List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript1);
+
+ for (IvrTaskTemplateScript ivrTaskTemplateScript2 : ivrTaskTemplateScripts) {
+ if (ivrTaskTemplate.getFirstQuestionNum() == Long.valueOf(ivrTaskTemplateScript2.getSort())) {
+ ivrTaskTemplateScript = ivrTaskTemplateScript2;
+ break;
+ }
+ }
+ //鑾峰彇寮�鍦虹櫧
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+
+ phoneCallBackSHVO.setSubId(serviceSubtask.getId());
+ phoneCallBackSHVO.setScriptId(ivrTaskTemplateScript.getId());
+ phoneCallBackSHVO.setSort(ivrTaskTemplateScript.getSort());
+ phoneCallBackSHVO.setTaskTemplateid(ivrTaskTemplateScript.getTemplateID());
+ phoneCallBackSHVO.setScriptContent(serviceTask.getKcb() + "," + ivrTaskTemplateScript.getScriptContent());
+ }
+ return phoneCallBackSHVO;
+ }
+
+
+ /**
+ * 涓夋眹ASR缁撴灉澶勭悊
+ *
+ * @param phoneCallResultYQVO
+ * @return
+ */
+ public PhoneCallBackSHVO processResust(PhoneCallResultYQVO phoneCallResultYQVO) {
+ PhoneCallBackSHVO phoneCallBackSHVO = new PhoneCallBackSHVO();
+ //閫氳繃scriptid锛岃幏鍙栨墍鏈夌殑缁撴灉
+ String url = configService.selectConfigByKey("sys.voice.match.ai.url", phoneCallResultYQVO.getOrgid());
+ ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(phoneCallResultYQVO.getSubId());
+ IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
+ IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = iIvrTaskTemplateScriptService.getTaskTempScriptInfoByid(Long.valueOf(phoneCallResultYQVO.getScriptId()));
+ Integer i = matchOptionIndex(url, phoneCallResultYQVO.getScriptContent(), phoneCallResultYQVO.getAsrResult(), ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList(), phoneCallResultYQVO.getUuid());
+ if (i >= 0) {
+ String optiondesc = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(i).getOptiondesc();
+ //灏嗘偅鑰呯殑鍥炵瓟鍐欒繘service_subtask_detail涓�
+ ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ ivrTaskTemplateScriptVO.setQuestionResult(optiondesc);
+
+ PhoneCallReqYQVO phoneCallReqYQVO = new PhoneCallReqYQVO();
+ phoneCallReqYQVO.setTaskid("" + serviceSubtask.getId());
+ phoneCallReqYQVO.setPhone(phoneCallResultYQVO.getPhone());
+ phoneCallReqYQVO.setAsrtext(phoneCallResultYQVO.getAsrResult());
+ ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
+ //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
+ if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
+ String questionvoice = serviceSubtaskDetail.getQuestionvoice();
+ String[] split = questionvoice.split("\\\\");
+ if (split.length > 0) {
+ String lastPart = split[split.length - 1];
+ serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+ }
+ }
+ serviceSubtaskDetailList.add(serviceSubtaskDetail);
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+ serviceSubTaskDetailReq.setGuid(phoneCallResultYQVO.getGuid());
+ serviceSubTaskDetailReq.setOrgid(phoneCallResultYQVO.getOrgid());
+ saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+
+ IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
+ ivrTaskTemplateScript.setTemplateID(ivrTaskTemplateScriptVO.getTemplateID());
+ List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
+
+ //鑾峰彇涓嬩竴棰�
+ for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
+ if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ phoneCallBackSHVO.setScriptContent(serviceTask.getJsy());
+ phoneCallBackSHVO.setTaskTemplateid(script.getTemplateID());
+ phoneCallBackSHVO.setSort(script.getSort());
+ phoneCallBackSHVO.setScriptId(script.getId());
+ phoneCallBackSHVO.setSubId(serviceSubtask.getId());
+ phoneCallBackSHVO.setStatus("0");
+ } else if (script.getSort() == ivrTaskTemplateScriptVO.getNextScriptno().intValue()) {
+ phoneCallBackSHVO.setScriptContent(script.getScriptContent());
+ phoneCallBackSHVO.setTaskTemplateid(script.getTemplateID());
+ phoneCallBackSHVO.setSort(script.getSort());
+ phoneCallBackSHVO.setScriptId(script.getId());
+ phoneCallBackSHVO.setSubId(serviceSubtask.getId());
+ break;
+ }
+ }
+ //鎶婄紦瀛樻竻闄�
+ redisCache.deleteObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId());
+ } else {
+ //鍐嶅皢閲嶅璇㈤棶
+ //璁板綍涓�涓嬭繖涓棶棰樿闂鐨勬鏁�
+ Object cacheObject = redisCache.getCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId());
+ if (cacheObject == null || (Integer) cacheObject < ivrTaskTemplate.getMateNum()) {
+
+
+ // 鑾峰彇閫夐」闆嗗悎涓殑 optiondesc 鐢ㄤ簬寮曞鎮h��
+ List<IvrTaskTemplateTargetoption> optionList = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
+ String optionDescStr = "";
+ if (optionList != null && !optionList.isEmpty()) {
+ optionDescStr = optionList.stream().map(IvrTaskTemplateTargetoption::getTargetvalue).filter(StringUtils::isNotEmpty).collect(Collectors.joining("鎴�"));
+ }
+
+ String scriptContent = "璇烽棶" + phoneCallResultYQVO.getScriptContent();
+ if (StringUtils.isNotEmpty(optionDescStr)) {
+ scriptContent += "锛屼綘鍙互鍥炵瓟锛�" + optionDescStr;
+ }
+ phoneCallBackSHVO.setScriptContent(scriptContent);
+ phoneCallBackSHVO.setTaskTemplateid(phoneCallResultYQVO.getTaskTemplateid());
+ phoneCallBackSHVO.setSort(phoneCallResultYQVO.getSort());
+ phoneCallBackSHVO.setScriptId(phoneCallResultYQVO.getScriptId());
+ phoneCallBackSHVO.setSubId(phoneCallResultYQVO.getSubId());
+ if (cacheObject == null)
+ redisCache.setCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId(), 1, 120, TimeUnit.MINUTES);
+ else
+ redisCache.setCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId(), (Integer) cacheObject + 1, 120, TimeUnit.MINUTES);
+ } else if ((Integer) cacheObject >= ivrTaskTemplate.getMateNum()) {
+ //濡傛灉宸茬粡闂簡瑙勫畾娆℃暟锛屽氨涓嶉棶浜嗭紝缁х画闂笅涓�棰橈紙杩欎釜瑕佸晢閲忎竴涓嬶紝鏄户缁棶涓嬩竴棰橈紝杩樻槸鍋滀簡锛屾槸涓嶆槸瑕佸仛涓紑鍏筹級
+ IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
+ ivrTaskTemplateScript.setTemplateID(ivrTaskTemplateScriptVO.getTemplateID());
+ List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
+ //鑾峰彇涓嬩竴棰�
+ for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
+ if (script.getSort() == ivrTaskTemplateScriptVO.getNextScriptno().intValue()) {
+ phoneCallBackSHVO.setScriptContent(script.getScriptContent());
+ phoneCallBackSHVO.setTaskTemplateid(script.getTemplateID());
+ phoneCallBackSHVO.setSort(script.getSort());
+ phoneCallBackSHVO.setScriptId(script.getId());
+ phoneCallBackSHVO.setSubId(serviceSubtask.getId());
+ break;
+ }
+ }
+ //鎶婄紦瀛樻竻闄�
+ redisCache.deleteObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId());
+ }
+ }
+ return phoneCallBackSHVO;
+ }
+
+
+ public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate, List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid) {
+ PhoneCallBackYQVO back = null;
+ List<IvrTaskTemplateTargetoption> options = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
+ String voiceText = phoneCallReqYQVO.getAsrtext();
+ String questionText = StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrtext()) ? ivrTaskTemplateScriptVO.getIvrtext() : ivrTaskTemplateScriptVO.getScriptContent();
+ Integer matched = -1;
+ matched = matchOptionIndex(url, questionText, voiceText, options, uuid);
+ //璇存槑鍖归厤姝g‘浜�
+ if (matched != null && matched >= 0) {
+ IvrTaskTemplateTargetoption chosenOption = options.get(matched);
+ //杩欓噷搴旇鍏堝垽鏂被鍨嬶紝鍘诲啀淇敼锛岃缃甀sUserOperation鏄崟閫夐鐨勬敼娉�
+ log.info("鍖归厤姝g‘浜嗗悧--------------");
+ chosenOption.setIsUserOperation(1);
+ serviceTaskScriptTargetoptionMapper.updateIvrTaskTemplateTargetoption(chosenOption);
+
+ //灏嗘偅鑰呯殑鍥炵鍐欒繘service_subtask_detail涓�
+ ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ ivrTaskTemplateScriptVO.setQuestionResult(chosenOption.getOptiondesc());
+ ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
+ //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
+ if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
+ String questionvoice = serviceSubtaskDetail.getQuestionvoice();
+ String[] split = questionvoice.split("\\\\");
+ if (split.length > 0) {
+ String lastPart = split[split.length - 1];
+ serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+ }
+ }
+ serviceSubtaskDetailList.add(serviceSubtaskDetail);
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+ serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
+ serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
+ saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+
+ //鍒ゆ柇涓�涓嬪綋鍓嶇殑闂鏄笉鏄弧鎰忓害闂锛屽苟涓攄utyDeptCode鏄惁鏈夊�硷紝骞朵笖閫夐」鏄笉鏄紓甯搁�夐」锛屽鏋滃叏绗﹀悎锛屽垯寰�婊℃剰搴﹂棶棰樺紓甯歌〃鏂板
+ if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getDutyDeptCode()) && 1 == chosenOption.getIsabnormal()) {
+ ServiceSubtaskDetailTrace subtaskDetailTrace = new ServiceSubtaskDetailTrace();
+ //鐢╰askid銆乻ubid鍜宻criptid鍘昏幏鍙杁etailid
+ ServiceSubtaskDetail ssd = new ServiceSubtaskDetail();
+ ssd.setSubId(serviceSubtask.getId());
+ ssd.setTaskid(serviceSubtask.getTaskid());
+ ssd.setScriptid(StringUtils.isNotEmpty(scriptId) ? Long.valueOf(scriptId) : null);
+ List<ServiceSubtaskDetail> serviceSubtaskDetails = serviceSubtaskDetailMapper.selectServiceSubtaskDetailList(ssd);
+ subtaskDetailTrace.setDetailId(CollectionUtils.isNotEmpty(serviceSubtaskDetails) ? serviceSubtaskDetails.get(0).getId() : null);
+
+ subtaskDetailTrace.setSubId(serviceSubtask.getId());
+ subtaskDetailTrace.setTaskid(serviceSubtask.getTaskid());
+ subtaskDetailTrace.setTemplateid(ivrTaskTemplateScriptVO.getId());
+ subtaskDetailTrace.setTemplatequestionnum(ivrTaskTemplateScriptVO.getScriptno());
+ subtaskDetailTrace.setSwitchid(chosenOption.getId());
+ subtaskDetailTrace.setQuestiontext(ivrTaskTemplateScriptVO.getScriptContent());
+ subtaskDetailTrace.setQuestionvoice(null);
+ subtaskDetailTrace.setCategoryname(ivrTaskTemplateScriptVO.getScriptAssortname());
+ subtaskDetailTrace.setCategoryid(ivrTaskTemplateScriptVO.getScriptAssortid());
+ //鑾峰彇鎵�鏈夐�夐」
+ String optionDescStr = Optional.ofNullable(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList()).filter(list -> !list.isEmpty()).map(list -> list.stream().map(IvrTaskTemplateTargetoption::getOptiondesc).filter(Objects::nonNull).collect(Collectors.joining("&"))).orElse("");
+ subtaskDetailTrace.setTargetid(chosenOption.getId());
+ subtaskDetailTrace.setTargetvalue(optionDescStr);
+ subtaskDetailTrace.setMatchedtext(chosenOption.getOptiondesc());
+ subtaskDetailTrace.setValueType(serviceSubtaskDetails.get(0).getValueType());
+ subtaskDetailTrace.setTemplateType(1);
+
+ SvyLibScriptCategory svyLibScriptCategory = svyLibScriptCategoryMapper.selectSvyLibScriptCategoryById(ivrTaskTemplateScriptVO.getScriptAssortid());
+ subtaskDetailTrace.setType(svyLibScriptCategory.getType());
+ subtaskDetailTrace.setScriptid(ivrTaskTemplateScriptVO.getId());
+ subtaskDetailTrace.setAsrtext(phoneCallReqYQVO.getAsrtext());
+ subtaskDetailTrace.setRecordpath(phoneCallReqYQVO.getRecordpath());
+ subtaskDetailTrace.setPatid(serviceSubtask.getPatid());
+ JSONObject patdescJson = new JSONObject();
+ patdescJson.put("sendname", serviceSubtask.getSendname());
+ patdescJson.put("phone", serviceSubtask.getPhone());
+ patdescJson.put("age", serviceSubtask.getAge());
+ patdescJson.put("sex", serviceSubtask.getSex() != null ? serviceSubtask.getSex() == 1 ? "鐢�" : "濂�" : null);
+ subtaskDetailTrace.setPatdesc(patdescJson.toJSONString());
+ subtaskDetailTrace.setTodeptcode(ivrTaskTemplateScriptVO.getDutyDeptCode());
+ subtaskDetailTrace.setTodeptname(ivrTaskTemplateScriptVO.getDutyDeptName());
+ subtaskDetailTrace.setOrgid(serviceSubtask.getOrgid());
+ subtaskDetailTrace.setHandleFlag("0");
+ subtaskDetailTrace.setGuid(phoneCallReqYQVO.getGuid());
+ subtaskDetailTrace.setCreateTime(new Date());
+ subtaskDetailTrace.setUpdateTime(new Date());
+ subtaskDetailTrace.setOrgid(phoneCallReqYQVO.getOrgid());
+ traceService.insertServiceSubtaskDetailTtrace(subtaskDetailTrace);
+ }
+
+ //鍒ゆ柇涓�涓嬶紝杩欎釜閫夐」缁撴灉鏄笉鏄繕鏈夌户缁棶涓嬪幓鐨勫繀瑕侊紝渚嬪閫夐」缁撴灉鏄埆浜轰笉鎯崇户缁洖绛旈棶棰橈紝灏辫缁撴潫鎺�
+ if (chosenOption.getIsEnd() == 1) {
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
+ //璁板綍鐘舵��
+ setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+ return phoneCallBackYQVO;
+ }
+
+ flag = 1;
+ //灏嗗綋鍓嶅墠鐨勬挱鎶ョ姸鎬佸垹闄わ紝缁欎笅涓�棰樿浣�
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+// //鑾峰彇涓嬩竴棰�
+ log.error("鑾峰彇涓嬩竴棰樼殑淇℃伅锛歿}", ivrTaskTemplateScriptVO);
+ if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
+ Long nextQuestion = null;
+ if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1")) {
+ nextQuestion = chosenOption.getNextQuestion();
+ //鏇存柊鍒嗘暟
+ double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ score = BigDecimal.valueOf(score).add(new BigDecimal(chosenOption.getScore())).doubleValue();
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score);
+ } else {
+ nextQuestion = ivrTaskTemplateScriptVO.getNextScriptno();
+ //鏇存柊鍒嗘暟
+ Object obj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ Double score = (obj == null ? new Double(0.00) : new Double(((Double) obj).doubleValue()));
+ score = BigDecimal.valueOf(score).add(new BigDecimal(String.valueOf(chosenOption.getScore()))).doubleValue();
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score, 120, TimeUnit.MINUTES);
+ }
+ if (nextQuestion == null || nextQuestion == 0L) {
+ //濡傛灉涓嬩竴棰樹负绌猴紝鎴栬�呬负0锛屽垯鎸傛満
+ ServiceSubtask ss = new ServiceSubtask();
+ ss.setId(serviceSubtask.getId());
+ ss.setSendstate(6L);
+ ss.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+ serviceSubtaskMapper.updateServiceSubtask(ss);
+ //璁板綍鐘舵��
+ setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "noVoice");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask.getJsy());
+ //灏嗙粨鏋滃啓杩沝etail琛�
+ ServiceSubTaskDetailReq ssdReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList2 = new ArrayList<>();
+ serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList2);
+ ssdReq.setGuid(phoneCallReqYQVO.getGuid());
+ ssdReq.setOrgid(phoneCallReqYQVO.getOrgid());
+ saveQuestionAnswerPhone(ssdReq);
+ return phoneCallBackYQVO;
+ }
+
+ for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
+ if (script.getSort() == nextQuestion.intValue()) {
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ String scriptContent = StringUtils.isNotEmpty(script.getIvrtext()) ? script.getIvrtext() : script.getScriptContent();
+ log.error("涓嬩竴棰橀棶棰橈細{}", scriptContent);
+ log.error("涓嬩竴棰樼殑瀛愪换鍔℃槸锛歿}", serviceSubtask);
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + getObject(serviceSubtask, scriptContent));
+ //灏嗚鎮h�呯殑Redis涓殑棰樼洰ID锛岃繘琛屼慨鏀�
+ redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
+ //鍒犻櫎鏃犲搷搴�
+ redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+ }
+ }
+ } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
+ ServiceTask serviceTask1 = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ phoneCallBackYQVO.setType("text");
+ phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
+ //鏇存柊涓�涓嬪垎鏁�
+ double score = 0.0;
+ Object scoreObj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ if (ObjectUtils.isNotEmpty(scoreObj)) score = (double) scoreObj;
+ serviceSubtask.setScore(String.valueOf(score));
+ serviceSubtask.setFinishtime(new Date());
+ serviceSubtask.setSendstate(6L);
+ serviceSubtask.setRemark("鐢佃瘽鎷ㄦ墦宸插畬鎴�");
+ serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
+ //璁板綍鐘舵��
+ setFailPreachForm(serviceSubtask, "3", "鐢佃瘽鎷ㄦ墦宸插畬鎴�", "9");
+ //璁剧疆缁撴潫璇�
+ phoneCallBackYQVO.setValue(phoneCallBackYQVO.getCommonValue() + serviceTask1.getJsy());
+ Long id = serviceSubtask.getId();
+ Map<String, String> map = delRedisValue(null, id.toString());
+ log.error("map鐨勫�间负锛歿}", map);
+ if (ObjectUtils.isNotEmpty(map)) redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
+ redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
+ redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
+ redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
+ //鍦╮edis涓繚瀛樹竴涓嬬粨鏉熻锛屽湪璋冪敤鎸傜數璇濈殑鏂规硶鏃跺垹闄�
+ ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
+ redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", serviceTask.getJsy(), 120, TimeUnit.MINUTES);
+// return phoneCallBackYQVO;
+
+ }
+ } else {
+ log.info("娌℃湁鍖归厤涓�----------------------------");
+ //flag=0,璇存槑娌� 鍖归厤涓婏紝涔熻鎶婃偅鑰呰鐨勮瘽璁板綍涓嬫潵
+ if (matched == ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().size() - 1 && flag == 0) {
+ ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
+ List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
+ ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
+ //淇敼涓�涓嬭闊宠矾寰勶紙鏀规垚鍓嶇鍙互璁块棶鐨勶紝瀛樺埌鏁版嵁搴撲腑锛�
+ if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
+ String questionvoice = serviceSubtaskDetail.getQuestionvoice();
+ String[] split = questionvoice.split("\\\\");
+ if (split.length > 0) {
+ String lastPart = split[split.length - 1];
+ serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
+ }
+ }
+ serviceSubtaskDetailList.add(serviceSubtaskDetail);
+ //濡傛灉娌℃湁 鍖归厤涓婏紝杩欎釜蹇呴』涓簄ull
+ serviceSubtaskDetailList.get(0).setMatchedtext("");
+ serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
+ serviceSubTaskDetailReq.setGuid(phoneCallReqYQVO.getGuid());
+ serviceSubTaskDetailReq.setOrgid(phoneCallReqYQVO.getOrgid());
+ saveQuestionAnswerPhone(serviceSubTaskDetailReq);
+ }
+ }
+ return back;
+ }
+
+
+ /**
+ * 闂缁撴灉鍗犳瘮
+ *
+ * @param sltdMydTotalVO
+ * @param serviceSubtaskRes
+ * @return
+ */
+ public List<ServiceSubtaskDetailRatioExport> getDetailRatio(SltdMydTotalVO sltdMydTotalVO, List<ServiceSubtaskRes> serviceSubtaskRes) {
+ List<ServiceSubtaskDetailRatioExport> serviceSubtaskDetailRatioExports = null;
+ if (CollectionUtils.isNotEmpty(sltdMydTotalVO.getServiceTypeList()) && sltdMydTotalVO.getServiceTypeList().contains("2") && (sltdMydTotalVO.getServiceTypeList().contains("6") || sltdMydTotalVO.getServiceTypeList().contains("14"))) {
+ //serviceType锛屽嵆鏈夐殢璁垮張鏈夋弧鎰忓害锛屾殏鏃舵病娉曠粺璁�
+ return serviceSubtaskDetailRatioExports;
+ } else if (CollectionUtils.isNotEmpty(sltdMydTotalVO.getServiceTypeList()) && sltdMydTotalVO.getServiceTypeList().contains("2")) {
+ //鑾峰彇serviceSubtaskList涓殑鎵�鏈塼askid
+ List<Long> taskIds = serviceSubtaskRes.stream().map(ServiceSubtaskRes::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList());
+ serviceSubtaskDetailRatioExports = statQuestionOption(taskIds, sltdMydTotalVO.getStartFinishTime(), sltdMydTotalVO.getEndFinishTime(), sltdMydTotalVO.getStartOutHospTime(), sltdMydTotalVO.getEndOutHospTime(), sltdMydTotalVO.getQuestionContent(), sltdMydTotalVO.getStartScore(), sltdMydTotalVO.getEndScore(), sltdMydTotalVO.getValueType());
+ } else if (CollectionUtils.isNotEmpty(sltdMydTotalVO.getServiceTypeList()) && sltdMydTotalVO.getServiceTypeList().contains("6") || sltdMydTotalVO.getServiceTypeList().contains("14")) {
+ //婊℃剰搴︾粺璁� 锛堥�氳繃 subtask 鐨� id 鍘荤粺璁★級
+ List<Long> subtaskIds = serviceSubtaskRes.stream().map(ServiceSubtaskRes::getId).collect(Collectors.toList());
+ serviceSubtaskDetailRatioExports = statQuestionOptionBySubtaskIds(subtaskIds, sltdMydTotalVO.getStartOutHospTime(), sltdMydTotalVO.getEndOutHospTime(), sltdMydTotalVO.getStartFinishTime(), sltdMydTotalVO.getEndFinishTime(), sltdMydTotalVO.getQuestionContent(), sltdMydTotalVO.getStartScore(), sltdMydTotalVO.getEndScore(), sltdMydTotalVO.getValueType());
+ }
+ return serviceSubtaskDetailRatioExports;
+ }
+
+ //鑾峰彇浠诲姟缁勪俊鎭�
+ private void findServiceTaskScheduleVO(ServiceTaskVO serviceTaskVO) {
+ if (StringUtils.isNotEmpty(serviceTaskVO.getAppltype()) && serviceTaskVO.getAppltype().equals("5")) {
+ //浠诲姟缁勪俊鎭�
+ ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTaskVO.getTaskid());
+ if (ObjectUtils.isNotEmpty(schedule)) {
+ ServiceTaskScheduleVO serviceTaskScheduleVO = DtoConversionUtils.sourceToTarget(schedule, ServiceTaskScheduleVO.class);
+ List<ServiceTaskScheduleDetail> scheduleDetailList = serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
+ serviceTaskScheduleVO.setDetailList(scheduleDetailList);
+ serviceTaskVO.setServiceTaskScheduleVO(serviceTaskScheduleVO);
+ }
+ }
+ }
+
+ @Test
+ public void TestMatch() {
+ String questionText = "鎮ㄥソ,璇烽棶鎮ㄦ槸鎮h�呮湰浜鸿繕鏄灞烇紵\n";
+ String voiceText = "鎴戣嚜宸�";
+ String matchedText = "";
+ List<IvrTaskTemplateTargetoption> options = new ArrayList<>();
+ IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption1 = new IvrTaskTemplateTargetoption();
+ ivrTaskTemplateTargetoption1.setTargetvalue("鏈汉");
+ options.add(ivrTaskTemplateTargetoption1);
+ IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption2 = new IvrTaskTemplateTargetoption();
+ ivrTaskTemplateTargetoption2.setTargetvalue("瀹跺睘");
+ options.add(ivrTaskTemplateTargetoption2);
+ IvrTaskTemplateTargetoption ivrTaskTemplateTargetoption3 = new IvrTaskTemplateTargetoption();
+ ivrTaskTemplateTargetoption3.setTargetvalue("鍏朵粬");
+ options.add(ivrTaskTemplateTargetoption3);
+ //1-AI璇嗗埆
+ String url = configService.selectConfigByKey("sys.voice.match.ai.url");
+ Integer matched = matchOptionIndex(url, questionText, voiceText, options, "1");
+ if (ObjectUtils.isNotEmpty(matched)) {
+ if (matched >= 0) {
+ matchedText = options.get(matched).getTargetvalue();
+ }
+ }
+ log.info("ai鍖归厤鎴愬姛锛屽尮閰嶇粨鏋滄槸:" + matchedText);
+ }
+
+ private static String trimAll(String s) {
+ if (s == null) {
+ return "";
+ }
+ int start = 0;
+ int end = s.length();
+ while (start < end && isBlankChar(s.charAt(start))) {
+ start++;
+ }
+ while (end > start && isBlankChar(s.charAt(end - 1))) {
+ end--;
+ }
+ return s.substring(start, end);
+ }
+
+ private static Boolean isBlankChar(char c) {
+ return c == '\u3000' // 鍏ㄨ绌烘牸
+ || c == ' ' // 鍗婅绌烘牸
+ || c == '\t' || c == '\n' || c == '\r' || c == '\f' || Character.isWhitespace(c);
+ }
+
+
+ private String buildKey(String groupName, String questionText, String option) {
+ return groupName + "\u0001" + questionText + "\u0001" + option;
+ }
+
+ private static int parseCount(String s) {
+ if (StringUtils.isEmpty(s)) {
+ return 0;
+ }
+ try {
+ return Integer.parseInt(s.trim());
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+
+ private List<MydTrendReqDTO> getWeekDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) {
+ // 1. 璁$畻鎬诲懆鏁帮紙鍜� SQL 閲岀殑鍏紡淇濇寔涓�鑷达級
+ long days = (mydTrendReqVO.getEndFinishTime().getTime() - mydTrendReqVO.getStartFinishTime().getTime()) / (1000L * 60 * 60 * 24);
+ int totalWeeks = (int) (days / 7) + 1;
+
+ // 2. 宸叉湁鏁版嵁锛歱eriod -> totalScore
+ Map<Integer, String> exist = new HashMap<>();
+ for (MydTrendReqDTO row : list) {
+ // period 鏄暟瀛楋紝鍙兘鏄� Integer / Long / BigDecimal锛岀粺涓�杞� int
+ int p = Integer.parseInt(StringUtils.isNotEmpty(row.getPeriod()) ? row.getPeriod() : "0");
+ exist.put(p, row.getTotalScore() != null ? row.getTotalScore() : "0");
+ // 涓嬮潰杩欒鎸変綘鐨勫師閫昏緫淇濈暀锛堣櫧鐒剁湅璧锋潵鏈夌偣澶氫綑锛�
+ exist.put(p, String.valueOf(row.getTotalScore() != null ? row.getTotalScore() : 0));
+ }
+
+ // 3. 琛ュ叏 1..totalWeeks
+ List<MydTrendReqDTO> result = new ArrayList<>(totalWeeks);
+
+ // 鑾峰彇鏁翠綋鐨勫紑濮嬫椂闂�
+ long startTimeMillis = mydTrendReqVO.getStartFinishTime().getTime();
+ long endTimeMillis = mydTrendReqVO.getEndFinishTime().getTime();
+ long oneWeekMillis = 7L * 24 * 60 * 60 * 1000; // 涓�鍛ㄧ殑姣鏁�
+
+ for (int i = 1; i <= totalWeeks; i++) {
+ MydTrendReqDTO row = new MydTrendReqDTO();
+ row.setPeriod(String.valueOf(i));
+ row.setTotalScore(exist.getOrDefault(i, "0"));
+
+ // -------- 鏂板锛氳缃瘡鍛ㄧ殑 startDate 鍜� endDate --------
+ // 褰撳墠鍛ㄥ紑濮嬫椂闂� = 鏁翠綋寮�濮嬫椂闂� + (i - 1) * 7澶�
+ long currentStartMillis = startTimeMillis + (long) (i - 1) * oneWeekMillis;
+
+ // 褰撳墠鍛ㄧ粨鏉熸椂闂� = 褰撳墠鍛ㄥ紑濮嬫椂闂� + 7澶� - 1姣锛堜繚璇佹槸杩欎竴鍛ㄧ殑鏈�鍚庝竴鍒伙級
+ long currentEndMillis = currentStartMillis + oneWeekMillis - 1;
+
+ // 濡傛灉鏄渶鍚庝竴鍛紝缁撴潫鏃堕棿涓嶈兘瓒呰繃鏁翠綋鐨� endTime
+ if (i == totalWeeks) {
+ currentEndMillis = endTimeMillis;
+ }
+
+ row.setStartDate(new Date(currentStartMillis));
+ row.setEndDate(new Date(currentEndMillis));
+ // ----------------------------------------------------
+
+ result.add(row);
+ }
+
+ return result;
+ }
+
+ private List<MydTrendReqDTO> getYearDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) {
+ // 鑾峰彇鏁翠綋寮�濮嬪拰缁撴潫鏃堕棿
+ Date startTime = mydTrendReqVO.getStartFinishTime();
+ Date endTime = mydTrendReqVO.getEndFinishTime();
+
+ // 1. 璁$畻骞翠唤鑼冨洿
+ // 浣跨敤 Calendar 鑾峰彇璧峰骞翠唤鍜岀粨鏉熷勾浠�
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(startTime);
+ int startYear = cal.get(Calendar.YEAR);
+
+ cal.setTime(endTime);
+ int endYear = cal.get(Calendar.YEAR);
+
+ // 鎬诲勾鏁� (鍖呭惈棣栧熬)
+ int totalYears = endYear - startYear + 1;
+
+ // 2. 宸叉湁鏁版嵁锛歱eriod -> totalScore (鍋囪 period 瀛樼殑鏄勾浠藉瓧绗︿覆锛屽 "2024")
+ Map<String, String> exist = new HashMap<>();
+ for (MydTrendReqDTO row : list) {
+ String period = row.getPeriod() != null ? row.getPeriod() : "";
+ exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0");
+ }
+
+ // 3. 琛ュ叏鎵�鏈夊勾浠�
+ List<MydTrendReqDTO> result = new ArrayList<>(totalYears);
+
+ for (int i = 0; i < totalYears; i++) {
+ int currentYear = startYear + i;
+ String periodKey = String.valueOf(currentYear);
+
+ MydTrendReqDTO row = new MydTrendReqDTO();
+ row.setPeriod(periodKey);
+ // 濡傛灉娌℃湁璇ュ勾浠界殑鏁版嵁锛岄粯璁ょ粰 "0"
+ row.setTotalScore(exist.getOrDefault(periodKey, "0"));
+
+ // -------- 璁剧疆璇ュ勾浠界殑 startDate 鍜� endDate --------
+ Calendar yearCal = Calendar.getInstance();
+ // 璁剧疆涓鸿骞寸殑 1鏈�1鏃� 00:00:00
+ yearCal.set(currentYear, Calendar.JANUARY, 1, 0, 0, 0);
+ yearCal.set(Calendar.MILLISECOND, 0);
+ row.setStartDate(yearCal.getTime());
+
+ // 璁剧疆涓鸿骞寸殑 12鏈�31鏃� 23:59:59
+ yearCal.set(currentYear, Calendar.DECEMBER, 31, 23, 59, 59);
+ yearCal.set(Calendar.MILLISECOND, 999);
+ row.setEndDate(yearCal.getTime());
+ // ----------------------------------------------------
+
+ result.add(row);
+ }
+
+ return result;
+ }
+
+ private List<MydTrendReqDTO> getMonthDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) {
+ // 鑾峰彇鏁翠綋寮�濮嬪拰缁撴潫鏃堕棿
+ Date startTime = mydTrendReqVO.getStartFinishTime();
+ Date endTime = mydTrendReqVO.getEndFinishTime();
+
+ // 1. 璁$畻鏈堜唤鑼冨洿
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(startTime);
+ int startYear = cal.get(Calendar.YEAR);
+ int startMonth = cal.get(Calendar.MONTH); // 娉ㄦ剰锛欳alendar.MONTH 浠� 0 寮�濮�
+
+ cal.setTime(endTime);
+ int endYear = cal.get(Calendar.YEAR);
+ int endMonth = cal.get(Calendar.MONTH);
+
+ // 鎬绘湀鏁� = (缁撴潫骞� - 寮�濮嬪勾) * 12 + (缁撴潫鏈� - 寮�濮嬫湀) + 1
+ int totalMonths = (endYear - startYear) * 12 + (endMonth - startMonth) + 1;
+
+ // 2. 宸叉湁鏁版嵁锛歱eriod -> totalScore (period 瀛樼殑鏄湀浠藉瓧绗︿覆锛屽 "2024-06")
+ Map<String, String> exist = new HashMap<>();
+ for (MydTrendReqDTO row : list) {
+ String period = row.getPeriod() != null ? row.getPeriod() : "";
+ exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0");
+ }
+
+ // 3. 琛ュ叏鎵�鏈夋湀浠�
+ List<MydTrendReqDTO> result = new ArrayList<>(totalMonths);
+
+ Calendar monthCal = Calendar.getInstance();
+ monthCal.set(startYear, startMonth, 1, 0, 0, 0);
+ monthCal.set(Calendar.MILLISECOND, 0);
+
+ for (int i = 0; i < totalMonths; i++) {
+ int currentYear = monthCal.get(Calendar.YEAR);
+ int currentMonth = monthCal.get(Calendar.MONTH) + 1; // 杞垚 1-12 鏈�
+
+ // 鎷兼帴 period锛屾牸寮忥細yyyy-MM锛屾瘮濡� "2024-06"
+ // 濡傛灉浣犲笇鏈涙槸 "2024-6"锛屽彲浠ユ妸 String.format 鏀规垚 currentMonth
+ String periodKey = String.format("%04d-%02d", currentYear, currentMonth);
+
+ MydTrendReqDTO row = new MydTrendReqDTO();
+ row.setPeriod(periodKey);
+ row.setTotalScore(exist.getOrDefault(periodKey, "0"));
+
+ // -------- 璁剧疆璇ユ湀鐨� startDate 鍜� endDate --------
+ // 褰撴湀寮�濮嬫椂闂达細1鍙� 00:00:00.000
+ Calendar startCal = (Calendar) monthCal.clone();
+ row.setStartDate(startCal.getTime());
+
+ // 褰撴湀缁撴潫鏃堕棿锛氫笅涓湀1鍙� 00:00:00.000 鍑� 1 姣
+ Calendar endCal = (Calendar) monthCal.clone();
+ endCal.add(Calendar.MONTH, 1);
+ endCal.add(Calendar.MILLISECOND, -1);
+ row.setEndDate(endCal.getTime());
+ // ----------------------------------------------------
+
+ result.add(row);
+
+ // 杩涘叆涓嬩竴涓湀
+ monthCal.add(Calendar.MONTH, 1);
+ }
+
+ return result;
+ }
+
+ private List<MydTrendReqDTO> getDayDate(MydTrendReqVO mydTrendReqVO, List<MydTrendReqDTO> list) {
+ // 鑾峰彇鏁翠綋寮�濮嬪拰缁撴潫鏃堕棿
+ Date startTime = mydTrendReqVO.getStartFinishTime();
+ Date endTime = mydTrendReqVO.getEndFinishTime();
+
+ // 1. 璁$畻鎬诲ぉ鏁�
+ long oneDayMillis = 24L * 60 * 60 * 1000;
+ // 娉ㄦ剰锛氳繖閲屽彧绠楁棩鏈熷樊锛屼笉鑰冭檻鏃跺垎绉掞紝鍚﹀垯鍙兘宸竴澶�
+ Calendar startCal = Calendar.getInstance();
+ startCal.setTime(startTime);
+ startCal.set(Calendar.HOUR_OF_DAY, 0);
+ startCal.set(Calendar.MINUTE, 0);
+ startCal.set(Calendar.SECOND, 0);
+ startCal.set(Calendar.MILLISECOND, 0);
+
+ Calendar endCal = Calendar.getInstance();
+ endCal.setTime(endTime);
+ endCal.set(Calendar.HOUR_OF_DAY, 0);
+ endCal.set(Calendar.MINUTE, 0);
+ endCal.set(Calendar.SECOND, 0);
+ endCal.set(Calendar.MILLISECOND, 0);
+
+ long days = (endCal.getTimeInMillis() - startCal.getTimeInMillis()) / oneDayMillis;
+ int totalDays = (int) days + 1;
+
+ // 2. 宸叉湁鏁版嵁锛歱eriod -> totalScore (period 瀛樼殑鏄棩鏈熷瓧绗︿覆锛屽 "2024-06-01")
+ Map<String, String> exist = new HashMap<>();
+ for (MydTrendReqDTO row : list) {
+ String period = row.getPeriod() != null ? row.getPeriod() : "";
+ exist.put(period, row.getTotalScore() != null ? row.getTotalScore() : "0");
+ }
+
+ // 3. 琛ュ叏鎵�鏈夋棩鏈�
+ List<MydTrendReqDTO> result = new ArrayList<>(totalDays);
+
+ Calendar dayCal = (Calendar) startCal.clone();
+ for (int i = 0; i < totalDays; i++) {
+ // 鎷兼帴 period锛屾牸寮忥細yyyy-MM-dd
+ String periodKey = String.format("%04d-%02d-%02d", dayCal.get(Calendar.YEAR), dayCal.get(Calendar.MONTH) + 1, dayCal.get(Calendar.DAY_OF_MONTH));
+
+ MydTrendReqDTO row = new MydTrendReqDTO();
+ row.setPeriod(periodKey);
+ row.setTotalScore(exist.getOrDefault(periodKey, "0"));
+
+ // -------- 璁剧疆璇ュぉ鐨� startDate 鍜� endDate --------
+ Calendar startOfDay = (Calendar) dayCal.clone();
+ row.setStartDate(startOfDay.getTime());
+
+ Calendar endOfDay = (Calendar) dayCal.clone();
+ endOfDay.set(Calendar.HOUR_OF_DAY, 23);
+ endOfDay.set(Calendar.MINUTE, 59);
+ endOfDay.set(Calendar.SECOND, 59);
+ endOfDay.set(Calendar.MILLISECOND, 999);
+ row.setEndDate(endOfDay.getTime());
+ // ----------------------------------------------------
+
+ result.add(row);
+
+ // 杩涘叆涓嬩竴澶�
+ dayCal.add(Calendar.DAY_OF_MONTH, 1);
+ }
+
+ return result;
+ }
+
+ /**
+ * 闂ㄨ瘖婊℃剰搴︾患鍚堝緱鍒嗘帓鍚嶏紙鎸夌瀹ゆ垨鐥呭尯锛�
+ * <p>
+ * 缁煎悎婊℃剰搴� = 危(璇勫垎鏄庣粏鏉冮噸) / 璇勫垎鏄庣粏鏉℃暟 脳 100%锛�
+ * 鏉冮噸鍙彇 1銆�0.8銆�0.6銆�0.4銆�0.2 浜旀。锛堝緢婊℃剰銆佹弧鎰忋�佷竴鑸�佷笉婊℃剰銆佸緢涓嶆弧鎰忥級銆�
+ *
+ * @param mzMydScoreRankVO 鏌ヨ鏉′欢
+ * @return 鎺掑悕缁撴灉锛屽悕娆′粠 1 寮�濮嬮『搴忕紪鍙�
+ */
+ @Override
+ public List<MzMydScoreRankDTO> mzMydScoreRank(MzMydScoreRankVO mzMydScoreRankVO) {
+ if (StringUtils.isEmpty(mzMydScoreRankVO.getDimensionType())) {
+ mzMydScoreRankVO.setDimensionType("1");
+ }
+ if (CollectionUtils.isEmpty(mzMydScoreRankVO.getServiceTypes())) {
+ List<String> list=new ArrayList<>(Arrays.asList("14"));
+ mzMydScoreRankVO.setServiceTypes(list);
+ }
+ List<MzMydScoreRankDTO> list = serviceSubtaskMapper.selectMzMydScoreRank(mzMydScoreRankVO);
+ if (CollectionUtils.isEmpty(list)) {
+ return new ArrayList<>();
+ }
+ // 鍚嶆锛歋QL 宸叉寜缁煎悎寰楀垎闄嶅簭杩斿洖锛岃繖閲岄『搴忕紪鍙�
+ for (int i = 0; i < list.size(); i++) {
+ list.get(i).setRank(i + 1);
+ }
+ return list;
+ }
+
+ private String getWXCode(String idcard, String url, String taskName, String taskDesc, String phone, String setPatientname, String setPatientid, List<String> wxqqxx) {
+ XinHuaWXReq xinHuaWXReq = new XinHuaWXReq();
+ xinHuaWXReq.setIdcard(idcard);
+ xinHuaWXReq.setUrl(url);
+ xinHuaWXReq.setPatientid(setPatientid);
+ xinHuaWXReq.setPatientname(setPatientname);
+ xinHuaWXReq.setMobile(phone);
+ xinHuaWXReq.setMedcardno(null);
+ xinHuaWXReq.setTitlename(taskName);
+ xinHuaWXReq.setContent(taskDesc);
+ xinHuaWXReq.setAppid(wxqqxx.get(1));
+ log.info("銆恎etWXCode銆戝井淇″叕浼楀彿璇锋眰鍙傛暟锛歿}", xinHuaWXReq);
+ String body = new Gson().toJson(xinHuaWXReq);
+ String encode = encode(wxqqxx.get(2).concat(body));
+ Map<String, String> headerMap = new HashMap<>();
+ headerMap.put("sign", encode);
+ String result = HttpUtils.sendPostByHeader(wxqqxx.get(3), body, headerMap);
+ log.info("銆恎etWXCode銆戝井淇″叕浼楀彿杩斿洖鍙傛暟锛歿}", result);
+ JSONObject jsonObject = JSONObject.parseObject(result);
+ String code = (String) jsonObject.toString();
+ return code;
+ }
+ public String encode(String arg) {
+ if (arg == null) {
+ arg = "";
+ }
+ MessageDigest md5 = null;
+ try {
+ md5 = MessageDigest.getInstance("MD5");
+ md5.update(arg.getBytes("UTF-8"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return toHex(md5.digest());
+ }
}
--
Gitblit v1.9.3