| | |
| | | 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))); |
| | | 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); |
| | |
| | | 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.setSendstate(2L); |
| | | serviceSubtask.setDeptcode(patTaskRelevance.getDeptcode()); |
| | | serviceSubtask.setDeptname(patTaskRelevance.getDeptName()); |
| | | serviceSubtask.setLeavehospitaldistrictcode(patTaskRelevance.getLeavehospitaldistrictcode()); |
| | |
| | | redisCache.removeElementFromList("cache-3", serviceSubtask.getId().toString()); |
| | | redisCache.removeElementFromList("cache-4", serviceSubtask.getId().toString()); |
| | | //将出入院表的数据,还原成还未处理的状态 |
| | | if(serviceSubtask.getServiceType().equals("2")) { |
| | | 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(); |
| | | if (serviceSubtask.getServiceType().equals("2")) { |
| | | 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)) { |
| | | if (CollectionUtils.isNotEmpty(patMedOuthosps)) { |
| | | PatMedOuthosp patMedOuthosp = patMedOuthosps.get(0); |
| | | patMedOuthosp.setServerState("0"); |
| | | patMedOuthospService.updatePatMedOuthosp(patMedOuthosp); |
| | |
| | | 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()); |
| | |
| | | if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L); |
| | | } |
| | | } else if(StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) { |
| | | } 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("5")) { |
| | | serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L); |
| | | } |
| | | }else { |
| | | } else { |
| | | //首次随访成功 - 统计时候加上不执行的,已发送的 |
| | | if (serviceSubtask.getSendstate() != null && (serviceSubtask.getSendstate().equals(6L) || serviceSubtask.getSendstate().equals(3L) || serviceSubtask.getSendstate().equals(4L))) { |
| | | serviceSubtaskStatistic.setFollowUpSuccess(serviceSubtaskStatistic.getFollowUpSuccess() + 1L); |
| | |
| | | if (serviceSubtask.getSendstate() != null && !serviceSubtask.getSendstate().equals(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L); |
| | | } |
| | | } else if(StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) { |
| | | } 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(4L) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChat(serviceSubtaskStatistic.getWeChat() + 1L); |
| | | } |
| | | } else if(StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) { |
| | | } 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) && ObjectUtils.isNotEmpty(serviceSubtask.getCurrentPreachform()) && serviceSubtask.getCurrentPreachform().equals("5")) { |
| | | serviceSubtaskStatistic.setWeChatAgain(serviceSubtaskStatistic.getWeChatAgain() + 1L); |
| | | } |
| | | } else if(StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) { |
| | | } else if (StringUtils.isNotEmpty(followUpCountStyle) && followUpCountStyle.equals("3")) { |
| | | //再次随访成功 |
| | | if (serviceSubtask.getSendstate() != null && serviceSubtask.getSendstate().equals(6L)) { |
| | | serviceSubtaskStatistic.setFollowUpSuccessAgain(serviceSubtaskStatistic.getFollowUpSuccessAgain() + 1L); |
| | |
| | | */ |
| | | 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<>(); |
| | | if (CollectionUtils.isNotEmpty(sendstates) && sendstates.get(0).equals(6L)) { |
| | | List<Long> sendstates1 = new ArrayList<>(); |
| | | sendstates1.add(3L); |
| | | sendstates1.add(4L); |
| | | sendstates1.add(6L); |
| | |
| | | //获取及时率统计合集 |
| | | Map<String, Map<String, Object>> jsRates = getSsRateForSfStatistics(serviceSubtaskCountReq, collect); |
| | | //一次性查询所有分组的题目统计,避免每个分组一次SQL(N+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); |