Browse Source

查询效率优化

zhaops 4 years ago
parent
commit
3a9f9a488b
1 changed files with 1 additions and 3 deletions
  1. 1 3
      cdssman-service/src/main/resources/mapper/HospitalInfoMapper.xml

+ 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