|
@@ -92,6 +92,7 @@
|
|
|
and t.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
|
and t.qc_type_id != 0
|
|
|
+ and t.is_placefile = 1
|
|
|
</select>
|
|
|
|
|
|
<select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
|
|
@@ -200,6 +201,7 @@
|
|
|
select * from med_behospital_info a
|
|
|
where a.is_deleted = 'N'
|
|
|
and a.qc_type_id != 0
|
|
|
+ and a.is_placefile = 1
|
|
|
<if test="filterFlag != null and filterFlag == 0">
|
|
|
and
|
|
|
not EXISTS (
|
|
@@ -222,6 +224,25 @@
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
+ <if test="individuation != null and individuation.contains(1)">
|
|
|
+ union
|
|
|
+ select * from med_behospital_info b
|
|
|
+ where b.is_deleted = 'N'
|
|
|
+ and b.qc_type_id != 0
|
|
|
+ and b.is_placefile = 1
|
|
|
+ <if test="startLeaveDate != null">
|
|
|
+ <![CDATA[ and b.leave_hospital_date >= #{startLeaveDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endLeaveDate != null">
|
|
|
+ <![CDATA[ and b.leave_hospital_date <= #{endLeaveDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="hosptialIdList != null and hosptialIdList.size > 0 ">
|
|
|
+ and b.hospital_id in
|
|
|
+ <foreach collection="hosptialIdList" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<!--质控评分(科室)分页-->
|
|
@@ -295,6 +316,7 @@
|
|
|
and t.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
|
and t.qc_type_id != 0
|
|
|
+ and t.is_placefile = 1
|
|
|
</select>
|
|
|
|
|
|
<!--质控评分(个人)分页-->
|
|
@@ -365,6 +387,7 @@
|
|
|
and t.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
|
and t.qc_type_id != 0
|
|
|
+ and t.is_placefile = 1
|
|
|
</select>
|
|
|
|
|
|
<!-- 出院总人数统计-全院-首页 -->
|
|
@@ -401,7 +424,10 @@
|
|
|
AND a.behospital_code = b.behospital_code
|
|
|
AND a.is_placefile = '1'
|
|
|
-- 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 (
|
|
|
+ ( IFNULL( b.newborn_day, '' ) != '' AND b.newborn_day != '0' )
|
|
|
+ OR ( IFNULL( b.newborn_month, '' )!= '' AND b.newborn_month != '0' )
|
|
|
+ )
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -1185,9 +1211,225 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计(上级科室允许为空) -->
|
|
|
+ <select id="levelStatisticsByDeptClass2" 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
|
|
|
+ tt1.deptId,
|
|
|
+ tt1.deptName,
|
|
|
+ e.dept_id AS deptClassId,
|
|
|
+ e.dept_name AS deptClass,
|
|
|
+ count( DISTINCT tt1.behospitalCode ) 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
|
|
|
+ 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
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ <![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>
|
|
|
+ ) 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
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ <![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>
|
|
|
+ ) 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
|
|
|
+ <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=="deptClassId"'>deptClassId asc</when>
|
|
|
+ <when test='asc=="deptClass"'>deptClass 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=="deptClassId"'>deptClassId desc</when>
|
|
|
+ <when test='desc=="deptClass"'>deptClass 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">
|
|
|
+ resultType="com.diagbot.dto.HomePageNumDTO">
|
|
|
SELECT
|
|
|
t1.deptId,
|
|
|
t1.deptName,
|
|
@@ -1200,29 +1442,32 @@
|
|
|
t1.firstLevelPercent,
|
|
|
t1.secondLevelPercent,
|
|
|
t1.firstLevelPercentStr,
|
|
|
- t1.secondLevelPercentStr
|
|
|
+ t1.secondLevelPercentStr,
|
|
|
+ t3.emptyNum,
|
|
|
+ t3.errorNum,
|
|
|
+ t3.entryTotleNum,
|
|
|
+ t3.emptyPercent,
|
|
|
+ t3.errorPercent,
|
|
|
+ t3.emptyPercentStr,
|
|
|
+ t3.errorPercentStr
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
a.beh_dept_id AS deptId,
|
|
|
a.beh_dept_name AS deptName,
|
|
|
- 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 a.behospital_code ) 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,
|
|
|
+ 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 ),
|
|
|
+ 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 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
'%'
|
|
|
) AS secondLevelPercentStr
|
|
|
FROM
|
|
@@ -1298,10 +1543,80 @@
|
|
|
GROUP BY
|
|
|
a.beh_dept_id,
|
|
|
a.beh_dept_name
|
|
|
- ) t2
|
|
|
+ ) t2,(
|
|
|
+ SELECT
|
|
|
+ h1.deptId,
|
|
|
+ h1.deptName,
|
|
|
+ h1.emptyNum,
|
|
|
+ h1.errorNum,
|
|
|
+ h1.mrNum,
|
|
|
+ h2.entryNum,
|
|
|
+ h1.mrNum * h2.entryNum AS entryTotleNum,
|
|
|
+ ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
|
|
|
+ ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
|
|
|
+ CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
|
|
|
+ CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ sum( d.rule_type = 1 ) AS emptyNum,
|
|
|
+ sum( d.rule_type = 2 ) AS errorNum,
|
|
|
+ count( DISTINCT a.behospital_code ) AS mrNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_cases b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases_entry d
|
|
|
+ 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 b.cases_id = c.cases_id
|
|
|
+ AND c.cases_id = d.cases_id
|
|
|
+ AND c.cases_entry_id = d.id
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ AND d.cases_id = 243
|
|
|
+ <![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 b.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and a.beh_dept_name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ ) h1,(
|
|
|
+ SELECT
|
|
|
+ count(*) AS entryNum
|
|
|
+ FROM
|
|
|
+ qc_cases_entry
|
|
|
+ WHERE
|
|
|
+ is_deleted = 'N'
|
|
|
+ AND cases_id = 243
|
|
|
+ ) h2
|
|
|
+ ) t3
|
|
|
WHERE
|
|
|
t1.deptId = t2.deptId
|
|
|
+ AND t1.deptId = t3.deptId
|
|
|
AND t1.deptName = t2.deptName
|
|
|
+ AND t1.deptName = t3.deptName
|
|
|
<if test="asc != null and asc !=''">
|
|
|
order by
|
|
|
<choose>
|
|
@@ -1317,6 +1632,13 @@
|
|
|
<when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
|
|
|
<when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
<when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
|
|
|
+ <when test='asc=="emptyNum"'>emptyNum asc</when>
|
|
|
+ <when test='asc=="errorNum"'>errorNum asc</when>
|
|
|
+ <when test='asc=="entryTotleNum"'>entryTotleNum asc</when>
|
|
|
+ <when test='asc=="emptyPercent"'>emptyPercent asc</when>
|
|
|
+ <when test='asc=="errorPercent"'>errorPercent asc</when>
|
|
|
+ <when test='asc=="emptyPercentStr"'>emptyPercent asc</when>
|
|
|
+ <when test='asc=="errorPercentStr"'>errorPercent asc</when>
|
|
|
<otherwise>deptName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
@@ -1335,6 +1657,13 @@
|
|
|
<when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
|
|
|
<when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
<when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
+ <when test='desc=="emptyNum"'>emptyNum desc</when>
|
|
|
+ <when test='desc=="errorNum"'>errorNum desc</when>
|
|
|
+ <when test='desc=="entryTotleNum"'>entryTotleNum desc</when>
|
|
|
+ <when test='desc=="emptyPercent"'>emptyPercent desc</when>
|
|
|
+ <when test='desc=="errorPercent"'>errorPercent desc</when>
|
|
|
+ <when test='desc=="emptyPercentStr"'>emptyPercent desc</when>
|
|
|
+ <when test='desc=="errorPercentStr"'>errorPercent desc</when>
|
|
|
<otherwise>deptName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
@@ -1529,7 +1858,7 @@
|
|
|
|
|
|
<!-- 病案首页合格率占比-科室 -->
|
|
|
<select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO"
|
|
|
- resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ resultType="com.diagbot.dto.HomePageNumDTO">
|
|
|
SELECT
|
|
|
t1.doctorId,
|
|
|
t1.doctorName,
|
|
@@ -1542,29 +1871,32 @@
|
|
|
t1.firstLevelPercent,
|
|
|
t1.secondLevelPercent,
|
|
|
t1.firstLevelPercentStr,
|
|
|
- t1.secondLevelPercentStr
|
|
|
+ t1.secondLevelPercentStr,
|
|
|
+ t3.emptyNum,
|
|
|
+ t3.errorNum,
|
|
|
+ t3.entryTotleNum,
|
|
|
+ t3.emptyPercent,
|
|
|
+ t3.errorPercent,
|
|
|
+ t3.emptyPercentStr,
|
|
|
+ t3.errorPercentStr
|
|
|
FROM
|
|
|
(
|
|
|
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,
|
|
|
+ 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,
|
|
|
+ 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,
|
|
|
+ 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 ),
|
|
|
+ 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 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
'%'
|
|
|
) AS secondLevelPercentStr
|
|
|
FROM
|
|
@@ -1594,7 +1926,12 @@
|
|
|
and c.level = #{level}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.doctor_name like CONCAT('%',#{name},'%')
|
|
|
+ <if test="name == '未知'">
|
|
|
+ and (a.doctor_name is null or a.doctor_name='')
|
|
|
+ </if>
|
|
|
+ <if test="name != '未知'">
|
|
|
+ and a.doctor_name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<if test="userId!=null and userId !=''">
|
|
|
AND f.user_id = #{userId}
|
|
@@ -1608,8 +1945,8 @@
|
|
|
) t1,
|
|
|
(
|
|
|
SELECT
|
|
|
- a.doctor_id AS doctorId,
|
|
|
- a.doctor_name AS doctorName,
|
|
|
+ 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( * ) AS entryNum
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
@@ -1647,7 +1984,12 @@
|
|
|
and c.level = #{level}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- and a.doctor_name like CONCAT('%',#{name},'%')
|
|
|
+ <if test="name == '未知'">
|
|
|
+ and (a.doctor_name is null or a.doctor_name='')
|
|
|
+ </if>
|
|
|
+ <if test="name != '未知'">
|
|
|
+ and a.doctor_name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
</if>
|
|
|
<if test="userId!=null and userId !=''">
|
|
|
AND f.user_id = #{userId}
|
|
@@ -1658,10 +2000,94 @@
|
|
|
GROUP BY
|
|
|
a.doctor_id,
|
|
|
a.doctor_name
|
|
|
- ) t2
|
|
|
+ ) t2,(
|
|
|
+ SELECT
|
|
|
+ h1.doctorId,
|
|
|
+ h1.doctorName,
|
|
|
+ h1.emptyNum,
|
|
|
+ h1.errorNum,
|
|
|
+ h1.mrNum,
|
|
|
+ h2.entryNum,
|
|
|
+ h1.mrNum * h2.entryNum AS entryTotleNum,
|
|
|
+ ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS emptyPercent,
|
|
|
+ ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum ), 4 ) AS errorPercent,
|
|
|
+ CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.emptyNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS emptyPercentStr,
|
|
|
+ CONCAT( ROUND( ( h1.mrNum * h2.entryNum - h1.errorNum ) / ( h1.mrNum * h2.entryNum )* 100, 2 ), '%' ) AS errorPercentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ 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,
|
|
|
+ sum( d.rule_type = 1 ) AS emptyNum,
|
|
|
+ sum( d.rule_type = 2 ) AS errorNum,
|
|
|
+ count( DISTINCT a.behospital_code ) AS mrNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_cases b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases_entry d,
|
|
|
+ sys_user_dept 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 = e.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND b.cases_id = c.cases_id
|
|
|
+ AND c.cases_id = d.cases_id
|
|
|
+ AND c.cases_entry_id = d.id
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ AND d.cases_id = 243
|
|
|
+ <![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 b.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ <if test="name == '未知'">
|
|
|
+ and (a.doctor_name is null or a.doctor_name='')
|
|
|
+ </if>
|
|
|
+ <if test="name != '未知'">
|
|
|
+ and a.doctor_name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="userId!=null and userId !=''">
|
|
|
+ AND e.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="deptName!=null and deptName !=''">
|
|
|
+ AND a.beh_dept_name = #{deptName}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ ) h1,(
|
|
|
+ SELECT
|
|
|
+ count(*) AS entryNum
|
|
|
+ FROM
|
|
|
+ qc_cases_entry
|
|
|
+ WHERE
|
|
|
+ is_deleted = 'N'
|
|
|
+ AND cases_id = 243
|
|
|
+ ) h2
|
|
|
+ ) t3
|
|
|
WHERE
|
|
|
t1.doctorId = t2.doctorId
|
|
|
+ AND t1.doctorId = t3.doctorId
|
|
|
AND t1.doctorName = t2.doctorName
|
|
|
+ AND t1.doctorName = t3.doctorName
|
|
|
<if test="asc != null and asc !=''">
|
|
|
order by
|
|
|
<choose>
|
|
@@ -1673,13 +2099,17 @@
|
|
|
<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>
|
|
|
+ <when test='asc=="emptyNum"'>emptyNum asc</when>
|
|
|
+ <when test='asc=="errorNum"'>errorNum asc</when>
|
|
|
+ <when test='asc=="entryTotleNum"'>entryTotleNum asc</when>
|
|
|
+ <when test='asc=="emptyPercent"'>emptyPercent asc</when>
|
|
|
+ <when test='asc=="errorPercent"'>errorPercent asc</when>
|
|
|
+ <when test='asc=="emptyPercentStr"'>emptyPercent asc</when>
|
|
|
+ <when test='asc=="errorPercentStr"'>errorPercent asc</when>
|
|
|
<otherwise>doctorName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
@@ -1694,13 +2124,17 @@
|
|
|
<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>
|
|
|
+ <when test='desc=="emptyNum"'>emptyNum desc</when>
|
|
|
+ <when test='desc=="errorNum"'>errorNum desc</when>
|
|
|
+ <when test='desc=="entryTotleNum"'>entryTotleNum desc</when>
|
|
|
+ <when test='desc=="emptyPercent"'>emptyPercent desc</when>
|
|
|
+ <when test='desc=="errorPercent"'>errorPercent desc</when>
|
|
|
+ <when test='desc=="emptyPercentStr"'>emptyPercent desc</when>
|
|
|
+ <when test='desc=="errorPercentStr"'>errorPercent desc</when>
|
|
|
<otherwise>doctorName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|