|
@@ -41,13 +41,7 @@
|
|
|
|
|
|
<select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
|
|
|
SELECT * 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,
|
|
|
+ select t.*,
|
|
|
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,
|
|
@@ -56,13 +50,9 @@
|
|
|
h.check_name AS mr_name,
|
|
|
g.check_time AS ch_time,
|
|
|
h.check_time AS mr_time
|
|
|
- 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
|
|
|
+ from (
|
|
|
+ select a.*, ifnull(b.level,'未评分') as `level`, b.grade_type, b.score_res, b.gmt_create as
|
|
|
+ grade_time,IF(c.age is null, null,CONCAT( ifnull(c.age,'') ,ifnull(c.age_unit,'') )as age,e.score_res as score_bn 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
|
|
@@ -71,55 +61,61 @@
|
|
|
on a.behospital_code = e.behospital_code
|
|
|
AND e.is_deleted = 'N'
|
|
|
and e.cases_id = 243
|
|
|
- where
|
|
|
- a.is_deleted = 'N'
|
|
|
+ ) 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'
|
|
|
<if test="diagnose != null and diagnose != ''">
|
|
|
- AND a.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
+ AND t.diagnose LIKE CONCAT( '%', #{diagnose}, '%' )
|
|
|
</if>
|
|
|
<if test="deptName != null and deptName != ''">
|
|
|
- and a.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
+ and t.beh_dept_name LIKE CONCAT( '%', #{deptName}, '%' )
|
|
|
</if>
|
|
|
<if test="doctorName != null and doctorName != ''">
|
|
|
and CONCAT(
|
|
|
- IFNULL(a.doctor_name,''),IFNULL(a.beh_doctor_name,''),IFNULL(a.director_doctor_name,''))
|
|
|
+ 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 a.name like CONCAT('%',#{name},'%')
|
|
|
+ and t.name like CONCAT('%',#{name},'%')
|
|
|
</if>
|
|
|
<if test="doctorCode != null and doctorCode != ''">
|
|
|
- and (a.doctor_id = #{doctorCode}
|
|
|
- or a.beh_doctor_id = #{doctorCode}
|
|
|
- or a.director_doctor_id = #{doctorCode})
|
|
|
+ and (t.doctor_id = #{doctorCode}
|
|
|
+ or t.beh_doctor_id = #{doctorCode}
|
|
|
+ or t.director_doctor_id = #{doctorCode})
|
|
|
</if>
|
|
|
<if test="fileCode != null and fileCode != ''">
|
|
|
- and a.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
+ and t.file_code like CONCAT('%',#{fileCode},'%')
|
|
|
</if>
|
|
|
<if test="hospitalId != null">
|
|
|
- and a.hospital_id = #{hospitalId}
|
|
|
+ and t.hospital_id = #{hospitalId}
|
|
|
</if>
|
|
|
<if test="behospitalCode != null and behospitalCode != ''">
|
|
|
- and a.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
+ and t.behospital_code like CONCAT('%',#{behospitalCode},'%')
|
|
|
</if>
|
|
|
<if test="behosDateStart != null">
|
|
|
- <![CDATA[ and a.behospital_date >= #{behosDateStart}]]>
|
|
|
+ <![CDATA[ and t.behospital_date >= #{behosDateStart}]]>
|
|
|
</if>
|
|
|
<if test="behosDateEnd != null">
|
|
|
- <![CDATA[ and a.behospital_date < #{behosDateEnd}]]>
|
|
|
+ <![CDATA[ and t.behospital_date < #{behosDateEnd}]]>
|
|
|
</if>
|
|
|
<if test="leaveHosDateStart != null">
|
|
|
- <![CDATA[ and a.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
+ <![CDATA[ and t.leave_hospital_date >= #{leaveHosDateStart}]]>
|
|
|
</if>
|
|
|
<if test="leaveHosDateEnd != null">
|
|
|
- <![CDATA[ and a.leave_hospital_date < #{leaveHosDateEnd}]]>
|
|
|
+ <![CDATA[ and t.leave_hospital_date < #{leaveHosDateEnd}]]>
|
|
|
</if>
|
|
|
<if test="level != null and level != ''">
|
|
|
- and b.level = #{level}
|
|
|
+ and t.level = #{level}
|
|
|
</if>
|
|
|
<if test="isPlacefile != null and isPlacefile != ''">
|
|
|
- and a.is_placefile = #{isPlacefile}
|
|
|
+ and t.is_placefile = #{isPlacefile}
|
|
|
</if>
|
|
|
- and a.qc_type_id != 0) p
|
|
|
+ and t.qc_type_id != 0) p
|
|
|
where p.is_deleted="N"
|
|
|
<if test="checkStatus != null ">
|
|
|
and p.check_status = #{checkStatus}
|
|
@@ -6431,8 +6427,6 @@
|
|
|
AND (
|
|
|
( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' )
|
|
|
OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
|
|
|
- ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' )
|
|
|
- OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
|
|
|
)
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
|
|
@@ -7783,8 +7777,8 @@
|
|
|
AND t1.hospital_id = t2.hospital_id
|
|
|
AND t1.behospital_code = t2.behospital_code
|
|
|
AND (
|
|
|
- ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-' )
|
|
|
- OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-' )
|
|
|
+ ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-' AND t2.newborn_day != '—' )
|
|
|
+ OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
|
|
|
)
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
|
|
@@ -8011,8 +8005,8 @@
|
|
|
AND t1.hospital_id = t2.hospital_id
|
|
|
AND t1.behospital_code = t2.behospital_code
|
|
|
AND (
|
|
|
- ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-' )
|
|
|
- OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-' )
|
|
|
+ ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' )
|
|
|
+ OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
|
|
|
)
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
|
|
@@ -8300,8 +8294,8 @@
|
|
|
AND t1.hospital_id = t2.hospital_id
|
|
|
AND t1.behospital_code = t2.behospital_code
|
|
|
AND (
|
|
|
- ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-' )
|
|
|
- OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-' )
|
|
|
+ ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-'AND t2.newborn_day != '—' )
|
|
|
+ OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-'AND t2.newborn_month != '—' )
|
|
|
)
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
|
|
@@ -8537,8 +8531,8 @@
|
|
|
AND t1.hospital_id = t2.hospital_id
|
|
|
AND t1.behospital_code = t2.behospital_code
|
|
|
AND (
|
|
|
- ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-' )
|
|
|
- OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-' )
|
|
|
+ ( IFNULL( t2.newborn_day, '' ) != '' AND t2.newborn_day != '0' AND t2.newborn_day != '-' AND t2.newborn_day != '—' )
|
|
|
+ OR ( IFNULL( t2.newborn_month, '' )!= '' AND t2.newborn_month != '0' AND t2.newborn_month != '-' AND t2.newborn_month != '—')
|
|
|
)
|
|
|
</if>
|
|
|
<if test="qcResultShortPageVO.leaveHosType != null and qcResultShortPageVO.leaveHosType ==1">
|