| | |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.domain.entity.ServiceSubtaskEntity; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IPatArchiveService; |
| | | import com.smartor.service.IPatMedInhospService; |
| | |
| | | private PatArchivecontactMapper patArchivecontactMapper; |
| | | |
| | | @Autowired |
| | | private IPatMedPhysicalService patMedPhysicalService; |
| | | private PatMedOuthospMapper patMedOuthospMapper; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Autowired |
| | | private PatArchivetagServiceImpl patArchivetagServiceImpl; |
| | | |
| | | |
| | | /** |
| | |
| | | patArchive.setCreateTime(DateUtils.getNowDate()); |
| | | patArchiveMapper.insertPatArchiveSingle(patArchive); |
| | | return patArchive.getId().intValue(); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean updateArchive(PatArchive patArchive) { |
| | | int i = patArchiveMapper.updatePatArchive(patArchive); |
| | | if (i != 1) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | patArchiveMapper.updatePatArchive(patArchive); |
| | | if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) { |
| | | //不需要服务了,需要通过patid和sendstate=2或者sendstate=1去查询一下,service_subtask里是否有正在执行的任务,有的话,立即停了 |
| | | ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO(); |
| | | ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity(); |
| | | serviceSubtaskVO.setPatid(patArchive.getId()); |
| | | serviceSubtaskVO.setSendstate(2L); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | |
| | | //去redis中,查询是否有subid,有的话移除cache-exist |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | log.error("需要移除的subId为:{}", serviceSubtask.getId().toString()); |
| | | log.info("需要移除的subId为:{}", serviceSubtask.getId().toString()); |
| | | serviceSubtaskMapper.deleteServiceSubtaskById(serviceSubtask.getId()); |
| | | redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString()); |
| | | redisCache.removeElementFromList("cache-0", serviceSubtask.getId().toString()); |
| | |
| | | } |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 |
| | | List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthosp(patArchiveReq); |
| | | if (CollectionUtils.isNotEmpty(patArchives2)) { |
| | | patArchiveList.addAll(patArchives2); |
| | | // List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthosp(patArchiveReq); |
| | | List<PatArchiveOthreInfo> patientInfoQC = getPatientInfoUtils(patArchiveReq); |
| | | |
| | | if (CollectionUtils.isNotEmpty(patientInfoQC)) { |
| | | patArchiveList.addAll(patientInfoQC); |
| | | } |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 |
| | | List<PatArchiveOthreInfo> patArchives3 = patArchiveMapper.selectPatArchiveInfoByPhysical(patArchiveReq); |
| | | if (CollectionUtils.isNotEmpty(patArchives3)) { |
| | | patArchiveList.addAll(patArchives3); |
| | | } |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 4) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | patArchiveReq.setCry(1); |
| | | List<PatArchiveOthreInfo> patArchives1 = patArchiveMapper.selectPatArchiveInfoByInhospQC(patArchiveReq); |
| | | if (CollectionUtils.isNotEmpty(patArchives1)) { |
| | | patArchiveList.addAll(patArchives1); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public List<PatArchive> patInfoByContion(PatArchiveReq patArchive) { |
| | | List<PatArchive> patArchives = new ArrayList<>(); |
| | | |
| | | if (ObjectUtils.isNotEmpty(patArchive.getPageNum()) && ObjectUtils.isNotEmpty(patArchive.getPageSize())) { |
| | | patArchive.setPn((patArchive.getPageNum() - 1) * patArchive.getPageSize()); |
| | | patArchive.setPs(patArchive.getPageSize()); |
| | | patArchive.setPageNum(null); |
| | | patArchive.setPageSize(null); |
| | | } |
| | | //根据条件获取患者信息 |
| | | // List<PatArchive> patArchiveList = patArchiveMapper.patInfoByContion(patArchive); |
| | | List<PatArchiveOthreInfo> patArchiveList = new ArrayList<>(); |
| | |
| | | patArchiveList.addAll(patArchives1); |
| | | } |
| | | } else if (patArchive.getAllhosp() != null && patArchive.getAllhosp() == 2) { |
| | | List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthosp(patArchive); |
| | | if (CollectionUtils.isNotEmpty(patArchives2)) { |
| | | patArchiveList.addAll(patArchives2); |
| | | List<PatArchiveOthreInfo> patientInfoUtils = getPatientInfoUtils(patArchive); |
| | | if (CollectionUtils.isNotEmpty(patientInfoUtils)) { |
| | | patArchiveList.addAll(patientInfoUtils); |
| | | } |
| | | } else if (patArchive.getAllhosp() != null && patArchive.getAllhosp() == 3) { |
| | | List<PatArchiveOthreInfo> patArchives3 = patArchiveMapper.selectPatArchiveInfoByPhysical(patArchive); |
| | | if (CollectionUtils.isNotEmpty(patArchives3)) { |
| | | patArchiveList.addAll(patArchives3); |
| | | } |
| | | } else if (patArchive.getAllhosp() != null && patArchive.getAllhosp() == 4) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | patArchive.setCry(1); |
| | | List<PatArchiveOthreInfo> patArchives1 = patArchiveMapper.selectPatArchiveInfoByInhospQC(patArchive); |
| | | if (CollectionUtils.isNotEmpty(patArchives1)) { |
| | | patArchiveList.addAll(patArchives1); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | //将查出的tag,放到patArchive1里的TagList中 |
| | | PatArchivetag patArchivetag = new PatArchivetag(); |
| | | patArchivetag.setTagname(list.get(i).getTag()); |
| | | patArchivetag.setTagid(list.get(i).getTagid()); |
| | | stringList.add(patArchivetag); |
| | | if (StringUtils.isNotEmpty(list.get(i).getTag()) && ObjectUtils.isNotEmpty(list.get(i).getTagid())) { |
| | | patArchivetag.setTagname(list.get(i).getTag()); |
| | | patArchivetag.setTagid(list.get(i).getTagid()); |
| | | stringList.add(patArchivetag); |
| | | } |
| | | } |
| | | patArchive1.setTagList(stringList.stream().collect(Collectors.toList())); |
| | | patArchives.add(patArchive1); |
| | |
| | | |
| | | List<PatArchiveOthreInfo> patArchiveList = new ArrayList<>(); |
| | | if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 1) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | patArchiveReq.setCry(0); |
| | | List<PatArchiveOthreInfo> patArchives1 = patArchiveMapper.selectPatArchiveInfoByInhospQC(patArchiveReq); |
| | | if (CollectionUtils.isNotEmpty(patArchives1)) { |
| | | patArchiveList.addAll(patArchives1); |
| | | } |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 |
| | | List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthospQC(patArchiveReq); |
| | | if (CollectionUtils.isNotEmpty(patArchives2)) { |
| | | patArchiveList.addAll(patArchives2); |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | List<PatArchiveOthreInfo> patArchives2 = new ArrayList<>(); |
| | | // List<PatArchiveOthreInfo> patArchives2 = patArchiveMapper.selectPatArchiveInfoByOuthospQC(patArchiveReq); |
| | | |
| | | //门急诊信息,采用分表查询(先查门急诊的存储过程,再查患者基本信息表,关联条件:patid) |
| | | List<PatArchiveOthreInfo> patientInfoUtils = getPatientInfoUtils(patArchiveReq); |
| | | if (CollectionUtils.isNotEmpty(patientInfoUtils)) { |
| | | patArchiveList.addAll(patientInfoUtils); |
| | | } |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | List<PatArchiveOthreInfo> patArchives3 = patArchiveMapper.selectPatArchiveInfoByPhysicalQC(patArchiveReq); |
| | | if (CollectionUtils.isNotEmpty(patArchives3)) { |
| | | patArchiveList.addAll(patArchives3); |
| | | } |
| | | |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 4) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | patArchiveReq.setCry(1); |
| | | log.info("--------查看出院的入参值为:{}", patArchiveReq); |
| | | List<PatArchiveOthreInfo> patArchives1 = patArchiveMapper.selectPatArchiveInfoByInhospQC(patArchiveReq); |
| | | log.info("--------查看出院的返参值为:{}", patArchives1.size()); |
| | | if (CollectionUtils.isNotEmpty(patArchives1)) { |
| | | patArchiveList.addAll(patArchives1); |
| | | } |
| | | } |
| | | // //查询tagName |
| | | // List<Long> patIds = patArchiveList.stream().map(PatArchiveOthreInfo::getId).distinct().collect(Collectors.toList()); |
| | | // Map<Long, String> patTagMap= patArchivetagMapper.getTagsByPatIds(patArchiveReq.getOrgid(),patIds); |
| | | // //装配tagName |
| | | // if(ObjectUtils.isNotEmpty(patTagMap)){ |
| | | // patArchiveList.forEach(patArchiveOthreInfo -> { |
| | | // String tagName = patTagMap.get(patArchiveOthreInfo.getId()); |
| | | // if(StringUtils.isNotEmpty(tagName)){ |
| | | // patArchiveOthreInfo.setTag(tagName); |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | return patArchiveList; |
| | | } |
| | | |
| | | /** |
| | | * 获取患者信息(去重) |
| | | * |
| | | * @param patArchiveReq |
| | | * @return |
| | | */ |
| | | // @Override |
| | | /** |
| | | * 获取患者信息总数(去重) |
| | | * |
| | | * @param patArchiveReq |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Long getPatientInfoQCCount(PatArchiveReq patArchiveReq) { |
| | | if (CollectionUtils.isEmpty(patArchiveReq.getLeavehospitaldistrictcodes()) || patArchiveReq.getLeavehospitaldistrictcodes().size() == 0) { |
| | | patArchiveReq.setLeavehospitaldistrictcodes(null); |
| | | } |
| | | if (CollectionUtils.isEmpty(patArchiveReq.getLeaveldeptcodes()) || patArchiveReq.getLeaveldeptcodes().size() == 0) { |
| | | patArchiveReq.setLeaveldeptcodes(null); |
| | | } |
| | | |
| | | Long count = 0L; |
| | | if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 1) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | patArchiveReq.setCry(0); |
| | | count = patArchiveMapper.countPatArchiveInfoByInhospQC(patArchiveReq); |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 2) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | // count = patArchiveMapper.countPatArchiveInfoByOuthospQC(patArchiveReq); |
| | | PatMedOuthospQueryReq req=new PatMedOuthospQueryReq(); |
| | | String deptcodes = CollectionUtils.isEmpty(patArchiveReq.getLeaveldeptcodes()) ? null : String.join(",", patArchiveReq.getLeaveldeptcodes()); |
| | | String leavehospitaldistrictcodes = CollectionUtils.isEmpty(patArchiveReq.getLeavehospitaldistrictcodes()) ? null : String.join(",", patArchiveReq.getLeavehospitaldistrictcodes()); |
| | | req.setDeptcode(deptcodes); |
| | | req.setHospitaldistrictcode(leavehospitaldistrictcodes); |
| | | req.setOrgid(patArchiveReq.getOrgid()); |
| | | req.setDrname(StringUtils.isNotEmpty(patArchiveReq.getDrname()) ? patArchiveReq.getDrname() : null); |
| | | req.setPatname(StringUtils.isNotEmpty(patArchiveReq.getName()) ? patArchiveReq.getName() : null); |
| | | req.setDiagname(StringUtils.isNotEmpty(patArchiveReq.getLeavediagname()) ? patArchiveReq.getLeavediagname() : null); |
| | | count = patMedOuthospMapper.callSpQueryOuthospCount(req); |
| | | |
| | | |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 3) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | count = patArchiveMapper.countPatArchiveInfoByPhysicalQC(patArchiveReq); |
| | | } else if (patArchiveReq.getAllhosp() != null && patArchiveReq.getAllhosp() == 4) { |
| | | // 查看住院 1 查看门诊 2 查看体检 3 查看出院 4 |
| | | patArchiveReq.setCry(1); |
| | | count = patArchiveMapper.countPatArchiveInfoByInhospQC(patArchiveReq); |
| | | } |
| | | |
| | | return count; |
| | | } |
| | | |
| | | private List<PatArchiveOthreInfo> getPatientInfoUtils(PatArchiveReq patArchiveReq) { |
| | | List<PatArchiveOthreInfo> patArchiveList = new ArrayList<>(); |
| | | |
| | | //门急诊信息,采用分表查询(先查门急诊的存储过程,再查患者基本信息表,关联条件:patid) |
| | | PatMedOuthospQueryReq req=new PatMedOuthospQueryReq(); |
| | | String deptcodes = CollectionUtils.isEmpty(patArchiveReq.getLeaveldeptcodes()) ? null : String.join(",", patArchiveReq.getLeaveldeptcodes()); |
| | | String leavehospitaldistrictcodes = CollectionUtils.isEmpty(patArchiveReq.getLeavehospitaldistrictcodes()) ? null : String.join(",", patArchiveReq.getLeavehospitaldistrictcodes()); |
| | | req.setDeptcode(deptcodes); |
| | | req.setHospitaldistrictcode(leavehospitaldistrictcodes); |
| | | req.setOrgid(patArchiveReq.getOrgid()); |
| | | req.setDrname(StringUtils.isNotEmpty(patArchiveReq.getDrname()) ? patArchiveReq.getDrname() : null); |
| | | req.setPatname(StringUtils.isNotEmpty(patArchiveReq.getName()) ? patArchiveReq.getName() : null); |
| | | req.setDiagname(StringUtils.isNotEmpty(patArchiveReq.getLeavediagname()) ? patArchiveReq.getLeavediagname() : null); |
| | | req.setPageNum(patArchiveReq.getPageNum()==null?null:patArchiveReq.getPageNum()); |
| | | req.setPageSize(patArchiveReq.getPageSize()==null?null:patArchiveReq.getPageSize()); |
| | | List<PatMedOuthosp> patMedOuthosps = patMedOuthospMapper.callSpQueryOuthosp(req); |
| | | for (PatMedOuthosp patMedOuthosp:patMedOuthosps ) { |
| | | PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patMedOuthosp.getPatid()); |
| | | PatArchiveOthreInfo patArchiveOthreInfo = DtoConversionUtils.sourceToTarget(patArchive, PatArchiveOthreInfo.class); |
| | | patArchiveOthreInfo.setDeptcode(patMedOuthosp.getDeptcode()); |
| | | patArchiveOthreInfo.setDeptname(patMedOuthosp.getDeptname()); |
| | | patArchiveOthreInfo.setDrcode(patMedOuthosp.getDrcode()); |
| | | patArchiveOthreInfo.setDrname(patMedOuthosp.getDrname()); |
| | | patArchiveList.add(patArchiveOthreInfo); |
| | | } |
| | | return patArchiveList; |
| | | } |
| | | } |