From 5bf12f0d21e39b74fe532af2bc2fd95f87e1ab65 Mon Sep 17 00:00:00 2001 From: "litao@lymsh.com" Date: Tue, 19 Sep 2017 16:58:23 +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 --- .../src/main/java/com/lyms/platform/common/result/ResponseCode.java | 2 ++ .../platform/operate/web/service/impl/PatientWeightServiceImpl.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java b/platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java index d96d609..60885a7 100644 --- a/platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java +++ b/platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java @@ -31,6 +31,8 @@ public enum ResponseCode { COUPON_IS_USED(1006, "当前优惠劵已经在其他医院使用,不能重复使用"), COUPON_IS_NOT_SELF(1007, "当前优惠劵不属于本人"), + NEED_ADD_PATIENT_WEIGHT(4001, "该用户还未开通体重管理服务,请先开通!"), + NEED_BUILD(1101, "未找到建档信息"); private Integer code; 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 1c0a60c..e24542d 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 @@ -4,6 +4,7 @@ import com.lyms.platform.common.enums.*; import com.lyms.platform.common.result.BaseResponse; import com.lyms.platform.common.result.PageResult; import com.lyms.platform.common.result.RespBuilder; +import com.lyms.platform.common.result.ResponseCode; import com.lyms.platform.common.utils.*; import com.lyms.platform.operate.web.facade.AutoMatchFacade; import com.lyms.platform.operate.web.service.PatientWeightService; @@ -55,6 +56,9 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient String nowWeight = patientWeight.getNowWeight(); Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId()).and("hospitalId").is(hospitalId)), PatientWeight.class); + if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) { + RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT); + } Map weights = new HashMap<>(); Map dayWeights = new HashMap<>(); if(pw != null) { @@ -700,6 +704,6 @@ public class PatientWeightServiceImpl extends BaseServiceImpl implements Patient private Double getDiff(String before, String now) { Double b = Double.parseDouble(before); Double n = Double.parseDouble(now); - return n - b; + return MathUtil.doubleFormat2(n - b); } } -- 1.8.3.1