|
@@ -1302,6 +1302,7 @@
|
|
m1.mrNum,
|
|
m1.mrNum,
|
|
m2.sameMrNum,
|
|
m2.sameMrNum,
|
|
m1.totleValue,
|
|
m1.totleValue,
|
|
|
|
+ m2.sameTotleValue,
|
|
m1.averageValue,
|
|
m1.averageValue,
|
|
m2.sameAvgValue,
|
|
m2.sameAvgValue,
|
|
m1.firstLevelNum,
|
|
m1.firstLevelNum,
|
|
@@ -1460,6 +1461,7 @@
|
|
t1.deptName,
|
|
t1.deptName,
|
|
t2.entryNum as sameNum,
|
|
t2.entryNum as sameNum,
|
|
t1.mrNum as sameMrNum,
|
|
t1.mrNum as sameMrNum,
|
|
|
|
+ t1.totleValue as sameTotleValue,
|
|
t1.averageValue as sameAvgValue,
|
|
t1.averageValue as sameAvgValue,
|
|
t1.firstLevelNum as sameFirstLevelNum,
|
|
t1.firstLevelNum as sameFirstLevelNum,
|
|
t1.secondLevelNum as sameSecondLevelNum,
|
|
t1.secondLevelNum as sameSecondLevelNum,
|
|
@@ -1503,19 +1505,19 @@
|
|
AND a.hospital_id = #{hospitalId}
|
|
AND a.hospital_id = #{hospitalId}
|
|
</if>
|
|
</if>
|
|
<if test="isPlacefile != null and isPlacefile == 0">
|
|
<if test="isPlacefile != null and isPlacefile == 0">
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
|
|
|
+ <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{lastStartDate}]]>
|
|
</if>
|
|
</if>
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
|
|
|
+ <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{lastEndDate}]]>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
<if test="isPlacefile != null and isPlacefile == 1">
|
|
<if test="isPlacefile != null and isPlacefile == 1">
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
|
|
|
+ <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{lastStartDate}]]>
|
|
</if>
|
|
</if>
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
|
|
|
+ <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{lastEndDate}]]>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
<if test="level != null and level != ''">
|
|
<if test="level != null and level != ''">
|
|
@@ -1557,19 +1559,19 @@
|
|
AND a.hospital_id = #{hospitalId}
|
|
AND a.hospital_id = #{hospitalId}
|
|
</if>
|
|
</if>
|
|
<if test="isPlacefile != null and isPlacefile == 0">
|
|
<if test="isPlacefile != null and isPlacefile == 0">
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
|
|
|
+ <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{lastStartDate}]]>
|
|
</if>
|
|
</if>
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
|
|
|
+ <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{lastEndDate}]]>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
<if test="isPlacefile != null and isPlacefile == 1">
|
|
<if test="isPlacefile != null and isPlacefile == 1">
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
|
|
|
+ <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{lastStartDate}]]>
|
|
</if>
|
|
</if>
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
|
|
|
+ <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{lastEndDate}]]>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
</if>
|
|
<if test="level != null and level != ''">
|
|
<if test="level != null and level != ''">
|
|
@@ -2358,477 +2360,6 @@
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(台州) 导出 -->
|
|
|
|
- <select id="levelStatisticsByDeptStr_TZ" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsStrTZDTO">
|
|
|
|
- select
|
|
|
|
- m1.deptId,
|
|
|
|
- m1.deptName,
|
|
|
|
- m1.deptClassId,
|
|
|
|
- m1.deptClass,
|
|
|
|
- m1.entryNum,
|
|
|
|
- m2.sameNum,
|
|
|
|
- m1.mrNum,
|
|
|
|
- m2.sameMrNum,
|
|
|
|
- m1.totleValue,
|
|
|
|
- m2.sameTotleValue,
|
|
|
|
- m1.averageValue,
|
|
|
|
- m2.sameAvgValue,
|
|
|
|
- m1.firstLevelNum,
|
|
|
|
- m2.sameFirstLevelNum,
|
|
|
|
- m1.secondLevelNum,
|
|
|
|
- m2.sameSecondLevelNum,
|
|
|
|
- m1.thirdLevelNum,
|
|
|
|
- m2.sameThirdLevelNum,
|
|
|
|
- m1.firstLevelPercent,
|
|
|
|
- m2.sameFirstLevelPercent,
|
|
|
|
- m1.secondLevelPercent,
|
|
|
|
- m2.sameSecondLevelPercent,
|
|
|
|
- m1.thirdLevelPercent,
|
|
|
|
- m2.sameThirdLevelPercent,
|
|
|
|
- m1.firstLevelPercentStr,
|
|
|
|
- m2.sameFirstLevelPercentStr,
|
|
|
|
- m1.secondLevelPercentStr,
|
|
|
|
- m2.sameSecondLevelPercentStr,
|
|
|
|
- m1.thirdLevelPercentStr,
|
|
|
|
- m2.sameThirdLevelPercentStr
|
|
|
|
- from (
|
|
|
|
- SELECT
|
|
|
|
- t1.deptId,
|
|
|
|
- t1.deptName,
|
|
|
|
- t1.deptClassId,
|
|
|
|
- t1.deptClass,
|
|
|
|
- t2.entryNum,
|
|
|
|
- t1.mrNum,
|
|
|
|
- t1.totleValue,
|
|
|
|
- t1.averageValue,
|
|
|
|
- t1.firstLevelNum,
|
|
|
|
- t1.secondLevelNum,
|
|
|
|
- t1.thirdLevelNum,
|
|
|
|
- t1.firstLevelPercent,
|
|
|
|
- t1.secondLevelPercent,
|
|
|
|
- t1.thirdLevelPercent,
|
|
|
|
- t1.firstLevelPercentStr,
|
|
|
|
- t1.secondLevelPercentStr,
|
|
|
|
- t1.thirdLevelPercentStr
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- tt1.deptId,
|
|
|
|
- tt1.deptName,
|
|
|
|
- e.dept_id AS deptClassId,
|
|
|
|
- e.dept_name AS deptClass,
|
|
|
|
- count(*) AS mrNum,
|
|
|
|
- ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
|
- 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
|
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
|
- d.parent_dept_id AS parentDeptId,
|
|
|
|
- a.hospital_id AS hospitalId,
|
|
|
|
- a.behospital_code AS behospitalCode,
|
|
|
|
- c.score_res AS score,
|
|
|
|
- c.LEVEL
|
|
|
|
- FROM
|
|
|
|
- med_behospital_info a,
|
|
|
|
- med_qcresult_info c,
|
|
|
|
- bas_dept_info d
|
|
|
|
- WHERE
|
|
|
|
- a.is_deleted = 'N'
|
|
|
|
- AND c.is_deleted = 'N'
|
|
|
|
- AND d.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.beh_dept_id = d.dept_id
|
|
|
|
- <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="isPlacefile != null and isPlacefile == 0">
|
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="level != null and level != ''">
|
|
|
|
- and c.level = #{level}
|
|
|
|
- </if>
|
|
|
|
- <if test="name != null and name != ''">
|
|
|
|
- and a.beh_dept_name like CONCAT('%',#{name},'%')
|
|
|
|
- </if>
|
|
|
|
- ) tt1
|
|
|
|
- LEFT JOIN bas_dept_info e ON tt1.parentDeptId = e.dept_id
|
|
|
|
- AND e.is_deleted = 'N'
|
|
|
|
- AND tt1.hospitalId = e.hospital_id
|
|
|
|
- <if test="deptClass != null and deptClass != ''">
|
|
|
|
- WHERE e.dept_name = #{deptClass}
|
|
|
|
- </if>
|
|
|
|
- GROUP BY
|
|
|
|
- tt1.deptId,
|
|
|
|
- tt1.deptName,
|
|
|
|
- e.dept_id,
|
|
|
|
- e.dept_name
|
|
|
|
- ) t1,
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- tt2.deptId,
|
|
|
|
- tt2.deptName,
|
|
|
|
- g.dept_id AS deptClassId,
|
|
|
|
- g.dept_name AS deptClass,
|
|
|
|
- count( * ) AS entryNum
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
|
- f.parent_dept_id AS parentDeptId,
|
|
|
|
- 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,
|
|
|
|
- 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.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}
|
|
|
|
- </if>
|
|
|
|
- AND a.qc_type_id != 0
|
|
|
|
- <if test="hospitalId != null and hospitalId != ''">
|
|
|
|
- AND a.hospital_id = #{hospitalId}
|
|
|
|
- </if>
|
|
|
|
- <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="level != null and level != ''">
|
|
|
|
- and c.level = #{level}
|
|
|
|
- </if>
|
|
|
|
- <if test="name != null and name != ''">
|
|
|
|
- and a.beh_dept_name like CONCAT('%',#{name},'%')
|
|
|
|
- </if>
|
|
|
|
- ) tt2
|
|
|
|
- LEFT JOIN bas_dept_info g ON tt2.parentDeptId = g.dept_id
|
|
|
|
- AND g.is_deleted = 'N'
|
|
|
|
- AND tt2.hospitalId = g.hospital_id
|
|
|
|
- <if test="deptClass != null and deptClass != ''">
|
|
|
|
- WHERE g.dept_name = #{deptClass}
|
|
|
|
- </if>
|
|
|
|
- GROUP BY
|
|
|
|
- tt2.deptId,
|
|
|
|
- tt2.deptName,
|
|
|
|
- g.dept_id,
|
|
|
|
- g.dept_name
|
|
|
|
- ) t2
|
|
|
|
- WHERE
|
|
|
|
- t1.deptId = t2.deptId
|
|
|
|
- AND t1.deptName = t2.deptName)m1 left join
|
|
|
|
- ( SELECT
|
|
|
|
- t1.deptId,
|
|
|
|
- t1.deptName,
|
|
|
|
- t1.deptClassId,
|
|
|
|
- t1.deptClass,
|
|
|
|
- t2.entryNum as sameNum,
|
|
|
|
- t1.mrNum as sameMrNum,
|
|
|
|
- t1.totleValue as sameTotleValue,
|
|
|
|
- t1.averageValue as sameAvgValue,
|
|
|
|
- t1.firstLevelNum as sameFirstLevelNum,
|
|
|
|
- t1.secondLevelNum as sameSecondLevelNum,
|
|
|
|
- t1.thirdLevelNum as sameThirdLevelNum,
|
|
|
|
- t1.firstLevelPercent as sameFirstLevelPercent,
|
|
|
|
- t1.secondLevelPercent as sameSecondLevelPercent,
|
|
|
|
- t1.thirdLevelPercent as sameThirdLevelPercent,
|
|
|
|
- t1.firstLevelPercentStr as sameFirstLevelPercentStr,
|
|
|
|
- t1.secondLevelPercentStr as sameSecondLevelPercentStr,
|
|
|
|
- t1.thirdLevelPercentStr as sameThirdLevelPercentStr
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- tt1.deptId,
|
|
|
|
- tt1.deptName,
|
|
|
|
- e.dept_id AS deptClassId,
|
|
|
|
- e.dept_name AS deptClass,
|
|
|
|
- count(*) AS mrNum,
|
|
|
|
- ROUND( sum( CAST( tt1.score AS DECIMAL ( 18, 2 )) ), 2 ) AS totleValue,
|
|
|
|
- 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
|
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
|
- d.parent_dept_id AS parentDeptId,
|
|
|
|
- a.hospital_id AS hospitalId,
|
|
|
|
- a.behospital_code AS behospitalCode,
|
|
|
|
- c.score_res AS score,
|
|
|
|
- c.LEVEL
|
|
|
|
- FROM
|
|
|
|
- med_behospital_info a,
|
|
|
|
- med_qcresult_info c,
|
|
|
|
- bas_dept_info d
|
|
|
|
- WHERE
|
|
|
|
- a.is_deleted = 'N'
|
|
|
|
- AND c.is_deleted = 'N'
|
|
|
|
- AND d.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.beh_dept_id = d.dept_id
|
|
|
|
- <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="isPlacefile != null and isPlacefile == 0">
|
|
|
|
- <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date >= #{lastStartDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date <= #{lastEndDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
|
- <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{lastStartDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{lastEndDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="level != null and level != ''">
|
|
|
|
- and c.level = #{level}
|
|
|
|
- </if>
|
|
|
|
- <if test="name != null and name != ''">
|
|
|
|
- and a.beh_dept_name like CONCAT('%',#{name},'%')
|
|
|
|
- </if>
|
|
|
|
- ) tt1
|
|
|
|
- LEFT JOIN bas_dept_info e ON tt1.parentDeptId = e.dept_id
|
|
|
|
- AND e.is_deleted = 'N'
|
|
|
|
- AND tt1.hospitalId = e.hospital_id
|
|
|
|
- <if test="deptClass != null and deptClass != ''">
|
|
|
|
- WHERE e.dept_name = #{deptClass}
|
|
|
|
- </if>
|
|
|
|
- GROUP BY
|
|
|
|
- tt1.deptId,
|
|
|
|
- tt1.deptName,
|
|
|
|
- e.dept_id,
|
|
|
|
- e.dept_name
|
|
|
|
- ) t1,
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- tt2.deptId,
|
|
|
|
- tt2.deptName,
|
|
|
|
- g.dept_id AS deptClassId,
|
|
|
|
- g.dept_name AS deptClass,
|
|
|
|
- count( * ) AS entryNum
|
|
|
|
- FROM
|
|
|
|
- (
|
|
|
|
- SELECT
|
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
|
- f.parent_dept_id AS parentDeptId,
|
|
|
|
- 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,
|
|
|
|
- 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.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}
|
|
|
|
- </if>
|
|
|
|
- AND a.qc_type_id != 0
|
|
|
|
- <if test="hospitalId != null and hospitalId != ''">
|
|
|
|
- AND a.hospital_id = #{hospitalId}
|
|
|
|
- </if>
|
|
|
|
- <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
|
- <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date >= #{lastStartDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
- <![CDATA[ AND a.behospital_date <= #{lastEndDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
|
- <if test="lastStartDate != null and lastStartDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{lastStartDate}]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="lastEndDate != null and lastEndDate != ''">
|
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{lastEndDate}]]>
|
|
|
|
- </if>
|
|
|
|
- </if>
|
|
|
|
- <if test="level != null and level != ''">
|
|
|
|
- and c.level = #{level}
|
|
|
|
- </if>
|
|
|
|
- <if test="name != null and name != ''">
|
|
|
|
- and a.beh_dept_name like CONCAT('%',#{name},'%')
|
|
|
|
- </if>
|
|
|
|
- ) tt2
|
|
|
|
- LEFT JOIN bas_dept_info g ON tt2.parentDeptId = g.dept_id
|
|
|
|
- AND g.is_deleted = 'N'
|
|
|
|
- AND tt2.hospitalId = g.hospital_id
|
|
|
|
- <if test="deptClass != null and deptClass != ''">
|
|
|
|
- WHERE g.dept_name = #{deptClass}
|
|
|
|
- </if>
|
|
|
|
- GROUP BY
|
|
|
|
- tt2.deptId,
|
|
|
|
- tt2.deptName,
|
|
|
|
- g.dept_id,
|
|
|
|
- g.dept_name
|
|
|
|
- ) t2
|
|
|
|
- WHERE
|
|
|
|
- t1.deptId = t2.deptId
|
|
|
|
- AND t1.deptName = t2.deptName)m2
|
|
|
|
- on
|
|
|
|
- m1.deptId = m2.deptId
|
|
|
|
- and m1.deptName = m2.deptName
|
|
|
|
- <if test="asc != null and asc !=''">
|
|
|
|
- order by
|
|
|
|
- <choose>
|
|
|
|
- <when test='asc=="deptId"'>m1.deptId asc</when>
|
|
|
|
- <when test='asc=="deptName"'>m1.deptName asc</when>
|
|
|
|
- <when test='asc=="deptClassId"'>m1.deptClassId asc</when>
|
|
|
|
- <when test='asc=="deptClass"'>m1.deptClass asc</when>
|
|
|
|
- <when test='asc=="entryNum"'>m1.entryNum asc</when>
|
|
|
|
- <when test='asc=="sameNum"'>m2.sameNum asc</when>
|
|
|
|
- <when test='asc=="mrNum"'>m1.mrNum asc</when>
|
|
|
|
- <when test='asc=="sameMrNum"'>m2.sameMrNum asc</when>
|
|
|
|
- <when test='asc=="totleValue"'>m1.totleValue asc</when>
|
|
|
|
- <when test='asc=="averageValue"'>m1.averageValue asc</when>
|
|
|
|
- <when test='asc=="sameAvgValue"'>m2.sameAvgValue asc</when>
|
|
|
|
- <when test='asc=="firstLevelNum"'>m1.firstLevelNum asc</when>
|
|
|
|
- <when test='asc=="sameFirstLevelNum"'>m2.sameFirstLevelNum asc</when>
|
|
|
|
- <when test='asc=="secondLevelNum"'>m1.secondLevelNum asc</when>
|
|
|
|
- <when test='asc=="sameSecondLevelNum"'>m2.sameSecondLevelNum asc</when>
|
|
|
|
- <when test='asc=="thirdLevelNum"'>m1.thirdLevelNum asc</when>
|
|
|
|
- <when test='asc=="sameThirdLevelNum"'>m2.sameThirdLevelNum asc</when>
|
|
|
|
- <when test='asc=="firstLevelPercent"'>m1.firstLevelPercent asc</when>
|
|
|
|
- <when test='asc=="sameFirstLevelPercent"'>m2.sameFirstLevelPercent asc</when>
|
|
|
|
- <when test='asc=="secondLevelPercent"'>m1.secondLevelPercent asc</when>
|
|
|
|
- <when test='asc=="sameSecondLevelPercent"'>m2.sameSecondLevelPercent asc</when>
|
|
|
|
- <when test='asc=="thirdLevelPercent"'>m1.thirdLevelPercent asc</when>
|
|
|
|
- <when test='asc=="sameThirdLevelPercent"'>m2.sameThirdLevelPercent asc</when>
|
|
|
|
- <when test='asc=="firstLevelPercentStr"'>m1.firstLevelPercent asc</when>
|
|
|
|
- <when test='asc=="sameFirstLevelPercentStr"'>m2.sameFirstLevelPercentStr asc</when>
|
|
|
|
- <when test='asc=="secondLevelPercentStr"'>m1.secondLevelPercent asc</when>
|
|
|
|
- <when test='asc=="sameSecondLevelPercentStr"'>m2.sameSecondLevelPercentStr asc</when>
|
|
|
|
- <when test='asc=="thirdLevelPercentStr"'>m1.thirdLevelPercent asc</when>
|
|
|
|
- <when test='asc=="sameThirdLevelPercentStr"'>m2.sameThirdLevelPercentStr asc</when>
|
|
|
|
- <otherwise>deptName asc</otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </if>
|
|
|
|
- <if test="desc != null and desc!=''">
|
|
|
|
- order by
|
|
|
|
- <choose>
|
|
|
|
- <when test='desc=="deptId"'>m1.deptId desc</when>
|
|
|
|
- <when test='desc=="deptName"'>m1.deptName desc</when>
|
|
|
|
- <when test='desc=="deptClassId"'>m1.deptClassId desc</when>
|
|
|
|
- <when test='desc=="deptClass"'>m1.deptClass desc</when>
|
|
|
|
- <when test='desc=="entryNum"'>m1.entryNum desc</when>
|
|
|
|
- <when test='desc=="sameNum"'>m2.sameNum desc</when>
|
|
|
|
- <when test='desc=="mrNum"'>m1.mrNum desc</when>
|
|
|
|
- <when test='desc=="sameMrNum"'>m2.sameMrNum desc</when>
|
|
|
|
- <when test='desc=="totleValue"'>m1.totleValue desc</when>
|
|
|
|
- <when test='desc=="averageValue"'>m1.averageValue desc</when>
|
|
|
|
- <when test='desc=="sameAvgValue"'>m2.sameAvgValue desc</when>
|
|
|
|
- <when test='desc=="firstLevelNum"'>m1.firstLevelNum desc</when>
|
|
|
|
- <when test='desc=="sameFirstLevelNum"'>m2.sameFirstLevelNum desc</when>
|
|
|
|
- <when test='desc=="secondLevelNum"'>m1.secondLevelNum desc</when>
|
|
|
|
- <when test='desc=="sameSecondLevelNum"'>m2.sameSecondLevelNum desc</when>
|
|
|
|
- <when test='desc=="thirdLevelNum"'>m1.thirdLevelNum desc</when>
|
|
|
|
- <when test='desc=="sameThirdLevelNum"'>m2.sameThirdLevelNum desc</when>
|
|
|
|
- <when test='desc=="firstLevelPercent"'>m1.firstLevelPercent desc</when>
|
|
|
|
- <when test='desc=="sameFirstLevelPercent"'>m2.sameFirstLevelPercent desc</when>
|
|
|
|
- <when test='desc=="secondLevelPercent"'>m1.secondLevelPercent desc</when>
|
|
|
|
- <when test='desc=="sameSecondLevelPercent"'>m2.sameSecondLevelPercent desc</when>
|
|
|
|
- <when test='desc=="thirdLevelPercent"'>m1.thirdLevelPercent desc</when>
|
|
|
|
- <when test='desc=="sameThirdLevelPercent"'>m2.sameThirdLevelPercent desc</when>
|
|
|
|
- <when test='desc=="firstLevelPercentStr"'>m1.firstLevelPercent desc</when>
|
|
|
|
- <when test='desc=="sameFirstLevelPercentStr"'>m2.sameFirstLevelPercentStr desc</when>
|
|
|
|
- <when test='desc=="secondLevelPercentStr"'>m1.secondLevelPercent desc</when>
|
|
|
|
- <when test='desc=="sameSecondLevelPercentStr"'>m2.sameSecondLevelPercentStr desc</when>
|
|
|
|
- <when test='desc=="thirdLevelPercentStr"'>m1.thirdLevelPercent desc</when>
|
|
|
|
- <when test='desc=="sameThirdLevelPercentStr"'>m2.sameThirdLevelPercentStr desc</when>
|
|
|
|
- <otherwise>deptName desc</otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </if>
|
|
|
|
- </select>
|
|
|
|
-
|
|
|
|
<!-- 病案首页合格率占比 -全院-->
|
|
<!-- 病案首页合格率占比 -全院-->
|
|
<select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO"
|
|
<select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO"
|
|
resultType="com.diagbot.dto.HomePageNumDTO">
|
|
resultType="com.diagbot.dto.HomePageNumDTO">
|