|
@@ -391,6 +391,75 @@
|
|
|
and t.is_placefile = 1
|
|
|
</select>
|
|
|
|
|
|
+ <!--质控评分(医疗组)分页-->
|
|
|
+ <select id="getPageByGroup" 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
|
|
|
+ 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'
|
|
|
+ ) t
|
|
|
+ where t.is_deleted = 'N' and
|
|
|
+ t.doctor_id in (
|
|
|
+ SELECT doctor_id FROM `bas_doctor_info`
|
|
|
+ where is_deleted = 'N' and hospital_id = #{hospitalId} and group_id in (
|
|
|
+ select c3.group_id from sys_user c1, sys_user_hospital c2, bas_doctor_info c3
|
|
|
+ where c1.is_deleted = 'N' and c2.is_deleted = 'N' and c3.is_deleted = 'N'
|
|
|
+ and c1.id = c2.user_id and c2.hospital_id = c3.hospital_id
|
|
|
+ and c1.username = c3.doctor_id
|
|
|
+ and c2.hospital_id = #{hospitalId}
|
|
|
+ and c1.id = #{userId}
|
|
|
+ )
|
|
|
+ )
|
|
|
+ <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},'%')
|
|
|
+ or t.beh_doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ or t.director_doctor_name like CONCAT('%',#{doctorName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and t.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ and (t.doctor_id = #{doctorCode}
|
|
|
+ or t.beh_doctor_id = #{doctorCode}
|
|
|
+ or t.director_doctor_id = #{doctorCode})
|
|
|
+ </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>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and t.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ and t.qc_type_id != 0
|
|
|
+ and t.is_placefile = 1
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 出院总人数统计-全院-首页 -->
|
|
|
<select id="leaveHosCount" parameterType="com.diagbot.vo.FilterVO" resultType="int">
|
|
|
SELECT
|
|
@@ -2334,7 +2403,7 @@
|
|
|
AND t1.behDeptName = t2.behDeptName
|
|
|
ORDER BY
|
|
|
t1.behDeptName,
|
|
|
- t1.behDeptName,
|
|
|
+ t1.behDoctorName,
|
|
|
t1.patName,
|
|
|
t1.behospitalCode,
|
|
|
t1.caseName
|
|
@@ -2488,7 +2557,181 @@
|
|
|
AND t1.behDeptName = t2.behDeptName
|
|
|
ORDER BY
|
|
|
t1.behDeptName,
|
|
|
+ t1.behDoctorName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.caseName
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 医疗组质控评分导出到excel-->
|
|
|
+ <select id="exportQcresultByGroup" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
+ SELECT
|
|
|
+ t1.behDeptId,
|
|
|
t1.behDeptName,
|
|
|
+ t1.behDoctorName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.behospitalDate,
|
|
|
+ t1.leaveHospitalDate,
|
|
|
+ t1.score,
|
|
|
+ t2.avgScore,
|
|
|
+ t1.msg,
|
|
|
+ t1.caseName
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ CONCAT(
|
|
|
+ ( CASE WHEN a.director_doctor_name IS NOT NULL AND a.director_doctor_name != '' THEN concat( a.director_doctor_name, '\n' ) ELSE '' END ),
|
|
|
+ a.doctor_name
|
|
|
+ ) AS behDoctorName,
|
|
|
+ a.`name` AS patName,
|
|
|
+ a.behospital_code AS behospitalCode,
|
|
|
+ a.behospital_date AS behospitalDate,
|
|
|
+ a.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ b.score_res AS score,
|
|
|
+ c.msg AS msg,
|
|
|
+ d.NAME AS caseName,
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases d,
|
|
|
+ sys_user_dept e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = e.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND c.cases_id = d.id
|
|
|
+ AND a.beh_dept_id = e.dept_id
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ AND a.doctor_id in
|
|
|
+ (SELECT doctor_id FROM `bas_doctor_info`
|
|
|
+ where is_deleted = 'N' and hospital_id = #{hospitalId} and group_id in (
|
|
|
+ select c3.group_id from sys_user c1, sys_user_hospital c2, bas_doctor_info c3
|
|
|
+ where c1.is_deleted = 'N' and c2.is_deleted = 'N' and c3.is_deleted = 'N'
|
|
|
+ and c1.id = c2.user_id and c2.hospital_id = c3.hospital_id
|
|
|
+ and c1.username = c3.doctor_id
|
|
|
+ and c2.hospital_id = #{hospitalId}
|
|
|
+ and c1.id = #{userId}
|
|
|
+ ))
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null ">
|
|
|
+ AND e.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null ">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null ">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ AND b.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ROUND( AVG( b.score_res ), 2 ) AS avgScore,
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ sys_user_dept c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND a.doctor_id in
|
|
|
+ (SELECT doctor_id FROM `bas_doctor_info`
|
|
|
+ where is_deleted = 'N' and hospital_id = #{hospitalId} and group_id in (
|
|
|
+ select c3.group_id from sys_user c1, sys_user_hospital c2, bas_doctor_info c3
|
|
|
+ where c1.is_deleted = 'N' and c2.is_deleted = 'N' and c3.is_deleted = 'N'
|
|
|
+ and c1.id = c2.user_id and c2.hospital_id = c3.hospital_id
|
|
|
+ and c1.username = c3.doctor_id
|
|
|
+ and c2.hospital_id = #{hospitalId}
|
|
|
+ and c1.id = #{userId}
|
|
|
+ ))
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.beh_dept_id = c.dept_id
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null ">
|
|
|
+ AND c.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null ">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null ">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ AND b.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ ) t2
|
|
|
+ WHERE
|
|
|
+ t1.behDeptId = t2.behDeptId
|
|
|
+ AND t1.behDeptName = t2.behDeptName
|
|
|
+ ORDER BY
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.behDoctorName,
|
|
|
t1.patName,
|
|
|
t1.behospitalCode,
|
|
|
t1.caseName
|