From 98329a1cc5f3be8be135be4b523d893bd5297545 Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Thu, 28 Sep 2017 00:46:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=9C=89=E5=BA=8Fmap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/service/impl/PatientWeightServiceImpl.java | 246 ++++++++------------- 1 file changed, 88 insertions(+), 158 deletions(-) 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 d889527..b73538f 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 @@ -18,8 +18,6 @@ import com.lyms.platform.pojo.PatientWeight; import com.lyms.platform.pojo.Patients; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Sort; import org.springframework.data.mongodb.core.MongoTemplate; @@ -49,8 +47,6 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient @Autowired private PatientsService patientsService; - private Logger logger = LoggerFactory.getLogger(PatientWeightServiceImpl.class); - /** * 最低:0~13 : 0~1.9 13~40 1.9~11.9 * 最高: 0~2.2 2.2~15.9 @@ -92,7 +88,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient patientsService.addPatient(patients); patientWeight.setPatientId(patients.getId()); } - Map dayWeights = new HashMap<>(); + Map dayWeights = new LinkedHashMap<>(); if(pw != null) { if(MapUtils.isNotEmpty(pw.getDayWeights())) { dayWeights = pw.getDayWeights(); @@ -168,7 +164,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient for (PatientWeight patientWeight : patientWeights) { Patients p = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); if(patients != null) { - Map temp = new HashMap<>(); + Map temp = new LinkedHashMap<>(); temp.put("id", patientWeight.getId()); temp.put("username", p.getUsername()); temp.put("age", DateUtil.getAge(p.getBirth())); @@ -216,7 +212,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map.put("bim", patientWeight.getBmi()); // 体质指数(BMI)=体重(kg)÷身高^2(m) Map dayWeights = patientWeight.getDayWeights(); - Map weights = new HashMap<>(); + Map weights = new LinkedHashMap<>(); if (MapUtils.isNotEmpty(dayWeights)) { Set> entries = dayWeights.entrySet(); for (Map.Entry entry : entries) { @@ -248,7 +244,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient public BaseResponse report(String id) { PatientWeight patientWeight = mongoTemplate.findById(id, PatientWeight.class); if(patientWeight != null) { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); Integer week = null; if(patients != null) { @@ -285,7 +281,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } Map dayWeights = patientWeight.getDayWeights(); - Map weights = new HashMap<>(); + Map weights = new LinkedHashMap<>(); if (MapUtils.isNotEmpty(dayWeights)) { Set> entries = dayWeights.entrySet(); for (Map.Entry entry : entries) { @@ -303,11 +299,11 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient public BaseResponse wxReport(String pid) { PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0")), PatientWeight.class); if(patientWeight != null) { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); map.put("beforeWeight", patientWeight.getBeforeWeight()); Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); Map dayWeights = patientWeight.getDayWeights(); - Map weights = new HashMap<>(); + Map weights = new LinkedHashMap<>(); if (MapUtils.isNotEmpty(dayWeights)) { Set> entries = dayWeights.entrySet(); for (Map.Entry entry : entries) { @@ -325,7 +321,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient String nowWeight = patientWeight.getNowWeight(); Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patientWeight.getPid())), PatientWeight.class); - Map dayWeights = new HashMap<>(); + Map dayWeights = new LinkedHashMap<>(); if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) { return RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT); } @@ -369,7 +365,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient String nowWeight = patientWeight.getNowWeight(); Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patientWeight.getPid())), PatientWeight.class); - Map dayWeights = new HashMap<>(); + Map dayWeights = new LinkedHashMap<>(); if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) { return RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT); } @@ -442,12 +438,12 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient private void setRecipe(Integer week, Map map) { String recipeTitle1 = ""; String recipeTitle2 = ""; - Map breakfast = new HashMap<>(); // 早餐 - Map breakfast2 = new HashMap<>(); // 上午加餐 - Map lunch = new HashMap<>(); // 午餐 - Map lunch2 = new HashMap<>(); // 下午加餐 - Map dinner = new HashMap<>(); // 晚餐 - Map dinner2 = new HashMap<>(); // 晚加餐 + Map breakfast = new LinkedHashMap<>(); // 早餐 + Map breakfast2 = new LinkedHashMap<>(); // 上午加餐 + Map lunch = new LinkedHashMap<>(); // 午餐 + Map lunch2 = new LinkedHashMap<>(); // 下午加餐 + Map dinner = new LinkedHashMap<>(); // 晚餐 + Map dinner2 = new LinkedHashMap<>(); // 晚加餐 if(week <= 12) { setData(breakfast, "早餐", "(谷类80克,蔬菜70克,蛋类50克,坚果18克,油脂5克)\n" + "面包(30克);小米绿豆粥(小米25克,绿豆25克);\n" + @@ -536,7 +532,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } private Map setData2(String ... values) { - Map map = new HashMap<>(); + Map map = new LinkedHashMap<>(); map.put("id", values[0]); List value = new ArrayList<>(); for (int i = 1; i < values.length; i++) { @@ -718,27 +714,27 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } } - /** - BMI指数: - 低体重(<18.5) 0-13周 13-40周 - 最低 0-1.2 1.2-11.9 - 最高 0-3.8 3.8-18.1 - 标准 (18.5-24.9) 0-13周 13-40周 - 最低 0-1.4 1.4-11.9 - 最高 0-3.2 3.2-15.9 - - 超重(25.0-29.9) 0-13周 13-40周 - 最低 0-1.1 1.1-7.1 - 最高 0-3.1 3.2-11.6 - 肥胖 (>=30.0) 0-13周 13-40周 - 最低 0-0.8 0.9-4.9 - 最高 0-2.1 2.1-8.9 + /** + BMI指数: + 低体重(<18.5) 0-13周 13-40周 + 最低 0-1.2 1.2-11.9 + 最高 0-3.8 3.8-18.1 + 标准 (18.5-24.9) 0-13周 13-40周 + 最低 0-1.4 1.4-11.9 + 最高 0-3.2 3.2-15.9 + + 超重(25.0-29.9) 0-13周 13-40周 + 最低 0-1.1 1.1-7.1 + 最高 0-3.1 3.2-11.6 + 肥胖 (>=30.0) 0-13周 13-40周 + 最低 0-0.8 0.9-4.9 + 最高 0-2.1 2.1-8.9 */ public void setAppReport(Map restMap, Map weights, String beforeWeight, String bmi, Map dayWeights) { List> restList = new ArrayList<>(); if(MapUtils.isNotEmpty(dayWeights)) { for (String key : dayWeights.keySet()) { - Map temp = new HashMap<>(); + Map temp = new LinkedHashMap<>(); temp.put("nowWeight", dayWeights.get(key)); temp.put("recordTime", key); restList.add(temp); @@ -750,42 +746,69 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient if(StringUtils.isNotEmpty(bmi)) { bmiD = Double.parseDouble(bmi); } - List highData = new ArrayList<>(); - List normalData = new ArrayList<>(); - List lowData = new ArrayList<>(); + double low = 0D; + double low2 = 0D; + double high = 0D; + double high2 = 0D; String color = ""; if(bmiD <= 18.5) { - highData = getDoubleList(Arrays.asList("0.0,0.3,0.6,0.9,1.2,1.5,1.8,2.0,2.3,2.6,2.9,3.2,3.5,3.8,4.3,4.9,5.4,5.9,6.4,7.0,7.5,8.0,8.6,9.1,9.6,10.2,10.7,11.2,11.7,12.3,12.8,13.3,13.9,14.4,14.9,15.5,16.0,16.5,17.0,17.6,18.1".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,3.0,3.4,3.9,4.4,4.8,5.3,5.7,6.2,6.7,7.1,7.6,8.1,8.5,9.0,9.4,9.9,10.4,10.8,11.3,11.8,12.2,12.7,13.1,13.6,14.1,14.5,15.0".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.2,5.6,6.0,6.4,6.7,7.1,7.5,7.9,8.3,8.7,9.1,9.5,9.9,10.3,10.7,11.1,11.5,11.9".split(","))); + low = 1.2; + low2 = 11.9; + high = 3.8; + high2 = 18.1; color = "#00CD00"; } else if(bmiD > 18.5 && bmiD <= 24.9){ - highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.5,1.7,2.0,2.2,2.5,2.7,3.0,3.2,3.7,4.1,4.6,5.1,5.6,6.0,6.5,7.0,7.4,7.9,8.4,8.8,9.3,9.8,10.3,10.7,11.2,11.7,12.1,12.6,13.1,13.5,14.0,14.5,15.0,15.4,15.9".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.5,0.7,0.9,1.1,1.2,1.4,1.6,1.8,1.9,2.1,2.3,2.7,3.2,3.6,4.0,4.4,4.9,5.3,5.7,6.2,6.6,7.0,7.5,7.9,8.3,8.7,9.2,9.6,10.0,10.5,10.9,11.3,11.8,12.2,12.6,13.0,13.5,13.9".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.8,2.2,2.6,3.0,3.3,3.7,4.1,4.5,4.9,5.3,5.7,6.1,6.5,6.8,7.2,7.6,8.0,8.4,8.8,9.2,9.6,10.0,10.3,10.7,11.1,11.5,11.9".split(","))); + low = 1.4; + low2 = 11.9; + high = 3.2; + high2 = 15.9; color = "#7EC0EE"; } else if(bmiD > 24.9 && bmiD < 30){ - highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.4,1.7,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.7,4.0,4.4,4.7,5.0,5.3,5.6,5.9,6.2,6.6,6.9,7.2,7.5,7.8,8.1,8.5,8.8,9.1,9.4,9.7,10.0,10.3,10.7,11.0,11.3,11.6".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.2,3.4,3.7,4.0,4.2,4.5,4.8,5.1,5.3,5.6,5.9,6.1,6.4,6.7,6.9,7.2,7.5,7.7,8.0,8.3,8.5,8.8,9.1,9.3".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.3,0.4,0.5,0.6,0.7,0.8,0.8,0.9,1.0,1.1,1.3,1.5,1.8,2.0,2.2,2.4,2.7,2.9,3.1,3.3,3.5,3.8,4.0,4.2,4.4,4.7,4.9,5.1,5.3,5.5,5.8,6.0,6.2,6.4,6.7,6.9,7.1".split(","))); + low = 1.1 ; + low2 = 7.1; + high = 3.1; + high2 = 11.6; color = "#CD3333"; } else if(bmiD >= 30){ - highData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.6,3.9,4.1,4.4,4.6,4.9,5.1,5.4,5.6,5.9,6.1,6.4,6.6,6.9,7.1,7.4,7.6,7.9,8.1,8.4,8.6,8.9".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,2.7,2.9,3.1,3.3,3.5,3.7,3.9,4.1,4.3,4.5,4.7,4.9,5.1,5.3,5.5,5.7,5.9,6.1,6.3,6.5,6.7,6.9".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.1,0.2,0.2,0.3,0.4,0.4,0.5,0.6,0.6,0.7,0.7,0.8,1.0,1.1,1.3,1.4,1.6,1.7,1.9,2.0,2.2,2.3,2.5,2.6,2.8,2.9,3.1,3.2,3.4,3.5,3.7,3.8,4.0,4.1,4.3,4.4,4.6,4.7,4.9".split(","))); + low = 0.8 ; + low2 = 4.9; + high = 2.1; + high2 = 8.9; color = "#CD00CD"; } + 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++) { + 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++) { + 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 = 0; i <= 40; i++) { + normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); + } - Map reportModel = new HashMap<>(); - Map series = new HashMap<>(); + Map reportModel = new LinkedHashMap<>(); + Map series = new LinkedHashMap<>(); // series.put("lowData", MathUtil.doubleFormat2(CollectionUtils.getValList(lowMap))); // series.put("highData", MathUtil.doubleFormat2(CollectionUtils.getValList(highMap))); // series.put("normalData", MathUtil.doubleFormat2(CollectionUtils.getValList(normalMap))); - series.put("lowData", lowData); - series.put("highData", highData); - series.put("normalData", normalData); + series.put("lowData", delOtherPort(CollectionUtils.getValList(lowMap))); + series.put("highData", delOtherPort(CollectionUtils.getValList(highMap))); + series.put("normalData", delOtherPort(CollectionUtils.getValList(normalMap))); series.put("dayWeights", restList); @@ -811,7 +834,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient Iterator> iterator = weights.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry next = iterator.next(); - Map temp = new HashMap<>(); + Map temp = new LinkedHashMap<>(); temp.put("week", next.getKey()); temp.put("weight", getDiff(beforeWeight, next.getValue())); list.add(temp); @@ -840,104 +863,11 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return restList; } - public List getDoubleList(List list) { - List rest = new ArrayList<>(); - for (String s : list) { - rest.add(Double.parseDouble(s)); - } - return rest; - } - public void setReport(Map restMap, Map weights, String beforeWeight, String bmi, Map dayWeights) { List> restList = new ArrayList<>(); if(MapUtils.isNotEmpty(dayWeights)) { for (String key : dayWeights.keySet()) { - Map temp = new HashMap<>(); - temp.put("nowWeight", dayWeights.get(key)); - temp.put("recordTime", key); - restList.add(temp); - } - } - - List highData = new ArrayList<>(); - List normalData = new ArrayList<>(); - List lowData = new ArrayList<>(); - // 小程序和app可能没有bmi 默认返回标准 - Double bmiD = 20D; - if(StringUtils.isNotEmpty(bmi)) { - bmiD = Double.parseDouble(bmi); - } - String title = ""; - String color = ""; - if(bmiD <= 18.5) { - title = "低体重推荐增重均值"; - highData = getDoubleList(Arrays.asList("0.0,0.3,0.6,0.9,1.2,1.5,1.8,2.0,2.3,2.6,2.9,3.2,3.5,3.8,4.3,4.9,5.4,5.9,6.4,7.0,7.5,8.0,8.6,9.1,9.6,10.2,10.7,11.2,11.7,12.3,12.8,13.3,13.9,14.4,14.9,15.5,16.0,16.5,17.0,17.6,18.1".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.6,0.8,1.0,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,3.0,3.4,3.9,4.4,4.8,5.3,5.7,6.2,6.7,7.1,7.6,8.1,8.5,9.0,9.4,9.9,10.4,10.8,11.3,11.8,12.2,12.7,13.1,13.6,14.1,14.5,15.0".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.6,2.0,2.4,2.8,3.2,3.6,4.0,4.4,4.8,5.2,5.6,6.0,6.4,6.7,7.1,7.5,7.9,8.3,8.7,9.1,9.5,9.9,10.3,10.7,11.1,11.5,11.9".split(","))); - color = "#00CD00"; - } else if(bmiD > 18.5 && bmiD <= 24.9){ - title = "标准体重推荐增重均值"; - highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.5,1.7,2.0,2.2,2.5,2.7,3.0,3.2,3.7,4.1,4.6,5.1,5.6,6.0,6.5,7.0,7.4,7.9,8.4,8.8,9.3,9.8,10.3,10.7,11.2,11.7,12.1,12.6,13.1,13.5,14.0,14.5,15.0,15.4,15.9".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.2,0.4,0.5,0.7,0.9,1.1,1.2,1.4,1.6,1.8,1.9,2.1,2.3,2.7,3.2,3.6,4.0,4.4,4.9,5.3,5.7,6.2,6.6,7.0,7.5,7.9,8.3,8.7,9.2,9.6,10.0,10.5,10.9,11.3,11.8,12.2,12.6,13.0,13.5,13.9".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.8,2.2,2.6,3.0,3.3,3.7,4.1,4.5,4.9,5.3,5.7,6.1,6.5,6.8,7.2,7.6,8.0,8.4,8.8,9.2,9.6,10.0,10.3,10.7,11.1,11.5,11.9".split(","))); - color = "#7EC0EE"; - } else if(bmiD > 24.9 && bmiD < 30){ - title = "超重体重推荐增重均值"; - highData = getDoubleList(Arrays.asList("0.0,0.2,0.5,0.7,1.0,1.2,1.4,1.7,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.7,4.0,4.4,4.7,5.0,5.3,5.6,5.9,6.2,6.6,6.9,7.2,7.5,7.8,8.1,8.5,8.8,9.1,9.4,9.7,10.0,10.3,10.7,11.0,11.3,11.6".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.2,3.4,3.7,4.0,4.2,4.5,4.8,5.1,5.3,5.6,5.9,6.1,6.4,6.7,6.9,7.2,7.5,7.7,8.0,8.3,8.5,8.8,9.1,9.3".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.3,0.4,0.5,0.6,0.7,0.8,0.8,0.9,1.0,1.1,1.3,1.5,1.8,2.0,2.2,2.4,2.7,2.9,3.1,3.3,3.5,3.8,4.0,4.2,4.4,4.7,4.9,5.1,5.3,5.5,5.8,6.0,6.2,6.4,6.7,6.9,7.1".split(","))); - color = "#CD3333"; - } else if(bmiD >= 30){ - title = "肥胖体重推荐增重均值"; - highData = getDoubleList(Arrays.asList("0.0,0.2,0.3,0.5,0.6,0.8,1.0,1.1,1.3,1.5,1.6,1.8,1.9,2.1,2.4,2.6,2.9,3.1,3.4,3.6,3.9,4.1,4.4,4.6,4.9,5.1,5.4,5.6,5.9,6.1,6.4,6.6,6.9,7.1,7.4,7.6,7.9,8.1,8.4,8.6,8.9".split(","))); - normalData = getDoubleList(Arrays.asList("0.0,0.1,0.2,0.3,0.4,0.6,0.7,0.8,0.9,1.0,1.1,1.2,1.3,1.5,1.7,1.9,2.1,2.3,2.5,2.7,2.9,3.1,3.3,3.5,3.7,3.9,4.1,4.3,4.5,4.7,4.9,5.1,5.3,5.5,5.7,5.9,6.1,6.3,6.5,6.7,6.9".split(","))); - lowData = getDoubleList(Arrays.asList("0.0,0.1,0.1,0.2,0.2,0.3,0.4,0.4,0.5,0.6,0.6,0.7,0.7,0.8,1.0,1.1,1.3,1.4,1.6,1.7,1.9,2.0,2.2,2.3,2.5,2.6,2.8,2.9,3.1,3.2,3.4,3.5,3.7,3.8,4.0,4.1,4.3,4.4,4.6,4.7,4.9".split(","))); - color = "#CD00CD"; - } - - List xAxis = new ArrayList<>(); - - Map reportModel = new HashMap<>(); - Map series = new HashMap<>(); - series.put("lowData", lowData); - series.put("highData", highData); - series.put("normalData", normalData); - - series.put("dayWeights", restList); - - reportModel.put("series", series); - - reportModel.put("title", title); - reportModel.put("color", color); - - for (int i = 0; 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); - series.put("portData", list); - restMap.put("reportModel", reportModel); - } - - /*public void setReport(Map restMap, Map weights, String beforeWeight, String bmi, Map dayWeights) { - logger.info("restMap>> " + restMap); - logger.info("weights>> " + weights); - logger.info("beforeWeight>> " + beforeWeight); - logger.info("bmi>> " + bmi); - logger.info("dayWeights>> " + dayWeights); - List> restList = new ArrayList<>(); - if(MapUtils.isNotEmpty(dayWeights)) { - for (String key : dayWeights.keySet()) { - Map temp = new HashMap<>(); + Map temp = new LinkedHashMap<>(); temp.put("nowWeight", dayWeights.get(key)); temp.put("recordTime", key); restList.add(temp); @@ -985,9 +915,9 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient color = "#CD00CD"; } - Map highMap = new HashMap<>(); - Map normalMap = new HashMap<>(); - Map lowMap = new HashMap<>(); + 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++) { @@ -1009,8 +939,8 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient normalMap.put(i, (highMap.get(i) + lowMap.get(i)) / 2); } - Map reportModel = new HashMap<>(); - Map series = new HashMap<>(); + Map reportModel = new LinkedHashMap<>(); + Map series = new LinkedHashMap<>(); series.put("lowData", MathUtil.doubleFormat2(CollectionUtils.getValList(lowMap))); series.put("highData", MathUtil.doubleFormat2(CollectionUtils.getValList(highMap))); series.put("normalData", MathUtil.doubleFormat2(CollectionUtils.getValList(normalMap))); @@ -1027,7 +957,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } reportModel.put("xAxis", xAxis); - List list = new ArrayList<>(); + List list = new ArrayList<>(); if(MapUtils.isNotEmpty(weights)) { Iterator> iterator = weights.entrySet().iterator(); while (iterator.hasNext()) { @@ -1038,7 +968,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient series.put("portData", list); series.put("portData", list); restMap.put("reportModel", reportModel); - }*/ + } /** * 获取两个体重之间相差的数值 -- 1.8.3.1