update===>:修改数据查询范围。
This commit is contained in:
parent
f5580afe0a
commit
cdd5e2ea96
@ -118,6 +118,11 @@ public class SysUser extends BaseEntity {
|
||||
*/
|
||||
private Long hospitalPersonId;
|
||||
|
||||
/**
|
||||
* 医院主键
|
||||
*/
|
||||
private Long hospitalId;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
@ -347,6 +352,14 @@ public class SysUser extends BaseEntity {
|
||||
this.hospitalPersonId = hospitalPersonId;
|
||||
}
|
||||
|
||||
public Long getHospitalId() {
|
||||
return hospitalId;
|
||||
}
|
||||
|
||||
public void setHospitalId(Long hospitalId) {
|
||||
this.hospitalId = hospitalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xinelu.framework.aspectj;
|
||||
|
||||
import com.xinelu.common.annotation.DataScope;
|
||||
import com.xinelu.common.core.domain.BaseDomain;
|
||||
import com.xinelu.common.core.domain.BaseEntity;
|
||||
import com.xinelu.common.core.domain.entity.SysRole;
|
||||
import com.xinelu.common.core.domain.entity.SysUser;
|
||||
@ -86,20 +87,21 @@ public class DataScopeAspect {
|
||||
break;
|
||||
} else if (DATA_SCOPE_CUSTOM.equals(dataScope)) {
|
||||
sqlString.append(StringUtils.format(
|
||||
" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
|
||||
" OR {}.hospital_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias,
|
||||
role.getRoleId()));
|
||||
} else if (DATA_SCOPE_DEPT.equals(dataScope)) {
|
||||
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId()));
|
||||
sqlString.append(StringUtils.format(" OR {}.hospital_id = {} ", deptAlias, user.getHospitalId()));
|
||||
} 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()));
|
||||
//sqlString.append(StringUtils.format(
|
||||
// " OR {}.hospital_id IN ( SELECT hospital_id FROM hospital_info WHERE hospital_id = {} or find_in_set( {} , ancestors ) )",
|
||||
// deptAlias, user.getHospitalId(), user.getHospitalId()));
|
||||
sqlString.append(StringUtils.format(" OR {}.hospital_id = {} ", deptAlias, user.getHospitalId()));
|
||||
} else if (DATA_SCOPE_SELF.equals(dataScope)) {
|
||||
if (StringUtils.isNotBlank(userAlias)) {
|
||||
sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId()));
|
||||
sqlString.append(StringUtils.format(" OR {}.doctor_id = {} ", userAlias, user.getUserId()));
|
||||
} else {
|
||||
// 数据权限为仅本人且没有userAlias别名不查询任何数据
|
||||
sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias));
|
||||
sqlString.append(StringUtils.format(" OR {}.hospital_id = 0 ", deptAlias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,6 +112,10 @@ public class DataScopeAspect {
|
||||
BaseEntity baseEntity = (BaseEntity) params;
|
||||
baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
||||
}
|
||||
if (StringUtils.isNotNull(params) && params instanceof BaseDomain) {
|
||||
BaseDomain baseDomain = (BaseDomain) params;
|
||||
baseDomain.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,6 +54,12 @@ public class HospitalInfoController extends BaseController {
|
||||
@PreAuthorize("@ss.hasPermi('system:hospital:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(HospitalInfo hospitalInfo) {
|
||||
if (!getLoginUser().getUser().isAdmin()) {
|
||||
HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.selectHospitalPersonInfoById(getLoginUser().getUser().getHospitalPersonId());
|
||||
if (hospitalPersonInfo != null) {
|
||||
hospitalInfo.setId(hospitalPersonInfo.getHospitalId());
|
||||
}
|
||||
}
|
||||
startPage();
|
||||
List<HospitalInfo> list = hospitalInfoService.selectHospitalInfoList(hospitalInfo);
|
||||
return getDataTable(list);
|
||||
@ -65,7 +71,6 @@ public class HospitalInfoController extends BaseController {
|
||||
@ApiOperation("查询医院信息管理列表")
|
||||
@GetMapping("/getList")
|
||||
public AjaxResult getList(HospitalInfo hospitalInfo) {
|
||||
// TODO 根据用户权限获取医院列表,机构管理员只能看自己机构,超级管理员查看所有
|
||||
if (!getLoginUser().getUser().isAdmin()) {
|
||||
HospitalPersonInfo hospitalPersonInfo = hospitalPersonInfoService.selectHospitalPersonInfoById(getLoginUser().getUser().getHospitalPersonId());
|
||||
if (hospitalPersonInfo != null) {
|
||||
|
||||
@ -15,13 +15,18 @@ import com.xinelu.manage.service.hospitalpersoninfo.IHospitalPersonInfoService;
|
||||
import com.xinelu.manage.vo.hospitalpersoninfo.HospitalPersonInfoVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 健康咨询-科室人员信息Controller
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xinelu.manage.service.hospitaldepartmentinfo.impl;
|
||||
|
||||
import com.xinelu.common.annotation.DataScope;
|
||||
import com.xinelu.common.constant.Constants;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
@ -55,6 +56,7 @@ public class HospitalDepartmentInfoServiceImpl implements IHospitalDepartmentInf
|
||||
* @return 科室信息管理
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<HospitalDepartmentInfo> selectHospitalDepartmentInfoList(HospitalDepartmentInfo hospitalDepartmentInfo) {
|
||||
return hospitalDepartmentInfoMapper.selectHospitalDepartmentInfoList(hospitalDepartmentInfo);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xinelu.manage.service.hospitalpersoninfo.impl;
|
||||
|
||||
import com.xinelu.common.annotation.DataScope;
|
||||
import com.xinelu.common.config.XinELuConfig;
|
||||
import com.xinelu.common.constant.Constants;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
@ -72,6 +73,7 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService
|
||||
* @return 健康咨询-科室人员信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "hpi", userAlias = "u")
|
||||
public List<HospitalPersonInfoVO> selectHospitalPersonInfoList(HospitalPersonInfoVO hospitalPersonInfo) {
|
||||
return hospitalPersonInfoMapper.selectHospitalPersonInfoList(hospitalPersonInfo);
|
||||
}
|
||||
@ -138,6 +140,7 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword()));
|
||||
sysUser.setNickName(hospitalPersonInfo.getPersonName());
|
||||
sysUser.setHospitalPersonId(hospitalPersonInfo.getId());
|
||||
sysUser.setHospitalId(hospitalPersonInfo.getHospitalId());
|
||||
sysUser.setStatus("0");
|
||||
sysUser.setDelFlag("0");
|
||||
userMapper.insertUser(sysUser);
|
||||
@ -169,6 +172,32 @@ public class HospitalPersonInfoServiceImpl implements IHospitalPersonInfoService
|
||||
hospitalPersonInfo.setUpdateTime(LocalDateTime.now());
|
||||
hospitalPersonInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||
hospitalPersonInfoMapper.updateHospitalPersonInfo(hospitalPersonInfo);
|
||||
// 修改sys_user表
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setHospitalPersonId(hospitalPersonInfo.getId());
|
||||
List<SysUser> userList = userMapper.selectUserList(sysUser);
|
||||
if (CollectionUtils.isEmpty(userList)) {
|
||||
SysUser newUser = new SysUser();
|
||||
newUser.setUserName(hospitalPersonInfo.getPersonAccount());
|
||||
newUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword()));
|
||||
newUser.setNickName(hospitalPersonInfo.getPersonName());
|
||||
newUser.setHospitalPersonId(hospitalPersonInfo.getId());
|
||||
newUser.setHospitalId(hospitalPersonInfo.getHospitalId());
|
||||
newUser.setStatus("0");
|
||||
newUser.setDelFlag("0");
|
||||
userMapper.insertUser(newUser);
|
||||
} else {
|
||||
SysUser updUser = userList.get(0);
|
||||
updUser.setUserName(hospitalPersonInfo.getPersonAccount());
|
||||
updUser.setPassword(SecurityUtils.encryptPassword(hospitalPersonInfo.getPersonPassword()));
|
||||
updUser.setNickName(hospitalPersonInfo.getPersonName());
|
||||
updUser.setHospitalPersonId(hospitalPersonInfo.getId());
|
||||
updUser.setHospitalId(hospitalPersonInfo.getHospitalId());
|
||||
updUser.setStatus("0");
|
||||
updUser.setDelFlag("0");
|
||||
userMapper.updateUser(updUser);
|
||||
}
|
||||
|
||||
//根据科室人员id去查询对应的资质证书 使用流来获取所有的证书路径
|
||||
List<HospitalPersonCertificate> hospitalPersonCertificateList = hospitalPersonCertificateMapper.selectHospitalPersonCertificateByIds(Collections.singletonList(hospitalPersonInfo.getId()));
|
||||
//数据库中的
|
||||
|
||||
@ -33,6 +33,12 @@ public class AppGoodsOrderVO {
|
||||
@ApiModelProperty(value = "患者名称")
|
||||
private String patientName;
|
||||
|
||||
@ApiModelProperty(value = "医生主键")
|
||||
private Long doctorId;
|
||||
|
||||
@ApiModelProperty(value = "医生姓名")
|
||||
private String doctorName;
|
||||
|
||||
/**
|
||||
* 患者身份证号
|
||||
*/
|
||||
@ -105,4 +111,5 @@ public class AppGoodsOrderVO {
|
||||
**/
|
||||
@ApiModelProperty(value = "健康咨询内容")
|
||||
private String healthConsultationContent;
|
||||
|
||||
}
|
||||
|
||||
@ -767,7 +767,7 @@
|
||||
<select id="getConsultationOrders" resultType="com.xinelu.manage.vo.goodsorder.AppGoodsOrderVO">
|
||||
select
|
||||
c.patient_id as patientId, c.id as consultationInfoId,
|
||||
c.patient_name as patientName, c.card_no as cardNo,
|
||||
c.patient_name as patientName, c.doctor_id as doctorId,c.doctor_name as doctorName, c.card_no as cardNo,
|
||||
c.phone, c.address,c.appointment_date, c.appointment_start_time, c.appointment_end_time,c.problem_description,
|
||||
gr.id as goodsOrderId,gr.order_no, gr.order_status, gr.total_price, gr.health_consultation_content
|
||||
from goods_order gr left join consultation_info c on gr.consultation_info_id = c.id
|
||||
|
||||
@ -23,22 +23,22 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHospitalDepartmentInfoVo">
|
||||
select id,
|
||||
parent_id,
|
||||
hospital_id,
|
||||
hospital_name,
|
||||
department_code,
|
||||
department_name,
|
||||
department_phone,
|
||||
department_person,
|
||||
department_address,
|
||||
department_level,
|
||||
department_sort,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from hospital_department_info
|
||||
select d.id,
|
||||
d.parent_id,
|
||||
d.hospital_id,
|
||||
d.hospital_name,
|
||||
d.department_code,
|
||||
d.department_name,
|
||||
d.department_phone,
|
||||
d.department_person,
|
||||
d.department_address,
|
||||
d.department_level,
|
||||
d.department_sort,
|
||||
d.create_by,
|
||||
d.create_time,
|
||||
d.update_by,
|
||||
d.update_time
|
||||
from hospital_department_info d
|
||||
</sql>
|
||||
|
||||
<select id="selectHospitalDepartmentInfoList" parameterType="com.xinelu.manage.domain.hospitaldepartmentinfo.HospitalDepartmentInfo"
|
||||
@ -46,43 +46,45 @@
|
||||
<include refid="selectHospitalDepartmentInfoVo"/>
|
||||
<where>
|
||||
<if test="parentId != null ">
|
||||
and parent_id = #{parentId}
|
||||
and d.parent_id = #{parentId}
|
||||
</if>
|
||||
<if test="hospitalId != null ">
|
||||
and hospital_id = #{hospitalId}
|
||||
and d.hospital_id = #{hospitalId}
|
||||
</if>
|
||||
<if test="hospitalName != null and hospitalName != ''">
|
||||
and hospital_name like concat('%', #{hospitalName}, '%')
|
||||
and d.hospital_name like concat('%', #{hospitalName}, '%')
|
||||
</if>
|
||||
<if test="departmentCode != null and departmentCode != ''">
|
||||
and department_code = #{departmentCode}
|
||||
and dd.epartment_code = #{departmentCode}
|
||||
</if>
|
||||
<if test="departmentName != null and departmentName != ''">
|
||||
and department_name like concat('%', #{departmentName}, '%')
|
||||
and d.department_name like concat('%', #{departmentName}, '%')
|
||||
</if>
|
||||
<if test="departmentPhone != null and departmentPhone != ''">
|
||||
and department_phone = #{departmentPhone}
|
||||
and d.department_phone = #{departmentPhone}
|
||||
</if>
|
||||
<if test="departmentPerson != null and departmentPerson != ''">
|
||||
and department_person = #{departmentPerson}
|
||||
and d.department_person = #{departmentPerson}
|
||||
</if>
|
||||
<if test="departmentAddress != null and departmentAddress != ''">
|
||||
and department_address = #{departmentAddress}
|
||||
and d.department_address = #{departmentAddress}
|
||||
</if>
|
||||
<if test="departmentLevel != null ">
|
||||
and department_level = #{departmentLevel}
|
||||
and d.department_level = #{departmentLevel}
|
||||
</if>
|
||||
<if test="departmentSort != null ">
|
||||
and department_sort = #{departmentSort}
|
||||
and d.department_sort = #{departmentSort}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
ORDER BY d.id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectHospitalDepartmentInfoById" parameterType="Long"
|
||||
resultMap="HospitalDepartmentInfoResult">
|
||||
<include refid="selectHospitalDepartmentInfoVo"/>
|
||||
where id = #{id}
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertHospitalDepartmentInfo" parameterType="com.xinelu.manage.domain.hospitaldepartmentinfo.HospitalDepartmentInfo" useGeneratedKeys="true"
|
||||
|
||||
@ -152,6 +152,8 @@
|
||||
<if test="status != null and status != ''">
|
||||
and hpi.status = #{status}
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</where>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="hospitalPersonId" column="hospital_person_id"/>
|
||||
<result property="hospitalId" column="hospital_id"/>
|
||||
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult"/>
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||
</resultMap>
|
||||
@ -49,7 +50,7 @@
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.hospital_person_id,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, u.hospital_person_id,u.hospital_id,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
@ -163,6 +164,7 @@
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="hospitalPersonId != null and hospitalPersonId != ''">hospital_person_id,</if>
|
||||
<if test="hospitalId != null and hospitalId != ''">hospital_id,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
@ -178,6 +180,7 @@
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="hospitalPersonId != null and hospitalPersonId != ''">#{hospitalPersonId},</if>
|
||||
<if test="hospitalId != null and hospitalId != ''">#{hospitalId},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user