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 1781c5c..2565bcc 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 @@ -61,6 +61,16 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { //面部识别是否存在 private boolean isFace; + //是否存在筛查结果 + private boolean isScreenResult; + + public boolean isScreenResult() { + return isScreenResult; + } + + public void setScreenResult(boolean screenResult) { + isScreenResult = screenResult; + } public Integer getDueStatus() { return dueStatus; @@ -1172,6 +1182,10 @@ public class PatientsQuery extends BaseQuery implements IConvertToNativeQuery { condition = condition.and("face", true, MongoOper.EXISTS); } + if (isScreenResult) { + condition = condition.and("screenResult", true, MongoOper.EXISTS); + } + if (bookbuildingDoctor != null) { condition = condition.and("bookbuildingDoctor", bookbuildingDoctor, MongoOper.IS); } 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 0a0f9f3..093d640 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 @@ -160,7 +160,7 @@ public class AntenatalExaminationFacade { //表示区域的 if (StringUtils.isNotEmpty(groupsFacade.findByCurrentUserId(hospitalId)) && StringUtils.isNotEmpty(pid)) { - System.out.println("复诊时开始隐藏建档:"+parentId); + System.out.println("复诊时开始隐藏建档:" + parentId); patients = findOnePatient(null, null, null, null, type, false, pid, false); patients.setSource(patients.getId()); patients.setId(null); @@ -368,7 +368,7 @@ public class AntenatalExaminationFacade { try { //复诊冗余到产检表 antenatalExaminationService.updateAntExRecord(antExamModel.getId(), 2); - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } try { @@ -439,7 +439,7 @@ public class AntenatalExaminationFacade { e.printStackTrace(); } //同步更新两条转诊记录信息 - applyOrderFacade.updataReferral(patients.getId(),model1); + applyOrderFacade.updataReferral(patients.getId(), model1); System.out.println("查询转诊条件:" + referralApplyOrderQuery.convertToQuery().convertToMongoQuery()); } @@ -634,9 +634,8 @@ public class AntenatalExaminationFacade { } //聊城东昌府医院初诊的身高更新到随心测 - if ("1000000116".equals(hospitalId) || "2100001305".equals(hospitalId)) - { - measureInfoFacade.updateHeight(antExChuModel.getParentId(),hospitalId,antExChuModel.getHeight()); + if ("1000000116".equals(hospitalId) || "2100001305".equals(hospitalId)) { + measureInfoFacade.updateHeight(antExChuModel.getParentId(), hospitalId, antExChuModel.getHeight()); } @@ -1720,7 +1719,20 @@ public class AntenatalExaminationFacade { HighScoreResult highScoreResult = findLastRisk(patients.getPid(), true); resultMap.put("highRisk", highScoreResult.getHighRisk()); resultMap.put("highriskDesc", highScoreResult.getHighriskDesc()); - resultMap.put("screenResult", getscreenResult(patients.getScreenResult())); + if (patients.getScreenResult() != null) {//优先继承当前医院的筛查结果 + resultMap.put("screenResult", getscreenResult(patients.getScreenResult())); + } else {//查询区域的patient数据 + PatientsQuery patientsQuery = new PatientsQuery(); + patientsQuery.setPid(patients.getPid()); + patientsQuery.setType(1); + patientsQuery.setScreenResult(true); + patientsQuery.setSort("created"); + List patients1 = patientsService.queryPatient(patientsQuery); + if (CollectionUtils.isNotEmpty(patients1)) { + patients = patients1.get(0); + resultMap.put("screenResult", getscreenResult(patients.getScreenResult())); + } + } } return new BaseObjectResponse().setData(resultMap).setErrorcode(ErrorCodeConstants.SUCCESS); } @@ -2077,7 +2089,7 @@ public class AntenatalExaminationFacade { patientsQuery.setEnable("2"); } Patients patients = null; - System.out.println("复诊时查询当前医院是否有隐藏建档条件:"+patientsQuery.convertToQuery().convertToMongoQuery()); + System.out.println("复诊时查询当前医院是否有隐藏建档条件:" + patientsQuery.convertToQuery().convertToMongoQuery()); List list = patientsService.queryPatient1(patientsQuery, "modified"); if (CollectionUtils.isNotEmpty(list)) { return list.get(0); @@ -2631,9 +2643,8 @@ public class AntenatalExaminationFacade { } /** - * * @param id - * @param n 是否要高危等级 + * @param n 是否要高危等级 * @return */ public synchronized HighScoreResult queryRisk(List id, boolean n) { diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java index 5aa6c48..b0f27df 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java @@ -293,7 +293,6 @@ public class BabyBookbuildingFacade { } else { checkRecord.put("hospitalName", ""); } - list.add(checkRecord); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java index 5c6635e..751e87f 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java @@ -106,8 +106,7 @@ public class BabyCheckFacade { List models = babyCheckService.queryBabyCheckRecord(query); babyCheckService.updateBabyCheck(model, request.getId()); - if (CollectionUtils.isNotEmpty(models)) - { + if (CollectionUtils.isNotEmpty(models)) { operateLogFacade.addModifyOptLog(userId, Integer.valueOf(hospitalId), models.get(0), model, OptActionEnums.UPDATE.getId(), "修改儿童检查"); } @@ -367,17 +366,17 @@ public class BabyCheckFacade { public BaseResponse addBabyCheck(BabyCheckRequest request, Integer userId) { /** 验证产检券是否可用 可用就改为已使用状态 */ - if(org.apache.commons.lang3.StringUtils.isNotBlank(request.getCouponCode())) { + if (org.apache.commons.lang3.StringUtils.isNotBlank(request.getCouponCode())) { BaseObjectResponse resp = couponService.validate(request.getCouponCode(), 8, autoMatchFacade.getHospitalId(userId)); - if(resp.getErrorcode() != 0) { + if (resp.getErrorcode() != 0) { return resp; } } /** 验证产检券是否可用 可用就改为已使用状态(血红蛋白) */ - if(org.apache.commons.lang3.StringUtils.isNotBlank(request.getHemoglobinCoupon())) { + if (org.apache.commons.lang3.StringUtils.isNotBlank(request.getHemoglobinCoupon())) { BaseObjectResponse resp = couponService.validate(request.getHemoglobinCoupon(), 10, autoMatchFacade.getHospitalId(userId)); - if(resp.getErrorcode() != 0) { + if (resp.getErrorcode() != 0) { return resp; } } @@ -428,10 +427,10 @@ public class BabyCheckFacade { operateLogFacade.addAddOptLog(userId, Integer.valueOf(hospitalId), model, OptActionEnums.ADD.getId(), "添加儿童检查"); /** 使用优惠券 */ - if(org.apache.commons.lang3.StringUtils.isNotBlank(request.getCouponCode())) { + if (org.apache.commons.lang3.StringUtils.isNotBlank(request.getCouponCode())) { couponService.use(autoMatchFacade.getHospitalId(userId), request.getCouponCode(), userId, model.getId()); } - if(org.apache.commons.lang3.StringUtils.isNotBlank(request.getHemoglobinCoupon())) { + if (org.apache.commons.lang3.StringUtils.isNotBlank(request.getHemoglobinCoupon())) { couponService.use(autoMatchFacade.getHospitalId(userId), request.getHemoglobinCoupon(), userId, model.getId()); } @@ -537,7 +536,7 @@ public class BabyCheckFacade { * * @param id */ - public void deleteBabyCheckById(String id,Integer userId) { + public void deleteBabyCheckById(String id, Integer userId) { String hospitalId = autoMatchFacade.getHospitalId(userId); @@ -550,7 +549,7 @@ public class BabyCheckFacade { babyCheckService.deleteBabyCheckById(id); if (CollectionUtils.isNotEmpty(checkModels)) { - operateLogFacade.addDeleteOptLog(userId, Integer.valueOf(hospitalId),checkModels.get(0), OptActionEnums.DELETE.getId(), "删除儿童检查"); + operateLogFacade.addDeleteOptLog(userId, Integer.valueOf(hospitalId), checkModels.get(0), OptActionEnums.DELETE.getId(), "删除儿童检查"); query.setId(null); query.setBuildId(checkModels.get(0).getBuildId()); @@ -632,7 +631,7 @@ public class BabyCheckFacade { List models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); Date lastDate = null; for (BabyModel b : models) { - if(lastDate == null) { + if (lastDate == null) { lastDate = b.getBuildDate(); } else { if (b.getBuildDate() != null && lastDate.getTime() < b.getBuildDate().getTime()) { @@ -640,7 +639,7 @@ public class BabyCheckFacade { } } } - if(lastDate != null) { + if (lastDate != null) { resMap.put("lastDate", DateUtil.getyyyy_MM_dd(lastDate)); } @@ -782,25 +781,25 @@ public class BabyCheckFacade { base.setPregnantCertificateTypeId(model.getMcertTypeId()); base.setMonthAge(DateUtil.getBabyMonthAge(model.getBirth(), new Date())); //计算儿童的预产期 - if(model.getBirth()!=null&&model.getDueWeek()!=null&&model.getDueWeek()<37){//早产儿,根据出生孕周计算末次月经,在根据末次月经计算预产期 + if (model.getBirth() != null && model.getDueWeek() != null && model.getDueWeek() < 37) {//早产儿,根据出生孕周计算末次月经,在根据末次月经计算预产期 String birthStr = DateUtil.getyyyy_MM_dd(model.getBirth()); Date ymdBirth = DateUtil.parseYMD(birthStr); - if(model.getDueDate()==null || ymdBirth.getTime() == model.getDueDate().getTime()){//预产期为空或者预产期与生日一致进行计算真实预产期 + if (model.getDueDate() == null || ymdBirth.getTime() == model.getDueDate().getTime()) {//预产期为空或者预产期与生日一致进行计算真实预产期 //根据出生孕周计算末次月经 - Date LastMens = DateUtil.addWeek(model.getBirth(),-model.getDueWeek()); + Date LastMens = DateUtil.addWeek(model.getBirth(), -model.getDueWeek()); //根据末次月经计算预产期 // Date dueDate = DateUtil.addMonth(LastMens, 9); // dueDate = DateUtil.addDay(dueDate, 7); Date dueDate = DateUtil.addDay(LastMens, 280); //返回预产期 base.setDueDate(DateUtil.getyyyy_MM_dd(dueDate)); - }else{ + } else { base.setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate())); } } base.setBirthday(DateUtil.getyyyy_MM_dd(model.getBirth())); - base.setSourceId(org.apache.commons.lang.StringUtils.isNotEmpty(model.getSource())?model.getSource():model.getId()); + base.setSourceId(org.apache.commons.lang.StringUtils.isNotEmpty(model.getSource()) ? model.getSource() : model.getId()); if (model.getPid() != null) { //诊断 List list = getBabyLastDiagnose(model.getPid()); @@ -994,10 +993,10 @@ public class BabyCheckFacade { babyQuery.setYn(YnEnums.YES.getId()); /** 处理优惠券查询 */ - if(StringUtils.isNotEmpty(coupon)) { + if (StringUtils.isNotEmpty(coupon)) { Map m = couponMapper.findUrl(coupon); Object personId = m.get("user_id"); - if(personId != null) { + if (personId != null) { babyQuery.setPid(personId.toString()); } } @@ -1013,30 +1012,27 @@ public class BabyCheckFacade { List hList = groupsFacade.findGroupHospital(userId, false); babyQuery.setHospitalIdList(hList); - Map> listMap = new HashMap<>(); + Map> listMap = new HashMap<>(); List models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); - if (CollectionUtils.isEmpty(models) && StringUtils.isNotEmpty(vcCardNo)) - { - if ("4".equals(HIS_VERSION)) { - List> hisPatient = qhdfyHisService.getPatientInfoList(vcCardNo); - - if (CollectionUtils.isNotEmpty(hisPatient)) { - Map babyHis = hisPatient.get(0); - if (babyHis != null && babyHis.get("phone") != null && StringUtils.isNotEmpty(babyHis.get("phone").toString())) { - babyQuery.setPhoneOrcardNo(null); //手机号码或者身份证号码 - babyQuery.setVcCardNo(null); - babyQuery.setMphone(babyHis.get("phone").toString()); - models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); - } - } - } + if (CollectionUtils.isEmpty(models) && StringUtils.isNotEmpty(vcCardNo)) { + if ("4".equals(HIS_VERSION)) { + List> hisPatient = qhdfyHisService.getPatientInfoList(vcCardNo); + + if (CollectionUtils.isNotEmpty(hisPatient)) { + Map babyHis = hisPatient.get(0); + if (babyHis != null && babyHis.get("phone") != null && StringUtils.isNotEmpty(babyHis.get("phone").toString())) { + babyQuery.setPhoneOrcardNo(null); //手机号码或者身份证号码 + babyQuery.setVcCardNo(null); + babyQuery.setMphone(babyHis.get("phone").toString()); + models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); + } + } + } } - if (CollectionUtils.isNotEmpty(models)) - { - + if (CollectionUtils.isNotEmpty(models)) { for (BabyModel model : models) { @@ -1058,46 +1054,36 @@ public class BabyCheckFacade { hospital = organization.getName(); } } - result.setHospitalName(hospital); + result.setHospitalName(hospital); List list = new ArrayList<>(); - if (listMap.get(model.getPid()) != null) - { + if (listMap.get(model.getPid()) != null) { list = listMap.get(model.getPid()); list.add(result); - } - else - { + } else { list.add(result); } - listMap.put(model.getPid(),list); + listMap.put(model.getPid(), list); // results.add(result); } } - if (listMap != null) - { - for (String pid : listMap.keySet()) - { + if (listMap != null) { + for (String pid : listMap.keySet()) { List currentBuildRecord = new ArrayList<>(); List list = listMap.get(pid); - for(BabyChooseResult baby : list) - { - if (StringUtils.isNotEmpty(hospitalId) && hospitalId.equals(baby.getHospitalId())) - { + for (BabyChooseResult baby : list) { + if (StringUtils.isNotEmpty(hospitalId) && hospitalId.equals(baby.getHospitalId())) { currentBuildRecord.add(baby); break; } } - if (CollectionUtils.isNotEmpty(currentBuildRecord)) - { + if (CollectionUtils.isNotEmpty(currentBuildRecord)) { results.addAll(currentBuildRecord); - } - else - { + } else { results.addAll(list); } } @@ -1146,7 +1132,7 @@ public class BabyCheckFacade { result.setCouponCode(couponService.findByType(id, 8)); /** 优惠券编号 */ String hemoglobinCoupon = couponService.findByType(id, 10); - if(StringUtils.isNotEmpty(hemoglobinCoupon)) { + if (StringUtils.isNotEmpty(hemoglobinCoupon)) { result.setHemoglobinCoupon(hemoglobinCoupon); } } @@ -1508,6 +1494,7 @@ public class BabyCheckFacade { * 身高别体重》M-2s && 年龄别身高小于M-2s * 4.慢性严重营养不良 * 身高别体重小于M-2s && 年龄别身高小于M-2s。 + * * @return */ public List getBabyGrowthEvaluate(Double height, Integer sex, String birth, Double weight) { @@ -1613,18 +1600,17 @@ public class BabyCheckFacade { date = DateUtil.parseYMD(checkDate); } - boolean isShowNavel = false; - int monthes = DateUtil.getBabyAgeMonth(birthDate,date); - if (monthes == 0 || monthes == 1 || monthes == 3) - { - isShowNavel = true; + boolean isShowNavel = false; + int monthes = DateUtil.getBabyAgeMonth(birthDate, date); + if (monthes == 0 || monthes == 1 || monthes == 3) { + isShowNavel = true; } String ageStr = DateUtil.getBabyMonthAge(birthDate, date); BaseObjectResponse objectResponse = new BaseObjectResponse(); - Map map = new HashMap<>(); - map.put("monthAge",ageStr); - map.put("isShowNavel",isShowNavel); + Map map = new HashMap<>(); + map.put("monthAge", ageStr); + map.put("isShowNavel", isShowNavel); objectResponse.setData(map); objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); objectResponse.setErrormsg("成功"); @@ -1676,7 +1662,7 @@ public class BabyCheckFacade { public BaseResponse getBabyCurve(String babyId, Integer id) { - Map map = new HashMap<>(); + Map map = new HashMap<>(); List weightTitles = new LinkedList<>(); List weightValues = new LinkedList<>(); @@ -1684,63 +1670,63 @@ public class BabyCheckFacade { List heightTitles = new LinkedList<>(); List heightValues = new LinkedList<>(); - List> tables = new LinkedList<>(); + List> tables = new LinkedList<>(); BabyModel babyModel = babyService.getOneBabyById(babyId); + BabyModelQuery babyQuery = new BabyModelQuery(); + babyQuery.setYn(YnEnums.YES.getId()); + + //查询建档记录 得到pid 通过pid查询所有的儿童建档记录 + babyQuery.setPid(babyModel.getPid()); + //查询建档记录 + List models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); + String[] buildIds = new String[models.size()]; + for (int i = 0; i < models.size(); i++) { + buildIds[i] = models.get(i).getId(); + } + BabyCheckModelQuery query = new BabyCheckModelQuery(); query.setYn(YnEnums.YES.getId()); - query.setBuildId(babyId); + query.setBuildIds(buildIds); //查询儿童的检查记录 - List checkModels = babyCheckService.queryBabyCheckRecord(query, "checkDate,created", Sort.Direction.ASC); - - if (CollectionUtils.isNotEmpty(checkModels)) - { - for (BabyCheckModel checkModel : checkModels) - { - if (checkModel != null) - { - if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight()) || org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getWeight())) - { - int month = DateUtil.getBabyAgeMonth(babyModel.getBirth(),checkModel.getCheckDate()); - Map heightMap = new HashMap<>(); - heightMap.put("time",month); - if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight())) - { - if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getHeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getHeight()).matches()) - { - if(heightTitles.contains(month)){ + List checkModels = babyCheckService.queryBabyCheckRecord(query, "checkDate,created", Sort.Direction.ASC); + + if (CollectionUtils.isNotEmpty(checkModels)) { + for (BabyCheckModel checkModel : checkModels) { + if (checkModel != null) { + if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight()) || org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getWeight())) { + int month = DateUtil.getBabyAgeMonth(babyModel.getBirth(), checkModel.getCheckDate()); + Map heightMap = new HashMap<>(); + heightMap.put("time", month); + if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getHeight())) { + if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getHeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getHeight()).matches()) { + if (heightTitles.contains(month)) { int index = heightTitles.indexOf(month); - heightValues.set(index,checkModel.getHeight()); - }else { + heightValues.set(index, checkModel.getHeight()); + } else { heightTitles.add(month); heightValues.add(checkModel.getHeight()); } } heightMap.put("height", checkModel.getHeight()); - } - else - { + } else { heightMap.put("height", "--"); } - if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getWeight())) - { - if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getWeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getWeight()).matches()) - { + if (org.apache.commons.lang.StringUtils.isNotEmpty(checkModel.getWeight())) { + if (org.apache.commons.lang.StringUtils.isNumeric(checkModel.getWeight()) || Pattern.compile("^[-\\+]?[.\\d]*$").matcher(checkModel.getWeight()).matches()) { - if(weightTitles.contains(month)){//如果存在月的数据则更新对应索引的值 + if (weightTitles.contains(month)) {//如果存在月的数据则更新对应索引的值 int index = weightTitles.indexOf(month); - weightValues.set(index,checkModel.getWeight()); - }else { + weightValues.set(index, checkModel.getWeight()); + } else { weightTitles.add(month); weightValues.add(checkModel.getWeight()); } } - heightMap.put("weight",checkModel.getWeight()); - } - else - { + heightMap.put("weight", checkModel.getWeight()); + } else { heightMap.put("weight", "--"); } tables.add(heightMap); @@ -1748,15 +1734,15 @@ public class BabyCheckFacade { } } } - map.put("weightTitles",weightTitles); - map.put("weightValues",weightValues); + map.put("weightTitles", weightTitles); + map.put("weightValues", weightValues); - map.put("heightTitles",heightTitles); - map.put("heightValues",heightValues); + map.put("heightTitles", heightTitles); + map.put("heightValues", heightValues); - map.put("tables",tables); - if(babyModel!=null){ - map.put("sex",babyModel.getSex()); + map.put("tables", tables); + if (babyModel != null) { + map.put("sex", babyModel.getSex()); } return new BaseObjectResponse().setData(map).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); } diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java index 2627243..e5d7f6a 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java @@ -3280,7 +3280,7 @@ public class ViewFacade { model.setTcType(checkModel.getTcType()); model.setBabyName(babyModel.getName()); model.setBabyBirthday(DateUtil.getyyyy_MM_dd(babyModel.getBirth())); - model.setMonthAge(DateUtil.getBabyMonthAge(babyModel.getBirth(), new Date())); + model.setMonthAge(DateUtil.getBabyMonthAge(babyModel.getBirth(), checkModel.getCheckDate())); model.setMommyPhone(babyModel.getMphone()); model.setMommyName(babyModel.getMname()); model.setRemark(babyModel.getMremark());