|
@@ -1068,6 +1068,208 @@
|
|
</if>
|
|
</if>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计 -->
|
|
|
|
+ <select id="levelStatisticsByDeptClass" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
|
+ 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
|
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
|
+ e.dept_id AS deptClassId,
|
|
|
|
+ e.dept_name AS deptClass,
|
|
|
|
+ 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
|
|
|
|
+ FROM
|
|
|
|
+ med_behospital_info a,
|
|
|
|
+ med_home_page b,
|
|
|
|
+ med_qcresult_info c,
|
|
|
|
+ bas_dept_info d,
|
|
|
|
+ bas_dept_info e
|
|
|
|
+ WHERE
|
|
|
|
+ a.is_deleted = 'N'
|
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
|
+ AND a.hospital_id = e.hospital_id
|
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
|
+ AND a.beh_dept_id = d.dept_id
|
|
|
|
+ AND d.parent_dept_id = e.dept_id
|
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
|
|
|
|
+ </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>
|
|
|
|
+ <if test="className != null and className != ''">
|
|
|
|
+ and e.dept_name = #{className}
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ a.beh_dept_id,
|
|
|
|
+ a.beh_dept_name,
|
|
|
|
+ e.dept_id,
|
|
|
|
+ e.dept_name
|
|
|
|
+ ) t1,
|
|
|
|
+ (
|
|
|
|
+ SELECT
|
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
|
+ g.dept_id AS deptClassId,
|
|
|
|
+ g.dept_name AS deptClass,
|
|
|
|
+ count( * ) AS entryNum
|
|
|
|
+ FROM
|
|
|
|
+ med_behospital_info a,
|
|
|
|
+ med_home_page b,
|
|
|
|
+ med_qcresult_info c,
|
|
|
|
+ med_qcresult_detail d,
|
|
|
|
+ qc_cases_entry e,
|
|
|
|
+ bas_dept_info f,
|
|
|
|
+ bas_dept_info g
|
|
|
|
+ WHERE
|
|
|
|
+ a.is_deleted = 'N'
|
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
|
+ AND f.is_deleted = 'N'
|
|
|
|
+ AND g.is_deleted = 'N'
|
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
|
+ AND a.hospital_id = f.hospital_id
|
|
|
|
+ AND a.hospital_id = g.hospital_id
|
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
|
+ 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
|
|
|
|
+ AND f.parent_dept_id = g.dept_id
|
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{startDate})]]>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
|
|
|
|
+ </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>
|
|
|
|
+ <if test="className != null and className != ''">
|
|
|
|
+ and g.dept_name = #{className}
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY
|
|
|
|
+ a.beh_dept_id,
|
|
|
|
+ a.beh_dept_name,
|
|
|
|
+ g.dept_id,
|
|
|
|
+ g.dept_name
|
|
|
|
+ ) t2
|
|
|
|
+ WHERE
|
|
|
|
+ t1.deptId = t2.deptId
|
|
|
|
+ AND t1.deptName = t2.deptName
|
|
|
|
+ AND t1.deptClassId = t2.deptClassId
|
|
|
|
+ AND t1.deptClass = t2.deptClass
|
|
|
|
+ <if test="asc != null and asc !=''">
|
|
|
|
+ order by
|
|
|
|
+ <choose>
|
|
|
|
+ <when test='asc=="deptId"'>deptId asc</when>
|
|
|
|
+ <when test='asc=="deptName"'>deptName asc</when>
|
|
|
|
+ <when test='asc=="entryNum"'>entryNum asc</when>
|
|
|
|
+ <when test='asc=="mrNum"'>mrNum asc</when>
|
|
|
|
+ <when test='asc=="totleValue"'>totleValue asc</when>
|
|
|
|
+ <when test='asc=="averageValue"'>averageValue asc</when>
|
|
|
|
+ <when test='asc=="firstLevelNum"'>firstLevelNum asc</when>
|
|
|
|
+ <when test='asc=="secondLevelNum"'>secondLevelNum asc</when>
|
|
|
|
+ <when test='asc=="thirdLevelNum"'>thirdLevelNum asc</when>
|
|
|
|
+ <when test='asc=="firstLevelPercent"'>firstLevelPercent asc</when>
|
|
|
|
+ <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
|
|
|
|
+ <when test='asc=="thirdLevelPercent"'>thirdLevelPercent asc</when>
|
|
|
|
+ <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
|
+ <when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
|
|
|
|
+ <when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
|
|
|
|
+ <otherwise> deptName asc </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="desc != null and desc!=''">
|
|
|
|
+ order by
|
|
|
|
+ <choose>
|
|
|
|
+ <when test='desc=="deptId"'>deptId desc</when>
|
|
|
|
+ <when test='desc=="deptName"'>deptName desc</when>
|
|
|
|
+ <when test='desc=="entryNum"'>entryNum desc</when>
|
|
|
|
+ <when test='desc=="mrNum"'>mrNum desc</when>
|
|
|
|
+ <when test='desc=="totleValue"'>totleValue desc</when>
|
|
|
|
+ <when test='desc=="averageValue"'>averageValue desc</when>
|
|
|
|
+ <when test='desc=="firstLevelNum"'>firstLevelNum desc</when>
|
|
|
|
+ <when test='desc=="secondLevelNum"'>secondLevelNum desc</when>
|
|
|
|
+ <when test='desc=="thirdLevelNum"'>thirdLevelNum desc</when>
|
|
|
|
+ <when test='desc=="firstLevelPercent"'>firstLevelPercent desc</when>
|
|
|
|
+ <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
|
|
|
|
+ <when test='desc=="thirdLevelPercent"'>thirdLevelPercent desc</when>
|
|
|
|
+ <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
|
+ <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
|
+ <when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
|
|
|
|
+ <otherwise> deptName desc </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<!-- 病案首页合格率占比 -全院-->
|
|
<!-- 病案首页合格率占比 -全院-->
|
|
<select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
<select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
SELECT
|
|
SELECT
|