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 f9f71ef..f8cff23 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java @@ -1029,6 +1029,8 @@ public class PatientController { @TokenRequired public BaseResponse addPatientAttention(@RequestBody @Validated LymsPatientAttention patientAttention,BindingResult bindingResult) { BaseResponse baseResponse = new BaseResponse(); + baseResponse.setErrorcode(0); + baseResponse.setErrormsg("成功"); //对象验证 if(bindingResult.hasErrors()){ baseResponse.setErrorcode(1); @@ -1042,8 +1044,6 @@ public class PatientController { baseResponse.setErrorcode(1); baseResponse.setErrormsg("保存异常!"); } - baseResponse.setErrorcode(0); - baseResponse.setErrormsg("成功"); return baseResponse; } /** @@ -1073,4 +1073,35 @@ public class PatientController { baseResponse.setErrormsg("成功"); return baseResponse; } + + /** + * 小程序取消关注患者 + * + * @param patient + * @return + */ + @PostMapping("cancelPatientAttention") + @TokenRequired + public BaseResponse cancelPatientAttention(@RequestBody @Validated LymsPatientAttention patientAttention,BindingResult bindingResult) { + BaseResponse baseResponse = new BaseResponse(); + baseResponse.setErrorcode(0); + baseResponse.setErrormsg("成功"); + //对象验证 + if(bindingResult.hasErrors()){ + baseResponse.setErrorcode(1); + for (ObjectError allError : bindingResult.getAllErrors()) { + baseResponse.setErrormsg((StringUtil.isNotEmpty(baseResponse.getErrormsg())?baseResponse.getErrormsg():"")+allError.getDefaultMessage()+";"); + } + return baseResponse; + } + QueryWrapper queryWrapper=new QueryWrapper<>(); + queryWrapper.lambda().eq(LymsPatientAttention::getPid, patientAttention.getPid()); + queryWrapper.lambda().eq(LymsPatientAttention::getAttentionId, patientAttention.getAttentionId()); + final boolean result = lymsPatientAttentionService.remove(queryWrapper); + if(!result){ + baseResponse.setErrorcode(1); + baseResponse.setErrormsg("保存异常!"); + } + return baseResponse; + } }