|
@@ -3225,7 +3225,7 @@
|
|
|
|
|
|
<resultMap id="ExportExcelMapByDept" type="com.diagbot.dto.ExportExcelByDeptDTO">
|
|
|
<result column="behDeptName" property="behDeptName"/>
|
|
|
- <result column="behDoctorName" property="behDoctorName"/>
|
|
|
+ <result column="doctorName" property="doctorName"/>
|
|
|
<result column="avgScore" property="avgScore"/>
|
|
|
<collection property="excelBehospitalDTOS"
|
|
|
ofType="com.diagbot.dto.ExportExcelBehByDeptDTO">
|
|
@@ -6753,9 +6753,8 @@
|
|
|
f1.behDeptId = f2.behDeptId
|
|
|
AND f1.behDeptName = f2.behDeptName
|
|
|
</select>
|
|
|
-
|
|
|
- <!-- 条目缺陷评分详情页导出-->
|
|
|
- <select id="qcResultShortPageExport" resultMap="ExportExcelMap">
|
|
|
+ <!--缺陷详情质控评分页导出-科室-->
|
|
|
+ <select id="qcResultShortByDeptPageExport" resultMap="ExportExcelMapByDept">
|
|
|
SELECT * from(
|
|
|
SELECT
|
|
|
f1.*,
|
|
@@ -6844,22 +6843,29 @@
|
|
|
med_behospital_info a,
|
|
|
med_qcresult_info b,
|
|
|
med_qcresult_detail c,
|
|
|
- qc_cases_entry d
|
|
|
+ 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 a.beh_dept_id = e.dept_id
|
|
|
AND c.cases_id = d.cases_id
|
|
|
AND c.cases_entry_id = d.id
|
|
|
AND a.qc_type_id != 0
|
|
|
<if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
|
|
|
and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
|
|
|
</if>
|
|
|
+ <if test="qcResultShortPageVO.userId != null and qcResultShortPageVO.userId != ''">
|
|
|
+ AND e.user_id = #{qcResultShortPageVO.userId}
|
|
|
+ </if>
|
|
|
<if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
|
|
|
AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
|
|
|
</if>
|
|
@@ -6884,7 +6890,19 @@
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
|
|
|
AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
|
|
|
-
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
+ AND a.doctor_name = #{qcResultShortPageVO.doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
|
|
|
+ AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
+ AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
|
|
|
AND b.`level` = #{qcResultShortPageVO.level}
|
|
@@ -6896,27 +6914,11 @@
|
|
|
AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
|
|
|
- AND d.NAME = #{qcResultShortPageVO.casesEntryName}
|
|
|
+ AND d.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.casesEntryName}, '%' )
|
|
|
</if>
|
|
|
- <if test="qcResultShortPageVO.casesEntryId != null ">
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId != ''">
|
|
|
AND d.id = #{qcResultShortPageVO.casesEntryId}
|
|
|
</if>
|
|
|
- <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
|
|
|
- AND d.cases_name = #{qcResultShortPageVO.casesName}
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.casesId != null">
|
|
|
- AND d.cases_id = #{qcResultShortPageVO.casesId}
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
|
|
|
- AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
- OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
- OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
|
|
|
- </if>
|
|
|
- <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
- AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
- OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
- OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
|
|
|
- </if>
|
|
|
<if test="qcResultShortPageVO.isReject != null">
|
|
|
AND c.is_reject = #{qcResultShortPageVO.isReject}
|
|
|
</if>
|
|
@@ -7035,7 +7037,9 @@
|
|
|
(SELECT
|
|
|
ROUND( AVG( qi.score_res ), 2 ) AS avgScore,
|
|
|
t.behDeptId,
|
|
|
- t.behDeptName
|
|
|
+ t.behDeptName,
|
|
|
+ t.doctorId,
|
|
|
+ t.doctorName
|
|
|
FROM
|
|
|
(SELECT DISTINCT
|
|
|
t1.hospital_id AS hospitalId,
|
|
@@ -7113,16 +7117,20 @@
|
|
|
med_behospital_info a,
|
|
|
med_qcresult_info b,
|
|
|
med_qcresult_detail c,
|
|
|
- qc_cases_entry d
|
|
|
+ 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 a.beh_dept_id = e.dept_id
|
|
|
AND c.cases_id = d.cases_id
|
|
|
AND c.cases_entry_id = d.id
|
|
|
AND a.qc_type_id != 0
|
|
@@ -7276,126 +7284,657 @@
|
|
|
</if>
|
|
|
GROUP BY
|
|
|
t.behDeptId,
|
|
|
- t.behDeptName
|
|
|
+ t.behDeptName,
|
|
|
+ t.doctorId,
|
|
|
+ t.doctorName
|
|
|
)f2
|
|
|
WHERE
|
|
|
- f1.behDeptId = f2.behDeptId
|
|
|
- AND f1.behDeptName = f2.behDeptName
|
|
|
+ f1.doctorId = f2.doctorId
|
|
|
+ AND f1.doctorName = f2.doctorName
|
|
|
)m
|
|
|
</select>
|
|
|
-
|
|
|
- <resultMap id="MedicalCheckMap" type="com.diagbot.dto.MedicalCheckDTO">
|
|
|
- <result column="deptName" property="deptName"/>
|
|
|
- <result column="deptId" property="deptId"/>
|
|
|
- <result column="doctorName" property="doctorName"/>
|
|
|
- <result column="entry_2658_num" property="entry_2658_num"/>
|
|
|
- <result column="entry_2686_num" property="entry_2686_num"/>
|
|
|
- <result column="entry_2657_num" property="entry_2657_num"/>
|
|
|
- <result column="entry_3010_num" property="entry_3010_num"/>
|
|
|
- <result column="entry_2655_num" property="entry_2655_num"/>
|
|
|
- <result column="entry_2654_num" property="entry_2654_num"/>
|
|
|
- <result column="entry_2852_num" property="entry_2852_num"/>
|
|
|
- <result column="entry_2287_num" property="entry_2287_num"/>
|
|
|
- <result column="entry_3025_num" property="entry_3025_num"/>
|
|
|
- <result column="entry_2170_num" property="entry_2170_num"/>
|
|
|
- <result column="entry_2930_num" property="entry_2930_num"/>
|
|
|
- <result column="entry_2900_num" property="entry_2900_num"/>
|
|
|
- <result column="entry_2229_num" property="entry_2229_num"/>
|
|
|
- <result column="entry_2217_num" property="entry_2217_num"/>
|
|
|
- <result column="entry_2218_num" property="entry_2218_num"/>
|
|
|
- <result column="entry_2220_num" property="entry_2220_num"/>
|
|
|
- <result column="entry_2486_num" property="entry_2486_num"/>
|
|
|
- <result column="entry_3063_num" property="entry_3063_num"/>
|
|
|
- <result column="entry_3062_num" property="entry_3062_num"/>
|
|
|
- <result column="entry_2495_num" property="entry_2495_num"/>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
- <!-- 病历稽查表最新sql-->
|
|
|
- <select id="getMedicalCheck" resultMap="MedicalCheckMap">
|
|
|
+ <!-- 条目缺陷评分详情页导出-->
|
|
|
+ <select id="qcResultShortPageExport" resultMap="ExportExcelMap">
|
|
|
+ SELECT * from(
|
|
|
SELECT
|
|
|
- a.beh_dept_id AS deptId,
|
|
|
- a.beh_dept_name AS deptName,
|
|
|
- a.doctor_name as doctorName,
|
|
|
- sum(c.cases_entry_id = 2658) as entry_2658_num,
|
|
|
- sum(c.cases_entry_id = 2686) as entry_2686_num,
|
|
|
- sum(c.cases_entry_id = 2657) as entry_2657_num,
|
|
|
- sum(c.cases_entry_id = 3010) as entry_3010_num,
|
|
|
- sum(c.cases_entry_id = 2655) as entry_2655_num,
|
|
|
- sum(c.cases_entry_id = 2654) as entry_2654_num,
|
|
|
- sum(c.cases_entry_id = 2852) as entry_2852_num,
|
|
|
- sum(c.cases_entry_id = 2287) as entry_2287_num,
|
|
|
- sum(c.cases_entry_id = 3025) as entry_3025_num,
|
|
|
- sum(c.cases_entry_id = 2170) as entry_2170_num,
|
|
|
- sum(c.cases_entry_id = 2930) as entry_2930_num,
|
|
|
- sum(c.cases_entry_id = 2900) as entry_2900_num,
|
|
|
- sum(c.cases_entry_id = 2229) as entry_2229_num,
|
|
|
- sum(c.cases_entry_id = 2217) as entry_2217_num,
|
|
|
- sum(c.cases_entry_id = 2218) as entry_2218_num,
|
|
|
- sum(c.cases_entry_id = 2220) as entry_2220_num,
|
|
|
- sum(c.cases_entry_id = 2486) as entry_2486_num,
|
|
|
- sum(c.cases_entry_id = 3063) as entry_3063_num,
|
|
|
- sum(c.cases_entry_id = 3062) as entry_3062_num,
|
|
|
- sum(c.cases_entry_id = 2495) as entry_2495_num
|
|
|
+ f1.*,
|
|
|
+ f2.avgScore
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ t.*,
|
|
|
+ qi.score_res AS score,
|
|
|
+ qd.msg AS msg,
|
|
|
+ qc.NAME AS caseName
|
|
|
+ FROM
|
|
|
+ (SELECT DISTINCT
|
|
|
+ t1.hospital_id AS hospitalId,
|
|
|
+ t1.behospital_code AS behospitalCode,
|
|
|
+ t1.bed_code AS bedCode,
|
|
|
+ t1.LEVEL AS LEVEL,
|
|
|
+ t1.grade_type AS gradeType,
|
|
|
+ t1.score_res AS scoreRes,
|
|
|
+ t1.scoreBn AS scoreBn,
|
|
|
+ t1.NAME AS patName,
|
|
|
+ t1.sex AS sex,
|
|
|
+ t1.beh_dept_id AS behDeptId,
|
|
|
+ t1.beh_dept_name AS behDeptName,
|
|
|
+ t1.doctor_id AS doctorId,
|
|
|
+ t1.doctor_name AS doctorName,
|
|
|
+ t1.beh_doctor_id AS behDoctorId,
|
|
|
+ t1.beh_doctor_name AS behDoctorName,
|
|
|
+ t1.director_doctor_id AS directorDoctorId,
|
|
|
+ t1.director_doctor_name AS directorDoctorName,
|
|
|
+ t1.birthday AS birthday,
|
|
|
+ t1.behospital_date AS behospitalDate,
|
|
|
+ t1.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ t1.placefile_date AS placefileDate,
|
|
|
+ t1.gmt_create AS gradeTime,
|
|
|
+ t1.diagnose AS diagnose,
|
|
|
+ t1.ward_name AS wardName,
|
|
|
+ t1.file_code AS fileCode,
|
|
|
+ t1.checkStatus AS checkStatus,
|
|
|
+ t1.mrStatus AS mrStatus,
|
|
|
+ t1.chName AS chName,
|
|
|
+ t1.mrName AS mrName,
|
|
|
+ t1.chTime AS chTime,
|
|
|
+ t1.mrTime AS mrTime
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ tt1.*
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ be.*,
|
|
|
+ ifnull(mci.status,0) AS checkStatus,
|
|
|
+ ifnull(hm_mci.status,0) AS mrStatus,
|
|
|
+ mci.check_name as chName,
|
|
|
+ hm_mci.check_name as mrName,
|
|
|
+ mci.gmt_create as chTime,
|
|
|
+ e.score_res as scoreBn,
|
|
|
+ hm_mci.gmt_create as mrTime
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ a.hospital_id,
|
|
|
+ a.behospital_code,
|
|
|
+ a.bed_code,
|
|
|
+ a.file_code,
|
|
|
+ b.LEVEL,
|
|
|
+ b.grade_type,
|
|
|
+ b.score_res,
|
|
|
+ a.NAME,
|
|
|
+ a.sex,
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.birthday,
|
|
|
+ a.behospital_date,
|
|
|
+ a.leave_hospital_date,
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name,
|
|
|
+ a.beh_doctor_id,
|
|
|
+ a.beh_doctor_name,
|
|
|
+ a.director_doctor_id,
|
|
|
+ a.director_doctor_name,
|
|
|
+ a.diagnose,
|
|
|
+ a.placefile_date,
|
|
|
+ a.ward_name,
|
|
|
+ b.gmt_create
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
med_qcresult_info b,
|
|
|
med_qcresult_detail c,
|
|
|
- qc_cases_entry d,
|
|
|
- bas_doctor_info e
|
|
|
+ qc_cases_entry d
|
|
|
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_id = d.cases_id
|
|
|
AND c.cases_entry_id = d.id
|
|
|
- and a.doctor_id=e.doctor_id
|
|
|
- and e.group_id is not NULL
|
|
|
- AND LENGTH(e.group_id)>0
|
|
|
AND a.qc_type_id != 0
|
|
|
- <if test="filterVO.isPlacefile != null and filterVO.isPlacefile != ''">
|
|
|
- and a.is_placefile = #{filterVO.isPlacefile}
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
|
|
|
</if>
|
|
|
- <if test="filterVO.hospitalId != null and filterVO.hospitalId != ''">
|
|
|
- AND a.hospital_id = #{filterVO.hospitalId}
|
|
|
+ <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
|
|
|
</if>
|
|
|
- <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 0">
|
|
|
- <if test="filterVO.startDate != null ">
|
|
|
- <![CDATA[ AND a.behospital_date >= #{filterVO.startDate}]]>
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 0">
|
|
|
+ <if test="qcResultShortPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
</if>
|
|
|
- <if test="filterVO.endDate != null ">
|
|
|
- <![CDATA[ AND a.behospital_date <= #{filterVO.endDate}]]>
|
|
|
+ <if test="qcResultShortPageVO.endDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 1">
|
|
|
- <if test="filterVO.startDate != null ">
|
|
|
- <![CDATA[ AND a.leave_hospital_date >= #{filterVO.startDate}]]>
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 1">
|
|
|
+ <if test="qcResultShortPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
</if>
|
|
|
- <if test="filterVO.endDate != null ">
|
|
|
- <![CDATA[ AND a.leave_hospital_date <= #{filterVO.endDate}]]>
|
|
|
+ <if test="qcResultShortPageVO.endDate != null">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
</if>
|
|
|
</if>
|
|
|
- <if test="filterVO.deptName != null and filterVO.deptName != ''">
|
|
|
- AND a.beh_dept_name like CONCAT('%', #{filterVO.deptName}, '%')
|
|
|
+ <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
|
|
|
</if>
|
|
|
- GROUP BY
|
|
|
- a.beh_dept_id,
|
|
|
- e.group_id,
|
|
|
- a.doctor_id
|
|
|
- </select>
|
|
|
+ <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
|
|
|
|
|
|
- <!-- 病历稽查表最新sql、id&&name-->
|
|
|
- <select id="getMedicalEntryIds" resultType="com.diagbot.dto.MedicalCheckIdNameDTO">
|
|
|
- SELECT
|
|
|
- d.id,
|
|
|
- d.name
|
|
|
- from
|
|
|
- qc_cases_entry d
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
|
|
|
+ AND b.`level` = #{qcResultShortPageVO.level}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
|
|
|
+ AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
|
|
|
+ AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
|
|
|
+ AND d.NAME = #{qcResultShortPageVO.casesEntryName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null ">
|
|
|
+ AND d.id = #{qcResultShortPageVO.casesEntryId}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
|
|
|
+ AND d.cases_name = #{qcResultShortPageVO.casesName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesId != null">
|
|
|
+ AND d.cases_id = #{qcResultShortPageVO.casesId}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
|
|
|
+ AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
+ AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.isReject != null">
|
|
|
+ AND c.is_reject = #{qcResultShortPageVO.isReject}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.ruleType != null">
|
|
|
+ AND d.rule_type = #{qcResultShortPageVO.ruleType}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 30
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 31
|
|
|
+ </if>
|
|
|
+ )be
|
|
|
+ left join med_check_info mci
|
|
|
+ on mci.is_deleted = 'N'
|
|
|
+ and mci.check_type = 0
|
|
|
+ and be.hospital_id = mci.hospital_id
|
|
|
+ and be.behospital_code = mci.behospital_code
|
|
|
+ left join med_check_info hm_mci
|
|
|
+ on hm_mci.is_deleted = 'N'
|
|
|
+ and hm_mci.check_type = 1
|
|
|
+ and be.hospital_id = hm_mci.hospital_id
|
|
|
+ and be.behospital_code = hm_mci.behospital_code
|
|
|
+ LEFT JOIN med_qcresult_cases e
|
|
|
+ on be.behospital_code = e.behospital_code
|
|
|
+ and be.hospital_id = e.hospital_id
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ and e.cases_id = 243
|
|
|
+ )tt1
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
|
|
|
+ ,med_medical_record tt2
|
|
|
+ WHERE
|
|
|
+ tt2.is_deleted = 'N'
|
|
|
+ AND tt1.hospital_id = tt2.hospital_id
|
|
|
+ AND tt1.behospital_code = tt2.behospital_code
|
|
|
+ AND tt2.mode_id = 30
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
|
|
|
+ ,med_crisis_info tt2
|
|
|
+ WHERE
|
|
|
+ tt2.is_deleted = 'N'
|
|
|
+ AND tt1.hospital_id = tt2.hospital_id
|
|
|
+ AND tt1.behospital_code = tt2.behospital_code
|
|
|
+ </if>
|
|
|
+ ) t1
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594 and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
|
|
|
+ LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594 or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
|
|
|
+ , med_home_page t2
|
|
|
+ , med_home_operation_info t3
|
|
|
+ WHERE t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t2.home_page_id = t3.home_page_id
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
|
|
|
+ AND t.hospitalId = qi.hospital_id
|
|
|
+ AND t.behospitalCode = qi.behospital_code
|
|
|
+ LEFT JOIN med_qcresult_detail qd ON qd.is_deleted = 'N'
|
|
|
+ AND t.hospitalId = qd.hospital_id
|
|
|
+ AND t.behospitalCode = qd.behospital_code
|
|
|
+ LEFT JOIN qc_cases qc ON qc.is_deleted = 'N'
|
|
|
+ AND qd.cases_id = qc.id
|
|
|
+ LEFT JOIN qc_cases_entry qce ON qce.is_deleted = 'N'
|
|
|
+ AND qd.cases_id = qce.cases_id
|
|
|
+ AND qd.cases_entry_id = qce.id
|
|
|
+ where 1=1
|
|
|
+ <if test="qcResultShortPageVO.checkStatus != null">
|
|
|
+ AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrStatus != null">
|
|
|
+ AND t.mrStatus = #{qcResultShortPageVO.mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.chName != null and qcResultShortPageVO.chName!=''">
|
|
|
+ AND t.chName like concat('%', #{qcResultShortPageVO.chName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrName != null and qcResultShortPageVO.mrName!=''">
|
|
|
+ AND t.mrName like concat('%', #{qcResultShortPageVO.mrName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.chTimeStart != null ">
|
|
|
+ <![CDATA[ AND t.chTime >= #{qcResultShortPageVO.chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.chTimeEnd != null ">
|
|
|
+ <![CDATA[ AND t.chTime <= #{qcResultShortPageVO.chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrTimeStart != null ">
|
|
|
+ <![CDATA[ AND t.mrTime >= #{qcResultShortPageVO.mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrTimeEnd != null ">
|
|
|
+ <![CDATA[ AND t.mrTime <= #{qcResultShortPageVO.mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
|
|
|
+ AND qce.NAME = #{qcResultShortPageVO.casesEntryName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null ">
|
|
|
+ AND qce.id = #{qcResultShortPageVO.casesEntryId}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
|
|
|
+ AND qce.cases_name = #{qcResultShortPageVO.casesName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesId != null">
|
|
|
+ AND qce.cases_id = #{qcResultShortPageVO.casesId}
|
|
|
+ </if>
|
|
|
+ )f1,
|
|
|
+ (SELECT
|
|
|
+ ROUND( AVG( qi.score_res ), 2 ) AS avgScore,
|
|
|
+ t.behDeptId,
|
|
|
+ t.behDeptName
|
|
|
+ FROM
|
|
|
+ (SELECT DISTINCT
|
|
|
+ t1.hospital_id AS hospitalId,
|
|
|
+ t1.behospital_code AS behospitalCode,
|
|
|
+ t1.bed_code AS bedCode,
|
|
|
+ t1.LEVEL AS LEVEL,
|
|
|
+ t1.grade_type AS gradeType,
|
|
|
+ t1.score_res AS scoreRes,
|
|
|
+ t1.NAME AS NAME,
|
|
|
+ t1.sex AS sex,
|
|
|
+ t1.beh_dept_id AS behDeptId,
|
|
|
+ t1.beh_dept_name AS behDeptName,
|
|
|
+ t1.doctor_id AS doctorId,
|
|
|
+ t1.doctor_name AS doctorName,
|
|
|
+ t1.beh_doctor_id AS behDoctorId,
|
|
|
+ t1.beh_doctor_name AS behDoctorName,
|
|
|
+ t1.director_doctor_id AS directorDoctorId,
|
|
|
+ t1.director_doctor_name AS directorDoctorName,
|
|
|
+ t1.birthday AS birthday,
|
|
|
+ t1.behospital_date AS behospitalDate,
|
|
|
+ t1.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ t1.placefile_date AS placefileDate,
|
|
|
+ t1.gmt_create AS gradeTime,
|
|
|
+ t1.diagnose,
|
|
|
+ t1.ward_name AS wardName,
|
|
|
+ t2.age,
|
|
|
+ t1.file_code AS fileCode,
|
|
|
+ t1.checkStatus,
|
|
|
+ t1.mrStatus,
|
|
|
+ t1.chName,
|
|
|
+ t1.mrName,
|
|
|
+ t1.chTime,
|
|
|
+ t1.mrTime
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ tt1.*
|
|
|
+ FROM
|
|
|
+ (SELECT
|
|
|
+ be.*,
|
|
|
+ ifnull(mci.status,0) AS checkStatus,
|
|
|
+ ifnull(hm_mci.status,0) AS mrStatus,
|
|
|
+ mci.check_name as chName,
|
|
|
+ hm_mci.check_name as mrName,
|
|
|
+ mci.gmt_create as chTime,
|
|
|
+ hm_mci.gmt_create as mrTime
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT DISTINCT
|
|
|
+ a.hospital_id,
|
|
|
+ a.behospital_code,
|
|
|
+ a.bed_code,
|
|
|
+ a.file_code,
|
|
|
+ b.LEVEL,
|
|
|
+ b.grade_type,
|
|
|
+ b.score_res,
|
|
|
+ a.NAME,
|
|
|
+ a.sex,
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.birthday,
|
|
|
+ a.behospital_date,
|
|
|
+ a.leave_hospital_date,
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name,
|
|
|
+ a.beh_doctor_id,
|
|
|
+ a.beh_doctor_name,
|
|
|
+ a.director_doctor_id,
|
|
|
+ a.director_doctor_name,
|
|
|
+ a.diagnose,
|
|
|
+ a.placefile_date,
|
|
|
+ a.ward_name,
|
|
|
+ b.gmt_create
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases_entry d
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.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
|
|
|
+ AND c.cases_id = d.cases_id
|
|
|
+ AND c.cases_entry_id = d.id
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{qcResultShortPageVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.hospitalId != null and qcResultShortPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{qcResultShortPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 0">
|
|
|
+ <if test="qcResultShortPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.endDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.isPlacefile != null and qcResultShortPageVO.isPlacefile == 1">
|
|
|
+ <if test="qcResultShortPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{qcResultShortPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.endDate != null">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{qcResultShortPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.diagnose != null and qcResultShortPageVO.diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{qcResultShortPageVO.diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.deptName != null and qcResultShortPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name LIKE CONCAT( '%', #{qcResultShortPageVO.deptName}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.level != null and qcResultShortPageVO.level != ''">
|
|
|
+ AND b.`level` = #{qcResultShortPageVO.level}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.behospitalCode != null and qcResultShortPageVO.behospitalCode != ''">
|
|
|
+ AND a.behospital_code LIKE CONCAT( '%', #{qcResultShortPageVO.behospitalCode}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.patName != null and qcResultShortPageVO.patName != ''">
|
|
|
+ AND a.NAME LIKE CONCAT( '%', #{qcResultShortPageVO.patName}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryName != null and qcResultShortPageVO.casesEntryName != ''">
|
|
|
+ AND d.NAME = #{qcResultShortPageVO.casesEntryName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null ">
|
|
|
+ AND d.id = #{qcResultShortPageVO.casesEntryId}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesName != null and qcResultShortPageVO.casesName != ''">
|
|
|
+ AND d.cases_name = #{qcResultShortPageVO.casesName}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesId != null">
|
|
|
+ AND d.cases_id = #{qcResultShortPageVO.casesId}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorId != null and qcResultShortPageVO.doctorId != ''">
|
|
|
+ AND (a.doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.beh_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' )
|
|
|
+ OR a.director_doctor_id LIKE CONCAT( '%', #{qcResultShortPageVO.doctorId}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.doctorName != null and qcResultShortPageVO.doctorName != ''">
|
|
|
+ AND (a.doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.beh_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' )
|
|
|
+ OR a.director_doctor_name LIKE CONCAT( '%', #{qcResultShortPageVO.doctorName}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.isReject != null">
|
|
|
+ AND c.is_reject = #{qcResultShortPageVO.isReject}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.ruleType != null">
|
|
|
+ AND d.rule_type = #{qcResultShortPageVO.ruleType}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2495">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 30
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.beHosGT31Days != null and qcResultShortPageVO.beHosGT31Days==1">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 31
|
|
|
+ </if>
|
|
|
+ )be
|
|
|
+ left join med_check_info mci
|
|
|
+ on mci.is_deleted = 'N'
|
|
|
+ and mci.check_type = 0
|
|
|
+ and be.hospital_id = mci.hospital_id
|
|
|
+ and be.behospital_code = mci.behospital_code
|
|
|
+ left join med_check_info hm_mci
|
|
|
+ on hm_mci.is_deleted = 'N'
|
|
|
+ and hm_mci.check_type = 1
|
|
|
+ and be.hospital_id = hm_mci.hospital_id
|
|
|
+ and be.behospital_code = hm_mci.behospital_code
|
|
|
+ )tt1
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2511">
|
|
|
+ ,med_medical_record tt2
|
|
|
+ WHERE
|
|
|
+ tt2.is_deleted = 'N'
|
|
|
+ AND tt1.hospital_id = tt2.hospital_id
|
|
|
+ AND tt1.behospital_code = tt2.behospital_code
|
|
|
+ AND tt2.mode_id = 30
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and qcResultShortPageVO.casesEntryId==2419">
|
|
|
+ ,med_crisis_info tt2
|
|
|
+ WHERE
|
|
|
+ tt2.is_deleted = 'N'
|
|
|
+ AND tt1.hospital_id = tt2.hospital_id
|
|
|
+ AND tt1.behospital_code = tt2.behospital_code
|
|
|
+ </if>
|
|
|
+ ) t1
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId == null or (qcResultShortPageVO.casesEntryId!=2594 and qcResultShortPageVO.casesEntryId!=2973 and qcResultShortPageVO.casesEntryId!=2930)">
|
|
|
+ LEFT JOIN med_home_page t2 ON t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.casesEntryId != null and( qcResultShortPageVO.casesEntryId==2594 or qcResultShortPageVO.casesEntryId==2973 or qcResultShortPageVO.casesEntryId==2930)">
|
|
|
+ , med_home_page t2
|
|
|
+ , med_home_operation_info t3
|
|
|
+ WHERE t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t2.home_page_id = t3.home_page_id
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ </if>
|
|
|
+ ) t
|
|
|
+ LEFT JOIN med_qcresult_info qi ON qi.is_deleted = 'N'
|
|
|
+ AND t.hospitalId = qi.hospital_id
|
|
|
+ AND t.behospitalCode = qi.behospital_code
|
|
|
+ where 1=1
|
|
|
+ <if test="qcResultShortPageVO.checkStatus != null">
|
|
|
+ AND t.checkStatus = #{qcResultShortPageVO.checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrStatus != null">
|
|
|
+ AND t.mrStatus = #{qcResultShortPageVO.mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.chName != null and qcResultShortPageVO.chName!=''">
|
|
|
+ AND t.chName like concat('%', #{qcResultShortPageVO.chName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrName != null and qcResultShortPageVO.mrName!=''">
|
|
|
+ AND t.mrName like concat('%', #{qcResultShortPageVO.mrName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.chTimeStart != null ">
|
|
|
+ <![CDATA[ AND t.chTime >= #{qcResultShortPageVO.chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.chTimeEnd != null ">
|
|
|
+ <![CDATA[ AND t.chTime <= #{qcResultShortPageVO.chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrTimeStart != null ">
|
|
|
+ <![CDATA[ AND t.mrTime >= #{qcResultShortPageVO.mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="qcResultShortPageVO.mrTimeEnd != null ">
|
|
|
+ <![CDATA[ AND t.mrTime <= #{qcResultShortPageVO.mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ t.behDeptId,
|
|
|
+ t.behDeptName
|
|
|
+ )f2
|
|
|
+ WHERE
|
|
|
+ f1.behDeptId = f2.behDeptId
|
|
|
+ AND f1.behDeptName = f2.behDeptName
|
|
|
+ )m
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <resultMap id="MedicalCheckMap" type="com.diagbot.dto.MedicalCheckDTO">
|
|
|
+ <result column="deptName" property="deptName"/>
|
|
|
+ <result column="deptId" property="deptId"/>
|
|
|
+ <result column="doctorName" property="doctorName"/>
|
|
|
+ <result column="entry_2658_num" property="entry_2658_num"/>
|
|
|
+ <result column="entry_2686_num" property="entry_2686_num"/>
|
|
|
+ <result column="entry_2657_num" property="entry_2657_num"/>
|
|
|
+ <result column="entry_3010_num" property="entry_3010_num"/>
|
|
|
+ <result column="entry_2655_num" property="entry_2655_num"/>
|
|
|
+ <result column="entry_2654_num" property="entry_2654_num"/>
|
|
|
+ <result column="entry_2852_num" property="entry_2852_num"/>
|
|
|
+ <result column="entry_2287_num" property="entry_2287_num"/>
|
|
|
+ <result column="entry_3025_num" property="entry_3025_num"/>
|
|
|
+ <result column="entry_2170_num" property="entry_2170_num"/>
|
|
|
+ <result column="entry_2930_num" property="entry_2930_num"/>
|
|
|
+ <result column="entry_2900_num" property="entry_2900_num"/>
|
|
|
+ <result column="entry_2229_num" property="entry_2229_num"/>
|
|
|
+ <result column="entry_2217_num" property="entry_2217_num"/>
|
|
|
+ <result column="entry_2218_num" property="entry_2218_num"/>
|
|
|
+ <result column="entry_2220_num" property="entry_2220_num"/>
|
|
|
+ <result column="entry_2486_num" property="entry_2486_num"/>
|
|
|
+ <result column="entry_3063_num" property="entry_3063_num"/>
|
|
|
+ <result column="entry_3062_num" property="entry_3062_num"/>
|
|
|
+ <result column="entry_2495_num" property="entry_2495_num"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 病历稽查表最新sql-->
|
|
|
+ <select id="getMedicalCheck" resultMap="MedicalCheckMap">
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ a.doctor_name as doctorName,
|
|
|
+ sum(c.cases_entry_id = 2658) as entry_2658_num,
|
|
|
+ sum(c.cases_entry_id = 2686) as entry_2686_num,
|
|
|
+ sum(c.cases_entry_id = 2657) as entry_2657_num,
|
|
|
+ sum(c.cases_entry_id = 3010) as entry_3010_num,
|
|
|
+ sum(c.cases_entry_id = 2655) as entry_2655_num,
|
|
|
+ sum(c.cases_entry_id = 2654) as entry_2654_num,
|
|
|
+ sum(c.cases_entry_id = 2852) as entry_2852_num,
|
|
|
+ sum(c.cases_entry_id = 2287) as entry_2287_num,
|
|
|
+ sum(c.cases_entry_id = 3025) as entry_3025_num,
|
|
|
+ sum(c.cases_entry_id = 2170) as entry_2170_num,
|
|
|
+ sum(c.cases_entry_id = 2930) as entry_2930_num,
|
|
|
+ sum(c.cases_entry_id = 2900) as entry_2900_num,
|
|
|
+ sum(c.cases_entry_id = 2229) as entry_2229_num,
|
|
|
+ sum(c.cases_entry_id = 2217) as entry_2217_num,
|
|
|
+ sum(c.cases_entry_id = 2218) as entry_2218_num,
|
|
|
+ sum(c.cases_entry_id = 2220) as entry_2220_num,
|
|
|
+ sum(c.cases_entry_id = 2486) as entry_2486_num,
|
|
|
+ sum(c.cases_entry_id = 3063) as entry_3063_num,
|
|
|
+ sum(c.cases_entry_id = 3062) as entry_3062_num,
|
|
|
+ sum(c.cases_entry_id = 2495) as entry_2495_num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases_entry d,
|
|
|
+ bas_doctor_info 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.doctor_id=e.doctor_id
|
|
|
+ and e.group_id is not NULL
|
|
|
+ AND LENGTH(e.group_id)>0
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="filterVO.isPlacefile != null and filterVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{filterVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="filterVO.hospitalId != null and filterVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{filterVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 0">
|
|
|
+ <if test="filterVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{filterVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterVO.endDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{filterVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="filterVO.isPlacefile != null and filterVO.isPlacefile == 1">
|
|
|
+ <if test="filterVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{filterVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="filterVO.endDate != null ">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{filterVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="filterVO.deptName != null and filterVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name like CONCAT('%', #{filterVO.deptName}, '%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ e.group_id,
|
|
|
+ a.doctor_id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 病历稽查表最新sql、id&&name-->
|
|
|
+ <select id="getMedicalEntryIds" resultType="com.diagbot.dto.MedicalCheckIdNameDTO">
|
|
|
+ SELECT
|
|
|
+ d.id,
|
|
|
+ d.name
|
|
|
+ from
|
|
|
+ qc_cases_entry d
|
|
|
where
|
|
|
1=1
|
|
|
<if test="casesEntryIds != null and casesEntryIds.size() > 0">
|
|
@@ -8833,7 +9372,7 @@
|
|
|
SELECT
|
|
|
f1.behDeptId,
|
|
|
f1.behDeptName,
|
|
|
- f1.behDoctorName,
|
|
|
+ f1.doctorName,
|
|
|
f1.patName,
|
|
|
f1.behospitalCode,
|
|
|
f1.hospitalId,
|
|
@@ -8854,7 +9393,7 @@
|
|
|
f1.mrTime
|
|
|
FROM
|
|
|
(SELECT
|
|
|
- t.doctorName AS behDoctorName,
|
|
|
+ t.doctorName AS doctorName,
|
|
|
t.doctorId,
|
|
|
t.`name` AS patName,
|
|
|
t.behospitalCode AS behospitalCode,
|
|
@@ -9314,7 +9853,7 @@
|
|
|
)f2
|
|
|
WHERE
|
|
|
f1.doctorId = f2.doctorId
|
|
|
- AND f1.behDoctorName = f2.doctorName
|
|
|
+ AND f1.doctorName = f2.doctorName
|
|
|
</select>
|
|
|
|
|
|
<!-- 未整改病历缺陷评分详情页导出-->
|