use of de.symeda.sormas.api.immunization.ImmunizationIndexDto in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationFacadeEjbTest method testOverdueImmunizationsFilterEnabledAtStartOfDay.
@Test
public void testOverdueImmunizationsFilterEnabledAtStartOfDay() {
loginWith(nationalUser);
final PersonDto person = creator.createPerson("John", "Doe");
final Date startOfDay = DateHelper.getStartOfDay(new Date());
final ImmunizationDto ongoingImmunizationThatEndedYesterday = createOngoingImmunizationWithEndDate(person, new DateTime(startOfDay).minusDays(1).toDate());
createOngoingImmunizationWithEndDate(person, startOfDay);
final ImmunizationCriteria immunizationCriteria = new ImmunizationCriteria();
immunizationCriteria.setOnlyPersonsWithOverdueImmunization(true);
final List<ImmunizationIndexDto> onlyOverdueImmunizations = getImmunizationFacade().getIndexList(immunizationCriteria, 0, 100, null);
Assert.assertEquals(1, onlyOverdueImmunizations.size());
Assert.assertEquals(ongoingImmunizationThatEndedYesterday.getUuid(), onlyOverdueImmunizations.get(0).getUuid());
}
use of de.symeda.sormas.api.immunization.ImmunizationIndexDto in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationIndexDtoResultTransformer method transformTuple.
@Override
public Object transformTuple(Object[] objects, String[] strings) {
Integer age = objects[5] != null ? (int) objects[5] : null;
ApproximateAgeType approximateAgeType = (ApproximateAgeType) objects[6];
Integer birthdateDD = objects[7] != null ? (int) objects[7] : null;
Integer birthdateMM = objects[8] != null ? (int) objects[8] : null;
Integer birthdateYYYY = objects[9] != null ? (int) objects[9] : null;
return new ImmunizationIndexDto((String) objects[0], (String) objects[1], (String) objects[2], (String) objects[3], (Disease) objects[4], new AgeAndBirthDateDto(age, approximateAgeType, birthdateDD, birthdateMM, birthdateYYYY), (Sex) objects[10], (String) objects[11], (MeansOfImmunization) objects[12], (ImmunizationManagementStatus) objects[13], (ImmunizationStatus) objects[14], (Date) objects[15], (Date) objects[16], (String) objects[17], (Date) objects[18], (Boolean) objects[19]);
}
use of de.symeda.sormas.api.immunization.ImmunizationIndexDto in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationGrid method initColumns.
private void initColumns() {
setColumns(ImmunizationIndexDto.UUID, ImmunizationIndexDto.PERSON_UUID, ImmunizationIndexDto.PERSON_FIRST_NAME, ImmunizationIndexDto.PERSON_LAST_NAME, ImmunizationIndexDto.DISEASE, ImmunizationIndexDto.AGE_AND_BIRTH_DATE, ImmunizationIndexDto.SEX, ImmunizationIndexDto.DISTRICT, ImmunizationIndexDto.MEANS_OF_IMMUNIZATION, ImmunizationIndexDto.MANAGEMENT_STATUS, ImmunizationIndexDto.IMMUNIZATION_STATUS, ImmunizationIndexDto.START_DATE, ImmunizationIndexDto.END_DATE, ImmunizationIndexDto.LAST_VACCINE_TYPE, ImmunizationIndexDto.RECOVERY_DATE);
((Column<ImmunizationIndexDto, String>) getColumn(ImmunizationIndexDto.UUID)).setRenderer(new UuidRenderer());
((Column<ImmunizationIndexDto, String>) getColumn(ImmunizationIndexDto.PERSON_UUID)).setRenderer(new UuidRenderer());
((Column<ImmunizationIndexDto, AgeAndBirthDateDto>) getColumn(ImmunizationIndexDto.AGE_AND_BIRTH_DATE)).setRenderer(value -> value == null ? "" : PersonHelper.getAgeAndBirthdateString(value.getAge(), value.getAgeType(), value.getDateOfBirthDD(), value.getDateOfBirthMM(), value.getDateOfBirthYYYY()), new TextRenderer());
((Column<ImmunizationIndexDto, Date>) getColumn(ImmunizationIndexDto.START_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
((Column<ImmunizationIndexDto, Date>) getColumn(ImmunizationIndexDto.END_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
((Column<ImmunizationIndexDto, Date>) getColumn(ImmunizationIndexDto.RECOVERY_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat()));
for (Column<ImmunizationIndexDto, ?> column : getColumns()) {
column.setCaption(I18nProperties.findPrefixCaptionWithDefault(column.getId(), column.getCaption(), ImmunizationIndexDto.I18N_PREFIX, PersonDto.I18N_PREFIX));
column.setStyleGenerator(FieldAccessColumnStyleGenerator.getDefault(getBeanType(), column.getId()));
}
}
use of de.symeda.sormas.api.immunization.ImmunizationIndexDto in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationGrid method setLazyDataProvider.
private void setLazyDataProvider() {
DataProvider<ImmunizationIndexDto, ImmunizationCriteria> dataProvider = DataProvider.fromFilteringCallbacks(query -> FacadeProvider.getImmunizationFacade().getIndexList(query.getFilter().orElse(null), query.getOffset(), query.getLimit(), query.getSortOrders().stream().map(sortOrder -> new SortProperty(sortOrder.getSorted(), sortOrder.getDirection() == SortDirection.ASCENDING)).collect(Collectors.toList())).stream(), query -> (int) FacadeProvider.getImmunizationFacade().count(query.getFilter().orElse(null)));
setDataProvider(dataProvider);
setSelectionMode(SelectionMode.NONE);
}
use of de.symeda.sormas.api.immunization.ImmunizationIndexDto in project SORMAS-Project by hzi-braunschweig.
the class ImmunizationFacadeEjb method getIndexList.
@Override
public List<ImmunizationIndexDto> getIndexList(ImmunizationCriteria criteria, Integer first, Integer max, List<SortProperty> sortProperties) {
List<ImmunizationIndexDto> resultsList = directoryImmunizationService.getIndexList(criteria, first, max, sortProperties);
Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue));
pseudonymizer.pseudonymizeDtoCollection(ImmunizationIndexDto.class, resultsList, ImmunizationIndexDto::isInJurisdiction, null);
return resultsList;
}
Aggregations