修改患者管理列表数据范围查询。

This commit is contained in:
haown 2024-04-29 15:18:07 +08:00
parent b2d8cd0e02
commit ba5dbf1302
9 changed files with 25 additions and 27 deletions

View File

@ -91,23 +91,12 @@ public class DataScopeAspect {
break; break;
} else if (DATA_SCOPE_CUSTOM.equals(dataScope)) { // 自定数据权限 } else if (DATA_SCOPE_CUSTOM.equals(dataScope)) { // 自定数据权限
sqlString.append(StringUtils.format( sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, " OR {}.department_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
role.getRoleId())); role.getRoleId()));
} else if(DATA_SCOPE_AGENCY.equals(dataScope)){ // 机构数据权限 } else if(DATA_SCOPE_AGENCY.equals(dataScope)){ // 机构数据权限
sqlString.append(StringUtils.format(" OR {}.hospital_agency_id = {} ", anencyAlias, user.getHospitalAgencyId())); sqlString.append(StringUtils.format(" OR {}.hospital_agency_id = {} ", anencyAlias, user.getHospitalAgencyId()));
} else if (DATA_SCOPE_DEPT.equals(dataScope)) { // 部门数据权限 } else if (DATA_SCOPE_DEPT.equals(dataScope)) { // 部门数据权限
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); sqlString.append(StringUtils.format(" OR {}.department_id = {} ", deptAlias, user.getDepartmentId()));
} else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) { // 部门及以下数据权限
sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )",
deptAlias, user.getDeptId(), user.getDeptId()));
} else if (DATA_SCOPE_SELF.equals(dataScope)) { // 仅本人数据权限
if (StringUtils.isNotBlank(userAlias)) {
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
} else {
// 数据权限为仅本人且没有userAlias别名不查询任何数据
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
}
} }
} }

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.dto.patientblacklist; package com.xinelu.manage.dto.patientblacklist;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -9,7 +10,7 @@ import lombok.Data;
* @create: 2024-02-28 13:15 * @create: 2024-02-28 13:15
**/ **/
@Data @Data
public class PatientBlacklistDto { public class PatientBlacklistDto extends BaseEntity {
/** 患者id */ /** 患者id */
private Long patientId; private Long patientId;

View File

@ -18,7 +18,7 @@ public interface PatientBlacklistMapper {
* @param id 患者-黑明单关系主键 * @param id 患者-黑明单关系主键
* @return 患者-黑明单关系 * @return 患者-黑明单关系
*/ */
public PatientBlacklistVo selectPatientBlacklistById(Long id); PatientBlacklistVo selectPatientBlacklistById(Long id);
/** /**
* 查询患者-黑明单关系列表 * 查询患者-黑明单关系列表
@ -26,7 +26,7 @@ public interface PatientBlacklistMapper {
* @param patientBlacklist 患者-黑明单关系 * @param patientBlacklist 患者-黑明单关系
* @return 患者-黑明单关系集合 * @return 患者-黑明单关系集合
*/ */
public List<PatientBlacklistVo> selectPatientBlacklistList(PatientBlacklistDto patientBlacklist); List<PatientBlacklistVo> selectPatientBlacklistList(PatientBlacklistDto patientBlacklist);
/** /**
* 新增患者-黑明单关系 * 新增患者-黑明单关系
@ -34,7 +34,7 @@ public interface PatientBlacklistMapper {
* @param patientBlacklist 患者-黑明单关系 * @param patientBlacklist 患者-黑明单关系
* @return 结果 * @return 结果
*/ */
public int insertPatientBlacklist(PatientBlacklist patientBlacklist); int insertPatientBlacklist(PatientBlacklist patientBlacklist);
/** /**
* 修改患者-黑明单关系 * 修改患者-黑明单关系
@ -42,7 +42,7 @@ public interface PatientBlacklistMapper {
* @param patientBlacklist 患者-黑明单关系 * @param patientBlacklist 患者-黑明单关系
* @return 结果 * @return 结果
*/ */
public int updatePatientBlacklist(PatientBlacklist patientBlacklist); int updatePatientBlacklist(PatientBlacklist patientBlacklist);
/** /**
* 删除患者-黑明单关系 * 删除患者-黑明单关系
@ -50,7 +50,7 @@ public interface PatientBlacklistMapper {
* @param id 患者-黑明单关系主键 * @param id 患者-黑明单关系主键
* @return 结果 * @return 结果
*/ */
public int deletePatientBlacklistById(Long id); int deletePatientBlacklistById(Long id);
/** /**
* 批量删除患者-黑明单关系 * 批量删除患者-黑明单关系
@ -58,5 +58,5 @@ public interface PatientBlacklistMapper {
* @param ids 需要删除的数据主键集合 * @param ids 需要删除的数据主键集合
* @return 结果 * @return 结果
*/ */
public int deletePatientBlacklistByIds(Long[] ids); int deletePatientBlacklistByIds(Long[] ids);
} }

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.patientblacklist.impl; package com.xinelu.manage.service.patientblacklist.impl;
import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.exception.ServiceException; import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.bean.BeanUtils; import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.manage.domain.patientblacklist.PatientBlacklist; import com.xinelu.manage.domain.patientblacklist.PatientBlacklist;
@ -49,6 +50,7 @@ public class PatientBlacklistServiceImpl implements IPatientBlacklistService {
* @return 患者-黑明单关系 * @return 患者-黑明单关系
*/ */
@Override @Override
@DataScope(anencyAlias = "b")
public List<PatientBlacklistVo> selectPatientBlacklistList(PatientBlacklistDto patientBlacklist) { public List<PatientBlacklistVo> selectPatientBlacklistList(PatientBlacklistDto patientBlacklist) {
return patientBlacklistMapper.selectPatientBlacklistList(patientBlacklist); return patientBlacklistMapper.selectPatientBlacklistList(patientBlacklist);
} }

View File

@ -1,5 +1,6 @@
package com.xinelu.manage.service.patientprehospitalization.impl; package com.xinelu.manage.service.patientprehospitalization.impl;
import com.xinelu.common.annotation.DataScope;
import com.xinelu.common.constant.NodeTypeConstants; import com.xinelu.common.constant.NodeTypeConstants;
import com.xinelu.common.constant.PatientTypeConstants; import com.xinelu.common.constant.PatientTypeConstants;
import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.AjaxResult;
@ -110,6 +111,7 @@ public class PatientPreHospitalizationServiceImpl implements IPatientPreHospital
} }
@Override @Override
@DataScope(anencyAlias = "p")
public List<PatientPreHospitalization> selectList(PatientInfoDto patientInfo) { public List<PatientPreHospitalization> selectList(PatientInfoDto patientInfo) {
return preHospitalizationMapper.selectList(patientInfo); return preHospitalizationMapper.selectList(patientInfo);
} }

View File

@ -62,6 +62,8 @@
<if test="blacklistSource != null and blacklistSource != ''"> <if test="blacklistSource != null and blacklistSource != ''">
and b.blacklist_source = #{blacklistSource} and b.blacklist_source = #{blacklistSource}
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where> </where>
</select> </select>

View File

@ -338,6 +338,8 @@
<if test="registrationNo != null and registrationNo != ''"> <if test="registrationNo != null and registrationNo != ''">
and p.registration_no = #{registrationNo} and p.registration_no = #{registrationNo}
</if> </if>
<!-- 数据范围过滤 -->
${params.dataScope}
</where> </where>
order by p.appointment_date order by p.appointment_date
</select> </select>

View File

@ -14,7 +14,7 @@ public class AgencyNameVO {
/** /**
* 主键id * 主键id
*/ */
private Long agencyId; private Long hospitalAgencyId;
/** /**
* 机构名称 * 机构名称

View File

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