|
@@ -40,11 +40,11 @@
|
|
|
on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
|
|
|
) t
|
|
|
where t.is_deleted = 'N'
|
|
|
- <if test="behDeptName != null and behDeptName != ''">
|
|
|
- and t.beh_dept_name like CONCAT('%',#{behDeptName},'%')
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ and t.beh_dept_id = #{deptId}
|
|
|
</if>
|
|
|
<if test="doctorName != null and doctorName != ''">
|
|
|
- and t.doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ and CONCAT( IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,'')) like CONCAT('%',#{doctorName},'%')
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
and t.name like CONCAT('%',#{name},'%')
|
|
@@ -319,4 +319,131 @@
|
|
|
AND a.behospital_code = b.behospital_code
|
|
|
)
|
|
|
</select>
|
|
|
+ <select id="getPageByDept" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
+ SELECT
|
|
|
+ *
|
|
|
+ FROM
|
|
|
+ ( SELECT
|
|
|
+ a.*,
|
|
|
+ IFNULL(b.level, '未评分') AS `level`,
|
|
|
+ b.grade_type,
|
|
|
+ b.score_res,
|
|
|
+ b.gmt_create AS grade_time,
|
|
|
+ c.age
|
|
|
+ FROM
|
|
|
+ med_behospital_info a
|
|
|
+ JOIN sys_user_dept d
|
|
|
+ ON a.hospital_id = d.hospital_id
|
|
|
+ AND a.beh_dept_id = d.dept_id
|
|
|
+ LEFT JOIN med_qcresult_info b
|
|
|
+ ON a.behospital_code = b.behospital_code
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ LEFT JOIN med_home_page c
|
|
|
+ ON a.behospital_code = c.behospital_code
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ WHERE d.is_deleted = 'N'
|
|
|
+ AND d.user_id = #{userId}
|
|
|
+ ) t
|
|
|
+ where t.is_deleted = 'N'
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ and t.beh_dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ and CONCAT( IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,'')) like CONCAT('%',#{doctorName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and t.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="fileCode != null and fileCode != ''">
|
|
|
+ and t.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null">
|
|
|
+ and t.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="behosDateStart != null">
|
|
|
+ <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null">
|
|
|
+ <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null">
|
|
|
+ <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and t.level = #{level}
|
|
|
+ </if>
|
|
|
+ order by t.behospital_date desc
|
|
|
+ </select>
|
|
|
+ <select id="getPageByPerson" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
+ select * from (SELECT
|
|
|
+ a.*,
|
|
|
+ IFNULL(b.level, '未评分') AS `level`,
|
|
|
+ b.grade_type,
|
|
|
+ b.score_res,
|
|
|
+ b.gmt_create AS grade_time,
|
|
|
+ c.age
|
|
|
+ FROM
|
|
|
+ med_behospital_info a
|
|
|
+ JOIN
|
|
|
+ (SELECT
|
|
|
+ u.id,
|
|
|
+ u.linkman AS linkman,
|
|
|
+ uh.hospital_id
|
|
|
+ FROM
|
|
|
+ sys_user u
|
|
|
+ JOIN sys_user_hospital uh
|
|
|
+ ON u.id = uh.user_id
|
|
|
+ WHERE u.is_deleted = "N"
|
|
|
+ AND u.id = #{userId}
|
|
|
+ AND uh.hospital_id = #{hospitalId}) u1
|
|
|
+ ON a.hospital_id = u1.hospital_id
|
|
|
+ LEFT JOIN med_qcresult_info b
|
|
|
+ ON a.behospital_code = b.behospital_code
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ LEFT JOIN med_home_page c
|
|
|
+ ON a.behospital_code = c.behospital_code
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ WHERE CONCAT(
|
|
|
+ IFNULL(a.doctor_name, ''),
|
|
|
+ IFNULL(a.beh_doctor_name, ''),
|
|
|
+ IFNULL(a.director_doctor_name, '')
|
|
|
+ ) LIKE CONCAT('%', u1.linkman, '%')
|
|
|
+ ) t
|
|
|
+ where t.is_deleted = 'N'
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ and t.beh_dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and t.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="fileCode != null and fileCode != ''">
|
|
|
+ and t.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="behosDateStart != null">
|
|
|
+ <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and t.behospital_date <= #{behosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null">
|
|
|
+ <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null">
|
|
|
+ <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and t.level = #{level}
|
|
|
+ </if>
|
|
|
+ order by t.behospital_date desc
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|