Search in sources :

Example 1 with ImmunizationIndexDto

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());
}
Also used : ImmunizationIndexDto(de.symeda.sormas.api.immunization.ImmunizationIndexDto) ImmunizationDto(de.symeda.sormas.api.immunization.ImmunizationDto) ImmunizationCriteria(de.symeda.sormas.api.immunization.ImmunizationCriteria) PersonDto(de.symeda.sormas.api.person.PersonDto) Date(java.util.Date) DateTime(org.joda.time.DateTime) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Example 2 with ImmunizationIndexDto

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]);
}
Also used : ImmunizationIndexDto(de.symeda.sormas.api.immunization.ImmunizationIndexDto) AgeAndBirthDateDto(de.symeda.sormas.api.caze.AgeAndBirthDateDto) ApproximateAgeType(de.symeda.sormas.api.person.ApproximateAgeType)

Example 3 with ImmunizationIndexDto

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()));
    }
}
Also used : ImmunizationIndexDto(de.symeda.sormas.api.immunization.ImmunizationIndexDto) UuidRenderer(de.symeda.sormas.ui.utils.UuidRenderer) DateRenderer(com.vaadin.ui.renderers.DateRenderer) TextRenderer(com.vaadin.ui.renderers.TextRenderer)

Example 4 with ImmunizationIndexDto

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);
}
Also used : ImmunizationIndexDto(de.symeda.sormas.api.immunization.ImmunizationIndexDto) SortProperty(de.symeda.sormas.api.utils.SortProperty) ImmunizationCriteria(de.symeda.sormas.api.immunization.ImmunizationCriteria)

Example 5 with ImmunizationIndexDto

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;
}
Also used : ImmunizationIndexDto(de.symeda.sormas.api.immunization.ImmunizationIndexDto) Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer)

Aggregations

ImmunizationIndexDto (de.symeda.sormas.api.immunization.ImmunizationIndexDto)7 ImmunizationCriteria (de.symeda.sormas.api.immunization.ImmunizationCriteria)4 PersonDto (de.symeda.sormas.api.person.PersonDto)3 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)3 Date (java.util.Date)3 DateTime (org.joda.time.DateTime)3 Test (org.junit.Test)3 ImmunizationDto (de.symeda.sormas.api.immunization.ImmunizationDto)2 DateRenderer (com.vaadin.ui.renderers.DateRenderer)1 TextRenderer (com.vaadin.ui.renderers.TextRenderer)1 AgeAndBirthDateDto (de.symeda.sormas.api.caze.AgeAndBirthDateDto)1 ApproximateAgeType (de.symeda.sormas.api.person.ApproximateAgeType)1 SortProperty (de.symeda.sormas.api.utils.SortProperty)1 Pseudonymizer (de.symeda.sormas.backend.util.Pseudonymizer)1 UuidRenderer (de.symeda.sormas.ui.utils.UuidRenderer)1