Commit af1fbe4aaf8e0fcb70c38a5f6e42050c8af63642
1 parent
2632665ecf
Exists in
master
and in
6 other branches
儿童短信生成添加儿童疫苗
Showing 1 changed file with 128 additions and 0 deletions
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
af1fbe4
| ... | ... | @@ -396,9 +396,137 @@ |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | + //儿童疫苗提醒 | |
| 400 | + else if (smsType == SmsServiceEnums.EBYMTX.getId()) | |
| 401 | + { | |
| 402 | + //发送频次 | |
| 403 | + Integer sendFreq = template.getSendFrequency(); | |
| 399 | 404 | |
| 405 | + if (sendFreq == SendFrequencyEnums.ONCE.getId()) | |
| 406 | + { | |
| 400 | 407 | |
| 408 | + //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"); | |
| 409 | + Integer sendDateType = template.getSendDateType(); | |
| 410 | + if (sendDateType == SendDateEnums.SLRQ.getId()) | |
| 411 | + { | |
| 401 | 412 | |
| 413 | + //时间类型 | |
| 414 | + Integer specialDateType = template.getSpecialDateType(); | |
| 415 | + | |
| 416 | + //儿童天数 | |
| 417 | + if (specialDateType == SpecialDateEnums.ETTS.getId()) | |
| 418 | + { | |
| 419 | + | |
| 420 | + //发送短信集合 | |
| 421 | + MsgListRequest list = new MsgListRequest(); | |
| 422 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 423 | + | |
| 424 | + Integer start = template.getStart(); | |
| 425 | + Integer end = template.getEnd(); | |
| 426 | + | |
| 427 | + if (start != null && end != null) | |
| 428 | + { | |
| 429 | + Date startDate = DateUtils.getNewDate(new Date(),-end, "天", sendTimeType); | |
| 430 | + Date endDate = DateUtils.getNewDate(new Date(),-start,"天",sendTimeType); | |
| 431 | + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); | |
| 432 | + endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 433 | + babyModelQuery.setBirthStart(startDate); | |
| 434 | + babyModelQuery.setBirthEnd(endDate); | |
| 435 | + | |
| 436 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 437 | + if (CollectionUtils.isNotEmpty(babyModels)) | |
| 438 | + { | |
| 439 | + for (BabyModel model : babyModels) | |
| 440 | + { | |
| 441 | + if (model.getBirth() == null) | |
| 442 | + { | |
| 443 | + continue; | |
| 444 | + } | |
| 445 | + if (HelperUtils.isExistMsg(model.getId(), template.getId())) | |
| 446 | + { | |
| 447 | + continue; | |
| 448 | + } | |
| 449 | + | |
| 450 | + //短信前缀 | |
| 451 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 452 | + String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 453 | + messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 454 | + | |
| 455 | + String itemName = "儿童保健"; | |
| 456 | + String nextCheckTime = HelperUtils.getKeyword(start, end, "天"); | |
| 457 | + | |
| 458 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), | |
| 459 | + ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), | |
| 460 | + model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", | |
| 461 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 462 | + | |
| 463 | + messages.add(request); | |
| 464 | + | |
| 465 | + } | |
| 466 | + } | |
| 467 | + } | |
| 468 | + | |
| 469 | + list.setMessages(messages); | |
| 470 | + HelperUtils.sendMsg(list); | |
| 471 | + } | |
| 472 | + //儿童月龄 | |
| 473 | + else if (specialDateType == SpecialDateEnums.ETYL.getId()) | |
| 474 | + { | |
| 475 | + | |
| 476 | + //发送短信集合 | |
| 477 | + MsgListRequest list = new MsgListRequest(); | |
| 478 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 479 | + | |
| 480 | + Integer start = template.getStart(); | |
| 481 | + Integer end = template.getEnd(); | |
| 482 | + | |
| 483 | + if (start != null && end != null) | |
| 484 | + { | |
| 485 | + Date startDate = DateUtils.getNewDate(new Date(),-end-1, "月", sendTimeType); | |
| 486 | + Date endDate = DateUtils.getNewDate(new Date(),-start,"月",sendTimeType); | |
| 487 | + startDate = DateUtils.formatDate(startDate, DateUtils.Y_M_D); | |
| 488 | + endDate = DateUtils.formatDate(endDate,DateUtils.Y_M_D); | |
| 489 | + babyModelQuery.setBirthStart(startDate); | |
| 490 | + babyModelQuery.setBirthEnd(endDate); | |
| 491 | + | |
| 492 | + List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); | |
| 493 | + if (CollectionUtils.isNotEmpty(babyModels)) | |
| 494 | + { | |
| 495 | + for (BabyModel model : babyModels) | |
| 496 | + { | |
| 497 | + if (model.getBirth() == null) | |
| 498 | + { | |
| 499 | + continue; | |
| 500 | + } | |
| 501 | + | |
| 502 | + if (HelperUtils.isExistMsg(model.getId(),template.getId())) | |
| 503 | + { | |
| 504 | + continue; | |
| 505 | + } | |
| 506 | + | |
| 507 | + //短信前缀 | |
| 508 | + String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(),ServiceObjEnums.BABYOBJ.getId()); | |
| 509 | + String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 510 | + messageContent = HelperUtils.replaceName(model.getName(), messageContent); | |
| 511 | + String itemName = "儿童保健"; | |
| 512 | + String nextCheckTime = HelperUtils.getKeyword(start, end, "月龄"); | |
| 513 | + | |
| 514 | + MsgRequest request = HelperUtils.getMessageRequest(messageContent, model.getMphone(), | |
| 515 | + ServiceObjEnums.BABYOBJ.getId(), template.getSmsType(), | |
| 516 | + model.getHospitalId(), template.getId(), model.getId(), itemName, nextCheckTime, "", | |
| 517 | + WxTempleteIdEnums.ER_TONG_TI_XING.getId(),service); | |
| 518 | + messages.add(request); | |
| 519 | + | |
| 520 | + } | |
| 521 | + } | |
| 522 | + } | |
| 523 | + | |
| 524 | + list.setMessages(messages); | |
| 525 | + HelperUtils.sendMsg(list); | |
| 526 | + } | |
| 527 | + } | |
| 528 | + } | |
| 529 | + } | |
| 402 | 530 | } |
| 403 | 531 | |
| 404 | 532 |