diff --git a/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java index 552dde0..693e28c 100644 --- a/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java +++ b/platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java @@ -478,7 +478,7 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { private String hospitalId; private String hcertificateNum; - + //3-转诊建档 private Integer buildType = -1; private Integer buildTypeNot = -1; diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java index 719c758..01fe3ea 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java @@ -270,7 +270,7 @@ public class AntenatalExaminationFacade { * @param antExAddRequest * @return */ - public BaseResponse addOneAntEx(final AntExAddRequest antExAddRequest, Integer userId) { + public BaseResponse addOneAntEx(final AntExAddRequest antExAddRequest, Integer userId) { final String hospitalId = autoMatchFacade.getHospitalId(userId); AntenatalExaminationModel model = antExAddRequest.convertToDataModel(); //表示区域的 @@ -336,7 +336,6 @@ public class AntenatalExaminationFacade { } - //修改申请单状态 updateApplyOrder(model, antExAddRequest.getParentId()); @@ -346,7 +345,6 @@ public class AntenatalExaminationFacade { antenatalExaminationService.addOneBabyAnt(model); - /** 验证产检券是否可用 可用就改为已使用状态 */ if (StringUtils.isNotBlank(antExAddRequest.getCouponCode()) && antExAddRequest.getCouponType() != null) { BaseObjectResponse resp = couponService.validate(antExAddRequest.getCouponCode(), antExAddRequest.getCouponType(), autoMatchFacade.getHospitalId(userId)); @@ -396,7 +394,6 @@ public class AntenatalExaminationFacade { }); - operateLogFacade.addAddOptLog(userId, Integer.parseInt(hospitalId), model, OptActionEnums.ADD.getId(), "添加复诊"); if (null != patients.getBuildType() && patients.getBuildType() == 3) { @@ -428,7 +425,7 @@ public class AntenatalExaminationFacade { } } //添加复诊时添加追访信息 - addTrackDownInfo(userId,patients); + addTrackDownInfo(userId, patients); } //处理自定义高危状态为已使用状态 highRiskFacade.dispHospHighRiskUse(model.getOtherRisk()); @@ -466,7 +463,7 @@ public class AntenatalExaminationFacade { * @param excAddRequest * @return */ - public BaseResponse addOneAnetExChu(final AntExcAddRequest excAddRequest, final Integer userId) { + public BaseResponse addOneAnetExChu(final AntExcAddRequest excAddRequest, final Integer userId) { StopWatch stopWatch = new StopWatch("addOneAnetExChu"); final String hospitalId = autoMatchFacade.getHospitalId(userId); @@ -634,7 +631,7 @@ public class AntenatalExaminationFacade { } } //初诊是添加追访记录 - addTrackDownInfo(userId,patients); + addTrackDownInfo(userId, patients); } else { return new BaseResponse().setErrorcode(ErrorCodeConstants.PARAMETER_ERROR).setErrormsg("您已经做过初诊"); } @@ -646,6 +643,7 @@ public class AntenatalExaminationFacade { /** * 初诊、复诊添加或更新追访信息 + * * @param userId * @param patient */ @@ -929,6 +927,7 @@ public class AntenatalExaminationFacade { if (null != groupsFacade.findByCurrentUserId(autoMatchFacade.getHospitalId(userId))) { patientsQuery.setExtEnable(false); } + System.out.println("查询孕妇档案:" + patientsQuery.convertToQuery().convertToMongoQuery()); //获取所有的建档记录 List list = patientsService.queryPatient(patientsQuery); AntexListResult antexListResult = new AntexListResult(); @@ -1429,14 +1428,23 @@ public class AntenatalExaminationFacade { //分娩记录 MatDeliverQuery matDeliverQuery = new MatDeliverQuery(); matDeliverQuery.setYn(YnEnums.YES.getId()); - matDeliverQuery.setParentId(patientId); + + PatientsQuery patientsQuery = new PatientsQuery(); + patientsQuery.setSource(patients.getId()); + patientsQuery.setBuildType(1); + List patients1 = patientsService.queryPatient(patientsQuery); + if (CollectionUtils.isNotEmpty(patients1)) { + Patients patients2 = patients1.get(0); + matDeliverQuery.setParentId(patients2.getId()); + } else { + matDeliverQuery.setParentId(patientId); + } List l = matDeliverService.query(matDeliverQuery); if (CollectionUtils.isNotEmpty(l)) { MaternalDeliverModel model = l.get(0); if (null != model.getHospitalId()) { organization = organizationService.getOrganization(Integer.valueOf(model.getHospitalId())); } - listData.add(new AntData(model, patients.getLastMenses(), null != organization ? organization.getName() : "")); } //出院小结 @@ -1645,7 +1653,6 @@ public class AntenatalExaminationFacade { } - public class SortIn { public SortIn(Patients patients) { @@ -1952,8 +1959,8 @@ public class AntenatalExaminationFacade { HighScoreResult highScoreResult = findLastRisk(patients.getPid(), true); patients1.setRiskScore(highScoreResult.getScore()); patients1.setRiskFactorId(highScoreResult.getHighId()); - List list =highScoreResult.getLevelId(); - com.lyms.platform.operate.web.utils.CollectionUtils.removeDuplicate(list,true); + List list = highScoreResult.getLevelId(); + com.lyms.platform.operate.web.utils.CollectionUtils.removeDuplicate(list, true); patients1.setRiskLevelId(JsonUtil.array2JsonString(list)); //设置其他的高危因素 patients1.setoRiskFactor(StringUtils.isNotEmpty(highScoreResult.getOtherRisk()) ? highScoreResult.getOtherRisk() : ""); @@ -2136,7 +2143,7 @@ public class AntenatalExaminationFacade { Patients fmPatient = findOnePatient(queryRequest.getCardNo(), queryRequest.getVcCardNo(), null, currentGroupHospital, 3, false, null, og.getbStatus() == 1); List sortList = new ArrayList<>(); - if(fmPatient!=null){ + if (fmPatient != null) { fmPatient.setBookbuildingDate(fmPatient.getFmDate()); sortList.add(new SortIn(fmPatient)); } @@ -2253,11 +2260,10 @@ public class AntenatalExaminationFacade { } - if (patients != null) - { + if (patients != null) { //测量数据 - antexListResult.setMeasureData(measureInfoFacade.getMeasureInfo(patients.getPcerteTypeId(),patients.getCardNo(),hospitalId)); + antexListResult.setMeasureData(measureInfoFacade.getMeasureInfo(patients.getPcerteTypeId(), patients.getCardNo(), hospitalId)); //产筛状态 antexListResult.setSieveStatus(sieveFacade.getSieveStatus(patients.getId(), hospitalId)); @@ -2265,15 +2271,12 @@ public class AntenatalExaminationFacade { DiagnoseConfigQuery diagnoseConfigQuery = new DiagnoseConfigQuery(); diagnoseConfigQuery.setHospitalId(hospitalId); List configModels = diagnoseConfigService.queryDiagnoseConfigs(diagnoseConfigQuery); - if (CollectionUtils.isNotEmpty(configModels) && StringUtils.isNotEmpty(configModels.get(0).getEnable())) - { + if (CollectionUtils.isNotEmpty(configModels) && StringUtils.isNotEmpty(configModels.get(0).getEnable())) { antexListResult.setEnableConfig(configModels.get(0).getEnable()); } } - - return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(antexListResult); } @@ -2726,41 +2729,35 @@ public class AntenatalExaminationFacade { public BaseResponse getGongGaoLine(String patientId, Integer id) { - Map map = new HashMap<>(); + Map map = new HashMap<>(); List titles = new ArrayList<>(); List values = new ArrayList<>(); - List> tables = new LinkedList<>(); + List> tables = new LinkedList<>(); AntExChuQuery antExChuQuery = new AntExChuQuery(); antExChuQuery.setYn(YnEnums.YES.getId()); antExChuQuery.setParentId(patientId); List antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery); - if (CollectionUtils.isNotEmpty(antExChuModels)) - { + if (CollectionUtils.isNotEmpty(antExChuModels)) { AntExChuModel chumodel = antExChuModels.get(0); - if (StringUtils.isNotEmpty(chumodel.getGonggao()) || StringUtils.isNotEmpty(chumodel.getGonggaoSelect())) - { - Map item = new HashMap<>(); + if (StringUtils.isNotEmpty(chumodel.getGonggao()) || StringUtils.isNotEmpty(chumodel.getGonggaoSelect())) { + Map item = new HashMap<>(); String value = ""; - if (StringUtils.isNotEmpty(chumodel.getGonggaoSelect()) ) - { + if (StringUtils.isNotEmpty(chumodel.getGonggaoSelect())) { if (StringUtils.isNotEmpty(chumodel.getGonggaoType())) { value = GongJingEnums.getGongGaoNameById(chumodel.getGonggaoSelect()) + "," + GongJingEnums.getHengZhiNameById(chumodel.getGonggaoType()); } else { value = GongJingEnums.getGongGaoNameById(chumodel.getGonggaoSelect()); } - } - else if (StringUtils.isNotEmpty(chumodel.getGonggao())) - { + } else if (StringUtils.isNotEmpty(chumodel.getGonggao())) { value = chumodel.getGonggao(); } item.put("value", value); item.put("time", DateUtil.getyyyy_MM_dd(chumodel.getCheckTime())); - if (StringUtils.isNotEmpty(chumodel.getGonggao()) && (StringUtils.isNumeric(chumodel.getGonggao()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(chumodel.getGonggao()).matches())) - { + if (StringUtils.isNotEmpty(chumodel.getGonggao()) && (StringUtils.isNumeric(chumodel.getGonggao()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(chumodel.getGonggao()).matches())) { titles.add(DateUtil.getyyyy_MM_dd(chumodel.getCheckTime())); values.add(chumodel.getGonggao()); } @@ -2773,32 +2770,25 @@ public class AntenatalExaminationFacade { antExQuery.setParentId(patientId); antExQuery.setYn(YnEnums.YES.getId()); List examinationModelList = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.ASC, "created")); - if (CollectionUtils.isNotEmpty(examinationModelList)) - { - for (AntenatalExaminationModel anmodel : examinationModelList) - { - if (StringUtils.isNotEmpty(anmodel.getGongGao()) || StringUtils.isNotEmpty(anmodel.getGongGaoSelect())) - { - Map item = new HashMap<>(); + if (CollectionUtils.isNotEmpty(examinationModelList)) { + for (AntenatalExaminationModel anmodel : examinationModelList) { + if (StringUtils.isNotEmpty(anmodel.getGongGao()) || StringUtils.isNotEmpty(anmodel.getGongGaoSelect())) { + Map item = new HashMap<>(); String value = ""; - if (StringUtils.isNotEmpty(anmodel.getGongGaoSelect()) ) - { + if (StringUtils.isNotEmpty(anmodel.getGongGaoSelect())) { if (StringUtils.isNotEmpty(anmodel.getGongGaoType())) { value = GongJingEnums.getGongGaoNameById(anmodel.getGongGaoSelect()) + "," + GongJingEnums.getHengZhiNameById(anmodel.getGongGaoType()); } else { value = GongJingEnums.getGongGaoNameById(anmodel.getGongGaoSelect()); } - } - else if (StringUtils.isNotEmpty(anmodel.getGongGao())) - { + } else if (StringUtils.isNotEmpty(anmodel.getGongGao())) { value = anmodel.getGongGao(); } item.put("value", value); item.put("time", DateUtil.getyyyy_MM_dd(anmodel.getCheckDate())); - if (StringUtils.isNotEmpty(anmodel.getGongGao()) && (StringUtils.isNumeric(anmodel.getGongGao()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(anmodel.getGongGao()).matches())) - { + if (StringUtils.isNotEmpty(anmodel.getGongGao()) && (StringUtils.isNumeric(anmodel.getGongGao()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(anmodel.getGongGao()).matches())) { titles.add(DateUtil.getyyyy_MM_dd(anmodel.getCheckDate())); values.add(anmodel.getGongGao()); } @@ -2825,7 +2815,7 @@ public class AntenatalExaminationFacade { diagnoseConfigQuery.setHospitalId(patients.getHospitalId()); List configModels = diagnoseConfigService.queryDiagnoseConfigs(diagnoseConfigQuery); - Map> mapItems = getRiskConfig(configModels); + Map> mapItems = getRiskConfig(configModels); if (mapItems != null && mapItems.size() > 0) { if (patients != null && patients.getBirth() != null) { String age = String.valueOf(DateUtil.getAge(patients.getBirth(), new Date())); @@ -2840,20 +2830,17 @@ public class AntenatalExaminationFacade { } } } - List> riskList = diagnoseConfigFacde.getRiskName(list); + List> riskList = diagnoseConfigFacde.getRiskName(list); return new BaseObjectResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); } //每一项是否启用 - private boolean isEnableItem(Map status,Integer id) - { - if (status != null && status.size() > 0) - { - if ("true".equals(status.get(String.valueOf(id)))) - { - return true; - } + private boolean isEnableItem(Map status, Integer id) { + if (status != null && status.size() > 0) { + if ("true".equals(status.get(String.valueOf(id)))) { + return true; + } } return false; } @@ -2869,27 +2856,25 @@ public class AntenatalExaminationFacade { diagnoseConfigQuery.setHospitalId(hospitalId); List configModels = diagnoseConfigService.queryDiagnoseConfigs(diagnoseConfigQuery); - List> riskList = new ArrayList<>(); + List> riskList = new ArrayList<>(); - Map status = new HashMap<>(); - if (CollectionUtils.isNotEmpty(configModels)) - { + Map status = new HashMap<>(); + if (CollectionUtils.isNotEmpty(configModels)) { DiagnoseConfigModel model = configModels.get(0); - List> configs = model.getConfigs(); + List> configs = model.getConfigs(); - if (model == null || "0".equals(model.getEnable()) || configs == null || configs.size() == 0) - { + if (model == null || "0".equals(model.getEnable()) || configs == null || configs.size() == 0) { return new BaseObjectResponse().setData(riskList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); } if (CollectionUtils.isNotEmpty(configs)) { for (Map map : configs) { - status.put(map.get("id"),map.get("status")); + status.put(map.get("id"), map.get("status")); } } } - Map> mapItems = getRiskConfig(configModels); + Map> mapItems = getRiskConfig(configModels); if (mapItems != null && mapItems.size() > 0) { if (isEnableItem(status, DiagnoseEnums.DiagnoseItemEnums.age.getId())) { Patients patients = patientsService.findOnePatientById(antExcAddRequest.getParentId()); @@ -3891,11 +3876,9 @@ public class AntenatalExaminationFacade { } } - if (list.size() > 0) - { + if (list.size() > 0) { List ids = new ArrayList<>(); - for (String id : list) - { + for (String id : list) { ids.add(id); } riskList = diagnoseConfigFacde.getRiskName(ids); @@ -3905,50 +3888,44 @@ public class AntenatalExaminationFacade { } - private boolean contain(String value,String content) - { + private boolean contain(String value, String content) { return content.contains(value); } /** - * - * @param expId 表达式id - * @param value 计算值 + * @param expId 表达式id + * @param value 计算值 * @param calValue 被计算值 * @return */ - private boolean compare(String expId,String value,String calValue) - { - try - { + private boolean compare(String expId, String value, String calValue) { + try { Double compareValue = Double.parseDouble(calValue); Integer id = Integer.parseInt(expId); - switch (id) - { - case 1 : + switch (id) { + case 1: return compareValue > Double.parseDouble(value); - case 2 : - return compareValue >= Double.parseDouble(value); - case 3 : - return compareValue < Double.parseDouble(value); - case 4 : - return compareValue <= Double.parseDouble(value) ; - case 5 : + case 2: + return compareValue >= Double.parseDouble(value); + case 3: + return compareValue < Double.parseDouble(value); + case 4: + return compareValue <= Double.parseDouble(value); + case 5: return compareValue == Double.parseDouble(value); - case 6 : + case 6: return compareValue != Double.parseDouble(value); - default: return false; + default: + return false; } - }catch (Exception e) - { - ExceptionUtils.catchException(e,"risk compare error"); + } catch (Exception e) { + ExceptionUtils.catchException(e, "risk compare error"); } return false; } - private boolean compare(DiagnoseItemModel item,String calValue) - { + private boolean compare(DiagnoseItemModel item, String calValue) { String expId1 = item.getValueOne(); String value1 = item.getValueTwo(); String logic = item.getValueThree(); @@ -3959,52 +3936,43 @@ public class AntenatalExaminationFacade { StringUtils.isNotEmpty(value1) && StringUtils.isNotEmpty(expId2) && StringUtils.isNotEmpty(value2) && - StringUtils.isNotEmpty(logic)) - { + StringUtils.isNotEmpty(logic)) { Integer logicId = Integer.parseInt(logic); - switch (logicId) - { - case 1 : + switch (logicId) { + case 1: return compare(expId1, value1, calValue) && compare(expId2, value2, calValue); - case 2 : + case 2: return compare(expId1, value1, calValue) || compare(expId2, value2, calValue); - default: return false; + default: + return false; } - } - else if (StringUtils.isNotEmpty(expId1) && StringUtils.isNotEmpty(value1)) - { + } else if (StringUtils.isNotEmpty(expId1) && StringUtils.isNotEmpty(value1)) { return compare(expId1, value1, calValue); } return false; } - private Map> getRiskConfig(List configModels) - { - Map> mapItems = new HashMap<>(); + private Map> getRiskConfig(List configModels) { + Map> mapItems = new HashMap<>(); - if (CollectionUtils.isNotEmpty(configModels)) - { + if (CollectionUtils.isNotEmpty(configModels)) { DiagnoseConfigModel configModel = configModels.get(0); DiagnoseItemsQuery diagnoseItemsQuery = new DiagnoseItemsQuery(); diagnoseItemsQuery.setConfigId(configModel.getId()); List diagnoseItemModels = diagnoseConfigService.queryDiagnoseItems(diagnoseItemsQuery); - if (CollectionUtils.isNotEmpty(diagnoseItemModels)) - { - for (DiagnoseEnums.DiagnoseItemEnums diagnoses : DiagnoseEnums.DiagnoseItemEnums.values()) - { + if (CollectionUtils.isNotEmpty(diagnoseItemModels)) { + for (DiagnoseEnums.DiagnoseItemEnums diagnoses : DiagnoseEnums.DiagnoseItemEnums.values()) { List diagnoseItemList = new ArrayList<>(); - for (DiagnoseItemModel item : diagnoseItemModels) - { - if (diagnoses.getId() == Integer.parseInt(item.getParentId())) - { + for (DiagnoseItemModel item : diagnoseItemModels) { + if (diagnoses.getId() == Integer.parseInt(item.getParentId())) { diagnoseItemList.add(item); } } - mapItems.put(diagnoses.getId(),diagnoseItemList); + mapItems.put(diagnoses.getId(), diagnoseItemList); } } }