|
@@ -849,7 +849,6 @@
|
|
|
where a.is_deleted = 'N' and b.is_deleted = 'N' and d.is_deleted = 'N'
|
|
|
and a.mode_id = b.id
|
|
|
and a.id = d.cases_entry_id
|
|
|
- and d.is_used = 1
|
|
|
and d.hospital_id = #{hospitalId}
|
|
|
and a.code in
|
|
|
<foreach collection="codeList" item="item" open="(" close=")" separator=",">
|
|
@@ -4551,6 +4550,29 @@
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
+ <resultMap id="ExportDoctorAverage_7" type="com.diagbot.dto.ExportDoctorAverageLevel_7DTO">
|
|
|
+ <result column="behDeptName" property="behDeptName"/>
|
|
|
+ <result column="avgScore" property="avgScore"/>
|
|
|
+ <collection property="excelBehospitalDTOS"
|
|
|
+ ofType="com.diagbot.dto.ExportBehospital_7DTO">
|
|
|
+ <result column="doctorName" property="doctorName"/>
|
|
|
+ <result column="patName" property="patName"/>
|
|
|
+ <result column="behospitalCode" property="behospitalCode"/>
|
|
|
+ <result column="behospitalDate" property="behospitalDate"/>
|
|
|
+ <result column="leaveHospitalDate" property="leaveHospitalDate"/>
|
|
|
+ <result column="score" property="score"/>
|
|
|
+ <result column="scoreBn" property="scoreBn"/>
|
|
|
+ <collection property="exportExcelCaseDTOS" ofType="com.diagbot.dto.ExportCase_7DTO">
|
|
|
+ <result column="caseName" property="caseName"/>
|
|
|
+ <collection property="exportExcelMsgDTOS"
|
|
|
+ ofType="com.diagbot.dto.ExportMsg_7DTO">
|
|
|
+ <result column="msg" property="msg"/>
|
|
|
+ </collection>
|
|
|
+ </collection>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+
|
|
|
<select id="exportExcel" resultMap="ExportExcelMap">
|
|
|
SELECT DISTINCT
|
|
|
t1.beh_dept_name AS behDeptName,
|
|
@@ -19763,4 +19785,913 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</select>
|
|
|
+ <select id="doctorAverageStatistics" resultType="com.diagbot.dto.DoctorAverageStatisticsDTO">
|
|
|
+ SELECT t1.*,t2.entryNum
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ CASE WHEN (a.doctor_id is null OR a.doctor_id = '' OR a.doctor_id = '-') THEN '-' ELSE a.doctor_id END AS doctorId,
|
|
|
+ CASE WHEN (a.doctor_name is null OR a.doctor_name = '' OR a.doctor_name = '-') THEN '-' ELSE a.doctor_name END AS doctorName,
|
|
|
+ CASE WHEN (a.beh_dept_id is null OR a.beh_dept_id = '' OR a.beh_dept_id = '-') THEN '-' ELSE a.beh_dept_id END AS deptId,
|
|
|
+ CASE WHEN (a.beh_dept_name is null OR a.beh_dept_name = '' OR a.beh_dept_name = '-') THEN '-' ELSE a.beh_dept_name END AS deptName,
|
|
|
+ ROUND( avg( CAST(c.score_res as DECIMAL ( 18, 2 )) ), 2 ) AS averageValue,
|
|
|
+ SUM( c.`level` = '甲' ) AS firstLevelNum,
|
|
|
+ SUM( c.`level` = '乙' ) AS secondLevelNum,
|
|
|
+ SUM( c.`level` = '丙' ) AS thirdLevelNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{doctorAverageStatisticsVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="doctorAverageStatisticsVO.hospitalId != null and doctorAverageStatisticsVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{doctorAverageStatisticsVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptId != null and doctorAverageStatisticsVO.deptId != '' and doctorAverageStatisticsVO.deptId != '-0'">
|
|
|
+ AND a.beh_dept_id = #{doctorAverageStatisticsVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptId == '-0'">
|
|
|
+ AND (a.beh_dept_id IS NULL OR a.beh_dept_id = '' OR a.beh_dept_id = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptName != null and doctorAverageStatisticsVO.deptName != '' and doctorAverageStatisticsVO.deptName != '-0'">
|
|
|
+ AND a.beh_dept_name = #{doctorAverageStatisticsVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptName == '-0'">
|
|
|
+ AND (a.beh_dept_name IS NULL OR a.beh_dept_name = '' OR a.beh_dept_name = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorId != null and doctorAverageStatisticsVO.doctorId != '' and doctorAverageStatisticsVO.doctorId != '-0'">
|
|
|
+ AND a.doctor_id LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorId == '-0'">
|
|
|
+ AND (a.doctor_id IS NULL OR a.doctor_id = '' OR a.doctor_id = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorName != null and doctorAverageStatisticsVO.doctorName != '' and doctorAverageStatisticsVO.doctorName != '-0'">
|
|
|
+ AND a.doctor_name LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorName == '-0'">
|
|
|
+ AND (a.doctor_name IS NULL OR a.doctor_name = '' OR a.doctor_name = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile == 0">
|
|
|
+ <if test="doctorAverageStatisticsVO.startDate != null and doctorAverageStatisticsVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{doctorAverageStatisticsVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.endDate != null and doctorAverageStatisticsVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{doctorAverageStatisticsVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile == 1">
|
|
|
+ <if test="doctorAverageStatisticsVO.startDate != null and doctorAverageStatisticsVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{doctorAverageStatisticsVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.endDate != null and doctorAverageStatisticsVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{doctorAverageStatisticsVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ )t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ CASE WHEN (a.doctor_id is null OR a.doctor_id = '' OR a.doctor_id = '-') THEN '-' ELSE a.doctor_id END AS doctorId,
|
|
|
+ CASE WHEN (a.doctor_name is null OR a.doctor_name = '' OR a.doctor_name = '-') THEN '-' ELSE a.doctor_name END AS doctorName,
|
|
|
+ CASE WHEN (a.beh_dept_id is null OR a.beh_dept_id = '' OR a.beh_dept_id = '-') THEN '-' ELSE a.beh_dept_id END AS deptId,
|
|
|
+ CASE WHEN (a.beh_dept_name is null OR a.beh_dept_name = '' OR a.beh_dept_name = '-') THEN '-' ELSE a.beh_dept_name END AS deptName,
|
|
|
+ count( 1 ) AS entryNum
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info c,
|
|
|
+ med_qcresult_detail d,
|
|
|
+ qc_cases_entry e
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.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.behospital_code = d.behospital_code
|
|
|
+ AND d.cases_id = e.cases_id
|
|
|
+ AND d.cases_entry_id = e.id
|
|
|
+ <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{doctorAverageStatisticsVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="doctorAverageStatisticsVO.hospitalId != null and doctorAverageStatisticsVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{doctorAverageStatisticsVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptId != null and doctorAverageStatisticsVO.deptId != '' and doctorAverageStatisticsVO.deptId != '-0'">
|
|
|
+ AND a.beh_dept_id = #{doctorAverageStatisticsVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptId == '-0'">
|
|
|
+ AND (a.beh_dept_id IS NULL OR a.beh_dept_id = '' OR a.beh_dept_id = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptName != null and doctorAverageStatisticsVO.deptName != '' and doctorAverageStatisticsVO.deptName != '-0'">
|
|
|
+ AND a.beh_dept_name = #{doctorAverageStatisticsVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.deptName == '-0'">
|
|
|
+ AND (a.beh_dept_name IS NULL OR a.beh_dept_name = '' OR a.beh_dept_name = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorId != null and doctorAverageStatisticsVO.doctorId != '' and doctorAverageStatisticsVO.doctorId != '-0'">
|
|
|
+ AND a.doctor_id LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorId == '-0'">
|
|
|
+ AND (a.doctor_id IS NULL OR a.doctor_id = '' OR a.doctor_id = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorName != null and doctorAverageStatisticsVO.doctorName != '' and doctorAverageStatisticsVO.doctorName != '-0'">
|
|
|
+ AND a.doctor_name LIKE CONCAT('%',#{doctorAverageStatisticsVO.doctorName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.doctorName == '-0'">
|
|
|
+ AND (a.doctor_name IS NULL OR a.doctor_name = '' OR a.doctor_name = '-')
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile == 0">
|
|
|
+ <if test="doctorAverageStatisticsVO.startDate != null and doctorAverageStatisticsVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{doctorAverageStatisticsVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.endDate != null and doctorAverageStatisticsVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{doctorAverageStatisticsVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.isPlacefile != null and doctorAverageStatisticsVO.isPlacefile == 1">
|
|
|
+ <if test="doctorAverageStatisticsVO.startDate != null and doctorAverageStatisticsVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{doctorAverageStatisticsVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="doctorAverageStatisticsVO.endDate != null and doctorAverageStatisticsVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{doctorAverageStatisticsVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name
|
|
|
+ )t2
|
|
|
+ WHERE t1.doctorId = t2.doctorId
|
|
|
+ AND t1.doctorName = t2.doctorName
|
|
|
+ AND t1.deptId = t2.deptId
|
|
|
+ AND t1.deptName = t2.deptName
|
|
|
+ </select>
|
|
|
+<!-- 医生质控平均分-患者列表(等级)-->
|
|
|
+ <select id="doctorAverageLevelPage" resultType="com.diagbot.dto.DoctorAverageLevelDTO">
|
|
|
+ SELECT * FROM (
|
|
|
+ select t.*,
|
|
|
+ CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type AS ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name,
|
|
|
+ g.check_time AS ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
+ from (
|
|
|
+ select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
|
|
|
+ grade_time,IF(c.age is null, null,CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') ))as age,e.score_res as score_bn from med_behospital_info a
|
|
|
+ LEFT JOIN med_qcresult_info b
|
|
|
+ on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
|
|
|
+ left join med_home_page c
|
|
|
+ on a.behospital_code = c.behospital_code and c.is_deleted = 'N'
|
|
|
+ LEFT JOIN med_qcresult_cases e
|
|
|
+ on a.behospital_code = e.behospital_code
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ and e.cases_id = 243
|
|
|
+ ) t
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type in(0,2) ) g
|
|
|
+ ON t.behospital_code = g.behospital_code
|
|
|
+ AND t.hospital_id = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON t.behospital_code = h.behospital_code
|
|
|
+ AND t.hospital_id = h.hospital_id
|
|
|
+ where t.is_deleted = 'N'
|
|
|
+ <if test="diagnose != null and diagnose != ''">
|
|
|
+ AND t.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and t.beh_dept_name= #{deptName}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ and CONCAT(
|
|
|
+ IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,''))
|
|
|
+ like CONCAT('%',#{doctorName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and t.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ and (t.doctor_id = #{doctorCode}
|
|
|
+ or t.beh_doctor_id = #{doctorCode}
|
|
|
+ or t.director_doctor_id = #{doctorCode})
|
|
|
+ </if>
|
|
|
+ <if test="fileCode != null and fileCode != ''">
|
|
|
+ and t.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null">
|
|
|
+ and t.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="behosDateStart != null">
|
|
|
+ <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null">
|
|
|
+ <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null">
|
|
|
+ <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and t.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and t.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ and t.qc_type_id != 0) p
|
|
|
+ where p.is_deleted="N"
|
|
|
+ <if test="checkStatus != null ">
|
|
|
+ and p.check_status = #{checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND p.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND p.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND p.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and p.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and p.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and p.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and p.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <!-- 医生质控平均分-患者列表(等级)-导出-->
|
|
|
+ <select id="doctorAverageLevelExport" resultMap="ExportDoctorAverage_7">
|
|
|
+ SELECT * FROM (
|
|
|
+ SELECT tp.*,CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
+ CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
+ g.check_type AS ch_type,
|
|
|
+ h.check_type AS mr_type,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name,
|
|
|
+ g.check_time AS ch_time,
|
|
|
+ h.check_time AS mr_time
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ t1.behDeptId,
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.doctorName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.hospitalId,
|
|
|
+ t1.behospitalDate,
|
|
|
+ t1.leaveHospitalDate,
|
|
|
+ t1.score,
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ t1.msg,
|
|
|
+ t1.caseName,
|
|
|
+ </if>
|
|
|
+ t1.scoreBn,
|
|
|
+ t2.avgScore
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.doctor_name AS doctorName,
|
|
|
+ a.`name` AS patName,
|
|
|
+ a.behospital_code AS behospitalCode,
|
|
|
+ a.behospital_date AS behospitalDate,
|
|
|
+ a.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ b.score_res AS score,
|
|
|
+ e.score_res as scoreBn,
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ c.msg AS msg,
|
|
|
+ d.NAME AS caseName,
|
|
|
+ </if>
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName,
|
|
|
+ a.hospital_id AS hospitalId
|
|
|
+ FROM
|
|
|
+ med_behospital_info a
|
|
|
+ RIGHT JOIN
|
|
|
+ med_qcresult_info b
|
|
|
+ ON a.hospital_id = b.hospital_id
|
|
|
+ AND a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ LEFT JOIN
|
|
|
+ med_qcresult_detail c
|
|
|
+ ON c.is_deleted = 'N'
|
|
|
+ AND b.behospital_code = c.behospital_code
|
|
|
+ AND b.hospital_id = c.hospital_id
|
|
|
+ LEFT JOIN
|
|
|
+ qc_cases d
|
|
|
+ on d.is_deleted = 'N'
|
|
|
+ AND c.cases_id = d.id
|
|
|
+ </if>
|
|
|
+ LEFT JOIN med_qcresult_cases e
|
|
|
+ on b.behospital_code = e.behospital_code
|
|
|
+ and b.hospital_id = e.hospital_id
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ and e.cases_id = 243
|
|
|
+ WHERE
|
|
|
+ 1=1
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="diagnose != null and diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="behosDateStart != null">
|
|
|
+ <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null ">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null ">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ AND b.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name = #{deptName}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ ) t1,
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ ROUND( AVG( b.score_res ), 2 ) AS avgScore,
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="diagnose != null and diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="behosDateStart != null">
|
|
|
+ <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null ">
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= DATE(#{leaveHosDateStart})]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null ">
|
|
|
+ <![CDATA[AND a.leave_hospital_date < DATE(#{leaveHosDateEnd})]]>
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ AND a.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ AND b.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ AND (a.doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.beh_doctor_name like CONCAT('%',#{doctorName},'%')
|
|
|
+ OR a.director_doctor_name like CONCAT('%',#{doctorName},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ AND (a.doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.beh_doctor_id like CONCAT('%',#{doctorCode},'%')
|
|
|
+ OR a.director_doctor_id like CONCAT('%',#{doctorCode},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name = #{deptName}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ ) t2
|
|
|
+ WHERE
|
|
|
+ t1.behDeptId = t2.behDeptId
|
|
|
+ AND t1.behDeptName = t2.behDeptName
|
|
|
+ ORDER BY
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.doctorName,
|
|
|
+ t1.patName,
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ t1.caseName,
|
|
|
+ </if>
|
|
|
+ t1.behospitalCode
|
|
|
+ )tp
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
+ ON tp.behospitalCode = g.behospital_code
|
|
|
+ AND tp.hospitalId = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON tp.behospitalCode = h.behospital_code
|
|
|
+ AND tp.hospitalId = h.hospital_id
|
|
|
+ ) tu
|
|
|
+ WHERE tu.behospitalCode IS NOT NULL
|
|
|
+ <if test="checkStatus != null ">
|
|
|
+ and tu.check_status = #{checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="mrStatus != null ">
|
|
|
+ AND tu.mr_status = #{mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND tu.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND tu.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="chTimeStart != null">
|
|
|
+ <![CDATA[ and tu.ch_time >= #{chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="chTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.ch_time < #{chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeStart != null">
|
|
|
+ <![CDATA[ and tu.mr_time >= #{mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="mrTimeEnd != null">
|
|
|
+ <![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 缺陷详情-个人(分页) -->
|
|
|
+ <select id="getDoctorDetailPage" resultType="com.diagbot.dto.GetDoctorDetailPageDTO">
|
|
|
+ SELECT
|
|
|
+ t.*
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ t1.deptId,
|
|
|
+ t1.deptName,
|
|
|
+ t1.id,
|
|
|
+ t1.NAME,
|
|
|
+ t1.casesId,
|
|
|
+ t1.casesName,
|
|
|
+ t1.num,
|
|
|
+ t2.totleNum,
|
|
|
+ t1.doctorId,
|
|
|
+ t1.ruleType,
|
|
|
+ t1.isReject,
|
|
|
+ t1.doctorName,
|
|
|
+ ROUND( t1.num / t2.totleNum, 4 ) AS percent,
|
|
|
+ CONCAT( ROUND( t1.num / t2.totleNum * 100, 2 ), '%' ) AS percentStr
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ tt1.deptId ,
|
|
|
+ tt1.deptName ,
|
|
|
+ tt2.id AS id,
|
|
|
+ tt2.NAME AS NAME,
|
|
|
+ tt2.cases_id AS casesId,
|
|
|
+ tt2.cases_name AS casesName,
|
|
|
+ tt1.num,
|
|
|
+ tt1.doctorId ,
|
|
|
+ tt1.doctorName ,
|
|
|
+ tt2.rule_type AS ruleType,
|
|
|
+ tt1.is_reject AS isReject
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ d.cases_id,
|
|
|
+ d.cases_entry_id,
|
|
|
+ CASE WHEN (a.doctor_id is null OR a.doctor_id = '' OR a.doctor_id = '-') THEN '-' ELSE a.doctor_id END AS doctorId,
|
|
|
+ CASE WHEN (a.doctor_name is null OR a.doctor_name = '' OR a.doctor_name = '-') THEN '-' ELSE a.doctor_name END AS doctorName,
|
|
|
+ CASE WHEN (a.beh_dept_id is null OR a.beh_dept_id = '' OR a.beh_dept_id = '-') THEN '-' ELSE a.beh_dept_id END AS deptId,
|
|
|
+ CASE WHEN (a.beh_dept_name is null OR a.beh_dept_name = '' OR a.beh_dept_name = '-') THEN '-' ELSE a.beh_dept_name END AS deptName,
|
|
|
+ d.is_reject,
|
|
|
+ count(*) AS num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_detail d
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
+ <if test="getDoctorDetailPageVO.isPlacefile != null and getDoctorDetailPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{getDoctorDetailPageVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="getDoctorDetailPageVO.hospitalId != null and getDoctorDetailPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{getDoctorDetailPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.isPlacefile != null and getDoctorDetailPageVO.isPlacefile == 0">
|
|
|
+ <if test="getDoctorDetailPageVO.startDate != null and getDoctorDetailPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{getDoctorDetailPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.endDate != null and getDoctorDetailPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{getDoctorDetailPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.isPlacefile != null and getDoctorDetailPageVO.isPlacefile == 1">
|
|
|
+ <if test="getDoctorDetailPageVO.startDate != null and getDoctorDetailPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{getDoctorDetailPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.endDate != null and getDoctorDetailPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{getDoctorDetailPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.deptName != null and getDoctorDetailPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{getDoctorDetailPageVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.deptId != null and getDoctorDetailPageVO.deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{getDoctorDetailPageVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.doctorId != null and getDoctorDetailPageVO.doctorId != ''">
|
|
|
+ AND a.doctor_id = #{getDoctorDetailPageVO.doctorId}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.doctorName != null and getDoctorDetailPageVO.doctorName != ''">
|
|
|
+ AND a.doctor_name = #{getDoctorDetailPageVO.doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.casesId != null and getDoctorDetailPageVO.casesId != 0">
|
|
|
+ AND d.cases_id = #{getDoctorDetailPageVO.casesId}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.isReject != null">
|
|
|
+ AND d.is_reject = #{getDoctorDetailPageVO.isReject}
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name,
|
|
|
+ a.doctor_id,
|
|
|
+ a.doctor_name,
|
|
|
+ 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="getDoctorDetailPageVO.casesName != null and getDoctorDetailPageVO.casesName != ''">
|
|
|
+ AND tt2.cases_name like CONCAT('%', #{getDoctorDetailPageVO.casesName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.name != null and getDoctorDetailPageVO.name != ''">
|
|
|
+ AND tt2.name like CONCAT('%', #{getDoctorDetailPageVO.name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.ruleType != null">
|
|
|
+ AND tt2.rule_type = #{getDoctorDetailPageVO.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="getDoctorDetailPageVO.isPlacefile != null and getDoctorDetailPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{getDoctorDetailPageVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ AND e.cases_id = d.cases_id
|
|
|
+ AND e.id = d.cases_entry_id
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ <if test="getDoctorDetailPageVO.hospitalId != null and getDoctorDetailPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{getDoctorDetailPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.isPlacefile != null and getDoctorDetailPageVO.isPlacefile == 0">
|
|
|
+ <if test="getDoctorDetailPageVO.startDate != null and getDoctorDetailPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{getDoctorDetailPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.endDate != null and getDoctorDetailPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{getDoctorDetailPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.isPlacefile != null and getDoctorDetailPageVO.isPlacefile == 1">
|
|
|
+ <if test="getDoctorDetailPageVO.startDate != null and getDoctorDetailPageVO.startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{getDoctorDetailPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.endDate != null and getDoctorDetailPageVO.endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{getDoctorDetailPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.deptName != null and getDoctorDetailPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{getDoctorDetailPageVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.doctorName != null and getDoctorDetailPageVO.doctorName != ''">
|
|
|
+ AND a.doctor_name = #{getDoctorDetailPageVO.doctorName}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.deptId != null and getDoctorDetailPageVO.deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{getDoctorDetailPageVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.doctorId != null and getDoctorDetailPageVO.doctorId != ''">
|
|
|
+ AND a.doctor_id = #{getDoctorDetailPageVO.doctorId}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.isReject != null">
|
|
|
+ AND d.is_reject = #{getDoctorDetailPageVO.isReject}
|
|
|
+ </if>
|
|
|
+ <if test="getDoctorDetailPageVO.ruleType != null">
|
|
|
+ AND e.rule_type = #{getDoctorDetailPageVO.ruleType}
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
+ )t
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 获取缺陷数量对应的病历 -->
|
|
|
+ <select id="getDetailRecordListPage" resultType="com.diagbot.dto.GetDetailRecordListPageDTO">
|
|
|
+ SELECT t.*
|
|
|
+ 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,
|
|
|
+ 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,
|
|
|
+ CONCAT( ifnull(t2.age,''),ifnull(t2.age_unit,'') )as 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,
|
|
|
+ e.score_res as scoreBn,
|
|
|
+ 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="getDetailRecordListPageVO.isPlacefile != null and getDetailRecordListPageVO.isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{getDetailRecordListPageVO.isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.hospitalId != null and getDetailRecordListPageVO.hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{getDetailRecordListPageVO.hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.isPlacefile != null and getDetailRecordListPageVO.isPlacefile == 0">
|
|
|
+ <if test="getDetailRecordListPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{getDetailRecordListPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.endDate != null ">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{getDetailRecordListPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.isPlacefile != null and getDetailRecordListPageVO.isPlacefile == 1">
|
|
|
+ <if test="getDetailRecordListPageVO.startDate != null ">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{getDetailRecordListPageVO.startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.endDate != null">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{getDetailRecordListPageVO.endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.diagnose != null and getDetailRecordListPageVO.diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{getDetailRecordListPageVO.diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.deptName != null and getDetailRecordListPageVO.deptName != ''">
|
|
|
+ AND a.beh_dept_name = #{getDetailRecordListPageVO.deptName}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.deptId != null and getDetailRecordListPageVO.deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{getDetailRecordListPageVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.level != null and getDetailRecordListPageVO.level != ''">
|
|
|
+ AND b.`level` = #{getDetailRecordListPageVO.level}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.behospitalCode != null and getDetailRecordListPageVO.behospitalCode != ''">
|
|
|
+ AND a.behospital_code LIKE CONCAT( '%', #{getDetailRecordListPageVO.behospitalCode}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.patName != null and getDetailRecordListPageVO.patName != ''">
|
|
|
+ AND a.NAME LIKE CONCAT( '%', #{getDetailRecordListPageVO.patName}, '%' )
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.casesEntryName != null and getDetailRecordListPageVO.casesEntryName != ''">
|
|
|
+ AND d.NAME = #{getDetailRecordListPageVO.casesEntryName}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.casesEntryId != null ">
|
|
|
+ AND d.id = #{getDetailRecordListPageVO.casesEntryId}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.casesName != null and getDetailRecordListPageVO.casesName != ''">
|
|
|
+ AND d.cases_name = #{getDetailRecordListPageVO.casesName}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.casesId != null">
|
|
|
+ AND d.cases_id = #{getDetailRecordListPageVO.casesId}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.doctorId != null and getDetailRecordListPageVO.doctorId != ''">
|
|
|
+ AND (a.doctor_id LIKE CONCAT( '%', #{getDetailRecordListPageVO.doctorId}, '%' )
|
|
|
+ OR a.beh_doctor_id LIKE CONCAT( '%', #{getDetailRecordListPageVO.doctorId}, '%' )
|
|
|
+ OR a.director_doctor_id LIKE CONCAT( '%', #{getDetailRecordListPageVO.doctorId}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.doctorName != null and getDetailRecordListPageVO.doctorName != ''">
|
|
|
+ AND (a.doctor_name LIKE CONCAT( '%', #{getDetailRecordListPageVO.doctorName}, '%' )
|
|
|
+ OR a.beh_doctor_name LIKE CONCAT( '%', #{getDetailRecordListPageVO.doctorName}, '%' )
|
|
|
+ OR a.director_doctor_name LIKE CONCAT( '%', #{getDetailRecordListPageVO.doctorName}, '%' ))
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.isReject != null">
|
|
|
+ AND c.is_reject = #{getDetailRecordListPageVO.isReject}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.ruleType != null">
|
|
|
+ AND d.rule_type = #{getDetailRecordListPageVO.ruleType}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.casesEntryId != null and getDetailRecordListPageVO.casesEntryId==2495">
|
|
|
+ AND TIMESTAMPDIFF(
|
|
|
+ DAY,
|
|
|
+ DATE( a.behospital_date ),
|
|
|
+ DATE( a.leave_hospital_date ))> 30
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.beHosGT31Days != null and getDetailRecordListPageVO.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 in(0,2)
|
|
|
+ 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="getDetailRecordListPageVO.casesEntryId != null and getDetailRecordListPageVO.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="getDetailRecordListPageVO.casesEntryId != null and getDetailRecordListPageVO.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="getDetailRecordListPageVO.casesEntryId == null or (getDetailRecordListPageVO.casesEntryId!=2594 and getDetailRecordListPageVO.casesEntryId!=2973 and getDetailRecordListPageVO.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="getDetailRecordListPageVO.casesEntryId != null and( getDetailRecordListPageVO.casesEntryId==2594 or getDetailRecordListPageVO.casesEntryId==2973 or getDetailRecordListPageVO.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
|
|
|
+ where 1=1
|
|
|
+ <if test="getDetailRecordListPageVO.checkStatus != null">
|
|
|
+ AND t.checkStatus = #{getDetailRecordListPageVO.checkStatus}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.mrStatus != null">
|
|
|
+ AND t.mrStatus = #{getDetailRecordListPageVO.mrStatus}
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.chName != null and getDetailRecordListPageVO.chName!=''">
|
|
|
+ AND t.chName like concat('%', #{getDetailRecordListPageVO.chName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.mrName != null and getDetailRecordListPageVO.mrName!=''">
|
|
|
+ AND t.mrName like concat('%', #{getDetailRecordListPageVO.mrName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.chTimeStart != null ">
|
|
|
+ <![CDATA[ AND t.chTime >= #{getDetailRecordListPageVO.chTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.chTimeEnd != null ">
|
|
|
+ <![CDATA[ AND t.chTime <= #{getDetailRecordListPageVO.chTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.mrTimeStart != null ">
|
|
|
+ <![CDATA[ AND t.mrTime >= #{getDetailRecordListPageVO.mrTimeStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="getDetailRecordListPageVO.mrTimeEnd != null ">
|
|
|
+ <![CDATA[ AND t.mrTime <= #{getDetailRecordListPageVO.mrTimeEnd}]]>
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|