|
@@ -617,8 +617,11 @@
|
|
|
AND a.hospital_id = c.hospital_id
|
|
|
AND a.behospital_code = b.behospital_code
|
|
|
AND a.beh_dept_id = c.dept_id
|
|
|
- AND ( b.age IS NULL OR b.age = '-' OR b.age = '' )
|
|
|
- <![CDATA[AND ( b.newborn_month IS NOT NULL OR b.newborn_month <> '' OR b.newborn_day IS NOT NULL OR b.newborn_day <> '' )]]>
|
|
|
+ -- AND ( b.age IS NULL OR b.age = '-' OR b.age = '' )
|
|
|
+ AND (
|
|
|
+ ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' )
|
|
|
+ OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' )
|
|
|
+ )
|
|
|
AND a.is_placefile = '1'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="userId!=null">
|
|
@@ -929,33 +932,18 @@
|
|
|
SELECT
|
|
|
a.beh_dept_id AS deptId,
|
|
|
a.beh_dept_name AS deptName,
|
|
|
- count( DISTINCT c.id ) AS mrNum,
|
|
|
+ count(*) AS mrNum,
|
|
|
ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
- ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END ) AS firstLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END ) AS secondLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END ) AS thirdLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
- ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
- ) AS secondLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
- ) AS thirdLevelPercent,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
- 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS firstLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
- 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS secondLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
- 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS thirdLevelPercentStr
|
|
|
+ ROUND( avg( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
|
|
|
+ SUM( c.`level` = '甲' ) AS firstLevelNum,
|
|
|
+ SUM( c.`level` = '乙' ) AS secondLevelNum,
|
|
|
+ SUM( c.`level` = '丙' ) AS thirdLevelNum,
|
|
|
+ ROUND( SUM( c.`level` = '甲' )/ count(*), 4 ) AS firstLevelPercent,
|
|
|
+ ROUND( SUM( c.`level` = '乙' )/ count(*), 4 ) AS secondLevelPercent,
|
|
|
+ ROUND( SUM( c.`level` = '丙' )/ count(*), 4 ) AS thirdLevelPercent,
|
|
|
+ concat( ROUND( SUM( c.`level` = '甲' )/ count(*)* 100, 2 ), '%' ) AS firstLevelPercentStr,
|
|
|
+ concat( ROUND( SUM( c.`level` = '乙' )/ count(*)* 100, 2 ), '%' ) AS secondLevelPercentStr,
|
|
|
+ concat( ROUND( SUM( c.`level` = '丙' )/ count(*)* 100, 2 ), '%' ) AS thirdLevelPercentStr
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_qcresult_info c
|
|
@@ -965,7 +953,7 @@
|
|
|
AND a.hospital_id = c.hospital_id
|
|
|
AND a.behospital_code = c.behospital_code
|
|
|
AND a.is_placefile = '1'
|
|
|
- <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
@@ -1007,7 +995,7 @@
|
|
|
AND d.cases_id = e.cases_id
|
|
|
AND d.cases_entry_id = e.id
|
|
|
AND a.is_placefile = '1'
|
|
|
- <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
@@ -1074,7 +1062,7 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州 -->
|
|
|
+ <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计-关联上级科室 -->
|
|
|
<select id="levelStatisticsByDeptClass" parameterType="com.diagbot.vo.FilterOrderVO"
|
|
|
resultType="com.diagbot.dto.LevelStatisticsTZDTO">
|
|
|
SELECT
|
|
@@ -1281,7 +1269,7 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空) -->
|
|
|
+ <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州) -->
|
|
|
<select id="levelStatisticsByDeptClass_TZ" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsTZDTO">
|
|
|
SELECT
|
|
|
t1.deptId,
|
|
@@ -1308,27 +1296,18 @@
|
|
|
tt1.deptName,
|
|
|
e.dept_id AS deptClassId,
|
|
|
e.dept_name AS deptClass,
|
|
|
- count( DISTINCT tt1.behospitalCode ) AS mrNum,
|
|
|
+ count(*) AS mrNum,
|
|
|
ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
- ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
|
|
|
- COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END ) AS firstLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END ) AS secondLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END ) AS thirdLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS secondLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode ), 4 ) AS thirdLevelPercent,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '甲' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS firstLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '乙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS secondLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN tt1.`level` = '丙' THEN tt1.behospitalCode END )/ count( DISTINCT tt1.behospitalCode )* 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS thirdLevelPercentStr
|
|
|
+ ROUND( avg( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
|
|
|
+ sum( tt1.`level` = '甲' ) AS firstLevelNum,
|
|
|
+ sum( tt1.`level` = '乙' ) AS secondLevelNum,
|
|
|
+ sum( tt1.`level` = '丙' ) AS thirdLevelNum,
|
|
|
+ ROUND( sum( tt1.`level` = '甲' )/ count( * ), 4 ) AS firstLevelPercent,
|
|
|
+ ROUND( sum( tt1.`level` = '乙' )/ count( * ), 4 ) AS secondLevelPercent,
|
|
|
+ ROUND( sum( tt1.`level` = '丙' )/ count( * ), 4 ) AS thirdLevelPercent,
|
|
|
+ concat( ROUND( sum( tt1.`level` = '甲' )/ count( * )* 100, 2 ), '%' ) AS firstLevelPercentStr,
|
|
|
+ concat( ROUND( sum( tt1.`level` = '乙' )/ count( * )* 100, 2 ), '%' ) AS secondLevelPercentStr,
|
|
|
+ concat( ROUND( sum( tt1.`level` = '丙' )/ count( * )* 100, 2 ), '%' ) AS thirdLevelPercentStr
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -1352,7 +1331,8 @@
|
|
|
AND a.behospital_code = c.behospital_code
|
|
|
AND a.beh_dept_id = d.dept_id
|
|
|
AND a.is_placefile = '1'
|
|
|
- <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
@@ -1417,7 +1397,8 @@
|
|
|
AND d.cases_entry_id = e.id
|
|
|
AND a.beh_dept_id = f.dept_id
|
|
|
AND a.is_placefile = '1'
|
|
|
- <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
@@ -1525,21 +1506,15 @@
|
|
|
SELECT
|
|
|
a.beh_dept_id AS deptId,
|
|
|
a.beh_dept_name AS deptName,
|
|
|
- count( DISTINCT a.behospital_code ) AS mrNum,
|
|
|
+ count( * ) AS mrNum,
|
|
|
ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
- ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS firstLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS secondLevelPercentStr
|
|
|
+ ROUND( avg( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
|
|
|
+ SUM( c.`level` = '合格' ) AS firstLevelNum,
|
|
|
+ SUM( c.`level` = '不合格' ) AS secondLevelNum,
|
|
|
+ ROUND( SUM( c.`level` = '合格' )/ count( * ), 4 ) AS firstLevelPercent,
|
|
|
+ ROUND( SUM( c.`level` = '不合格' )/ count( * ), 4 ) AS secondLevelPercent,
|
|
|
+ concat( ROUND( SUM( c.`level` = '合格' )/ count( * )* 100, 2 ),'%' ) AS firstLevelPercentStr,
|
|
|
+ concat( ROUND( SUM( c.`level` = '不合格' )/ count( * )* 100, 2 ),'%' ) AS secondLevelPercentStr
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_qcresult_cases c
|
|
@@ -1763,33 +1738,18 @@
|
|
|
SELECT
|
|
|
a.doctor_id AS doctorId,
|
|
|
a.doctor_name AS doctorName,
|
|
|
- count( DISTINCT c.id ) AS mrNum,
|
|
|
- ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
- ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END ) AS firstLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END ) AS secondLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END ) AS thirdLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
- ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
- ) AS secondLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
- ) AS thirdLevelPercent,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
- 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS firstLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
- 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS secondLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
- 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS thirdLevelPercentStr
|
|
|
+ count(*) AS mrNum,
|
|
|
+ ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
+ ROUND( avg( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
|
|
|
+ SUM( c.`level` = '甲' ) AS firstLevelNum,
|
|
|
+ SUM( c.`level` = '乙' ) AS secondLevelNum,
|
|
|
+ SUM( c.`level` = '丙' ) AS thirdLevelNum,
|
|
|
+ ROUND( SUM( c.`level` = '甲' )/ count(*), 4 ) AS firstLevelPercent,
|
|
|
+ ROUND( SUM( c.`level` = '乙' )/ count(*), 4 ) AS secondLevelPercent,
|
|
|
+ ROUND( SUM( c.`level` = '丙' )/ count(*), 4 ) AS thirdLevelPercent,
|
|
|
+ concat( ROUND( SUM( c.`level` = '甲' )/ count(*)* 100, 2 ), '%' ) AS firstLevelPercentStr,
|
|
|
+ concat( ROUND( SUM( c.`level` = '乙' )/ count(*)* 100, 2 ), '%' ) AS secondLevelPercentStr,
|
|
|
+ concat( ROUND( SUM( c.`level` = '丙' )/ count(*)* 100, 2 ), '%' ) AS thirdLevelPercentStr
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_qcresult_info c,
|
|
@@ -1954,21 +1914,15 @@
|
|
|
SELECT
|
|
|
CASE WHEN a.doctor_id is NULL OR a.doctor_id ='' THEN '未知' ELSE a.doctor_id END AS doctorId,
|
|
|
CASE WHEN a.doctor_name is NULL OR a.doctor_name ='' THEN '未知' ELSE a.doctor_name END AS doctorName,
|
|
|
- count( DISTINCT a.behospital_code ) AS mrNum,
|
|
|
+ count( * ) AS mrNum,
|
|
|
ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
- ROUND( sum( CAST( c.score_res AS DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
|
|
|
- COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS firstLevelPercentStr,
|
|
|
- concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
- '%'
|
|
|
- ) AS secondLevelPercentStr
|
|
|
+ ROUND( avg( CAST( c.score_res AS DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
|
|
|
+ sum( c.`level` = '合格' ) AS firstLevelNum,
|
|
|
+ sum( c.`level` = '不合格' ) AS secondLevelNum,
|
|
|
+ ROUND( sum( c.`level` = '合格' ) / count( * ), 4 ) AS firstLevelPercent,
|
|
|
+ ROUND( sum( c.`level` = '不合格' )/ count( * ), 4 ) AS secondLevelPercent,
|
|
|
+ concat( ROUND( sum( c.`level` = '合格' ) / count( * )* 100, 2 ), '%' ) AS firstLevelPercentStr,
|
|
|
+ concat( ROUND( sum( c.`level` = '不合格' )/ count( * )* 100, 2 ), '%' ) AS secondLevelPercentStr
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_qcresult_cases c,
|
|
@@ -2725,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,
|
|
@@ -2738,6 +2692,10 @@
|
|
|
t2.age
|
|
|
FROM
|
|
|
(
|
|
|
+ SELECT
|
|
|
+ DISTINCT tt1.*
|
|
|
+ FROM
|
|
|
+ (
|
|
|
SELECT DISTINCT
|
|
|
a.hospital_id,
|
|
|
a.behospital_code,
|
|
@@ -2790,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">
|
|
@@ -2799,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>
|
|
|
|
|
|
<!-- 条目缺陷质控评分页-科室(内页)-->
|
|
@@ -2870,7 +2861,7 @@
|
|
|
AND a.beh_dept_name = #{qcResultShortPageVO.behDeptName}
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
- AND a.beh_dept_name = #{qcResultShortPageVO.doctorName}
|
|
|
+ AND a.doctor_name = #{qcResultShortPageVO.doctorName}
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
|
|
|
AND b.`level` = #{qcResultShortPageVO.level}
|
|
@@ -2994,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
|
|
@@ -3089,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
|
|
@@ -3101,14 +3090,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 +3111,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 +3135,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 +3166,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 +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
|
|
@@ -3209,8 +3196,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 +3206,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 +3216,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 +3237,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
|