Commit 10387b3fd5328291d1b471e809fb4386ed60e308

Authored by liquanyu
1 parent 9ea53cd1ad

code update

Showing 6 changed files with 177 additions and 37 deletions

platform-biz-service/src/main/java/com/lyms/platform/permission/service/OrganizationService.java View file @ 10387b3
... ... @@ -20,5 +20,7 @@
20 20  
21 21 List<String> queryProvinceIdByOrgId(List<Integer> orgId);
22 22 List<Organization> queryHospital();
  23 +
  24 + List<Organization> queryHospitals(OrganizationQuery organizationQuery);
23 25 }
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/OrganizationServiceImpl.java View file @ 10387b3
... ... @@ -9,6 +9,7 @@
9 9 import org.springframework.beans.factory.annotation.Autowired;
10 10 import org.springframework.stereotype.Service;
11 11  
  12 +import java.util.ArrayList;
12 13 import java.util.Collections;
13 14 import java.util.List;
14 15  
... ... @@ -89,6 +90,32 @@
89 90 }
90 91 public List<Organization> queryHospital(){
91 92 return organizationMapper.queryHospital();
  93 + }
  94 +
  95 + @Override
  96 + public List<Organization> queryHospitals(OrganizationQuery query) {
  97 + if (query.getNeed() != null) {
  98 + query.mysqlBuild(organizationMapper.queryOrganizationCount(query));
  99 + }
  100 +
  101 + List<Organization> results = new ArrayList<>();
  102 + List<Organization> organizations = organizationMapper.queryOrganization(query);
  103 + if(CollectionUtils.isNotEmpty(organizations)) {
  104 + for(Organization organization : organizations) {
  105 + if(null != organization) {
  106 + //设置机构类型 1 医院 0 公司
  107 + if( null != organization.getType() ) {
  108 + if((organization.getType().equals(OrganizationTypeEnum.NY.getId()) || organization.getType().equals(OrganizationTypeEnum.FB.getId()) ||
  109 + organization.getType().equals(OrganizationTypeEnum.TY.getId())|| organization.getType().equals(OrganizationTypeEnum.JMQY.getId()))) {
  110 + organization.setOrgType(1);
  111 + results.add(organization);
  112 + }
  113 + }
  114 +
  115 + }
  116 + }
  117 + }
  118 + return results;
92 119 }
93 120 }
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java View file @ 10387b3
... ... @@ -177,6 +177,25 @@
177 177  
178 178 private Integer buildTypeEq;
179 179  
  180 + private Date fmDateStart;
  181 + private Date fmDateEnd;
  182 +
  183 + public Date getFmDateEnd() {
  184 + return fmDateEnd;
  185 + }
  186 +
  187 + public void setFmDateEnd(Date fmDateEnd) {
  188 + this.fmDateEnd = fmDateEnd;
  189 + }
  190 +
  191 + public Date getFmDateStart() {
  192 + return fmDateStart;
  193 + }
  194 +
  195 + public void setFmDateStart(Date fmDateStart) {
  196 + this.fmDateStart = fmDateStart;
  197 + }
  198 +
180 199 public Integer getBuildType() {
181 200 return buildType;
182 201 }
... ... @@ -500,6 +519,13 @@
500 519 if (null != pid) {
501 520 condition = condition.and("pid", pid, MongoOper.IS);
502 521 }
  522 +
  523 + if (fmDateStart != null && fmDateEnd != null)
  524 + {
  525 + Criteria cr = Criteria.where("fmDate").gte(fmDateStart).lte(fmDateEnd);
  526 + condition.andCondition(new MongoCondition(cr));
  527 + }
  528 +
