diff --git a/platform-common/src/main/java/com/lyms/platform/common/utils/ReflectionUtils.java b/platform-common/src/main/java/com/lyms/platform/common/utils/ReflectionUtils.java index d500112..7c76ee8 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/utils/ReflectionUtils.java +++ b/platform-common/src/main/java/com/lyms/platform/common/utils/ReflectionUtils.java @@ -51,6 +51,8 @@ public class ReflectionUtils { if (!key.equals("class")) { // 得到property对应的getter方法 Method getter = property.getReadMethod(); + if (getter == null) + continue; Object value = getter.invoke(obj); map.put(key, value); 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 37cfaab..a5caecd 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 @@ -119,7 +119,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient - WEIGHT_RANGE.put("BMI<18.5孕0-12周","1.00-1.50"); + //WEIGHT_RANGE.put("BMI<18.5孕0-12周","1.00-1.50"); WEIGHT_RANGE.put("BMI<18.5孕13周","1.41-2.09"); WEIGHT_RANGE.put("BMI<18.5孕14周","1.82-2.68"); WEIGHT_RANGE.put("BMI<18.5孕15周","2.23-3.27"); @@ -150,7 +150,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient WEIGHT_RANGE.put("BMI<18.5孕40周","12.50-18.00"); - WEIGHT_RANGE.put("BMI=18.5-24.9孕0-12周","1.00-1.50"); + // WEIGHT_RANGE.put("BMI=18.5-24.9孕0-12周","1.00-1.50"); WEIGHT_RANGE.put("BMI=18.5-24.9孕13周","1.37-2.02"); WEIGHT_RANGE.put("BMI=18.5-24.9孕14周","1.75-2.54"); WEIGHT_RANGE.put("BMI=18.5-24.9孕15周","2.12-3.06"); @@ -181,7 +181,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient WEIGHT_RANGE.put("BMI=18.5-24.9孕40周","11.50-16.00"); - WEIGHT_RANGE.put("BMI=25-29.9孕0-12周","1.00-1.50"); + //WEIGHT_RANGE.put("BMI=25-29.9孕0-12周","1.00-1.50"); WEIGHT_RANGE.put("BMI=25-29.9孕13周","1.21-1.86"); WEIGHT_RANGE.put("BMI=25-29.9孕14周","1.42-2.22"); WEIGHT_RANGE.put("BMI=25-29.9孕15周","1.64-2.58"); @@ -212,7 +212,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient WEIGHT_RANGE.put("BMI=25-29.9孕40周","7.00-11.50"); - WEIGHT_RANGE.put("BMI≥30孕0-12周","1.00-1.50"); + //WEIGHT_RANGE.put("BMI≥30孕0-12周","1.00-1.50"); WEIGHT_RANGE.put("BMI≥30孕13周","1.14-1.77"); WEIGHT_RANGE.put("BMI≥30孕14周","1.28-2.22"); WEIGHT_RANGE.put("BMI≥30孕15周","1.42-2.04"); @@ -243,7 +243,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient WEIGHT_RANGE.put("BMI≥30孕40周","5.00-9.00"); - DWEIGHT_RANGE.put("BMI≤24.9孕0-12周","1.00-1.50kg"); + //DWEIGHT_RANGE.put("BMI≤24.9孕0-12周","1.00-1.50kg"); DWEIGHT_RANGE.put("BMI≤24.9孕13周","1.57-2.34"); DWEIGHT_RANGE.put("BMI≤24.9孕14周","2.14-3.18"); DWEIGHT_RANGE.put("BMI≤24.9孕15周","2.71-4.02"); @@ -274,7 +274,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient DWEIGHT_RANGE.put("BMI≤24.9孕40周","17.00-25.00"); - DWEIGHT_RANGE.put("BMI=25-29.9孕0-12周","1.00-1.50"); + //DWEIGHT_RANGE.put("BMI=25-29.9孕0-12周","1.00-1.50"); DWEIGHT_RANGE.put("BMI=25-29.9孕13周","1.46-2.27"); DWEIGHT_RANGE.put("BMI=25-29.9孕14周","1.93-3.04"); DWEIGHT_RANGE.put("BMI=25-29.9孕15周","2.39-3.81"); @@ -304,7 +304,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient DWEIGHT_RANGE.put("BMI=25-29.9孕39周","13.55-22.29"); DWEIGHT_RANGE.put("BMI=25-29.9孕40周","14.00-23.00"); - DWEIGHT_RANGE.put("BMI≥30孕0-12周","1.00-1.50"); + //DWEIGHT_RANGE.put("BMI≥30孕0-12周","1.00-1.50"); DWEIGHT_RANGE.put("BMI≥30孕13周","1.36-2.12"); DWEIGHT_RANGE.put("BMI≥30孕14周","1.72-2.75"); DWEIGHT_RANGE.put("BMI≥30孕15周","2.08-3.37"); @@ -588,7 +588,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map.put("isShow",false); } - setReport(map, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights()); + setReport(map, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(),patientWeight.getBregmatic()); CollectionUtils.removeNullValue(map); return RespBuilder.buildSuccess(map); @@ -720,7 +720,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient weights.put(DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(entry.getKey())), entry.getValue()); } } - setReport(map, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights()); + setReport(map, weights, patientWeight.getBeforeWeight(), patientWeight.getBmi(), patientWeight.getDayWeights(),patientWeight.getBregmatic()); CollectionUtils.removeNullValue(map); return RespBuilder.buildSuccess(map); } @@ -1198,7 +1198,8 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return restList; } - public void setReport(Map restMap, Map weights, String beforeWeight, String bmi, Map dayWeights) { + public void setReport(Map restMap, Map weights, String beforeWeight, + String bmi, Map dayWeights,String bregmatic) { List> restList = new ArrayList<>(); if(MapUtils.isNotEmpty(dayWeights)) { for (String key : dayWeights.keySet()) { @@ -1216,61 +1217,86 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } String title = ""; String color = ""; - double low = 0D; - double low2 = 0D; - double high = 0D; - double high2 = 0D; - if(bmiD <= 18.5) { - title = "低体重推荐增重均值"; - low = 1.2; - low2 = 11.9; - high = 3.8; - high2 = 18.1; - color = "#00CD00"; - } else if(bmiD > 18.5 && bmiD <= 24.9){ - title = "标准体重推荐增重均值"; - low = 1.4; - low2 = 11.9; - high = 3.2; - high2 = 15.9; - color = "#7EC0EE"; - } else if(bmiD > 24.9 && bmiD < 30){ - title = "超重体重推荐增重均值"; - low = 1.1 ; - low2 = 7.1; - high = 3.1; - high2 = 11.6; - color = "#CD3333"; - } else if(bmiD >= 30){ - title = "肥胖体重推荐增重均值"; - low = 0.8 ; - low2 = 4.9; - high = 2.1; - high2 = 8.9; - color = "#CD00CD"; + double low = 1; + double high = 1.5D; + String bmiStr = ""; + + //空和1表示单胎 + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) + { + if(bmiD <= 18.5) { + title = "低体重推荐增重均值"; + color = "#00CD00"; + bmiStr = "BMI<18.5"; + } else if(bmiD > 18.5 && bmiD <= 24.9){ + title = "标准体重推荐增重均值"; + color = "#7EC0EE"; + bmiStr = "BMI=18.5-24.9"; + } else if(bmiD > 24.9 && bmiD < 30){ + title = "超重体重推荐增重均值"; + color = "#CD3333"; + bmiStr = "BMI=25-29.9"; + } else if(bmiD >= 30){ + title = "肥胖体重推荐增重均值"; + color = "#CD00CD"; + bmiStr = "BMI≥30"; + } + } + else + { + if(bmiD <= 24.9) { + title = "标准体重推荐增重均值"; + color = "#7EC0EE"; + bmiStr = "BMI≤24.9"; + } else if(bmiD >= 25 && bmiD <= 29.9){ + title = "超重体重推荐增重均值"; + color = "#CD3333"; + bmiStr = "BMI=25-29.9"; + } else if(bmiD >= 30){ + title = "肥胖体重推荐增重均值"; + color = "#CD00CD"; + bmiStr = "BMI≥30"; + } } + Map highMap = new LinkedHashMap<>(); Map normalMap = new LinkedHashMap<>(); Map lowMap = new LinkedHashMap<>(); List xAxis = new ArrayList<>(); - double avg = low / 13; - for (int i = 0; i <= 13; i++) { + + double avg = low / 12; + for (int i = 1; i <= 12; i++) { lowMap.put(i, i * avg); } - double avg2 = (low2 - low) / 27; - for (int i = 1; i <= 27; i++) { - lowMap.put(13 + i, low + i * avg2); - } - double highAvg = high / 13; - for (int i = 0; i <= 13; i++) { + + double highAvg = high / 12; + for (int i = 1; i <= 12; i++) { highMap.put(i, i * highAvg); } - double highAvg2 = (high2 - high) / 27; - for (int i = 1; i <= 27; i++) { - highMap.put(13 + i, high + i * highAvg2); + + for (int i = 13; i <= 40; i++) { + + String range = ""; + //空和1表示单胎 + if (!StringUtils.isNotEmpty(bregmatic) || "1".equals(bregmatic)) + { + range = WEIGHT_RANGE.get(bmiStr+"孕"+i+"周"); + } + else + { + range = DWEIGHT_RANGE.get(bmiStr+"孕"+i+"周"); + } + + if (StringUtils.isNotEmpty(range)) + { + String[] array = range.split("-"); + lowMap.put(i, Double.parseDouble(array[0])); + highMap.put(i, Double.parseDouble(array[1])); + } } - for (int i = 0; i <= 40; i++) { + + for (int i = 1; i <= 40; i++) { normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); }