Commit 5bf12f0d21e39b74fe532af2bc2fd95f87e1ab65
1 parent
5dc200b88e
Exists in
master
and in
6 other branches
体重管理相关代码
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
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 | } |