Commit 1980197036a53d69d3a234bf9759ba73e1ff10fa
1 parent
0926cc9b1a
Exists in
master
and in
1 other branch
code update
Showing 3 changed files with 105 additions and 18 deletions
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/BasicConfigServiceTest.java
View file @
1980197
| ... | ... | @@ -82,7 +82,7 @@ |
| 82 | 82 | // addaw(applicationContext, "0-83月龄体重标准差数值表(男、女).csv", 0); |
| 83 | 83 | // addZhenduan(applicationContext); |
| 84 | 84 | |
| 85 | - addCountry(applicationContext); | |
| 85 | + addMingzu(applicationContext); | |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public static void addZhenduan(ApplicationContext applicationContext) { |
| ... | ... | @@ -344,6 +344,34 @@ |
| 344 | 344 | Thread.sleep(1000); |
| 345 | 345 | config.setCreateDate(new Date().getTime()); |
| 346 | 346 | config.setParentId("57dc45f7-b0ba-42f0-863b-de53966a6e65"); |
| 347 | + mongoTemplate.save(config); | |
| 348 | + System.out.println(line); | |
| 349 | + } | |
| 350 | + } | |
| 351 | + | |
| 352 | + } catch (Exception e) { | |
| 353 | + e.printStackTrace(); | |
| 354 | + } | |
| 355 | + } | |
| 356 | + | |
| 357 | + | |
| 358 | + public static void addMingzu(ApplicationContext applicationContext) { | |
| 359 | + MongoTemplate mongoTemplate | |
| 360 | + =(MongoTemplate)applicationContext.getBean("mongoTemplate"); | |
| 361 | + mongoTemplate.getDb().authenticate("platform", "platform123".toCharArray()); | |
| 362 | + | |
| 363 | + try { | |
| 364 | + List<String> list = FileUtils.readLines(new File("F:\\temp\\mingz.txt"),"gbk"); | |
| 365 | + for (String line:list) { | |
| 366 | + if (line != null) { | |
| 367 | + BasicConfig config = new BasicConfig(); | |
| 368 | + config.setYn(YnEnums.YES.getId()); | |
| 369 | + config.setCode(PingYinUtil.getFirstSpell(line).toUpperCase()); | |
| 370 | + config.setName(line); | |
| 371 | + config.setEnable(1); | |
| 372 | + Thread.sleep(1000); | |
| 373 | + config.setCreateDate(new Date().getTime()); | |
| 374 | + config.setParentId("4bc86dd6-2217-4a33-95f4-dc22ee70f2e3"); | |
| 347 | 375 | mongoTemplate.save(config); |
| 348 | 376 | System.out.println(line); |
| 349 | 377 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
1980197
| ... | ... | @@ -145,21 +145,7 @@ |
| 145 | 145 | Collections.reverse(tempList); |
| 146 | 146 | list.addAll(tempList); |
| 147 | 147 | } |
| 148 | -// //查询儿童的基本信息 | |
| 149 | -// BabyModel model = babyCheckFacade.getBabyModel(babyId, base); | |
| 150 | -// | |
| 151 | -// | |
| 152 | -// List<Map<String, String>> tempList = new ArrayList<>(); | |
| 153 | -// if(CollectionUtils.isNotEmpty(models)){ | |
| 154 | -// for(BabyModel babyModel:models){ | |
| 155 | -// babyCheckFacade.getBabyCheckList(babyModel.getId(), babyModel, tempList); | |
| 156 | -// } | |
| 157 | -// } | |
| 158 | -// | |
| 159 | -// list.addAll(tempList); | |
| 160 | 148 | |
| 161 | - | |
| 162 | - | |
| 163 | 149 | resMap.put("baseInfo", base); |
| 164 | 150 | resMap.put("checkList", list); |
| 165 | 151 | br.setData(resMap); |
| ... | ... | @@ -533,7 +519,6 @@ |
| 533 | 519 | { |
| 534 | 520 | isStart = isStartService(SmsServiceEnums.FWKT.getId(), serviceStr); |
| 535 | 521 | } |
| 536 | - | |
| 537 | 522 | } |
| 538 | 523 | if (!isStart) |
| 539 | 524 | { |
| 540 | 525 | |
| ... | ... | @@ -642,13 +627,16 @@ |
| 642 | 627 | |
| 643 | 628 | if (CollectionUtils.isNotEmpty(sendList)) |
| 644 | 629 | { |
| 630 | + | |
| 631 | + //短信前缀 | |
| 632 | + String messagePrefix = getSmsPrefix(configs.get(0),babyModel.getBuildDoctor()); | |
| 645 | 633 | for (SmsTemplateModel templateModel : sendList) |
| 646 | 634 | { |
| 647 | 635 | if (templateModel != null && templateModel.getStatus() == 1) { |
| 648 | 636 | MessageListRequest smsList = new MessageListRequest(); |
| 649 | 637 | List<MessageRequest> messages = new ArrayList<>(); |
| 650 | 638 | MessageRequest mr = new MessageRequest(); |
| 651 | - mr.setContent(templateModel.getContent()); | |
| 639 | + mr.setContent("【"+messagePrefix+"】"+templateModel.getContent()); | |
| 652 | 640 | mr.setObjType(ServiceObjEnums.BABYOBJ.getId()); |
| 653 | 641 | mr.setPhone(babyModel.getMphone()); |
| 654 | 642 | //短信商 |
| ... | ... | @@ -677,6 +665,71 @@ |
| 677 | 665 | } |
| 678 | 666 | } |
| 679 | 667 | |
| 668 | + | |
| 669 | + | |
| 670 | + /** | |
| 671 | + * 获取发送短信的前缀 如果配置为发送科室前缀 就通过医生查询到医生所在科室 | |
| 672 | + * 然后取对应科室前缀 如果为空就取医院前缀 | |
| 673 | + * @return | |
| 674 | + */ | |
| 675 | + public String getSmsPrefix(SmsConfigModel config,String doctorId) | |
| 676 | + { | |
| 677 | + String messagePrefix = config.getHospitalPrefix(); | |
| 678 | + //前缀类型 0医院前缀 1科室前缀 | |
| 679 | + if (config.getPrefixType() != null && config.getPrefixType() == 1) | |
| 680 | + { | |
| 681 | + String res = getDeptPrefix(doctorId, config.getDeptPrefix()); | |
| 682 | + messagePrefix = res == "" ? messagePrefix : res; | |
| 683 | + } | |
| 684 | + return messagePrefix; | |
| 685 | + } | |
| 686 | + | |
| 687 | + /** | |
| 688 | + * /通过医生查询科室前缀 | |
| 689 | + * @param doctorId | |
| 690 | + * @param detpPrefixStr | |
| 691 | + * @return | |
| 692 | + */ | |
| 693 | + private String getDeptPrefix(String doctorId,String detpPrefixStr) | |
| 694 | + { | |
| 695 | + | |
| 696 | + if (StringUtils.isEmpty(doctorId) || StringUtils.isEmpty(detpPrefixStr)) | |
| 697 | + { | |
| 698 | + return ""; | |
| 699 | + } | |
| 700 | + Integer userId = null; | |
| 701 | + try { | |
| 702 | + userId = Integer.valueOf(doctorId); | |
| 703 | + }catch (Exception e) | |
| 704 | + { | |
| 705 | + System.out.println(doctorId); | |
| 706 | + return ""; | |
| 707 | + } | |
| 708 | + | |
| 709 | + //通过建档医生查询用户信息 | |
| 710 | + Users user = usersService.getUsers(userId); | |
| 711 | + if (user != null) | |
| 712 | + { | |
| 713 | + //得到医生对应的部门id | |
| 714 | + Integer deptId = user.getDeptId(); | |
| 715 | + if (StringUtils.isNotEmpty(detpPrefixStr)) | |
| 716 | + { | |
| 717 | + List<Map> detpPrefixs = JsonUtil.toList(detpPrefixStr, Map.class); | |
| 718 | + if (CollectionUtils.isNotEmpty(detpPrefixs)) | |
| 719 | + { | |
| 720 | + for (Map map : detpPrefixs) | |
| 721 | + { | |
| 722 | + Integer preDeptId = Integer.valueOf(String.valueOf(map.get("deptId"))); | |
| 723 | + if (preDeptId == deptId) | |
| 724 | + { | |
| 725 | + return String.valueOf(map.get("deptPrefix")); | |
| 726 | + } | |
| 727 | + } | |
| 728 | + } | |
| 729 | + } | |
| 730 | + } | |
| 731 | + return ""; | |
| 732 | + } | |
| 680 | 733 | |
| 681 | 734 | /** |
| 682 | 735 | * 判断对应服务是否启动 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
1980197
| ... | ... | @@ -72,6 +72,9 @@ |
| 72 | 72 | @Autowired |
| 73 | 73 | private BasicConfigService basicConfigService; |
| 74 | 74 | |
| 75 | + @Autowired | |
| 76 | + private BabyBookbuildingFacade babyBookbuildingFacade; | |
| 77 | + | |
| 75 | 78 | /** |
| 76 | 79 | * 添加孕妇建档 |
| 77 | 80 | * @param yunRequest |
| ... | ... | @@ -378,6 +381,9 @@ |
| 378 | 381 | |
| 379 | 382 | if (CollectionUtils.isNotEmpty(sendList)) |
| 380 | 383 | { |
| 384 | + | |
| 385 | + //短信前缀 | |
| 386 | + String messagePrefix = babyBookbuildingFacade.getSmsPrefix(configs.get(0), patient.getBookbuildingDoctor()); | |
| 381 | 387 | for (SmsTemplateModel templateModel : sendList) |
| 382 | 388 | { |
| 383 | 389 | if (templateModel != null && templateModel.getStatus() == 1) |
| ... | ... | @@ -385,7 +391,7 @@ |
| 385 | 391 | MessageListRequest smsList = new MessageListRequest(); |
| 386 | 392 | List<MessageRequest> messages = new ArrayList<>(); |
| 387 | 393 | MessageRequest mr = new MessageRequest(); |
| 388 | - mr.setContent(templateModel.getContent()); | |
| 394 | + mr.setContent("【"+messagePrefix+"】"+templateModel.getContent()); | |
| 389 | 395 | mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); |
| 390 | 396 | mr.setPhone(patient.getPhone()); |
| 391 | 397 | //短信商 |