Commit 665177d67578806f623f402421d722c8f505ceef
1 parent
8a84a32559
Exists in
master
and in
6 other branches
体重管理相关代码
Showing 4 changed files with 13 additions and 6 deletions
- platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java
View file @
665177d
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
View file @
665177d
... | ... | @@ -94,9 +94,9 @@ |
94 | 94 | * 体重报告(小程序和app使用) |
95 | 95 | */ |
96 | 96 | @ResponseBody |
97 | - @RequestMapping(value = "/report/wx/{patientId}/{hospitalId}", method = RequestMethod.GET) | |
98 | - public BaseResponse wxReport(@PathVariable String patientId, @PathVariable String hospitalId) { | |
99 | - return patientWeightService.wxReport(patientId, hospitalId); | |
97 | + @RequestMapping(value = "/report/wx/{patientId}", method = RequestMethod.GET) | |
98 | + public BaseResponse wxReport(@PathVariable String patientId) { | |
99 | + return patientWeightService.wxReport(patientId); | |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
View file @
665177d
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
665177d
... | ... | @@ -245,8 +245,8 @@ |
245 | 245 | } |
246 | 246 | |
247 | 247 | @Override |
248 | - public BaseResponse wxReport(String patientId, String hospitalId) { | |
249 | - PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId).and("hospitalId").is(hospitalId)), PatientWeight.class); | |
248 | + public BaseResponse wxReport(String patientId) { | |
249 | + PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId).and("yn").ne("0")), PatientWeight.class); | |
250 | 250 | if(patientWeight != null) { |
251 | 251 | Map<String, Object> map = new HashMap<>(); |
252 | 252 | map.put("beforeWeight", patientWeight.getBeforeWeight()); |
... | ... | @@ -262,6 +262,12 @@ |
262 | 262 | Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); |
263 | 263 | PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId())), PatientWeight.class); |
264 | 264 | Map<Integer, String> weights = new HashMap<>(); |
265 | + if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) { | |
266 | + return RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT); | |
267 | + } | |
268 | + if(pw != null && StringUtils.isNotEmpty(patientWeight.getBeforeWeight())) { | |
269 | + return RespBuilder.buildErro(ResponseCode.PATIENT_WEIGHT_IS_EXIST); | |
270 | + } | |
265 | 271 | if(pw != null) { |
266 | 272 | if(MapUtils.isNotEmpty(pw.getWeights())) { |
267 | 273 | weights = pw.getWeights(); |