Commit 1b97f1f2790a3b46497fd0b7a72a43673c3976d3
1 parent
456bb321a8
Exists in
master
and in
6 other branches
update
Showing 2 changed files with 73 additions and 51 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
1b97f1f
| ... | ... | @@ -844,11 +844,23 @@ |
| 844 | 844 | pis.add(patients.getId()); |
| 845 | 845 | } |
| 846 | 846 | if(CollectionUtils.isNotEmpty(pis)){ |
| 847 | - Query querymd = Query.query(Criteria.where("parentId").in(pis).and("yn").ne("0").and("baby").elemMatch(Criteria.where("babyWeight").gte("4000"))); | |
| 847 | +// Query querymd = Query.query(Criteria.where("parentId").in(pis).and("yn").ne("0").and("baby").elemMatch(Criteria.where("babyWeight").gte("4000"))); | |
| 848 | + Query querymd = Query.query(Criteria.where("parentId").in(pis).and("yn").ne("0")); | |
| 848 | 849 | List<MaternalDeliverModel> deliverModels = mongoTemplate.find(querymd, MaternalDeliverModel.class); |
| 849 | 850 | if(CollectionUtils.isNotEmpty(deliverModels)){ |
| 850 | 851 | for (MaternalDeliverModel m: deliverModels ) { |
| 851 | - idsMd.add(m.getParentId()); | |
| 852 | + List<MaternalDeliverModel.Baby> baby = m.getBaby(); | |
| 853 | + for (int i = 0; i <baby.size() ; i++) { | |
| 854 | + MaternalDeliverModel.Baby baby1 = baby.get(i); | |
| 855 | + if(StringUtils.isNotEmpty(baby1.getBabyWeight())){ | |
| 856 | + double babyWeight = Double.parseDouble(baby1.getBabyWeight()); | |
| 857 | + if(babyWeight >= 4000){ | |
| 858 | + idsMd.add(m.getParentId()); | |
| 859 | + } | |
| 860 | + } | |
| 861 | + | |
| 862 | + } | |
| 863 | + | |
| 852 | 864 | } |
| 853 | 865 | } |
| 854 | 866 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/worker/HugeQuanWeightWorker.java
View file @
1b97f1f
| ... | ... | @@ -50,67 +50,77 @@ |
| 50 | 50 | for (Patients patients : patientses) |
| 51 | 51 | if (StringUtils.isNotEmpty(patients.getId())) { |
| 52 | 52 | Map map = new HashMap(); |
| 53 | - map.put("fmDate", DateUtil.getyyyy_MM_dd(patients.getFmDate())); | |
| 54 | - if (patients.getFmWeek() != null) { | |
| 55 | - String dueWeek = ""; | |
| 56 | - String week = (patients.getFmWeek() / 7) + ""; | |
| 57 | - int day = (patients.getFmWeek() % 7); | |
| 58 | - dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); | |
| 59 | - map.put("fmWeek", dueWeek); | |
| 60 | - } else { | |
| 61 | - map.put("fmWeek", ""); | |
| 62 | - } | |
| 63 | - map.put("username", patients.getUsername()); | |
| 64 | - map.put("age", patients.getAge()); | |
| 65 | - map.put("phone", patients.getPhone()); | |
| 66 | - map.put("currentWeek", patients.getType() == 3 ? "已分娩" : DateUtil.getWeekDesc(patients.getLastMenses(), new Date())); | |
| 67 | - String risk = getRiskFactor(patients.getRiskFactorId()); | |
| 68 | - if (org.apache.commons.lang.StringUtils.isEmpty(risk)) { | |
| 69 | - risk = (org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor()) ? "" : patients.getoRiskFactor()); | |
| 70 | - } else { | |
| 71 | - risk = risk + (org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor()) ? "" : "," + patients.getoRiskFactor()); | |
| 72 | - } | |
| 73 | -// String rFactor = commonService.resloveFactor(JsonUtil.toList(patients.getRiskLevelId(), String.class)); | |
| 74 | - map.put("riskFactor", risk); | |
| 75 | - map.put("patientId", patients.getId()); | |
| 76 | - map.put("pid", patients.getPid()); | |
| 77 | - map.put("cardNo", patients.getCardNo()); | |
| 78 | 53 | |
| 79 | - | |
| 80 | - List<PatientWeight> patientWeightList = mongoTemplate.find(Query.query(Criteria.where("patientId").is(patients.getId()).and("yn").ne("0")), PatientWeight.class); | |
| 81 | - if (CollectionUtils.isNotEmpty(patientWeightList)) { | |
| 82 | - PatientWeight patientWeight = patientWeightList.get(0); | |
| 83 | - if (patientWeight != null && StringUtils.isNotEmpty(patientWeight.getBmi())) { | |
| 84 | - map.put("bmi", patientWeight.getBmi()); | |
| 85 | - map.put("beforeHeight", patientWeight.getBeforeHeight()); | |
| 86 | - map.put("beforeWeight", patientWeight.getBeforeWeight()); | |
| 87 | - map.put("dayWeights", patientWeight.getDayWeights()); | |
| 88 | - if (patientWeight.getDayWeights() != null) { | |
| 89 | - int ii = 1; | |
| 90 | - for (Map.Entry<String, String> entry : patientWeight.getDayWeights().entrySet()) { | |
| 91 | - String mapKey = entry.getKey(); | |
| 92 | - String mapValue = entry.getValue(); | |
| 93 | - map.put("dayWeights" + ii++, mapKey + "/" + mapValue); | |
| 94 | - } | |
| 95 | - } | |
| 96 | - } | |
| 97 | - | |
| 98 | - } | |
| 99 | - Query querymd = Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").ne("0") | |
| 100 | - .and("baby").elemMatch(Criteria.where("babyWeight").gte("4000"))); | |
| 54 | + Query querymd = Query.query(Criteria.where("parentId").is(patients.getId()).and("yn").ne("0")); | |
| 101 | 55 | List<MaternalDeliverModel> deliverModels = mongoTemplate.find(querymd, MaternalDeliverModel.class); |
| 102 | 56 | if (CollectionUtils.isNotEmpty(deliverModels)) { |
| 103 | 57 | MaternalDeliverModel maternalDeliverModel = deliverModels.get(0); |
| 104 | 58 | List<MaternalDeliverModel.Baby> baby = maternalDeliverModel.getBaby(); |
| 105 | 59 | for (int i = 0; i < baby.size(); i++) { |
| 106 | 60 | MaternalDeliverModel.Baby baby1 = baby.get(i); |
| 107 | - map.put("babyWeight", baby1.getBabyWeight()); | |
| 61 | + if(StringUtils.isNotEmpty(baby1.getBabyWeight())){ | |
| 62 | + double babyWeight = Double.parseDouble(baby1.getBabyWeight()); | |
| 63 | + if(babyWeight >= 4000){ | |
| 64 | + map.put("babyWeight", baby1.getBabyWeight()); | |
| 65 | + patientsMap(patients, map); | |
| 66 | + patientWeightMap(patients, map); | |
| 67 | + data.add(map); | |
| 68 | + } | |
| 69 | + } | |
| 108 | 70 | |
| 109 | 71 | } |
| 110 | 72 | } |
| 111 | - data.add(map); | |
| 112 | 73 | } |
| 113 | 74 | return data; |
| 75 | + } | |
| 76 | + | |
| 77 | + private void patientWeightMap(Patients patients, Map map) { | |
| 78 | + List<PatientWeight> patientWeightList = mongoTemplate.find(Query.query(Criteria.where("patientId").is(patients.getId()).and("yn").ne("0")), PatientWeight.class); | |
| 79 | + if (CollectionUtils.isNotEmpty(patientWeightList)) { | |
| 80 | + PatientWeight patientWeight = patientWeightList.get(0); | |
| 81 | + if (patientWeight != null && StringUtils.isNotEmpty(patientWeight.getBmi())) { | |
| 82 | + map.put("bmi", patientWeight.getBmi()); | |
| 83 | + map.put("beforeHeight", patientWeight.getBeforeHeight()); | |
| 84 | + map.put("beforeWeight", patientWeight.getBeforeWeight()); | |
| 85 | + map.put("dayWeights", patientWeight.getDayWeights()); | |
| 86 | + if (patientWeight.getDayWeights() != null) { | |
| 87 | + int ii = 1; | |
| 88 | + for (Map.Entry<String, String> entry : patientWeight.getDayWeights().entrySet()) { | |
| 89 | + String mapKey = entry.getKey(); | |
| 90 | + String mapValue = entry.getValue(); | |
| 91 | + map.put("dayWeights" + ii++, mapKey + "/" + mapValue); | |
| 92 | + } | |
| 93 | + } | |
| 94 | + } | |
| 95 | + } | |
| 96 | + } | |
| 97 | + | |
| 98 | + private void patientsMap(Patients patients, Map map) { | |
| 99 | + map.put("fmDate", DateUtil.getyyyy_MM_dd(patients.getFmDate())); | |
| 100 | + if (patients.getFmWeek() != null) { | |
| 101 | + String dueWeek = ""; | |
| 102 | + String week = (patients.getFmWeek() / 7) + ""; | |
| 103 | + int day = (patients.getFmWeek() % 7); | |
| 104 | + dueWeek = "孕" + week + "周" + (day > 0 ? "+" + day + "天" : ""); | |
| 105 | + map.put("fmWeek", dueWeek); | |
| 106 | + } else { | |
| 107 | + map.put("fmWeek", ""); | |
| 108 | + } | |
| 109 | + map.put("username", patients.getUsername()); | |
| 110 | + map.put("age", patients.getAge()); | |
| 111 | + map.put("phone", patients.getPhone()); | |
| 112 | + map.put("currentWeek", patients.getType() == 3 ? "已分娩" : DateUtil.getWeekDesc(patients.getLastMenses(), new Date())); | |
| 113 | + String risk = getRiskFactor(patients.getRiskFactorId()); | |
| 114 | + if (org.apache.commons.lang.StringUtils.isEmpty(risk)) { | |
| 115 | + risk = (org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor()) ? "" : patients.getoRiskFactor()); | |
| 116 | + } else { | |
| 117 | + risk = risk + (org.apache.commons.lang.StringUtils.isEmpty(patients.getoRiskFactor()) ? "" : "," + patients.getoRiskFactor()); | |
| 118 | + } | |
| 119 | +// String rFactor = commonService.resloveFactor(JsonUtil.toList(patients.getRiskLevelId(), String.class)); | |
| 120 | + map.put("riskFactor", risk); | |
| 121 | + map.put("patientId", patients.getId()); | |
| 122 | + map.put("pid", patients.getPid()); | |
| 123 | + map.put("cardNo", patients.getCardNo()); | |
| 114 | 124 | } |
| 115 | 125 | |
| 116 | 126 |