|
@@ -2,7 +2,6 @@ package com.lantone.security.facade;
|
|
|
|
|
|
import cn.hutool.crypto.digest.BCrypt;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -92,33 +91,36 @@ public class HospitalManagementFacade {
|
|
|
public boolean addHospital(AddHospitalVO addHospitalVO) {
|
|
|
|
|
|
//通过任务类型插入医院或科室
|
|
|
- if((HospitalTypeEnum.DEPT.getKey()+"").equals(addHospitalVO.getType())){
|
|
|
+ if ((HospitalTypeEnum.DEPT.getKey() + "").equals(addHospitalVO.getType())) {
|
|
|
Dept dept = new Dept();
|
|
|
BeanUtils.copyProperties(addHospitalVO, dept);
|
|
|
dept.setHospitalId(addHospitalVO.getParentId());
|
|
|
- dept.setCreator(SysUserUtils.getCurrentPrincipleId()+"");
|
|
|
+ dept.setCreator(SysUserUtils.getCurrentPrincipleId() + "");
|
|
|
dept.setGmtCreate(DateUtil.now());
|
|
|
- if(deptFacade.save(dept)){
|
|
|
+ //添加联系人手机号
|
|
|
+ dept.setLiaison(addHospitalVO.getAddHospitalUserVO().getName());
|
|
|
+ dept.setMobilePhone(addHospitalVO.getAddHospitalUserVO().getMobilePhone());
|
|
|
+ if (deptFacade.save(dept)) {
|
|
|
//如果选择病区的话保存不能过去和科室的关系
|
|
|
- if(addHospitalVO.getRegionId()!=null){
|
|
|
- RegionDept regionDept = new RegionDept();
|
|
|
- regionDept.setHospitalId(addHospitalVO.getParentId());
|
|
|
- regionDept.setRegionId(addHospitalVO.getRegionId());
|
|
|
- regionDept.setDeptId(dept.getId());
|
|
|
- if(!regionDeptFacade.save(regionDept)){
|
|
|
- Asserts.fail("病区和科室关系插入失败");
|
|
|
- }
|
|
|
- }
|
|
|
- //2.保存该组织的用户
|
|
|
- return saveUser(dept.getId(), addHospitalVO);
|
|
|
+ if (addHospitalVO.getRegionId() != null) {
|
|
|
+ RegionDept regionDept = new RegionDept();
|
|
|
+ regionDept.setHospitalId(addHospitalVO.getParentId());
|
|
|
+ regionDept.setRegionId(addHospitalVO.getRegionId());
|
|
|
+ regionDept.setDeptId(dept.getId());
|
|
|
+ if (!regionDeptFacade.save(regionDept)) {
|
|
|
+ Asserts.fail("病区和科室关系插入失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //2.保存该组织的用户(不支持创建管理员)
|
|
|
+ return true;
|
|
|
} else {
|
|
|
Asserts.fail("组织添加失败");
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//1.添加组织信息
|
|
|
Hospital hospital = new Hospital();
|
|
|
BeanUtils.copyProperties(addHospitalVO, hospital);
|
|
|
- hospital.setCreator(SysUserUtils.getCurrentPrincipleId()+"");
|
|
|
+ hospital.setCreator(SysUserUtils.getCurrentPrincipleId() + "");
|
|
|
hospital.setGmtCreate(DateUtil.now());
|
|
|
if (hospitalFacade.save(hospital)) {
|
|
|
//2.保存该组织的用户
|
|
@@ -144,9 +146,9 @@ public class HospitalManagementFacade {
|
|
|
addRoleVO.setRemark("ManagementRole");
|
|
|
addRoleVO.setStatus("1");
|
|
|
Long insertHospitalId = 0l;
|
|
|
- if((HospitalTypeEnum.DEPT.getKey()+"").equals(addHospitalVO.getType())){
|
|
|
+ if ((HospitalTypeEnum.DEPT.getKey() + "").equals(addHospitalVO.getType())) {
|
|
|
insertHospitalId = addHospitalVO.getParentId();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
insertHospitalId = hospitalId;
|
|
|
}
|
|
|
addRoleVO.setHospitalId(insertHospitalId);
|
|
@@ -166,7 +168,7 @@ public class HospitalManagementFacade {
|
|
|
addUserVO.setRemark("Administrators");
|
|
|
//用户与组织的关系(医院、科室)
|
|
|
AddHospitalTreeVO addHospitalTreeVO = new AddHospitalTreeVO();
|
|
|
- if((HospitalTypeEnum.DEPT.getKey()+"").equals(addHospitalVO.getType())){
|
|
|
+ if ((HospitalTypeEnum.DEPT.getKey() + "").equals(addHospitalVO.getType())) {
|
|
|
addHospitalTreeVO.setDepts(new ArrayList<>());
|
|
|
addHospitalTreeVO.getDepts().add(hospitalId);
|
|
|
addUserVO.setAddHospitalTreeVO(addHospitalTreeVO);
|
|
@@ -174,7 +176,7 @@ public class HospitalManagementFacade {
|
|
|
addHospitalTreeVO.setHospitals(new ArrayList<>());
|
|
|
addHospitalTreeVO.getHospitals().add(addHospitalVO.getParentId());
|
|
|
addUserVO.setAddHospitalTreeVO(addHospitalTreeVO);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
addHospitalTreeVO.setHospitals(new ArrayList<>());
|
|
|
addHospitalTreeVO.getHospitals().add(hospitalId);
|
|
|
addUserVO.setAddHospitalTreeVO(addHospitalTreeVO);
|
|
@@ -192,42 +194,50 @@ public class HospitalManagementFacade {
|
|
|
* @Description删除组织
|
|
|
* @Return boolean
|
|
|
*/
|
|
|
- public boolean deleteHospital(Long hospitalId) {
|
|
|
+ public boolean deleteHospital(Long hospitalId,String type) {
|
|
|
AtomicBoolean out = new AtomicBoolean(false);
|
|
|
- //1.获取该组织及其子组织
|
|
|
- List<Long> hospitals = hospitalFacade.getBaseMapper().getHospitalTreeInfo(hospitalId,null).stream()
|
|
|
- .map(GetHospitalTreeDTO::getHospitalId).collect(Collectors.toList());
|
|
|
- //2.删除这些组织的用户、角色
|
|
|
- if (ListUtil.isNotEmpty(hospitals)) {
|
|
|
- hospitals.forEach(id -> {
|
|
|
- //删除该组织角色
|
|
|
- if(roleFacade.update(new UpdateWrapper<Role>()
|
|
|
- .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
- .in("id", roleFacade.list(new QueryWrapper<Role>()
|
|
|
- .eq("hospital_id",id))
|
|
|
- .stream().map(Role::getId).collect(Collectors.toList())))){
|
|
|
-
|
|
|
- //删除组织用户
|
|
|
- if(userFacade.update(new UpdateWrapper<User>()
|
|
|
+ //禁用科室
|
|
|
+ if ((HospitalTypeEnum.DEPT.getKey() + "").equals(type)) {
|
|
|
+ return deptFacade.update(new UpdateWrapper<Dept>()
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .in("id",hospitalId));
|
|
|
+ }else {
|
|
|
+ //1.获取该组织及其子组织
|
|
|
+ List<Long> hospitals = hospitalFacade.getBaseMapper().getHospitalTreeInfo(hospitalId, null).stream()
|
|
|
+ .map(GetHospitalTreeDTO::getHospitalId).collect(Collectors.toList());
|
|
|
+ //2.删除这些组织的用户、角色
|
|
|
+ if (ListUtil.isNotEmpty(hospitals)) {
|
|
|
+ hospitals.forEach(id -> {
|
|
|
+ //删除该组织角色
|
|
|
+ if (roleFacade.update(new UpdateWrapper<Role>()
|
|
|
.set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
- .in("id", hospitalUserFacade.list(new QueryWrapper<HospitalUser>()
|
|
|
- .eq("hospital_id",id))
|
|
|
- .stream().map(HospitalUser::getUserId).collect(Collectors.toList())))){
|
|
|
- //删除组织
|
|
|
- out.set(hospitalFacade.update(new UpdateWrapper<Hospital>()
|
|
|
- .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
- .eq("id", id)));
|
|
|
- }else {
|
|
|
- Asserts.fail("组织用户删除失败");
|
|
|
+ .in("id", roleFacade.list(new QueryWrapper<Role>()
|
|
|
+ .eq("hospital_id", id))
|
|
|
+ .stream().map(Role::getId).collect(Collectors.toList())))) {
|
|
|
+
|
|
|
+ //删除组织用户
|
|
|
+ if (userFacade.update(new UpdateWrapper<User>()
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .in("id", hospitalUserFacade.list(new QueryWrapper<HospitalUser>()
|
|
|
+ .eq("hospital_id", id))
|
|
|
+ .stream().map(HospitalUser::getUserId).collect(Collectors.toList())))) {
|
|
|
+ //删除组织
|
|
|
+ out.set(hospitalFacade.update(new UpdateWrapper<Hospital>()
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .eq("id", id)));
|
|
|
+ } else {
|
|
|
+ Asserts.fail("组织用户删除失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Asserts.fail("组织角色删除失败");
|
|
|
}
|
|
|
- }else {
|
|
|
- Asserts.fail("组织角色删除失败");
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
- }else {
|
|
|
- Asserts.fail("要删除的组织不存在,请刷新重试~");
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ Asserts.fail("要删除的组织不存在,请刷新重试~");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return out.get();
|
|
|
}
|
|
|
|
|
@@ -239,16 +249,24 @@ public class HospitalManagementFacade {
|
|
|
private boolean deleteHUserAndRole(Long hospitalId) {
|
|
|
|
|
|
//1.获取用户id
|
|
|
- List<Long> userIds = hospitalUserFacade.getBaseMapper().getHospitalUserById(hospitalId,hospitalFacade.getById(hospitalId).getName()+"管理员");
|
|
|
- if(ListUtil.isEmpty(userIds)){
|
|
|
+ List<Long> userIds = hospitalUserFacade.getBaseMapper().getHospitalUserById(hospitalId, hospitalFacade.getById(hospitalId).getName() + "管理员");
|
|
|
+ if (ListUtil.isEmpty(userIds)) {
|
|
|
Asserts.fail("该组织的管理用户不存在,请联系管理员~");
|
|
|
}
|
|
|
- if(userIds.size()>1){
|
|
|
+ if (userIds.size() > 1) {
|
|
|
Asserts.fail("该组织的管理用户存在多个,请联系管理员~");
|
|
|
}
|
|
|
//2.获取角色id
|
|
|
- Long roleId = userRoleFacade.getBaseMapper().getUserRoleById(userIds.get(0));
|
|
|
- if (roleManagementFacade.deleteRole(roleId)) {
|
|
|
+ List<Long> roleIds = userRoleFacade.getBaseMapper().getUserRoleById(userIds.get(0));
|
|
|
+ if (ListUtil.isEmpty(roleIds)) {
|
|
|
+ Asserts.fail("要修改组织的管理角色不存在,请联系管理员~");
|
|
|
+ }
|
|
|
+ //通过角色id删除原来角色相关管理关系
|
|
|
+ AtomicBoolean deleteFlag = new AtomicBoolean(false);
|
|
|
+ roleIds.stream().forEach(roleId -> {
|
|
|
+ deleteFlag.set(roleManagementFacade.deleteRole(roleId));
|
|
|
+ });
|
|
|
+ if (deleteFlag.get()) {
|
|
|
//3.删除用户
|
|
|
return userManagementFacade.deleteUser(userIds.get(0));
|
|
|
} else {
|
|
@@ -264,18 +282,56 @@ public class HospitalManagementFacade {
|
|
|
* @Return boolean
|
|
|
*/
|
|
|
public boolean updateHospital(UpdateHospitalVO updateHospitalVO) {
|
|
|
- //1.删除该组织关联的管理用户以及角色
|
|
|
- if (deleteHUserAndRole(updateHospitalVO.getId())) {
|
|
|
- Hospital hospital = new Hospital();
|
|
|
- BeanUtils.copyProperties(updateHospitalVO, hospital);
|
|
|
- //2.修改组织信息
|
|
|
- if (hospitalFacade.updateById(hospital)) {
|
|
|
- //3.创建组织与管理用户、角色
|
|
|
- AddHospitalVO addHospitalVO = new AddHospitalVO();
|
|
|
- BeanUtils.copyProperties(updateHospitalVO, addHospitalVO);
|
|
|
- addHospitalVO.setAddHospitalUserVO(updateHospitalVO.getAddHospitalUserVO());
|
|
|
- addHospitalVO.setSoftwares(updateHospitalVO.getSoftwares());
|
|
|
- return saveUser(updateHospitalVO.getId(), addHospitalVO);
|
|
|
+ //修改科室信息
|
|
|
+ if ((HospitalTypeEnum.DEPT.getKey() + "").equals(updateHospitalVO.getType())) {
|
|
|
+ boolean updateFlag = true;
|
|
|
+ //1.删除原来科室和病区的管理关系
|
|
|
+ List<Long> ids = regionDeptFacade.list(new QueryWrapper<RegionDept>()
|
|
|
+ .eq("dept_id", updateHospitalVO.getId())
|
|
|
+ .eq("hospital_id", updateHospitalVO.getParentId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())).stream().map(RegionDept::getId).collect(Collectors.toList());
|
|
|
+ if (ListUtil.isNotEmpty(ids)) {
|
|
|
+ updateFlag = regionDeptFacade.removeByIds(ids);
|
|
|
+ }
|
|
|
+ //2.修改科室
|
|
|
+ if (updateFlag) {
|
|
|
+ Dept dept = new Dept();
|
|
|
+ BeanUtils.copyProperties(updateHospitalVO, dept);
|
|
|
+ dept.setHospitalId(updateHospitalVO.getParentId());
|
|
|
+ //添加联系人手机号
|
|
|
+ dept.setLiaison(updateHospitalVO.getAddHospitalUserVO().getName());
|
|
|
+ dept.setMobilePhone(updateHospitalVO.getAddHospitalUserVO().getMobilePhone());
|
|
|
+ updateFlag = deptFacade.updateById(dept);
|
|
|
+ //3.如果选择病区的话保存病区和科室的关系
|
|
|
+ if (updateHospitalVO.getRegionId() != null && updateFlag) {
|
|
|
+ RegionDept regionDept = new RegionDept();
|
|
|
+ regionDept.setHospitalId(updateHospitalVO.getParentId());
|
|
|
+ regionDept.setRegionId(updateHospitalVO.getRegionId());
|
|
|
+ regionDept.setDeptId(updateHospitalVO.getId());
|
|
|
+ if (!regionDeptFacade.save(regionDept)) {
|
|
|
+ Asserts.fail("病区和科室关系插入失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return updateFlag;
|
|
|
+ } else {
|
|
|
+ Asserts.fail("原病区和科室的关联关系删除失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //1.删除该组织关联的管理用户以及角色
|
|
|
+ if (deleteHUserAndRole(updateHospitalVO.getId())) {
|
|
|
+ Hospital hospital = new Hospital();
|
|
|
+ BeanUtils.copyProperties(updateHospitalVO, hospital);
|
|
|
+ //2.修改组织信息
|
|
|
+ if (hospitalFacade.updateById(hospital)) {
|
|
|
+ //3.创建组织与管理用户、角色
|
|
|
+ AddHospitalVO addHospitalVO = new AddHospitalVO();
|
|
|
+ BeanUtils.copyProperties(updateHospitalVO, addHospitalVO);
|
|
|
+ addHospitalVO.setAddHospitalUserVO(updateHospitalVO.getAddHospitalUserVO());
|
|
|
+ addHospitalVO.setSoftwares(updateHospitalVO.getSoftwares());
|
|
|
+ return saveUser(updateHospitalVO.getId(), addHospitalVO);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Asserts.fail("原组织管理用户信息清除失败,请联系管理员");
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
@@ -287,45 +343,55 @@ public class HospitalManagementFacade {
|
|
|
* @Description禁用启用组织
|
|
|
* @Return boolean
|
|
|
*/
|
|
|
- public boolean disableHospital(Long hospitalId, String status) {
|
|
|
+ public boolean disableHospital(Long hospitalId, String status,String type) {
|
|
|
AtomicBoolean out = new AtomicBoolean(false);
|
|
|
String selectStatus = "0";
|
|
|
- if(StatusEnum.Enable.getKey().equals(status)){
|
|
|
+ if (StatusEnum.Enable.getKey().equals(status)) {
|
|
|
selectStatus = StatusEnum.Disable.getKey();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
selectStatus = StatusEnum.Enable.getKey();
|
|
|
}
|
|
|
- //1.获取该组织及其子组织
|
|
|
- List<Long> hospitals = hospitalFacade.getBaseMapper().getHospitalTreeInfo(hospitalId,selectStatus).stream()
|
|
|
- .map(GetHospitalTreeDTO::getHospitalId).collect(Collectors.toList());
|
|
|
- //2.禁用这些组织的用户、角色
|
|
|
- if (ListUtil.isNotEmpty(hospitals)) {
|
|
|
- hospitals.forEach(id -> {
|
|
|
- //禁用该组织角色
|
|
|
- if(roleFacade.update(new UpdateWrapper<Role>()
|
|
|
+ //禁用科室
|
|
|
+ if ((HospitalTypeEnum.DEPT.getKey() + "").equals(type)) {
|
|
|
+ return deptFacade.update(new UpdateWrapper<Dept>()
|
|
|
.set("status", status)
|
|
|
- .in("id", roleFacade.list(new QueryWrapper<Role>()
|
|
|
- .eq("hospital_id",id))
|
|
|
- .stream().map(Role::getId).collect(Collectors.toList())))){
|
|
|
+ .in("id",hospitalId));
|
|
|
+ }else {
|
|
|
+ //1.获取该组织及其子组织
|
|
|
+ List<Long> hospitals = hospitalFacade.getBaseMapper().getHospitalTreeInfo(hospitalId, selectStatus).stream()
|
|
|
+ .map(GetHospitalTreeDTO::getHospitalId).collect(Collectors.toList());
|
|
|
+ //2.禁用这些组织的用户、角色
|
|
|
+ if (ListUtil.isNotEmpty(hospitals)) {
|
|
|
+ hospitals.forEach(id -> {
|
|
|
+ //禁用该组织角色
|
|
|
+ if (roleFacade.update(new UpdateWrapper<Role>()
|
|
|
+ .set("status", status)
|
|
|
+ .in("id", roleFacade.list(new QueryWrapper<Role>()
|
|
|
+ .eq("hospital_id", id))
|
|
|
+ .stream().map(Role::getId).collect(Collectors.toList())))) {
|
|
|
|
|
|
- //删除组织用户
|
|
|
- if(userFacade.update(new UpdateWrapper<User>()
|
|
|
- .set("status",status)
|
|
|
- .in("id", hospitalUserFacade.list(new QueryWrapper<HospitalUser>()
|
|
|
- .eq("hospital_id",id))
|
|
|
- .stream().map(HospitalUser::getUserId).collect(Collectors.toList())))){
|
|
|
- //删除组织
|
|
|
- out.set(hospitalFacade.update(new UpdateWrapper<Hospital>()
|
|
|
- .set("status", status).eq("id", id)));
|
|
|
- }else {
|
|
|
- Asserts.fail("组织用户禁用失败");
|
|
|
+ //禁用组织用户
|
|
|
+ if (userFacade.update(new UpdateWrapper<User>()
|
|
|
+ .set("status", status)
|
|
|
+ .in("id", hospitalUserFacade.list(new QueryWrapper<HospitalUser>()
|
|
|
+ .eq("hospital_id", id))
|
|
|
+ .stream().map(HospitalUser::getUserId).collect(Collectors.toList())))) {
|
|
|
+ //删除组织
|
|
|
+ out.set(hospitalFacade.update(new UpdateWrapper<Hospital>()
|
|
|
+ .set("status", status).eq("id", id)));
|
|
|
+ } else {
|
|
|
+ Asserts.fail("组织用户禁用失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Asserts.fail("组织角色禁用失败");
|
|
|
}
|
|
|
- }else {
|
|
|
- Asserts.fail("组织角色禁用失败");
|
|
|
- }
|
|
|
|
|
|
- });
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ Asserts.fail("该组织不存在,请联系管理员");
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
return out.get();
|
|
|
}
|
|
|
|
|
@@ -334,42 +400,53 @@ public class HospitalManagementFacade {
|
|
|
* @Description通过组织id获取该组织及用户详情
|
|
|
* @Return com.lantone.common.dto.GetHospitalByIdDTO
|
|
|
*/
|
|
|
- public GetHospitalByIdDTO getHospitalById(Long hospitalId,int type) {
|
|
|
+ public GetHospitalByIdDTO getHospitalById(Long hospitalId, int type) {
|
|
|
GetHospitalByIdDTO getHospitalByIdDTO = new GetHospitalByIdDTO();
|
|
|
- Long hID = null;
|
|
|
- //1.获取医院或科室详情
|
|
|
- if(HospitalTypeEnum.DEPT.getKey()==type){
|
|
|
+ //1.获取科室详情
|
|
|
+ if (HospitalTypeEnum.DEPT.getKey() == type) {
|
|
|
Dept dept = deptFacade.getById(hospitalId);
|
|
|
- if(dept==null){
|
|
|
+ if (dept == null) {
|
|
|
Asserts.fail("该组织不存在,请联系管理员~");
|
|
|
}
|
|
|
BeanUtils.copyProperties(dept, getHospitalByIdDTO);
|
|
|
getHospitalByIdDTO.setParentId(dept.getHospitalId());
|
|
|
- hID = dept.getHospitalId();
|
|
|
- }else {
|
|
|
+ //添加联系人、联系电话
|
|
|
+ GetHospitalUserDTO getHospitalUserDTO = new GetHospitalUserDTO();
|
|
|
+ getHospitalUserDTO.setName(dept.getLiaison());
|
|
|
+ getHospitalUserDTO.setMobilePhone(dept.getMobilePhone());
|
|
|
+ getHospitalByIdDTO.setGetHospitalUserDTO(getHospitalUserDTO);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //1.获取医院详情
|
|
|
Hospital hospital = hospitalFacade.getById(hospitalId);
|
|
|
- if(hospital==null){
|
|
|
+ if (hospital == null) {
|
|
|
Asserts.fail("该组织不存在,请联系管理员~");
|
|
|
}
|
|
|
BeanUtils.copyProperties(hospital, getHospitalByIdDTO);
|
|
|
- hID = hospitalId;
|
|
|
+ //2.获取该医院的管理用户详情
|
|
|
+ List<Long> userIds = hospitalUserFacade.getBaseMapper().getHospitalUserById(hospitalId, getHospitalByIdDTO.getName() + "管理员");
|
|
|
+ if (ListUtil.isEmpty(userIds)) {
|
|
|
+ Asserts.fail("该组织的管理用户不存在,请联系管理员~");
|
|
|
+ }
|
|
|
+ if (userIds.size() > 1) {
|
|
|
+ Asserts.fail("该组织的管理用户存在多个,请联系管理员~");
|
|
|
+ }
|
|
|
+ User user = userFacade.getById(userIds.get(0));
|
|
|
+ GetHospitalUserDTO getHospitalUserDTO = new GetHospitalUserDTO();
|
|
|
+ user.setPassword(user.getPassword());
|
|
|
+ BeanUtils.copyProperties(user, getHospitalUserDTO);
|
|
|
+ getHospitalByIdDTO.setGetHospitalUserDTO(getHospitalUserDTO);
|
|
|
+ //3.获取管理角色相关信息(新增组织查询时type为0)
|
|
|
+ List<Long> roleIds = userRoleFacade.getBaseMapper().getUserRoleById(user.getId());
|
|
|
+ if (ListUtil.isEmpty(roleIds)) {
|
|
|
+ Asserts.fail("该组织的管理角色不存在,请联系管理员~");
|
|
|
+ }
|
|
|
+ if (roleIds.size() > 1) {
|
|
|
+ Asserts.fail("该组织的管理角色存在多个,请联系管理员~");
|
|
|
+ }
|
|
|
+ getHospitalByIdDTO.setGetRoleDTO(roleManagementFacade.getRoleById(roleIds.get(0), "0"));
|
|
|
}
|
|
|
getHospitalByIdDTO.setParentName(hospitalFacade.getById(getHospitalByIdDTO.getParentId()).getName());
|
|
|
- //2.获取该医院的管理用户详情
|
|
|
- List<Long> userIds = hospitalUserFacade.getBaseMapper().getHospitalUserById(hID,getHospitalByIdDTO.getName()+"管理员");
|
|
|
- if(ListUtil.isEmpty(userIds)){
|
|
|
- Asserts.fail("该组织的管理用户不存在,请联系管理员~");
|
|
|
- }
|
|
|
- if(userIds.size()>1){
|
|
|
- Asserts.fail("该组织的管理用户存在多个,请联系管理员~");
|
|
|
- }
|
|
|
- User user = userFacade.getById(userIds.get(0));
|
|
|
- GetHospitalUserDTO getHospitalUserDTO = new GetHospitalUserDTO();
|
|
|
- BeanUtils.copyProperties(user, getHospitalUserDTO);
|
|
|
- getHospitalByIdDTO.setGetHospitalUserDTO(getHospitalUserDTO);
|
|
|
- //3.获取管理角色相关信息(新增组织查询时type为0)
|
|
|
- getHospitalByIdDTO.setGetRoleDTO(roleManagementFacade.getRoleById(userRoleFacade.getBaseMapper()
|
|
|
- .getUserRoleById(user.getId()),"0"));
|
|
|
return getHospitalByIdDTO;
|
|
|
}
|
|
|
|
|
@@ -380,13 +457,13 @@ public class HospitalManagementFacade {
|
|
|
*/
|
|
|
public Map<String, Object> getManagerBoxInfo() {
|
|
|
Map<String, Object> outMap = new HashMap<>();
|
|
|
- Map<String, List<GetDictionaryInfoByTypeDTO>> dicMapObj= dictionaryInfoFacade.getDicMapObj(ReturnTypeEnum.INTERFACE.getKey(),
|
|
|
- Lists.newArrayList(DictionaryEnum.TITLE.getKey()+"",
|
|
|
- DictionaryEnum.STATUS.getKey()+"",
|
|
|
- DictionaryEnum.HOSPITAL_TYPE.getKey()+"",
|
|
|
- DictionaryEnum.DATA_AUTH.getKey()+""));
|
|
|
+ Map<String, List<GetDictionaryInfoByTypeDTO>> dicMapObj = dictionaryInfoFacade.getDicMapObj(ReturnTypeEnum.INTERFACE.getKey(),
|
|
|
+ Lists.newArrayList(DictionaryEnum.TITLE.getKey() + "",
|
|
|
+ DictionaryEnum.STATUS.getKey() + "",
|
|
|
+ DictionaryEnum.HOSPITAL_TYPE.getKey() + "",
|
|
|
+ DictionaryEnum.DATA_AUTH.getKey() + ""));
|
|
|
outMap.putAll(dicMapObj);
|
|
|
- outMap.remove(DictionaryEnum.HOSPITAL_TYPE.getKey()+"");
|
|
|
+ outMap.remove(DictionaryEnum.HOSPITAL_TYPE.getKey() + "");
|
|
|
//1.获取当前用户的组织类型
|
|
|
int hospitalType = -1;
|
|
|
Hospital hospital = hospitalFacade.getById(SysUserUtils.getCurrentHospitalId());
|
|
@@ -404,11 +481,11 @@ public class HospitalManagementFacade {
|
|
|
BeanUtils.copyProperties(region, downBoxRegionDTO);
|
|
|
downBoxRegions.add(downBoxRegionDTO);
|
|
|
});
|
|
|
- outMap.put(DictionaryEnum.REGION.getKey()+"", downBoxRegions);
|
|
|
+ outMap.put(DictionaryEnum.REGION.getKey() + "", downBoxRegions);
|
|
|
} else {
|
|
|
- String type = dicMapObj.get(DictionaryEnum.HOSPITAL_TYPE.getKey()+"").get(hospitalType).getVal();
|
|
|
- if(StringUtil.isNotEmpty(type)){
|
|
|
- outMap.put(DictionaryEnum.HOSPITAL_TYPE.getKey()+"", JSONArray.parseArray(type));
|
|
|
+ String type = dicMapObj.get(DictionaryEnum.HOSPITAL_TYPE.getKey() + "").get(hospitalType).getVal();
|
|
|
+ if (StringUtil.isNotEmpty(type)) {
|
|
|
+ outMap.put(DictionaryEnum.HOSPITAL_TYPE.getKey() + "", JSONArray.parseArray(type));
|
|
|
}
|
|
|
}
|
|
|
return outMap;
|
|
@@ -438,7 +515,7 @@ public class HospitalManagementFacade {
|
|
|
//添加根目录标志
|
|
|
getHospitalListInfoDTO.setRootFlag(true);
|
|
|
getHospitalListInfoDTO.setTypeName(HospitalTypeEnum.getName(hospitalType));
|
|
|
- if(StringUtil.isNotEmpty(getHospitalListInfoDTO.getStatus())){
|
|
|
+ if (StringUtil.isNotEmpty(getHospitalListInfoDTO.getStatus())) {
|
|
|
getHospitalListInfoDTO.setStatusName(StatusEnum.getName(Integer.parseInt(getHospitalListInfoDTO.getStatus())));
|
|
|
}
|
|
|
getHospitalListInfoDTO.setDepts(deptFacade.getBaseMapper().getDeptRegion(getHospitalListInfoVO));
|