Bläddra i källkod

化验辅检查响应时间优化

chengyao 4 år sedan
förälder
incheckning
cb5d669128

+ 26 - 22
src/main/resources/mapper/MedLisInfoMapper.xml

@@ -65,13 +65,15 @@
         AND t1.hospital_id = t2.hospital_id
         and t1.hospital_id = t3.hospital_id
         AND t1.behospital_code = t2.behospital_code
-        <if test="examineInfoVO.hospitalId != null and examineInfoVO.hospitalId == 1l">
-            and t1.behospital_code = t3.behospital_code
-        </if>
-        <if test="examineInfoVO.hospitalId != null and examineInfoVO.hospitalId == 2l">
-            and t1.behospital_code = t3.file_code
-        </if>
         AND t1.rep_no = t2.rep_no
+        <choose>
+            <when test="examineInfoVO.hospitalId != null and examineInfoVO.hospitalId == 2l">
+                and t1.behospital_code = t3.file_code
+            </when>
+            <otherwise>
+                and t1.behospital_code = t3.behospital_code
+            </otherwise>
+        </choose>
         <if test="examineInfoVO.hospitalId != null">
             and t1.hospital_id = #{examineInfoVO.hospitalId}
         </if>
@@ -91,7 +93,8 @@
             </if>
         </if>
         <if test="examineInfoVO.isPlacefile != null and examineInfoVO.isPlacefile == 0">
-            <if test="examineInfoVO.behospitalDate != null">
+            <if test="examineInfoVO.leaveHospitalDate != null and examineInfoVO.behospitalDate != null">
+                <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') <= #{examineInfoVO.leaveHospitalDate}]]>
                 <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') >= #{examineInfoVO.behospitalDate}]]>
             </if>
         </if>
@@ -110,7 +113,7 @@
                 </foreach>
             </if>
             <if test="infos = null || infos.size() == 0">
-                and b.info in('000000ASDQWEZXC@#$%')
+                and 1 = 2
             </if>
 
     </select>
@@ -147,12 +150,6 @@
         and t1.is_deleted = "N"
         AND t3.is_deleted = "N"
         AND t1.check_date IS NOT NULL
-        <if test="examineInfoVO.hospitalId != null and examineInfoVO.hospitalId == 1l">
-            and t1.behospital_code = t3.behospital_code
-        </if>
-        <if test="examineInfoVO.hospitalId != null and examineInfoVO.hospitalId == 2l">
-            and t1.behospital_code = t3.file_code
-        </if>
         left join
         med_lis_result t2
         on t1.hospital_id = t2.hospital_id
@@ -160,8 +157,14 @@
         AND t2.item_name IS NOT NULL
         AND t1.behospital_code = t2.behospital_code
         AND t1.rep_no = t2.rep_no
-        WHERE
-        1=1
+        <choose>
+            <when test="examineInfoVO.hospitalId != null and examineInfoVO.hospitalId == 2l">
+                and t1.behospital_code = t3.file_code
+            </when>
+            <otherwise>
+                and t1.behospital_code = t3.behospital_code
+            </otherwise>
+        </choose>
         <if test="examineInfoVO.hospitalId != null">
             and t1.hospital_id = #{examineInfoVO.hospitalId}
         </if>
@@ -182,8 +185,9 @@
             </if>
         </if>
         <if test="examineInfoVO.isPlacefile != null and examineInfoVO.isPlacefile == 0">
-            <if test="examineInfoVO.behospitalDate != null">
-                <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') >= #{examineInfoVO.behospitalDate}]]>
+            <if test="examineInfoVO.leaveHospitalDate != null and examineInfoVO.behospitalDate != null">
+            <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') >= #{examineInfoVO.behospitalDate}]]>
+             <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') <= #{examineInfoVO.leaveHospitalDate}]]>
             </if>
         </if>
         ) b
@@ -202,7 +206,7 @@
                 </foreach>
             </if>
             <if test="infos = null || infos.size() == 0">
-                and b.info in('000000ASDQWEZXC@#$%')
+                and 1 = 2
             </if>
         </if>
         <if test="examineInfoVO.examineType != null and examineInfoVO.examineType == 2 ">
