use of org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData in project openmrs-module-pihcore by PIH.
the class BmiEncounterDataEvaluatorTest method shouldCalculateBmi.
@Test
public void shouldCalculateBmi() throws Exception {
EncounterBuilder eb = data.encounter();
eb.patient(createPatient());
eb.encounterDatetime(DateUtil.getDateTime(2015, 4, 15));
eb.location(Metadata.lookup(MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL));
eb.encounterType(Metadata.lookup(EncounterTypes.VITALS));
eb.obs(Metadata.getConcept("PIH:WEIGHT (KG)"), 45.4);
eb.obs(Metadata.getConcept("PIH:HEIGHT (CM)"), 152.4);
Encounter enc = eb.save();
EncounterEvaluationContext context = new EncounterEvaluationContext();
context.setBaseEncounters(new EncounterIdSet(enc.getEncounterId()));
EvaluatedEncounterData res = encounterDataService.evaluate(new BmiEncounterDataDefinition(), context);
assertThat((Double) res.getData().get(enc.getEncounterId()), is(19.5));
}
use of org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData 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(Metadata.lookup(MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL));
eb.encounterType(1);
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