|
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
and admission_time BETWEEN #{startTime} AND #{endTime}
|
|
|
</if>
|
|
|
<if test="deptId != null and deptId != 0">
|
|
|
- AND (v.dept_id = #{deptId} OR v.dept_id IN (SELECT s.dept_id FROM sys_dept s WHERE s.parent_id in (SELECT s.dept_id FROM sys_dept s WHERE find_in_set( 100, parent_id ))))
|
|
|
+ AND (v.dept_id = #{deptId} OR v.dept_id IN (SELECT s.dept_id FROM sys_dept s WHERE s.parent_id in (SELECT s.dept_id FROM sys_dept s WHERE find_in_set( #{deptId}, parent_id ))))
|
|
|
</if>
|
|
|
</where>
|
|
|
<!-- 数据范围过滤 -->
|
|
@@ -56,10 +56,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
JOIN tb_orc_report ON tb_orc_report.visit_id=v.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="name!='' and name!=null">
|
|
|
- AND tb_patient.`name` like concat('%', #{patientName}, '%')
|
|
|
+ AND tb_patient.`name` like concat('%', #{name}, '%')
|
|
|
</if>
|
|
|
<if test="department!='' and department!= null">
|
|
|
AND v.department =#{department}
|
|
@@ -68,7 +69,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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 s.dept_id FROM sys_dept s WHERE s.parent_id in (SELECT s.dept_id FROM sys_dept s WHERE find_in_set( 100, parent_id ))))
|
|
|
+ <choose>
|
|
|
+ <when test="deptId ==100">
|
|
|
+ AND (v.dept_id = #{deptId} OR v.dept_id IN (SELECT s.dept_id FROM sys_dept s WHERE s.parent_id in (SELECT s.dept_id FROM sys_dept s WHERE find_in_set( #{deptId}, parent_id ))))
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND (v.dept_id = #{deptId} AND v.dept_id IN(SELECT s.dept_id FROM sys_dept s WHERE find_in_set( #{deptId}, dept_id )))
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+
|
|
|
</if>
|
|
|
<if test="startTime!=null and endTime!=null ">
|
|
|
AND v.discharge_time BETWEEN #{startTime} AND DATE_ADD(#{endTime},INTERVAL 1 day)
|
|
@@ -140,4 +149,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
d.dept_id = #{deptId}
|
|
|
AND u.user_name = #{userName}
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getPatientCardByUserId" resultType="com.ruoyi.web.work.domain.dto.PatientCardDto">
|
|
|
+ SELECT
|
|
|
+ v.department,
|
|
|
+ v.physician,
|
|
|
+ tb_patient.`name`,
|
|
|
+ v.discharge_method,
|
|
|
+ v.discharge_time,
|
|
|
+ v.id as visit_id,
|
|
|
+ v.pat_id,
|
|
|
+ v.card_id
|
|
|
+ FROM
|
|
|
+ tb_visit v
|
|
|
+ JOIN tb_orc_report ON tb_orc_report.visit_id=v.id
|
|
|
+ LEFT JOIN tb_patient ON v.pat_id = tb_patient.id
|
|
|
+ <where>
|
|
|
+ <if test="doctorCode!=null and doctorCode!=''">
|
|
|
+ and v.doctor_code=#{doctorCode}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="isRole" resultType="java.lang.Long">
|
|
|
+ SELECT sys_user_role.role_id from sys_user_role where sys_user_role.user_id=#{userId}
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|