Commit 8c06453650fc92f16cea85096f8bc4afdd71bc7a

Authored by litao@lymsh.com
1 parent 890c6fdafa

改同步逻辑

Showing 1 changed file with 2 additions and 36 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PatientWeightServiceImpl.java View file @ 8c06453
... ... @@ -363,42 +363,8 @@
363 363  
364 364 @Override
365 365 public BaseResponse wxAddOrUpdateSync(PatientWeight patientWeight) {
366   - String nowWeight = patientWeight.getNowWeight();
367   - Patients patients = mongoTemplate.findById(patientWeight.getPatientId(), Patients.class);
368   - PatientWeight pw = mongoTemplate.findOne(Query.query(Criteria.where("pid").is(patientWeight.getPid())), PatientWeight.class);
369   - Map<String, String> dayWeights = new LinkedHashMap<>();
370   - if(pw == null && StringUtils.isEmpty(patientWeight.getBeforeWeight())) {
371   - return RespBuilder.buildErro(ResponseCode.NEED_ADD_PATIENT_WEIGHT);
372   - }
373   - if(pw != null && StringUtils.isNotEmpty(patientWeight.getBeforeWeight())) {
374   - return RespBuilder.buildErro(ResponseCode.PATIENT_WEIGHT_IS_EXIST);
375   - }
376   - if(pw != null) {
377   - if(MapUtils.isNotEmpty(pw.getDayWeights())) {
378   - dayWeights = pw.getDayWeights();
379   - }
380   - dayWeights.put(DateUtil.getyyyy_MM_dd(new Date()), nowWeight);
381   - pw.setNowWeight(nowWeight);
382   - pw.setDayWeights(dayWeights);
383   - Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(pw));
384   - mongoTemplate.updateFirst(Query.query(Criteria.where("id").is(pw.getId())), update, PatientWeight.class);
385   -// patientWeightService2.update(Query.query(Criteria.where("id").is(pw.getId())), pw);
386   - return RespBuilder.buildSuccess(pw.getId());
387   - }
388   -
389   - if(patients != null) {
390   - patientWeight.setCreated(new Date());
391   - patientWeight.setHospitalId(patients.getHospitalId());
392   - if (StringUtils.isNotBlank(patientWeight.getNowWeight()) && patientWeight.getBeforeHeight() != null) {
393   - patientWeight.setBmi(getBmi(patientWeight.getNowWeight(), patientWeight.getBeforeHeight()));
394   - }
395   - patientWeight.setYn("1");
396   - patientWeight.setPid(patients.getPid());
397   - mongoTemplate.save(patientWeight);
398   -// patientWeightService2.add(patientWeight);
399   - return RespBuilder.buildSuccess(patientWeight.getId());
400   - }
401   - return RespBuilder.buildSuccess("patients为null");
  366 + mongoTemplate.save(patientWeight);
  367 + return RespBuilder.buildSuccess(patientWeight.getId());
402 368 }
403 369  
404 370 private void setGuide(Integer week, Map<String, Object> map) {