Search in sources :

Example 31 with EpiWeek

use of de.symeda.sormas.api.utils.EpiWeek in project SORMAS-Project by hzi-braunschweig.

the class WeeklyReportFacadeEjbTest method testGetByEpiWeekAndUser.

@Test
public void testGetByEpiWeekAndUser() {
    EpiWeek previousEpiWeek = DateHelper.getPreviousEpiWeek(new Date());
    createFacilityInformantReport(informant1, new Date(), previousEpiWeek.getWeek(), previousEpiWeek.getYear(), 1);
    WeeklyReportDto report = getWeeklyReportFacade().getByEpiWeekAndUser(previousEpiWeek, informant1.toReference());
    assertNotNull(report);
    report = getWeeklyReportFacade().getByEpiWeekAndUser(previousEpiWeek, informant2.toReference());
    assertNull(report);
}
Also used : WeeklyReportDto(de.symeda.sormas.api.report.WeeklyReportDto) Date(java.util.Date) EpiWeek(de.symeda.sormas.api.utils.EpiWeek) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 32 with EpiWeek

use of de.symeda.sormas.api.utils.EpiWeek in project SORMAS-Project by hzi-braunschweig.

the class WeeklyReportFacadeEjbTest method testGetSummariesPerOfficer.

@Test
public void testGetSummariesPerOfficer() {
    EpiWeek previousEpiWeek = DateHelper.getPreviousEpiWeek(new Date());
    createFacilityInformantReport(informant1, new Date(), previousEpiWeek.getWeek(), previousEpiWeek.getYear(), 1);
    createCommunityInformantReport(informant3, new Date(), previousEpiWeek.getWeek(), previousEpiWeek.getYear(), 1);
    createFacilityInformantReport(informant4, new Date(), previousEpiWeek.getWeek(), previousEpiWeek.getYear(), 0);
    List<WeeklyReportOfficerSummaryDto> summariesPerRegion = getWeeklyReportFacade().getSummariesPerOfficer(officer.getRegion(), previousEpiWeek);
    assertEquals(1, summariesPerRegion.size());
    WeeklyReportOfficerSummaryDto summary = summariesPerRegion.get(0);
    assertEquals(4, summary.getInformants());
    assertEquals(2, summary.getInformantCaseReports());
    assertEquals(1, summary.getInformantZeroReports());
    assertEquals(1, summary.getInformantMissingReports());
}
Also used : WeeklyReportOfficerSummaryDto(de.symeda.sormas.api.report.WeeklyReportOfficerSummaryDto) Date(java.util.Date) EpiWeek(de.symeda.sormas.api.utils.EpiWeek) Test(org.junit.Test) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest)

Example 33 with EpiWeek

use of de.symeda.sormas.api.utils.EpiWeek in project SORMAS-Project by hzi-braunschweig.

the class EventsFilterForm method onApplyClick.

private void onApplyClick(EpiWeekAndDateFilterComponent<?> weekAndDateFilter, EventCriteria.DateType dateType) {
    EventCriteria criteria = getValue();
    DateFilterOption dateFilterOption = (DateFilterOption) weekAndDateFilter.getDateFilterOptionFilter().getValue();
    CriteriaDateType eventDateType = (CriteriaDateType) weekAndDateFilter.getDateTypeSelector().getValue();
    Date fromDate, toDate;
    if (dateFilterOption == DateFilterOption.DATE) {
        Date dateFrom = weekAndDateFilter.getDateFromFilter().getValue();
        fromDate = dateFrom != null ? DateHelper.getStartOfDay(dateFrom) : null;
        Date dateTo = weekAndDateFilter.getDateToFilter().getValue();
        toDate = dateTo != null ? DateHelper.getEndOfDay(dateTo) : null;
    } else {
        fromDate = DateHelper.getEpiWeekStart((EpiWeek) weekAndDateFilter.getWeekFromFilter().getValue());
        toDate = DateHelper.getEpiWeekEnd((EpiWeek) weekAndDateFilter.getWeekToFilter().getValue());
    }
    if ((fromDate != null && toDate != null) || (fromDate == null && toDate == null)) {
        criteria.dateBetween(dateType, fromDate, toDate, eventDateType, dateFilterOption);
    } else {
        weekAndDateFilter.setNotificationsForMissingFilters();
    }
}
Also used : DateFilterOption(de.symeda.sormas.api.utils.DateFilterOption) EventCriteria(de.symeda.sormas.api.event.EventCriteria) EventCriteriaDateType(de.symeda.sormas.api.event.EventCriteriaDateType) CriteriaDateType(de.symeda.sormas.api.utils.criteria.CriteriaDateType) Date(java.util.Date) EpiWeek(de.symeda.sormas.api.utils.EpiWeek)

