diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java index c5a6e12..98fab86 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java @@ -560,33 +560,44 @@ public class BookbuildingFacade { else if (!StringUtils.isEmpty(bookbuildingQueryRequest.getVcCardNo())) { patientsQuery.setVcCardNo(bookbuildingQueryRequest.getVcCardNo()); - - //区域模式 - patientsQuery.setHospitalList(groupsFacade.findGroupHospital(userId, false)); - - List patientsVc = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); - if (CollectionUtils.isNotEmpty(patientsVc)) { - if (patientsVc.get(0) == null || StringUtils.isEmpty(patientsVc.get(0).getCardNo())) { - patients = patientsVc; - } else { - patientsQuery.setHospitalId(null); - patientsQuery.setVcCardNo(null); - patientsQuery.setCardNo(patientsVc.get(0).getCardNo()); - patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery, "bookbuildingDate", Sort.Direction.DESC); - } + patientsQuery.setHospitalId(autoMatchFacade.getHospitalId(userId)); + //优先查询本院通过就诊卡 + List localPatients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); + patientsQuery.setHospitalId(null); + if (CollectionUtils.isNotEmpty(localPatients)) + { + patients = localPatients; } - // 如果为空,初次建档,根据就诊卡号从HIS库取患者信息 - else { - if ("2".equals(HIS_VERSION)) { - typeMap.put("hisPatient", hisServiceV2.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); - } else if ("3".equals(HIS_VERSION)) { - typeMap.put("hisPatient", qingLongXianHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); - } else if ("5".equals(HIS_VERSION)) { - typeMap.put("hisPatient", fnfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); - } else if ("4".equals(HIS_VERSION)) { - typeMap.put("hisPatient", qhdfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); + else + { + //区域模式 + patientsQuery.setHospitalList(groupsFacade.findGroupHospital(userId, false)); + + List patientsVc = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); + if (CollectionUtils.isNotEmpty(patientsVc)) { + if (patientsVc.get(0) == null || StringUtils.isEmpty(patientsVc.get(0).getCardNo())) { + patients = patientsVc; + } else { + patientsQuery.setHospitalId(null); + patientsQuery.setVcCardNo(null); + patientsQuery.setCardNo(patientsVc.get(0).getCardNo()); + patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery, "bookbuildingDate", Sort.Direction.DESC); + } + } + // 如果为空,初次建档,根据就诊卡号从HIS库取患者信息 + else { + if ("2".equals(HIS_VERSION)) { + typeMap.put("hisPatient", hisServiceV2.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); + } else if ("3".equals(HIS_VERSION)) { + typeMap.put("hisPatient", qingLongXianHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); + } else if ("5".equals(HIS_VERSION)) { + typeMap.put("hisPatient", fnfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); + } else if ("4".equals(HIS_VERSION)) { + typeMap.put("hisPatient", qhdfyHisService.getPatientInfoList(bookbuildingQueryRequest.getVcCardNo())); + } } } + } else if (!StringUtils.isEmpty(bookbuildingQueryRequest.getId())) { // id,HuJiaqi添加,为了建档管理里面的查看单条使用 patients.add(yunBookbuildingService.findOneById(bookbuildingQueryRequest.getId()));