|
@@ -1442,21 +1442,10 @@
|
|
|
a.beh_dept_name AS deptName,
|
|
|
count( * ) AS entryNum
|
|
|
FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- med_qcresult_detail d,
|
|
|
- qc_cases_entry e
|
|
|
+ med_qcresult_report a
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND e.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.hospital_id = d.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND a.behospital_code = d.behospital_code
|
|
|
- AND d.cases_id = e.cases_id
|
|
|
- AND d.cases_entry_id = e.id
|
|
|
+ AND a.cases_id is not null
|
|
|
<if test="isPlacefile != null and isPlacefile != ''">
|
|
|
and a.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
@@ -1481,7 +1470,7 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="level != null and level != ''">
|
|
|
- and c.level = #{level}
|
|
|
+ and a.level = #{level}
|
|
|
</if>
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
and a.beh_dept_name like CONCAT('%',#{deptName},'%')
|
|
@@ -1573,21 +1562,10 @@
|
|
|
a.beh_dept_name AS deptName,
|
|
|
count( * ) AS entryNum
|
|
|
FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- med_qcresult_detail d,
|
|
|
- qc_cases_entry e
|
|
|
+ med_qcresult_report a
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND e.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.hospital_id = d.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND a.behospital_code = d.behospital_code
|
|
|
- AND d.cases_id = e.cases_id
|
|
|
- AND d.cases_entry_id = e.id
|
|
|
+ AND a.cases_id is not null
|
|
|
<if test="isPlacefile != null and isPlacefile != ''">
|
|
|
and a.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
@@ -1612,7 +1590,7 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="level != null and level != ''">
|
|
|
- and c.level = #{level}
|
|
|
+ and a.level = #{level}
|
|
|
</if>
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
and a.beh_dept_name like CONCAT('%',#{deptName},'%')
|
|
@@ -1847,24 +1825,13 @@
|
|
|
a.hospital_id AS hospitalId,
|
|
|
a.behospital_code AS behospitalCode
|
|
|
FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- med_qcresult_detail d,
|
|
|
- qc_cases_entry e,
|
|
|
+ med_qcresult_report a,
|
|
|
bas_dept_info f
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND e.is_deleted = 'N'
|
|
|
AND f.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.cases_id is not null
|
|
|
AND a.hospital_id = f.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND a.behospital_code = d.behospital_code
|
|
|
- AND d.cases_id = e.cases_id
|
|
|
- AND d.cases_entry_id = e.id
|
|
|
AND a.beh_dept_id = f.dept_id
|
|
|
<if test="isPlacefile != null and isPlacefile != ''">
|
|
|
and a.is_placefile = #{isPlacefile}
|
|
@@ -1890,7 +1857,7 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="level != null and level != ''">
|
|
|
- and c.level = #{level}
|
|
|
+ and a.level = #{level}
|
|
|
</if>
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
@@ -2028,24 +1995,13 @@
|
|
|
a.hospital_id AS hospitalId,
|
|
|
a.behospital_code AS behospitalCode
|
|
|
FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- med_qcresult_detail d,
|
|
|
- qc_cases_entry e,
|
|
|
+ med_qcresult_report a,
|
|
|
bas_dept_info f
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND e.is_deleted = 'N'
|
|
|
AND f.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.cases_id is not null
|
|
|
AND a.hospital_id = f.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND a.behospital_code = d.behospital_code
|
|
|
- AND d.cases_id = e.cases_id
|
|
|
- AND d.cases_entry_id = e.id
|
|
|
AND a.beh_dept_id = f.dept_id
|
|
|
<if test="isPlacefile != null and isPlacefile != ''">
|
|
|
and a.is_placefile = #{isPlacefile}
|
|
@@ -2071,7 +2027,7 @@
|
|
|
</if>
|
|
|
</if>
|
|
|
<if test="level != null and level != ''">
|
|
|
- and c.level = #{level}
|
|
|
+ and a.level = #{level}
|
|
|
</if>
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
@@ -2928,8 +2884,8 @@
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
|
- b.beh_dept_id AS deptId,
|
|
|
- b.beh_dept_name AS deptName,
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
0 AS consultationNum,
|
|
|
0 AS consultationMRNum,
|
|
|
0 AS operationNameNum,
|
|
@@ -2938,18 +2894,11 @@
|
|
|
0 AS operationMRNum,
|
|
|
0 AS crisisNum,
|
|
|
0 AS crisisMRNum,
|
|
|
- sum( c.cases_entry_id = 2495 ) AS stageSummaryNum,
|
|
|
- count( DISTINCT b.behospital_code ) AS stageSummaryMRNum,
|
|
|
+ sum( a.cases_entry_id = 2495 ) AS stageSummaryNum,
|
|
|
+ count( DISTINCT a.behospital_code ) AS stageSummaryMRNum,
|
|
|
0 AS beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- a.hospital_id,
|
|
|
- a.behospital_code,
|
|
|
- a.beh_dept_name,
|
|
|
- a.beh_dept_id
|
|
|
- FROM
|
|
|
- med_behospital_info a
|
|
|
+ med_qcresult_report a
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
AND TIMESTAMPDIFF(
|
|
@@ -2982,18 +2931,14 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name LIKE CONCAT( '%', #{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
|
|
|
- b.beh_dept_id,
|
|
|
- b.beh_dept_name
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
) UNION
|
|
|
(
|
|
|
SELECT
|
|
|
- b.beh_dept_id AS deptId,
|
|
|
- b.beh_dept_name AS deptName,
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
0 AS consultationNum,
|
|
|
0 AS consultationMRNum,
|
|
|
0 AS operationNameNum,
|
|
@@ -3004,30 +2949,12 @@
|
|
|
0 AS crisisMRNum,
|
|
|
0 AS stageSummaryNum,
|
|
|
0 AS stageSummaryMRNum,
|
|
|
- count(*) AS beHosGT31DaysMRNum
|
|
|
+ count(distinct a.behospital_code) AS beHosGT31DaysMRNum
|
|
|
FROM
|
|
|
- (
|
|
|
- SELECT DISTINCT
|
|
|
- a.hospital_id,
|
|
|
- a.behospital_code,
|
|
|
- a.beh_dept_name,
|
|
|
- a.beh_dept_id
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c,
|
|
|
- qc_cases_entry d
|
|
|
+ med_qcresult_report a
|
|
|
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.behospital_code = b.behospital_code
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND c.cases_id = d.cases_id
|
|
|
- AND c.cases_entry_id = d.id
|
|
|
+ AND a.cases_id is not null
|
|
|
AND TIMESTAMPDIFF(
|
|
|
DAY,
|
|
|
DATE( behospital_date ),
|
|
@@ -3058,10 +2985,9 @@
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
AND a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
</if>
|
|
|
- ) b
|
|
|
GROUP BY
|
|
|
- b.beh_dept_id,
|
|
|
- b.beh_dept_name
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
)
|
|
|
) tt
|
|
|
GROUP BY
|