diff --git a/.github/workflows/cicd_process.yml b/.github/workflows/cicd_process.yml index e379b6bb1d..15f18c33cd 100644 --- a/.github/workflows/cicd_process.yml +++ b/.github/workflows/cicd_process.yml @@ -1,11 +1,11 @@ name: deploy to prod 8600 on: push: - branches: [ master ] + branches: [ 2.x ] jobs: - build: - name: Deploy + name: deploying to 2.x instance + if: github.ref == 'refs/heads/2.x' runs-on: ubuntu-latest steps: - name: executing remote connection @@ -23,7 +23,7 @@ jobs: sudo chown -R cicd2:cicd2 openmrs-module-kenyaemr git config --global --add safe.directory /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaemr cd /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaemr - git clone https://github.com/palladiumkenya/openmrs-module-kenyaemr.git /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaemr + git clone -b 2.x https://github.com/palladiumkenya/openmrs-module-kenyaemr.git /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaemr sudo chown -R cicd2:cicd2 /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaemr git status mvn license:format @@ -35,3 +35,35 @@ jobs: sudo chmod 755 /var/lib/OpenMRS/modules/*.omod sudo systemctl stop tomcat sudo systemctl start tomcat + + dev_server_deployment: + name: deploying to 3.x dev instance + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - name: executing remote connection + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.CICD_HOST }} + username: ${{ secrets.CICD_USERNAME }} + key: ${{ secrets.CICD_SECRET }} + port: ${{ secrets.PORT }} + command_timeout: 200m + script: | + cd /apps/githubworkflows/kenyaemr-modules + sudo rm -rf openmrs-module-kenyaemr + sudo mkdir openmrs-module-kenyaemr + sudo chown -R cicd:cicd openmrs-module-kenyaemr + git config --global --add safe.directory /apps/githubworkflows/kenyaemr-modules/openmrs-module-kenyaemr + cd /apps/githubworkflows/kenyaemr-modules/openmrs-module-kenyaemr + git clone -b master https://github.com/palladiumkenya/openmrs-module-kenyaemr.git . + git status + mvn license:format + sudo mvn clean install -DskipTests + sudo rm -rf /var/lib/OpenMRS/modules/kenyaemr-*.omod + sudo cp -r /apps/githubworkflows/kenyaemr-modules/openmrs-module-kenyaemr/omod/target/kenyaemr-*.omod /var/lib/OpenMRS/modules/ + sudo chown -R tomcat:tomcat /var/lib/OpenMRS/modules/ + sudo chmod +r /var/lib/OpenMRS/modules/*.omod + sudo chmod 755 /var/lib/OpenMRS/modules/*.omod + sudo service tomcat9 restart + diff --git a/.github/workflows/maven_deploy_cicd.yml b/.github/workflows/maven_deploy_cicd.yml index 5c7651c88c..0cf49fe8bd 100644 --- a/.github/workflows/maven_deploy_cicd.yml +++ b/.github/workflows/maven_deploy_cicd.yml @@ -4,7 +4,7 @@ on: # Manually triggered workflow using the "Run workflow" button workflow_dispatch: push: - branches: [ master ] + branches: [ master,openmrs-2.6.x-upgrade ] jobs: publish: diff --git a/api/pom.xml b/api/pom.xml index 5c85688411..bae2f44206 100755 --- a/api/pom.xml +++ b/api/pom.xml @@ -14,11 +14,11 @@ org.openmrs.module kenyaemr - 18.7.2-SNAPSHOT + 18.8.0 kenyaemr-api - 18.7.2-SNAPSHOT + 18.8.0 jar KenyaEMR Module API API project for KenyaEMR Module diff --git a/api/src/main/distro/metadata/identifierTypes.xml b/api/src/main/distro/metadata/identifierTypes.xml index b2f576a445..6cf55a921d 100755 --- a/api/src/main/distro/metadata/identifierTypes.xml +++ b/api/src/main/distro/metadata/identifierTypes.xml @@ -29,4 +29,5 @@ + \ No newline at end of file diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/advice/SyncHFEAppointmentsWithBahmniModule.java b/api/src/main/java/org/openmrs/module/kenyaemr/advice/SyncHFEAppointmentsWithBahmniModule.java deleted file mode 100644 index de9d0e3918..0000000000 --- a/api/src/main/java/org/openmrs/module/kenyaemr/advice/SyncHFEAppointmentsWithBahmniModule.java +++ /dev/null @@ -1,578 +0,0 @@ -/** - * This Source Code Form is subject to the terms of the Mozilla Public License, - * v. 2.0. If a copy of the MPL was not distributed with this file, You can - * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under - * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. - * - * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS - * graphic logo is a trademark of OpenMRS Inc. - */ -package org.openmrs.module.kenyaemr.advice; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.openmrs.Encounter; -import org.openmrs.Obs; -import org.openmrs.Person; -import org.openmrs.api.ConceptService; -import org.openmrs.api.ObsService; -import org.openmrs.api.PersonService; -import org.openmrs.api.context.Context; -import org.openmrs.module.appointments.model.Appointment; -import org.openmrs.module.appointments.model.AppointmentKind; -import org.openmrs.module.appointments.model.AppointmentServiceDefinition; -import org.openmrs.module.appointments.service.AppointmentsService; -import org.openmrs.module.appointments.util.DateUtil; -import org.openmrs.module.kenyaemr.metadata.HivMetadata; -import org.springframework.aop.AfterReturningAdvice; -import org.openmrs.module.appointments.service.AppointmentServiceDefinitionService; -import org.openmrs.module.kenyaemr.util.EmrUtils; -import org.openmrs.module.kenyaemr.metadata.MchMetadata; -import org.openmrs.module.kenyaemr.metadata.TbMetadata; -import org.openmrs.api.PatientService; -import org.openmrs.Patient; - -import java.lang.reflect.Method; -import java.text.SimpleDateFormat; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Synchronizes appointments documented in HTML forms with Bahmni appointments module - * Invoked after saving HFE forms - */ -public class SyncHFEAppointmentsWithBahmniModule implements AfterReturningAdvice { - - private Log log = LogFactory.getLog(this.getClass()); - - // HIV appointments - public static final String NEXT_CLINICAL_APPOINTMENT_DATE_CONCEPT_UUID = "5096AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; - public static final String NEXT_DRUG_REFILL_APPOINTMENT_DATE_CONCEPT_UUID = "162549AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; - - public static final String APPOINTMENT_REASON_CONCEPT_UUID = "160288AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; - - public static final String HIV_FOLLOWUP_SERVICE = "885b4ad3-fd4c-4a16-8ed3-08813e6b01fa"; - public static final String DRUG_REFILL_SERVICE = "a96921a1-b89e-4dd2-b6b4-7310f13bbabe"; - public static final String HIV_LAB_TEST_SERVICE = "61488cf6-fad4-11ed-be56-0242ac120002"; - public static final String COUNSELLING_SERVICE = "c6ce2119-c084-49c7-aa3f-be9fa1f3863e"; - - // MCH appointments - public static final String MCH_POSTNATAL_VISIT_SERVICE = "dcde8ca4-32a5-4c67-9982-33346e39813f"; - public static final String MCH_ANTENATAL_VISIT_SERVICE = "372eed95-6493-490a-8891-8374fe566aeb"; - public static final String CWC_FOLLOWUP_SERVICE = "b696161d-3755-4ff0-94a9-91f0148c18ab"; - - // Prep appointments - public static final String PREP_INITIAL_SERVICE = "242f74b9-b0a3-4ba6-9be3-8f57591e3dff"; - public static final String PREP_FOLLOWUP_SERVICE = "6f9b19f6-ac25-41f9-a75c-b8b125dec3da"; - public static final String PREP_MONTHLY_REFILL_SERVICE = "b8c3efd9-e106-4409-ae0e-b9c651484a20"; - public static final String PREP_INITIAL_FORM = "1bfb09fc-56d7-4108-bd59-b2765fd312b8"; - public static final String PREP_MONTHLY_REFILL_FORM = "291c03c8-a216-11e9-a2a3-2a2ae2dbcce4"; - public static final String PREP_FOLLOWUP_FORM = "ee3e2017-52c0-4a54-99ab-ebb542fb8984"; - - // Tb appointments - public static final String TB_SERVICE = "e4737031-7e3b-4c63-a929-588613b2c832"; - - // KP appointments - public static final String KP_CLINICAL_SERVICE = "b1b75503-5175-433c-a25d-763bc9650ebd"; - public static final String KP_CLINICAL_VISIT_FORM = "92e041ac-9686-11e9-bc42-526af7764f64"; - - - AppointmentsService appointmentsService = Context.getService(AppointmentsService.class); - AppointmentServiceDefinitionService appointmentServiceDefinitionService = Context.getService(AppointmentServiceDefinitionService.class); - ObsService obsService = Context.getObsService(); - ConceptService conceptService = Context.getConceptService(); - PersonService personService = Context.getPersonService(); - boolean followUpAppointment = false; - boolean nxtAppointment = false; - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date nextApptDate = null; - Date refillApptDate = null; - Integer appointmentReason = null; - - @Override - public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable { - if (method.getName().equals("saveEncounter")) { // handles both create and edit - Encounter enc = (Encounter) args[0]; - List appointmentForms = Arrays.asList(HivMetadata._Form.MOH_257_VISIT_SUMMARY, HivMetadata._Form.HIV_GREEN_CARD, MchMetadata._Form.MCHMS_ANTENATAL_VISIT, MchMetadata._Form.MCHCS_FOLLOW_UP, MchMetadata._Form.MCHMS_POSTNATAL_VISIT, PREP_FOLLOWUP_FORM, PREP_INITIAL_FORM, PREP_MONTHLY_REFILL_FORM, KP_CLINICAL_VISIT_FORM, TbMetadata._Form.TB_FOLLOW_UP, HivMetadata._Form.FAST_TRACK ); - - if (enc != null && enc.getForm() != null && appointmentForms.contains(enc.getForm().getUuid())) { - Appointment editAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - - if(enc.getVoided() == true && editAppointment != null && enc.getForm() != null){ - // Get appointment obs - Appointment hivFollowUpAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - Appointment drugRefillAppointment = hivFollowUpAppointment.getRelatedAppointment(); - - // delete HIV followup appointment - if(hivFollowUpAppointment != null ) { - nxtAppointment = true; - hivFollowUpAppointment.setVoided(true); - hivFollowUpAppointment.setDateVoided(new Date()); - hivFollowUpAppointment.setVoidedBy(Context.getAuthenticatedUser()); - } - - if(nxtAppointment && followUpAppointment) { - Appointment app = appointmentsService.validateAndSave(hivFollowUpAppointment); - } - - // delete existing appointment for drug refill - if(drugRefillAppointment != null) { - drugRefillAppointment.setVoided(true); - drugRefillAppointment.setDateVoided(new Date()); - drugRefillAppointment.setVoidedBy(Context.getAuthenticatedUser()); - Appointment app = appointmentsService.validateAndSave(drugRefillAppointment); - } - - } else if (editAppointment != null && enc.getForm() != null && - (enc.getForm().getUuid().equals(HivMetadata._Form.HIV_GREEN_CARD) || enc.getForm().getUuid().equals(HivMetadata._Form.MOH_257_VISIT_SUMMARY))) { - // pick HIV followup forms - processEditHivFollowupEncounter(enc); - - } else if (enc != null && enc.getForm() != null && - (enc.getForm().getUuid().equals(HivMetadata._Form.HIV_GREEN_CARD) || enc.getForm().getUuid().equals(HivMetadata._Form.MOH_257_VISIT_SUMMARY))) { - // pick HIV followup forms - processCreateHivFollowupEncounter(enc); - - } else if(enc != null && enc.getForm() != null && - (enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_ANTENATAL_VISIT) || - enc.getForm().getUuid().equals(MchMetadata._Form.MCHCS_FOLLOW_UP) || - enc.getForm().getUuid().equals(PREP_FOLLOWUP_FORM) || - enc.getForm().getUuid().equals(PREP_INITIAL_FORM) || - enc.getForm().getUuid().equals(PREP_MONTHLY_REFILL_FORM) || - enc.getForm().getUuid().equals(KP_CLINICAL_VISIT_FORM) || - enc.getForm().getUuid().equals(TbMetadata._Form.TB_FOLLOW_UP) || - enc.getForm().getUuid().equals(HivMetadata._Form.FAST_TRACK) )) { - - processProgramAppointments(enc); - } else if(enc != null && (enc.getForm() != null && (enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_POSTNATAL_VISIT) || enc.getForm() != null && enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_DELIVERY)))) { - - processMCHEncounter(enc); - } - } - } - - } - - /** - * Edit HIV appointments ie HIV consultation, Drug refill and lab - */ - private void processEditHivFollowupEncounter(Encounter enc) throws Throwable { - // Get appointment obs - Appointment hivFollowUpAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - Appointment drugRefillAppointment = hivFollowUpAppointment.getRelatedAppointment(); - Integer appointmentReasonToEdit = null; - - List obs = obsService.getObservations( - Arrays.asList(personService.getPerson(enc.getPatient().getPersonId())), - Arrays.asList(enc), - Arrays.asList( - conceptService.getConceptByUuid(NEXT_CLINICAL_APPOINTMENT_DATE_CONCEPT_UUID), - conceptService.getConceptByUuid(NEXT_DRUG_REFILL_APPOINTMENT_DATE_CONCEPT_UUID), - conceptService.getConceptByUuid(APPOINTMENT_REASON_CONCEPT_UUID) - ), - null, - null, - null, - null, - null, - null, - null, - null, - false - ); - - for (Obs o : obs) { // Loop through the obs and compose Appointment object for Bahmni - if((o.getConcept().getUuid().equals(APPOINTMENT_REASON_CONCEPT_UUID)) && hivFollowUpAppointment != null ) { - appointmentReasonToEdit = o.getValueCoded().getConceptId(); - AppointmentServiceDefinition appointmentServiceDefinition = new AppointmentServiceDefinition(); - if(appointmentReasonToEdit != null) { - // Allow for editing of appointment service based on updated appointment reasons from green card - String serviceUuid = getAppointmentServiceUuidFromConcept(appointmentReasonToEdit); - if(serviceUuid != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(serviceUuid).getId()); - hivFollowUpAppointment.setService(appointmentServiceDefinition); - } - } - if(o.getValueCoded().getConceptId() == 160523 || o.getValueCoded().getConceptId() == 160521 ) { - followUpAppointment = true; - } - } - - // edit HIV followup appointment - if((o.getConcept().getUuid().equals(NEXT_CLINICAL_APPOINTMENT_DATE_CONCEPT_UUID)) && hivFollowUpAppointment != null ) { - nxtAppointment = true; - Date nextApptStartDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date nextApptEndDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - hivFollowUpAppointment.setStartDateTime(nextApptStartDateTime); - hivFollowUpAppointment.setEndDateTime(nextApptEndDateTime); - if(enc.getVoided() == true) { - hivFollowUpAppointment.setVoided(true); - hivFollowUpAppointment.setDateVoided(new Date()); - hivFollowUpAppointment.setVoidedBy(Context.getAuthenticatedUser()); - } - } - - if(nxtAppointment && followUpAppointment) { - Appointment app = appointmentsService.validateAndSave(hivFollowUpAppointment); - } - - // edit existing appointment for drug refill - if((o.getConcept().getUuid().equals(NEXT_DRUG_REFILL_APPOINTMENT_DATE_CONCEPT_UUID)) && drugRefillAppointment != null) { - Date refillStartDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date refillEndDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - drugRefillAppointment.setStartDateTime(refillStartDateTime); - drugRefillAppointment.setEndDateTime(refillEndDateTime); - drugRefillAppointment.setVoided(enc.getVoided()); - if(enc.getVoided() == true) { - drugRefillAppointment.setVoided(true); - drugRefillAppointment.setDateVoided(new Date()); - drugRefillAppointment.setVoidedBy(Context.getAuthenticatedUser()); - } - Appointment app = appointmentsService.validateAndSave(drugRefillAppointment); - } - - //create new refill appointment if added on editing followup - if((o.getConcept().getUuid().equals(NEXT_DRUG_REFILL_APPOINTMENT_DATE_CONCEPT_UUID)) && drugRefillAppointment == null && - appointmentServiceDefinitionService.getAppointmentServiceByUuid(DRUG_REFILL_SERVICE) != null) { - AppointmentServiceDefinition appointmentServiceDefinition = new AppointmentServiceDefinition(); - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(DRUG_REFILL_SERVICE).getId()); - - Appointment editedFollowUpAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - Appointment refillAppointment = new Appointment(); - Date refillStartDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date refillEndDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - refillAppointment.setRelatedAppointment(editedFollowUpAppointment); - refillAppointment.setPatient(enc.getPatient()); - refillAppointment.setService(appointmentServiceDefinition); - refillAppointment.setStartDateTime(refillStartDateTime); - refillAppointment.setEndDateTime(refillEndDateTime); - refillAppointment.setLocation(enc.getLocation()); - refillAppointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - refillAppointment.setAppointmentKind(AppointmentKind.Scheduled); - Appointment app = appointmentsService.validateAndSave(refillAppointment); - - if (editedFollowUpAppointment != null) { - editedFollowUpAppointment.setRelatedAppointment(app); - Appointment app2 = appointmentsService.validateAndSave(editedFollowUpAppointment); - } - } - - } - } - - /** - * Create HIV appointments ie HIV consultation, Drug refill and lab - */ - private void processCreateHivFollowupEncounter(Encounter enc) throws Throwable { - Appointment nextAppointment = new Appointment(); - - // Get appointment obs - List obs = obsService.getObservations( - Arrays.asList(personService.getPerson(enc.getPatient().getPersonId())), - Arrays.asList(enc), - Arrays.asList( - conceptService.getConceptByUuid(NEXT_CLINICAL_APPOINTMENT_DATE_CONCEPT_UUID), - conceptService.getConceptByUuid(NEXT_DRUG_REFILL_APPOINTMENT_DATE_CONCEPT_UUID), - conceptService.getConceptByUuid(APPOINTMENT_REASON_CONCEPT_UUID) - ), - null, - null, - null, - null, - null, - null, - null, - null, - false - ); - - for (Obs o : obs) { // Loop through the obs and compose Appointment object for Bahmni - if (o.getConcept().getUuid().equals(NEXT_CLINICAL_APPOINTMENT_DATE_CONCEPT_UUID)) { - nextApptDate = o.getValueDatetime(); - } - if (o.getConcept().getUuid().equals(APPOINTMENT_REASON_CONCEPT_UUID)) { - appointmentReason = o.getValueCoded().getConceptId(); - } - if (o.getConcept().getUuid().equals(NEXT_DRUG_REFILL_APPOINTMENT_DATE_CONCEPT_UUID)) { - refillApptDate = o.getValueDatetime(); - } - - if((appointmentReason != null && appointmentReason == 160523) || (appointmentReason != null && appointmentReason == 160521) ) { - AppointmentServiceDefinition appointmentServiceDefinition = new AppointmentServiceDefinition(); - - // create HIV followup appointment - if(nextApptDate != null && appointmentServiceDefinitionService.getAppointmentServiceByUuid(HIV_FOLLOWUP_SERVICE) != null ) { - - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(HIV_FOLLOWUP_SERVICE).getId()); - Date nextApptStartDateTime = DateUtil.convertToDate(dateFormat.format(nextApptDate).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date nextApptEndDateTime = DateUtil.convertToDate(dateFormat.format(nextApptDate).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - nextAppointment.setUuid(enc.getUuid()); - nextAppointment.setPatient(enc.getPatient()); - nextAppointment.setService(appointmentServiceDefinition); - nextAppointment.setStartDateTime(nextApptStartDateTime); - nextAppointment.setEndDateTime(nextApptEndDateTime); - nextAppointment.setLocation(enc.getLocation()); - nextAppointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - nextAppointment.setAppointmentKind(AppointmentKind.Scheduled); - Appointment app = appointmentsService.validateAndSave(nextAppointment); - } - - // create appointment for drug refill - if (refillApptDate != null && nextApptDate != null && appointmentReason == 160521 && - appointmentServiceDefinitionService.getAppointmentServiceByUuid(DRUG_REFILL_SERVICE) != null ) { - AppointmentServiceDefinition refillApptServiceDefinition = new AppointmentServiceDefinition(); - refillApptServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(DRUG_REFILL_SERVICE).getId()); - Appointment currentFollowUpAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - Appointment refillAppointment = new Appointment(); - Date refillStartDateTime = DateUtil.convertToDate(dateFormat.format(refillApptDate).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date refillEndDateTime = DateUtil.convertToDate(dateFormat.format(refillApptDate).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - refillAppointment.setRelatedAppointment(currentFollowUpAppointment); - refillAppointment.setPatient(enc.getPatient()); - refillAppointment.setService(refillApptServiceDefinition); - refillAppointment.setStartDateTime(refillStartDateTime); - refillAppointment.setEndDateTime(refillEndDateTime); - refillAppointment.setLocation(enc.getLocation()); - refillAppointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - refillAppointment.setAppointmentKind(AppointmentKind.Scheduled); - Appointment app = appointmentsService.validateAndSave(refillAppointment); - - if (currentFollowUpAppointment != null ) { - currentFollowUpAppointment.setRelatedAppointment(app); - Appointment app2 = appointmentsService.validateAndSave(currentFollowUpAppointment); - } - } - - } else if ( appointmentReason != null && appointmentReason == 1283) { - // create lab tests appointment - if ( appointmentServiceDefinitionService.getAppointmentServiceByUuid(HIV_LAB_TEST_SERVICE) != null && nextApptDate != null ) { - AppointmentServiceDefinition labApptServiceDefinition = new AppointmentServiceDefinition(); - labApptServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(HIV_LAB_TEST_SERVICE).getId()); - Date labApptStartDateTime = DateUtil.convertToDate(dateFormat.format(nextApptDate).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date labApptEndDateTime = DateUtil.convertToDate(dateFormat.format(nextApptDate).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - Appointment labAppointment = new Appointment(); - labAppointment.setUuid(enc.getUuid()); - labAppointment.setPatient(enc.getPatient()); - labAppointment.setService(labApptServiceDefinition); - labAppointment.setStartDateTime(labApptStartDateTime); - labAppointment.setEndDateTime(labApptEndDateTime); - labAppointment.setLocation(enc.getLocation()); - labAppointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - labAppointment.setAppointmentKind(AppointmentKind.Scheduled); - Appointment app = appointmentsService.validateAndSave(labAppointment); - } - } - - } - - } - - /** - * Create and edit PREP or TB or KP appointments - * Create MCH appointments - */ - private void processProgramAppointments(Encounter enc) throws Throwable { - // MCH or PREP or TB or KP appointment - List obs = obsService.getObservations( - Arrays.asList(personService.getPerson(enc.getPatient().getPersonId())), - Arrays.asList(enc), - Arrays.asList( - conceptService.getConceptByUuid(NEXT_CLINICAL_APPOINTMENT_DATE_CONCEPT_UUID) - ), - null, - null, - null, - null, - null, - null, - null, - null, - false - ); - - for (Obs o : obs) { // Loop through the obs and compose Appointment object for Bahmni - AppointmentServiceDefinition appointmentServiceDefinition = new AppointmentServiceDefinition(); - Appointment editAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - - if(editAppointment != null) { - //edit MCH or PREP or TB or KP appointment - Date nextApptStartDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date nextApptEndDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - editAppointment.setStartDateTime(nextApptStartDateTime); - editAppointment.setEndDateTime(nextApptEndDateTime); - Appointment app = appointmentsService.validateAndSave(editAppointment); - - } else { - // create MCH or TB or KP or PREP appointment - if (enc.getForm() != null && enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_ANTENATAL_VISIT) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(MCH_ANTENATAL_VISIT_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(MCH_ANTENATAL_VISIT_SERVICE).getId()); - } else if (enc.getForm() != null && enc.getForm().getUuid().equals(MchMetadata._Form.MCHCS_FOLLOW_UP) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(CWC_FOLLOWUP_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(CWC_FOLLOWUP_SERVICE).getId()); - } else if (enc.getForm() != null && enc.getForm().getUuid().equals(PREP_INITIAL_FORM) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(PREP_INITIAL_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(PREP_INITIAL_SERVICE).getId()); - } else if (enc.getForm() != null && enc.getForm().getUuid().equals(PREP_FOLLOWUP_FORM) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(PREP_FOLLOWUP_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(PREP_FOLLOWUP_SERVICE).getId()); - } else if (enc.getForm() != null && enc.getForm().getUuid().equals(PREP_MONTHLY_REFILL_FORM) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(PREP_MONTHLY_REFILL_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(PREP_MONTHLY_REFILL_SERVICE).getId()); - } else if (enc.getForm() != null && enc.getForm().getUuid().equals(TbMetadata._Form.TB_FOLLOW_UP) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(TB_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(TB_SERVICE).getId()); - } else if (enc.getForm() != null && enc.getForm().getUuid().equals(KP_CLINICAL_VISIT_FORM) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(KP_CLINICAL_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(KP_CLINICAL_SERVICE).getId()); - } else if (enc.getForm() != null && enc.getForm().getUuid().equals(HivMetadata._Form.FAST_TRACK) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(DRUG_REFILL_SERVICE) != null) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(DRUG_REFILL_SERVICE).getId()); - } else { - return; - } - Appointment appointment = new Appointment(); - Date appointmentStartDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date appointmentEndDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - appointment.setUuid(enc.getUuid()); - appointment.setPatient(enc.getPatient()); - appointment.setService(appointmentServiceDefinition); - appointment.setStartDateTime(appointmentStartDateTime); - appointment.setEndDateTime(appointmentEndDateTime); - appointment.setLocation(enc.getLocation()); - appointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - appointment.setAppointmentKind(AppointmentKind.Scheduled); - Appointment app = appointmentsService.validateAndSave(appointment); - - } - } - } - - /** - * Edit the mother and baby appointments which are related - */ - private void processMCHEncounter(Encounter enc) throws Throwable { - //MCH appointments - List obs = obsService.getObservations( - Arrays.asList(personService.getPerson(enc.getPatient().getPersonId())), - Arrays.asList(enc), - Arrays.asList( - conceptService.getConceptByUuid(NEXT_CLINICAL_APPOINTMENT_DATE_CONCEPT_UUID) - ), - null, - null, - null, - null, - null, - null, - null, - null, - false - ); - - for (Obs o : obs) { // Loop through the obs and compose Appointment object for Bahmni - Date nextApptStartDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T07:00:00.0Z"), DateUtil.DateFormatType.UTC); - Date nextApptEndDateTime = DateUtil.convertToDate(dateFormat.format(o.getValueDatetime()).concat("T20:00:00.0Z"), DateUtil.DateFormatType.UTC); - Appointment editAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - - if (editAppointment != null) { - AppointmentServiceDefinition appointmentServiceDefinition = new AppointmentServiceDefinition(); - Appointment postNatalAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - Appointment cwcFollowUpAppointment = postNatalAppointment.getRelatedAppointment(); - - if(postNatalAppointment != null) { - postNatalAppointment.setStartDateTime(nextApptStartDateTime); - postNatalAppointment.setEndDateTime(nextApptEndDateTime); - Appointment app = appointmentsService.validateAndSave(postNatalAppointment); - } - if(cwcFollowUpAppointment != null) { - cwcFollowUpAppointment.setStartDateTime(nextApptEndDateTime); - cwcFollowUpAppointment.setEndDateTime(nextApptEndDateTime); - Appointment app2 = appointmentsService.validateAndSave(cwcFollowUpAppointment); - } - if(postNatalAppointment != null && cwcFollowUpAppointment == null && appointmentServiceDefinitionService.getAppointmentServiceByUuid(MCH_POSTNATAL_VISIT_SERVICE) != null ) { - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(CWC_FOLLOWUP_SERVICE).getId()); - List children = EmrUtils.getPersonChildren(enc.getPatient()); - for (Person child : children) { - int ageYears = child.getAge(); - int id = child.getId(); - PatientService patientService = Context.getPatientService(); - Patient patient = patientService.getPatient(id); - // add mothers appointment for all children who are HEI - if (ageYears <= 2) { - Appointment followUpAppointment = new Appointment(); - followUpAppointment.setPatient(patient); - followUpAppointment.setService(appointmentServiceDefinition); - followUpAppointment.setStartDateTime(nextApptStartDateTime); - followUpAppointment.setEndDateTime(nextApptEndDateTime); - followUpAppointment.setLocation(enc.getLocation()); - followUpAppointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - followUpAppointment.setAppointmentKind(AppointmentKind.Scheduled); - cwcFollowUpAppointment.setRelatedAppointment(postNatalAppointment); - Appointment app3 = appointmentsService.validateAndSave(followUpAppointment); - - postNatalAppointment.setRelatedAppointment(app3); - Appointment app4 = appointmentsService.validateAndSave(postNatalAppointment); - } - } - } - } - - // create MCH postnatal appointment - if (editAppointment == null && enc.getForm() != null && (enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_POSTNATAL_VISIT) || enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_DELIVERY)) && appointmentServiceDefinitionService.getAppointmentServiceByUuid(MCH_POSTNATAL_VISIT_SERVICE) != null) { - Appointment mchPostnatalAppointment = new Appointment(); - - if(enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_POSTNATAL_VISIT) || enc.getForm().getUuid().equals(MchMetadata._Form.MCHMS_DELIVERY)) { - nxtAppointment = true; - AppointmentServiceDefinition appointmentServiceDefinition = new AppointmentServiceDefinition(); - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(MCH_POSTNATAL_VISIT_SERVICE).getId()); - - mchPostnatalAppointment.setUuid(enc.getUuid()); - mchPostnatalAppointment.setPatient(enc.getPatient()); - mchPostnatalAppointment.setService(appointmentServiceDefinition); - mchPostnatalAppointment.setStartDateTime(nextApptStartDateTime); - mchPostnatalAppointment.setEndDateTime(nextApptEndDateTime); - mchPostnatalAppointment.setLocation(enc.getLocation()); - mchPostnatalAppointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - mchPostnatalAppointment.setAppointmentKind(AppointmentKind.Scheduled); - } - - if(nxtAppointment) { - Appointment app = appointmentsService.validateAndSave(mchPostnatalAppointment); - } - if(appointmentServiceDefinitionService.getAppointmentServiceByUuid(CWC_FOLLOWUP_SERVICE) != null) { - // create CWC followup appointment for child - List children = EmrUtils.getPersonChildren(enc.getPatient()); - for(Person child : children) { - int ageYears = child.getAge(); - int id = child.getId(); - PatientService patientService = Context.getPatientService(); - Patient patient = patientService.getPatient(id); - if(ageYears <= 2) { - AppointmentServiceDefinition appointmentServiceDefinition = new AppointmentServiceDefinition(); - appointmentServiceDefinition.setAppointmentServiceId(appointmentServiceDefinitionService.getAppointmentServiceByUuid(CWC_FOLLOWUP_SERVICE).getId()); - Appointment cwcFollowUpAppointment = new Appointment(); - Appointment relatedAppointment = appointmentsService.getAppointmentByUuid(enc.getUuid()); - cwcFollowUpAppointment.setRelatedAppointment(relatedAppointment); - cwcFollowUpAppointment.setPatient(patient); - cwcFollowUpAppointment.setService(appointmentServiceDefinition); - cwcFollowUpAppointment.setStartDateTime(nextApptStartDateTime); - cwcFollowUpAppointment.setEndDateTime(nextApptEndDateTime); - cwcFollowUpAppointment.setLocation(enc.getLocation()); - cwcFollowUpAppointment.setProvider(EmrUtils.getProvider(Context.getAuthenticatedUser())); - cwcFollowUpAppointment.setAppointmentKind(AppointmentKind.Scheduled); - Appointment app2 = appointmentsService.validateAndSave(cwcFollowUpAppointment); - - relatedAppointment.setRelatedAppointment(app2); - Appointment app3 = appointmentsService.validateAndSave(relatedAppointment); - } - } - } - } - - } - } - - private String getAppointmentServiceUuidFromConcept( int conceptId) { - Map idToUuidMap = new HashMap(); - idToUuidMap.put(1283, "61488cf6-fad4-11ed-be56-0242ac120002"); // lab tests - idToUuidMap.put(160523, "885b4ad3-fd4c-4a16-8ed3-08813e6b01fa"); // HIV consultation - idToUuidMap.put(159382, "c6ce2119-c084-49c7-aa3f-be9fa1f3863e"); // Counselling - return idToUuidMap.get(conceptId); - - } -} \ No newline at end of file diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/NeedsNewVLOrderCalculation.java b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/NeedsNewVLOrderCalculation.java index 61c78f6a8c..a9896e0d1a 100755 --- a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/NeedsNewVLOrderCalculation.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/hiv/NeedsNewVLOrderCalculation.java @@ -60,7 +60,7 @@ public CalculationResultMap evaluate(Collection cohort, Map 0) { Integer latestVlOrder = Collections.max(vlOrders); if (dueForVl.contains(ptId) && orderService.getOrder(latestVlOrder).isVoided() - && (orderService.getOrder(latestVlOrder).getVoidReason().equalsIgnoreCase("Sample not taken") + && orderService.getOrder(latestVlOrder).getVoidReason() != null && (orderService.getOrder(latestVlOrder).getVoidReason().equalsIgnoreCase("Sample not taken") || orderService.getOrder(latestVlOrder).getVoidReason().equalsIgnoreCase("Collect new sample") || orderService.getOrder(latestVlOrder).getVoidReason().equalsIgnoreCase("Sample rejected") || orderService.getOrder(latestVlOrder).getVoidReason().equalsIgnoreCase("No reagents"))) { diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/surveillance/EligibleForCholeraCalculation.java b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/surveillance/EligibleForCholeraCalculation.java index 3af0edb78b..9d1d9cbce6 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/surveillance/EligibleForCholeraCalculation.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/calculation/library/surveillance/EligibleForCholeraCalculation.java @@ -49,8 +49,8 @@ public String getFlagMessage() { return "Suspected Cholera case"; } - Integer VOMITING = 122983; - Integer DIARRHEA = 142412; + Integer VOMITING = 122983; + Integer WATERY_DIARRHEA = 161887; Integer SCREENING_QUESTION = 5219; @Override @@ -71,7 +71,7 @@ public CalculationResultMap evaluate(Collection cohort, Map cohort, Map cohort, Map getGeneralOutPatientFilters() { "state=NEW|age=<5|gender=F", "03"); ColumnParameters under5FemaleRevisit = new ColumnParameters("over5FemaleRevisit", "below 5 and revisit", "state=RVT|age=<5|gender=F", "04"); - ColumnParameters over5MaleNew = new ColumnParameters("over5MaleNew", "above 5 and new", "state=NEW|age=>5|gender=M", + ColumnParameters over5MaleNew = new ColumnParameters("over5MaleNew", "above 5 and new", "state=NEW|age=5+|gender=M", "05"); ColumnParameters over5MaleRevisit = new ColumnParameters("over5MaleRevisit", "above 5 and revisit", - "state=RVT|age=>5|gender=M", "06"); + "state=RVT|age=5+|gender=M", "06"); ColumnParameters over5FemaleNew = new ColumnParameters("over5MaleNew", "above 5 and new", - "state=NEW|age=>5|gender=F", "07"); + "state=NEW|age=5+|gender=F", "07"); ColumnParameters over5FemaleRevisit = new ColumnParameters("over5MaleRevisit", "above 5 and revisit", - "state=RVT|age=>5|gender=F", "08"); - ColumnParameters over60New = new ColumnParameters("over60New", "above 60 and new", "state=NEW|age=>60", "09"); - ColumnParameters over60Revisit = new ColumnParameters("over60Revisit", "above 60 and revisit", "state=RVT|age=>60", + "state=RVT|age=5+|gender=F", "08"); + ColumnParameters over60New = new ColumnParameters("over60New", "above 60 and new", "state=NEW|age=60+", "09"); + ColumnParameters over60Revisit = new ColumnParameters("over60Revisit", "above 60 and revisit", "state=RVT|age=60+", "10"); return Arrays.asList(under5MaleNew, under5MaleRevisit, under5FemaleNew, under5FemaleRevisit, over5MaleNew, diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/Moh705ReportUtils/ReportingUtils.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/MohReportUtils/ReportingUtils.java similarity index 60% rename from api/src/main/java/org/openmrs/module/kenyaemr/reporting/Moh705ReportUtils/ReportingUtils.java rename to api/src/main/java/org/openmrs/module/kenyaemr/reporting/MohReportUtils/ReportingUtils.java index 6fbb15b4d4..ee959e3688 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/Moh705ReportUtils/ReportingUtils.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/MohReportUtils/ReportingUtils.java @@ -7,9 +7,10 @@ * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS * graphic logo is a trademark of OpenMRS Inc. */ -package org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils; +package org.openmrs.module.kenyaemr.reporting.MohReportUtils; import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition; import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; import org.openmrs.module.reporting.evaluation.parameter.Mapped; import org.openmrs.module.reporting.evaluation.parameter.Parameter; @@ -60,5 +61,40 @@ public static EncounterQuery getEncounterLimitsByDate() { query.setQuery("SELECT encounter_id FROM encounter WHERE encounter_datetime BETWEEN :startDate AND :endDate"); return query; } + + /** + * MOH705 + * New Attendances + * @return + */ + public static CohortDefinition newAttendances(String age) { + String sqlQuery = "SELECT v.patient_id FROM kenyaemr_etl.etl_clinical_encounter v\n" + + "INNER JOIN kenyaemr_etl.etl_patient_demographics d on v.patient_id = d.patient_id and timestampdiff(YEAR, date(d.dob),date(:endDate)) "+ age +"\n" + + "WHERE v.visit_type = 'New visit' and date(v.visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("newAttendances"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients who are new attendances"); + return cd; + } + /** + * MOH705 + * Re-Attendances + * @return + */ + public static CohortDefinition reAttendances(String age) { + String sqlQuery = "SELECT v.patient_id FROM kenyaemr_etl.etl_clinical_encounter v\n" + + "INNER JOIN kenyaemr_etl.etl_patient_demographics d on v.patient_id = d.patient_id and timestampdiff(YEAR, date(d.dob),date(:endDate)) "+ age +"\n" + + "WHERE v.visit_type = 'Revisit' and date(v.visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("reAttendances"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients who are revisit attendances"); + return cd; + } } diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/Moh705ReportUtils/RicketsDiagnosisConstants.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/MohReportUtils/RicketsDiagnosisConstants.java similarity index 96% rename from api/src/main/java/org/openmrs/module/kenyaemr/reporting/Moh705ReportUtils/RicketsDiagnosisConstants.java rename to api/src/main/java/org/openmrs/module/kenyaemr/reporting/MohReportUtils/RicketsDiagnosisConstants.java index 337a587f22..47282c85c9 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/Moh705ReportUtils/RicketsDiagnosisConstants.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/MohReportUtils/RicketsDiagnosisConstants.java @@ -7,7 +7,7 @@ * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS * graphic logo is a trademark of OpenMRS Inc. */ -package org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils; +package org.openmrs.module.kenyaemr.reporting.MohReportUtils; public class RicketsDiagnosisConstants { //Rickets diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/ActivePatientSnapshotReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/ActivePatientSnapshotReportBuilder.java index 11f70bf3d4..6cc704a6e8 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/ActivePatientSnapshotReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/ActivePatientSnapshotReportBuilder.java @@ -30,43 +30,10 @@ import org.openmrs.module.kenyaemr.reporting.cohort.definition.ActivePatientsSnapshotCohortDefinition; import org.openmrs.module.kenyaemr.reporting.data.converter.ActiveInProgramConverter; import org.openmrs.module.kenyaemr.reporting.data.converter.BooleanResultsConverter; +import org.openmrs.module.kenyaemr.reporting.data.converter.CalculationResultConverter; import org.openmrs.module.kenyaemr.reporting.data.converter.definition.ActivePatientsPopulationTypeDataDefinition; import org.openmrs.module.kenyaemr.reporting.data.converter.definition.MFLCodeDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ActiveInMchDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ActiveInOtzDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ActiveInOvcDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ActiveInTbDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.AgeAtReportingDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.BaselineCD4CountDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.BaselineCD4DateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.BloodPressureDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLArtStartDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLCaseManagerDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLCurrentRegLineDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLCurrentRegimenDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLDifferentiatedCareModelDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLFirstRegimenDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLHivSelfVisitDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastCD4DateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastCD4ResultDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastVLDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastVLJustificationDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastVLResultDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastVLResultValidityDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastVisitDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLLastWHOStageDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLMonthsOfPrescriptionDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLNextAppointmentDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLRefillDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.ETLStabilityDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.HeightAtArtDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.MedicalCoverDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.MedicalCoverStatusDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.NCDDateDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.NCDStatusDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.NCDsDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.WHOStageArtDataDefinition; -import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.WeightAtArtDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.*; import org.openmrs.module.metadatadeploy.MetadataUtils; import org.openmrs.module.reporting.cohort.definition.CohortDefinition; import org.openmrs.module.reporting.data.DataDefinition; @@ -201,6 +168,15 @@ protected PatientDataSetDefinition activePatientsDataSetDefinition(String datase lastCD4ResultDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); ETLLastCD4DateDataDefinition etlLastCD4DateDataDefinition = new ETLLastCD4DateDataDefinition(); etlLastCD4DateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + LastRiskScoreDataDefinition lastRiskScoreDataDefinition = new LastRiskScoreDataDefinition(); + lastRiskScoreDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + lastRiskScoreDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + LastRiskCategorizationDataDefinition lastRiskCategorizationDataDefinition = new LastRiskCategorizationDataDefinition(); + lastRiskCategorizationDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + lastRiskCategorizationDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + LastRiskEvaluationDateDataDefinition lastRiskEvaluationDateDataDefinition = new LastRiskEvaluationDateDataDefinition(); + lastRiskEvaluationDateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + lastRiskEvaluationDateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); DataConverter formatter = new ObjectFormatter("{familyName}, {givenName}"); @@ -256,6 +232,10 @@ protected PatientDataSetDefinition activePatientsDataSetDefinition(String datase dsd.addColumn("AHD Client", new CalculationDataDefinition("AHD Client", new PatientsWithAdvancedHivDiseaseCalculation()), "", new BooleanResultsConverter()); dsd.addColumn("Medical cover", medicalCoverDataDefinition, "endDate=${endDate}"); dsd.addColumn("Medical cover status", medicalCoverStatusDataDefinition, "endDate=${endDate}"); + dsd.addColumn("Last risk score", lastRiskScoreDataDefinition, "endDate=${endDate}"); + dsd.addColumn("Risk categorization", lastRiskCategorizationDataDefinition, "endDate=${endDate}"); + dsd.addColumn("Evaluation date", lastRiskEvaluationDateDataDefinition, "endDate=${endDate}"); + return dsd; diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH204AReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH204AReportBuilder.java new file mode 100644 index 0000000000..d76399e399 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH204AReportBuilder.java @@ -0,0 +1,190 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.builder.common; + +import org.openmrs.PatientIdentifierType; +import org.openmrs.PersonAttributeType; +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyacore.report.data.patient.definition.CalculationDataDefinition; +import org.openmrs.module.kenyaemr.calculation.library.hiv.CountyAddressCalculation; +import org.openmrs.module.kenyaemr.calculation.library.hiv.SubCountyAddressCalculation; +import org.openmrs.module.kenyaemr.calculation.library.mchcs.PersonAddressCalculation; +import org.openmrs.module.kenyaemr.metadata.CommonMetadata; +import org.openmrs.module.kenyaemr.metadata.HivMetadata; +import org.openmrs.module.kenyaemr.reporting.calculation.converter.RDQACalculationResultConverter; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH204ARegisterCohortDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.CalculationResultConverter; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.HTSRemarksDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.*; +import org.openmrs.module.metadatadeploy.MetadataUtils; +import org.openmrs.module.reporting.common.SortCriteria; +import org.openmrs.module.reporting.data.DataDefinition; +import org.openmrs.module.reporting.data.converter.BirthdateConverter; +import org.openmrs.module.reporting.data.converter.DataConverter; +import org.openmrs.module.reporting.data.converter.DateConverter; +import org.openmrs.module.reporting.data.converter.ObjectFormatter; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDatetimeDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.ConvertedPatientDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.PatientIdDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.PatientIdentifierDataDefinition; +import org.openmrs.module.reporting.data.person.definition.*; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.EncounterDataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +@Component +@Builds({"kenyaemr.ehrReports.report.moh204A"}) +public class MOH204AReportBuilder extends AbstractReportBuilder { + public static final String ENC_DATE_FORMAT = "yyyy/MM/dd"; + public static final String DATE_FORMAT = "dd/MM/yyyy"; + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList( + new Parameter("startDate", "Start Date", Date.class), + new Parameter("endDate", "End Date", Date.class), + new Parameter("dateBasedReporting", "", String.class) + ); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, ReportDefinition reportDefinition) { + return Arrays.asList( + ReportUtils.map(datasetColumns(), "startDate=${startDate},endDate=${endDate}") + ); + } + + protected DataSetDefinition datasetColumns() { + EncounterDataSetDefinition dsd = new EncounterDataSetDefinition(); + dsd.setName("MOH204A"); + dsd.setDescription("OPD Visit information"); + dsd.addSortCriteria("Visit Date", SortCriteria.SortDirection.ASC); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + + String paramMapping = "startDate=${startDate},endDate=${endDate}"; + + DataConverter nameFormatter = new ObjectFormatter("{familyName}, {givenName} {middleName}"); + DataDefinition nameDef = new ConvertedPersonDataDefinition("name", new PreferredNameDataDefinition(), nameFormatter); + PatientIdentifierType pcn = MetadataUtils.existing(PatientIdentifierType.class, CommonMetadata._PatientIdentifierType.PATIENT_CLINIC_NUMBER); + DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); + DataDefinition patientClinicNo = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition(pcn.getName(), pcn), identifierFormatter); + + OPDHeightDataDefinition opdHeightDataDefinition = new OPDHeightDataDefinition(); + opdHeightDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdHeightDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDWeightDataDefinition opdWeightDataDefinition = new OPDWeightDataDefinition(); + opdWeightDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdWeightDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDMuacDataDefinition opdMuacDataDefinition = new OPDMuacDataDefinition(); + opdMuacDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdMuacDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDTemperatureDataDefinition opdTemperatureDataDefinition = new OPDTemperatureDataDefinition(); + opdTemperatureDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdTemperatureDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDRespiratoryRateDataDefinition opdRespiratoryRateDataDefinition = new OPDRespiratoryRateDataDefinition(); + opdRespiratoryRateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdRespiratoryRateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDOxygenSaturationDataDefinition opdOxygenSaturationDataDefinition = new OPDOxygenSaturationDataDefinition(); + opdOxygenSaturationDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdOxygenSaturationDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDPulseRateDataDefinition opdPulseRateDataDefinition = new OPDPulseRateDataDefinition(); + opdPulseRateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdPulseRateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDDangerSignsDataDefinition opdDangerSignsDataDefinition = new OPDDangerSignsDataDefinition(); + opdDangerSignsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdDangerSignsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDComplaintDurationDataDefinition opdComplaintDurationDataDefinition = new OPDComplaintDurationDataDefinition(); + opdComplaintDurationDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdComplaintDurationDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDMalariaAssessmentDataDefinition opdMalariaAssessmentDataDefinition = new OPDMalariaAssessmentDataDefinition(); + opdMalariaAssessmentDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdMalariaAssessmentDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDDiagnosisDataDefinition opdDiagnosisDataDefinition = new OPDDiagnosisDataDefinition(); + opdDiagnosisDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdDiagnosisDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDTracerDrugsPrescribedDataDefinition opdTracerDrugsPrescribedDataDefinition = new OPDTracerDrugsPrescribedDataDefinition(); + opdTracerDrugsPrescribedDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdTracerDrugsPrescribedDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDNonTracerDrugsPrescribedDataDefinition opdNonTracerDrugsPrescribedDataDefinition = new OPDNonTracerDrugsPrescribedDataDefinition(); + opdNonTracerDrugsPrescribedDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdNonTracerDrugsPrescribedDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDImmunizationStatusDataDefinition opdImmunizationStatusDataDefinition = new OPDImmunizationStatusDataDefinition(); + opdImmunizationStatusDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdImmunizationStatusDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDTbScreeningDataDefinition opdTbScreeningDataDefinition = new OPDTbScreeningDataDefinition(); + opdTbScreeningDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdTbScreeningDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDNutritionalInterventionsDataDefinition opdNutritionalInterventionsDataDefinition = new OPDNutritionalInterventionsDataDefinition(); + opdNutritionalInterventionsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdNutritionalInterventionsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDReferredToDataDefinition opdReferredToDataDefinition = new OPDReferredToDataDefinition(); + opdReferredToDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdReferredToDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDReferredFromDataDefinition opdReferredFromDataDefinition = new OPDReferredFromDataDefinition(); + opdReferredFromDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdReferredFromDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDOutcomeDataDefinition opdOutcomeDataDefinition = new OPDOutcomeDataDefinition(); + opdOutcomeDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdOutcomeDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + + PersonAttributeType phoneNumber = MetadataUtils.existing(PersonAttributeType.class, CommonMetadata._PersonAttributeType.TELEPHONE_CONTACT); + + dsd.addColumn("Name", nameDef, ""); + dsd.addColumn("id", new PatientIdDataDefinition(), ""); + dsd.addColumn("Visit Date", new EncounterDatetimeDataDefinition(),"", new DateConverter(ENC_DATE_FORMAT)); + dsd.addColumn("Age", new AgeDataDefinition(), ""); + dsd.addColumn("Sex", new GenderDataDefinition(), ""); + dsd.addColumn("Parent/Caregiver Telephone No", new PersonAttributeDataDefinition(phoneNumber), ""); + dsd.addColumn("Visit Date", new EncounterDatetimeDataDefinition(),"", new DateConverter(ENC_DATE_FORMAT)); + dsd.addColumn("OPD Number (New)", patientClinicNo, ""); + //dsd.addColumn("OPD Number (Revisit)", patientClinicNo, ""); //TODO:Determine revisit vs new visit + dsd.addColumn("Referred From", opdReferredFromDataDefinition, paramMapping); + dsd.addColumn("County",new CalculationDataDefinition("County", new CountyAddressCalculation()), "",new CalculationResultConverter()); + dsd.addColumn("Sub County", new CalculationDataDefinition("Subcounty", new SubCountyAddressCalculation()), "",new CalculationResultConverter()); + dsd.addColumn("Village", new CalculationDataDefinition("Village/Estate/Landmark", new PersonAddressCalculation()), "",new RDQACalculationResultConverter()); + dsd.addColumn("Weight", opdWeightDataDefinition, paramMapping); + dsd.addColumn("Height", opdHeightDataDefinition, paramMapping); + dsd.addColumn("Muac", opdMuacDataDefinition, paramMapping); + dsd.addColumn("Temperature",opdTemperatureDataDefinition, paramMapping); + dsd.addColumn("Respiratory Rate",opdRespiratoryRateDataDefinition, paramMapping); + dsd.addColumn("Oxygen Saturation (SPO2)",opdOxygenSaturationDataDefinition, paramMapping); + dsd.addColumn("Pulse Rate",opdPulseRateDataDefinition, paramMapping); + dsd.addColumn("Danger signs",opdDangerSignsDataDefinition, paramMapping); + dsd.addColumn("Duration",opdComplaintDurationDataDefinition, paramMapping); + dsd.addColumn("Malaria",opdMalariaAssessmentDataDefinition, paramMapping); + dsd.addColumn("IMNCI Classification Diagnosis",opdDiagnosisDataDefinition, paramMapping); + dsd.addColumn("Tracer Drugs Prescribed",opdTracerDrugsPrescribedDataDefinition, paramMapping); + dsd.addColumn("Other Treatments Prescribed",opdNonTracerDrugsPrescribedDataDefinition, paramMapping); + dsd.addColumn("Immunization Status Up to Date",opdImmunizationStatusDataDefinition, paramMapping); + dsd.addColumn("TB Screening",opdTbScreeningDataDefinition, paramMapping); + dsd.addColumn("Nutrition Interventions",opdNutritionalInterventionsDataDefinition, paramMapping); //TODO: missing 2=Nutrition therapeutic supplements and 3=Diatetics + dsd.addColumn("Referred to",opdNutritionalInterventionsDataDefinition, paramMapping); //TODO: missing 1=Community Unit + dsd.addColumn("Remarks/Outcome",opdOutcomeDataDefinition, paramMapping); + + MOH204ARegisterCohortDefinition cd = new MOH204ARegisterCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + + dsd.addRowFilter(cd, paramMapping); + return dsd; + + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH204BReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH204BReportBuilder.java new file mode 100644 index 0000000000..72dda77493 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH204BReportBuilder.java @@ -0,0 +1,162 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.builder.common; + +import org.openmrs.PatientIdentifierType; +import org.openmrs.PersonAttributeType; +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyacore.report.data.patient.definition.CalculationDataDefinition; +import org.openmrs.module.kenyaemr.calculation.library.hiv.CountyAddressCalculation; +import org.openmrs.module.kenyaemr.calculation.library.hiv.SubCountyAddressCalculation; +import org.openmrs.module.kenyaemr.calculation.library.mchcs.PersonAddressCalculation; +import org.openmrs.module.kenyaemr.metadata.CommonMetadata; +import org.openmrs.module.kenyaemr.reporting.calculation.converter.RDQACalculationResultConverter; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH204ARegisterCohortDefinition; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH204BRegisterCohortDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.CalculationResultConverter; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.BloodPressureDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.*; +import org.openmrs.module.metadatadeploy.MetadataUtils; +import org.openmrs.module.reporting.common.SortCriteria; +import org.openmrs.module.reporting.data.DataDefinition; +import org.openmrs.module.reporting.data.converter.DataConverter; +import org.openmrs.module.reporting.data.converter.DateConverter; +import org.openmrs.module.reporting.data.converter.ObjectFormatter; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDatetimeDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.ConvertedPatientDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.PatientIdDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.PatientIdentifierDataDefinition; +import org.openmrs.module.reporting.data.person.definition.*; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.EncounterDataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +@Component +@Builds({"kenyaemr.ehrReports.report.moh204B"}) +public class MOH204BReportBuilder extends AbstractReportBuilder { + public static final String ENC_DATE_FORMAT = "yyyy/MM/dd"; + public static final String DATE_FORMAT = "dd/MM/yyyy"; + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList( + new Parameter("startDate", "Start Date", Date.class), + new Parameter("endDate", "End Date", Date.class), + new Parameter("dateBasedReporting", "", String.class) + ); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, ReportDefinition reportDefinition) { + return Arrays.asList( + ReportUtils.map(datasetColumns(), "startDate=${startDate},endDate=${endDate}") + ); + } + + protected DataSetDefinition datasetColumns() { + EncounterDataSetDefinition dsd = new EncounterDataSetDefinition(); + dsd.setName("MOH204B"); + dsd.setDescription("OPD Visit information"); + dsd.addSortCriteria("Visit Date", SortCriteria.SortDirection.ASC); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + + String paramMapping = "startDate=${startDate},endDate=${endDate}"; + + DataConverter nameFormatter = new ObjectFormatter("{familyName}, {givenName} {middleName}"); + DataDefinition nameDef = new ConvertedPersonDataDefinition("name", new PreferredNameDataDefinition(), nameFormatter); + PatientIdentifierType pcn = MetadataUtils.existing(PatientIdentifierType.class, CommonMetadata._PatientIdentifierType.PATIENT_CLINIC_NUMBER); + DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); + DataDefinition patientClinicNo = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition(pcn.getName(), pcn), identifierFormatter); + + OPDHeightDataDefinition opdHeightDataDefinition = new OPDHeightDataDefinition(); + opdHeightDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdHeightDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDWeightDataDefinition opdWeightDataDefinition = new OPDWeightDataDefinition(); + opdWeightDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdWeightDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDTemperatureDataDefinition opdTemperatureDataDefinition = new OPDTemperatureDataDefinition(); + opdTemperatureDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdTemperatureDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDMalariaAssessmentDataDefinition opdMalariaAssessmentDataDefinition = new OPDMalariaAssessmentDataDefinition(); + opdMalariaAssessmentDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdMalariaAssessmentDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDTreatmentPrescribedDataDefinition opdTreatmentPrescribedDataDefinition = new OPDTreatmentPrescribedDataDefinition(); + opdTreatmentPrescribedDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdTreatmentPrescribedDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDTbScreeningDataDefinition opdTbScreeningDataDefinition = new OPDTbScreeningDataDefinition(); + opdTbScreeningDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdTbScreeningDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDReferredToDataDefinition opdReferredToDataDefinition = new OPDReferredToDataDefinition(); + opdReferredToDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdReferredToDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDReferredFromDataDefinition opdReferredFromDataDefinition = new OPDReferredFromDataDefinition(); + opdReferredFromDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdReferredFromDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDOutcomeDataDefinition opdOutcomeDataDefinition = new OPDOutcomeDataDefinition(); + opdOutcomeDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdOutcomeDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDBMIDataDefinition opdBMIDataDefinition = new OPDBMIDataDefinition(); + opdBMIDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdBMIDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDBloodPressureDataDefinition opdBloodPressureDataDefinition = new OPDBloodPressureDataDefinition(); + opdBloodPressureDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdBloodPressureDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDDiagnosisDataDefinition opdDiagnosisDataDefinition = new OPDDiagnosisDataDefinition(); + opdDiagnosisDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdDiagnosisDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + + PersonAttributeType phoneNumber = MetadataUtils.existing(PersonAttributeType.class, CommonMetadata._PersonAttributeType.TELEPHONE_CONTACT); + + dsd.addColumn("Name", nameDef, ""); + dsd.addColumn("id", new PatientIdDataDefinition(), ""); + dsd.addColumn("Visit Date", new EncounterDatetimeDataDefinition(),"", new DateConverter(ENC_DATE_FORMAT)); + dsd.addColumn("Age", new AgeDataDefinition(), ""); + dsd.addColumn("Sex", new GenderDataDefinition(), ""); + dsd.addColumn("Parent/Caregiver Telephone No", new PersonAttributeDataDefinition(phoneNumber), ""); + dsd.addColumn("Visit Date", new EncounterDatetimeDataDefinition(),"", new DateConverter(ENC_DATE_FORMAT)); + dsd.addColumn("OPD Number (New)", patientClinicNo, ""); + //dsd.addColumn("OPD Number (Revisit)", patientClinicNo, ""); //TODO:Determine revisit vs new visit + dsd.addColumn("Referred From", opdReferredFromDataDefinition, paramMapping); + dsd.addColumn("County",new CalculationDataDefinition("County", new CountyAddressCalculation()), "",new CalculationResultConverter()); + dsd.addColumn("Sub County", new CalculationDataDefinition("Subcounty", new SubCountyAddressCalculation()), "",new CalculationResultConverter()); + dsd.addColumn("Village", new CalculationDataDefinition("Village/Estate/Landmark", new PersonAddressCalculation()), "",new RDQACalculationResultConverter()); + dsd.addColumn("Weight", opdWeightDataDefinition, paramMapping); + dsd.addColumn("Height", opdHeightDataDefinition, paramMapping); + dsd.addColumn("BMI", opdBMIDataDefinition, paramMapping); + dsd.addColumn("Temperature",opdTemperatureDataDefinition, paramMapping); + dsd.addColumn("Blood Pressure", opdBloodPressureDataDefinition, paramMapping); + //dsd.addColumn("Visual Acuity", opdBloodPressureDataDefinition, paramMapping); //TODO: Determine how to get visual acuity. Is this an examination + dsd.addColumn("TB Screening",opdTbScreeningDataDefinition, paramMapping); + dsd.addColumn("Malaria",opdMalariaAssessmentDataDefinition, paramMapping); + dsd.addColumn("Diagnosis",opdDiagnosisDataDefinition, paramMapping); //TODO: Add all diagnosis + dsd.addColumn("Treatments Prescribed",opdTreatmentPrescribedDataDefinition, paramMapping); + dsd.addColumn("Referred to",opdReferredToDataDefinition, paramMapping); //TODO: missing 1=Community Unit + dsd.addColumn("Remarks/Outcome",opdOutcomeDataDefinition, paramMapping); + + MOH204BRegisterCohortDefinition cd = new MOH204BRegisterCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + + dsd.addRowFilter(cd, paramMapping); + return dsd; + + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH240LabReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH240LabReportBuilder.java new file mode 100644 index 0000000000..36cad609f0 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH240LabReportBuilder.java @@ -0,0 +1,170 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.builder.common; + +import org.openmrs.PatientIdentifierType; +import org.openmrs.PersonAttributeType; +import org.openmrs.api.context.Context; +import org.openmrs.module.kenyacore.report.HybridReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractHybridReportBuilder; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyacore.report.data.patient.definition.CalculationDataDefinition; +import org.openmrs.module.kenyaemr.calculation.library.hiv.CountyAddressCalculation; +import org.openmrs.module.kenyaemr.calculation.library.hiv.SubCountyAddressCalculation; +import org.openmrs.module.kenyaemr.calculation.library.mchcs.PersonAddressCalculation; +import org.openmrs.module.kenyaemr.metadata.CommonMetadata; +import org.openmrs.module.kenyaemr.reporting.calculation.converter.RDQACalculationResultConverter; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH204BRegisterCohortDefinition; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH240LabRegisterCohortDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.CalculationResultConverter; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.HTSProviderDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.*; +import org.openmrs.module.metadatadeploy.MetadataUtils; +import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition; +import org.openmrs.module.reporting.common.SortCriteria; +import org.openmrs.module.reporting.data.DataDefinition; +import org.openmrs.module.reporting.data.converter.BirthdateConverter; +import org.openmrs.module.reporting.data.converter.DataConverter; +import org.openmrs.module.reporting.data.converter.DateConverter; +import org.openmrs.module.reporting.data.converter.ObjectFormatter; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDatetimeDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.ConvertedPatientDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.PatientIdDataDefinition; +import org.openmrs.module.reporting.data.patient.definition.PatientIdentifierDataDefinition; +import org.openmrs.module.reporting.data.person.definition.*; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.EncounterDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.PatientDataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +@Component +@Builds({ "kenyaemr.ehrReports.report.240" }) +public class MOH240LabReportBuilder extends AbstractReportBuilder { + public static final String ENC_DATE_FORMAT = "yyyy/MM/dd"; + public static final String DATE_FORMAT = "dd/MM/yyyy"; + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList( + new Parameter("startDate", "Start Date", Date.class), + new Parameter("endDate", "End Date", Date.class), + new Parameter("dateBasedReporting", "", String.class) + ); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, ReportDefinition reportDefinition) { + return Arrays.asList( + ReportUtils.map(datasetColumns(), "startDate=${startDate},endDate=${endDate}") + ); + } + + protected DataSetDefinition datasetColumns() { + EncounterDataSetDefinition dsd = new EncounterDataSetDefinition(); + dsd.setName("MOH240"); + dsd.setDescription("OPD Lab Visit information"); + dsd.addSortCriteria("Visit Date", SortCriteria.SortDirection.ASC); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + + String paramMapping = "startDate=${startDate},endDate=${endDate}"; + + DataConverter nameFormatter = new ObjectFormatter("{familyName}, {givenName} {middleName}"); + DataDefinition nameDef = new ConvertedPersonDataDefinition("name", new PreferredNameDataDefinition(), nameFormatter); + PatientIdentifierType pcn = MetadataUtils.existing(PatientIdentifierType.class, CommonMetadata._PatientIdentifierType.PATIENT_CLINIC_NUMBER); + DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); + DataDefinition patientClinicNo = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition(pcn.getName(), pcn), identifierFormatter); + + OPDDateSampleCollectedDataDefinition opdDateSampleCollectedDataDefinition = new OPDDateSampleCollectedDataDefinition(); + opdDateSampleCollectedDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdDateSampleCollectedDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDDateSampleReceivedDataDefinition opdDateSampleReceivedDataDefinition = new OPDDateSampleReceivedDataDefinition(); + opdDateSampleReceivedDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdDateSampleReceivedDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDLabResultsDataDefinition opdLabResultsDataDefinition = new OPDLabResultsDataDefinition(); + opdLabResultsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdLabResultsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDLabResultsDateDataDefinition opdLabResultsDateDataDefinition = new OPDLabResultsDateDataDefinition(); + opdLabResultsDateDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdLabResultsDateDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDClinicalDiagnosisDataDefinition opdClinicalDiagnosisDataDefinition = new OPDClinicalDiagnosisDataDefinition(); + opdClinicalDiagnosisDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdClinicalDiagnosisDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDPriorTreatmentsPrescribedDataDefinition opdPriorTreatmentsPrescribedDataDefinition = new OPDPriorTreatmentsPrescribedDataDefinition(); + opdPriorTreatmentsPrescribedDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdPriorTreatmentsPrescribedDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDLabReferralsDataDefinition opdLabReferralsDataDefinition = new OPDLabReferralsDataDefinition(); + opdLabReferralsDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdLabReferralsDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDLabRemarksDataDefinition opdLabRemarksDataDefinition = new OPDLabRemarksDataDefinition(); + opdLabRemarksDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdLabRemarksDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + OPDInvestigationRequiredDataDefinition opdInvestigationRequiredDataDefinition = new OPDInvestigationRequiredDataDefinition(); + opdInvestigationRequiredDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + opdInvestigationRequiredDataDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + + + PersonAttributeType phoneNumber = MetadataUtils.existing(PersonAttributeType.class, CommonMetadata._PersonAttributeType.TELEPHONE_CONTACT); + + dsd.addColumn("Name", nameDef, ""); + dsd.addColumn("id", new PatientIdDataDefinition(), ""); + dsd.addColumn("Visit Date", new EncounterDatetimeDataDefinition(),"", new DateConverter(ENC_DATE_FORMAT)); + dsd.addColumn("OPD Reference No", patientClinicNo, ""); + dsd.addColumn("Age", new AgeDataDefinition(), ""); + dsd.addColumn("Sex", new GenderDataDefinition(), ""); + dsd.addColumn("Telephone No", new PersonAttributeDataDefinition(phoneNumber), ""); + dsd.addColumn("Visit Date", new EncounterDatetimeDataDefinition(),"", new DateConverter(ENC_DATE_FORMAT)); + dsd.addColumn("County",new CalculationDataDefinition("County", new CountyAddressCalculation()), "",new CalculationResultConverter()); + dsd.addColumn("Sub County", new CalculationDataDefinition("Subcounty", new SubCountyAddressCalculation()), "",new CalculationResultConverter()); + dsd.addColumn("Village", new CalculationDataDefinition("Village/Estate/Landmark", new PersonAddressCalculation()), "",new RDQACalculationResultConverter()); + + dsd.addColumn("Revisit", patientClinicNo, ""); + // dsd.addColumn("Lab Number", opdLabNumberDataDefinition, paramMapping); //TODO: missing as Specimen ID + dsd.addColumn("Clinical Diagnosis",opdClinicalDiagnosisDataDefinition, paramMapping); + dsd.addColumn("Prior Treatment",opdPriorTreatmentsPrescribedDataDefinition, paramMapping); + //dsd.addColumn("Type of Specimen",opdTreatmentPrescribedDataDefinition, paramMapping); //TODO: missing Specimen Type + //dsd.addColumn("Condition of Specimen",opdTreatmentPrescribedDataDefinition, paramMapping); //TODO: missing Specimen Condition + dsd.addColumn("Investigation required",opdInvestigationRequiredDataDefinition, paramMapping); + dsd.addColumn("Date Sample Collected",opdDateSampleCollectedDataDefinition, paramMapping, new DateConverter(ENC_DATE_FORMAT)); + //dsd.addColumn("Date Sample Received",opdDateSampleReceivedDataDefinition, paramMapping); + + dsd.addColumn("Clinician Name", new OPDOrderingClinicianDataDefinition(), null); + //dsd.addColumn("Date Sample Analysed",opdDateSampleReceivedDataDefinition, paramMapping); //TODO: missing Date sample analysed + + dsd.addColumn("Results",opdLabResultsDataDefinition, paramMapping); + //dsd.addColumn("Date results dispatched",opdLabResultsDateDataDefinition, paramMapping); //TODO: missing Date results dispatched + //dsd.addColumn("Amount charged",opdLabResultsDateDataDefinition, paramMapping); //TODO: missing Amount charged + //dsd.addColumn("Receipt number",opdLabResultsDateDataDefinition, paramMapping); //TODO: missing Receipt number + + + dsd.addColumn("Referred to",opdLabReferralsDataDefinition, paramMapping); + dsd.addColumn("Comments",opdLabRemarksDataDefinition, paramMapping); + dsd.addColumn("Analysing Officer",new OPDOrderingClinicianDataDefinition(), null); + + MOH240LabRegisterCohortDefinition cd = new MOH240LabRegisterCohortDefinition(); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + + dsd.addRowFilter(cd, paramMapping); + return dsd; + + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705AReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705AReportBuilder.java index 205b884f3d..9684816152 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705AReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705AReportBuilder.java @@ -13,9 +13,9 @@ import org.openmrs.module.kenyacore.report.ReportUtils; import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; import org.openmrs.module.kenyacore.report.builder.Builds; -import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.DiagnosisLists; -import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.ReportAddonUtils; -import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.ReportingUtils; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.DiagnosisLists; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportAddonUtils; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportingUtils; import org.openmrs.module.kenyaemr.reporting.library.ETLReports.MOH705.MOH705IndicatorLibrary; import org.openmrs.module.kenyaemr.reporting.library.shared.common.CommonDimensionLibrary; import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; @@ -36,80 +36,17 @@ * Diagnosis */ @Component -@Builds({ "kenyaemr.common.report.moh705A" }) +@Builds({ "kenyaemr.ehrReports.report.moh705A" }) public class MOH705AReportBuilder extends AbstractReportBuilder { static final String AGE_BELOW_FIVE = "<5"; - static final int DIARRHOEA_WITH_DEHYDRATION = 168737; + static final int DIARRHOEA_WITHOUT_DEHYDRATION = 168737; static final int DIARRHOEA_WITH_SOME_DEHYDRATION = 166569; static final int DIARRHOEA_WITH_SEVERE_DEHYDRATION = 168736 ; - static final int CHOLERA = 145622; - static final int DYSENTRY = 152 ; - static final int GASTROENTERITIS = 117889; - static final int PNEUMONIA = 114100; - static final int SEVERE_PNEUMONIA = 168738; - static final int UPPER_RESPIRATORY_TRACT_INFECTIONS = 123093; - static final int LOWER_RESPIRATORY_TRACT_INFECTIONS = 135556; - static final int ASTHMA = 121375; - static final int PRESUMED_TUBERCULOSIS = 168739; - static final int SUSPECTED_MALARIA = 166623 ; - static final int TESTED_FOR_MALARIA = 168740; + static final int CHOLERA = 145622; static final int CONFIRMED_MALARIA = 160148; - static final int EAR_INFECTION = 71; - static final int MALNUTRITION = 115122; - static final int ANAEMIA = 121629; - static final int MENINGOCOCCAL_MENINGITIS = 134369; - static final int OTHER_MENINGITIS = 0; - static final int NEONATAL_SEPSIS = 226; - static final int NEONATAL_TETANUS = 124954; - static final int POLIOMYELITIS = 160426; - static final int CHICKEN_POX = 892; - static final int MEASLES = 134561; - static final int HEPATITIS = 116986; - static final int AMOEBIASIS = 124; - static final int MUMPS = 133671; - static final int TYPHOID_FEVER = 141; - static final int BILHARZIA = 117152; - static final int INTESTINAL_WORMS = 116699; - static final int EYE_INFECTIONS = 140832; - static final int TONSILITIS = 112; - static final int URINARY_TRACT_INFECTIONS = 111633; - static final int MENTAL_DISORDERS = 77; - static final int DENTAL_DISORDERS = 78; - static final int JIGGERS_INFESTATION = 123964; - static final int SKIN_DISEASES = 119022; - static final int DOWNS_SYNDROME = 144481; - static final int POISONING = 114088; - static final int ROAD_TRAFFIC_INJURIES = 86; - static final int DEATH_BY_ROAD_TRAFFIC_INJURIES = 0; - static final int VIOLENCE_RELATED_INJURIES = 0; - static final int OTHER_INJURIES = 0; - static final int SEXUAL_VIOLENCE = 123160; - static final int BURNS = 146623; - static final int SNAKE_BITES = 126323; - static final int DOG_BITES = 166; - static final int OTHER_BITES = 0; - static final int DIABETES = 119481; - static final int EPILEPSY = 155; - static final int OTHER_CONVULSIVE_DISORDERS = 0; - static final int RHEUMATIC_FEVER = 127447; - static final int BRUCELLOSIS = 121005; - static final int RICKETS = 127394; - static final int CEREBRAL_PALSY = 152492; - static final int AUTISM = 121303; - static final int TRYPONOSOMIASIS = 124078; - static final int YELLOW_FEVER = 122759; - static final int VIRAL_HAEMORRHAGIC_FEVER = 123112; - static final int RIFT_VALLEY_FEVER = 113217; - static final int CHIKUNGUNYA = 120743; - static final int DENGUE_FEVER = 7592; - static final int LEISHMANIASIS = 116350; - static final int CUTANEOUS_LEISHMANIASIS = 143074; - static final int SUSPECTED_ANTHRAX = 168741; - static final int SUSPECTED_CHILDHOOD_CANCERS = 0; - static final int HYPOXAEMIA = 117312; - static final int ALL_OTHER_DISEASES = 0; - - + static final int TESTED_MALARIA = 168740; + static final int SUSPECTED_MALARIA = 166623; + static final int PRESUMED_TUBERCULOSIS = 168739; private MOH705IndicatorLibrary moh705indicatorLibrary; @@ -143,515 +80,85 @@ protected DataSetDefinition moh705ADataset() { cohortDsd.setDescription("MOH 705A"); cohortDsd.addDimension("day", ReportUtils.map(commonDimensionLibrary.encountersOfMonthPerDay(), indParams)); - // populate datasets -// EmrReportingUtils.addRow(indicatorDsd,"HV02-01", "First ANC Visit", ReportUtils.map(moh731GreenCardIndicators.firstANCVisitMchmsAntenatal(), indParams), cadreDisaggregation,Arrays.asList("1","2","3")); - ReportingUtils.addRow(cohortDsd,"DWND","Diarrhoea with no dehydration",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(DIARRHOEA_WITH_DEHYDRATION),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd,"DWSOD","Diarrhoea with some dehydration",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(DIARRHOEA_WITH_SOME_DEHYDRATION),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd,"DWSED","Diarrhoea with severe dehydration",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(DIARRHOEA_WITH_SEVERE_DEHYDRATION),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd,"CLC","Cholera",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(CHOLERA),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); - ReportingUtils.addRow( - cohortDsd, - "TC", - "Tuberculosis", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTuberculosisDiagnosisList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "DYC", - "Dysentery", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDysenteryList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "GAS", - "Gastroenteritis", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getGastroenteritisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - ReportingUtils.addRow( - cohortDsd, - "SP", - "Severe pneumonia", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getSeverePneumoniaList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - ReportingUtils.addRow(cohortDsd, "LTI", "Lower Respiratory Tract Infections", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getSLowerTractInfectionList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "NS", - "Neonatal Sepsis", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeutalSepsisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "AM", - "AMOEBIASIS", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getAmoebiasis(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "DS", - "Down’s syndrome", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDownSyndromeList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "RF", - "Rheumatic Fever", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getReumonicFeverList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - ReportingUtils.addRow( - cohortDsd, - "CKU", - "Chikungunya fever", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getChikungunyaFeverList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "DENF", - "Dengue fever", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDengueFeverList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "CL", "Cutaneous Leishmaniasis", ReportUtils.map(moh705indicatorLibrary - .diagnosis(DiagnosisLists.getCutaneousLeishmaniasisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "ANT", - "Suspected Anthrax", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnthraxList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - ReportingUtils.addRow( - cohortDsd, - "CLC", - "Cholera", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getCholeraList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "MCC", - "Meningococcal Meningitis", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getMeningococcalMeningitisList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "OMC", "Other Menignitis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherMenigitisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "NNC", "NeonatalTetanus", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeonatalTetanusList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "PMC", - "Poliomyelitis", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoliomyelitisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "CPC", - "Chicken Pox", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getChickenPoxList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "MSC", - "Measles", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMeaslesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "HPC", - "Hepatitis", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getHepatitisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "MPC", - "Mumps", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMumpsList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "SMC", "Suspected Malaria", ReportUtils.map( - moh705indicatorLibrary.diagnosis(Arrays.asList(CONFIRMED_MALARIA), AGE_BELOW_FIVE), indParams), //TODO Suspected Malaria - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "CMC", "Confirmed Malaria", ReportUtils.map( - moh705indicatorLibrary.diagnosis(Arrays.asList(CONFIRMED_MALARIA), AGE_BELOW_FIVE), indParams), //TODO Confirmed Malaria - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "UTC", - "Urinary Tract Infection", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getUrinaryTractInfectionList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "TYC", - "Typhoid Fever", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getTyphoidList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "BLC", - "Bilharzia", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getBilharziaList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "IWC", "Interstinal worms", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getInterstinalwormsList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "MNC", - "Malnutrition", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalnutritionList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "ANC", - "Anaemia", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnaemiaList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "EC", - "Eye Infections", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getEyeInfectionsList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "EIC", - "Ear Infections Conditions", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getEarInfectionsConditionsList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "URC", - "Upper Respiratory Tract Infections", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getUpperRespiratoryTractInfectionsList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "ASC", - "Asthma", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getAsthmaList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "TSC", - "Tonsilities", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getTonsilitiesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "PNC", - "Pneumonia", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getPneumoniaList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MDC", "Mental Disorders", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMentalDisordersList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DDC", "DentalDisorders", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDentalDisordersList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "JIC", "Jiggers Infestation", ReportUtils.map(moh705indicatorLibrary - .diagnosis(DiagnosisLists.getJiggersInfestationList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DOC", "Disease Of The Skin", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiseaseOfTheSkinList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "PC", - "Poisoning", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoisoningList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "RTC", "Road TrafficI Injuries", ReportUtils.map(moh705indicatorLibrary - .diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "OIC", - "Other Injuries", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherInjuriesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "SAC", - "Sexual Asualt", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getSexualAssaultList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "BC", - "Burns", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getBurnsList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "SBC", - "Snake Bites", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getSnakeBitesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "DBC", - "Dog BITES", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDogBitesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "OBC", - "Other Bites", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherBitesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "DTC", - "Diabetes", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiabetesList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "EPC", - "Epilepsy", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getEpilepsyList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "OCDC", - "Other Convulsive Disorders", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getOtherConvulsiveDisordersList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "BRC", - "Brucellosis", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getBrucellosisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "RKC", - "Rickets", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getRicketsList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "VRC", - "Violence related injuries", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getViolenceRelatedInjuriesList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "CRPC", - "Cerebral Palsy", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getCerebralPalsyList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "ATC", - "Autism", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getAutismList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "TRC", - "Tryponomiasis", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getTryponomiasisList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "KLC", - "Kalazar leishmaniasis", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getKalazarLeishmaniasisList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "YFC", - "Yellow Fever", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getYellowFeverList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "VHC", - "Viral Haemorrhagic Fever", - ReportUtils.map(moh705indicatorLibrary.diagnosis( - DiagnosisLists.getViralHaemorrhagicFeverList(), AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - - ReportingUtils.addRow( - cohortDsd, - "OVC", - "Overweight", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOvrerweightList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - ReportingUtils.addRow( - cohortDsd, - "SCC", - "Suspected Childhood Cancers", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getChildHoodCancerist(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "HYPO", - "Hypoxaemia (Spo2<90%)", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getHypoxaemiaList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - - ReportingUtils.addRow( - cohortDsd, - "RVF", - "Rift valley fever", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getRiftValleyFeverList(), - AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "DRTC", - "Deaths due to Road Trafic injuries", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(),AGE_BELOW_FIVE), indParams), //TODO change this to read deaths due to road traffic injuries concept and count - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "NFAC", "No of first attendances", - ReportUtils.map(moh705indicatorLibrary.newAttendances(AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "RAC", "Re-attendances", - ReportUtils.map(moh705indicatorLibrary.reAttendances(AGE_BELOW_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "RFHC", - "Referrals from other health facility", - ReportUtils.map(moh705indicatorLibrary.reAttendances(AGE_BELOW_FIVE), indParams), //TODO correct this to point to correct count - /*ReportUtils.map(moh705indicatorLibrary.getAllChildrenPatientsReferrals( - getConcept("160481AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getConceptId(), - getConcept("1537AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getConceptId()), indParam), */ - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "RTC", - "Referrals to Community Unit", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(),AGE_BELOW_FIVE), indParams), //TODO correct this to point to correct count - /*getConcept("477a7484-0f99-4026-b37c-261be587a70b").getConceptId(), - getConcept("4fcf003e-71cf-47a5-a967-47d24aa61092").getConceptId()), indParams),*/ - ReportAddonUtils.getAdultChildrenColumns() - ); - - ReportingUtils.addRow( - cohortDsd, - "AODC", - "All other diseases for children", - ReportUtils.map( - moh705indicatorLibrary.allOtherDiseasesAboveFive(AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - - + ReportingUtils.addRow(cohortDsd,"DWND","Diarrhoea with no dehydration",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(DIARRHOEA_WITHOUT_DEHYDRATION),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DWSOD","Diarrhoea with some dehydration",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(DIARRHOEA_WITH_SOME_DEHYDRATION),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DWSED","Diarrhoea with severe dehydration",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(DIARRHOEA_WITH_SEVERE_DEHYDRATION),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"CLC","Cholera",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(CHOLERA),AGE_BELOW_FIVE),indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"TC","Tuberculosis",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTuberculosisDiagnosisList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"TCP","Presumed Tuberculosis",ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(PRESUMED_TUBERCULOSIS), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DYC","Dysentery",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDysenteryList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"GAS","Gastroenteritis",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getGastroenteritisList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"SP","Severe pneumonia",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getSeverePneumoniaList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "LTI", "Lower Respiratory Tract Infections", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getSLowerTractInfectionList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"NS","Neonatal Sepsis",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeutalSepsisList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"AM","AMOEBIASIS",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAmoebiasis(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DS","Down’s syndrome",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDownSyndromeList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"RF","Rheumatic Fever",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getReumonicFeverList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"CKU","Chikungunya fever",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getChikungunyaFeverList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DENF","Dengue fever",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDengueFeverList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"CL", "Cutaneous Leishmaniasis",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getCutaneousLeishmaniasisList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"ANT","Suspected Anthrax",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnthraxList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"CLC","Cholera",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getCholeraList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"MCC","Meningococcal Meningitis",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMeningococcalMeningitisList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"OMC", "Other Menignitis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherMenigitisList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"NNC", "NeonatalTetanus", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeonatalTetanusList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"PMC","Poliomyelitis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoliomyelitisList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"CPC","Chicken Pox", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getChickenPoxList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"MSC","Measles", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMeaslesList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"HPC","Hepatitis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getHepatitisList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"MPC","Mumps", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMumpsList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"SMC", "Suspected Malaria", ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(SUSPECTED_MALARIA), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"TMC", "Tested Malaria", ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(TESTED_MALARIA), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"CMC", "Confirmed Malaria", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalariaList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"UTC","Urinary Tract Infection", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getUrinaryTractInfectionList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"TYC","Typhoid Fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTyphoidList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"BLC","Bilharzia", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getBilharziaList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "IWC","Interstinal worms", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getInterstinalwormsList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"MNC","Malnutrition", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalnutritionList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"ANC","Anaemia", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnaemiaList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"EC","Eye Infections", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getEyeInfectionsList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"EIC","Ear Infections Conditions", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getEarInfectionsConditionsList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"URC","Upper Respiratory Tract Infections", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getUpperRespiratoryTractInfectionsList(), AGE_BELOW_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"ASC","Asthma", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAsthmaList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"TSC","Tonsilities", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTonsilitiesList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"PNC","Pneumonia", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPneumoniaList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MDC", "Mental Disorders", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMentalDisordersList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DDC", "DentalDisorders", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDentalDisordersList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "JIC", "Jiggers Infestation", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getJiggersInfestationList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DOC", "Disease Of The Skin", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiseaseOfTheSkinList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"PC", "Poisoning",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoisoningList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "RTC", "Road TrafficI Injuries", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"OIC","Other Injuries", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherInjuriesList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"SAC","Sexual Assault", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getSexualAssaultList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"BC","Burns",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getBurnsList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"SBC","Snake Bites", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getSnakeBitesList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DBC","Dog BITES",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDogBitesList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"OBC","Other Bites", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherBitesList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DTC","Diabetes", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiabetesList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"EPC","Epilepsy", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getEpilepsyList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"OCDC","Other Convulsive Disorders", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherConvulsiveDisordersList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"BRC","Brucellosis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getBrucellosisList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"RKC","Rickets", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRicketsList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"VRC","Violence related injuries", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getViolenceRelatedInjuriesList(), AGE_BELOW_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"CRPC","Cerebral Palsy", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getCerebralPalsyList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"ATC","Autism", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAutismList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"TRC","Tryponomiasis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTryponomiasisList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"KLC","Kalazar leishmaniasis",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getKalazarLeishmaniasisList(), AGE_BELOW_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"YFC","Yellow Fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getYellowFeverList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"VHC","Viral Haemorrhagic Fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getViralHaemorrhagicFeverList(), AGE_BELOW_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"OVC","Overweight", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOvrerweightList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"SCC","Suspected Childhood Cancers", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getChildHoodCancerist(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"HYPO","Hypoxaemia (Spo2<90%)", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getHypoxaemiaList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"RVF","Rift valley fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRiftValleyFeverList(), AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"DRTC","Deaths due to Road Traffic Injuries",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(),AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "NFAC", "No of first attendances", ReportUtils.map(moh705indicatorLibrary.newAttendances(AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "RAC", "Re-attendances", ReportUtils.map(moh705indicatorLibrary.reAttendances(AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"RFHC","Referrals from other health facility", ReportUtils.map(moh705indicatorLibrary.referralsFromOtherFacilities(AGE_BELOW_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"RFCC","Referrals to other health facility", ReportUtils.map(moh705indicatorLibrary.referralsToOtherFacilities(AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"AODC","All other diseases for children",ReportUtils.map(moh705indicatorLibrary.allOtherDiseasesAboveFive(AGE_BELOW_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + //TODO: Referrals from community unit + //TODO:Referrals to community unit return cohortDsd; } diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java index 4c715adc28..a73ad21d0f 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH705BReportBuilder.java @@ -13,9 +13,9 @@ import org.openmrs.module.kenyacore.report.ReportUtils; import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; import org.openmrs.module.kenyacore.report.builder.Builds; -import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.DiagnosisLists; -import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.ReportAddonUtils; -import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.ReportingUtils; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.DiagnosisLists; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportAddonUtils; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportingUtils; import org.openmrs.module.kenyaemr.reporting.library.ETLReports.MOH705.MOH705IndicatorLibrary; import org.openmrs.module.kenyaemr.reporting.library.shared.common.CommonDimensionLibrary; import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; @@ -36,80 +36,11 @@ * Diagnosis */ @Component -@Builds({"kenyaemr.common.report.moh705B"}) +@Builds({"kenyaemr.ehrReports.report.moh705B"}) public class MOH705BReportBuilder extends AbstractReportBuilder { static final String EQUAL_AND_OVER_FIVE = ">=5"; - static final int DIARRHOEA = 5018; - static final int TUBERCULOSIS = 160156; - static final int DYSENTRY = 152; - static final int CHOLERA = 145622; - static final int MENINGOCOCCAL_MENINGITIS = 134369; - static final int OTHER_MENINGITIS = 0; - static final int TETANUS = 124957; - static final int POLIOMYELITIS = 5258; - static final int CHICKEN_POX = 892; - static final int MEASLES = 134561; - static final int HEPATITIS = 116986; - static final int MUMPS = 133671; - static final int SUSPECTED_MALARIA = 166623; - static final int CONFIRMED_MALARIA = 160148; - static final int TESTED_FOR_MALARIA = 168740; - static final int MALARIA_IN_PREGNANCY = 160152; - static final int AMOEBIASIS = 124; - static final int TYPHOID_FEVER = 141; - static final int SEXUALLY_TRANSMITTED_INFECTIONS = 112992; - static final int URINARY_TRACT_INFECTIONS = 111633; - static final int BILHARZIA = 117152; - static final int INTESTINAL_WORMS = 116699; - static final int MALNUTRITION = 134725; - static final int ANAEMIA = 121629; - static final int EYE_INFECTIONS = 140832; - static final int EAR_INFECTIONS = 71; - static final int UPPER_RESPIRATORY_TRACT_INFECTIONS = 123093; - static final int ASTHMA = 121375; - static final int PNEUMONIA = 114100; - static final int OTHER_LOWER_RESPIRATORY_TRACT_INFECTIONS = 998; - static final int ABORTION = 0; - static final int PUERPERIUM_AT_CHILDBIRTH = 0; - static final int HYPERTENSION = 117399; - static final int MENTAL_DISORDERS = 77; - static final int DENTAL_DISORDERS = 78; - static final int JIGGERS_INFESTATION = 123964; - static final int SKIN_DISEASES = 119022; - static final int ARTHRITIS_JOINT_PAINS = 148432; - static final int POISONING = 114088; - static final int ROAD_TRAFFIC_INJURIES = 86; - static final int DEATH_BY_ROAD_TRAFFIC_INJURIES = 0; - static final int OTHER_INJURIES = 0; - static final int SEXUAL_VIOLENCE = 123160; - static final int VIOLENCE_RELATED_INJURIES = 0; - static final int BURNS = 146623; - static final int SNAKE_BITES = 126323; - static final int DOG_BITES = 166; - static final int OTHER_BITES = 0; - static final int DIABETES = 119481; - static final int EPILEPSY = 155; - static final int BRUCELLOSIS = 121005; - static final int CARDIOVASCULAR_CONDITIONS = 119270; - static final int CENTRAL_NERVOUS_SYSTEM_CONDITIONS = 118994; - static final int OVERWEIGHT = 114413; - static final int MUSCULAR_SKELETAL_CONDITIONS = 0; - static final int FISTULA_BIRTH_RELATED = 0; - static final int SUSPECTED_NEOPLAMS_CANCERS = 0; - static final int PHYSICAL_DISABILITY = 0; - static final int TRYPONOSOMIASIS = 124078; - static final int RIFT_VALLEY_FEVER = 113217; - static final int YELLOW_FEVER = 122759; - static final int VIRAL_HAEMORRHAGIC_FEVER = 123112; - static final int CHIKUNGUNYA = 120743; - static final int DENGUE_FEVER = 7592; - static final int LEISHMANIASIS = 116350; - static final int CUTANEOUS_LEISHMANIASIS = 143074; - static final int SUSPECTED_ANTHRAX = 168741; - static final int REFERRALS_FROM_OTHER_HEALTH_FACILITY = 0; - static final int REFERRALS_FROM_OTHER_COMMUNITY_UNIT = 0; - private static final int REFERRALS_TO_COMMUNITY_UNIT = 0; - + static final int TESTED_MALARIA = 168740; + static final int SUSPECTED_MALARIA = 166623; @Autowired private MOH705IndicatorLibrary moh705indicatorLibrary; @@ -144,329 +75,79 @@ protected DataSetDefinition moh705BDataset() { cohortDsd.setName("MOH705B"); cohortDsd.setDescription("MOH 705B"); cohortDsd.addDimension("day", ReportUtils.map(commonDimensionLibrary.encountersOfMonthPerDay(), indParams)); - - - ReportingUtils.addRow(cohortDsd, "DA", "Diarrhoea", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiarrheaDiagnosisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "TBA", "Tuberculosis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getTuberculosisDiagnosisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DYA", "Dysentery", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDysenteryList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "CLA", "Cholera", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getCholeraList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MMA", "Meningococcal Meningitis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMeningococcalMeningitisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MOA", "Other Meningitis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherMenigitisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "NTA", "Neonatal Tetanus", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeonatalTetanusList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "PMA", "Poliomyelitis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoliomyelitisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils - .addRow(cohortDsd, "CPA", "Chicken Pox", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getChickenPoxList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MEA", "Measles", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMeaslesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "HEA", "Hepatitis", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getHepatitisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MPSA", "Mumps", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMumpsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "SUA", - "Suspected malaria", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalariaList(),EQUAL_AND_OVER_FIVE), indParams), - /*moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalariaList(), //TODO port getSuspectedMalariaResults evaluation criteria - DiagnosisLists.getSuspectedMalariaResults()), indParam),*/ - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "COA", - "Confirmed Malaria positive", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalariaList(), - EQUAL_AND_OVER_FIVE), indParams), - /* DiagnosisLists.getConfirmedMalariaResults()), indParam),*/ //TODO getConfirmedMalariaResults criteria - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MPA", "Malaria In Pregnancy", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalariaInPregnancyList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "TYA", "Typhoid Fever", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTyphoidList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "STIA", "STI", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getSexuallyTransmittedInfectionsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "URA", "Urinary tract infection", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getUrinaryTractInfectionList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "BIA", "Bilharzia", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getBilharziaList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "INA", "Intestinal worms", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getInterstinalwormsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MLA", "Malnutrition", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalnutritionList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "ANEA", "Aneamia", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnaemiaList(), EQUAL_AND_OVER_FIVE), indParams), - - ReportAddonUtils.getAdultChildrenColumns()); - ReportingUtils.addRow(cohortDsd, "EYA", "Eye Infections", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getEyeInfectionsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "EIA", "Ear Infection Conditions", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getEarInfectionConditionsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "UPA", "Upper Respiratory Tract Infections", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getUpperRespiratoryTractInfectionsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "ASA", "Asthma", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAsthmaList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "PNA", "Pneumonia", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPneumoniaList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "OTRA", "Other Dis Of Respiratory System", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherDisOfRespiratorySystemList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "ABA", "Abortion", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAbortionList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DPA", "Dis Of Puerperium & Childbath", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDisOfPuerperiumChildbathList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "HYA", "Hypertension", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getHypertensionList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MDA", "Mental Disorders", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMentalDisordersList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DEA", "Dental Disorders", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDentalDisordersList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "JIA", "Jiggers Infestation", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getJiggersInfestationList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DSA", "Disease Of The Skin", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiseaseOfTheSkinList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "AJPA", "Anthritis Joint Pains", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnthritisJointPainsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "POA", "Poisoning", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoisoningList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "ROA", "Road Traffic Injuries", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "OIA", "Other Injuries", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherInjuriesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "SEA", "Sexual Assault", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getSexualAssaultList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "VRA", "Violence Related Injuries", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getViolenceRelatedInjuriesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "BUA", "Burns", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getBurnsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "SNA", "Snake Bites", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getSnakeBitesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DOA", "Dog Bites", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDogBitesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils - .addRow(cohortDsd, "OBA", "Other Bites", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherBitesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DTA", "Diabetes", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiabetesList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "EPA", "Epilepsy", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getEpilepsyList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "BRLA", "Brucellosis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getBrucellosisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils - .getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "CAA", "Cardiovascular Conditions", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getCardiovascularConditionsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "CNSA", "Central Nervous System Conditions", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherCentralNervousSystemConditionsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "OVA", "Overweight", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getOvrerweightList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils - .getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "MSA", "Muscular Skeletal Conditions", - ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getMuscularSkeletalConditionsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "FIA", "Fistula Birth Related", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getFistulaBirthRelatedList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "NSA", "Neoplams", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeoplamsList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "PHA", "Physical Disability", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getPhysicalDisabilityList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "TRA", "Tryponomiasis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getTryponomiasisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "KAA", "Kalazar Leishmaniasis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getKalazarLeishmaniasisList(), EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "YEA", "Yellow Fever", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getYellowFeverList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils - .getAdultChildrenColumns()); - - ReportingUtils - .addRow(cohortDsd, "VHA", "Viral Haemorrhagic Fever", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getViralHaemorrhagicFeverList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DRA", - "Death due to road traffic injuries", - /*ReportUtils.map(moh705indicatorLibrary.diagnosis( - getConcept("1599AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getConceptId(), - getConcept("1603AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getConceptId()), indParam),*/ - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(),EQUAL_AND_OVER_FIVE), indParams), //TODO change this to read Death due to road traffic injuries - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "AODA", "All other diseases for adults", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getAllOtherDiseasesListForAdults(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "NFAA", "No. Of First Attendances", - ReportUtils.map(moh705indicatorLibrary.newAttendances(EQUAL_AND_OVER_FIVE)), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils - .addRow(cohortDsd, "RETA", "Re-Attendances", - ReportUtils.map(moh705indicatorLibrary.reAttendances(EQUAL_AND_OVER_FIVE)), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "RFHA", - "Referrals From Other Health Facility", - ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(REFERRALS_FROM_OTHER_HEALTH_FACILITY),EQUAL_AND_OVER_FIVE), indParams), - /*ReportUtils.map(moh705indicatorLibrary.getAllAdultPatientsWithReferrals( TODO port in this function - getConcept("160481AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getConceptId(), - getConcept("1537AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getConceptId()), indParam),*/ - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "RFCA", - "Referrals From Other Community Unit", - ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(REFERRALS_FROM_OTHER_COMMUNITY_UNIT),EQUAL_AND_OVER_FIVE), indParams), - /*ReportUtils.map(moh705indicatorLibrary.getAllAdultPatientsWithReferrals( //TODO implement getAllAdultPatientsWithReferrals - getConcept("160481AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA").getConceptId(), - getConcept("4fcf003e-71cf-47a5-a967-47d24aa61092").getConceptId()), indParam),*/ - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow( - cohortDsd, - "RTCA", - "Referrals To Community Unit", - ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(REFERRALS_TO_COMMUNITY_UNIT),EQUAL_AND_OVER_FIVE), indParams), - /* ReportUtils.map(moh705indicatorLibrary.getAllAdultPatientsWithReferrals( - getConcept("477a7484-0f99-4026-b37c-261be587a70b").getConceptId(), - getConcept("4fcf003e-71cf-47a5-a967-47d24aa61092").getConceptId()), indParam),*/ - ReportAddonUtils.getAdultChildrenColumns()); - - //additional indicators added - ReportingUtils.addRow(cohortDsd, "AM", "AMOEBIASIS", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAmoebiasis(),EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "RVF", "Rift valley fever", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getRiftValleyFeverList(),EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "CKU", "Chikungunya fever", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getChikungunyaFeverList(),EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "DENF", "Dengue fever", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getDengueFeverList(),EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils - .getAdultChildrenColumns()); - - ReportingUtils - .addRow(cohortDsd, "CL", "Cutaneous Leishmaniasis", ReportUtils.map( - moh705indicatorLibrary.diagnosis(DiagnosisLists.getCutaneousLeishmaniasisList(),EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); - - ReportingUtils.addRow(cohortDsd, "ANT", "Suspected Anthrax", - ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnthraxList(),EQUAL_AND_OVER_FIVE), indParams), - ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DA", "Diarrhoea", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiarrheaDiagnosisList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "TBA", "Tuberculosis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTuberculosisDiagnosisList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DYA", "Dysentery", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDysenteryList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "CLA", "Cholera", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getCholeraList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MMA", "Meningococcal Meningitis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMeningococcalMeningitisList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MOA", "Other Meningitis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherMenigitisList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "NTA", "Neonatal Tetanus", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeonatalTetanusList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "PMA", "Poliomyelitis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoliomyelitisList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "CPA", "Chicken Pox", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getChickenPoxList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MEA", "Measles", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMeaslesList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "HEA", "Hepatitis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getHepatitisList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MPSA", "Mumps", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMumpsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "TMC", "Tested Malaria", ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(TESTED_MALARIA), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "SUA", "Suspected malaria", ReportUtils.map(moh705indicatorLibrary.diagnosis(Arrays.asList(SUSPECTED_MALARIA),EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "COA", "Confirmed Malaria positive",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalariaList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MPA", "Malaria In Pregnancy", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalariaInPregnancyList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "TYA", "Typhoid Fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTyphoidList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "STIA", "STI", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getSexuallyTransmittedInfectionsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "URA", "Urinary tract infection", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getUrinaryTractInfectionList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "BIA", "Bilharzia",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getBilharziaList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "INA", "Intestinal worms", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getInterstinalwormsList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MLA", "Malnutrition", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMalnutritionList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "ANEA", "Aneamia", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnaemiaList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "EYA", "Eye Infections", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getEyeInfectionsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "EIA", "Ear Infection Conditions", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getEarInfectionConditionsList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "UPA", "Upper Respiratory Tract Infections", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getUpperRespiratoryTractInfectionsList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "ASA", "Asthma",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAsthmaList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "PNA", "Pneumonia",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPneumoniaList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "OTRA", "Other Dis Of Respiratory System",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherDisOfRespiratorySystemList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "ABA", "Abortion",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAbortionList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DPA", "Dis Of Puerperium & Childbath", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDisOfPuerperiumChildbathList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "HYA", "Hypertension", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getHypertensionList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MDA", "Mental Disorders", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMentalDisordersList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DEA", "Dental Disorders", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDentalDisordersList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "JIA", "Jiggers Infestation", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getJiggersInfestationList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DSA", "Disease Of The Skin", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiseaseOfTheSkinList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "AJPA", "Anthritis Joint Pains", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnthritisJointPainsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "POA", "Poisoning", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPoisoningList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "ROA", "Road Traffic Injuries", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "OIA", "Other Injuries", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherInjuriesList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "SEA", "Sexual Assault", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getSexualAssaultList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "VRA", "Violence Related Injuries", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getViolenceRelatedInjuriesList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "BUA", "Burns", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getBurnsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "SNA", "Snake Bites", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getSnakeBitesList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DOA", "Dog Bites", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDogBitesList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "OBA", "Other Bites", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherBitesList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DTA", "Diabetes", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDiabetesList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "EPA", "Epilepsy", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getEpilepsyList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "BRLA", "Brucellosis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getBrucellosisList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "CAA", "Cardiovascular Conditions", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getCardiovascularConditionsList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "CNSA", "Central Nervous System Conditions", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOtherCentralNervousSystemConditionsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "OVA", "Overweight", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getOvrerweightList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "MSA", "Muscular Skeletal Conditions",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getMuscularSkeletalConditionsList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "FIA", "Fistula Birth Related", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getFistulaBirthRelatedList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "NSA", "Neoplams",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getNeoplamsList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "PHA", "Physical Disability", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getPhysicalDisabilityList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "TRA", "Tryponomiasis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getTryponomiasisList(), EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "KAA", "Kalazar Leishmaniasis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getKalazarLeishmaniasisList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "YEA", "Yellow Fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getYellowFeverList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "VHA", "Viral Haemorrhagic Fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getViralHaemorrhagicFeverList(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DRA", "Death due to road traffic injuries",ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRoadTrafficInjuriesList(),EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "AM", "AMOEBIASIS", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAmoebiasis(),EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "RVF", "Rift valley fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getRiftValleyFeverList(),EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "CKU", "Chikungunya fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getChikungunyaFeverList(),EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "DENF", "Dengue fever", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getDengueFeverList(),EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "CL", "Cutaneous Leishmaniasis", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getCutaneousLeishmaniasisList(),EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "ANT", "Suspected Anthrax", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAnthraxList(),EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + + ReportingUtils.addRow(cohortDsd, "AODA", "All other diseases for adults", ReportUtils.map(moh705indicatorLibrary.diagnosis(DiagnosisLists.getAllOtherDiseasesListForAdults(), EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "NFAA", "No. Of First Attendances",ReportUtils.map(moh705indicatorLibrary.newAttendances(EQUAL_AND_OVER_FIVE)), ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd, "RETA", "Re-Attendances", ReportUtils.map(moh705indicatorLibrary.reAttendances(EQUAL_AND_OVER_FIVE)),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"RFHA","Referrals from other health facility", ReportUtils.map(moh705indicatorLibrary.referralsFromOtherFacilities(EQUAL_AND_OVER_FIVE), indParams),ReportAddonUtils.getAdultChildrenColumns()); + ReportingUtils.addRow(cohortDsd,"RFCA","Referrals to other health facility", ReportUtils.map(moh705indicatorLibrary.referralsToOtherFacilities(EQUAL_AND_OVER_FIVE), indParams), ReportAddonUtils.getAdultChildrenColumns()); return cohortDsd; diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH717ReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH717ReportBuilder.java new file mode 100644 index 0000000000..eb1c4d40ad --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/MOH717ReportBuilder.java @@ -0,0 +1,90 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.builder.common; + +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportingUtils; +import org.openmrs.module.kenyaemr.reporting.library.moh717.Moh717CohortLibrary; +import org.openmrs.module.kenyaemr.reporting.library.moh717.Moh717IndicatorLibrary; +import org.openmrs.module.kenyaemr.reporting.library.shared.common.CommonDimensionLibrary; +import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +import static org.openmrs.module.kenyacore.report.ReportUtils.map; +import static org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportAddonUtils.getGeneralOutPatientFilters; + +/** + * Report builder for MOH717 + * Work load + */ + +@Component +@Builds({ "kenyaemr.ehrReports.report.717" }) +public class MOH717ReportBuilder extends AbstractReportBuilder { + private final Moh717CohortLibrary moh717CohortLibrary; + + private final CommonDimensionLibrary commonDimensionLibrary; + + private final Moh717IndicatorLibrary moh717IndicatorLibrary; + + @Autowired + public MOH717ReportBuilder(Moh717CohortLibrary moh717CohortLibrary, CommonDimensionLibrary commonDimensionLibrary, Moh717IndicatorLibrary moh717IndicatorLibrary) { + this.moh717CohortLibrary = moh717CohortLibrary; + this.commonDimensionLibrary = commonDimensionLibrary; + this.moh717IndicatorLibrary = moh717IndicatorLibrary; + } + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList(new Parameter("startDate", "Start Date", Date.class), new Parameter("endDate", "End Date", + Date.class), new Parameter("dateBasedReporting", "", String.class)); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, + ReportDefinition reportDefinition) { + return Arrays.asList(ReportUtils.map(moh717DatasetDefinition(), "startDate=${startDate},endDate=${endDate}")); + } + + private DataSetDefinition moh717DatasetDefinition() { + String indParams = "startDate=${startDate},endDate=${endDate}"; + + CohortIndicatorDataSetDefinition dsd = new CohortIndicatorDataSetDefinition(); + dsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsd.setName("MOH717"); + dsd.setDescription("MOH 717 Report"); + + dsd.addDimension("age", map(commonDimensionLibrary.standardAgeGroups(), "onDate=${endDate}")); + dsd.addDimension("gender", map(commonDimensionLibrary.gender(), "")); + dsd.addDimension("state", map(commonDimensionLibrary.newOrRevisits(), "startDate=${startDate},endDate=${endDate}")); + + + + ReportingUtils.addRow(dsd, "OSN", "OUTPATIENT SERVICES NEW PATIENTS", + ReportUtils.map(moh717IndicatorLibrary.getAllPatientsWithEncountersWithinReportingPeriod(), indParams), getGeneralOutPatientFilters()); + + ReportingUtils.addRow(dsd, "OSR", "OUTPATIENT SERVICES REVIST PATIENTS", + ReportUtils.map(moh717IndicatorLibrary.getAllPatientsWithEncountersWithinReportingPeriod(), indParams), getGeneralOutPatientFilters()); + return dsd; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/SetupMOH706LabReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/SetupMOH706LabReportBuilder.java new file mode 100644 index 0000000000..0741be2b87 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/common/SetupMOH706LabReportBuilder.java @@ -0,0 +1,72 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.builder.common; + +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyaemr.reporting.library.MOH706.Moh706LabCohortLibrary; +import org.openmrs.module.kenyaemr.reporting.library.MOH706.Moh706IndicatorLibrary; +import org.openmrs.module.reporting.dataset.definition.CohortIndicatorDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +import static org.openmrs.module.kenyacore.report.ReportUtils.map; + +@Component +@Builds({ "kenyaemr.ehrReports.706.report" }) +public class SetupMOH706LabReportBuilder extends AbstractReportBuilder { + + + private final Moh706IndicatorLibrary moh706IndicatorLibrary; + + @Autowired + public SetupMOH706LabReportBuilder(Moh706LabCohortLibrary moh706CohortLibrary, Moh706IndicatorLibrary moh706IndicatorLibrary) { + this.moh706IndicatorLibrary = moh706IndicatorLibrary; + } + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList(new Parameter("startDate", "Start Date", Date.class), new Parameter("endDate", "End Date", + Date.class), new Parameter("dateBasedReporting", "", String.class)); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, + ReportDefinition reportDefinition) { + return Arrays.asList(map(getMoh706LabDatasetDefinition(), + "startDate=${startDate},endDate=${endDate+23h}")); + } + + private DataSetDefinition getMoh706LabDatasetDefinition() { + CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition(); + cohortDsd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cohortDsd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cohortDsd.setName("MOH706"); + cohortDsd.setDescription("MOH 706 for the lab"); + + //URINE ANALYSIS + cohortDsd.addColumn("UAGL", "1.2 Glucose", + ReportUtils.map(moh706IndicatorLibrary.getAllUrineAnalysisGlucoseTestsPositives(), "startDate=${startDate},endDate=${endDate}"), ""); + + return cohortDsd; + } + +} + diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java index a783c69ca2..f8845a4259 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/dmi/IDSRSuspectedCaseListReportBuilder.java @@ -51,7 +51,7 @@ import java.util.List; @Component -@Builds({"kenyaemr.common.report.IDSRSuspectedCaseList"}) +@Builds({"kenyaemr.ehrReports.report.IDSRSuspectedCaseList"}) public class IDSRSuspectedCaseListReportBuilder extends AbstractReportBuilder { public static final String DATE_FORMAT = "dd/MM/yyyy"; diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/finacials/SetupFacilityMonthlyRevenueCollectionBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/finacials/SetupFacilityMonthlyRevenueCollectionBuilder.java new file mode 100644 index 0000000000..c6c16578e7 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/finacials/SetupFacilityMonthlyRevenueCollectionBuilder.java @@ -0,0 +1,64 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.builder.finacials; + +import org.openmrs.module.kenyacore.report.HybridReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractHybridReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.kenyaemr.reporting.library.ETLReports.finacials.FacilityRevenueSummaries; +import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.PatientDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.SqlDataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +@Component +@Builds({ "kenyaemr.ehrReports.report.facility.monthly.collection" }) +public class SetupFacilityMonthlyRevenueCollectionBuilder extends AbstractHybridReportBuilder { + + @Override + protected Mapped buildCohort(HybridReportDescriptor hybridReportDescriptor, + PatientDataSetDefinition patientDataSetDefinition) { + return null; + } + + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList(new Parameter("startDate", "Start Date", Date.class), new Parameter("endDate", "End Date", + Date.class), new Parameter("dateBasedReporting", "", String.class)); + } + + @Override + protected List> buildDataSets(ReportDescriptor descriptor, ReportDefinition report) { + SqlDataSetDefinition dsdM1 = new SqlDataSetDefinition(); + dsdM1.setName("M1"); + dsdM1.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsdM1.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsdM1.setSqlQuery(FacilityRevenueSummaries.getMonthlySummaryQueryM1()); + + SqlDataSetDefinition dsdM2 = new SqlDataSetDefinition(); + dsdM2.setName("M2"); + dsdM2.addParameter(new Parameter("startDate", "Start Date", Date.class)); + dsdM2.addParameter(new Parameter("endDate", "End Date", Date.class)); + dsdM2.setSqlQuery(FacilityRevenueSummaries.getMonthlySummaryQueryM2()); + + return Arrays.asList(ReportUtils.map((DataSetDefinition) dsdM1, "startDate=${startDate},endDate=${endDate+23h}"), + ReportUtils.map((DataSetDefinition) dsdM2, "startDate=${startDate},endDate=${endDate+23h}")); + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/mchms/ANCRegisterReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/mchms/ANCRegisterReportBuilder.java index 19eba85103..2dd6042832 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/mchms/ANCRegisterReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/mchms/ANCRegisterReportBuilder.java @@ -93,8 +93,10 @@ protected DataSetDefinition datasetColumns() { DataConverter nameFormatter = new ObjectFormatter("{familyName}, {givenName} {middleName}"); DataDefinition nameDef = new ConvertedPersonDataDefinition("name", new PreferredNameDataDefinition(), nameFormatter); PatientIdentifierType upn = MetadataUtils.existing(PatientIdentifierType.class, HivMetadata._PatientIdentifierType.UNIQUE_PATIENT_NUMBER); + PatientIdentifierType nupi = MetadataUtils.existing(PatientIdentifierType.class, CommonMetadata._PatientIdentifierType.NATIONAL_UNIQUE_PATIENT_IDENTIFIER); DataConverter identifierFormatter = new ObjectFormatter("{identifier}"); DataDefinition identifierDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition(upn.getName(), upn), identifierFormatter); + DataDefinition nupiDef = new ConvertedPatientDataDefinition("identifier", new PatientIdentifierDataDefinition(nupi.getName(), nupi), identifierFormatter); ANCVisitNumberDataDefinition ancVisitNumberDataDefinition = new ANCVisitNumberDataDefinition(); ancVisitNumberDataDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); @@ -232,6 +234,7 @@ protected DataSetDefinition datasetColumns() { dsd.addColumn("Sex", new GenderDataDefinition(), ""); dsd.addColumn("Unique Patient Number", identifierDef, null); + dsd.addColumn("National Unique Patient Identifier", nupiDef, null); dsd.addColumn("Visit Date", new EncounterDatetimeDataDefinition(),"", new DateConverter(ENC_DATE_FORMAT)); // new columns dsd.addColumn("ANC Number", new ANCNumberDataDefinition(),""); diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/stock/SetFcdrrReportBuilder.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/stock/SetFcdrrReportBuilder.java new file mode 100644 index 0000000000..d102b9fbc5 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/builder/stock/SetFcdrrReportBuilder.java @@ -0,0 +1,50 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.builder.stock; + +import org.openmrs.module.kenyacore.report.ReportDescriptor; +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.kenyacore.report.builder.AbstractReportBuilder; +import org.openmrs.module.kenyacore.report.builder.Builds; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.SqlDataSetDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.stereotype.Component; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +@Component +@Builds({ "kenyaemr.ehrReports.report.fcdrr" }) +public class SetFcdrrReportBuilder extends AbstractReportBuilder { + @Override + protected List getParameters(ReportDescriptor reportDescriptor) { + return Arrays.asList(new Parameter("startDate", "Start Date", Date.class), new Parameter("endDate", "End Date", + Date.class), new Parameter("dateBasedReporting", "", String.class)); + } + + @Override + protected List> buildDataSets(ReportDescriptor reportDescriptor, + ReportDefinition reportDefinition) { + return Arrays.asList(ReportUtils.map(getFcdrrDatasetDefition(), "startDate=${startDate},endDate=${endDate}")); + } + + private DataSetDefinition getFcdrrDatasetDefition(){ + SqlDataSetDefinition sqlDataSetDefinition = new SqlDataSetDefinition(); + sqlDataSetDefinition.setName("FCDRR"); + sqlDataSetDefinition.addParameter(new Parameter("startDate", "Start Date", Date.class)); + sqlDataSetDefinition.addParameter(new Parameter("endDate", "End Date", Date.class)); + sqlDataSetDefinition.setSqlQuery("SELECT COUNT(*) AS total_items FROM stockmgmt_stock_item WHERE date_created BETWEEN :startDate AND :endDate "); + return sqlDataSetDefinition; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH204ARegisterCohortDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH204ARegisterCohortDefinition.java new file mode 100644 index 0000000000..26dfbd7833 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH204ARegisterCohortDefinition.java @@ -0,0 +1,44 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.cohort.definition; + +import org.openmrs.Encounter; +import org.openmrs.module.reporting.cohort.definition.BaseCohortDefinition; +import org.openmrs.module.reporting.common.Localized; +import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; +import org.openmrs.module.reporting.query.BaseQuery; +import org.openmrs.module.reporting.query.encounter.definition.EncounterQuery; + +import java.util.Date; + +/** + * MOH204 cohort definition + * OPD under 5 Register + */ +@Caching(strategy = ConfigurationPropertyCachingStrategy.class) +@Localized("reporting.MOH204ARegisterCohortDefinition") +public class MOH204ARegisterCohortDefinition extends BaseQuery implements EncounterQuery { + @ConfigurationProperty + private Date asOfDate; + + public MOH204ARegisterCohortDefinition() { + } + + public Date getAsOfDate() { + return asOfDate; + } + + public void setAsOfDate(Date asOfDate) { + this.asOfDate = asOfDate; + } + +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH204BRegisterCohortDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH204BRegisterCohortDefinition.java new file mode 100644 index 0000000000..18fa850e7d --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH204BRegisterCohortDefinition.java @@ -0,0 +1,43 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.cohort.definition; + +import org.openmrs.Encounter; +import org.openmrs.module.reporting.common.Localized; +import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; +import org.openmrs.module.reporting.query.BaseQuery; +import org.openmrs.module.reporting.query.encounter.definition.EncounterQuery; + +import java.util.Date; + +/** + * MOH204 cohort definition + * OPD >= 5 years Register + */ +@Caching(strategy = ConfigurationPropertyCachingStrategy.class) +@Localized("reporting.MOH204BRegisterCohortDefinition") +public class MOH204BRegisterCohortDefinition extends BaseQuery implements EncounterQuery { + @ConfigurationProperty + private Date asOfDate; + + public MOH204BRegisterCohortDefinition() { + } + + public Date getAsOfDate() { + return asOfDate; + } + + public void setAsOfDate(Date asOfDate) { + this.asOfDate = asOfDate; + } + +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH240LabRegisterCohortDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH240LabRegisterCohortDefinition.java new file mode 100644 index 0000000000..f5e1094dcf --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/MOH240LabRegisterCohortDefinition.java @@ -0,0 +1,43 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.cohort.definition; + +import org.openmrs.Encounter; +import org.openmrs.module.reporting.common.Localized; +import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; +import org.openmrs.module.reporting.query.BaseQuery; +import org.openmrs.module.reporting.query.encounter.definition.EncounterQuery; + +import java.util.Date; + +/** + * MOH240 Lab Register cohort definition + * OPD Register + */ +@Caching(strategy = ConfigurationPropertyCachingStrategy.class) +@Localized("reporting.MOH240LabRegisterCohortDefinition") +public class MOH240LabRegisterCohortDefinition extends BaseQuery implements EncounterQuery { + @ConfigurationProperty + private Date asOfDate; + + public MOH240LabRegisterCohortDefinition() { + } + + public Date getAsOfDate() { + return asOfDate; + } + + public void setAsOfDate(Date asOfDate) { + this.asOfDate = asOfDate; + } + +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH204ARegisterCohortDefinitionEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH204ARegisterCohortDefinitionEvaluator.java new file mode 100644 index 0000000000..a09708a3b0 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH204ARegisterCohortDefinitionEvaluator.java @@ -0,0 +1,60 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.cohort.definition.evaluator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH204ARegisterCohortDefinition; +import org.openmrs.module.reporting.common.ObjectUtil; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.openmrs.module.reporting.query.encounter.EncounterQueryResult; +import org.openmrs.module.reporting.query.encounter.definition.EncounterQuery; +import org.openmrs.module.reporting.query.encounter.evaluator.EncounterQueryEvaluator; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.List; + +/** + * Evaluator for patients for OPD Register + * < 5 years + */ +@Handler(supports = {MOH204ARegisterCohortDefinition.class}) +public class MOH204ARegisterCohortDefinitionEvaluator implements EncounterQueryEvaluator { + + private final Log log = LogFactory.getLog(this.getClass()); + @Autowired + EvaluationService evaluationService; + + public EncounterQueryResult evaluate(EncounterQuery definition, EvaluationContext context) throws EvaluationException { + context = ObjectUtil.nvl(context, new EvaluationContext()); + EncounterQueryResult queryResult = new EncounterQueryResult(definition, context); + + String qry = "SELECT ce.encounter_id from kenyaemr_etl.etl_clinical_encounter ce\n" + + " inner join kenyaemr_etl.etl_patient_demographics p on p.patient_id = ce.patient_id and p.voided = 0 and TIMESTAMPDIFF(YEAR, date(p.DOB), date(:startDate)) < 5\n" + + "where date(ce.visit_date) BETWEEN date(:startDate) AND date(:endDate)and ce.voided = 0;"; + + SqlQueryBuilder builder = new SqlQueryBuilder(); + builder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + builder.addParameter("endDate", endDate); + builder.addParameter("startDate", startDate); + + List results = evaluationService.evaluateToList(builder, Integer.class, context); + queryResult.getMemberIds().addAll(results); + return queryResult; + } + +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH204BRegisterCohortDefinitionEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH204BRegisterCohortDefinitionEvaluator.java new file mode 100644 index 0000000000..5147ade463 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH204BRegisterCohortDefinitionEvaluator.java @@ -0,0 +1,60 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.cohort.definition.evaluator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH204BRegisterCohortDefinition; +import org.openmrs.module.reporting.common.ObjectUtil; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.openmrs.module.reporting.query.encounter.EncounterQueryResult; +import org.openmrs.module.reporting.query.encounter.definition.EncounterQuery; +import org.openmrs.module.reporting.query.encounter.evaluator.EncounterQueryEvaluator; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.List; + +/** + * Evaluator for patients for OPD Register + * >= 5 years + */ +@Handler(supports = {MOH204BRegisterCohortDefinition.class}) +public class MOH204BRegisterCohortDefinitionEvaluator implements EncounterQueryEvaluator { + + private final Log log = LogFactory.getLog(this.getClass()); + @Autowired + EvaluationService evaluationService; + + public EncounterQueryResult evaluate(EncounterQuery definition, EvaluationContext context) throws EvaluationException { + context = ObjectUtil.nvl(context, new EvaluationContext()); + EncounterQueryResult queryResult = new EncounterQueryResult(definition, context); + + String qry = "SELECT ce.encounter_id from kenyaemr_etl.etl_clinical_encounter ce\n" + + " inner join kenyaemr_etl.etl_patient_demographics p on p.patient_id = ce.patient_id and p.voided = 0 and TIMESTAMPDIFF(YEAR, date(p.DOB), date(:startDate)) >= 5\n" + + "where date(ce.visit_date) BETWEEN date(:startDate) AND date(:endDate)and ce.voided = 0;"; + + SqlQueryBuilder builder = new SqlQueryBuilder(); + builder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + builder.addParameter("endDate", endDate); + builder.addParameter("startDate", startDate); + + List results = evaluationService.evaluateToList(builder, Integer.class, context); + queryResult.getMemberIds().addAll(results); + return queryResult; + } + +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH240LabRegisterCohortDefinitionEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH240LabRegisterCohortDefinitionEvaluator.java new file mode 100644 index 0000000000..689b9a73ab --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/MOH240LabRegisterCohortDefinitionEvaluator.java @@ -0,0 +1,61 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.cohort.definition.evaluator; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH204BRegisterCohortDefinition; +import org.openmrs.module.kenyaemr.reporting.cohort.definition.MOH240LabRegisterCohortDefinition; +import org.openmrs.module.reporting.common.ObjectUtil; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.openmrs.module.reporting.query.encounter.EncounterQueryResult; +import org.openmrs.module.reporting.query.encounter.definition.EncounterQuery; +import org.openmrs.module.reporting.query.encounter.evaluator.EncounterQueryEvaluator; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.List; + +/** + * Evaluator for patients MOH240 Lab Cohort Evaluator + * OPD Register + */ +@Handler(supports = {MOH240LabRegisterCohortDefinition.class}) +public class MOH240LabRegisterCohortDefinitionEvaluator implements EncounterQueryEvaluator { + + private final Log log = LogFactory.getLog(this.getClass()); + @Autowired + EvaluationService evaluationService; + + public EncounterQueryResult evaluate(EncounterQuery definition, EvaluationContext context) throws EvaluationException { + context = ObjectUtil.nvl(context, new EvaluationContext()); + EncounterQueryResult queryResult = new EncounterQueryResult(definition, context); + + String qry = "SELECT le.encounter_id from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join kenyaemr_etl.etl_patient_demographics p on p.patient_id = le.patient_id and p.voided = 0\n" + + "where date(le.visit_date) BETWEEN date(:startDate) AND date(:endDate);"; + + SqlQueryBuilder builder = new SqlQueryBuilder(); + builder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + builder.addParameter("endDate", endDate); + builder.addParameter("startDate", startDate); + + List results = evaluationService.evaluateToList(builder, Integer.class, context); + queryResult.getMemberIds().addAll(results); + return queryResult; + } + +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/CholeraCohortDefinitionEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/CholeraCohortDefinitionEvaluator.java index abee37c375..cf88e7114d 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/CholeraCohortDefinitionEvaluator.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/CholeraCohortDefinitionEvaluator.java @@ -51,12 +51,12 @@ public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationCon String qry = "select a.patient_id\n" + "from (select patient_id, c.visit_date,group_concat(c.complaint) as complaint, c.complaint_date as complaint_date\n" + " from kenyaemr_etl.etl_allergy_chronic_illness c\n" + - " where c.complaint in (142412,122983)\n" + + " where c.complaint in (161887,122983)\n" + " and date(c.visit_date) between date(:startDate) and date(:endDate)\n" + " group by patient_id) a\n" + " join kenyaemr_etl.etl_patient_demographics d on a.patient_id = d.patient_id\n" + "where timestampdiff(YEAR,date(d.DOB),coalesce(date(a.complaint_date),date(a.visit_date))) > 2 and FIND_IN_SET(122983, a.complaint) > 0\n" + - " and FIND_IN_SET(142412, a.complaint) > 0;"; + " and FIND_IN_SET(161887, a.complaint) > 0;"; SqlQueryBuilder builder = new SqlQueryBuilder(); builder.append(qry); diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/IDSRSuspectedCasesCohortDefinitionEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/IDSRSuspectedCasesCohortDefinitionEvaluator.java index e7e71b10fb..abc6defed4 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/IDSRSuspectedCasesCohortDefinitionEvaluator.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/cohort/definition/evaluator/dmi/IDSRSuspectedCasesCohortDefinitionEvaluator.java @@ -70,7 +70,7 @@ public EvaluatedCohort evaluate(CohortDefinition cohortDefinition, EvaluationCon " date(t.visit_date) between date(:startDate) and date(:endDate)\n" + " group by patient_id) a\n" + "where ((FIND_IN_SET(117671, a.complaint) > 0 AND FIND_IN_SET(142412, a.complaint) > 0)\n" + - " OR (FIND_IN_SET(142412, a.complaint) > 0 AND FIND_IN_SET(122983, a.complaint) > 0 AND\n" + + " OR (FIND_IN_SET(161887, a.complaint) > 0 AND FIND_IN_SET(122983, a.complaint) > 0 AND\n" + " timestampdiff(YEAR, date(a.DOB), coalesce(date(a.complaint_date), date(a.visit_date))) > 2)\n" + " OR (FIND_IN_SET(143264, a.complaint) > 0 AND timestampdiff(DAY, date(a.complaint_date), date(a.visit_date)) < 10 AND\n" + " date(a.visit_date) BETWEEN DATE(:startDate) AND DATE(:endDate) AND a.visit_type_id IN (1, 3) AND\n" + diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskCategorizationDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskCategorizationDataDefinition.java new file mode 100644 index 0000000000..0713baae9d --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskCategorizationDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.art; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * Most current risk categorization + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class LastRiskCategorizationDataDefinition extends BaseDataDefinition implements PersonDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public LastRiskCategorizationDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public LastRiskCategorizationDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskEvaluationDateDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskEvaluationDateDataDefinition.java new file mode 100644 index 0000000000..ca79ae2963 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskEvaluationDateDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.art; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * Most current risk evaluation date + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class LastRiskEvaluationDateDataDefinition extends BaseDataDefinition implements PersonDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public LastRiskEvaluationDateDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public LastRiskEvaluationDateDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskScoreDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskScoreDataDefinition.java new file mode 100644 index 0000000000..219c7538e0 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/art/LastRiskScoreDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.art; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * Most current risk score + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class LastRiskScoreDataDefinition extends BaseDataDefinition implements PersonDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public LastRiskScoreDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public LastRiskScoreDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/anc/ANCWeightDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/anc/ANCWeightDataEvaluator.java index bf8496e05b..7c3c4ca08a 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/anc/ANCWeightDataEvaluator.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/anc/ANCWeightDataEvaluator.java @@ -37,7 +37,7 @@ public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, Evalu String qry = "select\n" + " v.encounter_id,\n" + - " coalesce(v.weight,t.weight) as height\n" + + " coalesce(v.weight,t.weight) as weight\n" + " from kenyaemr_etl.etl_mch_antenatal_visit v\n" + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + " where date(v.visit_date) between date(:startDate) and date(:endDate);"; diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskCategorizationDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskCategorizationDataEvaluator.java new file mode 100644 index 0000000000..e829981ae3 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskCategorizationDataEvaluator.java @@ -0,0 +1,53 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.art; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.LastRiskCategorizationDataDefinition; +import org.openmrs.module.reporting.data.person.EvaluatedPersonData; +import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; +import org.openmrs.module.reporting.data.person.evaluator.PersonDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates LastRiskCategorizationDataDefinition + */ +@Handler(supports= LastRiskCategorizationDataDefinition.class, order=50) +public class LastRiskCategorizationDataEvaluator implements PersonDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedPersonData evaluate(PersonDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedPersonData c = new EvaluatedPersonData(definition, context); + + String qry = "select ml.patient_id,\n" + + " mid(max(concat(ml.date_created ,concat(ml.description ))),20) as risk_score\n" + + "from kenyaemr_ml_patient_risk_score ml where ml.date_created <= date(:endDate)\n" + + "GROUP BY ml.patient_id;"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskEvaluationDateDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskEvaluationDateDataEvaluator.java new file mode 100644 index 0000000000..04d031f5c5 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskEvaluationDateDataEvaluator.java @@ -0,0 +1,54 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.art; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.LastRiskCategorizationDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.LastRiskEvaluationDateDataDefinition; +import org.openmrs.module.reporting.data.person.EvaluatedPersonData; +import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; +import org.openmrs.module.reporting.data.person.evaluator.PersonDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates LastRiskCategorizationDataDefinition + */ +@Handler(supports= LastRiskEvaluationDateDataDefinition.class, order=50) +public class LastRiskEvaluationDateDataEvaluator implements PersonDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedPersonData evaluate(PersonDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedPersonData c = new EvaluatedPersonData(definition, context); + + String qry = "select ml.patient_id,\n" + + " mid(max(concat(ml.date_created ,NULLIF(concat(date(ml.evaluation_date)),'0000-00-00'))),20) as evaluation_date\n" + + "from kenyaemr_ml_patient_risk_score ml where ml.date_created <= date(:endDate)\n" + + "GROUP BY ml.patient_id;"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskScoreDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskScoreDataEvaluator.java new file mode 100644 index 0000000000..eaa2b32afc --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/art/LastRiskScoreDataEvaluator.java @@ -0,0 +1,53 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.art; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.art.LastRiskScoreDataDefinition; +import org.openmrs.module.reporting.data.person.EvaluatedPersonData; +import org.openmrs.module.reporting.data.person.definition.PersonDataDefinition; +import org.openmrs.module.reporting.data.person.evaluator.PersonDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates LastRiskScoreDataDefinition + */ +@Handler(supports= LastRiskScoreDataDefinition.class, order=50) +public class LastRiskScoreDataEvaluator implements PersonDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedPersonData evaluate(PersonDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedPersonData c = new EvaluatedPersonData(definition, context); + + String qry = "select ml.patient_id,\n" + + " mid(max(concat(ml.date_created ,concat(ml.risk_score ))),20) as risk_score\n" + + " from kenyaemr_ml_patient_risk_score ml where ml.date_created <= date(:endDate)\n" + + " GROUP BY ml.patient_id;"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDBMIDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDBMIDataEvaluator.java new file mode 100644 index 0000000000..1ffa85b102 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDBMIDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDBMIDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD BMI + * OPD Register + */ +@Handler(supports= OPDBMIDataDefinition.class, order=50) +public class OPDBMIDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " ROUND(t.weight/(t.height * t.height)*10000,1) as bmi\n" + + " from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + " where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDBloodPressureDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDBloodPressureDataEvaluator.java new file mode 100644 index 0000000000..5943203b6c --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDBloodPressureDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDBloodPressureDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDHeightDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD Height + * OPD Register + */ +@Handler(supports= OPDBloodPressureDataDefinition.class, order=50) +public class OPDBloodPressureDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select v.encounter_id,\n" + + " concat(t.systolic_pressure, '/',t.diastolic_pressure) as blood_pressure\n" + + " from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDClinicalDiagnosisDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDClinicalDiagnosisDataEvaluator.java new file mode 100644 index 0000000000..eaff987d16 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDClinicalDiagnosisDataEvaluator.java @@ -0,0 +1,61 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDClinicalDiagnosisDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDiagnosisDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Clinical Diagnosis + * MOH 240 Lab Register Register + */ +@Handler(supports= OPDClinicalDiagnosisDataDefinition.class, order=50) +public class OPDClinicalDiagnosisDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " le.encounter_id,\n" + + " dl.name as clinical_diagnosis\n" + + " from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join (select\n" + + " cn.name, ed.date_created, ed.dx_rank ,ed.patient_id\n" + + " from openmrs.encounter_diagnosis ed\n" + + " inner join openmrs.concept_name cn on cn.concept_id = ed.diagnosis_coded and cn.locale = 'en' and ed.dx_rank = 1\n" + + " ) dl on le.patient_id = dl.patient_id and date(dl.date_created) = date(le.visit_date)\n" + + " and date(le.visit_Date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDComplaintDurationDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDComplaintDurationDataEvaluator.java new file mode 100644 index 0000000000..3cb4c53b2e --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDComplaintDurationDataEvaluator.java @@ -0,0 +1,57 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDComplaintDurationDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDangerSignsDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Complaint duration Saturation + * OPD Register + */ +@Handler(supports= OPDComplaintDurationDataDefinition.class, order=50) +public class OPDComplaintDurationDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " a.complaint_duration\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_allergy_chronic_illness a ON v.patient_id = a.patient_id AND date(v.visit_date) = date(a.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDangerSignsDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDangerSignsDataEvaluator.java new file mode 100644 index 0000000000..553542424d --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDangerSignsDataEvaluator.java @@ -0,0 +1,62 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDangerSignsDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Danger signs Saturation + * OPD Register + */ +@Handler(supports= OPDDangerSignsDataDefinition.class, order=50) +public class OPDDangerSignsDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " (case a.complaint\n" + + " when 159861 then 1\n" + + " when 6017 then 1\n" + + " when 122983 then 2\n" + + " when 113054 then 3\n" + + " when 144576 then 4\n" + + " when 116334 then 4 end) as danger_signs\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_allergy_chronic_illness a ON v.patient_id = a.patient_id AND date(v.visit_date) = date(a.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDateSampleCollectedDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDateSampleCollectedDataEvaluator.java new file mode 100644 index 0000000000..4ff674303f --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDateSampleCollectedDataEvaluator.java @@ -0,0 +1,54 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDateSampleCollectedDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDSpecimenTypeDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Date sample collected + * OPD Lab Register + */ +@Handler(supports= OPDDateSampleCollectedDataDefinition.class, order=50) +public class OPDDateSampleCollectedDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "SELECT le.encounter_id, le.date_test_requested from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join kenyaemr_etl.etl_patient_demographics p on p.patient_id = le.patient_id and p.voided = 0\n" + + "where date(le.visit_date) BETWEEN date(:startDate) AND date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDateSampleReceivedDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDateSampleReceivedDataEvaluator.java new file mode 100644 index 0000000000..88dfdfab68 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDateSampleReceivedDataEvaluator.java @@ -0,0 +1,54 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDateSampleCollectedDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDateSampleReceivedDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Date sample collected + * OPD Lab Register + */ +@Handler(supports= OPDDateSampleReceivedDataDefinition.class, order=50) +public class OPDDateSampleReceivedDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "SELECT le.encounter_id, le.date_test_result_received from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join kenyaemr_etl.etl_patient_demographics p on p.patient_id = le.patient_id and p.voided = 0\n" + + "where date(le.visit_date) BETWEEN date(:startDate) AND date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDiagnosisDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDiagnosisDataEvaluator.java new file mode 100644 index 0000000000..d694769c81 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDDiagnosisDataEvaluator.java @@ -0,0 +1,60 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDiagnosisDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Diagnosis + * OPD Register + */ +@Handler(supports= OPDDiagnosisDataDefinition.class, order=50) +public class OPDDiagnosisDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " con.name as mnci_diagnosis\n" + + " from kenyaemr_etl.etl_clinical_encounter v\n" + + " inner join (select\n" + + " cn.name, cn.date_created, ed.patient_id\n" + + " from encounter_diagnosis ed\n" + + " inner join concept_name cn on cn.concept_id = ed.diagnosis_coded and cn.locale = 'en'\n" + + " and date(ed.date_created) between date(:startDate) and date(:endDate)\n" + + " ) con on v.patient_id = con.patient_id and date(v.visit_Date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDHeightDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDHeightDataEvaluator.java new file mode 100644 index 0000000000..db712e9247 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDHeightDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDHeightDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD Height + * OPD Register + */ +@Handler(supports= OPDHeightDataDefinition.class, order=50) +public class OPDHeightDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " t.height as height\n" + + " from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + " where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDImmunizationStatusDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDImmunizationStatusDataEvaluator.java new file mode 100644 index 0000000000..1bdfa5fa61 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDImmunizationStatusDataEvaluator.java @@ -0,0 +1,55 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDImmunizationStatusDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Immunization status prescribed + * OPD Register + */ +@Handler(supports= OPDImmunizationStatusDataDefinition.class, order=50) +public class OPDImmunizationStatusDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select v.encounter_id,\n" + + " if(m.fully_immunized = 1065,'Y','N') as fully_immunized\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " INNER JOIN kenyaemr_etl.etl_hei_immunization m ON v.patient_id = m.patient_id\n" + + " and date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDInvestigationRequiredDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDInvestigationRequiredDataEvaluator.java new file mode 100644 index 0000000000..39952b2511 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDInvestigationRequiredDataEvaluator.java @@ -0,0 +1,57 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDClinicalDiagnosisDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDInvestigationRequiredDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Investigation Required + * MOH 240 Lab Register Register + */ +@Handler(supports= OPDInvestigationRequiredDataDefinition.class, order=50) +public class OPDInvestigationRequiredDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select le.encounter_id,\n" + + " cn.name as investigation_required\n" + + "from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join openmrs.concept_name cn on cn.concept_id = le.lab_test and cn.locale = 'en'\n" + + "where date(le.visit_date) between date(:startDate) and date(:endDate)\n" + + "group by le.encounter_id;"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabReferralsDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabReferralsDataEvaluator.java new file mode 100644 index 0000000000..5d0c0340fa --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabReferralsDataEvaluator.java @@ -0,0 +1,57 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDLabReferralsDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDLabResultsDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Lab referrals + * MOH 240 Lab Register + */ +@Handler(supports= OPDLabReferralsDataDefinition.class, order=50) +public class OPDLabReferralsDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + "le.encounter_id,\n" + + " (case v.referral_to when 'This health facility' then 1 when 'Other health facility' then 2 when 'Community Unit' then 3 else '' end) as referred_to\n" + + " from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join kenyaemr_etl.etl_clinical_encounter v on v.patient_id = le.patient_id and date(v.visit_date) = date(le.visit_date)\n" + + "where date(le.visit_date) BETWEEN date(:startDate) AND date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabRemarksDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabRemarksDataEvaluator.java new file mode 100644 index 0000000000..33ffc35856 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabRemarksDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDLabRemarksDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Lab remarks + * MOH 240 Lab Register + */ +@Handler(supports= OPDLabRemarksDataDefinition.class, order=50) +public class OPDLabRemarksDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " le.encounter_id,\n" + + " p.notes\n" + + "from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join kenyaemr_etl.etl_progress_note p on p.patient_id = le.patient_id and date(p.visit_date) = date(le.visit_date)\n" + + "where date(le.visit_date) BETWEEN date(:startDate) AND date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabResultsDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabResultsDataEvaluator.java new file mode 100644 index 0000000000..3c656b430b --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabResultsDataEvaluator.java @@ -0,0 +1,54 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDClinicalDiagnosisDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDLabResultsDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Lab results + * MOH 240 Lab Register + */ +@Handler(supports= OPDLabResultsDataDefinition.class, order=50) +public class OPDLabResultsDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "SELECT le.encounter_id, le.test_result FROM kenyaemr_etl.etl_laboratory_extract le\n" + + " INNER JOIN kenyaemr_etl.etl_patient_demographics p ON p.patient_id = le.patient_id AND p.voided = 0\n" + + "WHERE date(le.visit_date) BETWEEN date(:startDate) AND date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabResultsDateDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabResultsDateDataEvaluator.java new file mode 100644 index 0000000000..5abea5bd05 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDLabResultsDateDataEvaluator.java @@ -0,0 +1,54 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDLabResultsDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDLabResultsDateDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Lab results date + * MOH 240 Lab Register + */ +@Handler(supports= OPDLabResultsDateDataDefinition.class, order=50) +public class OPDLabResultsDateDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "SELECT le.encounter_id, le.date_test_result_received from kenyaemr_etl.etl_laboratory_extract le\n" + + " inner join kenyaemr_etl.etl_patient_demographics p on p.patient_id = le.patient_id and p.voided = 0\n" + + "where date(le.visit_date) BETWEEN date(:startDate) AND date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDMalariaAssessmentDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDMalariaAssessmentDataEvaluator.java new file mode 100644 index 0000000000..59bff146cb --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDMalariaAssessmentDataEvaluator.java @@ -0,0 +1,62 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDComplaintDurationDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDMalariaAssessmentDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Malaria assessment + * OPD Register + */ +@Handler(supports= OPDMalariaAssessmentDataDefinition.class, order=50) +public class OPDMalariaAssessmentDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " if(ed.diagnosis_coded = 166623 and x.lab_test not in (1643,32,1366), 1,\n" + + "+ if(x.lab_test = 1643 and x.test_result = 664, 2,\n" + + "+ if(x.lab_test in (32) and x.test_result = 664, 3,\n" + + "+ if(x.lab_test in (1643) and x.test_result = 703, 4,\n" + + "+ if(x.lab_test in (32) and x.test_result = 703, 5,''))))) as malaria\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN encounter_diagnosis ed ON v.patient_id = ed.patient_id and date(ed.date_created)between date(:startDate) and date(:endDate)\n" + + " LEFT JOIN kenyaemr_etl.etl_laboratory_extract x ON v.patient_id = x.patient_id AND date(v.visit_date) between date(:startDate) and date(:endDate)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDMuacDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDMuacDataEvaluator.java new file mode 100644 index 0000000000..abe14b52fb --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDMuacDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDMuacDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD MUAC + * OPD Register + */ +@Handler(supports= OPDMuacDataDefinition.class, order=50) +public class OPDMuacDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " t.muac as muac\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDNonTracerDrugsPrescribedDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDNonTracerDrugsPrescribedDataEvaluator.java new file mode 100644 index 0000000000..bce3bf7e31 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDNonTracerDrugsPrescribedDataEvaluator.java @@ -0,0 +1,57 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDNonTracerDrugsPrescribedDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDTracerDrugsPrescribedDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Tracer drugs prescribed + * OPD Register + */ +@Handler(supports= OPDNonTracerDrugsPrescribedDataDefinition.class, order=50) +public class OPDNonTracerDrugsPrescribedDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select v.encounter_id,\n" + + " d.drug_name\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " INNER JOIN kenyaemr_etl.etl_drug_order d ON v.patient_id = d.patient_id and date(d.visit_date) = date(v.visit_date)\n" + + "where d.drug_concept_id not in (351,86672,71161,86339,81341,70439,162650) \n" + + " and date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDNutritionalInterventionsDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDNutritionalInterventionsDataEvaluator.java new file mode 100644 index 0000000000..94529d1237 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDNutritionalInterventionsDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDNutritionalInterventionsDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDTbScreeningDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Nutritional Interventions + * OPD Register + */ +@Handler(supports= OPDNutritionalInterventionsDataDefinition.class, order=50) +public class OPDNutritionalInterventionsDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " (case v.counselling_ordered when 1380 then 1 else '' end) as nutritional_interventios\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOrderingClinicianDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOrderingClinicianDataEvaluator.java new file mode 100644 index 0000000000..9ccccad0aa --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOrderingClinicianDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDDateSampleReceivedDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDOrderingClinicianDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Date sample collected + * OPD Lab Register + */ +@Handler(supports= OPDOrderingClinicianDataDefinition.class, order=50) +public class OPDOrderingClinicianDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select e.encounter_id, concat_ws(' ', pn.family_name, pn.given_name, pn.middle_name) as creator \n" + + " from encounter e\n" + + " inner join encounter_provider ep on ep.encounter_id=e.encounter_id\n" + + " inner join provider p on ep.provider_id = p.provider_id\n" + + " inner join person_name pn on pn.person_id = p.person_id ;"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOutcomeDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOutcomeDataEvaluator.java new file mode 100644 index 0000000000..e9e77b9b2c --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOutcomeDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDOutcomeDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDReferredToDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates outcome + * OPD Register + */ +@Handler(supports= OPDOutcomeDataDefinition.class, order=50) +public class OPDOutcomeDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " (case v.patient_outcome when 159 then 'Died' else 'Alive' end) as patient_outcome\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOxygenSaturationDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOxygenSaturationDataEvaluator.java new file mode 100644 index 0000000000..a9664a28bf --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDOxygenSaturationDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDOxygenSaturationDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD Oxygen Saturation + * OPD Register + */ +@Handler(supports= OPDOxygenSaturationDataDefinition.class, order=50) +public class OPDOxygenSaturationDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " t.oxygen_saturation as oxygen_saturation\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDPriorTreatmentsPrescribedDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDPriorTreatmentsPrescribedDataEvaluator.java new file mode 100644 index 0000000000..e70d2502f2 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDPriorTreatmentsPrescribedDataEvaluator.java @@ -0,0 +1,59 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDPriorTreatmentsPrescribedDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDTreatmentPrescribedDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates prior lab treatment prescribed + * OPD Register + */ +@Handler(supports= OPDPriorTreatmentsPrescribedDataDefinition.class, order=50) +public class OPDPriorTreatmentsPrescribedDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select le.encounter_id,\n" + + " d.drug_name\n" + + " from kenyaemr_etl.etl_laboratory_extract le\n" + + " INNER JOIN kenyaemr_etl.etl_drug_order d ON le.patient_id = d.patient_id\n" + + " and d.enc_name = 'Drug Order'\n" + + " and date(d.visit_date) = date(le.visit_date)\n" + + " where date(le.visit_date) between date(:startDate) and date(:endDate)\n" + + " group by d.encounter_id"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDPulseRateDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDPulseRateDataEvaluator.java new file mode 100644 index 0000000000..02e57f91f8 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDPulseRateDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDPulseRateDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Pulse Rate Saturation + * OPD Register + */ +@Handler(supports= OPDPulseRateDataDefinition.class, order=50) +public class OPDPulseRateDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " t.pulse_rate as pulse_rate\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDReferredFromDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDReferredFromDataEvaluator.java new file mode 100644 index 0000000000..c66fba1548 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDReferredFromDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDReferredFromDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDReferredToDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Referred From + * OPD Register + */ +@Handler(supports= OPDReferredFromDataDefinition.class, order=50) +public class OPDReferredFromDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " (case v.visit_type when 'Transfer in' then 2 else '' end) as referred_from\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDReferredToDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDReferredToDataEvaluator.java new file mode 100644 index 0000000000..312f5de594 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDReferredToDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDNutritionalInterventionsDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDReferredToDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Referred to + * OPD Register + */ +@Handler(supports= OPDReferredToDataDefinition.class, order=50) +public class OPDReferredToDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " (case v.referral_to when 'Community Unit' then 1 when 'Other health facility' then 2 when 'This health facility' then 3 else '' end) as referred_to\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDRespiratoryRateDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDRespiratoryRateDataEvaluator.java new file mode 100644 index 0000000000..39ceb22023 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDRespiratoryRateDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDRespiratoryRateDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD Respiratory Rate + * OPD Register + */ +@Handler(supports= OPDRespiratoryRateDataDefinition.class, order=50) +public class OPDRespiratoryRateDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " t.respiratory_rate as respiratory_rate\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDSpecimenTypeDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDSpecimenTypeDataEvaluator.java new file mode 100644 index 0000000000..2eee28a9c1 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDSpecimenTypeDataEvaluator.java @@ -0,0 +1,51 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDSpecimenTypeDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Specimen Type + * OPD Lab Register + */ +@Handler(supports= OPDSpecimenTypeDataDefinition.class, order=50) +public class OPDSpecimenTypeDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = ""; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTbScreeningDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTbScreeningDataEvaluator.java new file mode 100644 index 0000000000..c5c5ea6519 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTbScreeningDataEvaluator.java @@ -0,0 +1,57 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDImmunizationStatusDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDTbScreeningDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Tb screening prescribed + * OPD Register + */ +@Handler(supports= OPDTbScreeningDataDefinition.class, order=50) +public class OPDTbScreeningDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " (case t.resulting_tb_status when 1660 then 'No TB Signs' when 142177 then 'Presumed TB' when 1662 then 'TB Confirmed' when 160737 then 'TB Screening Not Done' else '' end) as resulting_tb_status\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_tb_screening t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTemperatureDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTemperatureDataEvaluator.java new file mode 100644 index 0000000000..6719ccecc2 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTemperatureDataEvaluator.java @@ -0,0 +1,57 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDTemperatureDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDWeightDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD Temperature + * OPD Register + */ +@Handler(supports= OPDTemperatureDataDefinition.class, order=50) +public class OPDTemperatureDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " t.temperature as temperature\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTracerDrugsPrescribedDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTracerDrugsPrescribedDataEvaluator.java new file mode 100644 index 0000000000..849af9e47c --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTracerDrugsPrescribedDataEvaluator.java @@ -0,0 +1,63 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDMalariaAssessmentDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDTracerDrugsPrescribedDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates Tracer drugs prescribed + * OPD Register + */ +@Handler(supports= OPDTracerDrugsPrescribedDataDefinition.class, order=50) +public class OPDTracerDrugsPrescribedDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select v.encounter_id,\n" + + " if(d.drug_concept_id = 351, 1,\n" + + " if(d.drug_concept_id = 86672 , 2,\n" + + " if(d.drug_concept_id = 351 , 3,\n" + + " if(d.drug_concept_id = 71161 , 4,\n" + + " if(d.drug_concept_id = 86339 , 5,\n" + + " if(d.drug_concept_id = 81341 , 6,\n" + + " if(d.drug_concept_id = 70439 , 7,\n" + + " if(d.drug_concept_id = 162650 , 8,'')))))))) as tracer_drugs_prescribed\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " INNER JOIN kenyaemr_etl.etl_drug_order d ON v.patient_id = d.patient_id and date(d.visit_date) = date(v.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTreatmentPrescribedDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTreatmentPrescribedDataEvaluator.java new file mode 100644 index 0000000000..01bb929729 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDTreatmentPrescribedDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDNonTracerDrugsPrescribedDataDefinition; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDTreatmentPrescribedDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates treatment prescribed + * OPD Register + */ +@Handler(supports= OPDTreatmentPrescribedDataDefinition.class, order=50) +public class OPDTreatmentPrescribedDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select v.encounter_id,\n" + + " d.drug_name\n" + + " from kenyaemr_etl.etl_clinical_encounter v\n" + + " INNER JOIN kenyaemr_etl.etl_drug_order d ON v.patient_id = d.patient_id and date(d.visit_date) = date(v.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDWeightDataEvaluator.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDWeightDataEvaluator.java new file mode 100644 index 0000000000..46c3db00aa --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/evaluator/opd/OPDWeightDataEvaluator.java @@ -0,0 +1,56 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.evaluator.opd; + +import org.openmrs.annotation.Handler; +import org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd.OPDWeightDataDefinition; +import org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.data.encounter.evaluator.EncounterDataEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.querybuilder.SqlQueryBuilder; +import org.openmrs.module.reporting.evaluation.service.EvaluationService; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.Date; +import java.util.Map; + +/** + * Evaluates OPD Weight + * OPD Register + */ +@Handler(supports= OPDWeightDataDefinition.class, order=50) +public class OPDWeightDataEvaluator implements EncounterDataEvaluator { + + @Autowired + private EvaluationService evaluationService; + + public EvaluatedEncounterData evaluate(EncounterDataDefinition definition, EvaluationContext context) throws EvaluationException { + EvaluatedEncounterData c = new EvaluatedEncounterData(definition, context); + + String qry = "select\n" + + " v.encounter_id,\n" + + " t.weight as weight\n" + + "from kenyaemr_etl.etl_clinical_encounter v\n" + + " LEFT JOIN kenyaemr_etl.etl_patient_triage t ON v.patient_id = t.patient_id AND date(v.visit_date) = date(t.visit_date)\n" + + "where date(v.visit_date) between date(:startDate) and date(:endDate);\n"; + + SqlQueryBuilder queryBuilder = new SqlQueryBuilder(); + queryBuilder.append(qry); + Date startDate = (Date)context.getParameterValue("startDate"); + Date endDate = (Date)context.getParameterValue("endDate"); + queryBuilder.addParameter("endDate", endDate); + queryBuilder.addParameter("startDate", startDate); + Map data = evaluationService.evaluateToMap(queryBuilder, Integer.class, Object.class, context); + c.setData(data); + return c; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDBMIDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDBMIDataDefinition.java new file mode 100644 index 0000000000..357591c049 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDBMIDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD BMI Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDBMIDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDBMIDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDBMIDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDBloodPressureDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDBloodPressureDataDefinition.java new file mode 100644 index 0000000000..1bb3dbfc16 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDBloodPressureDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Blood pressure Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDBloodPressureDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDBloodPressureDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDBloodPressureDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDClinicalDiagnosisDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDClinicalDiagnosisDataDefinition.java new file mode 100644 index 0000000000..09ecc2f5fb --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDClinicalDiagnosisDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Diagnosis + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDClinicalDiagnosisDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDClinicalDiagnosisDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDClinicalDiagnosisDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDComplaintDurationDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDComplaintDurationDataDefinition.java new file mode 100644 index 0000000000..87fed84546 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDComplaintDurationDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Complaint Duration Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDComplaintDurationDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDComplaintDurationDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDComplaintDurationDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDangerSignsDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDangerSignsDataDefinition.java new file mode 100644 index 0000000000..ab91796d35 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDangerSignsDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Danger Signs Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDDangerSignsDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDDangerSignsDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDDangerSignsDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDateSampleCollectedDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDateSampleCollectedDataDefinition.java new file mode 100644 index 0000000000..ff6e3c4082 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDateSampleCollectedDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD labs Date sample collected Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDDateSampleCollectedDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDDateSampleCollectedDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDDateSampleCollectedDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDateSampleReceivedDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDateSampleReceivedDataDefinition.java new file mode 100644 index 0000000000..3053d10348 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDateSampleReceivedDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD labs Date sample received Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDDateSampleReceivedDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDDateSampleReceivedDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDDateSampleReceivedDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDiagnosisDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDiagnosisDataDefinition.java new file mode 100644 index 0000000000..285449dcc4 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDDiagnosisDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Diagnosis + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDDiagnosisDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDDiagnosisDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDDiagnosisDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDHeightDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDHeightDataDefinition.java new file mode 100644 index 0000000000..76215e32ba --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDHeightDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Height Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDHeightDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDHeightDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDHeightDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDImmunizationStatusDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDImmunizationStatusDataDefinition.java new file mode 100644 index 0000000000..a6a772c157 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDImmunizationStatusDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Immunization status Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDImmunizationStatusDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDImmunizationStatusDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDImmunizationStatusDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDInvestigationRequiredDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDInvestigationRequiredDataDefinition.java new file mode 100644 index 0000000000..f6a427f295 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDInvestigationRequiredDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Investigation Required + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDInvestigationRequiredDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDInvestigationRequiredDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDInvestigationRequiredDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabReferralsDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabReferralsDataDefinition.java new file mode 100644 index 0000000000..e9c49e82e4 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabReferralsDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Lab Referrals + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDLabReferralsDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDLabReferralsDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDLabReferralsDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabRemarksDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabRemarksDataDefinition.java new file mode 100644 index 0000000000..01de4a3a86 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabRemarksDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Lab Remarks + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDLabRemarksDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDLabRemarksDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDLabRemarksDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabResultsDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabResultsDataDefinition.java new file mode 100644 index 0000000000..f7b1c52562 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabResultsDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Lab Results + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDLabResultsDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDLabResultsDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDLabResultsDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabResultsDateDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabResultsDateDataDefinition.java new file mode 100644 index 0000000000..545cf735dc --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDLabResultsDateDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Lab Results Date + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDLabResultsDateDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDLabResultsDateDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDLabResultsDateDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDMalariaAssessmentDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDMalariaAssessmentDataDefinition.java new file mode 100644 index 0000000000..acf796d8ee --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDMalariaAssessmentDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Malaria assessment Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDMalariaAssessmentDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDMalariaAssessmentDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDMalariaAssessmentDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDMuacDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDMuacDataDefinition.java new file mode 100644 index 0000000000..857b17ea17 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDMuacDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD MUAC Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDMuacDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDMuacDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDMuacDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDNonTracerDrugsPrescribedDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDNonTracerDrugsPrescribedDataDefinition.java new file mode 100644 index 0000000000..4a0976435d --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDNonTracerDrugsPrescribedDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Non Tracer drugs prescribed Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDNonTracerDrugsPrescribedDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDNonTracerDrugsPrescribedDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDNonTracerDrugsPrescribedDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDNutritionalInterventionsDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDNutritionalInterventionsDataDefinition.java new file mode 100644 index 0000000000..812197d909 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDNutritionalInterventionsDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Nutritional Interventions Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDNutritionalInterventionsDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDNutritionalInterventionsDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDNutritionalInterventionsDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOrderingClinicianDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOrderingClinicianDataDefinition.java new file mode 100644 index 0000000000..7c2dda7f71 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOrderingClinicianDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD labs Ordering clinician Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDOrderingClinicianDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDOrderingClinicianDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDOrderingClinicianDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOutcomeDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOutcomeDataDefinition.java new file mode 100644 index 0000000000..8246ee911e --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOutcomeDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Outcome Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDOutcomeDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDOutcomeDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDOutcomeDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOxygenSaturationDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOxygenSaturationDataDefinition.java new file mode 100644 index 0000000000..cbe5c8b320 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDOxygenSaturationDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Oxygen Saturation Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDOxygenSaturationDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDOxygenSaturationDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDOxygenSaturationDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDPriorTreatmentsPrescribedDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDPriorTreatmentsPrescribedDataDefinition.java new file mode 100644 index 0000000000..e9bdbb5e38 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDPriorTreatmentsPrescribedDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Prior labs Treatment prescribed Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDPriorTreatmentsPrescribedDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDPriorTreatmentsPrescribedDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDPriorTreatmentsPrescribedDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDPulseRateDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDPulseRateDataDefinition.java new file mode 100644 index 0000000000..6e60dd87f7 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDPulseRateDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Pulse Rate Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDPulseRateDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDPulseRateDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDPulseRateDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDReferredFromDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDReferredFromDataDefinition.java new file mode 100644 index 0000000000..dd359d29f7 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDReferredFromDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Referred From Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDReferredFromDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDReferredFromDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDReferredFromDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDReferredToDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDReferredToDataDefinition.java new file mode 100644 index 0000000000..7010d0694b --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDReferredToDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Referred to Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDReferredToDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDReferredToDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDReferredToDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDRespiratoryRateDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDRespiratoryRateDataDefinition.java new file mode 100644 index 0000000000..f675cad68e --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDRespiratoryRateDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Respiratory Rate Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDRespiratoryRateDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDRespiratoryRateDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDRespiratoryRateDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDSpecimenTypeDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDSpecimenTypeDataDefinition.java new file mode 100644 index 0000000000..0b9303286a --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDSpecimenTypeDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD labs Specimen Type Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDSpecimenTypeDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDSpecimenTypeDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDSpecimenTypeDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTbScreeningDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTbScreeningDataDefinition.java new file mode 100644 index 0000000000..e31e4d6fa3 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTbScreeningDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD TB screening Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDTbScreeningDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDTbScreeningDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDTbScreeningDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTemperatureDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTemperatureDataDefinition.java new file mode 100644 index 0000000000..eb5bb79925 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTemperatureDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Temperature Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDTemperatureDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDTemperatureDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDTemperatureDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTracerDrugsPrescribedDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTracerDrugsPrescribedDataDefinition.java new file mode 100644 index 0000000000..7d8c722fee --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTracerDrugsPrescribedDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Tracer drugs prescribed Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDTracerDrugsPrescribedDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDTracerDrugsPrescribedDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDTracerDrugsPrescribedDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTreatmentPrescribedDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTreatmentPrescribedDataDefinition.java new file mode 100644 index 0000000000..1405314ca8 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDTreatmentPrescribedDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** +// * OPD Non Treatment prescribed Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDTreatmentPrescribedDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDTreatmentPrescribedDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDTreatmentPrescribedDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDWeightDataDefinition.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDWeightDataDefinition.java new file mode 100644 index 0000000000..a8a4216f7c --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/data/converter/definition/opd/OPDWeightDataDefinition.java @@ -0,0 +1,47 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.data.converter.definition.opd; + +import org.openmrs.module.reporting.data.BaseDataDefinition; +import org.openmrs.module.reporting.data.encounter.definition.EncounterDataDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationPropertyCachingStrategy; +import org.openmrs.module.reporting.evaluation.caching.Caching; + +/** + * OPD Weight Column + */ +@Caching(strategy=ConfigurationPropertyCachingStrategy.class) +public class OPDWeightDataDefinition extends BaseDataDefinition implements EncounterDataDefinition { + + public static final long serialVersionUID = 1L; + + /** + * Default Constructor + */ + public OPDWeightDataDefinition() { + super(); + } + + /** + * Constructor to populate name only + */ + public OPDWeightDataDefinition(String name) { + super(name); + } + + //***** INSTANCE METHODS ***** + + /** + * @see org.openmrs.module.reporting.data.DataDefinition#getDataType() + */ + public Class getDataType() { + return Double.class; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705CohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705CohortLibrary.java index 87ae8c55fd..9f18413e56 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705CohortLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705CohortLibrary.java @@ -143,4 +143,38 @@ public CohortDefinition reAttendances(String age) { cd.setDescription("Patients who are revisit attendances"); return cd; } + /** + * MOH705 + * Referrals from other health facilities + * @return + */ + public CohortDefinition referralsFromOtherFacilities(String age) { + String sqlQuery = "SELECT v.patient_id FROM kenyaemr_etl.etl_clinical_encounter v\n" + + "INNER JOIN kenyaemr_etl.etl_patient_demographics d on v.patient_id = d.patient_id and timestampdiff(YEAR, date(d.dob),date(:endDate)) "+ age +"\n" + + "WHERE v.referral_to = 'This health facility' and date(v.visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("referralsFromOther"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients who are referrals To From Other"); + return cd; + } + /** + * MOH705 + * Referrals to other health facilities + * @return + */ + public CohortDefinition referralsToOtherFacilities(String age) { + String sqlQuery = "SELECT v.patient_id FROM kenyaemr_etl.etl_clinical_encounter v\n" + + "INNER JOIN kenyaemr_etl.etl_patient_demographics d on v.patient_id = d.patient_id and timestampdiff(YEAR, date(d.dob),date(:endDate)) "+ age +"\n" + + "WHERE v.referral_to = 'Other health facility' and date(v.visit_date) between date(:startDate) and date(:endDate);"; + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName("referralsToOther"); + cd.setQuery(sqlQuery); + cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); + cd.addParameter(new Parameter("endDate", "End Date", Date.class)); + cd.setDescription("Patients who are referrals To Other"); + return cd; + } } diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705IndicatorLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705IndicatorLibrary.java index 12686c383c..776d2f4ffb 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705IndicatorLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH705/MOH705IndicatorLibrary.java @@ -11,7 +11,7 @@ import org.apache.commons.lang3.StringUtils; import org.openmrs.module.kenyacore.report.ReportUtils; -import org.openmrs.module.kenyaemr.reporting.Moh705ReportUtils.DiagnosisLists; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.DiagnosisLists; import org.openmrs.module.reporting.indicator.CohortIndicator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -55,6 +55,12 @@ public CohortIndicator newAttendances(String age) { public CohortIndicator reAttendances(String age) { return cohortIndicator("Re attendances", ReportUtils.map(moh705CohortLibrary.reAttendances(age), "startDate=${startDate},endDate=${endDate}")); } + public CohortIndicator referralsFromOtherFacilities(String age) { + return cohortIndicator("referralsFromOtherFacilities", ReportUtils.map(moh705CohortLibrary.referralsFromOtherFacilities(age), "startDate=${startDate},endDate=${endDate}")); + } + public CohortIndicator referralsToOtherFacilities(String age) { + return cohortIndicator("referralsToOtherFacilities", ReportUtils.map(moh705CohortLibrary.referralsToOtherFacilities(age), "startDate=${startDate},endDate=${endDate}")); + } } diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH717/Moh705CohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH717/Moh705CohortLibrary.java new file mode 100644 index 0000000000..a5cb8a86c2 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH717/Moh705CohortLibrary.java @@ -0,0 +1,16 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.library.ETLReports.MOH717; + +import org.springframework.stereotype.Component; + +@Component +public class Moh705CohortLibrary { +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH731Greencard/ETLMoh731GreenCardCohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH731Greencard/ETLMoh731GreenCardCohortLibrary.java index 82c5d0beab..d93cff5781 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH731Greencard/ETLMoh731GreenCardCohortLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/MOH731Greencard/ETLMoh731GreenCardCohortLibrary.java @@ -1185,8 +1185,8 @@ public CohortDefinition referredAndLinkedSinceThreeMonthsAgo() { "from kenyaemr_etl.etl_hts_referral_and_linkage r\n" + "where (r.ccc_number != '' or r.ccc_number IS NOT NULL)\n" + " and (r.facility_linked_to != '' or r.facility_linked_to IS NOT NULL)\n" + - " and (r.art_start_date is not null or r.art_start_date != '')\n" + - " and (r.enrollment_date is not null or r.enrollment_date != '')\n" + + " and r.art_start_date is not null \n" + + " and r.enrollment_date is not null \n" + " and r.visit_date between date_sub(date(DATE_SUB(date(:endDate), INTERVAL DAYOFMONTH(date(:endDate)) - 1 DAY)),\n" + " interval 3 MONTH) and date(:endDate);"; SqlCohortDefinition cd = new SqlCohortDefinition(); diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/finacials/FacilityRevenueSummaries.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/finacials/FacilityRevenueSummaries.java new file mode 100644 index 0000000000..60361b6cac --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/ETLReports/finacials/FacilityRevenueSummaries.java @@ -0,0 +1,112 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.library.ETLReports.finacials; + +public class FacilityRevenueSummaries { + public static final String getMonthlySummaryQueryM1() { + return "select tbl.transaction_date as transaction_date,\n" + + " SUM(tbl.total_sales) as total_sales,\n" + + " SUM(tbl.ipd_cash) as ipd_cash,\n" + + " SUM(tbl.maternity) as maternity,\n" + + " SUM(tbl.xray) as xray,\n" + + " SUM(tbl.lab) as lab,\n" + + " SUM(tbl.theatre) as theatre,\n" + + " SUM(tbl.mortuary) as mortuary,\n" + + " SUM(tbl.op_treatment) as op_treatment,\n" + + " SUM(tbl.pharmacy) as pharmacy,\n" + + " SUM(tbl.medical_exam) as medical_exam,\n" + + " SUM(tbl.medical_reports_including_P3) as medical_reports_including_P3,\n" + + " SUM(tbl.dental) as dental,\n" + + " SUM(tbl.physio_therapy) as physio_therapy,\n" + + " SUM(tbl.occupational_therapy) as occupational_therapy,\n" + + " SUM(tbl.medical_records_cards_and_files) as medical_records_cards_and_files,\n" + + " SUM(tbl.booking_fees) as booking_fees,\n" + + " SUM(tbl.rental_services) as rental_services,\n" + + " SUM(tbl.ambulance) as ambulance,\n" + + " SUM(tbl.public_health_services) as public_health_services,\n" + + " SUM(tbl.ent_and_other_clinics) as ent_and_other_clinics,\n" + + " SUM(tbl.other) as other,\n" + + " SUM(tbl.cash_receipts_cash_from_daily_services) as cash_receipts_cash_from_daily_services,\n" + + " SUM(tbl.cash_receipt_nhif_receipt) as cash_receipt_nhif_receipt,\n" + + " SUM(tbl.cash_receipt_other_debtors_receipt) as cash_receipt_other_debtors_receipt,\n" + + " SUM(tbl.revenue_not_collected_patient_not_yet_paid_nhif_patients) as revenue_not_collected_patient_not_yet_paid_nhif_patients,\n" + + " SUM(tbl.revenue_not_collected_patient_not_yet_paid_other_debtors) as revenue_not_collected_patient_not_yet_paid_other_debtors,\n" + + " SUM(tbl.revenue_not_collected_patient_not_yet_paid_waivers) as revenue_not_collected_patient_not_yet_paid_waivers,\n" + + " SUM(tbl.revenue_not_collected_write_offs_exemptions) as revenue_not_collected_write_offs_exemptions,\n" + + " SUM(tbl.revenue_not_collected_write_offs_absconders) as revenue_not_collected_write_offs_absconders\n" + + "from (\n" + + " select transaction_date,\n" + + " total_sales,\n" + + " ipd_cash,\n" + + " maternity,\n" + + " xray,\n" + + " lab,\n" + + " theatre,\n" + + " mortuary,\n" + + " op_treatment,\n" + + " pharmacy,\n" + + " medical_exam,\n" + + " medical_reports_including_P3,\n" + + " dental,\n" + + " physio_therapy,\n" + + " occupational_therapy,\n" + + " medical_records_cards_and_files,\n" + + " booking_fees,\n" + + " rental_services,\n" + + " ambulance,\n" + + " public_health_services,\n" + + " ent_and_other_clinics,\n" + + " other,\n" + + " cash_receipts_cash_from_daily_services,\n" + + " cash_receipt_nhif_receipt,\n" + + " cash_receipt_other_debtors_receipt,\n" + + " revenue_not_collected_patient_not_yet_paid_nhif_patients,\n" + + " revenue_not_collected_patient_not_yet_paid_other_debtors,\n" + + " revenue_not_collected_patient_not_yet_paid_waivers,\n" + + " revenue_not_collected_write_offs_exemptions,\n" + + " revenue_not_collected_write_offs_absconders\n" + + " FROM kenyaemr_etl.etl_daily_revenue_summary dr WHERE dr.transaction_date BETWEEN :startDate AND :endDate\n" + + " ) tbl group by transaction_date WITH ROLLUP ;"; + } + + public static final String getMonthlySummaryQueryM2() { + return "SELECT transaction_date,\n" + + " total_sales,\n" + + " ipd_cash,\n" + + " maternity,\n" + + " xray,\n" + + " lab,\n" + + " theatre,\n" + + " mortuary,\n" + + " op_treatment,\n" + + " pharmacy,\n" + + " medical_exam,\n" + + " medical_reports_including_P3,\n" + + " dental,\n" + + " physio_therapy,\n" + + " occupational_therapy,\n" + + " medical_records_cards_and_files,\n" + + " booking_fees,\n" + + " rental_services,\n" + + " ambulance,\n" + + " public_health_services,\n" + + " ent_and_other_clinics,\n" + + " other,\n" + + " cash_receipts_cash_from_daily_services,\n" + + " cash_receipt_nhif_receipt,\n" + + " cash_receipt_other_debtors_receipt,\n" + + " revenue_not_collected_patient_not_yet_paid_nhif_patients,\n" + + " revenue_not_collected_patient_not_yet_paid_other_debtors,\n" + + " revenue_not_collected_patient_not_yet_paid_waivers,\n" + + " revenue_not_collected_write_offs_exemptions,\n" + + " revenue_not_collected_write_offs_absconders\n" + + " FROM kenyaemr_etl.etl_daily_revenue_summary dr WHERE dr.transaction_date BETWEEN :startDate AND :endDate"; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/MOH706/Moh706IndicatorLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/MOH706/Moh706IndicatorLibrary.java new file mode 100644 index 0000000000..60fa731136 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/MOH706/Moh706IndicatorLibrary.java @@ -0,0 +1,32 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.library.MOH706; + +import org.openmrs.module.reporting.indicator.CohortIndicator; +import org.springframework.stereotype.Component; + +import static org.openmrs.module.kenyacore.report.ReportUtils.map; +import static org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportingUtils.cohortIndicator; + +@Component +public class Moh706IndicatorLibrary { + private final Moh706LabCohortLibrary moh706LabCohortLibrary; + + public Moh706IndicatorLibrary(Moh706LabCohortLibrary moh706LabCohortLibrary) { + this.moh706LabCohortLibrary = moh706LabCohortLibrary; + } + + public CohortIndicator getAllUrineAnalysisGlucoseTestsPositives() { + return cohortIndicator( + "All patients who have urinalysis glucose", + map(moh706LabCohortLibrary.getAllUrineAnalysisGlucoseTestsPositives(), + "startDate=${startDate},endDate=${endDate}")); + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/MOH706/Moh706LabCohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/MOH706/Moh706LabCohortLibrary.java new file mode 100644 index 0000000000..cc66a4b09d --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/MOH706/Moh706LabCohortLibrary.java @@ -0,0 +1,38 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.library.MOH706; + +import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.springframework.stereotype.Component; + +import java.util.Date; + +@Component +public class Moh706LabCohortLibrary { + + public CohortDefinition getAllUrineAnalysisGlucoseTestsPositives() { + SqlCohortDefinition sql = new SqlCohortDefinition(); + sql.setName("Get urine analysis patients - glucose"); + sql.addParameter(new Parameter("startDate", "Start Date", Date.class)); + sql.addParameter(new Parameter("endDate", "End Date", Date.class)); + sql.setQuery("SELECT d.patient_id FROM kenyaemr_etl.etl_patient_demographics d\n" + + " INNER JOIN kenyaemr_etl.etl_laboratory_extract x ON x.patient_id = d.patient_id\n" + + " WHERE x.lab_test = 1305 AND x.test_result = 1302 AND date(x.visit_date) BETWEEN :startDate AND :endDate\n" + + " UNION\n" + + " SELECT d.patient_id FROM kenyaemr_etl.etl_patient_demographics d\n" + + " INNER JOIN kenyaemr_etl.etl_laboratory_extract x ON x.patient_id = d.patient_id\n" + + " WHERE x.lab_test = 856 AND x.test_result IS NOT NULL AND date(x.visit_date) BETWEEN :startDate AND :endDate;" + + ); + return sql; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java index a3eaaf6027..4081282c61 100644 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/dmi/IDSRCohortLibrary.java @@ -59,12 +59,12 @@ public CohortDefinition choleraCases() { String sqlQuery = "select a.patient_id\n" + "from (select patient_id, c.visit_date,group_concat(c.complaint) as complaint, c.complaint_date as complaint_date\n" + " from kenyaemr_etl.etl_allergy_chronic_illness c\n" + - " where c.complaint in (142412,122983)\n" + + " where c.complaint in (161887,122983)\n" + " and date(c.visit_date) between date(:startDate) and date(:endDate)\n" + " group by patient_id) a\n" + " join kenyaemr_etl.etl_patient_demographics d on a.patient_id = d.patient_id\n" + "where timestampdiff(YEAR,date(d.DOB),coalesce(date(a.complaint_date),date(a.visit_date))) > 2 and FIND_IN_SET(122983, a.complaint) > 0\n" + - " and FIND_IN_SET(142412, a.complaint) > 0;"; + " and FIND_IN_SET(161887, a.complaint) > 0;"; cd.setName("choleraCases"); cd.setQuery(sqlQuery); cd.addParameter(new Parameter("startDate", "Start Date", Date.class)); diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/moh717/Moh717CohortLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/moh717/Moh717CohortLibrary.java new file mode 100644 index 0000000000..1ce2f5042e --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/moh717/Moh717CohortLibrary.java @@ -0,0 +1,36 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.library.moh717; + +import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.springframework.stereotype.Component; + +import java.util.Date; + +@Component +public class Moh717CohortLibrary { + + public CohortDefinition getAllPatientsWithEncountersWithinReportingPeriod() { + SqlCohortDefinition sql = new SqlCohortDefinition(); + sql.setName("Patients with encounters within date period"); + sql.addParameter(new Parameter("startDate", "Start Date", Date.class)); + sql.addParameter(new Parameter("endDate", "End Date", Date.class)); + sql.setQuery( + "SELECT p.patient_id FROM patient p " + + " INNER JOIN encounter e ON p.patient_id=e.patient_id " + + " WHERE e.encounter_datetime <= :endDate " + + " AND p.voided = 0 AND e.voided = 0" + ); + + return sql; + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/moh717/Moh717IndicatorLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/moh717/Moh717IndicatorLibrary.java new file mode 100644 index 0000000000..ca72c8d078 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/moh717/Moh717IndicatorLibrary.java @@ -0,0 +1,32 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public License, + * v. 2.0. If a copy of the MPL was not distributed with this file, You can + * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under + * the terms of the Healthcare Disclaimer located at http://openmrs.org/license. + * + * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS + * graphic logo is a trademark of OpenMRS Inc. + */ +package org.openmrs.module.kenyaemr.reporting.library.moh717; + +import org.openmrs.module.kenyacore.report.ReportUtils; +import org.openmrs.module.reporting.indicator.CohortIndicator; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import static org.openmrs.module.kenyaemr.reporting.EmrReportingUtils.cohortIndicator; + +@Component +public class Moh717IndicatorLibrary { + + private final Moh717CohortLibrary moh717CohortLibrary; + + @Autowired + public Moh717IndicatorLibrary(Moh717CohortLibrary moh717CohortLibrary) { + this.moh717CohortLibrary = moh717CohortLibrary; + } + + public CohortIndicator getAllPatientsWithEncountersWithinReportingPeriod() { + return cohortIndicator("All Patients with encounters with period", ReportUtils.map(moh717CohortLibrary.getAllPatientsWithEncountersWithinReportingPeriod(), "endDate=${endDate}")); + } +} diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/shared/common/CommonDimensionLibrary.java b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/shared/common/CommonDimensionLibrary.java index 414690a1d0..b8da0f7eab 100755 --- a/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/shared/common/CommonDimensionLibrary.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/reporting/library/shared/common/CommonDimensionLibrary.java @@ -9,6 +9,7 @@ */ package org.openmrs.module.kenyaemr.reporting.library.shared.common; +import org.openmrs.module.kenyaemr.reporting.MohReportUtils.ReportingUtils; import org.openmrs.module.reporting.evaluation.parameter.Parameter; import org.openmrs.module.reporting.indicator.dimension.CohortDefinitionDimension; import org.springframework.beans.factory.annotation.Autowired; @@ -49,11 +50,14 @@ public CohortDefinitionDimension gender() { */ public CohortDefinitionDimension standardAgeGroups() { CohortDefinitionDimension dim = new CohortDefinitionDimension(); - dim.setName("age groups (<1, <15, 15+)"); + dim.setName("age groups (<1, <15, 15+, <5, 5+, 60+)"); dim.addParameter(new Parameter("onDate", "Date", Date.class)); dim.addCohortDefinition("<1", map(commonCohortLibrary.agedAtMost(0), "effectiveDate=${onDate}")); dim.addCohortDefinition("<15", map(commonCohortLibrary.agedAtMost(14), "effectiveDate=${onDate}")); dim.addCohortDefinition("15+", map(commonCohortLibrary.agedAtLeast(15), "effectiveDate=${onDate}")); + dim.addCohortDefinition("<5", map(commonCohortLibrary.agedAtMost(4), "effectiveDate=${onDate}")); + dim.addCohortDefinition("5+", map(commonCohortLibrary.agedAtLeast(5), "effectiveDate=${onDate}")); + dim.addCohortDefinition("60+", map(commonCohortLibrary.agedAtLeast(60), "effectiveDate=${onDate}")); return dim; } @@ -331,4 +335,15 @@ public CohortDefinitionDimension encountersOfMonthPerDay() { return dim; } + public CohortDefinitionDimension newOrRevisits() { + CohortDefinitionDimension dim = new CohortDefinitionDimension(); + dim.setName("New or revisits patients"); + dim.addParameter(new Parameter("startDate", "After date", Date.class)); + dim.addParameter(new Parameter("endDate", "Before date", Date.class)); + dim.addCohortDefinition("RVT", + map(ReportingUtils.reAttendances(">=0"), "startDate=${startDate},endDate=${endDate}")); + dim.addCohortDefinition("NEW", + map(ReportingUtils.newAttendances(">=0"), "startDate=${startDate},endDate=${endDate}")); + return dim; + } } \ No newline at end of file diff --git a/api/src/main/java/org/openmrs/module/kenyaemr/util/EmrUtils.java b/api/src/main/java/org/openmrs/module/kenyaemr/util/EmrUtils.java index 26e9456b95..6108225f1b 100755 --- a/api/src/main/java/org/openmrs/module/kenyaemr/util/EmrUtils.java +++ b/api/src/main/java/org/openmrs/module/kenyaemr/util/EmrUtils.java @@ -21,6 +21,7 @@ import org.openmrs.Encounter; import org.openmrs.EncounterType; import org.openmrs.Form; +import org.openmrs.GlobalProperty; import org.openmrs.Obs; import org.openmrs.Order; import org.openmrs.OrderType; @@ -54,6 +55,7 @@ */ public class EmrUtils { protected static final Log log = LogFactory.getLog(EmrUtils.class); + public static String GP_2X_FORMS_WHITELIST = "kenyaemr.2.x.forms.whitelist"; /** * Checks whether a date has any time value @@ -316,5 +318,24 @@ public static List getPersonChildren(Patient patient) { return people; } + /** + * A temporary solution for whitelisting forms to show in 2.x + * TODO: retire this once all forms are fully moved to o3 + * @return + */ + public static List getFormsToShowInLegacyUI() { + GlobalProperty gpFormsWhitelist = Context.getAdministrationService().getGlobalPropertyObject(GP_2X_FORMS_WHITELIST); + + String formsWhiteList = ""; + List formsList = new ArrayList(); + if (gpFormsWhitelist != null) { + formsWhiteList = gpFormsWhitelist.getPropertyValue(); + if (StringUtils.isNotBlank(formsWhiteList)) { + formsList = Arrays.asList(formsWhiteList.split(",")); + } + } + return formsList; + + } } \ No newline at end of file diff --git a/api/src/main/resources/MigrateAppointmentsFromObs.sql b/api/src/main/resources/MigrateAppointmentsFromObs.sql new file mode 100644 index 0000000000..0bd5d2a189 --- /dev/null +++ b/api/src/main/resources/MigrateAppointmentsFromObs.sql @@ -0,0 +1,160 @@ + +SET FOREIGN_KEY_CHECKS=0; +delete from patient_appointment_audit; +delete from patient_appointment where appointment_service_id is null or (appointment_service_id in (1,2,3,4,5,6,7,8,9,13,11,12) and date_created < '2024-04-25 18:00:00'); +SET FOREIGN_KEY_CHECKS=1; + + +INSERT INTO patient_appointment ( + patient_id, + start_date_time, + end_date_time, + appointment_service_id, + status, + location_id, + appointment_kind, + appointment_number, + uuid, + date_created, + creator +) +SELECT + e.patient_id, + CONCAT(DATE(o.value_datetime), + ' 07:00:00') AS start_date_time, + CONCAT(DATE(o.value_datetime), + ' 17:00:00') AS end_date_time, + (case + when ef.uuid = '23b4ebbd-29ad-455e-be0e-04aa6bc30798' and o.concept_id=5096 then 1 -- Greencard form + when ef.uuid = '23b4ebbd-29ad-455e-be0e-04aa6bc30798' and o.concept_id=162549 then 2 -- Greencard form + when ef.uuid = '22c68f86-bbf0-49ba-b2d1-23fa7ccf0259' and o.concept_id=5096 then 1 -- HIV summary form + when ef.uuid = '22c68f86-bbf0-49ba-b2d1-23fa7ccf0259' and o.concept_id=162549 then 2 -- HIV summary form + when ef.uuid = '1bfb09fc-56d7-4108-bd59-b2765fd312b8' then 7 -- prep initial + when ef.uuid = 'ee3e2017-52c0-4a54-99ab-ebb542fb8984' then 8 -- prep followup + when ef.uuid = '291c03c8-a216-11e9-a2a3-2a2ae2dbcce4' then 9 -- prep monthly refill + when ef.uuid = '2daabb77-7ad6-4952-864b-8d23e109c69d' then 6 -- TB followup + when ef.uuid = '92e041ac-9686-11e9-bc42-526af7764f64' then 3 -- KP clinical visit + when ef.uuid = '755b59e6-acbb-4853-abaf-be302039f902' then 13 -- HEI followup + when ef.uuid = 'e8f98494-af35-4bb8-9fc7-c409c8fed843' then 4 -- antenatal visit + when ef.uuid = '72aa78e0-ee4b-47c3-9073-26f3b9ecc4a7' then 5 -- postnatal visit + when ef.uuid = '496c7cc3-0eea-4e84-a04c-2292949e2f7f' then 5-- delivery visit. This is the first postnatal appointment after deliver + else null + end) AS appointment_service_id, + 'Scheduled' AS status, + e.location_id, + 'Scheduled' AS appointment_kind, + '0000' AS appointment_number, + uuid() AS uuid, + e.encounter_datetime AS date_created, -- we want to pick the encounter datetime as the date created + (select user_id from users where username='admin') AS creator +FROM + encounter e + inner join form ef on ef.form_id = e.form_id and ef.uuid in ('1bfb09fc-56d7-4108-bd59-b2765fd312b8','291c03c8-a216-11e9-a2a3-2a2ae2dbcce4','2daabb77-7ad6-4952-864b-8d23e109c69d','92e041ac-9686-11e9-bc42-526af7764f64','755b59e6-acbb-4853-abaf-be302039f902','e8f98494-af35-4bb8-9fc7-c409c8fed843','72aa78e0-ee4b-47c3-9073-26f3b9ecc4a7','496c7cc3-0eea-4e84-a04c-2292949e2f7f','23b4ebbd-29ad-455e-be0e-04aa6bc30798', '22c68f86-bbf0-49ba-b2d1-23fa7ccf0259','ee3e2017-52c0-4a54-99ab-ebb542fb8984') + inner join obs o on o.encounter_id = e.encounter_id and o.concept_id in (5096,162549) and o.voided = 0; + + +-- update appointment statuses +-- HIV followup appointments +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('23b4ebbd-29ad-455e-be0e-04aa6bc30798','22c68f86-bbf0-49ba-b2d1-23fa7ccf0259') +set apt.status='Completed' +where apt.appointment_service_id = 1; + +-- ART drug refill +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('83fb6ab2-faec-4d87-a714-93e77a28a201') +set apt.status='Completed' +where apt.appointment_service_id = 2; + +-- prep initial +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('1bfb09fc-56d7-4108-bd59-b2765fd312b8') +set apt.status='Completed' +where apt.appointment_service_id = 7; + +-- prep followup +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('ee3e2017-52c0-4a54-99ab-ebb542fb8984') +set apt.status='Completed' +where apt.appointment_service_id = 8; + +-- prep monthly +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('291c03c8-a216-11e9-a2a3-2a2ae2dbcce4') +set apt.status='Completed' +where apt.appointment_service_id = 9; + +-- TB follow-up +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('2daabb77-7ad6-4952-864b-8d23e109c69d') +set apt.status='Completed' +where apt.appointment_service_id = 6; + +-- KP clinic visit +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('92e041ac-9686-11e9-bc42-526af7764f64') +set apt.status='Completed' +where apt.appointment_service_id = 3; + +-- HEI followup +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('755b59e6-acbb-4853-abaf-be302039f902') +set apt.status='Completed' +where apt.appointment_service_id = 13; + +-- Ante-natal visit appointment +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('e8f98494-af35-4bb8-9fc7-c409c8fed843') +set apt.status='Completed' +where apt.appointment_service_id = 4; + +-- post-natal visit appointment +update patient_appointment apt +inner join encounter e on e.patient_id = apt.patient_id and date(e.encounter_datetime) between date_sub(date(apt.start_date_time), interval 5 day) and date(apt.start_date_time) +inner join form f on f.form_id = e.form_id and f.uuid in ('72aa78e0-ee4b-47c3-9073-26f3b9ecc4a7') +set apt.status='Completed' +where apt.appointment_service_id = 5; + +update patient_appointment apt set apt.status='Missed' where date(apt.start_date_time) < curdate() and apt.status='Scheduled'; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/api/src/main/resources/content/kenyaemr.common.xml b/api/src/main/resources/content/kenyaemr.common.xml index 6d2d666bfa..f32d15d200 100644 --- a/api/src/main/resources/content/kenyaemr.common.xml +++ b/api/src/main/resources/content/kenyaemr.common.xml @@ -87,9 +87,20 @@ - - - + + + + + + + + + + + + + + @@ -896,7 +907,7 @@ - + @@ -904,9 +915,9 @@ - + - + @@ -914,11 +925,10 @@ - - + - + @@ -930,4 +940,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/api/src/main/resources/metadata/mfl_2014-05-12.csv b/api/src/main/resources/metadata/mfl_2014-05-12.csv index 38ca69eab5..db9e244319 100755 --- a/api/src/main/resources/metadata/mfl_2014-05-12.csv +++ b/api/src/main/resources/metadata/mfl_2014-05-12.csv @@ -13725,3 +13725,10 @@ Code,Officialname,Province,County,Sub county,Ward,Facility type,Owner type,,,,Co 29292,BHESP Kariobangi North Wellness Centre,Nairobi,Nairobi,Embakasi North,Kariobangi North,Medical Clinic,Private Practice,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 27932,Eldoret Wellness Centre,Uasin Gishu,Turbo,Kapsaos,,Medical Clinic,Private Practice,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 22257,Kineni Health centre,"Kisii,","Kisii,",Bomachoge chache,Sengera Bosoti,Medical Clinic,Ministry of Health,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +29280,Shining Hope for Communities Mathare Clinic,Nairobi,Nairobi,Mathare,Hospital,Medical Clinic,Non-Governmental Organizations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +30464,Voi VCT Prison,Taita Taveta,Taita Taveta,Voi,Mbololo,Medical Clinic,Ministry of Health,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +29101,Mwiki health centre,Nairobi,Nairobi,Kasarani,Mwiki,Medical Clinic,Non-Governmental Organizations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +28432,Reuben GOK,Nairobi,Nairobi,Embakasi South,Kwa Reuben,Medical Clinic,Non-Governmental Organizations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +28537,Zimmerman pickens,Nairobi,Nairobi,Roysambu,Zimmerman,Medical Clinic,Non-Governmental Organizations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +28630,St. Crispin Afya Hospital,Kajiado,Kajiado,Kajiado Central,Ildamat,Medical Clinic,Non-Governmental Organizations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +27424,BHESP-Mowlem DICE,Nairobi,Nairobi,Embakasi,Mowlem,Medical Clinic,Non-Governmental Organizations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/distro/pom.xml b/distro/pom.xml index 147f85ca23..5883ea0cd8 100755 --- a/distro/pom.xml +++ b/distro/pom.xml @@ -16,11 +16,11 @@ org.openmrs.module kenyaemr - 18.7.2-SNAPSHOT + 18.8.0 kenyaemr-distro - 18.7.2-SNAPSHOT + 18.8.0 pom KenyaEMR Distribution (optional) Distribution project for KenyaEMR diff --git a/install/pom.xml b/install/pom.xml index 2962a94816..8eeaa60a32 100755 --- a/install/pom.xml +++ b/install/pom.xml @@ -15,11 +15,11 @@ org.openmrs.module kenyaemr - 18.7.2-SNAPSHOT + 18.8.0 kenyaemr-install - 18.7.2-SNAPSHOT + 18.8.0 pom KenyaEMR Installation (optional) Installation tools for KenyaEMR diff --git a/omod/pom.xml b/omod/pom.xml index 5cd5597de4..e752abd8dc 100755 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -15,11 +15,11 @@ org.openmrs.module kenyaemr - 18.7.2-SNAPSHOT + 18.8.0 kenyaemr-omod - 18.7.2-SNAPSHOT + 18.8.0 jar KenyaEMR Module OMOD OMOD project for KenyaEMR Module diff --git a/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/VisitAvailableFormsFragmentController.java b/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/VisitAvailableFormsFragmentController.java index 50cb2bdee2..e136cc59a5 100755 --- a/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/VisitAvailableFormsFragmentController.java +++ b/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/VisitAvailableFormsFragmentController.java @@ -16,6 +16,7 @@ import org.openmrs.module.appframework.domain.AppDescriptor; import org.openmrs.module.kenyacore.form.FormDescriptor; import org.openmrs.module.kenyacore.form.FormManager; +import org.openmrs.module.kenyaemr.util.EmrUtils; import org.openmrs.module.kenyaui.KenyaUiUtils; import org.openmrs.ui.framework.SimpleObject; import org.openmrs.ui.framework.UiUtils; @@ -45,9 +46,16 @@ public void controller(FragmentModel model, List availableForms = new ArrayList(); + List formsList = EmrUtils.getFormsToShowInLegacyUI(); + for (FormDescriptor descriptor : formManager.getAllUncompletedFormsForVisit(currentApp, visit)) { - //Display only active forms - if(!descriptor.getTarget().isRetired()) { + /** + * Display only active forms + * we filter forms based on the configured whitelist. The idea is to temporarily take care of any partner forms in the add-on modules + * We block everything if no configuration exists i.e. default to an empty whitelist + */ + + if(!descriptor.getTarget().isRetired() && formsList.contains(descriptor.getTarget().getUuid())) { availableForms.add(ui.simplifyObject(descriptor.getTarget())); } continue; diff --git a/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/report/AdxViewFragmentController.java b/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/report/AdxViewFragmentController.java index a4423441a7..69b77f2c13 100644 --- a/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/report/AdxViewFragmentController.java +++ b/omod/src/main/java/org/openmrs/module/kenyaemr/fragment/controller/report/AdxViewFragmentController.java @@ -188,7 +188,7 @@ public String render(ReportData reportData) throws IOException { mappingDetails.get("datasets").getElements(); w.append("\t").append("\n"); + + "/P1M\" dataSetId=\"" + datasetName + "\">\n"); DataSet dataset = reportData.getDataSets().get(dsKey); List columns = dataset.getMetaData().getColumns(); @@ -221,7 +221,7 @@ public String render(ReportData reportData) throws IOException { FacilityReportDataset ds = facilityreportingService.getDatasetById(datasetId); w.append("\t").append("\n"); + + "/P1M\" dataSetId=\"" + ds.getMapping() + "\">\n"); for (DatasetIndicatorDetails row : e.getIndicators()) { if (row.getValue() != null && !"".equals(row.getValue()) && StringUtils.isNotEmpty(row.getValue())) { String name = row.getName(); @@ -362,7 +362,7 @@ else if(reportName.equals(KPIF_MONTHLY_REPORT)){ // add group attributes eDataset.setAttribute("orgUnit", mfl); eDataset.setAttribute("period", isoDateFormat.format(reportDate).concat("/P1M")); - eDataset.setAttribute("dataSet", datasetName); + eDataset.setAttribute("dataSetId", datasetName); for (DatasetIndicatorDetails row : e.getIndicators()) { if (row.getValue() != null && !"".equals(row.getValue()) && StringUtils.isNotEmpty(row.getValue())) { diff --git a/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/ReportExportPageController.java b/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/ReportExportPageController.java index ddb283bcf0..2d26d6cc3a 100755 --- a/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/ReportExportPageController.java +++ b/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/ReportExportPageController.java @@ -172,6 +172,8 @@ protected void addExtraContextValues(ReportData data, EvaluationContext context) context.addContextValue("facility.name", facility.getTarget().getName()); context.addContextValue("facility.code", facility.getMflCode()); context.addContextValue("report.name", reportData.getName()); + context.addContextValue("facility.county", facility.getCounty()); + context.addContextValue("facility.subCounty", facility.getDistrict()); Calendar period = new GregorianCalendar(); period.setTime(context.containsParameter("startDate") ? (Date) context.getParameterValue("startDate") : context.getEvaluationDate()); diff --git a/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/reports/ReportsHomePageController.java b/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/reports/ReportsHomePageController.java index 6e692407ca..37fdd31216 100755 --- a/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/reports/ReportsHomePageController.java +++ b/omod/src/main/java/org/openmrs/module/kenyaemr/page/controller/reports/ReportsHomePageController.java @@ -53,8 +53,13 @@ public void controller(PageModel model, UiUtils ui, for (ReportDescriptor report : reportManager.getCohortAnalysisReports(currentApp)) { cohortAnalysis.add(ui.simplifyObject(report)); } + List ehrReports = new ArrayList(); + for (ReportDescriptor report : reportManager.getEhrReports(currentApp)) { + ehrReports.add(ui.simplifyObject(report)); + } reportsByProgram.put("Common", common); reportsByProgram.put("Cohort Analysis", cohortAnalysis); + reportsByProgram.put("EHR Reports", ehrReports); for (ProgramDescriptor programDescriptor : programManager.getAllProgramDescriptors()) { Program program = programDescriptor.getTarget(); diff --git a/omod/src/main/java/org/openmrs/module/kenyaemr/web/controller/KenyaemrCoreRestController.java b/omod/src/main/java/org/openmrs/module/kenyaemr/web/controller/KenyaemrCoreRestController.java index 7e77052cf7..04d9675253 100644 --- a/omod/src/main/java/org/openmrs/module/kenyaemr/web/controller/KenyaemrCoreRestController.java +++ b/omod/src/main/java/org/openmrs/module/kenyaemr/web/controller/KenyaemrCoreRestController.java @@ -64,6 +64,7 @@ import org.openmrs.module.kenyaemr.metadata.OVCMetadata; import org.openmrs.module.kenyaemr.metadata.MchMetadata; import org.openmrs.module.kenyaemr.metadata.VMMCMetadata; +import org.openmrs.module.kenyaemr.nupi.UpiUtilsDataExchange; import org.openmrs.module.kenyaemr.regimen.RegimenConfiguration; import org.openmrs.module.kenyaemr.wrapper.EncounterWrapper; import org.openmrs.module.kenyaemr.Dictionary; @@ -98,12 +99,16 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.CrossOrigin; import org.xml.sax.SAXException; import org.springframework.beans.factory.annotation.Autowired; + +import javax.net.ssl.HttpsURLConnection; import javax.servlet.http.HttpServletRequest; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -125,8 +130,13 @@ import java.util.HashMap; import java.util.Date; import java.util.Calendar; +import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.net.HttpURLConnection; +import java.net.URL; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.ArrayList; @@ -139,6 +149,8 @@ import java.util.Locale; import java.util.Comparator; +import org.springframework.http.MediaType; + /** * The rest controller for exposing resources through kenyacore and kenyaemr modules */ @@ -2671,4 +2683,445 @@ public List search(@RequestPar return Context.getService(KenyaEmrService.class).search(query, request.getParameterMap()); } + + /** + * Verify NUPI exists (EndPoint) + * @return + */ + @CrossOrigin(origins = "*", methods = {RequestMethod.GET, RequestMethod.OPTIONS}) + @RequestMapping(method = RequestMethod.GET, value = "/verifynupi/{country}/{identifierType}/{identifier}") + @ResponseBody + public Object verifyNUPI(@PathVariable String country, @PathVariable String identifierType, @PathVariable String identifier) { + String ret = "{\"status\": \"Error\"}"; + try { + System.out.println("NUPI verification: Country: " + country + " IdentifierType: " + identifierType + " Identifier: " + identifier); + + // Create URL + // String baseURL = "https://afyakenyaapi.health.go.ke/partners/registry/search"; + GlobalProperty globalGetUrl = Context.getAdministrationService().getGlobalPropertyObject(CommonMetadata.GP_CLIENT_VERIFICATION_GET_END_POINT); + String baseURL = globalGetUrl.getPropertyValue(); + if(baseURL == null || baseURL.trim().isEmpty()) { + baseURL = "https://afyakenyaapi.health.go.ke/partners/registry/search"; + } + String completeURL = baseURL + "/" + country + "/" + identifierType + "/" + identifier; + System.out.println("NUPI verification: Using NUPI GET URL: " + completeURL); + URL url = new URL(completeURL); + + UpiUtilsDataExchange upiUtilsDataExchange = new UpiUtilsDataExchange(); + String authToken = upiUtilsDataExchange.getToken(); + + HttpsURLConnection con =(HttpsURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + + con.setRequestProperty("Authorization", "Bearer " + authToken); + con.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); + con.setRequestProperty("Accept", "application/json"); + con.setConnectTimeout(10000); // set timeout to 10 seconds + + int responseCode = con.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { //success + // Read the response + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + + String input; + StringBuffer response = new StringBuffer(); + + while ((input = in.readLine()) != null) { + response.append(input); + } + in.close(); + + String returnResponse = response.toString(); + System.out.println("NUPI verification: Got the Response as: " + returnResponse); + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + + return ResponseEntity.ok().headers(headers).body(returnResponse); + } else { + System.out.println("NUPI verification: Error verifying NUPI for client: " + responseCode); + + InputStream errorStream = con.getErrorStream(); + // Read the error response body + BufferedReader errorReader = new BufferedReader(new InputStreamReader(errorStream)); + StringBuilder errorResponse = new StringBuilder(); + String line; + while ((line = errorReader.readLine()) != null) { + errorResponse.append(line); + } + + // Close the reader and the error stream + errorReader.close(); + errorStream.close(); + + // Handle or log the error response + String errorBody = errorResponse.toString(); + System.err.println("New NUPI: Error response body: " + errorBody); + + HttpHeaders headers = new HttpHeaders(); + String contentType = con.getHeaderField("Content-Type"); + if(contentType != null && contentType.toLowerCase().contains("json")) { + headers.setContentType(MediaType.APPLICATION_JSON); + } else { + headers.setContentType(MediaType.TEXT_PLAIN); + } + + return ResponseEntity.status(responseCode).headers(headers).body(errorBody); + } + } catch(Exception ex) { + System.err.println("NUPI verification: ERROR: " + ex.getMessage()); + ex.printStackTrace(); + } + + return ResponseEntity.badRequest().contentType(MediaType.APPLICATION_JSON).body(ret); + } + + /** + * Search for NUPI (EndPoint) + * @return + */ + @CrossOrigin(origins = "*", methods = {RequestMethod.GET, RequestMethod.OPTIONS}) + @RequestMapping(method = RequestMethod.GET, value = "/searchnupi/{searchkey}/{searchvalue}") + @ResponseBody + public Object searchNUPI(@PathVariable String searchkey, @PathVariable String searchvalue) { + String ret = "{\"status\": \"Error\"}"; + try { + System.out.println("NUPI search: SearchKey: " + searchkey + " SearchValue: " + searchvalue); + + // Create URL + // String baseURL = "https://afyakenyaapi.health.go.ke/partners/registry/search"; + GlobalProperty globalGetUrl = Context.getAdministrationService().getGlobalPropertyObject(CommonMetadata.GP_CLIENT_VERIFICATION_GET_END_POINT); + String baseURL = globalGetUrl.getPropertyValue(); + if(baseURL == null || baseURL.trim().isEmpty()) { + baseURL = "https://afyakenyaapi.health.go.ke/partners/registry/search"; + } + String completeURL = baseURL + "/" + searchkey + "/" + searchvalue; + System.out.println("NUPI search: Using NUPI GET URL: " + completeURL); + URL url = new URL(completeURL); + + UpiUtilsDataExchange upiUtilsDataExchange = new UpiUtilsDataExchange(); + String authToken = upiUtilsDataExchange.getToken(); + + HttpsURLConnection con =(HttpsURLConnection) url.openConnection(); + con.setRequestMethod("GET"); + + con.setRequestProperty("Authorization", "Bearer " + authToken); + con.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); + con.setRequestProperty("Accept", "application/json"); + con.setConnectTimeout(10000); // set timeout to 10 seconds + + int responseCode = con.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { //success + // Read the response + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + + String input; + StringBuffer response = new StringBuffer(); + + while ((input = in.readLine()) != null) { + response.append(input); + } + in.close(); + + String returnResponse = response.toString(); + System.out.println("NUPI search: Got the Response as: " + returnResponse); + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + return ResponseEntity.ok().headers(headers).body(returnResponse); + } else { + System.out.println("NUPI search: Error searching NUPI for client: " + responseCode); + + InputStream errorStream = con.getErrorStream(); + // Read the error response body + BufferedReader errorReader = new BufferedReader(new InputStreamReader(errorStream)); + StringBuilder errorResponse = new StringBuilder(); + String line; + while ((line = errorReader.readLine()) != null) { + errorResponse.append(line); + } + + // Close the reader and the error stream + errorReader.close(); + errorStream.close(); + + // Handle or log the error response + String errorBody = errorResponse.toString(); + System.err.println("New NUPI: Error response body: " + errorBody); + + HttpHeaders headers = new HttpHeaders(); + String contentType = con.getHeaderField("Content-Type"); + if(contentType != null && contentType.toLowerCase().contains("json")) { + headers.setContentType(MediaType.APPLICATION_JSON); + } else { + headers.setContentType(MediaType.TEXT_PLAIN); + } + + return ResponseEntity.status(responseCode).headers(headers).body(errorBody); + } + } catch(Exception ex) { + System.err.println("NUPI search: ERROR: " + ex.getMessage()); + ex.printStackTrace(); + } + + return ResponseEntity.badRequest().contentType(MediaType.APPLICATION_JSON).body(ret); + } + + /** + * Get a new NUPI (EndPoint) + * @param request + * @return + */ + @CrossOrigin(origins = "*", methods = {RequestMethod.POST, RequestMethod.OPTIONS}) + @RequestMapping(method = RequestMethod.POST, value = "/newnupi") + @ResponseBody + public Object newNUPI(HttpServletRequest request) { + String ret = "{\"status\": \"Error\"}"; + + // InputStream errorStream = null; + HttpsURLConnection con = null; + try { + System.out.println("New NUPI: Received NUPI details: " + request.getQueryString()); + + // Create URL + // String baseURL = "https://afyakenyaapi.health.go.ke/partners/registry"; + GlobalProperty globalPostUrl = Context.getAdministrationService().getGlobalPropertyObject(CommonMetadata.GP_CLIENT_VERIFICATION_POST_END_POINT); + String baseURL = globalPostUrl.getPropertyValue(); + if(baseURL == null || baseURL.trim().isEmpty()) { + baseURL = "https://afyakenyaapi.health.go.ke/partners/registry"; + } + String completeURL = baseURL; + System.out.println("New NUPI: Using NUPI POST URL: " + completeURL); + URL url = new URL(completeURL); + + UpiUtilsDataExchange upiUtilsDataExchange = new UpiUtilsDataExchange(); + String authToken = upiUtilsDataExchange.getToken(); + + // Make the Connection + con =(HttpsURLConnection) url.openConnection(); + con.setRequestMethod("POST"); + con.setDoOutput(true); + con.setRequestProperty("Authorization", "Bearer " + authToken); + con.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); + con.setRequestProperty("Accept", "application/json"); + con.setConnectTimeout(10000); // set timeout to 10 seconds + + // Repost the request + String requestBody = ""; + BufferedReader requestReader = request.getReader(); + + for(String output = ""; (output = requestReader.readLine()) != null; requestBody = requestBody + output) {} + System.out.println("New NUPI: Sending to remote: " + requestBody); + PrintStream os = new PrintStream(con.getOutputStream()); + os.print(requestBody); + os.close(); + + int responseCode = con.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { //success + + // Read the response + BufferedReader in = null; + in = new BufferedReader(new InputStreamReader(con.getInputStream())); + + String input; + StringBuffer response = new StringBuffer(); + + while ((input = in.readLine()) != null) { + response.append(input); + } + in.close(); + + String returnResponse = response.toString(); + System.out.println("New NUPI: Got the Response as: " + returnResponse); + + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + return ResponseEntity.ok().headers(headers).body(returnResponse); + } else { + System.out.println("New NUPI: Error posting new NUPI for client: " + responseCode); + + InputStream errorStream = con.getErrorStream(); + // Read the error response body + BufferedReader errorReader = new BufferedReader(new InputStreamReader(errorStream)); + StringBuilder errorResponse = new StringBuilder(); + String line; + while ((line = errorReader.readLine()) != null) { + errorResponse.append(line); + } + + // Close the reader and the error stream + errorReader.close(); + errorStream.close(); + + // Handle or log the error response + String errorBody = errorResponse.toString(); + System.err.println("New NUPI: Error response body: " + errorBody); + + HttpHeaders headers = new HttpHeaders(); + String contentType = con.getHeaderField("Content-Type"); + if(contentType != null && contentType.toLowerCase().contains("json")) { + headers.setContentType(MediaType.APPLICATION_JSON); + } else { + headers.setContentType(MediaType.TEXT_PLAIN); + } + + return ResponseEntity.status(responseCode).headers(headers).body(errorBody); + } + } catch(Exception ex) { + System.err.println("New NUPI: ERROR: " + ex.getMessage()); + ex.printStackTrace(); + } + + return ResponseEntity.badRequest().contentType(MediaType.APPLICATION_JSON).body(ret); + } + + /** + * Modify NUPI patient data e.g CCC Number (EndPoint) + * @param request + * @return + */ + @CrossOrigin(origins = "*", methods = {RequestMethod.PUT, RequestMethod.OPTIONS}) + @RequestMapping(method = RequestMethod.PUT, value = "/modifynupi/{nupinumber}/{searchtype}") + @ResponseBody + public Object modifyNUPI(HttpServletRequest request, @PathVariable String nupinumber, @PathVariable String searchtype) { + String ret = "{\"status\": \"Error\"}"; + + // InputStream errorStream = null; + HttpsURLConnection con = null; + try { + System.out.println("Modify NUPI: Received NUPI details: " + request.getQueryString()); + System.out.println("Modify NUPI: nupi number: " + nupinumber + " SearchType: " + searchtype); + + // Create URL + // String baseURL = "https://afyakenyaapi.health.go.ke/partners/registry"; + GlobalProperty globalPostUrl = Context.getAdministrationService().getGlobalPropertyObject(CommonMetadata.GP_CLIENT_VERIFICATION_UPDATE_END_POINT); + String baseURL = globalPostUrl.getPropertyValue(); + if(baseURL == null || baseURL.trim().isEmpty()) { + baseURL = "https://afyakenyaapi.health.go.ke/partners/registry"; + } + String completeURL = baseURL + "/" + nupinumber + "/" + searchtype; + System.out.println("Modify NUPI: Using NUPI POST URL: " + completeURL); + URL url = new URL(completeURL); + + UpiUtilsDataExchange upiUtilsDataExchange = new UpiUtilsDataExchange(); + String authToken = upiUtilsDataExchange.getToken(); + + // Make the Connection + con =(HttpsURLConnection) url.openConnection(); + con.setRequestMethod("PUT"); + con.setDoOutput(true); + con.setRequestProperty("Authorization", "Bearer " + authToken); + con.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); + con.setRequestProperty("Accept", "application/json"); + con.setConnectTimeout(10000); // set timeout to 10 seconds + + // Reput the request + String requestBody = ""; + BufferedReader requestReader = request.getReader(); + + for(String output = ""; (output = requestReader.readLine()) != null; requestBody = requestBody + output) {} + System.out.println("Modify NUPI: Sending to remote: " + requestBody); + PrintStream os = new PrintStream(con.getOutputStream()); + os.print(requestBody); + os.close(); + + int responseCode = con.getResponseCode(); + + if (responseCode == HttpURLConnection.HTTP_OK) { //success + + // Read the response + BufferedReader in = null; + in = new BufferedReader(new InputStreamReader(con.getInputStream())); + + String input; + StringBuffer response = new StringBuffer(); + + while ((input = in.readLine()) != null) { + response.append(input); + } + in.close(); + + String returnResponse = response.toString(); + System.out.println("Modify NUPI: Got the Response as: " + returnResponse); + + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + return ResponseEntity.ok().headers(headers).body(returnResponse); + } else { + System.out.println("Modify NUPI: Error posting new NUPI for client: " + responseCode); + + InputStream errorStream = con.getErrorStream(); + // Read the error response body + BufferedReader errorReader = new BufferedReader(new InputStreamReader(errorStream)); + StringBuilder errorResponse = new StringBuilder(); + String line; + while ((line = errorReader.readLine()) != null) { + errorResponse.append(line); + } + + // Close the reader and the error stream + errorReader.close(); + errorStream.close(); + + // Handle or log the error response + String errorBody = errorResponse.toString(); + System.err.println("Modify NUPI: Error response body: " + errorBody); + + HttpHeaders headers = new HttpHeaders(); + String contentType = con.getHeaderField("Content-Type"); + if(contentType != null && contentType.toLowerCase().contains("json")) { + headers.setContentType(MediaType.APPLICATION_JSON); + } else { + headers.setContentType(MediaType.TEXT_PLAIN); + } + + return ResponseEntity.status(responseCode).headers(headers).body(errorBody); + } + } catch(Exception ex) { + System.err.println("Modify NUPI: ERROR: " + ex.getMessage()); + ex.printStackTrace(); + } + + return ResponseEntity.badRequest().contentType(MediaType.APPLICATION_JSON).body(ret); + } + + /** + * Returns the latest patient Obs value coded concept ID and UUID given the patient UUID and Concept UUID + * @param patientUuid + * @return value coded concept id and uuid + */ + @CrossOrigin(origins = "*", methods = {RequestMethod.GET, RequestMethod.OPTIONS}) + @RequestMapping(method = RequestMethod.GET, value = "/latestobs") + @ResponseBody + public Object getLatestObs(@RequestParam("patientUuid") String patientUuid, @RequestParam("concept") String conceptIdentifier) { + SimpleObject ret = SimpleObject.create("conceptId", 0, "conceptUuid", ""); + if (StringUtils.isBlank(patientUuid)) { + return new ResponseEntity("You must specify a patientUuid in the request!", + new HttpHeaders(), HttpStatus.BAD_REQUEST); + } + + if (StringUtils.isBlank(conceptIdentifier)) { + return new ResponseEntity("You must specify a concept in the request!", + new HttpHeaders(), HttpStatus.BAD_REQUEST); + } + + Patient patient = Context.getPatientService().getPatientByUuid(patientUuid); + + Concept concept = Dictionary.getConcept(conceptIdentifier); + List obsList = Context.getObsService().getObservationsByPersonAndConcept(patient, concept); + if (obsList.size() > 0) { + // these are in reverse chronological order + Obs currentObs = obsList.get(0); + ret.put("conceptId", currentObs.getValueCoded().getId()); + ret.put("conceptUuid", currentObs.getValueCoded().getUuid()); + } + + return ret; + + } } diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml index c8ed76bba0..5613203b7d 100755 --- a/omod/src/main/resources/config.xml +++ b/omod/src/main/resources/config.xml @@ -36,7 +36,6 @@ org.openmrs.module.uiframework org.openmrs.module.kenyaemrorderentry org.openmrs.module.facilityreporting - org.bahmni.module.appointments @@ -63,11 +62,6 @@ ${project.parent.groupId}.${project.parent.artifactId}.advice.MCHMSDeliveryFormProcessor - - org.openmrs.api.EncounterService - ${project.parent.groupId}.${project.parent.artifactId}.advice.SyncHFEAppointmentsWithBahmniModule - - org.openmrs.api.EncounterService ${project.parent.groupId}.${project.parent.artifactId}.advice.OutpatientToInpatientCheckinOnAdmissionRequest @@ -182,4 +176,12 @@ + + kenyaemr.2.x.forms.whitelist + + + Configures a comma separated list of forms to avail in 2.x KenyaEMR user interface + + + diff --git a/omod/src/main/resources/liquibase.xml b/omod/src/main/resources/liquibase.xml index d23df06347..81112fe582 100755 --- a/omod/src/main/resources/liquibase.xml +++ b/omod/src/main/resources/liquibase.xml @@ -264,4 +264,11 @@ + + + Queries for migrating appointments to bahmni appointment module + + + + \ No newline at end of file diff --git a/omod/src/main/webapp/pages/registration/registrationHome.gsp b/omod/src/main/webapp/pages/registration/registrationHome.gsp index a35562d14e..e3d2f8f9f0 100755 --- a/omod/src/main/webapp/pages/registration/registrationHome.gsp +++ b/omod/src/main/webapp/pages/registration/registrationHome.gsp @@ -1,64 +1,16 @@ <% - ui.decorateWith("kenyaemr", "standardPage", [ layout: "sidebar" ]) - - ui.includeJavascript("kenyaemr", "controllers/visit.js") - - def menuItems = [ - [ label: "Find or create patient", iconProvider: "kenyaui", icon: "buttons/patient_search.png", href: ui.pageLink("kenyaemr", "registration/registrationSearch") ] - ] - - def menuItemsNew = [ - [ label: "Seen Patients", iconProvider: "kenyaui", icon: "buttons/patients.png", href: ui.pageLink("kenyaemr", "registration/registrationSearchSeen") ] - ] + ui.decorateWith("kenyaemr", "standardPage") %> - - - -
- ${ ui.includeFragment("kenyaui", "widget/panelMenu", [ heading: "Tasks", items: menuItems ]) } - - ${ ui.decorate("kenyaui", "panel", [ heading: "Select Day to View Scheduled Patients" ], """
""") } - -
-
Active Visits
- -
-
- {{ type.name }} ({{ type.count }}) -
- None -
- -
- -
-
- ${ ui.includeFragment("kenyaui", "widget/panelMenu", [ heading: "", items: menuItemsNew ]) } -
- -
- ${ ui.includeFragment("kenyaemr", "patient/dailySchedule", [ pageProvider: "kenyaemr", page: "registration/registrationViewPatient", date: scheduleDate ]) } -
\ No newline at end of file + //On ready + jq = jQuery; + jq(function () { + // Redirect to O3 + var getUrl = window.location; + var baseUrl = getUrl.protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; + baseUrl = baseUrl + "/spa/patient-registration" + var spaUrl = new URL(baseUrl); + window.location.replace(spaUrl); + }); + \ No newline at end of file diff --git a/omod/src/main/webapp/resources/reports/MOH240.xls b/omod/src/main/webapp/resources/reports/MOH240.xls new file mode 100644 index 0000000000..2b038c3a27 Binary files /dev/null and b/omod/src/main/webapp/resources/reports/MOH240.xls differ diff --git a/omod/src/main/webapp/resources/reports/MOH705A.xls b/omod/src/main/webapp/resources/reports/MOH705A.xls new file mode 100644 index 0000000000..9da5c5c57a Binary files /dev/null and b/omod/src/main/webapp/resources/reports/MOH705A.xls differ diff --git a/omod/src/main/webapp/resources/reports/MOH_705b.xls b/omod/src/main/webapp/resources/reports/MOH705B.xls similarity index 76% rename from omod/src/main/webapp/resources/reports/MOH_705b.xls rename to omod/src/main/webapp/resources/reports/MOH705B.xls index 0ac7eb9e14..b34e9f4dd0 100644 Binary files a/omod/src/main/webapp/resources/reports/MOH_705b.xls and b/omod/src/main/webapp/resources/reports/MOH705B.xls differ diff --git a/omod/src/main/webapp/resources/reports/MOH706.xls b/omod/src/main/webapp/resources/reports/MOH706.xls new file mode 100644 index 0000000000..6901b12084 Binary files /dev/null and b/omod/src/main/webapp/resources/reports/MOH706.xls differ diff --git a/omod/src/main/webapp/resources/reports/MOH_705a.xls b/omod/src/main/webapp/resources/reports/MOH_705a.xls deleted file mode 100644 index 29b771032a..0000000000 Binary files a/omod/src/main/webapp/resources/reports/MOH_705a.xls and /dev/null differ diff --git a/omod/src/main/webapp/resources/reports/MOH_717.xls b/omod/src/main/webapp/resources/reports/MOH_717.xls new file mode 100644 index 0000000000..4001679756 Binary files /dev/null and b/omod/src/main/webapp/resources/reports/MOH_717.xls differ diff --git a/omod/src/main/webapp/resources/reports/active_on_art_linelist.xls b/omod/src/main/webapp/resources/reports/active_on_art_linelist.xls index 1d5daed76e..28c810c212 100644 Binary files a/omod/src/main/webapp/resources/reports/active_on_art_linelist.xls and b/omod/src/main/webapp/resources/reports/active_on_art_linelist.xls differ diff --git a/omod/src/main/webapp/resources/reports/fcdrr.xls b/omod/src/main/webapp/resources/reports/fcdrr.xls new file mode 100644 index 0000000000..785d946b97 Binary files /dev/null and b/omod/src/main/webapp/resources/reports/fcdrr.xls differ diff --git a/omod/src/main/webapp/resources/reports/financials/monthly_revenue_summary.xls b/omod/src/main/webapp/resources/reports/financials/monthly_revenue_summary.xls new file mode 100644 index 0000000000..fee908c8f3 Binary files /dev/null and b/omod/src/main/webapp/resources/reports/financials/monthly_revenue_summary.xls differ diff --git a/omod/src/main/webapp/resources/reports/moh204A.xls b/omod/src/main/webapp/resources/reports/moh204A.xls new file mode 100644 index 0000000000..7041646ed7 Binary files /dev/null and b/omod/src/main/webapp/resources/reports/moh204A.xls differ diff --git a/omod/src/main/webapp/resources/reports/moh204B.xls b/omod/src/main/webapp/resources/reports/moh204B.xls new file mode 100644 index 0000000000..b1a2096e76 Binary files /dev/null and b/omod/src/main/webapp/resources/reports/moh204B.xls differ diff --git a/omod/src/main/webapp/resources/reports/moh705A.xls b/omod/src/main/webapp/resources/reports/moh705A.xls deleted file mode 100644 index 43c6b2c0df..0000000000 Binary files a/omod/src/main/webapp/resources/reports/moh705A.xls and /dev/null differ diff --git a/omod/src/main/webapp/resources/reports/moh705B.xls b/omod/src/main/webapp/resources/reports/moh705B.xls deleted file mode 100644 index be07eede99..0000000000 Binary files a/omod/src/main/webapp/resources/reports/moh705B.xls and /dev/null differ diff --git a/omod/src/main/webapp/resources/reports/pmtct/ANC_register_template.xls b/omod/src/main/webapp/resources/reports/pmtct/ANC_register_template.xls index 8e4425e160..2b46708960 100644 Binary files a/omod/src/main/webapp/resources/reports/pmtct/ANC_register_template.xls and b/omod/src/main/webapp/resources/reports/pmtct/ANC_register_template.xls differ diff --git a/pom.xml b/pom.xml index 2e8bb54b05..f0776adc57 100755 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.openmrs.module kenyaemr - 18.7.2-SNAPSHOT + 18.8.0 pom KenyaEMR OpenMRS-based EMR for Kenya @@ -46,7 +46,7 @@ - 2.3.3 + 2.6.2 2.0 20150123 @@ -60,20 +60,19 @@ 3.0.1 1.4.0 3.0.0 - 1.6.2 + 1.6.3-SNAPSHOT 0.5.2 1.2.0 4.5.10 1.11.0 1.3.4 1.5.0 - 1.22.0 + 1.25.0 0.2.14 - 3.15.0 + 3.23.0 2.26.0 2.0.9 1.15.0 - 2.0.0-SNAPSHOT UTF-8 yyyy-MM-dd'T'HH:mm:ssZ @@ -237,12 +236,6 @@ - org.bahmni.module - appointments-api - ${bahmniAppointmentsVersion} - provided - - org.openmrs.module webservices.rest-omod @@ -274,12 +267,12 @@ test - + @@ -449,8 +442,10 @@ + format-headers + process-sources - check + format