@@ -213,7 +217,7 @@
                 </foreach>
             </if>
             <if test="badCheckInfo = null || badCheckInfo.size() == 0">
-                and 1=1
+                and 1 = 1
             </if>
         </if>
     </select>
@@ -275,7 +279,7 @@
                 </foreach>
             </if>
             <if test="infos = null || infos.size() == 0">
-                and t.info in('000000ASDQWEZXC@#$%')
+                and 1 = 2
             </if>
         </if>
         <if test="examineSonInfoVO.examineType != null and examineSonInfoVO.examineType == 2 ">
@@ -286,7 +290,7 @@
                 </foreach>
             </if>
             <if test="infos = null || infos.size() == 0">
-                and 1=1
+                and 1 = 1
             </if>
         </if>
     </select>

+ 3 - 0
src/main/resources/mapper/MedLisResultMapper.xml

@@ -65,6 +65,9 @@
             <if test="behospitalDate != null">
                 <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') >= #{behospitalDate}]]>
             </if>
+            <if test="leaveHospitalDate != null">
+                <![CDATA[AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') <= #{leaveHospitalDate}]]>
+            </if>
         </if>
         <if test="isPlacefile != null and isPlacefile == 1">
             <if test="leaveHospitalDate != null">

+ 12 - 11
src/main/resources/mapper/MedPacsInfoMapper.xml

@@ -61,20 +61,20 @@
         AND t3.is_deleted = "N"
         AND t1.rep_name IS NOT NULL
         AND t1.check_date IS NOT NULL
-        <if test="checkInfoVO.hospitalId != null and checkInfoVO.hospitalId == 1l">
-            and t1.behospital_code = t3.behospital_code
-        </if>
-        <if test="checkInfoVO.hospitalId != null and checkInfoVO.hospitalId == 2l">
-            and t1.behospital_code = t3.file_code
-        </if>
         left join
         med_pacs_result t2
         on t1.hospital_id = t2.hospital_id
         AND t2.is_deleted = "N"
         AND t1.behospital_code = t2.behospital_code
         AND t1.rep_no = t2.rep_no
-        WHERE
-        1=1
+        <choose>
+            <when test="checkInfoVO.hospitalId != null and checkInfoVO.hospitalId == 2l">
+                and t1.behospital_code = t3.file_code
+            </when>
+            <otherwise>
+                and t1.behospital_code = t3.behospital_code
+            </otherwise>
+        </choose>
         <if test="checkInfoVO.hospitalId != null">
             and t1.hospital_id = #{checkInfoVO.hospitalId}
         </if>
@@ -94,7 +94,8 @@
             </if>
         </if>
         <if test="checkInfoVO.isPlacefile != null and checkInfoVO.isPlacefile == 0">
-            <if test="checkInfoVO.behospitalDate != null">
+            <if test="checkInfoVO.leaveHospitalDate != null and checkInfoVO.behospitalDate != null">
+                <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') <= #{checkInfoVO.leaveHospitalDate}]]>
                 <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') >= #{checkInfoVO.behospitalDate}]]>
             </if>
         </if>
@@ -114,7 +115,7 @@
                 </foreach>
             </if>
             <if test="infos = null || infos.size() == 0">
-                and b.info in('000000ASDQWEZXC@#$%')
+                and 1 = 2
             </if>
         </if>
         <if test="checkInfoVO.checkType != null and checkInfoVO.checkType == 2 ">
@@ -125,7 +126,7 @@
                 </foreach>
             </if>
             <if test="infos = null || infos.size() == 0">
-                and 1=1
+                and 1 = 1
             </if>
         </if>
     </select>

+ 3 - 0
src/main/resources/mapper/MedPacsResultMapper.xml

@@ -65,6 +65,9 @@
             <if test="behospitalDate != null">
                 <![CDATA[ AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') >= #{behospitalDate}]]>
             </if>
+            <if test="leaveHospitalDate != null">
+                <![CDATA[AND date_format (t1.check_date,'%Y-%m-%d %H:%i:%s') <= #{leaveHospitalDate}]]>
+            </if>
         </if>
         <if test="isPlacefile != null and isPlacefile == 1">
             <if test="leaveHospitalDate != null">