|
@@ -164,7 +164,7 @@
|
|
|
t3.dept_name,
|
|
|
t3.behospital_code,
|
|
|
t3.cases_id,
|
|
|
- t3. NAME,
|
|
|
+ t3.name,
|
|
|
t3.msg AS entryName,
|
|
|
t3.cases_entry_id,
|
|
|
CASE
|
|
@@ -185,7 +185,7 @@
|
|
|
t2.qcresult_info_id,
|
|
|
t2.gmt_create as gmTime,
|
|
|
t3.cases_id,
|
|
|
- t4. NAME,
|
|
|
+ t4.name,
|
|
|
t3.cases_entry_id,
|
|
|
t3.msg,
|
|
|
t3.is_deleted
|
|
@@ -226,30 +226,22 @@
|
|
|
<if test="endDate != null and endDate != ''">
|
|
|
<![CDATA[ AND t1.leave_hospital_date <= #{endDate}]]>
|
|
|
</if>
|
|
|
+ GROUP BY
|
|
|
+ t1.beh_dept_id,
|
|
|
+ t1.beh_dept_name,
|
|
|
+ t1.behospital_code,
|
|
|
+ t3.cases_id,
|
|
|
+ t3.cases_entry_id
|
|
|
UNION
|
|
|
SELECT
|
|
|
- tt1.hospital_id,
|
|
|
- tt1.dept_id,
|
|
|
- tt1.dept_name,
|
|
|
- tt1.behospital_code,
|
|
|
- tt1.qcresult_info_id,
|
|
|
- tt1.gmTime,
|
|
|
- tt1.cases_id,
|
|
|
- tt1. NAME,
|
|
|
- tt1.cases_entry_id,
|
|
|
- tt1.msg,
|
|
|
- tt1.is_deleted
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
t1.hospital_id,
|
|
|
t1.beh_dept_id AS dept_id,
|
|
|
t1.beh_dept_name AS dept_name,
|
|
|
t2.behospital_code,
|
|
|
t2.qcresult_info_id,
|
|
|
- t2.gmt_create AS gmTime,
|
|
|
+ min(t2.gmt_create) AS gmTime,
|
|
|
t3.cases_id,
|
|
|
- t4. NAME,
|
|
|
+ t4.name,
|
|
|
t3.cases_entry_id,
|
|
|
t3.msg,
|
|
|
t3.is_deleted
|
|
@@ -290,47 +282,13 @@
|
|
|
<if test="endDate != null and endDate != ''">
|
|
|
<![CDATA[ AND t1.leave_hospital_date <= #{endDate}]]>
|
|
|
</if>
|
|
|
- ) tt1,
|
|
|
- (
|
|
|
- SELECT
|
|
|
- t2.qcresult_info_id,
|
|
|
- min(t2.gmt_create) AS gmTime
|
|
|
- FROM
|
|
|
- med_behospital_info t1,
|
|
|
- med_click_info t2
|
|
|
- WHERE
|
|
|
- t1.is_deleted = 'N'
|
|
|
- AND t2.is_deleted = 'N'
|
|
|
- AND t1.hospital_id = t2.hospital_id
|
|
|
- AND t1.behospital_code = t2.behospital_code
|
|
|
- AND t1.qc_type_id != 0
|
|
|
- <if test="hospitalId != null and hospitalId != ''">
|
|
|
- AND t1.hospital_id = #{hospitalId}
|
|
|
- </if>
|
|
|
- <if test="deptId != null and deptId != ''">
|
|
|
- and t1.dept_id = #{deptId}
|
|
|
- </if>
|
|
|
- <if test="deptName != null and deptName != ''">
|
|
|
- and t1.dept_name like CONCAT('%',#{deptName},'%')
|
|
|
- </if>
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- <![CDATA[ AND t1.leave_hospital_date >= #{startDate}]]>
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- <![CDATA[ AND t1.leave_hospital_date <= #{endDate}]]>
|
|
|
- </if>
|
|
|
- ) tt2
|
|
|
- WHERE
|
|
|
- tt1.gmTime = tt2.gmTime
|
|
|
- AND tt1.qcresult_info_id = tt2.qcresult_info_id
|
|
|
- ) t3
|
|
|
GROUP BY
|
|
|
- t3.dept_id,
|
|
|
- t3.dept_name,
|
|
|
- t3.behospital_code,
|
|
|
+ t1.beh_dept_id,
|
|
|
+ t1.beh_dept_name,
|
|
|
+ t1.behospital_code,
|
|
|
t3.cases_id,
|
|
|
- t3.cases_entry_id,
|
|
|
- t3.is_deleted
|
|
|
+ t3.cases_entry_id
|
|
|
+ ) t3
|
|
|
) t4
|
|
|
GROUP BY
|
|
|
t4.dept_id,
|