|
@@ -1088,69 +1088,84 @@
|
|
|
|
|
|
<!-- 缺陷详情(分页) -->
|
|
|
<select id="entryCountGroupByEntryPage" resultType="com.diagbot.dto.EntryNumDTO">
|
|
|
- SELECT t.*
|
|
|
+ SELECT
|
|
|
+ t.*
|
|
|
FROM
|
|
|
- (SELECT
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
t1.id,
|
|
|
t1.NAME,
|
|
|
t1.casesId,
|
|
|
t1.casesName,
|
|
|
t1.ruleType,
|
|
|
t1.isReject,
|
|
|
- count(*) AS num,
|
|
|
+ t1.num,
|
|
|
t2.totleNum,
|
|
|
- ROUND( count(*) /t2.totleNum , 4 ) AS percent,
|
|
|
- CONCAT(ROUND( count(*) /t2.totleNum * 100, 2 ), '%' ) AS percentStr
|
|
|
+ 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
|
|
|
- e.id AS id,
|
|
|
- e.NAME AS NAME,
|
|
|
- e.cases_id as casesId,
|
|
|
- e.cases_name as casesName,
|
|
|
- e.rule_type as ruleType,
|
|
|
- d.is_reject as isReject
|
|
|
+ d.cases_id,
|
|
|
+ d.cases_entry_id,
|
|
|
+ d.is_reject,
|
|
|
+ count(*) AS num
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_qcresult_detail d,
|
|
|
- qc_cases_entry e
|
|
|
+ med_qcresult_detail d
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
AND d.is_deleted = 'N'
|
|
|
- and e.is_deleted='N'
|
|
|
- and a.hospital_id = d.hospital_id
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.behospital_code = d.behospital_code
|
|
|
AND a.is_placefile = '1'
|
|
|
- AND d.cases_id = e.cases_id
|
|
|
- AND d.cases_entry_id = e.id
|
|
|
- <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
- <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
|
|
|
- AND d.cases_id = #{filterPageVO.casesId}
|
|
|
- </if>
|
|
|
- <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
|
|
|
- AND e.cases_name = #{filterPageVO.casesName}
|
|
|
- </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.startDate != null and filterPageVO.startDate != ''">
|
|
|
- <![CDATA[ and a.leave_hospital_date >= DATE(#{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 e.name like CONCAT('%', #{filterPageVO.name},'%')
|
|
|
- </if>
|
|
|
<if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
|
|
|
AND a.beh_dept_name = #{filterPageVO.deptName}
|
|
|
</if>
|
|
|
- <if test="filterPageVO.ruleType != null">
|
|
|
- AND e.rule_type = #{filterPageVO.ruleType}
|
|
|
+ <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 = #{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
|
|
@@ -1161,19 +1176,13 @@
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
AND d.is_deleted = 'N'
|
|
|
- and e.is_deleted='N'
|
|
|
- and a.hospital_id = d.hospital_id
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
AND a.behospital_code = d.behospital_code
|
|
|
AND a.is_placefile = '1'
|
|
|
- AND d.cases_id = e.cases_id
|
|
|
- AND d.cases_entry_id = e.id
|
|
|
- <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
- <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
|
|
|
- AND d.cases_id = #{filterPageVO.casesId}
|
|
|
- </if>
|
|
|
- <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
|
|
|
- AND e.cases_name = #{filterPageVO.casesName}
|
|
|
- </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>
|
|
@@ -1186,18 +1195,19 @@
|
|
|
<if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
|
|
|
AND a.beh_dept_name = #{filterPageVO.deptName}
|
|
|
</if>
|
|
|
- <if test="filterPageVO.ruleType != null">
|
|
|
- AND e.rule_type = #{filterPageVO.ruleType}
|
|
|
- </if>
|
|
|
<if test="filterPageVO.isReject != null">
|
|
|
AND d.is_reject = #{filterPageVO.isReject}
|
|
|
</if>
|
|
|
+ <if test="filterPageVO.casesId != null and filterPageVO.casesId != 0">
|
|
|
+ AND d.cases_id = #{filterPageVO.casesId}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.casesName != null and filterPageVO.casesName != ''">
|
|
|
+ AND e.cases_name = #{filterPageVO.casesName}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageVO.ruleType != null">
|
|
|
+ AND e.rule_type = #{filterPageVO.ruleType}
|
|
|
+ </if>
|
|
|
) t2
|
|
|
- GROUP BY
|
|
|
- t1.id,
|
|
|
- t1.NAME,
|
|
|
- t1.casesId,
|
|
|
- t1.casesName
|
|
|
)t
|
|
|
</select>
|
|
|
|
|
@@ -1445,45 +1455,45 @@
|
|
|
t1.isReject,
|
|
|
t1.deptId,
|
|
|
t1.deptName,
|
|
|
- count(*) AS num,
|
|
|
+ t1.num,
|
|
|
t2.totleNum,
|
|
|
- ROUND( count(*) /t2.totleNum , 4 ) AS percent,
|
|
|
- CONCAT(ROUND( count(*) /t2.totleNum * 100, 2 ), '%' ) AS percentStr
|
|
|
+ ROUND( t1.num / t2.totleNum, 4 ) AS percent,
|
|
|
+ CONCAT( ROUND( t1.num / t2.totleNum * 100, 2 ), '%' ) AS percentStr
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- e.id,
|
|
|
- e.NAME,
|
|
|
- e.cases_id as casesId,
|
|
|
- e.cases_name as casesName,
|
|
|
- e.rule_type as ruleType,
|
|
|
- d.is_reject as isReject,
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName
|
|
|
+ tt2.id,
|
|
|
+ tt2.NAME,
|
|
|
+ tt2.cases_id AS casesId,
|
|
|
+ tt2.cases_name AS casesName,
|
|
|
+ tt2.rule_type AS ruleType,
|
|
|
+ tt1.num,
|
|
|
+ tt1.is_reject AS isReject,
|
|
|
+ tt1.beh_dept_id AS deptId,
|
|
|
+ tt1.beh_dept_name AS deptName
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ d.cases_id,
|
|
|
+ d.cases_entry_id,
|
|
|
+ count(*) AS num,
|
|
|
+ d.is_reject
|
|
|
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.is_placefile = '1'
|
|
|
- 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.casesId != null and filterPageByDeptVO.casesId != 0">
|
|
|
- AND d.cases_id = #{filterPageByDeptVO.casesId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
|
|
|
- AND e.cases_name = #{filterPageByDeptVO.casesName}
|
|
|
- </if>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="filterPageByDeptVO.userId!=null">
|
|
|
AND f.user_id = #{filterPageByDeptVO.userId}
|
|
|
</if>
|
|
@@ -1491,13 +1501,10 @@
|
|
|
AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
</if>
|
|
|
<if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ and a.leave_hospital_date >= DATE(#{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 e.name like CONCAT('%', #{filterPageByDeptVO.name},'%')
|
|
|
+ <![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}
|
|
@@ -1510,12 +1517,32 @@
|
|
|
AND a.doctor_name = #{filterPageByDeptVO.doctorName}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="filterPageByDeptVO.ruleType != null ">
|
|
|
- AND e.rule_type = #{filterPageByDeptVO.ruleType}
|
|
|
+ <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_id,
|
|
|
+ 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_id = tt2.cases_id
|
|
|
+ AND tt1.cases_entry_id = tt2.id
|
|
|
+ <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
|
|
|
+ AND tt2.cases_name = #{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
|
|
@@ -1536,13 +1563,7 @@
|
|
|
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.casesId != null and filterPageByDeptVO.casesId != 0">
|
|
|
- AND d.cases_id = #{filterPageByDeptVO.casesId}
|
|
|
- </if>
|
|
|
- <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
|
|
|
- AND e.cases_name = #{filterPageByDeptVO.casesName}
|
|
|
- </if>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
<if test="filterPageByDeptVO.userId!=null">
|
|
|
AND f.user_id = #{filterPageByDeptVO.userId}
|
|
|
</if>
|
|
@@ -1550,10 +1571,10 @@
|
|
|
AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
|
|
|
</if>
|
|
|
<if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
|
|
|
- <![CDATA[ and a.leave_hospital_date >= DATE(#{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})]]>
|
|
|
+ <![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}
|
|
@@ -1566,20 +1587,19 @@
|
|
|
AND a.doctor_name = #{filterPageByDeptVO.doctorName}
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="filterPageByDeptVO.ruleType != null ">
|
|
|
- AND e.rule_type = #{filterPageByDeptVO.ruleType}
|
|
|
+ <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>
|
|
|
+ <if test="filterPageByDeptVO.casesName != null and filterPageByDeptVO.casesName != ''">
|
|
|
+ AND e.cases_name = #{filterPageByDeptVO.casesName}
|
|
|
+ </if>
|
|
|
+ <if test="filterPageByDeptVO.ruleType != null ">
|
|
|
+ AND e.rule_type = #{filterPageByDeptVO.ruleType}
|
|
|
+ </if>
|
|
|
) t2
|
|
|
- GROUP BY
|
|
|
- t1.id,
|
|
|
- t1.NAME,
|
|
|
- t1.casesId,
|
|
|
- t1.casesName,
|
|
|
- t1.deptId,
|
|
|
- t1.deptName
|
|
|
)t
|
|
|
</select>
|
|
|
</mapper>
|