diff --git a/api/pom.xml b/api/pom.xml index d87dc9d0..272fe359 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -167,6 +167,7 @@ org.xhtmlrenderer flying-saucer-pdf-itext5 + @@ -195,6 +196,7 @@ true + diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/IsantePlusReportsProperties.java b/api/src/main/java/org/openmrs/module/isanteplusreports/IsantePlusReportsProperties.java index db684561..45033154 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/IsantePlusReportsProperties.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/IsantePlusReportsProperties.java @@ -178,5 +178,30 @@ public class IsantePlusReportsProperties{ public static final String ART_DISPENSATION_FOLLOW_UP_UUID = "ef282113-32bd-49d7-870f-0ef41443e8de"; public static final String NEXT_VISIT_BY_PERIOD_UUID = "f3bef310-0e62-4b4f-88f1-8b7983ea51cb"; + + public static final String ACTIVITY_AFTER_DISC_BY_PERIOD = "7414a044-ace9-4140-88f2-5b79d869b5c9"; + + public static final String PATIENTS_VACCINATED_FOR_COVID19 = "de5c0d89-4d01-4f1a-99dd-20b3dd778bc"; + + public static final String PATIENTS_DIAGNOSE_FOR_COVID19 = "c6381c6e-b9a4-49d3-84bd-210a0bc6b0dd"; + + public static final String WEEKLYMONITORINGREPORT_UUID = "1c558cf7-d44c-49f2-bf9e-a43be418c990"; + + public static final String PATIENTS_CONFIRM_COVID19 = "358f6c1f-6751-4ed0-8567-95a3ac227f39"; + + public static final String PATIENTS_SUSPECTED_COVID19 = "27f98dae-6c6d-4424-87d2-bd41305253f4"; + + public static final String PATIENTS_HIV_WITHOUT_POSITIVE_HIV_TEST = "3d931155-97ce-4c83-8652-37735bf48e45"; + + public static final String ACTIVE_PATIENTS_VIRALLOAD_TWELVE_MONTHS = "bb53535b-4d85-4315-8506-8b242e60cfd9"; + + public static final String ACTIVE_PATIENTS_SCREENED_FOR_TB_UUID = "8a6bf7f0-5a50-4221-83ad-61d29057864e"; + + public static final String PATIENT_WITH_INCOMPLETE_PROPHYLAXIS_AGAINST_TB_UUID = "f48cf8ec-feb2-4473-89ec-4ab19dc48738"; + + public static final String PATIENT_SCREENED_NEGATIVE_AGAINST_TB_WITH_NO_PROPHYLAXIS_UUID = "85d9ca70-81d7-4082-93c0-d9eeed450632"; + + public static final String DDPREPORTBYPERIOD_UUID = "3510620c-5eb8-4ca0-b680-eebc80502ebc"; + public static final String PATIENT_WITH_FINGER_PRINT_UUID = "2a06491b-9f73-40a6-bed6-8c39fade8d7a"; } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/RegisterReports.java b/api/src/main/java/org/openmrs/module/isanteplusreports/RegisterReports.java index 13516a1a..a8e6758d 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/RegisterReports.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/RegisterReports.java @@ -5,6 +5,7 @@ import org.openmrs.GlobalProperty; import org.openmrs.api.context.Context; import org.openmrs.module.ModuleFactory; +import org.openmrs.module.isanteplusreports.alertprecoce.util.RegisterAllAlertPrecoceReports; import org.openmrs.module.isanteplusreports.healthqual.util.RegisterAllHealthQualReports; import org.openmrs.module.isanteplusreports.pnlsReport.RegisterAllPnlsReports; import org.openmrs.module.isanteplusreports.util.RegisterAllOtherReports; @@ -29,6 +30,7 @@ public void registerReports() { RegisterAllHealthQualReports.registerAll(); RegisterPatientsArvStatusReports.registerAllPatientsArvStatusReports(); RegisterAllPnlsReports.registerAll(); + RegisterAllAlertPrecoceReports.registerAll(); Context.getAdministrationService().saveGlobalProperty(new GlobalProperty("reports.moduleVersion", version)); } } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/AlertPrecoceManager.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/AlertPrecoceManager.java new file mode 100644 index 00000000..0c349a1b --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/AlertPrecoceManager.java @@ -0,0 +1,101 @@ +package org.openmrs.module.isanteplusreports.alertprecoce; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceIndicator; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.openmrs.module.reporting.report.definition.service.ReportDefinitionService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class AlertPrecoceManager { + + private static final String[] alertPrecoceIndicatorsUuid = { + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_1_UUID, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_2_UUID, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_4_UUID, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_5_UUID, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_6_UUID, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_7_UUID + }; + + + private static final String[] artDistributionIndicatorsUuid = { + AlertPrecoceReportsConstants.APPOINTMENT_PERIOD_INDICATOR_UUID, + AlertPrecoceReportsConstants.DISPENSINGART_PERIOD_INDICATOR_UUID, + AlertPrecoceReportsConstants.NOTTAKINGART_PERIOD_INDICATOR_UUID, + AlertPrecoceReportsConstants.TAKINGART_PERIOD_INDICATOR_UUID + }; + + /*PsychoSocial*/ + private static final String[] psychoSocialIndicatorsUuid = { + AlertPrecoceReportsConstants.ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_UUID, + AlertPrecoceReportsConstants.NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_UUID + }; + + private static final String[] fingerPrintIndicatorsUuid = { + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_FINGER_PRINT_UUID, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_UUID + }; + + private static final String[] transisionedPatientIndicatorsUuid = { + AlertPrecoceReportsConstants.TRANSISIONED_PATIENT_FROM_PEDIATRIC_TO_ADULT_UUID + }; + + private static final String[] vitalStatisticsIndicatorsUuid = { + AlertPrecoceReportsConstants.VITAL_STATISTICS_UUID + }; + +//private Map options = new HashMap<>(); + +@Autowired +private ReportDefinitionService reportDefinitionService; + +public List getAlertPrecoceIndicators() { + return uuidToReportDefinition(Arrays.asList(alertPrecoceIndicatorsUuid)); +} + +public List getArtDistributionIndicators() { + return uuidToReportDefinition(Arrays.asList(artDistributionIndicatorsUuid)); +} +public List getPsychoSocialIndicators() { + return uuidToReportDefinition(Arrays.asList(psychoSocialIndicatorsUuid)); +} +public List getFingerPrintIndicators() { + return uuidToReportDefinition(Arrays.asList(fingerPrintIndicatorsUuid)); +} + +public List getTransisionedPatientIndicators() { + return uuidToReportDefinition(Arrays.asList(transisionedPatientIndicatorsUuid)); +} + +public List getvitalStatisticsIndicators() { + return uuidToReportDefinition(Arrays.asList(vitalStatisticsIndicatorsUuid)); +} + +private List uuidToReportDefinition(List uuids) { + List indicators = new ArrayList(); + for (String uuid : uuids) { + ReportDefinition reportDefinition = reportDefinitionService.getDefinitionByUuid(uuid); + //AlertPrecoceIndicatorOption option = options.get(uuid); + if (reportDefinition != null) { + indicators.add(new AlertPrecoceIndicator(reportDefinition, null)); + } + } + return indicators; +} + + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/AlertPrecoceReportDataset.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/AlertPrecoceReportDataset.java new file mode 100644 index 00000000..eaaea538 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/AlertPrecoceReportDataset.java @@ -0,0 +1,86 @@ +package org.openmrs.module.isanteplusreports.alertprecoce; + +import java.util.List; + +import org.openmrs.module.isanteplusreports.library.dimension.CommonDimension; +import org.openmrs.module.isanteplusreports.library.indicator.AlertPrecoceReportIndicatorLibrary; +import org.openmrs.module.isanteplusreports.reporting.utils.ReportUtils; +import org.openmrs.module.reporting.common.MessageUtil; +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.indicator.CohortIndicator; + +public class AlertPrecoceReportDataset { + + public DataSetDefinition constructDataSet(String reportName, String sqlDen, String sqlNum, List parameters) { + CohortIndicatorDataSetDefinition dsd = new CohortIndicatorDataSetDefinition(); + dsd.setName(reportName); + dsd.setDescription(MessageUtil.translate(reportName)); + dsd.setParameters(parameters); + + dsd.addDimension("gender", ReportUtils.map(new CommonDimension().gender(), "")); + + CohortIndicator numCohortIndicator = AlertPrecoceReportIndicatorLibrary.cohortIndicatorFromSqlResource(sqlNum,reportName + "_num", parameters); + CohortIndicator denCohortIndicator = AlertPrecoceReportIndicatorLibrary.cohortIndicatorFromSqlResource(sqlDen,reportName + "_den", parameters); + /* + dsd.addColumn( + "Numerator", + "Numerator", + Mapped.mapStraightThrough(numCohortIndicator), + ""); + + dsd.addColumn( + "denominator", + "Denominator", + Mapped.mapStraightThrough(denCohortIndicator), + ""); + + dsd.addColumn( + "pourcentage", + "Pourcentage", + Mapped.mapStraightThrough(denCohortIndicator), + ""); */ + + dsd.addColumn( + "femaleNumerator", + "Female Numerator", + Mapped.mapStraightThrough(numCohortIndicator), + "gender=F"); + + dsd.addColumn( + "maleNumerator", + "Male Numerator", + Mapped.mapStraightThrough(numCohortIndicator), + "gender=M"); + + dsd.addColumn( + "totalNumerator", + "Total Numerator", + Mapped.mapStraightThrough(numCohortIndicator), + ""); + + dsd.addColumn( + "maleDenominator", + "Male Denominator", + Mapped.mapStraightThrough(denCohortIndicator), + "gender=M"); + + dsd.addColumn( + "femaleDenominator", + "Female Denominator", + Mapped.mapStraightThrough(denCohortIndicator), + "gender=F"); + + dsd.addColumn( + "totalDenominator", + "Total Denominator", + Mapped.mapStraightThrough(denCohortIndicator), + ""); + + return dsd; + + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/builder/AlertPrecoceReportBuilder.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/builder/AlertPrecoceReportBuilder.java new file mode 100644 index 00000000..ad8419e0 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/builder/AlertPrecoceReportBuilder.java @@ -0,0 +1,428 @@ +package org.openmrs.module.isanteplusreports.alertprecoce.builder; + +import static j2html.TagCreator.a; +import static j2html.TagCreator.body; +import static j2html.TagCreator.div; +import static j2html.TagCreator.h2; +import static j2html.TagCreator.h3; +import static j2html.TagCreator.h5; +import static j2html.TagCreator.head; +import static j2html.TagCreator.html; +import static j2html.TagCreator.style; +import static j2html.TagCreator.table; +import static j2html.TagCreator.td; +import static j2html.TagCreator.th; +import static j2html.TagCreator.tr; +import static org.openmrs.module.isanteplusreports.IsantePlusReportsUtil.getStringFromResource; +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceUtils.replaceNonBreakingSpaces; +import j2html.tags.ContainerTag; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import javax.xml.bind.DatatypeConverter; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.common.MessageUtil; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.report.ReportData; +import org.w3c.dom.Document; +import org.xhtmlrenderer.pdf.ITextRenderer; +import org.xml.sax.SAXException; +import org.openmrs.ui.framework.UiUtils; + +import com.itextpdf.text.DocumentException; + +public class AlertPrecoceReportBuilder extends UiUtils { + + private final Log LOGGER = LogFactory.getLog(getClass()); + + private static final int ROWS = 4; + + private static final String MALE_NUMERATOR_COLUMN_NAME = "maleNumerator"; + + private static final String FEMALE_NUMERATOR_COLUMN_NAME = "femaleNumerator"; + + private static final String MALE_DENOMINATOR_COLUMN_NAME = "maleDenominator"; + + private static final String FEMALE_DENOMINATOR_COLUMN_NAME = "femaleDenominator"; + + private static final String TOTAL_NUMERATOR_COLUMN_NAME = "totalNumerator"; + + private static final String TOTAL_DENOMINATOR_COLUMN_NAME = "totalDenominator"; + + private static final String PERCENTAGE_STRING_FORMAT_PATTERN = "##0.0"; + + private static final String PERIOD_DATE_FORMAT_PATTERN = "yyyy/MM/dd"; + + private static final String CREATION_DATE_FORMAT_PATTERN = "yyyy/MM/dd HH:mm:ss"; + + private static final String STRING_IF_EMPTY = "-"; + + private String reportLabel; + + private int numberOfIndicatorsInOneTable = 1; // if there are too many indicators the table will be splitted + + private ContainerTag[] rows; + + private List dataSets; + + private String clinicDepartment; + + private String clinic; + + private Date startDate; + + private Date endDate; + + private Long femalePatients; + + private Long malePatients; + + public String getReportLabel(){ + return this.reportLabel; + } + + public void setReportLabel(String reportLabel){ + this.reportLabel = reportLabel; + } + + public String buildHtmlTables() { + String tablesHtml = buildTables().render(); + LOGGER.debug("built tables html: " + tablesHtml); + return tablesHtml; + } + + public String buildPdf() { + String htmlForPdf = html(head(getStyleForPdf()), body(createPdfHeader(), buildTables())).render(); + LOGGER.debug("built htmlForPdf: " + htmlForPdf); + try { + return convertHtmlToPdfInBase64(htmlForPdf); + } catch (Exception ex) { + throw new HealthQualException("PDF cannot be created", ex); + } + } + + /*private ContainerTag createPdfHeader() { + return div().withClass("center").with( + h2(translate("isanteplusreports.alertprecoce.report.label")), + h3(createPeriodString()), + h5(createDateOfCreationString()) + ); + }*/ + + private ContainerTag createPdfHeader() { + return div().withClass("center").with( + h2(translate(reportLabel)), + h3(createPeriodString()), + h5(createDateOfCreationString()) + ); + } + + private String createPeriodString() { + SimpleDateFormat df = new SimpleDateFormat(PERIOD_DATE_FORMAT_PATTERN); + return df.format(startDate) + " - " + df.format(endDate); + } + + private String createDateOfCreationString() { + SimpleDateFormat df = new SimpleDateFormat(CREATION_DATE_FORMAT_PATTERN); + return translate("isanteplusreports.healthqual.result.pdf.creationDate.label") + " " + df.format(new Date()); + } + + private ContainerTag getStyleForPdf() { + return style().withType("text/css").withText(getStringFromResource("healthQualPdfStyle.css")); + } + + private String convertHtmlToPdfInBase64(String html) throws IOException, ParserConfigurationException, SAXException, + DocumentException { + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document doc = builder.parse(new ByteArrayInputStream(html.replaceAll(" ", "").getBytes("UTF-8"))); + ITextRenderer renderer = new ITextRenderer(); + renderer.setDocument(doc, null); + + renderer.layout(); + renderer.createPDF(out); + out.flush(); + out.close(); + + return DatatypeConverter.printBase64Binary(out.toByteArray()); + } + + private ContainerTag buildTables() { + ContainerTag tables = div(); + Iterator iterator = getDataSets().iterator(); + while (iterator.hasNext()) { + tables.with(buildOneTable(iterator)); + + clearRows(); + } + + return tables; + } + + private ContainerTag buildOneTable(Iterator iterator) { + + for (int i = 0; i < numberOfIndicatorsInOneTable && iterator.hasNext(); ++i) { + buildIndicator(iterator.next()); + } + + return table().with(getRows()); + } + + private void buildIndicator(DataSet data) { + + if((translate(data.getDefinition().getName().toString()).equalsIgnoreCase(translate("isanteplusreports.artdistribution.appointmentperiod.message").toString())) + || (translate(data.getDefinition().getName().toString()).equalsIgnoreCase(translate("isanteplusreports.artdistribution.arvdispense.message").toString())) + ) + { + getRows()[0].with(th(translate(data.getDefinition().getName())).attr("colspan", "3").withClass("indicatorLabel")); + Integer[] numerator = createSummaryArray(getDataSetIntegerValue(data, MALE_NUMERATOR_COLUMN_NAME), + getDataSetIntegerValue(data, FEMALE_NUMERATOR_COLUMN_NAME)); + + + String[] numeratorColumns = createSummaryColumnArray(data, TOTAL_NUMERATOR_COLUMN_NAME); + buildIndicatorSummary(numerator, numeratorColumns); + + } + else + { + if(translate(data.getDefinition().getName().toString()).equalsIgnoreCase(translate("isanteplusreports.report.transitionedPatient").toString())){ + getRows()[0].with(th(translate(data.getDefinition().getName())).attr("colspan", "3").withClass("indicatorLabel")); + getRows()[1].with(td(translate("isanteplusreports.report.transitionedPatient.active")).attr("colspan", "1").withClass("label"), + td(translate("isanteplusreports.report.transitionedPatient.inactive")).attr("colspan", "1").withClass("label"), td(translate("isanteplusreports.pnls.result.Subtotal.label")) + .attr("colspan", "1").withClass("label")); + Integer[] numerator = createSummaryArray(getDataSetIntegerValue(data, MALE_NUMERATOR_COLUMN_NAME), + getDataSetIntegerValue(data, FEMALE_NUMERATOR_COLUMN_NAME)); + + String[] numeratorColumns = createSummaryColumnArray(data, TOTAL_NUMERATOR_COLUMN_NAME); + buildIndicatorSummary(numerator, numeratorColumns); + + Integer[] denominator = createSummaryArray(getDataSetIntegerValue(data, MALE_DENOMINATOR_COLUMN_NAME), + getDataSetIntegerValue(data, FEMALE_DENOMINATOR_COLUMN_NAME)); + + String[] denominatorColumns = createSummaryColumnArray(data, TOTAL_DENOMINATOR_COLUMN_NAME); + buildIndicatorSummary(denominator, denominatorColumns); + + buildIndicatorSummary(createTotalArray(numerator, denominator)); + } + else{ + + if(translate(data.getDefinition().getName().toString()).equalsIgnoreCase(translate("isanteplusreports.report.vitalStatistics").toString())){ + getRows()[0].with(th(translate(data.getDefinition().getName())).attr("colspan", "2").withClass("indicatorLabel")); + getRows()[1].with(td(translate("isanteplusreports.report.vitalStatistics.birthdate")).attr("colspan", "1").withClass("label"), + td(translate("isanteplusreports.report.vitalStatistics.death")).attr("colspan", "1").withClass("label")); + Integer[] numerator = createSummaryArray(getDataSetIntegerValue(data, MALE_NUMERATOR_COLUMN_NAME), + getDataSetIntegerValue(data, FEMALE_NUMERATOR_COLUMN_NAME)); + + String[] numeratorColumns = createSummaryColumnArray(data, TOTAL_NUMERATOR_COLUMN_NAME); + buildIndicatorSummary(numerator, numeratorColumns); + + Integer[] denominator = createSummaryArray(getDataSetIntegerValue(data, MALE_DENOMINATOR_COLUMN_NAME), + getDataSetIntegerValue(data, FEMALE_DENOMINATOR_COLUMN_NAME)); + + String[] denominatorColumns = createSummaryColumnArray(data, TOTAL_DENOMINATOR_COLUMN_NAME); + buildIndicatorSummary(denominator, denominatorColumns); + + //buildIndicatorSummary(createTotalArray(numerator, denominator)); + } + + else{ + + getRows()[0].with(th(translate(data.getDefinition().getName())).attr("colspan", "3").withClass("indicatorLabel")); + getRows()[1].with(td(translate("isanteplusreports.healthqual.result.numerator.label")).attr("colspan", "1").withClass("label"), + td(translate("isanteplusreports.healthqual.result.denominator.label")).attr("colspan", "1").withClass("label"), td(translate("isanteplusreports.healthqual.result.percentage.label")) + .attr("colspan", "1").withClass("label")); + Integer[] numerator = createSummaryArray(getDataSetIntegerValue(data, MALE_NUMERATOR_COLUMN_NAME), + getDataSetIntegerValue(data, FEMALE_NUMERATOR_COLUMN_NAME)); + + String[] numeratorColumns = createSummaryColumnArray(data, TOTAL_NUMERATOR_COLUMN_NAME); + buildIndicatorSummary(numerator, numeratorColumns); + + Integer[] denominator = createSummaryArray(getDataSetIntegerValue(data, MALE_DENOMINATOR_COLUMN_NAME), + getDataSetIntegerValue(data, FEMALE_DENOMINATOR_COLUMN_NAME)); + + String[] denominatorColumns = createSummaryColumnArray(data, TOTAL_DENOMINATOR_COLUMN_NAME); + buildIndicatorSummary(denominator, denominatorColumns); + + buildIndicatorSummary(createPercentageArray(numerator, denominator)); + } + } + } + } + + private void buildIndicatorSummary(T[] dataArray, String[] columnsArray) { + + final int ROW = 3; + String reportName = columnsArray[1]; + String reportUrl = pageLink("isanteplusreports", "alertPrecoceIndicatorReportPatientList"); + String totalUrl = String.format("%s?savedDataSetKey=%s&savedColumnKey=%s&columnKeyType=numerator", reportUrl, reportName, columnsArray[0]); + getRows()[ROW].with(td(a(dataArray[0].toString()).withHref(totalUrl).attr("onclick", "window.open(this.href, 'windowName', 'width=1000, height=700, left=24, top=24, scrollbars, resizable'); return false;"))); + } + + private void buildIndicatorSummary(T[] dataArray) { + + final int ROW = 3; + getRows()[ROW].with(td(dataArray[0].toString()).withClass("total")); + } + + + private Integer[] createSummaryArray(Integer males, Integer females) { + return new Integer[] { males + females }; + } + + + private String[] createSummaryColumnArray(DataSet data, String totalColumn) { + return new String[] { totalColumn, data.getDefinition().getName() }; + } + + private String[] createPercentageArray(Integer[] dividend, Integer[] factor) { + DecimalFormat df = new DecimalFormat(PERCENTAGE_STRING_FORMAT_PATTERN); + + final int SIZE = 1; + String result[] = new String[SIZE]; + for (int i = 0; i < SIZE; ++i) { + if (factor[i] != 0) { + result[i] = df.format(100.0f * dividend[i] / factor[i]); + } else { + result[i] = df.format(0); + } + } + return result; + } + + private String[] createTotalArray(Integer[] nbr1, Integer[] nbr2) { + + final int SIZE = 1; + int total = 0; + String result[] = new String[SIZE]; + for (int i = 0; i < SIZE; ++i) { + total = nbr1[i] + nbr2[i]; + result[i] = String.valueOf(total); + } + return result; + } + + public String getClinic() { + return StringUtils.isNotBlank(clinic) ? clinic : STRING_IF_EMPTY; + } + + public void setClinic(String clinic) { + this.clinic = clinic; + } + + public String getClinicDepartment() { + return StringUtils.isNotBlank(clinicDepartment) ? clinicDepartment : STRING_IF_EMPTY; + } + + public void setClinicDepartment(String clinicDepartment) { + this.clinicDepartment = clinicDepartment; + } + + public ContainerTag[] getRows() { + if (rows == null) { + rows = new ContainerTag[ROWS]; + for (int i = 0; i < ROWS; ++i) { + rows[i] = tr(); + } + } + return rows; + } + + private void clearRows() { + setRows(null); + } + + public void setRows(ContainerTag[] rows) { + this.rows = rows; + } + + public List getDataSets() { + if (dataSets == null) { + dataSets = new LinkedList(); + } + return dataSets; + } + + public void setDataSets(List dataSets) { + this.dataSets = dataSets; + } + + public void addDataSet(DataSet i) { + getDataSets().add(i); + } + + public void addReportData(ReportData reportData) { + getDataSets().addAll(reportData.getDataSets().values()); + } + + public int getNumberOfIndicatorsInOneTable() { + return numberOfIndicatorsInOneTable; + } + + public void setNumberOfIndicatorsInOneTable(int numberOfIndicatorsInOneTable) { + this.numberOfIndicatorsInOneTable = numberOfIndicatorsInOneTable; + } + + private Integer getDataSetIntegerValue(DataSet dataSet, String columnName) { + Object value = dataSet.iterator().next().getColumnValue(columnName); + if (value == null || StringUtils.isBlank(value.toString())) { + dataSet.getDefinition().getName(); + throw new HealthQualException("`" + dataSet.getDefinition().getName() + "` report - column `" + columnName + + "` doesn't exist in dataSet. Probably there is a bug in report SQL"); + } + return Integer.valueOf(value.toString()); + } + + + private static String translate(String code) { + return replaceNonBreakingSpaces(MessageUtil.translate(code)); + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Long getFemalePatients() { + return femalePatients; + } + + public void setFemalePatients(Long femalePatients) { + this.femalePatients = femalePatients; + } + + public Long getMalePatients() { + return malePatients; + } + + public void setMalePatients(Long malePatients) { + this.malePatients = malePatients; + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceIndicator.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceIndicator.java new file mode 100644 index 00000000..0dc63219 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceIndicator.java @@ -0,0 +1,32 @@ +package org.openmrs.module.isanteplusreports.alertprecoce.model; + +import org.openmrs.module.reporting.common.MessageUtil; +import org.openmrs.module.reporting.report.definition.ReportDefinition; + +public class AlertPrecoceIndicator { + +private String nameId; + + private String uuid; + + private AlertPrecoceIndicatorOption option; + + public AlertPrecoceIndicator(ReportDefinition report, AlertPrecoceIndicatorOption option) { + this.option = option; + this.nameId = report.getName(); + this.uuid = report.getUuid(); + } + + public String getName() { + return MessageUtil.translate(nameId); + } + + public String getUuid() { + return uuid; + } + + public AlertPrecoceIndicatorOption getOption() { + return option; + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceIndicatorOption.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceIndicatorOption.java new file mode 100644 index 00000000..32996d54 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceIndicatorOption.java @@ -0,0 +1,40 @@ +package org.openmrs.module.isanteplusreports.alertprecoce.model; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.openmrs.module.reporting.common.MessageUtil; + +public class AlertPrecoceIndicatorOption { + +private String id; + + private String parameterName; + + private List values; + + public AlertPrecoceIndicatorOption(String id, String parametrName, String[] values) { + this.id = id; + this.parameterName = parametrName; + this.values = new ArrayList(); + this.values.addAll(Arrays.asList(values)); + } + + public String getId() { + return id; + } + + public String getLabel() { + return MessageUtil.translate("isanteplusreports.healthqual.option.label." + this.id); + } + + public String getParameterName() { + return parameterName; + } + + public List getValues() { + return values; + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceSelectedIndicator.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceSelectedIndicator.java new file mode 100644 index 00000000..86df5288 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/model/AlertPrecoceSelectedIndicator.java @@ -0,0 +1,26 @@ +package org.openmrs.module.isanteplusreports.alertprecoce.model; + +import java.util.Map; + +public class AlertPrecoceSelectedIndicator { + + private String uuid; + + private Map options; + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public Map getOptions() { + return options; + } + + public void setOptions(Map options) { + this.options = options; + } +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/AlertPrecoceReportsConstants.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/AlertPrecoceReportsConstants.java new file mode 100644 index 00000000..3e20e6a8 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/AlertPrecoceReportsConstants.java @@ -0,0 +1,150 @@ +package org.openmrs.module.isanteplusreports.alertprecoce.util; + +import static org.openmrs.module.isanteplusreports.util.IsantePlusReportsConstants.REPORTS_SQL_PATH; + +public class AlertPrecoceReportsConstants { + + static final String ALERT_PRECOCE_REPORTS_RESOURCE_PATH = REPORTS_SQL_PATH + "alertePrecoceReports/"; + + // SQL files + static final String NUMBER_PATIENTS_SQL = "numberOfPatients.sql"; + + // indicators' UUIDs + public static final String NUMBER_PATIENTS_UUID = "956494eb-e546-48ff-91b7-ff3ae3046713"; + + //Misc + public static final String ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX = "_AP"; + + public static final String ALERT_PRECOCE_INDICATOR_1_UUID = "ffea8cf5-0705-43e1-bda8-1212361b5837"; + public static final String TIMELYWITHDRAWALART_INDICATOR_MESSAGE = "isanteplusreports.alertprecoce.retrait_a_temps_arv.label"; + public static final String TIMELYWITHDRAWALART_NUM_INDICATOR_SQL = "timelywithdrawalart_num.sql"; + public static final String TIMELYWITHDRAWALART_DEN_INDICATOR_SQL = "timelywithdrawalart_den.sql"; + + public static final String ALERT_PRECOCE_INDICATOR_2_UUID = "13e6b765-b108-4ef1-a575-48dcb8f3882f"; + public static final String RETENTIONONART_INDICATOR_MESSAGE = "isanteplusreports.alertprecoce.retention_tar.label"; + public static final String RETENTIONONART_NUM_INDICATOR_SQL = "retentionontar_num.sql"; + public static final String RETENTIONONART_DEN_INDICATOR_SQL = "retentionontar_den.sql"; + + public static final String ALERT_PRECOCE_INDICATOR_3_UUID = "294f299f-2358-40f3-bc41-ea088c93f8bc"; + public static final String RUPTURESTOCK_INDICATOR_MESSAGE = "isanteplusreports.alertprecoce.rupture_stock.label"; + public static final String RUPTURESTOCK_NUM_INDICATOR_SQL = "rupturestock_num.sql"; + public static final String RUPTURESTOCK_DEN_INDICATOR_SQL = "rupturestock_den.sql"; + + public static final String ALERT_PRECOCE_INDICATOR_4_UUID = "751900db-1bcd-4d17-aae3-9f4f69f76b82"; + public static final String VIRALLOADSUPPRESSION_INDICATOR_MESSAGE = "isanteplusreports.alertprecoce.viral_load_suppression.label"; + public static final String VIRALLOADSUPPRESSION_NUM_INDICATOR_SQL = "viralloadsuppression_num.sql"; + public static final String VIRALLOADSUPPRESSION_DEN_INDICATOR_SQL = "viralloadsuppression_den.sql"; + + public static final String ALERT_PRECOCE_INDICATOR_5_UUID = "4ba94f1b-efa6-430d-b1f1-6f7fc26baf9d"; + public static final String VIRALLOADCOMPLETION_INDICATOR_MESSAGE = "isanteplusreports.alertprecoce.viral_load_process_completion.label"; + public static final String VIRALLOADCOMPLETION_NUM_INDICATOR_SQL = "viralloadprocesscompletion_num.sql"; + public static final String VIRALLOADCOMPLETION_DEN_INDICATOR_SQL = "viralloadprocesscompletion_den.sql"; + + public static final String ALERT_PRECOCE_INDICATOR_6_UUID = "b29f22c1-0db0-41e0-b8f4-e428a6806a4c"; + public static final String APPROPRIATECHANGE_INDICATOR_MESSAGE = "isanteplusreports.alertprecoce.appropriate_change.label"; + public static final String APPROPRIATECHANGE_NUM_INDICATOR_SQL = "appropriatechange_num.sql"; + public static final String APPROPRIATECHANGE_DEN_INDICATOR_SQL = "appropriatechange_den.sql"; + + + public static final String ALERT_PRECOCE_INDICATOR_7_UUID = "01064e83-03ad-4dd9-9564-0ffec86c9b66"; + public static final String TREATMENTINTERRUPTION_INDICATOR_MESSAGE = "isanteplusreports.alertprecoce.treatment_interruption.label"; + public static final String TREATMENTINTERRUPTION_NUM_INDICATOR_SQL = "treatmentinterruption_num.sql"; + public static final String TREATMENTINTERRUPTION_DEN_INDICATOR_SQL = "treatmentinterruption_den.sql"; + + public static final String ALERT_PRECOCE_INDICATOR_8_UUID = "7f76d7be-d792-4f08-8081-92e5204dd1a2"; + + /*ARV distribution indicators*/ + public static final String APPOINTMENT_PERIOD_INDICATOR_UUID = "0b5ac4c8-5659-4952-9693-3ecfe1bbc6b7"; + public static final String APPOINTMENT_PERIOD_INDICATOR_MESSAGE = "isanteplusreports.artdistribution.appointmentperiod.message"; + public static final String APPOINTMENT_PERIOD_INDICATOR_SQL = "appointmentperiod.sql"; + + public static final String DISPENSINGART_PERIOD_INDICATOR_UUID = "a7139b90-9a85-4dfa-919c-948706face65"; + public static final String DISPENSINGART_PERIOD_INDICATOR_MESSAGE = "isanteplusreports.artdistribution.arvdispense.message"; + public static final String DISPENSINGART_PERIOD_INDICATOR_SQL = "dispensingartperiod.sql"; + + public static final String NOTTAKINGART_PERIOD_INDICATOR_UUID = "0a272874-2160-4c78-a7c4-95694e50c8f7"; + public static final String NOTTAKINGART_PERIOD_INDICATOR_MESSAGE = "isanteplusreports.artdistribution.nontakingarv.message"; + public static final String NOTTAKINGART_PERIOD_INDICATOR_NUM_SQL = "nottakingart_num.sql"; + public static final String NOTTAKINGART_PERIOD_INDICATOR_DEN_SQL = "nottakingart_den.sql"; + + + public static final String TAKINGART_PERIOD_INDICATOR_UUID = "36a61eda-79fe-431a-8189-86b12a859c9e"; + public static final String TAKINGART_PERIOD_INDICATOR_MESSAGE = "isanteplusreports.artdistribution.takingarv.message"; + public static final String TAKINGART_PERIOD_INDICATOR_NUM_SQL = "takingart_num.sql"; + public static final String TAKINGART_PERIOD_INDICATOR_DEN_SQL = "takingart_den.sql"; + + /*PsychoSocial*/ + public static final String ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_UUID = "d121bd5b-d267-4018-be9d-119ed694382a"; + public static final String ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientwithAssPsycho.label"; + public static final String ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_NUM_SQL = "activePatientOnArvHavingPsychosocialAssessment_num.sql"; + public static final String ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_DEN_SQL = "activePatientOnArvHavingPsychosocialAssessment_den.sql"; + + public static final String ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_UUID = "9ccb0880-de74-4e55-9994-8c57427be260"; + public static final String ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientwithAssPsychoIncomplete.label"; + public static final String ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_NUM_SQL = "activePatientWithIncompletePsychosocialAssessment_num.sql"; + public static final String ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_DEN_SQL = "activePatientWithIncompletePsychosocialAssessment_den.sql"; + + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_UUID = "6d349d95-9279-4dfe-a039-558ede8ce98b"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientwithAssPsychoDiagnosis.label"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_NUM_SQL = "activePatientWithPsychosocialDiagnoses_num.sql"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_DEN_SQL = "activePatientWithPsychosocialDiagnoses_den.sql"; + + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_UUID = "dfe8f920-f2e2-4d46-ac54-af341cf8aad9"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientWithDiagnosisPsychoResolve.label"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_NUM_SQL = "activePatientWithPsychosocialDiagnosesResolve_num.sql"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_DEN_SQL = "activePatientWithPsychosocialDiagnosesResolve_den.sql"; + + public static final String ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_UUID = "c33735a7-e89c-42c8-a483-cbb95eb2a913"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientWithPsychoFollowUp.label"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_NUM_SQL = "activePatientWithPsychosocialFollowUp_num.sql"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_DEN_SQL = "activePatientWithPsychosocialFollowUp_den.sql"; + + public static final String ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_UUID = "a5b4b5c2-589b-4254-b3bd-0ced0c80fac2"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientWithPsychoSocialNeeds.label"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_NUM_SQL = "activePatientWithPsychosocialNeeds_num.sql"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_DEN_SQL = "activePatientWithPsychosocialNeeds_den.sql"; + + public static final String ACTIVE_PATIENT_WITH_PSYCHO_AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_UUID = "9f70ba23-1558-4ad4-a7a8-25e38b326eb5"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO_AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientWithPsychoAfterViralLoadSupMille.label"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO__AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_NUM_SQL = "activePatientPsychoAfterViralLoadSupMille_num.sql"; + public static final String ACTIVE_PATIENT_WITH_PSYCHO__AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_DEN_SQL = "activePatientPsychoAfterViralLoadSupMille_den.sql"; + + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_UUID = "5e3d71fe-16f2-45ee-b761-2bc57643e539"; + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientWithViralLoadSupMilleWiththreePsychoAtTime.label"; + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_NUM_SQL = "activePatientWithViralLoadSupMilleWithThreePsycho_num.sql"; + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_DEN_SQL = "activePatientWithViralLoadSupMilleWithThreePsycho_den.sql"; + + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_UUID = "88cf2a8d-c4c0-4ae7-aff7-d452006a61ab"; + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.activePatientWithViralLoadSupMilleWithPsychoAtTime.label"; + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_NUM_SQL = "activePatientWithViralLoadSupMilleWithPsychoAtTime_num.sql"; + public static final String ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_DEN_SQL = "activePatientWithViralLoadSupMilleWithPsychoAtTime_den.sql"; + + public static final String NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_UUID = "89b930b2-5f60-4501-9607-12b9c46fb087"; + public static final String NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_MESSAGE = "isanteplusreports.psychosocial.indicator.newActivePatientWithPsychoEvaluation.label"; + public static final String NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_NUM_SQL = "newActivePatientWithPsychoAssessment_num.sql"; + public static final String NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENTINDICATOR_DEN_SQL = "newActivePatientWithPsychoAssessment_den.sql"; + + /*Constant for FingerPrint report*/ + public static final String ACTIVE_PATIENT_WITH_FINGER_PRINT_UUID = "80dc287b-9da3-45fe-b136-178cd547cbbf"; + public static final String ACTIVE_PATIENT_WITH_FINGER_PRINT_MESSAGE = "isanteplusreports.fingerprint.indicator.activePatientWithFingerPrint"; + public static final String ACTIVE_PATIENT_WITH_FINGER_PRINT_NUM_SQL = "activePatientWithFingerPrint_num.sql"; + public static final String ACTIVE_PATIENT_WITH_FINGER_PRINT_DEN_SQL = "activePatientWithFingerPrint_den.sql"; + + public static final String ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_UUID = "b015b45c-8af9-47dd-bbb0-5530083268c4"; + public static final String ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_MESSAGE = "isanteplusreports.fingerprint.indicator.activePatientWithoutFingerPrint"; + public static final String ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_NUM_SQL = "activePatientWithoutFingerPrint_num.sql"; + + /*Constants for transitioned patient from Pediatric to Adult*/ + public static final String TRANSISIONED_PATIENT_FROM_PEDIATRIC_TO_ADULT_UUID = "49d1312e-eef5-49ae-8e62-15321227e25a"; + public static final String TRANSISIONED_PATIENT_FROM_PEDIATRIC_TO_ADULT_MESSAGE = "isanteplusreports.report.transitionedPatient"; + public static final String TRANSISIONED_PATIENT_NUM_SQL = "transitionedPatient_num.sql"; + public static final String TRANSISIONED_PATIENT_DEN_SQL = "transitionedPatient_den.sql"; + + /* Constants vitalStatistics */ + public static final String VITAL_STATISTICS_UUID = "501e869e-f562-49da-8e3b-cb112f42837b"; + public static final String VITAL_STATISTICS_MESSAGE = "isanteplusreports.report.vitalStatistics"; + public static final String VITAL_STATISTICS_NUM_SQL = "vitalStatistics_num.sql"; + public static final String VITAL_STATISTICS_DEN_SQL = "vitalStatistics_den.sql"; + + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/AlertPrecoceUtils.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/AlertPrecoceUtils.java new file mode 100644 index 00000000..d9830cf8 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/AlertPrecoceUtils.java @@ -0,0 +1,48 @@ +package org.openmrs.module.isanteplusreports.alertprecoce.util; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.openmrs.module.reporting.report.definition.service.ReportDefinitionService; + +public abstract class AlertPrecoceUtils { + + public static ReportData getReportData(String reportUuid, Date startDate, Date endDate, Map additionalOptions) { + ReportDefinitionService reportDefinitionService = Context.getService(ReportDefinitionService.class); + ReportDefinition reportDefinition = reportDefinitionService.getDefinitionByUuid(reportUuid); + Map parameterValues = new HashMap(); + + for (Parameter parameter : reportDefinition.getParameters()) { + if (parameter.getName().equals("startDate")) { + parameterValues.put("startDate", startDate); + } else if (parameter.getName().equals("endDate")) { + parameterValues.put("endDate", endDate); + }else { + throw new HealthQualException("Report cannot be evaluated - missing '" + parameter.getName() + "' parameter'"); + } + } + + EvaluationContext evaluationContext = new EvaluationContext(); + evaluationContext.setParameterValues(parameterValues); + ReportData reportData = null; + try { + reportData = reportDefinitionService.evaluate(reportDefinition, evaluationContext); + } catch (EvaluationException e) { + throw new HealthQualException("Report cannot be evaluated", e); + } return reportData; + } + + public static String replaceNonBreakingSpaces(String stringToClean) { + return stringToClean.replaceAll(" ", " ") // to let space-wrapping + .replace(' ',' ').trim(); // replace non-breaking space with regular space + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/RegisterAllAlertPrecoceReports.java b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/RegisterAllAlertPrecoceReports.java new file mode 100644 index 00000000..7fcf8ed8 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/alertprecoce/util/RegisterAllAlertPrecoceReports.java @@ -0,0 +1,287 @@ +package org.openmrs.module.isanteplusreports.alertprecoce.util; + +import static org.openmrs.module.isanteplusreports.IsantePlusReportsUtil.reportDefinition; +import static org.openmrs.module.isanteplusreports.IsantePlusReportsUtil.sqlDataSetDefinitionWithResourcePath; +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants.ALERT_PRECOCE_REPORTS_RESOURCE_PATH; +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants.NUMBER_PATIENTS_UUID; +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants.NUMBER_PATIENTS_SQL; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.alertprecoce.AlertPrecoceReportDataset; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.SqlDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.service.DataSetDefinitionService; +import org.openmrs.module.reporting.definition.service.SerializedDefinitionService; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.definition.ReportDefinition; + +public class RegisterAllAlertPrecoceReports { + + private final static Parameter START_DATE = new Parameter("startDate", "isanteplusreports.parameters.startdate", + Date.class); + + private final static Parameter END_DATE = new Parameter("endDate", "isanteplusreports.parameters.enddate", Date.class); + + public static void registerAll() { + numberOfPatients(); + /*Alert precoce indicator*/ + timelyWithdrawalArt(); + retentionOnArt(); + ruptureStock(); + viralLoadSuppression(); + viralLoadCompletion(); + appropriateChange(); + treatmentInterruption(); + /*Distribution ART*/ + appointmentPeriod(); + dispensingArtPeriod(); + notTakinArtPeriod(); + takinArtPeriod(); + /*PsychoSociale*/ + activePatientWithPsychoSocialAssessement(); + activePatientWithIncompletePsychoSocialAssessement(); + activePatientWithPsychoSocialDiagnoses(); + activePatientWithPsychoSocialDiagnosesResolve(); + activePatientWithPsychoSocialFollowUp(); + activePatientWithPsychoSocialNeeds(); + activePatientPsychoAfterViralLoadSupMille(); + activePatientWithViralLoadSupMilleWithThreePsycho(); + activePatientWithViralLoadSupMilleWithPsychoAtTime(); + newActivePatientWithPsychoAssessment(); + activePatientWithFingerPrint(); + activePatientWithoutFingerPrint(); + transitionedPatientFromPediatricToAdult(); + vitalStatistics(); + } + + + /*Alert Precoce report*/ + + private static void numberOfPatients() { + registerAlertPrecoceReportWithStartAndEndDateParams(NUMBER_PATIENTS_SQL, + "Nombre de patients", NUMBER_PATIENTS_UUID); + } + + private static void timelyWithdrawalArt() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.TIMELYWITHDRAWALART_NUM_INDICATOR_SQL, + AlertPrecoceReportsConstants.TIMELYWITHDRAWALART_DEN_INDICATOR_SQL, + AlertPrecoceReportsConstants.TIMELYWITHDRAWALART_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_1_UUID); + } + + private static void retentionOnArt() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.RETENTIONONART_NUM_INDICATOR_SQL, + AlertPrecoceReportsConstants.RETENTIONONART_DEN_INDICATOR_SQL, + AlertPrecoceReportsConstants.RETENTIONONART_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_2_UUID); + } + + private static void ruptureStock() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.RUPTURESTOCK_NUM_INDICATOR_SQL, + AlertPrecoceReportsConstants.RUPTURESTOCK_DEN_INDICATOR_SQL, + AlertPrecoceReportsConstants.RUPTURESTOCK_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_3_UUID); + } + private static void viralLoadSuppression() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.VIRALLOADSUPPRESSION_NUM_INDICATOR_SQL, + AlertPrecoceReportsConstants.VIRALLOADSUPPRESSION_DEN_INDICATOR_SQL, + AlertPrecoceReportsConstants.VIRALLOADSUPPRESSION_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_4_UUID); + } + private static void viralLoadCompletion() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.VIRALLOADCOMPLETION_NUM_INDICATOR_SQL, + AlertPrecoceReportsConstants.VIRALLOADCOMPLETION_DEN_INDICATOR_SQL, + AlertPrecoceReportsConstants.VIRALLOADCOMPLETION_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_5_UUID); + } + private static void appropriateChange() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.APPROPRIATECHANGE_NUM_INDICATOR_SQL, + AlertPrecoceReportsConstants.APPROPRIATECHANGE_DEN_INDICATOR_SQL, + AlertPrecoceReportsConstants.APPROPRIATECHANGE_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_6_UUID); + } + private static void treatmentInterruption() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.TREATMENTINTERRUPTION_NUM_INDICATOR_SQL, + AlertPrecoceReportsConstants.TREATMENTINTERRUPTION_DEN_INDICATOR_SQL, + AlertPrecoceReportsConstants.TREATMENTINTERRUPTION_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ALERT_PRECOCE_INDICATOR_7_UUID); + } + /*Alert Precoce report*/ + /*ART Distribution*/ + private static void appointmentPeriod() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen( + AlertPrecoceReportsConstants.APPOINTMENT_PERIOD_INDICATOR_SQL, + AlertPrecoceReportsConstants.APPOINTMENT_PERIOD_INDICATOR_SQL, + "Rendez-vous pour la période", + AlertPrecoceReportsConstants.APPOINTMENT_PERIOD_INDICATOR_UUID); + } + private static void dispensingArtPeriod() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen( + AlertPrecoceReportsConstants.DISPENSINGART_PERIOD_INDICATOR_SQL, + AlertPrecoceReportsConstants.DISPENSINGART_PERIOD_INDICATOR_SQL, + "ARV dispensé pour la période", + AlertPrecoceReportsConstants.DISPENSINGART_PERIOD_INDICATOR_UUID); + } + private static void notTakinArtPeriod() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.NOTTAKINGART_PERIOD_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.NOTTAKINGART_PERIOD_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.NOTTAKINGART_PERIOD_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.NOTTAKINGART_PERIOD_INDICATOR_UUID); + } + private static void takinArtPeriod() { + + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.TAKINGART_PERIOD_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.TAKINGART_PERIOD_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.TAKINGART_PERIOD_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.TAKINGART_PERIOD_INDICATOR_UUID); + } + + /*PsychoSocial Indicator report*/ + private static void activePatientWithPsychoSocialAssessement() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_PSYCHO_ASSESS_INDICATOR_UUID); + } + + private static void activePatientWithIncompletePsychoSocialAssessement() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_INCOMPLETE_PSYCHO_ASSESS_INDICATOR_UUID); + } + + private static void activePatientWithPsychoSocialDiagnoses() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_INDICATOR_UUID); + } + private static void activePatientWithPsychoSocialDiagnosesResolve() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_DIAGNOSES_RESOLVE_INDICATOR_UUID); + } + + private static void activePatientWithPsychoSocialFollowUp() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_FOLLOWUP_INDICATOR_UUID); + } + + private static void activePatientWithPsychoSocialNeeds() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_SOCIAL_NEEDS_INDICATOR_UUID); + } + + private static void activePatientPsychoAfterViralLoadSupMille() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO__AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO__AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_PSYCHO_AFTER_VIRAL_LOAD_SUP_MILLE_INDICATOR_UUID); + } + + private static void activePatientWithViralLoadSupMilleWithThreePsycho() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_THREE_PSYCHO_INDICATOR_UUID); + } + + private static void activePatientWithViralLoadSupMilleWithPsychoAtTime() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_VL_SUP_MILLE_WITH_PSYCHO_AT_TIME_INDICATOR_UUID); + } + + private static void newActivePatientWithPsychoAssessment() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_NUM_SQL, + AlertPrecoceReportsConstants.NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENTINDICATOR_DEN_SQL, + AlertPrecoceReportsConstants.NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_MESSAGE, + AlertPrecoceReportsConstants.NEW_ACTIVE_PATIENT_WITH_WITH_PSYCHO_ASSESSMENT_INDICATOR_UUID); + } + + private static void activePatientWithFingerPrint() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_FINGER_PRINT_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_FINGER_PRINT_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_FINGER_PRINT_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_FINGER_PRINT_UUID); + } + private static void activePatientWithoutFingerPrint() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_NUM_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITH_FINGER_PRINT_DEN_SQL, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_MESSAGE, + AlertPrecoceReportsConstants.ACTIVE_PATIENT_WITHOUT_FINGER_PRINT_UUID); + } + + private static void transitionedPatientFromPediatricToAdult() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.TRANSISIONED_PATIENT_NUM_SQL, + AlertPrecoceReportsConstants.TRANSISIONED_PATIENT_DEN_SQL, + AlertPrecoceReportsConstants.TRANSISIONED_PATIENT_FROM_PEDIATRIC_TO_ADULT_MESSAGE, + AlertPrecoceReportsConstants.TRANSISIONED_PATIENT_FROM_PEDIATRIC_TO_ADULT_UUID); + } + + private static void vitalStatistics() { + registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(AlertPrecoceReportsConstants.VITAL_STATISTICS_NUM_SQL, + AlertPrecoceReportsConstants.VITAL_STATISTICS_DEN_SQL, + AlertPrecoceReportsConstants.VITAL_STATISTICS_MESSAGE, + AlertPrecoceReportsConstants.VITAL_STATISTICS_UUID); + } + + private static void registerAlertPrecoceReportWithStartAndEndDateParams(String sql, String messageProperties, + String uuid) { + SqlDataSetDefinition sqlData = sqlDataSetDefinitionWithResourcePath(sql, messageProperties, messageProperties, + ALERT_PRECOCE_REPORTS_RESOURCE_PATH); + sqlData.addParameter(START_DATE); + sqlData.addParameter(END_DATE); + Context.getService(DataSetDefinitionService.class).saveDefinition(sqlData); + + Map mappings = new HashMap(); + mappings.put("startDate", "${startDate}"); + mappings.put("endDate", "${endDate}"); + ReportDefinition repDefinition = reportDefinition(messageProperties, messageProperties, uuid); + repDefinition.addParameter(START_DATE); + repDefinition.addParameter(END_DATE); + repDefinition.addDataSetDefinition(sqlData, mappings); + Context.getService(SerializedDefinitionService.class).saveDefinition(repDefinition); + } + + public static void registerAlertPrecoceReportWithStartAndEndDateParamsNumDen(String sqlNum, String sqlDen, + String messageProperties, String uuid) { + ArrayList parameters = new ArrayList(); + parameters.add(START_DATE); + parameters.add(END_DATE); + + DataSetDefinition dsd = new AlertPrecoceReportDataset().constructDataSet(messageProperties, sqlDen, sqlNum, + parameters); + Context.getService(DataSetDefinitionService.class).saveDefinition(dsd); + + Map mappings = new HashMap(); + mappings.put("startDate", "${startDate}"); + mappings.put("endDate", "${endDate}"); + ReportDefinition repDefinition = reportDefinition(messageProperties, messageProperties, uuid); + repDefinition.addParameter(START_DATE); + repDefinition.addParameter(END_DATE); + repDefinition.addDataSetDefinition(dsd, mappings); + Context.getService(SerializedDefinitionService.class).saveDefinition(repDefinition); + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/api/IsantePlusReportsService.java b/api/src/main/java/org/openmrs/module/isanteplusreports/api/IsantePlusReportsService.java index 33c0f4df..d5c99b82 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/api/IsantePlusReportsService.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/api/IsantePlusReportsService.java @@ -93,6 +93,17 @@ List getMotifsConsultattionLastSixMonths( DataSet clinicExams(Patient p); void setEventScheduler(); - + + DataSet alertReport(); + + DataSet alertReportPatientList(Integer id); + + DataSet weeklyMonitoringReportpatientList(Integer id, String startDate, String endDate); + + DataSet patientImmunizationDoses(Patient p); + + DataSet psychoSocialSummary(Patient p); + + DataSet patientListDdpByPeriod(int id, String datA, String datB); } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/api/impl/IsantePlusReportsServiceImpl.java b/api/src/main/java/org/openmrs/module/isanteplusreports/api/impl/IsantePlusReportsServiceImpl.java index f25adbf1..c08eb7e0 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/api/impl/IsantePlusReportsServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/api/impl/IsantePlusReportsServiceImpl.java @@ -22,6 +22,7 @@ import liquibase.database.jvm.JdbcConnection; import liquibase.exception.DatabaseException; +import org.apache.commons.lang.time.DateUtils; import org.hibernate.SQLQuery; import org.hibernate.SessionFactory; import org.openmrs.Concept; @@ -42,7 +43,10 @@ import org.openmrs.module.isanteplusreports.api.IsantePlusReportsService; import org.openmrs.module.isanteplusreports.api.dao.IsantePlusReportsDao; import org.openmrs.module.isanteplusreports.api.db.IsantePlusReportsDAO; +import org.openmrs.module.isanteplusreports.dataset.definitions.DdpReportByPeriodDataSetDefinition; import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.common.ObjectUtil; import org.openmrs.module.reporting.dataset.DataSet; import org.openmrs.module.reporting.dataset.DataSetColumn; import org.openmrs.module.reporting.dataset.DataSetRow; @@ -171,6 +175,7 @@ public DataSet patientListArvByPeriod(Integer id, String startDate, String endDa if (endDate != null) { sqlQuery.append(" AND ifnull(DATE(pdis.dispensation_date),DATE(pdis.visit_date)) <= '" + endDate + "'"); } + //SQLQuery query = sessionFactory.getHibernateSessionFactory().getCurrentSession().createSQLQuery(sqlQuery.toString()); //SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery.toString()); //SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery.toString()); @@ -385,4 +390,186 @@ public void setEventScheduler() { } + @Override + public DataSet alertReport() { + EvaluationContext context = new EvaluationContext(); + SqlDataSetDefinition dataSetDefinition = new SqlDataSetDefinition(); + StringBuilder sqlQuery = new StringBuilder( + "select distinct" + + " al.id, al.libelle as Alert, count(a.id_alert) as Total" + + " FROM isanteplus.alert a, isanteplus.alert_lookup al" + + " WHERE a.id_alert = al.id" + + " GROUP BY al.id"); + SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery.toString()); + //query.setInteger("primaryIdentifierType", primaryIdentifierType.getId()); + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("id_alert", "id_alert", String.class), o[0]); + row.addColumnValue(new DataSetColumn("Alert", "Alert", String.class), o[1]); + row.addColumnValue(new DataSetColumn("Total", "Total", String.class), o[2]); + dataSet.addRow(row); + } + return dataSet; + } + + @Override + public DataSet alertReportPatientList(Integer id) { + EvaluationContext context = new EvaluationContext(); + SqlDataSetDefinition dataSetDefinition = new SqlDataSetDefinition(); + StringBuilder sqlQuery = new StringBuilder( + "select distinct" + + " distinct p.st_id as st_id, p.patient_id, p.national_id as national_id, p.given_name as Prénom, p.family_name as Nom, TIMESTAMPDIFF(YEAR,p.birthdate,now()) as Age, p.gender as Sexe" + + " FROM isanteplus.patient p, isanteplus.alert a" + + " WHERE p.patient_id = a.patient_id" + + " AND a.id_alert = '" + id + "'"); + SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery.toString()); + //query.setInteger("primaryIdentifierType", primaryIdentifierType.getId()); + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("st_id", "st_id", String.class), o[0]); + row.addColumnValue(new DataSetColumn("patient_id", "patient_id", String.class), o[1]); + row.addColumnValue(new DataSetColumn("ID_National", "ID_National", String.class), o[2]); + row.addColumnValue(new DataSetColumn("Nom", "Nom", String.class), o[3]); + row.addColumnValue(new DataSetColumn("Prenom", "Prenom", String.class), o[4]); + row.addColumnValue(new DataSetColumn("Age", "Age", String.class), o[5]); + row.addColumnValue(new DataSetColumn("Sexe", "Sexe", String.class), o[6]); + dataSet.addRow(row); + } + return dataSet; + } + + @Override + public DataSet weeklyMonitoringReportpatientList(Integer id, String startDate, String endDate) { + + EvaluationContext context = new EvaluationContext(); + SqlDataSetDefinition dataSetDefinition = new SqlDataSetDefinition(); + + //PatientIdentifierType primaryIdentifierType = emrApiProperties.getPrimaryIdentifierType(); + StringBuilder sqlQuery = new StringBuilder("select " + + "distinct p.st_id as st_id, p.patient_id, p.national_id as national_id, p.given_name as Prénom, p.family_name as Nom, TIMESTAMPDIFF(YEAR,p.birthdate,now()) as Age, p.gender as Sexe"); + sqlQuery.append(" FROM isanteplus.patient p, isanteplus.indicators ind"); + sqlQuery.append(" WHERE p.patient_id = ind.patient_id"); + sqlQuery.append(" AND ind.indicator_type_id = " + id); + if (startDate != null) { + sqlQuery.append(" AND DATE(ind.indicator_date) >= '" + startDate + "'"); + } + if (endDate != null) { + sqlQuery.append(" AND DATE(ind.indicator_date) <= '" + endDate + "'"); + } + + SQLQuery query = dao.getSessionFactoryResult().createSQLQuery(sqlQuery.toString()); + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("st_id", "st_id", String.class), o[0]); + row.addColumnValue(new DataSetColumn("patient_id", "patient_id", String.class), o[1]); + row.addColumnValue(new DataSetColumn("ID_National", "ID_National", String.class), o[2]); + row.addColumnValue(new DataSetColumn("Nom", "Nom", String.class), o[3]); + row.addColumnValue(new DataSetColumn("Prenom", "Prenom", String.class), o[4]); + row.addColumnValue(new DataSetColumn("Age", "Age", String.class), o[5]); + row.addColumnValue(new DataSetColumn("Sexe", "Sexe", String.class), o[6]); + dataSet.addRow(row); + } + return dataSet; + } + + @Override + public DataSet patientImmunizationDoses(Patient p) { + + EvaluationContext context = new EvaluationContext(); + SqlDataSetDefinition dataSetDefinition = new SqlDataSetDefinition(); + + StringBuilder sqlQuery = new StringBuilder("select " + + "distinct il.vaccine_name as Nom, id.dose0, id.dose1, id.dose2, id.dose3, id.dose4, id.dose5"); + sqlQuery.append(" FROM isanteplus.immunization_lookup il"); + sqlQuery.append(" LEFT OUTER JOIN isanteplus.immunization_dose id"); + sqlQuery.append(" ON il.vaccine_concept_id = id.vaccine_concept_id"); + sqlQuery.append(" AND id.patient_id = " + p.getPatientId()); + sqlQuery.append(" ORDER BY il.id ASC"); + + SQLQuery query = dao.getSessionFactoryResult().createSQLQuery(sqlQuery.toString()); + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("Nom", "Nom", String.class), o[0]); + row.addColumnValue(new DataSetColumn("Dose0", "Dose0", String.class), o[1]); + row.addColumnValue(new DataSetColumn("Dose1", "Dose1", String.class), o[2]); + row.addColumnValue(new DataSetColumn("Dose2", "Dose2", String.class), o[3]); + row.addColumnValue(new DataSetColumn("Dose3", "Dose3", String.class), o[4]); + row.addColumnValue(new DataSetColumn("Dose4", "Dose4", String.class), o[5]); + row.addColumnValue(new DataSetColumn("Dose5", "Dose5", String.class), o[6]); + dataSet.addRow(row); + } + return dataSet; + } + + @Override + public DataSet psychoSocialSummary(Patient p) { + + EvaluationContext context = new EvaluationContext(); + SqlDataSetDefinition dataSetDefinition = new SqlDataSetDefinition(); + + StringBuilder sqlQuery = new StringBuilder("select " + + "distinct c.patient_id, c.visitDate, c.obstaclesRemarks"); + sqlQuery.append(" FROM isanteplus.comprehension c"); + sqlQuery.append(" WHERE c.obstaclesRemarks IS NOT NULL"); + sqlQuery.append(" AND c.obstaclesRemarks <> ''"); + sqlQuery.append(" AND c.patient_id = " + p.getPatientId()); + sqlQuery.append(" ORDER BY c.visitDate ASC"); + + SQLQuery query = dao.getSessionFactoryResult().createSQLQuery(sqlQuery.toString()); + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("visit_date", "visit_date", String.class), o[1]); + row.addColumnValue(new DataSetColumn("remarks", "remarks", String.class), o[2]); + dataSet.addRow(row); + } + return dataSet; + } + + @SuppressWarnings("unchecked") + @Override + public DataSet patientListDdpByPeriod(int id, String datA, String datB) { + + EvaluationContext context = new EvaluationContext(); + SqlDataSetDefinition dataSetDefinition = new SqlDataSetDefinition(); + + StringBuilder sqlQuery = new StringBuilder( + "select " + + "distinct p.st_id as st_id, p.patient_id, p.national_id as national_id, p.given_name as Prénom, p.family_name as Nom, TIMESTAMPDIFF(YEAR,p.birthdate,now()) as Age, p.gender as Sexe" + + " FROM isanteplus.patient p, isanteplus.patient_dispensing pdisp," + + " (select pdi.patient_id,max(ifnull(DATE(pdi.dispensation_date),DATE(pdi.visit_date))) as visit_date from isanteplus.patient_dispensing pdi where pdi.arv_drug = 1065 AND pdi.voided <> 1 AND ifnull(DATE(pdi.dispensation_date),DATE(pdi.visit_date)) BETWEEN '"+ datA +"' AND '"+ datB +"' group by 1)B" + + " WHERE p.patient_id = pdisp.patient_id" + + " AND pdisp.patient_id = B.patient_id" + + " AND ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date)) = B.visit_date" + + " AND pdisp.arv_drug = 1065" + + " AND pdisp.voided <> 1" + + " AND pdisp.ddp = '"+ id +"'" + + " AND ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date)) BETWEEN '"+ datA +"' AND '"+ datB +"'"); + + SQLQuery query = dao.getSessionFactoryResult().createSQLQuery(sqlQuery.toString()); + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("st_id", "st_id", String.class), o[0]); + row.addColumnValue(new DataSetColumn("patient_id", "patient_id", String.class), o[1]); + row.addColumnValue(new DataSetColumn("ID_National", "ID_National", String.class), o[2]); + row.addColumnValue(new DataSetColumn("Nom", "Nom", String.class), o[3]); + row.addColumnValue(new DataSetColumn("Prenom", "Prenom", String.class), o[4]); + row.addColumnValue(new DataSetColumn("Age", "Age", String.class), o[5]); + row.addColumnValue(new DataSetColumn("Sexe", "Sexe", String.class), o[6]); + dataSet.addRow(row); + } + return dataSet; + } + } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/DdpReportByPeriodDataSetEvaluator.java b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/DdpReportByPeriodDataSetEvaluator.java new file mode 100644 index 00000000..af3616e6 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/DdpReportByPeriodDataSetEvaluator.java @@ -0,0 +1,119 @@ +package org.openmrs.module.isanteplusreports.dataset.definition.evaluator; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hibernate.SQLQuery; +import org.openmrs.annotation.Handler; +import org.openmrs.api.PatientService; +import org.openmrs.api.UserService; +import org.openmrs.api.db.hibernate.DbSessionFactory; +import org.openmrs.module.emrapi.EmrApiProperties; +import org.openmrs.module.isanteplusreports.api.db.IsantePlusReportsDAO; +import org.openmrs.module.isanteplusreports.dataset.definitions.DdpReportByPeriodDataSetDefinition; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.common.ObjectUtil; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.dataset.DataSetColumn; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.dataset.SimpleDataSet; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.evaluator.DataSetEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.springframework.beans.factory.annotation.Autowired; +@Handler(supports = DdpReportByPeriodDataSetDefinition.class) +public class DdpReportByPeriodDataSetEvaluator implements DataSetEvaluator { + +private final Log log = LogFactory.getLog(getClass()); + + //private IsantePlusReportsDAO dao; + private IsantePlusReportsDAO dao; + + /** + * @param dao the dao to set + */ + public void setDao(IsantePlusReportsDAO dao) { + this.dao = dao; + } + + /** + * @return the dao + */ + public IsantePlusReportsDAO getDao() { + return dao; + } + + @Autowired + private DbSessionFactory sessionFactory; + + @Autowired + private EmrApiProperties emrApiProperties; + + @Autowired + private UserService userService; + + @Autowired + private PatientService patientService; + + /* + public void setSessionFactory(SessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + }*/ + + /** + * @return the sessionFactory + */ + /*public SessionFactory getSessionFactory() { + return sessionFactory; + }*/ + + @Override + public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext context) throws EvaluationException { + + DdpReportByPeriodDataSetDefinition dsd = (DdpReportByPeriodDataSetDefinition) dataSetDefinition; + Date startDate = ObjectUtil.nvl(dsd.getStartDate(), DateUtils.addDays(new Date(), -7)); + Date endDate = ObjectUtil.nvl(dsd.getEndDate(), new Date()); + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + //PatientIdentifierType primaryIdentifierType = emrApiProperties.getPrimaryIdentifierType(); + StringBuilder sqlQuery = new StringBuilder( + "select ddp,Institution_communautaire,CONCAT(ROUND(((ddp /(Institution_communautaire+ddp)) * 100),2), '%') as pourcentage, (Institution_communautaire+ddp) as 'Patient unique' from(" + + "select " + + "COUNT(DISTINCT CASE WHEN (pdisp.ddp = 1065) THEN pdisp.patient_id else null END) AS ddp," + + "COUNT(DISTINCT CASE WHEN (pdisp.ddp = 0) THEN pdisp.patient_id else null END) AS Institution_communautaire" + + " FROM isanteplus.patient_dispensing pdisp," + + " (select pdi.patient_id,max(ifnull(DATE(pdi.dispensation_date),DATE(pdi.visit_date))) as visit_date from isanteplus.patient_dispensing pdi where pdi.arv_drug = 1065 AND pdi.voided <> 1 AND ifnull(DATE(pdi.dispensation_date),DATE(pdi.visit_date)) BETWEEN :startDate AND :endDate group by 1)B" + + " WHERE pdisp.ddp IN(1065,0)" + + " AND pdisp.patient_id = B.patient_id" + + " AND ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date)) = B.visit_date" + + " AND pdisp.arv_drug = 1065" + + " AND pdisp.voided <> 1" + + " AND ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date)) BETWEEN :startDate AND :endDate) A"); + + SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery.toString()); + + if (startDate != null) { + query.setTimestamp("startDate", startDate); + } + if (endDate != null) { + query.setTimestamp("endDate", endDate); + } + + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("ddp", "ddp", String.class), o[0]); + row.addColumnValue(new DataSetColumn("institution_com", "institution_com", String.class), o[1]); + row.addColumnValue(new DataSetColumn("pourcentage", "pourcentage", String.class), o[2]); + row.addColumnValue(new DataSetColumn("pat_unique", "pat_unique", String.class), o[3]); + dataSet.addRow(row); + } + return dataSet; + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/PatientsStatusDataSetEvaluator.java b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/PatientsStatusDataSetEvaluator.java index 49ae16a9..f13892e3 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/PatientsStatusDataSetEvaluator.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/PatientsStatusDataSetEvaluator.java @@ -96,8 +96,8 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext c "select DISTINCT pat.patient_id, pat.st_id as 'NO. de patient attribué par le site', pat.national_id as 'Numéro identité national'," + " pat.given_name as Prénom,pat.family_name as Nom, pat.gender as Sexe," + " TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, arv.name_fr as 'Status de patient'," - + " patstatus.start_date as 'Dernière date', pat.last_address as Adresse, pat.telephone as Téléphone," - + " pat.contact_name as Contact, pat.next_visit_date as 'Date de prochaine visite'," + + " DATE_FORMAT(DATE(patstatus.start_date), '%d-%m-%Y') as 'Dernière date', pat.last_address as Adresse, pat.telephone as Téléphone," + + " pat.contact_name as Contact, DATE_FORMAT(DATE(pat.next_visit_date), '%d-%m-%Y') as 'Date de prochaine visite'," + " CASE WHEN(patstatus.dis_reason=5240) THEN 'Perdu de vue'" + " WHEN (patstatus.dis_reason=159492) THEN 'Transfert'" + " WHEN (patstatus.dis_reason=159) THEN 'Décès'" @@ -115,7 +115,8 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext c + ":transitionLostFollowUp,:transitionDeath, :transitionTranfered)"); /*sqlQuery.append(" AND patstatus.start_date = B.start_date");*/ sqlQuery.append(" AND patstatus.date_started_status = B.date_started_status"); - sqlQuery.append(" AND patstatus.date_started_status <= :endDate"); + sqlQuery.append(" AND patstatus.date_started_status <= :endDate"); + sqlQuery.append(" AND pat.voided <> 1"); sqlQuery.append(" ORDER BY arv.name_fr"); SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery.toString()); @@ -176,7 +177,7 @@ public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext c row.addColumnValue(new DataSetColumn("prochaine_visite", "prochaine_visite", String.class), o[12]); row.addColumnValue(new DataSetColumn("raison", "raison", String.class), o[13]); dataSet.addRow(row); - } + } return dataSet; } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/WeeklyMonitoringReportDataSetEvaluator.java b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/WeeklyMonitoringReportDataSetEvaluator.java new file mode 100644 index 00000000..4e076a56 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definition/evaluator/WeeklyMonitoringReportDataSetEvaluator.java @@ -0,0 +1,106 @@ +package org.openmrs.module.isanteplusreports.dataset.definition.evaluator; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.time.DateUtils; +import org.hibernate.SQLQuery; +import org.openmrs.annotation.Handler; +import org.openmrs.api.PatientService; +import org.openmrs.api.UserService; +import org.openmrs.api.db.hibernate.DbSessionFactory; +import org.openmrs.module.emrapi.EmrApiProperties; +import org.openmrs.module.isanteplusreports.api.db.IsantePlusReportsDAO; +import org.openmrs.module.isanteplusreports.dataset.definitions.WeeklyMonitoringReportDataSetDefinition; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.common.ObjectUtil; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.dataset.DataSetColumn; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.dataset.SimpleDataSet; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.evaluator.DataSetEvaluator; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.springframework.beans.factory.annotation.Autowired; + +@Handler(supports = WeeklyMonitoringReportDataSetDefinition.class) +public class WeeklyMonitoringReportDataSetEvaluator implements DataSetEvaluator { + + + //private IsantePlusReportsDAO dao; + private IsantePlusReportsDAO dao; + + /** + * @param dao the dao to set + */ + public void setDao(IsantePlusReportsDAO dao) { + this.dao = dao; + } + + /** + * @return the dao + */ + public IsantePlusReportsDAO getDao() { + return dao; + } + + @Autowired + private DbSessionFactory sessionFactory; + + @Autowired + private EmrApiProperties emrApiProperties; + + @Autowired + private UserService userService; + + @Autowired + private PatientService patientService; + + + /** + * @return the sessionFactory + */ + + @Override + public DataSet evaluate(DataSetDefinition dataSetDefinition, EvaluationContext context) throws EvaluationException { + + WeeklyMonitoringReportDataSetDefinition dsd = (WeeklyMonitoringReportDataSetDefinition) dataSetDefinition; + Date startDate = ObjectUtil.nvl(dsd.getStartDate(), DateUtils.addDays(new Date(), -7)); + Date endDate = ObjectUtil.nvl(dsd.getEndDate(), new Date()); + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + //PatientIdentifierType primaryIdentifierType = emrApiProperties.getPrimaryIdentifierType(); + StringBuilder sqlQuery = new StringBuilder( + "SELECT itype.indicator_type_id AS ID,itype.indicator_name_fr AS Nom," + +" CASE WHEN (B.Total) IS NULL THEN '0' ELSE B.Total END AS Total" + +" FROM isanteplus.indicator_type itype" + +" LEFT OUTER JOIN" + +" (select ind.indicator_type_id, count(ind.indicator_type_id) AS Total FROM isanteplus.indicators ind" + +" WHERE DATE(ind.indicator_date) between :startDate AND :endDate" + +" GROUP BY 1) B"); + sqlQuery.append(" ON itype.indicator_type_id = B.indicator_type_id "); + sqlQuery.append(" WHERE itype.report_type_id = 1"); + sqlQuery.append(" GROUP BY itype.indicator_type_id"); + + SQLQuery query = sessionFactory.getCurrentSession().createSQLQuery(sqlQuery.toString()); + if (startDate != null) { + query.setTimestamp("startDate", startDate); + } + if (endDate != null) { + query.setTimestamp("endDate", endDate); + } + + @SuppressWarnings("unchecked") + List list = query.list(); + SimpleDataSet dataSet = new SimpleDataSet(dataSetDefinition, context); + for (Object[] o : list) { + DataSetRow row = new DataSetRow(); + row.addColumnValue(new DataSetColumn("id", "id", String.class), o[0]); + row.addColumnValue(new DataSetColumn("Indicateur", "Indicateur", String.class), o[1]); + row.addColumnValue(new DataSetColumn("Total", "Total", String.class), o[2]); + dataSet.addRow(row); + } + return dataSet; + } +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definitions/DdpReportByPeriodDataSetDefinition.java b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definitions/DdpReportByPeriodDataSetDefinition.java new file mode 100644 index 00000000..31427642 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definitions/DdpReportByPeriodDataSetDefinition.java @@ -0,0 +1,42 @@ +package org.openmrs.module.isanteplusreports.dataset.definitions; + +import java.util.Date; + +import org.openmrs.module.reporting.dataset.definition.BaseDataSetDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; + +public class DdpReportByPeriodDataSetDefinition extends BaseDataSetDefinition { +public static final long serialVersionUID = 1L; + + @ConfigurationProperty(group = "when") + private Date startDate; + + @ConfigurationProperty(group = "when") + private Date endDate; + + private Integer id; + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definitions/WeeklyMonitoringReportDataSetDefinition.java b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definitions/WeeklyMonitoringReportDataSetDefinition.java new file mode 100644 index 00000000..fee24f36 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/dataset/definitions/WeeklyMonitoringReportDataSetDefinition.java @@ -0,0 +1,44 @@ +package org.openmrs.module.isanteplusreports.dataset.definitions; + +import org.openmrs.module.reporting.dataset.definition.BaseDataSetDefinition; +import org.openmrs.module.reporting.definition.configuration.ConfigurationProperty; + +import java.util.Date; + +public class WeeklyMonitoringReportDataSetDefinition extends BaseDataSetDefinition { + +public static final long serialVersionUID = 1L; + + @ConfigurationProperty(group = "when") + private Date startDate; + + @ConfigurationProperty(group = "when") + private Date endDate; + + private Integer id; + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/definitions/DdpReportManager.java b/api/src/main/java/org/openmrs/module/isanteplusreports/definitions/DdpReportManager.java new file mode 100644 index 00000000..aa184d22 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/definitions/DdpReportManager.java @@ -0,0 +1,96 @@ +package org.openmrs.module.isanteplusreports.definitions; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hibernate.SessionFactory; +import org.openmrs.module.emrapi.EmrApiProperties; +import org.openmrs.module.isanteplusreports.IsantePlusReportsProperties; +import org.openmrs.module.isanteplusreports.dataset.definitions.DdpReportByPeriodDataSetDefinition; +import org.openmrs.module.reporting.common.MessageUtil; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.ReportDesign; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class DdpReportManager extends BaseReportManager { +private final Log log = LogFactory.getLog(getClass()); + + public final static String DATA_SET_NAME = "ddpReport"; + + public IsantePlusReportsProperties props = new IsantePlusReportsProperties(); + + //***** PROPERTIES ***** + + @Autowired + EmrApiProperties emrApiProperties; + + @Autowired + SessionFactory sessionFactory; + + @Override + public String getUuid() { + return props.DDPREPORTBYPERIOD_UUID; + } + + @Override + public String getName() { + return "ddpReport"; + } + + @Override + public String getVersion() { + return "1.0"; + } + + public void setEmrApiProperties(EmrApiProperties emrApiProperties) { + this.emrApiProperties = emrApiProperties; + } + + public void setSessionFactory(SessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + //***** INSTANCE METHODS + + @Override + public List getParameters() { + List l = new ArrayList(); + l.add(new Parameter("startDate", MessageUtil.translate("isanteplusreports.parameters.startdate"), Date.class)); + l.add(new Parameter("endDate", MessageUtil.translate("isanteplusreports.parameters.enddate"), Date.class)); + return l; + } + + @Override + public ReportDefinition constructReportDefinition() { + + log.info("Constructing " + getName()); + ReportDefinition rd = new ReportDefinition(); + rd.setName(getName()); + rd.setDescription(getDescription()); + rd.setParameters(getParameters()); + + DdpReportByPeriodDataSetDefinition dsd = new DdpReportByPeriodDataSetDefinition(); + dsd.addParameters(getParameters()); + Map mappings = new HashMap(); + mappings.put("startDate", "${startDate}"); + mappings.put("endDate", "${endDate}"); + + rd.addDataSetDefinition(DATA_SET_NAME, dsd, mappings); + + return rd; + } + + @Override + public List constructReportDesigns(ReportDefinition reportDefinition) { + return Arrays.asList(csvReportDesign(reportDefinition)); + } +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/definitions/WeeklyMonitoringReportManager.java b/api/src/main/java/org/openmrs/module/isanteplusreports/definitions/WeeklyMonitoringReportManager.java new file mode 100644 index 00000000..66f25653 --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/definitions/WeeklyMonitoringReportManager.java @@ -0,0 +1,98 @@ +package org.openmrs.module.isanteplusreports.definitions; + + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hibernate.SessionFactory; +import org.openmrs.module.emrapi.EmrApiProperties; +import org.openmrs.module.isanteplusreports.IsantePlusReportsProperties; +import org.openmrs.module.isanteplusreports.dataset.definitions.WeeklyMonitoringReportDataSetDefinition; +import org.openmrs.module.reporting.common.MessageUtil; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.report.ReportDesign; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Component +public class WeeklyMonitoringReportManager extends BaseReportManager { +private final Log log = LogFactory.getLog(getClass()); + + public final static String DATA_SET_NAME = "data"; + + public IsantePlusReportsProperties props = new IsantePlusReportsProperties(); + + //***** PROPERTIES ***** + + @Autowired + EmrApiProperties emrApiProperties; + + @Autowired + SessionFactory sessionFactory; + + @Override + public String getUuid() { + return props.WEEKLYMONITORINGREPORT_UUID; + } + + @Override + public String getName() { + return "weeklyMonitoringReport"; + } + + @Override + public String getVersion() { + return "1.0"; + } + + public void setEmrApiProperties(EmrApiProperties emrApiProperties) { + this.emrApiProperties = emrApiProperties; + } + + public void setSessionFactory(SessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + //***** INSTANCE METHODS + + @Override + public List getParameters() { + List l = new ArrayList(); + l.add(new Parameter("startDate", MessageUtil.translate("isanteplusreports.parameters.startdate"), Date.class)); + l.add(new Parameter("endDate", MessageUtil.translate("isanteplusreports.parameters.enddate"), Date.class)); + return l; + } + + @Override + public ReportDefinition constructReportDefinition() { + + log.info("Constructing " + getName()); + ReportDefinition rd = new ReportDefinition(); + rd.setName(getName()); + rd.setDescription(getDescription()); + rd.setParameters(getParameters()); + + WeeklyMonitoringReportDataSetDefinition dsd = new WeeklyMonitoringReportDataSetDefinition(); + dsd.addParameters(getParameters()); + Map mappings = new HashMap(); + mappings.put("startDate", "${startDate}"); + mappings.put("endDate", "${endDate}"); + + rd.addDataSetDefinition(DATA_SET_NAME, dsd, mappings); + + return rd; + } + + @Override + public List constructReportDesigns(ReportDefinition reportDefinition) { + return Arrays.asList(csvReportDesign(reportDefinition)); + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/library/cohort/AlertPrecoceReportCohortLibrary.java b/api/src/main/java/org/openmrs/module/isanteplusreports/library/cohort/AlertPrecoceReportCohortLibrary.java new file mode 100644 index 00000000..fe91a30c --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/library/cohort/AlertPrecoceReportCohortLibrary.java @@ -0,0 +1,57 @@ +package org.openmrs.module.isanteplusreports.library.cohort; + +import java.util.List; + +import org.openmrs.module.isanteplusreports.IsantePlusReportsUtil; +import org.openmrs.module.isanteplusreports.util.IsantePlusReportsConstants; +import org.openmrs.module.reporting.cohort.definition.CohortDefinition; +import org.openmrs.module.reporting.cohort.definition.SqlCohortDefinition; +import org.openmrs.module.reporting.common.MessageUtil; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; + +public class AlertPrecoceReportCohortLibrary { + + private static SqlCohortDefinition sqlCohortDefinition(String sqlResourceName, String cohortDefinitionName) { + String sql = IsantePlusReportsUtil + .getStringFromResource(IsantePlusReportsConstants.ALERTPRECOCE_REPORT_RESOURCE_PATH + sqlResourceName); + + SqlCohortDefinition definition = IsantePlusReportsUtil.sqlCohortDefinition(sql, cohortDefinitionName, + MessageUtil.translate(cohortDefinitionName)); + + return definition; + } + + public static CohortDefinition retentionOfPatientsOnArtDen() { + + SqlCohortDefinition cohortDefinition = sqlCohortDefinition("retention_of_patients_on_art_den.sql", + "isanteplusreports.retention_of_patients_on_art_den"); + + return cohortDefinition; + } + + public static CohortDefinition retentionOfPatientsOnArtNum() { + + SqlCohortDefinition cohortDefinition = sqlCohortDefinition("retention_of_patients_on_art_num.sql", + "isanteplusreports.retention_of_patients_on_art_num"); + + return cohortDefinition; + } + + public static CohortDefinition cohortFromSqlResource(String sqlResourceName, String name, List parameters) { + String sql = IsantePlusReportsUtil + .getStringFromResource(IsantePlusReportsConstants.ALERTPRECOCE_REPORT_RESOURCE_PATH + sqlResourceName); + + SqlCohortDefinition cd = new SqlCohortDefinition(); + cd.setName(name); + cd.setDescription(MessageUtil.translate(name)); + for (Parameter parameter : parameters) { + cd.addParameter(parameter); + } + + cd.setQuery(sql); + + return cd; + } + + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/library/indicator/AlertPrecoceReportIndicatorLibrary.java b/api/src/main/java/org/openmrs/module/isanteplusreports/library/indicator/AlertPrecoceReportIndicatorLibrary.java new file mode 100644 index 00000000..d91b481b --- /dev/null +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/library/indicator/AlertPrecoceReportIndicatorLibrary.java @@ -0,0 +1,31 @@ +package org.openmrs.module.isanteplusreports.library.indicator; + +import java.util.List; + +import org.openmrs.module.isanteplusreports.library.cohort.AlertPrecoceReportCohortLibrary; +import org.openmrs.module.isanteplusreports.library.cohort.HealthQualReportCohortLibrary; +import org.openmrs.module.isanteplusreports.reporting.utils.EmrReportingUtils; +import org.openmrs.module.isanteplusreports.reporting.utils.ReportUtils; +import org.openmrs.module.reporting.evaluation.parameter.Mapped; +import org.openmrs.module.reporting.evaluation.parameter.Parameter; +import org.openmrs.module.reporting.indicator.CohortIndicator; + +public class AlertPrecoceReportIndicatorLibrary { + private static final String IND_PARAMS = "startDate=${startDate},endDate=${endDate},location=${location}"; + + public static CohortIndicator retentionOfPatientsOnArtDen() { + return EmrReportingUtils.cohortIndicator("isanteplusreports.retention_of_patients_on_art_den", + ReportUtils.map(HealthQualReportCohortLibrary.retentionOfPatientsOnArtDen(), IND_PARAMS)); + } + + public static CohortIndicator retentionOfPatientsOnArtNum() { + return EmrReportingUtils.cohortIndicator("isanteplusreports.retention_of_patients_on_art_num", + ReportUtils.map(HealthQualReportCohortLibrary.retentionOfPatientsOnArtNum(), IND_PARAMS)); + } + + public static CohortIndicator cohortIndicatorFromSqlResource(String sql, String name, List parameters) { + return EmrReportingUtils.cohortIndicator(name, parameters, + Mapped.mapStraightThrough(AlertPrecoceReportCohortLibrary.cohortFromSqlResource(sql, name, parameters))); + } + +} diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/PnlsReportBuilder.java b/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/PnlsReportBuilder.java index d5d8b1b4..8ddb1e32 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/PnlsReportBuilder.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/PnlsReportBuilder.java @@ -38,9 +38,11 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Date; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; import javax.xml.bind.DatatypeConverter; import javax.xml.parsers.DocumentBuilder; @@ -53,6 +55,7 @@ import org.openmrs.module.isanteplusreports.exception.HealthQualException; import org.openmrs.module.reporting.common.MessageUtil; import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.dataset.DataSetColumn; import org.openmrs.module.reporting.report.ReportData; import org.openmrs.ui.framework.UiUtils; import org.w3c.dom.Document; @@ -1210,9 +1213,25 @@ private void buildIndicatorKeyPopn(DataSet data) { td(translateLabel("captv")).attr("colspan", "1").withClass("label"), td(translateLabel("drug")).attr("colspan", "1").withClass("label"), td(translateLabel("Total")).attr("colspan", "1").withClass("label")); + int[] dataSet = createSummaryArray(getKeyPopnColumnNamesList(), data); String reportName = data.getDefinition().getName(); buildIndicatorSummaryKeyPopn(dataSet, getKeyPopnColumnNamesArray(), reportName); + + /* Adding by Feshner */ + int d1 = Integer.parseInt(data.iterator().next().getColumnValue("MSMN").toString()); + int d2 = Integer.parseInt(data.iterator().next().getColumnValue("SPN").toString()); + int d3 = Integer.parseInt(data.iterator().next().getColumnValue("TSGN").toString()); + int d4 = Integer.parseInt(data.iterator().next().getColumnValue("CPN").toString()); + int d5 = Integer.parseInt(data.iterator().next().getColumnValue("DRUGN").toString()); + populateTable4WithSum(2, d1, d2, d3, d4, d5); + + int d6 = Integer.parseInt(data.iterator().next().getColumnValue("MSMR").toString()); + int d7 = Integer.parseInt(data.iterator().next().getColumnValue("SPR").toString()); + int d8 = Integer.parseInt(data.iterator().next().getColumnValue("TSGR").toString()); + int d9 = Integer.parseInt(data.iterator().next().getColumnValue("CPR").toString()); + int d10 = Integer.parseInt(data.iterator().next().getColumnValue("DRUGR").toString()); + populateTable4WithSum(3, d6, d7, d8, d9, d10); } private void buildIndicatorKeyPopnSingleRow(DataSet data) { @@ -1409,7 +1428,7 @@ private void buildIndicatorSummaryKeyPopn(int[] dataArray, String[] columnsArray int colCount = 0; for (int ROW = 2; ROW <= 3; ROW++) { - for (int col = 0; col <= 5; col++) { + for (int col = 0; col <= 4; col++) { if (colCount < dataArray.length) { String row = ConstructUrl(reportUrl, reportName, columnsArray[colCount]); populateTable4(ROW, dataArray[colCount], row); @@ -1532,7 +1551,17 @@ private void populateTable14WithSum(Integer ROW, int data1, int data2, int data3 getRows14()[ROW].with(td(Integer.toString( data1 + data2 + data3 + data4 + data5 + data6 + data7 + data8 + data9 + data10 + data11 + data12))); } - + /*Adding by Feshner*/ + private void populateTable4WithSum(Integer ROW, int data1, int data2, int data3, int data4, int data5) { + getRows4()[ROW].with(td(Integer.toString(data1 + data2 + data3 + data4 + data5))); + + //getRows4()[ROW].withValue(td(Integer.toString(data1 + data2 + data3 + data4 + data5))); + //getRows4()[ROW].withValue(Integer.toString(data1 + data2 + data3 + data4 + data5)); + + } + + + /*End adding by Feshner*/ private void populateTable(Integer ROW, int data) { getRows3()[ROW].with(td(Integer.toString(data))); } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/library/columns/ColumnsLibrary.java b/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/library/columns/ColumnsLibrary.java index 2d3c90c4..752da19d 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/library/columns/ColumnsLibrary.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/library/columns/ColumnsLibrary.java @@ -245,7 +245,7 @@ public static String[] getAllCtxColumnsArray(){ private static final String COLUMN_KEY_POPN_DRUG = "DRUG"; - private static final String COLUMN_KEY_POPN_TOTAL = "Total"; + /*private static final String COLUMN_KEY_POPN_TOTAL = "Total";*/ public static String[] genarateKeyPopnColumnArrayNames(String column){ String[] KeyPonColumns = { @@ -253,8 +253,8 @@ public static String[] genarateKeyPopnColumnArrayNames(String column){ COLUMN_KEY_POPN_SEX +column, COLUMN_KEY_POPN_TRANSGENDER +column, COLUMN_KEY_POPN_CAPTIVES +column, - COLUMN_KEY_POPN_DRUG +column, - COLUMN_KEY_POPN_TOTAL +column + COLUMN_KEY_POPN_DRUG +column/*, + COLUMN_KEY_POPN_TOTAL +column*/ }; return KeyPonColumns; } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/utils/pnlsReportUtils.java b/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/utils/pnlsReportUtils.java index d69a4ebb..4784092c 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/utils/pnlsReportUtils.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/pnlsReport/utils/pnlsReportUtils.java @@ -191,7 +191,7 @@ public static void addKeyPopulationColums(CohortIndicatorDataSetDefinition dsd, constructColumn("TSG" + column, "Transgender", CohortIndicator, "keyPopn=TRANSG", dsd); constructColumn("CP" + column, "Captives", CohortIndicator, "keyPopn=CAPT", dsd); constructColumn("DRUG" + column, "Drug Users", CohortIndicator, "keyPopn=DRUG", dsd); - constructColumn("Total" + column, "Tatal", CohortIndicator, "", dsd); + constructColumn("Total" + column, "Total", CohortIndicator, "", dsd); } public static void addKeyPopulationSingleRowColums(CohortIndicatorDataSetDefinition dsd, diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/util/IsantePlusReportsConstants.java b/api/src/main/java/org/openmrs/module/isanteplusreports/util/IsantePlusReportsConstants.java index edd51d9a..badc1c15 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/util/IsantePlusReportsConstants.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/util/IsantePlusReportsConstants.java @@ -12,9 +12,12 @@ public class IsantePlusReportsConstants { public static final String MALARIA_INDICATORS_RESOURCE_PATH = REPORTS_SQL_PATH + "malariaIndicatorReport/"; - public static final String SINGLE_INDICATORS_RESOURCE_PATH = REPORTS_SQL_PATH + "singleIndicatorReports/";; + public static final String SINGLE_INDICATORS_RESOURCE_PATH = REPORTS_SQL_PATH + "singleIndicatorReports/"; + public static final String OBGYN_INDICATORS_RESOURCE_PATH = REPORTS_SQL_PATH + "obGynSurveillanceReport/"; public static final String HEALTHQUAL_REPORT_RESOURCE_PATH = REPORTS_SQL_PATH + "healthQualReports/"; + public static final String ALERTPRECOCE_REPORT_RESOURCE_PATH = REPORTS_SQL_PATH + "alertePrecoceReports/"; + } diff --git a/api/src/main/java/org/openmrs/module/isanteplusreports/util/RegisterAllOtherReports.java b/api/src/main/java/org/openmrs/module/isanteplusreports/util/RegisterAllOtherReports.java index 0d3b88cd..08fc8910 100644 --- a/api/src/main/java/org/openmrs/module/isanteplusreports/util/RegisterAllOtherReports.java +++ b/api/src/main/java/org/openmrs/module/isanteplusreports/util/RegisterAllOtherReports.java @@ -56,7 +56,7 @@ public static void registerOtherReports(){ institutionFrequentingByUserAndDate(); institutionFrequenting(); institutionFrequentingByDate(); - saveAlertReport(); + //saveAlertReport(); patientWithOnlyRegisterForm(); hivPatientWithoutFirstVisit(); hivPatientWithActivityAfterDisc(); @@ -105,6 +105,17 @@ public static void registerOtherReports(){ listPatientWithNextVisitByPeriod(); MalariaIndicatorReport.registerReport(); ObGynIndicatorReport.registerReport(); + listPatientWithActivityAfterDiscByPeriod(); + listPatientVaccinatedForCovid19(); + listPatientDiagnoseForCovid19(); + listPatientSuspectedCovid19(); + listPatientConfirmCovid19(); + hivPatientsWithoutPositiveHivTest(); + listActivePatientsWithViralLoadTwelveMonths(); + listActivePatientsScreenedForTb(); + patientWithIncompleteProphylaxisAgainstTb(); + patientScreenedNegativeAgainstTbWithNoProphylaxis(); + listPatientWithFingerPrint(); } private static void cleanTables() { @@ -271,10 +282,10 @@ private static void institutionFrequentingByDate() { MessageUtil.translate("isanteplusreports.institution_frequenting_by_date"), IsantePlusReportsProperties.INSTITUTION_FREQUENTING_ORDER_BY_DATE); } - private static void saveAlertReport() { + /*private static void saveAlertReport() { IsantePlusReportsUtil.registerOtherReportsWithoutParams("alert.sql","isanteplusreports.alert", MessageUtil.translate("isanteplusreports.alert"), IsantePlusReportsProperties.ALERT_REPORT_DEFINITION_UUID); - } + }*/ private static void patientWithOnlyRegisterForm() { IsantePlusReportsUtil.registerReportsWithoutParams("patient_with_only_register_form.sql","isanteplusreports.patient_with_only_register_form", @@ -292,27 +303,13 @@ private static void hivPatientWithActivityAfterDisc(){ } private static void numberPregnancyWomenHivTested() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.number_pregnancy_women_hiv_tested", - MessageUtil.translate("isanteplusreports.number_pregnancy_women_hiv_tested"), - Arrays.asList(PmtctReportsIndicatorLibrary.pregnantWomenTestedForHiv())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.number_pregnancy_women_hiv_tested", - MessageUtil.translate("isanteplusreports.number_pregnancy_women_hiv_tested"), - IsantePlusReportsProperties.NUMBER_PREGNANT_WOMEN_HIV_TESTED_UUID, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_pregnancy_women_hiv_tested.sql","isanteplusreports.number_pregnancy_women_hiv_tested", + MessageUtil.translate("isanteplusreports.number_pregnancy_women_hiv_tested"), IsantePlusReportsProperties.NUMBER_PREGNANT_WOMEN_HIV_TESTED_UUID); } private static void numberPregnancyWomenHivPositive() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.number_prenancy_women_vih_positive", - MessageUtil.translate("isanteplusreports.number_prenancy_women_vih_positive"), - Arrays.asList(PmtctReportsIndicatorLibrary.pregnantWomenTestedHivPositive())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.number_prenancy_women_vih_positive", - MessageUtil.translate("isanteplusreports.number_prenancy_women_vih_positive"), - IsantePlusReportsProperties.NUMBER_PREGNANT_WOMEN_HIV_POSITIVE_UUID, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_prenancy_women_vih_positive.sql","isanteplusreports.number_prenancy_women_vih_positive", + MessageUtil.translate("isanteplusreports.number_prenancy_women_vih_positive"), IsantePlusReportsProperties.NUMBER_PREGNANT_WOMEN_HIV_POSITIVE_UUID); } private static void communityArvDistribution() { @@ -326,27 +323,13 @@ private static void pregnancyWomenOnHaart() { } private static void pregnancyWomenTestedForSyphilis() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.pregnancy_women_tested_for_syphilis", - MessageUtil.translate("isanteplusreports.pregnancy_women_tested_for_syphilis"), - Arrays.asList(PrenatalReportsIndicatorLibrary.pregnantWomenTestedForSyphilis())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.pregnancy_women_tested_for_syphilis", - MessageUtil.translate("isanteplusreports.pregnancy_women_tested_for_syphilis"), - IsantePlusReportsProperties.PREGNANCY_WOMEN_TESTED_FOR_SYPHILIS_UUID, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("pregnancy_women_tested_for_syphilis.sql","isanteplusreports.pregnancy_women_tested_for_syphilis", + MessageUtil.translate("isanteplusreports.pregnancy_women_tested_for_syphilis"), IsantePlusReportsProperties.PREGNANCY_WOMEN_TESTED_FOR_SYPHILIS_UUID); } private static void pregnancyWomenDiagnosedWithSyphilis() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.pregnancy_women_diagnosed_with_syphilis", - MessageUtil.translate("isanteplusreports.pregnancy_women_diagnosed_with_syphilis"), - Arrays.asList(PrenatalReportsIndicatorLibrary.pregnantWomenDiagnosedWithSyphilis())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.pregnancy_women_diagnosed_with_syphilis", - MessageUtil.translate("isanteplusreports.pregnancy_women_diagnosed_with_syphilis"), - IsantePlusReportsProperties.PREGNANCY_WOMEN_DIAGNOSED_WITH_SYPHILIS_UUID, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_pregnant_women_diagnosed_syphilis.sql","isanteplusreports.pregnancy_women_diagnosed_with_syphilis", + MessageUtil.translate("isanteplusreports.pregnancy_women_diagnosed_with_syphilis"), IsantePlusReportsProperties.PREGNANCY_WOMEN_DIAGNOSED_WITH_SYPHILIS_UUID); } private static void numberPrenatalVisitBySite() { @@ -360,15 +343,8 @@ private static void numberPregnancyWomenHadFirstPrenatalCons(){ } private static void numberHivPregnancyWomenGaveBirthAtHospital() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.number_hiv_pregnancy_women_gave_birth_at_hospital", - MessageUtil.translate("isanteplusreports.number_hiv_pregnancy_women_gave_birth_at_hospital"), - Arrays.asList(PmtctReportsIndicatorLibrary.hivPositivePregnantWomenWhoGaveBirthAtHospital())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.number_hiv_pregnancy_women_gave_birth_at_hospital", - MessageUtil.translate("isanteplusreports.number_hiv_pregnancy_women_gave_birth_at_hospital"), - IsantePlusReportsProperties.NUMBER_HIV_PREGNANCY_WOMEN_GAVE_BIRTH_AT_HOSP, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_hiv_women_gave_birth_at_hospital.sql","isanteplusreports.number_hiv_pregnancy_women_gave_birth_at_hospital", + MessageUtil.translate("isanteplusreports.number_hiv_pregnancy_women_gave_birth_at_hospital"), IsantePlusReportsProperties.NUMBER_HIV_PREGNANCY_WOMEN_GAVE_BIRTH_AT_HOSP); } private static void exposedInfantsWithMotherInPtmeProgram() { @@ -377,15 +353,8 @@ private static void exposedInfantsWithMotherInPtmeProgram() { } private static void numberInfantsFromMotherOnProphylaxis() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.number_infants_from_mother_on_prophylaxis", - MessageUtil.translate("isanteplusreports.number_infants_from_mother_on_prophylaxis"), - Arrays.asList(PmtctReportsIndicatorLibrary.infantsBornToMothersOnProphylaxis())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.number_infants_from_mother_on_prophylaxis", - MessageUtil.translate("isanteplusreports.number_infants_from_mother_on_prophylaxis"), - IsantePlusReportsProperties.NUMBER_INFANTS_FROM_MOTHER_ON_PROPHYLAXIS, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_infants_from_mother_on_prophylaxis.sql","isanteplusreports.number_infants_from_mother_on_prophylaxis", + MessageUtil.translate("isanteplusreports.number_infants_from_mother_on_prophylaxis"), IsantePlusReportsProperties.NUMBER_INFANTS_FROM_MOTHER_ON_PROPHYLAXIS); } private static void frequencyPrenatalVisitsPerPatient() { @@ -399,27 +368,22 @@ private static void numberExposedInfantsTestedByPcr(){ } private static void numberExposedInfantsConfirmedHiv() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.number_exposed_infants_confirmed_hiv", - MessageUtil.translate("isanteplusreports.number_exposed_infants_confirmed_hiv"), - Arrays.asList(PmtctReportsIndicatorLibrary.exposedInfantsConfirmedHivPositive())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.number_exposed_infants_confirmed_hiv", - MessageUtil.translate("isanteplusreports.number_exposed_infants_confirmed_hiv"), - IsantePlusReportsProperties.NUMBER_EXPOSED_INFANTS_CONFIRMED_HIV_UUID, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_exposed_infants_confirmed_hiv.sql","isanteplusreports.number_exposed_infants_confirmed_hiv", + MessageUtil.translate("isanteplusreports.number_exposed_infants_confirmed_hiv"), IsantePlusReportsProperties.NUMBER_EXPOSED_INFANTS_CONFIRMED_HIV_UUID); } private static void numberWomenFirstPrenatalVisitFirstTrimester() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester", - MessageUtil.translate("isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester"), - Arrays.asList(PrenatalReportsIndicatorLibrary.pregnantWomenFirstVisitAfterFirstTrimester())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.pregnancy_women_diagnosed_with_syphilis", - MessageUtil.translate("isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester"), - IsantePlusReportsProperties.NUMBER_WOMEN_SEEN_FIRST_PRENATAL_VISIT_FIRST_SEMESTER_UUID, dsd); + CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( + "isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester", + MessageUtil.translate("isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester"), + Arrays.asList(PrenatalReportsIndicatorLibrary.pregnantWomenFirstVisitAfterFirstTrimester())); + + IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( + "isanteplusreports.pregnancy_women_diagnosed_with_syphilis", + MessageUtil.translate("isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester"), + IsantePlusReportsProperties.NUMBER_WOMEN_SEEN_FIRST_PRENATAL_VISIT_FIRST_SEMESTER_UUID, dsd); + /* IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_women_seen_first_prenatal_visit_first_trimester.sql","isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester", + MessageUtil.translate("isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester"), IsantePlusReportsProperties.NUMBER_WOMEN_SEEN_FIRST_PRENATAL_VISIT_FIRST_SEMESTER_UUID);*/ } private static void hivTransmissionRisksFactor() { @@ -428,15 +392,9 @@ private static void hivTransmissionRisksFactor() { } private static void numberVisitsByPregnantWomenToClinic() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.number_visits_by_pregnant_women_to_the_clinic", - MessageUtil.translate("isanteplusreports.number_visits_by_pregnant_women_to_the_clinic"), - Arrays.asList(PrenatalReportsIndicatorLibrary.visitsByPregnantWomentInClinic())); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("number_visits_by_pregnant_women_to_the_clinic.sql","isanteplusreports.number_visits_by_pregnant_women_to_the_clinic", + MessageUtil.translate("isanteplusreports.number_visits_by_pregnant_women_to_the_clinic"), IsantePlusReportsProperties.NUMBER_VISITS_BY_PREGNANT_WOMEN_UUID); - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.number_visits_by_pregnant_women_to_the_clinic", - MessageUtil.translate("isanteplusreports.number_visits_by_pregnant_women_to_the_clinic"), - IsantePlusReportsProperties.NUMBER_VISITS_BY_PREGNANT_WOMEN_UUID, dsd); } private static void listVisitsByPregnantWomenToClinic() { @@ -544,15 +502,8 @@ private static void possibleDuplicateRegistrations(){ } private static void numberWomenEnrolledBecamePregnant() { - CohortIndicatorDataSetDefinition dsd = IsantePlusReportsUtil.cohortIndicatorDataSetDefinition( - "isanteplusreports.womenEnrolledBecamePregnant", - MessageUtil.translate("isanteplusreports.womenEnrolledBecamePregnant"), - Arrays.asList(PmtctReportsIndicatorLibrary.hivPositiveWomenEnrolledInCareWhoBecamePregnant())); - - IsantePlusReportsUtil.registerIndicatorReportsWithStartAndEndDateParams( - "isanteplusreports.womenEnrolledBecamePregnant", - MessageUtil.translate("isanteplusreports.womenEnrolledBecamePregnant"), - IsantePlusReportsProperties.WOMENENROLLEDBECAMEPREGNANT_UUID, dsd); + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("womenEnrolledBecamePregnant.sql","isanteplusreports.womenEnrolledBecamePregnant", + MessageUtil.translate("isanteplusreports.womenEnrolledBecamePregnant"), IsantePlusReportsProperties.WOMENENROLLEDBECAMEPREGNANT_UUID); } private static void numberHivPatient() { @@ -577,5 +528,61 @@ private static void listPatientWithNextVisitByPeriod() { MessageUtil.translate("isanteplusreports.next_visit_by_period"), IsantePlusReportsProperties.NEXT_VISIT_BY_PERIOD_UUID); } + private static void listPatientWithActivityAfterDiscByPeriod() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("patients_with_activity_after_disc_by_month.sql","isanteplusreports.activity_after_discontinuation_by_period", + MessageUtil.translate("isanteplusreports.activity_after_discontinuation_by_period"), IsantePlusReportsProperties.ACTIVITY_AFTER_DISC_BY_PERIOD); + } + + private static void listPatientVaccinatedForCovid19() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("patients_vaccinated_for_covid_19.sql","Liste des patients vaccinés pour le COVID-19", + "Liste des patients vaccinés pour le COVID-19", IsantePlusReportsProperties.PATIENTS_VACCINATED_FOR_COVID19); + } + + private static void listPatientDiagnoseForCovid19() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("patients_diagnose_for_covid19.sql","Liste des patients diagnostiqués pour le COVID-19", + "Liste des patients diagnostiqués pour le COVID-19", IsantePlusReportsProperties.PATIENTS_DIAGNOSE_FOR_COVID19); + } + + private static void listPatientConfirmCovid19() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("patients_confirm_covid19.sql","Liste des patients confirmés COVID-19", + "Liste des patients confirmés COVID-19", IsantePlusReportsProperties.PATIENTS_CONFIRM_COVID19); + } + + private static void listPatientSuspectedCovid19() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("patients_suspected_covid19.sql","Liste des patients suspectés pour le COVID-19", + "Liste des patients suspectés pour le COVID-19", IsantePlusReportsProperties.PATIENTS_SUSPECTED_COVID19); + } + + private static void hivPatientsWithoutPositiveHivTest(){ + IsantePlusReportsUtil.registerReportsWithoutParams("list_hiv_patients_without_hiv_test.sql","Liste des patients VIH sans test VIH positif", + "Liste des patients VIH sans test VIH positif", IsantePlusReportsProperties.PATIENTS_HIV_WITHOUT_POSITIVE_HIV_TEST); + + } + + private static void listActivePatientsWithViralLoadTwelveMonths() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("active_patient_viral_load_last_twelve_months.sql","Patient Actif avec une charge virale pendant les 12 derniers mois", + "Patient Actif avec une charge virale pendant les 12 derniers mois", IsantePlusReportsProperties.ACTIVE_PATIENTS_VIRALLOAD_TWELVE_MONTHS); + } + + private static void listActivePatientsScreenedForTb() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("activePatientsScreenedForTb.sql","Patients VIH+ actifs sous ARV dépistés pour la TB", + "Patients VIH+ actifs sous ARV dépistés pour la TB", IsantePlusReportsProperties.ACTIVE_PATIENTS_SCREENED_FOR_TB_UUID); + } + + private static void patientWithIncompleteProphylaxisAgainstTb() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("patientWithIncompleteProphylaxisAgainstTb.sql","Patients avec Prophylaxie incomplète contre la TB", + "Patients avec Prophylaxie incomplète contre la TB", IsantePlusReportsProperties.PATIENT_WITH_INCOMPLETE_PROPHYLAXIS_AGAINST_TB_UUID); + } + + private static void patientScreenedNegativeAgainstTbWithNoProphylaxis() { + IsantePlusReportsUtil.registerReportsWithStartAndEndDateParams("patientScreenedNegativeAgainstTbWithNoProphylaxis.sql","Patients dépistés négatifs pour la TB n’ayant pas reçu de prophylaxie", + "Patients dépistés négatifs pour la TB n’ayant pas reçu de prophylaxie", IsantePlusReportsProperties.PATIENT_SCREENED_NEGATIVE_AGAINST_TB_WITH_NO_PROPHYLAXIS_UUID); + } + + private static void listPatientWithFingerPrint(){ + IsantePlusReportsUtil.registerReportsWithoutParams("patient_with_finger_print.sql","Liste des patients avec empreinte", + "Liste des patients avec empreinte", IsantePlusReportsProperties.PATIENT_WITH_FINGER_PRINT_UUID); + + } } diff --git a/api/src/main/resources/healthQualPdfStyle.css b/api/src/main/resources/healthQualPdfStyle.css index 441c78bb..3d905f18 100644 --- a/api/src/main/resources/healthQualPdfStyle.css +++ b/api/src/main/resources/healthQualPdfStyle.css @@ -54,6 +54,7 @@ h3, h5 { table { border-collapse: separate; border-spacing: 0; + width:80%; empty-cells: hide; margin: 41pt 0; margin-right: 1.1in; /* setting proper right page margin */ diff --git a/api/src/main/resources/messages.properties b/api/src/main/resources/messages.properties index f1d87234..89981841 100644 --- a/api/src/main/resources/messages.properties +++ b/api/src/main/resources/messages.properties @@ -246,6 +246,7 @@ isanteplusreports.number_of_suspected_cases_of_confirmed_malaria=Number of suspe isanteplusreports.number_of_confirmed_cases_for_severe_malaria_and_put_on_treatment_according_to_the_national_standards_of_the_mspp=Number of confirmed cases for severe malaria and put on treatment according to the national standards of the MSPP isanteplusreports.number_of_patients_with_malaria_hospitalized=Number of patients with Malaria hospitalized isanteplusreports.number_of_cases_of_confirmed_malaria_for_pregnant_women=Number of cases of confirmed malaria for pregnant women +isanteplusreports.activity_after_discontinuation_by_period=HIV patient with activity after discontinuation during the month isanteplusreports.art_enrollments_among_medically_eligible=ART enrollment among medically eligible isanteplusreports.discontinued_drugs=Patients who discontinued drugs @@ -323,6 +324,7 @@ isanteplusreports.pnls.result.pdf.creationDate.label=Date Created isanteplusreports.newlyEnrolledPatientsOnArt= 1.1: NEW: Number of HIV+ newly enrolled on ART during the selected period (TX_NEW) isanteplusreports.newlyEnrolledBreastFeedingWomenOnArt=1.1.1: New breastfeeding women enrolled on ARVs isanteplusreports.referredInPatientsAnArt=1.2 : People previously enrolled on ARVs and transferred-in during the month + isanteplusreports.disintergrationByKeyPopulations=2: Enlistment and reference of those key populations isanteplusreports.notYetEnrolledOnArtByReason=3: HIV + patients not yet on ART isanteplusreports.patientsUnderPreventionCtx=4: Number of new patients on ARV PROPHYLAXIS placed under the CTX during the month @@ -400,4 +402,58 @@ isanteplusreports.womenOnArvScreenedCervicalCancer.testedPostive=24 Number of wo isanteplusreports.recomendedPf=25 Number of ARVs recommended in patients PF isanteplusreports.recomendedPf.accepting=25.1 : Accepting patients for the month of FP method isanteplusreports.recomendedPf.using=25.2 Patients users of FP method +isanteplusreports.patient_vaccinated_covid19=List of patients vaccinated for COVID-19 +isanteplusreports.patient_diagnose_for_covid19=List of patients diagnose for COVID-19 +isanteplusreports.alertprecoce.retrait_a_temps_arv.label=Timely withdrawal of ARTs +isanteplusreports.alertprecoce.retention_tar.label=Retention on ART +isanteplusreports.alertprecoce.rupture_stock.label=Sold out +isanteplusreports.alertprecoce.viral_load_suppression.label=Viral load Suppression +isanteplusreports.alertprecoce.viral_load_process_completion.label=Completion of the viral load analysis process (VLS.2) +isanteplusreports.alertprecoce.appropriate_change.label=Appropriate change +isanteplusreports.alertprecoce.treatment_interruption.label=Interruption of treatment (IIT) +isanteplusreports.alertprecoce.report.label=Early warning Report +isanteplusreports.alertprecoce.result.label=Early warning Report Result +isanteplusreports.reportsapp.alertprecoce=Early warning indicators +isanteplusreports.weeklymonitoringreport.indicator.label=Weekly monitoring indicator report +isanteplusreports.reportsapp.dashboard=Dashboard +isanteplusreports.artdistribution.report.label=ART Distribution Report +isanteplusreports.artdistribution.result.label=ART Distribution Report Result +isanteplusreports.artdistribution.appointmentperiod.message=Appointment for the period +isanteplusreports.artdistribution.arvdispense.message=ART dispense for the period +isanteplusreports.artdistribution.nontakingarv.message=Percentage of patients who did not withdraw ARTs during the period +isanteplusreports.artdistribution.takingarv.message=Percentage of patients having withdrawn ARTs during the period +isanteplusreports.patient_confirm_covid19=List of patients confirm COVID-19 +isanteplusreports.patient_suspected_covid19=List of patients suspected for COVID-19 +isanteplusreports.hiv_patients_without_hiv_test=List of HIV patients without positive HIV test +isanteplusreports.patientImmunization=Immunization History +isanteplusreports.reportsapp.psychosocial=PsychoSocial +isanteplusreports.psychosocial.indicator.label=PsychoSocial indicators +isanteplusreports.psychosocial.indicator.activePatientwithAssPsycho.label=Percentage of active people on ARVs having a psychosocial assessment (complete or in progress) for the analysis period +isanteplusreports.psychosocial.indicator.result.label=PsychoSocial indicator report result +isanteplusreports.psychosocial.indicator.activePatientwithAssPsychoIncomplete.label=Percentage of people active in clinical care with an incomplete psychosocial assessment +isanteplusreports.psychosocial.indicator.activePatientwithAssPsychoDiagnosis.label=Percentage of active patients on ARVs diagnosed with psychological disorders +isanteplusreports.psychosocial.indicator.activePatientWithDiagnosisPsychoResolve.label=Percentage of active HIV-positive patients treated for a psychological disorder during the analysis period +isanteplusreports.psychosocial.indicator.activePatientWithPsychoFollowUp.label=Percentage of active patients with ongoing psychosocial follow-up during the analysis period (Initiation of psychological therapy, social support) +isanteplusreports.psychosocial.indicator.activePatientWithPsychoSocialNeeds.label=Percentage of active HIV-positive patients supported for specific social needs expressed (education, housing, sexuality, etc.) during the analysis period +isanteplusreports.psychosocial.indicator.activePatientWithPsychoAfterViralLoadSupMille.label=Percentage of active HIV-positive patients with a viral load> 1000 who received psychosocial support within 30 days of receiving a viral load result +isanteplusreports.psychosocial.indicator.activePatientWithViralLoadSupMilleWiththreePsychoAtTime.label=Percentage of patients with a viral load > 1000 who had 3 psychosocial support sessions on time +isanteplusreports.psychosocial.indicator.activePatientWithViralLoadSupMilleWithPsychoAtTime.label=Percentage of active HIV-positive patients with a control viral load> 1000 among those who received psychosocial support in time during the analysis period +isanteplusreports.psychosocial.indicator.newActivePatientWithPsychoEvaluation.label=Percentage of new HIV-positive patients who received a psychosocial assessment (child and adult) on ARV enrollment during the analysis period +isanteplusreports.reports.activePatientsWithViralLoadLastTwelveMonths=Active patients with viral load last twelve months +isanteplusreports.reports.activePatientsScreenedForTb=Patients HIV+ active on ART screened for TB +isanteplusreports.reports.patientWithIncompleteProphylaxisAgainstTb=Patients with incomplete prophylaxis against TB +isanteplusreports.reports.patientScreenedNegativeAgainstTbWithNoProphylaxis=Patients screened negative for TB who did not receive prophylaxis +isanteplusreports.psychoSocialSummary=PsychoSocial Summary +isanteplusreports.actionPlan=Action plan and Remarks +isanteplusreports.ddp=DDP +isanteplusreports.institution_communautaire=Institution / Community +isanteplusreports.report.ddp=DDP Report +isanteplusreports.report.patient_with_finger_print=List of patients with FingerPrint +isanteplusreports.fingerprint.indicator.activePatientWithFingerPrint=Active patient with finger print +isanteplusreports.fingerprint.indicator.activePatientWithoutFingerPrint=Active patient without finger print +isanteplusreports.fingerprint.indicator.label=FingerPrint indicators +isanteplusreports.report.transitionedPatient=Transitioned Patient from pediatric to adult +isanteplusreports.report.transitionedPatient.active=Active +isanteplusreports.report.transitionedPatient.inactive=Inactive +isanteplusreports.report.vitalStatistics=Vital statistics \ No newline at end of file diff --git a/api/src/main/resources/messages_fr.properties b/api/src/main/resources/messages_fr.properties index 2ea70f37..9b0b4e7b 100644 --- a/api/src/main/resources/messages_fr.properties +++ b/api/src/main/resources/messages_fr.properties @@ -92,23 +92,23 @@ isanteplusreports.healthqual.label=Rapport HealthQual isanteplusreports.healthqual.currentDate.label = Date actuelle isanteplusreports.healthqual.indicator.label=Indicateur isanteplusreports.healthqual.options.label=Options -isanteplusreports.healthqual.selection.label=Sélection -isanteplusreports.healthqual.option.label.periodMonths=Période [mois] -isanteplusreports.healthqual.option.label.ageDays=Âge [jours] +isanteplusreports.healthqual.selection.label=Sélection +isanteplusreports.healthqual.option.label.periodMonths=Période [mois] +isanteplusreports.healthqual.option.label.ageDays=Âge [jours] isanteplusreports.healthqual.indicator.adult.label=Indicateurs d'adultes -isanteplusreports.healthqual.indicator.pediatric.label=Indicateurs pédiatriques +isanteplusreports.healthqual.indicator.pediatric.label=Indicateurs pédiatriques -isanteplusreports.healthqual.result.label=Résultat du rapport HealthQual +isanteplusreports.healthqual.result.label=Résultat du rapport HealthQual isanteplusreports.healthqual.result.pdf.header.label=Rapport HealthQual -isanteplusreports.healthqual.result.pdf.creationDate.label=Créé: +isanteplusreports.healthqual.result.pdf.creationDate.label=Créé: isanteplusreports.healthqual.result.male.label=M isanteplusreports.healthqual.result.female.label=F isanteplusreports.healthqual.result.total.label=Tot. -isanteplusreports.healthqual.result.department.label=Département +isanteplusreports.healthqual.result.department.label=Département isanteplusreports.healthqual.result.clinic.label=Clinique isanteplusreports.healthqual.result.activePatients.label=Patients actifs -isanteplusreports.healthqual.result.numerator.label=Numérateur -isanteplusreports.healthqual.result.denominator.label=Dénominateur +isanteplusreports.healthqual.result.numerator.label=Numérateur +isanteplusreports.healthqual.result.denominator.label=Dénominateur isanteplusreports.healthqual.result.percentage.label=% isanteplusreports.numberOfActivePatientsBySex=Nombre de patients actifs par sexe @@ -141,6 +141,46 @@ isanteplusreports.pediatric10=Proportion d'enfants exposés ou infectés au VIH isanteplusreports.pediatric11=Proportion d'enfants exposés au VIH ayant bénéficié de la prophylaxie aux ARV au cours de la période d'analyse. isanteplusreports.pediatric12=Proportion d'enfants exposés au VIH âgés de 4 semaines à 12 mois ayant bénéficié d'un test PCR diagnostic au cours de la période d'analyse. isanteplusreports.pediatric13=Proportion d'enfants exposés au VIH ayant un test PCR négatif au cours de la période d'analyse. + +isanteplusreports.pediatric14=Le diagnostic précoce du VIH/SIDA pédiatrique. +isanteplusreports.death_on_art=Liste des patients décédés sous ARV +isanteplusreports.stopped_on_art=Liste des patients arrêtés sous ARV +isanteplusreports.transfered_on_art=Liste des patients Transférés sous ARV +isanteplusreports.death_on_pre_art=Liste des patients Décédés durant la période de transition +isanteplusreports.transferred_on_pre_art=Liste des patients Transférés durant la période de transition +isanteplusreports.regular_active_on_art=Liste des patients Réguliers (actifs sous ARV) +isanteplusreports.recent_on_pre_art=Liste des patients récents durant la période de transition +isanteplusreports.missing_appointment=Liste des patients Rendez-vous ratés +isanteplusreports.adult1=Rétention des patients en prise en charge ARV +isanteplusreports.adult2=CD4 à l'enrôlement (Proportion de patients VIH+ ayant bénéficié d'un compte CD4 à l'enrôlement.) +isanteplusreports.adult3=Enrôlement ARV (Proportion de patients VIH+ éligibles placées sous ARV durant la période d'analyse.) +isanteplusreports.adult4=Proportion de PVVIH adulte ayant reçu la prophylaxie au cotrimoxazole durant la période d'analyse +isanteplusreports.adult5=Proportion de patients VIH+ sous ARV ayant bénéficié d'une évaluation sur l'adhérence au cours des 6 derniers mois +isanteplusreports.adult6=Proportion de patients VIH + sous ARV considérés comme adhérents durant la période d'analyse +isanteplusreports.adult10=Proportion de patients VIH+ en malnutrition sévère durant la période d'analyse +isanteplusreports.adult7=Proportion de PVVIH dépistée pour la tuberculose à l'enrôlement durant la période d'analyse. +isanteplusreports.adult8=Proportion de PVVIH ayant reçu la chimio prophylaxie à l'INH durant la période d'analyse +isanteplusreports.adult9=Proportion de patients VIH+ ayant bénéficié d'une évaluation nutritionnelle durant la période d'analyse. +isanteplusreports.adult11=Proportion de femmes VIH+ utilisant une méthode PF durant la période d'analyse +isanteplusreports.adult12=Proportion de femmes enceintes infectées au VIH ayant reçu la Trithérapie aux ARV durant la période d'analyse +isanteplusreports.adult14=Proportion de patients VIH+ sous traitement ARV ayant bénéficié d'une évaluation de leur Charge virale à 6 mois apr le début de leur traitement +isanteplusreports.adult13=Proportion de femmes enceintes en prénatal et salle de travail ayant bénéficié d'un test VIH au cours de la période d'analyse +isanteplusreports.adult15=Proportion de patients VIH+ sous traitement ARV ayant bénéficié d'une évaluation de leur Charge virale. +isanteplusreports.adult16=Proportion de patients VIH+ sous traitement ARV depuis plus de 6 mois ayant une charge virale indétectable +isanteplusreports.pediatric1=Proportion d'enfants régulièrement suivis sous ARV +isanteplusreports.pediatric2=Proportion d'enfants testés VIH positifs placés sous ARV durant la période d'analyse. +isanteplusreports.pediatric3=Proportion d'enfants exposés et infectés au VIH ayant reçu la prophylaxie au cotrimoxazole durant la période d'analyse +isanteplusreports.pediatric4=Proportion d'enfants VIH sous ARV ayant bénéficié d'une évaluation sur l'adhérence au cours des 3 derniers mois. +isanteplusreports.pediatric5=Proportion d'enfants VIH+ sous ARV considérés comme adhérents +isanteplusreports.pediatric6=Proportion d'enfants VIH+ dépistés pour la tuberculose à l'enrôlement au cours de la période d'analyse +isanteplusreports.pediatric7=Pourcentage d'enfants VIH positifs Âgés de plus d'un an éligible ayant reçu la prophylaxie a l'INH durant la période d'analyse +isanteplusreports.pediatric8=Pourcentage d'enfants exposés ou infectés au VIH Âgés de moins d'un an ayant reçu la prophylaxie a l'INH durant la période d'analyse +isanteplusreports.pediatric9=Proportion d'enfants ayant bénéficié d'une évaluation nutritionnelle au cours de la période d'analyse +isanteplusreports.pediatric10=Proportion d'enfants exposés ou infectés au VIH ayant reçu les vaccins adéquats pour leur Âge selon le Programme élargi de Vaccination (PEV) et les normes pédiatriques du ministère +isanteplusreports.pediatric11=Proportion d'enfants exposés au VIH ayant bénéficié de la prophylaxie aux ARV au cours de la période d'analyse. +isanteplusreports.pediatric12=Proportion d'enfants exposés au VIH Âgés de 4 semaines à  12 mois ayant bénéficié d'un test PCR diagnostic au cours de la période d'analyse. +isanteplusreports.pediatric13=Proportion d'enfants exposés au VIH ayant un test PCR négatif au cours de la période d'analyse. + isanteplusreports.pediatric14=Le diagnostic précoce du VIH/SIDA pédiatrique. isanteplusreports.death_on_art=Liste des patients décédés sous ARV isanteplusreports.stopped_on_art=Liste des patients arrêtés sous ARV @@ -151,78 +191,102 @@ isanteplusreports.regular_active_on_art=Liste des patients Réguliers (actifs so isanteplusreports.recent_on_pre_art=Liste des patients récents durant la période de transition isanteplusreports.missing_appointment=Liste des patients Rendez-vous ratés isanteplusreports.list_patients_lost_to_follow_up_on_art=Liste des patients Perdus de vue sous ARV -isanteplusreports.list_patients_lost_to_follow_up_on_pre_art=Liste des patients Perdus de vue durant la période de transition -isanteplusreports.list_patients_active_on_pre_art=Liste des patients Actifs durant la période de transition -isanteplusreports.list_patients_receiving_arv_in_community=Liste des patients ayant reçu des ARVs en communauté -isanteplusreports.list_patients_receiving_arv_in_hospital=Liste des patients ayant reçu des ARVs en milieu hospitalier -isanteplusreports.list_patients_beneficie_pcr=Liste des patients ayant bénéficié d'un PCR -isanteplusreports.number_patients_beneficie_pcr=Nombre de patients ayant bénéficié d'un PCR -isanteplusreports.list_eligible_children_for_pcr=Liste des enfants éligibles pour un PCR -isanteplusreports.number_eligible_children_for_pcr=Nombre d'enfants éligibles pour un PCR -isanteplusreports.number_charge_virale_by_result_date=Charge virale en fonction du nombre de copies/ml (selon la date du résultat) -isanteplusreports.list_patients_charge_virale_moins_mille_by_result_date=Liste des patients avec charge virale < 1000 copies/ml (selon la date du résultat) -isanteplusreports.list_patients_charge_virale_plus_mille_by_result_date=Liste des patients avec charge virale >= 1000 copies/ml (selon la date du résultat) +isanteplusreports.list_patients_lost_to_follow_up_on_pre_art=Liste des patients Perdus de vue durant la période de transition +isanteplusreports.list_patients_active_on_pre_art=Liste des patients Actifs durant la période de transition +isanteplusreports.list_patients_receiving_arv_in_community=Liste des patients ayant reçu des ARVs en communauté +isanteplusreports.list_patients_receiving_arv_in_hospital=Liste des patients ayant reçu des ARVs en milieu hospitalier +isanteplusreports.list_patients_beneficie_pcr=Liste des patients ayant bénéficié d'un PCR +isanteplusreports.number_patients_beneficie_pcr=Nombre de patients ayant bénéficié d'un PCR +isanteplusreports.list_eligible_children_for_pcr=Liste des enfants éligibles pour un PCR +isanteplusreports.number_eligible_children_for_pcr=Nombre d'enfants éligibles pour un PCR +isanteplusreports.number_charge_virale_by_result_date=Charge virale en fonction du nombre de copies/ml (selon la date du résultat) +isanteplusreports.list_patients_charge_virale_moins_mille_by_result_date=Liste des patients avec charge virale < 1000 copies/ml (selon la date du résultat) +isanteplusreports.list_patients_charge_virale_plus_mille_by_result_date=Liste des patients avec charge virale >= 1000 copies/ml (selon la date du résultat) isanteplusreports.number_charge_virale_by_demand_date=Charge virale en fonction du nombre de copies/ml (selon la date de la demande) isanteplusreports.list_patients_charge_virale_moins_mille_by_demand_date=Liste des patients avec charge virale < 1000 copies/ml (selon la date de la demande) isanteplusreports.list_patients_charge_virale_plus_mille_by_demand_date=Liste des patients avec charge virale >= 1000 copies/ml (selon la date de la demande) isanteplusreports.list_of_lab_orders=Liste des commandes de laboratoire -isanteplusreports.list_patients_eligible_for_charge_virale=Liste des patients éligibles pour leur première charge virale -isanteplusreports.list_of_lab_orders_results=Liste des résultats des commandes de laboratoire -isanteplusreports.list_patients_eligible_for_charge_virale_controle=Liste des patients éligibles pour une charge virale de contrôle +isanteplusreports.list_patients_eligible_for_charge_virale=Liste des patients éligibles pour leur première charge virale +isanteplusreports.list_of_lab_orders_results=Liste des résultats des commandes de laboratoire +isanteplusreports.list_patients_eligible_for_charge_virale_controle=Liste des patients éligibles pour une charge virale de contrôle isanteplusreports.code_st=Code ST -isanteplusreports.age=Âge +isanteplusreports.age=Âge isanteplusreports.sex=Sexe isanteplusreports.address=Adresse -isanteplusreports.patientSummary=Résumé du patient -isanteplusreports.demographicsData=Informations démographiques +isanteplusreports.patientSummary=Résumé du patient +isanteplusreports.demographicsData=Informations démographiques isanteplusreports.back=Retour -isanteplusreports.lastSixForms=Visites/Fiches (dernier 6 mois et première visite) +isanteplusreports.lastSixForms=Visites/Fiches (dernier 6 mois et première visite) isanteplusreports.exportToPdf=Exporter en PDF isanteplusreports.lastVitals=Derniers signes vitaux isanteplusreports.visitDate=Date isanteplusreports.visitType=Type -isanteplusreports.summaryMedicalData=Résumé du Dossier Médical -isanteplusreports.labsResult=Résultats de laboratoire +isanteplusreports.summaryMedicalData=Résumé du Dossier Médical +isanteplusreports.labsResult=Résultats de laboratoire isanteplusreports.motifs=Motifs de consultation isanteplusreports.impressions=Impressions cliniques et diagnostiques -isanteplusreports.dispensingDrugs=Médicaments dispensés +isanteplusreports.dispensingDrugs=Médicaments dispensés isanteplusreports.clinicExams=Examens cliniques isanteplusreports.patientWithoutPCOrST=Patients sans PC, ST -isanteplusreports.possibleDuplicateRegistrations=Éventualité de duplication d'enregistrement de patients -isanteplusreports.patientsWithNoGender=Patients sans désignation de sexe -isanteplusreports.patientsWithMultipleARTRegimens=Les patients ayant de multiples régimes VIH prescrits / distribués le même jour -isanteplusreports.womenEnrolledBecamePregnant=Nombre de femmes VIH(+) enrôlées en soins devenues enceintes +isanteplusreports.possibleDuplicateRegistrations=Éventualité de duplication d'enregistrement de patients +isanteplusreports.patientsWithNoGender=Patients sans désignation de sexe +isanteplusreports.patientsWithMultipleARTRegimens=Les patients ayant de multiples régimes VIH prescrits / distribués le meme jour +isanteplusreports.womenEnrolledBecamePregnant=Nombre de femmes VIH(+) enrôlées en soins devenues enceintes isanteplusreports.number_hiv_patient=Nombre de patient VIH -isanteplusreports.list_of_exposed_infants=Liste des enfants exposés +isanteplusreports.list_of_exposed_infants=Liste des enfants exposés isanteplusreports.reportsapp.other=Autre -isanteplusreports.reportsapp.antenatal=Prénatal +isanteplusreports.reportsapp.antenatal=Prénatal isanteplusreports.reportsapp.patientsStatus=Statut des patients isanteplusreports.art_dispensation_follow_up=Suivi dispensation ARV isanteplusreports.reportsapp.ptme=PTME -isanteplusreports.parameters.hiv_status.death_on_art=Décédés sous ARV -isanteplusreports.parameters.hiv_status.regular_on_art=Réguliers sous ARV +isanteplusreports.parameters.hiv_status.death_on_art=Décédés sous ARV +isanteplusreports.parameters.hiv_status.regular_on_art=Réguliers sous ARV isanteplusreports.parameters.hiv_status.lost_of_follow_up_on_art=Perdus de vue sous ARV isanteplusreports.patients_active_inactive=Patients Actifs/Inactifs -isanteplusreports.parameters.hiv_status.missing_appointment=Rendez-vous ratés -isanteplusreports.parameters.hiv_status.stopped_on_art=Arrêtés sous ARV -isanteplusreports.parameters.hiv_status.transfered=Transférés sous ARV -isanteplusreports.parameters.hiv_status.transitionRecent=Récent durant la période de transition -isanteplusreports.parameters.hiv_status.transitionActive=Actif durant la période de transition -isanteplusreports.parameters.hiv_status.transitionLostFollowUp=Perdus de vue durant la période de transition -isanteplusreports.parameters.hiv_status.transitionDeath=Décédé durant la période de transition -isanteplusreports.parameters.hiv_status.transitionTranfered=Transféré durant la période de transition +isanteplusreports.parameters.hiv_status.missing_appointment=Rendez-vous ratés +isanteplusreports.parameters.hiv_status.stopped_on_art=Arrétés sous ARV +isanteplusreports.parameters.hiv_status.transfered=Transférés sous ARV +isanteplusreports.parameters.hiv_status.transitionRecent=Récent durant la période de transition +isanteplusreports.parameters.hiv_status.transitionActive=Actif durant la période de transition +isanteplusreports.parameters.hiv_status.transitionLostFollowUp=Perdus de vue durant la période de transition +isanteplusreports.parameters.hiv_status.transitionDeath=Décédé durant la période de transition +isanteplusreports.parameters.hiv_status.transitionTranfered=Transféré durant la période de transition isanteplusreports.code_national=Code National -isanteplusreports.last_date=Dernière date +isanteplusreports.last_date=Dernière date isanteplusreports.contact=Contact isanteplusreports.reason=Raison de discontinuation -isanteplusreports.next_visit_by_period=Liste des patients avec date de prochaine visite dans la période choisie +isanteplusreports.next_visit_by_period=Liste des patients avec date de prochaine visite dans la période choisie isanteplusreports.malaria_indicator_report=Rapport de surveillance du paludisme +isanteplusreports.percentage_of_all_patients_with_a_fever_of_less_than_2_weeks=Pourcentage de patients ayant eu la fi�vre au cours des 2 derni�res semaines (OMS) +isanteplusreports.percentage_of_patients_with_fever_suspected_case_receiving_an_antimalarial_drug_who=Pourcentage de patients avec fi�vre (cas suspect) ayant re�u un antipaludique (OMS) +isanteplusreports.percentage_of_patients_with_confirmed_malaria_who_have_been_treated_according_to_the_national_standards_of_the_mspp_who=Pourcentage de patients avec malaria confirm�e ayant re�u un traitement conforme aux normes nationales du MSPP (OMS) +isanteplusreports.percentage_of_patients_with_fever_who_have_been_tested_for_malaria_who=Pourcentage de patients avec fi�vre ayant �t� test�s pour la malaria (OMS) +isanteplusreports.number_of_cases_of_confirmed_malaria=Nombre de cas de la malaria confirm�e +isanteplusreports.number_of_patients_undergoing_microscopic_malaria_test=Nombre de patients ayant bénéficié d\u2019un test microscopique pour la malaria +isanteplusreports.number_of_patients_with_a_positive_microscopic_test_for_malaria=Nombre de patients ayant un test microscopique positif pour la malaria +isanteplusreports.number_of_patients_with_a_positive_microscopy_test_with_plasmodium_falciparum=Nombre de patients ayant un test microscopique positif � Plasmodium falciparum +isanteplusreports.number_of_patients_with_mixed_positive_plasmodium_microscopy_test_who=Nombre de patients ayant un test microscopique positif mixte � Plasmodium (OMS) +isanteplusreports.number_of_plasmodium_positive_microscopic_test_patients_other_than_falciparum=Nombre de patients ayant un test microscopique positif � Plasmodium autres que falciparum +isanteplusreports.number_of_patients_who_have_had_a_rdt_for_malaria=Nombre de patients ayant bénéficié d\u2019un TDR pour la malaria +isanteplusreports.number_of_patients_with_positive_rdt_for_malaria=Nombre de patients ayant un TDR positif pour la malaria +isanteplusreports.number_of_suspected_cases_of_malaria_tested=Nombre de cas suspects de la malaria dépisté +isanteplusreports.number_of_suspected_cases_of_confirmed_malaria=Nombre de cas suspects de la malaria confirm�e +isanteplusreports.number_of_confirmed_cases_for_severe_malaria_and_put_on_treatment_according_to_the_national_standards_of_the_mspp=Nombre de cas confirm�s pour la malaria sévere et mis sous traitement selon les normes nationales du MSPP +isanteplusreports.number_of_patients_with_malaria_hospitalized=Nombre de patients avec Malaria hospitalisés +isanteplusreports.number_of_cases_of_confirmed_malaria_for_pregnant_women=Nombre de cas de la malaria confirmé pour les femmes enceintes +isanteplusreports.activity_after_discontinuation_by_period=Patients (VIH) avec activité après discontinuation au cours du mois +isanteplusreports.percentage_of_all_patients_with_a_fever_of_less_than_2_weeks=Pourcentage de patients ayant eu la fièvre au cours des 2 dernières semaines (OMS) +isanteplusreports.percentage_of_patients_with_fever_suspected_case_receiving_an_antimalarial_drug_who=Pourcentage de patients avec fièvre (cas suspect) ayant reçu un antipaludique (OMS) +isanteplusreports.percentage_of_patients_with_confirmed_malaria_who_have_been_treated_according_to_the_national_standards_of_the_mspp_who=Pourcentage de patients avec malaria confirmée ayant reçu un traitement conforme aux normes nationales du MSPP (OMS) +isanteplusreports.percentage_of_patients_with_fever_who_have_been_tested_for_malaria_who=Pourcentage de patients avec fièvre ayant été testés pour la malaria (OMS) + isanteplusreports.percentage_of_all_patients_with_a_fever_of_less_than_2_weeks=Pourcentage de patients ayant eu la fiévre au cours des 2 derniéres semaines (OMS) isanteplusreports.percentage_of_patients_with_fever_suspected_case_receiving_an_antimalarial_drug_who=Pourcentage de patients avec fiévre (cas suspect) ayant reéu un antipaludique (OMS) isanteplusreports.percentage_of_patients_with_confirmed_malaria_who_have_been_treated_according_to_the_national_standards_of_the_mspp_who=Pourcentage de patients avec malaria confirmée ayant reéu un traitement conforme aux normes nationales du MSPP (OMS) isanteplusreports.percentage_of_patients_with_fever_who_have_been_tested_for_malaria_who=Pourcentage de patients avec fiévre ayant été testés pour la malaria (OMS) + isanteplusreports.number_of_cases_of_confirmed_malaria=Nombre de cas de la malaria confirmée isanteplusreports.number_of_patients_undergoing_microscopic_malaria_test=Nombre de patients ayant bénéficié d\u2019un test microscopique pour la malaria isanteplusreports.number_of_patients_with_a_positive_microscopic_test_for_malaria=Nombre de patients ayant un test microscopique positif pour la malaria @@ -240,7 +304,7 @@ isanteplusreports.number_of_cases_of_confirmed_malaria_for_pregnant_women=Nombre isanteplusreports.art_enrollments_among_medically_eligible=Enrôlement aux ARV parmi les patients médicalement éligibles isanteplusreports.discontinued_drugs=Discontinuation de médicaments isanteplusreports.discontinued_cotrimoxazole=Cotrimoxazole démarrée, puis discontinuée -isanteplusreports.pnls.label=Rapport mensuel ART +isanteplusreports.pnls.label=Rapport mensuel ARV isanteplusreports.pnls.select.all=Sélectionnez tous les indicateurs isanteplusreports.pnls.result.department.label=Département isanteplusreports.pnls.result.clinic.label=Clinique @@ -248,23 +312,23 @@ isanteplusreports.pnls.result.Males.label=M isanteplusreports.pnls.result.FeMales.label=F isanteplusreports.pnls.result.Subtotal.label=Total isanteplusreports.pnls.result.BreastFeeding.label=Allaitement maternel -isanteplusreports.pnls.result.NewPatients.label=Récemment enrélé -isanteplusreports.pnls.result.Referenced.label=previously enrolled and referees +isanteplusreports.pnls.result.NewPatients.label=Récemment enrôlé +isanteplusreports.pnls.result.Referenced.label=Préalablement enrôlées et référées isanteplusreports.pnls.result.died.label=Décédés -isanteplusreports.pnls.result.voluntary.label=Voluntary +isanteplusreports.pnls.result.voluntary.label=Volontaire isanteplusreports.pnls.result.denial.label=Le déni isanteplusreports.pnls.result.medical.label=Médicale isanteplusreports.pnls.result.refered.label=Référé isanteplusreports.pnls.result.other.label=Autre isanteplusreports.pnls.result.msm.label=MSM isanteplusreports.pnls.result.sexP.label=Professionnels du sexe -isanteplusreports.pnls.result.trans.label=transgenres -isanteplusreports.pnls.result.captv.label=prisonniéres +isanteplusreports.pnls.result.trans.label=Transgenres +isanteplusreports.pnls.result.captv.label=Prisonniers isanteplusreports.pnls.result.drug.label=Utilisateurs de drogues isanteplusreports.pnls.result.newCtx.label=Patients VIH+ sous ARV nouvellement mis sous CTX isanteplusreports.pnls.result.activeCtx.label=Patients actifs sous ARV sous CTX isanteplusreports.pnls.result.newTb.label=Nouveaux enrolés sous ARV -isanteplusreports.pnls.result.alreadyTb.label=Patients déjé sous ARV +isanteplusreports.pnls.result.alreadyTb.label=Patients déjà sous ARV isanteplusreports.pnls.result.1-0.label=0-1 ans isanteplusreports.pnls.result.1-4.label=1-4 ans isanteplusreports.pnls.result.5-9.label=5-9 ans @@ -276,7 +340,7 @@ isanteplusreports.pnls.result.30-34.label=30-34 ans isanteplusreports.pnls.result.35-39.label=35-39 ans isanteplusreports.pnls.result.40-44.label=40-44 ans isanteplusreports.pnls.result.45-49.label=45-49 ans -isanteplusreports.pnls.result.50.label=50+ anss +isanteplusreports.pnls.result.50.label=50+ ans isanteplusreports.pnls.result.UnKnown.label=Inconnue ans isanteplusreports.pnls.result.Total.label=Total isanteplusreports.pnls.result.<15.label=<15 ans @@ -296,8 +360,8 @@ isanteplusreports.pnls.result.leep.label=LEEP isanteplusreports.pnls.result.CrachatTest.label=Crachat seulement isanteplusreports.pnls.result.geneExpertTest.label=GeneXpert MTB/RIF (avec ou sans autre test) isanteplusreports.pnls.result.OtherTest.label=Autres tests -isanteplusreports.pnls.indicator.adult.label=Indicateurs du rapport mensuel ART -isanteplusreports.pnls.result.pdf.header.label=Rapport mensuel ART +isanteplusreports.pnls.indicator.adult.label=Indicateurs du rapport mensuel ARV +isanteplusreports.pnls.result.pdf.header.label=Rapport mensuel ARV isanteplusreports.pnls.result.pills.label=Pilules isanteplusreports.pnls.result.inject.label=Injectables isanteplusreports.pnls.result.impl.label=Implants @@ -310,26 +374,30 @@ isanteplusreports.pnls.result.quaterly.label=trimestriellement isanteplusreports.pnls.result.semiAnualy.label=semestriellement isanteplusreports.pnls.result.annualy.label= annuellement isanteplusreports.pnls.result.pdf.creationDate.label=date créée -isanteplusreports.newlyEnrolledPatientsOnArt= 1.1: NOUVEAU: Nombre de personnes VIH+ nouvellement enrolées sous ARV au cours du mois : (TX_NEW) -isanteplusreports.newlyEnrolledBreastFeedingWomenOnArt=1.1.1: Nouvelles Femmes allaitantes enrolees sous ARV -isanteplusreports.referredInPatientsAnArt=1.2 : REFERENCE : Nombre de personnes VIH+ préalablement enrolées sous ARV dans un autre site et référées au cours du mois + +isanteplusreports.newlyEnrolledPatientsOnArt=1.1 :NOUVEAUX : Nombre de personnes VIH+ nouvellement enrôlées sous ARV au cours du mois (TX_NEW) +isanteplusreports.referredInPatientsAnArt=1.2 :Personnes préalablement enrôlées sous ARV et RÉFÉRÉES au cours du mois + +isanteplusreports.newlyEnrolledPatientsOnArt= 1.1: NOUVEAU: Nombre de personnes VIH+ nouvellement enrôlées sous ARV au cours du mois : (TX_NEW) +isanteplusreports.newlyEnrolledBreastFeedingWomenOnArt=1.1.1: Nouvelles Femmes allaitantes enrôlées sous ARV +isanteplusreports.referredInPatientsAnArt=1.2 : REFERENCE : Nombre de personnes VIH+ préalablement enrôlées sous ARV dans un autre site et référées au cours du mois isanteplusreports.disintergrationByKeyPopulations=2: Enrolement et référence des personnes des populations clés -isanteplusreports.notYetEnrolledOnArtByReason=3:Patients VIH+ non encore enroles sous ARV +isanteplusreports.notYetEnrolledOnArtByReason=3:Patients VIH+ non encore enrôlés sous ARV isanteplusreports.patientsUnderPreventionCtx=4: Nombre de patients VIH(+) sous ARV placées sous PROPHYLAXIE CTX au cours du mois -isanteplusreports.patientsUnderTBPreventionTreatment=5: Nombre de patients sous ARV ayant initie un traitement préventif de la TB au cours du +isanteplusreports.patientsUnderTBPreventionTreatment=5: Nombre de patients sous ARV ayant initié un traitement préventif de la TB au cours du isanteplusreports.patientsUnderTBPreventionTreatment.6months=6:Nombre de patients sous ARV ayant initié un traitement préventif de la TB il y a 6 mois: (TB_PREV D) -isanteplusreports.newlyReferredInEnrolledBreastFeedingWomenOnArt:1.2.1 :Nouvelles Femmes allaitantes prealablement enrolees sous ARV et referees au cours du mois +isanteplusreports.newlyReferredInEnrolledBreastFeedingWomenOnArt:1.2.1 :Nouvelles Femmes allaitantes prealablement enrôlées sous ARV et referees au cours du mois isanteplusreports.patientsCompletedTBTreatment=7: Nombre de patients sous ARV ayant complété un traitement préventif de la TB au cours du mois: (TB_PREV N) -isanteplusreports.inh.6months=8. Nombre de patients actifs sous ARV ayant déjé complété 6 mois de prophylaxie a l'INH +isanteplusreports.inh.6months=8. Nombre de patients actifs sous ARV ayant déjà complété 6 mois de prophylaxie a l'INH isanteplusreports.tbPatientsScreneesPostive=9.1 : Screenés positifs isanteplusreports.tbPatientsScreneesNegative=9.2 :Screenés négatifs isanteplusreports.patientsUnderPreventionCtx.total=4: Nombre de patients VIH(+) sous ARV placées sous PROPHYLAXIE CTX au cours du mois -isanteplusreports.patientsUnderTBPreventionTreatment.total=5:Nombre de patients sous ARV ayant initie un traitement préventif de la TB au cours du +isanteplusreports.patientsUnderTBPreventionTreatment.total=5:Nombre de patients sous ARV ayant initié un traitement préventif de la TB au cours du isanteplusreports.patientsUnderTBPreventionTreatment.6months.total=6:Nombre de patients sous ARV ayant initié un traitement préventif de la TB il y a 6 mois: (TB_PREV D) isanteplusreports.patientsCompletedTBTreatment.total=7:Nombre de patients sous ARV ayant complété un traitement préventif de la TB au cours du mois: (TB_PREV N) isanteplusreports.tbPatientsScrenees.total=9:Nombre de patients actifs sous ARV ayant été screenées au moins une fois pour la Tuberculose au cours des 6 derniers mois: (TX_TB D) isanteplusreports.bacteriologySpecimenCollectioan.total=9.1.1 :Nombre de patients actifs sous ARV qui ont eu le prélévement d'un échantillon envoyé pour un diagnostic bactériologique de la tuberculose active -isanteplusreports.breastFeedingWomenNotYetEnrolled=3.1 :Femmes allaitantes VIH+ non encore enrolees sous ARV +isanteplusreports.breastFeedingWomenNotYetEnrolled=3.1 :Femmes allaitantes VIH+ non encore enrôlées sous ARV isanteplusreports.dignosticTests=9.1.1.1 :Nombre de patients actifs dont les échantillons ont été envoyés pour les tests de diagnostic suivants isanteplusreports.postiveResultFomTbDiagnosis=9.1.1.1.1: Nombre de patients actifs sous ARV pour lesquels un résultat positif est retourné pour un diagnostic bactériologique de la tuberculose active isanteplusreports.arvPatientsNewlyPacedOnTbTreatmet.total=10:Patients sous ARV nouvellement placés sous traitement anti-TB: (TX_TB N) @@ -340,10 +408,10 @@ isanteplusreports.activeHivPatients=13 : Patients VIH(+) ACTIFS sous ARV: (TX_CU isanteplusreports.activeHivPatientsByKeyPopn=13.1: Personnes des populations clés ACTIVES sous ARV isanteplusreports.activeHivPatients.overMonths=14: Nombre de patients recevant des médicaments ARV sur plusieurs mois. isanteplusreports.followUp=15- Nombre de patients actifs ayant bénéficié au moins d'une visite de suivi clinique -isanteplusreports.activeHivPatients.regimeLines=16:éRéGIME de TRAITEMENT ARV +isanteplusreports.activeHivPatients.regimeLines=16:Régime de TRAITEMENT ARV isanteplusreports.arvPatientsInactiveAtTheEnd.total=17: Patients sous ARV INACTIFS à la fin du mois isanteplusreports.inactive.dead=17.1 : Patients sous ARV INACTIFS à la fin du mois - Décédés -isanteplusreports.inactive.medicalAndvoluntary=17.2 : Patients sous ARV INACTIFS à la fin du mois - Arrét des ARV (volontaire/médicale) +isanteplusreports.inactive.medicalAndvoluntary=17.2 : Patients sous ARV INACTIFS à la fin du mois - Arrêt des ARV (volontaire/médicale) isanteplusreports.inactive.lostTo.month=17.3 :Patients sous ARV INACTIFS à la fin du mois - Perdus de vue (n'ont pas été approvisionnés en ARV depuis 1 mois ou plus) isanteplusreports.inactive.lostTo.migrated=17.3.1 : Patients sous ARV INACTIFS a la fin du mois - Perdus de vue qui ont été émigré isanteplusreports.inactive.transferred=17.4 :Patients sous ARV INACTIFS à la fin du mois - Transférés vers un autre site @@ -351,13 +419,13 @@ isanteplusreports.lostToFollow=18 : Nombre de patients sous ARV perdus de vue au isanteplusreports.lostToFolow.died=18.1 : Nombre de patients décédés parmi les perdus de vue au cours de la période. isanteplusreports.lostToFolow.lessThan3monthsTreatment=18.2 :Nombre de patients perdus de vue au cours de la période aprés un traitement de moins de 3 mois sous ARV isanteplusreports.lostToFolow.moreThan3monthsTreatment=18.3 :Nombre de patients perdus de vue au cours de la période aprés un traitement de plus de 3 mois sous ARV -isanteplusreports.lostToFolow.transferred=18.4 Nombre de patients perdus de vue transférés CONFIRMéS +isanteplusreports.lostToFolow.transferred=18.4 Nombre de patients perdus de vue transférés CONFIRMÉS isanteplusreports.lostToFolow.stopped=18.5 Nombre de patients perdus de vue contactés et confirmés avoir arreté le traitement ARV isanteplusreports.dead.tuberclosis=18.1.1 Nombre de décés CONFIRMES liés a la Tuberculose parmi les perdus de vue recherches au cours du mois du rapport isanteplusreports.dead.otherInfectiousDiseases=18.1.2 Nombre de décés CONFIRMéS lies a d'autres maladies infectieuses et parasitaires parmi les perdus de vue recherches au cours du mois du rapport isanteplusreports.dead.cancer=18.1.3 Nombre de décés CONFIRMéS dus a des causes de cancer connu ou présumé parmi les perdus de vue recherches au cours du mois isanteplusreports.dead.hivIllnesses=18.1.4 Nombre de décés CONFIRMéS dus a d'autres maladies liées au VIH parmi les perdus de vue recherches -isanteplusreports.dead.naturalCauses=18.1.5 Nombre de décés parmi les perdus de vue liés a des causes naturelles ( cancers et infections, qui n'étaient pas directement liées é l'infection é VIH). +isanteplusreports.dead.naturalCauses=18.1.5 Nombre de décés parmi les perdus de vue liés a des causes naturelles ( cancers et infections, qui n'étaient pas directement liées à l'infection du VIH). isanteplusreports.dead.unNaturalCauses=18.1.6 Nombre de décés parmi les perdus de vue liés a des causes non naturelles ( traumatisme, accident, suicide, guerre, etc.) isanteplusreports.dead.unKnownCauses=18.1.7 Nombre de décés parmi les perdus de vue liés a des causes inconnues isanteplusreports.lost.resumedTreatment=19 Nombre de Patients perdus de vue ayant repris le traitement ARV au cours du mois @@ -366,18 +434,18 @@ isanteplusreports.activePatients.viralLoadResult=20.1 Nombre cumulé de patients isanteplusreports.activePatients.viralLoadResult.pregnant=20.1.1 Nombre de femmes enceintes actives sous ARV ayant au moins un résultat de charge virale au cours des 12 derniers mois isanteplusreports.activePatients.viralLoadResult.breastFeeding=20.1.2 Nombre de femmes allaitantes actives sous ARV ayant au moins un resultat de charge virale au cours des 12 derniers mois isanteplusreports.activePatients.viralLoadResult.keyPopn=20.1.3 Nombre de populations clés actives sous ARV ayant au moins un resultat de charge virale au cours des 12 derniers mois -isanteplusreports.activePatients.viralLoadResultLessThan1000=20.2 Nombre cumule de patients sous ARV dont le dernier résultat de Charge virale de routine au cours des 12 derniers mois est inférieur é 1000 copies/ml (TX-PVLS.N) -isanteplusreports.activePatients.viralLoadResultLessThan1000.pregnantWomen=20.2.1 Nombre de femmes enceintes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur é 1000 copies/ml -isanteplusreports.activePatients.viralLoadResultLessThan1000.breatFeedingWomen=20.2.2 Nombre de femmes allaitantes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur é 1000 copies/ml -isanteplusreports.activePatients.viralLoadResultLessThan1000.keyPopulation=20.2.3 Nombre de populations clés actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur é 1000 copies/ml +isanteplusreports.activePatients.viralLoadResultLessThan1000=20.2 Nombre cumule de patients sous ARV dont le dernier résultat de Charge virale de routine au cours des 12 derniers mois est inférieur à 1000 copies/ml (TX-PVLS.N) +isanteplusreports.activePatients.viralLoadResultLessThan1000.pregnantWomen=20.2.1 Nombre de femmes enceintes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur à 1000 copies/ml +isanteplusreports.activePatients.viralLoadResultLessThan1000.breatFeedingWomen=20.2.2 Nombre de femmes allaitantes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur à 1000 copies/ml +isanteplusreports.activePatients.viralLoadResultLessThan1000.keyPopulation=20.2.3 Nombre de populations clés actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur à 1000 copies/ml isanteplusreports.activePatients.viralLoadResult.targeted=21.1 Nombre cumulé de patients sous ARV ayant au moins un résultat de charge virale ciblée au cours des 12 derniers mois (TX_PVLS. D) -isanteplusreports.activePatients.viralLoadResult.pregnant.targerted=21.1.1 Nombre de femmes enceintes actives sous ARV ayant au moins un resultat de charge virale au cours des 12 derniers moi. +isanteplusreports.activePatients.viralLoadResult.pregnant.targerted=21.1.1 Nombre de femmes enceintes actives sous ARV ayant au moins un resultat de charge virale au cours des 12 derniers mois. isanteplusreports.activePatients.viralLoadResult.breastFeeding.targerted=21.1.2 Nombre de femmes allaitantes actives sous ARV ayant au moins un resultat de charge virale au cours des 12 derniers mois isanteplusreports.activePatients.viralLoadResult.keyPopn.targerted=21.1.3Nombre de populations clés actives sous ARV ayant au moins un resultat de charge virale au cours des 12 derniers mois -isanteplusreports.activePatients.viralLoadResult.targeted.lessThan1000Copies=21.2 Nombre cumulé de patients sous ARV dont le dernier résultat de Charge virale ciblée au cours des 12 derniers mois est inférieur é 1000 copies/ml (TX_PVLS. N) -isanteplusreports.activePatients.viralLoadResult.pregnant.targerted.lessThan100Copies=21.2.1 Nombre de femmes enceintes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur é 1000 copies/ml -isanteplusreports.activePatients.viralLoadResult.breastFeeding.targerted.lessThan100Copies=21.2.2 Nombre de femmes allaitantes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur é 1000 copies/ml -isanteplusreports.activePatients.viralLoadResult.keyPopn.targerted.lessThan1000Copies=21.2.3 Nombre de populations clés actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur é 1000 copies/ml +isanteplusreports.activePatients.viralLoadResult.targeted.lessThan1000Copies=21.2 Nombre cumulé de patients sous ARV dont le dernier résultat de Charge virale ciblée au cours des 12 derniers mois est inférieur à 1000 copies/ml (TX_PVLS. N) +isanteplusreports.activePatients.viralLoadResult.pregnant.targerted.lessThan100Copies=21.2.1 Nombre de femmes enceintes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur à 1000 copies/ml +isanteplusreports.activePatients.viralLoadResult.breastFeeding.targerted.lessThan100Copies=21.2.2 Nombre de femmes allaitantes actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur à 1000 copies/ml +isanteplusreports.activePatients.viralLoadResult.keyPopn.targerted.lessThan1000Copies=21.2.3 Nombre de populations clés actives sous ARV dont le dernier résultat de Charge virale au cours des 12 derniers mois est inférieur à 1000 copies/ml isanteplusreports.activePatientsFor12Months=22.1 Total de Patients ayant démarré le traitement ARV il y a 12 mois (TX_RET. D) isanteplusreports.activePatientsInsight=22.1.1 Total de Patients ayant démarré le traitement ARV dans le site il y a 12 mois isanteplusreports.activePatientsTransferred=22.1.2 Total de Patients ayant démarré le traitement ARV dans un autre site il y a 12 mois et référé pour prise en charge @@ -386,8 +454,64 @@ isanteplusreports.womenOnArvScreenedCervicalCancer=23 Nombre de femmes VIH+sous isanteplusreports.womenOnArvScreenedCervicalCancer.firstTime=23.1 Nombre de femmes sous ARV ayant bénéficié d'un dépistage du cancer du col de l'utérus (CXCA_SCRN) pour la 1ére fois isanteplusreports.womenOnArvScreenedCervicalCancer.afterNegative=23.2 Nombre de femmes sous ARV ayant bénéficié d'un dépistage du cancer du col de l'utérus (CXCA_SCRN) aprés un test negatif isanteplusreports.womenOnArvScreenedCervicalCancer.AfterTreament=23.3 Nombre de femmes sous ARV ayant bénéficié d'un dépistage du cancer du col de l'utérus (CXCA_SCRN) aprés traitement -isanteplusreports.womenOnArvScreenedCervicalCancer.testedPostive=24 Nombre de femmes sous ARV dépistées positives pour le cancer du col de l'utérus et qui ont reéu reéu une cryothérapie,une thermocoagulation ou une LEEP (CXCA_TX) +isanteplusreports.womenOnArvScreenedCervicalCancer.testedPostive=24 Nombre de femmes sous ARV dépistées positives pour le cancer du col de l'utérus et qui ont reçu une cryothérapie,une thermocoagulation ou une LEEP (CXCA_TX) isanteplusreports.recomendedPf=25 Nombre de patients ARV conseillés en PF isanteplusreports.recomendedPf.accepting=25.1 : Patients acceptant pour le mois d'une méthode de PF isanteplusreports.recomendedPf.using=25.2 Patients utilisateurs d'une méthode de PF - +isanteplusreports.patient_vaccinated_covid19=Liste des patients vaccinés pour le COVID-19 +isanteplusreports.patient_diagnose_for_covid19=Liste des patients diagnostiqués pour le COVID-19 + +isanteplusreports.alertprecoce.retrait_a_temps_arv.label=Retrait à temps des ARV +isanteplusreports.alertprecoce.retention_tar.label=Rétention sous TAR +isanteplusreports.alertprecoce.rupture_stock.label=Rupture de stock +isanteplusreports.alertprecoce.viral_load_suppression.label=Suppression de la charge virale (VLS.1) +isanteplusreports.alertprecoce.viral_load_process_completion.label=Achèvement du processus d'analyse de la charge virale (VLS.2) +isanteplusreports.alertprecoce.appropriate_change.label=Changement approprié +isanteplusreports.alertprecoce.treatment_interruption.label=Interruption de traitement (IIT) +isanteplusreports.alertprecoce.report.label=Rapport indicateur d'alerte précoce +isanteplusreports.alertprecoce.result.label=Résultat du Rapport d'alerte précoce +isanteplusreports.reportsapp.alertprecoce=Indicateurs d'alerte précoce +isanteplusreports.weeklymonitoringreport.indicator.label=Rapport de surveillance hebdomadaire +isanteplusreports.reportsapp.dashboard=Tableau de bord +isanteplusreports.artdistribution.report.label=Distribution de médicaments ARV +isanteplusreports.artdistribution.result.label=Résultat du rapport de Distribution ARV +isanteplusreports.artdistribution.appointmentperiod.message=Rendez-vous pour la période +isanteplusreports.artdistribution.arvdispense.message=ARV dispensé pour la période +isanteplusreports.artdistribution.nontakingarv.message=Pourcentage de patient n'ayant pas retiré des arvs pendant la période +isanteplusreports.artdistribution.takingarv.message=Pourcentage de patient ayant retiré des arvs pendant la période +isanteplusreports.patient_confirm_covid19=Liste des patients confirmés COVID-19 +isanteplusreports.patient_suspected_covid19=Liste des patients suspectés pour le COVID-19 +isanteplusreports.hiv_patients_without_hiv_test=Liste des patients VIH sans test VIH positif +isanteplusreports.patientImmunization=Vaccination +isanteplusreports.reportsapp.psychosocial=PsychoSocial +isanteplusreports.psychosocial.indicator.label=Indicateurs PsychoSociaux +isanteplusreports.psychosocial.indicator.activePatientwithAssPsycho.label=Pourcentage de personnes actives sous ARV ayant une évaluation psychosociale (complète ou en cours) pour la période d’analyse +isanteplusreports.psychosocial.indicator.result.label=Résultat du rapport d'indicateurs PsychoSociaux +isanteplusreports.psychosocial.indicator.activePatientwithAssPsychoIncomplete.label=Pourcentage de personnes actives en soins cliniques avec une évaluation psychosociale incomplète +isanteplusreports.psychosocial.indicator.activePatientwithAssPsychoDiagnosis.label=Pourcentage de patients séropositifs actifs sous ARV diagnostiqués avec troubles psychologiques +isanteplusreports.psychosocial.indicator.activePatientWithDiagnosisPsychoResolve.label=Pourcentage de patients séropositifs actifs traités pour un trouble psychologique durant la période d’analyse +isanteplusreports.psychosocial.indicator.activePatientWithPsychoFollowUp.label=Pourcentage de patients séropositifs actifs ayant un suivi psychosocial en cours durant la période d'analyse (Initiation de la thérapie psychologique, accompagnement social) +isanteplusreports.psychosocial.indicator.activePatientWithPsychoSocialNeeds.label=Pourcentage de patients séropositifs actifs accompagnés pour des besoins sociaux spécifiques exprimés (éducation, logement, sexualité etc.) durant la période d’analyse +isanteplusreports.psychosocial.indicator.activePatientWithPsychoAfterViralLoadSupMille.label=Pourcentage de patients actifs séropositifs avec une charge virale > 1000 ayant bénéficié d’un appui psychosocial dans les 30 jours suivant la réception de résultat de charge virale +isanteplusreports.psychosocial.indicator.activePatientWithViralLoadSupMilleWiththreePsychoAtTime.label=Pourcentage de patients avec charge virale > 1000 ayant eu 3 séances d’accompagnement psychosocial à temps +isanteplusreports.psychosocial.indicator.activePatientWithViralLoadSupMilleWithPsychoAtTime.label=Pourcentage de patients séropositifs actifs avec une charge virale de contrôle > 1000 parmi ceux qui ont bénéficié d’un accompagnement psychosocial à temps durant la période d’analyse +isanteplusreports.psychosocial.indicator.newActivePatientWithPsychoEvaluation.label=Pourcentage de nouveaux patients séropositifs ayant reçu une évaluation psychosociale (enfant et adulte) à l’enrôlement aux ARV durant la période d’analyse +isanteplusreports.reports.activePatientsWithViralLoadLastTwelveMonths=Patient Actif avec une charge virale pendant les 12 derniers mois +isanteplusreports.reports.activePatientsScreenedForTb=Patients VIH+ actifs sous ARV dépistés pour la TB +isanteplusreports.reports.patientWithIncompleteProphylaxisAgainstTb=Patients avec Prophylaxie incomplète contre la TB +isanteplusreports.reports.patientScreenedNegativeAgainstTbWithNoProphylaxis=Patients dépistés négatifs pour la TB n’ayant pas reçu de prophylaxie +isanteplusreports.psychoSocialSummary=Résumé PsychoSocial +isanteplusreports.actionPlan=Remarques et Plan d'action +isanteplusreports.ddp=DDP +isanteplusreports.institution_communautaire=Institution / Communautaire +isanteplusreports.report.ddp=Rapport DDP +isanteplusreports.report.patient_with_finger_print=Liste des patients avec empreinte +isanteplusreports.fingerprint.indicator.activePatientWithFingerPrint=Patient actif avec empreinte +isanteplusreports.fingerprint.indicator.activePatientWithoutFingerPrint=Patient actif sans empreinte +isanteplusreports.fingerprint.indicator.label=Indicateurs d'empreinte digital +isanteplusreports.report.transitionedPatient=Patient transitionné de pédiatrique à adulte +isanteplusreports.report.transitionedPatient.active=Actif +isanteplusreports.report.transitionedPatient.inactive=Inactif +isanteplusreports.report.vitalStatistics=Statistiques de l'état civil +isanteplusreports.report.vitalStatistics.birthdate=Naissance +isanteplusreports.report.vitalStatistics.death=Décès \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientOnArvHavingPsychosocialAssessment_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientOnArvHavingPsychosocialAssessment_den.sql new file mode 100644 index 00000000..1a6987c8 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientOnArvHavingPsychosocialAssessment_den.sql @@ -0,0 +1,10 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientOnArvHavingPsychosocialAssessment_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientOnArvHavingPsychosocialAssessment_num.sql new file mode 100644 index 00000000..3ab58d87 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientOnArvHavingPsychosocialAssessment_num.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 163340 + AND TIMESTAMPDIFF(MONTH, DATE(e.encounter_datetime),:endDate) BETWEEN 0 AND 12 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientPsychoAfterViralLoadSupMille_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientPsychoAfterViralLoadSupMille_den.sql new file mode 100644 index 00000000..38cdcf36 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientPsychoAfterViralLoadSupMille_den.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, isanteplus.patient_laboratory pl, + (SELECT pla.patient_id, MAX(DATE(pla.visit_date)) as visit_date + FROM isanteplus.patient_laboratory pla + WHERE DATE(pla.visit_date) between :startDate AND :endDate + AND pla.test_id IN (856,1305) GROUP BY 1) C + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND pl.patient_id = C.patient_id + AND DATE(pl.visit_date) = DATE(C.visit_date) + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND (pl.test_id = 856 AND pl.test_result > 1000) + AND DATE(psa.date_started_status) between :startDate AND :endDate + AND DATE(pl.visit_date) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientPsychoAfterViralLoadSupMille_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientPsychoAfterViralLoadSupMille_num.sql new file mode 100644 index 00000000..ba0789bf --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientPsychoAfterViralLoadSupMille_num.sql @@ -0,0 +1,24 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.encounter e, + openmrs.encounter_type et, isanteplus.patient_laboratory pl, + (SELECT pla.patient_id, MAX(DATE(pla.visit_date)) as visit_date + FROM isanteplus.patient_laboratory pla + WHERE DATE(pla.visit_date) between :startDate AND :endDate + AND pla.test_id IN (856,1305) GROUP BY 1) C + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = e.patient_id + AND e.encounter_type = et.encounter_type_id + AND pl.patient_id = C.patient_id + AND DATE(pl.visit_date) = DATE(C.visit_date) + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND TIMESTAMPDIFF(DAY, DATE(e.encounter_datetime), DATE(pl.date_test_done)) BETWEEN 0 AND 30 + AND DATE(e.encounter_datetime) > DATE(pl.visit_date) + AND (pl.test_id = 856 AND pl.test_result > 1000) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithFingerPrint_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithFingerPrint_den.sql new file mode 100644 index 00000000..ba030d19 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithFingerPrint_den.sql @@ -0,0 +1,9 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) <= :endDate GROUP BY 1) B + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND DATE(psa.date_started_status) <= :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithFingerPrint_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithFingerPrint_num.sql new file mode 100644 index 00000000..208912eb --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithFingerPrint_num.sql @@ -0,0 +1,16 @@ +select DISTINCT p.patient_id AS 'Patient Id' +FROM openmrs.patient_identifier_type ptype,openmrs.patient_identifier pid, +isanteplus.patient p, isanteplus.patient_status_arv ps, +(select psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status FROM + isanteplus.patient_status_arv psa WHERE + DATE(psa.date_started_status) <= :endDate GROUP BY 1) B +WHERE ptype.patient_identifier_type_id = pid.identifier_type +AND p.patient_id = pid.patient_id +AND p.patient_id = ps.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) <= :endDate +AND ptype.uuid = 'e26ca279-8f57-44a5-9ed8-8cc16e90e559' +AND pid.voided <> 1 +AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithIncompletePsychosocialAssessment_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithIncompletePsychosocialAssessment_den.sql new file mode 100644 index 00000000..1a6987c8 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithIncompletePsychosocialAssessment_den.sql @@ -0,0 +1,10 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithIncompletePsychosocialAssessment_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithIncompletePsychosocialAssessment_num.sql new file mode 100644 index 00000000..22830cb1 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithIncompletePsychosocialAssessment_num.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 163340 AND o.value_coded = 163339 + AND TIMESTAMPDIFF(MONTH, DATE(e.encounter_datetime),:endDate) BETWEEN 0 AND 12 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnosesResolve_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnosesResolve_den.sql new file mode 100644 index 00000000..8d8140c2 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnosesResolve_den.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 1284 AND o.value_coded IS NOT NULL AND o.obs_group_id IS NOT NULL + AND TIMESTAMPDIFF(MONTH, DATE(e.encounter_datetime),:endDate) BETWEEN 0 AND 12 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnosesResolve_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnosesResolve_num.sql new file mode 100644 index 00000000..3067a984 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnosesResolve_num.sql @@ -0,0 +1,30 @@ +/*Pourcentage de patients séropositifs actifs traités pour un trouble psychologique durant la période d’analyse*/ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et, + (SELECT ob.person_id AS patient_id, DATE(enc.encounter_datetime) AS visit_date + FROM openmrs.obs ob, openmrs.encounter enc, + openmrs.encounter_type etype + WHERE ob.encounter_id = enc.encounter_id + AND enc.encounter_type = etype.encounter_type_id + AND etype.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND (ob.concept_id = 1284 AND ob.value_coded IS NOT NULL + AND ob.obs_group_id IS NOT NULL))C + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND B.patient_id = C.patient_id + AND DATE(e.encounter_datetime) > DATE(C.visit_date) + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 163104 AND (o.value_text IS NOT NULL AND o.value_text <> '') + AND TIMESTAMPDIFF(MONTH, DATE(e.encounter_datetime),:endDate) BETWEEN 0 AND 12 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnoses_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnoses_den.sql new file mode 100644 index 00000000..1a6987c8 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnoses_den.sql @@ -0,0 +1,10 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnoses_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnoses_num.sql new file mode 100644 index 00000000..8d8140c2 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialDiagnoses_num.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 1284 AND o.value_coded IS NOT NULL AND o.obs_group_id IS NOT NULL + AND TIMESTAMPDIFF(MONTH, DATE(e.encounter_datetime),:endDate) BETWEEN 0 AND 12 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialFollowUp_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialFollowUp_den.sql new file mode 100644 index 00000000..8d8140c2 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialFollowUp_den.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 1284 AND o.value_coded IS NOT NULL AND o.obs_group_id IS NOT NULL + AND TIMESTAMPDIFF(MONTH, DATE(e.encounter_datetime),:endDate) BETWEEN 0 AND 12 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialFollowUp_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialFollowUp_num.sql new file mode 100644 index 00000000..30b3ea1c --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialFollowUp_num.sql @@ -0,0 +1,21 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et, openmrs.concept c + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND o.value_coded = c.concept_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 163145 + AND c.uuid IN('9fb9a204-56d4-488c-9693-c067c53b593d', + '5079a471-61b4-4d0e-ad87-c08fc31162b2','3c9afedd-4287-4f32-ac76-41410a61d5e0') + AND DATE(e.encounter_datetime) between :startDate AND :endDate + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialNeeds_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialNeeds_den.sql new file mode 100644 index 00000000..d1666d31 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialNeeds_den.sql @@ -0,0 +1,12 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.encounter e + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = e.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND DATE(psa.date_started_status) between :startDate AND :endDate + AND DATE(e.encounter_datetime) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialNeeds_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialNeeds_num.sql new file mode 100644 index 00000000..be614214 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithPsychosocialNeeds_num.sql @@ -0,0 +1,37 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et, openmrs.concept c + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND o.concept_id = c.concept_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 163145 + AND c.uuid IN('1054AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + '1825AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'a7014c39-eac8-44ee-ab58-d0dd416682fa', + '36dbbb2a-7c98-4c0b-aef9-c1d7d559064f', + 'b7138252-def2-466c-b166-bb6d911c7a54', + '2421bd25-726f-41be-953d-8173381b3ab0', + '3d376960-3b97-4958-8c86-7626b2fd1bd0', + '2fac6db5-1fcb-419a-84a6-17bd09a047b1', + '6b31605d-5987-4744-9444-b8b1f8f217da', + '68c14421-1a12-470b-8cd0-500cebdb7177', + '159740AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'e0f3ac04-1f14-427d-b7e5-e5a06db9905e', + '72a714d2-1183-431e-9a30-f1361aa0b177', + '163577AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', + 'fe556012-245c-4a30-a3bf-f0961be4aa10', + 'ab30c201-df39-452e-bbc9-c718f5be98d6', + 'd4ba3c5b-7fad-4bca-8a5e-0834f1623f46', + 'aad7ae43-39e9-4e25-a79d-9a334b4ae5a4') + AND DATE(e.encounter_datetime) between :startDate AND :endDate + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithPsychoAtTime_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithPsychoAtTime_den.sql new file mode 100644 index 00000000..85343384 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithPsychoAtTime_den.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, isanteplus.patient_laboratory pl, + (SELECT pla.patient_id, MAX(DATE(pla.visit_date)) as visit_date + FROM isanteplus.patient_laboratory pla + WHERE DATE(pla.visit_date) between :startDate AND :endDate + AND pla.test_id IN (856,1305) GROUP BY 1) C + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND pl.patient_id = C.patient_id + AND DATE(pl.visit_date) = DATE(C.visit_date) + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND (pl.test_id = 856 AND pl.test_result > 1000) + AND DATE(pl.visit_date) between :startDate AND :endDate + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithPsychoAtTime_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithPsychoAtTime_num.sql new file mode 100644 index 00000000..9549cd61 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithPsychoAtTime_num.sql @@ -0,0 +1,34 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, isanteplus.patient_laboratory pl, + (SELECT pla.patient_id, MAX(DATE(pla.visit_date)) as visit_date + FROM isanteplus.patient_laboratory pla + WHERE DATE(pla.visit_date) between :startDate AND :endDate + AND pla.test_id IN (856,1305) GROUP BY 1) C, + (SELECT DISTINCT en.patient_id, MAX(DATE(en.encounter_datetime)) AS date_visite, + COUNT(en.encounter_id) FROM openmrs.encounter en, + openmrs.encounter_type etype, openmrs.obs ob, openmrs.concept c + WHERE en.encounter_type = etype.encounter_type_id + AND en.encounter_id = ob.encounter_id + AND ob.value_coded = c.concept_id + AND ob.concept_id = 163145 + AND c.uuid = 'e0520711-73e5-4490-ba34-9dc3d7e959c3' + AND etype.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + HAVING COUNT(en.encounter_id) = 3)D, isanteplus.patient_laboratory labo + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND pl.patient_id = C.patient_id + AND pl.patient_id = D.patient_id + AND D.patient_id = labo.patient_id + AND DATE(pl.visit_date) = DATE(C.visit_date) + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND DATE(pl.visit_date) <= DATE(D.date_visite) + AND DATE(labo.visit_date) > DATE(D.date_visite) + AND labo.test_id = 856 AND labo.test_result > 1000 + AND TIMESTAMPDIFF(DAY, DATE(D.date_visite),DATE(pl.visit_date)) BETWEEN 0 AND 90 + AND psa.id_status IN (6,8) + AND (pl.test_id = 856 AND pl.test_result > 1000) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithThreePsycho_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithThreePsycho_den.sql new file mode 100644 index 00000000..85343384 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithThreePsycho_den.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, isanteplus.patient_laboratory pl, + (SELECT pla.patient_id, MAX(DATE(pla.visit_date)) as visit_date + FROM isanteplus.patient_laboratory pla + WHERE DATE(pla.visit_date) between :startDate AND :endDate + AND pla.test_id IN (856,1305) GROUP BY 1) C + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND pl.patient_id = C.patient_id + AND DATE(pl.visit_date) = DATE(C.visit_date) + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND (pl.test_id = 856 AND pl.test_result > 1000) + AND DATE(pl.visit_date) between :startDate AND :endDate + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithThreePsycho_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithThreePsycho_num.sql new file mode 100644 index 00000000..c816f0d7 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithViralLoadSupMilleWithThreePsycho_num.sql @@ -0,0 +1,31 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, isanteplus.patient_laboratory pl, + (SELECT pla.patient_id, MAX(DATE(pla.visit_date)) as visit_date + FROM isanteplus.patient_laboratory pla + WHERE DATE(pla.visit_date) between :startDate AND :endDate + AND pla.test_id IN (856,1305) GROUP BY 1) C, + (SELECT DISTINCT en.patient_id, MAX(DATE(en.encounter_datetime)) AS date_visite, + COUNT(en.encounter_id) FROM openmrs.encounter en, + openmrs.encounter_type etype, openmrs.obs ob, openmrs.concept c + WHERE en.encounter_type = etype.encounter_type_id + AND en.encounter_id = ob.encounter_id + AND ob.value_coded = c.concept_id + AND ob.concept_id = 163145 + AND c.uuid = 'e0520711-73e5-4490-ba34-9dc3d7e959c3' + AND etype.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + HAVING COUNT(en.encounter_id) = 3)D + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND pl.patient_id = C.patient_id + AND pl.patient_id = D.patient_id + AND DATE(pl.visit_date) = DATE(C.visit_date) + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND DATE(pl.visit_date) <= DATE(D.date_visite) + AND TIMESTAMPDIFF(DAY, DATE(D.date_visite),DATE(pl.visit_date)) BETWEEN 0 AND 90 + AND psa.id_status IN (6,8) + AND (pl.test_id = 856 AND pl.test_result > 1000) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithoutFingerPrint_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithoutFingerPrint_num.sql new file mode 100644 index 00000000..0c157564 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/activePatientWithoutFingerPrint_num.sql @@ -0,0 +1,16 @@ +select DISTINCT p.patient_id AS 'Patient Id' +FROM isanteplus.patient p, isanteplus.patient_status_arv ps, +(select psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status FROM + isanteplus.patient_status_arv psa WHERE + DATE(psa.date_started_status) <= :endDate GROUP BY 1) B +WHERE p.patient_id = ps.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) <= :endDate + AND p.patient_id NOT IN (select pid.patient_id FROM + openmrs.patient_identifier_type ptype, openmrs.patient_identifier pid + WHERE ptype.patient_identifier_type_id = pid.identifier_type + AND ptype.uuid = 'e26ca279-8f57-44a5-9ed8-8cc16e90e559' + AND pid.voided <> 1) +AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appointmentperiod.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appointmentperiod.sql new file mode 100644 index 00000000..2341f42c --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appointmentperiod.sql @@ -0,0 +1,13 @@ +select distinct pdisp.patient_id FROM isanteplus.patient p, +isanteplus.patient_dispensing pdisp, isanteplus.patient_status_arv ps, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) C +WHERE p.patient_id = pdisp.patient_id +AND pdisp.patient_id = ps.patient_id +AND ps.patient_id = C.patient_id +AND DATE(ps.date_started_status) = C.date_status +AND ps.id_status IN(6,8,9) +AND pdisp.arv_drug = 1065 +AND DATE(pdisp.next_dispensation_date) between :startDate AND :endDate +AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appropriatechange_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appropriatechange_den.sql new file mode 100644 index 00000000..3ff062df --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appropriatechange_den.sql @@ -0,0 +1,20 @@ +SELECT DISTINCT lab.patient_id FROM isanteplus.patient_laboratory lab, + (SELECT l.patient_id, MAX(DATE(l.date_test_done)) AS result_date FROM + isanteplus.patient_laboratory l WHERE l.test_id = 856 + AND l.date_test_done <= :endDate GROUP BY 1) B, + (SELECT la.patient_id, MAX(DATE(la.date_test_done)) AS result_date, + la.test_result FROM + isanteplus.patient_laboratory la WHERE la.test_id = 856 + AND DATE(la.date_test_done) < + (SELECT MAX(DATE(lb.date_test_done)) AS date_result FROM + isanteplus.patient_laboratory lb WHERE lb.test_id = 856 + AND DATE(lb.date_test_done) <= :endDate AND la.patient_id = lb.patient_id) + AND DATE(la.date_test_done) <= :endDate GROUP BY 1) C + WHERE lab.patient_id = B.patient_id + AND B.patient_id = C.patient_id + AND DATE(lab.date_test_done) = DATE(B.result_date) + AND DATE(C.result_date) < DATE(B.result_date) + AND lab.test_id = 856 + AND lab.test_result > 1000 + AND C.test_result > 1000 + AND DATE(lab.date_test_done) <= :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appropriatechange_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appropriatechange_num.sql new file mode 100644 index 00000000..353c2477 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/appropriatechange_num.sql @@ -0,0 +1,48 @@ +SELECT DISTINCT E.patient_id FROM ( + select pe.patient_id,pe.visit_date,pe.regimen from isanteplus.pepfarTable pe, + (select p.patient_id,DATE(MAX(p.visit_date)) AS m_visit_date from isanteplus.pepfarTable p, + (SELECT l.patient_id, MAX(DATE(l.date_test_done)) AS result_date FROM + isanteplus.patient_laboratory l WHERE l.test_id = 856 + AND l.date_test_done <= :endDate GROUP BY 1) m_lab + WHERE p.patient_id = m_lab.patient_id + AND DATE(p.visit_date) <= DATE(m_lab.result_date) GROUP BY 1) p1 + WHERE pe.patient_id = p1.patient_id + AND DATE(pe.visit_date) = DATE(p1.m_visit_date) + ) A, + ( + select pe.patient_id,pe.visit_date,pe.regimen from isanteplus.pepfarTable pe, + (select p.patient_id,DATE(MAX(p.visit_date)) AS m_visit_date from isanteplus.pepfarTable p, + (SELECT l.patient_id, MAX(DATE(l.date_test_done)) AS result_date FROM + isanteplus.patient_laboratory l WHERE l.test_id = 856 + AND l.date_test_done <= :endDate GROUP BY 1) m_lab + WHERE p.patient_id = m_lab.patient_id + AND DATE(p.visit_date) BETWEEN DATE(m_lab.result_date) + AND DATE_ADD(DATE(m_lab.result_date), INTERVAL 3 month) group by 1) p1 + WHERE pe.patient_id = p1.patient_id + AND DATE(pe.visit_date) = DATE(p1.m_visit_date) + ) B, + ( + SELECT DISTINCT lab.patient_id FROM isanteplus.patient_laboratory lab, + (SELECT l.patient_id, MAX(DATE(l.date_test_done)) AS result_date FROM + isanteplus.patient_laboratory l WHERE l.test_id = 856 + AND l.date_test_done <= :endDate GROUP BY 1) plab, + (SELECT la.patient_id, MAX(DATE(la.date_test_done)) AS result_date, + la.test_result FROM + isanteplus.patient_laboratory la WHERE la.test_id = 856 + AND DATE(la.date_test_done) < + (SELECT MAX(DATE(lb.date_test_done)) AS date_result FROM + isanteplus.patient_laboratory lb WHERE lb.test_id = 856 + AND DATE(lb.date_test_done) <= :endDate + AND la.patient_id = lb.patient_id) + AND DATE(la.date_test_done) <= :endDate GROUP BY 1) D + WHERE lab.patient_id = plab.patient_id + AND plab.patient_id = D.patient_id + AND DATE(lab.date_test_done) = DATE(plab.result_date) + AND DATE(D.result_date) < DATE(plab.result_date) + AND lab.test_id = 856 + AND lab.test_result > 1000 + AND D.test_result > 1000 + AND DATE(lab.date_test_done) <= :endDate + ) E + WHERE A.patient_id = B.patient_id AND B.patient_id = E.patient_id + AND STRCMP(A.regimen,B.regimen)<>0; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/dispensingartperiod.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/dispensingartperiod.sql new file mode 100644 index 00000000..c18aa653 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/dispensingartperiod.sql @@ -0,0 +1,5 @@ +select distinct pdisp.patient_id FROM isanteplus.patient p, isanteplus.patient_dispensing pdisp +WHERE p.patient_id = pdisp.patient_id +AND pdisp.arv_drug = 1065 +AND ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date)) +between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/newActivePatientWithPsychoAssessment_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/newActivePatientWithPsychoAssessment_den.sql new file mode 100644 index 00000000..ec4ebd83 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/newActivePatientWithPsychoAssessment_den.sql @@ -0,0 +1,11 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND DATE(psa.date_started_status) between :startDate AND :endDate + AND DATE(p.date_started_arv) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/newActivePatientWithPsychoAssessment_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/newActivePatientWithPsychoAssessment_num.sql new file mode 100644 index 00000000..e80dfff5 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/newActivePatientWithPsychoAssessment_num.sql @@ -0,0 +1,17 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.encounter e, + openmrs.encounter_type et + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND e.encounter_type = et.encounter_type_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND DATE(e.encounter_datetime) BETWEEN :startDate AND :endDate + AND DATE(psa.date_started_status) between :startDate AND :endDate + AND DATE(p.date_started_arv) between :startDate AND :endDate + AND TIMESTAMPDIFF(DAY, DATE(e.encounter_datetime),DATE(p.date_started_arv)) BETWEEN 0 AND 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/nottakingart_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/nottakingart_den.sql new file mode 100644 index 00000000..2341f42c --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/nottakingart_den.sql @@ -0,0 +1,13 @@ +select distinct pdisp.patient_id FROM isanteplus.patient p, +isanteplus.patient_dispensing pdisp, isanteplus.patient_status_arv ps, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) C +WHERE p.patient_id = pdisp.patient_id +AND pdisp.patient_id = ps.patient_id +AND ps.patient_id = C.patient_id +AND DATE(ps.date_started_status) = C.date_status +AND ps.id_status IN(6,8,9) +AND pdisp.arv_drug = 1065 +AND DATE(pdisp.next_dispensation_date) between :startDate AND :endDate +AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/nottakingart_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/nottakingart_num.sql new file mode 100644 index 00000000..0ad428b0 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/nottakingart_num.sql @@ -0,0 +1,15 @@ +SELECT DISTINCT B.patient_id FROM +(select distinct pdisp.patient_id, DATE(pdisp.next_dispensation_date) AS next_visit +FROM isanteplus.patient_dispensing pdisp +WHERE pdisp.arv_drug = 1065 AND pdisp.voided <> 1 +AND DATE(pdisp.next_dispensation_date) between :startDate AND :endDate +GROUP BY 1) B, isanteplus.patient_status_arv ps, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) C +WHERE B.patient_id = ps.patient_id +AND ps.patient_id = C.patient_id +AND DATE(ps.date_started_status) = C.date_status +AND ps.id_status IN (8,9) +AND B.next_visit < C.date_status +AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/numberOfPatients.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/numberOfPatients.sql new file mode 100644 index 00000000..2520735b --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/numberOfPatients.sql @@ -0,0 +1,6 @@ +SELECT + COUNT(DISTINCT CASE WHEN p.gender='F' THEN p.patient_id END) as F, + COUNT(DISTINCT CASE WHEN p.gender='M' THEN p.patient_id END) as M +FROM isanteplus.patient p +INNER JOIN openmrs.encounter e ON p.patient_id = e.patient_id +WHERE DATE(e.encounter_datetime) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/retentionontar_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/retentionontar_den.sql new file mode 100644 index 00000000..919f6cc1 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/retentionontar_den.sql @@ -0,0 +1,9 @@ +select DISTINCT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE pdisp.arv_drug = 1065 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate)=12) B, + isanteplus.patient_status_arv psa + WHERE p.patient_id = B.patient_id + AND B.patient_id = psa.patient_id + AND psa.id_status <> 2 + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/retentionontar_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/retentionontar_num.sql new file mode 100644 index 00000000..4018ab94 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/retentionontar_num.sql @@ -0,0 +1,9 @@ +select DISTINCT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE pdisp.arv_drug = 1065 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate)=12) B, + isanteplus.patient_status_arv psa + WHERE p.patient_id = B.patient_id + AND B.patient_id = psa.patient_id + AND psa.id_status = 6 + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/rupturestock_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/rupturestock_den.sql new file mode 100644 index 00000000..919f6cc1 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/rupturestock_den.sql @@ -0,0 +1,9 @@ +select DISTINCT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE pdisp.arv_drug = 1065 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate)=12) B, + isanteplus.patient_status_arv psa + WHERE p.patient_id = B.patient_id + AND B.patient_id = psa.patient_id + AND psa.id_status <> 2 + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/rupturestock_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/rupturestock_num.sql new file mode 100644 index 00000000..4018ab94 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/rupturestock_num.sql @@ -0,0 +1,9 @@ +select DISTINCT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE pdisp.arv_drug = 1065 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate)=12) B, + isanteplus.patient_status_arv psa + WHERE p.patient_id = B.patient_id + AND B.patient_id = psa.patient_id + AND psa.id_status = 6 + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/takingart_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/takingart_den.sql new file mode 100644 index 00000000..2341f42c --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/takingart_den.sql @@ -0,0 +1,13 @@ +select distinct pdisp.patient_id FROM isanteplus.patient p, +isanteplus.patient_dispensing pdisp, isanteplus.patient_status_arv ps, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) C +WHERE p.patient_id = pdisp.patient_id +AND pdisp.patient_id = ps.patient_id +AND ps.patient_id = C.patient_id +AND DATE(ps.date_started_status) = C.date_status +AND ps.id_status IN(6,8,9) +AND pdisp.arv_drug = 1065 +AND DATE(pdisp.next_dispensation_date) between :startDate AND :endDate +AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/takingart_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/takingart_num.sql new file mode 100644 index 00000000..a4c0d44b --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/takingart_num.sql @@ -0,0 +1,21 @@ +SELECT DISTINCT patd.patient_id FROM isanteplus.patient p, +isanteplus.patient_dispensing patd, +(select distinct pdisp.patient_id, DATE(pdisp.next_dispensation_date) AS next_visit +FROM isanteplus.patient_dispensing pdisp +WHERE pdisp.arv_drug = 1065 AND pdisp.voided <> 1 +AND DATE(pdisp.next_dispensation_date) between :startDate AND :endDate +GROUP BY 1) B, isanteplus.patient_status_arv ps, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) C +WHERE p.patient_id = patd.patient_id +AND patd.patient_id = B.patient_id +AND patd.patient_id = ps.patient_id +AND ps.patient_id = C.patient_id +AND DATE(ps.date_started_status) = C.date_status +AND ps.id_status = 6 +AND patd.voided <> 1 +AND next_visit BETWEEN :startDate AND :endDate +AND DATE(ps.date_started_status) >= DATE(B.next_visit) +AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate +AND patd.arv_drug = 1065; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/timelywithdrawalart_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/timelywithdrawalart_den.sql new file mode 100644 index 00000000..0b0c4e9d --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/timelywithdrawalart_den.sql @@ -0,0 +1,8 @@ +SELECT DISTINCT pdisp.patient_id FROM isanteplus.patient p, isanteplus.patient_dispensing pdisp, +(select pdis.patient_id, pdis.dispensation_date, pdis.next_dispensation_date + FROM isanteplus.patient_dispensing pdis WHERE DATE(pdis.next_dispensation_date) + between :startDate AND :endDate AND pdis.arv_drug = 1065) B +WHERE p.patient_id = pdisp.patient_id +AND pdisp.patient_id = B.patient_id +AND DATE(pdisp.dispensation_date) between :startDate AND :endDate +AND pdisp.arv_drug = 1065; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/timelywithdrawalart_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/timelywithdrawalart_num.sql new file mode 100644 index 00000000..9f37f5a5 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/timelywithdrawalart_num.sql @@ -0,0 +1,9 @@ +SELECT DISTINCT pdisp.patient_id FROM isanteplus.patient p, isanteplus.patient_dispensing pdisp, +(select pdis.patient_id, pdis.dispensation_date, pdis.next_dispensation_date + FROM isanteplus.patient_dispensing pdis WHERE DATE(pdis.next_dispensation_date) + between :startDate AND :endDate AND pdis.arv_drug = 1065) B +WHERE p.patient_id = pdisp.patient_id +AND pdisp.patient_id = B.patient_id +AND pdisp.arv_drug = 1065 +AND DATE(pdisp.dispensation_date) between :startDate AND :endDate +AND DATE(pdisp.dispensation_date) <= DATE(B.next_dispensation_date)+2; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/transitionedPatient_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/transitionedPatient_den.sql new file mode 100644 index 00000000..ca27ded6 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/transitionedPatient_den.sql @@ -0,0 +1,13 @@ +SELECT p.patient_id +FROM isanteplus.patient p, isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(ps.date_started_status) AS date_status FROM +isanteplus.patient_status_arv ps +WHERE DATE(ps.date_started_status) BETWEEN :startDate AND :endDate +GROUP BY 1) B +WHERE p.patient_id = psa.patient_id +AND psa.patient_id = B.patient_id +AND DATE(psa.date_started_status) = DATE(B.date_status) +AND psa.id_status = 9 +AND TIMESTAMPDIFF(YEAR,p.birthdate,DATE(psa.date_started_status)) = 15 +AND TIMESTAMPDIFF(YEAR,p.birthdate, DATE_SUB(DATE(psa.date_started_status), INTERVAL 1 MONTH)) = 14 +AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/transitionedPatient_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/transitionedPatient_num.sql new file mode 100644 index 00000000..f3a87319 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/transitionedPatient_num.sql @@ -0,0 +1,13 @@ +SELECT p.patient_id +FROM isanteplus.patient p, isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(ps.date_started_status) AS date_status FROM +isanteplus.patient_status_arv ps +WHERE DATE(ps.date_started_status) BETWEEN :startDate AND :endDate +GROUP BY 1) B +WHERE p.patient_id = psa.patient_id +AND psa.patient_id = B.patient_id +AND DATE(psa.date_started_status) = DATE(B.date_status) +AND psa.id_status IN (6,8) +AND TIMESTAMPDIFF(YEAR,p.birthdate,DATE(psa.date_started_status)) = 15 +AND TIMESTAMPDIFF(YEAR,p.birthdate, DATE_SUB(DATE(psa.date_started_status), INTERVAL 1 MONTH)) = 14 +AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/treatmentinterruption_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/treatmentinterruption_den.sql new file mode 100644 index 00000000..8c0a4ba6 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/treatmentinterruption_den.sql @@ -0,0 +1,10 @@ +select distinct B.patient_id FROM isanteplus.patient p, +(SELECT pdisp.patient_id, min(DATE(pdisp.visit_date)) + FROM isanteplus.patient_dispensing pdisp + WHERE pdisp.arv_drug = 1065 AND pdisp.voided = 0 GROUP BY pdisp.patient_id + having TIMESTAMPDIFF(MONTH, min(DATE(pdisp.visit_date)),:endDate)=12) B, + isanteplus.patient_status_arv psa + WHERE p.patient_id = B.patient_id + AND B.patient_id = psa.patient_id + AND psa.id_status IN (6,8,9) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/treatmentinterruption_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/treatmentinterruption_num.sql new file mode 100644 index 00000000..1e9e73f1 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/treatmentinterruption_num.sql @@ -0,0 +1,9 @@ +select distinct B.patient_id FROM isanteplus.patient p, (SELECT pdisp.patient_id, min(DATE(pdisp.visit_date)) + FROM isanteplus.patient_dispensing pdisp + WHERE pdisp.arv_drug = 1065 AND pdisp.voided = 0 GROUP BY pdisp.patient_id + having TIMESTAMPDIFF(MONTH, min(DATE(pdisp.visit_date)),:endDate)=12) B, + isanteplus.patient_status_arv psa + WHERE p.patient_id = B.patient_id + AND B.patient_id = psa.patient_id + AND psa.id_status = 9 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadprocesscompletion_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadprocesscompletion_den.sql new file mode 100644 index 00000000..787cec92 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadprocesscompletion_den.sql @@ -0,0 +1,6 @@ +SELECT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE pdisp.arv_drug = 1065 + AND pdisp.voided = 0 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate) between 9 and 15) B + WHERE p.patient_id = B.patient_id; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadprocesscompletion_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadprocesscompletion_num.sql new file mode 100644 index 00000000..0d13c9ec --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadprocesscompletion_num.sql @@ -0,0 +1,10 @@ +SELECT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE + pdisp.arv_drug = 1065 AND pdisp.voided = 0 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate) between 9 and 15) B, + (select pl.patient_id from isanteplus.patient_laboratory pl + WHERE pl.test_id = 856 AND pl.test_result > 0 AND pl.voided = 0 + AND DATE(pl.visit_date) between :startDate and :endDate group by 1) lab + WHERE p.patient_id = B.patient_id + AND B.patient_id = lab.patient_id; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadsuppression_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadsuppression_den.sql new file mode 100644 index 00000000..e664f003 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadsuppression_den.sql @@ -0,0 +1,12 @@ +SELECT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE pdisp.arv_drug = 1065 + AND pdisp.voided=0 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate) between 9 and 15) B, + isanteplus.patient_status_arv psa, (select pl.patient_id from isanteplus.patient_laboratory pl + WHERE pl.test_id = 856 AND pl.test_result > 0 AND pl.voided = 0 + AND DATE(pl.visit_date) between :startDate and :endDate group by 1) lab + WHERE p.patient_id = B.patient_id + AND p.patient_id = psa.patient_id + AND B.patient_id = lab.patient_id + AND psa.id_status <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadsuppression_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadsuppression_num.sql new file mode 100644 index 00000000..4119e344 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/viralloadsuppression_num.sql @@ -0,0 +1,13 @@ +SELECT B.patient_id FROM isanteplus.patient p, + (select pdisp.patient_id, min(DATE(pdisp.visit_date)) as visit_date + from isanteplus.patient_dispensing pdisp WHERE pdisp.arv_drug = 1065 + AND pdisp.voided = 0 group by pdisp.patient_id + HAVING TIMESTAMPDIFF(MONTH, min(pdisp.visit_date),:endDate) between 9 and 15) B, + isanteplus.patient_status_arv psa, (select pl.patient_id from isanteplus.patient_laboratory pl + WHERE pl.test_id = 856 AND pl.test_result > 0 AND pl.test_result < 1000 + AND pl.voided =0 + AND DATE(pl.visit_date) between :startDate and :endDate group by 1) lab + WHERE p.patient_id = B.patient_id + AND p.patient_id = psa.patient_id + AND B.patient_id = lab.patient_id + AND psa.id_status <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/vitalStatistics_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/vitalStatistics_den.sql new file mode 100644 index 00000000..c1e9d250 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/vitalStatistics_den.sql @@ -0,0 +1,13 @@ +select distinct o.person_id as patient_id FROM openmrs.obs o, openmrs.encounter e, +openmrs.encounter_type et +WHERE o.encounter_id = e.encounter_id +AND e.encounter_type = et.encounter_type_id +AND o.concept_id = 1543 +AND et.uuid = '9d0113c6-f23a-4461-8428-7e9a7344f2ba' +AND DATE(o.value_datetime) BETWEEN :startDate AND :endDate + +UNION + + SELECT distinct pe.person_id as patient_id FROM openmrs.person pe WHERE + pe.death_date IS NOT NULL + AND DATE(pe.death_date) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/vitalStatistics_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/vitalStatistics_num.sql new file mode 100644 index 00000000..f31e6311 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/alertePrecoceReports/vitalStatistics_num.sql @@ -0,0 +1,2 @@ +select distinct p.person_id as patient_id FROM openmrs.person p +WHERE DATE(p.birthdate) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/ART_dispensation_follow_up.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/ART_dispensation_follow_up.sql index 0b9cd60d..9ce7ab04 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/ART_dispensation_follow_up.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/ART_dispensation_follow_up.sql @@ -8,12 +8,13 @@ DATE_FORMAT(DATE(pdis.dispensation_date), "%d-%m-%Y") as 'Date effective de dern DATE_FORMAT(DATE(pdis.next_dispensation_date), "%d-%m-%Y") as 'Prochain Rendez-vous ARV', pdis.number_day_dispense as 'Nombre de Jours prescrit pour la derniere visite ARV' FROM isanteplus.patient p, isanteplus.patient_prescription pdis, -(select pd.patient_id, MAX(pd.encounter_id) as encounter_id FROM +(select pd.patient_id, MAX(DATE(pd.visit_date)) as visit_date FROM isanteplus.patient_prescription pd WHERE pd.arv_drug = 1065 AND pd.voided <> 1 AND (pd.rx_or_prophy <> 163768 OR pd.rx_or_prophy is null) GROUP BY 1) B WHERE p.patient_id = pdis.patient_id AND pdis.patient_id = B.patient_id -AND pdis.encounter_id = B.encounter_id +AND DATE(pdis.visit_date) = B.visit_date AND p.vih_status = 1 +AND p.voided <> 1 AND p.patient_id IN (SELECT ip.patient_id from openmrs.isanteplus_patient_arv ip WHERE ip.arv_regimen is not null) GROUP BY 1,2,3,4,5,6,7; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/activePatient_with_fingerprint.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/activePatient_with_fingerprint.sql new file mode 100644 index 00000000..9c3a8a93 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/activePatient_with_fingerprint.sql @@ -0,0 +1,17 @@ +select DISTINCT p.patient_id AS 'Patient Id', +p.st_id as 'Code ST',p.national_id as 'Code national', +p.given_name as Prénom,p.family_name as Nom, p.gender as Sexe, +DATE_FORMAT(p.birthdate, "%d-%m-%Y") as 'Date de naissance', +TIMESTAMPDIFF(YEAR, p.birthdate,DATE(now())) as Age, +DATE_FORMAT(pid.date_created, "%d-%m-%Y") as 'Date Empreinte', p.last_address as Adresse, +p.telephone as Téléphone,p.mother_name as Contact +FROM openmrs.patient_identifier_type ptype,openmrs.patient_identifier pid, +isanteplus.patient p, isanteplus.patient_status_arv ps, +(select psa.patient_id, DATE(psa.date_started_status) as date_status FROM + isanteplus.patient_status_arv psa WHERE + DATE(psa.date_started_status) = DATE(now()) GROUP BY 1) +WHERE ptype.patient_identifier_type_id = pid.identifier_type +AND p.patient_id = pid.patient_id +AND ptype.uuid = 'e26ca279-8f57-44a5-9ed8-8cc16e90e559' +AND pid.voided <> 1 +AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/activePatientsScreenedForTb.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/activePatientsScreenedForTb.sql new file mode 100644 index 00000000..1c72d6b0 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/activePatientsScreenedForTb.sql @@ -0,0 +1,24 @@ +select DISTINCT p.patient_id AS 'Patient Id', +p.st_id as 'NO. de patient attribué par le site', +p.national_id as 'Numéro d\'identité national', +p.given_name as Prénom,p.family_name as Nom, p.gender as Sexe, +DATE_FORMAT(p.birthdate, "%d-%m-%Y") as 'Date de naissance', +TIMESTAMPDIFF(YEAR, p.birthdate,DATE(now())) as Age, +asl.name_fr as 'Statut du patient', p.last_address as Adresse, + p.telephone as Téléphone,p.mother_name as Contact +FROM isanteplus.patient p, isanteplus.patient_status_arv ps,isanteplus.arv_status_loockup asl, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B, + openmrs.obs o + WHERE p.patient_id = ps.patient_id + AND ps.id_status = asl.id + AND ps.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND o.concept_id = 1659 AND o.value_coded IN (1660,142177) + AND DATE(o.obs_datetime) <= :endDate + AND p.voided <> 1 + AND o.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/active_patient_viral_load_last_twelve_months.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/active_patient_viral_load_last_twelve_months.sql new file mode 100644 index 00000000..8d024b97 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/active_patient_viral_load_last_twelve_months.sql @@ -0,0 +1,36 @@ +/*Patient Actif avec une charge virale pendant les 12 derniers mois*/ +select DISTINCT pat.patient_id AS 'Patient Id', pat.st_id as 'Code ST', pat.national_id as 'Code National', +pat.given_name as Prénom,pat.family_name as Nom, pat.gender as Sexe, +DATE_FORMAT(pat.birthdate, "%d-%m-%Y") as 'Date de naissance',TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, asl.name_fr as 'Statut du patient', +CASE WHEN (pl.test_id = 1305 AND pl.test_result = 1306) THEN 'Indétectable' +WHEN (pl.test_id = 1305 AND pl.test_result = 1301) THEN 'Détectable' +ELSE pl.test_result +END +AS Résultat, +C.date_test AS 'Date du test',pat.last_address as Adresse, pat.telephone as Téléphone, +pat.mother_name as Contact FROM isanteplus.patient pat, +isanteplus.patient_status_arv ps,isanteplus.arv_status_loockup asl, +isanteplus.patient_laboratory pl,(SELECT psar.patient_id, + MAX(DATE(psar.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psar WHERE DATE(psar.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1)B, +(SELECT l.patient_id, MAX(IFNULL(DATE(l.date_test_done),DATE(l.visit_date))) +AS date_test FROM isanteplus.patient_laboratory l WHERE l.test_id IN(856,1305) +AND l.test_result IS NOT NULL +AND TIMESTAMPDIFF(MONTH, IFNULL(DATE(l.date_test_done),DATE(l.visit_date)),:endDate) <= 12 +GROUP BY 1) C +WHERE pat.patient_id = ps.patient_id +AND ps.patient_id = pl.patient_id +AND ps.id_status = asl.id +AND ps.patient_id = B.patient_id +AND pl.patient_id = C.patient_id +AND IFNULL(DATE(pl.date_test_done),DATE(pl.visit_date)) = C.date_test +AND DATE(ps.date_started_status) = DATE(B.date_status) +AND ps.id_status IN (6,8) +AND pl.test_id IN(856,1305) +AND pl.test_result IS NOT NULL +AND TIMESTAMPDIFF(MONTH, IFNULL(DATE(pl.date_test_done),DATE(pl.visit_date)),:endDate) <= 12 +AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate +AND IFNULL(DATE(pl.date_test_done),DATE(pl.visit_date)) <= :endDate +AND pat.voided <> 1 +AND pl.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/consultationByDay.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/consultationByDay.sql index 62998ee1..12e8b5ac 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/consultationByDay.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/consultationByDay.sql @@ -1,5 +1,5 @@ /* Consultation par jour */ -SELECT p.patient_id AS 'Patient Id', DATE_FORMAT(DATE(patvi.date_started), "%d-%m-%Y") as VisitDate, loc.name as Clinic, CONCAT(pat.given_name,' ',pat.family_name) as Patient, +SELECT pat.patient_id AS 'Patient Id', DATE_FORMAT(DATE(patvi.date_started), "%d-%m-%Y") as VisitDate, loc.name as Clinic, CONCAT(pat.given_name,' ',pat.family_name) as Patient, CASE WHEN pat.vih_status=1 THEN 'Patient VIH' WHEN pat.vih_status=0 THEN 'Patient non VIH' END as PatientType, enct.name as Form diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/exposed_infants_register_in_ptme_program.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/exposed_infants_register_in_ptme_program.sql index 841f937e..688f4131 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/exposed_infants_register_in_ptme_program.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/exposed_infants_register_in_ptme_program.sql @@ -1,8 +1,11 @@ /*Nombre d'enfants nés de mère VIH (+) (exposés) enregistrés dans le programme PTME / Number of infants born to HIV+ mothers registered in PTME program */ -SELECT COUNT(DISTINCT pv.patient_id) AS Total FROM isanteplus.pediatric_hiv_visit pv -WHERE pv.actual_vih_status=1405 +select distinct p.patient_id AS 'Patient Id', p.st_id,p.national_id as 'numéro identité national', p.given_name as prénom, +p.family_name as nom,p.gender as sexe, TIMESTAMPDIFF(YEAR,p.birthdate,now()) as Âge, p.last_visit_date as 'Dernière date' +FROM isanteplus.pediatric_hiv_visit pv, isanteplus.patient p +WHERE pv.patient_id = p.patient_id + AND pv.actual_vih_status=1405 AND pv.ptme=1065 AND pv.voided <> 1 AND pv.encounter_date BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/hiv_patient_with_activity_after_disc.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/hiv_patient_with_activity_after_disc.sql index f304af76..3f47be17 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/hiv_patient_with_activity_after_disc.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/hiv_patient_with_activity_after_disc.sql @@ -5,7 +5,7 @@ DATE_FORMAT(MAX(DATE(enc.encounter_datetime)),"%d-%m-%Y") as 'Dernière date', e from isanteplus.patient p, openmrs.encounter enc, openmrs.encounter_type entype, openmrs.encounter en, (select e.patient_id, MAX(e.encounter_datetime) as encounter_date FROM openmrs.encounter e, openmrs.encounter_type et - WHERE e.encounter_type=et.encounter_type_id AND et.uuid = '9d0113c6-f23a-4461-8428-7e9a7344f2ba' GROUP BY 1) B + WHERE e.encounter_type=et.encounter_type_id AND et.uuid = '9d0113c6-f23a-4461-8428-7e9a7344f2ba' AND e.voided <> 1 GROUP BY 1) B WHERE p.patient_id=enc.patient_id AND enc.encounter_type=entype.encounter_type_id AND enc.patient_id=en.patient_id @@ -13,10 +13,14 @@ AND en.patient_id = B.patient_id AND en.encounter_datetime = B.encounter_date AND p.vih_status=1 AND p.voided <> 1 +AND en.voided <> 1 +AND enc.voided <> 1 AND en.encounter_type=(select encounter_type_id FROM openmrs.encounter_type enct WHERE enct.uuid='9d0113c6-f23a-4461-8428-7e9a7344f2ba') AND DATE(enc.encounter_datetime) > DATE(en.encounter_datetime) AND enc.patient_id NOT IN (SELECT e.patient_id FROM openmrs.encounter e, openmrs.encounter_type et WHERE e.encounter_type = et.encounter_type_id AND et.uuid IN - ('12f4d7c3-e047-4455-a607-47a40fe32460','a5600919-4dde-4eb8-a45b-05c204af8284','709610ff-5e39-4a47-9c27-a60e740b0944','fdb5b14f-555f-4282-b4c1-9286addf0aae')) + ('12f4d7c3-e047-4455-a607-47a40fe32460','a5600919-4dde-4eb8-a45b-05c204af8284', +'709610ff-5e39-4a47-9c27-a60e740b0944','fdb5b14f-555f-4282-b4c1-9286addf0aae', +'1dd1e63a-1543-4885-b807-e49c6d18cffd')) GROUP BY p.patient_id; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_hiv_patients_without_hiv_test.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_hiv_patients_without_hiv_test.sql new file mode 100644 index 00000000..fcbda517 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_hiv_patients_without_hiv_test.sql @@ -0,0 +1,10 @@ +select DISTINCT pa.patient_id AS 'Patient Id', pa.st_id as 'NO. de patient attribué par le site', +pa.national_id as 'No. d\'identité nationale',pa.given_name as Prénom, +pa.family_name as Nom, pa.gender as Sexe,DATE_FORMAT(pa.birthdate, "%d-%m-%Y") as 'Date de naissance', TIMESTAMPDIFF(YEAR, pa.birthdate,DATE(now())) as Âge, +pa.telephone as Téléphone +from isanteplus.patient pa +WHERE pa.vih_status = 1 +AND pa.voided <> 1 +AND pa.patient_id NOT IN (SELECT distinct pl.patient_id + FROM isanteplus.patient_laboratory pl WHERE pl.test_id IN (1042,1040) + AND pl.test_result = 703 AND pl.voided <> 1); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_demand_date.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_demand_date.sql index ccd27998..9af6ca98 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_demand_date.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_demand_date.sql @@ -1,13 +1,20 @@ +/*Liste des patients avec charge virale < 1000 copies/ml (selon la date de la demande)*/ select DISTINCT pat.patient_id AS 'Patient Id', pat.st_id as 'NO. de patient attribué par le site', pat.national_id as 'Numéro d\'identité national', pat.given_name as Prénom,pat.family_name as Nom, pat.gender as Sexe, -TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, pat.last_address as Adresse, pat.telephone as Téléphone, -pat.mother_name as Contact FROM isanteplus.patient pat, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.visit_date) as test_date from isanteplus.patient_laboratory plab -WHERE plab.test_id IN(856,1305) AND plab.test_done = 1 AND plab.voided <> 1 group by 1)B +TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, asl.name_fr as 'Statut du patient', pat.last_address as Adresse, pat.telephone as Téléphone, +pat.mother_name as Contact FROM isanteplus.patient pat LEFT JOIN isanteplus.arv_status_loockup asl +ON pat.arv_status = asl.id, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.visit_date) as test_date from isanteplus.patient_laboratory plab +WHERE plab.test_id IN(856,1305) AND plab.test_done = 1 AND plab.voided <> 1 +AND plab.visit_date BETWEEN :startDate AND :endDate group by 1)B WHERE pat.patient_id = pl.patient_id AND B.patient_id = pl.patient_id AND pl.visit_date = B.test_date AND pl.test_id IN(856,1305) AND pl.test_done = 1 - AND (pl.test_result < 1000 OR pl.test_result=1306) - AND pat.patient_id NOT IN (SELECT ei.patient_id FROM isanteplus.exposed_infants ei) + AND pl.voided <> 1 + AND ifnull(case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end,0) between 0.01 and 1000 AND pl.visit_date BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_result_date.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_result_date.sql index af19610a..832c9276 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_result_date.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_moins_mille_by_result_date.sql @@ -1,13 +1,20 @@ +/*Liste des patients avec charge virale < 1000 copies/ml (selon la date du résultat)*/ select DISTINCT pat.patient_id AS 'Patient Id', pat.st_id as 'NO. de patient attribué par le site', pat.national_id as 'Numéro d\'identité national', pat.given_name as Prénom,pat.family_name as Nom, pat.gender as Sexe, -TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, pat.last_address as Adresse, pat.telephone as Téléphone, -pat.mother_name as Contact FROM isanteplus.patient pat, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.date_test_done) as test_date from isanteplus.patient_laboratory plab -WHERE plab.test_id IN(856,1305) AND plab.test_done = 1 AND plab.voided <> 1 group by 1)B +TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, asl.name_fr as 'Statut du patient', pat.last_address as Adresse, pat.telephone as Téléphone, +pat.mother_name as Contact FROM isanteplus.patient pat LEFT JOIN isanteplus.arv_status_loockup asl +ON pat.arv_status = asl.id, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.date_test_done) as test_date from isanteplus.patient_laboratory plab +WHERE plab.test_id IN(856,1305) AND plab.test_done = 1 AND plab.voided <> 1 +AND plab.date_test_done BETWEEN :startDate AND :endDate group by 1)B WHERE pat.patient_id = pl.patient_id AND B.patient_id = pl.patient_id AND pl.date_test_done = B.test_date AND pl.test_id IN(856,1305) AND pl.test_done = 1 - AND (pl.test_result < 1000 OR pl.test_result=1306) - AND pat.patient_id NOT IN (SELECT ei.patient_id FROM isanteplus.exposed_infants ei) + AND pl.voided <> 1 + AND ifnull(case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end,0) between 0.01 and 1000 AND pl.date_test_done BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_demand_date.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_demand_date.sql index af586be0..856a9a6e 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_demand_date.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_demand_date.sql @@ -1,13 +1,20 @@ +/*Liste des patients avec charge virale >= 1000 copies/ml (selon la date de la demande) */ select DISTINCT pat.patient_id AS 'Patient Id', pat.st_id as 'NO. de patient attribué par le site', pat.national_id as 'Numéro d\'identité national', pat.given_name as Prénom,pat.family_name as Nom, pat.gender as Sexe, -TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, pat.last_address as Adresse, pat.telephone as Téléphone, -pat.mother_name as Contact FROM isanteplus.patient pat, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.visit_date) as test_date from isanteplus.patient_laboratory plab -WHERE plab.test_id = 856 AND plab.test_done = 1 AND plab.voided <> 1 group by 1)B +TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, asl.name_fr as 'Statut du patient', pat.last_address as Adresse, pat.telephone as Téléphone, +pat.mother_name as Contact FROM isanteplus.patient pat LEFT JOIN isanteplus.arv_status_loockup asl +ON pat.arv_status = asl.id, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.visit_date) as test_date from isanteplus.patient_laboratory plab +WHERE plab.test_id in (856,1305) AND plab.test_done = 1 AND plab.voided <> 1 +AND plab.visit_date BETWEEN :startDate AND :endDate group by 1)B WHERE pat.patient_id = pl.patient_id AND B.patient_id = pl.patient_id AND pl.visit_date = B.test_date - AND pl.test_id = 856 + AND pl.test_id in (856,1305) AND pl.test_done = 1 - AND pl.test_result >= 1000 - AND pat.patient_id NOT IN (SELECT ei.patient_id FROM isanteplus.exposed_infants ei) + AND pl.voided <> 1 + AND ifnull(case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end,0)>=1000 AND pl.visit_date BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_result_date.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_result_date.sql index 6d7e6080..f58d5926 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_result_date.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_charge_virale_plus_mille_by_result_date.sql @@ -1,13 +1,20 @@ +/*Liste des patients avec charge virale >= 1000 copies/ml (selon la date du résultat)*/ select DISTINCT pat.patient_id AS 'Patient Id', pat.st_id as 'NO. de patient attribué par le site', pat.national_id as 'Numéro d\'identité national', pat.given_name as Prénom,pat.family_name as Nom, pat.gender as Sexe, -TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, pat.last_address as Adresse, pat.telephone as Téléphone, -pat.mother_name as Contact FROM isanteplus.patient pat, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.date_test_done) as test_date from isanteplus.patient_laboratory plab -WHERE plab.test_id = 856 AND plab.test_done = 1 AND plab.voided <> 1 group by 1)B +TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Age, asl.name_fr as 'Statut du patient', pat.last_address as Adresse, pat.telephone as Téléphone, +pat.mother_name as Contact FROM isanteplus.patient pat LEFT JOIN isanteplus.arv_status_loockup asl +ON pat.arv_status = asl.id, isanteplus.patient_laboratory pl, (select plab.patient_id,max(plab.date_test_done) as test_date from isanteplus.patient_laboratory plab +WHERE plab.test_id in (856,1305) AND plab.test_done = 1 AND plab.voided <> 1 +AND plab.date_test_done BETWEEN :startDate AND :endDate group by 1)B WHERE pat.patient_id = pl.patient_id AND B.patient_id = pl.patient_id AND pl.date_test_done = B.test_date - AND pl.test_id = 856 + AND pl.test_id in (856,1305) AND pl.test_done = 1 - AND pl.test_result >= 1000 - AND pat.patient_id NOT IN (SELECT ei.patient_id FROM isanteplus.exposed_infants ei) + AND pl.voided <> 1 + AND ifnull(case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end,0)>=1000 AND pl.date_test_done BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale.sql index 79ea29c8..eae04714 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale.sql @@ -8,4 +8,5 @@ AND p.patient_id NOT IN(SELECT pl.patient_id FROM isanteplus.patient_laboratory WHERE pl.test_id IN(856, 1305) AND pl.test_done=1 AND pl.voided <> 1 AND ((pl.test_result is not null) OR (pl.test_result <> ''))) AND p.patient_id NOT IN (select enc.patient_id FROM openmrs.encounter enc, openmrs.encounter_type et where enc.encounter_type = et.encounter_type_id AND et.uuid = '9d0113c6-f23a-4461-8428-7e9a7344f2ba') -AND p.vih_status = 1; \ No newline at end of file +AND p.patient_id NOT IN (SELECT ex.patient_id FROM isanteplus.exposed_infants ex) + AND p.vih_status = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale_controle.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale_controle.sql index 1f81ad9c..1783777a 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale_controle.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/list_patients_eligible_for_charge_virale_controle.sql @@ -17,6 +17,7 @@ AND p.patient_id NOT IN (SELECT enc.patient_id FROM openmrs.encounter enc, openmrs.encounter_type enct WHERE enc.encounter_type = enct.encounter_type_id AND enct.uuid = '9d0113c6-f23a-4461-8428-7e9a7344f2ba') +AND p.patient_id NOT IN (SELECT ex.patient_id FROM isanteplus.exposed_infants ex) GROUP BY p.patient_id UNION @@ -39,4 +40,5 @@ AND p.patient_id NOT IN (SELECT enc.patient_id FROM openmrs.encounter enc, openmrs.encounter_type enct WHERE enc.encounter_type = enct.encounter_type_id AND enct.uuid = '9d0113c6-f23a-4461-8428-7e9a7344f2ba') +AND p.patient_id NOT IN (SELECT ex.patient_id FROM isanteplus.exposed_infants ex) GROUP BY p.patient_id; diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_eligible_children_for_pcr.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_eligible_children_for_pcr.sql index 9d6771dc..ba7ace10 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_eligible_children_for_pcr.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_eligible_children_for_pcr.sql @@ -1,9 +1,9 @@ /*Liste des enfants éligibles pour un PCR*/ - select DISTINCT B.st_id as 'NO. de patient attribué par le site', B.national_id as 'Numéro d\'identité national', + select DISTINCT B.patient_id AS 'Patient Id', B.st_id as 'NO. de patient attribué par le site', B.national_id as 'Numéro d\'identité national', B.prenom as Prénom,B.nom as Nom, B.sexe as Sexe, B.age as Âge, B.telephone as Téléphone, B.mother_name as Contact - FROM (SELECT DISTINCT pat.st_id as st_id, pat.national_id as national_id, + FROM (SELECT DISTINCT pat.patient_id, pat.st_id as st_id, pat.national_id as national_id, pat.given_name as prenom,pat.family_name as nom, pat.gender as sexe, TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as age, pat.telephone as telephone, pat.mother_name @@ -13,7 +13,7 @@ AND (TIMESTAMPDIFF(DAY, pat.birthdate,DATE(now())) BETWEEN 28 AND 365) AND pat.patient_id NOT IN (select distinct o.person_id from openmrs.obs o where o.voided <> 1 AND (o.concept_id IN (844,1030)) OR (o.concept_id = 1271 AND value_coded = 844)) UNION - SELECT DISTINCT pat.st_id as st_id, pat.national_id as national_id, + SELECT DISTINCT pat.patient_id, pat.st_id as 'NO. de patient attribué par le site', pat.national_id as national_id, pat.given_name as prenom,pat.family_name as nom, pat.gender as sexe, TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as age, pat.telephone as telephone, pat.mother_name diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_exposed_infants_confirmed_hiv.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_exposed_infants_confirmed_hiv.sql index e7c2735a..a623c52e 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_exposed_infants_confirmed_hiv.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_exposed_infants_confirmed_hiv.sql @@ -1,5 +1,5 @@ /*Nombre d'enfants exposés confirmés VIH (+) */ -select DISTINCT pat.st_id as 'NO. de patient attribué par le site', pat.national_id as 'Numéro d\'identité national', +select DISTINCT pat.patient_id AS 'Patient Id', pat.st_id as 'NO. de patient attribué par le site', pat.national_id as 'Numéro d\'identité national', pat.given_name as Prénom,pat.family_name as Nom, pat.gender as Sexe, TIMESTAMPDIFF(YEAR, pat.birthdate,DATE(now())) as Âge, pat.telephone as Téléphone, pat.mother_name as Contact diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_hiv_women_gave_birth_at_hospital.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_hiv_women_gave_birth_at_hospital.sql index 28274b4f..16c3d1d0 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_hiv_women_gave_birth_at_hospital.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_hiv_women_gave_birth_at_hospital.sql @@ -1,4 +1,4 @@ -SELECT DISTINCT ppr.patient_id +SELECT COUNT(DISTINCT ppr.patient_id) FROM isanteplus.patient_pregnancy ppr INNER JOIN isanteplus.patient_delivery pdel ON pdel.patient_id=ppr.patient_id diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille.sql index 52e261fc..516048bd 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille.sql @@ -1,16 +1,30 @@ /* Charge virale en fonction du nombre de copies/ml (selon la date du résultat) */ -select moins_de_mille AS 'Patient avec résultat de charge virale < 1000 copies/ml', plus_de_mille AS 'Patient avec résultat de charge virale >= 1000 copies/ml', moins_de_mille + plus_de_mille as 'Patient unique' from( +select moins_de_mille AS 'Patient avec résultat de charge virale < 1000 copies/ml', plus_de_mille AS 'Patient avec résultat de charge virale >= 1000 copies/ml', moins_de_mille + plus_de_mille as 'Patient unique' +from( select -COUNT(DISTINCT CASE WHEN ((pl.test_id = 856 AND pl.test_done = 1 AND (pl.test_result is not null AND pl.test_result > 0) AND pl.test_result < 1000)) THEN pl.patient_id else null END) AS moins_de_mille, -COUNT(DISTINCT CASE WHEN (pl.test_id = 856 AND pl.test_done = 1 AND (pl.test_result is not null AND pl.test_result > 0) AND pl.test_result >= 1000) THEN pl.patient_id else null END) AS plus_de_mille, +COUNT(DISTINCT CASE WHEN (case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end) < 1000 THEN pl.patient_id else null END) AS moins_de_mille, +COUNT(DISTINCT CASE WHEN (case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end) >= 1000 THEN pl.patient_id else null END) AS plus_de_mille, count(distinct pl.patient_id) as Patient_unique FROM isanteplus.patient_laboratory pl,(select plab.patient_id,max(DATE(plab.date_test_done)) as test_date from isanteplus.patient_laboratory plab -WHERE plab.test_id = 856 group by 1)B +WHERE plab.test_id in(856,1305) AND plab.test_done = 1 AND plab.voided <> 1 +AND DATE(plab.date_test_done) BETWEEN :startDate AND :endDate group by 1)B WHERE B.patient_id = pl.patient_id -AND DATE(pl.date_test_done) = B.test_date -AND pl.test_id = 856 +AND DATE(pl.date_test_done) = B.test_date +AND pl.test_id in(856,1305) AND pl.test_done = 1 AND pl.voided <> 1 -AND (pl.test_result > 0 AND pl.test_result is not null) +AND ifnull(case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end,0) > 0 AND DATE(pl.date_test_done) BETWEEN :startDate AND :endDate) A; diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille_demand.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille_demand.sql index 8312fe6d..a6aeeaa0 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille_demand.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_patients_charge_virale_moins_plus_mille_demand.sql @@ -1,15 +1,29 @@ /*Charge virale en fonction du nombre de copies/ml (selon la date de la demande) */ + /*Charge virale en fonction du nombre de copies/ml (selon la date de la demande) */ select moins_de_mille AS 'Patient avec résultat de charge virale < 1000 copies/ml', plus_de_mille AS 'Patient avec résultat de charge virale >= 1000 copies/ml', moins_de_mille + plus_de_mille as 'Patient unique' from( select -COUNT(DISTINCT CASE WHEN ((pl.test_id = 856 AND pl.test_done = 1 AND (pl.test_result is not null AND pl.test_result > 0) AND pl.test_result < 1000)) THEN pl.patient_id else null END) AS moins_de_mille, -COUNT(DISTINCT CASE WHEN (pl.test_id = 856 AND pl.test_done = 1 AND (pl.test_result is not null AND pl.test_result > 0) AND pl.test_result >= 1000) THEN pl.patient_id else null END) AS plus_de_mille, +COUNT(DISTINCT CASE WHEN (case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end) < 1000 THEN pl.patient_id else null END) AS moins_de_mille, +COUNT(DISTINCT CASE WHEN (case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end) >= 1000 THEN pl.patient_id else null END) AS plus_de_mille, count(distinct pl.patient_id) as Patient_unique FROM isanteplus.patient_laboratory pl,(select plab.patient_id,max(DATE(plab.visit_date)) as test_date from isanteplus.patient_laboratory plab -WHERE plab.test_id = 856 group by 1)B +WHERE plab.test_id in(856,1305) AND plab.test_done = 1 AND plab.voided <> 1 +AND DATE(plab.visit_date) BETWEEN :startDate AND :endDate group by 1)B WHERE B.patient_id = pl.patient_id AND DATE(pl.visit_date) = B.test_date -AND pl.test_id = 856 +AND pl.test_id in(856,1305) AND pl.test_done = 1 AND pl.voided <> 1 -AND (pl.test_result > 0 AND pl.test_result is not null) +AND ifnull(case when pl.test_id=856 then pl.test_result + when pl.test_id=1305 and pl.test_result=1301 then 1001 + when pl.test_id=1305 and pl.test_result=1306 then 800 + else pl.test_result +end,0) > 0 AND DATE(pl.visit_date) BETWEEN :startDate AND :endDate) A; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_visits_by_pregnant_women_to_the_clinic.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_visits_by_pregnant_women_to_the_clinic.sql index 39109c5a..dc954d8a 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_visits_by_pregnant_women_to_the_clinic.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_visits_by_pregnant_women_to_the_clinic.sql @@ -1,5 +1,5 @@ /*Nombre de visites de femmes enceintes reçues en clinique / Number of visits by pregnant women to the clinic*/ -select distinct p.patient_id AS 'Patient Id', p.st_id,p.national_id as 'numéro identité national', p.given_name as prénom,p.family_name as nom,p.gender as sexe, TIMESTAMPDIFF(YEAR,p.birthdate,now()) as Âge, +select distinct p.patient_id AS 'Patient Id', p.st_id AS 'NO. de patient attribué par le site',p.national_id as 'numéro identité national', p.given_name as prénom,p.family_name as nom,p.gender as sexe, TIMESTAMPDIFF(YEAR,p.birthdate,now()) as Âge, p.last_visit_date as 'Dernière date' FROM isanteplus.patient p, isanteplus.patient_pregnancy pp WHERE p.patient_id=pp.patient_id diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_women_seen_first_prenatal_visit_first_trimester.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_women_seen_first_prenatal_visit_first_trimester.sql index a2f2323f..df45c3ce 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_women_seen_first_prenatal_visit_first_trimester.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/number_women_seen_first_prenatal_visit_first_trimester.sql @@ -1,5 +1,10 @@ -SELECT DISTINCT ppr.patient_id +/*Nombre de femmes enceintes vues en première visite après leur 1er trimestre*/ +SELECT distinct p.patient_id AS 'Patient Id', p.st_id,p.national_id as 'numéro identité national', p.given_name as prénom, +p.family_name as nom,p.gender as sexe, TIMESTAMPDIFF(YEAR,p.birthdate,now()) as Âge, +p.last_visit_date as 'Dernière date' FROM isanteplus.patient_pregnancy ppr +INNER JOIN isanteplus.patient p +ON ppr.patient_id = p.patient_id INNER JOIN isanteplus.patient_menstruation pm ON pm.patient_id=ppr.patient_id INNER JOIN isanteplus.visit_type vt diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientScreenedNegativeAgainstTbWithNoProphylaxis.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientScreenedNegativeAgainstTbWithNoProphylaxis.sql new file mode 100644 index 00000000..55c8ae2c --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientScreenedNegativeAgainstTbWithNoProphylaxis.sql @@ -0,0 +1,27 @@ +/*Patients dépistés négatifs pour la TB n’ayant pas reçu de prophylaxie*/ +select DISTINCT p.patient_id AS 'Patient Id', +p.st_id as 'NO. de patient attribué par le site', +p.national_id as 'Numéro d\'identité national', +p.given_name as Prénom,p.family_name as Nom, p.gender as Sexe, +DATE_FORMAT(p.birthdate, "%d-%m-%Y") as 'Date de naissance', +TIMESTAMPDIFF(YEAR, p.birthdate,DATE(now())) as Age, +asl.name_fr as 'Statut du patient', p.last_address as Adresse, + p.telephone as Téléphone,p.mother_name as Contact +FROM isanteplus.patient p, isanteplus.patient_status_arv ps,isanteplus.arv_status_loockup asl, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B, + openmrs.obs o + WHERE p.patient_id = ps.patient_id + AND ps.id_status = asl.id + AND ps.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND o.concept_id = 1659 AND o.value_coded = 1660 + AND o.person_id NOT IN (SELECT ob.person_id FROM openmrs.obs ob + WHERE ob.concept_id IN (162320,163284) AND ob.voided <> 1 + AND ob.value_datetime IS NOT NULL) + AND p.voided <> 1 + AND o.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientStartingArv.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientStartingArv.sql index 937e7319..4495c9f0 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientStartingArv.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientStartingArv.sql @@ -1,7 +1,7 @@ /*Liste des patients ayant démarré un régime ARV*/ select distinct p.patient_id AS 'Patient Id', ifnull(DATE(pdis.dispensation_date),DATE(pdis.visit_date)) as 'Date initiation ARV',p.st_id as 'NO. de patient attribué par le site', p.national_id as 'Numéro d\'identité national',p.given_name as Nom, -p.family_name as Prénom, p.gender AS Sexe, TIMESTAMPDIFF(YEAR,p.birthdate,now()) AS Âge +p.family_name as Prénom, p.gender AS Sexe, TIMESTAMPDIFF(YEAR,p.birthdate,now()) AS Âge, DATE_FORMAT(p.birthdate, "%d-%m-%Y") as 'Date de naissance' FROM isanteplus.patient p,isanteplus.patient_dispensing pdis, (SELECT pdp.patient_id,MIN(ifnull(DATE(pdp.dispensation_date),DATE(pdp.visit_date))) as visit_date FROM isanteplus.patient_dispensing pdp WHERE pdp.arv_drug = 1065 AND pdp.voided <> 1 GROUP BY 1) B WHERE p.patient_id=pdis.patient_id diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientWithIncompleteProphylaxisAgainstTb.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientWithIncompleteProphylaxisAgainstTb.sql new file mode 100644 index 00000000..0002cfc3 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientWithIncompleteProphylaxisAgainstTb.sql @@ -0,0 +1,28 @@ +/*Patients avec Prophylaxie incomplète contre la TB*/ +select DISTINCT p.patient_id AS 'Patient Id', +p.st_id as 'NO. de patient attribué par le site', +p.national_id as 'Numéro d\'identité national', +p.given_name as Prénom,p.family_name as Nom, p.gender as Sexe, +DATE_FORMAT(p.birthdate, "%d-%m-%Y") as 'Date de naissance', +TIMESTAMPDIFF(YEAR, p.birthdate,DATE(now())) as Age, +asl.name_fr as 'Statut du patient', p.last_address as Adresse, + p.telephone as Téléphone,p.mother_name as Contact +FROM isanteplus.patient p, isanteplus.patient_status_arv ps,isanteplus.arv_status_loockup asl, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B, + openmrs.obs o + WHERE p.patient_id = ps.patient_id + AND ps.id_status = asl.id + AND ps.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND o.concept_id = 162320 + AND DATE_ADD(DATE(o.value_datetime),INTERVAL 6 MONTH) BETWEEN :startDate AND :endDate + AND o.person_id NOT IN (SELECT ob.person_id FROM openmrs.obs ob + WHERE ob.concept_id = 163284 AND ob.voided <> 1 + AND DATE(ob.value_datetime) BETWEEN :startDate AND :endDate) + AND p.voided <> 1 + AND o.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patient_with_finger_print.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patient_with_finger_print.sql new file mode 100644 index 00000000..9b441842 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patient_with_finger_print.sql @@ -0,0 +1,14 @@ +select DISTINCT p.patient_id AS 'Patient Id', +p.st_id as 'Code ST',p.national_id as 'Code national', +p.given_name as Prénom,p.family_name as Nom, p.gender as Sexe, +DATE_FORMAT(p.birthdate, "%d-%m-%Y") as 'Date de naissance', +TIMESTAMPDIFF(YEAR, p.birthdate,DATE(now())) as Age, +DATE_FORMAT(pid.date_created, "%d-%m-%Y") as 'Date Empreinte', p.last_address as Adresse, +p.telephone as Téléphone,p.mother_name as Contact +FROM openmrs.patient_identifier_type ptype,openmrs.patient_identifier pid, +isanteplus.patient p +WHERE ptype.patient_identifier_type_id = pid.identifier_type +AND p.patient_id = pid.patient_id +AND ptype.uuid = 'e26ca279-8f57-44a5-9ed8-8cc16e90e559' +AND pid.voided <> 1 +AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithMultipleARTRegimens.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithMultipleARTRegimens.sql index 3d1ea24c..508b76e7 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithMultipleARTRegimens.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithMultipleARTRegimens.sql @@ -1,5 +1,5 @@ /*Les patients ayant de multiples régimes VIH prescrits / distribués le même jour*/ -select distinct p.patient_id AS 'Patient Id', f.name as Fiche, pa.st_id as 'Code ST', pa.national_id as 'Code national', pa.given_name as Prénom, +select distinct pa.patient_id AS 'Patient Id', f.name as Fiche, pa.st_id as 'Code ST', pa.national_id as 'Code national', pa.given_name as Prénom, pa.family_name as Nom, pa.gender as Sexe, TIMESTAMPDIFF(YEAR, pa.birthdate,DATE(now())) as Âge, pa.mother_name as 'Nom de la mère', pa.telephone as Téléphone, pa.visit_date as 'Date visite' FROM openmrs.encounter en, openmrs.form f, diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithTbDiagnosticWithoutTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithTbDiagnosticWithoutTreatment.sql index 0a1754e0..e839396b 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithTbDiagnosticWithoutTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patientsWithTbDiagnosticWithoutTreatment.sql @@ -9,7 +9,7 @@ ON pdiag.patient_id=p.patient_id WHERE (pdiag.tb_diag = 1 OR pdiag.mdr_tb_diag = 1 OR tb_pulmonaire = 1 OR tb_multiresistante = 1 OR tb_extrapul_ou_diss = 1) AND pdiag.patient_id NOT IN (SELECT ppr.patient_id FROM isanteplus.patient_prescription ppr WHERE ((ppr.drug_id IN (75948,82900,767,84360,78280) AND (ppr.rx_or_prophy <> 163768 OR ppr.rx_or_prophy is null) AND DATE(ppr.visit_date) between :startDate AND :endDate))) -AND pdiag.status_tb_treatment <> 1 +AND (pdiag.status_tb_treatment <> 1 OR pdiag.status_tb_treatment IS NULL) AND pdiag.voided <> 1 AND DATE(pdiag.visit_date) between :startDate AND :endDate ORDER BY 2 ASC; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_confirm_covid19.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_confirm_covid19.sql new file mode 100644 index 00000000..ad4e3126 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_confirm_covid19.sql @@ -0,0 +1,9 @@ +select distinct p.patient_id AS 'Patient Id', p.st_id as 'NO. de patient attribué par le site', +p.national_id as 'Numéro d\'identité national',p.given_name as Nom, +p.family_name as Prénom, p.birthdate as 'Date de naissance' +FROM isanteplus.patient p, isanteplus.patient_diagnosis pdiag +WHERE p.patient_id = pdiag.patient_id +AND pdiag.concept_id = 1284 +AND pdiag.answer_concept_id = 155762 +AND pdiag.suspected_confirmed = 159392 +AND DATE(pdiag.encounter_date) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_diagnose_for_covid19.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_diagnose_for_covid19.sql new file mode 100644 index 00000000..a4673df0 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_diagnose_for_covid19.sql @@ -0,0 +1,8 @@ +select distinct p.patient_id AS 'Patient Id', p.st_id as 'NO. de patient attribué par le site', +p.national_id as 'Numéro d\'identité national',p.given_name as Nom, +p.family_name as Prénom, p.birthdate as 'Date de naissance' +FROM isanteplus.patient p, isanteplus.patient_diagnosis pdiag +WHERE p.patient_id = pdiag.patient_id +AND pdiag.concept_id = 1284 +AND pdiag.answer_concept_id = 155762 +AND DATE(pdiag.encounter_date) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_suspected_covid19.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_suspected_covid19.sql new file mode 100644 index 00000000..aa7b87a2 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_suspected_covid19.sql @@ -0,0 +1,9 @@ +select distinct p.patient_id AS 'Patient Id', p.st_id as 'NO. de patient attribué par le site', +p.national_id as 'Numéro d\'identité national',p.given_name as Nom, +p.family_name as Prénom, p.birthdate as 'Date de naissance' +FROM isanteplus.patient p, isanteplus.patient_diagnosis pdiag +WHERE p.patient_id = pdiag.patient_id +AND pdiag.concept_id = 1284 +AND pdiag.answer_concept_id = 155762 +AND pdiag.suspected_confirmed = 159393 +AND DATE(pdiag.encounter_date) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_vaccinated_for_covid_19.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_vaccinated_for_covid_19.sql new file mode 100644 index 00000000..d25fe8d1 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_vaccinated_for_covid_19.sql @@ -0,0 +1,14 @@ +select distinct p.patient_id AS 'Patient Id', p.st_id as 'NO. de patient attribué par le site', +p.national_id as 'Numéro d\'identité national',p.given_name as Nom, +p.family_name as Prénom, p.birthdate as 'Date de naissance', p.telephone AS Téléphone,cn.name AS 'Nom du vaccin' +FROM isanteplus.patient p, isanteplus.patient_immunization pim, openmrs.concept c, +openmrs.concept_name cn +WHERE p.patient_id = pim.patient_id +AND c.concept_id = cn.concept_id +AND pim.vaccine_concept_id = c.concept_id +AND cn.locale = "en" +AND cn.locale_preferred = 1 +AND pim.vaccine_uuid IN ("166156AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","166154AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "166155AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","166157AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "166249AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","166355AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") +AND DATE(pim.vaccine_date) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_with_activity_after_disc_by_month.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_with_activity_after_disc_by_month.sql new file mode 100644 index 00000000..54f4bc80 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/patients_with_activity_after_disc_by_month.sql @@ -0,0 +1,28 @@ +/*Patients (VIH) avec activité après discontinuation pour le mois*/ +select distinct p.patient_id AS 'Patient Id', p.identifier as Identifiant, p.st_id as 'No. de patient attribué par le site', p.national_id as 'No. d\'identité nationale', +p.family_name as Nom,p.given_name as Prénom, DATE_FORMAT(MAX(DATE(en.encounter_datetime)), "%d-%m-%Y") as 'Date de discontinuation', +DATE_FORMAT(MAX(DATE(enc.encounter_datetime)),"%d-%m-%Y") as 'Dernière date', entype.name +from isanteplus.patient p, + openmrs.encounter enc, openmrs.encounter_type entype, openmrs.encounter en, + (select e.patient_id, MAX(e.encounter_datetime) as encounter_date FROM openmrs.encounter e, openmrs.encounter_type et + WHERE e.encounter_type=et.encounter_type_id AND et.uuid = '9d0113c6-f23a-4461-8428-7e9a7344f2ba' AND e.voided <> 1 + AND DATE(e.encounter_datetime) < :endDate GROUP BY 1) B +WHERE p.patient_id=enc.patient_id +AND enc.encounter_type=entype.encounter_type_id +AND enc.patient_id=en.patient_id +AND en.patient_id = B.patient_id +AND en.encounter_datetime = B.encounter_date +AND p.vih_status=1 +AND p.voided <> 1 +AND en.voided <> 1 +AND enc.voided <> 1 +AND en.encounter_type=(select encounter_type_id FROM openmrs.encounter_type enct +WHERE enct.uuid='9d0113c6-f23a-4461-8428-7e9a7344f2ba') +AND DATE(enc.encounter_datetime) > DATE(en.encounter_datetime) +AND enc.patient_id NOT IN (SELECT e.patient_id FROM openmrs.encounter e, openmrs.encounter_type et + WHERE e.encounter_type = et.encounter_type_id AND et.uuid IN + ('12f4d7c3-e047-4455-a607-47a40fe32460','a5600919-4dde-4eb8-a45b-05c204af8284', +'709610ff-5e39-4a47-9c27-a60e740b0944','fdb5b14f-555f-4282-b4c1-9286addf0aae', +'1dd1e63a-1543-4885-b807-e49c6d18cffd')) +AND DATE(enc.encounter_datetime) BETWEEN :startDate AND :endDate +GROUP BY p.patient_id; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextFourteenDays.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextFourteenDays.sql index 986bd398..6dfdae09 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextFourteenDays.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextFourteenDays.sql @@ -1,9 +1,16 @@ +/* Patient avec Rendez-Vous programmé dans les 14 jours à venir */ select DISTINCT pa.patient_id AS 'Patient Id', pa.st_id as 'NO. de patient attribué par le site', pa.national_id as 'No. d\'identité nationale',pa.given_name as Prénom, pa.family_name as Nom, pa.gender as Sexe,TIMESTAMPDIFF(YEAR, pa.birthdate,DATE(now())) as Âge, pa.telephone as Telephone,f.name as 'fiches', asl.name_fr as 'Statut du patient', DATE_FORMAT(pv.visit_date, "%d-%m-%Y") as 'Date visite', DATE_FORMAT(pv.next_visit_date, "%d-%m-%Y") as 'Prochaine visite' -from isanteplus.patient pa, isanteplus.patient_visit pv, openmrs.form f, isanteplus.arv_status_loockup asl +from isanteplus.patient pa, isanteplus.patient_visit pv, openmrs.form f, isanteplus.arv_status_loockup asl, +(SELECT pvi.patient_id,MAX(DATE(pvi.next_visit_date)) +as next_visit_date, pvi.form_id FROM isanteplus.patient_visit pvi +WHERE pvi.next_visit_date between date(now()) and date_add(date(now()),interval 14 day) GROUP BY 1,3) B where pa.patient_id=pv.patient_id AND pv.form_id=f.form_id and pa.arv_status = asl.id +AND pv.patient_id = B.patient_id +AND DATE(pv.next_visit_date) = B.next_visit_date +AND pv.form_id = B.form_id and pv.next_visit_date between date(now()) and date_add(date(now()),interval 14 day) UNION @@ -12,10 +19,17 @@ select DISTINCT pa.patient_id AS 'Patient Id', pa.st_id as 'NO. de patient attri pa.given_name as Prénom, pa.family_name as Nom, pa.gender as Sexe,TIMESTAMPDIFF(YEAR, pa.birthdate,DATE(now())) as Âge, pa.telephone as Telephone,f.name as 'fiches', asl.name_fr as 'Statut du patient',DATE_FORMAT(DATE(pd.visit_date), "%d-%m-%Y") as 'Date visite', DATE_FORMAT(pd.next_dispensation_date, "%d-%m-%Y") as 'Prochaine visite' -from isanteplus.patient pa, isanteplus.patient_dispensing pd, openmrs.encounter enc, openmrs.form f, isanteplus.arv_status_loockup asl +from isanteplus.patient pa, isanteplus.patient_dispensing pd, openmrs.encounter enc, openmrs.form f, isanteplus.arv_status_loockup asl, +(SELECT pdisp.patient_id, MAX(DATE(pdisp.next_dispensation_date)) AS next_dispensation_date, fo.form_id +FROM isanteplus.patient_dispensing pdisp, openmrs.encounter e, openmrs.form fo +WHERE pdisp.encounter_id = e.encounter_id AND e.form_id = fo.form_id +AND pdisp.next_dispensation_date between date(now()) and date_add(date(now()),interval 14 day) GROUP BY 1,3) C where pa.patient_id=pd.patient_id AND pd.encounter_id=enc.encounter_id AND enc.form_id=f.form_id +AND pd.patient_id = C.patient_id +AND DATE(pd.next_dispensation_date) = C.next_dispensation_date +AND enc.form_id = C.form_id AND pa.arv_status = asl.id and pd.next_dispensation_date between date(now()) and date_add(date(now()),interval 14 day) ORDER BY 12 \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextSevenDays.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextSevenDays.sql index fa9c0b7b..e7d813ea 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextSevenDays.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/visitNextSevenDays.sql @@ -1,9 +1,17 @@ +/*Patient avec Rendez-Vous programmé dans les 7 jours à venir */ + select DISTINCT pa.patient_id AS 'Patient Id',pa.st_id as 'NO. de patient attribué par le site', pa.national_id as 'No. d\'identité nationale', pa.given_name as Prénom, pa.family_name as Nom, pa.gender as Sexe,TIMESTAMPDIFF(YEAR, pa.birthdate,DATE(now())) as Âge, pa.telephone as Telephone,f.name as 'fiches', asl.name_fr as 'Statut du patient', DATE_FORMAT(pv.visit_date, "%d-%m-%Y") as 'Date visite', DATE_FORMAT(pv.next_visit_date, "%d-%m-%Y") as 'Prochaine visite' -from isanteplus.patient pa, isanteplus.patient_visit pv, openmrs.form f, isanteplus.arv_status_loockup asl +from isanteplus.patient pa, isanteplus.patient_visit pv, openmrs.form f, isanteplus.arv_status_loockup asl, +(SELECT pvi.patient_id,MAX(DATE(pvi.next_visit_date)) +as next_visit_date, pvi.form_id FROM isanteplus.patient_visit pvi +WHERE pvi.next_visit_date between date(now()) and date_add(date(now()),interval 7 day) GROUP BY 1,3) B where pa.patient_id=pv.patient_id AND pv.form_id=f.form_id and pa.arv_status = asl.id +AND pv.patient_id = B.patient_id +AND DATE(pv.next_visit_date) = B.next_visit_date +AND pv.form_id = B.form_id and pv.next_visit_date between date(now()) and date_add(date(now()),interval 7 day) UNION @@ -12,10 +20,17 @@ select DISTINCT pa.patient_id AS 'Patient Id', pa.st_id as 'NO. de patient attri pa.given_name as Prénom, pa.family_name as Nom, pa.gender as Sexe,TIMESTAMPDIFF(YEAR, pa.birthdate,DATE(now())) as Âge, pa.telephone as Telephone,f.name as 'fiches', asl.name_fr as 'Statut du patient',DATE_FORMAT(DATE(pd.visit_date), "%d-%m-%Y") as 'Date visite', DATE_FORMAT(pd.next_dispensation_date, "%d-%m-%Y") as 'Prochaine visite' -from isanteplus.patient pa, isanteplus.patient_dispensing pd, openmrs.encounter enc, openmrs.form f, isanteplus.arv_status_loockup asl +from isanteplus.patient pa, isanteplus.patient_dispensing pd, openmrs.encounter enc, openmrs.form f, isanteplus.arv_status_loockup asl, +(SELECT pdisp.patient_id, MAX(DATE(pdisp.next_dispensation_date)) AS next_dispensation_date, fo.form_id +FROM isanteplus.patient_dispensing pdisp, openmrs.encounter e, openmrs.form fo +WHERE pdisp.encounter_id = e.encounter_id AND e.form_id = fo.form_id +AND pdisp.next_dispensation_date between date(now()) and date_add(date(now()),interval 7 day) GROUP BY 1,3) C where pa.patient_id=pd.patient_id AND pd.encounter_id=enc.encounter_id AND enc.form_id=f.form_id +AND pd.patient_id = C.patient_id +AND DATE(pd.next_dispensation_date) = C.next_dispensation_date +AND enc.form_id = C.form_id AND pa.arv_status = asl.id and pd.next_dispensation_date between date(now()) and date_add(date(now()),interval 7 day) ORDER BY 12 \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/womenEnrolledBecamePregnant.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/womenEnrolledBecamePregnant.sql index 5f96d6bb..32f4e2db 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/womenEnrolledBecamePregnant.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/fullDataExports/womenEnrolledBecamePregnant.sql @@ -1,6 +1,6 @@ /*Nombre de femmes VIH(+) enrôlées en soins devenues enceintes*/ /*Number of HIV-positive women enrolled in care who became pregnant*/ -select DISTINCT p.patient_id AS 'Patient Id', p.national_id as 'No. d\'identité nationale', p.identifier as 'iSantéPlus ID',p.given_name as Prénom, +select DISTINCT p.patient_id AS 'Patient Id',p.st_id as 'NO. de patient attribué par le site', p.national_id as 'No. d\'identité nationale',p.given_name as Prénom, p.family_name as Nom, p.gender as Sexe,TIMESTAMPDIFF(YEAR, p.birthdate,DATE(now())) as Âge, p.telephone as Téléphone from isanteplus.patient_pregnancy ppr LEFT OUTER JOIN isanteplus.patient_laboratory plab diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/childrenRegularlyFollowedOnArt.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/childrenRegularlyFollowedOnArt.sql index d7cc2752..77dd4f54 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/childrenRegularlyFollowedOnArt.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/childrenRegularlyFollowedOnArt.sql @@ -1,15 +1,15 @@ SELECT - COUNT( DISTINCT CASE WHEN ( + COUNT(DISTINCT CASE WHEN ( p.gender = 'F' AND ( - pv.visit_date BETWEEN DATE_SUB(:currentDate, INTERVAL :period MONTH) AND :currentDate AND pv.encounter_type IN (9,10) -- Paeds initial and followup encounter types + pv.visit_date BETWEEN DATE_SUB(:currentDate, INTERVAL :period MONTH) AND :currentDate AND pv.encounter_type IN (9,10) -- Paeds initial and followup encounter types OR ( -- Pediatric Rx pp.visit_date BETWEEN DATE_SUB(:currentDate, INTERVAL :period MONTH) AND :currentDate ) ) ) THEN p.patient_id else null END ) AS 'femaleNumerator', - COUNT( DISTINCT CASE WHEN ( + COUNT(DISTINCT CASE WHEN ( p.gender = 'M' AND ( pv.visit_date BETWEEN DATE_SUB(:currentDate, INTERVAL :period MONTH) AND :currentDate AND pv.encounter_type IN (9,10) -- Paeds initial and followup encounter types diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/children_regularly_followed_on_art_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/children_regularly_followed_on_art_num.sql index 63ebc83f..47229166 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/children_regularly_followed_on_art_num.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/children_regularly_followed_on_art_num.sql @@ -2,20 +2,22 @@ SELECT p.patient_id FROM isanteplus.patient p - INNER JOIN isanteplus.patient_on_arv poa -- patient on arv + INNER JOIN isanteplus.patient_on_arv poa ON p.patient_id = poa.patient_id - INNER JOIN isanteplus.health_qual_patient_visit pv -- pediatric first visit + INNER JOIN isanteplus.health_qual_patient_visit pv ON p.patient_id = pv.patient_id + INNER JOIN openmrs.encounter_type et + ON pv.encounter_type = et.encounter_type_id LEFT JOIN isanteplus.patient_prescription pp ON poa.patient_id = pp.patient_id WHERE - p.vih_status = '1' -- HIV+ patient - AND p.patient_id NOT IN ( -- excluding  + p.vih_status = 1 + AND p.patient_id NOT IN ( SELECT discon.patient_id FROM isanteplus.discontinuation_reason discon WHERE discon.reason IN (159,1667,159492) ) - AND poa.patient_id NOT IN ( -- negative PCR result + AND poa.patient_id NOT IN ( SELECT plab.patient_id FROM isanteplus.patient_laboratory plab WHERE @@ -23,8 +25,9 @@ WHERE AND plab.test_id = 844 AND plab.test_result = 1302 ) - AND pv.age_in_years <= 14 -- An child - AND pv.visit_date BETWEEN DATE_SUB(:currentDate, INTERVAL :period MONTH) AND :currentDate AND pv.encounter_type IN (9,10) -- Paeds initial and followup encounter types - OR ( -- Pediatric Rx - pp.visit_date BETWEEN DATE_SUB(:currentDate, INTERVAL :period MONTH) AND :currentDate - ); \ No newline at end of file + AND pv.age_in_years <= 14 + /* AND DATE(pv.visit_date) BETWEEN SUBDATE(now(), INTERVAL :period MONTH) AND now()*/ + AND et.uuid IN('349ae0b4-65c1-4122-aa06-480f186c8350','33491314-c352-42d0-bd5d-a9d0bffc9bf1') + /* OR ( + DATE(pp.visit_date) BETWEEN DATE_SUB(DATE(now()), INTERVAL :period MONTH) AND DATE(:currentDate) + );*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_den.sql index afb9a812..0e9740c7 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_den.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_den.sql @@ -20,7 +20,7 @@ WHERE FROM isanteplus.patient_dispensing pd WHERE pd.drug_id IN ( SELECT arvd.drug_id FROM isanteplus.arv_drugs arvd) - AND pd.dispensation_date <= DATE_SUB(:endDateDate, INTERVAL 6 MONTH) + AND pd.dispensation_date <= DATE_SUB(:endDate, INTERVAL 6 MONTH) ) AND ( p.patient_id IN ( SELECT pv.patient_id diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_num.sql index 517666de..177db746 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_num.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_undetectable_viral_load_test_6_months_num.sql @@ -20,7 +20,7 @@ WHERE FROM isanteplus.patient_dispensing pd WHERE pd.drug_id IN ( SELECT arvd.drug_id FROM isanteplus.arv_drugs arvd) - AND pd.dispensation_date <= DATE_SUB(:endDateDate, INTERVAL 6 MONTH) + AND pd.dispensation_date <= DATE_SUB(:endDate, INTERVAL 6 MONTH) ) AND ( p.patient_id IN ( SELECT pv.patient_id diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_den.sql index 6ee3fe34..acda4759 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_den.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_den.sql @@ -31,7 +31,7 @@ WHERE OR p.patient_id IN ( SELECT plab.patient_id FROM isanteplus.patient_laboratory plab - WHERE DATE(plab.visit_date) BETWEEN :startdate AND :endDate + WHERE DATE(plab.visit_date) BETWEEN :startDate AND :endDate ) ) diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_num.sql index acbf9741..ddb69e33 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_num.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_on_art_viral_load_test6_months_num.sql @@ -31,7 +31,7 @@ WHERE OR p.patient_id IN ( SELECT plab.patient_id FROM isanteplus.patient_laboratory plab - WHERE DATE(plab.visit_date) BETWEEN :startdate AND :endDate + WHERE DATE(plab.visit_date) BETWEEN :startDate AND :endDate ) ) diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_women_using_family_planning_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_women_using_family_planning_num.sql index 2c18cfcc..e61dbac2 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_women_using_family_planning_num.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/proportion_of_hiv_women_using_family_planning_num.sql @@ -17,7 +17,7 @@ WHERE FROM isanteplus.discontinuation_reason discon WHERE discon.reason IN (159,1667,159492) ) - p.patient_id IN ( + AND p.patient_id IN ( SELECT pv.patient_id FROM isanteplus.health_qual_patient_visit pv WHERE pv.family_planning_method_used is true AND pv.visit_date BETWEEN :startDate AND :endDate diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retentionOfPatientsOnArt.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retentionOfPatientsOnArt.sql index 66329573..6b428fea 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retentionOfPatientsOnArt.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retentionOfPatientsOnArt.sql @@ -2,24 +2,14 @@ SELECT COUNT( DISTINCT CASE WHEN ( p.gender = 'F' - -- drug order form completed on date X. The date of the drug order form should not surpass the reporting period by more than 90 days. - AND p.patient_id IN ( SELECT pnv.patient_id FROM isanteplus.health_qual_patient_visit pnv - WHERE pnv.patient_id = p.patient_id - AND pnv.encounter_type IN (5, 11) -- Ord. Médicale OR Ord. médicale Pédiatrique - AND (pnv.visit_date BETWEEN DATE(:currentDate) AND DATE_ADD(DATE(:currentDate), INTERVAL 90 DAY) - OR pnv.visit_date BETWEEN DATE_SUB(DATE(:currentDate), INTERVAL 90 DAY) AND DATE(:currentDate))) + AND p.patient_id = C.patient_id AND arv.start_date BETWEEN SUBDATE(:currentDate, INTERVAL :period MONTH) AND :currentDate ) THEN p.patient_id ELSE null END ) AS 'femaleNumerator', COUNT( DISTINCT CASE WHEN ( p.gender = 'M' - -- drug order form completed on date X. The date of the drug order form should not surpass the reporting period by more than 90 days. - AND p.patient_id IN ( SELECT pnv.patient_id FROM isanteplus.health_qual_patient_visit pnv - WHERE pnv.patient_id = p.patient_id - AND pnv.encounter_type IN (5, 11) -- Ord. Médicale OR Ord. médicale Pédiatrique - AND (pnv.visit_date BETWEEN DATE(:currentDate) AND DATE_ADD(DATE(:currentDate), INTERVAL 90 DAY) - OR pnv.visit_date BETWEEN DATE_SUB(DATE(:currentDate), INTERVAL 90 DAY) AND DATE(:currentDate))) + AND p.patient_id = C.patient_id AND arv.start_date BETWEEN SUBDATE(:currentDate, INTERVAL :period MONTH) AND :currentDate ) THEN p.patient_id ELSE null END ) AS 'maleNumerator', @@ -35,11 +25,16 @@ SELECT ) AS 'maleDenominator' FROM isanteplus.patient p LEFT JOIN isanteplus.patient_dispensing pd ON p.patient_id = pd.patient_id + INNER JOIN (SELECT drug_id FROM isanteplus.arv_drugs) B ON pd.drug_id = B.drug_id INNER JOIN isanteplus.patient_status_arv arv ON p.patient_id = arv.patient_id -WHERE pd.drug_id IN (SELECT drug_id FROM isanteplus.arv_drugs) -- ART treatment - AND p.vih_status = '1' -- HIV+ patient - AND p.patient_id NOT IN ( -- Exclude discontinued (1667), transfer (159492) + LEFT JOIN ( SELECT pnv.patient_id FROM isanteplus.health_qual_patient_visit pnv + WHERE pnv.encounter_type IN (5, 11) + AND (pnv.visit_date BETWEEN DATE(:currentDate) AND DATE_ADD(DATE(:currentDate), INTERVAL 90 DAY) + OR pnv.visit_date BETWEEN DATE_SUB(DATE(:currentDate), INTERVAL 90 DAY) AND DATE(:currentDate))) C + ON p.patient_id = C.patient_id +WHERE p.vih_status = '1' + AND p.patient_id NOT IN ( SELECT discon.patient_id FROM isanteplus.discontinuation_reason discon WHERE discon.reason IN (1667, 159492) - ) AND TIMESTAMPDIFF(YEAR, p.birthdate, :currentDate) > 14; -- adult + ) AND TIMESTAMPDIFF(YEAR, p.birthdate, :currentDate) > 14; diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_den.sql index 5d483a3b..b5c7d353 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_den.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_den.sql @@ -3,8 +3,8 @@ SELECT FROM isanteplus.patient p LEFT JOIN isanteplus.patient_dispensing pd ON p.patient_id = pd.patient_id INNER JOIN isanteplus.patient_status_arv arv ON p.patient_id = arv.patient_id -WHERE pd.drug_id IN (SELECT drug_id FROM isanteplus.arv_drugs) -- ART treatment - AND p.vih_status = '1' -- HIV+ patient + INNER JOIN (SELECT drug_id FROM isanteplus.arv_drugs) B ON pd.drug_id = B.drug_id +WHERE p.vih_status = '1' -- HIV+ patient AND p.patient_id NOT IN ( -- Exclude discontinued (1667), transfer (159492) SELECT discon.patient_id FROM isanteplus.discontinuation_reason discon diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_num.sql index d673905d..a3c73dfd 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_num.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/healthQualReports/retention_of_patients_on_art_num.sql @@ -3,8 +3,8 @@ SELECT FROM isanteplus.patient p LEFT JOIN isanteplus.patient_dispensing pd ON p.patient_id = pd.patient_id INNER JOIN isanteplus.patient_status_arv arv ON p.patient_id = arv.patient_id -WHERE pd.drug_id IN (SELECT drug_id FROM isanteplus.arv_drugs) -- ART treatment - AND p.vih_status = '1' -- HIV+ patient + INNER JOIN (SELECT drug_id FROM isanteplus.arv_drugs) B ON pd.drug_id = B.drug_id +WHERE p.vih_status = '1' -- HIV+ patient AND p.patient_id NOT IN ( -- Exclude discontinued (1667), transfer (159492) SELECT discon.patient_id FROM isanteplus.discontinuation_reason discon diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtCompletedTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtCompletedTbTreatment.sql index da4d7e49..0ac5c7a0 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtCompletedTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtCompletedTbTreatment.sql @@ -1,16 +1,25 @@ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd , isanteplus.patient_on_art pat ,(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p, isanteplus.patient_dispensing pd, +isanteplus.patient_on_art pat, +(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date + FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 78280 + AND pd.rx_or_prophy = 163768 GROUP BY 1) B, openmrs.obs o WHERE p.patient_id = pd.patient_id AND p.patient_id = pat.patient_id - AND p.transferred_in = 0 - AND p.patient_id = B.patient_id + AND p.patient_id = B.patient_id + AND o.person_id = pd.patient_id + AND pd.visit_date = B.min_vist_date + AND (p.transferred_in <> 1 OR p.transferred_in IS NULL) AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL - AND pd.visit_date = B.min_vist_date AND p.date_started_arv < :startDate AND pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) >= 6 AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) < 7 - AND pat.date_completed_preventive_tb_treatment BETWEEN :startDate AND :endDate - AND p.voided = 0; \ No newline at end of file + AND o.concept_id IN(159431,1659) + AND (o.value_datetime IS NOT NULL OR o.value_coded = 1663) + AND IFNULL(DATE(o.value_datetime),DATE(o.obs_datetime)) BETWEEN :startDate AND :endDate + AND o.voided <> 1 + AND pd.voided <> 1 + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesNegative.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesNegative.sql index eeb7d958..3caefc2d 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesNegative.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesNegative.sql @@ -1,10 +1,27 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat,isanteplus.patient p, +(select psa.patient_id, MAX(DATE(psa.date_started_status)) AS date_status +FROM isanteplus.patient_status_arv psa WHERE +DATE(psa.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B, +openmrs.obs o,(SELECT ob.person_id as patient_id, + MAX(DATE(ob.obs_datetime)) AS obs_datetime + FROM openmrs.obs ob WHERE ob.concept_id = 1659 + AND ob.value_coded IN (1660,142177) + AND TIMESTAMPDIFF(MONTH,DATE(ob.obs_datetime),:endDate) <= 6 GROUP BY 1) C WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id AND ps.id_status IN (6,8) - AND p.date_started_arv < :startDate - AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.tb_screened =1 + AND p.date_started_arv < :startDate + AND ps.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND o.person_id = C.patient_id + AND DATE(o.obs_datetime) = DATE(C.obs_datetime) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND o.concept_id = 1659 AND o.value_coded = 1660 + AND TIMESTAMPDIFF(MONTH,DATE(o.obs_datetime),:endDate) <= 6 + /*AND pat.tb_screened =1 AND pat.tb_status = 'NEGATIVE' - AND TIMESTAMPDIFF(MONTH,pat.date_tb_screened ,:endDate) <= 6 ; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH,pat.date_tb_screened ,:endDate) <= 6*/ + AND p.voided <> 1 + AND o.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesPostive.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesPostive.sql index 4247fa46..eb509b24 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesPostive.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtScreeneesPostive.sql @@ -1,10 +1,27 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +isanteplus.patient p, (select psa.patient_id, MAX(DATE(psa.date_started_status)) AS date_status +FROM isanteplus.patient_status_arv psa WHERE +DATE(psa.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B, +openmrs.obs o,(SELECT ob.person_id as patient_id, + MAX(DATE(ob.obs_datetime)) AS obs_datetime + FROM openmrs.obs ob WHERE ob.concept_id = 1659 + AND ob.value_coded IN (1660,142177) + AND TIMESTAMPDIFF(MONTH,DATE(ob.obs_datetime),:endDate) <= 6 GROUP BY 1) C WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id AND ps.id_status IN (6,8) - AND p.date_started_arv < :startDate - AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.tb_screened =1 + AND p.date_started_arv < :startDate + AND ps.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND o.person_id = C.patient_id + AND DATE(o.obs_datetime) = DATE(C.obs_datetime) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + /* AND pat.tb_screened =1 AND pat.tb_status = 'POSTIVE' - AND TIMESTAMPDIFF(MONTH,pat.date_tb_screened ,:endDate) <= 6 ; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH,pat.date_tb_screened ,:endDate) <= 6 */ + AND o.concept_id = 1659 AND o.value_coded = 142177 + AND TIMESTAMPDIFF(MONTH,DATE(o.obs_datetime),:endDate) <= 6 + AND p.voided <> 1 + AND o.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatment.sql index f41d8b72..36ca7d4e 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatment.sql @@ -1,13 +1,17 @@ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd ,(SELECT pd.patient_id, MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p,isanteplus.patient_dispensing pd, +(SELECT pd.patient_id, MIN(pd.visit_date) AS min_vist_date +FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 78280 +AND pd.rx_or_prophy = 163768 GROUP BY 1) B WHERE p.patient_id = pd.patient_id - AND p.transferred_in = 0 - AND p.patient_id = B.patient_id + AND (p.transferred_in <> 1 OR p.transferred_in IS NULL) + AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL AND p.date_started_arv < :startDate - AND pd.drug_id =78280 + AND pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 - AND pd.visit_date = B.min_vist_date + AND DATE(pd.visit_date) = DATE(B.min_vist_date) AND pd.visit_date BETWEEN :startDate AND :endDate - AND p.voided = 0; \ No newline at end of file + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatmentForSixMonths.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatmentForSixMonths.sql index ebb28484..c377941b 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatmentForSixMonths.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/AlreadyOnArtStartedTbTreatmentForSixMonths.sql @@ -1,14 +1,21 @@ +/*6:Nombre de patients sous ARV ayant initié un traitement + * préventif de la TB il y a 6 mois: (TB_PREV D)*/ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd ,(SELECT pd.patient_id, MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p ,isanteplus.patient_dispensing pd, +(SELECT pd.patient_id, MIN(pd.visit_date) AS min_vist_date +FROM isanteplus.patient_dispensing pd +WHERE pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B WHERE p.patient_id = pd.patient_id - AND p.transferred_in = 0 + AND (p.transferred_in <> 1 OR p.transferred_in IS NULL) AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL - AND pd.visit_date = B.min_vist_date - AND p.date_started_arv < :startDate + AND DATE(pd.visit_date) = DATE(B.min_vist_date) + /*AND p.date_started_arv < :startDate*/ + AND TIMESTAMPDIFF(MONTH,p.date_started_arv,:endDate) > 6 AND pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) >= 6 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) < 7 - AND p.voided = 0; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) >= 6 + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) < 7 + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtCompletedTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtCompletedTbTreatment.sql index 3bde72d6..e0683bb1 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtCompletedTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtCompletedTbTreatment.sql @@ -1,16 +1,21 @@ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd , isanteplus.patient_on_art pat ,(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p, isanteplus.patient_dispensing pd, +isanteplus.patient_on_art pat, +(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date +FROM isanteplus.patient_dispensing pd +WHERE pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 GROUP BY 1)B WHERE p.patient_id = pd.patient_id AND p.patient_id = pat.patient_id - AND p.transferred_in = 0 + AND (p.transferred_in IS NULL OR p.transferred_in = 0) AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL - AND pd.visit_date = B.min_vist_date + AND DATE(pd.visit_date) = DATE(B.min_vist_date) AND p.date_started_arv BETWEEN :startDate AND :endDate AND pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) >= 6 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) < 7 + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) >= 6 + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) < 7 AND pat.date_completed_preventive_tb_treatment BETWEEN :startDate AND :endDate - AND p.voided = 0; \ No newline at end of file + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesNegative.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesNegative.sql index b700b2f4..036d104b 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesNegative.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesNegative.sql @@ -1,10 +1,26 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps, isanteplus.patient_on_art pat, +isanteplus.patient p,(SELECT psa.patient_id, +MAX(DATE(psa.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psa + WHERE DATE(psa.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, + (SELECT ob.person_id as patient_id, + MAX(DATE(ob.obs_datetime)) AS obs_datetime + FROM openmrs.obs ob WHERE ob.concept_id = 1659 + AND ob.value_coded IN (1660,142177) + AND TIMESTAMPDIFF(MONTH,DATE(ob.obs_datetime),:endDate) <= 6 GROUP BY 1) C WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id - AND ps.id_status IN (6,8) - AND p.date_started_arv BETWEEN :startDate AND :endDate - AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.tb_screened =1 - AND pat.tb_status = 'NEGATIVE' - AND TIMESTAMPDIFF(MONTH,pat.date_tb_screened ,:endDate) <= 6 ; \ No newline at end of file + AND p.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND o.person_id = C.patient_id + AND DATE(o.obs_datetime) = DATE(C.obs_datetime) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(p.date_started_arv) BETWEEN :startDate AND :endDate + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND o.concept_id = 1659 AND o.value_coded = 1660 + AND TIMESTAMPDIFF(MONTH,DATE(o.obs_datetime),:endDate) <= 6 + AND o.voided <> 1 + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesPostive.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesPostive.sql index 796b3904..1558666e 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesPostive.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtScreeneesPostive.sql @@ -1,10 +1,26 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps, isanteplus.patient_on_art pat, +isanteplus.patient p,(SELECT psa.patient_id, +MAX(DATE(psa.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psa + WHERE DATE(psa.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, + (SELECT ob.person_id as patient_id, + MAX(DATE(ob.obs_datetime)) AS obs_datetime + FROM openmrs.obs ob WHERE ob.concept_id = 1659 + AND ob.value_coded IN (1660,142177) + AND TIMESTAMPDIFF(MONTH,DATE(ob.obs_datetime),:endDate) <= 6 GROUP BY 1) C WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id - AND ps.id_status IN (6,8) - AND p.date_started_arv BETWEEN :startDate AND :endDate - AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.tb_screened =1 - AND pat.tb_status = 'POSTIVE' - AND TIMESTAMPDIFF(MONTH,pat.date_tb_screened ,:endDate) <= 6 ; \ No newline at end of file + AND p.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND o.person_id = C.patient_id + AND DATE(o.obs_datetime) = DATE(C.obs_datetime) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(p.date_started_arv) BETWEEN :startDate AND :endDate + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND o.concept_id = 1659 AND o.value_coded = 142177 + AND TIMESTAMPDIFF(MONTH,DATE(o.obs_datetime),:endDate) <= 6 + AND o.voided <> 1 + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatment.sql index bb842c2b..89bebd8b 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatment.sql @@ -1,7 +1,10 @@ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd ,(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p,isanteplus.patient_dispensing pd, +(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date +FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 78280 +AND pd.rx_or_prophy = 163768 GROUP BY 1) B WHERE p.patient_id = pd.patient_id - AND p.transferred_in = 0 + AND (p.transferred_in = 0 OR p.transferred_in IS NULL) AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL @@ -10,4 +13,5 @@ FROM isanteplus.patient p ,isanteplus.patient_dispensing pd ,(SELECT pd.patient_ AND pd.rx_or_prophy = 163768 AND pd.visit_date = B.min_vist_date AND pd.visit_date BETWEEN :startDate AND :endDate - AND p.voided = 0; \ No newline at end of file + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatmentForSixMonths.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatmentForSixMonths.sql index cfc65017..e8f787b8 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatmentForSixMonths.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/NewlyEnrolledOnArtStartedTbTreatmentForSixMonths.sql @@ -1,14 +1,22 @@ +/*6:Nombre de patients nouvellement sous ARV ayant initié un traitement préventif de la + * TB il y a 6 mois: (TB_PREV D)*/ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd ,(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p,isanteplus.patient_dispensing pd, +(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date +FROM isanteplus.patient_dispensing pd +WHERE pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B WHERE p.patient_id = pd.patient_id - AND p.transferred_in = 0 + AND (p.transferred_in <> 1 OR p.transferred_in IS NULL) AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL - AND pd.visit_date = B.min_vist_date - AND p.date_started_arv BETWEEN :startDate AND :endDate + AND DATE(pd.visit_date) = DATE(B.min_vist_date) + /*AND p.date_started_arv BETWEEN :startDate AND :endDate*/ AND pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) >= 6 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) < 7 - AND p.voided = 0; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) >= 6 + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) < 7 + AND TIMESTAMPDIFF(MONTH,p.date_started_arv,:endDate) >= 6 + AND TIMESTAMPDIFF(MONTH,p.date_started_arv,:endDate) < 7 + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalArvPatientsNewlyPalcedUnderTbTreatmet.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalArvPatientsNewlyPalcedUnderTbTreatmet.sql index fbe5165e..1d848121 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalArvPatientsNewlyPalcedUnderTbTreatmet.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalArvPatientsNewlyPalcedUnderTbTreatmet.sql @@ -1,7 +1,14 @@ +/*10:Patients sous ARV nouvellement placés sous traitement anti-TB: (TX_TB N) */ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +isanteplus.patient p,(SELECT psa.patient_id, + MAX(psa.date_started_status) as date_status + FROM isanteplus.patient_status_arv psa WHERE psa.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)B WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND p.date_started_arv <= :endDate AND ps.date_started_status BETWEEN :startDate AND :endDate diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatienstWithPostiveResultsFromTbDiagnosis.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatienstWithPostiveResultsFromTbDiagnosis.sql index b21af75f..f5e028aa 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatienstWithPostiveResultsFromTbDiagnosis.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatienstWithPostiveResultsFromTbDiagnosis.sql @@ -1,6 +1,11 @@ SELECT pat.patient_id - FROM isanteplus.patient_on_art pat ,isanteplus.patient_status_arv ps + FROM isanteplus.patient_on_art pat,isanteplus.patient_status_arv ps, + (SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE pat.patient_id = ps.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = (B.date_status) AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pat.date_sample_sent_for_diagnositic_tb IS NOT NULL diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsCompletedTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsCompletedTbTreatment.sql index 7d8542fe..bc608781 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsCompletedTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsCompletedTbTreatment.sql @@ -2,7 +2,7 @@ SELECT p.patient_id FROM isanteplus.patient p ,isanteplus.patient_dispensing pd , isanteplus.patient_on_art pat ,(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B WHERE p.patient_id = pd.patient_id AND p.patient_id = pat.patient_id - AND p.transferred_in = 0 + AND (p.transferred_in = 0 OR p.transferred_in IS NULL) AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL @@ -13,4 +13,5 @@ FROM isanteplus.patient p ,isanteplus.patient_dispensing pd , isanteplus.patient AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) >= 6 AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) < 7 AND pat.date_completed_preventive_tb_treatment BETWEEN :startDate AND :endDate - AND p.voided = 0; \ No newline at end of file + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsForTbScreenes.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsForTbScreenes.sql index 08b27fc4..9ae5dd4b 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsForTbScreenes.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsForTbScreenes.sql @@ -1,7 +1,23 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat - WHERE ps.patient_id = pat.patient_id - AND ps.id_status IN (6,8) - AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.tb_screened =1 - AND TIMESTAMPDIFF(MONTH,pat.date_tb_screened ,:endDate) <= 6 ; \ No newline at end of file +FROM isanteplus.patient p, isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +(select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B, + openmrs.obs o, (SELECT ob.person_id as patient_id, + MAX(DATE(ob.obs_datetime)) AS obs_datetime + FROM openmrs.obs ob WHERE ob.concept_id = 1659 + AND ob.value_coded IN (1660,142177) + AND TIMESTAMPDIFF(MONTH,DATE(ob.obs_datetime),:endDate) <= 6 GROUP BY 1) C + WHERE p.patient_id = ps.patient_id + AND ps.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND p.patient_id = o.person_id + AND o.person_id = C.patient_id + AND DATE(o.obs_datetime) = DATE(C.obs_datetime) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND o.concept_id = 1659 AND o.value_coded IN (1660,142177) + AND TIMESTAMPDIFF(MONTH,DATE(o.obs_datetime),:endDate) <= 6 + AND p.voided <> 1 + AND o.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderPreventionCtx.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderPreventionCtx.sql index 82c1cafb..0da0f815 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderPreventionCtx.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderPreventionCtx.sql @@ -1,8 +1,17 @@ -SELECT p.patient_id - FROM isanteplus.patient_on_arv p , isanteplus.patient_dispensing pd ,(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 105281 GROUP BY 1) B ,(SELECT pd.patient_id,MAX(pd.visit_date) AS max_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 105281 GROUP BY 1) C - WHERE p.patient_id = pd.patient_id - AND (p.patient_id = B.patient_id OR p.patient_id = C.patient_id ) +SELECT pat.patient_id + FROM isanteplus.patient pat, isanteplus.patient_on_arv p, isanteplus.patient_dispensing pd, + isanteplus.patient_status_arv ps, + (select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) D + WHERE pat.patient_id = p.patient_id + AND p.patient_id = pd.patient_id + AND pd.patient_id = ps.patient_id + AND ps.patient_id = D.patient_id + AND DATE(ps.date_started_status) = D.date_status + AND ps.id_status = 6 + AND ps.date_started_status BETWEEN :startDate AND :endDate AND pd.drug_id = 105281 - AND (pd.visit_date = B.min_vist_date OR pd.visit_date = C.max_vist_date) - AND pd.visit_date BETWEEN :startDate AND :endDate - AND p.voided = 0 ; \ No newline at end of file + AND DATE(pd.next_dispensation_date) >= :startDate + AND pd.voided <> 1 + AND pat.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreament.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreament.sql index dbb5fd26..ca32f0f2 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreament.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreament.sql @@ -1,13 +1,17 @@ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd ,(SELECT pd.patient_id, MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p,isanteplus.patient_dispensing pd, +(SELECT pd.patient_id, MIN(DATE(pd.visit_date)) AS min_vist_date +FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 78280 GROUP BY 1) B WHERE p.patient_id = pd.patient_id - AND p.transferred_in = 0 - AND p.patient_id = B.patient_id + AND (p.transferred_in <> 1 OR p.transferred_in IS NULL) + AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL - AND (p.date_started_arv < :startDate OR p.date_started_arv BETWEEN :startDate AND :endDate ) - AND pd.drug_id =78280 + AND (DATE(p.date_started_arv) < :startDate + OR DATE(p.date_started_arv) BETWEEN :startDate AND :endDate) + AND pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 - AND pd.visit_date = B.min_vist_date - AND pd.visit_date BETWEEN :startDate AND :endDate - AND p.voided = 0; \ No newline at end of file + AND DATE(pd.visit_date) = DATE(B.min_vist_date) + AND DATE(pd.visit_date) BETWEEN :startDate AND :endDate + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreatmentForSixMonths.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreatmentForSixMonths.sql index e4f63a60..5fc3bde5 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreatmentForSixMonths.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalPatientsUnderTbTreatmentForSixMonths.sql @@ -1,14 +1,19 @@ SELECT p.patient_id -FROM isanteplus.patient p ,isanteplus.patient_dispensing pd ,(SELECT pd.patient_id, MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id =78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B +FROM isanteplus.patient p,isanteplus.patient_dispensing pd, +(SELECT pd.patient_id, MIN(pd.visit_date) AS min_vist_date +FROM isanteplus.patient_dispensing pd +WHERE pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 GROUP BY 1) B WHERE p.patient_id = pd.patient_id AND p.transferred_in = 0 AND p.patient_id = B.patient_id AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL AND pd.visit_date = B.min_vist_date - AND (p.date_started_arv < :startDate OR p.date_started_arv BETWEEN :startDate AND :endDate ) + AND (p.date_started_arv < :startDate + OR p.date_started_arv BETWEEN :startDate AND :endDate ) AND pd.drug_id = 78280 AND pd.rx_or_prophy = 163768 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) >= 6 - AND TIMESTAMPDIFF(MONTH,pd.visit_date ,:endDate) < 7 - AND p.voided = 0; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) >= 6 + AND TIMESTAMPDIFF(MONTH,pd.visit_date,:endDate) < 7 + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalpatientsWithBacterologySpecimenSampleColection.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalpatientsWithBacterologySpecimenSampleColection.sql index fc8b97b0..e0804909 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalpatientsWithBacterologySpecimenSampleColection.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/TotalpatientsWithBacterologySpecimenSampleColection.sql @@ -1,7 +1,12 @@ SELECT pat.patient_id - FROM isanteplus.patient_on_art pat ,isanteplus.patient_status_arv ps + FROM isanteplus.patient_on_art pat,isanteplus.patient_status_arv ps, + (SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE pat.patient_id = ps.patient_id - AND ps.id_status IN (6,8) + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pat.date_sample_sent_for_diagnositic_tb IS NOT NULL AND pat.date_sample_sent_for_diagnositic_tb BETWEEN :startDate AND :endDate ; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResult.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResult.sql index ec1b6fb9..8f177e38 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResult.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResult.sql @@ -1,11 +1,21 @@ SELECT pl.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl , isanteplus.patient_on_art pat - WHERE ps.patient_id = pl.patient_id - AND pat.patient_id = ps.patient_id +FROM isanteplus.patient p, isanteplus.patient_status_arv ps, +isanteplus.patient_laboratory pl, isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = pl.patient_id + AND ps.patient_id = pl.patient_id + AND pat.patient_id = ps.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND pl.test_id IN (856,1305) AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted IS NULL ; + AND pl.test_done = 1 + AND pl.voided <> 1 + AND TIMESTAMPDIFF(MONTH, pl.date_test_done, :endDate) >= 12 + AND pl.viral_load_target_or_routine <> 2 + AND (p.birthdate IS NOT NULL OR p.birthdate <> "") + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultLess1000Copies.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultLess1000Copies.sql index c804c6d5..d74c1dff 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultLess1000Copies.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultLess1000Copies.sql @@ -9,11 +9,23 @@ SELECT CASE END END -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_on_art pat - WHERE ps.patient_id = pl.patient_id +FROM isanteplus.patient p, isanteplus.patient_status_arv ps, +isanteplus.patient_laboratory pl, isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = pl.patient_id + AND ps.patient_id = pl.patient_id AND pl.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted IS NULL ; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH, pl.date_test_done,:endDate) >= 12 + AND pat.viral_load_targeted IS NULL + AND pl.viral_load_target_or_routine <> 2 + AND pl.voided <> 1 + AND (p.birthdate IS NOT NULL OR p.birthdate <> "") + AND ((pl.test_id = 856 AND pl.test_result < 1000) OR (pl.test_id = 1305 AND pl.test_result = 1306)) + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargeted.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargeted.sql index 4dfefc58..803c303c 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargeted.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargeted.sql @@ -1,10 +1,21 @@ SELECT pl.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl , isanteplus.patient_on_art pat - WHERE ps.patient_id = pl.patient_id - AND pat.patient_id = ps.patient_id +FROM isanteplus.patient p, isanteplus.patient_status_arv ps, +isanteplus.patient_laboratory pl , isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = pl.patient_id + AND ps.patient_id = pl.patient_id + AND pat.patient_id = ps.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND pl.test_id IN (856,1305) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted = 1 ; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH, pl.date_test_done,:endDate) >= 12 + AND pat.viral_load_targeted = 1 + AND pl.viral_load_target_or_routine = 2 + AND pl.voided <> 1 + AND (p.birthdate IS NOT NULL OR p.birthdate <> "") + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargetedLessThan1000Copies.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargetedLessThan1000Copies.sql index c2bbaa14..5cd2bebb 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargetedLessThan1000Copies.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeArvPatientWithViralLoadResultTargetedLessThan1000Copies.sql @@ -9,11 +9,22 @@ SELECT CASE END END -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_on_art pat - WHERE ps.patient_id = pl.patient_id +FROM isanteplus.patient p, isanteplus.patient_status_arv ps, +isanteplus.patient_laboratory pl ,isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = pl.patient_id + AND ps.patient_id = pl.patient_id AND pl.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted = 1 ; \ No newline at end of file + AND pl.test_done = 1 + AND TIMESTAMPDIFF(MONTH, pl.date_test_done, :endDate) >= 12 + AND pl.viral_load_target_or_routine = 2 + AND pl.voided <> 1 + AND (p.birthdate IS NOT NULL OR p.birthdate <> "") + AND ((pl.test_id = 856 AND pl.test_result < 1000) OR (pl.test_id = 1305 AND pl.test_result = 1306)) + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResult.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResult.sql index d4d1a21a..de8d1201 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResult.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResult.sql @@ -1,12 +1,19 @@ SELECT pl.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl, isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND pat.breast_feeding = 1 - AND ps.id_status IN (6,8) - AND pl.test_id IN (856,1305) + AND ps.id_status IN (6,8) + AND pl.test_id IN (856,1305) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pat.date_breast_feeding BETWEEN :startDate AND :endDate - AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted IS NULL ; \ No newline at end of file + AND pl.test_done = 1 + AND TIMESTAMPDIFF(MONTH, pl.date_test_done,:endDate) >= 12 + AND pl.viral_load_target_or_routine <> 2 + AND pl.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargeted.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargeted.sql index 53ca18c7..b0162adf 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargeted.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargeted.sql @@ -1,12 +1,19 @@ SELECT pl.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl, isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND pat.breast_feeding = 1 - AND ps.id_status IN (6,8) - AND pl.test_id IN (856,1305) + AND ps.id_status IN (6,8) + AND pl.test_id IN (856,1305) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pat.date_breast_feeding BETWEEN :startDate AND :endDate - AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted = 1 ; \ No newline at end of file + AND pl.test_done =1 + AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 + AND pl.viral_load_target_or_routine = 2 + AND pl.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql index d2a5b049..6cddccc6 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql @@ -9,12 +9,21 @@ SELECT CASE END END -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pat.patient_id - AND ps.id_status IN (6,8) - AND pat.breast_feeding = 1 + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND pat.breast_feeding = 1 AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted =1 ; \ No newline at end of file + AND pl.test_done = 1 + AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 + AND pl.viral_load_target_or_routine = 2 + AND ((pl.test_id = 856 AND pl.test_result < 1000) + OR (pl.test_id = 1305 AND pl.test_result = 1306)) + AND pl.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenWithViralLoadResultLess1000Copies.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenWithViralLoadResultLess1000Copies.sql index 98010ac4..8df9aab6 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenWithViralLoadResultLess1000Copies.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeBreastFeedingWomenWithViralLoadResultLess1000Copies.sql @@ -9,12 +9,21 @@ SELECT CASE END END -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_on_art pat, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND pat.breast_feeding = 1 AND ps.date_started_status BETWEEN :startDate AND :endDate AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted IS NULL ; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH, pl.date_test_done,:endDate) >= 12 + AND pl.viral_load_target_or_routine <> 2 + AND ((pl.test_id = 856 AND pl.test_result < 1000) + OR (pl.test_id = 1305 AND pl.test_result = 1306)) + AND pl.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeCtxCorhotIndicator.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeCtxCorhotIndicator.sql index 70ef98d6..89bab212 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeCtxCorhotIndicator.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeCtxCorhotIndicator.sql @@ -1,11 +1,22 @@ -SELECT p.patient_id - FROM isanteplus.patient_on_arv p , isanteplus.patient_dispensing pd ,isanteplus.patient_status_arv ps ,(SELECT pd.patient_id,MAX(pd.visit_date) AS max_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 105281 GROUP BY 1) B - WHERE p.patient_id = pd.patient_id +/*Nombre de patients VIH(+) sous ARV placées sous PROPHYLAXIE CTX au cours du mois*/ +SELECT pat.patient_id + FROM isanteplus.patient pat,isanteplus.patient_on_arv p, isanteplus.patient_dispensing pd, + isanteplus.patient_status_arv ps, + (SELECT pd.patient_id,MAX(DATE(pd.visit_date)) AS max_visit_date + FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 105281 + GROUP BY 1) B, (SELECT psa.patient_id, + MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE DATE(psa.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) C + WHERE pat.patient_id = p.patient_id + AND p.patient_id = pd.patient_id AND p.patient_id = ps.patient_id AND p.patient_id = B.patient_id + AND ps.patient_id = C.patient_id + AND DATE(ps.date_started_status) = DATE(C.date_status) AND ps.id_status = 6 - AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pd.drug_id = 105281 - AND pd.visit_date = B.max_vist_date - AND pd.visit_date BETWEEN :startDate AND :endDate - AND p.voided = 0 ; \ No newline at end of file + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate + AND pd.drug_id = 105281 + AND DATE(pd.next_dispensation_date) >= :startDate + AND pd.voided <> 1 + AND pat.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatients.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatients.sql index 013c7894..6b5bcbaf 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatients.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatients.sql @@ -1,4 +1,9 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps - WHERE ps.id_status IN (6,8) - AND ps.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file +FROM isanteplus.patient_status_arv ps, +(SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + DATE(psa.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = B.date_status + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsBtn3_5Months.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsBtn3_5Months.sql index e99ca570..253fdc2a 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsBtn3_5Months.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsBtn3_5Months.sql @@ -1,8 +1,14 @@ SELECT p.patient_id - FROM isanteplus.patient p, isanteplus.patient_on_art pa , isanteplus.patient_status_arv psa + FROM isanteplus.patient p, isanteplus.patient_on_art pa, + isanteplus.patient_status_arv psa, (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)B WHERE p.patient_id =pa.patient_id AND p.patient_id = psa.patient_id - AND psa.id_status IN (6 ,8) + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN(6,8) AND pa.last_folowup_vist_date IS NOT NULL AND DATEDIFF (:endDate , pa.last_folowup_vist_date ) <= 365 AND DATEDIFF(pa.last_folowup_vist_date ,IFNULL(DATE(pa.second_last_folowup_vist_date), DATE(pa.first_vist_date))) BETWEEN 80 AND 180; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsFirstLineRegimen.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsFirstLineRegimen.sql index 2c1e4ca4..6b6ab4ec 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsFirstLineRegimen.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsFirstLineRegimen.sql @@ -1,7 +1,20 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +(SELECT psa.patient_id, + MAX(psa.date_started_status) as date_status + FROM isanteplus.patient_status_arv psa WHERE psa.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)B, + isanteplus.patient_dispensing pd,(SELECT pdis.patient_id, + MAX(pdis.visit_date) AS visit_date + FROM isanteplus.patient_dispensing pdis WHERE pdis.visit_date + BETWEEN :startDate AND :endDate GROUP BY 1) C WHERE ps.patient_id = pat.patient_id - AND ps.id_status IN (6,8) + AND ps.patient_id = B.patient_id + AND B.patient_id = pd.patient_id + AND pd.patient_id = C.patient_id + AND DATE(pd.visit_date) = DATE(C.visit_date) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.treatment_regime_lines = 'FIRST_LINE' - AND pat.date_started_regime_treatment BETWEEN :startDate AND :endDate ; \ No newline at end of file + AND pd.treatment_regime_lines = 'FIRST_LINE' + AND pd.visit_date BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsLess3Months.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsLess3Months.sql index 6fae8915..db2acbcc 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsLess3Months.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsLess3Months.sql @@ -1,8 +1,20 @@ SELECT p.patient_id - FROM isanteplus.patient p, isanteplus.patient_dispensing pdis, isanteplus.patient_status_arv psa ,(select pdisp.patient_id, MAX(ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date))) as min_visit_date FROM isanteplus.patient_dispensing pdisp WHERE pdisp.voided <> 1 GROUP BY 1) B + FROM isanteplus.patient p, isanteplus.patient_dispensing pdis, + isanteplus.patient_status_arv psa,(select pdisp.patient_id, + MAX(ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date))) as min_visit_date + FROM isanteplus.patient_dispensing pdisp WHERE pdisp.voided <> 1 GROUP BY 1) B, + (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)C WHERE p.patient_id = pdis.patient_id AND p.patient_id =B.patient_id AND p.patient_id = psa.patient_id - AND psa.id_status IN (6 ,8) + AND psa.patient_id = C.patient_id + AND DATE(psa.date_started_status) = DATE(C.date_status) + AND psa.id_status IN (6,8) + AND psa.date_started_status BETWEEN :startDate AND :endDate AND ifnull(DATE(pdis.dispensation_date),DATE(pdis.visit_date)) = B.min_visit_date - AND DATEDIFF(pdis.next_dispensation_date,ifnull(DATE(pdis.dispensation_date),DATE(pdis.visit_date))) BETWEEN 0 AND 89; \ No newline at end of file + AND DATEDIFF(pdis.next_dispensation_date,ifnull( + DATE(pdis.dispensation_date),DATE(pdis.visit_date))) + BETWEEN 0 AND 89; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsOver5Months.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsOver5Months.sql index 90ea3a28..409eff52 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsOver5Months.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsOver5Months.sql @@ -1,8 +1,19 @@ SELECT p.patient_id - FROM isanteplus.patient p, isanteplus.patient_dispensing pdis, isanteplus.patient_status_arv psa ,(select pdisp.patient_id, MAX(ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date))) as min_visit_date FROM isanteplus.patient_dispensing pdisp WHERE pdisp.voided <> 1 GROUP BY 1) B + FROM isanteplus.patient p, isanteplus.patient_dispensing pdis, + isanteplus.patient_status_arv psa,(select pdisp.patient_id, + MAX(ifnull(DATE(pdisp.dispensation_date),DATE(pdisp.visit_date))) + as min_visit_date FROM isanteplus.patient_dispensing pdisp + WHERE pdisp.voided <> 1 GROUP BY 1) B, + (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)C WHERE p.patient_id = pdis.patient_id AND p.patient_id =B.patient_id AND p.patient_id = psa.patient_id - AND psa.id_status IN (6 ,8) + AND psa.patient_id = C.patient_id + AND DATE(psa.date_started_status) = DATE(C.date_status) + AND psa.id_status IN (6,8) AND ifnull(DATE(pdis.dispensation_date),DATE(pdis.visit_date)) = B.min_visit_date - AND DATEDIFF(pdis.next_dispensation_date,ifnull(DATE(pdis.dispensation_date),DATE(pdis.visit_date))) >180; \ No newline at end of file + AND DATEDIFF(pdis.next_dispensation_date,ifnull(DATE(pdis.dispensation_date),DATE(pdis.visit_date))) >180 + AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsSecondLineRegimen.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsSecondLineRegimen.sql index d5a92034..757ce5ec 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsSecondLineRegimen.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsSecondLineRegimen.sql @@ -1,7 +1,20 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)B, + isanteplus.patient_dispensing pd,(SELECT pdis.patient_id, + MAX(pdis.visit_date) AS visit_date + FROM isanteplus.patient_dispensing pdis WHERE pdis.visit_date + BETWEEN :startDate AND :endDate GROUP BY 1) C WHERE ps.patient_id = pat.patient_id - AND ps.id_status IN (6,8) + AND ps.patient_id = B.patient_id + AND B.patient_id = pd.patient_id + AND pd.patient_id = C.patient_id + AND DATE(pd.visit_date) = DATE(C.visit_date) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.treatment_regime_lines = 'SECOND_LINE' - AND pat.date_started_regime_treatment BETWEEN :startDate AND :endDate ; \ No newline at end of file + AND pd.treatment_regime_lines = 'SECOND_LINE' + AND pd.visit_date BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsThirdLineRegimen.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsThirdLineRegimen.sql index a0a16a36..c884e157 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsThirdLineRegimen.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activeHivPatientsThirdLineRegimen.sql @@ -1,7 +1,20 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)B, + isanteplus.patient_dispensing pd,(SELECT pdis.patient_id, + MAX(pdis.visit_date) AS visit_date + FROM isanteplus.patient_dispensing pdis WHERE pdis.visit_date + BETWEEN :startDate AND :endDate GROUP BY 1) C WHERE ps.patient_id = pat.patient_id - AND ps.id_status IN (6,8) + AND ps.patient_id = B.patient_id + AND B.patient_id = pd.patient_id + AND pd.patient_id = C.patient_id + AND DATE(pd.visit_date) = DATE(C.visit_date) + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.treatment_regime_lines = 'THIRD_LINE' - AND pat.date_started_regime_treatment BETWEEN :startDate AND :endDate ; \ No newline at end of file + AND pd.treatment_regime_lines = 'THIRD_LINE' + AND pd.visit_date BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatients6MonthsInh.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatients6MonthsInh.sql index 60335953..dd7d5bc8 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatients6MonthsInh.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatients6MonthsInh.sql @@ -1,7 +1,14 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +(SELECT psar.patient_id, + MAX(DATE(psar.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psar + WHERE DATE(psar.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pat.patient_id - AND ps.id_status IN (6,8) - AND ps.date_started_status BETWEEN :startDate AND :endDate + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status IN (6,8) + AND DATE(ps.date_started_status) BETWEEN :startDate AND :endDate AND pat.date_full_6_months_of_inh_has_px IS NOT NULL AND pat.date_full_6_months_of_inh_has_px < :endDate ; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistAnnualy.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistAnnualy.sql index 699f6619..9c3a65ce 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistAnnualy.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistAnnualy.sql @@ -1,8 +1,16 @@ SELECT p.patient_id - FROM isanteplus.patient p, isanteplus.patient_on_art pa , isanteplus.patient_status_arv psa - WHERE p.patient_id =pa.patient_id + FROM isanteplus.patient p, isanteplus.patient_on_art pa, + isanteplus.patient_status_arv psa, + (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = pa.patient_id AND p.patient_id = psa.patient_id - AND psa.id_status IN (6 ,8) + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND psa.date_started_status BETWEEN :startDate AND :endDate AND pa.last_folowup_vist_date IS NOT NULL AND DATEDIFF (:endDate , pa.last_folowup_vist_date ) <= 365 - AND DATEDIFF(pa.last_folowup_vist_date ,IFNULL(DATE(pa.second_last_folowup_vist_date), DATE(pa.first_vist_date))) BETWEEN 180 AND 360; \ No newline at end of file + AND DATEDIFF(pa.last_folowup_vist_date,IFNULL(DATE(pa.second_last_folowup_vist_date), DATE(pa.first_vist_date))) BETWEEN 180 AND 360; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistQuatery.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistQuatery.sql index 22f771cb..efa31675 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistQuatery.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistQuatery.sql @@ -1,8 +1,16 @@ SELECT p.patient_id - FROM isanteplus.patient p, isanteplus.patient_on_art pa , isanteplus.patient_status_arv psa - WHERE p.patient_id =pa.patient_id + FROM isanteplus.patient p, isanteplus.patient_on_art pa, + isanteplus.patient_status_arv psa, + (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = pa.patient_id AND p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) AND psa.id_status IN (6 ,8) + AND psa.date_started_status BETWEEN :startDate AND :endDate AND pa.last_folowup_vist_date IS NOT NULL AND DATEDIFF (:endDate , pa.last_folowup_vist_date ) <= 365 AND DATEDIFF(pa.last_folowup_vist_date ,IFNULL(DATE(pa.second_last_folowup_vist_date), DATE(pa.first_vist_date))) BETWEEN 0 AND 89; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistSemiAnnualy.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistSemiAnnualy.sql index f0a0a507..aa0712ab 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistSemiAnnualy.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePatientsWithAtleastOneFollowUpVistSemiAnnualy.sql @@ -1,8 +1,16 @@ SELECT p.patient_id - FROM isanteplus.patient p, isanteplus.patient_on_art pa , isanteplus.patient_status_arv psa - WHERE p.patient_id =pa.patient_id + FROM isanteplus.patient p, isanteplus.patient_on_art pa, + isanteplus.patient_status_arv psa, + (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = pa.patient_id AND p.patient_id = psa.patient_id - AND psa.id_status IN (6 ,8) + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6 ,8) + AND psa.date_started_status BETWEEN :startDate AND :endDate AND pa.last_folowup_vist_date IS NOT NULL - AND DATEDIFF (:endDate , pa.last_folowup_vist_date ) <= 365 + AND DATEDIFF (:endDate , pa.last_folowup_vist_date ) <= 365 AND DATEDIFF(pa.last_folowup_vist_date ,IFNULL(DATE(pa.second_last_folowup_vist_date), DATE(pa.first_vist_date))) BETWEEN 90 AND 179; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResult.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResult.sql index e29d3fd9..85b5e7ae 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResult.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResult.sql @@ -1,13 +1,21 @@ SELECT pl.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_pregnancy pp ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_pregnancy pp,isanteplus.patient_on_art pat, +(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pp.patient_id AND pat.patient_id = pp.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND pp.end_date >= :endDate AND ps.id_status IN (6,8) AND pl.test_id IN (856,1305) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pl.test_done =1 AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted IS NULL ; + AND pl.viral_load_target_or_routine <> 2 + AND pl.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargeted.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargeted.sql index aaabcad1..0b311003 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargeted.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargeted.sql @@ -1,12 +1,19 @@ SELECT pl.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_pregnancy pp ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_pregnancy pp,isanteplus.patient_on_art pat, + (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pp.patient_id AND pat.patient_id = pp.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND pp.end_date >= :endDate AND ps.id_status IN (6,8) AND pl.test_id IN (856,1305) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pl.test_done =1 - AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted =1 ; \ No newline at end of file + AND TIMESTAMPDIFF(MONTH, pl.date_test_done,:endDate) >= 12 + AND pl.viral_load_target_or_routine = 2 ; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql index e8acd0b6..a00ce09f 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenOnArtWithViralLoadResultTargetedLessThan1000Copies.sql @@ -9,13 +9,22 @@ SELECT CASE END END -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_pregnancy pp ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_pregnancy pp ,isanteplus.patient_on_art pat, +(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pp.patient_id AND pl.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND pp.end_date >= :endDate AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pl.test_done =1 AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted = 1 ; \ No newline at end of file + AND pl.viral_load_target_or_routine = 2 + AND ((pl.test_id = 856 AND pl.test_result < 1000) + OR (pl.test_id = 1305 AND pl.test_result = 1306)); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenWithViralLoadResultLess1000Copies.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenWithViralLoadResultLess1000Copies.sql index b30c249e..b785b80c 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenWithViralLoadResultLess1000Copies.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/activePregnantWomenWithViralLoadResultLess1000Copies.sql @@ -9,13 +9,22 @@ SELECT CASE END END -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_laboratory pl ,isanteplus.patient_pregnancy pp ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_laboratory pl, +isanteplus.patient_pregnancy pp,isanteplus.patient_on_art pat, +(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pl.patient_id AND pl.patient_id = pp.patient_id AND pl.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND pp.end_date >= :endDate - AND ps.id_status IN (6,8) + AND ps.id_status IN (6,8) AND ps.date_started_status BETWEEN :startDate AND :endDate AND pl.test_done =1 AND TIMESTAMPDIFF(MONTH, pl.date_test_done ,:endDate) >= 12 - AND pat.viral_load_targeted IS NULL ; \ No newline at end of file + AND pl.viral_load_target_or_routine = 1 + AND ((pl.test_id = 856 AND pl.test_result < 1000) + OR (pl.test_id = 1305 AND pl.test_result = 1306)); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByCancer.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByCancer.sql index 56402024..0ffd65fb 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByCancer.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByCancer.sql @@ -1,5 +1,19 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 2 - AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, openmrs.obs o, openmrs.concept c, + (SELECT psarv.patient_id, + MAX(DATE(psarv.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psarv WHERE DATE(psarv.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = o.person_id + AND o.value_coded = c.concept_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = B.date_status + AND o.concept_id = 1748 + AND c.uuid = '8efa7daf-0fb1-49bd-8e1e-1702334246ba' + AND psa.patient_id IN (SELECT psar.patient_id + FROM isanteplus.patient_status_arv psar + WHERE TIMESTAMPDIFF(MONTH,psar.date_started_status,:startDate) <=3 + AND psar.id_status IN (6,8)) + AND psa.id_status = 1 + AND o.obs_datetime <= :endDate + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByHivIllnensses.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByHivIllnensses.sql index 56402024..535a8b02 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByHivIllnensses.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByHivIllnensses.sql @@ -1,5 +1,18 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 2 - AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, openmrs.obs o, + (SELECT psarv.patient_id, + MAX(DATE(psarv.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psarv WHERE DATE(psarv.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = o.person_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = B.date_status + AND o.concept_id = 1748 + AND o.value_coded = 160159 + AND psa.patient_id IN (SELECT psar.patient_id + FROM isanteplus.patient_status_arv psar + WHERE TIMESTAMPDIFF(MONTH,DATE(psar.date_started_status),:startDate) <=3 + AND psar.id_status IN (6,8)) + AND psa.id_status = 1 + AND o.obs_datetime <= :endDate + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByNaturalCauses.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByNaturalCauses.sql index 56402024..080b1491 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByNaturalCauses.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByNaturalCauses.sql @@ -1,5 +1,18 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 2 - AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, openmrs.obs o, + (SELECT psarv.patient_id, + MAX(DATE(psarv.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psarv WHERE DATE(psarv.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = o.person_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = B.date_status + AND o.concept_id = 1748 + AND o.value_coded = 133481 + AND psa.patient_id IN (SELECT psar.patient_id + FROM isanteplus.patient_status_arv psar + WHERE TIMESTAMPDIFF(MONTH,DATE(psar.date_started_status),:startDate) <=3 + AND psar.id_status IN (6,8)) + AND psa.id_status = 1 + AND DATE(o.obs_datetime) <= :endDate + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByOtherInfectiousDiseases.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByOtherInfectiousDiseases.sql index 56402024..2104a82c 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByOtherInfectiousDiseases.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByOtherInfectiousDiseases.sql @@ -1,5 +1,18 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 2 - AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, openmrs.obs o, + (SELECT psarv.patient_id, + MAX(DATE(psarv.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psarv WHERE DATE(psarv.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = o.person_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = B.date_status + AND o.concept_id = 1748 + AND o.value_coded = 5622 + AND psa.patient_id IN (SELECT psar.patient_id + FROM isanteplus.patient_status_arv psar + WHERE TIMESTAMPDIFF(MONTH,DATE(psar.date_started_status),:startDate) <=3 + AND psar.id_status IN (6,8)) + AND psa.id_status = 1 + AND DATE(o.obs_datetime) <= :endDate + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByTuberclosis.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByTuberclosis.sql index 56402024..7fd6828d 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByTuberclosis.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByTuberclosis.sql @@ -1,5 +1,18 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 2 - AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, openmrs.obs o, + (SELECT psarv.patient_id, + MAX(DATE(psarv.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psarv WHERE DATE(psarv.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = o.person_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = B.date_status + AND o.concept_id = 1748 + AND o.value_coded = 112141 + AND psa.patient_id IN (SELECT psar.patient_id + FROM isanteplus.patient_status_arv psar + WHERE TIMESTAMPDIFF(MONTH,DATE(psar.date_started_status),:startDate) <=3 + AND psar.id_status IN (6,8)) + AND psa.id_status = 1 + AND DATE(o.obs_datetime) <= :endDate + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnKnownCauses.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnKnownCauses.sql index 56402024..e42af725 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnKnownCauses.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnKnownCauses.sql @@ -1,5 +1,18 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 2 - AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, openmrs.obs o, + (SELECT psarv.patient_id, + MAX(DATE(psarv.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psarv WHERE DATE(psarv.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = o.person_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = B.date_status + AND o.concept_id = 1748 + AND o.value_coded = 1067 + AND psa.patient_id IN (SELECT psar.patient_id + FROM isanteplus.patient_status_arv psar + WHERE TIMESTAMPDIFF(MONTH,DATE(psar.date_started_status),:startDate) <=3 + AND psar.id_status IN (6,8)) + AND psa.id_status = 1 + AND DATE(o.obs_datetime) <= :endDate + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnNaturalCauses.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnNaturalCauses.sql index 56506d2b..a2bae558 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnNaturalCauses.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/deadArvPatientsByUnNaturalCauses.sql @@ -1,4 +1,20 @@ -SELECT pat.patient_id - FROM isanteplus.patient_on_art pat - WHERE pat.deceased = 1 - AND pat.cause_of_death_for_lost = "UNNATURAL" ; \ No newline at end of file +SELECT psa.patient_id + FROM isanteplus.patient_status_arv psa, openmrs.obs o, openmrs.concept c, + (SELECT psarv.patient_id, + MAX(DATE(psarv.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psarv WHERE DATE(psarv.date_started_status) + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = o.person_id + AND o.value_coded = c.concept_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = B.date_status + AND o.concept_id = 1748 + AND c.uuid = '768778dc-ce6a-47a0-8f78-b0777c8cf081' + AND psa.patient_id IN (SELECT psar.patient_id + FROM isanteplus.patient_status_arv psar + WHERE TIMESTAMPDIFF(MONTH,DATE(psar.date_started_status),:startDate) <=3 + AND psar.id_status IN (6,8)) + AND psa.id_status = 1 + AND DATE(o.obs_datetime) <= :endDate + AND DATE(psa.date_started_status) BETWEEN :startDate AND :endDate + AND o.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsDead.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsDead.sql index ad5ef4df..80784c8d 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsDead.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsDead.sql @@ -1,4 +1,9 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps - WHERE ps.id_status =1 +FROM isanteplus.patient_status_arv ps,(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status =1 AND ps.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsLostToForMonth.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsLostToForMonth.sql index 046a8cde..e3742003 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsLostToForMonth.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsLostToForMonth.sql @@ -1,4 +1,9 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps - WHERE ps.id_status =9 +FROM isanteplus.patient_status_arv ps,(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status = 9 AND ps.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMedicalOrVoluntary.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMedicalOrVoluntary.sql index aa05bec2..a75b1c3c 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMedicalOrVoluntary.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMedicalOrVoluntary.sql @@ -1,4 +1,9 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps - WHERE ps.id_status =3 +FROM isanteplus.patient_status_arv ps, (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status = 3 AND ps.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMigrated.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMigrated.sql index 0836bcd4..f1011ca4 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMigrated.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsMigrated.sql @@ -1,6 +1,12 @@ SELECT pat.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +(SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status =9 AND ps.date_started_status BETWEEN :startDate AND :endDate AND pat.migrated = 1 ; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsTransferred.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsTransferred.sql index edbd87b7..fb0ca518 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsTransferred.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/inactivePatientsTransferred.sql @@ -1,4 +1,9 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps - WHERE ps.id_status =2 +FROM isanteplus.patient_status_arv ps, (SELECT psar.patient_id, + MAX(psar.date_started_status) as date_status + FROM isanteplus.patient_status_arv psar WHERE psar.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) + AND ps.id_status = 2 AND ps.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationCaptive.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationCaptive.sql index 9d4b2575..b939f12f 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationCaptive.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationCaptive.sql @@ -1,3 +1,8 @@ SELECT pa.patient_id -FROM isanteplus.patient_on_art pa - WHERE pa.key_population = "CAPTIVE" ; \ No newline at end of file +FROM isanteplus.patient_on_art pa, openmrs.obs o, openmrs.concept c + WHERE pa.patient_id = o.person_id + AND o.concept_id = c.concept_id + AND c.uuid = 'b2726cc7-df4b-463c-919d-1c7a600fef87' + AND o.value_coded = 162277 + AND o.voided <> 1 + /*AND o.obs_datetime BETWEEN :startDate AND :endDate;*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationDrug.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationDrug.sql index 15bee13f..c4007759 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationDrug.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationDrug.sql @@ -1,3 +1,8 @@ SELECT pa.patient_id -FROM isanteplus.patient_on_art pa - WHERE pa.key_population = "DRUG USER" ; \ No newline at end of file +FROM isanteplus.patient_on_art pa, openmrs.obs o, openmrs.concept c + WHERE pa.patient_id = o.person_id + AND o.concept_id = c.concept_id + AND c.uuid = 'b2726cc7-df4b-463c-919d-1c7a600fef87' + AND o.value_coded = 105 + AND o.voided <> 1 + /* AND o.obs_datetime BETWEEN :startDate AND :endDate;*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationMsm.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationMsm.sql index 4ae98387..a106b79b 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationMsm.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationMsm.sql @@ -1,3 +1,8 @@ SELECT pa.patient_id -FROM isanteplus.patient_on_art pa - WHERE pa.key_population = "MSM" ; \ No newline at end of file +FROM isanteplus.patient_on_art pa, openmrs.obs o, openmrs.concept c + WHERE pa.patient_id = o.person_id + AND o.concept_id = c.concept_id + AND c.uuid = 'b2726cc7-df4b-463c-919d-1c7a600fef87' + AND o.value_coded = 160578 + AND o.voided <> 1 + /*AND o.obs_datetime BETWEEN :startDate AND :endDate;*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationSex.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationSex.sql index 8ea690e9..ddbb830f 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationSex.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationSex.sql @@ -1,3 +1,8 @@ SELECT pa.patient_id -FROM isanteplus.patient_on_art pa - WHERE pa.key_population = "SEX PROFESSIONAL" ; \ No newline at end of file +FROM isanteplus.patient_on_art pa, openmrs.obs o, openmrs.concept c + WHERE pa.patient_id = o.person_id + AND o.concept_id = c.concept_id + AND c.uuid = 'b2726cc7-df4b-463c-919d-1c7a600fef87' + AND o.value_coded = 160579 + AND o.voided <> 1 + /*AND o.obs_datetime BETWEEN :startDate AND :endDate;*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationTransgender.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationTransgender.sql index 2430f55b..72e597de 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationTransgender.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/keyPopulationTransgender.sql @@ -1,3 +1,8 @@ SELECT pa.patient_id -FROM isanteplus.patient_on_art pa - WHERE pa.key_population = "TRANSGENDER" ; \ No newline at end of file +FROM isanteplus.patient_on_art pa, openmrs.obs o, openmrs.concept c + WHERE pa.patient_id = o.person_id + AND o.concept_id = c.concept_id + AND c.uuid = 'b2726cc7-df4b-463c-919d-1c7a600fef87' + AND o.value_coded = 124275 + AND o.voided <> 1 + /*AND o.obs_datetime BETWEEN :startDate AND :endDate;*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstDied.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstDied.sql index 1004cd4f..34c583aa 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstDied.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstDied.sql @@ -1,5 +1,13 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) + FROM isanteplus.patient_status_arv psa, + (select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.patient_id IN + (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa + WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 + AND psa.id_status IN (6,8)) AND psa.id_status = 1 AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForMoreThan3monthsTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForMoreThan3monthsTreatment.sql index 507ccf0c..68af8761 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForMoreThan3monthsTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForMoreThan3monthsTreatment.sql @@ -1,7 +1,15 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa , isanteplus.patient p - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.patient_id = p.patient_id - AND psa.id_status IN (1,2,3,9) - AND psa.date_started_status BETWEEN :startDate AND :endDate - AND TIMESTAMPDIFF(MONTH,p.date_started_arv ,:endDate) >= 3 ; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, isanteplus.patient p, + (select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.patient_id IN (SELECT psa.patient_id + FROM isanteplus.patient_status_arv psa + WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 + AND psa.id_status IN (6,8)) + AND psa.patient_id = p.patient_id + AND psa.id_status IN (1,2,3,9) + AND psa.date_started_status BETWEEN :startDate AND :endDate + AND TIMESTAMPDIFF(MONTH,p.date_started_arv,:endDate) >= 3 ; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForlessThan3monthsTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForlessThan3monthsTreatment.sql index c2c60cee..9cf48e78 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForlessThan3monthsTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatienstForlessThan3monthsTreatment.sql @@ -1,7 +1,15 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa , isanteplus.patient p - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.patient_id = p.patient_id - AND psa.id_status IN (1,2,3,9) - AND psa.date_started_status BETWEEN :startDate AND :endDate - AND TIMESTAMPDIFF(MONTH,p.date_started_arv ,:endDate) < 3 ; \ No newline at end of file + FROM isanteplus.patient_status_arv psa, isanteplus.patient p, + (select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id IN (SELECT psa.patient_id + FROM isanteplus.patient_status_arv psa + WHERE psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND TIMESTAMPDIFF(MONTH,psa.date_started_status,:startDate) <=3 + AND psa.id_status IN (6,8) ) + AND psa.patient_id = p.patient_id + AND psa.id_status IN (1,2,3,9) + AND psa.date_started_status BETWEEN :startDate AND :endDate + AND TIMESTAMPDIFF(MONTH,p.date_started_arv,:endDate) < 3 ; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsStopped.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsStopped.sql index 56402024..15215558 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsStopped.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsStopped.sql @@ -1,5 +1,13 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 2 + FROM isanteplus.patient_status_arv psa, + (select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.patient_id IN (SELECT psa.patient_id + FROM isanteplus.patient_status_arv psa + WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status,:startDate) <=3 + AND psa.id_status IN (6,8)) + AND psa.id_status = 3 AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsTransferred.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsTransferred.sql index 5c1d1075..ac16d5d4 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsTransferred.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostArvPatientsTransferred.sql @@ -1,5 +1,13 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 AND psa.id_status IN (6,8) ) - AND psa.id_status = 3 + FROM isanteplus.patient_status_arv psa, + (select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.patient_id IN + (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa + WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) <=3 + AND psa.id_status IN (6,8)) + AND psa.id_status = 2 AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostPatientsResumedTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostPatientsResumedTreatment.sql index 89dcc55f..280ad7b1 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostPatientsResumedTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/lostPatientsResumedTreatment.sql @@ -1,5 +1,13 @@ SELECT psa.patient_id - FROM isanteplus.patient_status_arv psa - WHERE psa.patient_id IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa WHERE TIMESTAMPDIFF(MONTH,psa.date_started_status ,:startDate) =1 AND psa.id_status =9 ) + FROM isanteplus.patient_status_arv psa, + (select psar.patient_id, MAX(DATE(psar.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv psar WHERE + DATE(psar.date_started_status) BETWEEN :startDate AND :endDate GROUP BY 1) B + WHERE psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.patient_id IN (SELECT psarv.patient_id + FROM isanteplus.patient_status_arv psarv + WHERE TIMESTAMPDIFF(MONTH,psarv.date_started_status,:startDate) = 1 + AND psa.id_status =9) AND psa.id_status IN (6,8) AND psa.date_started_status BETWEEN :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newPatientsEnrolledOnART.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newPatientsEnrolledOnART.sql index a44df627..40c13284 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newPatientsEnrolledOnART.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newPatientsEnrolledOnART.sql @@ -1,7 +1,7 @@ SELECT p.patient_id FROM isanteplus.patient p - WHERE p.transferred_in = 0 - AND (p.birthdate <>'' AND p.birthdate is not null) + WHERE (p.transferred_in IS NULL OR p.transferred_in = 0) AND p.date_started_arv IS NOT NULL + AND p.arv_status IS NOT NULL AND p.date_started_arv BETWEEN :startDate AND :endDate AND p.voided = 0; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyEnrolledBreatFeedingWomen.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyEnrolledBreatFeedingWomen.sql index c686ce1a..c0b2b42e 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyEnrolledBreatFeedingWomen.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyEnrolledBreatFeedingWomen.sql @@ -1,11 +1,12 @@ SELECT p.patient_id FROM isanteplus.patient p ,isanteplus.patient_on_art pa WHERE p.patient_id = pa.patient_id - AND p.transferred_in = 0 + AND (p.transferred_in IS NULL OR p.transferred_in = 0) AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL AND p.date_started_arv BETWEEN :startDate AND :endDate AND p.gender = "F" AND pa.breast_feeding = 1 AND pa.date_started_breast_feeding BETWEEN :startDate AND :endDate - AND p.voided = 0; \ No newline at end of file + AND p.voided = 0 + AND p.arv_status IS NOT NUll; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyPoweredCtxCorhotIndicator.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyPoweredCtxCorhotIndicator.sql index 160c7333..d32a11f9 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyPoweredCtxCorhotIndicator.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/newlyPoweredCtxCorhotIndicator.sql @@ -1,8 +1,21 @@ +/*Patients VIH+ sous ARV nouvellement mis sous CTX*/ SELECT p.patient_id - FROM isanteplus.patient_on_arv p , isanteplus.patient_dispensing pd ,(SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 105281 GROUP BY 1) B + FROM isanteplus.patient_on_arv p, isanteplus.patient_dispensing pd, + (SELECT pd.patient_id,MIN(pd.visit_date) AS min_visit_date + FROM isanteplus.patient_dispensing pd WHERE pd.drug_id = 105281 + GROUP BY 1) B, isanteplus.patient_status_arv ps, + (SELECT psa.patient_id, + MAX(psa.date_started_status) as date_status + FROM isanteplus.patient_status_arv psa WHERE psa.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1) C WHERE p.patient_id = pd.patient_id AND p.patient_id = B.patient_id - AND pd.drug_id = 105281 - AND pd.visit_date = B.min_vist_date + AND pd.patient_id = ps.patient_id + AND ps.patient_id = C.patient_id + AND DATE(ps.date_started_status) = DATE(C.date_status) + AND ps.id_status = 6 + AND pd.drug_id = 105281 + AND DATE(pd.visit_date) = DATE(B.min_visit_date) AND pd.visit_date BETWEEN :startDate AND :endDate - AND p.voided = 0 ; \ No newline at end of file + AND p.voided <> 1 + AND pd.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCcv.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCcv.sql index e3d2d44a..95166ca6 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCcv.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCcv.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method = "CCV" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "CCV" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCondoms.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCondoms.sql index 7d1db8dd..640a4bba 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCondoms.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningCondoms.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method = "CONDOM" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "CONDOM" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningImplnats.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningImplnats.sql index e411b014..c5362517 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningImplnats.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningImplnats.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method = "IMPLANTS" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "IMPLANTS" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningInject.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningInject.sql index a27f0161..38598fd1 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningInject.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningInject.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method = "INJECT" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "INJECT" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningLam.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningLam.sql index b4beaf1a..f9bae4ee 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningLam.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningLam.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method = "LAM" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "LAM" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningNecklace.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningNecklace.sql index d1e04160..a7effc59 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningNecklace.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningNecklace.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method ="NECKLACE" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "NECKLACE" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningPills.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningPills.sql index 8d71798b..91d14c4f 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningPills.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningPills.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method ="PILLS" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "PILLS" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningVagTabs.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningVagTabs.sql index b955b009..d9a1ce94 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningVagTabs.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAcceptingFamilyPlanningVagTabs.sql @@ -1,4 +1,11 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.accepted_family_planning_method ="VAG_TABS" -AND pat.date_accepted_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp, +(SELECT fpl.patient_id, MIN(DATE(fpl.encounter_date)) AS visit_date +FROM isanteplus.family_planning fpl GROUP BY 1) B +WHERE pat.patient_id = fp.patient_id +AND fp.patient_id = B.patient_id +AND DATE(fp.encounter_date) = DATE(B.visit_date) +AND fp.family_planning_method_name = "VAG_TABS" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp = 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAlreadyOnArvsAndTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAlreadyOnArvsAndTbTreatment.sql index eb34e5b1..552949f6 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAlreadyOnArvsAndTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsAlreadyOnArvsAndTbTreatment.sql @@ -1,7 +1,13 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps, isanteplus.patient_on_art pat, +isanteplus.patient p,(SELECT psa.patient_id, + MAX(psa.date_started_status) as date_status + FROM isanteplus.patient_status_arv psa WHERE psa.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)B WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND p.date_started_arv < :startDate AND ps.date_started_status BETWEEN :startDate AND :endDate diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsNewlyenrolledOnArvsAndTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsNewlyenrolledOnArvsAndTbTreatment.sql index e58b3e47..c3221d4c 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsNewlyenrolledOnArvsAndTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsNewlyenrolledOnArvsAndTbTreatment.sql @@ -1,9 +1,23 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps, isanteplus.patient_on_art pat, +isanteplus.patient p,isanteplus.patient_dispensing pdisp, +(SELECT psa.patient_id,MAX(psa.date_started_status) as date_status + FROM isanteplus.patient_status_arv psa WHERE psa.date_started_status + BETWEEN :startDate AND :endDate GROUP BY 1)B, + (SELECT pd.patient_id,MIN(pd.visit_date) AS min_vist_date +FROM isanteplus.patient_dispensing pd +WHERE pd.drug_id = 78280 GROUP BY 1)C WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND ps.patient_id = pdisp.patient_id + AND pdisp.patient_id = C.patient_id + AND DATE(pdisp.visit_date) = DATE(C.min_vist_date) + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) - AND p.date_started_arv BETWEEN :startDate AND :endDate + AND (p.transferred_in <> 1 OR p.transferred_in IS NULL) + AND p.date_started_arv BETWEEN :startDate AND :endDate AND ps.date_started_status BETWEEN :startDate AND :endDate - AND pat.date_enrolled_on_tb_treatment IS NOT NUlL - AND pat.date_enrolled_on_tb_treatment BETWEEN :startDate AND :endDate ; + AND pdisp.visit_date BETWEEN :startDate AND :endDate + AND p.voided <> 1 + AND pdisp.voided <> 1; diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12Months.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12Months.sql index 63277bf6..439febde 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12Months.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12Months.sql @@ -1,6 +1,17 @@ SELECT p.patient_id -FROM isanteplus.patient_on_art pat ,isanteplus.patient_status_arv psa , isanteplus.patient p +FROM isanteplus.patient_on_art pat, isanteplus.patient_status_arv psa, isanteplus.patient p, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status, ps.id_status + FROM isanteplus.patient_status_arv ps + WHERE ps.date_started_status <= :endDate GROUP BY 1) B WHERE p.patient_id = pat.patient_id AND p.patient_id = psa.patient_id -AND ( TIMESTAMPDIFF(MONTH, pat.date_started_arv_for_transfered ,:endDate) >= 12 OR TIMESTAMPDIFF(MONTH, p.date_started_arv ,:endDate) >= 12 ) -AND p.patient_id NOT IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa , isanteplus.patient p WHERE psa.patient_id = p.patient_id AND psa.id_status =2 AND p.date_started_arv <= :endDate) ; +AND ((p.transferred_in = 1 AND TIMESTAMPDIFF(MONTH, pat.date_started_arv_for_transfered, :endDate) >= 12) +OR (TIMESTAMPDIFF(MONTH, p.date_started_arv, :endDate)) >= 12) +AND psa.patient_id = B.patient_id +AND DATE(psa.date_started_status) = DATE(B.date_status) +AND psa.id_status = B.id_status +AND B.date_status <= :endDate +AND B.id_status <> 2;/* +AND p.patient_id NOT IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa , isanteplus.patient p +WHERE psa.patient_id = p.patient_id AND psa.id_status = 2 +AND psa.date_started_status between :startDate AND :endDate);*/ diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsAlive.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsAlive.sql index b878ad85..16e04d8e 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsAlive.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsAlive.sql @@ -1,9 +1,13 @@ SELECT p.patient_id -FROM isanteplus.patient_on_art pat ,isanteplus.patient_status_arv psa , isanteplus.patient p ,(SELECT ps.patient_id ,MAX(ps.date_started_status) AS max_staus_date FROM isanteplus.patient_status_arv ps WHERE ps.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B +FROM isanteplus.patient_on_art pat, isanteplus.patient_status_arv psa, +isanteplus.patient p, (SELECT ps.patient_id, MAX(ps.date_started_status) AS max_staus_date, +ps.id_status FROM isanteplus.patient_status_arv ps +WHERE ps.date_started_status <= :endDate GROUP BY 1) B WHERE p.patient_id = pat.patient_id AND p.patient_id = psa.patient_id -AND B.patient_id = p.patient_id -AND ( TIMESTAMPDIFF(MONTH, pat.date_started_arv_for_transfered ,:endDate) >= 12 OR TIMESTAMPDIFF(MONTH, p.date_started_arv ,:endDate) >= 12 ) -AND p.patient_id NOT IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa , isanteplus.patient p WHERE psa.patient_id = p.patient_id AND psa.id_status =2 AND p.date_started_arv <= :endDate) -AND B.max_staus_date = psa.date_started_status -AND psa.id_status <> 1 ; \ No newline at end of file +AND p.patient_id = B.patient_id +AND psa.id_status = B.id_status +AND DATE(psa.date_started_status) = DATE(B.max_staus_date) +AND ((p.transferred_in = 1 AND TIMESTAMPDIFF(MONTH, pat.date_started_arv_for_transfered, :endDate) >= 12) +OR (TIMESTAMPDIFF(MONTH, p.date_started_arv, :endDate) >= 12)) +AND psa.id_status IN (6,8,9); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsInSight.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsInSight.sql index 0559630f..5b405006 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsInSight.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsInSight.sql @@ -1,6 +1,18 @@ SELECT p.patient_id -FROM isanteplus.patient_status_arv psa , isanteplus.patient p +FROM isanteplus.patient_status_arv psa, isanteplus.patient p, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status, ps.id_status + FROM isanteplus.patient_status_arv ps + WHERE ps.date_started_status <= :endDate GROUP BY 1) B WHERE p.patient_id = psa.patient_id -AND p.transferred_in =0 -AND TIMESTAMPDIFF(MONTH, p.date_started_arv ,:endDate) >= 12 -AND p.patient_id NOT IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa , isanteplus.patient p WHERE psa.patient_id = p.patient_id AND psa.id_status =2 AND p.date_started_arv <= :endDate); \ No newline at end of file +AND (p.transferred_in = 0 OR p.transferred_in IS NULL) +AND TIMESTAMPDIFF(MONTH, p.date_started_arv,:endDate) >= 12 +AND psa.patient_id = B.patient_id +AND DATE(psa.date_started_status) = DATE(B.date_status) +AND psa.id_status = B.id_status +AND B.date_status <= :endDate +AND B.id_status <> 2; +/* +AND p.patient_id NOT IN +(SELECT psa.patient_id FROM isanteplus.patient_status_arv psa, +isanteplus.patient p WHERE psa.patient_id = p.patient_id +AND psa.id_status = 2 AND psa.date_started_status between :startDate AND :endDate);*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsTransferred.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsTransferred.sql index ae0e71f3..65cc8e9c 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsTransferred.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsOnArvsFor12MonthsTransferred.sql @@ -1,7 +1,19 @@ SELECT p.patient_id -FROM isanteplus.patient_on_art pat ,isanteplus.patient_status_arv psa , isanteplus.patient p +FROM isanteplus.patient_on_art pat, isanteplus.patient_status_arv psa, isanteplus.patient p, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status, ps.id_status + FROM isanteplus.patient_status_arv ps + WHERE ps.date_started_status <= :endDate GROUP BY 1) B WHERE p.patient_id = pat.patient_id AND p.patient_id = psa.patient_id AND p.transferred_in =1 -AND TIMESTAMPDIFF(MONTH, pat.date_started_arv_for_transfered ,:endDate) >= 12 -AND p.patient_id NOT IN (SELECT psa.patient_id FROM isanteplus.patient_status_arv psa , isanteplus.patient p WHERE psa.patient_id = p.patient_id AND psa.id_status =2 AND p.date_started_arv <= :endDate); \ No newline at end of file +AND TIMESTAMPDIFF(MONTH, IFNULL(pat.date_started_arv_for_transfered,p.date_started_arv), :endDate) >= 12 +AND psa.patient_id = B.patient_id +AND DATE(psa.date_started_status) = DATE(B.date_status) +AND psa.id_status = B.id_status +AND B.date_status <= :endDate +AND B.id_status <> 2; +/* +AND p.patient_id NOT IN (SELECT psa.patient_id +FROM isanteplus.patient_status_arv psa, isanteplus.patient p +WHERE psa.patient_id = p.patient_id AND psa.id_status =2 +AND psa.date_started_status between :startDate AND :endDate);*/ \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCcv.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCcv.sql index 4307559a..215bbd6e 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCcv.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCcv.sql @@ -1,4 +1,7 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = 'CCV' -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = 'CCV' +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCondoms.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCondoms.sql index 64442342..46a75ce5 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCondoms.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningCondoms.sql @@ -1,4 +1,7 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = "CONDOMS" -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = "CONDOM" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningImplnats.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningImplnats.sql index cd24f715..7a3e72e8 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningImplnats.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningImplnats.sql @@ -1,4 +1,8 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = "IMPLANTS" -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = "IMPLANTS" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); + \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningInject.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningInject.sql index 2d71845c..518d5796 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningInject.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningInject.sql @@ -1,4 +1,7 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = "INJECT" -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = "INJECT" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningLam.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningLam.sql index c1a8c47d..b7f3afd2 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningLam.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningLam.sql @@ -1,4 +1,7 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = "LAM" -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = "LAM" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningNecklace.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningNecklace.sql index e0469f4a..2618aa31 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningNecklace.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningNecklace.sql @@ -1,4 +1,7 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = "NECKLACE" -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = "NECKLACE" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningPills.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningPills.sql index 7a829ea9..8a73f7a7 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningPills.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningPills.sql @@ -1,4 +1,7 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = "PILLS" -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = "PILLS" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningVagTabs.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningVagTabs.sql index 1f663dd4..4754747b 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningVagTabs.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/patientsUsingFamilyPlanningVagTabs.sql @@ -1,4 +1,7 @@ SELECT pat.patient_id -FROM isanteplus.patient_on_art pat -WHERE pat.using_family_planning_method = "VAG_TABS" -AND pat.date_using_family_planning_method BETWEEN :startDate AND :endDate ; \ No newline at end of file +FROM isanteplus.patient_on_art pat, isanteplus.family_planning fp +WHERE pat.patient_id = fp.patient_id +AND fp.family_planning_method_name = "VAG_TABS" +AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate +AND fp.voided = 0 +AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/refferedInPatientsEnrolledOnArt.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/refferedInPatientsEnrolledOnArt.sql index a6abd478..91bf5b07 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/refferedInPatientsEnrolledOnArt.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/refferedInPatientsEnrolledOnArt.sql @@ -1,7 +1,8 @@ +/*2: Enrôlement et référence des personnes des populations clés*/ +/*2)Préalablement enrôlées et référées */ SELECT p.patient_id FROM isanteplus.patient p WHERE p.transferred_in = 1 - AND (p.birthdate <>'' AND p.birthdate is not null) AND p.date_started_arv IS NOT NULL AND p.date_started_arv BETWEEN :startDate AND :endDate AND p.voided = 0; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsAlreadyOnArtOnAntiTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsAlreadyOnArtOnAntiTbTreatment.sql index bb95b2d0..beedb795 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsAlreadyOnArtOnAntiTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsAlreadyOnArtOnAntiTbTreatment.sql @@ -6,4 +6,5 @@ FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplu AND p.date_started_arv < :startDate AND ps.date_started_status BETWEEN :startDate AND :endDate AND pat.date_enrolled_on_tb_treatment IS NOT NUlL - AND pat.date_enrolled_on_tb_treatment BETWEEN :startDate AND :endDate ; \ No newline at end of file + AND pat.date_enrolled_on_tb_treatment BETWEEN :startDate AND :endDate + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsNewlyEntolledOnArtOnAntiTbTreatment.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsNewlyEntolledOnArtOnAntiTbTreatment.sql index 80ca22ef..3bba96cf 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsNewlyEntolledOnArtOnAntiTbTreatment.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/tbHivPatientsNewlyEntolledOnArtOnAntiTbTreatment.sql @@ -1,9 +1,15 @@ SELECT ps.patient_id -FROM isanteplus.patient_status_arv ps ,isanteplus.patient_on_art pat , isanteplus.patient p +FROM isanteplus.patient_status_arv ps,isanteplus.patient_on_art pat, +isanteplus.patient p, (SELECT psa.patient_id, MAX(DATE(psa.date_started_status)) as date_status + FROM isanteplus.patient_status_arv psa WHERE + psa.date_started_status BETWEEN :startDate AND :endDate GROUP BY 1) B WHERE ps.patient_id = pat.patient_id AND p.patient_id = pat.patient_id + AND ps.patient_id = B.patient_id + AND DATE(ps.date_started_status) = DATE(B.date_status) AND ps.id_status IN (6,8) AND p.date_started_arv BETWEEN :startDate AND :endDate AND ps.date_started_status BETWEEN :startDate AND :endDate AND pat.date_enrolled_on_tb_treatment IS NOT NUlL - AND pat.date_enrolled_on_tb_treatment BETWEEN :startDate AND :endDate ; \ No newline at end of file + AND pat.date_enrolled_on_tb_treatment BETWEEN :startDate AND :endDate + AND p.voided <> 1; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/totalArvPatientsRecomendedPf.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/totalArvPatientsRecomendedPf.sql index 263ec627..bc1b39dd 100644 --- a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/totalArvPatientsRecomendedPf.sql +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/pnlsIndicatorReport/totalArvPatientsRecomendedPf.sql @@ -1,3 +1,15 @@ -SELECT p.patient_id -FROM isanteplus.patient p - WHERE p.date_started_arv BETWEEN :startDate AND :endDate ; \ No newline at end of file +/* 25 Nombre de patients ARV conseillés en PF*/ +SELECT fp.patient_id +FROM isanteplus.patient p, isanteplus.patient_on_arv pa, + isanteplus.family_planning fp, (SELECT plf.patient_id, + MAX(DATE(plf.encounter_date)) AS visit_date FROM isanteplus.family_planning plf + WHERE DATE(plf.encounter_date) BETWEEN :startDate AND :endDate + GROUP BY 1) B + WHERE p.patient_id = pa.patient_id + AND pa.patient_id = fp.patient_id + AND fp.patient_id = B.patient_id + AND DATE(fp.encounter_date) = DATE(B.visit_date) + AND DATE(fp.encounter_date) BETWEEN :startDate AND :endDate + AND p.voided <> 1 + AND fp.voided <> 1 + AND fp.accepting_or_using_fp IN (1,2); \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/psychoSocialReport/psychoSocialIndicators/activePatientOnArvHavingPsychosocialAssessment_den.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/psychoSocialReport/psychoSocialIndicators/activePatientOnArvHavingPsychosocialAssessment_den.sql new file mode 100644 index 00000000..1a6987c8 --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/psychoSocialReport/psychoSocialIndicators/activePatientOnArvHavingPsychosocialAssessment_den.sql @@ -0,0 +1,10 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/psychoSocialReport/psychoSocialIndicators/activePatientOnArvHavingPsychosocialAssessment_num.sql b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/psychoSocialReport/psychoSocialIndicators/activePatientOnArvHavingPsychosocialAssessment_num.sql new file mode 100644 index 00000000..389f331a --- /dev/null +++ b/api/src/main/resources/org/openmrs/module/isanteplusreports/sql/psychoSocialReport/psychoSocialIndicators/activePatientOnArvHavingPsychosocialAssessment_num.sql @@ -0,0 +1,18 @@ +SELECT p.patient_id FROM isanteplus.patient p,isanteplus.patient_status_arv psa, +(SELECT ps.patient_id, MAX(DATE(ps.date_started_status)) AS date_status + FROM isanteplus.patient_status_arv ps + WHERE DATE(ps.date_started_status) + between :startDate AND :endDate GROUP BY 1) B, openmrs.obs o, openmrs.encounter e, + openmrs.encounter_type et + WHERE p.patient_id = psa.patient_id + AND psa.patient_id = B.patient_id + AND B.patient_id = o.person_id + AND o.encounter_id = e.encounter_id + AND e.encounter_type = et.encounter_type_id + AND DATE(psa.date_started_status) = DATE(B.date_status) + AND psa.id_status IN (6,8) + AND et.uuid IN ('a0d57dca-3028-4153-88b7-c67a30fde595', + '51df75f7-a3de-4f82-a9df-c0bedaf5a2dd','09d3f0aa-bf4b-42b9-a750-138178bda202') + AND o.concept_id = 163340 + TIMESTAMPDIFF(MONTH, DATE(e.encounter_datetime),:endDate) BETWEEN 0 AND 12 + AND DATE(psa.date_started_status) between :startDate AND :endDate; \ No newline at end of file diff --git a/api/src/test/java/org/openmrs/module/isanteplusreports/healthqual/util/RegisterAllHealthQualReportsTest.java b/api/src/test/java/org/openmrs/module/isanteplusreports/healthqual/util/RegisterAllHealthQualReportsTest.java index c9974231..8d1da00a 100644 --- a/api/src/test/java/org/openmrs/module/isanteplusreports/healthqual/util/RegisterAllHealthQualReportsTest.java +++ b/api/src/test/java/org/openmrs/module/isanteplusreports/healthqual/util/RegisterAllHealthQualReportsTest.java @@ -10,10 +10,13 @@ import org.openmrs.module.reporting.definition.service.SerializedDefinitionService; import org.openmrs.module.reporting.report.definition.ReportDefinition; import org.openmrs.test.BaseModuleContextSensitiveTest; - +//import org.springframework.test.context.ContextConfiguration; +//@ContextConfiguration(locations = "isanteplusreports:webModuleApplicationContext.xml") +//@ContextConfiguration("/moduleApplicationContext.xml") +/*@ContextConfiguration(locations = { "classpath:applicationContext-service.xml", "classpath*:openmrs-servlet.xml", +"classpath*:moduleApplicationContext.xml" })*/ public class RegisterAllHealthQualReportsTest extends BaseModuleContextSensitiveTest { - - @Override + @Override public Properties getRuntimeProperties() { Properties p = super.getRuntimeProperties(); String url = "jdbc:h2:mem:isanteplus;MODE=MYSQL;DB_CLOSE_DELAY=30;LOCK_TIMEOUT=10000;" @@ -26,10 +29,11 @@ public Properties getRuntimeProperties() { return p; } - /** + /** * @see RegisterAllHealthQualReports#registerHealthEqualReportWithCurrentDateAndPeriodParamsNumDen(String,String,String,String) * @verifies save report definition and return valid instance */ + @Test public void registerHealthEqualReportWithCurrentDateAndPeriodParamsNumDen_shouldSaveReportDefinitionAndReturnValidInstance() throws Exception { diff --git a/omod/pom.xml b/omod/pom.xml index 85c357aa..3e293594 100644 --- a/omod/pom.xml +++ b/omod/pom.xml @@ -26,7 +26,7 @@ org.openmrs.module isanteplusreports-api - 1.0 + 1.1-SNAPSHOT org.openmrs.web diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/conventer/StringToAlertPrecoceIndicatorListConverter.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/conventer/StringToAlertPrecoceIndicatorListConverter.java new file mode 100644 index 00000000..7c45a991 --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/conventer/StringToAlertPrecoceIndicatorListConverter.java @@ -0,0 +1,32 @@ +package org.openmrs.module.isanteplusreports.conventer; + +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.type.JavaType; +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceSelectedIndicator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.List; + +@Component +public class StringToAlertPrecoceIndicatorListConverter implements Converter> { + + private static final Logger LOGGER = LoggerFactory.getLogger(StringToAlertPrecoceIndicatorListConverter.class); + + @Override + public List convert(String json) { + ObjectMapper mapper = new ObjectMapper(); + JavaType type = mapper.getTypeFactory().constructCollectionType(List.class, AlertPrecoceSelectedIndicator.class); + List list = null; + try { + list = mapper.readValue(json, type); + } + catch (IOException ex) { + LOGGER.error("Cannot convert json to List>. Null was returned"); + } + return list; + } +} \ No newline at end of file diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertPrecoceIndicatorReportPatientListPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertPrecoceIndicatorReportPatientListPageController.java new file mode 100644 index 00000000..ef0f93b1 --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertPrecoceIndicatorReportPatientListPageController.java @@ -0,0 +1,128 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.io.IOException; +import java.text.ParseException; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.Cohort; +import org.openmrs.api.context.Context; +import org.openmrs.module.coreapps.CoreAppsProperties; +import org.openmrs.module.isanteplusreports.IsantePlusReportsProperties; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.reporting.ReportingConstants; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.dataset.DataSetColumn; +import org.openmrs.module.reporting.dataset.MapDataSet; +import org.openmrs.module.reporting.dataset.definition.DataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.SimplePatientDataSetDefinition; +import org.openmrs.module.reporting.dataset.definition.service.DataSetDefinitionService; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.indicator.dimension.CohortIndicatorAndDimensionResult; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class AlertPrecoceIndicatorReportPatientListPageController { + + private final Log log = LogFactory.getLog(getClass()); + + public void get(@RequestParam(required = false, value = "savedDataSetKey") String savedDataSetKey, + @RequestParam(required = false, value = "savedColumnKey") String savedColumnKey, + @RequestParam(required = false, value = "applyDataSetId") String applyDataSetId, + @RequestParam(required = false, value = "limit") Integer limit, + @RequestParam(required = false, value = "columnKeyType") String columnKeyType, + @SpringBean CoreAppsProperties coreAppsProperties, + HttpServletRequest request, PageModel model) + throws EvaluationException, IOException, NumberFormatException, ParseException { + + @SuppressWarnings("unchecked") + List allReportData = (List) request.getSession().getAttribute(ReportingConstants.OPENMRS_REPORT_DATA + AlertPrecoceReportsConstants.ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX); + + for (ReportData reportData : allReportData) { + for (Map.Entry e : reportData.getDataSets().entrySet()) { + if (e.getKey().equals(savedDataSetKey)) { + + MapDataSet mapDataSet = (MapDataSet) e.getValue(); + DataSetColumn dataSetColumn = mapDataSet.getMetaData().getColumn(savedColumnKey); + model.addAttribute("selectedColumn", dataSetColumn); + + Object result = mapDataSet.getData(dataSetColumn); + Cohort selectedCohort = null; + log.debug(result.getClass().getName()); + if (result instanceof CohortIndicatorAndDimensionResult) { + CohortIndicatorAndDimensionResult cidr = (CohortIndicatorAndDimensionResult) mapDataSet + .getData(dataSetColumn); + if (columnKeyType.equals("denominator")) { //Can either be "denominator" or "numerator" (Default is numerator) + selectedCohort = cidr.getCohortIndicatorAndDimensionDenominator(); + } else { + selectedCohort = cidr.getCohortIndicatorAndDimensionCohort(); + } + } else if (result instanceof Cohort) { + selectedCohort = (Cohort) result; + } + + model.addAttribute("selectedCohort", selectedCohort); + + // Evaluate the default patient dataset definition + DataSetDefinition dsd = null; + if (applyDataSetId != null) { + try { + dsd = Context.getService(DataSetDefinitionService.class).getDefinition(applyDataSetId, null); + } + catch (Exception ex) { + log.error("exception getting dataset definition", ex); + } + } + + if (dsd == null) { + SimplePatientDataSetDefinition d = new SimplePatientDataSetDefinition(); + d.addPatientProperty("patientId"); + d.addIdentifierType(Context.getPatientService().getPatientIdentifierTypeByName("Code ST")); + d.addIdentifierType(Context.getPatientService().getPatientIdentifierTypeByName("Code National")); + d.addPatientProperty("givenName"); + d.addPatientProperty("familyName"); + d.addPatientProperty("age"); + d.addPatientProperty("gender"); + dsd = d; + } + + EvaluationContext evalContext = new EvaluationContext(); + if (limit != null && limit > 0) + evalContext.setLimit(limit); + evalContext.setBaseCohort(selectedCohort); + + DataSet patientDataSet = Context.getService(DataSetDefinitionService.class).evaluate(dsd, evalContext); + model.addAttribute("columnsValues", patientDataSet.iterator()); + model.addAttribute("dataSetDefinition", dsd); + + if (reportData != null) { + DataSet dataSet = null; + + for (String key : reportData.getDataSets().keySet()) { + dataSet = reportData.getDataSets().get(key); + } + + model.addAttribute("reportName", dataSet.getDefinition().getName()); + model.addAttribute("columns", dataSet.getMetaData().getColumns()); + model.addAttribute("dataset", dataSet); + model.addAttribute("startDate", request.getParameter("startDate")); + model.addAttribute("endDate", request.getParameter("endDate")); + model.addAttribute("id", request.getParameter("id")); + model.addAttribute("dashboardUrlWithoutQueryParams", + coreAppsProperties.getDashboardUrlWithoutQueryParams()); + model.addAttribute("privilegePatientDashboard", + IsantePlusReportsProperties.PRIVILEGE_PATIENT_DASHBOARD); + } + } + } + } + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertPrecoceReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertPrecoceReportPageController.java new file mode 100644 index 00000000..bd6e5b67 --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertPrecoceReportPageController.java @@ -0,0 +1,120 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceUtils.getReportData; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.time.DateUtils; +import org.openmrs.Location; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.alertprecoce.AlertPrecoceManager; +import org.openmrs.module.isanteplusreports.alertprecoce.builder.AlertPrecoceReportBuilder; +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceSelectedIndicator; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.ReportingConstants; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class AlertPrecoceReportPageController { + + public static final String NUMBER_OF_MALES_COLUMN_NAME = "M"; + + public static final String NUMBER_OF_FEMALES_COLUMN_NAME = "F"; + + public final static String LOCATION_SESSION_ATTRIBUTE = "emrContext.sessionLocationId"; + + public void get(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", null); + model.addAttribute("pdfResult", null); + } + + public void post(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(value = "indicatorList") List indicators, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, + PageModel model, HttpSession session) throws IOException { + + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + AlertPrecoceReportBuilder builder = new AlertPrecoceReportBuilder(); + Location location = getSessionLocation(session); + builder.setClinic(location.getDisplayString()); + builder.setClinicDepartment(location.getStateProvince()); + builder.setStartDate(startDate); + builder.setEndDate(endDate); + builder.setReportLabel("isanteplusreports.alertprecoce.report.label"); + setNumberOfPatients(startDate, endDate, builder); + + List allReportData = new ArrayList(); + for (AlertPrecoceSelectedIndicator indicator : indicators) { + ReportData reportData = getReportData(indicator.getUuid(), startDate, endDate, null); + allReportData.add(reportData); + builder.addReportData(reportData); + } + + session.setAttribute(ReportingConstants.OPENMRS_REPORT_DATA + AlertPrecoceReportsConstants.ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX, allReportData); + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", builder.buildHtmlTables()); + model.addAttribute("pdfResult", builder.buildPdf()); + } + + private Location getSessionLocation(HttpSession session) { + Location location = Context.getUserContext().getLocation(); + if (location == null) { + return Context.getLocationService().getDefaultLocation(); + } + + return location; // to get clinic data + } + + private void setNumberOfPatients(Date startDate, Date endDate, AlertPrecoceReportBuilder builder) { + ReportData numberOfPatientsReportData = getReportData(AlertPrecoceReportsConstants.NUMBER_PATIENTS_UUID, startDate, endDate, null); + if (numberOfPatientsReportData.getDataSets().isEmpty()) { + throw new HealthQualException("Cannot read number of patients - reportData is empty"); + } + Iterator rowIterator = numberOfPatientsReportData.getDataSets().values().iterator().next().iterator(); + if (!rowIterator.hasNext()) { + throw new HealthQualException("Cannot read number of patients - first dataSetRow is empty"); + } + DataSetRow row = rowIterator.next(); + builder.setMalePatients((Long) row.getColumnValue(NUMBER_OF_MALES_COLUMN_NAME)); + builder.setFemalePatients((Long) row.getColumnValue(NUMBER_OF_FEMALES_COLUMN_NAME)); + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertReportPageController.java new file mode 100644 index 00000000..3cb83a9e --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertReportPageController.java @@ -0,0 +1,37 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.api.context.Context; +import org.openmrs.module.coreapps.CoreAppsProperties; +import org.openmrs.module.isanteplusreports.IsantePlusReportsProperties; +import org.openmrs.module.isanteplusreports.api.IsantePlusReportsService; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; + +public class AlertReportPageController { + + private final Log log = LogFactory.getLog(getClass()); + + public void get(@SpringBean CoreAppsProperties coreAppsProperties, + HttpServletRequest request, PageModel model) throws EvaluationException, IOException, NumberFormatException, + ParseException { + DataSet dataset = Context.getService(IsantePlusReportsService.class).alertReport(); + model.addAttribute("columns", dataset.getMetaData().getColumns()); + model.addAttribute("columnsValues", dataset.iterator()); + model.addAttribute("dashboardUrlWithoutQueryParams", coreAppsProperties.getDashboardUrlWithoutQueryParams()); + model.addAttribute("privilegePatientDashboard", IsantePlusReportsProperties.PRIVILEGE_PATIENT_DASHBOARD); + + } +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertReportPatientListPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertReportPatientListPageController.java new file mode 100644 index 00000000..dae4ff5a --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/AlertReportPatientListPageController.java @@ -0,0 +1,41 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.api.context.Context; +import org.openmrs.module.coreapps.CoreAppsProperties; +import org.openmrs.module.isanteplusreports.IsantePlusReportsProperties; +import org.openmrs.module.isanteplusreports.api.IsantePlusReportsService; +import org.openmrs.module.isanteplusreports.definitions.ArvReportManager; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; + +public class AlertReportPatientListPageController { + +private final Log log = LogFactory.getLog(getClass()); + + public void get(@SpringBean ArvReportManager reportManager, @SpringBean CoreAppsProperties coreAppsProperties, + HttpServletRequest request, PageModel model) throws EvaluationException, IOException, NumberFormatException, + ParseException { + //DataSet dataSet = arv.patientListArvByPeriod(Integer.parseInt(request.getParameter("id")), startDate, endDate); + DataSet dataSet = Context.getService(IsantePlusReportsService.class).alertReportPatientList(Integer.parseInt(request.getParameter("id"))); + + model.addAttribute("columns", dataSet.getMetaData().getColumns()); + model.addAttribute("columnsValues", dataSet.iterator()); + model.addAttribute("id", request.getParameter("id")); + model.addAttribute("dashboardUrlWithoutQueryParams", coreAppsProperties.getDashboardUrlWithoutQueryParams()); + model.addAttribute("privilegePatientDashboard", IsantePlusReportsProperties.PRIVILEGE_PATIENT_DASHBOARD); + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/ArtDistributionReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/ArtDistributionReportPageController.java new file mode 100644 index 00000000..1077b40d --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/ArtDistributionReportPageController.java @@ -0,0 +1,121 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceUtils.getReportData; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.time.DateUtils; +import org.openmrs.Location; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.alertprecoce.AlertPrecoceManager; +import org.openmrs.module.isanteplusreports.alertprecoce.builder.AlertPrecoceReportBuilder; +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceSelectedIndicator; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.ReportingConstants; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class ArtDistributionReportPageController { + + public static final String NUMBER_OF_MALES_COLUMN_NAME = "M"; + + public static final String NUMBER_OF_FEMALES_COLUMN_NAME = "F"; + + public final static String LOCATION_SESSION_ATTRIBUTE = "emrContext.sessionLocationId"; + + public void get(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", null); + model.addAttribute("pdfResult", null); + } + + public void post(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(value = "indicatorList") List indicators, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, + PageModel model, HttpSession session) throws IOException { + + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + AlertPrecoceReportBuilder builder = new AlertPrecoceReportBuilder(); + Location location = getSessionLocation(session); + builder.setClinic(location.getDisplayString()); + builder.setClinicDepartment(location.getStateProvince()); + builder.setStartDate(startDate); + builder.setEndDate(endDate); + builder.setReportLabel("isanteplusreports.artdistribution.report.label"); + setNumberOfPatients(startDate, endDate, builder); + + List allReportData = new ArrayList(); + for (AlertPrecoceSelectedIndicator indicator : indicators) { + ReportData reportData = getReportData(indicator.getUuid(), startDate, endDate, null); + allReportData.add(reportData); + builder.addReportData(reportData); + } + + session.setAttribute(ReportingConstants.OPENMRS_REPORT_DATA + AlertPrecoceReportsConstants.ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX, allReportData); + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", builder.buildHtmlTables()); + model.addAttribute("pdfResult", builder.buildPdf()); + } + + private Location getSessionLocation(HttpSession session) { + Location location = Context.getUserContext().getLocation(); + if (location == null) { + return Context.getLocationService().getDefaultLocation(); + } + + return location; // to get clinic data + } + + private void setNumberOfPatients(Date startDate, Date endDate, AlertPrecoceReportBuilder builder) { + ReportData numberOfPatientsReportData = getReportData(AlertPrecoceReportsConstants.NUMBER_PATIENTS_UUID, startDate, endDate, null); + if (numberOfPatientsReportData.getDataSets().isEmpty()) { + throw new HealthQualException("Cannot read number of patients - reportData is empty"); + } + Iterator rowIterator = numberOfPatientsReportData.getDataSets().values().iterator().next().iterator(); + if (!rowIterator.hasNext()) { + throw new HealthQualException("Cannot read number of patients - first dataSetRow is empty"); + } + DataSetRow row = rowIterator.next(); + builder.setMalePatients((Long) row.getColumnValue(NUMBER_OF_MALES_COLUMN_NAME)); + builder.setFemalePatients((Long) row.getColumnValue(NUMBER_OF_FEMALES_COLUMN_NAME)); + } + +} + diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/DdpByPeriodReportListPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/DdpByPeriodReportListPageController.java new file mode 100644 index 00000000..94da7668 --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/DdpByPeriodReportListPageController.java @@ -0,0 +1,47 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; +import org.openmrs.api.context.Context; +import org.openmrs.module.coreapps.CoreAppsProperties; +import org.openmrs.module.isanteplusreports.IsantePlusReportsProperties; +import org.openmrs.module.isanteplusreports.api.IsantePlusReportsService; +import org.openmrs.module.isanteplusreports.definitions.DdpReportManager; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; + +public class DdpByPeriodReportListPageController { + + + public void get(@SpringBean DdpReportManager reportManager, @SpringBean CoreAppsProperties coreAppsProperties, + HttpServletRequest request, PageModel model) throws EvaluationException, IOException, NumberFormatException, + ParseException { + + DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + + String datA = inputFormat.format(inputFormat.parse(request.getParameter("startDate").toString())); + String datB = inputFormat.format(inputFormat.parse(request.getParameter("endDate").toString())); + + //DataSet dataSet = arv.patientListArvByPeriod(Integer.parseInt(request.getParameter("id")), startDate, endDate); + DataSet dataSet = Context.getService(IsantePlusReportsService.class).patientListDdpByPeriod( + Integer.parseInt(request.getParameter("id")), datA, datB); + + model.addAttribute("columns", dataSet.getMetaData().getColumns()); + model.addAttribute("columnsValues", dataSet.iterator()); + model.addAttribute("startDate", request.getParameter("startDate")); + model.addAttribute("endDate", request.getParameter("endDate")); + model.addAttribute("id", request.getParameter("id")); + model.addAttribute("dashboardUrlWithoutQueryParams", coreAppsProperties.getDashboardUrlWithoutQueryParams()); + model.addAttribute("privilegePatientDashboard", IsantePlusReportsProperties.PRIVILEGE_PATIENT_DASHBOARD); + model.addAttribute("i", 0); + } + + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/DdpByPeriodReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/DdpByPeriodReportPageController.java new file mode 100644 index 00000000..dc8e826c --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/DdpByPeriodReportPageController.java @@ -0,0 +1,88 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import org.apache.commons.lang.time.DateUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.openmrs.module.coreapps.CoreAppsProperties; +import org.openmrs.module.isanteplusreports.definitions.DdpReportManager; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.openmrs.module.reporting.report.definition.service.ReportDefinitionService; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class DdpByPeriodReportPageController { +private final Log log = LogFactory.getLog(getClass()); + + public void get(@SpringBean DdpReportManager reportManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws EvaluationException, + IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("ddpRows", null); + model.addAttribute("reportManager", reportManager); + model.addAttribute("startDate", null); + model.addAttribute("endDate", null); + + DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + model.addAttribute("date_debut", inputFormat.format(startDate)); + model.addAttribute("date_fin", inputFormat.format(endDate)); + } + + public void post(@SpringBean DdpReportManager reportManager, + @SpringBean ReportDefinitionService reportDefinitionService, @SpringBean CoreAppsProperties coreAppsProperties, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws EvaluationException, + IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + Map params = new HashMap(); + params.put("startDate", startDate); + params.put("endDate", endDate); + EvaluationContext context = reportManager.initializeContext(params); + ReportDefinition reportDefinition = reportManager.constructReportDefinition(); + ReportData reportData = reportDefinitionService.evaluate(reportDefinition, context); + + model.addAttribute("reportManager", reportManager); + model.addAttribute("ddpRows", reportData.getDataSets().get(DdpReportManager.DATA_SET_NAME)); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", DateUtil.getStartOfDay(endDate)); + startDate.getTime(); + model.addAttribute("dashboardUrl", coreAppsProperties.getDashboardUrl()); + + DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + model.addAttribute("date_debut", inputFormat.format(startDate)); + model.addAttribute("date_fin", inputFormat.format(endDate)); + } + + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/FingerPrintIndicatorReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/FingerPrintIndicatorReportPageController.java new file mode 100644 index 00000000..4b5c3665 --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/FingerPrintIndicatorReportPageController.java @@ -0,0 +1,119 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceUtils.getReportData; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.time.DateUtils; +import org.openmrs.Location; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.alertprecoce.AlertPrecoceManager; +import org.openmrs.module.isanteplusreports.alertprecoce.builder.AlertPrecoceReportBuilder; +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceSelectedIndicator; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.ReportingConstants; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class FingerPrintIndicatorReportPageController { + public static final String NUMBER_OF_MALES_COLUMN_NAME = "M"; + + public static final String NUMBER_OF_FEMALES_COLUMN_NAME = "F"; + + public final static String LOCATION_SESSION_ATTRIBUTE = "emrContext.sessionLocationId"; + + public void get(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", null); + model.addAttribute("pdfResult", null); + } + + public void post(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(value = "indicatorList") List indicators, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, + PageModel model, HttpSession session) throws IOException { + + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + AlertPrecoceReportBuilder builder = new AlertPrecoceReportBuilder(); + Location location = getSessionLocation(session); + builder.setClinic(location.getDisplayString()); + builder.setClinicDepartment(location.getStateProvince()); + builder.setStartDate(startDate); + builder.setEndDate(endDate); + builder.setReportLabel("isanteplusreports.fingerprint.indicator.label"); + setNumberOfPatients(startDate, endDate, builder); + + List allReportData = new ArrayList(); + for (AlertPrecoceSelectedIndicator indicator : indicators) { + ReportData reportData = getReportData(indicator.getUuid(), startDate, endDate, null); + allReportData.add(reportData); + builder.addReportData(reportData); + } + + session.setAttribute(ReportingConstants.OPENMRS_REPORT_DATA + AlertPrecoceReportsConstants.ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX, allReportData); + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", builder.buildHtmlTables()); + model.addAttribute("pdfResult", builder.buildPdf()); + } + + private Location getSessionLocation(HttpSession session) { + Location location = Context.getUserContext().getLocation(); + if (location == null) { + return Context.getLocationService().getDefaultLocation(); + } + + return location; // to get clinic data + } + + private void setNumberOfPatients(Date startDate, Date endDate, AlertPrecoceReportBuilder builder) { + ReportData numberOfPatientsReportData = getReportData(AlertPrecoceReportsConstants.NUMBER_PATIENTS_UUID, startDate, endDate, null); + if (numberOfPatientsReportData.getDataSets().isEmpty()) { + throw new HealthQualException("Cannot read number of patients - reportData is empty"); + } + Iterator rowIterator = numberOfPatientsReportData.getDataSets().values().iterator().next().iterator(); + if (!rowIterator.hasNext()) { + throw new HealthQualException("Cannot read number of patients - first dataSetRow is empty"); + } + DataSetRow row = rowIterator.next(); + builder.setMalePatients((Long) row.getColumnValue(NUMBER_OF_MALES_COLUMN_NAME)); + builder.setFemalePatients((Long) row.getColumnValue(NUMBER_OF_FEMALES_COLUMN_NAME)); + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PatientImmunizationDosesPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PatientImmunizationDosesPageController.java new file mode 100644 index 00000000..64cfab29 --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PatientImmunizationDosesPageController.java @@ -0,0 +1,45 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.util.Iterator; +import java.util.List; + +import org.json.JSONObject; +import org.openmrs.Patient; +import org.openmrs.PatientIdentifier; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.api.IsantePlusReportsService; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.dataset.DataSetColumn; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class PatientImmunizationDosesPageController { + + public void controller(PageModel model, @RequestParam("patientId") Patient patient) { + /* JSONObject patientOpts = new JSONObject(); + patientOpts.put("name", patient.getPersonName().getFullName()); + model.addAttribute("patientPropts", patientOpts); */ + + DataSet dataset = Context.getService(IsantePlusReportsService.class).patientImmunizationDoses(patient); + List columns = null; + Iterator columnsValues = null; + if(dataset != null){ + columns = dataset.getMetaData().getColumns(); + columnsValues = dataset.iterator(); + } + + PatientIdentifier pi = patient.getPatientIdentifier("iSantePlus ID"); + String location = null; + if(pi != null){ + location = pi.getLocation().getName(); + } + + model.addAttribute("location", location); + model.addAttribute("patient", patient); + model.addAttribute("columns", columns); + model.addAttribute("columnsvalues", columnsValues); + } + + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PsychoSocialIndicatorReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PsychoSocialIndicatorReportPageController.java new file mode 100644 index 00000000..b1ed5eba --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PsychoSocialIndicatorReportPageController.java @@ -0,0 +1,121 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceUtils.getReportData; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.time.DateUtils; +import org.openmrs.Location; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.alertprecoce.AlertPrecoceManager; +import org.openmrs.module.isanteplusreports.alertprecoce.builder.AlertPrecoceReportBuilder; +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceSelectedIndicator; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.ReportingConstants; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class PsychoSocialIndicatorReportPageController { + + public static final String NUMBER_OF_MALES_COLUMN_NAME = "M"; + + public static final String NUMBER_OF_FEMALES_COLUMN_NAME = "F"; + + public final static String LOCATION_SESSION_ATTRIBUTE = "emrContext.sessionLocationId"; + + public void get(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", null); + model.addAttribute("pdfResult", null); + } + + public void post(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(value = "indicatorList") List indicators, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, + PageModel model, HttpSession session) throws IOException { + + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + AlertPrecoceReportBuilder builder = new AlertPrecoceReportBuilder(); + Location location = getSessionLocation(session); + builder.setClinic(location.getDisplayString()); + builder.setClinicDepartment(location.getStateProvince()); + builder.setStartDate(startDate); + builder.setEndDate(endDate); + builder.setReportLabel("isanteplusreports.psychosocial.indicator.label"); + + setNumberOfPatients(startDate, endDate, builder); + + List allReportData = new ArrayList(); + for (AlertPrecoceSelectedIndicator indicator : indicators) { + ReportData reportData = getReportData(indicator.getUuid(), startDate, endDate, null); + allReportData.add(reportData); + builder.addReportData(reportData); + } + + session.setAttribute(ReportingConstants.OPENMRS_REPORT_DATA + AlertPrecoceReportsConstants.ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX, allReportData); + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", builder.buildHtmlTables()); + model.addAttribute("pdfResult", builder.buildPdf()); + } + + private Location getSessionLocation(HttpSession session) { + Location location = Context.getUserContext().getLocation(); + if (location == null) { + return Context.getLocationService().getDefaultLocation(); + } + + return location; // to get clinic data + } + + private void setNumberOfPatients(Date startDate, Date endDate, AlertPrecoceReportBuilder builder) { + ReportData numberOfPatientsReportData = getReportData(AlertPrecoceReportsConstants.NUMBER_PATIENTS_UUID, startDate, endDate, null); + if (numberOfPatientsReportData.getDataSets().isEmpty()) { + throw new HealthQualException("Cannot read number of patients - reportData is empty"); + } + Iterator rowIterator = numberOfPatientsReportData.getDataSets().values().iterator().next().iterator(); + if (!rowIterator.hasNext()) { + throw new HealthQualException("Cannot read number of patients - first dataSetRow is empty"); + } + DataSetRow row = rowIterator.next(); + builder.setMalePatients((Long) row.getColumnValue(NUMBER_OF_MALES_COLUMN_NAME)); + builder.setFemalePatients((Long) row.getColumnValue(NUMBER_OF_FEMALES_COLUMN_NAME)); + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PsychoSocialSummaryPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PsychoSocialSummaryPageController.java new file mode 100644 index 00000000..f2ea04ba --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/PsychoSocialSummaryPageController.java @@ -0,0 +1,40 @@ +package org.openmrs.module.isanteplusreports.page.controller; + + +import java.util.Iterator; +import java.util.List; +import org.openmrs.Patient; +import org.openmrs.PatientIdentifier; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.api.IsantePlusReportsService; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.dataset.DataSetColumn; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class PsychoSocialSummaryPageController { + + public void controller(PageModel model, @RequestParam("patientId") Patient patient) { + + DataSet dataset = Context.getService(IsantePlusReportsService.class).psychoSocialSummary(patient); + List columns = null; + Iterator columnsValues = null; + if(dataset != null){ + columns = dataset.getMetaData().getColumns(); + columnsValues = dataset.iterator(); + } + + PatientIdentifier pi = patient.getPatientIdentifier("iSantePlus ID"); + String location = null; + if(pi != null){ + location = pi.getLocation().getName(); + } + + model.addAttribute("location", location); + model.addAttribute("patient", patient); + model.addAttribute("columns", columns); + model.addAttribute("columnsvalues", columnsValues); + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/TransisionedPatientIndicatorReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/TransisionedPatientIndicatorReportPageController.java new file mode 100644 index 00000000..920e172c --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/TransisionedPatientIndicatorReportPageController.java @@ -0,0 +1,121 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceUtils.getReportData; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.time.DateUtils; +import org.openmrs.Location; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.alertprecoce.AlertPrecoceManager; +import org.openmrs.module.isanteplusreports.alertprecoce.builder.AlertPrecoceReportBuilder; +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceSelectedIndicator; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.ReportingConstants; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class TransisionedPatientIndicatorReportPageController { + + + public static final String NUMBER_OF_MALES_COLUMN_NAME = "M"; + + public static final String NUMBER_OF_FEMALES_COLUMN_NAME = "F"; + + public final static String LOCATION_SESSION_ATTRIBUTE = "emrContext.sessionLocationId"; + + public void get(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", null); + model.addAttribute("pdfResult", null); + } + + public void post(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(value = "indicatorList") List indicators, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, + PageModel model, HttpSession session) throws IOException { + + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + AlertPrecoceReportBuilder builder = new AlertPrecoceReportBuilder(); + Location location = getSessionLocation(session); + builder.setClinic(location.getDisplayString()); + builder.setClinicDepartment(location.getStateProvince()); + builder.setStartDate(startDate); + builder.setEndDate(endDate); + builder.setReportLabel("isanteplusreports.report.transitionedPatient"); + setNumberOfPatients(startDate, endDate, builder); + + List allReportData = new ArrayList(); + for (AlertPrecoceSelectedIndicator indicator : indicators) { + ReportData reportData = getReportData(indicator.getUuid(), startDate, endDate, null); + allReportData.add(reportData); + builder.addReportData(reportData); + } + + session.setAttribute(ReportingConstants.OPENMRS_REPORT_DATA + AlertPrecoceReportsConstants.ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX, allReportData); + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", builder.buildHtmlTables()); + model.addAttribute("pdfResult", builder.buildPdf()); + } + + private Location getSessionLocation(HttpSession session) { + Location location = Context.getUserContext().getLocation(); + if (location == null) { + return Context.getLocationService().getDefaultLocation(); + } + + return location; // to get clinic data + } + + private void setNumberOfPatients(Date startDate, Date endDate, AlertPrecoceReportBuilder builder) { + ReportData numberOfPatientsReportData = getReportData(AlertPrecoceReportsConstants.NUMBER_PATIENTS_UUID, startDate, endDate, null); + if (numberOfPatientsReportData.getDataSets().isEmpty()) { + throw new HealthQualException("Cannot read number of patients - reportData is empty"); + } + Iterator rowIterator = numberOfPatientsReportData.getDataSets().values().iterator().next().iterator(); + if (!rowIterator.hasNext()) { + throw new HealthQualException("Cannot read number of patients - first dataSetRow is empty"); + } + DataSetRow row = rowIterator.next(); + builder.setMalePatients((Long) row.getColumnValue(NUMBER_OF_MALES_COLUMN_NAME)); + builder.setFemalePatients((Long) row.getColumnValue(NUMBER_OF_FEMALES_COLUMN_NAME)); + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/VitalStatisticsIndicatorPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/VitalStatisticsIndicatorPageController.java new file mode 100644 index 00000000..3b116ca9 --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/VitalStatisticsIndicatorPageController.java @@ -0,0 +1,121 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import static org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceUtils.getReportData; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.lang.time.DateUtils; +import org.openmrs.Location; +import org.openmrs.api.context.Context; +import org.openmrs.module.isanteplusreports.alertprecoce.AlertPrecoceManager; +import org.openmrs.module.isanteplusreports.alertprecoce.builder.AlertPrecoceReportBuilder; +import org.openmrs.module.isanteplusreports.alertprecoce.model.AlertPrecoceSelectedIndicator; +import org.openmrs.module.isanteplusreports.alertprecoce.util.AlertPrecoceReportsConstants; +import org.openmrs.module.isanteplusreports.exception.HealthQualException; +import org.openmrs.module.reporting.ReportingConstants; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.dataset.DataSetRow; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class VitalStatisticsIndicatorPageController { + + public static final String NUMBER_OF_MALES_COLUMN_NAME = "M"; + + public static final String NUMBER_OF_FEMALES_COLUMN_NAME = "F"; + + public final static String LOCATION_SESSION_ATTRIBUTE = "emrContext.sessionLocationId"; + + public void get(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", null); + model.addAttribute("pdfResult", null); + } + + public void post(@SpringBean AlertPrecoceManager alertPrecoceManager, + @RequestParam(value = "indicatorList") List indicators, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, + PageModel model, HttpSession session) throws IOException { + + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -21); + } + if (endDate == null) { + endDate = new Date(); + } + + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + AlertPrecoceReportBuilder builder = new AlertPrecoceReportBuilder(); + Location location = getSessionLocation(session); + builder.setClinic(location.getDisplayString()); + builder.setClinicDepartment(location.getStateProvince()); + builder.setStartDate(startDate); + builder.setEndDate(endDate); + builder.setReportLabel("isanteplusreports.report.vitalStatistics"); + setNumberOfPatients(startDate, endDate, builder); + + List allReportData = new ArrayList(); + for (AlertPrecoceSelectedIndicator indicator : indicators) { + ReportData reportData = getReportData(indicator.getUuid(), startDate, endDate, null); + allReportData.add(reportData); + builder.addReportData(reportData); + } + + session.setAttribute(ReportingConstants.OPENMRS_REPORT_DATA + AlertPrecoceReportsConstants.ALERT_PRECOCE_GENERAL_PURPOSE_SUFFIX, allReportData); + model.addAttribute("manager", alertPrecoceManager); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", endDate); + model.addAttribute("htmlResult", builder.buildHtmlTables()); + model.addAttribute("pdfResult", builder.buildPdf()); + } + + private Location getSessionLocation(HttpSession session) { + Location location = Context.getUserContext().getLocation(); + if (location == null) { + return Context.getLocationService().getDefaultLocation(); + } + + return location; // to get clinic data + } + + private void setNumberOfPatients(Date startDate, Date endDate, AlertPrecoceReportBuilder builder) { + ReportData numberOfPatientsReportData = getReportData(AlertPrecoceReportsConstants.NUMBER_PATIENTS_UUID, startDate, endDate, null); + if (numberOfPatientsReportData.getDataSets().isEmpty()) { + throw new HealthQualException("Cannot read number of patients - reportData is empty"); + } + Iterator rowIterator = numberOfPatientsReportData.getDataSets().values().iterator().next().iterator(); + if (!rowIterator.hasNext()) { + throw new HealthQualException("Cannot read number of patients - first dataSetRow is empty"); + } + DataSetRow row = rowIterator.next(); + builder.setMalePatients((Long) row.getColumnValue(NUMBER_OF_MALES_COLUMN_NAME)); + builder.setFemalePatients((Long) row.getColumnValue(NUMBER_OF_FEMALES_COLUMN_NAME)); + } + + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/WeeklyMonitoringReportPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/WeeklyMonitoringReportPageController.java new file mode 100644 index 00000000..c14ef57a --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/WeeklyMonitoringReportPageController.java @@ -0,0 +1,113 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import org.apache.commons.lang.time.DateUtils; +import org.openmrs.module.coreapps.CoreAppsProperties; +import org.openmrs.module.isanteplusreports.definitions.WeeklyMonitoringReportManager; +import org.openmrs.module.reporting.common.DateUtil; +import org.openmrs.module.reporting.evaluation.EvaluationContext; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.module.reporting.report.ReportData; +import org.openmrs.module.reporting.report.definition.ReportDefinition; +import org.openmrs.module.reporting.report.definition.service.ReportDefinitionService; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; +import org.springframework.web.bind.annotation.RequestParam; + +public class WeeklyMonitoringReportPageController { + + /*public void get(@SpringBean WeeklyMonitoringReportManager reportManager, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws EvaluationException, + IOException {*/ + public void get(@SpringBean WeeklyMonitoringReportManager reportManager, + @SpringBean ReportDefinitionService reportDefinitionService, @SpringBean CoreAppsProperties coreAppsProperties, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws EvaluationException, + IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -7); + } + if (endDate == null) { + endDate = new Date(); + } + /* + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + model.addAttribute("nonCodedRows", null); + model.addAttribute("reportManager", reportManager); + model.addAttribute("startDate", null); + model.addAttribute("endDate", null); + + DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + model.addAttribute("date_debut", inputFormat.format(startDate)); + model.addAttribute("date_fin", inputFormat.format(endDate)); + + */ + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + Map params = new HashMap(); + params.put("startDate", startDate); + params.put("endDate", endDate); + EvaluationContext context = reportManager.initializeContext(params); + ReportDefinition reportDefinition = reportManager.constructReportDefinition(); + ReportData reportData = reportDefinitionService.evaluate(reportDefinition, context); + + model.addAttribute("reportManager", reportManager); + model.addAttribute("nonCodedRows", reportData.getDataSets().get(WeeklyMonitoringReportManager.DATA_SET_NAME)); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", DateUtil.getStartOfDay(endDate)); + startDate.getTime(); + model.addAttribute("dashboardUrl", coreAppsProperties.getDashboardUrl()); + + DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + model.addAttribute("date_debut", inputFormat.format(startDate)); + model.addAttribute("date_fin", inputFormat.format(endDate)); + + } + + public void post(@SpringBean WeeklyMonitoringReportManager reportManager, + @SpringBean ReportDefinitionService reportDefinitionService, @SpringBean CoreAppsProperties coreAppsProperties, + @RequestParam(required = false, value = "startDate") Date startDate, + @RequestParam(required = false, value = "endDate") Date endDate, PageModel model) throws EvaluationException, + IOException { + + if (startDate == null) { + startDate = DateUtils.addDays(new Date(), -7); + } + if (endDate == null) { + endDate = new Date(); + } + startDate = DateUtil.getStartOfDay(startDate); + endDate = DateUtil.getEndOfDay(endDate); + + Map params = new HashMap(); + params.put("startDate", startDate); + params.put("endDate", endDate); + EvaluationContext context = reportManager.initializeContext(params); + ReportDefinition reportDefinition = reportManager.constructReportDefinition(); + ReportData reportData = reportDefinitionService.evaluate(reportDefinition, context); + + model.addAttribute("reportManager", reportManager); + model.addAttribute("nonCodedRows", reportData.getDataSets().get(WeeklyMonitoringReportManager.DATA_SET_NAME)); + model.addAttribute("startDate", startDate); + model.addAttribute("endDate", DateUtil.getStartOfDay(endDate)); + startDate.getTime(); + model.addAttribute("dashboardUrl", coreAppsProperties.getDashboardUrl()); + + DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + model.addAttribute("date_debut", inputFormat.format(startDate)); + model.addAttribute("date_fin", inputFormat.format(endDate)); + } + +} diff --git a/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/WeeklyMonitoringReportPatientListPageController.java b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/WeeklyMonitoringReportPatientListPageController.java new file mode 100644 index 00000000..067ab02a --- /dev/null +++ b/omod/src/main/java/org/openmrs/module/isanteplusreports/page/controller/WeeklyMonitoringReportPatientListPageController.java @@ -0,0 +1,43 @@ +package org.openmrs.module.isanteplusreports.page.controller; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Locale; + +import javax.servlet.http.HttpServletRequest; + +import org.openmrs.api.context.Context; +import org.openmrs.module.coreapps.CoreAppsProperties; +import org.openmrs.module.isanteplusreports.IsantePlusReportsProperties; +import org.openmrs.module.isanteplusreports.api.IsantePlusReportsService; +import org.openmrs.module.isanteplusreports.definitions.ArvReportManager; +import org.openmrs.module.reporting.dataset.DataSet; +import org.openmrs.module.reporting.evaluation.EvaluationException; +import org.openmrs.ui.framework.annotation.SpringBean; +import org.openmrs.ui.framework.page.PageModel; + +public class WeeklyMonitoringReportPatientListPageController { + + public void get(@SpringBean ArvReportManager reportManager, @SpringBean CoreAppsProperties coreAppsProperties, + HttpServletRequest request, PageModel model) throws EvaluationException, IOException, NumberFormatException, + ParseException { + + DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()); + + String datA = inputFormat.format(inputFormat.parse(request.getParameter("startDate").toString())); + String datB = inputFormat.format(inputFormat.parse(request.getParameter("endDate").toString())); + DataSet dataSet = Context.getService(IsantePlusReportsService.class).weeklyMonitoringReportpatientList( + Integer.parseInt(request.getParameter("id")), datA, datB); + + model.addAttribute("columns", dataSet.getMetaData().getColumns()); + model.addAttribute("columnsValues", dataSet.iterator()); + model.addAttribute("startDate", request.getParameter("startDate")); + model.addAttribute("endDate", request.getParameter("endDate")); + model.addAttribute("id", request.getParameter("id")); + model.addAttribute("dashboardUrlWithoutQueryParams", coreAppsProperties.getDashboardUrlWithoutQueryParams()); + model.addAttribute("privilegePatientDashboard", IsantePlusReportsProperties.PRIVILEGE_PATIENT_DASHBOARD); + + } +} \ No newline at end of file diff --git a/omod/src/main/resources/apps/isanteplusreportspatientsummary_extension.json b/omod/src/main/resources/apps/isanteplusreportspatientsummary_extension.json index 1484a7f9..38cbdd6e 100644 --- a/omod/src/main/resources/apps/isanteplusreportspatientsummary_extension.json +++ b/omod/src/main/resources/apps/isanteplusreportspatientsummary_extension.json @@ -7,5 +7,24 @@ "url": "${project.parent.artifactId}/patientSummary.page?patientId={{patient.uuid}}", "icon": "icon-beaker", "order": 50 + }, + { + "id": "isanteplusreports.patientImmunization", + "extensionPointId": "patientDashboard.overallActions", + "type": "link", + "label": "${project.parent.artifactId}.patientImmunization", + "url": "${project.parent.artifactId}/patientImmunizationDoses.page?patientId={{patient.uuid}}", + "icon": "icon-beaker", + "order": 10 + }, + { + "id": "isanteplusreports.psychoSocialSummary", + "extensionPointId": "patientDashboard.overallActions", + "type": "link", + "label": "${project.parent.artifactId}.psychoSocialSummary", + "url": "${project.parent.artifactId}/psychoSocialSummary.page?patientId={{patient.uuid}}", + "icon": "icon-beaker", + "order": 13 } + ] \ No newline at end of file diff --git a/omod/src/main/resources/apps/reportsmenu_app.json b/omod/src/main/resources/apps/reportsmenu_app.json index c58ea870..8233326b 100644 --- a/omod/src/main/resources/apps/reportsmenu_app.json +++ b/omod/src/main/resources/apps/reportsmenu_app.json @@ -256,16 +256,16 @@ "url": "reportingui/runReport.page?reportDefinition=33c5cee6-8102-43c1-975e-c11b3ce26ea9", "order": 37, "requiredPrivilege": "App: reportingui.reports" - }, + }, { - "id": "Address and Diagnosis", + "id": "isanteplusreports.alert", "extensionPointId": "org.openmrs.module.reportingui.reports.overview", "type": "link", "label": "isanteplusreports.alert", - "url": "reportingui/runReport.page?reportDefinition=bbb6e146-67f3-49fd-be43-7aeb776def9b", + "url": "isanteplusreports/alertReport.page", "order": 38, "requiredPrivilege": "App: reportingui.reports" - }, + }, { "id": "isanteplusreports.patient_with_only_register_form", "extensionPointId": "org.openmrs.module.reportingui.reports.dataquality", @@ -307,7 +307,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.ptme", "type": "link", "label": "isanteplusreports.number_pregnancy_women_hiv_tested", - "url": "reportingui/runIndicatorReport.page?reportDefinition=7a55fec8-6189-4e0f-9742-a462e4dbc189", + "url": "reportingui/runReport.page?reportDefinition=7a55fec8-6189-4e0f-9742-a462e4dbc189", "order": 43, "requiredPrivilege": "App: reportingui.reports" }, @@ -316,7 +316,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.ptme", "type": "link", "label": "isanteplusreports.number_prenancy_women_vih_positive", - "url": "reportingui/runIndicatorReport.page?reportDefinition=f5c6a8db-73cb-4537-b2ce-833cf850fad4", + "url": "reportingui/runReport.page?reportDefinition=f5c6a8db-73cb-4537-b2ce-833cf850fad4", "order": 44, "requiredPrivilege": "App: reportingui.reports" }, @@ -343,7 +343,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.ptme", "type": "link", "label": "isanteplusreports.number_hiv_pregnancy_women_gave_birth_at_hospital", - "url": "reportingui/runIndicatorReport.page?reportDefinition=a366a646-382a-4eb1-b2a7-16282579c9df", + "url": "reportingui/runReport.page?reportDefinition=a366a646-382a-4eb1-b2a7-16282579c9df", "order": 51, "requiredPrivilege": "App: reportingui.reports" }, @@ -361,7 +361,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.ptme", "type": "link", "label": "isanteplusreports.number_infants_from_mother_on_prophylaxis", - "url": "reportingui/runIndicatorReport.page?reportDefinition=d0ba4eba-dc36-4adc-9c0e-f0eb244fd279", + "url": "reportingui/runReport.page?reportDefinition=d0ba4eba-dc36-4adc-9c0e-f0eb244fd279", "order": 53, "requiredPrivilege": "App: reportingui.reports" }, @@ -388,7 +388,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.ptme", "type": "link", "label": "isanteplusreports.number_exposed_infants_confirmed_hiv", - "url": "reportingui/runIndicatorReport.page?reportDefinition=1c072b8f-2740-4cb4-aff7-6d0095df2437", + "url": "reportingui/runReport.page?reportDefinition=1c072b8f-2740-4cb4-aff7-6d0095df2437", "order": 56, "requiredPrivilege": "App: reportingui.reports" }, @@ -397,7 +397,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.antenatal", "type": "link", "label": "isanteplusreports.number_women_seen_first_prenatal_visit_first_trimester", - "url": "reportingui/runIndicatorReport.page?reportDefinition=99dd9482-6e97-49be-8e6e-123ba8f689cb", + "url": "reportingui/runReport.page?reportDefinition=99dd9482-6e97-49be-8e6e-123ba8f689cb", "order": 57, "requiredPrivilege": "App: reportingui.reports" }, @@ -415,7 +415,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.antenatal", "type": "link", "label": "isanteplusreports.number_visits_by_pregnant_women_to_the_clinic", - "url": "reportingui/runIndicatorReport.page?reportDefinition=6647de56-ada8-4a01-a5ed-3e8db17d3957", + "url": "reportingui/runReport.page?reportDefinition=6647de56-ada8-4a01-a5ed-3e8db17d3957", "order": 60, "requiredPrivilege": "App: reportingui.reports" }, @@ -613,7 +613,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.ptme", "type": "link", "label": "isanteplusreports.womenEnrolledBecamePregnant", - "url": "reportingui/runIndicatorReport.page?reportDefinition=c1c3838d-80bb-44c3-963d-2283078bf274", + "url": "reportingui/runReport.page?reportDefinition=c1c3838d-80bb-44c3-963d-2283078bf274", "order": 145, "requiredPrivilege": "App: reportingui.reports" }, @@ -640,7 +640,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.antenatal", "type": "link", "label": "isanteplusreports.pregnancy_women_tested_for_syphilis", - "url": "reportingui/runIndicatorReport.page?reportDefinition=23f61edd-76b1-4e68-a24d-c3c16a91436d", + "url": "reportingui/runReport.page?reportDefinition=23f61edd-76b1-4e68-a24d-c3c16a91436d", "order": 47, "requiredPrivilege": "App: reportingui.reports" }, @@ -649,7 +649,7 @@ "extensionPointId": "org.openmrs.module.isanteplusreports.reports.antenatal", "type": "link", "label": "isanteplusreports.pregnancy_women_diagnosed_with_syphilis", - "url": "reportingui/runIndicatorReport.page?reportDefinition=613d0119-cb40-4fed-aa67-56f032a20cc9", + "url": "reportingui/runReport.page?reportDefinition=613d0119-cb40-4fed-aa67-56f032a20cc9", "order": 48, "requiredPrivilege": "App: reportingui.reports" }, @@ -720,6 +720,15 @@ "requiredPrivilege": "App: reportingui.reports" }, { + "id": "isanteplusreports.activity_after_discontinuation_by_period", + "extensionPointId": "org.openmrs.module.reportingui.reports.dataquality", + "type": "link", + "label": "isanteplusreports.activity_after_discontinuation_by_period", + "url": "reportingui/runReport.page?reportDefinition=7414a044-ace9-4140-88f2-5b79d869b5c9", + "order": 180, + "requiredPrivilege": "App: reportingui.reports" + }, + { "id": "isanteplusreports.pnls_report", "extensionPointId": "org.openmrs.module.reportingui.reports.overview", "type": "link", @@ -727,7 +736,171 @@ "url": "isanteplusreports/pnlsReport.page", "order": 200, "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.patient_diagnose_for_covid19", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.patient_diagnose_for_covid19", + "url": "reportingui/runReport.page?reportDefinition=c6381c6e-b9a4-49d3-84bd-210a0bc6b0dd", + "order": 201, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.patient_vaccinated_covid19", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.patient_vaccinated_covid19", + "url": "reportingui/runReport.page?reportDefinition=de5c0d89-4d01-4f1a-99dd-20b3dd778bc", + "order": 202, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.alertPrecoce_report", + "extensionPointId": "org.openmrs.module.isanteplusreports.reports.alertprecoce", + "type": "link", + "label": "isanteplusreports.alertprecoce.report.label", + "url": "isanteplusreports/alertPrecoceReport.page", + "order": 203, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.weeklymonitoringreport.indicator.label", + "extensionPointId": "org.openmrs.module.isanteplusreports.reports.dashboard", + "type": "link", + "label": "isanteplusreports.weeklymonitoringreport.indicator.label", + "url": "isanteplusreports/weeklyMonitoringReport.page", + "order": 204, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.artdistribution.report.label", + "extensionPointId": "org.openmrs.module.isanteplusreports.reports.dashboard", + "type": "link", + "label": "isanteplusreports.artdistribution.report.label", + "url": "isanteplusreports/artDistributionReport.page", + "order": 205, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.patient_confirm_covid19", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.patient_confirm_covid19", + "url": "reportingui/runReport.page?reportDefinition=358f6c1f-6751-4ed0-8567-95a3ac227f39", + "order": 206, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.patient_suspected_covid19", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.patient_suspected_covid19", + "url": "reportingui/runReport.page?reportDefinition=27f98dae-6c6d-4424-87d2-bd41305253f4", + "order": 207, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.isanteplusreports.hiv_patients_without_hiv_test", + "extensionPointId": "org.openmrs.module.reportingui.reports.dataquality", + "type": "link", + "label": "isanteplusreports.hiv_patients_without_hiv_test", + "url": "reportingui/runReport.page?reportDefinition=3d931155-97ce-4c83-8652-37735bf48e45", + "order": 208, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.psychosocial.indicator.label", + "extensionPointId": "org.openmrs.module.isanteplusreports.reports.psychosocial", + "type": "link", + "label": "isanteplusreports.psychosocial.indicator.label", + "url": "isanteplusreports/psychoSocialIndicatorReport.page", + "order": 209, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.reports.activePatientsWithViralLoadLastTwelveMonths", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.reports.activePatientsWithViralLoadLastTwelveMonths", + "url": "reportingui/runReport.page?reportDefinition=bb53535b-4d85-4315-8506-8b242e60cfd9", + "order": 210, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.reports.activePatientsScreenedForTb", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.reports.activePatientsScreenedForTb", + "url": "reportingui/runReport.page?reportDefinition=8a6bf7f0-5a50-4221-83ad-61d29057864e", + "order": 211, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.reports.patientWithIncompleteProphylaxisAgainstTb", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.reports.patientWithIncompleteProphylaxisAgainstTb", + "url": "reportingui/runReport.page?reportDefinition=f48cf8ec-feb2-4473-89ec-4ab19dc48738", + "order": 212, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.reports.patientScreenedNegativeAgainstTbWithNoProphylaxis", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.reports.patientScreenedNegativeAgainstTbWithNoProphylaxis", + "url": "reportingui/runReport.page?reportDefinition=85d9ca70-81d7-4082-93c0-d9eeed450632", + "order": 213, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.report.ddp", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.report.ddp", + "url": "isanteplusreports/ddpByPeriodReport.page", + "order": 214, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.report.patient_with_finger_print", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.report.patient_with_finger_print", + "url": "reportingui/runReport.page?reportDefinition=2a06491b-9f73-40a6-bed6-8c39fade8d7a", + "order": 215, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.fingerprint.indicator.label", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.fingerprint.indicator.label", + "url": "isanteplusreports/fingerPrintIndicatorReport.page", + "order": 216, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.report.transitionedPatient", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.report.transitionedPatient", + "url": "isanteplusreports/transisionedPatientIndicatorReport.page", + "order": 217, + "requiredPrivilege": "App: reportingui.reports" + }, + { + "id": "isanteplusreports.report.vitalStatistics", + "extensionPointId": "org.openmrs.module.reportingui.reports.overview", + "type": "link", + "label": "isanteplusreports.report.vitalStatistics", + "url": "isanteplusreports/vitalStatisticsIndicator.page", + "order": 218, + "requiredPrivilege": "App: reportingui.reports" } + + ], "requiredPrivilege": "App: reportingui.reports" diff --git a/omod/src/main/webapp/fragments/alertPrecoceIndicator.gsp b/omod/src/main/webapp/fragments/alertPrecoceIndicator.gsp new file mode 100644 index 00000000..d69631f8 --- /dev/null +++ b/omod/src/main/webapp/fragments/alertPrecoceIndicator.gsp @@ -0,0 +1,13 @@ +<% + def indicator = config.indicator +%> + + + ${ indicator.getName() } + + +
+ +
+ + \ No newline at end of file diff --git a/omod/src/main/webapp/fragments/selectedIndicator.gsp b/omod/src/main/webapp/fragments/selectedIndicator.gsp new file mode 100644 index 00000000..282c4a02 --- /dev/null +++ b/omod/src/main/webapp/fragments/selectedIndicator.gsp @@ -0,0 +1,13 @@ +<% + def indicator = config.indicator +%> + + + ${ indicator.getName() } + + +
+ +
+ + \ No newline at end of file diff --git a/omod/src/main/webapp/pages/alertPrecoceIndicatorReportPatientList.gsp b/omod/src/main/webapp/pages/alertPrecoceIndicatorReportPatientList.gsp new file mode 100644 index 00000000..6814efb3 --- /dev/null +++ b/omod/src/main/webapp/pages/alertPrecoceIndicatorReportPatientList.gsp @@ -0,0 +1,145 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("coreapps", "fragments/datamanagement/codeDiagnosisDialog.js") + ui.includeJavascript("uicommons", "datatables/jquery.dataTables.min.js") + ui.includeJavascript("isanteplusreports", "print.js") + ui.includeJavascript("isanteplusreports", "isanteplusReport.js") + ui.includeCss("uicommons", "datatables/dataTables_jui.css") +%> + + + + + + +
+    + +

+
+ ${ ui.message(reportName) } ${ ui.message("isanteplusreports.from") } ${ui.format(dataset.getContext().getParameterValue("startDate"))} ${ ui.message("isanteplusreports.to") } ${ui.format(dataset.getContext().getParameterValue("endDate"))}

+
+ + + + + + + + + +
+ <% columnsValues.each { %> +
+ + + + + + + + <% } %> + +
${ ui.message("isanteplusreports.code_st") }${ ui.message("isanteplusreports.identifier") }${ ui.message("isanteplusreports.name") }${ ui.message("isanteplusreports.familyName") }${ ui.message("isanteplusreports.age") }${ ui.message("isanteplusreports.sex") }
+ + ${ui.format(it.getColumnValue("Code ST"))} + + + + ${ui.format(it.getColumnValue("Code National"))} + + + + ${ui.format(it.getColumnValue("givenName"))} + + + + ${ui.format(it.getColumnValue("familyName"))} + + + + ${ui.format(it.getColumnValue("Age"))} + + + + ${ui.format(it.getColumnValue("gender"))} + +
+
+
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/alertPrecoceReport.gsp b/omod/src/main/webapp/pages/alertPrecoceReport.gsp new file mode 100644 index 00000000..3c4bf344 --- /dev/null +++ b/omod/src/main/webapp/pages/alertPrecoceReport.gsp @@ -0,0 +1,221 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("isanteplusreports", "healthQualExportToExcel.js") +%> + + + + + +
+ +

${ ui.message("isanteplusreports.alertprecoce.report.label") }

+
+ +
+
+ + ${ ui.message("reportingui.runReport.run.legend") } + +

${ ui.message("isanteplusreports.pnls.select.all") }

+

+ ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": "From Date", "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": "To Date", "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } +

+ +

+ + + + + + + + + + + + + <% manager.alertPrecoceIndicators.each { indicator -> %> + ${ ui.includeFragment("isanteplusreports", "alertPrecoceIndicator", [indicator: indicator]) } + <% } %> + +
${ ui.message("isanteplusreports.healthqual.indicator.label") }${ ui.message("isanteplusreports.healthqual.selection.label") }
+ ${ ui.message("isanteplusreports.alertprecoce.report.label") } +
+
+ + <% if (htmlResult != null) { %> +

+ ${ ui.message("isanteplusreports.alertprecoce.result.label") } +

+ + +
+ <%= htmlResult %> +
+ <% } %> +
+ +
diff --git a/omod/src/main/webapp/pages/alertReport.gsp b/omod/src/main/webapp/pages/alertReport.gsp new file mode 100644 index 00000000..9031eb09 --- /dev/null +++ b/omod/src/main/webapp/pages/alertReport.gsp @@ -0,0 +1,51 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("coreapps", "fragments/datamanagement/codeDiagnosisDialog.js") + ui.includeJavascript("uicommons", "datatables/jquery.dataTables.min.js") + +%> + + + + +
+ +
+ + + + + + + + + + <% if (columnsValues == null ) { %> + + + + <% } else columnsValues.each { %> + + + + + + <% } %> + +
AlertTotal
No result
+ ${ ui.format(it.getColumnValue("Alert")) } + + + ${ ui.format(it.getColumnValue("Total")) } + +
+ +
+ +
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/alertReportPatientList.gsp b/omod/src/main/webapp/pages/alertReportPatientList.gsp new file mode 100644 index 00000000..93a9fec8 --- /dev/null +++ b/omod/src/main/webapp/pages/alertReportPatientList.gsp @@ -0,0 +1,126 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("coreapps", "fragments/datamanagement/codeDiagnosisDialog.js") + ui.includeJavascript("uicommons", "datatables/jquery.dataTables.min.js") + ui.includeJavascript("isanteplusreports", "print.js") +%> + + + +
+    + +

+
+ ${ ui.message("isanteplusreports.alert") }

+
+ + + + + + + + + +
+ <% columnsValues.each { %> +
+ + + + + + + + <% } %> + +
${ ui.message("isanteplusreports.code_st") }${ ui.message("isanteplusreports.identifier") }${ ui.message("isanteplusreports.name") }${ ui.message("isanteplusreports.familyName") }${ ui.message("isanteplusreports.age") }${ ui.message("isanteplusreports.sex") }
+ + ${ui.format(it.getColumnValue("st_id"))} + + + + ${ui.format(it.getColumnValue("ID_National"))} + + + ${ui.format(it.getColumnValue("Nom"))} + + + ${ui.format(it.getColumnValue("Prenom"))} + + + ${ui.format(it.getColumnValue("Age"))} + + + ${ui.format(it.getColumnValue("Sexe"))} + +
+
+
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/artDistributionReport.gsp b/omod/src/main/webapp/pages/artDistributionReport.gsp new file mode 100644 index 00000000..3c037dad --- /dev/null +++ b/omod/src/main/webapp/pages/artDistributionReport.gsp @@ -0,0 +1,221 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("isanteplusreports", "healthQualExportToExcel.js") +%> + + + + + +
+ +

${ ui.message("isanteplusreports.artdistribution.report.label") }

+
+ +
+
+ + ${ ui.message("reportingui.runReport.run.legend") } + +

${ ui.message("isanteplusreports.pnls.select.all") }

+

+ ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": "From Date", "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": "To Date", "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } +

+ +

+ + + + + + + + + + + + + <% manager.artDistributionIndicators.each { indicator -> %> + ${ ui.includeFragment("isanteplusreports", "alertPrecoceIndicator", [indicator: indicator]) } + <% } %> + +
${ ui.message("isanteplusreports.healthqual.indicator.label") }${ ui.message("isanteplusreports.healthqual.selection.label") }
+ ${ ui.message("isanteplusreports.artdistribution.report.label") } +
+
+ + <% if (htmlResult != null) { %> +

+ ${ ui.message("isanteplusreports.artdistribution.result.label") } +

+ + +
+ <%= htmlResult %> +
+ <% } %> +
+ +
diff --git a/omod/src/main/webapp/pages/arvByPeriodReportPatientList.gsp b/omod/src/main/webapp/pages/arvByPeriodReportPatientList.gsp index 228993b4..8f0e6c43 100644 --- a/omod/src/main/webapp/pages/arvByPeriodReportPatientList.gsp +++ b/omod/src/main/webapp/pages/arvByPeriodReportPatientList.gsp @@ -91,6 +91,7 @@
<% columnsValues.each { %> + <% i = i + 1 %> @@ -126,5 +127,8 @@ <% } %>
+
+ Total : ${ui.format(i)} +
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/ddpByPeriodReport.gsp b/omod/src/main/webapp/pages/ddpByPeriodReport.gsp new file mode 100644 index 00000000..a3dd0a05 --- /dev/null +++ b/omod/src/main/webapp/pages/ddpByPeriodReport.gsp @@ -0,0 +1,89 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("coreapps", "fragments/datamanagement/codeDiagnosisDialog.js") + ui.includeJavascript("uicommons", "datatables/jquery.dataTables.min.js") + +%> + + + + +
+ +
+ +
+
+ + ${ ui.message("reportingui.runReport.run.legend") } + + + <% for (int i=0; i +

+ <% if (parameter.name == "startDate") { %> + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": parameter.label, "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + <% } else if (parameter.name == "endDate") { %> + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": parameter.label, "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } + <% } %> + <% } %> +

+ +

+
+ +
+ + <% if (startDate != null || endDate != null) { %> +

+ ${ ui.message("isanteplusreports.report.ddp", ui.format(startDate), ui.format(endDate)) } +

+ + + + + + + + + + + + <% if (ddpRows == null ) { %> + + + + <% } else ddpRows.each { %> + + + + + + + <% } %> + +
${ ui.message("isanteplusreports.ddp") }${ ui.message("isanteplusreports.institution_communautaire") }${ ui.message("isanteplusreports.healthqual.result.percentage.label") }${ ui.message("isanteplusreports.patient_unique") }
+ + ${ ui.format(it.getColumnValue("ddp")) } + + + + ${ ui.format(it.getColumnValue("institution_com")) } + + + ${ ui.format(it.getColumnValue("pourcentage")) } + + ${ ui.format(it.getColumnValue("pat_unique")) } +
+ +<% } %> + +
+ +
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/ddpByPeriodReportList.gsp b/omod/src/main/webapp/pages/ddpByPeriodReportList.gsp new file mode 100644 index 00000000..e7394c1c --- /dev/null +++ b/omod/src/main/webapp/pages/ddpByPeriodReportList.gsp @@ -0,0 +1,134 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("coreapps", "fragments/datamanagement/codeDiagnosisDialog.js") + ui.includeJavascript("uicommons", "datatables/jquery.dataTables.min.js") + ui.includeJavascript("isanteplusreports", "print.js") +%> + + + +
+    + +

+
+ ${ ui.message("isanteplusreports.report.ddp") } ${ ui.message("isanteplusreports.from") } ${ ui.format(startDate) } ${ ui.message("isanteplusreports.to") } ${ ui.format(endDate) }

+
+ + + + + + + + + +
+ <% columnsValues.each { %> + <% i = i + 1 %> +
+ + + + + + + + <% } %> + +
${ ui.message("isanteplusreports.code_st") }${ ui.message("isanteplusreports.identifier") }${ ui.message("isanteplusreports.name") }${ ui.message("isanteplusreports.familyName") }${ ui.message("isanteplusreports.age") }${ ui.message("isanteplusreports.sex") }
+ + ${ui.format(it.getColumnValue("st_id"))} + + + + ${ui.format(it.getColumnValue("ID_National"))} + + + + ${ui.format(it.getColumnValue("Nom"))} + + + + ${ui.format(it.getColumnValue("Prenom"))} + + + + ${ui.format(it.getColumnValue("Age"))} + + + + ${ui.format(it.getColumnValue("Sexe"))} + +
+
+ Total : ${ui.format(i)} +
+
+
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/fingerPrintIndicatorReport.gsp b/omod/src/main/webapp/pages/fingerPrintIndicatorReport.gsp new file mode 100644 index 00000000..cca5ba8d --- /dev/null +++ b/omod/src/main/webapp/pages/fingerPrintIndicatorReport.gsp @@ -0,0 +1,221 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("isanteplusreports", "healthQualExportToExcel.js") +%> + + + + + +
+ +

${ ui.message("isanteplusreports.fingerprint.indicator.label") }

+
+ +
+
+ + ${ ui.message("reportingui.runReport.run.legend") } + +

${ ui.message("isanteplusreports.pnls.select.all") }

+

+ ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": "From Date", "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": "To Date", "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } +

+ +

+ + + + + + + + + + + + + <% manager.fingerPrintIndicators.each { indicator -> %> + ${ ui.includeFragment("isanteplusreports", "alertPrecoceIndicator", [indicator: indicator]) } + <% } %> + +
${ ui.message("isanteplusreports.healthqual.indicator.label") }${ ui.message("isanteplusreports.healthqual.selection.label") }
+ ${ ui.message("isanteplusreports.fingerprint.indicator.label") } +
+
+ + <% if (htmlResult != null) { %> +

+ ${ ui.message("isanteplusreports.fingerprint.indicator.label") } +

+ + +
+ <%= htmlResult %> +
+ <% } %> +
+ +
diff --git a/omod/src/main/webapp/pages/patientImmunizationDoses.gsp b/omod/src/main/webapp/pages/patientImmunizationDoses.gsp new file mode 100644 index 00000000..41ebcbe3 --- /dev/null +++ b/omod/src/main/webapp/pages/patientImmunizationDoses.gsp @@ -0,0 +1,41 @@ +<% + ui.decorateWith("appui", "standardEmrPage", [ title: ui.message("isanteplusreports.patientImmunization") ]) + ui.includeJavascript("isanteplusreports", "print.js") +%> + + + + +${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } + +
+

${ ui.message("isanteplusreports.patientImmunization") }


+ + + + <% columns.each { %> + + <% } %> + + + + <% columnsvalues.each { %> + + <% columns.each { colName -> %> + + + <% } %> + + <% } %> + +
${ui.format(it)}
+ ${ui.format(it.columnValues[colName])} +
+ +
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/patientsStatus.gsp b/omod/src/main/webapp/pages/patientsStatus.gsp index 914df687..068cd3a5 100644 --- a/omod/src/main/webapp/pages/patientsStatus.gsp +++ b/omod/src/main/webapp/pages/patientsStatus.gsp @@ -1,8 +1,9 @@ <% ui.decorateWith("appui", "standardEmrPage") - ui.includeJavascript("coreapps", "fragments/datamanagement/codeDiagnosisDialog.js") ui.includeJavascript("uicommons", "datatables/jquery.dataTables.min.js") - ui.includeJavascript("isanteplusreports", "print.js") + ui.includeJavascript("isanteplusreports", "isanteplusReport.js") + ui.includeJavascript("isanteplusreports", "datatable.js") + ui.includeCss("uicommons", "datatables/dataTables_jui.css") %> - - + -
+
@@ -143,7 +143,7 @@ <% if (startDate != null || endDate != null) { %>
   - +

@@ -165,8 +165,9 @@ <% } %> - - + <% ui.resourceLink("isanteplusreports", "images/sort_asc.png") %> + +
@@ -219,7 +220,7 @@ ${ui.format(it.getColumnValue("statut"))}
${ ui.message("isanteplusreports.code_st") } - ${ui.format(it.getColumnValue("derniere_date"))} + ${ ui.format(it.getColumnValue("derniere_date"))} ${ui.format(it.getColumnValue("adresse"))} diff --git a/omod/src/main/webapp/pages/psychoSocialIndicatorReport.gsp b/omod/src/main/webapp/pages/psychoSocialIndicatorReport.gsp new file mode 100644 index 00000000..b85d6ef5 --- /dev/null +++ b/omod/src/main/webapp/pages/psychoSocialIndicatorReport.gsp @@ -0,0 +1,221 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("isanteplusreports", "healthQualExportToExcel.js") +%> + + + + + +
+ +

${ ui.message("isanteplusreports.psychosocial.indicator.label") }

+
+ +
+
+ + ${ ui.message("reportingui.runReport.run.legend") } + +

${ ui.message("isanteplusreports.pnls.select.all") }

+

+ ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": "From Date", "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": "To Date", "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } +

+ +

+ + + + + + + + + + + + + <% manager.psychoSocialIndicators.each { indicator -> %> + ${ ui.includeFragment("isanteplusreports", "alertPrecoceIndicator", [indicator: indicator]) } + <% } %> + +
${ ui.message("isanteplusreports.psychosocial.indicator.label") }${ ui.message("isanteplusreports.healthqual.selection.label") }
+ ${ ui.message("isanteplusreports.psychosocial.indicator.label") } +
+
+ + <% if (htmlResult != null) { %> +

+ ${ ui.message("isanteplusreports.psychosocial.indicator.result.label") } +

+ + +
+ <%= htmlResult %> +
+ <% } %> +
+ +
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/psychoSocialSummary.gsp b/omod/src/main/webapp/pages/psychoSocialSummary.gsp new file mode 100644 index 00000000..26d9abba --- /dev/null +++ b/omod/src/main/webapp/pages/psychoSocialSummary.gsp @@ -0,0 +1,40 @@ +<% + ui.decorateWith("appui", "standardEmrPage", [ title: ui.message("isanteplusreports.psychoSocialSummary") ]) + ui.includeJavascript("isanteplusreports", "print.js") +%> + + + + +${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } + +
+

${ ui.message("isanteplusreports.psychoSocialSummary") }


+ + + + + + + + + <% columnsvalues.each { %> + + <% columns.each { colName -> %> + + + <% } %> + + <% } %> + +
${ ui.message("isanteplusreports.visitDate") } ${ ui.message("isanteplusreports.actionPlan") }
+ ${ui.format(it.columnValues[colName])} +
+ +
\ No newline at end of file diff --git a/omod/src/main/webapp/pages/reportsHome.gsp b/omod/src/main/webapp/pages/reportsHome.gsp index acb45889..80bc65b7 100644 --- a/omod/src/main/webapp/pages/reportsHome.gsp +++ b/omod/src/main/webapp/pages/reportsHome.gsp @@ -10,7 +10,10 @@ def other = appFrameworkService.getExtensionsForCurrentUser("org.openmrs.module.isanteplusreports.reports.other") def antenatal = appFrameworkService.getExtensionsForCurrentUser("org.openmrs.module.isanteplusreports.reports.antenatal") def patientsStatus = appFrameworkService.getExtensionsForCurrentUser("org.openmrs.module.isanteplusreports.reports.patientsstatus") + def alertPrecoce = appFrameworkService.getExtensionsForCurrentUser("org.openmrs.module.isanteplusreports.reports.alertprecoce") + def dashboard = appFrameworkService.getExtensionsForCurrentUser("org.openmrs.module.isanteplusreports.reports.dashboard") def ptme = appFrameworkService.getExtensionsForCurrentUser("org.openmrs.module.isanteplusreports.reports.ptme") + def psychosocial = appFrameworkService.getExtensionsForCurrentUser("org.openmrs.module.isanteplusreports.reports.psychosocial") def contextModel = [:] %> @@ -79,6 +82,16 @@ <% } %> <% } %> + <% if (alertPrecoce) { %> +

${ ui.message("isanteplusreports.reportsapp.alertprecoce") }

+
    + <% alertPrecoce.each { %> +
  • + ${ ui.includeFragment("uicommons", "extension", [ extension: it, contextModel: contextModel ]) } +
  • + <% } %> +
+ <% } %> <% if (dataExports) { %>

${ ui.message("reportingui.reportsapp.dataExports") }

@@ -91,6 +104,17 @@ <% } %> + <% if (dashboard) { %> +

${ ui.message("isanteplusreports.reportsapp.dashboard") }

+
    + <% dashboard.each { %> +
  • + ${ ui.includeFragment("uicommons", "extension", [ extension: it, contextModel: contextModel ]) } +
  • + <% } %> +
+ <% } %> + <% if (ptme) { %>

${ ui.message("isanteplusreports.reportsapp.ptme") }

    @@ -102,6 +126,17 @@
<% } %> + <% if (psychosocial) { %> +

${ ui.message("isanteplusreports.reportsapp.psychosocial") }

+
    + <% psychosocial.each { %> +
  • + ${ ui.includeFragment("uicommons", "extension", [ extension: it, contextModel: contextModel ]) } +
  • + <% } %> +
+ <% } %> + <% if (other) { %>

${ ui.message("isanteplusreports.reportsapp.other") }

    diff --git a/omod/src/main/webapp/pages/transisionedPatientIndicatorReport.gsp b/omod/src/main/webapp/pages/transisionedPatientIndicatorReport.gsp new file mode 100644 index 00000000..601916f4 --- /dev/null +++ b/omod/src/main/webapp/pages/transisionedPatientIndicatorReport.gsp @@ -0,0 +1,221 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("isanteplusreports", "healthQualExportToExcel.js") +%> + + + + + +
    + +

    ${ ui.message("isanteplusreports.report.transitionedPatient") }

    +
    + +
    +
    + + ${ ui.message("reportingui.runReport.run.legend") } + +

    ${ ui.message("isanteplusreports.pnls.select.all") }

    +

    + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": "From Date", "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": "To Date", "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } +

    + +

    + + + + + + + + + + + + + <% manager.transisionedPatientIndicators.each { indicator -> %> + ${ ui.includeFragment("isanteplusreports", "selectedIndicator", [indicator: indicator]) } + <% } %> + +
    ${ ui.message("isanteplusreports.healthqual.indicator.label") }${ ui.message("isanteplusreports.healthqual.selection.label") }
    + ${ ui.message("isanteplusreports.report.transitionedPatient") } +
    +
    + + <% if (htmlResult != null) { %> +

    + ${ ui.message("isanteplusreports.report.transitionedPatient") } +

    + + +
    + <%= htmlResult %> +
    + <% } %> +
    + +
    diff --git a/omod/src/main/webapp/pages/viewReportIsantePlusRequest.gsp b/omod/src/main/webapp/pages/viewReportIsantePlusRequest.gsp index d3c3da18..b68fa83f 100644 --- a/omod/src/main/webapp/pages/viewReportIsantePlusRequest.gsp +++ b/omod/src/main/webapp/pages/viewReportIsantePlusRequest.gsp @@ -19,13 +19,13 @@ diff --git a/omod/src/main/webapp/pages/vitalStatisticsIndicator.gsp b/omod/src/main/webapp/pages/vitalStatisticsIndicator.gsp new file mode 100644 index 00000000..eb455f3b --- /dev/null +++ b/omod/src/main/webapp/pages/vitalStatisticsIndicator.gsp @@ -0,0 +1,221 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("isanteplusreports", "healthQualExportToExcel.js") +%> + + + + + +
    + +

    ${ ui.message("isanteplusreports.report.vitalStatistics") }

    +
    + +
    +
    + + ${ ui.message("reportingui.runReport.run.legend") } + +

    ${ ui.message("isanteplusreports.pnls.select.all") }

    +

    + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": "From Date", "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": "To Date", "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } +

    + +

    + + + + + + + + + + + + + <% manager.vitalStatisticsIndicators.each { indicator -> %> + ${ ui.includeFragment("isanteplusreports", "selectedIndicator", [indicator: indicator]) } + <% } %> + +
    ${ ui.message("isanteplusreports.healthqual.indicator.label") }${ ui.message("isanteplusreports.healthqual.selection.label") }
    + ${ ui.message("isanteplusreports.report.vitalStatistics") } +
    +
    + + <% if (htmlResult != null) { %> +

    + ${ ui.message("isanteplusreports.report.vitalStatistics") } +

    + + +
    + <%= htmlResult %> +
    + <% } %> +
    + +
    diff --git a/omod/src/main/webapp/pages/weeklyMonitoringReport.gsp b/omod/src/main/webapp/pages/weeklyMonitoringReport.gsp new file mode 100644 index 00000000..984a3703 --- /dev/null +++ b/omod/src/main/webapp/pages/weeklyMonitoringReport.gsp @@ -0,0 +1,210 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("isanteplusreports", "healthQualExportToExcel.js") +%> + + + + + +
    + +

    ${ ui.message("isanteplusreports.weeklymonitoringreport.indicator.label") }

    +
    + +
    +
    + + ${ ui.message("reportingui.runReport.run.legend") } + + +

    + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "startDateField", "label": "From Date", "formFieldName": "startDate", "defaultDate": startDate, "useTime": false ]) } + ${ ui.includeFragment("uicommons", "field/datetimepicker", [ "id": "endDateField", "label": "To Date", "formFieldName": "endDate", "defaultDate": endDate, "useTime": false ]) } +

    + +

    + + + + + + + + + + + + + <% nonCodedRows.each { %> + + + + + + <% } %> + +
    ${ ui.message("isanteplusreports.weeklymonitoringreport.indicator.label") }
    + <% if (startDate != null || endDate != null) { %> + ${ ui.message("isanteplusreports.from") } ${ ui.format(startDate) } ${ ui.message("isanteplusreports.to") } ${ ui.format(endDate) } + <% } %> +
    + ${ ui.format(it.getColumnValue("Indicateur")) } + + + ${ ui.format(it.getColumnValue("Total")) } + +
    +
    +
    + +
    diff --git a/omod/src/main/webapp/pages/weeklyMonitoringReportPatientList.gsp b/omod/src/main/webapp/pages/weeklyMonitoringReportPatientList.gsp new file mode 100644 index 00000000..830f4510 --- /dev/null +++ b/omod/src/main/webapp/pages/weeklyMonitoringReportPatientList.gsp @@ -0,0 +1,127 @@ +<% + ui.decorateWith("appui", "standardEmrPage") + ui.includeJavascript("coreapps", "fragments/datamanagement/codeDiagnosisDialog.js") + ui.includeJavascript("uicommons", "datatables/jquery.dataTables.min.js") + ui.includeJavascript("isanteplusreports", "print.js") +%> + + + +
    +    + +

    +
    + ${ ui.message("isanteplusreports.weeklymonitoringreport.indicator.label") }

    +
    + + + + + + + + + +
    + <% columnsValues.each { %> +
    + + + + + + + + <% } %> + +
    ${ ui.message("isanteplusreports.code_st") }${ ui.message("isanteplusreports.identifier") }${ ui.message("isanteplusreports.name") }${ ui.message("isanteplusreports.familyName") }${ ui.message("isanteplusreports.age") }${ ui.message("isanteplusreports.sex") }
    + + ${ui.format(it.getColumnValue("st_id"))} + + + + ${ui.format(it.getColumnValue("ID_National"))} + + + + ${ui.format(it.getColumnValue("Nom"))} + + + ${ui.format(it.getColumnValue("Prenom"))} + + + ${ui.format(it.getColumnValue("Age"))} + + + ${ui.format(it.getColumnValue("Sexe"))} + +
    +
    +
    \ No newline at end of file diff --git a/omod/src/main/webapp/resources/scripts/datatable.js b/omod/src/main/webapp/resources/scripts/datatable.js new file mode 100644 index 00000000..2aa50619 --- /dev/null +++ b/omod/src/main/webapp/resources/scripts/datatable.js @@ -0,0 +1,40 @@ +jq().ready( function () { + $('#example').dataTable( { + "bPaginate": false, + "bFilter": false, + "bInfo": false, + "aoColumns": [ + null, + null, + null, + null, + null, + null, + null, + null, + { "sType": "date-uk" }, + null, + null, + { "sType": "date-uk" }, + null + + ] + }); + +} ); + +jQuery.extend( jQuery.fn.dataTableExt.oSort, { +"date-uk-pre": function ( a ) { + var ukDatea = a.split('-'); + return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1; +}, + +"date-uk-asc": function ( a, b ) { + return ((a < b) ? -1 : ((a > b) ? 1 : 0)); +}, + +"date-uk-desc": function ( a, b ) { + return ((a < b) ? 1 : ((a > b) ? -1 : 0)); +} +} ); +