|
@@ -130,20 +130,24 @@
|
|
|
(
|
|
|
(
|
|
|
SELECT
|
|
|
- c.msg,
|
|
|
+ d.msg,
|
|
|
count(*) AS num
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.behospital_code = b.behospital_code
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -155,7 +159,7 @@
|
|
|
<![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
- c.msg
|
|
|
+ d.msg
|
|
|
ORDER BY
|
|
|
count(*) DESC
|
|
|
) t1,
|
|
@@ -164,16 +168,20 @@
|
|
|
count(*) AS totle
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.behospital_code = b.behospital_code
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -206,16 +214,20 @@
|
|
|
count(*) AS num
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.behospital_code = b.behospital_code
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -237,16 +249,20 @@
|
|
|
count(*) AS totle
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.behospital_code = b.behospital_code
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -264,20 +280,25 @@
|
|
|
<!-- 缺陷排行列表 -->
|
|
|
<select id="resultStatistics2" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
- c.msg as name,
|
|
|
+ d.msg as name,
|
|
|
count(*) AS num
|
|
|
FROM
|
|
|
+ FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.behospital_code = b.behospital_code
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -289,7 +310,7 @@
|
|
|
<![CDATA[AND a.leave_hospital_date < DATE(#{endDate})]]>
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
- c.msg
|
|
|
+ d.msg
|
|
|
ORDER BY
|
|
|
count(*) DESC
|
|
|
<if test="limitCount != null and limitCount != ''">
|
|
@@ -305,16 +326,20 @@
|
|
|
count(*) AS num
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.behospital_code = b.behospital_code
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -338,16 +363,20 @@
|
|
|
count(*) AS totle
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_info b,
|
|
|
- med_qcresult_detail c
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.behospital_code = b.behospital_code
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
- AND b.behospital_code = c.behospital_code
|
|
|
- AND b.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.is_deleted = 'N'
|
|
|
AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
<![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
<if test="hospitalId != null and hospitalId != ''">
|
|
|
AND a.hospital_id = #{hospitalId}
|
|
@@ -376,6 +405,9 @@
|
|
|
AND a.behospital_code = b.behospital_code
|
|
|
)
|
|
|
and a.qc_type_id != 0
|
|
|
+ <if test="leaveDate != null">
|
|
|
+ <![CDATA[ and a.leave_hospital_date < #{leaveDate}]]>
|
|
|
+ </if>
|
|
|
</select>
|
|
|
|
|
|
<!--质控评分(科室)分页-->
|
|
@@ -547,7 +579,7 @@
|
|
|
<!-- 病案首页手术病历数统计 -->
|
|
|
<select id="homePageCountForOperation" parameterType="com.diagbot.vo.FilterVO" resultType="int">
|
|
|
SELECT
|
|
|
- COUNT(*)
|
|
|
+ COUNT(DISTINCT a.behospital_code)
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_home_page b,
|
|
@@ -573,7 +605,7 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 按科室统计病案首页病历数 -->
|
|
|
- <select id="homePageCountByDept" parameterType="com.diagbot.vo.HPFilterByDeptVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ <select id="homePageCountByDept" parameterType="com.diagbot.vo.HomePageFilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
a.beh_dept_id AS id,
|
|
|
a.beh_dept_name AS NAME,
|
|
@@ -612,11 +644,11 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 按科室病案首页手术病历数 -->
|
|
|
- <select id="homePageCountForOperationByDept" parameterType="com.diagbot.vo.FilterByDeptVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ <select id="homePageCountForOperationByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
a.beh_dept_id AS id,
|
|
|
a.beh_dept_name AS NAME,
|
|
|
- COUNT(*) AS num
|
|
|
+ COUNT(DISTINCT a.behospital_code) AS num
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_home_page b,
|
|
@@ -650,4 +682,632 @@
|
|
|
a.beh_dept_id,
|
|
|
a.beh_dept_name
|
|
|
</select>
|
|
|
+
|
|
|
+ <!-- 各科室缺陷占比排行(分页) -->
|
|
|
+ <select id="resultStatisticsByDeptPage" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ SELECT t.*
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ t1.beh_dept_name AS NAME,
|
|
|
+ t1.num AS num,
|
|
|
+ t2.totle AS totleNum,
|
|
|
+ round( t1.num / t2.totle, 4 ) AS percent,
|
|
|
+ concat( round( t1.num / t2.totle * 100, 2 ), '%' ) AS percentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ count(*) AS num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
+ WHERE
|
|
|
+ a.behospital_code = b.behospital_code
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{filterPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.name != null and filterPageVO.name != ''">
|
|
|
+ AND a.beh_dept_name like CONCAT('%', #{filterPageVO.name},'%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ ORDER BY
|
|
|
+ count(*) DESC
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(*) AS totle
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d
|
|
|
+ WHERE
|
|
|
+ a.behospital_code = b.behospital_code
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{filterPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageVO.startDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageVO.endDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.name != null and filterPageVO.name != ''">
|
|
|
+ AND a.beh_dept_name like CONCAT('%', #{filterPageVO.name},'%')
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
+ )t
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 科室缺陷占比(主任医生) -->
|
|
|
+ <select id="resultStatisticsByDeptAndDoctorPage" resultType="com.diagbot.dto.DeptNumDTO">
|
|
|
+ SELECT
|
|
|
+ t.*
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.NAME,
|
|
|
+ t1.num AS num,
|
|
|
+ t2.totle AS totleNum,
|
|
|
+ round( t1.num / t2.totle, 4 ) AS percent,
|
|
|
+ concat( round( t1.num / t2.totle * 100, 2 ), '%' ) AS percentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ d.msg as name,
|
|
|
+ count(*) AS num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d,
|
|
|
+ sys_user_dept e
|
|
|
+ WHERE
|
|
|
+ a.behospital_code = b.behospital_code
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND 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.beh_dept_id = e.dept_id
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="filterPageByDeptVO.userId!=null">
|
|
|
+ AND e.user_id = #{filterPageByDeptVO.userId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageByDeptVO.startDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageByDeptVO.endDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
|
|
|
+ AND d.msg like CONCAT('%', #{filterPageByDeptVO.name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
+ AND a.doctor_name = #{filterPageByDeptVO.name}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ d.msg
|
|
|
+ ORDER BY
|
|
|
+ count(*) DESC
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(*) AS totle
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d,
|
|
|
+ sys_user_dept e
|
|
|
+ WHERE
|
|
|
+ a.behospital_code = b.behospital_code
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND 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.beh_dept_id = e.dept_id
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="filterPageByDeptVO.userId!=null">
|
|
|
+ AND e.user_id = #{filterPageByDeptVO.userId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{filterPageByDeptVO.startDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{filterPageByDeptVO.endDate})]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
|
|
|
+ AND d.msg like CONCAT('%', #{filterPageByDeptVO.name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
+ AND a.doctor_name = #{filterPageByDeptVO.name}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
+ )t
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 各科室缺陷占比(组合) -->
|
|
|
+ <select id="levelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ 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,
|
|
|
+ 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,
|
|
|
+ 1-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) - 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 sencondLevelPercentStr,
|
|
|
+ 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 )),
|
|
|
+ '%'
|
|
|
+ ) AS thirdLevelPercentStr
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail 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.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.behospital_code = d.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
|
|
|
+ <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
|
|
|
+ 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,
|
|
|
+ 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,
|
|
|
+ 1-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(
|
|
|
+ 100-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ '%'
|
|
|
+ ) AS secondLevelPercentStr
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_cases c,
|
|
|
+ med_qcresult_detail 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.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND c.cases_id = d.cases_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.beh_dept_name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ <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=="firstLevelPercent"'>firstLevelPercent asc</when>
|
|
|
+ <when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
|
|
|
+ <when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
+ <when test='asc=="secondLevelPercentStr"'>secondLevelPercent 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=="firstLevelPercent"'>firstLevelPercent desc</when>
|
|
|
+ <when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
|
|
|
+ <when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
+ <when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
+ <otherwise> deptName desc </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 各科室缺陷占比(主任医生) -->
|
|
|
+ <select id="levelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ 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,
|
|
|
+ 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,
|
|
|
+ 1-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) - 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 sencondLevelPercentStr,
|
|
|
+ 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 )),
|
|
|
+ '%'
|
|
|
+ ) AS thirdLevelPercentStr
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail 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 a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.behospital_code = d.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
|
|
|
+ <if test="asc != null and asc !=''">
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test='asc=="doctorId"'>doctorId asc</when>
|
|
|
+ <when test='asc=="doctorName"'>doctorName 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> doctorName asc </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="desc != null and desc!=''">
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test='desc=="doctorId"'>doctorId desc</when>
|
|
|
+ <when test='desc=="doctorName"'>doctorName 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> doctorName desc </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 病案首页合格率占比(主任医生) -->
|
|
|
+ <select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ 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,
|
|
|
+ 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,
|
|
|
+ 1-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(
|
|
|
+ 100-ROUND ( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ '%'
|
|
|
+ ) AS secondLevelPercentStr
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_cases c,
|
|
|
+ med_qcresult_detail 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 = d.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ AND a.beh_dept_id = e.dept_id
|
|
|
+ AND c.cases_id = d.cases_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
|
|
|
+ <if test="asc != null and asc !=''">
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test='asc=="doctorId"'>doctorId asc</when>
|
|
|
+ <when test='asc=="doctorName"'>doctorName 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> doctorName asc </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="desc != null and desc!=''">
|
|
|
+ order by
|
|
|
+ <choose>
|
|
|
+ <when test='desc=="doctorId"'>doctorId desc</when>
|
|
|
+ <when test='desc=="doctorName"'>doctorName 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> doctorName desc </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|