|
@@ -143,6 +143,291 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getQualityControl" resultType="com.diagbot.dto.QualityControlDTO">
|
|
|
+ SELECT m.* FROM(
|
|
|
+ SELECT
|
|
|
+ a.name AS NAME,
|
|
|
+ a.behospital_code AS behospitalCode,
|
|
|
+ a.doctor_name AS doctorName,
|
|
|
+ a.beh_dept_name AS deptName,
|
|
|
+ a.beh_dept_id AS deptId,
|
|
|
+ a.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ c.behospital_code,
|
|
|
+ c.hospital_id,
|
|
|
+ c.admissionNote,
|
|
|
+ c.firstCourseNote,
|
|
|
+ c.medHomePage,
|
|
|
+ c.docAdviceNote,
|
|
|
+ c.courseRecord,
|
|
|
+ c.operationInfo,
|
|
|
+ c.dischargeNote,
|
|
|
+ c.admissionNoteScore,
|
|
|
+ c.firstCourseNoteScore,
|
|
|
+ c. medHomePageScore,
|
|
|
+ c.docAdviceNoteScore,
|
|
|
+ c.courseRecordScore,
|
|
|
+ c.operationInfoScore,
|
|
|
+ c.dischargeNoteScore,
|
|
|
+ c.otherCase,
|
|
|
+ (100.0-c.score_res) AS otherCaseScore,
|
|
|
+ IFNULL(b.level,'未评分') AS `level`,
|
|
|
+ g.check_name AS ch_name,
|
|
|
+ h.check_name AS mr_name
|
|
|
+ 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 (
|
|
|
+ SELECT
|
|
|
+ t.behospital_code,
|
|
|
+ t.hospital_id,
|
|
|
+ t.admissionNote,
|
|
|
+ t.firstCourseNote,
|
|
|
+ t.medHomePage,
|
|
|
+ t.docAdviceNote,
|
|
|
+ t.courseRecord,
|
|
|
+ t.operationInfo,
|
|
|
+ t.dischargeNote,
|
|
|
+ t.otherCase,
|
|
|
+ t.score_res,
|
|
|
+ if(t.admissionNoteScoreOn >= t.admissionNoteTolScore, (t.admissionNoteTolScore + t.admissionNoteScoreTh),(t.admissionNoteScoreOn + t.admissionNoteScoreTh)) AS admissionNoteScore,
|
|
|
+ if(t.firstCourseNoteScoreOn >= t.firstCourseNoteTolScore, (t.firstCourseNoteTolScore + t.firstCourseNoteScoreTh),(t.firstCourseNoteScoreOn + t.firstCourseNoteScoreTh)) AS firstCourseNoteScore,
|
|
|
+ if(t.medHomePageScoreOn >= t.medHomePageTolScore, (t.medHomePageTolScore + t.medHomePageScoreTh),(t.medHomePageScoreOn + t.medHomePageScoreTh)) AS medHomePageScore,
|
|
|
+ if(t.docAdviceNoteScoreOn >= t.docAdviceNoteTolScore, (t.docAdviceNoteTolScore + t.docAdviceNoteScoreTh),(t.docAdviceNoteScoreOn + t.docAdviceNoteScoreTh)) AS docAdviceNoteScore,
|
|
|
+ if(t.courseRecordScoreOn >= t.courseRecordTolScore, (t.courseRecordTolScore + t.courseRecordScoreTh),(t.courseRecordScoreOn + t.courseRecordScoreTh)) AS courseRecordScore,
|
|
|
+ if(t.operationInfoScoreOn >= t.operationInfoTolScore, (t.operationInfoTolScore + t.operationInfoScoreTh),(t.operationInfoScoreOn + t.operationInfoScoreTh)) AS operationInfoScore,
|
|
|
+ if(t.dischargeNoteScoreOn >= t.dischargeNoteTolScore, (t.dischargeNoteTolScore + t.dischargeNoteScoreTh),(t.dischargeNoteScoreOn + t.dischargeNoteScoreTh)) AS dischargeNoteScore
|
|
|
+ from(
|
|
|
+ select
|
|
|
+ t1.*,
|
|
|
+ t2.admissionNoteTolScore,
|
|
|
+ t2.firstCourseNoteTolScore,
|
|
|
+ t2.medHomePageTolScore,
|
|
|
+ t2.docAdviceNoteTolScore,
|
|
|
+ t2.courseRecordTolScore,
|
|
|
+ t2.operationInfoTolScore,
|
|
|
+ t2.dischargeNoteTolScore,
|
|
|
+ t2.score_res FROM (
|
|
|
+ SELECT
|
|
|
+ t1.behospital_code,
|
|
|
+ t1.hospital_id,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 1 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS admissionNote,
|
|
|
+ SUM(CASE WHEN t1.mode_id =1 AND t1.is_reject = 0 THEN t1.score ELSE 0 END) AS admissionNoteScoreOn,
|
|
|
+ SUM(CASE WHEN t1.mode_id =1 THEN t1.score ELSE 0 END) AS admissionNoteScoreTw,
|
|
|
+ (SUM(CASE WHEN t1.mode_id =1 THEN t1.score ELSE 0 END)-SUM(CASE WHEN t1.mode_id =1 AND t1.is_reject = 0 THEN t1.score ELSE 0 END)) AS admissionNoteScoreTh,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 2 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS firstCourseNote,
|
|
|
+ SUM(CASE WHEN t1.mode_id =2 AND t1.is_reject = 0 THEN t1.score ELSE 0 END) AS firstCourseNoteScoreOn,
|
|
|
+ SUM(CASE WHEN t1.mode_id =2 THEN t1.score ELSE 0 END) AS firstCourseNoteScoreTw,
|
|
|
+ (SUM(CASE WHEN t1.mode_id =2 THEN t1.score ELSE 0 END) -SUM(CASE WHEN t1.mode_id =2 AND t1.is_reject = 0 THEN t1.score ELSE 0 END)) AS firstCourseNoteScoreTh,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 6 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS medHomePage,
|
|
|
+ SUM(CASE WHEN t1.mode_id =6 AND t1.is_reject = 0 THEN t1.score ELSE 0 END) AS medHomePageScoreOn,
|
|
|
+ SUM(CASE WHEN t1.mode_id =6 THEN t1.score ELSE 0 END) AS medHomePageScoreTw,
|
|
|
+ (SUM(CASE WHEN t1.mode_id =6 THEN t1.score ELSE 0 END)-SUM(CASE WHEN t1.mode_id =6 AND t1.is_reject = 0 THEN t1.score ELSE 0 END)) AS medHomePageScoreTh,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 8 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS docAdviceNote,
|
|
|
+ SUM(CASE WHEN t1.mode_id =8 AND t1.is_reject = 0 THEN t1.score ELSE 0 END) AS docAdviceNoteScoreOn,
|
|
|
+ SUM(CASE WHEN t1.mode_id =8 THEN t1.score ELSE 0 END) AS docAdviceNoteScoreTw,
|
|
|
+ (SUM(CASE WHEN t1.mode_id =8 THEN t1.score ELSE 0 END)-SUM(CASE WHEN t1.mode_id =8 AND t1.is_reject = 0 THEN t1.score ELSE 0 END)) AS docAdviceNoteScoreTh,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 56 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS courseRecord,
|
|
|
+ SUM(CASE WHEN t1.mode_id =56 AND t1.is_reject = 0 THEN t1.score ELSE 0 END) AS courseRecordScoreOn,
|
|
|
+ SUM(CASE WHEN t1.mode_id =56 THEN t1.score ELSE 0 END) AS courseRecordScoreTw,
|
|
|
+ (SUM(CASE WHEN t1.mode_id =56 THEN t1.score ELSE 0 END)-SUM(CASE WHEN t1.mode_id =56 AND t1.is_reject = 0 THEN t1.score ELSE 0 END)) AS courseRecordScoreTh,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 17 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS operationInfo,
|
|
|
+ SUM(CASE WHEN t1.mode_id =17 AND t1.is_reject = 0 THEN t1.score ELSE 0 END) AS operationInfoScoreOn,
|
|
|
+ SUM(CASE WHEN t1.mode_id =17 THEN t1.score ELSE 0 END) AS operationInfoScoreTw,
|
|
|
+ (SUM(CASE WHEN t1.mode_id =17 THEN t1.score ELSE 0 END)-SUM(CASE WHEN t1.mode_id =17 AND t1.is_reject = 0 THEN t1.score ELSE 0 END)) AS operationInfoScoreTh,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 5 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS dischargeNote,
|
|
|
+ SUM(CASE WHEN t1.mode_id =5 AND t1.is_reject = 0 THEN t1.score ELSE 0 END) AS dischargeNoteScoreOn,
|
|
|
+ SUM(CASE WHEN t1.mode_id =5 THEN t1.score ELSE 0 END) AS dischargeNoteScoreTw,
|
|
|
+ (SUM(CASE WHEN t1.mode_id =5 THEN t1.score ELSE 0 END)-GROUP_CONCAT(DISTINCT CASE WHEN t1.mode_id = 5 THEN t1.msg ELSE NULL END SEPARATOR ';' )) AS dischargeNoteScoreTh,
|
|
|
+ GROUP_CONCAT(DISTINCT CASE WHEN 1=1 THEN t1.msg ELSE NULL END SEPARATOR ';' ) AS otherCase
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ c.behospital_code,
|
|
|
+ c.hospital_id,
|
|
|
+ a.mode_id,
|
|
|
+ c.cases_score,
|
|
|
+ c.score,
|
|
|
+ c.msg,
|
|
|
+ c.is_reject,
|
|
|
+ c.cases_id
|
|
|
+ FROM
|
|
|
+ `qc_cases_entry` a,
|
|
|
+ qc_mode b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases_hospital d,
|
|
|
+ med_behospital_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.id = c.cases_entry_id
|
|
|
+ AND a.mode_id = b.id
|
|
|
+ AND c.cases_id = d.cases_id
|
|
|
+ AND c.hospital_id = d.hospital_id
|
|
|
+ AND c.behospital_code = e.behospital_code
|
|
|
+ AND c.hospital_id = e.hospital_id
|
|
|
+ <if test="hospitalId != null">
|
|
|
+ and c.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and e.beh_dept_name= #{deptName}
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ and e.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and e.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="behosDateStart != null">
|
|
|
+ <![CDATA[ and e.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and e.behospital_date < #{behosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null">
|
|
|
+ <![CDATA[ and e.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null">
|
|
|
+ <![CDATA[ and e.leave_hospital_date < #{leaveHosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and e.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and e.level = #{level}
|
|
|
+ </if>
|
|
|
+ ORDER BY b.order_no, c.grade_type DESC, a.order_no
|
|
|
+ )t1 GROUP BY behospital_code)t1
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT m1.*, m2.score_res FROM(
|
|
|
+ SELECT
|
|
|
+ m1.hospital_id,
|
|
|
+ m1.behospital_code,
|
|
|
+ SUM(CASE WHEN m1.mode_id =1 THEN m1.cases_score ELSE 0 END) AS admissionNoteTolScore,
|
|
|
+ SUM(CASE WHEN m1.mode_id =2 THEN m1.cases_score ELSE 0 END) AS firstCourseNoteTolScore,
|
|
|
+ SUM(CASE WHEN m1.mode_id =6 THEN m1.cases_score ELSE 0 END) AS medHomePageTolScore,
|
|
|
+ SUM(CASE WHEN m1.mode_id =8 THEN m1.cases_score ELSE 0 END) AS docAdviceNoteTolScore,
|
|
|
+ SUM(CASE WHEN m1.mode_id =56 THEN m1.cases_score ELSE 0 END) AS courseRecordTolScore,
|
|
|
+ SUM(CASE WHEN m1.mode_id =17 THEN m1.cases_score ELSE 0 END) AS operationInfoTolScore,
|
|
|
+ SUM(CASE WHEN m1.mode_id =5 THEN m1.cases_score ELSE 0 END) AS dischargeNoteTolScore
|
|
|
+ FROM (
|
|
|
+ SELECT
|
|
|
+ c.behospital_code,
|
|
|
+ a.mode_id,
|
|
|
+ c.cases_score,
|
|
|
+ c.cases_id,
|
|
|
+ c.hospital_id
|
|
|
+ FROM
|
|
|
+ `qc_cases_entry` a,
|
|
|
+ qc_mode b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases_hospital d,
|
|
|
+ med_behospital_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.id = c.cases_entry_id
|
|
|
+ AND a.mode_id = b.id
|
|
|
+ AND c.cases_id = d.cases_id
|
|
|
+ AND c.hospital_id = d.hospital_id
|
|
|
+ AND c.behospital_code = e.behospital_code
|
|
|
+ AND c.hospital_id = e.hospital_id
|
|
|
+ <if test="hospitalId != null">
|
|
|
+ and c.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and e.beh_dept_name= #{deptName}
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ and e.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and e.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ <if test="behosDateStart != null">
|
|
|
+ <![CDATA[ and e.behospital_date >= #{behosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="behosDateEnd != null">
|
|
|
+ <![CDATA[ and e.behospital_date < #{behosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateStart != null">
|
|
|
+ <![CDATA[ and e.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
+ </if>
|
|
|
+ <if test="leaveHosDateEnd != null">
|
|
|
+ <![CDATA[ and e.leave_hospital_date < #{leaveHosDateEnd}]]>
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and e.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="level != null and level != ''">
|
|
|
+ and e.level = #{level}
|
|
|
+ </if>
|
|
|
+ GROUP BY mode_id
|
|
|
+ ORDER BY b.order_no, c.grade_type DESC, a.order_no
|
|
|
+ )m1 GROUP BY behospital_code)m1 LEFT JOIN med_qcresult_info m2
|
|
|
+ ON m2.is_deleted = 'N'
|
|
|
+ AND m1.hospital_id = m2.hospital_id
|
|
|
+ AND m1.behospital_code = m2.behospital_code
|
|
|
+ )t2
|
|
|
+ ON t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code)t)c
|
|
|
+ ON a.behospital_code = c.behospital_code
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
+ ON a.behospital_code = g.behospital_code
|
|
|
+ AND a.hospital_id = g.hospital_id
|
|
|
+ LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
+ ON a.behospital_code = h.behospital_code
|
|
|
+ AND a.hospital_id = h.hospital_id
|
|
|
+ where
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ <if test="deptName != null and deptName != ''">
|
|
|
+ and a.beh_dept_name= #{deptName}
|
|
|
+ </if>
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ and CONCAT(
|
|
|
+ IFNULL(a.doctor_name,''),IFNULL(a.beh_doctor_name,''),IFNULL(a.director_doctor_name,''))
|
|
|
+ like CONCAT('%',#{doctorName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ and a.name like CONCAT('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="doctorCode != null and doctorCode != ''">
|
|
|
+ and (a.doctor_id = #{doctorCode}
|
|
|
+ or a.beh_doctor_id = #{doctorCode}
|
|
|
+ or a.director_doctor_id = #{doctorCode})
|
|
|
+ </if>
|
|
|
+ <if test="fileCode != null and fileCode != ''">
|
|
|
+ and a.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null">
|
|
|
+ and a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="behospitalCode != null and behospitalCode != ''">
|
|
|
+ and a.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ </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="level != null and level != ''">
|
|
|
+ and a.level = #{level}
|
|
|
+ </if>
|
|
|
+ <if test="isPlacefile != null and isPlacefile != ''">
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
+ </if>
|
|
|
+ and a.qc_type_id != 0
|
|
|
+ <if test="chName != null and chName !=''">
|
|
|
+ AND g.ch_name like CONCAT('%',#{chName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mrName != null and mrName !=''">
|
|
|
+ AND h.mr_name like CONCAT('%',#{mrName},'%')
|
|
|
+ </if>)m
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
|
|
|
SELECT b.`name` model_name,c.score,c.msg,c.cases_entry_id,c.is_reject,c.id id,c.info,
|
|
|
a.cases_id cases_id, d.score cases_score,b.id model_id, a.name standard_msg,
|