Commit 0c5a157da1b2c1565ce69aa5f12939684eb813ff
1 parent
d8a8a67ad5
Exists in
dev
#fix:优化大同课程通知
Showing 2 changed files with 77 additions and 10 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BirthController.java
View file @
0c5a157
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.ArchiveDataServicer; | |
| 3 | 4 | import com.lyms.platform.biz.service.PatientsService; |
| 4 | 5 | import com.lyms.platform.common.annotation.TokenRequired; |
| 5 | 6 | import com.lyms.platform.common.base.BaseController; |
| 6 | 7 | |
| 7 | 8 | |
| 8 | 9 | |
| ... | ... | @@ -7,16 +8,26 @@ |
| 7 | 8 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 8 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 9 | 10 | import com.lyms.platform.common.utils.DateUtil; |
| 11 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 10 | 12 | import com.lyms.platform.common.utils.StringUtils; |
| 11 | 13 | import com.lyms.platform.operate.web.facade.PatientServiceFacade; |
| 12 | 14 | import com.lyms.platform.operate.web.facade.ViewFacade; |
| 13 | 15 | import com.lyms.platform.operate.web.result.BirthResult; |
| 16 | +import com.lyms.platform.pojo.ArchiveData; | |
| 17 | +import com.lyms.platform.query.ArchiveDataQuery; | |
| 14 | 18 | import com.lyms.platform.query.PatientsQuery; |
| 19 | +import org.apache.commons.collections.CollectionUtils; | |
| 15 | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 21 | import org.springframework.stereotype.Controller; |
| 17 | 22 | import org.springframework.web.bind.annotation.*; |
| 18 | 23 | |
| 19 | 24 | import javax.servlet.http.HttpServletRequest; |
| 25 | +import java.math.BigDecimal; | |
| 26 | +import java.math.RoundingMode; | |
| 27 | +import java.util.ArrayList; | |
| 28 | +import java.util.HashMap; | |
| 29 | +import java.util.List; | |
| 30 | +import java.util.Map; | |
| 20 | 31 | |
| 21 | 32 | /** |
| 22 | 33 | * 出生证明一件事一件办管理 |
| ... | ... | @@ -28,6 +39,8 @@ |
| 28 | 39 | private PatientServiceFacade patientServiceFacade; |
| 29 | 40 | @Autowired |
| 30 | 41 | private ViewFacade viewFacade; |
| 42 | + @Autowired | |
| 43 | + private ArchiveDataServicer archiveDataServicer; | |
| 31 | 44 | |
| 32 | 45 | @RequestMapping(value = "/getPatientList", method = RequestMethod.GET) |
| 33 | 46 | @ResponseBody |
| ... | ... | @@ -70,5 +83,42 @@ |
| 70 | 83 | baseResponse.setErrormsg("成功"); |
| 71 | 84 | return baseResponse; |
| 72 | 85 | } |
| 86 | + | |
| 87 | + @RequestMapping(value = "/testInit", method = RequestMethod.GET) | |
| 88 | + @ResponseBody | |
| 89 | + public BaseResponse testInit(){ | |
| 90 | + BaseResponse baseResponse=new BaseResponse(); | |
| 91 | + ArchiveDataQuery query = new ArchiveDataQuery(); | |
| 92 | + query.setHospitalId("2100002419"); | |
| 93 | + query.setCreatedStart(DateUtil.parseYMDHMS("2024-04-01 00:00:00")); | |
| 94 | + query.setCreatedEnd(DateUtil.parseYMDHMS("2024-06-10 00:00:00")); | |
| 95 | + List<ArchiveData> list= archiveDataServicer.query(query.convertToQuery()); | |
| 96 | + List<Map<String,Object>> mapList=new ArrayList<>(); | |
| 97 | + if (CollectionUtils.isNotEmpty(list)){ | |
| 98 | + for (ArchiveData archiveData:list){ | |
| 99 | + Map map = JsonUtil.str2Obj(archiveData.getJsonData(), HashMap.class); | |
| 100 | + String history1 = JsonUtil.obj2JsonString(map.get("history")); | |
| 101 | + Map<String, Object> history = JsonUtil.str2Obj(history1, Map.class); | |
| 102 | + if (history.get("yqWeight")!=null&&history.get("height")!=null){ | |
| 103 | + BigDecimal height= new BigDecimal(String.valueOf(history.get("height"))); | |
| 104 | + if (height.compareTo(BigDecimal.ZERO)>0){ | |
| 105 | + height=height.multiply(height); | |
| 106 | + } | |
| 107 | + BigDecimal bim= new BigDecimal(String.valueOf(history.get("yqWeight"))).divide(height,2, RoundingMode.HALF_UP); | |
| 108 | + if (bim.compareTo(new BigDecimal("28"))>0){ | |
| 109 | + Map<String,Object> map1=new HashMap<>(); | |
| 110 | + map1.put("idCard",archiveData.getIdCard()); | |
| 111 | + map1.put("BMI",bim.toPlainString()); | |
| 112 | + mapList.add(map1); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + } | |
| 116 | + } | |
| 117 | + baseResponse.setObject(mapList); | |
| 118 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 119 | + baseResponse.setErrormsg("成功"); | |
| 120 | + return baseResponse; | |
| 121 | + } | |
| 122 | + | |
| 73 | 123 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
0c5a157
| ... | ... | @@ -350,7 +350,9 @@ |
| 350 | 350 | String id=courseModel.getId(); |
| 351 | 351 | PatientsQuery patientsQuery = new PatientsQuery(); |
| 352 | 352 | patientsQuery.setHospitalId(courseModel.getHospitalId()); |
| 353 | - patientsQuery.setType(1); | |
| 353 | + if (courseModel.getCourseObjId()!=null){ | |
| 354 | + patientsQuery.setType(courseModel.getCourseObjId()); | |
| 355 | + } | |
| 354 | 356 | patientsQuery.setExtEnable(false); |
| 355 | 357 | patientsQuery.setBuildTypeNot(1); |
| 356 | 358 | patientsQuery.setYn(YnEnums.YES.getId()); |
| 357 | 359 | |
| 358 | 360 | |
| ... | ... | @@ -359,12 +361,18 @@ |
| 359 | 361 | logger.info("courseTask{},patientsModels-->"+patientsModels.toString()); |
| 360 | 362 | if (CollectionUtils.isNotEmpty(patientsModels)) |
| 361 | 363 | { |
| 364 | + List<MsgRequest> messages=new ArrayList<>(); | |
| 362 | 365 | for (Patients model : patientsModels) |
| 363 | 366 | { |
| 364 | - saveMsg(model.getHospitalId(),model.getPhone(),model.getId(), | |
| 367 | + messages= saveMsg(model.getHospitalId(),model.getPhone(),model.getId(), | |
| 365 | 368 | courseModel.getCourseName(),courseModel.getCourseSpeaker(),model.getId(),id, |
| 366 | 369 | "孕妇学校新课程已发布,点击进入小程序预约",1); |
| 367 | 370 | } |
| 371 | + | |
| 372 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 373 | + logger.info("messages{},"+messages.toString()); | |
| 374 | + smsConfigFacade.saveMsg(messages, courseModel.getHospitalId()); | |
| 375 | + } | |
| 368 | 376 | } |
| 369 | 377 | } |
| 370 | 378 | } |
| 371 | 379 | |
| 372 | 380 | |
| ... | ... | @@ -404,12 +412,18 @@ |
| 404 | 412 | List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); |
| 405 | 413 | if (CollectionUtils.isNotEmpty(patientCourseModels)) |
| 406 | 414 | { |
| 415 | + List<MsgRequest> messages=new ArrayList<>(); | |
| 407 | 416 | for (PatientCourseModel model : patientCourseModels) |
| 408 | 417 | { |
| 409 | - saveMsg(model.getHospitalId(),model.getPhone(),model.getPatientId(), | |
| 418 | + messages= saveMsg(model.getHospitalId(),model.getPhone(),model.getPatientId(), | |
| 410 | 419 | courseModel.getCourseName(),courseModel.getCourseSpeaker(),model.getId(),model.getCourseId(), |
| 411 | 420 | "您本次参加的孕妇学校课程已经取消,请注意安排时间。",null); |
| 412 | 421 | } |
| 422 | + | |
| 423 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 424 | + logger.info("messages{},"+messages.toString()); | |
| 425 | + smsConfigFacade.saveMsg(messages, courseModel.getHospitalId()); | |
| 426 | + } | |
| 413 | 427 | } |
| 414 | 428 | } |
| 415 | 429 | }).start(); |
| ... | ... | @@ -536,6 +550,7 @@ |
| 536 | 550 | List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); |
| 537 | 551 | if (CollectionUtils.isNotEmpty(patientCourseModels)) |
| 538 | 552 | { |
| 553 | + List<MsgRequest> messages=new ArrayList<>(); | |
| 539 | 554 | CourseQuery query1 = new CourseQuery(); |
| 540 | 555 | for (PatientCourseModel patientCourseModel : patientCourseModels) |
| 541 | 556 | { |
| 542 | 557 | |
| 543 | 558 | |
| ... | ... | @@ -557,16 +572,20 @@ |
| 557 | 572 | } |
| 558 | 573 | |
| 559 | 574 | String courseName = CollectionUtils.isNotEmpty(courseModels1) ? courseModels1.get(0).getCourseName() : ""; |
| 560 | - saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPatientId(), | |
| 575 | + messages= saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPatientId(), | |
| 561 | 576 | courseName,speaker,patientCourseModel.getId(),patientCourseModel.getCourseId(), |
| 562 | 577 | "您本次参加的孕妇学校课程已经结束,请点击详情回顾课程内容并对本次课程评分。我们会根据您的评价结果相应做相应的评估的课程调整等。",null); |
| 563 | 578 | } |
| 579 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 580 | + logger.info("messages{},"+messages.toString()); | |
| 581 | + smsConfigFacade.saveMsg(messages, model.getHospitalId()); | |
| 582 | + } | |
| 564 | 583 | } |
| 565 | 584 | } |
| 566 | 585 | } |
| 567 | 586 | } |
| 568 | 587 | |
| 569 | - private void saveMsg(String hospitalId,String phone,String patientId,String courseName,String doctorName,String patientCourseId,String courseId, | |
| 588 | + private List<MsgRequest> saveMsg(String hospitalId,String phone,String patientId,String courseName,String doctorName,String patientCourseId,String courseId, | |
| 570 | 589 | String msg,Integer type) |
| 571 | 590 | { |
| 572 | 591 | |
| ... | ... | @@ -584,7 +603,7 @@ |
| 584 | 603 | startType=1; |
| 585 | 604 | } |
| 586 | 605 | if (startType == 0) { |
| 587 | - return; | |
| 606 | + return null; | |
| 588 | 607 | } |
| 589 | 608 | //短信前缀 |
| 590 | 609 | String messagePrefix = configModel.getHospitalPrefix(); |
| ... | ... | @@ -620,10 +639,8 @@ |
| 620 | 639 | } |
| 621 | 640 | |
| 622 | 641 | messages.add(mr); |
| 623 | - if (CollectionUtils.isNotEmpty(messages)) { | |
| 624 | - logger.info("messages{},"+messages.toString()); | |
| 625 | - smsConfigFacade.saveMsg(messages, hospitalId); | |
| 626 | - } | |
| 642 | + | |
| 643 | + return messages; | |
| 627 | 644 | } |
| 628 | 645 | |
| 629 | 646 | public BaseResponse validateCourseName(String courseName, Integer userId,String courseId) { |