|
@@ -169,8 +169,16 @@
|
|
|
e.`name`
|
|
|
</select>
|
|
|
|
|
|
- <!-- 条目缺陷分组统计 -->
|
|
|
+ <!-- 条目缺陷占比(首页) -->
|
|
|
<select id="entryCountGroupByEntry" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ SELECT
|
|
|
+ t1.NAME AS NAME,
|
|
|
+ t1.num AS num,
|
|
|
+ t2.mrNum AS totleNum,
|
|
|
+ Round( t1.num / t2.mrNum, 4 ) AS percent,
|
|
|
+ CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
SELECT
|
|
|
e.id,
|
|
|
e.NAME,
|
|
@@ -208,6 +216,114 @@
|
|
|
GROUP BY
|
|
|
e.id,
|
|
|
e.NAME
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(*) AS mrNum
|
|
|
+ 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>
|
|
|
+ ) t2
|
|
|
+ ORDER BY
|
|
|
+ percent DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 条目缺陷占比(内页) -->
|
|
|
+ <select id="entryGroupByEntryInnerPage" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ SELECT t.*
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ t1.NAME AS NAME,
|
|
|
+ t1.num AS num,
|
|
|
+ t2.mrNum AS totleNum,
|
|
|
+ Round( t1.num / t2.mrNum, 4 ) AS percent,
|
|
|
+ CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ e.id,
|
|
|
+ e.NAME,
|
|
|
+ count(*) AS num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d,
|
|
|
+ qc_cases_entry 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 d.cases_id = e.cases_id
|
|
|
+ AND d.cases_entry_id = e.id
|
|
|
+ <![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>
|
|
|
+ GROUP BY
|
|
|
+ e.id,
|
|
|
+ e.NAME
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(*) AS mrNum
|
|
|
+ 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="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>
|
|
|
+ ) t2
|
|
|
+ )t
|
|
|
</select>
|
|
|
|
|
|
<!-- 质控平均分按科室统计 -->
|
|
@@ -346,8 +462,18 @@
|
|
|
a.beh_dept_name
|
|
|
</select>
|
|
|
|
|
|
- <!-- 条目缺陷分组统计 -->
|
|
|
+ <!-- 条目缺陷占比-科室(首页) -->
|
|
|
<select id="entryCountGroupByEntryAndDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.DeptNumDTO">
|
|
|
+ SELECT
|
|
|
+ t1.deptId AS deptId,
|
|
|
+ t1.deptName AS deptName,
|
|
|
+ t1.NAME AS NAME,
|
|
|
+ t1.num AS num,
|
|
|
+ t2.mrNum AS totleNum,
|
|
|
+ Round( t1.num / t2.mrNum, 4 ) AS percent,
|
|
|
+ CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
SELECT
|
|
|
e.id,
|
|
|
e.NAME,
|
|
@@ -396,6 +522,165 @@
|
|
|
e.NAME,
|
|
|
a.beh_dept_id,
|
|
|
a.beh_dept_name
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ count(*) AS mrNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ sys_user_dept f
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND f.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = f.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.beh_dept_id = f.dept_id
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="userId!=null">
|
|
|
+ AND f.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <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>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ ) t2
|
|
|
+ WHERE
|
|
|
+ t1.deptId = t2.deptId
|
|
|
+ AND t1.deptName = t2.deptName
|
|
|
+ ORDER BY
|
|
|
+ percent DESC,
|
|
|
+ num DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 条目缺陷占比-科室(内页) -->
|
|
|
+ <select id="entryGroupByEntryAndDeptInnerPage" resultType="com.diagbot.dto.DeptNumDTO">
|
|
|
+ SELECT t.*
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ t1.deptId AS deptId,
|
|
|
+ t1.deptName AS deptName,
|
|
|
+ t1.NAME AS NAME,
|
|
|
+ t1.num AS num,
|
|
|
+ t2.mrNum AS totleNum,
|
|
|
+ Round( t1.num / t2.mrNum, 4 ) AS percent,
|
|
|
+ CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ e.id,
|
|
|
+ e.NAME,
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ count(*) AS num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d,
|
|
|
+ qc_cases_entry e,
|
|
|
+ sys_user_dept f
|
|
|
+ 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 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.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
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="filterPageByDeptVO.userId!=null">
|
|
|
+ AND f.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.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ e.id,
|
|
|
+ e.NAME,
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ count(*) AS mrNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_info c,
|
|
|
+ sys_user_dept f
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND f.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = f.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND a.beh_dept_id = f.dept_id
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="filterPageByDeptVO.userId!=null">
|
|
|
+ AND f.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.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ ) t2
|
|
|
+ WHERE
|
|
|
+ t1.deptId = t2.deptId
|
|
|
+ AND t1.deptName = t2.deptName
|
|
|
+ )t
|
|
|
</select>
|
|
|
|
|
|
<!-- 按模块统计质控缺陷数(分页) -->
|