Commit 9b5be348b2b4d0884a69d206d96ab82693b98c5c
1 parent
eb31e23fe7
Exists in
master
and in
6 other branches
孕妇学校
Showing 3 changed files with 167 additions and 13 deletions
platform-common/src/main/java/com/lyms/platform/common/enums/WxTempleteIdEnums.java
View file @
9b5be34
| ... | ... | @@ -18,6 +18,9 @@ |
| 18 | 18 | CHAN_YI_BAN_ZHI_DAO("H2_ucLqVEbsZAv-EZcmUDpD1Zul5NGqMoJktHT0u4gw","产妇一般指导"),//产妇 |
| 19 | 19 | BABY_YI_BAN_ZHI_DAO("dqvyESU8UXx1V3cIMQDqj4PLxI6T9-sgihQcs3ZGL9E","儿童一般指导"),//儿童 |
| 20 | 20 | YUN_XUE_KE_CHEN_TX("UEwcdz3lJL3NR38KRqN6yTO4nUvRgym5mlXl4jXQBik","孕妇学校课程提醒"),//孕妇学校课程提醒 |
| 21 | + | |
| 22 | + YUN_XUE_JSTX("","孕妇学校课程结束提醒"),//孕妇学校课程结束提醒 | |
| 23 | + | |
| 21 | 24 | FU_WU_DING_GOU_TX("UEwcdz3lJL3NR38KRqN6yTO4nUvRgym5mlXl4jXQBik","服务订购提醒"),//服务订购提醒和收费成功后的高危提醒 |
| 22 | 25 | YI_SHENG_ZHI_DAO("OggqiSHitLkCgSLCaCH72reCZzaw5NyG8iO56InQiQg","医生指导"),//指导 |
| 23 | 26 | // WEI_JI_ZHI_DAO("fNkkLSp_gS-YWvzji6gwgdTddl4XBlk8SNP7FRksrfk","危急值提醒");//危急值提醒 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MatDeliverController.java
View file @
9b5be34
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
| 4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 5 | +import com.lyms.platform.biz.service.PatientsService; | |
| 3 | 6 | import com.lyms.platform.common.annotation.TokenRequired; |
| 4 | 7 | import com.lyms.platform.common.base.BaseController; |
| 5 | 8 | import com.lyms.platform.common.base.LoginContext; |
| 6 | 9 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 10 | +import com.lyms.platform.common.enums.YnEnums; | |
| 7 | 11 | import com.lyms.platform.common.result.BaseListResponse; |
| 8 | 12 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 9 | 13 | import com.lyms.platform.common.result.BaseResponse; |
| 10 | 14 | import com.lyms.platform.common.utils.BeanUtils; |
| 15 | +import com.lyms.platform.common.utils.DateUtil; | |
| 11 | 16 | import com.lyms.platform.common.utils.ExcelUtil; |
| 12 | 17 | import com.lyms.platform.common.utils.ExceptionUtils; |
| 18 | +import com.lyms.platform.operate.web.facade.AntenatalExaminationFacade; | |
| 13 | 19 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
| 14 | 20 | import com.lyms.platform.operate.web.facade.MatDeliverFacade; |
| 15 | 21 | import com.lyms.platform.operate.web.request.ChildbirthManagerRequest; |
| 16 | 22 | import com.lyms.platform.operate.web.request.MatDeliverAddRequest; |
| 17 | 23 | import com.lyms.platform.operate.web.request.MatDeliverQueryRequest; |
| 18 | 24 | import com.lyms.platform.operate.web.request.NewBabyManagerRequest; |
| 19 | -import com.lyms.platform.operate.web.result.ChildbirthManagerQueryModel; | |
| 20 | -import com.lyms.platform.operate.web.result.ChildbirthManagerResult; | |
| 21 | -import com.lyms.platform.operate.web.result.NewBabyManagerQueryModel; | |
| 22 | -import com.lyms.platform.operate.web.result.NewBabyManagerResult; | |
| 25 | +import com.lyms.platform.operate.web.result.*; | |
| 26 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 27 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 23 | 28 | import com.lyms.platform.permission.model.Organization; |
| 29 | +import com.lyms.platform.permission.model.PatientService; | |
| 24 | 30 | import com.lyms.platform.permission.service.CouponService; |
| 25 | 31 | import com.lyms.platform.permission.service.OrganizationService; |
| 32 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 33 | +import com.lyms.platform.pojo.Patients; | |
| 34 | +import com.lyms.platform.query.AntExChuQuery; | |
| 26 | 35 | import org.apache.commons.lang.StringUtils; |
| 27 | 36 | import org.springframework.beans.factory.annotation.Autowired; |
| 28 | 37 | import org.springframework.stereotype.Controller; |
| ... | ... | @@ -51,6 +60,18 @@ |
| 51 | 60 | @Autowired |
| 52 | 61 | private OrganizationService organizationService; |
| 53 | 62 | |
| 63 | + @Autowired | |
| 64 | + private PatientsService patientsService; | |
| 65 | + | |
| 66 | + @Autowired | |
| 67 | + private BasicConfigService basicConfigService; | |
| 68 | + | |
| 69 | + @Autowired | |
| 70 | + private AntenatalExaminationFacade antenatalExaminationFacade; | |
| 71 | + | |
| 72 | + @Autowired | |
| 73 | + private AntenatalExaminationService antenatalExaminationService; | |
| 74 | + | |
| 54 | 75 | /** |
| 55 | 76 | * 查询分娩记录 |
| 56 | 77 | * |
| ... | ... | @@ -329,6 +350,56 @@ |
| 329 | 350 | map.put(key, "-"); |
| 330 | 351 | } |
| 331 | 352 | } |
| 353 | + | |
| 354 | +// Patients patients = patientsService.findOnePatientById(newBabyManagerQueryModel.getPatientId()); | |
| 355 | +// if (patients != null) | |
| 356 | +// { | |
| 357 | +// map.put("age", DateUtil.getAge(patients.getBirth())); | |
| 358 | +// | |
| 359 | +// //居住地 | |
| 360 | +// String liveAddress = CommonsHelper.getResidence(patients.getProvinceId(), patients.getCityId(), | |
| 361 | +// patients.getAreaId(), patients.getStreetId(), patients.getAddress(), basicConfigService); | |
| 362 | +// | |
| 363 | +// map.put("addressRegister",liveAddress); | |
| 364 | +// | |
| 365 | +// //户籍地址 | |
| 366 | +// String addressRegister = CommonsHelper.getResidence(patients.getProvinceRegisterId(), patients.getCityRegisterId(), | |
| 367 | +// patients.getAreaRegisterId(), patients.getStreetRegisterId(), patients.getAddressRegister(), basicConfigService); | |
| 368 | +// | |
| 369 | +// map.put("addressRegister", addressRegister); | |
| 370 | +// | |
| 371 | +// //产后休养地 | |
| 372 | +// String postRest = CommonsHelper.getResidence(patients.getProvincePostRestId(), patients.getCityPostRestId(), | |
| 373 | +// patients.getAreaPostRestId(), patients.getStreetPostRestId(), patients.getAddressPostRest(), basicConfigService); | |
| 374 | +// map.put("postRest", postRest); | |
| 375 | +// | |
| 376 | +// HighScoreResult highScoreResult = antenatalExaminationFacade.findLastRisk(patients.getPid(), false); | |
| 377 | +// //妊娠期高危因素 | |
| 378 | +// map.put("risk", highScoreResult.gethighRiskStr()); | |
| 379 | +// | |
| 380 | +// map.put("husbandName", patients.getHusbandName() == null ? "" : patients.getHusbandName()); | |
| 381 | +// map.put("husbandName", patients.getHusbandPhone() == null ? "" : patients.getHusbandPhone()); | |
| 382 | +// | |
| 383 | +// AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 384 | +// antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 385 | +// antExChuQuery.setParentId(patients.getId()); | |
| 386 | +// List<AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 387 | +// if (CollectionUtils.isNotEmpty(antExChuModels)) | |
| 388 | +// { | |
| 389 | +// AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 390 | +// map.put("yc",antExChuModel.getPregnancyTimes() == null ? "" : antExChuModel.getPregnancyTimes()); | |
| 391 | +// map.put("cc",antExChuModel.getProdTime() == null ? "" : antExChuModel.getProdTime()); | |
| 392 | +// map.put("ts",antExChuModel.getTireNumber1() == null ? "" : antExChuModel.getTireNumber1()); | |
| 393 | +// } | |
| 394 | +// | |
| 395 | +// if (StringUtils.isNotEmpty(patients.getFmHospital())) | |
| 396 | +// { | |
| 397 | +// Organization organization = organizationService.getOrganization(Integer.parseInt(patients.getFmHospital())); | |
| 398 | +// map.put("fmHospital",organization != null ? organization.getName() : ""); | |
| 399 | +// } | |
| 400 | +// map.put("husbandName", patients.getHusbandPhone() == null ? "" : patients.getHusbandPhone()); | |
| 401 | +// } | |
| 402 | + | |
| 332 | 403 | list.add(map); |
| 333 | 404 | } |
| 334 | 405 | Map<String, String> header = new LinkedHashMap<>(); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
9b5be34
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.lyms.platform.beans.MsgRequest; | |
| 4 | 5 | import com.lyms.platform.biz.service.CourseService; |
| 5 | 6 | import com.lyms.platform.biz.service.CourseTypeService; |
| 6 | 7 | import com.lyms.platform.biz.service.PatientCourseService; |
| 7 | 8 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 8 | -import com.lyms.platform.common.enums.CourseStatusEnums; | |
| 9 | -import com.lyms.platform.common.enums.OptActionEnums; | |
| 10 | -import com.lyms.platform.common.enums.SmsServiceEnums; | |
| 11 | -import com.lyms.platform.common.enums.YnEnums; | |
| 9 | +import com.lyms.platform.common.enums.*; | |
| 12 | 10 | import com.lyms.platform.common.result.BaseListResponse; |
| 13 | 11 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 14 | 12 | import com.lyms.platform.common.result.BaseResponse; |
| ... | ... | @@ -22,10 +20,7 @@ |
| 22 | 20 | import com.lyms.platform.operate.web.worker.CourseCountWorker; |
| 23 | 21 | import com.lyms.platform.permission.model.Users; |
| 24 | 22 | import com.lyms.platform.permission.service.UsersService; |
| 25 | -import com.lyms.platform.pojo.BabyModel; | |
| 26 | -import com.lyms.platform.pojo.CourseModel; | |
| 27 | -import com.lyms.platform.pojo.CourseTypeModel; | |
| 28 | -import com.lyms.platform.pojo.PatientCourseModel; | |
| 23 | +import com.lyms.platform.pojo.*; | |
| 29 | 24 | import com.lyms.platform.query.CourseQuery; |
| 30 | 25 | import com.lyms.platform.query.CourseTypeQuery; |
| 31 | 26 | import com.lyms.platform.query.PatientCourseQuery; |
| ... | ... | @@ -68,6 +63,9 @@ |
| 68 | 63 | private OperateLogFacade operateLogFacade; |
| 69 | 64 | |
| 70 | 65 | @Autowired |
| 66 | + private SmsConfigFacade smsConfigFacade; | |
| 67 | + | |
| 68 | + @Autowired | |
| 71 | 69 | @Qualifier("commonThreadPool") |
| 72 | 70 | private ThreadPoolTaskExecutor commonThreadPool; |
| 73 | 71 | |
| 74 | 72 | |
| ... | ... | @@ -351,7 +349,28 @@ |
| 351 | 349 | { |
| 352 | 350 | model.setStatus(CourseStatusEnums.YJS.getId()); |
| 353 | 351 | courseService.updateCourse(model); |
| 352 | + } | |
| 353 | + } | |
| 354 | + } | |
| 354 | 355 | |
| 356 | + | |
| 357 | + /** | |
| 358 | + * 线上环境生成结束推送 | |
| 359 | + */ | |
| 360 | + public void handCoureseEndOnline() | |
| 361 | + { | |
| 362 | + CourseQuery query = new CourseQuery(); | |
| 363 | + query.setYn(YnEnums.YES.getId()); | |
| 364 | + query.setStatus(CourseStatusEnums.YFB.getId()); | |
| 365 | + query.setCourseEndTime(new Date()); | |
| 366 | + List<CourseModel> courseModels = courseService.queryCourseList(query); | |
| 367 | + if (CollectionUtils.isNotEmpty(courseModels)) | |
| 368 | + { | |
| 369 | + for (CourseModel model : courseModels) | |
| 370 | + { | |
| 371 | + model.setStatus(CourseStatusEnums.YJS.getId()); | |
| 372 | + courseService.updateCourse(model); | |
| 373 | + | |
| 355 | 374 | PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); |
| 356 | 375 | patientCourseQuery.setYn(YnEnums.YES.getId()); |
| 357 | 376 | patientCourseQuery.setCourseId(model.getId()); |
| 358 | 377 | |
| 359 | 378 | |
| 360 | 379 | |
| ... | ... | @@ -360,12 +379,73 @@ |
| 360 | 379 | List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); |
| 361 | 380 | if (CollectionUtils.isNotEmpty(patientCourseModels)) |
| 362 | 381 | { |
| 382 | + CourseQuery query1 = new CourseQuery(); | |
| 363 | 383 | for (PatientCourseModel patientCourseModel : patientCourseModels) |
| 364 | 384 | { |
| 385 | + query1.setYn(YnEnums.YES.getId()); | |
| 386 | + query1.setId(patientCourseModel.getCourseId()); | |
| 387 | + List<CourseModel> courseModels1 = courseService.queryCourseList(query); | |
| 388 | + String speaker = ""; | |
| 389 | + if (CollectionUtils.isNotEmpty(courseModels1)) | |
| 390 | + { | |
| 391 | + speaker = courseModels1.get(0).getCourseSpeaker(); | |
| 392 | + if (speaker != null && StringUtils.isNumeric(speaker)) | |
| 393 | + { | |
| 394 | + Users user = usersService.getUsers(Integer.parseInt(speaker)); | |
| 395 | + if (user != null) | |
| 396 | + { | |
| 397 | + speaker = user.getName(); | |
| 398 | + } | |
| 399 | + } | |
| 400 | + } | |
| 365 | 401 | |
| 402 | + String courseName = CollectionUtils.isNotEmpty(courseModels1) ? courseModels1.get(0).getCourseName() : ""; | |
| 403 | + saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPhone(),courseName,speaker,patientCourseModel.getId()); | |
| 366 | 404 | } |
| 367 | 405 | } |
| 368 | 406 | } |
| 407 | + } | |
| 408 | + } | |
| 409 | + | |
| 410 | + private void saveMsg(String hospitalId,String phone,String patientId,String courseName,String doctorName,String patientCourseId) | |
| 411 | + { | |
| 412 | + //判断医院是否启动和对应的服务项是否启用 | |
| 413 | + SmsConfigModel configModel = new SmsConfigModel(); | |
| 414 | + // 1 推送服务, 2 推送和短信服务 3短信服务, | |
| 415 | + int startType = smsConfigFacade.hospitalIsStart(hospitalId, configModel, SmsServiceEnums.YFXXKCTX.getId()); | |
| 416 | + if (startType == 0) { | |
| 417 | + return; | |
| 418 | + } | |
| 419 | + | |
| 420 | + //短信前缀 | |
| 421 | + String messagePrefix = configModel.getHospitalPrefix(); | |
| 422 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 423 | + MsgRequest mr = new MsgRequest(); | |
| 424 | + | |
| 425 | + String content = "【" + messagePrefix + "】本次孕妇学校课程已结束,请对本次课程内容和讲解医生进行评价。"; | |
| 426 | + mr.setFirst(content); | |
| 427 | + mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 428 | + mr.setPhone(phone); | |
| 429 | + mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 430 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 431 | + mr.setSubTypeId(SmsServiceEnums.YFXXKCTX.getId()); | |
| 432 | + mr.setStatus(SmsStatusEnums.WFS.getId()); | |
| 433 | + mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId()); | |
| 434 | + | |
| 435 | + mr.setHospitalId(hospitalId); | |
| 436 | + mr.setTempId(patientCourseId); | |
| 437 | + mr.setPatientId(patientId); | |
| 438 | + | |
| 439 | + mr.setKeyword1(courseName); | |
| 440 | + mr.setKeyword2(doctorName); | |
| 441 | + mr.setRemark(""); | |
| 442 | + mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 443 | + mr.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 444 | + mr.setServiceType(startType); | |
| 445 | + mr.setWxTempId(WxTempleteIdEnums.YUN_XUE_JSTX.getId()); | |
| 446 | + messages.add(mr); | |
| 447 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 448 | + smsConfigFacade.saveMsg(messages, hospitalId); | |
| 369 | 449 | } |
| 370 | 450 | } |
| 371 | 451 |