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);
}
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());
}
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();
}
}
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();
}
}
Aggregations