Example 34 with EpiWeek

use of de.symeda.sormas.api.utils.EpiWeek in project SORMAS-Project by hzi-braunschweig.

the class ImmunizationFilterForm method onApplyClick.

private void onApplyClick(EpiWeekAndDateFilterComponent<ImmunizationDateType> weekAndDateFilter) {
    ImmunizationCriteria criteria = getValue();
    DateFilterOption dateFilterOption = (DateFilterOption) weekAndDateFilter.getDateFilterOptionFilter().getValue();
    Date fromDate, toDate;
    if (dateFilterOption == DateFilterOption.DATE) {
        Date dateFrom = weekAndDateFilter.getDateFromFilter().getValue();
        fromDate = dateFrom != null ? DateHelper.getStartOfDay(dateFrom) : null;
        Date dateTo = weekAndDateFilter.getDateToFilter().getValue();
        toDate = dateFrom != null ? DateHelper.getEndOfDay(dateTo) : null;
    } else {
        fromDate = DateHelper.getEpiWeekStart((EpiWeek) weekAndDateFilter.getWeekFromFilter().getValue());
        toDate = DateHelper.getEpiWeekEnd((EpiWeek) weekAndDateFilter.getWeekToFilter().getValue());
    }
    if ((fromDate != null && toDate != null) || (fromDate == null && toDate == null)) {
        criteria.setDateFilterOption(dateFilterOption);
        ImmunizationDateType immunizationDateType = (ImmunizationDateType) weekAndDateFilter.getDateTypeSelector().getValue();
        criteria.setImmunizationDateType(immunizationDateType);
        criteria.setFromDate(fromDate);
        criteria.setToDate(toDate);
    } else {
        weekAndDateFilter.setNotificationsForMissingFilters();
    }
}
Also used : ImmunizationCriteria(de.symeda.sormas.api.immunization.ImmunizationCriteria) DateFilterOption(de.symeda.sormas.api.utils.DateFilterOption) ImmunizationDateType(de.symeda.sormas.api.immunization.ImmunizationDateType) Date(java.util.Date) EpiWeek(de.symeda.sormas.api.utils.EpiWeek)

Aggregations

EpiWeek (de.symeda.sormas.api.utils.EpiWeek)34 Date (java.util.Date)24 DateFilterOption (de.symeda.sormas.api.utils.DateFilterOption)9 WeeklyReportOfficerSummaryDto (de.symeda.sormas.api.report.WeeklyReportOfficerSummaryDto)4 Test (org.junit.Test)4 Button (com.vaadin.ui.Button)3 HorizontalLayout (com.vaadin.ui.HorizontalLayout)3 MonthOfYear (de.symeda.sormas.api.MonthOfYear)3 QuarterOfYear (de.symeda.sormas.api.QuarterOfYear)3 WeeklyReportDto (de.symeda.sormas.api.report.WeeklyReportDto)3 WeeklyReportRegionSummaryDto (de.symeda.sormas.api.report.WeeklyReportRegionSummaryDto)3 TaskCriteria (de.symeda.sormas.api.task.TaskCriteria)3 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)3 LocalDate (java.time.LocalDate)3 ArrayList (java.util.ArrayList)3 RolesAllowed (javax.annotation.security.RolesAllowed)3 Month (de.symeda.sormas.api.Month)2 Quarter (de.symeda.sormas.api.Quarter)2 Year (de.symeda.sormas.api.Year)2 EventCriteria (de.symeda.sormas.api.event.EventCriteria)2