|
@@ -767,6 +767,121 @@
|
|
|
)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
|
|
|
+ a.doctor_id AS doctorId,
|
|
|
+ a.doctor_name AS doctorName,
|
|
|
+ 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
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_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,
|
|
|
+ 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
|
|
@@ -845,6 +960,9 @@
|
|
|
<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>
|
|
@@ -863,6 +981,9 @@
|
|
|
<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>
|
|
@@ -939,6 +1060,8 @@
|
|
|
<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>
|
|
@@ -955,6 +1078,8 @@
|
|
|
<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>
|
|
@@ -1046,6 +1171,9 @@
|
|
|
<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>
|
|
@@ -1064,6 +1192,9 @@
|
|
|
<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>
|
|
@@ -1151,6 +1282,9 @@
|
|
|
<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>
|
|
@@ -1169,6 +1303,9 @@
|
|
|
<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>
|