Commit 2115441265412a4ae71f00f73ff4cb75d4448eb9
1 parent
fb734b10c8
Exists in
master
and in
6 other branches
update code
Showing 4 changed files with 70 additions and 14 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
2115441
... | ... | @@ -970,11 +970,11 @@ |
970 | 970 | } |
971 | 971 | |
972 | 972 | public static void main(String[] arg) throws Exception { |
973 | - Date start = parseYMD("2017-05-11"); | |
974 | - Date end = parseYMD("2017-06-02"); | |
973 | + Date lastMensesMax = DateUtil.getNewDate(-42, "周", 0); | |
975 | 974 | |
976 | - System.out.println(getMonth(start)); | |
977 | - System.out.println(getMonth(end)); | |
975 | + System.out.println(getyyyy_MM_dd_hms(lastMensesMax)); | |
976 | +// System.out.println(getMonth(start)); | |
977 | +// System.out.println(getMonth(end)); | |
978 | 978 | } |
979 | 979 | |
980 | 980 |
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
2115441
... | ... | @@ -323,6 +323,7 @@ |
323 | 323 | private String lastDiagnose; |
324 | 324 | |
325 | 325 | private List<Integer> buildTypeList; |
326 | + private List<Integer> smsBuildTypeList; | |
326 | 327 | |
327 | 328 | private String queryNo; |
328 | 329 | |
329 | 330 | |
... | ... | @@ -336,7 +337,14 @@ |
336 | 337 | //身长别体重 |
337 | 338 | private String heightWeight; |
338 | 339 | |
340 | + public List<Integer> getSmsBuildTypeList() { | |
341 | + return smsBuildTypeList; | |
342 | + } | |
339 | 343 | |
344 | + public void setSmsBuildTypeList(List<Integer> smsBuildTypeList) { | |
345 | + this.smsBuildTypeList = smsBuildTypeList; | |
346 | + } | |
347 | + | |
340 | 348 | public String getWeightEvaluate() { |
341 | 349 | return weightEvaluate; |
342 | 350 | } |
... | ... | @@ -647,6 +655,9 @@ |
647 | 655 | MongoCondition condition2 = MongoCondition.newInstance("buildType", buildTypeList, MongoOper.IN); |
648 | 656 | |
649 | 657 | condition = condition.orCondition(new MongoCondition[]{condition1, condition2}); |
658 | + } | |
659 | + if (null != smsBuildTypeList) { | |
660 | + condition = condition.and("buildType", smsBuildTypeList, MongoOper.IN); | |
650 | 661 | } |
651 | 662 | |
652 | 663 | if (StringUtils.isNotEmpty(queryNo)){ |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
2115441
... | ... | @@ -416,6 +416,8 @@ |
416 | 416 | |
417 | 417 | private List<Integer> buildTypeList; |
418 | 418 | |
419 | + private List<Integer> smsBuildTypeList; | |
420 | + | |
419 | 421 | private Integer buildTypeEq; |
420 | 422 | |
421 | 423 | private Date fmDateStart; |
... | ... | @@ -456,6 +458,14 @@ |
456 | 458 | // 是否自动分娩 |
457 | 459 | private Integer isAutoFm = -1; |
458 | 460 | |
461 | + public List<Integer> getSmsBuildTypeList() { | |
462 | + return smsBuildTypeList; | |
463 | + } | |
464 | + | |
465 | + public void setSmsBuildTypeList(List<Integer> smsBuildTypeList) { | |
466 | + this.smsBuildTypeList = smsBuildTypeList; | |
467 | + } | |
468 | + | |
459 | 469 | public Integer getIsAutoFm() { |
460 | 470 | return isAutoFm; |
461 | 471 | } |
... | ... | @@ -949,6 +959,10 @@ |
949 | 959 | MongoCondition condition1 = mongoCondition.and("enable", enable, MongoOper.IS); |
950 | 960 | MongoCondition condition2 = MongoCondition.newInstance("buildType", buildTypeList, MongoOper.IN); |
951 | 961 | condition = condition.orCondition(new MongoCondition[]{condition1, condition2}); |
962 | + } | |
963 | + else if (null != smsBuildTypeList) | |
964 | + { | |
965 | + condition = condition.and("buildType", smsBuildTypeList, MongoOper.IN); | |
952 | 966 | } |
953 | 967 | if(null!=extEnable){ |
954 | 968 | List list=new ArrayList(); |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
2115441
... | ... | @@ -146,14 +146,15 @@ |
146 | 146 | List buildType = new ArrayList(); |
147 | 147 | buildType.add(0); |
148 | 148 | buildType.add(2); |
149 | - patientsQuery.setBuildTypeList(buildType); | |
149 | + patientsQuery.setSmsBuildTypeList(buildType); | |
150 | 150 | //1孕妇 3 产妇 |
151 | 151 | patientsQuery.setType(1); |
152 | 152 | //分娩状态 |
153 | 153 | patientsQuery.setDueStatus(0); |
154 | 154 | |
155 | 155 | //末次月经必须大于当前时间减去42周视为未分娩孕妇 |
156 | - Date lastMensesMax = DateUtil.getNewDate(-42, "周", 1); | |
156 | + Date lastMenses = DateUtil.getNewDate(-42, "周", 0); | |
157 | + Date lastMensesMax = DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(lastMenses)); | |
157 | 158 | patientsQuery.setLastMensesStart(lastMensesMax); |
158 | 159 | //健康指导短信 只能是类型为 增值服务 开通状态 才发送 |
159 | 160 | patientsQuery.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); |
160 | 161 | |
... | ... | @@ -238,10 +239,11 @@ |
238 | 239 | { |
239 | 240 | /** |
240 | 241 | * 高危短信 |
242 | + * | |
241 | 243 | */ |
242 | 244 | //获取最后一次高危因素 |
243 | 245 | List risks = findLastRisk(pat.getPid()); |
244 | - if (CollectionUtils.isNotEmpty(risks)) | |
246 | + if (isOnlyHealthy(risks)) | |
245 | 247 | { |
246 | 248 | List<MessageContent> highRiskContents = new ArrayList(); |
247 | 249 | //把多种高危因素的短信合并在一起 |
248 | 250 | |
... | ... | @@ -359,9 +361,34 @@ |
359 | 361 | } |
360 | 362 | |
361 | 363 | |
364 | + /** | |
365 | + * 健康高危因素 id d42eec03-aa86-45b8-a4e0-78a0ff365fb6 | |
366 | + * | |
367 | + * 判断高危因素中是不只有健康 | |
368 | + * @param list | |
369 | + * @return | |
370 | + */ | |
371 | + private boolean isOnlyHealthy(List list) | |
372 | + { | |
373 | + if (CollectionUtils.isNotEmpty(list)) | |
374 | + { | |
375 | + Map<String, Object> riskMap = (Map<String, Object>) list.get(0); | |
376 | + //只存在健康高危因素就生成指导短信 | |
377 | + if (list.size() == 1 && "d42eec03-aa86-45b8-a4e0-78a0ff365fb6".equals(riskMap.get("id").toString())) | |
378 | + { | |
379 | + return false; | |
380 | + } | |
381 | + else | |
382 | + { | |
383 | + return true; | |
384 | + } | |
385 | + } | |
386 | + return false; | |
387 | + } | |
362 | 388 | |
363 | 389 | |
364 | 390 | |
391 | + | |
365 | 392 | /** |
366 | 393 | * 生成儿童ams短信 |
367 | 394 | */ |
... | ... | @@ -421,7 +448,7 @@ |
421 | 448 | List buildType = new ArrayList(); |
422 | 449 | buildType.add(1); |
423 | 450 | buildType.add(2); |
424 | - babyQuery.setBuildTypeList(buildType); | |
451 | + babyQuery.setSmsBuildTypeList(buildType); | |
425 | 452 | |
426 | 453 | //儿童年龄满三岁就不在提供短信服务 |
427 | 454 | Date birthdayMax = DateUtil.addYear(new Date(), -3); |
... | ... | @@ -596,7 +623,7 @@ |
596 | 623 | List buildType = new ArrayList(); |
597 | 624 | buildType.add(0); |
598 | 625 | buildType.add(2); |
599 | - patientsQuery.setBuildTypeList(buildType); | |
626 | + patientsQuery.setSmsBuildTypeList(buildType); | |
600 | 627 | |
601 | 628 | // //末次月经必须大于当前时间减去42周视为为分娩孕妇 |
602 | 629 | // Date lastMensesMax = DateUtil.addDay(new Date(), -42); |
... | ... | @@ -680,7 +707,7 @@ |
680 | 707 | chanpatientsQuery.setLastMensesEnd(chanEndDate); |
681 | 708 | chanpatientsQuery.setLastMensesStart(chanEndDate); |
682 | 709 | |
683 | - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(chanpatientsQuery); | |
710 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(chanpatientsQuery); | |
684 | 711 | if (CollectionUtils.isNotEmpty(patients)) |
685 | 712 | { |
686 | 713 | for (Patients pat : patients) |
... | ... | @@ -791,7 +818,7 @@ |
791 | 818 | List buildType = new ArrayList(); |
792 | 819 | buildType.add(0); |
793 | 820 | buildType.add(2); |
794 | - patientsQuery.setBuildTypeList(buildType); | |
821 | + patientsQuery.setSmsBuildTypeList(buildType); | |
795 | 822 | |
796 | 823 | //1孕妇 |
797 | 824 | patientsQuery.setType(1); |
... | ... | @@ -1109,6 +1136,10 @@ |
1109 | 1136 | BabyModelQuery babyModelQuery = new BabyModelQuery(); |
1110 | 1137 | babyModelQuery.setYn(YnEnums.YES.getId()); |
1111 | 1138 | babyModelQuery.setHospitalId(hospitalId); |
1139 | + List buildType = new ArrayList(); | |
1140 | + buildType.add(1); | |
1141 | + buildType.add(2); | |
1142 | + babyModelQuery.setSmsBuildTypeList(buildType); | |
1112 | 1143 | babyModelQuery = getServiceBabyQuery( serviceType, serviceStatus, babyModelQuery); |
1113 | 1144 | |
1114 | 1145 | //发送短信集合 |
... | ... | @@ -1469,7 +1500,7 @@ |
1469 | 1500 | List buildType = new ArrayList(); |
1470 | 1501 | buildType.add(0); |
1471 | 1502 | buildType.add(2); |
1472 | - patientsQuery.setBuildTypeList(buildType); | |
1503 | + patientsQuery.setSmsBuildTypeList(buildType); | |
1473 | 1504 | //1孕妇 3产妇 |
1474 | 1505 | patientsQuery.setType(3); |
1475 | 1506 | //0未终止妊娠的产妇 |
... | ... | @@ -1728,7 +1759,7 @@ |
1728 | 1759 | PatientsQuery chanPatientsQuery = new PatientsQuery(); |
1729 | 1760 | chanPatientsQuery.setYn(YnEnums.YES.getId()); |
1730 | 1761 | chanPatientsQuery.setHospitalId(hospitalId); |
1731 | - chanPatientsQuery.setBuildTypeList(buildType); | |
1762 | + chanPatientsQuery.setSmsBuildTypeList(buildType); | |
1732 | 1763 | chanPatientsQuery.setType(3); |
1733 | 1764 | chanPatientsQuery.setDueStatus(0); |
1734 | 1765 | getServicePatientQuery(serviceType, serviceStatus, chanPatientsQuery); |
... | ... | @@ -1739,7 +1770,7 @@ |
1739 | 1770 | yunPatientsQuery.setHospitalId(hospitalId); |
1740 | 1771 | yunPatientsQuery.setType(1); |
1741 | 1772 | yunPatientsQuery.setDueStatus(0); |
1742 | - yunPatientsQuery.setBuildTypeList(buildType); | |
1773 | + yunPatientsQuery.setSmsBuildTypeList(buildType); | |
1743 | 1774 | getServicePatientQuery(serviceType, serviceStatus, yunPatientsQuery); |
1744 | 1775 | |
1745 | 1776 |