use of org.openmrs.contrib.testdata.builder.EncounterBuilder in project openmrs-module-pihcore by PIH.
the class EncounterDataSetManagerTest method createCheckInEncounter.
protected Encounter createCheckInEncounter(Patient p) {
EncounterBuilder eb = data.encounter();
eb.patient(p);
eb.encounterDatetime(DateUtil.getDateTime(2015, 4, 15));
eb.location(locationService.getLocation("Klinik Ekstèn"));
eb.encounterType(getCheckInEncounterType());
eb.obs("REASON FOR VISIT", "PIH", Metadata.getConcept("PIH:MALNUTRITION PROGRAM"));
return eb.save();
}
use of org.openmrs.contrib.testdata.builder.EncounterBuilder in project openmrs-module-pihcore by PIH.
the class ObsDataSetManagerTest method createConsultEncounter.
protected Encounter createConsultEncounter(Patient p) {
EncounterBuilder eb = data.encounter();
eb.patient(p);
eb.encounterDatetime(DateUtil.getDateTime(2015, 4, 15));
eb.location(locationService.getLocation("Klinik Ekstèn"));
eb.encounterType(getConsultationEncounterType());
eb.obs("DIAGNOSIS", "PIH", Metadata.getConcept("PIH:ASTHMA"));
return eb.save();
}
use of org.openmrs.contrib.testdata.builder.EncounterBuilder in project openmrs-module-pihcore by PIH.
the class BmiEncounterDataEvaluatorTest method shouldReturnNullIfNoHeight.
@Test
public void shouldReturnNullIfNoHeight() 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(getVitalsEncounterType());
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);
assertNull(res.getData().get(enc.getEncounterId()));
}
use of org.openmrs.contrib.testdata.builder.EncounterBuilder in project openmrs-module-pihcore by PIH.
the class BmiEncounterDataEvaluatorTest method shouldReturnNullIfNoWeight.
@Test
public void shouldReturnNullIfNoWeight() 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(getVitalsEncounterType());
eb.obs(Metadata.getConcept("PIH:WEIGHT (KG)"), 45.4);
Encounter enc = eb.save();
EncounterEvaluationContext context = new EncounterEvaluationContext();
context.setBaseEncounters(new EncounterIdSet(enc.getEncounterId()));
EvaluatedEncounterData res = encounterDataService.evaluate(new BmiEncounterDataDefinition(), context);
assertNull(res.getData().get(enc.getEncounterId()));
}
use of org.openmrs.contrib.testdata.builder.EncounterBuilder 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()));
}
Aggregations