From 8c06453650fc92f16cea85096f8bc4afdd71bc7a Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Thu, 28 Sep 2017 03:55:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8C=E6=AD=A5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/service/impl/PatientWeightServiceImpl.java | 38 ++-------------------- 1 file changed, 2 insertions(+), 36 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 005845b..d32e46e 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 @@ -363,42 +363,8 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient @Override public BaseResponse wxAddOrUpdateSync(PatientWeight patientWeight) { - String nowWeight = patientWeight.getNowWeight(); - Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); - PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patientWeight.getPid())), PatientWeight.class); - Map dayWeights = new LinkedHashMap<>(); - if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) { - return RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT); - } - if(pw != null && StringUtils.isNotEmpty(patientWeight.getBeforeWeight())) { - return RespBuilder.buildErro(ResponseCode.PATIENT_WEIGHT_IS_EXIST); - } - if(pw != null) { - if(MapUtils.isNotEmpty(pw.getDayWeights())) { - dayWeights = pw.getDayWeights(); - } - dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), nowWeight); - pw.setNowWeight(nowWeight); - pw.setDayWeights(dayWeights); - Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(pw)); - mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(pw.getId())), update, PatientWeight.class); -// patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw); - return RespBuilder.buildSuccess(pw.getId()); - } - - if(patients != null) { - patientWeight.setCreated(new Date()); - patientWeight.setHospitalId(patients.getHospitalId()); - if (StringUtils.isNotBlank(patientWeight.getNowWeight()) && patientWeight.getBeforeHeight() != null) { - patientWeight.setBmi(getBmi(patientWeight.getNowWeight(), patientWeight.getBeforeHeight())); - } - patientWeight.setYn("1"); - patientWeight.setPid(patients.getPid()); - mongoTemplate.save(patientWeight); -// patientWeightService2.add(patientWeight); - return RespBuilder.buildSuccess(patientWeight.getId()); - } - return RespBuilder.buildSuccess("patients为null"); + mongoTemplate.save(patientWeight); + return RespBuilder.buildSuccess(patientWeight.getId()); } private void setGuide(Integer week, Map map) { -- 1.8.3.1