Commit db3ab800f6cc7a0cf55ebe5b4ebc2fa9431f18f1
1 parent
036ec0c760
Exists in
master
and in
6 other branches
听力诊断模块
Showing 1 changed file with 53 additions and 0 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientServiceController.java
View file @
db3ab80
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | import com.lyms.platform.common.annotation.TokenRequired; |
| 4 | 4 | import com.lyms.platform.common.base.BaseController; |
| 5 | 5 | import com.lyms.platform.common.base.LoginContext; |
| 6 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 6 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
| 7 | 8 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 9 | import com.lyms.platform.common.utils.StringUtils; |
| ... | ... | @@ -66,6 +67,10 @@ |
| 66 | 67 | @RequestMapping(value = "/patSer", method = RequestMethod.POST) |
| 67 | 68 | public BaseResponse addOrUpdatePatientService(PatientService ps, HttpServletRequest request) { |
| 68 | 69 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 70 | + BaseResponse baseResponse = validatePatient(ps); | |
| 71 | + if(baseResponse.getErrorcode()!=ErrorCodeConstants.SUCCESS){ | |
| 72 | + return baseResponse; | |
| 73 | + } | |
| 69 | 74 | if (StringUtils.isEmpty(ps.getId())) { |
| 70 | 75 | return patientServiceFacade.addPatientService(ps, loginState.getId()); |
| 71 | 76 | } else { |
| ... | ... | @@ -147,6 +152,54 @@ |
| 147 | 152 | public BaseResponse receivePatientService(String psId, HttpServletRequest request) { |
| 148 | 153 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 149 | 154 | return patientServiceFacade.receivePatientService(psId, loginState.getId()); |
| 155 | + } | |
| 156 | + | |
| 157 | + /** | |
| 158 | + * 数据验证 | |
| 159 | + * @param ps | |
| 160 | + * @return | |
| 161 | + */ | |
| 162 | + public BaseResponse validatePatient(PatientService ps){ | |
| 163 | + BaseResponse baseResponse = new BaseResponse(); | |
| 164 | + //孕妇id | |
| 165 | + if(StringUtils.isEmpty(ps.getParentid())){ | |
| 166 | + baseResponse.setErrormsg("请传入parentid"); | |
| 167 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 168 | + return baseResponse; | |
| 169 | + } | |
| 170 | + //personid | |
| 171 | + if(StringUtils.isEmpty(ps.getPid())){ | |
| 172 | + baseResponse.setErrormsg("请传入pid"); | |
| 173 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 174 | + return baseResponse; | |
| 175 | + } | |
| 176 | + //personid | |
| 177 | + if(StringUtils.isEmpty(ps.getPid())){ | |
| 178 | + baseResponse.setErrormsg("请传入pid"); | |
| 179 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 180 | + return baseResponse; | |
| 181 | + } | |
| 182 | + //serType服务类型(1-高危精准指导、2-体重、3-血糖、4-血压、5-专家咨询) | |
| 183 | + if(ps.getSerType()==null){ | |
| 184 | + baseResponse.setErrormsg("请传入serType"); | |
| 185 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 186 | + return baseResponse; | |
| 187 | + } | |
| 188 | + //开通医生 | |
| 189 | + if(ps.getSerDoct()==null){ | |
| 190 | + baseResponse.setErrormsg("请传入serDoct"); | |
| 191 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 192 | + return baseResponse; | |
| 193 | + } | |
| 194 | + //服务状态 | |
| 195 | + if(ps.getSerStatus()==null){ | |
| 196 | + baseResponse.setErrormsg("serStatus"); | |
| 197 | + baseResponse.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); | |
| 198 | + return baseResponse; | |
| 199 | + } | |
| 200 | + | |
| 201 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 202 | + return baseResponse; | |
| 150 | 203 | } |
| 151 | 204 | |
| 152 | 205 | } |