Jelajahi Sumber

应收报表优化

hurugang 5 tahun lalu
induk
melakukan
f4abd326ef

+ 3 - 3
src/main/java/cn/hnthyy/thmz/mapper/his/MzChargeDetailMapper.java

@@ -744,11 +744,11 @@ public interface MzChargeDetailMapper {
                     "  exec_dept= z.name," +
                     "       charge_bill_code= case a.charge_bill_code when 'BILL10' then 'BILL01' when 'BILL11' then 'BILL28' when 'BILL12' then 'BILL02' else a.charge_bill_code end," +
                     "         parent=max( d.parent_code )," +
-                    "         total_charge=isnull(sum(round(convert(decimal(18,3),((convert(decimal(18,3),unit_price)) * (quantity * isnull(drug_win,1)))),2)),0)," +
+                    "         total_charge= case  when (b.pay_id ='99999' and b.charge_dcount_date <![CDATA[<=]]> '2021-12-01 23:59:59')  then  isnull(sum(round(convert(decimal(18,2),((convert(decimal(18,2),unit_price)) * (quantity * isnull(drug_win,1)))),2)),0) else isnull(sum(round(convert(decimal(18,3),((convert(decimal(18,3),unit_price)) * (quantity * isnull(drug_win,1)))),2)),0) end ," +
                     "         audit_code=case when isnull(a.group_no,'00')='71' then max(d.name)+'(门诊)' when isnull(a.group_no,'00')='72' then max(d.name)+'(急诊)' else max(d.name) end," +
                     " charge_dcount_date=b.charge_dcount_date  " +
                     "    FROM ${firstTableName} a(nolock),   " +
-                    "         (select distinct patient_id,times,receipt_no, serial_no,receipt_sn,charge_dcount_date from ${secondTableName} " +
+                    "         (select distinct patient_id,times,receipt_no, serial_no,receipt_sn,charge_dcount_date,pay_id from ${secondTableName} " +
                     "          where (case 1 when '0' then charge_date " +
                     "                 else charge_dcount_date end) <![CDATA[>=]]> #{beginDate} and " +
                     "                (case 1 when '0' then charge_date " +
@@ -783,7 +783,7 @@ public interface MzChargeDetailMapper {
                     "group by " +
                     "z.name,c.audit_code,isnull(a.group_no,'00')," +
                     " case a.charge_bill_code when 'BILL10' then 'BILL01' when 'BILL11' then 'BILL28' when 'BILL12' then 'BILL02' else a.charge_bill_code end" +
-                    ",b.charge_dcount_date ",
+                    ",b.charge_dcount_date,b.pay_id ",
             "</script>"})
     List<Map<String, Object>> selectDepetBusinessReport(ThmzmxsrParamsVo thmzmxsrParamsVo);