Commit b799ea30bbbfcd0d67cdaafa06e5a92f537af101
1 parent
8cb0e6da9a
Exists in
master
and in
8 other branches
医院基础列表
Showing 3 changed files with 121 additions and 11 deletions
platform-common/src/main/java/com/lyms/platform/common/enums/HospitalStatusEnums.java
View file @
b799ea3
1 | +package com.lyms.platform.common.enums; | |
2 | + | |
3 | + | |
4 | +import java.util.ArrayList; | |
5 | +import java.util.HashMap; | |
6 | +import java.util.List; | |
7 | +import java.util.Map; | |
8 | + | |
9 | +/** | |
10 | + * 医院运行状态 | |
11 | + * Created by lqy on 2016/06/27 | |
12 | + */ | |
13 | +public enum HospitalStatusEnums { | |
14 | + | |
15 | + | |
16 | + ZSYX(0,"正式运行"),SYX(1,"试运行"),TZYX(2,"停止运行"); | |
17 | + | |
18 | + HospitalStatusEnums(int id, String name) { | |
19 | + this.id = id; | |
20 | + this.name = name; | |
21 | + | |
22 | + } | |
23 | + private int id; | |
24 | + private String name; | |
25 | + | |
26 | + public int getId() { | |
27 | + return id; | |
28 | + } | |
29 | + | |
30 | + public void setId(int id) { | |
31 | + this.id = id; | |
32 | + } | |
33 | + | |
34 | + public String getName() { | |
35 | + return name; | |
36 | + } | |
37 | + | |
38 | + public void setName(String name) { | |
39 | + this.name = name; | |
40 | + } | |
41 | + | |
42 | + public static List<Map> getHospitalStatusEnums() { | |
43 | + | |
44 | + List<Map> list = new ArrayList<>(); | |
45 | + for (HospitalStatusEnums e : HospitalStatusEnums.values()) { | |
46 | + Map rootMap = new HashMap(); | |
47 | + rootMap.put("id", e.getId()); | |
48 | + rootMap.put("name", e.getName()); | |
49 | + list.add(rootMap); | |
50 | + } | |
51 | + return list; | |
52 | + } | |
53 | + | |
54 | + public static String getNameById(int id){ | |
55 | + for(HospitalStatusEnums enums:values()){ | |
56 | + if(id==enums.getId()){ | |
57 | + return enums.getName(); | |
58 | + } | |
59 | + } | |
60 | + return ""; | |
61 | + } | |
62 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
b799ea3
... | ... | @@ -12,8 +12,11 @@ |
12 | 12 | import com.lyms.platform.data.service.SmsService; |
13 | 13 | import com.lyms.platform.data.util.AmsMessageService; |
14 | 14 | import com.lyms.platform.data.util.SaveMessageService; |
15 | +import com.lyms.platform.permission.model.Organization; | |
16 | +import com.lyms.platform.permission.model.OrganizationQuery; | |
15 | 17 | import com.lyms.platform.permission.model.Users; |
16 | 18 | import com.lyms.platform.permission.model.UsersQuery; |
19 | +import com.lyms.platform.permission.service.OrganizationService; | |
17 | 20 | import com.lyms.platform.permission.service.UsersService; |
18 | 21 | import com.lyms.platform.pojo.*; |
19 | 22 | import com.lyms.platform.query.*; |
... | ... | @@ -57,6 +60,8 @@ |
57 | 60 | |
58 | 61 | @Autowired |
59 | 62 | private PostReviewService postReviewService; |
63 | + @Autowired | |
64 | + private OrganizationService organizationService; | |
60 | 65 | |
61 | 66 | /** |
62 | 67 | * 生成孕妇ams指导短信 |
63 | 68 | |
... | ... | @@ -78,10 +83,16 @@ |
78 | 83 | for(SmsConfigModel config : configs) |
79 | 84 | { |
80 | 85 | String hospitalId = config.getHospitalId(); |
81 | - if (hospitalId == null) | |
86 | + if (StringUtils.isEmpty(hospitalId)) | |
82 | 87 | { |
83 | 88 | continue; |
84 | 89 | } |
90 | + //判断医院是否运行 | |
91 | + if (!isRunning(hospitalId)) | |
92 | + { | |
93 | + continue; | |
94 | + } | |
95 | + | |
85 | 96 | String strService = config.getSmsService(); |
86 | 97 | |
87 | 98 | //判断消息服务是否启动 |
... | ... | @@ -140,6 +151,7 @@ |
140 | 151 | messagePrefix = res == "" ? messagePrefix : res; |
141 | 152 | } |
142 | 153 | |
154 | + //每周几发送的指导实践 | |
143 | 155 | String timeStr = config.getGuideTime(); |
144 | 156 | if (StringUtils.isEmpty(timeStr)) |
145 | 157 | { |
146 | 158 | |
... | ... | @@ -279,11 +291,17 @@ |
279 | 291 | for(SmsConfigModel config : configs) |
280 | 292 | { |
281 | 293 | String hospitalId = config.getHospitalId(); |
282 | - if (hospitalId == null) | |
294 | + if (StringUtils.isEmpty(hospitalId)) | |
283 | 295 | { |
284 | 296 | continue; |
285 | 297 | } |
286 | 298 | |
299 | + //判断医院是否运行 | |
300 | + if (!isRunning(hospitalId)) | |
301 | + { | |
302 | + continue; | |
303 | + } | |
304 | + | |
287 | 305 | String serviceStr = config.getSmsService(); |
288 | 306 | |
289 | 307 | //判断消息服务是否启动 |
290 | 308 | |
... | ... | @@ -398,11 +416,17 @@ |
398 | 416 | for(SmsConfigModel config : configs) |
399 | 417 | { |
400 | 418 | String hospitalId = config.getHospitalId(); |
401 | - if (hospitalId == null) | |
419 | + if (StringUtils.isEmpty(hospitalId)) | |
402 | 420 | { |
403 | 421 | continue; |
404 | 422 | } |
405 | 423 | |
424 | + //判断医院是否运行 | |
425 | + if (!isRunning(hospitalId)) | |
426 | + { | |
427 | + continue; | |
428 | + } | |
429 | + | |
406 | 430 | String serviceStr = config.getSmsService(); |
407 | 431 | |
408 | 432 | //判断消息服务是否启动 |
... | ... | @@ -576,6 +600,12 @@ |
576 | 600 | continue; |
577 | 601 | } |
578 | 602 | |
603 | + //判断医院是否运行 | |
604 | + if (!isRunning(hospitalId)) | |
605 | + { | |
606 | + continue; | |
607 | + } | |
608 | + | |
579 | 609 | SmsConfigModel config = getSmsConfig(configs,hospitalId); |
580 | 610 | |
581 | 611 | //false 表示该服务没有启动 |
... | ... | @@ -1998,7 +2028,7 @@ |
1998 | 2028 | { |
1999 | 2029 | if (StringUtils.isNotEmpty(repalceStr)) |
2000 | 2030 | { |
2001 | - return repalceStr.replace("{{姓名}}",name); | |
2031 | + return repalceStr.replace("{{姓名}}", name); | |
2002 | 2032 | } |
2003 | 2033 | return repalceStr; |
2004 | 2034 | } |
... | ... | @@ -2131,6 +2161,27 @@ |
2131 | 2161 | { |
2132 | 2162 | return true; |
2133 | 2163 | } |
2164 | + } | |
2165 | + } | |
2166 | + return false; | |
2167 | + } | |
2168 | + | |
2169 | + /** | |
2170 | + * 判断医院是否运行 | |
2171 | + * @return | |
2172 | + */ | |
2173 | + private boolean isRunning(String hid) | |
2174 | + { | |
2175 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
2176 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
2177 | + organizationQuery.setId(Integer.parseInt(hid)); | |
2178 | + List<Organization> organizations = organizationService.queryOrganization(organizationQuery); | |
2179 | + if (CollectionUtils.isNotEmpty(organizations)) | |
2180 | + { | |
2181 | + Organization org = organizations.get(0); | |
2182 | + if (org != null && org.getStatus() != null && org.getStatus() == HospitalStatusEnums.ZSYX.getId()) | |
2183 | + { | |
2184 | + return true; | |
2134 | 2185 | } |
2135 | 2186 | } |
2136 | 2187 | return false; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsConfigFacade.java
View file @
b799ea3
... | ... | @@ -2,10 +2,7 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.*; |
4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
5 | -import com.lyms.platform.common.enums.OrganizationTypeEnum; | |
6 | -import com.lyms.platform.common.enums.SmsServiceEnums; | |
7 | -import com.lyms.platform.common.enums.WeekEnums; | |
8 | -import com.lyms.platform.common.enums.YnEnums; | |
5 | +import com.lyms.platform.common.enums.*; | |
9 | 6 | import com.lyms.platform.common.result.BaseListResponse; |
10 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
11 | 8 | import com.lyms.platform.common.result.BaseResponse; |
12 | 9 | |
13 | 10 | |
... | ... | @@ -554,15 +551,15 @@ |
554 | 551 | if (org.getStatus() != null) |
555 | 552 | { |
556 | 553 | // 0运行 1试运行 2停止 |
557 | - if (org.getStatus() == 0) | |
554 | + if (org.getStatus() == HospitalStatusEnums.ZSYX.getId()) | |
558 | 555 | { |
559 | 556 | statusStr = "正式运行"; |
560 | 557 | } |
561 | - else if (org.getStatus() == 1) | |
558 | + else if (org.getStatus() == HospitalStatusEnums.SYX.getId()) | |
562 | 559 | { |
563 | 560 | statusStr = "试运行"; |
564 | 561 | } |
565 | - else if (org.getStatus() == 2) { | |
562 | + else if (org.getStatus() == HospitalStatusEnums.TZYX.getId()) { | |
566 | 563 | statusStr = "停止运行"; |
567 | 564 | } |
568 | 565 | } |