Commit 1d6c2cd4aab6c5b4447e539a1dfd3255c50c271b
1 parent
41777ace23
Exists in
master
and in
8 other branches
医院查询人
Showing 2 changed files with 32 additions and 22 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StopPregnancyController.java
View file @
1d6c2cd
| 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.base.LoginContext; | |
| 4 | 5 | import com.lyms.platform.common.result.BaseResponse; |
| 5 | 6 | import com.lyms.platform.common.utils.StringUtils; |
| 6 | 7 | import com.lyms.platform.operate.web.facade.StopPregnancyFacade; |
| ... | ... | @@ -9,6 +10,7 @@ |
| 9 | 10 | import org.springframework.stereotype.Controller; |
| 10 | 11 | import org.springframework.web.bind.annotation.*; |
| 11 | 12 | |
| 13 | +import javax.servlet.http.HttpServletRequest; | |
| 12 | 14 | import javax.validation.Valid; |
| 13 | 15 | |
| 14 | 16 | /** |
| 15 | 17 | |
| ... | ... | @@ -51,15 +53,13 @@ |
| 51 | 53 | |
| 52 | 54 | /** |
| 53 | 55 | * 返回该医院可选择的录入人 |
| 54 | - * @param hospitalId 医院Id 必填 | |
| 55 | - * @param deptId 科室id 非必填 | |
| 56 | 56 | * @return |
| 57 | 57 | */ |
| 58 | 58 | @RequestMapping(method = RequestMethod.GET, value = "/queryInPerson") |
| 59 | 59 | @ResponseBody |
| 60 | - public BaseResponse queryInPerson( @RequestParam(value = "hospitalId", required = true)Integer hospitalId, | |
| 61 | - @RequestParam(value = "deptId", required = false)Integer deptId) { | |
| 62 | - return stopPregnancyFacade.queryInPerson(hospitalId,deptId); | |
| 60 | + public BaseResponse queryInPerson(HttpServletRequest request) { | |
| 61 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 62 | + return stopPregnancyFacade.queryInPerson(loginState.getId()); | |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
View file @
1d6c2cd
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 5 | import com.lyms.platform.common.enums.StopPregEnums; |
| 6 | 6 | import com.lyms.platform.common.enums.YnEnums; |
| 7 | +import com.lyms.platform.common.enums.ZhiChenEnums; | |
| 7 | 8 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 8 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 9 | 10 | import com.lyms.platform.common.utils.DateUtil; |
| 10 | 11 | |
| 11 | 12 | |
| 12 | 13 | |
| 13 | 14 | |
| 14 | 15 | |
| 15 | 16 | |
| ... | ... | @@ -236,30 +237,39 @@ |
| 236 | 237 | |
| 237 | 238 | /** |
| 238 | 239 | * 返回该医院可选择的录入人 |
| 239 | - * @param hospitalId | |
| 240 | 240 | * @return |
| 241 | 241 | */ |
| 242 | - public BaseResponse queryInPerson(Integer hospitalId,Integer deptId) { | |
| 243 | - | |
| 244 | - UsersQuery usersQuery = new UsersQuery(); | |
| 245 | - usersQuery.setYn(YnEnums.YES.getId()); | |
| 246 | - usersQuery.setOrgId(hospitalId); | |
| 247 | - if (deptId != null) | |
| 248 | - { | |
| 249 | - usersQuery.setDeptId(deptId); | |
| 250 | - } | |
| 251 | - List<Users> users = usersService.queryUsers2(usersQuery); | |
| 242 | + public BaseResponse queryInPerson(Integer id) { | |
| 252 | 243 | List<Map> list = new ArrayList<>(); |
| 253 | - if (CollectionUtils.isNotEmpty(users)) | |
| 244 | + if (id != null) | |
| 254 | 245 | { |
| 255 | - for(Users user : users) | |
| 246 | + Users dbuser = usersService.getUsers(id); | |
| 247 | + | |
| 248 | + if (dbuser != null) | |
| 256 | 249 | { |
| 257 | - Map pmap = new HashMap(); | |
| 258 | - pmap.put("id",user.getId()); | |
| 259 | - pmap.put("name",user.getName()); | |
| 260 | - list.add(pmap); | |
| 250 | + UsersQuery usersQuery = new UsersQuery(); | |
| 251 | + usersQuery.setYn(YnEnums.YES.getId()); | |
| 252 | + usersQuery.setOrgId(dbuser.getOrgId()); | |
| 253 | + if (dbuser != null && dbuser.getZhiChenId() == ZhiChenEnums.DOCTOR.getId() && dbuser.getDeptId() != null) | |
| 254 | + { | |
| 255 | + usersQuery.setDeptId(dbuser.getDeptId()); | |
| 256 | + } | |
| 257 | + List<Users> users = usersService.queryUsers2(usersQuery); | |
| 258 | + | |
| 259 | + if (CollectionUtils.isNotEmpty(users)) | |
| 260 | + { | |
| 261 | + for(Users user : users) | |
| 262 | + { | |
| 263 | + Map pmap = new HashMap(); | |
| 264 | + pmap.put("id",user.getId()); | |
| 265 | + pmap.put("name",user.getName()); | |
| 266 | + list.add(pmap); | |
| 267 | + } | |
| 268 | + } | |
| 261 | 269 | } |
| 270 | + | |
| 262 | 271 | } |
| 272 | + | |
| 263 | 273 | BaseObjectResponse objectResponse = new BaseObjectResponse(); |
| 264 | 274 | objectResponse.setData(list); |
| 265 | 275 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |