| | |
| | | //说明该患者是被过滤的,不用再执行了 |
| | | serviceSubtask.setCreateBy(serviceTask.getCreateBy()); |
| | | serviceSubtask.setCreateTime(new Date()); |
| | | serviceSubtask.setSendstate(4L); |
| | | i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask); |
| | | } else { |
| | | if (StringUtils.isEmpty(serviceSubtask.getPhone())) { |
| | |
| | | } else { |
| | | serviceTask = serviceTasks.get(0); |
| | | } |
| | | if (Objects.isNull(patMedOperationItem.getOpid())) { |
| | | return; |
| | | } |
| | | if (Objects.isNull(patMedOperationItem.getOplevelcode())) { |
| | | return; |
| | | } |
| | | PatMedOperation patMedOperation = patMedOperationMapper.selectPatMedOperationById(patMedOperationItem.getOpid()); |
| | | if (Objects.isNull(patMedOperation)) { |
| | | if (Objects.isNull(patMedOperationItem.getPatid())) { |
| | | return; |
| | | } |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOperation.getPatid()); |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOperationItem.getPatid()); |
| | | if (Objects.isNull(patArchive)) { |
| | | return; |
| | | } |
| | | PatMedInhosp patMedInhosp = new PatMedInhosp(); |
| | | patMedInhosp.setPatid(patMedOperation.getPatid()); |
| | | patMedInhosp.setPatid((patMedOperationItem.getPatid())); |
| | | patMedInhosp.setInhospstate("1"); |
| | | patMedInhosp.setFuflag("1"); |
| | | List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhosp); |
| | |
| | | } |
| | | |
| | | //封装serviceSubtask |
| | | ServiceSubtask serviceSubtask = boxedServiceSubtaskForOp(serviceTask, patMedInhospList.get(0), patMedOperation, patMedOperationItem, patArchive, config); |
| | | ServiceSubtask serviceSubtask = boxedServiceSubtaskForOp(serviceTask, patMedInhospList.get(0), patMedOperationItem, patArchive, config); |
| | | if (ObjectUtils.isEmpty(serviceSubtask)) { |
| | | return; |
| | | } |
| | | serviceSubtask.setVisitDeptCode(patMedOperation.getReqdeptcode()); |
| | | serviceSubtask.setVisitDeptName(patMedOperation.getReqdeptname()); |
| | | if(StringUtils.isNotEmpty(patMedOperationItem.getDeptcode())){ |
| | | serviceSubtask.setVisitDeptCode(patMedOperationItem.getDeptcode()); |
| | | serviceSubtask.setVisitDeptName(patMedOperationItem.getDeptname()); |
| | | }else { |
| | | serviceSubtask.setVisitDeptCode(patMedOperationItem.getHospitaldistrictcode()); |
| | | serviceSubtask.setVisitDeptName(patMedOperationItem.getHospitaldistrictname()); |
| | | } |
| | | //记录insertServiceSubtask语句返回状态 |
| | | Integer i = 0; |
| | | try { |
| | |
| | | //说明该患者是被过滤的,不用再执行了 |
| | | serviceSubtask.setCreateBy(serviceTask.getCreateBy()); |
| | | serviceSubtask.setCreateTime(new Date()); |
| | | serviceSubtask.setSendstate(4L); |
| | | i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask); |
| | | } else { |
| | | if (StringUtils.isEmpty(serviceSubtask.getPhone())) { |
| | |
| | | serviceSubtask.setLeavehospitaldistrictname(patMedInhosp1.getHospitaldistrictname()); |
| | | } |
| | | serviceSubtask.setLeaveicd10code(patMedInhosp1.getLeaveicd10code()); |
| | | serviceSubtask.setLeavediagname(patMedInhosp1.getDiagname()); |
| | | serviceSubtask.setLeavediagname(patMedInhosp1.getLeavediagname()); |
| | | serviceSubtask.setDiagname(patMedInhosp1.getDiagname()); |
| | | serviceSubtask.setTemplateid(serviceTask.getTemplateid()); |
| | | serviceSubtask.setTemplatename(serviceTask.getTemplatename()); |
| | | serviceSubtask.setPatid(patArchive.getId()); |
| | |
| | | } |
| | | |
| | | } |
| | | //如果患者的入院和出院时间一致,可以不用随访(南华附一肿瘤一病区提出) |
| | | if (active.equals("nhfy") && patMedInhosp1.getStarttime() != null && patMedInhosp1.getEndtime() != null && DateUtils.differentDaysByMillisecond(patMedInhosp1.getStarttime(), patMedInhosp1.getEndtime()) == 0) { |
| | | serviceSubtask.setRemark("患者当天出院,不用随访"); |
| | | serviceSubtask.setResult("error"); |
| | | //不执行 |
| | | serviceSubtask.setSendstate(4L); |
| | | } |
| | | |
| | | //患者发送时间 |
| | | if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) { |
| | |
| | | } |
| | | |
| | | //封装serviceSubtask |
| | | private ServiceSubtask boxedServiceSubtaskForOp(ServiceTask serviceTask, PatMedInhosp patMedInhosp1, PatMedOperation patMedOperation, PatMedOperationItem patMedOperationItem, PatArchive patArchive, String config) { |
| | | private ServiceSubtask boxedServiceSubtaskForOp(ServiceTask serviceTask, PatMedInhosp patMedInhosp1, PatMedOperationItem patMedOperationItem, PatArchive patArchive, String config) { |
| | | ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTask, ServiceSubtask.class); |
| | | serviceSubtask.setTaskid(serviceTask.getTaskid()); |
| | | if (StringUtils.isNotEmpty(serviceTask.getLibtemplateid())) |
| | | serviceSubtask.setLibtemplateid(Long.valueOf(serviceTask.getLibtemplateid())); |
| | | serviceSubtask.setNurseId(patMedOperation.getNurseId()); |
| | | serviceSubtask.setNurseName(patMedOperation.getNurseName()); |
| | | serviceSubtask.setNurseId(patMedOperationItem.getNurseId()); |
| | | serviceSubtask.setNurseName(patMedOperationItem.getNurseName()); |
| | | // serviceSubtask.setInhospid(patMedInhosp.getInhospid()); |
| | | serviceSubtask.setDrcode(patMedOperation.getDrcode()); |
| | | serviceSubtask.setDrname(patMedOperation.getDrname()); |
| | | serviceSubtask.setDeptcode(patMedOperation.getDeptcode()); |
| | | serviceSubtask.setDeptname(patMedOperation.getDeptname()); |
| | | serviceSubtask.setDrcode(patMedOperationItem.getDrcode()); |
| | | serviceSubtask.setDrname(patMedOperationItem.getDrname()); |
| | | serviceSubtask.setDeptcode(patMedOperationItem.getDeptcode()); |
| | | serviceSubtask.setDeptname(patMedOperationItem.getDeptname()); |
| | | |
| | | serviceSubtask.setTemplateid(serviceTask.getTemplateid()); |
| | | serviceSubtask.setTemplatename(serviceTask.getTemplatename()); |
| | |
| | | serviceSubtask.setSex(patArchive.getSex()); |
| | | serviceSubtask.setAge(patArchive.getAge()); |
| | | serviceSubtask.setSendstate(2L); |
| | | serviceSubtask.setManagementDoctor(patMedOperation.getDrname()); |
| | | serviceSubtask.setManagementDoctorCode(patMedOperation.getDrcode()); |
| | | serviceSubtask.setManagementDoctor(patMedOperationItem.getDrname()); |
| | | serviceSubtask.setManagementDoctorCode(patMedOperationItem.getDrcode()); |
| | | // serviceSubtask.setStarttime(patMedInhosp.getStarttime()); |
| | | // serviceSubtask.setEndtime(patMedInhosp.getEndtime()); |
| | | |
| | |
| | | serviceSubtask.setHospType("2"); |
| | | serviceSubtask.setCreateTime(new Date()); |
| | | serviceSubtask.setUpdateTime(new Date()); |
| | | serviceSubtask.setCreateBy(patMedOperation.getNurseName()); |
| | | serviceSubtask.setCreateBy(patMedOperationItem.getNurseName()); |
| | | // serviceSubtask.setLeavehospitaldistrictcode(patArchive.getLeavehospitaldistrictcode()); |
| | | // serviceSubtask.setLeavehospitaldistrictname(patArchive.getLeavehospitaldistrictname()); |
| | | serviceSubtask.setOperationItemId(patMedOperationItem.getId()); |
| | | serviceSubtask.setUpdateBy(serviceTask.getUpdateBy()); |
| | | serviceSubtask.setUpdateTime(new Date()); |
| | | |
| | | //todo |
| | | //设置发送时间 |
| | | if (serviceTask.getSendDay() == null) serviceTask.setSendDay(1L); |
| | | Date newDate = null; |
| | |
| | | } |
| | | } |
| | | |
| | | private void addOperationSubTask(String config) { |
| | | @Override |
| | | public void addOperationSubTask(String config) { |
| | | // 手术随访 |
| | | PatMedOperationItem pmoi = new PatMedOperationItem(); |
| | | //获取需要出院疾病随访,未处理的数据 |
| | | pmoi.setOpercheckFlag("0"); |
| | | pmoi.setMainFlag("1"); |
| | | |
| | | List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectPatMedOperationItemList(pmoi); |
| | | List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectOperationItemList(pmoi); |
| | | log.info("dealOutHospInfo需要处理的出院手术患者信息:{}", CollectionUtils.isNotEmpty(patMedOperationItems) ? patMedOperationItems.size() : null); |
| | | |
| | | for (PatMedOperationItem opItem : patMedOperationItems) { |
| | |
| | | serviceTaskoper.setLongtask(1L); |
| | | serviceTaskoper.setOrgid(opItem.getOrgid()); |
| | | serviceTaskoper.setOplevelcode(opItem.getOplevelcode()); |
| | | |
| | | //根据科室、病区过滤 |
| | | serviceTaskoper.setDeptCode(opItem.getDeptcode()); |
| | | serviceTaskoper.setWardCode(opItem.getHospitaldistrictcode()); |
| | | |
| | | List<ServiceTaskoper> serviceTaskopers = serviceTaskoperMapper.selectServiceTaskoperList(serviceTaskoper); |
| | | //如果部门模板为空(将deptIsNull设置为true) |
| | |
| | | e.printStackTrace(); |
| | | log.error("人员手术处理出异常了:{}", e.getMessage()); |
| | | opItem.setOpercheckFlag("2"); |
| | | opItem.setLongTaskReason("人员手术处理异常:" + e.getMessage()); |
| | | opItem.setLongTaskReason("人员手术处理异常"); |
| | | patMedOperationItemMapper.updatePatMedOperationItem(opItem); |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | log.error("人员疾病处理出异常了:{}", e.getMessage()); |
| | | pmiJB.setDiagcheckFlag("2"); |
| | | pmiJB.setLongTaskReason("人员疾病处理异常:" + e.getMessage()); |
| | | pmiJB.setLongTaskReason("人员疾病处理异常"); |
| | | patMedInhospMapper.updatePatMedInhosp(pmiJB); |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | log.error("人员病区处理出异常了:{}", e.getMessage()); |
| | | pmiBQ1.setWardcheckFlag("2"); |
| | | pmiBQ1.setLongTaskReason("人员病区处理异常:" + e.getMessage()); |
| | | pmiBQ1.setLongTaskReason("人员病区处理异常"); |
| | | patMedInhospMapper.updatePatMedInhosp(pmiBQ1); |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | log.error("人员科室处理出异常了:{}", e.getMessage()); |
| | | patMedInhosp1.setDeptcheckFlag("2"); |
| | | patMedInhosp1.setLongTaskReason("人员科室处理异常:" + e.getMessage()); |
| | | patMedInhosp1.setLongTaskReason("人员科室处理异常"); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | } |
| | | } |
| | |
| | | int primaryGeneratedCount = deptGenCount + wardGenCount + diagGenCount; |
| | | log.info("【基于规则】首要规则执行结果: deptGen={}, wardGen={}, diagGen={}, total={}", deptGenCount, wardGenCount, diagGenCount, primaryGeneratedCount); |
| | | |
| | | String remark = patMedInhosp1.getRemark(); |
| | | // 第二步:判断首要规则是否有任意一个生成成功 |
| | | if (primaryGeneratedCount > 0) { |
| | | // 至少有一个首要规则生成成功 |
| | | // —— 将=2的次要规则对应flag设为"2"(跳过) |
| | | log.info("【基于规则】首要规则有成功(count={}),将次要规则对应flag设为2", primaryGeneratedCount); |
| | | if (deptIsSecondary) { |
| | | updateCheckFlag(patMedInhosp1, 1, "2", "首要规则已生成,次要规则跳过"); |
| | | updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark) ? remark + ";首要规则已生成,次要规则跳过" : "首要规则已生成,次要规则跳过"); |
| | | } |
| | | if (!active.equals("xh")) { |
| | | if (wardIsSecondary) { |
| | | updateCheckFlag(patMedInhosp1, 2, "2", "首要规则已生成,次要规则跳过"); |
| | | updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark) ? remark + ";首要规则已生成,次要规则跳过" : "首要规则已生成,次要规则跳过"); |
| | | } |
| | | if (diagIsSecondary) { |
| | | updateCheckFlag(patMedInhosp1, 3, "2", "首要规则已生成,次要规则跳过"); |
| | | updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark) ? remark + ";首要规则已生成,次要规则跳过" : "首要规则已生成,次要规则跳过"); |
| | | } |
| | | } |
| | | // —— 对于=1且生成成功的,将其对应flag设为"1" |
| | | if (deptIsPrimary && deptGenCount > 0) { |
| | | updateCheckFlag(patMedInhosp1, 1, "1", "科室首要规则生成成功"); |
| | | updateCheckFlag(patMedInhosp1, 1, "1", StringUtils.isNotEmpty(remark) ? remark + ";科室首要规则生成成功" : "科室首要规则生成成功"); |
| | | } |
| | | if (!active.equals("xh")) { |
| | | if (wardIsPrimary && wardGenCount > 0) { |
| | | updateCheckFlag(patMedInhosp1, 2, "1", "病区首要规则生成成功"); |
| | | updateCheckFlag(patMedInhosp1, 2, "1", StringUtils.isNotEmpty(remark) ? remark + ";病区首要规则生成成功" : "病区首要规则生成成功"); |
| | | } |
| | | if (diagIsPrimary && diagGenCount > 0) { |
| | | updateCheckFlag(patMedInhosp1, 3, "1", "疾病首要规则生成成功"); |
| | | updateCheckFlag(patMedInhosp1, 3, "1", StringUtils.isNotEmpty(remark) ? remark + ";疾病首要规则生成成功" : "疾病首要规则生成成功"); |
| | | } |
| | | } |
| | | // —— 对于=1但生成失败的,将其对应flag设为"2" |
| | | if (deptIsPrimary && deptGenCount == 0) { |
| | | updateCheckFlag(patMedInhosp1, 1, "2", "科室首要规则生成失败"); |
| | | updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark) ? remark + ";科室首要规则生成失败" : "科室首要规则生成失败"); |
| | | } |
| | | if (!active.equals("xh")) { |
| | | if (wardIsPrimary && wardGenCount == 0) { |
| | | updateCheckFlag(patMedInhosp1, 2, "2", "病区首要规则生成失败"); |
| | | updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark) ? remark + ";病区首要规则生成失败" : "病区首要规则生成失败"); |
| | | } |
| | | if (diagIsPrimary && diagGenCount == 0) { |
| | | updateCheckFlag(patMedInhosp1, 3, "2", "疾病首要规则生成失败"); |
| | | updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark) ? remark + ";疾病首要规则生成失败" : "疾病首要规则生成失败"); |
| | | } |
| | | } |
| | | } else { |
| | | // 所有首要规则全部失败,将=1的flag设为"2",然后执行=2的方法 |
| | | log.info("【基于规则】首要规则全部失败,将=1的flag设为2,开始执行次要规则"); |
| | | if (deptIsPrimary) { |
| | | updateCheckFlag(patMedInhosp1, 1, "2", "科室首要规则全部失败"); |
| | | updateCheckFlag(patMedInhosp1, 1, "2", StringUtils.isNotEmpty(remark) ? remark + ";科室首要规则全部失败" : "科室首要规则全部失败"); |
| | | } |
| | | if (!active.equals("xh")) { |
| | | if (wardIsPrimary) { |
| | | updateCheckFlag(patMedInhosp1, 2, "2", "病区首要规则全部失败"); |
| | | updateCheckFlag(patMedInhosp1, 2, "2", StringUtils.isNotEmpty(remark) ? remark + ";病区首要规则全部失败" : "病区首要规则全部失败"); |
| | | } |
| | | if (diagIsPrimary) { |
| | | updateCheckFlag(patMedInhosp1, 3, "2", "疾病首要规则全部失败"); |
| | | updateCheckFlag(patMedInhosp1, 3, "2", StringUtils.isNotEmpty(remark) ? remark + ";疾病首要规则全部失败" : "疾病首要规则全部失败"); |
| | | } |
| | | } |
| | | // 执行次要规则(=2)的方法 |
| | |
| | | e.printStackTrace(); |
| | | log.error("【基于规则】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage()); |
| | | patMedInhosp1.setDeptcheckFlag("2"); |
| | | patMedInhosp1.setLongTaskReason("基于规则处理异常:" + e.getMessage()); |
| | | patMedInhosp1.setLongTaskReason("基于规则处理异常"); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | log.error("【科室任务】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage()); |
| | | patMedInhosp1.setDeptcheckFlag("2"); |
| | | patMedInhosp1.setLongTaskReason("科室任务处理异常:" + e.getMessage()); |
| | | patMedInhosp1.setLongTaskReason("科室任务处理异常"); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | } |
| | | return generatedCount; |
| | |
| | | e.printStackTrace(); |
| | | log.error("【病区任务】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage()); |
| | | patMedInhosp1.setWardcheckFlag("2"); |
| | | patMedInhosp1.setLongTaskReason("病区任务处理异常:" + e.getMessage()); |
| | | patMedInhosp1.setLongTaskReason("病区任务处理异常"); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | } |
| | | return generatedCount; |
| | |
| | | e.printStackTrace(); |
| | | log.error("【疾病任务】患者{}处理异常:{}", patMedInhosp1.getInhospid(), e.getMessage()); |
| | | patMedInhosp1.setDiagcheckFlag("2"); |
| | | patMedInhosp1.setLongTaskReason("疾病任务处理异常:" + e.getMessage()); |
| | | patMedInhosp1.setLongTaskReason("疾病任务处理异常"); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp1); |
| | | } |
| | | return generatedCount; |