Commit d203b670c4f184c1b0baf6f104bb4eecddb12466
1 parent
755fed04ec
Exists in
master
and in
1 other branch
医院基础配置
Showing 2 changed files with 99 additions and 6 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/SmsConfigController.java
View file @
d203b67
1 | 1 | package com.lyms.platform.operate.web.controller; |
2 | 2 | |
3 | 3 | import com.lyms.platform.common.base.BaseController; |
4 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
4 | 5 | import com.lyms.platform.common.enums.SendTimeEnums; |
5 | 6 | import com.lyms.platform.common.enums.SmsServiceEnums; |
6 | 7 | import com.lyms.platform.common.result.BaseObjectResponse; |
... | ... | @@ -14,6 +15,8 @@ |
14 | 15 | import org.springframework.web.bind.annotation.*; |
15 | 16 | |
16 | 17 | import javax.validation.Valid; |
18 | +import java.util.ArrayList; | |
19 | +import java.util.HashMap; | |
17 | 20 | import java.util.List; |
18 | 21 | import java.util.Map; |
19 | 22 | |
... | ... | @@ -112,6 +115,35 @@ |
112 | 115 | @ResponseBody |
113 | 116 | public BaseResponse queryHospitalConfig(@PathVariable("hid") String hid) { |
114 | 117 | return smsConfigFacade.queryHospitalConfig(hid); |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * 更新医院基础配置查询医院 | |
122 | + * @return | |
123 | + */ | |
124 | + @RequestMapping(value = "/addOrUpdateHospitalConfig", method = RequestMethod.PUT) | |
125 | + @ResponseBody | |
126 | + public BaseResponse addOrUpdateHospitalConfig(@RequestParam(required = true) String hid,@RequestParam(required = true) String highConfig,@RequestParam(required = true) Integer status) { | |
127 | + return smsConfigFacade.addOrUpdateHospitalConfig(hid, highConfig, status); | |
128 | + } | |
129 | + | |
130 | + /** | |
131 | + * 查询出高危配置库 | |
132 | + * @return | |
133 | + */ | |
134 | + @RequestMapping(value = "/queryHighConfigLib", method = RequestMethod.GET) | |
135 | + @ResponseBody | |
136 | + public BaseResponse updateHospitalConfig() { | |
137 | + List<Map> highLibs = new ArrayList(); | |
138 | + | |
139 | + Map<String,String> map = new HashMap(); | |
140 | + map.put("1","测试高危版"); | |
141 | + highLibs.add(map); | |
142 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
143 | + objectResponse.setData(highLibs); | |
144 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
145 | + objectResponse.setErrormsg("成功"); | |
146 | + return objectResponse; | |
115 | 147 | } |
116 | 148 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/SmsConfigFacade.java
View file @
d203b67
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | import com.lyms.platform.common.result.BaseResponse; |
10 | 10 | import com.lyms.platform.common.utils.JsonUtil; |
11 | 11 | import com.lyms.platform.common.utils.StringUtils; |
12 | +import com.lyms.platform.common.utils.SystemConfig; | |
12 | 13 | import com.lyms.platform.operate.web.request.SmsConfigRequest; |
13 | 14 | import com.lyms.platform.operate.web.result.*; |
14 | 15 | import com.lyms.platform.permission.model.Departments; |
... | ... | @@ -40,6 +41,9 @@ |
40 | 41 | @Autowired |
41 | 42 | private OrganizationService organizationService; |
42 | 43 | |
44 | + @Autowired | |
45 | + private BasicConfigService basicConfigService; | |
46 | + | |
43 | 47 | /** |
44 | 48 | * 更新短信服务配置 |
45 | 49 | * @param request |
... | ... | @@ -223,7 +227,7 @@ |
223 | 227 | public BaseResponse getDeptPrefix(String hid) { |
224 | 228 | |
225 | 229 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
226 | - objectResponse.setData(querDeptPrefixByHid( hid)); | |
230 | + objectResponse.setData(querDeptPrefixByHid(hid)); | |
227 | 231 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
228 | 232 | objectResponse.setErrormsg("成功"); |
229 | 233 | |
230 | 234 | |
231 | 235 | |
232 | 236 | |
233 | 237 | |
234 | 238 | |
... | ... | @@ -337,25 +341,42 @@ |
337 | 341 | hospital.put("shortCode",org.getShortCode()); |
338 | 342 | String allAddress = ""; |
339 | 343 | String provinceId = org.getProvinceId(); |
344 | + BasicConfigQuery query = new BasicConfigQuery(); | |
345 | + query.setYn(YnEnums.YES.getId()); | |
340 | 346 | if (StringUtils.isNotEmpty(provinceId)) |
341 | 347 | { |
342 | - | |
348 | + query.setId(provinceId); | |
349 | + List<BasicConfig> configList = basicConfigService.queryBasicConfig(query); | |
350 | + if (CollectionUtils.isNotEmpty(configList)) | |
351 | + { | |
352 | + allAddress+=configList.get(0).getName(); | |
353 | + } | |
343 | 354 | } |
344 | 355 | String areaId = org.getAreaId(); |
345 | 356 | if (StringUtils.isNotEmpty(provinceId)) |
346 | 357 | { |
347 | - | |
358 | + query.setId(areaId); | |
359 | + List<BasicConfig> configList = basicConfigService.queryBasicConfig(query); | |
360 | + if (CollectionUtils.isNotEmpty(configList)) | |
361 | + { | |
362 | + allAddress+=configList.get(0).getName(); | |
363 | + } | |
348 | 364 | } |
349 | 365 | String cityId = org.getCityId(); |
350 | 366 | if (StringUtils.isNotEmpty(provinceId)) |
351 | 367 | { |
352 | - | |
368 | + query.setId(cityId); | |
369 | + List<BasicConfig> configList = basicConfigService.queryBasicConfig(query); | |
370 | + if (CollectionUtils.isNotEmpty(configList)) | |
371 | + { | |
372 | + allAddress+=configList.get(0).getName(); | |
373 | + } | |
353 | 374 | } |
354 | 375 | String address = org.getAddress(); |
355 | 376 | allAddress+=address; |
356 | - hospital.put("address",allAddress); | |
377 | + hospital.put("address", allAddress); | |
357 | 378 | |
358 | - hospital.put("remark",""); | |
379 | + hospital.put("remark", ""); | |
359 | 380 | } |
360 | 381 | SmsConfigQuery query = new SmsConfigQuery(); |
361 | 382 | query.setYn(YnEnums.YES.getId()); |
... | ... | @@ -375,6 +396,46 @@ |
375 | 396 | objectResponse.setData(hospital); |
376 | 397 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
377 | 398 | objectResponse.setErrormsg("成功"); |
399 | + return objectResponse; | |
400 | + } | |
401 | + | |
402 | + /** | |
403 | + * 更新医院基础配置 | |
404 | + * @param hid | |
405 | + * @param highConfig | |
406 | + * @param status | |
407 | + * @return | |
408 | + */ | |
409 | + public BaseResponse addOrUpdateHospitalConfig(String hid, String highConfig, Integer status) { | |
410 | + SmsConfigQuery query = new SmsConfigQuery(); | |
411 | + query.setYn(YnEnums.YES.getId()); | |
412 | + query.setHospitalId(hid); | |
413 | + List<SmsConfigModel> smsmodels = smsConfigService.querySmsConfigByHid(query); | |
414 | + boolean isExist = false; | |
415 | + if (CollectionUtils.isNotEmpty(smsmodels)) | |
416 | + { | |
417 | + SmsConfigModel model = smsmodels.get(0); | |
418 | + if (model != null && StringUtils.isNotEmpty(model.getId())) | |
419 | + { | |
420 | + model.setHighConfig(highConfig); | |
421 | + model.setStatus(status); | |
422 | + smsConfigService.updateSmsConfig(model, model.getId()); | |
423 | + isExist = true; | |
424 | + } | |
425 | + | |
426 | + } | |
427 | + if (!isExist) | |
428 | + { | |
429 | + SmsConfigModel model = new SmsConfigModel(); | |
430 | + model.setHospitalId(hid); | |
431 | + model.setYn(YnEnums.YES.getId()); | |
432 | + model.setHighConfig(highConfig); | |
433 | + model.setStatus(status); | |
434 | + smsConfigService.addSmsConfig(model); | |
435 | + } | |
436 | + BaseResponse objectResponse = new BaseResponse(); | |
437 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
438 | + objectResponse.setErrormsg("保存成功"); | |
378 | 439 | return objectResponse; |
379 | 440 | } |
380 | 441 | } |