diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java index bad7f14..8c7ff97 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java @@ -545,6 +545,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient String yunqi = "孕" + String.valueOf(week) + "期"; map.put("yunqi", yunqi); } + map.put("week",week); map.put("height", patientWeight.getBeforeHeight() == null ? "" : MathUtil.doubleFormat(Double.parseDouble(patientWeight.getBeforeHeight()) / 100) + " 米"); map.put("beforeWeight", patientWeight.getBeforeWeight() == null ? "" : patientWeight.getBeforeWeight() + " 公斤"); map.put("bmi", patientWeight.getBmi()); @@ -560,8 +561,18 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient if (week > 5 && week < 41) { double bmi = Double.parseDouble(patientWeight.getBmi()); //根据高危获取不同的卡路里计算公式 - Map kmap = computeKulServiceManager.getComputeKulByRisk(rid).getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()), - Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight()); + + Map kmap = null; + //威海市妇幼热量单独计算 + if ("2100001635".equals(hospitalId)) + { + kmap = getWhComputeKul(week,Double.parseDouble(patientWeight.getNowWeight()), Double.parseDouble(patientWeight.getBeforeWeight()), patientWeight.getBregmatic(), bmi); + } + else + { + kmap = computeKulServiceManager.getComputeKulByRisk(rid).getComputeKul(Double.parseDouble(patientWeight.getBeforeWeight()), + Double.parseDouble(patientWeight.getNowWeight()), week, bmi, patientWeight.getBregmatic(), patientWeight.getBeforeHeight()); + } if (map == null || map.size() == 0) { return null; } @@ -578,6 +589,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient setYSYZ(map,ComputeKulServiceManager.getPatientGuideMap().get(rid+nsArea)); //设置饮食原则 setYYZN(map,ComputeKulServiceManager.getPatientGuideMap().get(rid+nsArea)); + } } } @@ -597,6 +609,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return RespBuilder.buildSuccess(); } + @Override public BaseResponse wxReport(String pid) { PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0")), PatientWeight.class); @@ -898,7 +911,6 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map.put("ysyz", patientGuide.getYsyz()); map.put("cookbookTitle", "饮食原则"); } - private void setYYZN(Map map, ComputeKulServiceManager.PatientGuide patientGuide) { if(null==patientGuide){ return; @@ -1099,8 +1111,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } String title = ""; String color = ""; - double low = 1; - double high = 1.5D; + String bmiStr = ""; //空和1表示单胎 @@ -1138,11 +1149,46 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } } + List xAxis = new ArrayList<>(); + + Map reportModel = new LinkedHashMap<>(); + Map series = new LinkedHashMap<>(); + getSeries(series, bmiStr, bregmatic); + + series.put("dayWeights", restList); + + reportModel.put("series", series); + + reportModel.put("title", title); + reportModel.put("color", color); + + for (int i = 1; i <= 40; i++) { + xAxis.add(i); + } + reportModel.put("xAxis", xAxis); + + List list = new ArrayList<>(); + if (MapUtils.isNotEmpty(weights)) { + Iterator> iterator = weights.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry next = iterator.next(); + list.add(Arrays.asList(next.getKey(), getDiff(beforeWeight, next.getValue()))); + } + } + series.put("portData", list); + restMap.put("reportModel", reportModel); + } + + + public void getSeries(Map series,String bmiStr,String bregmatic) + { Map highMap = new LinkedHashMap<>(); Map normalMap = new LinkedHashMap<>(); Map lowMap = new LinkedHashMap<>(); - List xAxis = new ArrayList<>(); + + double low = 1; + double high = 1.5D; double avg = Double.valueOf(String.format("%.2f", low / 12)); for (int i = 1; i <= 12; i++) { @@ -1175,34 +1221,9 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient normalMap.put(i, Double.valueOf(String.format("%.2f", (highMap.get(i) + lowMap.get(i)) / 2))); } - Map reportModel = new LinkedHashMap<>(); - Map series = new LinkedHashMap<>(); series.put("lowData", CollectionUtils.getValList(lowMap)); series.put("highData", CollectionUtils.getValList(highMap)); series.put("normalData", CollectionUtils.getValList(normalMap)); - - series.put("dayWeights", restList); - - reportModel.put("series", series); - - reportModel.put("title", title); - reportModel.put("color", color); - - for (int i = 1; i <= 40; i++) { - xAxis.add(i); - } - reportModel.put("xAxis", xAxis); - - List list = new ArrayList<>(); - if (MapUtils.isNotEmpty(weights)) { - Iterator> iterator = weights.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry next = iterator.next(); - list.add(Arrays.asList(next.getKey(), getDiff(beforeWeight, next.getValue()))); - } - } - series.put("portData", list); - restMap.put("reportModel", reportModel); } /** @@ -1368,6 +1389,98 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return map; } + + + public Map getWhComputeKul(int week, double currentWeight,double beforeWeight,String bregmatic, double bmiD) { + + String bmiStr = null; + //空和1表示单胎 + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) { + if (bmiD < 18.5) { + bmiStr = "BMI<18.5"; + } else if (bmiD >= 18.5 && bmiD <= 24.9) { + bmiStr = "BMI=18.5-24.9"; + } else if (bmiD > 24.9 && bmiD < 30) { + bmiStr = "BMI=25-29.9"; + } else if (bmiD >= 30) { + bmiStr = "BMI≥30"; + } + } else { + if (bmiD <= 24.9) { + bmiStr = "BMI≤24.9"; + } else if (bmiD >= 25 && bmiD <= 29.9) { + bmiStr = "BMI=25-29.9"; + } else if (bmiD >= 30) { + bmiStr = "BMI≥30"; + } + } + + Map series = new LinkedHashMap<>(); + getSeries(series, bmiStr, bregmatic); + + + List highMap = (List)series.get("highMap"); + List lowMap = (List)series.get("lowMap"); + + Map map = new HashMap<>(); + + double kulStart = 0; + double kulEnd = 0; + String status = ""; + + double add = Double.valueOf(String.format("%.2f", currentWeight - beforeWeight)); + + double hvalue = highMap.get(week-1); + double lvalue = lowMap.get(week - 1); + + //孕早期 + if (week <= 12) { + if (add < lvalue) { + status = "低于"; + kulStart = currentWeight * 30 ; + } else if (add >= lvalue && add <= hvalue) { + status = "处于"; + kulStart = currentWeight * 25; + } else { + status = "高于"; + kulStart = currentWeight * 20; + } + + } + //孕中期 + else if (week < 28) { + if (add < lvalue) { + status = "低于"; + kulStart = currentWeight * 30 +340; + } else if (add >= lvalue && add <= hvalue) { + status = "处于"; + kulStart = currentWeight * 25 + 340; + } else { + status = "高于"; + kulStart = currentWeight * 20 + 340; + } + } + else + { + if (add < lvalue) { + status = "低于"; + kulStart = currentWeight * 30 + 450; + } else if (add >= lvalue && add <= hvalue) { + status = "处于"; + kulStart = currentWeight * 25 + 450; + } else { + status = "高于"; + kulStart = currentWeight * 20 + 450; + } + } + kulEnd = kulStart; + map.put("kulStart", String.valueOf(kulStart)); + map.put("kulEnd", String.valueOf(kulEnd)); + map.put("status", status); + return map; + } + + /** * 获取高危的饮食原则 *