|
@@ -272,14 +272,11 @@ public interface ZyDailySettlementMapper {
|
|
|
" charge28=sum(b.charge28), " +
|
|
|
" name=max(c.name)," +
|
|
|
" receipt_no=max(b.receipt_no) " +
|
|
|
- " FROM zy_ledger_file a,zy_receipt b,a_patient_mi c " +
|
|
|
+ " FROM zy_ledger_file a join zy_receipt b on a.inpatient_no = b.inpatient_no and a.admiss_times = b.admiss_times " +
|
|
|
+ " left join a_patient_mi c on a.inpatient_no = b.inpatient_no " +
|
|
|
" WHERE a.cash_date > #{beginTime} and " +
|
|
|
" a.cash_date <= #{endTime} and " +
|
|
|
- " (a.cash_id =#{opId} or a.cash_id is null) and " +
|
|
|
- " a.inpatient_no=b.inpatient_no and " +
|
|
|
- " a.admiss_times=b.admiss_times and " +
|
|
|
- " a.ledger_sn =b.ledger_sn and " +
|
|
|
- " a.inpatient_no*=c.inpatient_no " +
|
|
|
+ " (a.cash_id =#{opId} or a.cash_id is null) " +
|
|
|
" group by a.inpatient_no,a.admiss_times ,a.ledger_sn " +
|
|
|
" order by receipt_no,a.inpatient_no")
|
|
|
List<Map<String, Object>> selectZyChargeDetail(@Param("opId") String opId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
|
|
@@ -344,23 +341,17 @@ public interface ZyDailySettlementMapper {
|
|
|
" charge_tk =isnull(max(d.charge_tk),0) ," +
|
|
|
" deposit =case when a.ledger_sn<0 then 0 - abs(max(a.deposit)) else max(a.deposit) end ," +
|
|
|
" receipt_no =max(c.receipt_no)," +
|
|
|
- "ledger_sn=a.ledger_sn " +
|
|
|
- " from zy_ledger_file a,zy_receipt c," +
|
|
|
- " (select inpatient_no,admiss_times,ledger_sn," +
|
|
|
+ " ledger_sn=a.ledger_sn " +
|
|
|
+ " from zy_ledger_file a join zy_receipt c on a.inpatient_no=c.inpatient_no and a.admiss_times=c.admiss_times and a.ledger_sn = c.ledger_sn " +
|
|
|
+ " left join (select inpatient_no,admiss_times,ledger_sn," +
|
|
|
" charge_bk=sum(case when status in ('1','3','4','5') and depo_type <>'2' then depo_amount else 0 end)," +
|
|
|
" charge_tk=sum(case when status='2' then depo_amount else 0 end) " +
|
|
|
" from zy_deposit_file " +
|
|
|
" where window_no='2' and depo_date > #{beginTime} and depo_date <=#{endTime} and status in ('1','2','3','4','5') " +
|
|
|
- " group by inpatient_no,admiss_times,ledger_sn) as d " +
|
|
|
+ " group by inpatient_no,admiss_times,ledger_sn) as d on a.inpatient_no = d.inpatient_no and a.admiss_times = d.admiss_times and a.ledger_sn=d.ledger_sn " +
|
|
|
" where a.cash_date > #{beginTime} and " +
|
|
|
" a.cash_date <= #{endTime} and " +
|
|
|
- " isnull(a.cash_id,a.op_id_code) =#{opId} and " +
|
|
|
- " a.inpatient_no=c.inpatient_no and " +
|
|
|
- " a.admiss_times=c.admiss_times and " +
|
|
|
- " a.ledger_sn =c.ledger_sn and " +
|
|
|
- " a.inpatient_no*=d.inpatient_no and " +
|
|
|
- " a.admiss_times*=d.admiss_times and " +
|
|
|
- " a.ledger_sn *=d.ledger_sn " +
|
|
|
+ " isnull(a.cash_id,a.op_id_code) =#{opId} " +
|
|
|
" and c.receipt_sn<>4 " +
|
|
|
" group by a.inpatient_no,a.admiss_times,a.ledger_sn ) as z,${tableName} y " +
|
|
|
" where z.in_no=y.inpatient_no and " +
|