Commit 10ef424104211d769d750130488925a1fc145f1c
1 parent
e55facc4b3
Exists in
master
and in
6 other branches
update code
Showing 1 changed file with 88 additions and 0 deletions
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
10ef424
| ... | ... | @@ -623,6 +623,94 @@ |
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | + //产后复查程序提醒 | |
| 627 | + else if (smsType == SmsServiceEnums.CHFCCXTX.getId()) | |
| 628 | + { | |
| 629 | + //发送频次 | |
| 630 | + Integer sendFreq = template.getSendFrequency(); | |
| 631 | + | |
| 632 | + if (sendFreq == SendFrequencyEnums.ONCE.getId()) { | |
| 633 | + | |
| 634 | + //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); | |
| 635 | + Integer sendDateType = template.getSendDateType(); | |
| 636 | + if (sendDateType == SendDateEnums.SLRQ.getId()) { | |
| 637 | + // | |
| 638 | + Integer specialDateType = template.getSpecialDateType(); | |
| 639 | + | |
| 640 | + //产后天数 | |
| 641 | + if (specialDateType == SpecialDateEnums.CHTS.getId()) { | |
| 642 | + Integer start = template.getStart(); | |
| 643 | + Integer end = template.getEnd(); | |
| 644 | + | |
| 645 | + if (start != null && end != null) { | |
| 646 | + Date startDate = DateUtil.getNewDate(-end, "天", sendTimeType); | |
| 647 | + Date endDate = DateUtil.getNewDate(-start, "天", sendTimeType); | |
| 648 | + startDate = DateUtil.formatDate(startDate); | |
| 649 | + endDate = DateUtil.formatDate(endDate); | |
| 650 | + patientsQuery.setFmDateStart(startDate); | |
| 651 | + patientsQuery.setFmDateEnd(endDate); | |
| 652 | + List<Patients> patientses = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 653 | + for(Patients pat : patientses) | |
| 654 | + { | |
| 655 | + if (pat.getDueDate() == null) | |
| 656 | + { | |
| 657 | + continue; | |
| 658 | + } | |
| 659 | + if (queryPostOrder(pat.getDueDate(),start,tempHid,sendTimeType,pat.getId())) | |
| 660 | + { | |
| 661 | + continue; | |
| 662 | + } | |
| 663 | + //短信前缀 | |
| 664 | + String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor()); | |
| 665 | + String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 666 | + messageContent = HelperUtils.replaceName(pat.getUsername(), messageContent); | |
| 667 | + | |
| 668 | + String days = DateUtils.daysBetween(pat.getFmDate(), new Date()) + "天"; | |
| 669 | + String title = "产后复查"; | |
| 670 | + MessageRequest request = HelperUtils.getMessageRequest(messageContent, pat.getPhone(), | |
| 671 | + ServiceObjEnums.CHANOBJ.getId(), template.getSmsType(), | |
| 672 | + pat.getHospitalId(), template.getId(), pat.getId(), title, days, "", WxTempleteIdEnums.CHAN_JIAN_TI_XING.getId()); | |
| 673 | + messages.add(request); | |
| 674 | + } | |
| 675 | + } | |
| 676 | + } | |
| 677 | + //产妇服务结束 | |
| 678 | + else if (specialDateType == SpecialDateEnums.FWJS.getId()) | |
| 679 | + { | |
| 680 | + | |
| 681 | + } | |
| 682 | + } | |
| 683 | + } | |
| 684 | + list.setMessages(messages); | |
| 685 | + HelperUtils.sendMsg(list); | |
| 686 | + } | |
| 687 | + } | |
| 688 | + | |
| 689 | + | |
| 690 | + /** | |
| 691 | + * 查询出产妇有效的下次预约时间 | |
| 692 | + * @param tempHid | |
| 693 | + * @return | |
| 694 | + */ | |
| 695 | + private boolean queryPostOrder(Date dueDate,Integer start,String tempHid,Integer sendTimeType,String pid) | |
| 696 | + { | |
| 697 | + Set<String> idset = new HashSet<>(); | |
| 698 | + Date startDate = DateUtil.getRangeDate(dueDate, start, "周", -sendTimeType); | |
| 699 | + if (startDate != null) | |
| 700 | + { | |
| 701 | + //把时间格式化成 yyyy_MM_dd 的日期 | |
| 702 | + startDate = DateUtil.formatDate(startDate); | |
| 703 | + } | |
| 704 | + List<PostReviewModel> models = postReviewService.queryPostOrder(startDate, tempHid, pid); | |
| 705 | + if (CollectionUtils.isNotEmpty(models)) | |
| 706 | + { | |
| 707 | + for (PostReviewModel model : models) | |
| 708 | + { | |
| 709 | + idset.add(model.getId()); //这里的id就是parentid | |
| 710 | + } | |
| 711 | + } | |
| 712 | + | |
| 713 | + return idset.size() > 0; | |
| 626 | 714 | } |
| 627 | 715 | } |