Commit f132ee5a2718f22b3e4f2495ea5df3bcfb185023
1 parent
dc9c7c21b2
Exists in
master
小程序取消关注患者
Showing 1 changed file with 33 additions and 2 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/PatientController.java
View file @
f132ee5
| ... | ... | @@ -1029,6 +1029,8 @@ |
| 1029 | 1029 | @TokenRequired |
| 1030 | 1030 | public BaseResponse addPatientAttention(@RequestBody @Validated LymsPatientAttention patientAttention,BindingResult bindingResult) { |
| 1031 | 1031 | BaseResponse baseResponse = new BaseResponse(); |
| 1032 | + baseResponse.setErrorcode(0); | |
| 1033 | + baseResponse.setErrormsg("成功"); | |
| 1032 | 1034 | //对象验证 |
| 1033 | 1035 | if(bindingResult.hasErrors()){ |
| 1034 | 1036 | baseResponse.setErrorcode(1); |
| ... | ... | @@ -1042,8 +1044,6 @@ |
| 1042 | 1044 | baseResponse.setErrorcode(1); |
| 1043 | 1045 | baseResponse.setErrormsg("保存异常!"); |
| 1044 | 1046 | } |
| 1045 | - baseResponse.setErrorcode(0); | |
| 1046 | - baseResponse.setErrormsg("成功"); | |
| 1047 | 1047 | return baseResponse; |
| 1048 | 1048 | } |
| 1049 | 1049 | /** |
| ... | ... | @@ -1071,6 +1071,37 @@ |
| 1071 | 1071 | baseResponse.setErrorcode(0); |
| 1072 | 1072 | baseResponse.setObject(resultMap); |
| 1073 | 1073 | baseResponse.setErrormsg("成功"); |
| 1074 | + return baseResponse; | |
| 1075 | + } | |
| 1076 | + | |
| 1077 | + /** | |
| 1078 | + * 小程序取消关注患者 | |
| 1079 | + * | |
| 1080 | + * @param patient | |
| 1081 | + * @return | |
| 1082 | + */ | |
| 1083 | + @PostMapping("cancelPatientAttention") | |
| 1084 | + @TokenRequired | |
| 1085 | + public BaseResponse cancelPatientAttention(@RequestBody @Validated LymsPatientAttention patientAttention,BindingResult bindingResult) { | |
| 1086 | + BaseResponse baseResponse = new BaseResponse(); | |
| 1087 | + baseResponse.setErrorcode(0); | |
| 1088 | + baseResponse.setErrormsg("成功"); | |
| 1089 | + //对象验证 | |
| 1090 | + if(bindingResult.hasErrors()){ | |
| 1091 | + baseResponse.setErrorcode(1); | |
| 1092 | + for (ObjectError allError : bindingResult.getAllErrors()) { | |
| 1093 | + baseResponse.setErrormsg((StringUtil.isNotEmpty(baseResponse.getErrormsg())?baseResponse.getErrormsg():"")+allError.getDefaultMessage()+";"); | |
| 1094 | + } | |
| 1095 | + return baseResponse; | |
| 1096 | + } | |
| 1097 | + QueryWrapper<LymsPatientAttention> queryWrapper=new QueryWrapper<>(); | |
| 1098 | + queryWrapper.lambda().eq(LymsPatientAttention::getPid, patientAttention.getPid()); | |
| 1099 | + queryWrapper.lambda().eq(LymsPatientAttention::getAttentionId, patientAttention.getAttentionId()); | |
| 1100 | + final boolean result = lymsPatientAttentionService.remove(queryWrapper); | |
| 1101 | + if(!result){ | |
| 1102 | + baseResponse.setErrorcode(1); | |
| 1103 | + baseResponse.setErrormsg("保存异常!"); | |
| 1104 | + } | |
| 1074 | 1105 | return baseResponse; |
| 1075 | 1106 | } |
| 1076 | 1107 | } |