Commit 5bf12f0d21e39b74fe532af2bc2fd95f87e1ab65

Authored by litao@lymsh.com
1 parent 5dc200b88e

体重管理相关代码

Showing 2 changed files with 7 additions and 1 deletions

platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java View file @ 5bf12f0
... ... @@ -31,6 +31,8 @@
31 31 COUPON_IS_USED(1006, "当前优惠劵已经在其他医院使用,不能重复使用"),
32 32 COUPON_IS_NOT_SELF(1007, "当前优惠劵不属于本人"),
33 33  
  34 + NEED_ADD_PATIENT_WEIGHT(4001, "该用户还未开通体重管理服务,请先开通!"),
  35 +
34 36 NEED_BUILD(1101, "未找到建档信息");
35 37  
36 38 private Integer code;
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ 5bf12f0
... ... @@ -4,6 +4,7 @@
4 4 import com.lyms.platform.common.result.BaseResponse;
5 5 import com.lyms.platform.common.result.PageResult;
6 6 import com.lyms.platform.common.result.RespBuilder;
  7 +import com.lyms.platform.common.result.ResponseCode;
7 8 import com.lyms.platform.common.utils.*;
8 9 import com.lyms.platform.operate.web.facade.AutoMatchFacade;
9 10 import com.lyms.platform.operate.web.service.PatientWeightService;
... ... @@ -55,6 +56,9 @@
55 56 String nowWeight = patientWeight.getNowWeight();
56 57 Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class);
57 58 PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId()).and("hospitalId").is(hospitalId)), PatientWeight.class);
  59 + if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) {
  60 + RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT);
  61 + }
58 62 Map<Integer, String> weights = new HashMap<>();
59 63 Map<String, String> dayWeights = new HashMap<>();
60 64 if(pw != null) {
... ... @@ -700,7 +704,7 @@
700 704 private Double getDiff(String before, String now) {
701 705 Double b = Double.parseDouble(before);
702 706 Double n = Double.parseDouble(now);
703   - return n - b;
  707 + return MathUtil.doubleFormat2(n - b);
704 708 }
705 709 }