Ver código fonte

优化查询 sql

xiaochan 3 anos atrás
pai
commit
c297d2dc04

+ 3 - 4
src/main/java/thyyxxk/webserver/dao/his/yibao/TransferInOfExpensesDao.java

@@ -75,14 +75,14 @@ public interface TransferInOfExpensesDao {
             "        b.receipt_sn=#{serialNo} and " +
             "        a.charge_item_code=c.code and " +
             "        isnull(a.group_no,'00')='00' " +
-            "union " +
+            "union all " +
             "select patient_name =rtrim(a.name), " +
             "       item_name = (select name from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial),/*c.drugname,*/ " +
             "       charge_amount = a.quantity, " +
             "       self_flag=a.self_flag, " +
             "       separate_flag =  (select separate_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
             "       suppress_flag =  (select suprice_flag from yp_zd_dict where yp_zd_dict.code=c.charge_code and yp_zd_dict.serial=c.serial), " +
-            "       charge_code =  (select charge_code from zy_bill_item where zy_bill_item.code = e.bill_item_zy), " +
+            "       charge_code =  a.charge_item_code, " +
             "       charge_code_mx = a.charge_item_code, " +
             "       serial = a.serial, " +
             "       group_no = a.group_no, " +
@@ -93,9 +93,8 @@ public interface TransferInOfExpensesDao {
             "       doctor_code = a.doctor_code, " +
             "       bill_item_code = rtrim(a.bill_item_code), " +
             "       exec_dept = a.exec_dept " +
-            "from ${tableName} a,mz_receipt_serial b,yp_base_yf c ,view_yp_zd_dict e " +
+            "from ${tableName} a,mz_receipt_serial b,yp_base_yf c  " +
             "where a.patient_id = b.patient_id and " +
-            " e.code = a.charge_item_code and a.serial = e.serial and" +
             "        a.times = b.times and " +
             "        a.receipt_no = b.receipt_no and " +
             "        a.serial_no= b.serial_no and " +