|
@@ -3195,6 +3195,12 @@
|
|
|
DATE( a.behospital_date ),
|
|
|
DATE( a.leave_hospital_date ))> 30
|
|
|
</if>
|
|
|
+ <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 31
|
|
|
+ </if>
|
|
|
)be
|
|
|
left join med_check_info mci
|
|
|
on mci.is_deleted = 'N'
|
|
@@ -3527,7 +3533,8 @@
|
|
|
stageSummaryMRNum,
|
|
|
stageSummaryNum,
|
|
|
ROUND( IFNULL( stageSummaryNum / stageSummaryMRNum, 0 ), 4 ) AS stageSummaryPercent,
|
|
|
- CONCAT( ROUND( IFNULL( stageSummaryNum / stageSummaryMRNum, 0 ) * 100, 2 ), '%' ) AS stageSummaryPercentStr
|
|
|
+ CONCAT( ROUND( IFNULL( stageSummaryNum / stageSummaryMRNum, 0 ) * 100, 2 ), '%' ) AS stageSummaryPercentStr,
|
|
|
+ beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -3542,7 +3549,8 @@
|
|
|
sum( tt.crisisNum ) AS crisisNum,
|
|
|
sum( tt.crisisMRNum ) AS crisisMRNum,
|
|
|
sum( tt.stageSummaryNum ) AS stageSummaryNum,
|
|
|
- sum( tt.stageSummaryMRNum ) AS stageSummaryMRNum
|
|
|
+ sum( tt.stageSummaryMRNum ) AS stageSummaryMRNum,
|
|
|
+ sum( tt.beHosGT31DaysMRNum ) AS beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
(
|
|
|
(
|
|
@@ -3558,7 +3566,8 @@
|
|
|
0 AS crisisNum,
|
|
|
0 AS crisisMRNum,
|
|
|
0 AS stageSummaryNum,
|
|
|
- 0 AS stageSummaryMRNum
|
|
|
+ 0 AS stageSummaryMRNum,
|
|
|
+ 0 AS beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT DISTINCT
|
|
@@ -3612,7 +3621,8 @@
|
|
|
0 AS crisisNum,
|
|
|
0 AS crisisMRNum,
|
|
|
0 AS stageSummaryNum,
|
|
|
- 0 AS stageSummaryMRNum
|
|
|
+ 0 AS stageSummaryMRNum,
|
|
|
+ 0 AS beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT DISTINCT
|
|
@@ -3669,7 +3679,8 @@
|
|
|
sum( d.cases_entry_id = 2419 ) AS crisisNum,
|
|
|
count( DISTINCT c.behospital_code ) AS crisisMRNum,
|
|
|
0 AS stageSummaryNum,
|
|
|
- 0 AS stageSummaryMRNum
|
|
|
+ 0 AS stageSummaryMRNum,
|
|
|
+ 0 AS beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT DISTINCT
|
|
@@ -3722,7 +3733,8 @@
|
|
|
0 AS crisisNum,
|
|
|
0 AS crisisMRNum,
|
|
|
sum( c.cases_entry_id = 2495 ) AS stageSummaryNum,
|
|
|
- count( DISTINCT b.behospital_code ) AS stageSummaryMRNum
|
|
|
+ count( DISTINCT b.behospital_code ) AS stageSummaryMRNum,
|
|
|
+ 0 AS beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
(
|
|
|
SELECT DISTINCT
|
|
@@ -3761,6 +3773,57 @@
|
|
|
GROUP BY
|
|
|
b.beh_dept_id,
|
|
|
b.beh_dept_name
|
|
|
+ ) UNION
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ b.beh_dept_id AS deptId,
|
|
|
+ b.beh_dept_name AS deptName,
|
|
|
+ 0 AS consultationNum,
|
|
|
+ 0 AS consultationMRNum,
|
|
|
+ 0 AS operationNameNum,
|
|
|
+ 0 AS operationTimeNum,
|
|
|
+ 0 AS operation15MinuteNum,
|
|
|
+ 0 AS operationMRNum,
|
|
|
+ 0 AS crisisNum,
|
|
|
+ 0 AS crisisMRNum,
|
|
|
+ 0 AS stageSummaryNum,
|
|
|
+ 0 AS stageSummaryMRNum,
|
|
|
+ count(*) AS beHosGT31DaysMRNum
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ 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 TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( behospital_date ),
|
|
|
+ DATE( leave_hospital_date ))> 31
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{deptName}
|
|
|
+ </if>
|
|
|
+ ) b
|
|
|
+ GROUP BY
|
|
|
+ b.beh_dept_id,
|
|
|
+ b.beh_dept_name
|
|
|
)
|
|
|
) tt
|
|
|
GROUP BY
|
|
@@ -3794,6 +3857,7 @@
|
|
|
<when test='asc=="stageSummaryPercent"'>stageSummaryPercent asc</when>
|
|
|
<when test='asc=="stageSummaryPercentStr"'>stageSummaryPercent asc</when>
|
|
|
<when test='asc=="stageSummaryMRNum"'>stageSummaryMRNum asc</when>
|
|
|
+ <when test='asc=="beHosGT31DaysMRNum"'>beHosGT31DaysMRNum asc</when>
|
|
|
<otherwise>deptName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
@@ -3824,6 +3888,7 @@
|
|
|
<when test='desc=="stageSummaryPercent"'>stageSummaryPercent desc</when>
|
|
|
<when test='desc=="stageSummaryPercentStr"'>stageSummaryPercent desc</when>
|
|
|
<when test='desc=="stageSummaryMRNum"'>stageSummaryMRNum desc</when>
|
|
|
+ <when test='desc=="beHosGT31DaysMRNum"'>beHosGT31DaysMRNum desc</when>
|
|
|
<otherwise>deptName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
@@ -5379,6 +5444,12 @@
|
|
|
DATE( a.behospital_date ),
|
|
|
DATE( a.leave_hospital_date ))> 30
|
|
|
</if>
|
|
|
+ <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 31
|
|
|
+ </if>
|
|
|
)be
|
|
|
left join med_check_info mci
|
|
|
on mci.is_deleted = 'N'
|
|
@@ -5608,6 +5679,12 @@
|
|
|
DATE( a.behospital_date ),
|
|
|
DATE( a.leave_hospital_date ))> 30
|
|
|
</if>
|
|
|
+ <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 31
|
|
|
+ </if>
|
|
|
)be
|
|
|
left join med_check_info mci
|
|
|
on mci.is_deleted = 'N'
|