|
@@ -885,9 +885,25 @@
|
|
|
<!-- 各科室缺陷占比(组合) -->
|
|
|
<select id="levelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
+ t1.deptId,
|
|
|
+ t1.deptName,
|
|
|
+ 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,
|
|
|
- count( DISTINCT d.id ) AS entryNum,
|
|
|
count( DISTINCT c.id ) AS mrNum,
|
|
|
ROUND( sum( c.score_res ), 2 ) AS totleValue,
|
|
|
ROUND( sum( c.score_res )/ count(*), 2 ) AS averageValue,
|
|
@@ -904,7 +920,7 @@
|
|
|
concat(
|
|
|
ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
'%'
|
|
|
- ) AS sencondLevelPercentStr,
|
|
|
+ ) AS secondLevelPercentStr,
|
|
|
concat(
|
|
|
(
|
|
|
100-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 )),
|
|
@@ -913,6 +929,41 @@
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_home_page b,
|
|
|
+ med_qcresult_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 a.behospital_code = c.behospital_code
|
|
|
+ <![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>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name)t1,
|
|
|
+ (SELECT
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ count( DISTINCT d.id ) AS entryNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
med_qcresult_info c,
|
|
|
med_qcresult_detail d
|
|
|
WHERE
|
|
@@ -944,7 +995,9 @@
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
+ a.beh_dept_name)t2
|
|
|
+ where t1.deptId=t2.deptId
|
|
|
+ and t1.deptName=t2.deptName
|
|
|
<if test="asc != null and asc !=''">
|
|
|
order by
|
|
|
<choose>
|
|
@@ -992,9 +1045,22 @@
|
|
|
<!-- 病案首页合格率占比 -->
|
|
|
<select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
+ t1.deptId,
|
|
|
+ t1.deptName,
|
|
|
+ t2.entryNum,
|
|
|
+ t1.mrNum,
|
|
|
+ t1.totleValue,
|
|
|
+ t1.averageValue,
|
|
|
+ t1.firstLevelNum,
|
|
|
+ t1.secondLevelNum,
|
|
|
+ t1.firstLevelPercent,
|
|
|
+ t1.secondLevelPercent,
|
|
|
+ t1.firstLevelPercentStr,
|
|
|
+ t1.secondLevelPercentStr
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
a.beh_dept_id AS deptId,
|
|
|
a.beh_dept_name AS deptName,
|
|
|
- count( DISTINCT d.id ) AS entryNum,
|
|
|
count( DISTINCT c.id ) AS mrNum,
|
|
|
ROUND( sum( c.score_res ), 2 ) AS totleValue,
|
|
|
ROUND( sum( c.score_res )/ count(*), 2 ) AS averageValue,
|
|
@@ -1013,6 +1079,42 @@
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_home_page b,
|
|
|
+ med_qcresult_cases 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 a.behospital_code = c.behospital_code
|
|
|
+ AND c.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 c.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)t1,
|
|
|
+ (SELECT
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ count( DISTINCT d.id ) AS entryNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
med_qcresult_cases c,
|
|
|
med_qcresult_detail d
|
|
|
WHERE
|
|
@@ -1046,7 +1148,9 @@
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
+ a.beh_dept_name) t2
|
|
|
+ where t1.deptId=t2.deptId
|
|
|
+ and t1.deptName=t2.deptName
|
|
|
<if test="asc != null and asc !=''">
|
|
|
order by
|
|
|
<choose>
|
|
@@ -1088,9 +1192,25 @@
|
|
|
<!-- 各科室缺陷占比(主任医生) -->
|
|
|
<select id="levelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
+ t1.doctorId,
|
|
|
+ t1.doctorName,
|
|
|
+ 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.doctor_id AS doctorId,
|
|
|
a.doctor_name AS doctorName,
|
|
|
- count( DISTINCT d.id ) AS entryNum,
|
|
|
count( DISTINCT c.id ) AS mrNum,
|
|
|
ROUND( sum( c.score_res ), 2 ) AS totleValue,
|
|
|
ROUND( sum( c.score_res )/ count(*), 2 ) AS averageValue,
|
|
@@ -1107,7 +1227,7 @@
|
|
|
concat(
|
|
|
ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
'%'
|
|
|
- ) AS sencondLevelPercentStr,
|
|
|
+ ) AS secondLevelPercentStr,
|
|
|
concat(
|
|
|
(
|
|
|
100-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 )),
|
|
@@ -1117,6 +1237,50 @@
|
|
|
med_behospital_info a,
|
|
|
med_home_page b,
|
|
|
med_qcresult_info c,
|
|
|
+ sys_user_dept e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND e.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 a.beh_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.doctor_name like CONCAT('%',#{name},'%')
|
|
|
+ </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)t1,
|
|
|
+ (SELECT
|
|
|
+ a.doctor_id AS doctorId,
|
|
|
+ a.doctor_name AS doctorName,
|
|
|
+ count( DISTINCT d.id ) AS entryNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
med_qcresult_detail d,
|
|
|
sys_user_dept e
|
|
|
WHERE
|
|
@@ -1124,6 +1288,7 @@
|
|
|
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
|
|
@@ -1155,7 +1320,10 @@
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
a.doctor_id,
|
|
|
- a.doctor_name
|
|
|
+ a.doctor_name)t2
|
|
|
+ WHERE
|
|
|
+ t1.doctorId = t2.doctorId
|
|
|
+ AND t1.doctorName = t2.doctorName
|
|
|
<if test="asc != null and asc !=''">
|
|
|
order by
|
|
|
<choose>
|
|
@@ -1203,9 +1371,22 @@
|
|
|
<!-- 病案首页合格率占比(主任医生) -->
|
|
|
<select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
+ t1.doctorId,
|
|
|
+ t1.doctorName,
|
|
|
+ t2.entryNum,
|
|
|
+ t1.mrNum,
|
|
|
+ t1.totleValue,
|
|
|
+ t1.averageValue,
|
|
|
+ t1.firstLevelNum,
|
|
|
+ t1.secondLevelNum,
|
|
|
+ t1.firstLevelPercent,
|
|
|
+ t1.secondLevelPercent,
|
|
|
+ t1.firstLevelPercentStr,
|
|
|
+ t1.secondLevelPercentStr
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
a.doctor_id AS doctorId,
|
|
|
a.doctor_name AS doctorName,
|
|
|
- count( DISTINCT d.id ) AS entryNum,
|
|
|
count( DISTINCT c.id ) AS mrNum,
|
|
|
ROUND( sum( c.score_res ), 2 ) AS totleValue,
|
|
|
ROUND( sum( c.score_res )/ count(*), 2 ) AS averageValue,
|
|
@@ -1225,6 +1406,51 @@
|
|
|
med_behospital_info a,
|
|
|
med_home_page b,
|
|
|
med_qcresult_cases c,
|
|
|
+ sys_user_dept e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND e.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 a.beh_dept_id = e.dept_id
|
|
|
+ AND c.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 c.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and a.doctor_name like CONCAT('%',#{name},'%')
|
|
|
+ </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)t1,
|
|
|
+ (SELECT
|
|
|
+ a.doctor_id AS doctorId,
|
|
|
+ a.doctor_name AS doctorName,
|
|
|
+ count( DISTINCT d.id ) AS entryNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_cases c,
|
|
|
med_qcresult_detail d,
|
|
|
sys_user_dept e
|
|
|
WHERE
|
|
@@ -1262,11 +1488,14 @@
|
|
|
AND e.user_id = #{userId}
|
|
|
</if>
|
|
|
<if test="deptName!=null and deptName !=''">
|
|
|
- AND a.beh_dept_name = #{deptName}
|
|
|
+ AND a.beh_dept_name = #{deptName}
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
a.doctor_id,
|
|
|
- a.doctor_name
|
|
|
+ a.doctor_name)t2
|
|
|
+ WHERE
|
|
|
+ t1.doctorId = t2.doctorId
|
|
|
+ AND t1.doctorName = t2.doctorName
|
|
|
<if test="asc != null and asc !=''">
|
|
|
order by
|
|
|
<choose>
|