use of org.openmrs.module.pihcore.reporting.encounter.definition.RetrospectiveEncounterDataDefinition in project openmrs-module-pihcore by PIH.
the class RetrospectiveEncounterDataEvaluatorTest method shouldFindEncounterToBeRetrospective.
@Test
public void shouldFindEncounterToBeRetrospective() throws Exception {
EncounterBuilder eb = data.encounter();
eb.patient(createPatient());
eb.encounterDatetime(DateUtil.getDateTime(2015, 4, 15));
eb.location(locationService.getLocation("CDI Klinik Ekstèn Jeneral"));
eb.encounterType(encounterService.getAllEncounterTypes().get(0));
Encounter enc = eb.save();
EncounterEvaluationContext context = new EncounterEvaluationContext();
context.setBaseEncounters(new EncounterIdSet(enc.getEncounterId()));
EvaluatedEncounterData res = encounterDataService.evaluate(new RetrospectiveEncounterDataDefinition(), context);
assertTrue((Boolean) res.getData().get(enc.getEncounterId()));
}
use of org.openmrs.module.pihcore.reporting.encounter.definition.RetrospectiveEncounterDataDefinition in project openmrs-module-pihcore by PIH.
the class BaseEncounterDataSetManager method addCoreEncounterColumns.
/**
* Add columns that describe the common elements of encounters
*/
protected void addCoreEncounterColumns(EncounterDataSetDefinition dsd) {
addColumn(dsd, getEncounterColumnPrefix() + "_date", builtInEncounterData.getEncounterDatetime());
addColumn(dsd, getEncounterColumnPrefix() + "_location", builtInEncounterData.getLocationName());
addColumn(dsd, getEncounterColumnPrefix() + "_provider", pihEncounterData.getEncounterProvider());
addColumn(dsd, getEncounterColumnPrefix() + "_retrospective", new RetrospectiveEncounterDataDefinition(), new BooleanConverter());
}
use of org.openmrs.module.pihcore.reporting.encounter.definition.RetrospectiveEncounterDataDefinition in project openmrs-module-pihcore by PIH.
the class RetrospectiveEncounterDataEvaluatorTest method shouldFindEncounterNotToBeRetrospective.
@Test
public void shouldFindEncounterNotToBeRetrospective() throws Exception {
EncounterBuilder eb = data.encounter();
eb.patient(createPatient());
eb.encounterDatetime(new Date());
eb.location(locationService.getLocation("CDI Klinik Ekstèn Jeneral"));
eb.encounterType(encounterService.getAllEncounterTypes().get(0));
Encounter enc = eb.save();
EncounterEvaluationContext context = new EncounterEvaluationContext();
context.setBaseEncounters(new EncounterIdSet(enc.getEncounterId()));
EvaluatedEncounterData res = encounterDataService.evaluate(new RetrospectiveEncounterDataDefinition(), context);
assertFalse((Boolean) res.getData().get(enc.getEncounterId()));
}
Aggregations