|
@@ -73,15 +73,26 @@
|
|
<select id="midDeptAuditList"
|
|
<select id="midDeptAuditList"
|
|
resultType="org.jeecg.modules.medical.common.bo.mid.response.MidDeptAuditDetailResponse">
|
|
resultType="org.jeecg.modules.medical.common.bo.mid.response.MidDeptAuditDetailResponse">
|
|
SELECT
|
|
SELECT
|
|
- m.medical_dept_name
|
|
|
|
- ,m.medical_dept_code
|
|
|
|
- ,(SELECT count(*) from sys_user_depart where dep_id = (SELECT id from sys_depart where medical_dept_code = m.medical_dept_code)) as deptDoctorTotal -- 科室医生总数
|
|
|
|
- ,(select count(*) from ( SELECT count(doctor_id) from mid_incident_audit_detail WHERE medical_dept_code = m.medical_dept_code GROUP BY doctor_id) as t ) as violationDoctorNumber -- 违规医生总数
|
|
|
|
- ,COUNT(id) as violationTotal
|
|
|
|
- ,(select IFNULL(sum(amount), 0) from mid_incident_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '2') as outpatientsErrorAmount -- 门诊违规金额
|
|
|
|
- ,(select IFNULL(sum(amount),0) from mid_incident_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '1') as hospErrorAmount -- 住院违规金额
|
|
|
|
- ,sum(amount) as errorAmountTotal -- 异常金额总和
|
|
|
|
- FROM mid_incident_audit_detail as m
|
|
|
|
|
|
+ m.id,
|
|
|
|
+ m.medical_dept_name,
|
|
|
|
+ m.medical_dept_code,
|
|
|
|
+ IFNULL(sd.deptDoctorTotal, 0) AS deptDoctorTotal,
|
|
|
|
+ COUNT(DISTINCT m.doctor_id) AS violationDoctorNumber,
|
|
|
|
+ COUNT(m.id) AS violationTotal,
|
|
|
|
+ IFNULL(SUM(CASE WHEN m.treatment_type = '2' THEN m.amount ELSE 0 END), 0) AS outpatientsErrorAmount,
|
|
|
|
+ IFNULL(SUM(CASE WHEN m.treatment_type = '1' THEN m.amount ELSE 0 END), 0) AS hospErrorAmount,
|
|
|
|
+ IFNULL(SUM(m.amount), 0) AS errorAmountTotal
|
|
|
|
+ FROM mid_incident_audit_detail AS m
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT dep.id AS department_id, COUNT(user_dep.id) AS deptDoctorTotal
|
|
|
|
+ FROM sys_depart AS dep
|
|
|
|
+ LEFT JOIN sys_user_depart AS user_dep ON dep.id = user_dep.dep_id
|
|
|
|
+ GROUP BY dep.id
|
|
|
|
+ ) AS sd ON sd.department_id = (
|
|
|
|
+ SELECT id
|
|
|
|
+ FROM sys_depart
|
|
|
|
+ WHERE medical_dept_code = m.medical_dept_code
|
|
|
|
+ )
|
|
<where> 1=1
|
|
<where> 1=1
|
|
<if test="deptName != null and deptName != ''">
|
|
<if test="deptName != null and deptName != ''">
|
|
AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
|
|
AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
|
|
@@ -96,7 +107,7 @@
|
|
and <![CDATA[ m.create_time <= #{endTime} ]]>
|
|
and <![CDATA[ m.create_time <= #{endTime} ]]>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- GROUP BY medical_dept_code
|
|
|
|
|
|
+ GROUP BY m.medical_dept_code
|
|
ORDER BY violationDoctorNumber DESC
|
|
ORDER BY violationDoctorNumber DESC
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -104,15 +115,26 @@
|
|
<select id="afterDeptAuditList"
|
|
<select id="afterDeptAuditList"
|
|
resultType="org.jeecg.modules.medical.common.bo.mid.response.MidDeptAuditDetailResponse">
|
|
resultType="org.jeecg.modules.medical.common.bo.mid.response.MidDeptAuditDetailResponse">
|
|
SELECT
|
|
SELECT
|
|
- m.medical_dept_name
|
|
|
|
- ,m.medical_dept_code
|
|
|
|
- ,(SELECT count(*) from sys_user_depart where dep_id = (SELECT id from sys_depart where medical_dept_code = m.medical_dept_code)) as deptDoctorTotal -- 科室医生总数
|
|
|
|
- ,(select count(*) from ( SELECT count(doctor_id) from afterwards_audit_detail WHERE medical_dept_code = m.medical_dept_code GROUP BY doctor_id) as t ) as violationDoctorNumber -- 违规医生总数
|
|
|
|
- ,COUNT(id) as violationTotal
|
|
|
|
- ,(select IFNULL(sum(amount), 0) from afterwards_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '2') as outpatientsErrorAmount -- 门诊违规金额
|
|
|
|
- ,(select IFNULL(sum(amount),0) from afterwards_audit_detail WHERE medical_dept_code = m.medical_dept_code and treatment_type = '1') as hospErrorAmount -- 住院违规金额
|
|
|
|
- ,sum(amount) as errorAmountTotal -- 异常金额总和
|
|
|
|
- FROM afterwards_audit_detail as m
|
|
|
|
|
|
+ m.id,
|
|
|
|
+ m.medical_dept_name,
|
|
|
|
+ m.medical_dept_code,
|
|
|
|
+ IFNULL(sd.deptDoctorTotal, 0) AS deptDoctorTotal,
|
|
|
|
+ COUNT(DISTINCT m.doctor_id) AS violationDoctorNumber,
|
|
|
|
+ COUNT(m.id) AS violationTotal,
|
|
|
|
+ IFNULL(SUM(CASE WHEN m.treatment_type = '2' THEN m.amount ELSE 0 END), 0) AS outpatientsErrorAmount,
|
|
|
|
+ IFNULL(SUM(CASE WHEN m.treatment_type = '1' THEN m.amount ELSE 0 END), 0) AS hospErrorAmount,
|
|
|
|
+ IFNULL(SUM(m.amount), 0) AS errorAmountTotal
|
|
|
|
+ FROM afterwards_audit_detail AS m
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT dep.id AS department_id, COUNT(user_dep.id) AS deptDoctorTotal
|
|
|
|
+ FROM sys_depart AS dep
|
|
|
|
+ LEFT JOIN sys_user_depart AS user_dep ON dep.id = user_dep.dep_id
|
|
|
|
+ GROUP BY dep.id
|
|
|
|
+ ) AS sd ON sd.department_id = (
|
|
|
|
+ SELECT id
|
|
|
|
+ FROM sys_depart
|
|
|
|
+ WHERE medical_dept_code = m.medical_dept_code
|
|
|
|
+ )
|
|
<where> 1=1
|
|
<where> 1=1
|
|
<if test="deptName != null and deptName != ''">
|
|
<if test="deptName != null and deptName != ''">
|
|
AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
|
|
AND m.medical_dept_name like LIKE concat(concat('%',#{deptName}),'%')
|
|
@@ -127,7 +149,7 @@
|
|
and <![CDATA[ m.create_time <= #{endTime} ]]>
|
|
and <![CDATA[ m.create_time <= #{endTime} ]]>
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</where>
|
|
- GROUP BY medical_dept_code
|
|
|
|
|
|
+ GROUP BY m.medical_dept_code
|
|
ORDER BY violationDoctorNumber DESC
|
|
ORDER BY violationDoctorNumber DESC
|
|
</select>
|
|
</select>
|
|
|
|
|