|
@@ -7208,6 +7208,365 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 质控核查统计-科室(内页)-->
|
|
|
+ <select id="qcCheckStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.ImproveByDeptDTO">
|
|
|
+ SELECT
|
|
|
+ t.*
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ mr.beh_dept_id AS deptId,
|
|
|
+ mr.beh_dept_name AS deptName,
|
|
|
+ mr.doctorId,
|
|
|
+ mr.doctorName,
|
|
|
+ IFNULL( mr.mrNum, 0 ) AS mrNum,
|
|
|
+ ck.checkedNum AS checkedNum,
|
|
|
+ ROUND( ck.checkedNum / mr.mrNum, 4 ) AS checkedPercent,
|
|
|
+ CONCAT( ROUND( ck.checkedNum / mr.mrNum * 100, 2 ), '%' ) AS checkedPercentStr,
|
|
|
+ hmmr_t.homePageMRNum,
|
|
|
+ improve_t.improveNum,
|
|
|
+ round( improve_t.improveNum / hmmr_t.homePageMRNum, 4 ) AS improvePercent,
|
|
|
+ Concat( round( improve_t.improveNum / hmmr_t.homePageMRNum * 100, 2 ), '%' ) AS improvePercentStr,
|
|
|
+ improve_t.improveToPassNum,
|
|
|
+ round( improve_t.improveToPassNum / hmmr_t.homePageMRNum, 4 ) AS improveToPassPercent,
|
|
|
+ Concat( round( improve_t.improveToPassNum / hmmr_t.homePageMRNum * 100, 2 ), '%' ) AS improveToPassPercentStr,
|
|
|
+ improve_t.improveToFullNum,
|
|
|
+ round( improve_t.improveToFullNum / hmmr_t.homePageMRNum, 4 ) AS improveToFullPercent,
|
|
|
+ Concat( round( improve_t.improveToFullNum / hmmr_t.homePageMRNum * 100, 2 ), '%' ) AS improveToFullPercentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.doctor_id as doctorId,
|
|
|
+ a.doctor_name as doctorName,
|
|
|
+ count(*) AS mrNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ sys_user_dept c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ 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.beh_dept_id = c.dept_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="userId!=null">
|
|
|
+ AND c.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ ) mr
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.doctor_id as doctorId,
|
|
|
+ a.doctor_name as doctorName,
|
|
|
+ count(*) AS checkedNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ med_check_info c,
|
|
|
+ sys_user_dept d
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.beh_dept_id = d.dept_id
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ AND ifnull(c.`status`,0) = 1
|
|
|
+ AND c.check_type = 0
|
|
|
+ <if test="userId!=null">
|
|
|
+ AND d.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ ) ck ON mr.doctorId = ck.doctorId
|
|
|
+ AND mr.doctorName = ck.doctorName
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.doctor_id as doctorId,
|
|
|
+ a.doctor_name as doctorName,
|
|
|
+ count( DISTINCT a.behospital_code ) AS homePageMRNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ sys_user_dept d
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.beh_dept_id = d.dept_id
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="userId!=null">
|
|
|
+ AND d.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ ) hmmr_t ON mr.doctorId = hmmr_t.doctorId
|
|
|
+ AND mr.doctorName = hmmr_t.doctorName
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.doctor_id as doctorId,
|
|
|
+ a.doctor_name as doctorName,
|
|
|
+ <![CDATA[sum( e.`level` = '不合格' AND d.`level` = '合格' AND d.score_res < 20 ) AS improveToPassNum,]]>
|
|
|
+ sum( d.score_res = 20 ) AS improveToFullNum,
|
|
|
+ count(*) AS improveNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_cases d,
|
|
|
+ sys_user_dept f,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ m4.*
|
|
|
+ FROM
|
|
|
+ med_behospital_info m1,
|
|
|
+ med_home_page m2,
|
|
|
+ med_qcresult_info m3,
|
|
|
+ med_qcresult_cases m4
|
|
|
+ WHERE
|
|
|
+ m1.is_deleted = 'N'
|
|
|
+ AND m2.is_deleted = 'N'
|
|
|
+ AND m3.is_deleted = 'Y'
|
|
|
+ AND m4.is_deleted = 'Y'
|
|
|
+ AND m1.hospital_id = m2.hospital_id
|
|
|
+ AND m1.hospital_id = m3.hospital_id
|
|
|
+ AND m1.hospital_id = m4.hospital_id
|
|
|
+ AND m1.behospital_code = m2.behospital_code
|
|
|
+ AND m1.behospital_code = m3.behospital_code
|
|
|
+ AND m1.behospital_code = m4.behospital_code
|
|
|
+ AND m3.gmt_create = m4.gmt_create
|
|
|
+ AND m3.have_home_page = 1
|
|
|
+ AND m4.cases_id = 243
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and m1.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND m1.qc_type_id != 0
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND m1.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND m1.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND m1.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND m1.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND m1.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and m1.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ m1.behospital_code
|
|
|
+ ORDER BY
|
|
|
+ m1.behospital_code,
|
|
|
+ m4.gmt_create
|
|
|
+ ) e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND f.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.hospital_id = e.hospital_id
|
|
|
+ AND a.hospital_id = f.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.behospital_code = e.behospital_code
|
|
|
+ AND a.beh_dept_id = f.dept_id
|
|
|
+ <if test="userId!=null">
|
|
|
+ AND f.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ AND d.cases_id = 243
|
|
|
+ AND d.score_res > e.score_res
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ ) improve_t ON mr.doctorId = improve_t.doctorId
|
|
|
+ AND mr.doctorName = improve_t.doctorName
|
|
|
+ ) t
|
|
|
+ <if test="asc != null and asc !=''">
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test='asc=="deptId"'>deptId asc</when>
|
|
|
+ <when test='asc=="deptName"'>deptName asc</when>
|
|
|
+ <when test='asc=="doctorName"'>doctorName asc</when>
|
|
|
+ <when test='asc=="mrNum"'>mrNum asc</when>
|
|
|
+ <when test='asc=="checkedNum"'>checkedNum asc</when>
|
|
|
+ <when test='asc=="checkedPercent"'>checkedPercent asc</when>
|
|
|
+ <when test='asc=="checkedPercentStr"'>checkedPercent asc</when>
|
|
|
+ <when test='asc=="homePageMRNum"'>homePageMRNum asc</when>
|
|
|
+ <when test='asc=="improveNum"'>improveNum asc</when>
|
|
|
+ <when test='asc=="improvePercent"'>improvePercent asc</when>
|
|
|
+ <when test='asc=="improvePercentStr"'>improvePercent asc</when>
|
|
|
+ <when test='asc=="improveToPassNum"'>improveToPassNum asc</when>
|
|
|
+ <when test='asc=="improveToPassPercent"'>improveToPassPercent asc</when>
|
|
|
+ <when test='asc=="improveToPassPercentStr"'>improveToPassPercent asc</when>
|
|
|
+ <when test='asc=="improveToFullNum"'>improveToFullNum asc</when>
|
|
|
+ <when test='asc=="improveToFullPercent"'>improveToFullPercent asc</when>
|
|
|
+ <when test='asc=="improveToFullPercentStr"'>improveToFullPercent asc</when>
|
|
|
+ <otherwise>doctorName asc</otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="desc != null and desc!=''">
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test='desc=="deptId"'>deptId desc</when>
|
|
|
+ <when test='desc=="deptName"'>deptName desc</when>
|
|
|
+ <when test='desc=="doctorName"'>doctorName desc</when>
|
|
|
+ <when test='desc=="mrNum"'>mrNum desc</when>
|
|
|
+ <when test='desc=="checkedNum"'>checkedNum desc</when>
|
|
|
+ <when test='desc=="checkedPercent"'>checkedPercent desc</when>
|
|
|
+ <when test='desc=="checkedPercentStr"'>checkedPercent desc</when>
|
|
|
+ <when test='desc=="homePageMRNum"'>homePageMRNum desc</when>
|
|
|
+ <when test='desc=="improveNum"'>improveNum desc</when>
|
|
|
+ <when test='desc=="improvePercent"'>improvePercent desc</when>
|
|
|
+ <when test='desc=="improvePercentStr"'>improvePercent desc</when>
|
|
|
+ <when test='desc=="improveToPassNum"'>improveToPassNum desc</when>
|
|
|
+ <when test='desc=="improveToPassPercent"'>improveToPassPercent desc</when>
|
|
|
+ <when test='desc=="improveToPassPercentStr"'>improveToPassPercent desc</when>
|
|
|
+ <when test='desc=="improveToFullNum"'>improveToFullNum desc</when>
|
|
|
+ <when test='desc=="improveToFullPercent"'>improveToFullPercent desc</when>
|
|
|
+ <when test='desc=="improveToFullPercentStr"'>improveToFullPercent desc</when>
|
|
|
+ <otherwise>deptName desc</otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 离院病人评分详情页导出-->
|
|
|
<select id="leaveHosMRPageExport" resultMap="ExportExcelMap">
|
|
|
SELECT
|