Commit 8158d6ede6b529eb894c2c6998c8727ff45b8aed
1 parent
52ba4a8301
Exists in
master
and in
1 other branch
code update
Showing 11 changed files with 133 additions and 155 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/ProjectTypeEnums.java
- platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
- platform-data-api/src/main/java/com/lyms/platform/data/util/AmsMessageService.java
- platform-data-api/src/main/resources/config.properties
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsConfigFacade.java
- platform-operate-api/src/main/resources/config.properties
platform-common/src/main/java/com/lyms/platform/common/enums/ProjectTypeEnums.java
View file @
8158d6e
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
View file @
8158d6e
... | ... | @@ -163,7 +163,17 @@ |
163 | 163 | { |
164 | 164 | if (StringUtils.isNotEmpty(repalceStr)) |
165 | 165 | { |
166 | - return repalceStr.replace("{{姓名}}",name); | |
166 | + return repalceStr.replace("{{姓名}}", name); | |
167 | + } | |
168 | + return repalceStr; | |
169 | + } | |
170 | + | |
171 | + public static String replaceBaby(String name,Date birth,String repalceStr) | |
172 | + { | |
173 | + if (StringUtils.isNotEmpty(repalceStr)) | |
174 | + { | |
175 | + String date = DateUtil.getyyyy_MM_dd(birth); | |
176 | + return repalceStr.replace("{{姓名}}",name).replace("{{出生日期}}",date); | |
167 | 177 | } |
168 | 178 | return repalceStr; |
169 | 179 | } |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
8158d6e
... | ... | @@ -1577,23 +1577,24 @@ |
1577 | 1577 | } |
1578 | 1578 | } |
1579 | 1579 | //产妇为分娩日期 |
1580 | - else if (sendDateType == SendDateEnums.TSRQ.getId()) | |
1581 | - { | |
1582 | - Integer specialDateType = template.getSpecialDateType(); | |
1583 | - if (specialDateType == SpecialDateEnums.FM.getId()) | |
1584 | - { | |
1585 | - //分娩都为分娩后第二天发送短信 | |
1586 | - Date dueDate = DateUtil.addDay(new Date(),-1); | |
1587 | - //把时间格式化成 yyyy_MM_dd 的日期 | |
1588 | - dueDate = DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(dueDate)); | |
1589 | - | |
1590 | - patientsQuery.setDueDateStart(dueDate); | |
1591 | - patientsQuery.setDueDateEnd(dueDate); | |
1592 | - | |
1593 | - messages.addAll(getChanMessageRequestList(patientsQuery, config, template)); | |
1594 | - } | |
1595 | - | |
1596 | - } | |
1580 | + //在填写分娩记录处生成 | |
1581 | +// else if (sendDateType == SendDateEnums.TSRQ.getId()) | |
1582 | +// { | |
1583 | +// Integer specialDateType = template.getSpecialDateType(); | |
1584 | +// if (specialDateType == SpecialDateEnums.FM.getId()) | |
1585 | +// { | |
1586 | +// //分娩都为分娩后第二天发送短信 | |
1587 | +// Date dueDate = DateUtil.addDay(new Date(),-1); | |
1588 | +// //把时间格式化成 yyyy_MM_dd 的日期 | |
1589 | +// dueDate = DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(dueDate)); | |
1590 | +// | |
1591 | +// patientsQuery.setDueDateStart(dueDate); | |
1592 | +// patientsQuery.setDueDateEnd(dueDate); | |
1593 | +// | |
1594 | +// messages.addAll(getChanMessageRequestList(patientsQuery, config, template)); | |
1595 | +// } | |
1596 | +// | |
1597 | +// } | |
1597 | 1598 | |
1598 | 1599 | } |
1599 | 1600 | } |
platform-data-api/src/main/java/com/lyms/platform/data/util/AmsMessageService.java
View file @
8158d6e
platform-data-api/src/main/resources/config.properties
View file @
8158d6e
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
8158d6e
... | ... | @@ -486,12 +486,12 @@ |
486 | 486 | /** |
487 | 487 | * 创建建档短信 |
488 | 488 | */ |
489 | - private void createBuildSms(BabyModel babyModel) | |
489 | + public void createBuildSms(BabyModel babyModel) | |
490 | 490 | { |
491 | 491 | |
492 | 492 | //判断医院是否启动和对应的服务项是否启用 |
493 | 493 | SmsConfigModel configModel = new SmsConfigModel(); |
494 | - BaseResponse response = smsConfigFacade.hospitalIsStart(babyModel.getHospitalId(),configModel); | |
494 | + BaseResponse response = smsConfigFacade.hospitalIsStart(babyModel.getHospitalId(),configModel,SmsServiceEnums.FWKT.getId()); | |
495 | 495 | if (response != null) |
496 | 496 | { |
497 | 497 | return; |
... | ... | @@ -609,7 +609,7 @@ |
609 | 609 | List<MessageRequest> messages = new ArrayList<>(); |
610 | 610 | MessageRequest mr = new MessageRequest(); |
611 | 611 | String content = "【" + messagePrefix + "】" + templateModel.getContent(); |
612 | - mr.setContent(StringUtils.replaceName(babyModel.getName(),content)); | |
612 | + mr.setContent(StringUtils.replaceBaby(babyModel.getName(),babyModel.getBirth(),content)); | |
613 | 613 | mr.setObjType(ServiceObjEnums.BABYOBJ.getId()); |
614 | 614 | mr.setPhone(babyModel.getMphone()); |
615 | 615 | //短信商 |
616 | 616 | |
617 | 617 | |
... | ... | @@ -640,8 +640,92 @@ |
640 | 640 | } |
641 | 641 | |
642 | 642 | |
643 | + public static void main(String[] args) | |
644 | + { | |
643 | 645 | |
646 | + Integer serviceType = 1; | |
647 | + Integer serviceStatus = 3; | |
648 | + List<SmsTemplateModel> sendList = new ArrayList<>(); | |
649 | + List<SmsTemplateModel> temps = new ArrayList<>(); | |
644 | 650 | |
651 | + SmsTemplateModel model = new SmsTemplateModel(); | |
652 | + model.setServiceType(100); | |
653 | + model.setServiceStatus(7); | |
654 | + temps.add(model); | |
655 | + | |
656 | + if (CollectionUtils.isNotEmpty(temps)) { | |
657 | + | |
658 | + for (SmsTemplateModel temp : temps) { | |
659 | + if (temp.getServiceType() == serviceType && temp.getServiceStatus() == serviceStatus) { | |
660 | + sendList.add(temp); | |
661 | + break; | |
662 | + } | |
663 | + } | |
664 | + | |
665 | + for (SmsTemplateModel temp : temps) { | |
666 | + if (temp.getServiceStatus() == ServiceStatusEnums.STANDARD_ALL.getId()) { | |
667 | + if (serviceStatus == ServiceStatusEnums.STANDARD_OPEN.getId() || serviceStatus == ServiceStatusEnums.NO_OPEN.getId() || serviceStatus == ServiceStatusEnums.STANDARD_OVERDUE.getId()) { | |
668 | + sendList.add(temp); | |
669 | + break; | |
670 | + } | |
671 | + } | |
672 | + } | |
673 | + | |
674 | + for (SmsTemplateModel temp : temps) { | |
675 | + if (temp.getServiceStatus() == ServiceStatusEnums.ADD_ALL.getId()) { | |
676 | + if (serviceStatus == ServiceStatusEnums.ADD_OPEN.getId() || serviceStatus == ServiceStatusEnums.UNSUBSCRIBE.getId() | |
677 | + || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId() || serviceStatus == ServiceStatusEnums.SUSPEND.getId()) { | |
678 | + sendList.add(temp); | |
679 | + break; | |
680 | + } | |
681 | + } | |
682 | + } | |
683 | + | |
684 | + | |
685 | + for (SmsTemplateModel temp : temps) { | |
686 | + if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OPEN.getId()) { | |
687 | + if (serviceStatus == ServiceStatusEnums.STANDARD_OPEN.getId() || serviceStatus == ServiceStatusEnums.ADD_OPEN.getId()) { | |
688 | + sendList.add(temp); | |
689 | + break; | |
690 | + } | |
691 | + } | |
692 | + } | |
693 | + | |
694 | + | |
695 | + for (SmsTemplateModel temp : temps) { | |
696 | + if (temp.getServiceStatus() == ServiceStatusEnums.ALL_NO_OPEN.getId()) { | |
697 | + if (serviceStatus == ServiceStatusEnums.NO_OPEN.getId() || serviceStatus == ServiceStatusEnums.UNSUBSCRIBE.getId()) { | |
698 | + sendList.add(temp); | |
699 | + break; | |
700 | + } | |
701 | + } | |
702 | + } | |
703 | + | |
704 | + | |
705 | + for (SmsTemplateModel temp : temps) { | |
706 | + if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OVERDUE.getId()) { | |
707 | + if (serviceStatus == ServiceStatusEnums.STANDARD_OVERDUE.getId() || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId()) { | |
708 | + sendList.add(temp); | |
709 | + break; | |
710 | + } | |
711 | + } | |
712 | + } | |
713 | + | |
714 | + | |
715 | + for (SmsTemplateModel temp : temps) { | |
716 | + if (temp.getServiceType() == ServiceTypeEnums.ALL_SERVICE.getId() && temp.getServiceStatus() == ServiceStatusEnums.ALL.getId()) { | |
717 | + sendList.add(temp); | |
718 | + break; | |
719 | + } | |
720 | + } | |
721 | + | |
722 | + System.out.print(sendList.size()); | |
723 | + } | |
724 | + } | |
725 | + | |
726 | + | |
727 | + | |
728 | + | |
645 | 729 | /** |
646 | 730 | * 准备修改和添加的孕妇建档数据 |
647 | 731 | * |
... | ... | @@ -1556,7 +1640,7 @@ |
1556 | 1640 | |
1557 | 1641 | //判断医院是否启动和对应的服务项是否启用 |
1558 | 1642 | SmsConfigModel configModel = new SmsConfigModel(); |
1559 | - BaseResponse response = smsConfigFacade.hospitalIsStart(hospitalId,configModel); | |
1643 | + BaseResponse response = smsConfigFacade.hospitalIsStart(hospitalId,configModel,SmsServiceEnums.YSGXHZD.getId()); | |
1560 | 1644 | if (response != null) |
1561 | 1645 | { |
1562 | 1646 | return response; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
8158d6e
... | ... | @@ -242,48 +242,14 @@ |
242 | 242 | private void createBuildSms(Patients patient) |
243 | 243 | { |
244 | 244 | |
245 | - OrganizationQuery orgQuery = new OrganizationQuery(); | |
246 | - orgQuery.setYn(YnEnums.YES.getId()); | |
247 | - orgQuery.setId(Integer.parseInt(patient.getHospitalId())); | |
248 | - List<Organization> list = organizationService.queryOrganization(orgQuery); | |
249 | - boolean isRunning = false; | |
250 | - if (CollectionUtils.isNotEmpty(list)) | |
245 | + //判断医院是否启动和对应的服务项是否启用 | |
246 | + SmsConfigModel configModel = new SmsConfigModel(); | |
247 | + BaseResponse response = smsConfigFacade.hospitalIsStart(patient.getHospitalId(),configModel,SmsServiceEnums.FWKT.getId()); | |
248 | + if (response != null) | |
251 | 249 | { |
252 | - Organization org = list.get(0); | |
253 | - if (org != null) | |
254 | - { | |
255 | - Integer status = org.getStatus(); | |
256 | - if (status != null && (status == HospitalStatusEnums.SYX.getId() || status == HospitalStatusEnums.ZSYX.getId())) | |
257 | - { | |
258 | - isRunning = true; | |
259 | - } | |
260 | - } | |
261 | - } | |
262 | - if (!isRunning) | |
263 | - { | |
264 | 250 | return; |
265 | 251 | } |
266 | 252 | |
267 | - SmsConfigQuery configQuery = new SmsConfigQuery(); | |
268 | - configQuery.setYn(YnEnums.YES.getId()); | |
269 | - configQuery.setHospitalId(patient.getHospitalId()); | |
270 | - //查询出对应医院配置 | |
271 | - List<SmsConfigModel> configs = smsConfigService.querySmsConfig(configQuery); | |
272 | - boolean isStart = false; | |
273 | - if (CollectionUtils.isNotEmpty(configs)) | |
274 | - { | |
275 | - String serviceStr = configs.get(0).getSmsService(); | |
276 | - if (StringUtils.isNotEmpty(serviceStr)) | |
277 | - { | |
278 | - isStart = isStartService(SmsServiceEnums.FWKT.getId(), serviceStr); | |
279 | - } | |
280 | - | |
281 | - } | |
282 | - if (!isStart) | |
283 | - { | |
284 | - return; | |
285 | - } | |
286 | - | |
287 | 253 | SmsTemplateQuery query = new SmsTemplateQuery(); |
288 | 254 | query.setYn(YnEnums.YES.getId()); |
289 | 255 | query.setStatus(1); |
290 | 256 | |
... | ... | @@ -338,98 +304,11 @@ |
338 | 304 | } |
339 | 305 | } |
340 | 306 | |
341 | - | |
342 | -// for (SmsTemplateModel temp : temps) | |
343 | -// { | |
344 | -// if (temp.getServiceType() == serviceType && temp.getServiceStatus() == serviceStatus) | |
345 | -// { | |
346 | -// sendList.add(temp); | |
347 | -// break; | |
348 | -// } | |
349 | -// } | |
350 | -// | |
351 | -// for (SmsTemplateModel temp : temps) | |
352 | -// { | |
353 | -// if (temp.getServiceStatus() == ServiceStatusEnums.STANDARD_ALL.getId()) | |
354 | -// { | |
355 | -// if (serviceStatus == ServiceStatusEnums.STANDARD_OPEN.getId() || serviceStatus == ServiceStatusEnums.NO_OPEN.getId() || serviceStatus == ServiceStatusEnums.STANDARD_OVERDUE.getId() ) | |
356 | -// { | |
357 | -// sendList.add(temp); | |
358 | -// break; | |
359 | -// } | |
360 | -// } | |
361 | -// } | |
362 | -// | |
363 | -// for (SmsTemplateModel temp : temps) | |
364 | -// { | |
365 | -// if (temp.getServiceStatus() == ServiceStatusEnums.ADD_ALL.getId()) | |
366 | -// { | |
367 | -// if (serviceStatus == ServiceStatusEnums.ADD_OPEN.getId() || serviceStatus == ServiceStatusEnums.UNSUBSCRIBE.getId() | |
368 | -// || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId()|| serviceStatus == ServiceStatusEnums.SUSPEND.getId()) | |
369 | -// { | |
370 | -// sendList.add(temp); | |
371 | -// break; | |
372 | -// } | |
373 | -// } | |
374 | -// } | |
375 | -// | |
376 | -// | |
377 | -// for (SmsTemplateModel temp : temps) | |
378 | -// { | |
379 | -// if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OPEN.getId()) | |
380 | -// { | |
381 | -// if (serviceStatus == ServiceStatusEnums.STANDARD_OPEN.getId() || serviceStatus == ServiceStatusEnums.ADD_OPEN.getId() ) | |
382 | -// { | |
383 | -// sendList.add(temp); | |
384 | -// break; | |
385 | -// } | |
386 | -// } | |
387 | -// } | |
388 | -// | |
389 | -// | |
390 | -// | |
391 | -// for (SmsTemplateModel temp : temps) | |
392 | -// { | |
393 | -// if (temp.getServiceStatus() == ServiceStatusEnums.ALL_NO_OPEN.getId()) | |
394 | -// { | |
395 | -// if (serviceStatus == ServiceStatusEnums.NO_OPEN.getId() || serviceStatus == ServiceStatusEnums.UNSUBSCRIBE.getId() ) | |
396 | -// { | |
397 | -// sendList.add(temp); | |
398 | -// break; | |
399 | -// } | |
400 | -// } | |
401 | -// } | |
402 | -// | |
403 | -// | |
404 | -// | |
405 | -// for (SmsTemplateModel temp : temps) | |
406 | -// { | |
407 | -// if (temp.getServiceStatus() == ServiceStatusEnums.ALL_OVERDUE.getId()) | |
408 | -// { | |
409 | -// if (serviceStatus == ServiceStatusEnums.STANDARD_OVERDUE.getId() || serviceStatus == ServiceStatusEnums.ADD_OVERDUE.getId() ) | |
410 | -// { | |
411 | -// sendList.add(temp); | |
412 | -// break; | |
413 | -// } | |
414 | -// } | |
415 | -// } | |
416 | -// | |
417 | -// | |
418 | -// | |
419 | -// for (SmsTemplateModel temp : temps) | |
420 | -// { | |
421 | -// if (temp.getServiceType() == ServiceTypeEnums.ALL_SERVICE.getId() && temp.getServiceStatus() == ServiceStatusEnums.ALL.getId()) | |
422 | -// { | |
423 | -// sendList.add(temp); | |
424 | -// break; | |
425 | -// } | |
426 | -// } | |
427 | - | |
428 | 307 | if (CollectionUtils.isNotEmpty(sendList)) |
429 | 308 | { |
430 | 309 | |
431 | 310 | //短信前缀 |
432 | - String messagePrefix = smsConfigFacade.getSmsPrefix(configs.get(0), patient.getBookbuildingDoctor()); | |
311 | + String messagePrefix = smsConfigFacade.getSmsPrefix(configModel, patient.getBookbuildingDoctor()); | |
433 | 312 | for (SmsTemplateModel templateModel : sendList) |
434 | 313 | { |
435 | 314 | if (templateModel != null && templateModel.getStatus() == 1) |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
8158d6e
... | ... | @@ -55,6 +55,9 @@ |
55 | 55 | @Autowired |
56 | 56 | private StopPregnancyService stopPregnancyService; |
57 | 57 | |
58 | + @Autowired | |
59 | + private BabyBookbuildingFacade babyBookbuildingFacade; | |
60 | + | |
58 | 61 | private static Map<Integer, String> ONE_ENUMS = new HashMap<>(); |
59 | 62 | |
60 | 63 | private static Map<String, List> babyMap = new HashMap<>(); |
... | ... | @@ -468,6 +471,7 @@ |
468 | 471 | babyModel.setPid(personService.addPerson(personModel).getId()); |
469 | 472 | } |
470 | 473 | babyIds.add(babyService.addOneBaby(babyModel).getId()); |
474 | + babyBookbuildingFacade.createBuildSms(babyModel); | |
471 | 475 | i++; |
472 | 476 | } |
473 | 477 | maternalDeliverModel.setBaby(babyList); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
8158d6e
... | ... | @@ -522,7 +522,7 @@ |
522 | 522 | |
523 | 523 | //判断医院是否启动和对应的服务项是否启用 |
524 | 524 | SmsConfigModel configModel = new SmsConfigModel(); |
525 | - BaseResponse response = smsConfigFacade.hospitalIsStart(hospital,configModel); | |
525 | + BaseResponse response = smsConfigFacade.hospitalIsStart(hospital,configModel,SmsServiceEnums.YSGXHZD.getId()); | |
526 | 526 | if (response != null) |
527 | 527 | { |
528 | 528 | return response; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsConfigFacade.java
View file @
8158d6e
... | ... | @@ -716,7 +716,7 @@ |
716 | 716 | } |
717 | 717 | |
718 | 718 | |
719 | - public BaseResponse hospitalIsStart(String hospitalId,SmsConfigModel configModel) | |
719 | + public BaseResponse hospitalIsStart(String hospitalId,SmsConfigModel configModel,int service) | |
720 | 720 | { |
721 | 721 | OrganizationQuery orgQuery = new OrganizationQuery(); |
722 | 722 | orgQuery.setYn(YnEnums.YES.getId()); |
... | ... | @@ -755,7 +755,7 @@ |
755 | 755 | String serviceStr = configs.get(0).getSmsService(); |
756 | 756 | if (StringUtils.isNotEmpty(serviceStr)) |
757 | 757 | { |
758 | - isStart = isStartService(SmsServiceEnums.FWKT.getId(), serviceStr); | |
758 | + isStart = isStartService(service, serviceStr); | |
759 | 759 | } |
760 | 760 | } |
761 | 761 | if (!isStart) |
platform-operate-api/src/main/resources/config.properties
View file @
8158d6e