@@ -2829,7 +2829,7 @@ public ReportTemplateRowBundle generateReportBillItems(List<BillTypeAtomic> bts,
2829
2829
2830
2830
jpql += "GROUP BY billItem" ;
2831
2831
2832
- List <ReportTemplateRow > rs = (List <ReportTemplateRow >) paymentFacade .findLightsByJpql (jpql , parameters , TemporalType .TIMESTAMP );
2832
+ List <ReportTemplateRow > rs = (List <ReportTemplateRow >) paymentFacade .findLightsByJpqlWithoutCache (jpql , parameters , TemporalType .TIMESTAMP );
2833
2833
2834
2834
ReportTemplateRowBundle b = new ReportTemplateRowBundle ();
2835
2835
b .setReportTemplateRows (rs );
@@ -2905,7 +2905,7 @@ public ReportTemplateRowBundle generateReportBill(List<BillTypeAtomic> bts, List
2905
2905
2906
2906
jpql += "GROUP BY bill" ;
2907
2907
2908
- List <ReportTemplateRow > rs = (List <ReportTemplateRow >) paymentFacade .findLightsByJpql (jpql , parameters , TemporalType .TIMESTAMP );
2908
+ List <ReportTemplateRow > rs = (List <ReportTemplateRow >) paymentFacade .findLightsByJpqlWithoutCache (jpql , parameters , TemporalType .TIMESTAMP );
2909
2909
2910
2910
ReportTemplateRowBundle b = new ReportTemplateRowBundle ();
2911
2911
b .setReportTemplateRows (rs );
@@ -3287,6 +3287,7 @@ public void externalLaboratoryWorkloadReport() {
3287
3287
opdBts .add (BillTypeAtomic .INWARD_SERVICE_BILL_CANCELLATION );
3288
3288
opdBts .add (BillTypeAtomic .INWARD_FINAL_BILL );
3289
3289
opdBts .add (BillTypeAtomic .PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_INWARD_SERVICE_RETURN );
3290
+ opdBts .add (BillTypeAtomic .INWARD_SERVICE_BILL_REFUND );
3290
3291
}
3291
3292
if (visitType != null && visitType .equalsIgnoreCase ("OP" )) {
3292
3293
opdBts .add (BillTypeAtomic .OPD_BILL_WITH_PAYMENT );
@@ -3302,6 +3303,8 @@ public void externalLaboratoryWorkloadReport() {
3302
3303
opdBts .add (BillTypeAtomic .PACKAGE_OPD_BILL_CANCELLATION );
3303
3304
opdBts .add (BillTypeAtomic .OPD_BILL_CANCELLATION_DURING_BATCH_BILL_CANCELLATION );
3304
3305
opdBts .add (BillTypeAtomic .PACKAGE_OPD_BILL_CANCELLATION_DURING_BATCH_BILL_CANCELLATION );
3306
+ opdBts .add (BillTypeAtomic .OPD_BILL_REFUND );
3307
+ opdBts .add (BillTypeAtomic .PACKAGE_OPD_BILL_REFUND );
3305
3308
}
3306
3309
if (visitType != null && visitType .equalsIgnoreCase ("CC" )) {
3307
3310
opdBts .add (BillTypeAtomic .CC_BILL );
@@ -3321,6 +3324,25 @@ public void externalLaboratoryWorkloadReport() {
3321
3324
}
3322
3325
}
3323
3326
3327
+ private List <BillTypeAtomic > cancelAndRefundBillTypeAtomics () {
3328
+ return Arrays .asList (
3329
+ BillTypeAtomic .INWARD_SERVICE_BILL_CANCELLATION ,
3330
+ BillTypeAtomic .INWARD_SERVICE_BATCH_BILL_CANCELLATION ,
3331
+ BillTypeAtomic .PROFESSIONAL_PAYMENT_FOR_STAFF_FOR_INWARD_SERVICE_RETURN ,
3332
+ BillTypeAtomic .INWARD_SERVICE_BILL_REFUND ,
3333
+ BillTypeAtomic .OPD_BILL_CANCELLATION ,
3334
+ BillTypeAtomic .OPD_BATCH_BILL_CANCELLATION ,
3335
+ BillTypeAtomic .PACKAGE_OPD_BILL_CANCELLATION ,
3336
+ BillTypeAtomic .PACKAGE_OPD_BATCH_BILL_CANCELLATION ,
3337
+ BillTypeAtomic .OPD_BILL_CANCELLATION_DURING_BATCH_BILL_CANCELLATION ,
3338
+ BillTypeAtomic .PACKAGE_OPD_BILL_CANCELLATION_DURING_BATCH_BILL_CANCELLATION ,
3339
+ BillTypeAtomic .OPD_BILL_REFUND ,
3340
+ BillTypeAtomic .PACKAGE_OPD_BILL_REFUND ,
3341
+ BillTypeAtomic .CC_BILL_CANCELLATION ,
3342
+ BillTypeAtomic .CC_BILL_REFUND
3343
+ );
3344
+ }
3345
+
3324
3346
private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems (List <BillTypeAtomic > bts ) {
3325
3347
Map <String , Object > parameters = new HashMap <>();
3326
3348
@@ -3330,7 +3352,7 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems(List
3330
3352
+ "LEFT JOIN PatientInvestigation pi ON pi.billItem = billItem "
3331
3353
+ "WHERE bill.billTypeAtomic IN :bts "
3332
3354
+ "AND billItem.item is not null "
3333
- + "AND billItem.patientInvestigation is not null " ;
3355
+ + "AND (pi IS NOT NULL OR bill.billTypeAtomic IN :cancellableTypes) " ;
3334
3356
// String jpql = "SELECT new com.divudi.data.ReportTemplateRow(billItem) "
3335
3357
// + "FROM PatientInvestigation pi "
3336
3358
// + "JOIN pi.billItem billItem "
@@ -3340,6 +3362,7 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadBillItems(List
3340
3362
// + " AND bill.retired=false "
3341
3363
// + " AND bill.billTypeAtomic in :bts ";
3342
3364
3365
+ parameters .put ("cancellableTypes" , cancelAndRefundBillTypeAtomics ());
3343
3366
parameters .put ("bts" , bts );
3344
3367
3345
3368
if (staff != null ) {
@@ -3431,7 +3454,9 @@ private ReportTemplateRowBundle generateExternalLaboratoryWorkloadSummaryBillIte
3431
3454
+ "WHERE bill.billTypeAtomic IN :bts "
3432
3455
+ "AND bill.createdAt BETWEEN :fd AND :td "
3433
3456
+ "AND billItem.item is not null "
3434
- + "AND billItem.patientInvestigation is not null " ;
3457
+ + "AND (pi IS NOT NULL OR bill.billTypeAtomic IN :cancellableTypes)" ;
3458
+
3459
+ parameters .put ("cancellableTypes" , cancelAndRefundBillTypeAtomics ());
3435
3460
3436
3461
if (staff != null ) {
3437
3462
jpql += "AND billItem.patientInvestigation.barcodeGeneratedBy.webUserPerson.name = :staff " ;
0 commit comments