医院园区查询

This commit is contained in:
zhangheng 2024-03-26 10:35:53 +08:00
parent bdc1b53cb2
commit d646a62680
5 changed files with 108 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.dto.agency.HospitalDTO;
import com.xinelu.manage.service.agency.IAgencyService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
@ -144,4 +145,9 @@ public class AgencyController extends BaseController {
List<Agency> list = util.importExcel(file.getInputStream());
return agencyService.insertAgencyImportList(list);
}
@GetMapping("/getAgencyList")
public AjaxResult getAgencyList(HospitalDTO hospitalDTO) {
return agencyService.getAgencyList(hospitalDTO);
}
}

View File

@ -0,0 +1,27 @@
package com.xinelu.manage.dto.agency;
import lombok.Data;
@Data
public class HospitalDTO {
/**
* 类型
*/
private String nodeType;
/**
* 医院id
*/
private Long hospitalId;
/**
* 园区id
*/
private Long campusId;
/**
* 科室id
*/
private Long departmentId;
}

View File

@ -2,6 +2,7 @@ package com.xinelu.manage.service.agency;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.dto.agency.HospitalDTO;
import com.xinelu.manage.vo.agency.AgencyTreeVO;
import com.xinelu.manage.vo.agency.AgencyVO;
@ -94,4 +95,6 @@ public interface IAgencyService {
* @return int
**/
AjaxResult insertAgencyImportList(List<Agency> agencyList);
AjaxResult getAgencyList(HospitalDTO hospitalDTO);
}

View File

@ -1,16 +1,21 @@
package com.xinelu.manage.service.agency.impl;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.NodeTypeEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.regex.RegexUtil;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.domain.department.Department;
import com.xinelu.manage.dto.agency.HospitalDTO;
import com.xinelu.manage.mapper.agency.AgencyMapper;
import com.xinelu.manage.mapper.department.DepartmentMapper;
import com.xinelu.manage.mapper.sysarea.SysAreaMapper;
import com.xinelu.manage.service.agency.IAgencyService;
import com.xinelu.manage.vo.agency.AgencyTreeVO;
import com.xinelu.manage.vo.agency.AgencyVO;
import com.xinelu.manage.vo.agency.HospitalVO;
import com.xinelu.manage.vo.sysarea.SysAreaVO;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
@ -41,6 +46,9 @@ public class AgencyServiceImpl implements IAgencyService {
private RegexUtil regexUtil;
@Resource
private SysAreaMapper sysAreaMapper;
@Resource
private DepartmentMapper departmentMapper;
/**
* 查询机构信息
@ -226,6 +234,44 @@ public class AgencyServiceImpl implements IAgencyService {
return AjaxResult.success();
}
@Override
public AjaxResult getAgencyList(HospitalDTO hospitalDTO) {
HospitalVO hospitalVO = new HospitalVO();
if (StringUtils.isNotBlank(hospitalDTO.getNodeType()) && NodeTypeEnum.HOSPITAL.getInfo().equals(hospitalDTO.getNodeType()) && Objects.nonNull(hospitalDTO.getHospitalId())) {
Agency agency = new Agency();
agency.setNodeType(NodeTypeEnum.CAMPUS.getInfo());
agency.setParentId(hospitalDTO.getHospitalId());
List<Agency> campusList = agencyMapper.selectAgencyList(agency);
hospitalVO.setCampusList(campusList);
Department department = new Department();
department.setNodeType(NodeTypeEnum.DEPARTMENT.getInfo());
department.setAgencyId(hospitalDTO.getHospitalId());
List<Department> departmentList = departmentMapper.selectDepartmentList(department);
hospitalVO.setDepartmentList(departmentList);
department.setNodeType(NodeTypeEnum.WARD.getInfo());
List<Department> wardList = departmentMapper.selectDepartmentList(department);
hospitalVO.setWardList(wardList);
}
if (StringUtils.isNotBlank(hospitalDTO.getNodeType()) && NodeTypeEnum.CAMPUS.getInfo().equals(hospitalDTO.getNodeType()) && Objects.nonNull(hospitalDTO.getCampusId())) {
Department department = new Department();
department.setNodeType(NodeTypeEnum.DEPARTMENT.getInfo());
department.setAgencyId(hospitalDTO.getCampusId());
List<Department> departmentList = departmentMapper.selectDepartmentList(department);
hospitalVO.setDepartmentList(departmentList);
department.setNodeType(NodeTypeEnum.WARD.getInfo());
List<Department> wardList = departmentMapper.selectDepartmentList(department);
hospitalVO.setWardList(wardList);
}
if (StringUtils.isNotBlank(hospitalDTO.getNodeType()) && NodeTypeEnum.DEPARTMENT.getInfo().equals(hospitalDTO.getNodeType()) && Objects.nonNull(hospitalDTO.getDepartmentId())) {
Department department = new Department();
department.setNodeType(NodeTypeEnum.WARD.getInfo());
department.setParentDepartmentId(hospitalDTO.getDepartmentId());
List<Department> wardList = departmentMapper.selectDepartmentList(department);
hospitalVO.setWardList(wardList);
}
return AjaxResult.success(hospitalVO);
}
public List<AgencyVO> buildDeptTree(List<AgencyVO> agencies) {
List<AgencyVO> returnList = new ArrayList<AgencyVO>();
List<Long> tempList = new ArrayList<Long>();

View File

@ -0,0 +1,26 @@
package com.xinelu.manage.vo.agency;
import com.xinelu.manage.domain.agency.Agency;
import com.xinelu.manage.domain.department.Department;
import lombok.Data;
import java.util.List;
@Data
public class HospitalVO {
/**
* 园区集合
*/
List<Agency> campusList;
/**
* 科室集合
*/
List<Department> departmentList;
/**
* 病区集合
*/
List<Department> wardList;
}