|
@@ -30,6 +30,7 @@ import com.lantone.common.vo.AddUserVO;
|
|
|
import com.lantone.common.vo.GetUserPageVO;
|
|
|
import com.lantone.common.vo.LoginVO;
|
|
|
import com.lantone.common.vo.UpdateUserVO;
|
|
|
+import com.lantone.dblayermbg.entity.Dept;
|
|
|
import com.lantone.dblayermbg.entity.DeptUser;
|
|
|
import com.lantone.dblayermbg.entity.Doctor;
|
|
|
import com.lantone.dblayermbg.entity.Hospital;
|
|
@@ -342,6 +343,16 @@ public class UserManagementFacade {
|
|
|
if (ListUtil.isEmpty(addHospitalTreeVO.getDepts()) && ListUtil.isEmpty(addHospitalTreeVO.getHospitals())) {
|
|
|
Asserts.fail("用户关联的医院或科室都为空");
|
|
|
}
|
|
|
+ //如果选择科室没有添加科室对应的医院
|
|
|
+ addHospitalTreeVO.getHospitals().addAll(deptFacade.list(new QueryWrapper<Dept>()
|
|
|
+ .in("id",addHospitalTreeVO.getDepts())
|
|
|
+ .eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
+ .eq("status",StatusEnum.Enable.getKey())).stream().map(Dept::getHospitalId).collect(Collectors.toList()));
|
|
|
+ //去重
|
|
|
+ Set<Long> hospitalSet = new HashSet<>(addHospitalTreeVO.getHospitals());
|
|
|
+ List<Long> hospitals = new ArrayList<>(hospitalSet);
|
|
|
+ addHospitalTreeVO.setHospitals(hospitals);
|
|
|
+
|
|
|
//插入用户和科室的关系(没有科室信息默认为全院)
|
|
|
if (ListUtil.isNotEmpty(addHospitalTreeVO.getDepts())) {
|
|
|
addHospitalTreeVO.getDepts().stream().forEach(deptID -> {
|
|
@@ -534,22 +545,9 @@ public class UserManagementFacade {
|
|
|
* @param hospitalMap 医院集
|
|
|
*/
|
|
|
public void getSonHospital(GetHospitalTreeDTO hospital, Map<Long, List<GetHospitalTreeDTO>> hospitalMap, List<Long> hospitals, List<GetUserHospitalDeptDTO> userHospitalDepts) {
|
|
|
- //通过查询用户所在的医院集添加关联关系
|
|
|
- if (hospitals.contains(hospital.getHospitalId())) {
|
|
|
- hospital.setRelation(RelationEnum.Y.getName());
|
|
|
- }
|
|
|
List<GetHospitalTreeDTO> hospitalTreeDTOS = hospitalMap.get(hospital.getHospitalId());
|
|
|
if (ListUtil.isNotEmpty(hospitalTreeDTOS)) {
|
|
|
hospital.setChildren(hospitalTreeDTOS);
|
|
|
- //获取该医院的子集如果包含hospitals说明已关联
|
|
|
- List<Long> beanHospitals = hospitalFacade.getBaseMapper().getHospitalTreeInfo(hospital.getHospitalId(),StatusEnum.Enable.getKey())
|
|
|
- .stream().map(GetHospitalTreeDTO::getHospitalId).collect(Collectors.toList());
|
|
|
- hospitals.stream().forEach(id->{
|
|
|
- if(beanHospitals.contains(id)){
|
|
|
- hospital.setRelation(RelationEnum.Y.getName());
|
|
|
- return;
|
|
|
- }
|
|
|
- });
|
|
|
getHospitalDeptInfo(hospitalMap, hospitals, userHospitalDepts, hospitalTreeDTOS);
|
|
|
}
|
|
|
}
|
|
@@ -574,8 +572,10 @@ public class UserManagementFacade {
|
|
|
getDeptTreeDTOList.stream().forEach(getDeptTreeDTO -> {
|
|
|
if (depts.contains(getDeptTreeDTO.getDeptId())) {
|
|
|
getDeptTreeDTO.setRelation(RelationEnum.Y.getName());
|
|
|
+ //如果只有医院没有科室则是医院全选
|
|
|
}else if(hospitals.contains(bean.getHospitalId())&&!dHospitals.contains(bean.getHospitalId())){
|
|
|
getDeptTreeDTO.setRelation(RelationEnum.Y.getName());
|
|
|
+ bean.setRelation(RelationEnum.Y.getName());
|
|
|
}
|
|
|
});
|
|
|
bean.setDepts(getDeptTreeDTOList);
|