| | |
| | | package com.sinata.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.sinata.common.constant.CacheConstants; |
| | | import com.sinata.common.core.domain.entity.SysUser; |
| | | import com.sinata.common.entity.PageDTO; |
| | | import com.sinata.common.exception.ServiceException; |
| | | import com.sinata.common.utils.BeanUtils; |
| | |
| | | } |
| | | return root; |
| | | } |
| | | @Override |
| | | public List<SysDepartmentVO> getRegionTree1(String keyword) { |
| | | SysUser sysUser = SecurityUtils.getLoginUser().getUser(); |
| | | |
| | | List<SysDepartmentVO> root = new ArrayList<>(); |
| | | SysDepartment sysDepartment = this.baseMapper.selectById(sysUser.getDepartmentId()); |
| | | SysDepartment currentDepartment = this.baseMapper.selectById(sysDepartment.getParentId()); |
| | | if (Objects.isNull(currentDepartment)) { |
| | | return root; |
| | | } |
| | | if (!currentDepartment.getOrgType().equals(DepartmentEnum.REGION.getCode())) { |
| | | return root; |
| | | } |
| | | Map<Long, List<SysDepartment>> childrenMap = getChildrenDepartmentByOrgType(currentDepartment, Collections.singletonList(DepartmentEnum.REGION.getCode())); |
| | | SysDepartmentVO sysDepartmentVO = fillChildrenTreeModel(currentDepartment, childrenMap); |
| | | root.add(sysDepartmentVO); |
| | | if (StringUtils.isNotBlank(keyword)) { |
| | | treeMatch(root, keyword); |
| | | } |
| | | return root; |
| | | } |
| | | public List<SysDepartmentVO> getRegionTree2(String keyword) { |
| | | |
| | | List<SysDepartmentVO> root = new ArrayList<>(); |
| | | SysDepartment currentDepartment = this.baseMapper.selectById(-1); |
| | | if (Objects.isNull(currentDepartment)) { |
| | | return root; |
| | | } |
| | | if (!currentDepartment.getOrgType().equals(DepartmentEnum.REGION.getCode())) { |
| | | return root; |
| | | } |
| | | Map<Long, List<SysDepartment>> childrenMap = getChildrenDepartmentByOrgType(currentDepartment, Collections.singletonList(DepartmentEnum.REGION.getCode())); |
| | | SysDepartmentVO sysDepartmentVO = fillChildrenTreeModel(currentDepartment, childrenMap); |
| | | root.add(sysDepartmentVO); |
| | | if (StringUtils.isNotBlank(keyword)) { |
| | | treeMatch(root, keyword); |
| | | } |
| | | return root; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前登录用户所属区域 |
| | |
| | | SysDepartment department = BeanUtils.copyBean(dto, SysDepartment.class); |
| | | //获取部门树编码 |
| | | department.setOrgType(DepartmentEnum.REGION.getCode()); |
| | | department.setTreeCode(getTreeCode(dto.getParentId())); |
| | | department.setTreeCode(generateTreeCode(dto.getParentId())); |
| | | department.setOrgCode(getOrgCode(dto.getParentId(), DepartmentEnum.REGION.getCode())); |
| | | save(department); |
| | | } |
| | |
| | | SysDepartment sysDepartment = getById(dto.getId()); |
| | | if (!dto.getParentId().equals(sysDepartment.getParentId())) { |
| | | //获取部门树编码 |
| | | department.setTreeCode(getTreeCode(dto.getParentId())); |
| | | department.setTreeCode(generateTreeCode(dto.getParentId())); |
| | | } |
| | | updateById(department); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String getTreeCode(Long parentId) { |
| | | public String generateTreeCode(Long parentId) { |
| | | |
| | | String treeId; |
| | | String preTreeCode = ""; |
| | |
| | | */ |
| | | @Override |
| | | public PageDTO<MedicalInstitutionVO> pageMedicalList(DepartmentQuery query) { |
| | | String treeCode = getTreeCodeByDepartmentId(query.getDepartmentId()); |
| | | String treeCode; |
| | | if (Objects.isNull(query.getDepartmentId())) { |
| | | SysDepartment department = getMyDepartment(); |
| | | treeCode = department.getTreeCode(); |
| | | } else { |
| | | SysDepartment department = getById(query.getDepartmentId()); |
| | | //如果是处置单位,则获取父级部门 |
| | | if (department.getOrgType().equals(DepartmentEnum.DISPOSAL_UNIT.getCode())) { |
| | | department = getDepartmentByParentId(department.getParentId()); |
| | | } |
| | | treeCode = department.getTreeCode(); |
| | | } |
| | | if (StringUtils.isBlank(treeCode)) { |
| | | return PageDTO.empty(0L, 0L); |
| | | } |
| | |
| | | throw new ServiceException("医疗机构已存在"); |
| | | } |
| | | SysDepartment department = BeanUtils.copyBean(dto, SysDepartment.class); |
| | | department.setTreeCode(getTreeCode(parent.getId())); |
| | | department.setTreeCode(generateTreeCode(parent.getId())); |
| | | department.setOrgCode(getOrgCode(parent.getId(), DepartmentEnum.MEDICAL_INSTITUTION.getCode())); |
| | | department.setOrgType(DepartmentEnum.MEDICAL_INSTITUTION.getCode()); |
| | | //查询父级完整区域 |
| | |
| | | sysDepartmentInfoService.save(sysDepartmentInfo); |
| | | } |
| | | |
| | | /** |
| | | * 根据父级区域id查询处置单位列表 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<DisposalUnitVO> getDisposalUnitListByParentId(Long id) { |
| | | List<DisposalUnitVO> disposalUnitList = null; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取完成区域 |
| | | * 获取完整区域 |
| | | * |
| | | * @param department |
| | | * @return |
| | |
| | | } |
| | | SysDepartment department = BeanUtils.copyBean(dto, SysDepartment.class); |
| | | if (!department.getParentId().equals(sysDepartment.getParentId())) { |
| | | department.setTreeCode(getTreeCode(parent.getId())); |
| | | department.setTreeCode(generateTreeCode(parent.getId())); |
| | | //查询父级完整区域 |
| | | String region = getRegionName(parent); |
| | | department.setRegion(region); |
| | |
| | | throw new ServiceException("处置单位已存在"); |
| | | } |
| | | SysDepartment department = BeanUtils.copyBean(dto, SysDepartment.class); |
| | | department.setTreeCode(getTreeCode(parent.getId())); |
| | | department.setTreeCode(generateTreeCode(parent.getId())); |
| | | department.setOrgCode(getOrgCode(parent.getId(), DepartmentEnum.DISPOSAL_UNIT.getCode())); |
| | | department.setOrgType(DepartmentEnum.DISPOSAL_UNIT.getCode()); |
| | | //查询父级完整区域 |
| | |
| | | SysDepartment department = BeanUtils.copyBean(dto, SysDepartment.class); |
| | | |
| | | if (!department.getParentId().equals(sysDepartment.getParentId())) { |
| | | department.setTreeCode(getTreeCode(parent.getId())); |
| | | department.setTreeCode(generateTreeCode(parent.getId())); |
| | | //查询父级完整区域 |
| | | String region = getRegionName(parent); |
| | | department.setRegion(region); |
| | |
| | | .like(StringUtils.isNotEmpty(query.getDepartmentName()), SysDepartment::getDepartmentName, query.getDepartmentName()) |
| | | .like(StringUtils.isNotBlank(query.getContactPerson()), SysDepartment::getContactPerson, query.getContactPerson()) |
| | | .like(StringUtils.isNotBlank(query.getContactPhone()), SysDepartment::getContactPhone, query.getContactPhone()) |
| | | .eq(SysDepartment::getOrgType, DepartmentEnum.REGULATORY_UNIT.getCode()) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | return PageDTO.of(page, RegulatoryUnitVO.class); |
| | | } |
| | |
| | | throw new ServiceException("监管单位已存在"); |
| | | } |
| | | SysDepartment department = BeanUtils.copyBean(dto, SysDepartment.class); |
| | | department.setTreeCode(getTreeCode(parent.getId())); |
| | | department.setTreeCode(generateTreeCode(parent.getId())); |
| | | department.setOrgCode(getOrgCode(parent.getId(), DepartmentEnum.REGULATORY_UNIT.getCode())); |
| | | department.setOrgType(DepartmentEnum.REGULATORY_UNIT.getCode()); |
| | | //查询父级完整区域 |
| | |
| | | SysDepartment department = BeanUtils.copyBean(dto, SysDepartment.class); |
| | | |
| | | if (!department.getParentId().equals(sysDepartment.getParentId())) { |
| | | department.setTreeCode(getTreeCode(parent.getId())); |
| | | department.setTreeCode(generateTreeCode(parent.getId())); |
| | | //查询父级完整区域 |
| | | String region = getRegionName(parent); |
| | | department.setRegion(region); |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 路线关联医院列表 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<MedicalInstitutionVO> getHospitalListByRouteId(Long id) { |
| | | return baseMapper.getHospitalListByRouteId(id); |
| | | } |
| | | } |