diff --git a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java index e60c0eed..a9baf556 100644 --- a/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java +++ b/api/src/main/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManager.java @@ -9,6 +9,7 @@ import java.util.Map; import org.apache.commons.lang3.math.NumberUtils; +import org.openmrs.Location; import org.openmrs.api.ConceptService; import org.openmrs.api.context.Context; import org.openmrs.module.commonreports.ActivatedReportManager; @@ -137,6 +138,22 @@ public ReportDefinition constructReportDefinition() { String[] vaccinationConceptsListWithSequence = inizService .getValueFromKey("report.MSPP.vaccination.vaccinationConceptsListWithSequence").split(","); + if (inizService.getConceptFromKey("report.MSPP.vaccination.isChildFullyVaccinatedQuestion.concept") != null && + inizService.getConceptFromKey("report.MSPP.vaccination.yesAnswer.concept") != null) { + CodedObsCohortDefinition isChildFullyVaccinated = new CodedObsCohortDefinition(); + isChildFullyVaccinated.setQuestion( + inizService.getConceptFromKey("report.MSPP.vaccination.isChildFullyVaccinatedQuestion.concept")); + isChildFullyVaccinated.addParameter(new Parameter("onOrAfter", "On Or After", Date.class)); + isChildFullyVaccinated.addParameter(new Parameter("onOrBefore", "On Or Before", Date.class)); + isChildFullyVaccinated.setOperator(SetComparator.IN); + isChildFullyVaccinated + .setValueList(Arrays.asList(inizService.getConceptFromKey("report.MSPP.vaccination.yesAnswer.concept"))); + + vaccination.addRow(inizService + .getConceptFromKey("report.MSPP.vaccination.isChildFullyVaccinatedQuestion.concept").getDisplayString(), + isChildFullyVaccinated, parameterMappings); + } + for (String member : vaccinationConceptsListWithSequence) { String[] bits = member.split(":"); diff --git a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java index 81e7c3f7..bcf993c0 100644 --- a/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java +++ b/api/src/test/java/org/openmrs/module/commonreports/reports/MSPPVaccinationReportManagerTest.java @@ -132,6 +132,21 @@ public void testReport() throws Exception { .getColumnValue("Diphtheria Tetanus Vaccination 11." + MSPPVaccinationReportManager.col5); assertNotNull(_prenatalFemalesReceivedDT); assertEquals(1, _prenatalFemalesReceivedDT.getSize()); + + Cohort _0mTo1yFemalesFullyVaccinated= (Cohort) row + .getColumnValue("Is the child fully vaccinated?." + MSPPVaccinationReportManager.col1); + assertNotNull(_0mTo1yFemalesFullyVaccinated); + assertEquals(1, _0mTo1yFemalesFullyVaccinated.getSize()); + + Cohort _0mTo1yMalesFullyVaccinated = (Cohort) row + .getColumnValue("Is the child fully vaccinated?." + MSPPVaccinationReportManager.col3); + assertNotNull(_0mTo1yMalesFullyVaccinated); + assertEquals(1, _0mTo1yMalesFullyVaccinated.getSize()); + + Cohort _prenatalFemalesFullyVaccinated = (Cohort) row + .getColumnValue("Is the child fully vaccinated?." + MSPPVaccinationReportManager.col5); + assertNotNull(_prenatalFemalesFullyVaccinated); + assertEquals(1, _prenatalFemalesFullyVaccinated.getSize()); } for (Iterator itr = data.getDataSets().get("MSPP ECV").iterator(); itr.hasNext();) { diff --git a/api/src/test/resources/org/openmrs/module/commonreports/include/MSPPvaccinationTestDataset.xml b/api/src/test/resources/org/openmrs/module/commonreports/include/MSPPvaccinationTestDataset.xml index 531fdc29..0cda24c9 100644 --- a/api/src/test/resources/org/openmrs/module/commonreports/include/MSPPvaccinationTestDataset.xml +++ b/api/src/test/resources/org/openmrs/module/commonreports/include/MSPPvaccinationTestDataset.xml @@ -24,6 +24,7 @@ + @@ -38,6 +39,7 @@ + @@ -49,6 +51,7 @@ + @@ -61,6 +64,7 @@ + diff --git a/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json b/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json index 3f0d34dc..26ece13c 100644 --- a/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json +++ b/api/src/test/resources/testAppDataDir/configuration/jsonkeyvalues/config.json @@ -107,6 +107,8 @@ "report.MSPP.vaccination.vaccinations" : "3c25e650-ccfa-48da-b276-a7872796b113", "report.MSPP.vaccination.vaccinationSequenceNumberConcept" : "39741bfe-36a0-4a5b-9c64-fd4caaadca01", "report.MSPP.vaccination.vaccinationConceptsListWithSequence" : "9199a4c6-b15f-482c-aa0e-c839bd0cf535,0661812a-6ff7-42f9-bbe7-f79c5bdd0f58:1,0661812a-6ff7-42f9-bbe7-f79c5bdd0f58:2,0661812a-6ff7-42f9-bbe7-f79c5bdd0f58:3,30fd2e76-bfcb-49b4-8668-64fd3d3ec0ea,613c8c54-a1f5-435c-a1f0-ec9beaa42d06:1,613c8c54-a1f5-435c-a1f0-ec9beaa42d06:2,613c8c54-a1f5-435c-a1f0-ec9beaa42d06:3,9a9b3ca9-4ef9-4cb6-8a6d-ed9a7c32c46e:1,9a9b3ca9-4ef9-4cb6-8a6d-ed9a7c32c46e:2,5bc84919-86f1-4d9a-8b08-73cbb853b574:1,5bc84919-86f1-4d9a-8b08-73cbb853b574:2,3afaa3ce-0dbe-4ac8-964a-1913ee930d34:11,3afaa3ce-0dbe-4ac8-964a-1913ee930d34:12", + "report.MSPP.vaccination.isChildFullyVaccinatedQuestion.concept" : "25f7d0de-378a-477b-ac19-0bc9e9138064", + "report.MSPP.vaccination.yesAnswer.concept" : "b055abd8-a420-4a11-8b98-02ee170a7b54", "report.MSPP.vaccination.ecvList" : "9199a4c6-b15f-482c-aa0e-c839bd0cf535,0661812a-6ff7-42f9-bbe7-f79c5bdd0f58:2,30fd2e76-bfcb-49b4-8668-64fd3d3ec0ea,613c8c54-a1f5-435c-a1f0-ec9beaa42d06:3,9a9b3ca9-4ef9-4cb6-8a6d-ed9a7c32c46e:2,5bc84919-86f1-4d9a-8b08-73cbb853b574:1", "report.MSPP.vaccination.vaccinationDateConcept" : "5e7c3216-7f3b-4f5f-ab46-390f309e350d", "report.MSPP.childCare.active" : "true",