DataAuthManagementFacade.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. package com.lantone.security.facade;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
  4. import com.baomidou.mybatisplus.core.metadata.IPage;
  5. import com.lantone.common.dto.DataAuthDetailDTO;
  6. import com.lantone.common.dto.GetDataAuthByIdDTO;
  7. import com.lantone.common.dto.GetDataAuthDeptDTO;
  8. import com.lantone.common.dto.GetDataAuthDetailDTO;
  9. import com.lantone.common.dto.GetDataAuthDoctorDTO;
  10. import com.lantone.common.dto.GetDataAuthHospitalDTO;
  11. import com.lantone.common.dto.GetDataAuthPageDTO;
  12. import com.lantone.common.dto.GetDataAuthRoleDTO;
  13. import com.lantone.common.dto.GetDataAuthSoftwareDTO;
  14. import com.lantone.common.dto.GetDoctorPageDTO;
  15. import com.lantone.common.dto.SoftwareDataAuthDetail;
  16. import com.lantone.common.exception.Asserts;
  17. import com.lantone.common.service.RedisService;
  18. import com.lantone.common.util.DateUtil;
  19. import com.lantone.common.util.EntityUtil;
  20. import com.lantone.common.util.ListUtil;
  21. import com.lantone.common.util.SysUserUtils;
  22. import com.lantone.common.vo.AddAuthSoftwareVO;
  23. import com.lantone.common.vo.AddAuthVO;
  24. import com.lantone.common.vo.GetDataAuthPageVO;
  25. import com.lantone.common.vo.GetDoctorPageVO;
  26. import com.lantone.common.vo.UpdateAuthVO;
  27. import com.lantone.dblayermbg.entity.DataAuth;
  28. import com.lantone.dblayermbg.entity.DataAuthDetail;
  29. import com.lantone.dblayermbg.entity.DeptUser;
  30. import com.lantone.dblayermbg.entity.RoleSoftwareDataAuth;
  31. import com.lantone.dblayermbg.entity.SoftwareDataAuth;
  32. import com.lantone.dblayermbg.facade.DataAuthDetailFacade;
  33. import com.lantone.dblayermbg.facade.DataAuthFacade;
  34. import com.lantone.dblayermbg.facade.DeptFacade;
  35. import com.lantone.dblayermbg.facade.DeptUserFacade;
  36. import com.lantone.dblayermbg.facade.DoctorFacade;
  37. import com.lantone.dblayermbg.facade.HospitalFacade;
  38. import com.lantone.dblayermbg.facade.HospitalUserFacade;
  39. import com.lantone.dblayermbg.facade.MedoupDoctorFacade;
  40. import com.lantone.dblayermbg.facade.RoleSoftwareDataAuthFacade;
  41. import com.lantone.dblayermbg.facade.SoftwareDataAuthFacade;
  42. import com.lantone.dblayermbg.facade.UserFacade;
  43. import com.lantone.dblayermbg.service.impl.DataAuthDetailServiceImpl;
  44. import com.lantone.dblayermbg.service.impl.RoleSoftwareDataAuthServiceImpl;
  45. import com.lantone.security.enums.DataAuthDataTypeEnum;
  46. import com.lantone.security.enums.DataAuthDetailTypeEnum;
  47. import com.lantone.common.enums.IsDeleteEnum;
  48. import com.lantone.security.enums.SoftwareEnum;
  49. import org.springframework.beans.BeanUtils;
  50. import org.springframework.beans.factory.annotation.Autowired;
  51. import org.springframework.scheduling.annotation.Async;
  52. import org.springframework.stereotype.Component;
  53. import java.util.ArrayList;
  54. import java.util.HashMap;
  55. import java.util.List;
  56. import java.util.Map;
  57. import java.util.concurrent.atomic.AtomicBoolean;
  58. import java.util.stream.Collectors;
  59. /**
  60. * @Description:数据权限操作facade
  61. * @Author songxl
  62. * @Date 2021/7/21
  63. */
  64. @Component
  65. public class DataAuthManagementFacade {
  66. @Autowired
  67. private DataAuthFacade dataAuthFacade;
  68. @Autowired
  69. private SoftwareDataAuthFacade softwareDataAuthFacade;
  70. @Autowired
  71. private RoleSoftwareDataAuthFacade roleSoftwareDataAuthFacade;
  72. @Autowired
  73. private DataAuthDetailFacade dataAuthDetailFacade;
  74. @Autowired
  75. private HospitalFacade hospitalFacade;
  76. @Autowired
  77. private DeptFacade deptFacade;
  78. @Autowired
  79. private DoctorFacade doctorFacade;
  80. @Autowired
  81. private HospitalUserFacade hospitalUserFacade;
  82. @Autowired
  83. private RedisService redisService;
  84. @Autowired
  85. private DeptUserFacade deptUserFacade;
  86. @Autowired
  87. private UserFacade userFacade;
  88. @Autowired
  89. private MedoupDoctorFacade medoupDoctorFacade;
  90. /**
  91. * @param Id
  92. * @param status
  93. * @Description禁用启用数据权限
  94. * @Return boolean
  95. */
  96. public boolean disableDataAuth(Long Id, String status) {
  97. return dataAuthFacade.update(new UpdateWrapper<DataAuth>()
  98. .set("status", status)
  99. .eq("id", Id)
  100. .eq("is_deleted", IsDeleteEnum.N.getKey()));
  101. }
  102. /**
  103. * @Description修改数据权限
  104. * @Param [softwareDataAuthVO]
  105. * @Return boolean
  106. */
  107. public boolean updateDataAuth(UpdateAuthVO updateAuthVO) {
  108. //1.修改数据权限
  109. boolean dataAuthUpdate = dataAuthFacade.update(new UpdateWrapper<DataAuth>()
  110. .set("name", updateAuthVO.getUpdateDataAuthVO().getName())
  111. .eq("id", updateAuthVO.getUpdateDataAuthVO().getId())
  112. .eq("is_deleted", IsDeleteEnum.N.getKey()));
  113. if (dataAuthUpdate) {
  114. //2.获取该权限 系统与数据权限信息关联表(sys_service_data_auth)的关联id
  115. List<Long> serviceDataAuthIDS = softwareDataAuthFacade.list(new QueryWrapper<SoftwareDataAuth>()
  116. .eq("data_auth_id", updateAuthVO.getUpdateDataAuthVO().getId())
  117. .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(SoftwareDataAuth::getId).collect(Collectors.toList());
  118. //3.通过serviceDataAuthIDS 删除sys_role_service_data_auth和sys_service_data_auth和sys_data_auth_detail 对应关系
  119. if (ListUtil.isNotEmpty(serviceDataAuthIDS)) {
  120. if (!deleteServiceDataAuth(serviceDataAuthIDS)) {
  121. Asserts.fail("数据权限与系统关系删除失败");
  122. }
  123. }
  124. //4.插入新建数据权限与系统的关系
  125. return saveServiceDataAuth(updateAuthVO.getUpdateDataAuthVO().getSoftwareVOS(), updateAuthVO.getRoles(), updateAuthVO.getUpdateDataAuthVO().getId());
  126. } else {
  127. Asserts.fail("数据权限修改失败");
  128. }
  129. return false;
  130. }
  131. /**
  132. * @Description通过serviceDataAuthIDS删除sys_role_service_data_auth和sys_service_data_auth和sys_data_auth_detail对应关系
  133. * @Param [serviceDataAuthIDS]
  134. * @Return void
  135. */
  136. public boolean deleteServiceDataAuth(List<Long> serviceDataAuthIDS) {
  137. if (dataAuthDetailFacade.remove(new UpdateWrapper<DataAuthDetail>()
  138. .in("software_data_auth_id", serviceDataAuthIDS)
  139. .eq("is_deleted", IsDeleteEnum.N.getKey()))) {
  140. if (roleSoftwareDataAuthFacade.remove(new UpdateWrapper<RoleSoftwareDataAuth>()
  141. .in("software_data_auth_id", serviceDataAuthIDS)
  142. .eq("is_deleted", IsDeleteEnum.N.getKey()))) {
  143. return softwareDataAuthFacade.remove(new UpdateWrapper<SoftwareDataAuth>()
  144. .in("id", serviceDataAuthIDS)
  145. .eq("is_deleted", IsDeleteEnum.N.getKey()));
  146. } else {
  147. Asserts.fail("数据权限与系统、角色关联关系删除失败");
  148. }
  149. } else {
  150. Asserts.fail("系统数据权限与数据权限明细关联关系删除失败");
  151. }
  152. return false;
  153. }
  154. /**
  155. * @param Id
  156. * @Description删除数据权限
  157. * @Return boolean
  158. */
  159. public boolean deleteDataAuth(Long Id) {
  160. //1.删除数据权限
  161. boolean dataAuthdelete = dataAuthFacade.update(new UpdateWrapper<DataAuth>()
  162. .set("is_deleted", IsDeleteEnum.Y.getKey())
  163. .eq("id", Id));
  164. if (dataAuthdelete) {
  165. // //2.获取该权限 系统与数据权限信息关联表(sys_service_data_auth)的关联id
  166. // List<Long> serviceDataAuthIDS = softwareDataAuthFacade.list(new QueryWrapper<SoftwareDataAuth>()
  167. // .eq("data_auth_id", Id)
  168. // .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(SoftwareDataAuth::getId).collect(Collectors.toList());
  169. // //3.通过serviceDataAuthIDS 删除sys_role_service_data_auth和sys_service_data_auth和sys_data_auth_detail 对应关系
  170. // if (ListUtil.isNotEmpty(serviceDataAuthIDS)) {
  171. // if (deleteServiceDataAuth(serviceDataAuthIDS)) {
  172. // return true;
  173. // } else {
  174. // Asserts.fail("数据权限与系统关系删除失败");
  175. // }
  176. // }
  177. return true;
  178. } else {
  179. Asserts.fail("数据权限删除失败");
  180. }
  181. return false;
  182. }
  183. /**
  184. * @param addAuthVO
  185. * @Description添加数据权限
  186. * @Return boolean
  187. */
  188. public boolean addDataAuth(AddAuthVO addAuthVO) {
  189. //1.插入新建数据权限
  190. DataAuth dataAuth = new DataAuth();
  191. BeanUtils.copyProperties(addAuthVO.getAddDataAuthVO(), dataAuth);
  192. dataAuth.setGmtCreate(DateUtil.now());
  193. dataAuth.setCreator(SysUserUtils.getCurrentPrincipleId() + "");
  194. if (dataAuthFacade.save(dataAuth)) {
  195. //2.插入新建数据权限与系统的关系 sys_software_data_auth
  196. return saveServiceDataAuth(addAuthVO.getAddDataAuthVO().getSoftwareVOS(), addAuthVO.getRoles(), dataAuth.getId());
  197. } else {
  198. Asserts.fail("数据权限插入失败");
  199. }
  200. return false;
  201. }
  202. /**
  203. * @param softwareVOS
  204. * @param roles
  205. * @param dataAuthId
  206. * @Description插入新建数据权限与系统的关系
  207. * @Return void
  208. */
  209. private boolean saveServiceDataAuth(List<AddAuthSoftwareVO> softwareVOS, List<Long> roles, Long dataAuthId) {
  210. AtomicBoolean out = new AtomicBoolean(false);
  211. softwareVOS.stream().forEach(softwareVO -> {
  212. SoftwareDataAuth softwareDataAuth = new SoftwareDataAuth();
  213. softwareDataAuth.setSoftwareId(softwareVO.getId());
  214. softwareDataAuth.setDataAuthId(dataAuthId);
  215. softwareDataAuth.setGmtCreate(DateUtil.now());
  216. softwareDataAuth.setCreator(SysUserUtils.getCurrentPrincipleId() + "");
  217. if (softwareDataAuthFacade.save(softwareDataAuth)) {
  218. //2.插入数据权限系统关联表与角色管理sys_role_service_data_auth
  219. List<RoleSoftwareDataAuth> roleSoftwareDataAuths = new ArrayList<>();
  220. for (Long roleId : roles) {
  221. RoleSoftwareDataAuth roleServiceDataAuth = new RoleSoftwareDataAuth();
  222. roleServiceDataAuth.setRoleId(roleId);
  223. roleServiceDataAuth.setSoftwareDataAuthId(softwareDataAuth.getId());
  224. roleServiceDataAuth.setGmtCreate(DateUtil.now());
  225. roleServiceDataAuth.setCreator(SysUserUtils.getCurrentPrincipleId() + "");
  226. roleSoftwareDataAuths.add(roleServiceDataAuth);
  227. }
  228. if (new RoleSoftwareDataAuthServiceImpl().saveBatch(roleSoftwareDataAuths)) {
  229. //3.插入数据权限详细信息。sys_data_auth_detail
  230. //自定义时
  231. List<DataAuthDetail> dataAuthDetails = new ArrayList<>();
  232. if (ListUtil.isNotEmpty(softwareVO.getDataAuthDetails())) {
  233. softwareVO.getDataAuthDetails().stream().forEach(dataAuthDetailVO -> {
  234. DataAuthDetail dataAuthDetail = new DataAuthDetail();
  235. BeanUtils.copyProperties(dataAuthDetailVO, dataAuthDetail);
  236. dataAuthDetail.setGmtCreate(DateUtil.now());
  237. dataAuthDetail.setCreator(SysUserUtils.getCurrentPrincipleId() + "");
  238. dataAuthDetail.setSoftwareDataAuthId(softwareDataAuth.getId());
  239. dataAuthDetails.add(dataAuthDetail);
  240. });
  241. }
  242. if (new DataAuthDetailServiceImpl().saveBatch(dataAuthDetails)) {
  243. out.set(true);
  244. } else {
  245. Asserts.fail("数据权限详情插入失败");
  246. }
  247. } else {
  248. Asserts.fail("角色对应服务数据权限关系插入失败");
  249. }
  250. } else {
  251. Asserts.fail("服务对应数据权限关系插入失败");
  252. }
  253. });
  254. return out.get();
  255. }
  256. /**
  257. * @Description通过数据权限id获取数据权限详情
  258. * @Param [serviceDataAuthVO]
  259. * @Return com.lantone.security.dto.DataAuthDTO
  260. */
  261. public GetDataAuthByIdDTO getDataAuthById(Long Id) {
  262. GetDataAuthByIdDTO dataAuthDTO = new GetDataAuthByIdDTO();
  263. //1.获取数据权限基本信息
  264. DataAuth dataAuth = dataAuthFacade.getById(Id);
  265. if (dataAuth == null) {
  266. Asserts.fail("该数据权限不存在,请重试");
  267. }
  268. BeanUtils.copyProperties(dataAuth, dataAuthDTO);
  269. List<SoftwareDataAuth> softwareDataAuths = softwareDataAuthFacade.list(new QueryWrapper<SoftwareDataAuth>()
  270. .eq("data_auth_id", Id)
  271. .eq("is_deleted", IsDeleteEnum.N.getKey()));
  272. if (ListUtil.isEmpty(softwareDataAuths)) {
  273. Asserts.fail("该数据权限无系统信息,请联系管理员");
  274. }
  275. List<Long> softwareDataAuthIds = softwareDataAuths.stream().map(SoftwareDataAuth::getId).collect(Collectors.toList());
  276. //2.系统-(角色、数据权限详情)信息组装
  277. List<GetDataAuthSoftwareDTO> softwares = new ArrayList<>();
  278. softwareDataAuths.stream().forEach(softwareDataAuth -> {
  279. //2.1获取系统信息
  280. GetDataAuthSoftwareDTO software = new GetDataAuthSoftwareDTO();
  281. software.setId(softwareDataAuth.getSoftwareId());
  282. software.setName(SoftwareEnum.getName(softwareDataAuth.getSoftwareId().intValue()));
  283. //2.2获取角色信息
  284. List<GetDataAuthRoleDTO> roles = roleSoftwareDataAuthFacade.getBaseMapper().getRole(softwareDataAuth.getId());
  285. software.setRoles(roles);
  286. //2.3数据权限详情
  287. List<SoftwareDataAuthDetail> softwareDataAuthDetails = softwareDataAuthFacade.getBaseMapper().getDataAuthDetail(softwareDataAuth.getId());
  288. //--非自定义处理
  289. if (softwareDataAuthDetails.size() == 1 && softwareDataAuthDetails.get(0).getDataType() != DataAuthDataTypeEnum.CUSTOMIZE.getKey()) {
  290. software.setDataType(softwareDataAuthDetails.get(0).getDataType());
  291. //--自定义处理
  292. } else if (softwareDataAuthDetails.get(0).getDataType() == DataAuthDataTypeEnum.CUSTOMIZE.getKey()) {
  293. //按自定义类型分类
  294. Map<Integer, List<SoftwareDataAuthDetail>> softwareDataAuthDetailMap = EntityUtil.makeEntityListMap(softwareDataAuthDetails, "detailType");
  295. //自定义数据
  296. DataAuthDetailDTO dataAuthDetail = new DataAuthDetailDTO();
  297. softwareDataAuthDetailMap.keySet().stream().forEach(detailType -> {
  298. List<Long> ids = softwareDataAuthDetailMap
  299. .get(detailType).stream().map(SoftwareDataAuthDetail::getDetailId).collect(Collectors.toList());
  300. //医院
  301. if (DataAuthDetailTypeEnum.HOSPITAL.getKey() == detailType) {
  302. dataAuthDetail.setHospitals(hospitalFacade.getBaseMapper().getHospitals(ids));
  303. }
  304. //科室
  305. if (DataAuthDetailTypeEnum.DEPT.getKey() == detailType) {
  306. dataAuthDetail.setDepts(deptFacade.getBaseMapper().getDepts(ids));
  307. }
  308. //医生
  309. if (DataAuthDetailTypeEnum.DOCTOR.getKey() == detailType) {
  310. dataAuthDetail.setDoctors(deptFacade.getBaseMapper().getDoctors(ids));
  311. }
  312. });
  313. software.setDataAuthDetail(dataAuthDetail);
  314. }
  315. softwares.add(software);
  316. });
  317. dataAuthDTO.setSoftwares(softwares);
  318. return dataAuthDTO;
  319. }
  320. /**
  321. * @param getDoctorPageVO
  322. * @Description通过医院id或科室id获取医生列表
  323. * @Return com.baomidou.mybatisplus.core.metadata.IPage<com.lantone.common.dto.DoctorDTO>
  324. */
  325. public IPage<GetDoctorPageDTO> getDoctorPage(GetDoctorPageVO getDoctorPageVO) {
  326. return doctorFacade.getBaseMapper().getDoctorPage(getDoctorPageVO);
  327. }
  328. /**
  329. * @param getDataAuthPageVO
  330. * @Description获取数据权限列表
  331. * @Return com.baomidou.mybatisplus.core.metadata.IPage<com.lantone.common.dto.DataAuthDTO>
  332. */
  333. public IPage<GetDataAuthPageDTO> getDataAuthPage(GetDataAuthPageVO getDataAuthPageVO) {
  334. //数据权限的创建者不一定是当前登录用户,创建者应为当前登录用户所在医院所有用户
  335. getDataAuthPageVO.setCreator(SysUserUtils.getCurrentPrincipleId());
  336. return dataAuthFacade.getBaseMapper().getDataAuthPage(getDataAuthPageVO);
  337. }
  338. /**
  339. * @param
  340. * @Description获取用户数据权限
  341. * @Return void
  342. */
  343. @Async
  344. public void initUserDataAuth(Long userId, Long hospitalId,String softwareId) {
  345. //获取当前用户的数据权限
  346. List<GetDataAuthDetailDTO> dataAuthDetails = dataAuthFacade.getBaseMapper()
  347. .getDataAuth(userId, softwareId);
  348. Map<String, List<Long>> localDataAuthMap = new HashMap<>();
  349. List<Long> users = new ArrayList<>();
  350. List<Long> notUsers = new ArrayList<>();
  351. List<Long> doctors = new ArrayList<>();
  352. List<Long> depts = new ArrayList<>();
  353. List<Long> notDepts = new ArrayList<>();
  354. List<Long> hospitals = new ArrayList<>();
  355. List<Long> notHospitals = new ArrayList<>();
  356. if (ListUtil.isNotEmpty(dataAuthDetails)) {
  357. Map<Integer, List<GetDataAuthDetailDTO>> dataAuthDetailMap = dataAuthDetails.stream()
  358. .collect(Collectors.groupingBy(GetDataAuthDetailDTO::getDataType));
  359. dataAuthDetailMap.keySet().stream().forEach(dataType -> {
  360. //1:全部组织,2:全部科室,3:全部科室除本科室外,4:本科室,5:本医疗组,6:本人,7:自定义
  361. //全部组织
  362. if (DataAuthDataTypeEnum.ALL_HOSPITAL.getKey() == dataType) {
  363. //获取当前登录用户的医院id
  364. hospitals.add(hospitalId);
  365. }
  366. //全部科室
  367. if (DataAuthDataTypeEnum.ALL_DEPT.getKey() == dataType) {
  368. hospitals.add(hospitalId);
  369. //获取所有科室
  370. // depts.addAll(deptFacade.list(new QueryWrapper<Dept>()
  371. // .in("hospital_id",hospitalId)
  372. // .eq("is_deleted",IsDeleteEnum.N.getKey())).stream().map(Dept::getId).collect(Collectors.toList()));
  373. }
  374. //除了本科室外
  375. if (DataAuthDataTypeEnum.ALL_DEPT_NOT_SELF.getKey() == dataType) {
  376. notDepts.addAll(deptUserFacade.list(new QueryWrapper<DeptUser>()
  377. .eq("user_id", userId)
  378. .eq("is_deleted", IsDeleteEnum.N.getKey())).stream()
  379. .map(DeptUser::getDeptId).collect(Collectors.toList()));
  380. }
  381. //本科室
  382. if (DataAuthDataTypeEnum.ALL_SELF_DEPT.getKey() == dataType) {
  383. depts.addAll(deptUserFacade.list(new QueryWrapper<DeptUser>()
  384. .eq("user_id", userId)
  385. .eq("is_deleted", IsDeleteEnum.N.getKey())).stream()
  386. .map(DeptUser::getDeptId).collect(Collectors.toList()));
  387. }
  388. //本医疗组
  389. if (DataAuthDataTypeEnum.SELF_MEDOUP.getKey() == dataType) {
  390. doctors.addAll(medoupDoctorFacade.getBaseMapper().getDoctorIdByMedoup(userId));
  391. }
  392. //本人
  393. if (DataAuthDataTypeEnum.SELF_MEDOUP.getKey() == dataType) {
  394. users.add(userId);
  395. }
  396. //自定义
  397. if (DataAuthDataTypeEnum.CUSTOMIZE.getKey() == dataType) {
  398. Map<Integer, List<GetDataAuthDetailDTO>> dataAuthDetailTypeMap = dataAuthDetailMap.get(dataType).stream()
  399. .collect(Collectors.groupingBy(GetDataAuthDetailDTO::getDetailType));
  400. dataAuthDetailTypeMap.keySet().stream().forEach(detailType -> {
  401. List<Long> ids = dataAuthDetailTypeMap
  402. .get(detailType).stream().map(GetDataAuthDetailDTO::getDetailId).collect(Collectors.toList());
  403. //医院
  404. if (DataAuthDetailTypeEnum.HOSPITAL.getKey() == detailType) {
  405. hospitals.addAll(hospitalFacade.getBaseMapper().getHospitals(ids).stream()
  406. .map(GetDataAuthHospitalDTO::getId).collect(Collectors.toList()));
  407. }
  408. //科室
  409. if (DataAuthDetailTypeEnum.DEPT.getKey() == detailType) {
  410. depts.addAll(deptFacade.getBaseMapper().getDepts(ids).stream()
  411. .map(GetDataAuthDeptDTO::getId).collect(Collectors.toList()));
  412. }
  413. //医生
  414. if (DataAuthDetailTypeEnum.DOCTOR.getKey() == detailType) {
  415. doctors.addAll(deptFacade.getBaseMapper().getDoctors(ids).stream()
  416. .map(GetDataAuthDoctorDTO::getId).collect(Collectors.toList()));
  417. }
  418. });
  419. }
  420. });
  421. localDataAuthMap.put("users", users);
  422. localDataAuthMap.put("notUsers", notUsers);
  423. localDataAuthMap.put("doctors", doctors);
  424. localDataAuthMap.put("depts", depts);
  425. localDataAuthMap.put("notDepts", notDepts);
  426. localDataAuthMap.put("hospitals", hospitals);
  427. localDataAuthMap.put("notHospitals", notHospitals);
  428. redisService.hSetAll(hospitalId + "_" + userId + "_" + softwareId, localDataAuthMap);
  429. }
  430. }
  431. }