503 529  
504 530 /* *//**
505 531 * 服务类型
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java View file @ 10387b3
... ... @@ -627,6 +627,8 @@
627 627 patientsQuery.setYn(YnEnums.YES.getId());
628 628 //1孕妇
629 629 patientsQuery.setType(1);
  630 + // 0未终止妊娠 1终止妊娠
  631 + patientsQuery.setDueStatus(0);
630 632  
631 633 patientsQuery = getServicePatientQuery(serviceType, serviceStatus, patientsQuery);
632 634  
633 635  
634 636  
635 637  
636 638  
... ... @@ -844,40 +846,72 @@
844 846 //服务结束
845 847 if (specialDateType == SpecialDateEnums.FWJS.getId())
846 848 {
847   - /**
848   - * 孕妇超过42周的 就自动分娩
849   - */
850   - Date endDate = DateUtil.getNewDate(-42, "周", 0);
851   - //把时间格式化成 yyyy_MM_dd 的日期
852   - endDate = DateUtil.formatDate(endDate);
853   - patientsQuery.setYn(YnEnums.YES.getId());
854   - //1孕妇
855   - patientsQuery.setType(1);
856   - patientsQuery.setLastMensesEnd(endDate);
857   - patientsQuery.setLastMensesStart(endDate);
858 849  
859   - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
860   - if (CollectionUtils.isNotEmpty(patients))
861   - {
862   - for (Patients pat : patients)
863   - {
  850 +// Date endDate = DateUtil.formatDate(new Date());
  851 +//
  852 +// patientsQuery.setYn(YnEnums.YES.getId());
  853 +//// //1孕妇 3产妇
  854 +// patientsQuery.setType(3);
  855 +// patientsQuery.setBuildTypeEq(2);
  856 +// patientsQuery.setFmDateStart(endDate);
  857 +// patientsQuery.setFmDateEnd(endDate);
  858 +//
  859 +// List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  860 +// if (CollectionUtils.isNotEmpty(patients))
  861 +// {
  862 +// for (Patients pat : patients)
  863 +// {
  864 +//
  865 +// //短信前缀
  866 +// String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  867 +// String messageContent = "【"+messagePrefix+"】"+template.getContent();
  868 +// messageContent = replaceName(pat.getUsername(), messageContent);
  869 +// MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  870 +// pat.getHospitalId(),template.getId(),pat.getId());
  871 +// messages.add(request);
  872 +//
  873 +// //更新成产妇状态 分娩时间设置成当前时间
  874 +// pat.setType(3);
  875 +// pat.setFmDate(new Date());
  876 +// pat.setModified(new Date());
  877 +// yunBookbuildingService.updatePregnant(pat, pat.getId());
  878 +// }
  879 +//
  880 +// }
864 881  
865   - //短信前缀
866   - String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
867   - String messageContent = "【"+messagePrefix+"】"+template.getContent();
868   - messageContent = replaceName(pat.getUsername(), messageContent);
869   - MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
870   - pat.getHospitalId(),template.getId(),pat.getId());
871   - messages.add(request);
872 882  
873   - //更新成产妇状态 分娩时间设置成当前时间
874   - pat.setType(3);
875   - pat.setFmDate(new Date());
876   - pat.setModified(new Date());
877   - yunBookbuildingService.updatePregnant(pat, pat.getId());
878   - }
879 883  
880   - }
  884 +// Date endDate = DateUtil.getNewDate(-42, "周", 0);
  885 +// //把时间格式化成 yyyy_MM_dd 的日期
  886 +// endDate = DateUtil.formatDate(endDate);
  887 +// patientsQuery.setYn(YnEnums.YES.getId());
  888 +// //1孕妇
  889 +// patientsQuery.setType(1);
  890 +// patientsQuery.setLastMensesEnd(endDate);
  891 +// patientsQuery.setLastMensesStart(endDate);
  892 +//
  893 +// List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  894 +// if (CollectionUtils.isNotEmpty(patients))
  895 +// {
  896 +// for (Patients pat : patients)
  897 +// {
  898 +//
  899 +// //短信前缀
  900 +// String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  901 +// String messageContent = "【"+messagePrefix+"】"+template.getContent();
  902 +// messageContent = replaceName(pat.getUsername(), messageContent);
  903 +// MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  904 +// pat.getHospitalId(),template.getId(),pat.getId());
  905 +// messages.add(request);
  906 +//
  907 +// //更新成产妇状态 分娩时间设置成当前时间
  908 +// pat.setType(3);
  909 +// pat.setFmDate(new Date());
  910 +// pat.setModified(new Date());
  911 +// yunBookbuildingService.updatePregnant(pat, pat.getId());
  912 +// }
  913 +//
  914 +// }
881 915 }
882 916 //孕妇建档在 孕妇建档生成
883 917  
... ... @@ -1552,6 +1586,11 @@
1552 1586 sendSms(list);
1553 1587 }
1554 1588 }
  1589 +
  1590 + for (MessageRequest msg :allMsgs)
  1591 + {
  1592 + System.out.println("=======" + msg.getContent());
  1593 + }
1555 1594 }
1556 1595  
1557 1596  
... ... @@ -2021,6 +2060,7 @@
2021 2060 return request;
2022 2061 }
2023 2062  
  2063 + private List<MessageRequest> allMsgs = new ArrayList<>();
2024 2064  
2025 2065 /**
2026 2066 * 发送短信到短信中心
... ... @@ -2034,10 +2074,11 @@
2034 2074 if (list != null && list.getMessages() != null)
2035 2075 {
2036 2076 List<MessageRequest> msgs = list.getMessages();
2037   - for (MessageRequest msg :msgs)
2038   - {
2039   - System.out.println("=======" + msg.getContent());
2040   - }
  2077 + allMsgs.addAll(msgs);
  2078 +// for (MessageRequest msg :msgs)
  2079 +// {
  2080 +// System.out.println("=======" + msg.getContent());
  2081 +// }
2041 2082 }
2042 2083 //SaveMessageService.saveSmsCenter(list);
2043 2084 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java View file @ 10387b3
... ... @@ -141,5 +141,18 @@
141 141 return objectResponse;
142 142 }
143 143  
  144 +
  145 +
  146 + @RequestMapping(value = "/queryHospitals", method = RequestMethod.GET)
  147 + @ResponseBody
  148 + @TokenRequired
  149 + public BaseObjectResponse queryHospitals(HttpServletRequest request,
  150 + @RequestParam(required = false) String keyWord,
  151 + @RequestParam(required = false) Integer page,
  152 + @RequestParam(required = false) Integer limit){
  153 + LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
  154 + BaseObjectResponse objectResponse = bookbuildingFacade.queryHospitals(keyWord, page,limit ,loginState.getId());
  155 + return objectResponse;
  156 + }
144 157 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java View file @ 10387b3
... ... @@ -857,5 +857,36 @@
857 857 objectResponse.setErrormsg("成功");
858 858 return objectResponse;
859 859 }
  860 +
  861 + public BaseObjectResponse queryHospitals(String keyWord, Integer page, Integer limit, Integer userId) {
  862 + OrganizationQuery organizationQuery = new OrganizationQuery();
  863 + if(null != page && limit != page) {
  864 + organizationQuery.setNeed("true");
  865 + organizationQuery.setPage(page);
  866 + organizationQuery.setLimit(limit);
  867 + organizationQuery.setSort("modified desc");
  868 + }
  869 +
  870 + organizationQuery.setYn(YnEnums.YES.getId());
  871 + organizationQuery.setKeyword(keyWord);
  872 +
  873 + Map<String,String> map = new HashMap<>();
  874 + List<Organization> orgs = organizationService.queryHospitals(organizationQuery);
  875 + if (CollectionUtils.isNotEmpty(orgs))
  876 + {
  877 + for(Organization org : orgs)
  878 + {
  879 + map.put("id",org.getId()+"");
  880 + map.put("name",org.getName());
  881 + }
  882 + }
  883 +
  884 + BaseObjectResponse objectResponse = new BaseObjectResponse();
  885 + objectResponse.setData(map);
  886 +
  887 + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS);
  888 + objectResponse.setErrormsg("成功");
  889 + return objectResponse;
  890 + }
860 891 }