Commit 13ea15348c3459c19c5ca2b037ea080bc6b59b64

Authored by changpengfei
1 parent 334e792164
Exists in master

更新患者待用卡数量

Showing 1 changed file with 29 additions and 0 deletions

talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java View file @ 13ea153
... ... @@ -563,5 +563,34 @@
563 563 baseResponse.setObject(patientListMap);
564 564 return baseResponse;
565 565 }
  566 +
  567 + /**
  568 + * 更新患者待用卡数量---小程序端使用
  569 + *
  570 + * @param patient
  571 + * @return
  572 + */
  573 + @PostMapping("updateCcnt")
  574 + public BaseResponse updateCcnt(@RequestBody LymsPatient patient){
  575 + BaseResponse baseResponse=new BaseResponse();
  576 + boolean f=false;
  577 + LymsPatient patient2=lymsPatientService.getById(patient.getId());
  578 + if(Objects.nonNull(patient2)){//验证问诊卡次数
  579 + int cnt=patient2.getCcnt()-1;
  580 + if (cnt < 0) {
  581 + baseResponse.setErrorcode(1);
  582 + baseResponse.setErrormsg("问诊卡次数错误");
  583 + return baseResponse;
  584 + }else{
  585 + patient.setCcnt(cnt);
  586 + }
  587 + }
  588 + if(Objects.nonNull(patient.getId()) ){
  589 + patient.setUpdatedtime(new Date());
  590 + f=lymsPatientService.saveOrUpdate(patient);
  591 + }
  592 + baseResponse.setErrorcode(f==true?0:1);
  593 + return baseResponse;
  594 + }
566 595 }