Commit 665177d67578806f623f402421d722c8f505ceef

Authored by litao@lymsh.com
1 parent 8a84a32559

体重管理相关代码

Showing 4 changed files with 13 additions and 6 deletions

platform-common/src/main/java/com/lyms/platform/common/result/ResponseCode.java View file @ 665177d
... ... @@ -32,6 +32,7 @@
32 32 COUPON_IS_NOT_SELF(1007, "当前优惠劵不属于本人"),
33 33  
34 34 NEED_ADD_PATIENT_WEIGHT(4001, "该用户还未开通体重管理服务,请先开通!"),
  35 + PATIENT_WEIGHT_IS_EXIST(4002, "该用户已开通体重管理服务!"),
35 36  
36 37 NEED_BUILD(1101, "未找到建档信息");
37 38  
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
... ... @@ -21,7 +21,7 @@
21 21  
22 22 BaseResponse report(String id);
23 23  
24   - BaseResponse wxReport(String patientId, String hospitalId);
  24 + BaseResponse wxReport(String patientId);
25 25  
26 26 BaseResponse wxAddOrUpdate(PatientWeight patientWeight);
27 27 }
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();