| | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.*; |
| | |
| | | Integer yc = 0; |
| | | Integer fssb = 0; |
| | | Integer yfs = 0; |
| | | Integer blq = 0; |
| | | Integer xj = 0; |
| | | Integer dfs = 0; |
| | | Integer ywc = 0; |
| | | Integer ywc2 = 0; |
| | | for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { |
| | | if (serviceSubtask.getSendstate() == 4L) wzx = wzx + 1; |
| | | else if (serviceSubtask.getSendstate() != 4L) ysf = ysf + 1; |
| | | if (serviceSubtask.getSendstate() == 5L) fssb = fssb + 1; |
| | | if (serviceSubtask.getSendstate() == 3L) yfs = yfs + 1; |
| | | if (serviceSubtask.getSendstate() == 1L) blq = blq + 1; |
| | | if (serviceSubtask.getSendstate() == 1L) xj = xj + 1; |
| | | if (serviceSubtask.getSendstate() == 2L) dfs = dfs + 1; |
| | | if (serviceSubtask.getSendstate() == 6L) ywc = ywc + 1; |
| | | if (serviceSubtask.getExcep().equals("1")) yc = yc + 1; |
| | | } |
| | | map.put("wzx", wzx); |
| | |
| | | map.put("yc", yc); |
| | | map.put("fssb", fssb); |
| | | map.put("yfs", yfs); |
| | | map.put("blq", blq); |
| | | |
| | | map.put("xj", xj); |
| | | map.put("dfs", dfs); |
| | | map.put("ywc", ywc); |
| | | map.put("yfs2", yfs + ywc); |
| | | return map; |
| | | } |
| | | |
| | |
| | | serviceSubtask.setEndtime(patTaskRelevance.getEndtime()); |
| | | serviceSubtask.setNurseId(patTaskRelevance.getNurseId()); |
| | | serviceSubtask.setNurseName(patTaskRelevance.getNurseName()); |
| | | if (serviceTaskVO.getLongTask() != null &&serviceTaskVO.getLongTask() == 1) |
| | | if (serviceTaskVO.getLongTask() != null && serviceTaskVO.getLongTask() == 1) |
| | | serviceSubtask.setLongSendTime(patTaskRelevance.getLongSendTime()); |
| | | serviceSubtaskMapper.insertServiceSubtask(serviceSubtask); |
| | | integer = serviceSubtask.getId().intValue(); |
| | |
| | | return result2; |
| | | } |
| | | |
| | | /** |
| | | * 获取随访统计比例 |
| | | * |
| | | * @param serviceSubtaskCountReq |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ServiceSubtaskStatistic> getSfStatistics(ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | log.error("getSfStatistics的入参为:{}", serviceSubtaskCountReq); |
| | | List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>(); |
| | | Map<String, List<ServiceSubtask>> collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(ServiceSubtask::getLeavehospitaldistrictname)); |
| | | for (List<ServiceSubtask> serviceSubtaskList : collect.values()) { |
| | | if (CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | continue; |
| | | } |
| | | ServiceSubtaskStatistic statistic = getStatistic(serviceSubtaskList); |
| | | if (ObjectUtils.isNotEmpty(statistic)) { |
| | | serviceSubtaskStatistics.add(statistic); |
| | | } |
| | | } |
| | | return serviceSubtaskStatistics; |
| | | } |
| | | |
| | | private ServiceSubtaskStatistic getStatistic(List<ServiceSubtask> serviceSubtaskList) { |
| | | ServiceSubtaskStatistic serviceSubtaskStatistic = new ServiceSubtaskStatistic(); |
| | | serviceSubtaskStatistic.setLeavehospitaldistrictname(serviceSubtaskList.get(0).getLeavehospitaldistrictname()); |
| | | serviceSubtaskStatistic.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode()); |
| | | serviceSubtaskStatistic.setServiceCount(serviceSubtaskList.size()); |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | //不随访数量 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 4) { |
| | | serviceSubtaskStatistic.setBzxCount(serviceSubtaskStatistic.getBzxCount() + 1L); |
| | | } |
| | | //应随访数量 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) { |
| | | serviceSubtaskStatistic.setYsfCount(serviceSubtaskStatistic.getYsfCount() + 1L); |
| | | } |
| | | //发送失败数量 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 5) { |
| | | serviceSubtaskStatistic.setFssbCount(serviceSubtaskStatistic.getFssbCount() + 1L); |
| | | } |
| | | //待发送数量 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 2) { |
| | | serviceSubtaskStatistic.setDfsCount(serviceSubtaskStatistic.getDfsCount() + 1L); |
| | | } |
| | | //已发送数量 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 3) { |
| | | serviceSubtaskStatistic.setYfsCount(serviceSubtaskStatistic.getYfsCount() + 1L); |
| | | } |
| | | //已完成数量 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() == 6) { |
| | | //已发送,包含已完成 |
| | | serviceSubtaskStatistic.setYfsCount(serviceSubtaskStatistic.getYfsCount() + 1L); |
| | | serviceSubtaskStatistic.setYwcCount(serviceSubtaskStatistic.getYwcCount() + 1L); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(serviceSubtask.getExcep()) && serviceSubtask.getExcep().equals("1")) { |
| | | //异常标识 |
| | | serviceSubtaskStatistic.setYczs(serviceSubtaskStatistic.getYczs() + 1L); |
| | | |
| | | } |
| | | |
| | | } |
| | | //随访完成率=已发送/随访数 |
| | | if (serviceSubtaskStatistic.getYfsCount() == 0 || CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | serviceSubtaskStatistic.setSfwcl("0"); |
| | | } else { |
| | | BigDecimal multiply = BigDecimal.valueOf(serviceSubtaskStatistic.getYfsCount()).divide(BigDecimal.valueOf(serviceSubtaskList.size()), 2, BigDecimal.ROUND_HALF_UP); |
| | | serviceSubtaskStatistic.setSfwcl(multiply.toString()); |
| | | } |
| | | |
| | | return serviceSubtaskStatistic; |
| | | } |
| | | |
| | | private IvrTaskTemplateScriptVO getNextQuestion(List<IvrTaskTemplateScriptVO> IvrTaskTemplateScriptVOList, IvrTaskTemplateScriptVO IvrTaskTemplateScriptVO) { |
| | | |
| | | for (int j = 0; j < IvrTaskTemplateScriptVOList.size(); j++) { |
| | |
| | | redisCache.setCacheObject(subTaskId + "recordAccept-hungup", "1", 10, TimeUnit.MINUTES); |
| | | if (StringUtils.isNotEmpty(serviceSubtask.getRemark())) serviceSubtask.setRemark("电话发送拒接,短信补偿发送成功"); |
| | | else serviceSubtask.setRemark("短信补偿发送成功"); |
| | | //记录一下补偿方式 |
| | | if (StringUtils.isNotEmpty(serviceSubtask.getPreachform())) { |
| | | serviceSubtask.setPreachform(serviceSubtask.getPreachform() + ",1"); |
| | | } |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | } |
| | | } |