| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | 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; |
| | | } |
| | | // 原方法 |
| | | // @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; |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | * @return 各状态统计结果 |
| | | */ |
| | | @Override |
| | | public Map<String, Object> patItemCount1(ServiceSubtaskVO serviceSubtaskVO) { |
| | | public Map<String, Object> patItemCount(ServiceSubtaskVO serviceSubtaskVO) { |
| | | // 直接调用数据库统计方法,在数据库层完成聚合计算 |
| | | Map<String, Object> result = serviceSubtaskMapper.countByCondition(serviceSubtaskVO); |
| | | |
| | | // 处理空异常 |
| | | if(MapUtils.isEmpty(result)){ |
| | | result = new HashMap<>(); |
| | | } |
| | | // 确保所有 key 都有值,避免空指针异常 |
| | | // MyBatis 的 SUM 在没有匹配行时会返回 null |
| | | result.putIfAbsent("wzx", 0); |
| | |
| | | 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; |
| | | } |
| | | |