|
@@ -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,
|
|
@@ -2870,7 +2824,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}
|