From 8cf457e181d2e4f50bc30b0b347558b62df52f5c Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Wed, 13 Sep 2017 14:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E9=87=8D=E7=AE=A1=E7=90=86=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operate/web/service/impl/PatientWeightServiceImpl.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 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); -- 1.8.3.1