Skip to content

Commit

Permalink
Merge pull request #537 from Guimino/remove_b13_commit
Browse files Browse the repository at this point in the history
Compatibility issues 2.3.x vs 2.6.x
  • Loading branch information
Guimino authored Dec 19, 2024
2 parents a2bc701 + fec8f19 commit f326d9a
Show file tree
Hide file tree
Showing 10 changed files with 267 additions and 231 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,23 @@ public CalculationResultMap evaluate(
Map<String, Object> parameterValues, EvaluationContext context) {

CalculationResultMap resultMap = new CalculationResultMap();
Map<Integer, Date> processorResult =

Map<Integer, ? extends Object> processorResult =
Context.getRegisteredComponents(OnArtInitiatedArvDrugsMISAUDefinitionProcessor.class)
.get(0)
.getResutls(context);
for (Integer pId : processorResult.keySet()) {

Object dateProcessor = processorResult.get(pId);
LocalDateTime localDateTime = (LocalDateTime) dateProcessor;

Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
for (Integer pId : processorResult.keySet()) {
Object dateObject = processorResult.get(pId);
Date date = null;

if (dateObject instanceof Date) {
date = (Date) dateObject;
} else if (dateObject instanceof LocalDateTime) {
// Convert LocalDateTime to Date
LocalDateTime localDateTime = (LocalDateTime) dateObject;
date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}

if (date != null) {
resultMap.put(pId, new SimpleResult(date, this));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ public CalculationResultMap evaluate(

for (Integer patientId : lastFilaCalculationResult.keySet()) {
CalculationResult calculationResult = lastFilaCalculationResult.get(patientId);
Object dateObject = (calculationResult != null ? calculationResult.getValue() : null);

Object object = (calculationResult != null ? calculationResult.getValue() : null);
LocalDateTime localDateTime = (LocalDateTime) object;
Date lastDateFila = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
Date lastDateFila = null;
if (dateObject instanceof Date) {
lastDateFila = (Date) dateObject;
} else if (dateObject instanceof LocalDateTime) {
// Convert LocalDateTime to Date
LocalDateTime localDateTime = (LocalDateTime) dateObject;
lastDateFila = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}

List<Date[]> allObsNextFila = resutls.get(patientId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,15 @@ public static CalculationResultMap getLastRecepcaoLevantamentoPlus30(
if (maxRecepcao != null) {

Object object = maxRecepcao.getValue();
Date date = null;

LocalDateTime localDateTime = (LocalDateTime) object;
if (object instanceof Date) {
date = (Date) object;

Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
} else if (object instanceof LocalDateTime) {
LocalDateTime localDateTime = (LocalDateTime) object;
date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
}

lastRecepcaoLevantamentoPlus30.put(
patientId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,25 @@ private ListMap<Integer, Date[]> getNextFilaScheduled(

for (Object[] row : queryResult) {

Date date1 = null;
Date date2 = null;

Object row1 = row[1];
Object row2 = row[2];

LocalDateTime rowDate1 = (LocalDateTime) row1;
LocalDateTime rowDate2 = (LocalDateTime) row2;
if (row1 instanceof Date) {
date1 = (Date) row1;
} else if (row1 instanceof LocalDateTime) {
LocalDateTime rowDate1 = (LocalDateTime) row1;
date1 = Date.from(rowDate1.atZone(ZoneId.systemDefault()).toInstant());
}

Date date1 = Date.from(rowDate1.atZone(ZoneId.systemDefault()).toInstant());
Date date2 = Date.from(rowDate2.atZone(ZoneId.systemDefault()).toInstant());
if (row2 instanceof Date) {
date2 = (Date) row2;
} else if (row2 instanceof LocalDateTime) {
LocalDateTime rowDate2 = (LocalDateTime) row2;
date2 = Date.from(rowDate2.atZone(ZoneId.systemDefault()).toInstant());
}

listPatientDates.putInList((Integer) row[0], new Date[] {date1, date2});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@
import org.openmrs.module.eptsreports.reporting.library.datasets.TxPvlsSuplementalDataSet;
import org.openmrs.module.eptsreports.reporting.library.datasets.TxRttDataset;
import org.openmrs.module.eptsreports.reporting.library.queries.BaseQueries;
import org.openmrs.module.eptsreports.reporting.reports.manager.EptsDataExportManager;
import org.openmrs.module.eptsreports.reporting.reports.manager.EptsPeriodIndicatorDataExportManager;
import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils;
import org.openmrs.module.reporting.ReportingException;
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
import org.openmrs.module.reporting.report.ReportDesign;
import org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition;
import org.openmrs.module.reporting.report.definition.ReportDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SetupMERQuarterly extends EptsDataExportManager {
public class SetupMERQuarterly extends EptsPeriodIndicatorDataExportManager {

@Autowired private TxPvlsDataset txPvlsDataset;

Expand Down Expand Up @@ -94,8 +95,10 @@ public String getDescription() {
}

@Override
public ReportDefinition constructReportDefinition() {
final ReportDefinition reportDefinition = new ReportDefinition();
public PeriodIndicatorReportDefinition constructReportDefinition() {

PeriodIndicatorReportDefinition reportDefinition =
SetupResumoMensalReport.getDefaultPeriodIndicatorReportDefinition();

reportDefinition.setUuid(this.getUuid());
reportDefinition.setName(this.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@
import org.openmrs.module.eptsreports.reporting.library.datasets.TxMlDataset;
import org.openmrs.module.eptsreports.reporting.library.datasets.TxTBDataset;
import org.openmrs.module.eptsreports.reporting.library.queries.BaseQueries;
import org.openmrs.module.eptsreports.reporting.reports.manager.EptsDataExportManager;
import org.openmrs.module.eptsreports.reporting.reports.manager.EptsPeriodIndicatorDataExportManager;
import org.openmrs.module.eptsreports.reporting.utils.EptsReportUtils;
import org.openmrs.module.reporting.ReportingException;
import org.openmrs.module.reporting.evaluation.parameter.Mapped;
import org.openmrs.module.reporting.report.ReportDesign;
import org.openmrs.module.reporting.report.definition.PeriodIndicatorReportDefinition;
import org.openmrs.module.reporting.report.definition.ReportDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SetupMERSemiAnnualReport extends EptsDataExportManager {
public class SetupMERSemiAnnualReport extends EptsPeriodIndicatorDataExportManager {

@Autowired private TxMlDataset txMlDataset;

Expand Down Expand Up @@ -64,8 +65,11 @@ public String getDescription() {
}

@Override
public ReportDefinition constructReportDefinition() {
ReportDefinition rd = new ReportDefinition();
public PeriodIndicatorReportDefinition constructReportDefinition() {

PeriodIndicatorReportDefinition rd =
SetupResumoMensalReport.getDefaultPeriodIndicatorReportDefinition();

rd.setUuid(getUuid());
rd.setName(getName());
rd.setDescription(getDescription());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ from (
where p.voided = 0 and e.voided = 0 and o.voided = 0 and e.encounter_type = 53 and o.concept_id = 856
and e.location_id =:location and o.obs_datetime between date_sub(:endDate, interval 12 month) and :endDate
group by p.patient_id
)f group by f.patient_id, encounter_datetime desc, ordem asc
)f group by f.patient_id order by encounter_datetime desc, ordem asc
)f group by f.patient_id
) cargaQuantitaviva group by patient_id
) cargaQuantitaviva group by patient_id
Expand Down Expand Up @@ -81,7 +81,7 @@ from (
where p.voided = 0 and e.voided = 0 and o.voided = 0 and e.encounter_type = 53 and o.concept_id = 1305
and e.location_id =:location and o.obs_datetime between date_sub(:endDate, interval 12 month) and :endDate
group by p.patient_id
) cargaQualitativa group by cargaQualitativa.patient_id, cargaQualitativa.encounter_datetime desc, ordem asc
) cargaQualitativa group by cargaQualitativa.patient_id order by cargaQualitativa.encounter_datetime desc, ordem asc
)cargaQualitativa group by cargaQualitativa.patient_id
) cargaQualitativa on cargaQuantitativa.patient_id = cargaQualitativa.patient_id
where cargaQualitativa.patient_id is null
Expand Down Expand Up @@ -152,6 +152,6 @@ from (
) f
inner join obs obCv on obCv.person_id=f.patient_id and obCv.concept_id=856 and obCv.value_numeric>=1000 and date(obCv.obs_datetime)=date(f.encounter_datetime) and obCv.voided=0
) filter on filter.patient_id=cargaQuantitativa.patient_id
) cargaQuantitativa group by patient_id, encounter_datetime desc, ordem asc
) cargaQuantitativa group by patient_id order by encounter_datetime desc, ordem asc
) cargaQuantitativa group by patient_id
) cargaQuantitativa
Binary file modified api/src/main/resources/ListPatientWithHighViralLoad.xls
Binary file not shown.
Loading

0 comments on commit f326d9a

Please # to comment.