Commit ce2d0fbf89a6de44bf5fe73c7b7680a7a16eafa2
1 parent
3829ae6acb
Exists in
master
and in
6 other branches
孕妇学校
Showing 2 changed files with 33 additions and 59 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientCourseController.java
View file @
ce2d0fb
| ... | ... | @@ -69,9 +69,10 @@ |
| 69 | 69 | @TokenRequired |
| 70 | 70 | public BaseResponse queryOrderPatient( |
| 71 | 71 | @RequestParam(required = true) String queryNo, |
| 72 | + @RequestParam(required = true) String courseId, | |
| 72 | 73 | HttpServletRequest request) { |
| 73 | 74 | |
| 74 | - return patientCourseFacade.queryOrderPatient(queryNo, getUserId(request)); | |
| 75 | + return patientCourseFacade.queryOrderPatient(queryNo,courseId, getUserId(request)); | |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | 78 | |
| 78 | 79 | |
| ... | ... | @@ -86,9 +87,10 @@ |
| 86 | 87 | @TokenRequired |
| 87 | 88 | public BaseResponse querySignPatient( |
| 88 | 89 | @RequestParam(required = true) String queryNo, |
| 90 | + @RequestParam(required = true) String courseId, | |
| 89 | 91 | HttpServletRequest request) { |
| 90 | 92 | |
| 91 | - return patientCourseFacade.querySignPatient(queryNo, getUserId(request)); | |
| 93 | + return patientCourseFacade.querySignPatient(queryNo,courseId, getUserId(request)); | |
| 92 | 94 | } |
| 93 | 95 | |
| 94 | 96 | |
| ... | ... | @@ -103,7 +105,6 @@ |
| 103 | 105 | */ |
| 104 | 106 | @RequestMapping(method = RequestMethod.GET, value = "/orderCourse") |
| 105 | 107 | @ResponseBody |
| 106 | - @TokenRequired | |
| 107 | 108 | public BaseResponse orderCourse( |
| 108 | 109 | @RequestParam(required = true) String courseId, |
| 109 | 110 | @RequestParam(required = true) String patientId, |
| 110 | 111 | |
| 111 | 112 | |
| 112 | 113 | |
| 113 | 114 | |
| ... | ... | @@ -115,17 +116,20 @@ |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | 118 | |
| 119 | + /** | |
| 120 | + * 孕妇签到 | |
| 121 | + * @param patientCourseId | |
| 122 | + * @param request | |
| 123 | + * @return | |
| 124 | + */ | |
| 118 | 125 | @RequestMapping(method = RequestMethod.GET, value = "/signCourse") |
| 119 | 126 | @ResponseBody |
| 120 | - @TokenRequired | |
| 121 | 127 | public BaseResponse signCourse( |
| 128 | + @RequestParam(required = true) String patientCourseId, | |
| 122 | 129 | @RequestParam(required = true) String courseId, |
| 123 | - @RequestParam(required = true) String patientId, | |
| 124 | - @RequestParam(required = true) String hospitalId, | |
| 125 | - @RequestParam(required = true) Integer orderType, | |
| 126 | 130 | HttpServletRequest request) { |
| 127 | 131 | |
| 128 | - return patientCourseFacade.signCourse(courseId,patientId,hospitalId, orderType,getUserId(request)); | |
| 132 | + return patientCourseFacade.signCourse(patientCourseId,courseId,getUserId(request)); | |
| 129 | 133 | } |
| 130 | 134 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCourseFacade.java
View file @
ce2d0fb
| ... | ... | @@ -80,12 +80,12 @@ |
| 80 | 80 | return objectResponse; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public BaseResponse queryOrderPatient(String queryNo, Integer userId) { | |
| 83 | + public BaseResponse queryOrderPatient(String queryNo,String courseId, Integer userId) { | |
| 84 | 84 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| 85 | 85 | |
| 86 | 86 | PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); |
| 87 | 87 | patientCourseQuery.setYn(YnEnums.YES.getId()); |
| 88 | - | |
| 88 | + patientCourseQuery.setCourseId(courseId); | |
| 89 | 89 | patientCourseQuery.setHospitalId(hospitalId); |
| 90 | 90 | patientCourseQuery.setQueryNo(queryNo); |
| 91 | 91 | //状态 1预约,2签到 |
| 92 | 92 | |
| ... | ... | @@ -113,14 +113,14 @@ |
| 113 | 113 | } |
| 114 | 114 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
| 115 | 115 | objectResponse.setData(result); |
| 116 | - objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA); | |
| 116 | + objectResponse.setErrorcode(ErrorCodeConstants.NAME_EXIST); | |
| 117 | 117 | objectResponse.setErrormsg("该孕妇未预约此课程,是否现在预约?"); |
| 118 | 118 | return objectResponse; |
| 119 | 119 | } |
| 120 | 120 | else |
| 121 | 121 | { |
| 122 | 122 | BaseResponse objectResponse = new BaseResponse(); |
| 123 | - objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 123 | + objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA); | |
| 124 | 124 | objectResponse.setErrormsg("数据不存在"); |
| 125 | 125 | return objectResponse; |
| 126 | 126 | } |
| ... | ... | @@ -144,15 +144,6 @@ |
| 144 | 144 | for (PatientCourseModel model : patientCourseModels) |
| 145 | 145 | { |
| 146 | 146 | PatientCourseResult result = new PatientCourseResult(); |
| 147 | -// Patients patients = patientsService.findOnePatientById(model.getPatientId()); | |
| 148 | -// if (patients != null) | |
| 149 | -// { | |
| 150 | -// result.setAge(DateUtil.getAge(patients.getBirth(),new Date())); | |
| 151 | -// result.setCardNo(patients.getCardNo()); | |
| 152 | -// result.setUserName(patients.getUsername()); | |
| 153 | -// result.setPhone(patients.getPhone()); | |
| 154 | -// result.setVcCardNo(patients.getVcCardNo()); | |
| 155 | -// } | |
| 156 | 147 | result.setAge(DateUtil.getAge(model.getBirthday(),new Date())); |
| 157 | 148 | result.setCardNo(model.getCardNo()); |
| 158 | 149 | result.setUserName(model.getUserName()); |
| 159 | 150 | |
| ... | ... | @@ -213,10 +204,11 @@ |
| 213 | 204 | } |
| 214 | 205 | |
| 215 | 206 | |
| 216 | - public BaseResponse querySignPatient(String queryNo, Integer userId) { | |
| 207 | + public BaseResponse querySignPatient(String queryNo,String courseId, Integer userId) { | |
| 217 | 208 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
| 218 | 209 | |
| 219 | 210 | PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); |
| 211 | + patientCourseQuery.setCourseId(courseId); | |
| 220 | 212 | patientCourseQuery.setYn(YnEnums.YES.getId()); |
| 221 | 213 | |
| 222 | 214 | patientCourseQuery.setHospitalId(hospitalId); |
| 223 | 215 | |
| 224 | 216 | |
| ... | ... | @@ -227,33 +219,21 @@ |
| 227 | 219 | List<PatientCourseResult> results = getPatientCourse(patientCourseQuery); |
| 228 | 220 | if (CollectionUtils.isEmpty(results)) |
| 229 | 221 | { |
| 230 | - PatientsQuery patientsQuery = new PatientsQuery(); | |
| 231 | - patientsQuery.setYn(YnEnums.YES.getId()); | |
| 232 | - patientsQuery.setPvc(queryNo); | |
| 233 | - List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
| 234 | - if (CollectionUtils.isNotEmpty(patientses)) | |
| 222 | + | |
| 223 | + //状态 1预约,2签到 | |
| 224 | + patientCourseQuery.setStatus(1); | |
| 225 | + List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); | |
| 226 | + if (CollectionUtils.isNotEmpty(patientCourseModels)) | |
| 235 | 227 | { |
| 236 | - Patients patients = patientses.get(0); | |
| 237 | - PatientCourseResult result = new PatientCourseResult(); | |
| 238 | - if (patients != null) | |
| 239 | - { | |
| 240 | - result.setAge(DateUtil.getAge(patients.getBirth(),new Date())); | |
| 241 | - result.setCardNo(patients.getCardNo()); | |
| 242 | - result.setUserName(patients.getUsername()); | |
| 243 | - result.setPhone(patients.getPhone()); | |
| 244 | - result.setVcCardNo(patients.getVcCardNo()); | |
| 245 | - result.setPatientId(patients.getId()); | |
| 246 | - } | |
| 247 | - BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 248 | - objectResponse.setData(result); | |
| 249 | - objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA); | |
| 250 | - objectResponse.setErrormsg("该孕妇未预约此课程,无法签到,是否现在预约?"); | |
| 228 | + BaseResponse objectResponse = new BaseResponse(); | |
| 229 | + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 230 | + objectResponse.setErrormsg("孕妇已经预约,确认是否签到?"); | |
| 251 | 231 | return objectResponse; |
| 252 | 232 | } |
| 253 | 233 | else |
| 254 | 234 | { |
| 255 | 235 | BaseResponse objectResponse = new BaseResponse(); |
| 256 | - objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
| 236 | + objectResponse.setErrorcode(ErrorCodeConstants.NO_DATA); | |
| 257 | 237 | objectResponse.setErrormsg("数据不存在"); |
| 258 | 238 | return objectResponse; |
| 259 | 239 | } |
| ... | ... | @@ -267,7 +247,7 @@ |
| 267 | 247 | return objectResponse; |
| 268 | 248 | } |
| 269 | 249 | |
| 270 | - public BaseResponse signCourse(String courseId, String patientId, String hospitalId, Integer orderType, Integer userId) { | |
| 250 | + public BaseResponse signCourse(String patientCourseId,String courseId, Integer userId) { | |
| 271 | 251 | |
| 272 | 252 | BaseResponse objectResponse = new BaseResponse(); |
| 273 | 253 | CourseQuery query = new CourseQuery(); |
| 274 | 254 | |
| 275 | 255 | |
| 276 | 256 | |
| ... | ... | @@ -280,29 +260,19 @@ |
| 280 | 260 | if (model != null && model.getCourseEndTime().getTime() < new Date().getTime()) |
| 281 | 261 | { |
| 282 | 262 | objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXPIRE); |
| 283 | - objectResponse.setErrormsg("该课程预约时间已截止,请刷新后重试"); | |
| 263 | + objectResponse.setErrormsg("该课程签到时间已截止,请刷新后重试"); | |
| 284 | 264 | return objectResponse; |
| 285 | 265 | } |
| 286 | 266 | } |
| 287 | 267 | |
| 288 | - Patients patients = patientsService.findOnePatientById(patientId); | |
| 289 | - if (patients == null) | |
| 268 | + if (patientCourseId == null) | |
| 290 | 269 | { |
| 291 | 270 | PatientCourseModel model = new PatientCourseModel(); |
| 292 | - model.setBirthday(patients.getBirth()); | |
| 293 | - model.setCardNo(patients.getCardNo()); | |
| 294 | - model.setUserName(patients.getUsername()); | |
| 295 | - model.setPhone(patients.getPhone()); | |
| 296 | - model.setVcCardNo(patients.getVcCardNo()); | |
| 297 | - model.setOrderTime(new Date()); | |
| 298 | - model.setOrderType(orderType); | |
| 299 | - model.setOperUserId(String.valueOf(userId)); | |
| 300 | - model.setHospitalId(hospitalId); | |
| 301 | - model.setCourseId(courseId); | |
| 302 | - model.setCreated(new Date()); | |
| 271 | + model.setId(patientCourseId); | |
| 303 | 272 | model.setModified(new Date()); |
| 304 | 273 | model.setYn(YnEnums.YES.getId()); |
| 305 | - patientCourseService.addPatientCourse(model); | |
| 274 | + model.setStatus(2); | |
| 275 | + patientCourseService.updatePatientCourse(model); | |
| 306 | 276 | } |
| 307 | 277 | |
| 308 | 278 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |