Commit cceb29bd740dbb53507180fe51122e4e4db2eef8
1 parent
31fe73db95
Exists in
master
and in
6 other branches
威海体重
Showing 1 changed file with 18 additions and 2 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
cceb29b
... | ... | @@ -375,7 +375,23 @@ |
375 | 375 | return dayWeights; |
376 | 376 | } |
377 | 377 | |
378 | + private Map<String, String> sortMapByKey1(Map<String, String> dayWeights) { | |
379 | + if (MapUtils.isNotEmpty(dayWeights)) { | |
380 | + Map<String, String> temp = new TreeMap<>(new Comparator<String>() { | |
381 | + @Override | |
382 | + public int compare(String o1, String o2) { | |
383 | + return o2.compareTo(o1); | |
384 | + } | |
385 | + }); | |
386 | + for (Map.Entry<String, String> entry : dayWeights.entrySet()) { | |
387 | + temp.put(entry.getKey(), entry.getValue()); | |
388 | + } | |
389 | + return temp; | |
390 | + } | |
391 | + return dayWeights; | |
392 | + } | |
378 | 393 | |
394 | + | |
379 | 395 | @Override |
380 | 396 | public BaseResponse edit(String id) { |
381 | 397 | PatientWeight patientWeight = mongoTemplate.findById(id, PatientWeight.class); |
382 | 398 | |
... | ... | @@ -1958,11 +1974,11 @@ |
1958 | 1974 | bmiD = Double.parseDouble(weight.getBmi()); |
1959 | 1975 | } |
1960 | 1976 | Map<String, String> dayWeights = weight.getDayWeights(); |
1961 | - dayWeights = sortMapByKey(dayWeights); | |
1977 | + dayWeights = sortMapByKey1(dayWeights); | |
1962 | 1978 | if (MapUtils.isNotEmpty(dayWeights) && dayWeights.size() > 1) { |
1963 | 1979 | int index = 0; |
1964 | 1980 | int count = 0; |
1965 | - for (String key : weight.getDayWeights().keySet()) { | |
1981 | + for (String key : dayWeights.keySet()) { | |
1966 | 1982 | int week = DateUtil.getWeek2(patients.getLastMenses(), DateUtil.parseYMD(key)); |
1967 | 1983 | //-1过低 0正常 1过高 |
1968 | 1984 | int level = handleWeightExcLevel(bmiD, weight.getBregmatic(),weight.getBeforeWeight(),dayWeights.get(key), week); |