diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/txcurr/TxCurrPatientsOnArvDispense6OrMoreMonthsCalculation.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/txcurr/TxCurrPatientsOnArvDispense6OrMoreMonthsCalculation.java index 91c2cf3c93..89b17bf8ec 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/txcurr/TxCurrPatientsOnArvDispense6OrMoreMonthsCalculation.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/txcurr/TxCurrPatientsOnArvDispense6OrMoreMonthsCalculation.java @@ -4,7 +4,6 @@ import java.util.List; import org.openmrs.calculation.result.CalculationResultMap; import org.openmrs.module.eptsreports.reporting.calculation.BooleanResult; -import org.openmrs.module.eptsreports.reporting.calculation.txcurr.TxCurrPatientsOnArtOnArvDispenseIntervalsCalculation.DisaggregationSourceTypes; import org.openmrs.module.reporting.common.DateUtil; import org.springframework.stereotype.Component; diff --git a/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/util/processor/LastFilaProcessor.java b/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/util/processor/LastFilaProcessor.java index fbaffb6527..8eaf42c343 100644 --- a/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/util/processor/LastFilaProcessor.java +++ b/api/src/main/java/org/openmrs/module/eptsreports/reporting/calculation/util/processor/LastFilaProcessor.java @@ -77,22 +77,21 @@ public List<Object[]> getMaxFilaWithProximoLevantamento(EvaluationContext contex SqlQueryBuilder qb = new SqlQueryBuilder( - "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 ", + "select pickup.patient_id, pickup.last_levantamento, max(obs_proximo_levantamento.value_datetime) proximo_levantamento " + + "from ( " + + "select maxpkp.patient_id,maxpkp.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 date(e.encounter_datetime) <=:endDate " + + "GROUP BY p.patient_id " + + ") maxpkp " + + "inner join encounter e on e.patient_id=maxpkp.patient_id " + + "where date(e.encounter_datetime)=date(maxpkp.last_levantamento) and e.encounter_type=18 and e.location_id=:location and e.voided=0 " + + "order by maxpkp.patient_id " + + ") pickup " + + "inner join obs obs_proximo_levantamento on pickup.encounter_id=obs_proximo_levantamento.encounter_id " + + "where obs_proximo_levantamento.concept_id = 5096 and obs_proximo_levantamento.voided = 0 " + + "group by pickup.patient_id ", context.getParameterValues()); return Context.getRegisteredComponents(EvaluationService.class)