|
@@ -1135,6 +1135,141 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <!--各科室缺陷占比病历列表-->
|
|
|
+ <select id="levelStatisticsByDeptPage" resultType="com.diagbot.dto.BehospitalInfoDeptDTO">
|
|
|
+ SELECT * from (
|
|
|
+ SELECT
|
|
|
+ t.*,
|
|
|
+ t3.name as medoup_name,
|
|
|
+ CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type as ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name as ch_name,
|
|
|
+ h.check_name as mr_name,
|
|
|
+ g.check_time as ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
+ FROM
|
|
|
+ ( SELECT
|
|
|
+ a.*,
|
|
|
+ IFNULL(b.level, '未评分') AS `level`,
|
|
|
+ b.grade_type,
|
|
|
+ b.score_res,
|
|
|
+ e.score_res as score_bn,
|
|
|
+ b.gmt_create AS grade_time,
|
|
|
+ CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') )as 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_qcresult_cases e
|
|
|
+ on a.behospital_code = e.behospital_code
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ and e.cases_id = 243
|
|
|
+ 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
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type in(0,2) ) g
|
|
|
+ ON t.behospital_code = g.behospital_code
|
|
|
+ AND t.hospital_id = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON t.behospital_code = h.behospital_code
|
|
|
+ AND t.hospital_id = h.hospital_id
|
|
|
+ LEFT JOIN bas_doctor_info t2 ON t.doctor_id = t2.doctor_id
|
|
|
+ AND t.hospital_id = t2.hospital_id
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ LEFT JOIN sys_medoup t3 ON t2.group_id = t3.`code`
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ where t.is_deleted = 'N'
|
|
|
+ <if test="medoupName != null and medoupName != ''">
|
|
|
+ AND t3.name = #{medoupName}
|
|
|
+ </if>
|
|
|
+ <if test="wardName != null and wardName != ''">
|
|
|
+ AND t.ward_name = #{wardName}
|
|
|
+ </if>
|
|
|
+ <if test="diagnose != null and diagnose != ''">
|
|
|
+ AND t.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and t.beh_dept_name = #{deptName}
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ and t.beh_dept_Id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ and t.doctor_name = #{doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ and t.doctor_id = #{doctorCode}
|
|
|
+ </if>
|
|
|
+ <if test="doctorId != null and doctorId != ''">
|
|
|
+ and t.doctor_id = #{doctorId}
|
|
|
+ </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>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and t.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ and t.qc_type_id != 0) p
|
|
|
+ where p.is_deleted="N"
|
|
|
+ <if test="checkStatus != null ">
|
|
|
+ and p.check_status = #{checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND p.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND p.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND p.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<!--质控评分(个人)分页-->
|
|
|
<select id="getPageByPerson" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
Select * from (
|
|
@@ -4694,6 +4829,263 @@
|
|
|
<![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+ <!-- 各科室缺陷占比科室导出-->
|
|
|
+ <select id="levelStatisticsExportByDept" resultMap="ExportExcelMapByDept" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
+ SELECT * FROM (
|
|
|
+ SELECT tp.*,t3.name as medoup_name,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type AS ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name,
|
|
|
+ g.check_time AS ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ t1.behDeptId,
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.doctorName,
|
|
|
+ t1.doctor_id as doctorId,
|
|
|
+ t1.patName,
|
|
|
+ t1.wardName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.fileCode,
|
|
|
+ t1.hospitalId,
|
|
|
+ t1.behospitalDate,
|
|
|
+ t1.leaveHospitalDate,
|
|
|
+ t1.score,
|
|
|
+ t2.avgScore,
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ c.msg AS msg,
|
|
|
+ t1.caseName,
|
|
|
+ </if>
|
|
|
+ e.score_res as scoreBn
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.doctor_name AS doctorName,
|
|
|
+ a.doctor_id,
|
|
|
+ a.`name` AS patName,
|
|
|
+ a.ward_name as wardName,
|
|
|
+ a.file_code as fileCode,
|
|
|
+ a.behospital_code AS behospitalCode,
|
|
|
+ a.hospital_id AS hospital_id,
|
|
|
+ d.id,
|
|
|
+ a.behospital_date AS behospitalDate,
|
|
|
+ a.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ b.score_res AS score,
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ d.NAME AS caseName,
|
|
|
+ </if>
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName,
|
|
|
+ a.hospital_id AS hospitalId
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ qc_cases d,
|
|
|
+ sys_user_dept e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = e.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.beh_dept_id = e.dept_id
|
|
|
+ <if test="diagnose != null and diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="wardName != null and wardName != ''">
|
|
|
+ AND a.ward_name = #{wardName}
|
|
|
+ </if>
|
|
|
+ <![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="behosDateStart != null">
|
|
|
+ <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
|
|
|
+ </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 = #{doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ AND a.doctor_id = #{doctorCode}
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name = #{deptName}
|
|
|
+ </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
|
|
|
+ LEFT JOIN med_qcresult_cases e
|
|
|
+ on t1.behospitalCode = e.behospital_code
|
|
|
+ and t1.hospital_id = e.hospital_id
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ and e.cases_id = 243
|
|
|
+ LEFT JOIN med_qcresult_detail c
|
|
|
+ on t1.behospitalCode = c.behospital_code
|
|
|
+ and t1.hospital_id = c.hospital_id
|
|
|
+ AND c.cases_id = t1.id
|
|
|
+ AND c.is_deleted = 'N',
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ROUND( AVG( b.score_res ), 2 ) AS avgScore,
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName,
|
|
|
+ a.doctor_id AS doctorId,
|
|
|
+ a.doctor_name AS doctorName
|
|
|
+ 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.behospital_code = b.behospital_code
|
|
|
+ AND a.beh_dept_id = c.dept_id
|
|
|
+ <if test="diagnose != null and diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="wardName != null and wardName != ''">
|
|
|
+ AND a.ward_name = #{wardName}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <![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="behosDateStart != null">
|
|
|
+ <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
|
|
|
+ </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 = #{doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ and a.doctor_id = #{doctorCode}
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name = #{deptName}
|
|
|
+ </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,
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ ) t2
|
|
|
+ WHERE
|
|
|
+ t1.behDeptId = t2.behDeptId
|
|
|
+ AND t1.behDeptName = t2.behDeptName
|
|
|
+ AND t1.doctor_id = t2.doctorId
|
|
|
+ AND t1.doctorName = t2.doctorName
|
|
|
+ ORDER BY
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.doctorName,
|
|
|
+ t1.patName,
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ t1.caseName,
|
|
|
+ </if>
|
|
|
+ t1.behospitalCode
|
|
|
+ )tp
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
+ ON tp.behospitalCode = g.behospital_code
|
|
|
+ AND tp.hospitalId = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON tp.behospitalCode = h.behospital_code
|
|
|
+ AND tp.hospitalId = h.hospital_id
|
|
|
+ LEFT JOIN bas_doctor_info t2 ON tp.doctorId = t2.doctor_id
|
|
|
+ AND tp.hospitalId = t2.hospital_id
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ LEFT JOIN sys_medoup t3 ON t2.group_id = t3.`code`
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ where 1=1
|
|
|
+ <if test="medoupName != null and medoupName != ''">
|
|
|
+ AND t3.name = #{medoupName}
|
|
|
+ </if>
|
|
|
+ ) tu
|
|
|
+ WHERE tu.behospitalCode IS NOT NULL
|
|
|
+ <if test="checkStatus != null ">
|
|
|
+ and tu.check_status = #{checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND tu.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND tu.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND tu.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 个人质控评分导出到excel-->
|
|
|
<select id="exportQcresultByPerson" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
SELECT * FROM (
|