Commit 84b72358e1d498f3e3c1455e001c6867670bbac1
1 parent
793de78903
Exists in
master
and in
8 other branches
增加根据登录的机构权限去获取医院
Showing 1 changed file with 36 additions and 2 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
84b7235
... | ... | @@ -11,11 +11,13 @@ |
11 | 11 | import com.lyms.platform.common.enums.YnEnums; |
12 | 12 | import com.lyms.platform.common.utils.ResultUtils; |
13 | 13 | import com.lyms.platform.common.utils.SystemConfig; |
14 | +import com.lyms.platform.operate.web.facade.AutoMatchFacade; | |
14 | 15 | import com.lyms.platform.operate.web.result.FrontEndResult; |
15 | 16 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
16 | 17 | import com.lyms.platform.permission.model.*; |
17 | 18 | import com.lyms.platform.permission.service.*; |
18 | 19 | import com.lyms.platform.pojo.BasicConfig; |
20 | +import org.apache.commons.collections.CollectionUtils; | |
19 | 21 | import org.apache.commons.lang.StringUtils; |
20 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
21 | 23 | import org.springframework.stereotype.Controller; |
... | ... | @@ -40,6 +42,8 @@ |
40 | 42 | private BasicConfigService basicConfigService; |
41 | 43 | @Autowired |
42 | 44 | private DepartmentsService departmentsService; |
45 | + @Autowired | |
46 | + private AutoMatchFacade autoMatchFacade; | |
43 | 47 | |
44 | 48 | |
45 | 49 | /** |
46 | 50 | |
47 | 51 | |
... | ... | @@ -195,12 +199,42 @@ |
195 | 199 | ResultUtils.buildSuccessResultAndWrite(response); |
196 | 200 | } |
197 | 201 | |
202 | + /** | |
203 | + * 根据当前登录的权限去获取下属的医院 | |
204 | + * | |
205 | + */ | |
206 | + @RequestMapping(value = "/organization1", method = RequestMethod.GET) | |
207 | + @ResponseBody | |
208 | + @TokenRequired | |
209 | + public FrontEndResult getOrganization(HttpServletRequest request){ | |
210 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
198 | 211 | |
212 | + String areaId= autoMatchFacade.match(loginState.getId()); | |
213 | + List<Map> data =new ArrayList<>(); | |
214 | + if(StringUtils.isNotEmpty(areaId)){ | |
215 | + OrganizationQuery organizationQuery = new OrganizationQuery(); | |
216 | + organizationQuery.setAreaId(areaId); | |
217 | + List<Integer> list = new ArrayList<>(); | |
218 | + list.add(3); | |
219 | + list.add(4); | |
220 | + organizationQuery.setYn(YnEnums.YES.getId()); | |
221 | + organizationQuery.setTypeList(list); | |
222 | + List<Organization> organizations = organizationService.queryOrganization(organizationQuery); | |
223 | + if(CollectionUtils.isNotEmpty(organizations)){ | |
224 | + for(Organization organization : organizations){ | |
225 | + Map<String,Object> map = new HashMap<>(); | |
226 | + map.put("id", organization.getId()); | |
227 | + map.put("name", organization.getName()); | |
228 | + data.add(map); | |
229 | + } | |
230 | + } | |
231 | + } | |
232 | + return new FrontEndResult().setData(data).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); | |
233 | + } | |
199 | 234 | |
200 | 235 | |
201 | 236 | |
202 | 237 | |
203 | - | |
204 | 238 | /** |
205 | 239 | * 获取列表 |
206 | 240 | */ |
... | ... | @@ -269,7 +303,7 @@ |
269 | 303 | organization.setArea(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getAreaId()), falg)); |
270 | 304 | } |
271 | 305 | if(null != organization.getStreetId()) { |
272 | - organization.setStreet(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getStreetId()),falg)); | |
306 | + organization.setStreet(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getStreetId()), falg)); | |
273 | 307 | } |
274 | 308 | Object obj = organization; |
275 | 309 | if(falg){ |