浏览代码

优化收费项目查询

lighter 9 月之前
父节点
当前提交
5b06efd29a
共有 1 个文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/main/java/thyyxxk/webserver/dao/his/reports/QueryDrugsAndProjectsDao.java

+ 6 - 3
src/main/java/thyyxxk/webserver/dao/his/reports/QueryDrugsAndProjectsDao.java

@@ -144,7 +144,7 @@ public interface QueryDrugsAndProjectsDao {
             "CONVERT(varchar(100), a.charge_date, 23)  charge_date, " +
             "    (select name from zd_unit_code where code=c.small_dept) dept, " +
             "(select name from zd_unit_code where code= a.exec_unit) exec_unit, " +
-            "    (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
+            "    (select name from zy_zd_responce_type where code=isnull(c.responce_type,'01')) yb_type, " +
             "    sum(a.charge_amount) number,sum(a.charge_fee) amount_of_money,charge_code_mx charge_code,source='住院' " +
             "FROM zy_detail_charge a,a_patient_mi b,zy_inactpatient c " +
             "where charge_code_mx = #{chargeCode} " +
@@ -162,7 +162,7 @@ public interface QueryDrugsAndProjectsDao {
             "CONVERT(varchar(100), a.charge_date, 23)  charge_date," +
             "    (select name from zd_unit_code where code=c.small_dept) dept, " +
             "(select name from zd_unit_code where code= a.exec_unit) exec_unit, " +
-            "    (select name from zy_zd_responce_type where code=c.responce_type) yb_type, " +
+            "    (select name from zy_zd_responce_type where code=isnull(c.responce_type,'01')) yb_type, " +
             "    sum(a.charge_amount) number,sum(a.charge_fee) amount_of_money,charge_code_mx charge_code,source = '住院' " +
             "FROM zy_detail_charge a,a_patient_mi b,zy_actpatient c " +
             "where charge_code_mx = #{chargeCode} " +
@@ -179,7 +179,10 @@ public interface QueryDrugsAndProjectsDao {
             "a.charge_date admiss_date,dis_date = null,CONVERT(varchar(100), a.charge_date, 23)  charge_date, " +
             "    (select name from zd_unit_code where code = a.warn_dept) dept, " +
             "    (select name from zd_unit_code where code = a.exec_dept) exec_unit, " +
-            "           yb_type = '自费',sum(a.quantity*a.drug_win) number,sum(a.quantity*drug_win*unit_price) amount_of_money,a.charge_item_code,source = '门诊' " +
+            " yb_type=(select rtrim(d.name) from zy_zd_responce_type d where d.med_type=" +
+            "isnull((select e.med_type from t_si_setlinfo e where e.pat_no=a.patient_id and e.times=a.times and e.revoked=0)," +
+            "(case when (select count(1) from powersi_mip_setlinfo f where f.med_org_ord=rtrim(a.patient_id)+'_'+cast(a.times as varchar)+'_1' and f.ord_state='SETTLED')=1 then '11' else '01' end )))," +
+            "sum(a.quantity*a.drug_win) number,sum(a.quantity*drug_win*unit_price) amount_of_money,a.charge_item_code,source = '门诊' " +
             "           from mz_charge_detail a,mz_patient_mi b " +
             "where a.patient_id = b.patient_id " +
             "and charge_item_code = #{chargeCode} " +