用户科室

This commit is contained in:
zhangheng 2024-03-05 13:56:50 +08:00
parent 9d9b867d5a
commit 6b85065ccf
6 changed files with 174 additions and 7 deletions

View File

@ -224,4 +224,22 @@ public class SysUserController extends BaseController {
List<AgencyNameVO> list = userService.selectUserBelongAgency(userName);
return getDataTable(list);
}
/**
* 剩余科室查询
*/
@GetMapping("/selectUserDepartment")
public TableDataInfo selectUserDepartment(String userName, String departmentName) {
return userService.selectUserDepartment(userName, departmentName);
}
/**
* 所属科室查询
*/
@GetMapping("/getBelongDepartment")
public TableDataInfo getBelongDepartment(String userName) {
startPage();
List<AgencyNameVO> list = userService.getBelongDepartment(userName);
return getDataTable(list);
}
}

View File

@ -30,4 +30,24 @@ public class AgencyNameVO {
* 机构数量
*/
private Integer agencyNum;
/**
* 主键id
*/
private Long departmentId;
/**
* 机构名称
*/
private String departmentName;
/**
* 机构代码
*/
private String departmentCode;
/**
* 机构数量
*/
private Integer departmentNum;
}

View File

@ -126,7 +126,38 @@ public interface SysUserMapper {
*/
public SysUser checkEmailUnique(String email);
/**
* 剩余机构信息
*
* @param agencyName 机构搜索信息
* @param agencyId 机构id
* @return AgencyNameVO
*/
List<AgencyNameVO> selectAgencyList(@Param("agencyName") String agencyName, @Param("agencyId") Long agencyId);
/**
* 机构查询
*
* @param agencyId 机构id
* @return
*/
List<AgencyNameVO> selectBelongAgencyList(Long agencyId);
/**
* 剩余科室信息
*
* @param departmentName 科室搜索条件
* @param departmentId 科室id
* @param agencyId 机构id
* @return AgencyNameVO
*/
List<AgencyNameVO> selectDepartmentList(@Param("departmentName") String departmentName, @Param("departmentId") Long departmentId, @Param("agencyId") Long agencyId);
/**
* 科室信息
*
* @param departmentId 科室id
* @return AgencyNameVO
*/
List<AgencyNameVO> selectBelongDepartmentList(Long departmentId);
}

View File

@ -1,6 +1,5 @@
package com.xinelu.system.service;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.entity.SysUser;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.system.domain.vo.AgencyNameVO;
@ -208,7 +207,7 @@ public interface ISysUserService {
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName);
/**
* 所属机构查询
* 剩余机构查询
*
* @param userName 用户账号
* @return AjaxResult
@ -222,4 +221,21 @@ public interface ISysUserService {
* @return AjaxResult
*/
List<AgencyNameVO> selectUserBelongAgency(String userName);
/**
* 剩余科室查询
*
* @param userName 用户账号
* @return AjaxResult
*/
TableDataInfo selectUserDepartment(String userName, String departmentName);
/**
* 所属科室查询
*
* @param userName 用户账号
* @return AjaxResult
*/
List<AgencyNameVO> getBelongDepartment(String userName);
}

View File

@ -499,7 +499,7 @@ public class SysUserServiceImpl implements ISysUserService {
SysUser sysUser = userMapper.selectUserByUserName(userName);
pageServiceUtil.startPage();
List<AgencyNameVO> agencyList = userMapper.selectAgencyList(agencyName, sysUser.getAgencyId());
if (CollectionUtils.isNotEmpty(agencyList)){
if (CollectionUtils.isNotEmpty(agencyList)) {
return pageServiceUtil.getDataTable(agencyList);
}
return pageServiceUtil.getDataTable(new ArrayList<>());
@ -519,4 +519,39 @@ public class SysUserServiceImpl implements ISysUserService {
}
return new ArrayList<AgencyNameVO>();
}
/**
* 剩余科室查询
*
* @param userName 用户账号
* @return AjaxResult
*/
@Override
public TableDataInfo selectUserDepartment(String userName, String departmentName) {
SysUser sysUser = userMapper.selectUserByUserName(userName);
if (Objects.isNull(sysUser) || Objects.isNull(sysUser.getAgencyId())) {
return pageServiceUtil.getDataTable(new ArrayList<>());
}
pageServiceUtil.startPage();
List<AgencyNameVO> agencyList = userMapper.selectDepartmentList(departmentName, sysUser.getDepartmentId(), sysUser.getAgencyId());
if (CollectionUtils.isNotEmpty(agencyList)) {
return pageServiceUtil.getDataTable(agencyList);
}
return pageServiceUtil.getDataTable(new ArrayList<>());
}
/**
* 所属科室查询
*
* @param userName 用户账号
* @return AjaxResult
*/
@Override
public List<AgencyNameVO> getBelongDepartment(String userName) {
SysUser sysUser = userMapper.selectUserByUserName(userName);
if (Objects.nonNull(sysUser) && Objects.nonNull(sysUser.getDepartmentId())) {
return userMapper.selectBelongDepartmentList(sysUser.getDepartmentId());
}
return new ArrayList<AgencyNameVO>();
}
}

View File

@ -299,7 +299,7 @@
agency_code,
(select COUNT(1)
from agency
where agency_status = 'ON'
where agency_status = 'ON' and node_type = 'HOSPITAL'
<if test="agencyName != null and agencyName != ''">
and agency_name = #{agencyName}
or agency_code = #{agencyName}
@ -309,7 +309,7 @@
</if>
) as agencyNum
from agency
where agency_status = 'ON'
where agency_status = 'ON' and node_type = 'HOSPITAL'
<if test="agencyName != null and agencyName != ''">
and agency_name = #{agencyName}
or agency_code = #{agencyName}
@ -320,15 +320,62 @@
</select>
<select id="selectBelongAgencyList" resultType="com.xinelu.system.domain.vo.AgencyNameVO">
select id agencyId,
select id agencyId,
agency_name,
agency_code,
(select COUNT(1)
from agency
where id = #{agencyId}
and agency_status = 'ON') as agencyNum
and agency_status = 'ON'
and node_type = 'HOSPITAL') as agencyNum
from agency
where id = #{agencyId}
and agency_status = 'ON'
and node_type = 'HOSPITAL'
</select>
<select id="selectDepartmentList" resultType="com.xinelu.system.domain.vo.AgencyNameVO">
select id departmentId,
department_name departmentName,
department_code departmentCode,
(select COUNT(1)
from department
where node_type = 'DEPARTMENT'
<if test="departmentName != null and departmentName != ''">
and department_name = #{departmentName}
or department_code = #{departmentName}
</if>
<if test="departmentId != null ">
and id &lt;&gt; #{departmentId}
</if>
<if test="agencyId != null ">
and id = #{agencyId}
</if>
) as departmentNum
from department
where agency_status = 'ON' and node_type = 'HOSPITAL'
<if test="departmentName != null and departmentName != ''">
and department_name = #{departmentName}
or department_code = #{departmentName}
</if>
<if test="departmentId != null ">
and id &lt;&gt; #{departmentId}
</if>
<if test="agencyId != null ">
and id = #{agencyId}
</if>
</select>
<select id="selectBelongDepartmentList" resultType="com.xinelu.system.domain.vo.AgencyNameVO">
select id departmentId,
department_name departmentName,
department_code departmentCode,
(select COUNT(1)
from department
where id = #{departmentId}
and node_type = 'DEPARTMENT') as departmentNum
from department
where id = #{departmentId}
and node_type = 'DEPARTMENT'
</select>
</mapper>