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 b1a966d..b72c6cb 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 @@ -90,16 +90,16 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient String nowWeight = patientWeight.getNowWeight(); if(StringUtils.isEmpty(patientWeight.getId())) { if(StringUtils.isNotBlank(nowWeight) && StringUtils.isNotBlank(patientWeight.getPatientId())) { - Map weights = new HashMap<>(); PatientWeight weight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId())), PatientWeight.class); if(weight != null && MapUtils.isNotEmpty(weight.getWeights())) { - weights = weight.getWeights(); + Map weights = weight.getWeights(); + weights.put(DateUtil.getWeek(weight.getLastMenses(), new Date()), nowWeight); + weight.setWeights(weights); + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(weight)); + mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(weight.getId())), update, PatientWeight.class); + return RespBuilder.buildSuccess(patientWeight.getId()); } - weights.put(DateUtil.getWeek(weight.getLastMenses(), new Date()), nowWeight); - weight.setWeights(weights); - Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(weight)); - mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(weight.getId())), update, PatientWeight.class); - return RespBuilder.buildSuccess(patientWeight.getId()); + } String hospitalId = autoMatchFacade.getHospitalId(userId);