Commit 29c8368a6b3ae3bb2b1584fd2ba9092b8d451ff9
1 parent
c011308e6e
Exists in
master
and in
6 other branches
update
Showing 5 changed files with 105 additions and 8 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/controller/MsgGenerateController.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
29c8368
platform-dal/src/main/java/com/lyms/platform/query/AntExQuery.java
View file @
29c8368
| ... | ... | @@ -53,6 +53,25 @@ |
| 53 | 53 | |
| 54 | 54 | private Date checkEndDate; |
| 55 | 55 | |
| 56 | + private Date nextCheckTimeStartDate; | |
| 57 | + private Date nextCheckTimeEndDate; | |
| 58 | + | |
| 59 | + public Date getNextCheckTimeStartDate() { | |
| 60 | + return nextCheckTimeStartDate; | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setNextCheckTimeStartDate(Date nextCheckTimeStartDate) { | |
| 64 | + this.nextCheckTimeStartDate = nextCheckTimeStartDate; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public Date getNextCheckTimeEndDate() { | |
| 68 | + return nextCheckTimeEndDate; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public void setNextCheckTimeEndDate(Date nextCheckTimeEndDate) { | |
| 72 | + this.nextCheckTimeEndDate = nextCheckTimeEndDate; | |
| 73 | + } | |
| 74 | + | |
| 56 | 75 | public Date getCheckStartDate() { |
| 57 | 76 | return checkStartDate; |
| 58 | 77 | } |
| ... | ... | @@ -268,6 +287,15 @@ |
| 268 | 287 | condition = condition.orCondition(new MongoCondition[]{mongoCondition, condition2}); |
| 269 | 288 | } |
| 270 | 289 | |
| 290 | + | |
| 291 | + if (null != nextCheckTimeEndDate && nextCheckTimeStartDate != null) { | |
| 292 | + if (null != c) { | |
| 293 | + c = c.where("nextCheckTime").gte(nextCheckTimeStartDate).lte(nextCheckTimeEndDate); | |
| 294 | + } else { | |
| 295 | + c = Criteria.where("nextCheckTime").gte(nextCheckTimeStartDate).lte(nextCheckTimeEndDate); | |
| 296 | + } | |
| 297 | + isAddStart = Boolean.TRUE; | |
| 298 | + } | |
| 271 | 299 | |
| 272 | 300 | if (null != createdTimeStart && createdTimeEnd != null) { |
| 273 | 301 | if (null != c) { |
platform-msg-generate/src/main/java/com/lyms/platform/msg/controller/MsgGenerateController.java
View file @
29c8368
| ... | ... | @@ -142,9 +142,9 @@ |
| 142 | 142 | @ResponseBody |
| 143 | 143 | public String generaterAllMsg() |
| 144 | 144 | { |
| 145 | - msgGenerateService.generaterAllAmsMsg(); | |
| 145 | +// msgGenerateService.generaterAllAmsMsg(); | |
| 146 | 146 | msgGenerateService.generaterAllTmpMsg(); |
| 147 | - msgGenerateService.generaterAllCourseMsg(); | |
| 147 | +// msgGenerateService.generaterAllCourseMsg(); | |
| 148 | 148 | return ""; |
| 149 | 149 | } |
| 150 | 150 |
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/MsgGenerateServiceImpl.java
View file @
29c8368
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | import org.slf4j.Logger; |
| 22 | 22 | import org.slf4j.LoggerFactory; |
| 23 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 24 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 24 | 25 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 25 | 26 | import org.springframework.stereotype.Service; |
| 26 | 27 | |
| 27 | 28 | |
| ... | ... | @@ -95,8 +96,12 @@ |
| 95 | 96 | |
| 96 | 97 | @Autowired |
| 97 | 98 | private MatDeliverService matDeliverService; |
| 99 | + @Autowired | |
| 100 | + private AntenatalExaminationService antenatalExaminationService; | |
| 101 | + @Autowired | |
| 102 | + @Qualifier("cfCheckItemService") | |
| 103 | + private CheckItemService checkItemService; | |
| 98 | 104 | |
| 99 | - | |
| 100 | 105 | /** |
| 101 | 106 | * 生成孕妇的AMS推送消息 |
| 102 | 107 | * @param generateHospitalId 医院id |
| ... | ... | @@ -259,7 +264,10 @@ |
| 259 | 264 | if (end > configModels.size()) { |
| 260 | 265 | end = configModels.size(); |
| 261 | 266 | } |
| 262 | - TempleteMsgGenerateWorker worker = new TempleteMsgGenerateWorker(configModels.subList(i,end), | |
| 267 | + TempleteMsgGenerateWorker worker = new TempleteMsgGenerateWorker( | |
| 268 | + antenatalExaminationService, | |
| 269 | + checkItemService, | |
| 270 | + configModels.subList(i,end), | |
| 263 | 271 | baseService, |
| 264 | 272 | yunBookbuildingService, |
| 265 | 273 | smsTemplateService, |
| ... | ... | @@ -327,7 +335,8 @@ |
| 327 | 335 | */ |
| 328 | 336 | @Override |
| 329 | 337 | public void generaterAllTmpMsg() { |
| 330 | - generateTemplateMsg(null); | |
| 338 | +// generateTemplateMsg(null); | |
| 339 | + generateTemplateMsg("1000000115"); | |
| 331 | 340 | } |
| 332 | 341 | |
| 333 | 342 |
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
29c8368
| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | import com.lyms.platform.biz.service.*; |
| 6 | 6 | import com.lyms.platform.common.enums.*; |
| 7 | 7 | import com.lyms.platform.common.utils.DateUtil; |
| 8 | -import com.lyms.platform.common.utils.JsonUtil; | |
| 9 | 8 | import com.lyms.platform.common.utils.StringUtils; |
| 10 | 9 | import com.lyms.platform.msg.service.IBaseService; |
| 11 | 10 | import com.lyms.platform.msg.utils.DateUtils; |
| ... | ... | @@ -18,7 +17,6 @@ |
| 18 | 17 | import org.apache.commons.collections.CollectionUtils; |
| 19 | 18 | import org.slf4j.Logger; |
| 20 | 19 | import org.slf4j.LoggerFactory; |
| 21 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 22 | 20 | import org.springframework.data.domain.Sort; |
| 23 | 21 | import org.springframework.data.mongodb.core.MongoTemplate; |
| 24 | 22 | import org.springframework.data.mongodb.core.query.Criteria; |
| 25 | 23 | |
| ... | ... | @@ -65,7 +63,9 @@ |
| 65 | 63 | |
| 66 | 64 | private ResidentsArchiveService residentsArchiveService; |
| 67 | 65 | |
| 66 | + private AntenatalExaminationService antenatalExaminationService; | |
| 68 | 67 | |
| 68 | + private CheckItemService checkItemService; | |
| 69 | 69 | |
| 70 | 70 | private FolviteMapper folviteMapper; |
| 71 | 71 | |
| ... | ... | @@ -73,7 +73,9 @@ |
| 73 | 73 | |
| 74 | 74 | |
| 75 | 75 | private MatDeliverService matDeliverService; |
| 76 | - public TempleteMsgGenerateWorker(List<SmsConfigModel> configs, | |
| 76 | + public TempleteMsgGenerateWorker(AntenatalExaminationService antenatalExaminationService, | |
| 77 | + CheckItemService checkItemService, | |
| 78 | + List<SmsConfigModel> configs, | |
| 77 | 79 | IBaseService baseService, |
| 78 | 80 | YunBookbuildingService yunBookbuildingService, |
| 79 | 81 | SmsTemplateService smsTemplateService, |
| ... | ... | @@ -92,6 +94,8 @@ |
| 92 | 94 | FolviteMapper folviteMapper |
| 93 | 95 | |
| 94 | 96 | ) { |
| 97 | + this.antenatalExaminationService = antenatalExaminationService; | |
| 98 | + this.checkItemService = checkItemService; | |
| 95 | 99 | this.configs = configs; |
| 96 | 100 | this.baseService = baseService; |
| 97 | 101 | this.yunBookbuildingService = yunBookbuildingService; |
| ... | ... | @@ -1770,6 +1774,8 @@ |
| 1770 | 1774 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
| 1771 | 1775 | //messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); |
| 1772 | 1776 | messageContent = HelperUtils.replaceELD(pat.getUsername(), yuYueDate, remark, messageContent); |
| 1777 | + //包含{{检查项目}}就赋值最近检查项目 | |
| 1778 | + messageContent = getCheckTimeStr(pat, messageContent); | |
| 1773 | 1779 | |
| 1774 | 1780 | String checkTimeStr = DateUtils.getDateStr(yuYueDate, DateUtils.Y_M_D); |
| 1775 | 1781 | String checkName = "产前检查"; |
| ... | ... | @@ -1782,6 +1788,57 @@ |
| 1782 | 1788 | messages.add(request); |
| 1783 | 1789 | } |
| 1784 | 1790 | } |
| 1791 | + } | |
| 1792 | + | |
| 1793 | + private String getCheckTimeStr(Patients pat, String messageContent) { | |
| 1794 | + String nextCheckItem = ""; | |
| 1795 | + try { | |
| 1796 | + if(StringUtils.isNotEmpty(messageContent) && messageContent.contains("{{检查项目}}")){ | |
| 1797 | + Date nextCheckTime = pat.getNextCheckTime(); | |
| 1798 | + //复诊 | |
| 1799 | + AntExQuery antExQuery = new AntExQuery(); | |
| 1800 | + antExQuery.setYn(YnEnums.YES.getId()); | |
| 1801 | + antExQuery.setParentId(pat.getId()); | |
| 1802 | + antExQuery.setNextCheckTimeStartDate(DateUtil.getDayStartTime(nextCheckTime)); | |
| 1803 | + antExQuery.setNextCheckTimeEndDate(DateUtil.getDayEndTime(nextCheckTime)); | |
| 1804 | + List <AntenatalExaminationModel> antenatalExaminationModels = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
| 1805 | + if(CollectionUtils.isNotEmpty(antenatalExaminationModels)){ | |
| 1806 | + AntenatalExaminationModel fz = antenatalExaminationModels.get(0); | |
| 1807 | + if(fz!=null && StringUtils.isNotEmpty(fz.getConfigItemId())){ | |
| 1808 | + String[] arrs = fz.getConfigItemId().split(","); | |
| 1809 | + for (String checkItemId : arrs) { | |
| 1810 | + String checkItem = checkItemService.getOne(Integer.parseInt(checkItemId)); | |
| 1811 | + nextCheckItem += StringUtils.isEmpty(nextCheckItem) ? checkItem : ("," + checkItem); | |
| 1812 | + } | |
| 1813 | + } | |
| 1814 | + | |
| 1815 | + } | |
| 1816 | + //初诊 | |
| 1817 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 1818 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 1819 | + antExChuQuery.setParentId(pat.getId()); | |
| 1820 | + antExChuQuery.setNextCheckTimeStart(DateUtil.getDayStartTime(nextCheckTime)); | |
| 1821 | + antExChuQuery.setNextCheckTimeEnd(DateUtil.getDayEndTime(nextCheckTime)); | |
| 1822 | + System.out.println(antExChuQuery.convertToQuery().convertToMongoQuery()); | |
| 1823 | + List <AntExChuModel> antExChuModels = antenatalExaminationService.queryAntExChu(antExChuQuery.convertToQuery().addOrder(Sort.Direction.DESC, "created")); | |
| 1824 | + if(CollectionUtils.isNotEmpty(antExChuModels) && CollectionUtils.isEmpty(antenatalExaminationModels)){ | |
| 1825 | + AntExChuModel antExChuModel = antExChuModels.get(0); | |
| 1826 | + if(antExChuModel!=null && StringUtils.isNotEmpty(antExChuModel.getConfigItemId())){ | |
| 1827 | + String[] arrs = antExChuModel.getConfigItemId().split(","); | |
| 1828 | + for (String checkItemId : arrs) { | |
| 1829 | + String checkItem = checkItemService.getOne(Integer.parseInt(checkItemId)); | |
| 1830 | + nextCheckItem += StringUtils.isEmpty(nextCheckItem) ? checkItem : ("、" + checkItem); | |
| 1831 | + } | |
| 1832 | + } | |
| 1833 | + } | |
| 1834 | + if(StringUtils.isNotEmpty(nextCheckItem)){ | |
| 1835 | + messageContent = messageContent.replace("{{检查项目}}", "检查"+nextCheckItem); | |
| 1836 | + } | |
| 1837 | + } | |
| 1838 | + } catch (NumberFormatException e) { | |
| 1839 | + e.printStackTrace(); | |
| 1840 | + } | |
| 1841 | + return messageContent; | |
| 1785 | 1842 | } |
| 1786 | 1843 | |
| 1787 | 1844 |