Pārlūkot izejas kodu

查询效率优化

zhaops 4 gadi atpakaļ
vecāks
revīzija
3a9f9a488b

+ 1 - 3
cdssman-service/src/main/resources/mapper/HospitalInfoMapper.xml

@@ -71,9 +71,7 @@
         sum( type = 13 ) AS tcmsyndromeNum,
         sum( type = 14 ) AS anesthesiaNum
         FROM
-        tran_mapping_config
-        WHERE
-        is_deleted = 'N'
+        ( SELECT hospital_id, type, count(*) AS num FROM tran_mapping_config WHERE is_deleted = 'N' GROUP BY hospital_id, type ) t1
         GROUP BY
         hospital_id
         ) b ON a.id = b.hospital_id