Commit fc6f81e0959a9c384c3eed68fe1517ee39d47c9b
1 parent
ff9e04666e
Exists in
master
and in
6 other branches
改逻辑
Showing 3 changed files with 7 additions and 14 deletions
- 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-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientWeightController.java
View file @
fc6f81e
... | ... | @@ -94,9 +94,9 @@ |
94 | 94 | * 体重报告(小程序和app使用) |
95 | 95 | */ |
96 | 96 | @ResponseBody |
97 | - @RequestMapping(value = "/report/wx/{patientId}", method = RequestMethod.GET) | |
98 | - public BaseResponse wxReport(@PathVariable String patientId) { | |
99 | - return patientWeightService.wxReport(patientId); | |
97 | + @RequestMapping(value = "/report/wx/{pid}", method = RequestMethod.GET) | |
98 | + public BaseResponse wxReport(@PathVariable String pid) { | |
99 | + return patientWeightService.wxReport(pid); | |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/PatientWeightService.java
View file @
fc6f81e
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java
View file @
fc6f81e
... | ... | @@ -283,12 +283,12 @@ |
283 | 283 | } |
284 | 284 | |
285 | 285 | @Override |
286 | - public BaseResponse wxReport(String patientId) { | |
287 | - PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientId).and("yn").ne("0")), PatientWeight.class); | |
286 | + public BaseResponse wxReport(String pid) { | |
287 | + PatientWeight patientWeight = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(pid).and("yn").ne("0")), PatientWeight.class); | |
288 | 288 | if(patientWeight != null) { |
289 | 289 | Map<String, Object> map = new HashMap<>(); |
290 | 290 | map.put("beforeWeight", patientWeight.getBeforeWeight()); |
291 | - Patients patients = mongoTemplate.findById(patientId, Patients.class); | |
291 | + Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class); | |
292 | 292 | Map<String, String> dayWeights = patientWeight.getDayWeights(); |
293 | 293 | Map<Integer, String> weights = new HashMap<>(); |
294 | 294 | if (MapUtils.isNotEmpty(dayWeights)) { |
... | ... | @@ -310,12 +310,6 @@ |
310 | 310 | PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patientWeight.getPatientId())), PatientWeight.class); |
311 | 311 | Map<String, String> dayWeights = new HashMap<>(); |
312 | 312 | if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) { |
313 | - /* patients = mongoTemplate.findOne(Query.query(Criteria.where("source").is(patientWeight.getPatientId()).and("hospitalId").is(hospitalId).and("enable").is("2")), Patients.class); | |
314 | - if(patients == null) { | |
315 | - return RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT); | |
316 | - } | |
317 | - patientWeight.setPatientId(patients.getId()); | |
318 | - pw = mongoTemplate.findOne(Query.query(Criteria.where("patientId").is(patients.getId()).and("hospitalId").is(hospitalId)), PatientWeight.class);*/ | |
319 | 313 | return RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT); |
320 | 314 | } |
321 | 315 | if(pw != null && StringUtils.isNotEmpty(patientWeight.getBeforeWeight())) { |
... | ... | @@ -328,7 +322,6 @@ |
328 | 322 | dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), nowWeight); |
329 | 323 | pw.setNowWeight(nowWeight); |
330 | 324 | pw.setDayWeights(dayWeights); |
331 | -// pw.setBmi(getBmi(patientWeight.getNowWeight(), pw.getBeforeHeight())); | |
332 | 325 | Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(pw)); |
333 | 326 | mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(pw.getId())), update, PatientWeight.class); |
334 | 327 | return RespBuilder.buildSuccess(pw.getId()); |