Skip to content

Commit a5b8374

Browse files
2 parents 03b162c + c905a48 commit a5b8374

File tree

13 files changed

+1890
-144
lines changed

13 files changed

+1890
-144
lines changed

api/src/main/java/org/openmrs/module/rwandareports/dataset/EncounterIndicatorDataSetDefinition.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import org.openmrs.module.reporting.dataset.definition.BaseDataSetDefinition;
77
import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty;
8+
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
89
import org.openmrs.module.rwandareports.indicator.EncounterIndicator;
910

1011

@@ -41,4 +42,8 @@ public List<EncounterIndicator> getColumns() {
4142
public void setColumns(List<EncounterIndicator> columns) {
4243
this.columns = columns;
4344
}
45+
46+
public void addColumn(String key, String label, Mapped<EncounterIndicator> encounterIndicatorMapped, Object o) {
47+
48+
}
4449
}

api/src/main/java/org/openmrs/module/rwandareports/dhis2/model/DHISDataValue.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
import org.codehaus.jackson.annotate.JsonPropertyOrder;
1616
import org.codehaus.jackson.map.annotate.JsonSerialize;
1717

18-
import javax.annotation.Generated;
19-
2018
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
21-
@Generated("org.jsonschema2pojo")
19+
//@Generated("org.jsonschema2pojo")
2220
@JsonPropertyOrder({
2321
"dataElement",
2422
"value",

api/src/main/java/org/openmrs/module/rwandareports/dhis2/model/DHISDataValueSet.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
import org.codehaus.jackson.annotate.JsonPropertyOrder;
1616
import org.codehaus.jackson.map.annotate.JsonSerialize;
1717

18-
import javax.annotation.Generated;
1918
import java.util.ArrayList;
2019
import java.util.List;
2120

2221
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
23-
@Generated("org.jsonschema2pojo")
22+
//@Generated("org.jsonschema2pojo")
2423
@JsonPropertyOrder({
2524
"dataSet",
2625
"completeData",

api/src/main/java/org/openmrs/module/rwandareports/reporting/SetupAncHMISIndicatorReport.java

Lines changed: 464 additions & 126 deletions
Large diffs are not rendered by default.

api/src/main/java/org/openmrs/module/rwandareports/reporting/SetupHMISIndicatorMonthlyReport.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -782,14 +782,6 @@ private void createCohortMonthlyIndicatorsII(CohortIndicatorDataSetDefinition ds
782782

783783
SqlCohortDefinition foodPoisoningPatient= patientWithICDCodeObsByStartDateAndEndDate("A05",caseStatus,newCase);
784784

785-
//new SqlCohortDefinition("select o.person_id from obs o where o.value_coded in (select distinct concept_id from concept_name where name like '%A05%') and o.value_coded in (select distinct concept_id from concept where class_id="+ICDConceptClassId+") and o.voided=0 and o.obs_datetime>= :startDate and o.obs_datetime<= :endDate");
786-
787-
//SqlCohortDefinition foodPoisoningPatient=new SqlCohortDefinition("select o.person_id from obs o where o.value_coded in (10201) and o.voided=0 and o.obs_datetime>= :startDate and o.obs_datetime<= :endDate");
788-
//SqlCohortDefinition foodPoisoningPatient=new SqlCohortDefinition("select o.person_id from obs o,concept c where c.class_id=19 and o.value_coded=c.concept_id and o.voided=0 and o.obs_datetime>='2019-01-01' and o.obs_datetime<='2019-04-05'");
789-
/*foodPoisoningPatient.setName("foodPoisoningPatient");
790-
foodPoisoningPatient.addParameter(new Parameter("startDate", "startDate", Date.class));
791-
foodPoisoningPatient.addParameter(new Parameter("endDate", "endDate", Date.class));*/
792-
793785

794786
CompositionCohortDefinition maleBelow5FoodPoisoningPatient = new CompositionCohortDefinition();
795787
maleBelow5FoodPoisoningPatient.setName("maleBelow5FoodPoisoningPatient");

api/src/main/java/org/openmrs/module/rwandareports/reporting/SetupHealtCenterHMISIndicatorMonthlyReport.java

Lines changed: 1076 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
package org.openmrs.module.rwandareports.reporting;
2+
3+
import org.apache.commons.logging.Log;
4+
import org.apache.commons.logging.LogFactory;
5+
import org.openmrs.api.context.Context;
6+
import org.openmrs.module.reporting.dataset.definition.SqlDataSetDefinition;
7+
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
8+
import org.openmrs.module.reporting.evaluation.parameter.Parameter;
9+
import org.openmrs.module.reporting.report.ReportDesign;
10+
import org.openmrs.module.reporting.report.definition.ReportDefinition;
11+
import org.openmrs.module.reporting.report.service.ReportService;
12+
import org.openmrs.module.rwandareports.util.GlobalPropertiesManagement;
13+
14+
import java.util.Date;
15+
16+
public class SetupInsuranceReport {
17+
18+
protected final static Log log = LogFactory.getLog(SetupInsuranceReport.class);
19+
GlobalPropertiesManagement gp = new GlobalPropertiesManagement();
20+
21+
22+
public void setup() throws Exception {
23+
24+
ReportDefinition rd = createReportDefinition();
25+
ReportDesign designCSV = Helper.createCsvReportDesign(rd,"Billing - Insurance Report.csv_");
26+
Helper.saveReportDesign(designCSV);
27+
}
28+
29+
public void delete() {
30+
ReportService rs = Context.getService(ReportService.class);
31+
for (ReportDesign rd : rs.getAllReportDesigns(false)) {
32+
if ("Billing - Insurance Report.csv_".equals(rd.getName())) {
33+
rs.purgeReportDesign(rd);
34+
}
35+
}
36+
Helper.purgeReportDefinition("Billing - Insurance Report");
37+
}
38+
39+
private ReportDefinition createReportDefinition() {
40+
41+
ReportDefinition reportDefinition = new ReportDefinition();
42+
reportDefinition.setName("Billing - Insurance Report");
43+
reportDefinition.addParameter(new Parameter("startDate", "From:", Date.class));
44+
reportDefinition.addParameter(new Parameter("endDate", "To:", Date.class));
45+
46+
createDataSetDefinition(reportDefinition);
47+
48+
Helper.saveReportDefinition(reportDefinition);
49+
50+
return reportDefinition;
51+
}
52+
53+
private void createDataSetDefinition(ReportDefinition reportDefinition) {
54+
55+
56+
SqlDataSetDefinition sqldsd =new SqlDataSetDefinition();
57+
sqldsd.setSqlQuery("SELECT \n" +
58+
" DATE(gb.created_date) AS 'Date',\n" +
59+
" pi.identifier AS 'Patient ID',\n" +
60+
" bn.policy_id_number AS 'BENEFICIARY`S AFFILIATION NUMBER',\n" +
61+
" FLOOR(DATEDIFF(CURDATE(), p.birthdate) / 365.25) AS 'BENEFICIARY`S AGE',\n" +
62+
" p.gender AS 'BENEFICIARY`S SEX',\n" +
63+
" CONCAT(COALESCE(pn.given_name, ''), ' ', COALESCE(pn.middle_name, ''), ' ', COALESCE(pn.family_name, '')) AS 'BENEFICIARY`S NAMES',\n" +
64+
" bn.owner_name AS 'AFFILIATE`S NAMES',\n" +
65+
" bn.company AS 'AFFILIATE`S AFFECTATION',\n" +
66+
" i.name AS 'Insurance Name',\n" +
67+
" -- Cost calculations: Concatenate individual item amounts with '+' and prefix with '=', return 0 if no items\n" +
68+
" COALESCE(\n" +
69+
" CONCAT('=', GROUP_CONCAT(\n" +
70+
" CASE WHEN hs.name = 'Consultation' THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
71+
" SEPARATOR '+'\n" +
72+
" )),\n" +
73+
" '0'\n" +
74+
" ) AS 'Cost for Consultation',\n" +
75+
" COALESCE(\n" +
76+
" CONCAT('=', GROUP_CONCAT(\n" +
77+
" CASE WHEN hs.name = 'Laboratory' THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
78+
" SEPARATOR '+'\n" +
79+
" )),\n" +
80+
" '0'\n" +
81+
" ) AS 'Cost for Laboratory Tests',\n" +
82+
" COALESCE(\n" +
83+
" CONCAT('=', GROUP_CONCAT(\n" +
84+
" CASE WHEN hs.service_id IN (41,42,43,44,45,16) THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
85+
" SEPARATOR '+'\n" +
86+
" )),\n" +
87+
" '0'\n" +
88+
" ) AS 'Cost for Medical Imaging',\n" +
89+
" COALESCE(\n" +
90+
" CONCAT('=', GROUP_CONCAT(\n" +
91+
" CASE WHEN hs.name = 'Hospitalization' THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
92+
" SEPARATOR '+'\n" +
93+
" )),\n" +
94+
" '0'\n" +
95+
" ) AS 'Cost for Hospitalization',\n" +
96+
" COALESCE(\n" +
97+
" CONCAT('=', GROUP_CONCAT(\n" +
98+
" CASE WHEN hs.service_id IN (6,8,10,12,13,14,18,22,34,36,37,38,39,40,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
99+
" SEPARATOR '+'\n" +
100+
" )),\n" +
101+
" '0'\n" +
102+
" ) AS 'Cost for Procedures and Materials',\n" +
103+
" COALESCE(\n" +
104+
" CONCAT('=', GROUP_CONCAT(\n" +
105+
" CASE WHEN psb.item_type = 0 THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
106+
" SEPARATOR '+'\n" +
107+
" )),\n" +
108+
" '0'\n" +
109+
" ) AS 'Cost for Medicines',\n" +
110+
" COALESCE(\n" +
111+
" CONCAT('=', GROUP_CONCAT(\n" +
112+
" CASE WHEN hs.name = 'Other Consumables' THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
113+
" SEPARATOR '+'\n" +
114+
" )),\n" +
115+
" '0'\n" +
116+
" ) AS 'Cost for Other Consumables',\n" +
117+
" ROUND(gb.global_amount, 0) AS 'Total Amount 100%',\n" +
118+
" ROUND(gb.global_amount * 0.15, 0) AS 'Patient Paid 15%',\n" +
119+
" ROUND(gb.global_amount * 0.85, 0) AS 'Insurance Share 85%'\n" +
120+
"FROM moh_bill_patient_bill pb\n" +
121+
"INNER JOIN moh_bill_payment bp ON pb.patient_bill_id = bp.patient_bill_id\n" +
122+
"INNER JOIN moh_bill_consommation mc ON pb.patient_bill_id = mc.patient_bill_id\n" +
123+
"INNER JOIN moh_bill_patient_service_bill psb ON mc.consommation_id = psb.consommation_id\n" +
124+
"LEFT JOIN moh_bill_hop_service hs ON psb.service_id = hs.service_id\n" +
125+
"INNER JOIN moh_bill_beneficiary bn ON mc.beneficiary_id = bn.beneficiary_id\n" +
126+
"INNER JOIN moh_bill_global_bill gb ON mc.global_bill_id = gb.global_bill_id\n" +
127+
"INNER JOIN moh_bill_insurance_policy e ON bn.insurance_policy_id = e.insurance_policy_id \n" +
128+
"INNER JOIN moh_bill_insurance i ON e.insurance_id = i.insurance_id\n" +
129+
"INNER JOIN moh_bill_department dp ON mc.department_id = dp.department_id\n" +
130+
"INNER JOIN moh_bill_insurance_rate ir ON i.insurance_id = ir.insurance_id\n" +
131+
"INNER JOIN patient_identifier pi ON bn.patient_id = pi.patient_id \n" +
132+
"INNER JOIN person p ON bn.patient_id = p.person_id\n" +
133+
"INNER JOIN person_name pn ON bn.patient_id = pn.person_id\n" +
134+
"WHERE pb.voided = 0\n" +
135+
" AND ir.retired = 0\n" +
136+
" AND mc.voided = 0\n" +
137+
" AND psb.voided = 0\n" +
138+
" AND i.insurance_id = 2\n" +
139+
" AND gb.closed = 1\n" +
140+
" AND DATE(gb.created_date) BETWEEN :startDate AND :endDate\n" +
141+
"GROUP BY gb.global_bill_id;");
142+
sqldsd.addParameter(new Parameter("startDate", "From:", Date.class));
143+
sqldsd.addParameter(new Parameter("endDate", "To:", Date.class));
144+
145+
reportDefinition.addDataSetDefinition("dsd",Mapped.mapStraightThrough(sqldsd));
146+
147+
148+
}
149+
150+
151+
}
152+

api/src/main/java/org/openmrs/module/rwandareports/reporting/SetupLabResultReports.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private void createLabResultDataSetDefinition(ReportDefinition reportDefinition)
119119
"(select name from concept_name where concept_id=ods.concept_id limit 1) as 'Name'," +
120120
"CONCAT_WS(',',(select name from concept_name where concept_id=o.value_coded limit 1),o.value_numeric,o.value_text) as 'Result'" +
121121
"from orders ods,obs o " +
122-
"where ods.order_id=o.order_id and ods.order_type_id="+labOrder.getOrderTypeId()+" and o.obs_datetime >= :startDate and o.obs_datetime <= :endDate and o.voided=0 and (:location is null or o.location_id=:location) and (:concept is null or ods.concept_id=:concept) and ods.concept_id not in (select concept_set from concept_set)");
122+
"where ods.order_id=o.order_id and ods.order_type_id="+labOrder.getOrderTypeId()+" and o.obs_datetime >= :startDate and o.obs_datetime <= :endDate and o.voided=0 and (:location is null or o.location_id=:location) and (:concept is null or ods.concept_id=:concept)");
123123
sqldsd.addParameter(new Parameter("startDate", "From:", Date.class));
124124
sqldsd.addParameter(new Parameter("endDate", "To:", Date.class));
125125
sqldsd.addParameter(location);
@@ -165,7 +165,7 @@ private void createLabExamDataSetDefinition(ReportDefinition reportDefinition) {
165165
"CONCAT_WS(',',(select name from concept_name where concept_id=o.value_coded limit 1),o.value_numeric,o.value_text) as 'Result'" +
166166
"from orders ods " +
167167
"left join obs o on o.order_id=ods.order_id and o.concept_id=ods.concept_id and o.voided=0 " +
168-
"where ods.order_type_id="+labOrder.getOrderTypeId()+" and ods.date_activated >= :startDate and ods.date_activated <= :endDate and ods.voided=0 and (:location is null or (ods.patient_id in (select person_id from person_attribute where person_attribute_type_id="+healthFacilityAttributeType.getPersonAttributeTypeId()+" and voided=0 and value=:location ))) and (:concept is null or ods.concept_id=:concept) and ods.concept_id not in (select concept_set from concept_set)");
168+
"where ods.order_type_id="+labOrder.getOrderTypeId()+" and ods.date_activated >= :startDate and ods.date_activated <= :endDate and ods.voided=0 and (:location is null or (ods.patient_id in (select person_id from person_attribute where person_attribute_type_id="+healthFacilityAttributeType.getPersonAttributeTypeId()+" and voided=0 and value=:location ))) and (:concept is null or ods.concept_id=:concept)");
169169
System.out.println("checkkkkkkkkkkkkkkk" + sqldsd.getSqlQuery());
170170
sqldsd.addParameter(new Parameter("startDate", "From:", Date.class));
171171
sqldsd.addParameter(new Parameter("endDate", "To:", Date.class));
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
package org.openmrs.module.rwandareports.reporting;
2+
3+
import org.apache.commons.logging.Log;
4+
import org.apache.commons.logging.LogFactory;
5+
import org.openmrs.api.context.Context;
6+
import org.openmrs.module.reporting.dataset.definition.SqlDataSetDefinition;
7+
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
8+
import org.openmrs.module.reporting.evaluation.parameter.Parameter;
9+
import org.openmrs.module.reporting.report.ReportDesign;
10+
import org.openmrs.module.reporting.report.definition.ReportDefinition;
11+
import org.openmrs.module.reporting.report.service.ReportService;
12+
import org.openmrs.module.rwandareports.util.GlobalPropertiesManagement;
13+
14+
import java.util.Date;
15+
16+
public class SetupRamaInsuranceReport {
17+
18+
protected final static Log log = LogFactory.getLog(SetupRamaInsuranceReport.class);
19+
GlobalPropertiesManagement gp = new GlobalPropertiesManagement();
20+
21+
22+
public void setup() throws Exception {
23+
24+
ReportDefinition rd = createReportDefinition();
25+
ReportDesign designCSV = Helper.createCsvReportDesign(rd,"Billing - RAMA Insurance Report.csv_");
26+
Helper.saveReportDesign(designCSV);
27+
}
28+
29+
public void delete() {
30+
ReportService rs = Context.getService(ReportService.class);
31+
for (ReportDesign rd : rs.getAllReportDesigns(false)) {
32+
if ("Billing - RAMA Insurance Report.csv_".equals(rd.getName())) {
33+
rs.purgeReportDesign(rd);
34+
}
35+
}
36+
Helper.purgeReportDefinition("Billing - RAMA Insurance Report");
37+
}
38+
39+
private ReportDefinition createReportDefinition() {
40+
41+
ReportDefinition reportDefinition = new ReportDefinition();
42+
reportDefinition.setName("Billing - RAMA Insurance Report");
43+
reportDefinition.addParameter(new Parameter("startDate", "From:", Date.class));
44+
reportDefinition.addParameter(new Parameter("endDate", "To:", Date.class));
45+
46+
createDataSetDefinition(reportDefinition);
47+
48+
Helper.saveReportDefinition(reportDefinition);
49+
50+
return reportDefinition;
51+
}
52+
53+
private void createDataSetDefinition(ReportDefinition reportDefinition) {
54+
55+
SqlDataSetDefinition sqldsd =new SqlDataSetDefinition();
56+
sqldsd.setSqlQuery("SELECT \n" +
57+
" DATE(gb.created_date) AS 'Date',\n" +
58+
" pi.identifier AS 'Patient ID',\n" +
59+
" bn.policy_id_number AS 'BENEFICIARY`S AFFILIATION NUMBER',\n" +
60+
" FLOOR(DATEDIFF(CURDATE(), p.birthdate) / 365.25) AS 'BENEFICIARY`S AGE',\n" +
61+
" p.gender AS 'BENEFICIARY`S SEX',\n" +
62+
" CONCAT(COALESCE(pn.given_name, ''), ' ', COALESCE(pn.middle_name, ''), ' ', COALESCE(pn.family_name, '')) AS 'BENEFICIARY`S NAMES',\n" +
63+
" bn.owner_name AS 'AFFILIATE`S NAMES',\n" +
64+
" bn.company AS 'AFFILIATE`S AFFECTATION',\n" +
65+
" i.name AS 'Insurance Name',\n" +
66+
" -- Cost calculations: Concatenate individual item amounts with '+' and prefix with '=', return 0 if no items\n" +
67+
" COALESCE(\n" +
68+
" CONCAT('=', GROUP_CONCAT(\n" +
69+
" CASE WHEN hs.name = 'Consultation' THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
70+
" SEPARATOR '+'\n" +
71+
" )),\n" +
72+
" '0'\n" +
73+
" ) AS 'Cost for Consultation',\n" +
74+
" COALESCE(\n" +
75+
" CONCAT('=', GROUP_CONCAT(\n" +
76+
" CASE WHEN hs.name = 'Laboratory' THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
77+
" SEPARATOR '+'\n" +
78+
" )),\n" +
79+
" '0'\n" +
80+
" ) AS 'Cost for Laboratory Tests',\n" +
81+
" COALESCE(\n" +
82+
" CONCAT('=', GROUP_CONCAT(\n" +
83+
" CASE WHEN hs.service_id IN (41,42,43,44,45,16) THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
84+
" SEPARATOR '+'\n" +
85+
" )),\n" +
86+
" '0'\n" +
87+
" ) AS 'Cost for Medical Imaging',\n" +
88+
" COALESCE(\n" +
89+
" CONCAT('=', GROUP_CONCAT(\n" +
90+
" CASE WHEN hs.name = 'Hospitalization' THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
91+
" SEPARATOR '+'\n" +
92+
" )),\n" +
93+
" '0'\n" +
94+
" ) AS 'Cost for Hospitalization',\n" +
95+
" COALESCE(\n" +
96+
" CONCAT('=', GROUP_CONCAT(\n" +
97+
" CASE WHEN hs.service_id IN (6,8,10,12,13,14,18,22,34,36,37,38,39,40,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60) THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
98+
" SEPARATOR '+'\n" +
99+
" )),\n" +
100+
" '0'\n" +
101+
" ) AS 'Cost for Procedures and Materials',\n" +
102+
" COALESCE(\n" +
103+
" CONCAT('=', GROUP_CONCAT(\n" +
104+
" CASE WHEN hs.service_id in (27,30) THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
105+
" SEPARATOR '+'\n" +
106+
" )),\n" +
107+
" '0'\n" +
108+
" ) AS 'Cost for Medicines',\n" +
109+
" COALESCE(\n" +
110+
" CONCAT('=', GROUP_CONCAT(\n" +
111+
" CASE WHEN hs.service_id in (26) THEN ROUND(psb.unit_price * psb.quantity, 0) ELSE NULL END\n" +
112+
" SEPARATOR '+'\n" +
113+
" )),\n" +
114+
" '0'\n" +
115+
" ) AS 'Cost for Other Consumables',\n" +
116+
" ROUND(gb.global_amount, 0) AS 'Total Amount 100%',\n" +
117+
" ROUND(gb.global_amount * 0.15, 0) AS 'Patient Paid 15%',\n" +
118+
" ROUND(gb.global_amount * 0.85, 0) AS 'Insurance Share 85%'\n" +
119+
"FROM moh_bill_patient_bill pb\n" +
120+
"INNER JOIN moh_bill_payment bp ON pb.patient_bill_id = bp.patient_bill_id\n" +
121+
"INNER JOIN moh_bill_consommation mc ON pb.patient_bill_id = mc.patient_bill_id\n" +
122+
"INNER JOIN moh_bill_patient_service_bill psb ON mc.consommation_id = psb.consommation_id\n" +
123+
"LEFT JOIN moh_bill_hop_service hs ON psb.service_id = hs.service_id\n" +
124+
"INNER JOIN moh_bill_beneficiary bn ON mc.beneficiary_id = bn.beneficiary_id\n" +
125+
"INNER JOIN moh_bill_global_bill gb ON mc.global_bill_id = gb.global_bill_id\n" +
126+
"INNER JOIN moh_bill_insurance_policy e ON bn.insurance_policy_id = e.insurance_policy_id \n" +
127+
"INNER JOIN moh_bill_insurance i ON e.insurance_id = i.insurance_id\n" +
128+
"INNER JOIN moh_bill_department dp ON mc.department_id = dp.department_id\n" +
129+
"INNER JOIN moh_bill_insurance_rate ir ON i.insurance_id = ir.insurance_id\n" +
130+
"INNER JOIN patient_identifier pi ON bn.patient_id = pi.patient_id \n" +
131+
"INNER JOIN person p ON bn.patient_id = p.person_id\n" +
132+
"INNER JOIN person_name pn ON bn.patient_id = pn.person_id\n" +
133+
"WHERE pb.voided = 0\n" +
134+
" AND ir.retired = 0\n" +
135+
" AND mc.voided = 0\n" +
136+
" AND psb.voided = 0\n" +
137+
" AND i.insurance_id = 2\n" +
138+
" AND gb.closed = 1\n" +
139+
" AND DATE(gb.created_date) BETWEEN :startDate AND :endDate\n" +
140+
"GROUP BY gb.global_bill_id;");
141+
sqldsd.addParameter(new Parameter("startDate", "From:", Date.class));
142+
sqldsd.addParameter(new Parameter("endDate", "To:", Date.class));
143+
144+
reportDefinition.addDataSetDefinition("dsd",Mapped.mapStraightThrough(sqldsd));
145+
146+
147+
}
148+
149+
150+
}
151+
33.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)