diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java index db8f240..5b97043 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -563,4 +563,33 @@ public class PatientController { baseResponse.setObject(patientListMap); return baseResponse; } + + /** + * 更新患者待用卡数量---小程序端使用 + * + * @param patient + * @return + */ + @PostMapping("updateCcnt") + public BaseResponse updateCcnt(@RequestBody LymsPatient patient){ + BaseResponse baseResponse=new BaseResponse(); + boolean f=false; + LymsPatient patient2=lymsPatientService.getById(patient.getId()); + if(Objects.nonNull(patient2)){//验证问诊卡次数 + int cnt=patient2.getCcnt()-1; + if (cnt < 0) { + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("问诊卡次数错误"); + return baseResponse; + }else{ + patient.setCcnt(cnt); + } + } + if(Objects.nonNull(patient.getId()) ){ + patient.setUpdatedtime(new Date()); + f=lymsPatientService.saveOrUpdate(patient); + } + baseResponse.setErrorcode(f==true?0:1); + return baseResponse; + } }