|
|
@@ -326,4 +326,52 @@
|
|
|
CASE WHEN doctor_confirm = 0 THEN 0 ELSE 1 END,
|
|
|
prescribe_id desc
|
|
|
</select>
|
|
|
+ <select id="selectDoctorOperateStatList" resultType="com.fs.his.vo.DoctorOperateStatVO">
|
|
|
+ SELECT
|
|
|
+ fp.doctor_id,
|
|
|
+ fd.doctor_name,
|
|
|
+ fd.dept_id,
|
|
|
+ fd.hospital_id,
|
|
|
+ AVG(fp.operate_second) AS avgOperateSecond,
|
|
|
+ COUNT(*) as operation,
|
|
|
+ de.dept_name,
|
|
|
+ ho.hospital_name
|
|
|
+ FROM fs_prescribe fp
|
|
|
+ LEFT JOIN fs_doctor fd ON fp.doctor_id = fd.doctor_id
|
|
|
+ LEFT JOIN fs_department de ON de.dept_id=fd.dept_id
|
|
|
+ LEFT JOIN fs_hospital ho ON ho.hospital_id=fd.hospital_id
|
|
|
+ WHERE
|
|
|
+ fp.start_operate_time IS NOT NULL
|
|
|
+ AND fp.end_operate_time IS NOT NULL
|
|
|
+ AND fp.operate_second IS NOT NULL
|
|
|
+
|
|
|
+ <if test="doctorName != null and doctorName != ''">
|
|
|
+ AND fd.doctor_name LIKE CONCAT('%', #{doctorName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="deptId != null and deptId != ''">
|
|
|
+ AND de.dept_id = #{deptId}
|
|
|
+ </if>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND ho.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ AND fp.end_operate_time >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ AND fp.end_operate_time <= #{endTime}
|
|
|
+ </if>
|
|
|
+
|
|
|
+ GROUP BY
|
|
|
+ fp.doctor_id,
|
|
|
+ fd.doctor_name,
|
|
|
+ fd.dept_id,
|
|
|
+ fd.hospital_id
|
|
|
+
|
|
|
+ ORDER BY
|
|
|
+ avgOperateSecond
|
|
|
+ <choose>
|
|
|
+ <when test="sort != null and sort == 'desc'">DESC</when>
|
|
|
+ <otherwise>ASC</otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
</mapper>
|