Commit 8cf457e181d2e4f50bc30b0b347558b62df52f5c
1 parent
79969b562c
Exists in
master
and in
6 other branches
体重管理相关代码
Showing 1 changed file with 7 additions and 7 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
8cf457e
... | ... | @@ -90,16 +90,16 @@ |
90 | 90 | String nowWeight = patientWeight.getNowWeight(); |
91 | 91 | if(StringUtils.isEmpty(patientWeight.getId())) { |
92 | 92 | if(StringUtils.isNotBlank(nowWeight) && StringUtils.isNotBlank(patientWeight.getPatientId())) { |
93 | - Map<Integer, String> weights = new HashMap<>(); | |
94 | 93 | PatientWeight weight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId())), PatientWeight.class); |
95 | 94 | if(weight != null && MapUtils.isNotEmpty(weight.getWeights())) { |
96 | - weights = weight.getWeights(); | |
95 | + Map<Integer, String> weights = weight.getWeights(); | |
96 | + weights.put(DateUtil.getWeek(weight.getLastMenses(), new Date()), nowWeight); | |
97 | + weight.setWeights(weights); | |
98 | + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(weight)); | |
99 | + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(weight.getId())), update, PatientWeight.class); | |
100 | + return RespBuilder.buildSuccess(patientWeight.getId()); | |
97 | 101 | } |
98 | - weights.put(DateUtil.getWeek(weight.getLastMenses(), new Date()), nowWeight); | |
99 | - weight.setWeights(weights); | |
100 | - Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(weight)); | |
101 | - mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(weight.getId())), update, PatientWeight.class); | |
102 | - return RespBuilder.buildSuccess(patientWeight.getId()); | |
102 | + | |
103 | 103 | } |
104 | 104 | |
105 | 105 | String hospitalId = autoMatchFacade.getHospitalId(userId); |