Commit 87aae30855dfad3b739452bdd58c374ff0f939ae
Exists in
master
and in
6 other branches
Merge remote-tracking branch 'origin/master'
Showing 1 changed file
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientCourseFacade.java
View file @
87aae30
| ... | ... | @@ -251,6 +251,29 @@ |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | + PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); | |
| 255 | + patientCourseQuery.setCourseId(courseId); | |
| 256 | + patientCourseQuery.setYn(YnEnums.YES.getId()); | |
| 257 | + patientCourseQuery.setPatientId(patientId); | |
| 258 | + List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); | |
| 259 | + | |
| 260 | + if (CollectionUtils.isNotEmpty(patientCourseModels)) | |
| 261 | + { | |
| 262 | + PatientCourseModel model = patientCourseModels.get(0); | |
| 263 | + if (model.getStatus() != null && model.getStatus() == 1) | |
| 264 | + { | |
| 265 | + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXPIRE); | |
| 266 | + objectResponse.setErrormsg("您已经预约该课程了!"); | |
| 267 | + return objectResponse; | |
| 268 | + } | |
| 269 | + else if (model.getStatus() != null && model.getStatus() == 2) | |
| 270 | + { | |
| 271 | + objectResponse.setErrorcode(ErrorCodeConstants.DATA_EXPIRE); | |
| 272 | + objectResponse.setErrormsg("您已经签到该课程了!"); | |
| 273 | + return objectResponse; | |
| 274 | + } | |
| 275 | + } | |
| 276 | + | |
| 254 | 277 | Patients patients = patientsService.findOnePatientById(patientId); |
| 255 | 278 | if (patients != null) |
| 256 | 279 | { |
| ... | ... | @@ -521,6 +544,18 @@ |
| 521 | 544 | { |
| 522 | 545 | String id = patientCourseModels.get(0).getId(); |
| 523 | 546 | patientCourseService.deletePatientCourse(id); |
| 547 | + | |
| 548 | + CourseQuery query = new CourseQuery(); | |
| 549 | + query.setYn(YnEnums.YES.getId()); | |
| 550 | + query.setId(courseId); | |
| 551 | + List<CourseModel> courseModels = courseService.queryCourseList(query); | |
| 552 | + if (CollectionUtils.isNotEmpty(courseModels)) | |
| 553 | + { | |
| 554 | + CourseModel courseModel = new CourseModel(); | |
| 555 | + courseModel.setId(courseId); | |
| 556 | + courseModel.setEnrolmentNum(courseModels.get(0).getEnrolmentNum() == null ? 0 : courseModels.get(0).getEnrolmentNum() - 1); | |
| 557 | + courseService.updateCourse(courseModel); | |
| 558 | + } | |
| 524 | 559 | } |
| 525 | 560 | BaseResponse objectResponse = new BaseResponse(); |
| 526 | 561 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |