|
@@ -988,17 +988,21 @@
|
|
|
COUNT(*) AS num
|
|
|
FROM
|
|
|
med_behospital_info a,
|
|
|
- med_home_page b,
|
|
|
- sys_user_dept c
|
|
|
+ sys_user_dept c,
|
|
|
+ med_medical_record d,
|
|
|
+ med_medical_record_content e
|
|
|
WHERE
|
|
|
a.is_deleted = 'N'
|
|
|
- AND b.is_deleted = 'N'
|
|
|
AND c.is_deleted = 'N'
|
|
|
- AND a.hospital_id = b.hospital_id
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
AND a.hospital_id = c.hospital_id
|
|
|
- AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.hospital_id = d.hospital_id
|
|
|
+ AND a.hospital_id = e.hospital_id
|
|
|
+ AND a.behospital_code = d.behospital_code
|
|
|
AND a.beh_dept_id = c.dept_id
|
|
|
- AND b.return_to_type = '死亡'
|
|
|
+ AND d.rec_id = e.rec_id
|
|
|
+ AND d.mode_id = '24'
|
|
|
<if test="isPlacefile != null and isPlacefile != ''">
|
|
|
and a.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
@@ -3686,7 +3690,239 @@
|
|
|
<![CDATA[ and tu.mr_time < #{mrTimeEnd}]]>
|
|
|
</if>
|
|
|
</select>
|
|
|
-
|
|
|
+ <!-- 个人质控评分导出到excel-->
|
|
|
+ <select id="exportQcresultByPerson" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
+ 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.behDoctorName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.hospitalId,
|
|
|
+ t1.behospitalDate,
|
|
|
+ t1.leaveHospitalDate,
|
|
|
+ t1.score,
|
|
|
+ t2.avgScore,
|
|
|
+ <if test="radioCheck !=null and radioCheck == 1">
|
|
|
+ t1.msg,
|
|
|
+ t1.caseName,
|
|
|
+ </if>
|
|
|
+ e.score_res as scoreBn
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.doctor_name AS behDoctorName,
|
|
|
+ a.beh_doctor_name,
|
|
|
+ a.director_doctor_name,
|
|
|
+ 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,
|
|
|
+ <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,
|
|
|
+ med_qcresult_info b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases d,
|
|
|
+ sys_user u,
|
|
|
+ sys_user_hospital uh
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND d.is_deleted = 'N'
|
|
|
+ AND u.is_deleted = 'N'
|
|
|
+ AND uh.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 u.id = uh.user_id
|
|
|
+ AND a.hospital_id = uh.hospital_id
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ AND u.id = #{userId}
|
|
|
+ </if>
|
|
|
+ <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 >= #{leaveHosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null ">
|
|
|
+ <![CDATA[AND a.leave_hospital_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="deptId != null and deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ ) t1 LEFT JOIN med_qcresult_cases e
|
|
|
+ on t1.behospitalCode = e.behospital_code
|
|
|
+ and t1.hospitalId = e.hospital_id
|
|
|
+ AND e.is_deleted = 'N'
|
|
|
+ and e.cases_id = 243,
|
|
|
+ (
|
|
|
+ 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,
|
|
|
+ sys_user u,
|
|
|
+ sys_user_hospital uh
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND u.is_deleted = 'N'
|
|
|
+ AND uh.is_deleted = 'N'
|
|
|
+ AND a.hospital_id = b.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND u.id = uh.user_id
|
|
|
+ AND a.hospital_id = uh.hospital_id
|
|
|
+ and (a.doctor_name = u.linkman
|
|
|
+ or a.beh_doctor_name = u.linkman
|
|
|
+ or a.director_doctor_name = u.linkman)
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
+ AND u.id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="diagnose != null and diagnose != ''">
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ </if>
|
|
|
+ <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="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 >= #{leaveHosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null ">
|
|
|
+ <![CDATA[AND a.leave_hospital_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="deptId != null and deptId != ''">
|
|
|
+ AND a.beh_dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
+ WHERE
|
|
|
+ t1.behDeptId = t2.behDeptId
|
|
|
+ AND t1.behDeptName = t2.behDeptName
|
|
|
+ ORDER BY
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.behDoctorName,
|
|
|
+ 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>
|
|
|
<!-- 医疗组质控评分导出到excel-->
|
|
|
<select id="exportQcresultByGroup" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
SELECT * FROM (
|
|
@@ -9038,6 +9274,56 @@
|
|
|
a.beh_dept_name
|
|
|
</select>
|
|
|
|
|
|
+ <!-- 单条条目缺陷统计-->
|
|
|
+ <select id="casesEntryStatisticsByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ SELECT
|
|
|
+ a.beh_dept_id AS id,
|
|
|
+ a.beh_dept_name AS NAME,
|
|
|
+ count(*) AS num
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_detail b,
|
|
|
+ sys_user_dept c
|
|
|
+ WHERE
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.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.beh_dept_id = c.dept_id
|
|
|
+ AND a.qc_type_id != 0
|
|
|
+ and b.cases_entry_id=2658
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="userId!=null">
|
|
|
+ AND c.user_id = #{userId}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 0">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.behospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile == 1">
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ GROUP BY
|
|
|
+ a.beh_dept_id,
|
|
|
+ a.beh_dept_name
|
|
|
+ </select>
|
|
|
+
|
|
|
<!-- 病案首页改善率质控评分页(内页)-->
|
|
|
<select id="hmImproveMRPage" resultType="com.diagbot.dto.QcResultShortDTO">
|
|
|
SELECT
|