Selaa lähdekoodia

运行质控按入院时间统计

zhaops 4 vuotta sitten
vanhempi
commit
d206aceb50

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 945 - 252
src/main/resources/mapper/BehospitalInfoMapper.xml


+ 450 - 120
src/main/resources/mapper/QcresultInfoMapper.xml

@@ -35,11 +35,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         <if test="gradeType != null and gradeType != ''">
             AND c.grade_type = #{gradeType}
@@ -68,11 +79,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         <if test="gradeType != null and gradeType != ''">
             AND c.grade_type = #{gradeType}
@@ -109,11 +131,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         a.beh_dept_id,
@@ -146,11 +179,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         a.beh_dept_id,
@@ -201,11 +245,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         d.cases_id
@@ -233,11 +288,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         ) t2,
         (
@@ -305,11 +371,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         d.cases_entry_id
@@ -337,11 +414,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         ) t2
         ORDER BY
@@ -402,11 +490,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageVO.isReject != null">
             AND d.is_reject = #{filterPageVO.isReject}
@@ -450,11 +549,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         ) t2
         ) t
@@ -511,11 +621,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         d.cases_entry_id,
@@ -549,11 +670,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         ) t2
         ORDER BY
@@ -583,11 +715,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         a.beh_dept_id,
@@ -626,11 +769,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         <if test="deptClass != null and deptClass != ''">
             AND e.dept_name = #{deptClass}
@@ -668,11 +822,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         <if test="gradeType != null and gradeType != ''">
             AND c.grade_type = #{gradeType}
@@ -729,11 +894,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         d.cases_id,
@@ -797,11 +973,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         d.cases_entry_id,
@@ -840,11 +1027,22 @@
         <if test="hospitalId != null and hospitalId != ''">
             AND a.hospital_id = #{hospitalId}
         </if>
-        <if test="startDate != null and startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{endDate}]]>
+            </if>
         </if>
-        <if test="endDate != null and endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+        <if test="isPlacefile != null and isPlacefile == 1">
+            <if test="startDate != null and startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{startDate}]]>
+            </if>
+            <if test="endDate != null and endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{endDate}]]>
+            </if>
         </if>
         GROUP BY
         a.beh_dept_id,
@@ -925,11 +1123,22 @@
         <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
         </if>
-        <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
             AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
@@ -987,11 +1196,22 @@
         <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
         </if>
-        <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
             AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
@@ -1056,11 +1276,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
@@ -1094,11 +1325,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.deptName},'%')
@@ -1178,11 +1420,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name = #{filterPageVO.deptName}
@@ -1233,11 +1486,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageVO.deptName != null and filterPageVO.deptName != ''">
             AND a.beh_dept_name  =  #{filterPageVO.deptName}
@@ -1283,11 +1547,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageVO.name != null and filterPageVO.name != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.name},'%')
@@ -1327,11 +1602,22 @@
         <if test="filterPageVO.hospitalId != null and filterPageVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageVO.hospitalId}
         </if>
-        <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+        <if test="filterPageVO.isPlacefile != null and filterPageVO.isPlacefile == 1">
+            <if test="filterPageVO.startDate != null and filterPageVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageVO.startDate}]]>
+            </if>
+            <if test="filterPageVO.endDate != null and filterPageVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageVO.name != null and filterPageVO.name != ''">
             AND a.beh_dept_name like CONCAT('%', #{filterPageVO.name},'%')
@@ -1409,11 +1695,22 @@
         <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
         </if>
-        <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
             AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
@@ -1458,11 +1755,22 @@
         <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
         </if>
-        <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
             AND a.beh_dept_name = #{filterPageByDeptVO.deptName}
@@ -1557,11 +1865,22 @@
         <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
         </if>
-        <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
             AND a.beh_dept_name =  #{filterPageByDeptVO.deptName}
@@ -1629,11 +1948,22 @@
         <if test="filterPageByDeptVO.hospitalId != null and filterPageByDeptVO.hospitalId != ''">
             AND a.hospital_id = #{filterPageByDeptVO.hospitalId}
         </if>
-        <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
-            <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 0">
+            AND ifnull(a.leave_hospital_date ,'') = ''
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.behospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.behospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
-        <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
-            <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+        <if test="filterPageByDeptVO.isPlacefile != null and filterPageByDeptVO.isPlacefile == 1">
+            <if test="filterPageByDeptVO.startDate != null and filterPageByDeptVO.startDate != ''">
+                <![CDATA[ AND a.leave_hospital_date >= #{filterPageByDeptVO.startDate}]]>
+            </if>
+            <if test="filterPageByDeptVO.endDate != null and filterPageByDeptVO.endDate != ''">
+                <![CDATA[ AND a.leave_hospital_date <= #{filterPageByDeptVO.endDate}]]>
+            </if>
         </if>
         <if test="filterPageByDeptVO.deptName != null and filterPageByDeptVO.deptName != ''">
             AND a.beh_dept_name =  #{filterPageByDeptVO.deptName}