Search in sources :

Example 11 with EncounterSearchCriteriaBuilder

use of org.openmrs.parameter.EncounterSearchCriteriaBuilder in project openmrs-core by openmrs.

the class EncounterServiceTest method getEncounters_shouldGetEncountersByLocation.

/**
 * @see EncounterService#getEncounters(Patient, Location, Date, Date, java.util.Collection,
 *      java.util.Collection, java.util.Collection, boolean)
 */
@Test
public void getEncounters_shouldGetEncountersByLocation() {
    EncounterSearchCriteria encounterSearchCriteria = new EncounterSearchCriteriaBuilder().setLocation(new Location(1)).setIncludeVoided(true).createEncounterSearchCriteria();
    List<Encounter> encounters = Context.getEncounterService().getEncounters(encounterSearchCriteria);
    assertEquals(6, encounters.size());
}
Also used : EncounterSearchCriteria(org.openmrs.parameter.EncounterSearchCriteria) EncounterSearchCriteriaBuilder(org.openmrs.parameter.EncounterSearchCriteriaBuilder) Encounter(org.openmrs.Encounter) Location(org.openmrs.Location) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Example 12 with EncounterSearchCriteriaBuilder

use of org.openmrs.parameter.EncounterSearchCriteriaBuilder in project openmrs-core by openmrs.

the class EncounterServiceTest method getEncounters_shouldGetEncountersByVisit.

/**
 * @see EncounterService#getEncounters(Patient, Location, Date, Date, java.util.Collection,
 *      java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection,
 *      boolean)
 */
@Test
public void getEncounters_shouldGetEncountersByVisit() {
    List<Visit> visits = new ArrayList<>();
    visits.add(new Visit(1));
    EncounterSearchCriteria encounterSearchCriteria = new EncounterSearchCriteriaBuilder().setVisits(visits).setIncludeVoided(true).createEncounterSearchCriteria();
    List<Encounter> encounters = Context.getEncounterService().getEncounters(encounterSearchCriteria);
    assertEquals(2, encounters.size());
}
Also used : EncounterSearchCriteria(org.openmrs.parameter.EncounterSearchCriteria) Visit(org.openmrs.Visit) EncounterSearchCriteriaBuilder(org.openmrs.parameter.EncounterSearchCriteriaBuilder) ArrayList(java.util.ArrayList) Encounter(org.openmrs.Encounter) BaseContextSensitiveTest(org.openmrs.test.BaseContextSensitiveTest) Test(org.junit.Test)

Aggregations

EncounterSearchCriteria (org.openmrs.parameter.EncounterSearchCriteria)12 EncounterSearchCriteriaBuilder (org.openmrs.parameter.EncounterSearchCriteriaBuilder)12 Test (org.junit.Test)10 Encounter (org.openmrs.Encounter)10 BaseContextSensitiveTest (org.openmrs.test.BaseContextSensitiveTest)10 ArrayList (java.util.ArrayList)4 EncounterService (org.openmrs.api.EncounterService)3 SimpleDateFormat (java.text.SimpleDateFormat)2 Order (org.openmrs.Order)2 OrderService (org.openmrs.api.OrderService)2 DateFormat (java.text.DateFormat)1 Date (java.util.Date)1 EncounterType (org.openmrs.EncounterType)1 Form (org.openmrs.Form)1 Location (org.openmrs.Location)1 Patient (org.openmrs.Patient)1 User (org.openmrs.User)1 Visit (org.openmrs.Visit)1 VisitType (org.openmrs.VisitType)1 CohortService (org.openmrs.api.CohortService)1