Skip to content

Commit

Permalink
Merge pull request #72 from emaposse/REPORT-154
Browse files Browse the repository at this point in the history
 Report 154
  • Loading branch information
Guimino authored Sep 3, 2020
2 parents 7741561 + cdb3dfb commit 983e397
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,22 @@ public List<Object[]> getMaxFilaWithProximoLevantamento(EvaluationContext contex

SqlQueryBuilder qb =
new SqlQueryBuilder(
" select patient_id, last_levantamento, max(proximo_levantamento) from( select last_fila.patient_id, last_fila.last_levantamento, obs_proximo_levantamento.value_datetime proximo_levantamento from "
+ " (select p.patient_id, max(e.encounter_datetime) last_levantamento from patient p "
+ " inner join encounter e on e.patient_id = p.patient_id "
+ " where p.voided = 0 and e.voided = 0 and e.encounter_type = 18 "
+ " and e.location_id =:location and e.encounter_datetime <=:endDate "
+ " group by p.patient_id) last_fila "
+ " inner join obs obs_proximo_levantamento on obs_proximo_levantamento.person_id = last_fila.patient_id "
+ " and obs_proximo_levantamento.obs_datetime = last_fila.last_levantamento and "
+ " obs_proximo_levantamento.concept_id = 5096 and obs_proximo_levantamento.voided = 0 "
+ " order by last_fila.patient_id ) plastiFila group by patient_id ",
"select patient_id, last_levantamento, max(proximo_levantamento) from ( "
+ "select pickup.patient_id, pickup.last_levantamento, obs_proximo_levantamento.value_datetime proximo_levantamento from ( "
+ "select maxpkp.patient_id,e.encounter_datetime last_levantamento,e.encounter_id from ( "
+ "SELECT p.patient_id, MAX(e.encounter_datetime) last_levantamento FROM patient p "
+ "INNER JOIN encounter e ON e.patient_id = p.patient_id "
+ "WHERE p.voided = 0 AND e.voided = 0 AND e.encounter_type = 18 and e.location_id =:location and e.encounter_datetime <=:endDate "
+ "GROUP BY p.patient_id "
+ ") maxpkp "
+ "inner join encounter e on e.patient_id=maxpkp.patient_id "
+ "where e.encounter_datetime=maxpkp.last_levantamento and e.encounter_type=18 and e.location_id=:location and e.voided=0 "
+ ") pickup "
+ "inner join obs obs_proximo_levantamento on obs_proximo_levantamento.person_id = pickup.patient_id "
+ "and obs_proximo_levantamento.concept_id = 5096 and obs_proximo_levantamento.voided = 0 and pickup.encounter_id=obs_proximo_levantamento.encounter_id "
+ "order by pickup.patient_id "
+ ") plastiFila "
+ "group by patient_id ",
context.getParameterValues());

return Context.getRegisteredComponents(EvaluationService.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.openmrs.module.eptsreports.reporting.utils.AgeRange.TWENTY_FIVE_TO_TWENTY_NINE;
import static org.openmrs.module.eptsreports.reporting.utils.AgeRange.TWENTY_TO_TWENTY_FOUR;
import static org.openmrs.module.eptsreports.reporting.utils.AgeRange.UNDER_ONE;
import static org.openmrs.module.eptsreports.reporting.utils.AgeRange.UNKNOWN;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -174,7 +173,21 @@ public CohortIndicatorDataSetDefinition constructTxCurrDataset(final boolean cur
FORTY_FIVE_TO_FORTY_NINE,
ABOVE_FIFTY);

this.addColums(dataSetDefinition, "", txCurrIndicator, UNKNOWN);
dataSetDefinition.addColumn(
"C-malesUnknownM",
"unknownM",
EptsReportUtils.map(txCurrIndicator, mappings),
this.getName(Gender.MALE, AgeRange.UNKNOWN)
+ "="
+ this.getName(Gender.MALE, AgeRange.UNKNOWN));

dataSetDefinition.addColumn(
"C-femalesUnknownF",
"unknownF",
EptsReportUtils.map(txCurrIndicator, mappings),
this.getName(Gender.FEMALE, AgeRange.UNKNOWN)
+ "="
+ this.getName(Gender.FEMALE, AgeRange.UNKNOWN));

dataSetDefinition.addColumn(
"C-MSM",
Expand Down
Binary file modified api/src/main/resources/IM_ER_Report.xls
Binary file not shown.
Binary file modified api/src/main/resources/PEPFAR_MER_2.4_QUARTERLY.xls
Binary file not shown.

0 comments on commit 983e397

Please sign in to comment.