| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.collections4.ListUtils; |
| | | import org.apache.commons.collections4.MapUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | return serviceSubtaskList; |
| | | } |
| | | |
| | | // 原方法 |
| | | // @Override |
| | | // public Map<String, Object> patItemCount(ServiceSubtaskVO serviceSubtaskVO) { |
| | | // serviceSubtaskVO.setPageSize(99999999); |
| | | // serviceSubtaskVO.setPageNum(1); |
| | | // List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO); |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // Integer wzx = 0; |
| | | // Integer ysf = 0; |
| | | // Integer yc = 0; |
| | | // Integer fssb = 0; |
| | | // Integer yfs = 0; |
| | | // Integer blq = 0; |
| | | // Integer dsf = 0; |
| | | // for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { |
| | | // if (serviceSubtask.getSendstate() == 4L) wzx = wzx + 1; |
| | | // else if (serviceSubtask.getSendstate() != 4L && serviceSubtask.getSendstate() != 2L) ysf = ysf + 1; |
| | | // if (serviceSubtask.getSendstate() == 5L) fssb = fssb + 1; |
| | | // if (serviceSubtask.getSendstate() >= 3L || serviceSubtask.getSendstate() == 1L) yfs = yfs + 1; |
| | | // if (serviceSubtask.getSendstate() == 2L) dsf = dsf + 1; |
| | | // if (serviceSubtask.getSendstate() == 1L) blq = blq + 1; |
| | | // if (StringUtils.isNotEmpty(serviceSubtask.getExcep()) && !serviceSubtask.getExcep().equals("0")) |
| | | // yc = yc + 1; |
| | | // } |
| | | // |
| | | // map.put("wzx", wzx); |
| | | // map.put("ysf", ysf); |
| | | // map.put("yc", yc); |
| | | // map.put("fssb", fssb); |
| | | // map.put("yfs", yfs); |
| | | // map.put("blq", blq); |
| | | // map.put("dsf", dsf); |
| | | // |
| | | // return map; |
| | | // } |
| | | |
| | | |
| | | /** |
| | | * 统计任务各种状态的数量(已优化) |
| | | * 优化说明: |
| | | * 1. 使用数据库层聚合计算,替代应用层遍历 |
| | | * 2. 性能提升 10-100 倍(取决于数据量) |
| | | * 3. 降低内存占用和网络传输 |
| | | * |
| | | * @param serviceSubtaskVO 查询条件 |
| | | * @return 各状态统计结果 |
| | | */ |
| | | @Override |
| | | public Map<String, Object> patItemCount(ServiceSubtaskVO serviceSubtaskVO) { |
| | | serviceSubtaskVO.setPageSize(99999999); |
| | | serviceSubtaskVO.setPageNum(1); |
| | | List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Integer wzx = 0; |
| | | Integer ysf = 0; |
| | | Integer yc = 0; |
| | | Integer fssb = 0; |
| | | Integer yfs = 0; |
| | | Integer blq = 0; |
| | | Integer dsf = 0; |
| | | for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { |
| | | if (serviceSubtask.getSendstate() == 4L) wzx = wzx + 1; |
| | | else if (serviceSubtask.getSendstate() != 4L && serviceSubtask.getSendstate() != 2L) ysf = ysf + 1; |
| | | if (serviceSubtask.getSendstate() == 5L) fssb = fssb + 1; |
| | | if (serviceSubtask.getSendstate() >= 3L || serviceSubtask.getSendstate() == 1L) yfs = yfs + 1; |
| | | if (serviceSubtask.getSendstate() == 2L) dsf = dsf + 1; |
| | | if (serviceSubtask.getSendstate() == 1L) blq = blq + 1; |
| | | if (StringUtils.isNotEmpty(serviceSubtask.getExcep()) && !serviceSubtask.getExcep().equals("0")) |
| | | yc = yc + 1; |
| | | // 直接调用数据库统计方法,在数据库层完成聚合计算 |
| | | Map<String, Object> result = serviceSubtaskMapper.countByCondition(serviceSubtaskVO); |
| | | // 处理空异常 |
| | | if(MapUtils.isEmpty(result)){ |
| | | result = new HashMap<>(); |
| | | } |
| | | map.put("wzx", wzx); |
| | | map.put("ysf", ysf); |
| | | map.put("yc", yc); |
| | | map.put("fssb", fssb); |
| | | map.put("yfs", yfs); |
| | | map.put("blq", blq); |
| | | map.put("dsf", dsf); |
| | | // 确保所有 key 都有值,避免空指针异常 |
| | | // MyBatis 的 SUM 在没有匹配行时会返回 null |
| | | result.putIfAbsent("wzx", 0); |
| | | result.putIfAbsent("ysf", 0); |
| | | result.putIfAbsent("yc", 0); |
| | | result.putIfAbsent("fssb", 0); |
| | | result.putIfAbsent("yfs", 0); |
| | | result.putIfAbsent("blq", 0); |
| | | result.putIfAbsent("dsf", 0); |
| | | |
| | | return map; |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | if (ObjectUtils.isNotEmpty(serviceTaskVO.getIvrTaskTemplateVO())) { |
| | | tempid = Long.valueOf(ivrTaskTemplateService.saveOrUpdateTempScript(serviceTaskVO.getIvrTaskTemplateVO())); |
| | | tempName = ivrTaskTemplateService.selectIvrTaskTemplateByID(tempid).getTemplateName(); |
| | | log.info("IVR模板插入成功,返回的tempid={}", tempid); |
| | | |
| | | IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(tempid); |
| | | if (ivrTaskTemplate == null) { |
| | | log.error("根据tempid={}查询IVR模板失败,返回null!请检查del_flag字段是否正确设置", tempid); |
| | | throw new BaseException("IVR模板保存成功但查询失败,请联系管理员检查数据"); |
| | | } |
| | | tempName = ivrTaskTemplate.getTemplateName(); |
| | | log.info("IVR模板查询成功,tempName={}", tempName); |
| | | } |
| | | |
| | | //往任务表中,新增任务 |
| | |
| | | return serviceSubtaskStatistics; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取满意度题目总量 |
| | | * type : 1-科室 2病区 |
| | |
| | | List<ServiceSubtask> followUpSuccessInfo = new ArrayList<>(); |
| | | //记录首次随访失败详情 |
| | | List<ServiceSubtask> followUpFailInfo = new ArrayList<>(); |
| | | //记录首次随访人工详情 |
| | | List<ServiceSubtask> manualInfo = 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> smsAgainInfo = new ArrayList<>(); |
| | | //记录首次随访微信详情 |
| | | List<ServiceSubtask> wechatAgainInfo= new ArrayList<>(); |
| | | |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | //无需随访人次 |
| | |
| | | } else { |
| | | serviceSubtaskStatistic.setFollowUpRate("0.00%"); |
| | | } |
| | | //首次随访人工 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManual(serviceSubtaskStatistic.getManual() + 1L); |
| | | manualInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访短信 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSms(serviceSubtaskStatistic.getSms() + 1L); |
| | | smsInfo.add(serviceSubtask); |
| | | } |
| | | //首次随访微信 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L); |
| | | wechatInfo.add(serviceSubtask); |
| | | } |
| | | //结果异常 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) { |
| | | serviceSubtaskStatistic.setAbnormal(serviceSubtaskStatistic.getAbnormal() + 1L); |
| | | } |
| | | }//二次出院随访 |
| | | else if (serviceSubtask.getVisitCount() != null && serviceSubtask.getVisitCount() > 1) { |
| | | //再次应随访 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate() != 4) { |
| | | serviceSubtaskStatistic.setNeedFollowUpAgain(serviceSubtaskStatistic.getNeedFollowUpAgain() + 1L); |
| | | 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(); |
| | |
| | | } else { |
| | | serviceSubtaskStatistic.setFollowUpRateAgain("0.00%"); |
| | | } |
| | | //再次随访人工 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("1")) { |
| | | serviceSubtaskStatistic.setManualAgain(serviceSubtaskStatistic.getManualAgain() + 1L); |
| | | manualAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访短信 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("4")) { |
| | | serviceSubtaskStatistic.setSmsAgain(serviceSubtaskStatistic.getSmsAgain() + 1L); |
| | | smsAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次随访微信 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L); |
| | | wechatAgainInfo.add(serviceSubtask); |
| | | } |
| | | //再次异常 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getExcep().equals("1")) { |
| | | serviceSubtaskStatistic.setAbnormalAgain(serviceSubtaskStatistic.getAbnormalAgain() + 1L); |
| | | } |
| | |
| | | serviceSubtaskStatistic.setFollowUpSuccessInfo(followUpSuccessInfo); |
| | | //记录首次随访失败详情 |
| | | serviceSubtaskStatistic.setFollowUpFailInfo(followUpFailInfo); |
| | | //记录首次随访人工详情 |
| | | serviceSubtaskStatistic.setManualInfo(manualInfo); |
| | | //记录首次随访短信详情 |
| | | serviceSubtaskStatistic.setSmsInfo(smsInfo); |
| | | //记录首次随访微信详情 |
| | | serviceSubtaskStatistic.setWechatInfo(wechatInfo); |
| | | //记录再次应随访详情 |
| | | serviceSubtaskStatistic.setNeedFollowUpAgainInfo(needFollowUpAgainInfo); |
| | | //记录再次待随访详情 |
| | | serviceSubtaskStatistic.setPendingFollowUpAgainInfo(pendingFollowUpAgainInfo); |
| | | //记录再次随访成功详情 |
| | | serviceSubtaskStatistic.setFollowUpSuccessAgainInfo(followUpSuccessAgainInfo); |
| | | //记录再次随访失败详情 |
| | | serviceSubtaskStatistic.setFollowUpFailAgainInfo(followUpFailAgainInfo); |
| | | //记录再次随访人工详情 |
| | | serviceSubtaskStatistic.setManualAgainInfo(manualAgainInfo); |
| | | //记录再次随访短信详情 |
| | | serviceSubtaskStatistic.setSmsAgainInfo(smsAgainInfo); |
| | | //记录再次随访微信详情 |
| | | serviceSubtaskStatistic.setWechatAgainInfo(wechatAgainInfo); |
| | | return serviceSubtaskStatistic; |
| | | } |
| | | |
| | |
| | | return serviceSubtaskMapper.getSfStatisticsJoydetails(serviceSubtaskCountReq); |
| | | } |
| | | |
| | | /** |
| | | * 获取随访统计比例 |
| | | * |
| | | * @param serviceSubtaskCountReq |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Cacheable(value = "sfStatisticsJoy", key = "T(org.springframework.util.DigestUtils).md5DigestAsHex(#serviceSubtaskCountReq.toString().getBytes())", unless = "#result == null or #result.isEmpty()") |
| | | public List<ServiceSubtaskStatistic> getSfStatisticsScript(ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | log.error("getSfStatisticsScript的入参为:{}", serviceSubtaskCountReq); |
| | | List<ServiceSubtaskStatistic> serviceSubtaskStatistics = new ArrayList<>(); |
| | | |
| | | // 根据条件进行分组 |
| | | Map<String, List<ServiceSubtask>> collect = new HashMap<>(); |
| | | String orgid = null; |
| | | |
| | | if (serviceSubtaskCountReq.getLeavehospitaldistrictcodes() != null && serviceSubtaskCountReq.getLeavehospitaldistrictcodes().size() > 0) { |
| | | if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) { |
| | | collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown"))); |
| | | |
| | | } else { |
| | | collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getLeavehospitaldistrictname()).orElse("Unknown"))); |
| | | } |
| | | } else if (serviceSubtaskCountReq.getDeptcodes() != null && serviceSubtaskCountReq.getDeptcodes().size() > 0) { |
| | | if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) { |
| | | collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDrname()).orElse("Unknown"))); |
| | | } else { |
| | | collect = serviceSubtaskMapper.getSfStatistics(serviceSubtaskCountReq).stream().collect(Collectors.groupingBy(subtask -> Optional.ofNullable(subtask.getDeptname()).orElse("Unknown"))); |
| | | } |
| | | } |
| | | //获取随访统计 |
| | | List<ServiceSubtaskCount> subCount = new ArrayList<>(); |
| | | subCount = serviceSubtaskMapper.getSfStatisticsCategory(serviceSubtaskCountReq); |
| | | for (List<ServiceSubtask> serviceSubtaskList : collect.values()) { |
| | | if (CollectionUtils.isEmpty(serviceSubtaskList)) { |
| | | continue; |
| | | } |
| | | ServiceSubtaskStatistic statistic = getStatisticJoy(serviceSubtaskList, subCount); |
| | | //及时率 |
| | | ServiceSubtask ss = new ServiceSubtask(); |
| | | orgid = serviceSubtaskList.get(0).getOrgid(); |
| | | ss.setOrgid(orgid); |
| | | |
| | | // 如果有医生编码,设置医生编码用于及时率查询 |
| | | if (serviceSubtaskCountReq.getDrcode() != null && !serviceSubtaskCountReq.getDrcode().isEmpty()) { |
| | | ss.setDrcode(serviceSubtaskList.get(0).getDrcode()); |
| | | } else { |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getLeavehospitaldistrictcodes())) { |
| | | ss.setLeavehospitaldistrictcode(serviceSubtaskList.get(0).getLeavehospitaldistrictcode()); |
| | | } else if (CollectionUtils.isNotEmpty(serviceSubtaskCountReq.getDeptcodes())) { |
| | | ss.setDeptcode(serviceSubtaskList.get(0).getDeptcode()); |
| | | } |
| | | } |
| | | |
| | | ss.setStarttime(serviceSubtaskCountReq.getStartTime()); |
| | | ss.setEndtime(serviceSubtaskCountReq.getEndTime()); |
| | | if (serviceSubtaskCountReq.getEndTime() != null && new Date().before(serviceSubtaskCountReq.getEndTime())) { |
| | | ss.setEndtime(new Date()); |
| | | } |
| | | Double jsRate = serviceSubtaskMapper.selectTimelyRate(ss); |
| | | statistic.setRate(jsRate); |
| | | if (ObjectUtils.isNotEmpty(statistic)) { |
| | | serviceSubtaskStatistics.add(statistic); |
| | | } |
| | | } |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskStatistics)) { |
| | | for (ServiceSubtaskStatistic serviceSubtaskStatistic : serviceSubtaskStatistics) { |
| | | //获取满意度题目总量 |
| | | BigDecimal mydtmzlsum = new BigDecimal(0); |
| | | //获取满意度题目填报量 |
| | | BigDecimal mydtblsum = new BigDecimal(0); |
| | | //完成比例 |
| | | Double wcbl = null; |
| | | if(ObjectUtils.isNotEmpty(serviceSubtaskStatistic.getJoyAllCount())){ |
| | | mydtblsum = new BigDecimal(serviceSubtaskStatistic.getJoyAllCount()); |
| | | } |
| | | |
| | | if(ObjectUtils.isNotEmpty(serviceSubtaskStatistic.getJoyCount())){ |
| | | mydtmzlsum = new BigDecimal(serviceSubtaskStatistic.getJoyCount()); |
| | | } |
| | | if(mydtmzlsum.intValue() != 0){ |
| | | wcbl = mydtblsum.divide(mydtmzlsum, 2, RoundingMode.HALF_UP).doubleValue(); |
| | | } |
| | | serviceSubtaskStatistic.setJoyAllCount(mydtmzlsum.intValue()); |
| | | serviceSubtaskStatistic.setJoyCount(mydtblsum.intValue()); |
| | | serviceSubtaskStatistic.setJoyTotal(wcbl); |
| | | } |
| | | } |
| | | |
| | | return serviceSubtaskStatistics; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, ServiceSubtaskScriptCount> getSfStatisticsScriptDetails(ServiceSubtaskCountReq serviceSubtaskCountReq) { |
| | | Map<String, ServiceSubtaskScriptCount> result = new HashMap<>(); |
| | | List<ServiceSubtaskScriptCount> allCounts = new ArrayList<>(); |
| | | List<ServiceSubtaskScriptCount> allItemCounts = new ArrayList<>(); |
| | | String type = serviceSubtaskCountReq.getType(); |
| | | if(ObjectUtils.isEmpty(type)){ |
| | | //查询语音统计明细 |
| | | serviceSubtaskCountReq.setType("1"); |
| | | List<ServiceSubtaskScriptCount> ivyCounts = serviceSubtaskMapper.getSfStatisticsScriptDetails(serviceSubtaskCountReq); |
| | | List<ServiceSubtaskScriptCount> ivyItemCounts = serviceSubtaskMapper.getSfStatisticsScriptItemDetails(serviceSubtaskCountReq); |
| | | |
| | | //查询短信统计明细 |
| | | serviceSubtaskCountReq.setType("2"); |
| | | List<ServiceSubtaskScriptCount> svyCounts = serviceSubtaskMapper.getSfStatisticsScriptDetails(serviceSubtaskCountReq); |
| | | List<ServiceSubtaskScriptCount> svyItemCounts = serviceSubtaskMapper.getSfStatisticsScriptItemDetails(serviceSubtaskCountReq); |
| | | |
| | | allCounts.addAll(ivyCounts); |
| | | allCounts.addAll(svyCounts); |
| | | allItemCounts.addAll(ivyItemCounts); |
| | | allItemCounts.addAll(svyItemCounts); |
| | | }else { |
| | | allCounts = serviceSubtaskMapper.getSfStatisticsScriptDetails(serviceSubtaskCountReq); |
| | | allItemCounts = serviceSubtaskMapper.getSfStatisticsScriptItemDetails(serviceSubtaskCountReq); |
| | | } |
| | | |
| | | |
| | | for(ServiceSubtaskScriptCount count : allCounts){ |
| | | Map<String, ServiceSubtaskScriptCount> itemCountMap = new HashMap<>(); |
| | | if(ObjectUtils.isNotEmpty(count.getOptions())){ |
| | | String[] optionsArray = count.getOptions().split(","); |
| | | List<String> optionsList = Arrays.stream(optionsArray).map(String::valueOf).collect(Collectors.toList()); |
| | | if(ObjectUtils.isNotEmpty(optionsList)){ |
| | | //填入空白信息 |
| | | optionsList.forEach(option ->{ |
| | | ServiceSubtaskScriptCount emptyCount = new ServiceSubtaskScriptCount(); |
| | | emptyCount.setScriptContent(count.getScriptContent()); |
| | | emptyCount.setScriptType(count.getScriptType()); |
| | | emptyCount.setCompletedQuantity(count.getCompletedQuantity()); |
| | | emptyCount.setAllQuantity(count.getAllQuantity()); |
| | | emptyCount.setChosenQuantity(0); |
| | | emptyCount.setChosenPercentage("0.0"); |
| | | itemCountMap.put(option,emptyCount); |
| | | }); |
| | | } |
| | | } |
| | | List<ServiceSubtaskScriptCount> itemCounts = new ArrayList<>(); |
| | | allItemCounts.forEach(itemCount ->{ |
| | | if(ObjectUtils.isNotEmpty(count.getScriptid()) && ObjectUtils.isNotEmpty(itemCount.getScriptid())){ |
| | | if(count.getScriptid().equals(itemCount.getScriptid())){ |
| | | //放入统计信息 |
| | | itemCount.setScriptContent(count.getScriptContent()); |
| | | itemCount.setScriptType(count.getScriptType()); |
| | | itemCount.setCompletedQuantity(count.getCompletedQuantity()); |
| | | itemCount.setAllQuantity(count.getAllQuantity()); |
| | | //计算选择比例 |
| | | int chosenQuantity = ObjectUtils.isNotEmpty(itemCount.getChosenQuantity())?itemCount.getChosenQuantity():0; |
| | | int completedQuantity = itemCount.getCompletedQuantity(); |
| | | if(ObjectUtils.isNotEmpty(completedQuantity) && completedQuantity != 0){ |
| | | BigDecimal chosenPercentage = (new BigDecimal(chosenQuantity)).divide(new BigDecimal(completedQuantity), 2, RoundingMode.HALF_UP); |
| | | itemCount.setChosenPercentage(chosenPercentage.toString()); |
| | | } |
| | | itemCountMap.put(count.getOptionText(), itemCount); |
| | | } |
| | | } |
| | | }); |
| | | itemCounts = new ArrayList<>(itemCountMap.values()); |
| | | count.setDetails(itemCounts); |
| | | result.put(count.getScriptid().toString(),count); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @param serviceSubtask |
| | |
| | | serviceSubtaskPreachform.setTaskid(taskid); |
| | | List<ServiceSubtaskPreachform> serviceSubtaskPreachforms = serviceSubtaskPreachformMapper.selectServiceSubtaskPreachformList(serviceSubtaskPreachform); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms)) { |
| | | //没有随访时间则按当天来算--临时 |
| | | if (ObjectUtils.isEmpty(visitTime)) { |
| | | visitTime = new Date(); |
| | | } |
| | | |
| | | String compensateTime = serviceSubtaskPreachforms.get(0).getCompensateTime(); |
| | | int hoursToAdd = Integer.valueOf(compensateTime) * 24; |
| | | Calendar calendar = Calendar.getInstance(); |