Search in sources :

Example 21 with CaseCriteria

use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.

the class CaseFacadeEjbTest method testGetDuplicateCasesOfSexUnknownAndSameBirthDateMatches.

@Test
public void testGetDuplicateCasesOfSexUnknownAndSameBirthDateMatches() {
    final Date today = new Date();
    RDCFEntities rdcf = creator.createRDCFEntities("Region", "District", "Community", "Facility");
    UserDto user = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR);
    PersonDto cazePerson = creator.createPerson("Case", "Person", Sex.MALE, 1980, 1, 1);
    creator.createCase(user.toReference(), cazePerson.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, today, rdcf);
    PersonDto cazePerson2 = creator.createPerson("Case", "Person", Sex.UNKNOWN, 1980, 1, 1);
    creator.createCase(user.toReference(), cazePerson2.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, DateUtils.addMinutes(today, -3), rdcf);
    Assert.assertEquals(1, getCaseFacade().getCasesForDuplicateMerging(new CaseCriteria().creationDateFrom(today).creationDateTo(today), true).size());
}
Also used : RDCFEntities(de.symeda.sormas.backend.TestDataCreator.RDCFEntities) CasePersonDto(de.symeda.sormas.api.caze.CasePersonDto) PersonDto(de.symeda.sormas.api.person.PersonDto) UserDto(de.symeda.sormas.api.user.UserDto) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) Date(java.util.Date) LocalDate(java.time.LocalDate) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Example 22 with CaseCriteria

use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.

the class CaseFacadeEjbTest method testGetIndexListByEventFreeText.

@Test
public void testGetIndexListByEventFreeText() {
    String districtName = "District";
    RDCF rdcf = creator.createRDCF("Region", districtName, "Community", "Facility");
    useSurveillanceOfficerLogin(rdcf);
    UserDto user = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR);
    PersonDto person1 = creator.createPerson();
    PersonDto person2 = creator.createPerson();
    EventDto event1 = creator.createEvent(EventStatus.SIGNAL, EventInvestigationStatus.PENDING, "Signal foo", "A long description for this event", user.toReference(), eventDto -> {
    });
    EventParticipantDto event1Participant1 = creator.createEventParticipant(event1.toReference(), person1, user.toReference());
    EventParticipantDto event1Participant2 = creator.createEventParticipant(event1.toReference(), person2, user.toReference());
    CaseDataDto case1 = creator.createCase(user.toReference(), person1.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
    creator.createCase(user.toReference(), person2.toReference(), Disease.EVD, CaseClassification.PROBABLE, InvestigationStatus.PENDING, new Date(), rdcf);
    event1Participant1.setResultingCase(case1.toReference());
    getEventParticipantFacade().save(event1Participant1);
    Assert.assertEquals(2, getCaseFacade().getIndexList(null, 0, 100, null).size());
    Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().eventLike("signal"), 0, 100, null).size());
    Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().eventLike(event1.getUuid()), 0, 100, null).size());
    Assert.assertEquals(1, getCaseFacade().getIndexList(new CaseCriteria().eventLike("signal description"), 0, 100, null).size());
}
Also used : RDCF(de.symeda.sormas.backend.TestDataCreator.RDCF) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) CasePersonDto(de.symeda.sormas.api.caze.CasePersonDto) PersonDto(de.symeda.sormas.api.person.PersonDto) UserDto(de.symeda.sormas.api.user.UserDto) EventDto(de.symeda.sormas.api.event.EventDto) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) EventParticipantDto(de.symeda.sormas.api.event.EventParticipantDto) Matchers.isEmptyOrNullString(org.hamcrest.Matchers.isEmptyOrNullString) Date(java.util.Date) LocalDate(java.time.LocalDate) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Example 23 with CaseCriteria

use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.

the class CaseFacadeEjbUserFilterTest method testGetCasesOnNationalLevel.

@Test
public void testGetCasesOnNationalLevel() {
    loginWith(nationalUser);
    createCase(rdcf2, districtUser2);
    createCase(rdcf1, districtUser1);
    List<CaseIndexDto> indexList = getCaseFacade().getIndexList(new CaseCriteria(), 0, 100, null);
    assertThat(indexList, hasSize(2));
}
Also used : CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Example 24 with CaseCriteria

use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.

the class CaseFacadeEjbUserFilterTest method testGetCasesOnCommunityLevel.

@Test
public void testGetCasesOnCommunityLevel() {
    loginWith(communityUser);
    CaseDataDto visibleCase = createCase(rdcf2, districtUser2);
    createCase(rdcf1, districtUser1);
    List<CaseIndexDto> indexList = getCaseFacade().getIndexList(new CaseCriteria(), 0, 100, null);
    assertThat(indexList, hasSize(1));
    assertThat(indexList.get(0).getUuid(), is(visibleCase.getUuid()));
}
Also used : CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Example 25 with CaseCriteria

use of de.symeda.sormas.api.caze.CaseCriteria in project SORMAS-Project by hzi-braunschweig.

the class CaseFacadeEjbUserFilterTest method testGetCasesOnRegionLevel.

@Test
public void testGetCasesOnRegionLevel() {
    loginWith(regionUser);
    CaseDataDto visibleCase = createCase(rdcf2, districtUser2);
    createCase(rdcf1, districtUser1);
    List<CaseIndexDto> indexList = getCaseFacade().getIndexList(new CaseCriteria(), 0, 100, null);
    assertThat(indexList, hasSize(1));
    assertThat(indexList.get(0).getUuid(), is(visibleCase.getUuid()));
}
Also used : CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria) CaseIndexDto(de.symeda.sormas.api.caze.CaseIndexDto) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Aggregations

CaseCriteria (de.symeda.sormas.api.caze.CaseCriteria)59 Test (org.junit.Test)39 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)38 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)37 Date (java.util.Date)25 CaseIndexDto (de.symeda.sormas.api.caze.CaseIndexDto)22 PersonDto (de.symeda.sormas.api.person.PersonDto)21 UserDto (de.symeda.sormas.api.user.UserDto)19 CasePersonDto (de.symeda.sormas.api.caze.CasePersonDto)17 LocalDate (java.time.LocalDate)17 RDCF (de.symeda.sormas.backend.TestDataCreator.RDCF)14 RDCFEntities (de.symeda.sormas.backend.TestDataCreator.RDCFEntities)12 CaseExportDto (de.symeda.sormas.api.caze.CaseExportDto)11 SortProperty (de.symeda.sormas.api.utils.SortProperty)8 Disease (de.symeda.sormas.api.Disease)7 CaseReferenceDto (de.symeda.sormas.api.caze.CaseReferenceDto)7 SampleDto (de.symeda.sormas.api.sample.SampleDto)7 DeletionDetails (de.symeda.sormas.api.common.DeletionDetails)6 ContactDto (de.symeda.sormas.api.contact.ContactDto)6 EditPermissionType (de.symeda.sormas.api.EditPermissionType)5