Commit 9fa1b86568125601acf86e70cd488f2f0dc02e48
Exists in
master
and in
1 other branch
Merge remote-tracking branch 'origin/master'
Showing 2 changed files
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ResidentsArchiveController.java
View file @
9fa1b86
| ... | ... | @@ -7,8 +7,10 @@ |
| 7 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 8 | 8 | import com.lyms.platform.common.result.BaseResponse; |
| 9 | 9 | import com.lyms.platform.operate.web.facade.ResidentsArchiveFacade; |
| 10 | +import com.lyms.platform.operate.web.request.PatientGuideSmsRequest; | |
| 10 | 11 | import com.lyms.platform.operate.web.request.ResidentsArchiveAddRequest; |
| 11 | 12 | import com.lyms.platform.operate.web.request.ResidentsArchiveQueryRequest; |
| 13 | +import com.lyms.platform.operate.web.request.WomenGuideSmsRequest; | |
| 12 | 14 | import org.apache.commons.lang.StringUtils; |
| 13 | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | 16 | import org.springframework.stereotype.Controller; |
| ... | ... | @@ -82,7 +84,7 @@ |
| 82 | 84 | */ |
| 83 | 85 | @RequestMapping(value = "/queryResidentsArchiveById/{id}", method = RequestMethod.GET) |
| 84 | 86 | @ResponseBody |
| 85 | -// @TokenRequired | |
| 87 | + @TokenRequired | |
| 86 | 88 | public BaseObjectResponse queryResidentsArchiveById(@PathVariable("id")String id){ |
| 87 | 89 | BaseObjectResponse objectResponse = residentsArchiveFacade.queryResidentsArchiveById(id); |
| 88 | 90 | return objectResponse; |
| ... | ... | @@ -109,6 +111,34 @@ |
| 109 | 111 | return residentsArchiveFacade.queryCardNoType(); |
| 110 | 112 | } |
| 111 | 113 | |
| 114 | + /** | |
| 115 | + * 数据导出接口 | |
| 116 | + * @param residentsArchiveQueryRequest | |
| 117 | + * @param response | |
| 118 | + * @param request | |
| 119 | + */ | |
| 120 | + @RequestMapping(value = "/residentsArchiveExport", method = RequestMethod.GET) | |
| 121 | + @ResponseBody | |
| 122 | + @TokenRequired | |
| 123 | + public void residentsArchiveExport(@Valid ResidentsArchiveQueryRequest residentsArchiveQueryRequest,HttpServletResponse response, | |
| 124 | + HttpServletRequest request){ | |
| 125 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 126 | + residentsArchiveFacade.residentsArchiveExport(residentsArchiveQueryRequest,loginState.getId(),response); | |
| 127 | + } | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * 妇女指导接口 | |
| 131 | + * @param womenGuideSmsRequest | |
| 132 | + * @param request | |
| 133 | + * @return | |
| 134 | + */ | |
| 135 | + @RequestMapping(value = "/sendWomenGuildSms", method = RequestMethod.POST) | |
| 136 | + @ResponseBody | |
| 137 | + @TokenRequired | |
| 138 | + public BaseResponse womenGuildSms(@RequestBody @Valid WomenGuideSmsRequest womenGuideSmsRequest,HttpServletRequest request){ | |
| 139 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 140 | + return residentsArchiveFacade.womenGuildSms(womenGuideSmsRequest, loginState.getId()); | |
| 141 | + } | |
| 112 | 142 | |
| 113 | 143 | |
| 114 | 144 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ResidentsArchiveFacade.java
View file @
9fa1b86
| ... | ... | @@ -3,8 +3,9 @@ |
| 3 | 3 | import com.lyms.platform.biz.service.BasicConfigService; |
| 4 | 4 | import com.lyms.platform.biz.service.PremaritalCheckupService; |
| 5 | 5 | import com.lyms.platform.biz.service.ResidentsArchiveService; |
| 6 | +import com.lyms.platform.biz.service.SyncDataService; | |
| 6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | -import com.lyms.platform.common.enums.YnEnums; | |
| 8 | +import com.lyms.platform.common.enums.*; | |
| 8 | 9 | import com.lyms.platform.common.result.BaseListResponse; |
| 9 | 10 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 10 | 11 | import com.lyms.platform.common.result.BaseResponse; |
| 11 | 12 | |
| ... | ... | @@ -12,12 +13,12 @@ |
| 12 | 13 | import com.lyms.platform.common.utils.ExcelUtil; |
| 13 | 14 | import com.lyms.platform.common.utils.JsonUtil; |
| 14 | 15 | import com.lyms.platform.common.utils.SystemConfig; |
| 15 | -import com.lyms.platform.operate.web.request.ResidentsArchiveAddRequest; | |
| 16 | -import com.lyms.platform.operate.web.request.ResidentsArchiveQueryRequest; | |
| 16 | +import com.lyms.platform.operate.web.request.*; | |
| 17 | 17 | import com.lyms.platform.operate.web.result.BasicConfigResult; |
| 18 | 18 | import com.lyms.platform.operate.web.result.ResidentsArchiveHistoryResult; |
| 19 | 19 | import com.lyms.platform.operate.web.result.ResidentsArchiveResult; |
| 20 | 20 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
| 21 | +import com.lyms.platform.operate.web.utils.MessageCenterService; | |
| 21 | 22 | import com.lyms.platform.permission.model.Organization; |
| 22 | 23 | import com.lyms.platform.permission.model.Users; |
| 23 | 24 | import com.lyms.platform.permission.service.OrganizationService; |
| ... | ... | @@ -25,6 +26,7 @@ |
| 25 | 26 | import com.lyms.platform.pojo.BasicConfig; |
| 26 | 27 | import com.lyms.platform.pojo.PremaritalCheckup; |
| 27 | 28 | import com.lyms.platform.pojo.ResidentsArchiveModel; |
| 29 | +import com.lyms.platform.pojo.SmsConfigModel; | |
| 28 | 30 | import com.lyms.platform.query.BasicConfigQuery; |
| 29 | 31 | import com.lyms.platform.query.PremaritalCheckupQuery; |
| 30 | 32 | import com.lyms.platform.query.ResidentsArchiveQuery; |
| 31 | 33 | |
| ... | ... | @@ -59,8 +61,11 @@ |
| 59 | 61 | private BasicConfigService basicConfigService; |
| 60 | 62 | @Autowired |
| 61 | 63 | private PremaritalCheckupService premaritalCheckupService; |
| 64 | + @Autowired | |
| 65 | + private SmsConfigFacade smsConfigFacade; | |
| 66 | + @Autowired | |
| 67 | + private SyncDataService syncDataService; | |
| 62 | 68 | |
| 63 | - | |
| 64 | 69 | /** |
| 65 | 70 | * 查询居民健康记录,获取基础数据 |
| 66 | 71 | * @param residentsArchiveQueryRequest |
| ... | ... | @@ -232,6 +237,7 @@ |
| 232 | 237 | if (users!=null && users.getYn()!=YnEnums.NO.getId()){ |
| 233 | 238 | model.setPublishName(users.getName()); |
| 234 | 239 | } |
| 240 | + | |
| 235 | 241 | model.setId(id); |
| 236 | 242 | residentsArchiveService.updateResident(model,id); |
| 237 | 243 | }catch (Exception e){ |
| ... | ... | @@ -305,6 +311,11 @@ |
| 305 | 311 | archiveModel.setPublishName(users.getName()); |
| 306 | 312 | } |
| 307 | 313 | |
| 314 | +/* if (StringUtils.isNotEmpty(archiveModel.getBuildDoctor())){ | |
| 315 | + Users u = usersService.getUsers(Integer.valueOf(archiveModel.getBuildDoctor())); | |
| 316 | + archiveModel.setBuildDoctor(u.getName()); | |
| 317 | + }*/ | |
| 318 | + | |
| 308 | 319 | ResidentsArchiveModel residentsArchiveModel = residentsArchiveService.addResident(archiveModel); |
| 309 | 320 | |
| 310 | 321 | if (residentsArchiveModel == null || StringUtils.isEmpty(residentsArchiveModel.getId())){ |
| 311 | 322 | |
| 312 | 323 | |
| 313 | 324 | |
| ... | ... | @@ -568,15 +579,41 @@ |
| 568 | 579 | map.put("presentHistory", data.getPresentHistory()); |
| 569 | 580 | |
| 570 | 581 | map.put("vcCardNo", data.getVcCardNo()); |
| 582 | + | |
| 571 | 583 | map.put("buildDoctor", data.getBuildDoctor()); |
| 572 | 584 | map.put("buildDay", data.getBuildDay()); |
| 585 | + list.add(map); | |
| 573 | 586 | } |
| 574 | 587 | } |
| 575 | 588 | out = response.getOutputStream(); |
| 576 | 589 | Map<String, String> cnames = new LinkedHashMap<>(); |
| 577 | 590 | cnames.put("username","姓名"); |
| 591 | + cnames.put("sex","性别"); | |
| 592 | + cnames.put("birthday","出生日期"); | |
| 593 | + cnames.put("countryId","国籍"); | |
| 594 | + cnames.put("nationId","民族"); | |
| 595 | + cnames.put("marriageId","婚姻状况"); | |
| 596 | + cnames.put("certificateTypeId","证件类型"); | |
| 597 | + cnames.put("certificateNum","证件号"); | |
| 598 | + cnames.put("censusTypeId","户籍类型"); | |
| 599 | + cnames.put("liveTypeId","居住类别"); | |
| 600 | + cnames.put("levelTypeId","文化程度"); | |
| 601 | + cnames.put("professionTypeId","职业类别"); | |
| 602 | + cnames.put("hospital","建档医院"); | |
| 603 | + cnames.put("age","年龄"); | |
| 604 | + cnames.put("phone","联系方式"); | |
| 605 | + cnames.put("workUnit","工作单位"); | |
| 606 | + cnames.put("residence","居住地"); | |
| 607 | + cnames.put("residenceRegister","户籍地址"); | |
| 608 | + cnames.put("pastHistory","既往史"); | |
| 609 | + cnames.put("familyHistory","家族史"); | |
| 610 | + cnames.put("personalHistory","个人史"); | |
| 611 | + cnames.put("ywgmHistory","药物过敏史"); | |
| 612 | + cnames.put("presentHistory","现病史"); | |
| 613 | + cnames.put("vcCardNo","就诊卡号"); | |
| 614 | + cnames.put("buildDoctor","建档人"); | |
| 615 | + cnames.put("buildDay","建档日期"); | |
| 578 | 616 | |
| 579 | - | |
| 580 | 617 | response.setContentType("application/octet-stream"); |
| 581 | 618 | response.setHeader("Content-Disposition", "attachment;fileName=" + "juming.xls"); |
| 582 | 619 | ExcelUtil.toExcel(out, list, cnames); |
| ... | ... | @@ -607,5 +644,83 @@ |
| 607 | 644 | } |
| 608 | 645 | return ""; |
| 609 | 646 | } |
| 647 | + | |
| 648 | + /** | |
| 649 | + * 发送妇女指导短信 | |
| 650 | + * @param request | |
| 651 | + * @param userId | |
| 652 | + * @return | |
| 653 | + */ | |
| 654 | + public BaseResponse womenGuildSms(WomenGuideSmsRequest request,Integer userId){ | |
| 655 | + String hospitalId = ""; | |
| 656 | + //得到当前登录的医院id | |
| 657 | + if (userId != null) { | |
| 658 | + Users dbuser = usersService.getUsers(userId); | |
| 659 | + if (dbuser != null) { | |
| 660 | + hospitalId = String.valueOf(dbuser.getOrgId()); | |
| 661 | + } | |
| 662 | + } | |
| 663 | + | |
| 664 | + //判断医院是否启动和对应的服务项是否启用 | |
| 665 | + SmsConfigModel configModel = new SmsConfigModel(); | |
| 666 | + BaseResponse response = smsConfigFacade.hospitalIsStart(hospitalId, configModel, SmsServiceEnums.YSGXHZD.getId()); | |
| 667 | + if (response != null) { | |
| 668 | + return response; | |
| 669 | + } | |
| 670 | + | |
| 671 | + MessageListRequest smsList = new MessageListRequest(); | |
| 672 | + List<MessageRequest> messages = new ArrayList<>(); | |
| 673 | + | |
| 674 | + List<ResidentsArchiveModel> sendModels = new ArrayList<>(); | |
| 675 | + if (CollectionUtils.isNotEmpty(request.getIds())) { | |
| 676 | + List<String> ids = request.getIds(); | |
| 677 | + ResidentsArchiveQuery query = new ResidentsArchiveQuery(); | |
| 678 | + query.setYn(YnEnums.YES.getId()); | |
| 679 | + for (String id : ids){ | |
| 680 | + if (StringUtils.isNotEmpty(id)){ | |
| 681 | + query.setId(id); | |
| 682 | + List<ResidentsArchiveModel> modelList = residentsArchiveService.queryResident(query); | |
| 683 | + if (CollectionUtils.isNotEmpty(modelList)){ | |
| 684 | + sendModels.addAll(modelList); | |
| 685 | + } | |
| 686 | + } | |
| 687 | + } | |
| 688 | + | |
| 689 | + if (CollectionUtils.isNotEmpty(sendModels)) { | |
| 690 | + for (ResidentsArchiveModel model : sendModels){ | |
| 691 | + if (model!=null && StringUtils.isNotEmpty(model.getPhone())){ | |
| 692 | + MessageRequest mr = new MessageRequest(); | |
| 693 | + String messagePrefix = smsConfigFacade.getSmsPrefix(configModel, model.getBuildDoctor()); | |
| 694 | + mr.setContent("【" + messagePrefix + "】" + request.getSmsContent()); | |
| 695 | + mr.setObjType(Integer.valueOf(request.getType())); | |
| 696 | + mr.setPhone(model.getPhone()); | |
| 697 | + //短信商 | |
| 698 | + mr.setServiceType(SmsProviderEnums.YM.getId()); | |
| 699 | + mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 700 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 701 | + mr.setSubTypeId(SmsServiceEnums.YSGXHZD.getId()); | |
| 702 | + mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId()); | |
| 703 | + | |
| 704 | + mr.setStatus(SmsStatusEnums.WFS.getId()); | |
| 705 | + | |
| 706 | + mr.setExt1(String.valueOf(model.getHospitalId())); | |
| 707 | + messages.add(mr); | |
| 708 | + } | |
| 709 | + } | |
| 710 | + } | |
| 711 | + | |
| 712 | + if (CollectionUtils.isNotEmpty(messages)) { | |
| 713 | + smsList.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 714 | + smsList.setMessages(messages); | |
| 715 | + //调用发送接口 | |
| 716 | + if (!syncDataService.savePostMsg(JsonUtil.obj2JsonString(smsList), messages.get(0).getExt1())) { | |
| 717 | + MessageCenterService.saveSmsCenter(smsList); | |
| 718 | + } | |
| 719 | + } | |
| 720 | + } | |
| 721 | + return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 722 | + } | |
| 723 | + | |
| 724 | + | |
| 610 | 725 | } |