Commit 49bf4904aa45f4d9ea3c32f059f735e92eda6bb9
1 parent
b53a48ca47
Exists in
master
and in
6 other branches
一级二级追访详细署名医生
Showing 6 changed files with 176 additions and 35 deletions
- platform-msg-generate/src/main/java/com/lyms/platform/msg/service/IBaseService.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/BaseServiceImpl.java
- platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.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/ViewFacade.java
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/IBaseService.java
View file @
49bf490
1 | 1 | package com.lyms.platform.msg.service; |
2 | 2 | |
3 | 3 | import com.lyms.platform.pojo.SmsConfigModel; |
4 | +import com.lyms.platform.pojo.SmsTemplateModel; | |
4 | 5 | |
5 | 6 | import java.util.Date; |
6 | 7 | import java.util.List; |
... | ... | @@ -35,5 +36,9 @@ |
35 | 36 | |
36 | 37 | public String getServiceDoctorId(String patientId,boolean isJz); |
37 | 38 | public String getBabyServiceDoctorId(String babyId,boolean isJz); |
39 | + | |
40 | + public String getBabySmsPrefix(SmsConfigModel config,String babyId,String mainPrefix,SmsTemplateModel template); | |
41 | + | |
42 | + public String getPregnantSmsPrefix(SmsConfigModel config,String pid,String mainPrefix,SmsTemplateModel template); | |
38 | 43 | } |
platform-msg-generate/src/main/java/com/lyms/platform/msg/service/impl/BaseServiceImpl.java
View file @
49bf490
1 | 1 | package com.lyms.platform.msg.service.impl; |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.*; |
4 | -import com.lyms.platform.common.enums.HospitalStatusEnums; | |
5 | -import com.lyms.platform.common.enums.PatientSerEnums; | |
6 | -import com.lyms.platform.common.enums.ServiceObjEnums; | |
7 | -import com.lyms.platform.common.enums.YnEnums; | |
4 | +import com.lyms.platform.common.enums.*; | |
8 | 5 | import com.lyms.platform.common.utils.JsonUtil; |
9 | 6 | import com.lyms.platform.common.utils.StringUtils; |
10 | 7 | import com.lyms.platform.msg.model.HighScoreResult; |
... | ... | @@ -19,6 +16,9 @@ |
19 | 16 | import org.apache.commons.collections.CollectionUtils; |
20 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
21 | 18 | import org.springframework.data.domain.Sort; |
19 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
20 | +import org.springframework.data.mongodb.core.query.Criteria; | |
21 | +import org.springframework.data.mongodb.core.query.Query; | |
22 | 22 | import org.springframework.stereotype.Service; |
23 | 23 | |
24 | 24 | import java.util.*; |
25 | 25 | |
... | ... | @@ -32,8 +32,9 @@ |
32 | 32 | @Autowired |
33 | 33 | private SmsConfigService smsConfigService; |
34 | 34 | |
35 | + @Autowired | |
36 | + private AntExRecordService recordService; | |
35 | 37 | |
36 | - | |
37 | 38 | @Autowired |
38 | 39 | private UsersService usersService; |
39 | 40 | |
40 | 41 | |
... | ... | @@ -47,8 +48,15 @@ |
47 | 48 | |
48 | 49 | @Autowired |
49 | 50 | private PatientsService patientsService; |
51 | + @Autowired | |
52 | + private BabyCheckService babyCheckService; | |
50 | 53 | |
51 | 54 | @Autowired |
55 | + private BabyService babyService; | |
56 | + | |
57 | + @Autowired | |
58 | + private MongoTemplate mongoTemplate; | |
59 | + @Autowired | |
52 | 60 | private OrganizationService organizationService; |
53 | 61 | |
54 | 62 | @Autowired |
... | ... | @@ -284,6 +292,89 @@ |
284 | 292 | |
285 | 293 | |
286 | 294 | /** |
295 | + * 获取儿童 前缀 | |
296 | + * @param config | |
297 | + * @param babyId | |
298 | + * @return | |
299 | + */ | |
300 | + public String getBabySmsPrefix(SmsConfigModel config,String babyId,String mainPrefix,SmsTemplateModel template) | |
301 | + { | |
302 | + String prefix = mainPrefix; | |
303 | + if (config.getBabyType() != null && config.getBabyType() == 1) | |
304 | + { | |
305 | + prefix = config.getHospitalPrefix(); | |
306 | + //儿保程序提醒 | |
307 | + if (template.getSmsType() == SmsServiceEnums.EBCXTX.getId() || template.getSmsType() == SmsServiceEnums.EBYYTX.getId() || template.getSmsType() == SmsServiceEnums.EBGQTX.getId()) | |
308 | + { | |
309 | + BabyCheckModelQuery babyCheckModelQuery = new BabyCheckModelQuery(); | |
310 | + babyCheckModelQuery.setYn(YnEnums.YES.getId()); | |
311 | + babyCheckModelQuery.setBuildId(babyId); | |
312 | + List<BabyCheckModel> babyCheckModels = babyCheckService.queryBabyCheckRecord(babyCheckModelQuery); | |
313 | + if (CollectionUtils.isNotEmpty(babyCheckModels)) | |
314 | + { | |
315 | + prefix +="-" +getDoctorName(babyCheckModels.get(0).getCheckDoctor()); | |
316 | + } | |
317 | + else | |
318 | + { | |
319 | + BabyModel babyModel = babyService.getOneBabyById(babyId); | |
320 | + prefix += "-" +getDoctorName(babyModel.getBuildDoctor()); | |
321 | + } | |
322 | + } | |
323 | + else if (template.getSmsType() == SmsServiceEnums.YBYYTX.getId()) | |
324 | + { | |
325 | + List<BabyEyeCheck> checkModels = mongoTemplate.find(Query.query(Criteria.where("babyId").is(babyId).and("yn").is("1")), BabyEyeCheck.class); | |
326 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
327 | + prefix +="-" +getDoctorName(checkModels.get(0).getDoctor()); | |
328 | + } | |
329 | + else | |
330 | + { | |
331 | + BabyModel babyModel = babyService.getOneBabyById(babyId); | |
332 | + prefix +="-" +getDoctorName(babyModel.getBuildDoctor()); | |
333 | + } | |
334 | + } | |
335 | + | |
336 | + } | |
337 | + return prefix; | |
338 | + } | |
339 | + | |
340 | + /** | |
341 | + * 获取孕妇前缀 | |
342 | + * @param config | |
343 | + * @return | |
344 | + */ | |
345 | + public String getPregnantSmsPrefix(SmsConfigModel config,String pid,String mainPrefix,SmsTemplateModel template) | |
346 | + { | |
347 | + String prefix = mainPrefix; | |
348 | + if (config.getBabyType() != null && config.getBabyType() == 1) { | |
349 | + prefix = config.getHospitalPrefix(); | |
350 | + | |
351 | + if (template.getSmsType() == SmsServiceEnums.CJCXTX.getId() || template.getSmsType() == SmsServiceEnums.CJYYTX.getId() || | |
352 | + template.getSmsType() == SmsServiceEnums.CJGQTX.getId()) | |
353 | + { | |
354 | + AntExRecordQuery antExRecordQuery = new AntExRecordQuery(); | |
355 | + antExRecordQuery.setPid(pid); | |
356 | + List<AntExRecordModel> antExRecordModelList = recordService.queryAntExRecords(antExRecordQuery, Sort.Direction.DESC, "created"); | |
357 | + if (CollectionUtils.isNotEmpty(antExRecordModelList)) | |
358 | + { | |
359 | + prefix +="-" +getDoctorName(antExRecordModelList.get(0).getCheckDoctor()); | |
360 | + } | |
361 | + else | |
362 | + { | |
363 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
364 | + patientsQuery.setPid(pid); | |
365 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
366 | + List<Patients> patientses = patientsService.queryPatient1(patientsQuery, "created"); | |
367 | + if (CollectionUtils.isNotEmpty(patientses)) | |
368 | + { | |
369 | + prefix +="-" +getDoctorName(patientses.get(0).getBookbuildingDoctor()); | |
370 | + } | |
371 | + } | |
372 | + } | |
373 | + } | |
374 | + return prefix; | |
375 | + } | |
376 | + | |
377 | + /** | |
287 | 378 | * 获取发送短信的前缀 如果配置为发送科室前缀 就通过医生查询到医生所在科室 |
288 | 379 | * 然后取对应科室前缀 如果为空就取医院前缀 |
289 | 380 | * @return |
... | ... | @@ -412,6 +503,18 @@ |
412 | 503 | } |
413 | 504 | } |
414 | 505 | return ""; |
506 | + } | |
507 | + | |
508 | + private String getDoctorName(String doctorId) | |
509 | + { | |
510 | + try { | |
511 | + //通过建档医生查询用户信息 | |
512 | + Users user = usersService.getUsers(Integer.valueOf(doctorId)); | |
513 | + return user != null ? user.getName() : ""; | |
514 | + }catch (Exception e) | |
515 | + { | |
516 | + return ""; | |
517 | + } | |
415 | 518 | } |
416 | 519 | |
417 | 520 |
platform-msg-generate/src/main/java/com/lyms/platform/msg/worker/TempleteMsgGenerateWorker.java
View file @
49bf490
... | ... | @@ -376,8 +376,7 @@ |
376 | 376 | babyModelQuery.setBirthEnd(endDate); |
377 | 377 | |
378 | 378 | if (serviceType == com.lyms.platform.common.enums.ServiceTypeEnums.ALL_SERVICE.getId() |
379 | - && serviceStatus == ServiceStatusEnums.ADD_ALL.getId()){ | |
380 | - | |
379 | + && (serviceStatus == ServiceStatusEnums.ADD_ALL.getId() || serviceStatus == ServiceStatusEnums.ALL.getId())){ | |
381 | 380 | // 全部 |
382 | 381 | List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(babyModelQuery); |
383 | 382 | for (BabyModel babyModel: babyModels){ |
... | ... | @@ -576,6 +575,32 @@ |
576 | 575 | list.setMessages(messages); |
577 | 576 | HelperUtils.sendMsg(list); |
578 | 577 | } |
578 | + | |
579 | + //儿保检查过期提醒 | |
580 | + else if (smsType == SmsServiceEnums.EBGQTX.getId()) { | |
581 | + //发送短信集合 | |
582 | + MsgListRequest list = new MsgListRequest(); | |
583 | + List<MsgRequest> messages = new ArrayList<>(); | |
584 | + | |
585 | + | |
586 | + Date yuYueDate = DateUtils.addDay(new Date(), sendTimeType); | |
587 | + yuYueDate = DateUtils.formatDate(yuYueDate, DateUtils.Y_M_D); | |
588 | + List<BabyCheckModel> checkModels = babyBookbuildingService.queryBabyYuYueRecord(yuYueDate, tempHid); | |
589 | + | |
590 | + if (CollectionUtils.isNotEmpty(checkModels)) { | |
591 | + for (BabyCheckModel checkModel : checkModels) { | |
592 | + List<BabyCheckModel> checkModels1 = mongoTemplate.find(Query.query(Criteria.where("created").gte(yuYueDate) | |
593 | + .and("yn").is(1).and("buildId").is(checkModel.getId())), BabyCheckModel.class); | |
594 | + if (!CollectionUtils.isNotEmpty(checkModels1)) | |
595 | + { | |
596 | + babyCare(template, config, service, messages, yuYueDate, checkModel.getId()); | |
597 | + } | |
598 | + } | |
599 | + } | |
600 | + | |
601 | + list.setMessages(messages); | |
602 | + HelperUtils.sendMsg(list); | |
603 | + } | |
579 | 604 | // 无服务 |
580 | 605 | else if (smsType == SmsServiceEnums.NOSERVICE.getId()){ |
581 | 606 | //发送短信集合 |
582 | 607 | |
... | ... | @@ -615,12 +640,12 @@ |
615 | 640 | } |
616 | 641 | |
617 | 642 | //查询符合条件儿童 |
618 | - | |
619 | 643 | List<BabyModel> babyModels = babyBookbuildingService.queryBabyBuildByCond(query); |
620 | 644 | if (CollectionUtils.isNotEmpty(babyModels)) { |
621 | 645 | for (BabyModel model : babyModels) { |
622 | 646 | //短信前缀 |
623 | 647 | String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); |
648 | + messagePrefix = baseService.getBabySmsPrefix(config,model.getId(),messagePrefix,template); | |
624 | 649 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
625 | 650 | messageContent = HelperUtils.replaceEL(model.getName(), orderDate, messageContent); |
626 | 651 | |
627 | 652 | |
... | ... | @@ -710,9 +735,11 @@ |
710 | 735 | |
711 | 736 | //短信前缀 |
712 | 737 | String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); |
738 | + messagePrefix = baseService.getBabySmsPrefix(config,model.getId(),messagePrefix,template); | |
713 | 739 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
714 | 740 | messageContent = HelperUtils.replaceName(model.getName(), messageContent); |
715 | 741 | |
742 | + | |
716 | 743 | //接种时间 |
717 | 744 | String vaccineTime = start + ( isDay ? "天" : "月龄"); |
718 | 745 | //疫苗名称 |
... | ... | @@ -765,6 +792,7 @@ |
765 | 792 | |
766 | 793 | //短信前缀 |
767 | 794 | String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); |
795 | + messagePrefix = baseService.getBabySmsPrefix(config,model.getId(),messagePrefix,template); | |
768 | 796 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
769 | 797 | messageContent = HelperUtils.replaceName(model.getName(), messageContent); |
770 | 798 | String itemName = "儿童保健"; |
... | ... | @@ -814,6 +842,7 @@ |
814 | 842 | |
815 | 843 | //短信前缀 |
816 | 844 | String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); |
845 | + messagePrefix = baseService.getBabySmsPrefix(config,model.getId(),messagePrefix,template); | |
817 | 846 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
818 | 847 | messageContent = HelperUtils.replaceName(model.getName(), messageContent); |
819 | 848 | |
... | ... | @@ -864,6 +893,7 @@ |
864 | 893 | |
865 | 894 | //短信前缀 |
866 | 895 | String messagePrefix = baseService.getSmsPrefix(config, model.getBuildDoctor(), ServiceObjEnums.BABYOBJ.getId()); |
896 | + messagePrefix = baseService.getBabySmsPrefix(config,model.getId(),messagePrefix,template); | |
867 | 897 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
868 | 898 | messageContent = HelperUtils.replaceEL(model.getName(), yuYueDate, messageContent); |
869 | 899 | |
... | ... | @@ -1473,6 +1503,7 @@ |
1473 | 1503 | private void addYunOverdueMessages(SmsTemplateModel template, SmsConfigModel config, Integer service, List<MsgRequest> messages, Date yuYueDate, Patients pat) { |
1474 | 1504 | //短信前缀 |
1475 | 1505 | String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); |
1506 | + messagePrefix = baseService.getPregnantSmsPrefix(config,pat.getPid(),messagePrefix,template); | |
1476 | 1507 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
1477 | 1508 | //替换的变量值 |
1478 | 1509 | messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); |
... | ... | @@ -1547,6 +1578,7 @@ |
1547 | 1578 | |
1548 | 1579 | //短信前缀 |
1549 | 1580 | String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); |
1581 | + messagePrefix = baseService.getPregnantSmsPrefix(config,pat.getPid(),messagePrefix,template); | |
1550 | 1582 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
1551 | 1583 | |
1552 | 1584 | String checkWeekName = HelperUtils.getCheckTimeStr(start, end); |
... | ... | @@ -1584,6 +1616,7 @@ |
1584 | 1616 | |
1585 | 1617 | //短信前缀 |
1586 | 1618 | String messagePrefix = baseService.getSmsPrefix(config, pat.getBookbuildingDoctor(), ServiceObjEnums.YUNOBJ.getId()); |
1619 | + messagePrefix = baseService.getPregnantSmsPrefix(config,pat.getPid(),messagePrefix,template); | |
1587 | 1620 | String messageContent = "【" + messagePrefix + "】" + template.getContent(); |
1588 | 1621 | //messageContent = HelperUtils.replaceEL(pat.getUsername(), yuYueDate, messageContent); |
1589 | 1622 | messageContent = HelperUtils.replaceELD(pat.getUsername(), yuYueDate, remark, messageContent); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/AntenatalExaminationFacade.java
View file @
49bf490
... | ... | @@ -312,13 +312,13 @@ |
312 | 312 | public BaseResponse addOneAntEx(AntExAddRequest antExAddRequest, Integer userId) { |
313 | 313 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
314 | 314 | |
315 | - //秦皇岛市山海关人民医院 零时处理 | |
316 | - if (StringUtils.isNotEmpty(antExAddRequest.getCheckDate()) && "1000000004".equals(hospitalId)) { | |
317 | - if (!antExAddRequest.getCheckDate().equals(DateUtil.getyyyy_MM_dd(new Date()))) | |
318 | - { | |
319 | - return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
320 | - } | |
321 | - } | |
315 | +// //秦皇岛市山海关人民医院 零时处理 | |
316 | +// if (StringUtils.isNotEmpty(antExAddRequest.getCheckDate()) && "1000000004".equals(hospitalId)) { | |
317 | +// if (!antExAddRequest.getCheckDate().equals(DateUtil.getyyyy_MM_dd(new Date()))) | |
318 | +// { | |
319 | +// return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
320 | +// } | |
321 | +// } | |
322 | 322 | |
323 | 323 | AntenatalExaminationModel model = antExAddRequest.convertToDataModel(); |
324 | 324 | //表示区域的 |
... | ... | @@ -634,13 +634,13 @@ |
634 | 634 | |
635 | 635 | |
636 | 636 | //秦皇岛市山海关人民医院 零时处理 |
637 | - if (StringUtils.isNotEmpty(excAddRequest.getCheckTime()) && "1000000004".equals(hospitalId)) { | |
638 | - if (!excAddRequest.getCheckTime().equals(DateUtil.getyyyy_MM_dd(new Date()))) | |
639 | - { | |
640 | - return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
641 | - } | |
642 | - | |
643 | - } | |
637 | +// if (StringUtils.isNotEmpty(excAddRequest.getCheckTime()) && "1000000004".equals(hospitalId)) { | |
638 | +// if (!excAddRequest.getCheckTime().equals(DateUtil.getyyyy_MM_dd(new Date()))) | |
639 | +// { | |
640 | +// return new BaseResponse().setErrormsg("检查日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
641 | +// } | |
642 | +// | |
643 | +// } | |
644 | 644 | |
645 | 645 | |
646 | 646 | /** 验证产检券是否可用 可用就改为已使用状态 */ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MatDeliverFacade.java
View file @
49bf490
... | ... | @@ -216,18 +216,18 @@ |
216 | 216 | String hospitalId = autoMatchFacade.getHospitalId(userId); |
217 | 217 | |
218 | 218 | //秦皇岛市山海关人民医院 零时处理 |
219 | - if (CollectionUtils.isNotEmpty(deliverAddRequest.getBabies()) && "1000000004".equals(hospitalId)) { | |
220 | - if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(deliverAddRequest.getBabies().get(0).getDueTime())) | |
221 | - { | |
222 | - Date birth = DateUtil.parseYMDHM(deliverAddRequest.getBabies().get(0).getDueTime()); | |
223 | - String birtStr = DateUtil.getyyyy_MM_dd(birth); | |
224 | - if (!birtStr.equals(DateUtil.getyyyy_MM_dd(new Date()))) | |
225 | - { | |
226 | - return new BaseResponse().setErrormsg("儿童分娩日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
227 | - } | |
228 | - } | |
229 | - | |
230 | - } | |
219 | +// if (CollectionUtils.isNotEmpty(deliverAddRequest.getBabies()) && "1000000004".equals(hospitalId)) { | |
220 | +// if (com.lyms.platform.common.utils.StringUtils.isNotEmpty(deliverAddRequest.getBabies().get(0).getDueTime())) | |
221 | +// { | |
222 | +// Date birth = DateUtil.parseYMDHM(deliverAddRequest.getBabies().get(0).getDueTime()); | |
223 | +// String birtStr = DateUtil.getyyyy_MM_dd(birth); | |
224 | +// if (!birtStr.equals(DateUtil.getyyyy_MM_dd(new Date()))) | |
225 | +// { | |
226 | +// return new BaseResponse().setErrormsg("儿童分娩日期不是当天不能保存").setErrorcode(ErrorCodeConstants.DATA_EXIST); | |
227 | +// } | |
228 | +// } | |
229 | +// | |
230 | +// } | |
231 | 231 | |
232 | 232 | |
233 | 233 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
49bf490
... | ... | @@ -6768,7 +6768,7 @@ |
6768 | 6768 | PersonModel personModel = mongoTemplate.findOne(Query.query(Criteria.where("cardNo").is(idCard).and("type").ne(2)), PersonModel.class); |
6769 | 6769 | if (personModel != null) { |
6770 | 6770 | String personModelId = personModel.getId(); |
6771 | - List<MaternalDeliverModel> models = mongoTemplate.find(Query.query(Criteria.where("pid").is(personModelId)). | |
6771 | + List<MaternalDeliverModel> models = mongoTemplate.find(Query.query(Criteria.where("pid").is(personModelId).and("yn").is(YnEnums.YES.getId())). | |
6772 | 6772 | with(new Sort(Sort.Direction.DESC, "created")), MaternalDeliverModel.class); |
6773 | 6773 | if (CollectionUtils.isNotEmpty(models)) { |
6774 | 6774 | MaternalDeliverModel deliverModel = models.get(0); |