| | |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.common.ScheduleSubtaskBuilder; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.DTO.PatMedInhospDTO; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IPatMedInhospService; |
| | |
| | | @Autowired |
| | | private ServiceSubtaskPreachformMapper serviceSubtaskPreachformMapper; |
| | | @Autowired |
| | | private PatMedOperationMapper patMedOperationMapper; |
| | | private ServiceTaskmedicalMapper serviceTaskmedicalMapper; |
| | | @Autowired |
| | | private PatMedOperationItemMapper patMedOperationItemMapper; |
| | | @Autowired |
| | |
| | | private String active; |
| | | @Autowired |
| | | private IConfigService iSysConfigService; |
| | | @Autowired |
| | | private ServiceTaskScheduleMapper serviceTaskScheduleMapper; |
| | | |
| | | @Autowired |
| | | private ScheduleSubtaskBuilder scheduleSubtaskBuilder; |
| | | @Autowired |
| | | private ServiceTaskScheduleDetailMapper serviceTaskScheduleDetailMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | patMedInhosp1.setTagname(tagname); |
| | | } |
| | | return patMedInhospList; |
| | | } |
| | | |
| | | @Override |
| | | public List<PatMedInhospDTO> selectPatMedInhospByApplication(PatMedInhosp patMedInhosp) { |
| | | List<PatMedInhosp> patMedInhosps = selectPatMedInhospList(patMedInhosp); |
| | | if (!org.springframework.util.CollectionUtils.isEmpty(patMedInhosps)) { |
| | | return null; |
| | | } |
| | | List<PatMedInhospDTO> patMedInhospDTOList = DtoConversionUtils.sourceToTarget(patMedInhosps, PatMedInhospDTO.class); |
| | | for (PatMedInhospDTO pmd : patMedInhospDTOList) { |
| | | ServiceSubtaskEntity serviceSubtask = new ServiceSubtaskEntity(); |
| | | serviceSubtask.setServiceType("4"); |
| | | serviceSubtask.setInhospid(pmd.getInhospid()); |
| | | List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtask); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtasks)) pmd.setFinishFlag("1"); |
| | | } |
| | | |
| | | return patMedInhospDTOList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public int dealOutHospInfo(String config) { |
| | | PatMedInhosp pmks = new PatMedInhosp(); |
| | | pmks.setDeptcheckFlag("0"); |
| | | pmks.setInhospstate("1"); |
| | | pmks.setFuflag("1"); |
| | | List<PatMedInhosp> patMedInhosps = patMedInhospMapper.selectPatMedInhospList(pmks); |
| | | |
| | | //1.入院宣教 |
| | | String helibrarySwitch = iSysConfigService.selectConfigByKey("in.helibrary.switch"); |
| | | if (StringUtils.isNotEmpty(helibrarySwitch) && "2".equals(helibrarySwitch)) { |
| | | PatMedInhosp inhosp = new PatMedInhosp(); |
| | | inhosp.setInDeptcheckFlag("0"); |
| | | inhosp.setInhospstate("0"); |
| | | inhosp.setFuflag("1"); |
| | | List<PatMedInhosp> inPatMedInhosps = patMedInhospMapper.selectPatMedInhospList(inhosp); |
| | | |
| | | //1.1 科室 |
| | | for (PatMedInhosp patMedInhosp1 : inPatMedInhosps) { |
| | | for (PatMedInhosp patMedInhosp1 : patMedInhosps) { |
| | | //获取患者信息 |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp1.getPatid()); |
| | | if (Objects.isNull(patArchive)) { |
| | |
| | | |
| | | |
| | | //1.2 病区 |
| | | inhosp.setInDeptcheckFlag(null); |
| | | inhosp.setInWardcheckFlag("0"); |
| | | List<PatMedInhosp> inPatMedInhospsWard = patMedInhospMapper.selectPatMedInhospList(inhosp); |
| | | pmks.setInDeptcheckFlag(null); |
| | | pmks.setInWardcheckFlag("0"); |
| | | pmks.setDeptcheckFlag(null); |
| | | List<PatMedInhosp> inPatMedInhospsWard = patMedInhospMapper.selectPatMedInhospList(pmks); |
| | | for (PatMedInhosp patMedInhosp1 : inPatMedInhospsWard) { |
| | | //获取患者信息 |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp1.getPatid()); |
| | |
| | | } |
| | | } |
| | | |
| | | //2.出院随访 - 基于规则的任务生成 |
| | | addSubTaskByRule(config); |
| | | //根据患者所在病区,获取该病区的长期任务,新华医院可以先不用根据病区和疾病来做 |
| | | //2.药品宣教 |
| | | for (PatMedInhosp patMedInhosp : patMedInhosps) { |
| | | String medicalCode = patMedInhosp.getMedicalCode(); |
| | | if (StringUtils.isNotEmpty(medicalCode)) { |
| | | String[] split = medicalCode.split(","); |
| | | // 防御性编程:确保 medicalCompany 和 medicalName 不为 null |
| | | String medicalCompanyStr = patMedInhosp.getMedicalCompany() != null ? patMedInhosp.getMedicalCompany() : ""; |
| | | String medicalNameStr = patMedInhosp.getMedicalName() != null ? patMedInhosp.getMedicalName() : ""; |
| | | String[] medicalCompanyArray = medicalCompanyStr.split(","); |
| | | String[] medicalNameArray = medicalNameStr.split(","); |
| | | |
| | | for (int i = 0; i < split.length; i++) { |
| | | ServiceTaskmedical serviceTaskmedical = new ServiceTaskmedical(); |
| | | //拿药品编码和公司去查 |
| | | serviceTaskmedical.setMedicalCode(split[i]); |
| | | // 防止下标越界:如果数组长度不一致,取最小长度 |
| | | if (i < medicalCompanyArray.length) { |
| | | serviceTaskmedical.setMedicalName(medicalCompanyArray[i]); |
| | | } else { |
| | | log.warn("【药品宣教】药品编码{}对应的公司信息下标越界,medicalCompany 数组长度={}, 当前索引={}", split[i], medicalCompanyArray.length, i); |
| | | serviceTaskmedical.setMedicalName(""); // 越界时设置为空 |
| | | } |
| | | List<ServiceTaskmedical> serviceTaskmedicals = serviceTaskmedicalMapper.selectServiceTaskmedicalList(serviceTaskmedical); |
| | | if (CollectionUtils.isNotEmpty(serviceTaskmedicals)) { |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp.getPatid()); |
| | | writeInSubTask(serviceTaskmedicals.get(0).getTaskId(), false, patMedInhosp, patArchive, 0, config); |
| | | } |
| | | //查不到的药品就是不需要宣教的,就不管了 |
| | | } |
| | | } |
| | | } |
| | | |
| | | //3.出院随访 - 基于规则的任务生成 |
| | | // 获取所有需要处理的出院患者(科室维度未处理) |
| | | |
| | | addSubTaskByRule(config, patMedInhosps); |
| | | if (!active.equals("xh")) { |
| | | addOperationSubTask(config); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 多维度随访 |
| | | * 任务组随访 |
| | | * |
| | | * @param config |
| | | * @return |
| | | */ |
| | | public int dealOutHospInfoByDimension(String config) { |
| | | // 一次性查出所有需要处理的出院患者(三个维度任意一个未完成) |
| | | List<PatMedInhosp> patList = patMedInhospMapper.selectNeedProcessList(); |
| | | log.info("【统一扫描】待处理患者数:{}", patList.size()); |
| | | public int dealOutHospInfoBySchedule(String config) { |
| | | |
| | | for (PatMedInhosp patMedInhosp1 : patList) { |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp1.getPatid()); |
| | | if (Objects.isNull(patArchive)) { |
| | | // 三个维度都标记为失败 |
| | | markAllFlagsAsError(patMedInhosp1, "患者基本信息为空"); |
| | | continue; |
| | | } |
| | | ServiceTask serviceTaskVo = new ServiceTask(); |
| | | serviceTaskVo.setLongTask(1); |
| | | serviceTaskVo.setAppltype("5"); |
| | | List<ServiceTask> serviceTasks = serviceTaskMapper.selectServiceTaskList(serviceTaskVo); |
| | | |
| | | // ── 维度1:科室 ── |
| | | if ("0".equals(patMedInhosp1.getDeptcheckFlag())) { |
| | | processTasksByDimension(patMedInhosp1, patArchive, config, 1); |
| | | } |
| | | if (CollectionUtils.isNotEmpty(serviceTasks)) { |
| | | for (ServiceTask serviceTask : serviceTasks) { |
| | | if(!ObjectUtils.isEmpty(serviceTask.getTaskid())){ |
| | | ServiceTaskSchedule serviceTaskSchedule = new ServiceTaskSchedule(); |
| | | ServiceTaskSchedule taskSchedule = new ServiceTaskSchedule(); |
| | | taskSchedule.setTaskid(serviceTask.getTaskid()); |
| | | List<ServiceTaskSchedule> serviceTaskSchedules = serviceTaskScheduleMapper.selectServiceTaskScheduleList(taskSchedule); |
| | | if(CollectionUtils.isNotEmpty(serviceTaskSchedules)){ |
| | | serviceTaskSchedule = serviceTaskSchedules.get(0); |
| | | String deptCodes = serviceTaskSchedule.getDeptCodes(); |
| | | String wardCodes = serviceTaskSchedule.getWardCodes(); |
| | | String icd10Codes = serviceTaskSchedule.getIcd10Codes(); |
| | | String opLevelCodes = serviceTaskSchedule.getOplevelCodes(); |
| | | |
| | | // ── 维度2:病区 ──(新华医院跳过) |
| | | if (!active.equals("xh") && "0".equals(patMedInhosp1.getWardcheckFlag())) { |
| | | processTasksByDimension(patMedInhosp1, patArchive, config, 2); |
| | | } |
| | | List<String> icd10CodeList = new ArrayList<>(); |
| | | List<String> opLevelCodeList = new ArrayList<>(); |
| | | List<String> deptCodeList = new ArrayList<>(); |
| | | List<String> wardCodeList = new ArrayList<>(); |
| | | |
| | | // ── 维度3:疾病 ──(新华医院跳过) |
| | | if (!active.equals("xh") && "0".equals(patMedInhosp1.getDiagcheckFlag())) { |
| | | processTasksByDimension(patMedInhosp1, patArchive, config, 3); |
| | | /** |
| | | * 随访类型(1-科室,2-病区,3-疾病 4-入院科室 5-入院病区 6-手术) |
| | | */ |
| | | Integer type = 1; |
| | | if (StringUtils.isNotEmpty(deptCodes)) { |
| | | type = 1; |
| | | deptCodeList = new ArrayList<>(Arrays.asList(deptCodes.split(","))); |
| | | } |
| | | if(StringUtils.isNotEmpty(wardCodes)) { |
| | | type = 2; |
| | | wardCodeList = new ArrayList<>(Arrays.asList(wardCodes.split(","))); |
| | | } |
| | | if(StringUtils.isNotEmpty(icd10Codes)) { |
| | | type = 3; |
| | | icd10CodeList = new ArrayList<>(Arrays.asList(icd10Codes.split(","))); |
| | | } |
| | | if (StringUtils.isNotEmpty(opLevelCodes)) { |
| | | type = 6; |
| | | opLevelCodeList = new ArrayList<>(Arrays.asList(opLevelCodes.split(","))); |
| | | } |
| | | //非手术处理方式 |
| | | if(type != 6){ |
| | | PatMedInhosp patMedInhospVo = new PatMedInhosp(); |
| | | patMedInhospVo.setScheduleCheckFlag("0"); |
| | | patMedInhospVo.setInhospstate("1"); |
| | | patMedInhospVo.setFuflag("1"); |
| | | // patMedInhospVo.setDeptcodeList(deptCodeList); |
| | | patMedInhospVo.setLeaveldeptcodes(deptCodeList); |
| | | patMedInhospVo.setLeavehospitaldistrictcodes(wardCodeList); |
| | | patMedInhospVo.setIcd10codeList(icd10CodeList); |
| | | List<PatMedInhosp> patList = patMedInhospMapper.selectPatMedInhospList(patMedInhospVo); |
| | | log.info("dealOutHospInfoBySchedule 任务组随访, taskid = {}, 扫描患者人数 {}", serviceTask.getTaskid(), patList.size()); |
| | | |
| | | for(PatMedInhosp patMedInhosp : patList){ |
| | | ServiceTaskScheduleDetail scheduleDetailVo = new ServiceTaskScheduleDetail(); |
| | | scheduleDetailVo.setTaskid(serviceTask.getTaskid()); |
| | | scheduleDetailVo.setScheduleid(serviceTaskSchedule.getId()); |
| | | List<ServiceTaskScheduleDetail> serviceTaskScheduleDetails = serviceTaskScheduleDetailMapper.selectServiceTaskScheduleDetailList(scheduleDetailVo); |
| | | |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp.getPatid()); |
| | | if (Objects.isNull(patArchive)) { |
| | | continue; |
| | | } |
| | | //封装serviceSubtask |
| | | |
| | | ServiceSubtask serviceSubtask = boxedServiceSubtask(serviceTask, patMedInhosp, patArchive, config, type); |
| | | List<Map<String, Object>> preachformList = new ArrayList<>(); |
| | | if(StringUtils.isNotEmpty(serviceTask.getPreachformDesc())){ |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | preachformList = objectMapper.readValue(serviceTask.getPreachformDesc(), List.class); |
| | | }catch (Exception e){ |
| | | log.error("任务组preachformDesc解析失败,taskid={},inhospid={}", serviceTask.getTaskid(), patMedInhosp.getInhospid()); |
| | | } |
| | | } |
| | | scheduleSubtaskBuilder.buildSubtasksForPatient(serviceTask, serviceTaskSchedule, serviceTaskScheduleDetails, serviceSubtask, preachformList); |
| | | //置首轮纳入标记,避免下次扫描重复生成(后续轮次由 rollTaskGroupCycle 负责) |
| | | PatMedInhosp flagUpd = new PatMedInhosp(); |
| | | flagUpd.setInhospid(patMedInhosp.getInhospid()); |
| | | flagUpd.setScheduleCheckFlag("1"); |
| | | patMedInhospMapper.updatePatMedInhosp(flagUpd); |
| | | } |
| | | }else { |
| | | //任务组 - 手术随访 |
| | | if(CollectionUtils.isNotEmpty(opLevelCodeList)){ |
| | | PatMedOperationItem pmoi = new PatMedOperationItem(); |
| | | //获取需要出院疾病随访,未处理的数据 |
| | | pmoi.setOpercheckFlag("0"); |
| | | pmoi.setMainFlag("1"); |
| | | pmoi.setDeptCodes(deptCodeList); |
| | | pmoi.setWardCodes(wardCodeList); |
| | | pmoi.setOpLevelCodes(opLevelCodeList); |
| | | List<PatMedOperationItem> patMedOperationItems = patMedOperationItemMapper.selectOperationItemList(pmoi); |
| | | for(PatMedOperationItem patMedOperationItem : patMedOperationItems){ |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOperationItem.getPatid()); |
| | | if (Objects.isNull(patArchive)) { |
| | | continue; |
| | | } |
| | | PatMedInhosp patMedInhospVo = new PatMedInhosp(); |
| | | patMedInhospVo.setPatid((patMedOperationItem.getPatid())); |
| | | patMedInhospVo.setScheduleCheckFlag("0"); |
| | | patMedInhospVo.setInhospstate("1"); |
| | | patMedInhospVo.setFuflag("1"); |
| | | List<PatMedInhosp> patMedInhospList = patMedInhospMapper.selectPatMedInhospList(patMedInhospVo); |
| | | if(CollectionUtils.isNotEmpty(patMedInhospList)){ |
| | | ServiceTaskScheduleDetail scheduleDetailVo = new ServiceTaskScheduleDetail(); |
| | | scheduleDetailVo.setTaskid(serviceTask.getTaskid()); |
| | | scheduleDetailVo.setScheduleid(serviceTaskSchedule.getId()); |
| | | List<ServiceTaskScheduleDetail> serviceTaskScheduleDetails = serviceTaskScheduleDetailMapper.selectServiceTaskScheduleDetailList(scheduleDetailVo); |
| | | //封装serviceSubtask |
| | | ServiceSubtask serviceSubtask = boxedServiceSubtaskForOp(serviceTask, patMedInhospList.get(0), patMedOperationItem, patArchive, config); |
| | | List<Map<String, Object>> preachformList = new ArrayList<>(); |
| | | if(StringUtils.isNotEmpty(serviceTask.getPreachformDesc())){ |
| | | try { |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | preachformList = objectMapper.readValue(serviceTask.getPreachformDesc(), List.class); |
| | | }catch (Exception e){ |
| | | log.error("任务组(手术)preachformDesc解析失败,taskid={}", serviceTask.getTaskid()); |
| | | } |
| | | } |
| | | scheduleSubtaskBuilder.buildSubtasksForPatient(serviceTask, serviceTaskSchedule, serviceTaskScheduleDetails, serviceSubtask, preachformList); |
| | | //置首轮纳入标记,避免重复生成 |
| | | PatMedInhosp flagUpd = new PatMedInhosp(); |
| | | flagUpd.setInhospid(patMedInhospList.get(0).getInhospid()); |
| | | flagUpd.setScheduleCheckFlag("1"); |
| | | patMedInhospMapper.updatePatMedInhosp(flagUpd); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 按维度找到所有匹配长期任务,批量生成 subtask |
| | | * type: 1=科室, 2=病区, 3=疾病 |
| | | */ |
| | | private void processTasksByDimension(PatMedInhosp patMedInhosp1, PatArchive patArchive, String config, int type) { |
| | | List<Long> matchedTaskIds = findMatchingTaskIds(patMedInhosp1, type); |
| | | |
| | | if (CollectionUtils.isEmpty(matchedTaskIds)) { |
| | | String reason = getDimensionReason(type); |
| | | markFlagAsNoConfig(patMedInhosp1, type, reason); |
| | | return; |
| | | } |
| | | |
| | | // 一条 inhosp 记录 → 多个匹配任务 → 多条 subtask |
| | | for (Long taskId : matchedTaskIds) { |
| | | writeInSubTask(taskId, true, patMedInhosp1, patArchive, type, config); |
| | | } |
| | | } |
| | | |
| | | private String getDimensionReason(int type) { |
| | | switch (type) { |
| | | case 1: { // 科室 |
| | | return "未找到科室匹配的长期任务"; |
| | | } |
| | | case 2: { // 病区 |
| | | return "未找到病区匹配的长期任务"; |
| | | } |
| | | case 3: { // 疾病 |
| | | return "未找到疾病匹配的长期任务"; |
| | | } |
| | | } |
| | | return "多维长期任务-匹配类型为空"; |
| | | } |
| | | |
| | | private void markFlagAsNoConfig(PatMedInhosp patMedInhosp, int type, String reason) { |
| | | switch (type) { |
| | | case 1: { // 科室 |
| | | patMedInhosp.setDeptcheckFlag("2"); |
| | | patMedInhosp.setRemark(reason); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp); |
| | | break; |
| | | } |
| | | case 2: { // 病区 |
| | | patMedInhosp.setWardcheckFlag("2"); |
| | | patMedInhosp.setRemark(reason); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp); |
| | | break; |
| | | } |
| | | case 3: { // 疾病 |
| | | patMedInhosp.setDiagcheckFlag("2"); |
| | | patMedInhosp.setRemark(reason); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | private void markAllFlagsAsError(PatMedInhosp patMedInhosp, String reason) { |
| | | patMedInhosp.setDeptcheckFlag("2"); |
| | | patMedInhosp.setWardcheckFlag("2"); |
| | | patMedInhosp.setDiagcheckFlag("2"); |
| | | patMedInhosp.setRemark(reason); |
| | | patMedInhospMapper.updatePatMedInhosp(patMedInhosp); |
| | | } |
| | | |
| | | /** |
| | | * 根据维度类型查询匹配的长期任务 ID 列表 |
| | | */ |
| | | private List<Long> findMatchingTaskIds(PatMedInhosp patMedInhosp1, int type) { |
| | | switch (type) { |
| | | case 1: { // 科室 |
| | | ServiceTaskdept query = new ServiceTaskdept(); |
| | | query.setLongtask(1L); |
| | | query.setDeptCode(patMedInhosp1.getLeaveldeptcode()); |
| | | query.setDeptType("1"); |
| | | query.setOrgid(patMedInhosp1.getOrgid()); |
| | | return serviceTaskdeptMapper.selectServiceTaskdeptList(query).stream().map(ServiceTaskdept::getTaskId).collect(Collectors.toList()); |
| | | } |
| | | case 2: { // 病区 |
| | | ServiceTaskdept query = new ServiceTaskdept(); |
| | | query.setLongtask(1L); |
| | | query.setDeptCode(patMedInhosp1.getLeavehospitaldistrictcode()); |
| | | query.setDeptType("2"); |
| | | query.setOrgid(patMedInhosp1.getOrgid()); |
| | | return serviceTaskdeptMapper.selectServiceTaskdeptList(query).stream().map(ServiceTaskdept::getTaskId).collect(Collectors.toList()); |
| | | } |
| | | case 3: { // 疾病 |
| | | if (StringUtils.isEmpty(patMedInhosp1.getLeaveicd10code())) return Collections.emptyList(); |
| | | ServiceTaskdiag query = new ServiceTaskdiag(); |
| | | query.setLongtask(1L); |
| | | query.setIcd10code(patMedInhosp1.getLeaveicd10code()); |
| | | query.setOrgid(patMedInhosp1.getOrgid()); |
| | | return serviceTaskdiagMapper.selectServiceTaskdiagList(query).stream().map(ServiceTaskdiag::getTaskId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | |
| | |
| | | * @param check 是否需要校验 |
| | | * @param patMedInhosp1 病人出入院信息 |
| | | * @param patArchive 病人信息 |
| | | * @param type 随访类型(1-科室,2-病区,3-疾病 4-入院科室 5-入院病区) |
| | | * @param type 随访类型(0-宣教,1-科室,2-病区,3-疾病 4-入院科室 5-入院病区) |
| | | * @param config 配置信息 visit.early.day |
| | | */ |
| | | //将患者放到subtask中 |
| | |
| | | if (ObjectUtils.isEmpty(serviceSubtask)) { |
| | | return; |
| | | } |
| | | if(StringUtils.isNotEmpty(patMedOperationItem.getDeptcode())){ |
| | | serviceSubtask.setVisitDeptCode(patMedOperationItem.getDeptcode()); |
| | | serviceSubtask.setVisitDeptName(patMedOperationItem.getDeptname()); |
| | | }else { |
| | | serviceSubtask.setVisitDeptCode(patMedOperationItem.getHospitaldistrictcode()); |
| | | serviceSubtask.setVisitDeptName(patMedOperationItem.getHospitaldistrictname()); |
| | | if (StringUtils.isNotEmpty(patMedOperationItem.getLeaveldeptcode())) { |
| | | serviceSubtask.setVisitDeptCode(patMedOperationItem.getLeaveldeptcode()); |
| | | serviceSubtask.setVisitDeptName(patMedOperationItem.getLeaveldeptname()); |
| | | } else { |
| | | serviceSubtask.setVisitDeptCode(patMedOperationItem.getLeavehospitaldistrictcode()); |
| | | serviceSubtask.setVisitDeptName(patMedOperationItem.getLeavehospitaldistrictname()); |
| | | } |
| | | //记录insertServiceSubtask语句返回状态 |
| | | Integer i = 0; |
| | |
| | | serviceSubtask.setSex(patArchive.getSex()); |
| | | serviceSubtask.setAge(patArchive.getAge()); |
| | | serviceSubtask.setSendstate(2L); |
| | | serviceSubtask.setCampusid(patMedInhosp1.getCampusid()); |
| | | serviceSubtask.setManagementDoctor(patMedInhosp1.getManagementDoctor()); |
| | | serviceSubtask.setManagementDoctorCode(patMedInhosp1.getManagementDoctorCode()); |
| | | serviceSubtask.setStarttime(patMedInhosp1.getStarttime()); |
| | |
| | | serviceTaskoper.setOplevelcode(opItem.getOplevelcode()); |
| | | |
| | | //根据科室、病区过滤 |
| | | serviceTaskoper.setDeptCode(opItem.getDeptcode()); |
| | | serviceTaskoper.setWardCode(opItem.getHospitaldistrictcode()); |
| | | if(StringUtils.isNotEmpty(opItem.getLeaveldeptcode())){ |
| | | serviceTaskoper.setDeptCode(opItem.getLeaveldeptcode()); |
| | | }else { |
| | | serviceTaskoper.setWardCode(opItem.getLeavehospitaldistrictcode()); |
| | | } |
| | | |
| | | List<ServiceTaskoper> serviceTaskopers = serviceTaskoperMapper.selectServiceTaskoperList(serviceTaskoper); |
| | | //如果部门模板为空(将deptIsNull设置为true) |
| | |
| | | * 根据患者离院科室或病区查询service_task_rule,获取deptRule、wradRule、diagRule |
| | | * 根据规则值决定调用哪个方法生成随访任务 |
| | | */ |
| | | private void addSubTaskByRule(String config) { |
| | | // 获取所有需要处理的出院患者(科室维度未处理) |
| | | PatMedInhosp pmks = new PatMedInhosp(); |
| | | pmks.setDeptcheckFlag("0"); |
| | | pmks.setInhospstate("1"); |
| | | pmks.setFuflag("1"); |
| | | List<PatMedInhosp> patMedInhosps = patMedInhospMapper.selectPatMedInhospList(pmks); |
| | | log.info("【基于规则】需要处理的出院患者信息:{}", CollectionUtils.isNotEmpty(patMedInhosps) ? patMedInhosps.size() : null); |
| | | |
| | | private void addSubTaskByRule(String config, List<PatMedInhosp> patMedInhosps) { |
| | | for (PatMedInhosp patMedInhosp1 : patMedInhosps) { |
| | | // 获取患者基本信息 |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedInhosp1.getPatid()); |