|
@@ -1786,6 +1786,181 @@
|
|
|
)t
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 缺陷详情(分页)湘雅 -->
|
|
|
+ <select id="entryCountGroupXYByEntryPage" resultType="com.diagbot.dto.EntryNumGroupDTO">
|
|
|
+ SELECT
|
|
|
+ t.*
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ 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
|
|
|
+ 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
|
|
|
+ d.cases_id,
|
|
|
+ d.cases_entry_id,
|
|
|
+ d.is_reject,
|
|
|
+ count(*) AS num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_home_page b,
|
|
|
+ med_qcresult_detail d
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{filterPageVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{filterPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
|
|
|
+ <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
|
|
|
+ <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{filterPageVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.deptId != null and filterPageVO.deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{filterPageVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.doctorName != null and filterPageVO.doctorName != ''">
|
|
|
+ AND (case
|
|
|
+ when a.doctor_id != '' and a.doctor_id is not null then a.doctor_id
|
|
|
+ when (a.doctor_id = '' or a.doctor_id is null) and
|
|
|
+ a.director_doctor_id != '' and a.director_doctor_id is not null
|
|
|
+ then a.director_doctor_id
|
|
|
+ when (a.doctor_id = '' or a.doctor_id is null) and
|
|
|
+ (a.director_doctor_id = '' or a.director_doctor_id is null) and
|
|
|
+ a.beh_doctor_id != '' and a.beh_doctor_id is not null
|
|
|
+ then a.beh_doctor_id end)= #{filterPageVO.doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
|
|
|
+ AND d.cases_id = #{filterPageVO.casesId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.isReject != null">
|
|
|
+ AND d.is_reject = #{filterPageVO.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="filterPageVO.casesName != null and filterPageVO.casesName != ''">
|
|
|
+ AND tt2.cases_name like CONCAT('%', #{filterPageVO.casesName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.name != null and filterPageVO.name != ''">
|
|
|
+ AND tt2.name like CONCAT('%', #{filterPageVO.name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.ruleType != null">
|
|
|
+ AND tt2.rule_type = #{filterPageVO.ruleType}
|
|
|
+ </if>
|
|
|
+ ) t1,(
|
|
|
+ SELECT
|
|
|
+ count(*) AS totleNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_detail d,
|
|
|
+ qc_cases_entry e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{filterPageVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND e.cases_id = d.cases_id
|
|
|
+ AND e.id = d.cases_entry_id
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{filterPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
|
|
|
+ <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
|
|
|
+ <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.doctorName != null and filterPageVO.doctorName != ''">
|
|
|
+ AND (case
|
|
|
+ when a.doctor_id != '' and a.doctor_id is not null then a.doctor_id
|
|
|
+ when (a.doctor_id = '' or a.doctor_id is null) and
|
|
|
+ a.director_doctor_id != '' and a.director_doctor_id is not null
|
|
|
+ then a.director_doctor_id
|
|
|
+ when (a.doctor_id = '' or a.doctor_id is null) and
|
|
|
+ (a.director_doctor_id = '' or a.director_doctor_id is null) and
|
|
|
+ a.beh_doctor_id != '' and a.beh_doctor_id is not null
|
|
|
+ then a.beh_doctor_id end)= #{filterPageVO.doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{filterPageVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.deptId != null and filterPageVO.deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{filterPageVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.isReject != null">
|
|
|
+ AND d.is_reject = #{filterPageVO.isReject}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.ruleType != null">
|
|
|
+ AND e.rule_type = #{filterPageVO.ruleType}
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
+ )t
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 质控平均分按科室统计(分页) -->
|
|
|
<select id="getAverageScoreByDeptPage" resultType="com.diagbot.dto.AverageStatisticsDTO">
|
|
|
SELECT t.*
|