Explorar o código

优化代码4

wangfeng %!s(int64=5) %!d(string=hai) anos
pai
achega
df859e3ced

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1205 - 0
doc/013.20200706v1.3.7/qc_initv1.3.7.sql


+ 25 - 16
src/main/resources/mapper/BehospitalInfoMapper.xml

@@ -40,6 +40,7 @@
     </resultMap>
 
     <select id="getPage" resultType="com.diagbot.dto.BehospitalInfoDTO">
+        SELECT * FROM (
         select   t.*,
         CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
          from (
@@ -54,9 +55,6 @@
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
         where t.is_deleted = 'N'
-        <if test="checkStatus != null ">
-            and g.status = #{checkStatus}
-        </if>
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
         </if>
@@ -101,7 +99,11 @@
             and t.is_placefile = #{isPlacefile}
         </if>
         and t.qc_type_id != 0
-        and t.is_placefile = 1
+        and t.is_placefile = 1) p
+        where p.is_deleted="N"
+        <if test="checkStatus != null ">
+        and p.checkStatus = #{checkStatus}
+        </if>
     </select>
 
     <select id="getMsg" resultType="com.diagbot.dto.MsgDTO">
@@ -256,6 +258,7 @@
 
     <!--质控评分(科室)分页-->
     <select id="getPageByDept" resultType="com.diagbot.dto.BehospitalInfoDTO">
+        SELECT * from (
         SELECT
         t.*,
         CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
@@ -285,9 +288,6 @@
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
         where t.is_deleted = 'N'
-        <if test="checkStatus != null ">
-            and g.status = #{checkStatus}
-        </if>
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
         </if>
@@ -332,11 +332,16 @@
             and t.is_placefile = #{isPlacefile}
         </if>
         and t.qc_type_id != 0
-        and t.is_placefile = 1
+        and t.is_placefile = 1) p
+        where p.is_deleted="N"
+        <if test="checkStatus != null ">
+            and p.checkStatus = #{checkStatus}
+        </if>
     </select>
 
     <!--质控评分(个人)分页-->
     <select id="getPageByPerson" resultType="com.diagbot.dto.BehospitalInfoDTO">
+        Select * from (
         select t.*,
         CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
          from (SELECT
@@ -377,9 +382,6 @@
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
         WHERE t.is_deleted = 'N'
-        <if test="checkStatus != null ">
-            AND g.status = #{checkStatus}
-        </if>
         <if test="deptId != null and deptId != ''">
             and t.beh_dept_id = #{deptId}
         </if>
@@ -411,11 +413,16 @@
             and t.is_placefile = #{isPlacefile}
         </if>
         and t.qc_type_id != 0
-        and t.is_placefile = 1
+        and t.is_placefile = 1) p
+        where p.is_deleted="N"
+        <if test="checkStatus != null ">
+            and p.checkStatus = #{checkStatus}
+        </if>
     </select>
 
     <!--质控评分(医疗组)分页-->
     <select id="getPageByGroup" resultType="com.diagbot.dto.BehospitalInfoDTO">
+        select * from (
         select t.*,
         CASE WHEN ISNULL(g.status) THEN 0 ELSE g.status END checkStatus
          from (
@@ -430,9 +437,7 @@
         ON t.behospital_code = g.behospital_code
         AND t.hospital_id = g.hospital_id
         WHERE t.is_deleted = 'N'
-        <if test="checkStatus != null ">
-            AND g.status = #{checkStatus}
-        </if> and
+        and
             t.doctor_id in (
                 SELECT doctor_id FROM `bas_doctor_info`
                 where is_deleted = 'N' and hospital_id = #{hospitalId} and group_id in (
@@ -488,7 +493,11 @@
             and t.is_placefile = #{isPlacefile}
         </if>
         and t.qc_type_id != 0
-        and t.is_placefile = 1
+        and t.is_placefile = 1) p
+        where p.is_deleted="N"
+        <if test="checkStatus != null ">
+            and p.checkStatus = #{checkStatus}
+        </if>
     </select>
 
     <!-- 出院总人数统计-全院-首页 -->