|
@@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="reasonArea != null and reasonArea != ''"> and reasonArea = #{reasonArea}</if>
|
|
|
<if test="wardCode != null and wardCode != ''"> and ward_code = #{wardCode}</if>
|
|
|
<if test="wardName != null and wardName != ''"> and ward_name = #{wardName}</if>
|
|
|
- <if test="deptId != null and deptId != 0">AND (v.dept_id = #{deptId} OR v.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))</if>
|
|
|
+ <if test="deptId != null and deptId != 0">AND (v.dept_id = #{deptId} OR v.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, parent_id) ))</if>
|
|
|
</where>
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|
|
@@ -48,8 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
v.card_id
|
|
|
FROM
|
|
|
tb_visit v
|
|
|
- JOIN tb_patient ON v.pat_id = tb_patient.id
|
|
|
- JOIN sys_dept d ON d.dept_id = v.dept_id
|
|
|
+ LEFT JOIN tb_patient ON v.pat_id = tb_patient.id
|
|
|
+ LEFT JOIN sys_dept d ON d.dept_id = v.dept_id
|
|
|
<where>
|
|
|
v.hospital_status = '3'
|
|
|
<if test="patientName!='' and patientName!=null">
|
|
@@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="physician!='' and physician!= null">
|
|
|
AND v.physician like concat('%', #{physician}, '%')
|
|
|
</if>
|
|
|
- <if test="deptId !=null and deptId != 0">AND (v.dept_id = #{deptId} OR v.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))</if>
|
|
|
+ <if test="deptId !=null and deptId != 0">AND (v.dept_id = #{deptId} OR v.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, parent_id) ))</if>
|
|
|
</where>
|
|
|
<!-- 数据范围过滤 -->
|
|
|
${params.dataScope}
|