|
@@ -122,7 +122,7 @@ public class UserManagementFacade {
|
|
|
List<String> roleIdNames = roleFacade.list(roleQueryWrapper).stream().map(i -> i.getId() + "_" + i.getName()).collect(Collectors.toList());
|
|
|
|
|
|
BeanUtils.copyProperties(user, userDTO);
|
|
|
- userDTO.setStatus(Integer.parseInt(user.getStatus()));
|
|
|
+ userDTO.setStatus(user.getStatus());
|
|
|
userDTO.setRoles(roleIdNames);
|
|
|
return userDTO;
|
|
|
}
|
|
@@ -159,7 +159,7 @@ public class UserManagementFacade {
|
|
|
*/
|
|
|
private boolean saveUserHospital(AddHospitalTreeVO addHospitalTreeVO, Long userId, List<Long> roles) {
|
|
|
|
|
|
- if(ListUtil.isEmpty(addHospitalTreeVO.getDepts())&&ListUtil.isEmpty(addHospitalTreeVO.getHospitals())){
|
|
|
+ if (ListUtil.isEmpty(addHospitalTreeVO.getDepts()) && ListUtil.isEmpty(addHospitalTreeVO.getHospitals())) {
|
|
|
Asserts.fail("用户关联的医院或科室都为空");
|
|
|
}
|
|
|
//插入用户和科室的关系(没有科室信息默认为全院)
|
|
@@ -359,10 +359,10 @@ public class UserManagementFacade {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @param hospitalMap 医院结果级
|
|
|
- * @param hospitals 查询用户所在医院集
|
|
|
- * @param depts 查询用户所在科室集
|
|
|
- * @param hospitalTreeDTOS 当前遍历医院集
|
|
|
+ * @param hospitalMap 医院结果级
|
|
|
+ * @param hospitals 查询用户所在医院集
|
|
|
+ * @param depts 查询用户所在科室集
|
|
|
+ * @param hospitalTreeDTOS 当前遍历医院集
|
|
|
* @Description
|
|
|
* @Return void
|
|
|
*/
|
|
@@ -383,6 +383,7 @@ public class UserManagementFacade {
|
|
|
getSonHospital(bean, hospitalMap, hospitals, depts);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 递归获取医院结构
|
|
|
*
|
|
@@ -399,6 +400,7 @@ public class UserManagementFacade {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 递归获取医院结构
|
|
|
*
|
|
@@ -432,66 +434,70 @@ public class UserManagementFacade {
|
|
|
getUserPageVO.setLocalUserID(SysUserUtils.getCurrentPrincipleId());
|
|
|
return hospitalUserFacade.getBaseMapper().getUserPage(getUserPageVO);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- * @Description获取用户所属组织
|
|
|
* @param
|
|
|
+ * @Description获取用户所属组织
|
|
|
* @Return java.util.List<com.lantone.common.dto.GetHospitalTreeDTO>
|
|
|
*/
|
|
|
- public Map<String,Object> getUserHospitals() {
|
|
|
- Map<String,Object> out = new HashMap<>();
|
|
|
+ public Map<String, Object> getUserHospitals() {
|
|
|
+ Map<String, Object> out = new HashMap<>();
|
|
|
//但系统单家医院直接跳转
|
|
|
boolean jumpFlag = true;
|
|
|
//1.获取用户系统信息
|
|
|
List<SoftwareDTO> softwares = userFacade.getBaseMapper().getUserSoftwareByUId(SysUserUtils.getCurrentPrincipleId());
|
|
|
- if(softwares.size()>1){
|
|
|
+ if (softwares.size() > 1) {
|
|
|
jumpFlag = false;
|
|
|
}
|
|
|
AtomicInteger count = new AtomicInteger();
|
|
|
List<UserSoftwareHospitalDTO> userSoftwareHospitals = new ArrayList<>();
|
|
|
- if(ListUtil.isNotEmpty(softwares)){
|
|
|
+ if (ListUtil.isNotEmpty(softwares)) {
|
|
|
softwares.stream().forEach(softwareDTO -> {
|
|
|
UserSoftwareHospitalDTO tempU = new UserSoftwareHospitalDTO();
|
|
|
- BeanUtils.copyProperties(softwareDTO,tempU);
|
|
|
+ BeanUtils.copyProperties(softwareDTO, tempU);
|
|
|
//获取该系统下的医院
|
|
|
List<GetUserHospitalsDTO> softwareHospitals = userFacade.getBaseMapper()
|
|
|
- .getUserSoftwareHospitals(SysUserUtils.getCurrentPrincipleId(),softwareDTO.getId());
|
|
|
+ .getUserSoftwareHospitals(SysUserUtils.getCurrentPrincipleId(), softwareDTO.getId());
|
|
|
count.set(count.get() + softwareHospitals.size());
|
|
|
//转换成树状结构
|
|
|
- Map<Long,List<GetUserHospitalsDTO>> softwareHospitalMap = EntityUtil.makeEntityListMap(softwareHospitals,"parentId");
|
|
|
- tempU.setHospitals(transTreeData(softwareHospitalMap,softwareHospitals));
|
|
|
+ Map<Long, List<GetUserHospitalsDTO>> softwareHospitalMap = EntityUtil.makeEntityListMap(softwareHospitals, "parentId");
|
|
|
+ tempU.setHospitals(transTreeData(softwareHospitalMap, softwareHospitals));
|
|
|
userSoftwareHospitals.add(tempU);
|
|
|
});
|
|
|
}
|
|
|
- if(count.get()>1){
|
|
|
+ if (count.get() > 1) {
|
|
|
jumpFlag = false;
|
|
|
}
|
|
|
- out.put("jump",jumpFlag);
|
|
|
- out.put("software",userSoftwareHospitals);
|
|
|
+ out.put("jump", jumpFlag);
|
|
|
+ out.put("software", userSoftwareHospitals);
|
|
|
return out;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
- * @Description将医院信息转换成树状结构
|
|
|
* @param softwareHospitalMap
|
|
|
* @param softwareHospitals
|
|
|
+ * @Description将医院信息转换成树状结构
|
|
|
* @Return java.util.List<com.lantone.common.dto.GetUserHospitalsDTO>
|
|
|
*/
|
|
|
- private List<GetUserHospitalsDTO> transTreeData(Map<Long, List<GetUserHospitalsDTO>> softwareHospitalMap,List<GetUserHospitalsDTO> softwareHospitals) {
|
|
|
- if(softwareHospitalMap==null)return null;
|
|
|
+ private List<GetUserHospitalsDTO> transTreeData(Map<Long, List<GetUserHospitalsDTO>> softwareHospitalMap, List<GetUserHospitalsDTO> softwareHospitals) {
|
|
|
+ if (softwareHospitalMap == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
List<GetUserHospitalsDTO> out = new ArrayList<>();
|
|
|
- Set<Long> tempParents = new HashSet<>();
|
|
|
- Set<Long> parents = softwareHospitalMap.keySet();
|
|
|
- parents.stream().forEach(id->{
|
|
|
+ Set<Long> tempParents = new HashSet<>();
|
|
|
+ Set<Long> parents = softwareHospitalMap.keySet();
|
|
|
+ parents.stream().forEach(id -> {
|
|
|
softwareHospitals.stream().forEach(getUserHospitalsDTO -> {
|
|
|
- if(getUserHospitalsDTO.getHospitalId().equals(id)){
|
|
|
+ if (getUserHospitalsDTO.getHospitalId().equals(id)) {
|
|
|
tempParents.add(id);
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- parents.stream().forEach(parentId->{
|
|
|
- if(!tempParents.contains(parentId)){
|
|
|
+ parents.stream().forEach(parentId -> {
|
|
|
+ if (!tempParents.contains(parentId)) {
|
|
|
List<GetUserHospitalsDTO> hospitalListInfos = softwareHospitalMap.get(parentId);
|
|
|
- for(GetUserHospitalsDTO bean:hospitalListInfos){
|
|
|
- getSonHospital(bean,softwareHospitalMap);
|
|
|
+ for (GetUserHospitalsDTO bean : hospitalListInfos) {
|
|
|
+ getSonHospital(bean, softwareHospitalMap);
|
|
|
}
|
|
|
out.addAll(hospitalListInfos);
|
|
|
}
|