|
@@ -41,7 +41,13 @@
|
|
|
|
|
|
<select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
SELECT * FROM (
|
|
|
- select t.*,
|
|
|
+ select distinct a.*,
|
|
|
+ ifnull(b.level,'未评分') as `level`,
|
|
|
+ b.grade_type,
|
|
|
+ b.score_res,
|
|
|
+ b.gmt_create as grade_time,
|
|
|
+ CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') )as age,
|
|
|
+ e.score_res as score_bn,
|
|
|
CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END check_status,
|
|
|
CASE WHEN ISNULL(h.status) THEN 0 ELSE h.status END mr_status,
|
|
|
g.check_type AS ch_type,
|
|
@@ -50,9 +56,13 @@
|
|
|
h.check_name AS mr_name,
|
|
|
g.check_time AS ch_time,
|
|
|
h.check_time AS mr_time
|
|
|
- from (
|
|
|
- select distinct a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
|
|
|
- grade_time,CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') )as age, e.score_res as score_bn from med_behospital_info a
|
|
|
+ from med_behospital_info a
|
|
|
+ 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
|
|
|
LEFT JOIN med_qcresult_info b
|
|
|
on a.behospital_code = b.behospital_code and b.is_deleted = 'N'
|
|
|
left join med_home_page c
|
|
@@ -61,61 +71,55 @@
|
|
|
on a.behospital_code = e.behospital_code
|
|
|
AND e.is_deleted = 'N'
|
|
|
and e.cases_id = 243
|
|
|
- ) t
|
|
|
- LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N' AND check_type = 0 ) g
|
|
|
- ON t.behospital_code = g.behospital_code
|
|
|
- AND t.hospital_id = g.hospital_id
|
|
|
- LEFT JOIN (SELECT * FROM med_check_info WHERE is_deleted = 'N'AND check_type = 1 ) h
|
|
|
- ON t.behospital_code = h.behospital_code
|
|
|
- AND t.hospital_id = h.hospital_id
|
|
|
- where t.is_deleted = 'N'
|
|
|
+ where
|
|
|
+ a.is_deleted = 'N'
|
|
|
<if test="diagnose != null and diagnose != ''">
|
|
|
- AND t.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
</if>
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
- and t.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
+ and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
</if>
|
|
|
<if test="doctorName != null and doctorName != ''">
|
|
|
and CONCAT(
|
|
|
- IFNULL(t.doctor_name,''),IFNULL(t.beh_doctor_name,''),IFNULL(t.director_doctor_name,''))
|
|
|
+ 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 t.name like CONCAT('%',#{name},'%')
|
|
|
+ and a.name like CONCAT('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="doctorCode != null and doctorCode != ''">
|
|
|
- and (t.doctor_id = #{doctorCode}
|
|
|
- or t.beh_doctor_id = #{doctorCode}
|
|
|
- or t.director_doctor_id = #{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 t.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
+ and a.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
</if>
|
|
|
<if test="hospitalId != null">
|
|
|
- and t.hospital_id = #{hospitalId}
|
|
|
+ and a.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
|
<if test="behospitalCode != null and behospitalCode != ''">
|
|
|
- and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ and a.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
</if>
|
|
|
<if test="behosDateStart != null">
|
|
|
- <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
|
|
|
+ <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
|
|
|
</if>
|
|
|
<if test="behosDateEnd != null">
|
|
|
- <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
|
|
|
+ <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
|
|
|
</if>
|
|
|
<if test="leaveHosDateStart != null">
|
|
|
- <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
+ <![CDATA[ and a.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
</if>
|
|
|
<if test="leaveHosDateEnd != null">
|
|
|
- <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
|
|
|
+ <![CDATA[ and a.leave_hospital_date < #{leaveHosDateEnd}]]>
|
|
|
</if>
|
|
|
<if test="level != null and level != ''">
|
|
|
- and t.level = #{level}
|
|
|
+ and b.level = #{level}
|
|
|
</if>
|
|
|
<if test="isPlacefile != null and isPlacefile != ''">
|
|
|
- and t.is_placefile = #{isPlacefile}
|
|
|
+ and a.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
|
- and t.qc_type_id != 0) p
|
|
|
+ and a.qc_type_id != 0) p
|
|
|
where p.is_deleted="N"
|
|
|
<if test="checkStatus != null ">
|
|
|
and p.check_status = #{checkStatus}
|