|
@@ -1,56 +1,60 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.diagbot.mapper.BehospitalInfoMapper">
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<resultMap id="BaseResultMap" type="com.diagbot.entity.BehospitalInfo">
|
|
|
- <id column="behospital_code" property="behospitalCode" />
|
|
|
- <result column="hospital_id" property="hospitalId" />
|
|
|
- <result column="name" property="name" />
|
|
|
- <result column="sex" property="sex" />
|
|
|
- <result column="birthday" property="birthday" />
|
|
|
- <result column="file_code" property="fileCode" />
|
|
|
- <result column="qc_type_id" property="qcTypeId" />
|
|
|
- <result column="ward_code" property="wardCode" />
|
|
|
- <result column="ward_name" property="wardName" />
|
|
|
- <result column="beh_dept_id" property="behDeptId" />
|
|
|
- <result column="beh_dept_name" property="behDeptName" />
|
|
|
- <result column="bed_code" property="bedCode" />
|
|
|
- <result column="bed_name" property="bedName" />
|
|
|
- <result column="insurance_name" property="insuranceName" />
|
|
|
- <result column="job_type" property="jobType" />
|
|
|
- <result column="behospital_date" property="behospitalDate" />
|
|
|
- <result column="leave_hospital_date" property="leaveHospitalDate" />
|
|
|
- <result column="diagnose_icd" property="diagnoseIcd" />
|
|
|
- <result column="diagnose" property="diagnose" />
|
|
|
- <result column="beh_doctor_id" property="behDoctorId" />
|
|
|
- <result column="beh_doctor_name" property="behDoctorName" />
|
|
|
- <result column="doctor_id" property="doctorId" />
|
|
|
- <result column="doctor_name" property="doctorName" />
|
|
|
- <result column="director_doctor_id" property="directorDoctorId" />
|
|
|
- <result column="director_doctor_name" property="directorDoctorName" />
|
|
|
- <result column="is_placefile" property="isPlacefile" />
|
|
|
- <result column="is_deleted" property="isDeleted" />
|
|
|
- <result column="gmt_create" property="gmtCreate" />
|
|
|
- <result column="gmt_modified" property="gmtModified" />
|
|
|
- <result column="creator" property="creator" />
|
|
|
- <result column="modifier" property="modifier" />
|
|
|
+ <id column="behospital_code" property="behospitalCode"/>
|
|
|
+ <result column="hospital_id" property="hospitalId"/>
|
|
|
+ <result column="name" property="name"/>
|
|
|
+ <result column="sex" property="sex"/>
|
|
|
+ <result column="birthday" property="birthday"/>
|
|
|
+ <result column="file_code" property="fileCode"/>
|
|
|
+ <result column="qc_type_id" property="qcTypeId"/>
|
|
|
+ <result column="ward_code" property="wardCode"/>
|
|
|
+ <result column="ward_name" property="wardName"/>
|
|
|
+ <result column="beh_dept_id" property="behDeptId"/>
|
|
|
+ <result column="beh_dept_name" property="behDeptName"/>
|
|
|
+ <result column="bed_code" property="bedCode"/>
|
|
|
+ <result column="bed_name" property="bedName"/>
|
|
|
+ <result column="insurance_name" property="insuranceName"/>
|
|
|
+ <result column="job_type" property="jobType"/>
|
|
|
+ <result column="behospital_date" property="behospitalDate"/>
|
|
|
+ <result column="leave_hospital_date" property="leaveHospitalDate"/>
|
|
|
+ <result column="diagnose_icd" property="diagnoseIcd"/>
|
|
|
+ <result column="diagnose" property="diagnose"/>
|
|
|
+ <result column="beh_doctor_id" property="behDoctorId"/>
|
|
|
+ <result column="beh_doctor_name" property="behDoctorName"/>
|
|
|
+ <result column="doctor_id" property="doctorId"/>
|
|
|
+ <result column="doctor_name" property="doctorName"/>
|
|
|
+ <result column="director_doctor_id" property="directorDoctorId"/>
|
|
|
+ <result column="director_doctor_name" property="directorDoctorName"/>
|
|
|
+ <result column="is_placefile" property="isPlacefile"/>
|
|
|
+ <result column="is_deleted" property="isDeleted"/>
|
|
|
+ <result column="gmt_create" property="gmtCreate"/>
|
|
|
+ <result column="gmt_modified" property="gmtModified"/>
|
|
|
+ <result column="creator" property="creator"/>
|
|
|
+ <result column="modifier" property="modifier"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
select * from (
|
|
|
- select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as grade_time, c.age 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'
|
|
|
+ select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
|
|
|
+ grade_time, c.age 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'
|
|
|
) t
|
|
|
where t.is_deleted = 'N'
|
|
|
<if test="deptId != null and deptId != ''">
|
|
|
and t.beh_dept_id = #{deptId}
|
|
|
</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},'%')
|
|
|
+ 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},'%')
|
|
@@ -102,13 +106,13 @@
|
|
|
and c.hospital_id = d.hospital_id
|
|
|
and c.hospital_id = #{hospitalId}
|
|
|
and c.behospital_code = #{behospitalCode}
|
|
|
- order by b.order_no, a.order_no
|
|
|
+ order by b.order_no, c.grade_type desc, a.order_no
|
|
|
</select>
|
|
|
|
|
|
<select id="getMsgByEntryCode" resultType="com.diagbot.dto.MsgDTO">
|
|
|
- SELECT b.id model_id,b.`name` model_name,
|
|
|
- d.score,d.msg,d.cases_entry_id,d.is_reject,
|
|
|
- a.cases_id cases_id, a.name standard_msg,a.code
|
|
|
+ SELECT b.id model_id,b.`name` model_name,
|
|
|
+ d.score,d.msg,d.cases_entry_id,d.is_reject,
|
|
|
+ a.cases_id cases_id, a.name standard_msg,a.code
|
|
|
FROM `qc_cases_entry` a, qc_mode b, qc_cases_entry_hospital d
|
|
|
where a.is_deleted = 'N' and b.is_deleted = 'N' and d.is_deleted = 'N'
|
|
|
and a.mode_id = b.id
|
|
@@ -126,7 +130,8 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 各科室缺陷占比-全院-首页 -->
|
|
|
- <select id="entryByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ <select id="entryByDept" parameterType="com.diagbot.vo.FilterVO"
|
|
|
+ resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
a.beh_dept_id as id,
|
|
|
a.beh_dept_name as name,
|
|
@@ -162,7 +167,7 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 质控结果缺陷总数查询-->
|
|
|
- <select id="getTotleResultNum" parameterType="com.diagbot.vo.FilterVO" resultType="int">
|
|
|
+ <select id="getTotleResultNum" parameterType="com.diagbot.vo.FilterVO" resultType="int">
|
|
|
SELECT
|
|
|
count(*) AS totle
|
|
|
FROM
|
|
@@ -192,28 +197,28 @@
|
|
|
|
|
|
<!--获取病历-->
|
|
|
<select id="getNoGrade" resultMap="BaseResultMap">
|
|
|
- select * from med_behospital_info a
|
|
|
- where a.is_deleted = 'N'
|
|
|
- and a.qc_type_id != 0
|
|
|
- <if test="filterFlag != null and filterFlag == 0">
|
|
|
+ select * from med_behospital_info a
|
|
|
+ where a.is_deleted = 'N'
|
|
|
+ and a.qc_type_id != 0
|
|
|
+ <if test="filterFlag != null and filterFlag == 0">
|
|
|
and
|
|
|
not EXISTS (
|
|
|
SELECT
|
|
|
- 1
|
|
|
+ 1
|
|
|
FROM
|
|
|
- med_qcresult_info b
|
|
|
+ med_qcresult_info b
|
|
|
WHERE
|
|
|
- b.is_deleted = 'N'
|
|
|
+ b.is_deleted = 'N'
|
|
|
AND a.hospital_id = b.hospital_id
|
|
|
AND a.behospital_code = b.behospital_code
|
|
|
)
|
|
|
- </if>
|
|
|
- <if test="leaveDate != null">
|
|
|
- <![CDATA[ and a.leave_hospital_date < #{leaveDate}]]>
|
|
|
- </if>
|
|
|
+ </if>
|
|
|
+ <if test="leaveDate != null">
|
|
|
+ <![CDATA[ and a.leave_hospital_date < #{leaveDate}]]>
|
|
|
+ </if>
|
|
|
<if test="hosptialIdList != null and hosptialIdList.size > 0 ">
|
|
|
and a.hospital_id in
|
|
|
- <foreach collection="hosptialIdList" item="item" open="(" separator="," close=")">
|
|
|
+ <foreach collection="hosptialIdList" item="item" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>
|
|
|
</if>
|
|
@@ -224,7 +229,7 @@
|
|
|
SELECT
|
|
|
*
|
|
|
FROM
|
|
|
- ( SELECT
|
|
|
+ ( SELECT
|
|
|
a.*,
|
|
|
IFNULL(b.level, '未评分') AS `level`,
|
|
|
b.grade_type,
|
|
@@ -250,7 +255,9 @@
|
|
|
and t.beh_dept_id = #{deptId}
|
|
|
</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},'%')
|
|
|
+ and CONCAT(
|
|
|
+ IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,''))
|
|
|
+ like CONCAT('%',#{doctorName},'%')
|
|
|
</if>
|
|
|
<if test="doctorCode != null and doctorCode != ''">
|
|
|
and (t.doctor_id = #{doctorCode}
|
|
@@ -464,7 +471,8 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 出院总人数统计-科室-首页 -->
|
|
|
- <select id="leaveHosCountByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ <select id="leaveHosCountByDept" parameterType="com.diagbot.vo.FilterVO"
|
|
|
+ resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
a.beh_dept_id AS id,
|
|
|
a.beh_dept_name AS NAME,
|
|
@@ -497,7 +505,8 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 新生儿出院人数统计-科室-首页 -->
|
|
|
- <select id="newBornCountByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ <select id="newBornCountByDept" parameterType="com.diagbot.vo.FilterVO"
|
|
|
+ resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
a.beh_dept_id AS id,
|
|
|
a.beh_dept_name AS NAME,
|
|
@@ -536,7 +545,8 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 死亡人数统计-科室-首页 -->
|
|
|
- <select id="deathCountByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ <select id="deathCountByDept" parameterType="com.diagbot.vo.FilterVO"
|
|
|
+ resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
a.beh_dept_id AS id,
|
|
|
a.beh_dept_name AS NAME,
|
|
@@ -574,7 +584,8 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 手术人数统计-科室-首页 -->
|
|
|
- <select id="operationCountByDept" parameterType="com.diagbot.vo.FilterVO" resultType="com.diagbot.dto.NumDTO">
|
|
|
+ <select id="operationCountByDept" parameterType="com.diagbot.vo.FilterVO"
|
|
|
+ resultType="com.diagbot.dto.NumDTO">
|
|
|
SELECT
|
|
|
a.beh_dept_id AS id,
|
|
|
a.beh_dept_name AS NAME,
|
|
@@ -801,7 +812,8 @@
|
|
|
</select>
|
|
|
|
|
|
<!-- 各科室缺陷占比(组合)-全院 -->
|
|
|
- <select id="levelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ <select id="levelStatistics" parameterType="com.diagbot.vo.FilterOrderVO"
|
|
|
+ resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
t1.deptId,
|
|
|
t1.deptName,
|
|
@@ -829,19 +841,25 @@
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END ) AS firstLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END ) AS secondLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END ) AS thirdLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS thirdLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS firstLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS secondLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS thirdLevelPercent,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS firstLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS secondLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS thirdLevelPercentStr
|
|
|
FROM
|
|
@@ -936,7 +954,7 @@
|
|
|
<when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
<when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
|
|
|
<when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
|
|
|
- <otherwise> deptName asc </otherwise>
|
|
|
+ <otherwise>deptName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
<if test="desc != null and desc!=''">
|
|
@@ -957,13 +975,14 @@
|
|
|
<when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
<when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
<when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
|
|
|
- <otherwise> deptName desc </otherwise>
|
|
|
+ <otherwise>deptName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 各科室缺陷占比(组合)-全院-根据内外科系统统计 -->
|
|
|
- <select id="levelStatisticsByDeptClass" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ <select id="levelStatisticsByDeptClass" parameterType="com.diagbot.vo.FilterOrderVO"
|
|
|
+ resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
t1.deptId,
|
|
|
t1.deptName,
|
|
@@ -995,19 +1014,25 @@
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END ) AS firstLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END ) AS secondLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END ) AS thirdLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS thirdLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS firstLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS secondLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS thirdLevelPercent,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS firstLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS secondLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS thirdLevelPercentStr
|
|
|
FROM
|
|
@@ -1134,7 +1159,7 @@
|
|
|
<when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
<when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
|
|
|
<when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
|
|
|
- <otherwise> deptName asc </otherwise>
|
|
|
+ <otherwise>deptName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
<if test="desc != null and desc!=''">
|
|
@@ -1157,13 +1182,14 @@
|
|
|
<when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
<when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
<when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
|
|
|
- <otherwise> deptName desc </otherwise>
|
|
|
+ <otherwise>deptName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 病案首页合格率占比 -全院-->
|
|
|
- <select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ <select id="homePageLevelStatistics" parameterType="com.diagbot.vo.FilterOrderVO"
|
|
|
+ resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
t1.deptId,
|
|
|
t1.deptName,
|
|
@@ -1187,14 +1213,18 @@
|
|
|
ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS firstLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ),
|
|
|
+ 4 ) AS secondLevelPercent,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS firstLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS secondLevelPercentStr
|
|
|
FROM
|
|
@@ -1289,7 +1319,7 @@
|
|
|
<when test='asc=="secondLevelPercent"'>secondLevelPercent asc</when>
|
|
|
<when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
<when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
|
|
|
- <otherwise> deptName asc </otherwise>
|
|
|
+ <otherwise>deptName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
<if test="desc != null and desc!=''">
|
|
@@ -1307,13 +1337,14 @@
|
|
|
<when test='desc=="secondLevelPercent"'>secondLevelPercent desc</when>
|
|
|
<when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
<when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
- <otherwise> deptName desc </otherwise>
|
|
|
+ <otherwise>deptName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 各科室缺陷占比-科室 -->
|
|
|
- <select id="levelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ <select id="levelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO"
|
|
|
+ resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
t1.doctorId,
|
|
|
t1.doctorName,
|
|
@@ -1341,19 +1372,25 @@
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END ) AS firstLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END ) AS secondLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END ) AS thirdLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS thirdLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS firstLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS secondLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS thirdLevelPercent,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '甲' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS firstLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '乙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS secondLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '丙' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS thirdLevelPercentStr
|
|
|
FROM
|
|
@@ -1466,7 +1503,7 @@
|
|
|
<when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
<when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
|
|
|
<when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
|
|
|
- <otherwise> doctorName asc </otherwise>
|
|
|
+ <otherwise>doctorName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
<if test="desc != null and desc!=''">
|
|
@@ -1487,13 +1524,14 @@
|
|
|
<when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
<when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
<when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
|
|
|
- <otherwise> doctorName desc </otherwise>
|
|
|
+ <otherwise>doctorName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
<!-- 病案首页合格率占比-科室 -->
|
|
|
- <select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO" resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
+ <select id="homePageLevelStatisticsByDept" parameterType="com.diagbot.vo.FilterOrderByDeptVO"
|
|
|
+ resultType="com.diagbot.dto.LevelStatisticsDTO">
|
|
|
SELECT
|
|
|
t1.doctorId,
|
|
|
t1.doctorName,
|
|
@@ -1517,14 +1555,18 @@
|
|
|
ROUND( sum( CAST(c.score_res as DECIMAL ( 18, 2 )) )/ count(*), 2 ) AS averageValue,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END ) AS firstLevelNum,
|
|
|
COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END ) AS secondLevelNum,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS firstLevelPercent,
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ), 4 ) AS secondLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id ), 4
|
|
|
+ ) AS firstLevelPercent,
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id ),
|
|
|
+ 4 ) AS secondLevelPercent,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '合格' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS firstLevelPercentStr,
|
|
|
concat(
|
|
|
- ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )* 100, 2 ),
|
|
|
+ ROUND( COUNT( DISTINCT CASE WHEN c.`level` = '不合格' THEN c.id END )/ count( DISTINCT c.id )*
|
|
|
+ 100, 2 ),
|
|
|
'%'
|
|
|
) AS secondLevelPercentStr
|
|
|
FROM
|
|
@@ -1640,7 +1682,7 @@
|
|
|
<when test='asc=="firstLevelPercentStr"'>firstLevelPercent asc</when>
|
|
|
<when test='asc=="secondLevelPercentStr"'>secondLevelPercent asc</when>
|
|
|
<when test='asc=="thirdLevelPercentStr"'>thirdLevelPercent asc</when>
|
|
|
- <otherwise> doctorName asc </otherwise>
|
|
|
+ <otherwise>doctorName asc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
<if test="desc != null and desc!=''">
|
|
@@ -1661,8 +1703,272 @@
|
|
|
<when test='desc=="firstLevelPercentStr"'>firstLevelPercent desc</when>
|
|
|
<when test='desc=="secondLevelPercentStr"'>secondLevelPercent desc</when>
|
|
|
<when test='desc=="thirdLevelPercentStr"'>thirdLevelPercent desc</when>
|
|
|
- <otherwise> doctorName desc </otherwise>
|
|
|
+ <otherwise>doctorName desc</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+ <resultMap id="ExportExcelMap" type="com.diagbot.dto.ExportExcelDTO">
|
|
|
+ <result column="behDeptName" property="behDeptName"/>
|
|
|
+ <result column="avgScore" property="avgScore"/>
|
|
|
+ <collection property="excelBehospitalDTOS"
|
|
|
+ ofType="com.diagbot.dto.ExportExcelBehospitalDTO">
|
|
|
+ <result column="behDoctorName" property="behDoctorName"/>
|
|
|
+ <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"/>
|
|
|
+ <collection property="exportExcelCaseDTOS" ofType="com.diagbot.dto.ExportExcelCaseDTO">
|
|
|
+ <result column="caseName" property="caseName"/>
|
|
|
+ <collection property="exportExcelMsgDTOS"
|
|
|
+ ofType="com.diagbot.dto.ExportExcelMsgDTO">
|
|
|
+ <result column="msg" property="msg"/>
|
|
|
+ </collection>
|
|
|
+ </collection>
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="exportExcel" resultMap="ExportExcelMap">
|
|
|
+ SELECT DISTINCT
|
|
|
+ t1.beh_dept_name AS behDeptName,
|
|
|
+ t1.beh_doctor_name AS behDoctorName,
|
|
|
+ t1.`name` AS patName,
|
|
|
+ t1.behospital_code AS behospitalCode,
|
|
|
+ t1.behospital_date AS behospitalDate,
|
|
|
+ t1.leave_hospital_date AS leaveHospitalDate,
|
|
|
+ t2.score_res AS score,
|
|
|
+ "1" AS avgScore,
|
|
|
+ t4.`name` AS caseName,
|
|
|
+ t3.msg AS msg
|
|
|
+ FROM
|
|
|
+ med_behospital_info t1,
|
|
|
+ med_qcresult_info t2,
|
|
|
+ med_qcresult_detail t3,
|
|
|
+ qc_cases t4
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ <![CDATA[AND t1.leave_hospital_date >= '2020-03-03 00:00:00']]>
|
|
|
+ <![CDATA[AND t1.leave_hospital_date <= '2020-03-03 23:00:00']]>
|
|
|
+ AND t1.hospital_id = t2.hospital_id
|
|
|
+ AND t1.behospital_code = t2.behospital_code
|
|
|
+ AND t1.hospital_id = t3.hospital_id
|
|
|
+ AND t1.behospital_code = t3.behospital_code
|
|
|
+ AND t3.cases_id = t4.id
|
|
|
+ ORDER BY
|
|
|
+ t1.beh_dept_id ASC,
|
|
|
+ t1.leave_hospital_date DESC,
|
|
|
+ t1.behospital_code ASC,
|
|
|
+ t4.`name` ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 质控评分导出到excel-->
|
|
|
+ <select id="exportQcresult" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
+ SELECT
|
|
|
+ t1.behDeptId,
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.behDoctorName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.behospitalDate,
|
|
|
+ t1.leaveHospitalDate,
|
|
|
+ t1.score,
|
|
|
+ t2.avgScore,
|
|
|
+ t1.msg,
|
|
|
+ t1.caseName
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ CONCAT(
|
|
|
+ ( CASE WHEN a.director_doctor_name IS NOT NULL AND a.director_doctor_name != '' THEN concat( a.director_doctor_name, '\n' ) ELSE '' END ),
|
|
|
+ a.doctor_name
|
|
|
+ ) AS behDoctorName,
|
|
|
+ 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,
|
|
|
+ c.msg AS msg,
|
|
|
+ d.NAME AS caseName,
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases 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.id
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </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>
|
|
|
+ ) 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
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </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>
|
|
|
+ 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.behDeptName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.caseName
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 科室质控评分导出到excel-->
|
|
|
+ <select id="exportQcresultByDept" resultMap="ExportExcelMap" parameterType="com.diagbot.vo.ExportQcresultVO">
|
|
|
+ SELECT
|
|
|
+ t1.behDeptId,
|
|
|
+ t1.behDeptName,
|
|
|
+ t1.behDoctorName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.behospitalDate,
|
|
|
+ t1.leaveHospitalDate,
|
|
|
+ t1.score,
|
|
|
+ t2.avgScore,
|
|
|
+ t1.msg,
|
|
|
+ t1.casesName
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ CONCAT(
|
|
|
+ ( CASE WHEN a.director_doctor_name IS NOT NULL AND a.director_doctor_name != '' THEN concat( a.director_doctor_name, '\n' ) ELSE '' END ),
|
|
|
+ a.doctor_name
|
|
|
+ ) AS behDoctorName,
|
|
|
+ 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,
|
|
|
+ c.msg AS msg,
|
|
|
+ d.NAME AS casesName,
|
|
|
+ a.beh_dept_id AS behDeptId,
|
|
|
+ a.beh_dept_name AS behDeptName
|
|
|
+ FROM
|
|
|
+ med_behospital_info a,
|
|
|
+ med_qcresult_info b,
|
|
|
+ med_qcresult_detail c,
|
|
|
+ qc_cases d,
|
|
|
+ sys_user_dept 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.hospital_id = b.hospital_id
|
|
|
+ AND a.hospital_id = c.hospital_id
|
|
|
+ AND a.hospital_id = e.hospital_id
|
|
|
+ AND a.behospital_code = b.behospital_code
|
|
|
+ AND a.behospital_code = c.behospital_code
|
|
|
+ AND c.cases_id = d.id
|
|
|
+ AND a.beh_dept_id = e.dept_id
|
|
|
+ AND a.is_placefile = '1'
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null ">
|
|
|
+ AND e.user_id = #{userId}
|
|
|
+ </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>
|
|
|
+ ) 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,
|
|
|
+ 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.is_placefile = '1'
|
|
|
+ <![CDATA[AND a.qc_type_id <>0 ]]>
|
|
|
+ <if test="hospitalId != null and hospitalId != ''">
|
|
|
+ AND a.hospital_id = #{hospitalId}
|
|
|
+ </if>
|
|
|
+ <if test="userId != null ">
|
|
|
+ AND c.user_id = #{userId}
|
|
|
+ </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>
|
|
|
+ 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.behDeptName,
|
|
|
+ t1.patName,
|
|
|
+ t1.behospitalCode,
|
|
|
+ t1.casesName
|
|
|
+ </select>
|
|
|
</mapper>
|