|
@@ -2679,10 +2679,10 @@
|
|
|
|
|
|
<!-- 条目缺陷质控评分页(内页)-->
|
|
|
<select id="qcResultShortPage" resultType="com.diagbot.dto.QcResultShortDTO">
|
|
|
- SELECT
|
|
|
+ SELECT DISTINCT
|
|
|
t1.hospital_id AS hospitalId,
|
|
|
t1.behospital_code AS behospitalCode,
|
|
|
- t1.LEVEL AS level,
|
|
|
+ t1.LEVEL AS LEVEL,
|
|
|
t1.score_res AS scoreRes,
|
|
|
t1.NAME AS patName,
|
|
|
t1.sex AS sex,
|
|
@@ -2692,6 +2692,10 @@
|
|
|
t2.age
|
|
|
FROM
|
|
|
(
|
|
|
+ SELECT
|
|
|
+ DISTINCT tt1.*
|
|
|
+ FROM
|
|
|
+ (
|
|
|
SELECT DISTINCT
|
|
|
a.hospital_id,
|
|
|
a.behospital_code,
|
|
@@ -2744,7 +2748,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">
|
|
@@ -2753,10 +2757,43 @@
|
|
|
<if test="qcResultShortPageVO.ruleType != null">
|
|
|
AND d.rule_type = #{qcResultShortPageVO.ruleType}
|
|
|
</if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 30
|
|
|
+ </if>
|
|
|
+ ) tt1
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
|
|
|
+ ,med_medical_record tt2
|
|
|
+ WHERE
|
|
|
+ tt2.is_deleted = 'N'
|
|
|
+ AND tt1.hospital_id = tt2.hospital_id
|
|
|
+ AND tt1.behospital_code = tt2.behospital_code
|
|
|
+ AND tt2.mode_id = 30
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
|
|
|
+ ,med_crisis_info tt2
|
|
|
+ WHERE
|
|
|
+ tt2.is_deleted = 'N'
|
|
|
+ AND tt1.hospital_id = tt2.hospital_id
|
|
|
+ AND tt1.behospital_code = tt2.behospital_code
|
|
|
+ </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
|
|
|
+ , med_home_operation_info t3
|
|
|
+ WHERE t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t2.home_page_id = t3.home_page_id
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 条目缺陷质控评分页-科室(内页)-->
|
|
@@ -2948,40 +2985,40 @@
|
|
|
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,
|
|
|
+ stageSummaryMRNum,
|
|
|
stageSummaryNum,
|
|
|
- ROUND( stageSummaryNum / stageSummaryMRNum, 4 ) AS stageSummaryPercent,
|
|
|
- CONCAT( ROUND( stageSummaryNum / stageSummaryMRNum * 100, 2 ), '%' ) AS stageSummaryPercentStr,
|
|
|
- stageSummaryMRNum
|
|
|
+ ROUND( IFNULL( stageSummaryNum / stageSummaryMRNum, 0 ), 4 ) AS stageSummaryPercent,
|
|
|
+ CONCAT( ROUND( IFNULL( stageSummaryNum / stageSummaryMRNum, 0 ) * 100, 2 ), '%' ) AS stageSummaryPercentStr
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -3043,10 +3080,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
|
|
@@ -3055,22 +3090,29 @@
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
+ d.beh_dept_id AS deptId,
|
|
|
+ d.beh_dept_name AS deptName,
|
|
|
0 AS consultationNum,
|
|
|
0 AS consultationMRNum,
|
|
|
- sum( c.cases_entry_id = 2594 ) AS operationNameNum,
|
|
|
- sum( c.cases_entry_id = 2973 ) AS operationTimeNum,
|
|
|
- sum( c.cases_entry_id = 2166 ) AS operation15MinuteNum,
|
|
|
- count( DISTINCT a.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,
|
|
|
0 AS stageSummaryMRNum
|
|
|
FROM
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ a.hospital_id,
|
|
|
+ a.behospital_code,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.beh_dept_id
|
|
|
+ FROM
|
|
|
med_behospital_info a,
|
|
|
med_home_page b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_operation_info c
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
@@ -3078,9 +3120,9 @@
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
AND a.hospital_id = c.hospital_id
|
|
|
AND a.behospital_code = b.behospital_code
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
+ AND b.home_page_id = c.home_page_id
|
|
|
AND a.is_placefile = '1'
|
|
|
- AND a.qc_type_id !=0
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
@@ -3093,22 +3135,26 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name = #{deptName}
|
|
|
</if>
|
|
|
+ ) 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
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
+ d.beh_dept_id,
|
|
|
+ d.beh_dept_name
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
|
c.beh_dept_id AS deptId,
|
|
|
c.beh_dept_name AS deptName,
|
|
|
- sum( d.cases_entry_id = 2419 ) AS crisisNum,
|
|
|
- count( DISTINCT c.behospital_code ) AS crisisMRNum,
|
|
|
0 AS consultationNum,
|
|
|
0 AS consultationMRNum,
|
|
|
0 AS operationNameNum,
|
|
|
0 AS operationTimeNum,
|
|
|
0 AS operation15MinuteNum,
|
|
|
0 AS operationMRNum,
|
|
|
+ sum( d.cases_entry_id = 2419 ) AS crisisNum,
|
|
|
+ count( DISTINCT c.behospital_code ) AS crisisMRNum,
|
|
|
0 AS stageSummaryNum,
|
|
|
0 AS stageSummaryMRNum
|
|
|
FROM
|
|
@@ -3140,10 +3186,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
|
|
@@ -3152,10 +3196,8 @@
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
- sum( b.cases_entry_id = 2495 ) AS stageSummaryNum,
|
|
|
- count( DISTINCT a.behospital_code ) AS stageSummaryMRNum,
|
|
|
+ b.beh_dept_id AS deptId,
|
|
|
+ b.beh_dept_name AS deptName,
|
|
|
0 AS consultationNum,
|
|
|
0 AS consultationMRNum,
|
|
|
0 AS operationNameNum,
|
|
@@ -3163,21 +3205,26 @@
|
|
|
0 AS operation15MinuteNum,
|
|
|
0 AS operationMRNum,
|
|
|
0 AS crisisNum,
|
|
|
- 0 AS crisisMRNum
|
|
|
+ 0 AS crisisMRNum,
|
|
|
+ sum( c.cases_entry_id = 2495 ) AS stageSummaryNum,
|
|
|
+ count( DISTINCT b.behospital_code ) AS stageSummaryMRNum
|
|
|
FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_detail b
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ a.hospital_id,
|
|
|
+ a.behospital_code,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.beh_dept_id
|
|
|
+ FROM
|
|
|
+ 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 TIMESTAMPDIFF(
|
|
|
DAY,
|
|
|
DATE( behospital_date ),
|
|
|
DATE( leave_hospital_date ))> 30
|
|
|
AND a.is_placefile = '1'
|
|
|
- AND a.qc_type_id !=0
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
@@ -3190,9 +3237,13 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name = #{deptName}
|
|
|
</if>
|
|
|
+ ) 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
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
+ b.beh_dept_id,
|
|
|
+ b.beh_dept_name
|
|
|
)
|
|
|
) tt
|
|
|
GROUP BY
|