|
@@ -2790,7 +2790,7 @@
|
|
|
<if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
|
|
|
AND d.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.casesEntryName}, '%' )
|
|
|
</if>
|
|
|
- <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId != ''">
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null ">
|
|
|
AND d.id = #{qcResultShortPageVO.casesEntryId}
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.isReject != null">
|
|
@@ -2800,9 +2800,17 @@
|
|
|
AND d.rule_type = #{qcResultShortPageVO.ruleType}
|
|
|
</if>
|
|
|
) t1
|
|
|
- LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- AND t2.is_deleted = 'N'
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594 and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2166)">
|
|
|
+ LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594 or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2166)">
|
|
|
+ , med_home_page t2
|
|
|
+ WHERE t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 条目缺陷质控评分页-科室(内页)-->
|
|
@@ -2994,40 +3002,39 @@
|
|
|
SELECT
|
|
|
deptId,
|
|
|
deptName,
|
|
|
+ consultationMRNum,
|
|
|
consultationNum,
|
|
|
2511 AS consultationEntryId,
|
|
|
'普通会诊未在24小时内完成' AS consultationEntryName,
|
|
|
- ROUND( consultationNum / consultationMRNum, 4 ) AS consultationPercent,
|
|
|
- CONCAT( ROUND( consultationNum / consultationMRNum * 100, 2 ), '%' ) AS consultationPercentStr,
|
|
|
- consultationMRNum,
|
|
|
+ ROUND( IFNULL( consultationNum / consultationMRNum, 0 ), 4 ) AS consultationPercent,
|
|
|
+ CONCAT( ROUND( IFNULL( consultationNum / consultationMRNum, 0 ) * 100, 2 ), '%' ) AS consultationPercentStr,
|
|
|
+ operationMRNum,
|
|
|
2594 AS operationNameEntryId,
|
|
|
'首页手术名称与手术记录不一致' AS operationNameEntryName,
|
|
|
operationNameNum,
|
|
|
- ROUND( operationNameNum / operationMRNum, 4 ) AS operationNamePercent,
|
|
|
- CONCAT( ROUND( operationNameNum / operationMRNum * 100, 2 ), '%' ) AS operationNamePercentStr,
|
|
|
+ ROUND( IFNULL( operationNameNum / operationMRNum, 0 ), 4 ) AS operationNamePercent,
|
|
|
+ CONCAT( ROUND( IFNULL( operationNameNum / operationMRNum, 0 ) * 100, 2 ), '%' ) AS operationNamePercentStr,
|
|
|
2973 AS operationTimeEntryId,
|
|
|
'手术日期与手术记录中手术日期不一致' AS operationTimeEntryName,
|
|
|
operationTimeNum,
|
|
|
- ROUND( operationTimeNum / operationMRNum, 4 ) AS operationTimePercent,
|
|
|
- CONCAT( ROUND( operationTimeNum / operationMRNum * 100, 2 ), '%' ) AS operationTimePercentStr,
|
|
|
+ ROUND( IFNULL( operationTimeNum / operationMRNum, 0 ), 4 ) AS operationTimePercent,
|
|
|
+ CONCAT( ROUND( IFNULL( operationTimeNum / operationMRNum, 0 ) * 100, 2 ), '%' ) AS operationTimePercentStr,
|
|
|
2166 AS operation15MinuteEntryId,
|
|
|
'术后首程未在手术结束1小时内完成' AS operation15MinuteEntryName,
|
|
|
operation15MinuteNum,
|
|
|
- ROUND( operation15MinuteNum / operationMRNum, 4 ) AS operation15MinutePercent,
|
|
|
- CONCAT( ROUND( operation15MinuteNum / operationMRNum * 100, 2 ), '%' ) AS operation15MinutePercentStr,
|
|
|
- operationMRNum,
|
|
|
+ ROUND( IFNULL( operation15MinuteNum / operationMRNum, 0 ), 4 ) AS operation15MinutePercent,
|
|
|
+ CONCAT( ROUND( IFNULL( operation15MinuteNum / operationMRNum, 0 ) * 100, 2 ), '%' ) AS operation15MinutePercentStr,
|
|
|
2419 AS crisisEntryId,
|
|
|
'危急值记录未在接到危急值报告后6小时内完成' AS crisisEntryName,
|
|
|
- crisisNum,
|
|
|
- ROUND( crisisNum / crisisMRNum, 4 ) AS crisisPercent,
|
|
|
- CONCAT( ROUND( crisisNum / crisisMRNum * 100, 2 ), '%' ) AS crisisPercentStr,
|
|
|
crisisMRNum,
|
|
|
+ crisisNum,
|
|
|
+ ROUND( IFNULL( crisisNum / crisisMRNum, 0 ), 4 ) AS crisisPercent,
|
|
|
+ CONCAT( ROUND( IFNULL( crisisNum / crisisMRNum, 0 ) * 100, 2 ), '%' ) AS crisisPercentStr,
|
|
|
2495 AS stageSummaryEntryId,
|
|
|
'无阶段小结' AS stageSummaryEntryName,
|
|
|
- stageSummaryNum,
|
|
|
- ROUND( stageSummaryNum / stageSummaryMRNum, 4 ) AS stageSummaryPercent,
|
|
|
- CONCAT( ROUND( stageSummaryNum / stageSummaryMRNum * 100, 2 ), '%' ) AS stageSummaryPercentStr,
|
|
|
- stageSummaryMRNum
|
|
|
+ stageSummaryMRNum stageSummaryNum,
|
|
|
+ ROUND( IFNULL( stageSummaryNum / stageSummaryMRNum, 0 ), 4 ) AS stageSummaryPercent,
|
|
|
+ CONCAT( ROUND( IFNULL( stageSummaryNum / stageSummaryMRNum, 0 ) * 100, 2 ), '%' ) AS stageSummaryPercentStr
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -3089,10 +3096,8 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name = #{deptName}
|
|
|
</if>
|
|
|
- ) c,
|
|
|
- med_qcresult_detail d
|
|
|
- WHERE
|
|
|
- d.is_deleted = 'N'
|
|
|
+ ) c
|
|
|
+ LEFT JOIN med_qcresult_detail d ON d.is_deleted = 'N'
|
|
|
AND c.hospital_id = d.hospital_id
|
|
|
AND c.behospital_code = d.behospital_code
|
|
|
GROUP BY
|
|
@@ -3101,14 +3106,14 @@
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
|
- c.beh_dept_id AS deptId,
|
|
|
- c.beh_dept_name AS deptName,
|
|
|
+ d.beh_dept_id AS deptId,
|
|
|
+ d.beh_dept_name AS deptName,
|
|
|
0 AS consultationNum,
|
|
|
0 AS consultationMRNum,
|
|
|
- sum( d.cases_entry_id = 2594 ) AS operationNameNum,
|
|
|
- sum( d.cases_entry_id = 2973 ) AS operationTimeNum,
|
|
|
- sum( d.cases_entry_id = 2166 ) AS operation15MinuteNum,
|
|
|
- count( DISTINCT c.behospital_code ) AS operationMRNum,
|
|
|
+ sum( e.cases_entry_id = 2594 ) AS operationNameNum,
|
|
|
+ sum( e.cases_entry_id = 2973 ) AS operationTimeNum,
|
|
|
+ sum( e.cases_entry_id = 2166 ) AS operation15MinuteNum,
|
|
|
+ count( DISTINCT d.behospital_code ) AS operationMRNum,
|
|
|
0 AS crisisNum,
|
|
|
0 AS crisisMRNum,
|
|
|
0 AS stageSummaryNum,
|
|
@@ -3122,13 +3127,16 @@
|
|
|
a.beh_dept_id
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_medical_record b
|
|
|
+ med_home_page b,
|
|
|
+ med_home_operation_info 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 b.mode_id = 17
|
|
|
+ AND b.home_page_id = c.home_page_id
|
|
|
AND a.is_placefile = '1'
|
|
|
AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
@@ -3143,15 +3151,13 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name = #{deptName}
|
|
|
</if>
|
|
|
- ) c,
|
|
|
- med_qcresult_detail d
|
|
|
- WHERE
|
|
|
- d.is_deleted = 'N'
|
|
|
- AND c.hospital_id = d.hospital_id
|
|
|
- AND c.behospital_code = d.behospital_code
|
|
|
+ ) d
|
|
|
+ LEFT JOIN med_qcresult_detail e ON e.is_deleted = 'N'
|
|
|
+ AND d.hospital_id = e.hospital_id
|
|
|
+ AND d.behospital_code = e.behospital_code
|
|
|
GROUP BY
|
|
|
- c.beh_dept_id,
|
|
|
- c.beh_dept_name
|
|
|
+ d.beh_dept_id,
|
|
|
+ d.beh_dept_name
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
@@ -3176,13 +3182,12 @@
|
|
|
a.beh_dept_id
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_medical_record b
|
|
|
+ med_crisis_info b
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
AND a.behospital_code = b.behospital_code
|
|
|
- AND b.mode_id = 23
|
|
|
AND a.is_placefile = '1'
|
|
|
AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
@@ -3197,10 +3202,8 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name = #{deptName}
|
|
|
</if>
|
|
|
- ) c,
|
|
|
- med_qcresult_detail d
|
|
|
- WHERE
|
|
|
- d.is_deleted = 'N'
|
|
|
+ ) c
|
|
|
+ LEFT JOIN med_qcresult_detail d ON d.is_deleted = 'N'
|
|
|
AND c.hospital_id = d.hospital_id
|
|
|
AND c.behospital_code = d.behospital_code
|
|
|
GROUP BY
|
|
@@ -3209,8 +3212,8 @@
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
|
- c.beh_dept_id AS deptId,
|
|
|
- c.beh_dept_name AS deptName,
|
|
|
+ b.beh_dept_id AS deptId,
|
|
|
+ b.beh_dept_name AS deptName,
|
|
|
0 AS consultationNum,
|
|
|
0 AS consultationMRNum,
|
|
|
0 AS operationNameNum,
|
|
@@ -3219,8 +3222,8 @@
|
|
|
0 AS operationMRNum,
|
|
|
0 AS crisisNum,
|
|
|
0 AS crisisMRNum,
|
|
|
- sum( d.cases_entry_id = 2495 ) AS stageSummaryNum,
|
|
|
- count( DISTINCT c.behospital_code ) AS stageSummaryMRNum
|
|
|
+ sum( c.cases_entry_id = 2495 ) AS stageSummaryNum,
|
|
|
+ count( DISTINCT b.behospital_code ) AS stageSummaryMRNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT DISTINCT
|
|
@@ -3229,14 +3232,13 @@
|
|
|
a.beh_dept_name,
|
|
|
a.beh_dept_id
|
|
|
FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_medical_record b
|
|
|
+ med_behospital_info a
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
- AND b.is_deleted = 'N'
|
|
|
- AND a.hospital_id = b.hospital_id
|
|
|
- AND a.behospital_code = b.behospital_code
|
|
|
- AND b.mode_id = 23
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( behospital_date ),
|
|
|
+ DATE( leave_hospital_date ))> 30
|
|
|
AND a.is_placefile = '1'
|
|
|
AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
@@ -3251,15 +3253,13 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name = #{deptName}
|
|
|
</if>
|
|
|
- ) c,
|
|
|
- med_qcresult_detail d
|
|
|
- WHERE
|
|
|
- d.is_deleted = 'N'
|
|
|
- AND c.hospital_id = d.hospital_id
|
|
|
- AND c.behospital_code = d.behospital_code
|
|
|
+ ) b
|
|
|
+ LEFT JOIN med_qcresult_detail c ON c.is_deleted = 'N'
|
|
|
+ AND b.hospital_id = c.hospital_id
|
|
|
+ AND b.behospital_code = c.behospital_code
|
|
|
GROUP BY
|
|
|
- c.beh_dept_id,
|
|
|
- c.beh_dept_name
|
|
|
+ b.beh_dept_id,
|
|
|
+ b.beh_dept_name
|
|
|
)
|
|
|
) tt
|
|
|
GROUP BY
|