From f132ee5a2718f22b3e4f2495ea5df3bcfb185023 Mon Sep 17 00:00:00 2001 From: shiyang <316555390@qq.com> Date: Mon, 18 Apr 2022 15:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E6=82=A3=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PatientController.java | 35 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) 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; + } } -- 1.8.3.1