diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java index 21f212a..b22c7dd 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodPressureServiceImpl.java @@ -167,7 +167,6 @@ public class BloodPressureServiceImpl extends BaseServiceImpl implements IBloodP temp.put("ssy", infos.containsKey(date) ? infos.get(date).get("ssy") : "--"); temp.put("szy", infos.containsKey(date) ? infos.get(date).get("szy") : "--"); - xAxis.add(date.replace("-", "/")); ssy.add(infos.containsKey(date) ? infos.get(date).get("ssy") : 0); szy.add(infos.containsKey(date) ? infos.get(date).get("szy") : 0); 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 a5f6c62..3f295d3 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 @@ -86,7 +86,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient // 绑定医生和患者的关系 String patSerSyncUrl = Config.getItem("patSer_sync_url", "0"); - Map param = new LinkedHashMap<>(); + Map param = new HashMap<>(); param.put("doctorName", couponMapper.findUserName(userId + "")); param.put("patientId", patients.getId()); param.put("hospitalName", couponMapper.findHospitalNameById(hospitalId)); @@ -134,7 +134,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } } if(flag) { - Map m = new LinkedHashMap<>(); + Map m = new HashMap<>(); m.put("hospitalId", hospitalId); m.put("hospitalName", couponMapper.getHospitalName(hospitalId)); m.put("date", ymdDate); @@ -163,7 +163,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient // mongoTemplate.save(patientWeight); - Map m = new LinkedHashMap<>(); + Map m = new HashMap<>(); m.put("hospitalId", hospitalId); m.put("hospitalName", couponMapper.getHospitalName(hospitalId)); m.put("date", DateUtil.getyyyy_MM_dd(new Date())); @@ -280,6 +280,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient map.put("bim", patientWeight.getBmi()); // 体质指数(BMI)=体重(kg)÷身高^2(m) Map dayWeights = patientWeight.getDayWeights(); + dayWeights = sortMapByKey(dayWeights); Map weights = new LinkedHashMap<>(); if (MapUtils.isNotEmpty(dayWeights)) { Set> entries = dayWeights.entrySet(); @@ -296,6 +297,26 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient return RespBuilder.buildSuccess(); } + private Map sortMapByKey(Map dayWeights) { + if(MapUtils.isNotEmpty(dayWeights)) { + Map temp = new TreeMap<>(new Comparator() { + @Override + public int compare(String o1, String o2) { + return o1.compareTo(o2); + } + }); + for (Map.Entry entry : dayWeights.entrySet()) { + temp.put(entry.getKey(), entry.getValue()); + } + return temp; + } + return dayWeights; + } + + public static void main(String[] args) { + System.out.println("2017-12-16".compareTo("2017-12-18")); + } + @Override public BaseResponse edit(String id) { PatientWeight patientWeight = mongoTemplate.findById(id, PatientWeight.class); @@ -303,7 +324,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient List> weightInfo = new ArrayList<>(); List betweenDay = DateUtil.getBetweenDay(7); for (String date : betweenDay) { - Map temp = new LinkedHashMap<>(); + Map temp = new HashMap<>(); weightInfo.add(temp); temp.put("id", date); for (Map map : patientWeight.getDayWeights2()) { @@ -389,7 +410,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient Map map = new LinkedHashMap<>(); map.put("beforeWeight", patientWeight.getBeforeWeight()); Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); - Map dayWeights = patientWeight.getDayWeights(); + Map dayWeights = sortMapByKey(patientWeight.getDayWeights()); Map weights = new LinkedHashMap<>(); if (MapUtils.isNotEmpty(dayWeights)) { Set> entries = dayWeights.entrySet(); @@ -450,7 +471,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } } if(flag) { - Map m = new LinkedHashMap<>(); + Map m = new HashMap<>(); m.put("hospitalId", hospitalId); m.put("hospitalName", couponMapper.getHospitalName(hospitalId)); m.put("date", ymdDate); @@ -464,7 +485,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } if(StringUtils.isNotEmpty(nowWeight)) { - Map m = new LinkedHashMap<>(); + Map m = new HashMap<>(); m.put("hospitalId", hospitalId); m.put("hospitalName", couponMapper.getHospitalName(hospitalId)); m.put("date", ymdDate); @@ -494,7 +515,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient String dayWeigthsJson = patientWeight.getDayWeigthsJson(); JSONObject dayWeights = JSONObject.fromObject(dayWeigthsJson); Set set = dayWeights.entrySet(); - Map map = new LinkedHashMap<>(); + Map map = new HashMap<>(); for (Map.Entry entry : set) { map.put(entry.getKey() + "", entry.getValue() + ""); } @@ -532,7 +553,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient } - return RespBuilder.buildSuccess(patientWeight.getId()); + return RespBuilder.buildSuccess(patientWeight.getId()); } @Override @@ -550,7 +571,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient // 绑定医生和患者的关系 String patSerSyncUrl = Config.getItem("patSer_sync_url", "0"); - Map param = new LinkedHashMap<>(); + Map param = new HashMap<>(); param.put("doctorName", couponMapper.findUserName(userId + "")); param.put("patientId", patientWeight.getPatientId()); param.put("hospitalName", couponMapper.findHospitalNameById(hospitalId)); @@ -601,7 +622,7 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient new Thread(new Runnable() { @Override public void run() { - Map param = new LinkedHashMap<>(); + Map param = new HashMap<>(); param.put("userId", userId + ""); param.put("id", id); param.put("beforeWeight", beforeWeight);