Commit 72399d6bc5ddeb7ff94da401a3b3faf80c39ec30
1 parent
7686813319
Exists in
master
and in
6 other branches
update
Showing 3 changed files with 125 additions and 6 deletions
platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java
View file @
72399d6
| ... | ... | @@ -17,6 +17,7 @@ |
| 17 | 17 | public class CourseQuery extends BaseQuery implements IConvertToNativeQuery { |
| 18 | 18 | |
| 19 | 19 | private String id; |
| 20 | + private List<String> ids; | |
| 20 | 21 | |
| 21 | 22 | //课程名称 |
| 22 | 23 | private String courseName; |
| ... | ... | @@ -89,6 +90,10 @@ |
| 89 | 90 | condition = condition.and("id", id, MongoOper.IS); |
| 90 | 91 | } |
| 91 | 92 | |
| 93 | + if (CollectionUtils.isNotEmpty(ids)) { | |
| 94 | + condition = condition.and("id", ids, MongoOper.IN); | |
| 95 | + } | |
| 96 | + | |
| 92 | 97 | if (null != yn) { |
| 93 | 98 | condition = condition.and("yn", yn, MongoOper.IS); |
| 94 | 99 | } |
| ... | ... | @@ -212,6 +217,14 @@ |
| 212 | 217 | condition = condition.andCondition(new MongoCondition(c1)); |
| 213 | 218 | } |
| 214 | 219 | return condition.toMongoQuery(); |
| 220 | + } | |
| 221 | + | |
| 222 | + public List<String> getIds() { | |
| 223 | + return ids; | |
| 224 | + } | |
| 225 | + | |
| 226 | + public void setIds(List<String> ids) { | |
| 227 | + this.ids = ids; | |
| 215 | 228 | } |
| 216 | 229 | |
| 217 | 230 | public Date getPublishTimeStart() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java
View file @
72399d6
| ... | ... | @@ -89,6 +89,25 @@ |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
| 92 | + /** | |
| 93 | + * 小程序获取取消的课程列表 | |
| 94 | + * @param hospitalId | |
| 95 | + * @param patientId | |
| 96 | + * @param request | |
| 97 | + * @return | |
| 98 | + */ | |
| 99 | + @RequestMapping(method = RequestMethod.GET, value = "/getCancelAppCourseList") | |
| 100 | + @ResponseBody | |
| 101 | + public BaseResponse getCancelAppCourseList( | |
| 102 | + @RequestParam(required = false) String hospitalId, | |
| 103 | + @RequestParam(required = false) String patientId, | |
| 104 | + HttpServletRequest request) { | |
| 105 | + | |
| 106 | + return courseFacade.getCancelAppCourseList(hospitalId,patientId); | |
| 107 | + } | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 92 | 111 | |
| 93 | 112 | /** |
| 94 | 113 | * 课程列表 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
72399d6
| ... | ... | @@ -11,17 +11,12 @@ |
| 11 | 11 | import com.lyms.platform.common.utils.*; |
| 12 | 12 | import com.lyms.platform.operate.web.request.CourseRequest; |
| 13 | 13 | import com.lyms.platform.operate.web.result.CourseResult; |
| 14 | -import com.lyms.platform.operate.web.result.PatientCourseResult; | |
| 15 | -import com.lyms.platform.operate.web.utils.MessageCenterService; | |
| 16 | 14 | import com.lyms.platform.operate.web.worker.CourseCountWorker; |
| 17 | 15 | import com.lyms.platform.permission.model.*; |
| 18 | 16 | import com.lyms.platform.permission.service.OrganizationService; |
| 19 | 17 | import com.lyms.platform.permission.service.UsersService; |
| 20 | 18 | import com.lyms.platform.pojo.*; |
| 21 | -import com.lyms.platform.query.CourseEvalQuery; | |
| 22 | -import com.lyms.platform.query.CourseQuery; | |
| 23 | -import com.lyms.platform.query.CourseTypeQuery; | |
| 24 | -import com.lyms.platform.query.PatientCourseQuery; | |
| 19 | +import com.lyms.platform.query.*; | |
| 25 | 20 | import org.apache.commons.collections.CollectionUtils; |
| 26 | 21 | import org.apache.commons.lang.StringUtils; |
| 27 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -909,6 +904,98 @@ |
| 909 | 904 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 910 | 905 | objectResponse.setErrormsg("成功"); |
| 911 | 906 | return objectResponse; |
| 907 | + } | |
| 908 | + | |
| 909 | + public BaseResponse getCancelAppCourseList(String hospitalId, String patientId) { | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); | |
| 915 | + patientCourseQuery.setYn(YnEnums.YES.getId()); | |
| 916 | + List<String> patids = new ArrayList<>(); | |
| 917 | + | |
| 918 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 919 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 920 | + patientsQuery.setId(patientId); | |
| 921 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
| 922 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 923 | + | |
| 924 | + Patients patients = patientses.get(0); | |
| 925 | + patientsQuery.setId(null); | |
| 926 | + patientsQuery.setPid(patients.getPid()); | |
| 927 | + patientsQuery.setDesc("true"); | |
| 928 | + patientsQuery.setSort("created"); | |
| 929 | + patientses = patientsService.queryPatient(patientsQuery); | |
| 930 | + if (CollectionUtils.isNotEmpty(patientses)) | |
| 931 | + { | |
| 932 | + for (Patients pat : patientses) | |
| 933 | + { | |
| 934 | + patids.add(pat.getId()); | |
| 935 | + } | |
| 936 | + } | |
| 937 | + } | |
| 938 | + patientCourseQuery.setPatientIds(patids); | |
| 939 | + | |
| 940 | + //状态 1预约,2签到 | |
| 941 | + patientCourseQuery.setStatus(1); | |
| 942 | + List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); | |
| 943 | + | |
| 944 | + List<String> courses = new ArrayList<>(); | |
| 945 | + //获取预约的课程id | |
| 946 | + if (CollectionUtils.isNotEmpty(patientCourseModels)) | |
| 947 | + { | |
| 948 | + for (PatientCourseModel courseModel : patientCourseModels) | |
| 949 | + { | |
| 950 | + courses.add(courseModel.getCourseId()); | |
| 951 | + } | |
| 952 | + } | |
| 953 | + | |
| 954 | + if (CollectionUtils.isEmpty(courses)) | |
| 955 | + { | |
| 956 | + return new BaseObjectResponse().setData(null).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
| 957 | + } | |
| 958 | + CourseQuery query = new CourseQuery(); | |
| 959 | + query.setYn(YnEnums.YES.getId()); | |
| 960 | + query.setIds(courses); | |
| 961 | + query.setStatus(CourseStatusEnums.YQX.getId()); | |
| 962 | + List<CourseModel> courseModels = courseService.queryCourseList(query); | |
| 963 | + List<CourseResult> results = new ArrayList<>(); | |
| 964 | + | |
| 965 | + if (CollectionUtils.isNotEmpty(courseModels)) | |
| 966 | + { | |
| 967 | + for (CourseModel model : courseModels) | |
| 968 | + { | |
| 969 | + if (model.getCourseEndTime().getTime() > System.currentTimeMillis()) | |
| 970 | + { | |
| 971 | + CourseResult result = new CourseResult(); | |
| 972 | + CourseTypeQuery courseTypeQuery = new CourseTypeQuery(); | |
| 973 | + courseTypeQuery.setYn(YnEnums.YES.getId()); | |
| 974 | + courseTypeQuery.setId(model.getCourseTypeId()); | |
| 975 | + List<CourseTypeModel> typeModels = courseTypeService.queryCourseTypeList(courseTypeQuery); | |
| 976 | + if (CollectionUtils.isNotEmpty(typeModels)) | |
| 977 | + { | |
| 978 | + String courseType = typeModels.get(0).getCourseTypeName(); | |
| 979 | + result.setCourseType(courseType); | |
| 980 | + } | |
| 981 | + result.setCourseTypeId(model.getCourseTypeId()); | |
| 982 | + result.setId(model.getId()); | |
| 983 | + result.setCourseTypeId(model.getCourseTypeId()); | |
| 984 | + result.setCourseName(model.getCourseName()); | |
| 985 | + result.setCourseSpeaker(model.getCourseSpeaker()); | |
| 986 | + result.setCourseAddress(model.getCourseAddress()); | |
| 987 | + result.setCourseTime(DateUtil.gety_m_dhm(model.getCourseTime())); | |
| 988 | + result.setTimeLong(model.getTimeLong()); | |
| 989 | + result.setLimitNum(model.getLimitNum()); | |
| 990 | + result.setEnrolmentNum(model.getEnrolmentNum()); | |
| 991 | + result.setSignNum(model.getSignNum()); | |
| 992 | + result.setStatus(CourseStatusEnums.getNameById(model.getStatus())); | |
| 993 | + result.setCreated(DateUtil.getyyyy_MM_dd_hms(model.getCreated())); | |
| 994 | + results.add(result); | |
| 995 | + } | |
| 996 | + } | |
| 997 | + } | |
| 998 | + return new BaseObjectResponse().setData(results).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg(ErrorCodeConstants.SUCCESS_DESCRIPTION); | |
| 912 | 999 | } |
| 913 | 1000 | } |