|
@@ -1090,388 +1090,6 @@
|
|
|
a.beh_dept_name
|
|
|
</select>
|
|
|
|
|
|
- <!-- 按模块统计质控缺陷数 -->
|
|
|
- <select id="entryCountGroupByCaseAndDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.DeptNumDTO">
|
|
|
- SELECT
|
|
|
- f.id,
|
|
|
- g.NAME AS NAME,
|
|
|
- f.deptId,
|
|
|
- f.deptName,
|
|
|
- f.num
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
- c.cases_id AS id,
|
|
|
- count(*) AS num
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info 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 c.cases_entry_id = d.id
|
|
|
- AND a.beh_dept_id = e.dept_id
|
|
|
- <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
- and a.is_placefile = #{isPlacefile}
|
|
|
- </if>
|
|
|
- AND a.qc_type_id != 0
|
|
|
- <if test="userId!=null">
|
|
|
- AND e.user_id = #{userId}
|
|
|
- </if>
|
|
|
- <if test="hospitalId != null and hospitalId != ''">
|
|
|
- AND a.hospital_id = #{hospitalId}
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- d.cases_id,
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
- ) f,
|
|
|
- qc_cases g
|
|
|
- WHERE
|
|
|
- g.is_deleted = 'N'
|
|
|
- AND f.id = g.id
|
|
|
- </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
|
|
|
- tt2.id,
|
|
|
- tt2.NAME,
|
|
|
- tt1.beh_dept_id AS deptId,
|
|
|
- tt1.beh_dept_name AS deptName,
|
|
|
- tt1.num
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name,
|
|
|
- count(*) AS num,
|
|
|
- d.cases_entry_id
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- med_qcresult_detail d,
|
|
|
- sys_user_dept f
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.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 a.beh_dept_id = f.dept_id
|
|
|
- <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
- and a.is_placefile = #{isPlacefile}
|
|
|
- </if>
|
|
|
- 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="isPlacefile != null and isPlacefile == 0">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- d.cases_entry_id,
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
- ) tt1,
|
|
|
- qc_cases_entry tt2
|
|
|
- WHERE
|
|
|
- tt2.is_deleted = 'N'
|
|
|
- AND tt1.cases_entry_id = tt2.id
|
|
|
- ) t1,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
- count(*) AS mrNum
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- sys_user_dept f
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND f.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.hospital_id = f.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND a.beh_dept_id = f.dept_id
|
|
|
- <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
- and a.is_placefile = #{isPlacefile}
|
|
|
- </if>
|
|
|
- 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="isPlacefile != null and isPlacefile == 0">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- </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.DeptEntryNumDTO">
|
|
|
- SELECT
|
|
|
- t.*
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- t1.deptId AS deptId,
|
|
|
- t1.deptName AS deptName,
|
|
|
- t1.id AS id,
|
|
|
- t1.NAME AS NAME,
|
|
|
- t1.casesId AS casesId,
|
|
|
- t1.casesName AS casesName,
|
|
|
- t1.num AS num,
|
|
|
- t2.mrNum AS totleNum,
|
|
|
- t1.score AS score,
|
|
|
- t1.isReject AS isReject,
|
|
|
- Round( t1.num / t2.mrNum, 4 ) AS percent,
|
|
|
- CONCAT( Round( t1.num / t2.mrNum * 100, 2 ), '%' ) AS percentStr
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- tt2.id,
|
|
|
- tt2.NAME,
|
|
|
- tt1.beh_dept_id AS deptId,
|
|
|
- tt1.beh_dept_name AS deptName,
|
|
|
- tt2.cases_id AS casesId,
|
|
|
- tt2.cases_name AS casesName,
|
|
|
- tt1.num,
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
|
|
|
- tt3.score_run as score,
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
|
|
|
- tt3.score,
|
|
|
- </if>
|
|
|
- tt1.is_reject AS isReject
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.hospital_id,
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name,
|
|
|
- count(*) AS num,
|
|
|
- d.cases_id,
|
|
|
- d.cases_entry_id,
|
|
|
- d.is_reject
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- med_qcresult_detail d,
|
|
|
- sys_user_dept f
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.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 a.beh_dept_id = f.dept_id
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{filterPageByDeptVO.isPlacefile}
|
|
|
- </if>
|
|
|
- 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.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
- AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
- AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName}, '%')
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isReject != null">
|
|
|
- AND d.is_reject = #{filterPageByDeptVO.isReject}
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- d.cases_entry_id,
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name,
|
|
|
- d.is_reject,
|
|
|
- d.cases_id
|
|
|
- ) tt1,
|
|
|
- qc_cases_entry tt2,
|
|
|
- qc_cases_entry_hospital tt3
|
|
|
- WHERE
|
|
|
- tt2.is_deleted = 'N'
|
|
|
- AND tt3.is_deleted = 'N'
|
|
|
- AND tt1.hospital_id = tt3.hospital_id
|
|
|
- AND tt1.cases_id = tt2.cases_id
|
|
|
- AND tt1.cases_entry_id = tt2.id
|
|
|
- AND tt2.id = tt3.cases_entry_id
|
|
|
- <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
|
|
|
- AND tt2.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
|
|
|
- AND tt2.cases_name like CONCAT('%', #{filterPageByDeptVO.casesName},'%')
|
|
|
- </if>
|
|
|
- ) t1,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
- count(*) AS mrNum
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- sys_user_dept f
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND f.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.hospital_id = f.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND a.beh_dept_id = f.dept_id
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{filterPageByDeptVO.isPlacefile}
|
|
|
- </if>
|
|
|
- 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.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
- AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
- AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName}, '%')
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
- ) t2
|
|
|
- WHERE
|
|
|
- t1.deptId = t2.deptId
|
|
|
- AND t1.deptName = t2.deptName
|
|
|
- )t
|
|
|
- </select>
|
|
|
-
|
|
|
<!-- 按模块统计质控缺陷数(分页) -->
|
|
|
<select id="entryCountGroupByCasePage" resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
@@ -1864,355 +1482,4 @@
|
|
|
ROUND( sum( c.`level` = '丙' )/ count(*)* 100, 2 ) DESC) t
|
|
|
</select>
|
|
|
|
|
|
- <!-- 按模块统计质控缺陷数-科室(分页) -->
|
|
|
- <select id="entryCountGroupByCaseAndDeptPage" resultType="com.diagbot.dto.NumDTO">
|
|
|
- SELECT
|
|
|
- t.id,
|
|
|
- t.`NAME`,
|
|
|
- t.deptId,
|
|
|
- t.deptName,
|
|
|
- t.num,
|
|
|
- t.totleNum,
|
|
|
- t.percent,
|
|
|
- t.percentStr
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- t1.caseId AS id,
|
|
|
- t1.caseName AS NAME,
|
|
|
- t1.deptId,
|
|
|
- t1.deptName,
|
|
|
- t1.num AS num,
|
|
|
- t2.mrNum,
|
|
|
- t3.originalNum,
|
|
|
- t2.mrNum * t3.originalNum AS totleNum,
|
|
|
- ROUND( t1.num /( t2.mrNum * t3.originalNum ), 4 ) AS percent,
|
|
|
- CONCAT( ROUND( t1.num /( t2.mrNum * t3.originalNum )* 100, 2 ), '%' ) AS percentStr
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- f.caseId,
|
|
|
- e.NAME AS caseName,
|
|
|
- f.deptId,
|
|
|
- f.deptName,
|
|
|
- f.num
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
- d.cases_id AS caseId,
|
|
|
- count(*) AS num
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- med_qcresult_detail d,
|
|
|
- sys_user_dept g
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND g.is_deleted = 'N'
|
|
|
- AND a.hospital_id = c.hospital_id
|
|
|
- AND a.hospital_id = d.hospital_id
|
|
|
- AND a.hospital_id = g.hospital_id
|
|
|
- AND a.behospital_code = c.behospital_code
|
|
|
- AND a.behospital_code = d.behospital_code
|
|
|
- AND a.beh_dept_id = g.dept_id
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{filterPageByDeptVO.isPlacefile}
|
|
|
- </if>
|
|
|
- AND a.qc_type_id != 0
|
|
|
- <if test="filterPageByDeptVO.userId!=null">
|
|
|
- AND g.user_id = #{filterPageByDeptVO.userId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
|
|
|
- AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
- AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
- and a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName}, '%')
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- d.cases_id,
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
- ) f,
|
|
|
- qc_cases e
|
|
|
- WHERE
|
|
|
- e.is_deleted = 'N'
|
|
|
- AND f.caseId = e.id
|
|
|
- <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
|
|
|
- AND e.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
|
|
|
- </if>
|
|
|
- ) t1,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
- COUNT(*) AS mrNum
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_info c,
|
|
|
- sys_user_dept 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
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{filterPageByDeptVO.isPlacefile}
|
|
|
- </if>
|
|
|
- AND a.qc_type_id != 0
|
|
|
- <if test="filterPageByDeptVO.userId!=null">
|
|
|
- AND d.user_id = #{filterPageByDeptVO.userId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
|
|
|
- AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
- AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
- and a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName}, '%')
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name
|
|
|
- ) t2,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.id AS caseId,
|
|
|
- a.NAME AS caseName,
|
|
|
- count(*) AS originalNum
|
|
|
- FROM
|
|
|
- qc_cases a,
|
|
|
- qc_cases_entry b
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND b.is_deleted = 'N'
|
|
|
- AND a.id = b.cases_id
|
|
|
- GROUP BY
|
|
|
- a.id,
|
|
|
- a.`name`
|
|
|
- ) t3
|
|
|
- WHERE
|
|
|
- t1.caseId = t3.caseId
|
|
|
- AND t1.caseName = t3.caseName
|
|
|
- AND t1.deptId = t2.deptId
|
|
|
- AND t1.deptName = t2.deptName
|
|
|
- ) t
|
|
|
- </select>
|
|
|
-
|
|
|
- <!-- 缺陷详情-科室(分页) -->
|
|
|
- <select id="entryCountGroupByEntryAndDeptPage" resultType="com.diagbot.dto.EntryNumGroupDTO">
|
|
|
- SELECT
|
|
|
- t.*
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- t1.deptId,
|
|
|
- t1.deptName,
|
|
|
- t1.id,
|
|
|
- t1.NAME,
|
|
|
- t1.casesId,
|
|
|
- t1.casesName,
|
|
|
- t1.ruleType,
|
|
|
- t1.isReject,
|
|
|
- t1.num,
|
|
|
- t2.totleNum,
|
|
|
- ROUND( t1.num / t2.totleNum, 4 ) AS percent,
|
|
|
- CONCAT( ROUND( t1.num / t2.totleNum * 100, 2 ), '%' ) AS percentStr
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- tt1.beh_dept_id AS deptId,
|
|
|
- tt1.beh_dept_name AS deptName,
|
|
|
- tt2.id AS id,
|
|
|
- tt2.NAME AS NAME,
|
|
|
- tt2.cases_id AS casesId,
|
|
|
- tt2.cases_name AS casesName,
|
|
|
- tt1.num,
|
|
|
- tt2.rule_type AS ruleType,
|
|
|
- tt1.is_reject AS isReject
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- a.beh_dept_id,
|
|
|
- a.beh_dept_name,
|
|
|
- d.cases_id,
|
|
|
- d.cases_entry_id,
|
|
|
- d.is_reject,
|
|
|
- count(*) AS num
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_detail d,
|
|
|
- sys_user_dept f
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND f.is_deleted = 'N'
|
|
|
- AND a.hospital_id = d.hospital_id
|
|
|
- AND a.hospital_id = f.hospital_id
|
|
|
- AND a.behospital_code = d.behospital_code
|
|
|
- AND a.beh_dept_id = f.dept_id
|
|
|
- <if test="filterPageByDeptVO.userId!=null">
|
|
|
- AND f.user_id = #{filterPageByDeptVO.userId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{filterPageByDeptVO.isPlacefile}
|
|
|
- </if>
|
|
|
- AND a.qc_type_id != 0
|
|
|
- <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
|
|
|
- AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
- AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
- AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName}, '%')
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorId != null and filterPageByDeptVO.doctorId != ''">
|
|
|
- AND a.doctor_id = #{filterPageByDeptVO.doctorId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.casesId != null and filterPageByDeptVO.casesId != 0">
|
|
|
- AND d.cases_id = #{filterPageByDeptVO.casesId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isReject != null">
|
|
|
- AND d.is_reject = #{filterPageByDeptVO.isReject}
|
|
|
- </if>
|
|
|
- GROUP BY
|
|
|
- d.cases_entry_id,
|
|
|
- d.cases_id
|
|
|
- ) tt1,
|
|
|
- qc_cases_entry tt2
|
|
|
- WHERE
|
|
|
- tt2.is_deleted = 'N'
|
|
|
- AND tt1.cases_id = tt2.cases_id
|
|
|
- AND tt1.cases_entry_id = tt2.id
|
|
|
- <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
|
|
|
- AND tt2.cases_name like CONCAT('%', #{filterPageByDeptVO.casesName},'%')
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.name != null and filterPageByDeptVO.name != ''">
|
|
|
- AND tt2.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.ruleType != null">
|
|
|
- AND tt2.rule_type = #{filterPageByDeptVO.ruleType}
|
|
|
- </if>
|
|
|
- ) t1,(
|
|
|
- SELECT
|
|
|
- count(*) AS totleNum
|
|
|
- FROM
|
|
|
- med_behospital_info a,
|
|
|
- med_qcresult_detail d,
|
|
|
- qc_cases_entry e,
|
|
|
- sys_user_dept f
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND d.is_deleted = 'N'
|
|
|
- AND e.is_deleted = 'N'
|
|
|
- AND f.is_deleted = 'N'
|
|
|
- AND a.hospital_id = d.hospital_id
|
|
|
- AND a.hospital_id = f.hospital_id
|
|
|
- AND a.behospital_code = d.behospital_code
|
|
|
- AND a.beh_dept_id = f.dept_id
|
|
|
- <if test="filterPageByDeptVO.userId!=null">
|
|
|
- AND f.user_id = #{filterPageByDeptVO.userId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{filterPageByDeptVO.isPlacefile}
|
|
|
- </if>
|
|
|
- AND e.cases_id = d.cases_id
|
|
|
- AND e.id = d.cases_entry_id
|
|
|
- AND a.qc_type_id != 0
|
|
|
- <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
|
|
|
- AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
|
|
|
- <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
|
|
|
- AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorName != null and filterPageByDeptVO.doctorName != ''">
|
|
|
- AND a.doctor_name like CONCAT('%', #{filterPageByDeptVO.doctorName}, '%')
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.doctorId != null and filterPageByDeptVO.doctorId != ''">
|
|
|
- AND a.doctor_id = #{filterPageByDeptVO.doctorId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.isReject != null">
|
|
|
- AND d.is_reject = #{filterPageByDeptVO.isReject}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.ruleType != null">
|
|
|
- AND e.rule_type = #{filterPageByDeptVO.ruleType}
|
|
|
- </if>
|
|
|
- ) t2
|
|
|
- )t
|
|
|
- </select>
|
|
|
</mapper>
|