zhoutg %!s(int64=5) %!d(string=hai) anos
pai
achega
a26413e3fc
Modificáronse 1 ficheiros con 20 adicións e 14 borrados
  1. 20 14
      src/main/resources/mapper/BehospitalInfoMapper.xml

+ 20 - 14
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -32,36 +32,42 @@
     </resultMap>
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
-        select a.*, b.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'
-        where a.is_deleted = 'N'
+        select * from (
+            select a.*, ifnull(b.level,'未评分') 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="name != null and name != ''">
-            and a.name like CONCAT('%',#{name},'%')
+            and t.name like CONCAT('%',#{name},'%')
         </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.behospitalCode like CONCAT('%',#{behospitalCode},'%')
+            and t.behospitalCode 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 != ''">
+            <![CDATA[ and t.leave_hospital_date <= #{leaveHosDateEnd}]]>
+        </if>
+        order by t.behospital_date desc
     </select>
 
     <select id="getMsg" resultType="com.diagbot.dto.MsgDTO">