Search in sources :

Example 1 with VaccinationListEntryDto

use of de.symeda.sormas.api.vaccination.VaccinationListEntryDto in project SORMAS-Project by hzi-braunschweig.

the class VaccinationFacadeEjb method getEntriesListWithRelevance.

@Override
public List<VaccinationListEntryDto> getEntriesListWithRelevance(CaseReferenceDto caseReferenceDto, VaccinationListCriteria criteria, Integer first, Integer max) {
    List<Vaccination> vaccinationsList = vaccinationService.getVaccinationsByCriteria(criteria, first, max, null);
    Case caze = caseService.getByReferenceDto(caseReferenceDto);
    return vaccinationsList.stream().map(v -> toVaccinationListEntryDto(v, vaccinationService.isVaccinationRelevant(caze, v), I18nProperties.getString(v.getVaccinationDate() != null ? Strings.messageVaccinationNotRelevantForCase : Strings.messageVaccinationNoDateNotRelevantForCase))).collect(Collectors.toList());
}
Also used : ImmunizationManagementStatus(de.symeda.sormas.api.immunization.ImmunizationManagementStatus) ImmunizationEntityHelper(de.symeda.sormas.backend.immunization.ImmunizationEntityHelper) DtoHelper(de.symeda.sormas.backend.util.DtoHelper) Date(java.util.Date) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) HealthConditionsMapper(de.symeda.sormas.backend.clinicalcourse.HealthConditionsMapper) Immunization(de.symeda.sormas.backend.immunization.entity.Immunization) MeansOfImmunization(de.symeda.sormas.api.immunization.MeansOfImmunization) Valid(javax.validation.Valid) VaccinationFacade(de.symeda.sormas.api.vaccination.VaccinationFacade) UserFacadeEjb(de.symeda.sormas.backend.user.UserFacadeEjb) Map(java.util.Map) EventParticipantReferenceDto(de.symeda.sormas.api.event.EventParticipantReferenceDto) ImmunizationFacadeEjbLocal(de.symeda.sormas.backend.immunization.ImmunizationFacadeEjb.ImmunizationFacadeEjbLocal) VaccinationStatus(de.symeda.sormas.api.caze.VaccinationStatus) Contact(de.symeda.sormas.backend.contact.Contact) Stateless(javax.ejb.Stateless) CaseService(de.symeda.sormas.backend.caze.CaseService) NotNull(javax.validation.constraints.NotNull) Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer) Collectors(java.util.stream.Collectors) ImmunizationFacadeEjb(de.symeda.sormas.backend.immunization.ImmunizationFacadeEjb) List(java.util.List) UserService(de.symeda.sormas.backend.user.UserService) User(de.symeda.sormas.backend.user.User) Optional(java.util.Optional) ImmunizationDto(de.symeda.sormas.api.immunization.ImmunizationDto) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) ValidationRuntimeException(de.symeda.sormas.api.utils.ValidationRuntimeException) EventParticipant(de.symeda.sormas.backend.event.EventParticipant) ClinicalCourseFacadeEjb(de.symeda.sormas.backend.clinicalcourse.ClinicalCourseFacadeEjb) PersonReferenceDto(de.symeda.sormas.api.person.PersonReferenceDto) DateHelper(de.symeda.sormas.api.utils.DateHelper) VaccinationListEntryDto(de.symeda.sormas.api.vaccination.VaccinationListEntryDto) EventParticipantService(de.symeda.sormas.backend.event.EventParticipantService) ArrayList(java.util.ArrayList) CaseReferenceDto(de.symeda.sormas.api.caze.CaseReferenceDto) Case(de.symeda.sormas.backend.caze.Case) LocalBean(javax.ejb.LocalBean) EJB(javax.ejb.EJB) Validations(de.symeda.sormas.api.i18n.Validations) DataHelper(de.symeda.sormas.api.utils.DataHelper) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) VaccinationListCriteria(de.symeda.sormas.api.vaccination.VaccinationListCriteria) ImmunizationService(de.symeda.sormas.backend.immunization.ImmunizationService) SortProperty(de.symeda.sormas.api.utils.SortProperty) Event(de.symeda.sormas.backend.event.Event) UserRight(de.symeda.sormas.api.user.UserRight) Disease(de.symeda.sormas.api.Disease) ContactService(de.symeda.sormas.backend.contact.ContactService) VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto) ImmunizationStatus(de.symeda.sormas.api.immunization.ImmunizationStatus) ContactReferenceDto(de.symeda.sormas.api.contact.ContactReferenceDto) Comparator(java.util.Comparator) Strings(de.symeda.sormas.api.i18n.Strings) Case(de.symeda.sormas.backend.caze.Case)

Example 2 with VaccinationListEntryDto

use of de.symeda.sormas.api.vaccination.VaccinationListEntryDto in project SORMAS-Project by hzi-braunschweig.

the class VaccinationFacadeEjb method getEntriesListWithRelevance.

@Override
public List<VaccinationListEntryDto> getEntriesListWithRelevance(ContactReferenceDto contactReferenceDto, VaccinationListCriteria criteria, Integer first, Integer max) {
    List<Vaccination> vaccinationsList = vaccinationService.getVaccinationsByCriteria(criteria, first, max, null);
    Contact contact = contactService.getByReferenceDto(contactReferenceDto);
    return vaccinationsList.stream().map(v -> toVaccinationListEntryDto(v, vaccinationService.isVaccinationRelevant(contact, v), I18nProperties.getString(v.getVaccinationDate() != null ? Strings.messageVaccinationNotRelevantForContact : Strings.messageVaccinationNoDateNotRelevantForContact))).collect(Collectors.toList());
}
Also used : ImmunizationManagementStatus(de.symeda.sormas.api.immunization.ImmunizationManagementStatus) ImmunizationEntityHelper(de.symeda.sormas.backend.immunization.ImmunizationEntityHelper) DtoHelper(de.symeda.sormas.backend.util.DtoHelper) Date(java.util.Date) I18nProperties(de.symeda.sormas.api.i18n.I18nProperties) HealthConditionsMapper(de.symeda.sormas.backend.clinicalcourse.HealthConditionsMapper) Immunization(de.symeda.sormas.backend.immunization.entity.Immunization) MeansOfImmunization(de.symeda.sormas.api.immunization.MeansOfImmunization) Valid(javax.validation.Valid) VaccinationFacade(de.symeda.sormas.api.vaccination.VaccinationFacade) UserFacadeEjb(de.symeda.sormas.backend.user.UserFacadeEjb) Map(java.util.Map) EventParticipantReferenceDto(de.symeda.sormas.api.event.EventParticipantReferenceDto) ImmunizationFacadeEjbLocal(de.symeda.sormas.backend.immunization.ImmunizationFacadeEjb.ImmunizationFacadeEjbLocal) VaccinationStatus(de.symeda.sormas.api.caze.VaccinationStatus) Contact(de.symeda.sormas.backend.contact.Contact) Stateless(javax.ejb.Stateless) CaseService(de.symeda.sormas.backend.caze.CaseService) NotNull(javax.validation.constraints.NotNull) Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer) Collectors(java.util.stream.Collectors) ImmunizationFacadeEjb(de.symeda.sormas.backend.immunization.ImmunizationFacadeEjb) List(java.util.List) UserService(de.symeda.sormas.backend.user.UserService) User(de.symeda.sormas.backend.user.User) Optional(java.util.Optional) ImmunizationDto(de.symeda.sormas.api.immunization.ImmunizationDto) RegionReferenceDto(de.symeda.sormas.api.infrastructure.region.RegionReferenceDto) ValidationRuntimeException(de.symeda.sormas.api.utils.ValidationRuntimeException) EventParticipant(de.symeda.sormas.backend.event.EventParticipant) ClinicalCourseFacadeEjb(de.symeda.sormas.backend.clinicalcourse.ClinicalCourseFacadeEjb) PersonReferenceDto(de.symeda.sormas.api.person.PersonReferenceDto) DateHelper(de.symeda.sormas.api.utils.DateHelper) VaccinationListEntryDto(de.symeda.sormas.api.vaccination.VaccinationListEntryDto) EventParticipantService(de.symeda.sormas.backend.event.EventParticipantService) ArrayList(java.util.ArrayList) CaseReferenceDto(de.symeda.sormas.api.caze.CaseReferenceDto) Case(de.symeda.sormas.backend.caze.Case) LocalBean(javax.ejb.LocalBean) EJB(javax.ejb.EJB) Validations(de.symeda.sormas.api.i18n.Validations) DataHelper(de.symeda.sormas.api.utils.DataHelper) DistrictReferenceDto(de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto) VaccinationListCriteria(de.symeda.sormas.api.vaccination.VaccinationListCriteria) ImmunizationService(de.symeda.sormas.backend.immunization.ImmunizationService) SortProperty(de.symeda.sormas.api.utils.SortProperty) Event(de.symeda.sormas.backend.event.Event) UserRight(de.symeda.sormas.api.user.UserRight) Disease(de.symeda.sormas.api.Disease) ContactService(de.symeda.sormas.backend.contact.ContactService) VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto) ImmunizationStatus(de.symeda.sormas.api.immunization.ImmunizationStatus) ContactReferenceDto(de.symeda.sormas.api.contact.ContactReferenceDto) Comparator(java.util.Comparator) Strings(de.symeda.sormas.api.i18n.Strings) Contact(de.symeda.sormas.backend.contact.Contact)

Example 3 with VaccinationListEntryDto

use of de.symeda.sormas.api.vaccination.VaccinationListEntryDto in project SORMAS-Project by hzi-braunschweig.

the class VaccinationFacadeEjbTest method testGetEntriesList.

@Test
public void testGetEntriesList() {
    loginWith(nationalUser);
    PersonDto person1 = creator.createPerson("John", "Doe");
    PersonDto person2 = creator.createPerson("Jane", "Doe");
    Disease disease1 = Disease.CORONAVIRUS;
    Disease disease2 = Disease.CHOLERA;
    ImmunizationDto immunization11 = creator.createImmunization(disease1, person1.toReference(), nationalUser.toReference(), rdcf1);
    ImmunizationDto immunization12 = creator.createImmunization(disease1, person1.toReference(), nationalUser.toReference(), rdcf1);
    ImmunizationDto immunization13 = creator.createImmunization(disease2, person1.toReference(), nationalUser.toReference(), rdcf1);
    ImmunizationDto immunization21 = creator.createImmunization(disease1, person2.toReference(), nationalUser.toReference(), rdcf1);
    creator.createImmunization(disease2, person2.toReference(), nationalUser.toReference(), rdcf1);
    VaccinationDto vaccination111 = creator.createVaccination(nationalUser.toReference(), immunization11.toReference());
    VaccinationDto vaccination112 = creator.createVaccination(nationalUser.toReference(), immunization11.toReference());
    VaccinationDto vaccination121 = creator.createVaccination(nationalUser.toReference(), immunization12.toReference());
    VaccinationDto vaccination131 = creator.createVaccination(nationalUser.toReference(), immunization13.toReference());
    VaccinationDto vaccination211 = creator.createVaccination(nationalUser.toReference(), immunization21.toReference());
    VaccinationDto vaccination212 = creator.createVaccination(nationalUser.toReference(), immunization21.toReference());
    List<VaccinationListEntryDto> vaccinations = getVaccinationFacade().getEntriesList(new VaccinationListCriteria.Builder(person1.toReference()).withDisease(disease1).build(), null, null, null);
    assertThat(vaccinations, hasSize(3));
    assertThat(vaccinations, hasItems(hasProperty(EntityDto.UUID, is(vaccination111.getUuid())), hasProperty(EntityDto.UUID, is(vaccination112.getUuid())), hasProperty(EntityDto.UUID, is(vaccination121.getUuid()))));
    vaccinations = getVaccinationFacade().getEntriesList(new VaccinationListCriteria.Builder(person1.toReference()).withDisease(disease2).build(), null, null, null);
    assertThat(vaccinations, hasSize(1));
    assertThat(vaccinations, hasItem(hasProperty(EntityDto.UUID, is(vaccination131.getUuid()))));
    vaccinations = getVaccinationFacade().getEntriesList(new VaccinationListCriteria.Builder(person2.toReference()).withDisease(disease1).build(), null, null, null);
    assertThat(vaccinations, hasSize(2));
    assertThat(vaccinations, hasItems(hasProperty(EntityDto.UUID, is(vaccination211.getUuid())), hasProperty(EntityDto.UUID, is(vaccination212.getUuid()))));
    vaccinations = getVaccinationFacade().getEntriesList(new VaccinationListCriteria.Builder(person2.toReference()).withDisease(disease2).build(), null, null, null);
    assertThat(vaccinations, hasSize(0));
}
Also used : ImmunizationDto(de.symeda.sormas.api.immunization.ImmunizationDto) Disease(de.symeda.sormas.api.Disease) PersonDto(de.symeda.sormas.api.person.PersonDto) VaccinationListEntryDto(de.symeda.sormas.api.vaccination.VaccinationListEntryDto) VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto) VaccinationListCriteria(de.symeda.sormas.api.vaccination.VaccinationListCriteria) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Example 4 with VaccinationListEntryDto

use of de.symeda.sormas.api.vaccination.VaccinationListEntryDto in project SORMAS-Project by hzi-braunschweig.

the class VaccinationList method drawDisplayedEntries.

@Override
protected void drawDisplayedEntries() {
    for (VaccinationListEntryDto entryDto : getDisplayedEntries()) {
        VaccinationListEntry listEntry = new VaccinationListEntry(entryDto, disease == null);
        listEntry.addEditButton("edit-vaccination-" + listEntry.getVaccination().getUuid(), e -> fireEvent(new SideComponentFieldEditEvent(listEntry)));
        listLayout.addComponent(listEntry);
    }
}
Also used : SideComponentFieldEditEvent(de.symeda.sormas.ui.utils.components.sidecomponent.event.SideComponentFieldEditEvent) VaccinationListEntryDto(de.symeda.sormas.api.vaccination.VaccinationListEntryDto)

Example 5 with VaccinationListEntryDto

use of de.symeda.sormas.api.vaccination.VaccinationListEntryDto in project SORMAS-Project by hzi-braunschweig.

the class VaccinationFacadeEjb method toVaccinationListEntryDto.

private VaccinationListEntryDto toVaccinationListEntryDto(Vaccination vaccination, boolean relevant, String message) {
    VaccinationListEntryDto dto = new VaccinationListEntryDto();
    dto.setUuid(vaccination.getUuid());
    dto.setDisease(vaccination.getImmunization().getDisease());
    dto.setVaccinationDate(vaccination.getVaccinationDate());
    dto.setVaccineName(vaccination.getVaccineName());
    dto.setOtherVaccineName(vaccination.getOtherVaccineName());
    dto.setRelevant(relevant);
    dto.setNonRelevantMessage(message);
    return dto;
}
Also used : VaccinationListEntryDto(de.symeda.sormas.api.vaccination.VaccinationListEntryDto)

Aggregations

VaccinationListEntryDto (de.symeda.sormas.api.vaccination.VaccinationListEntryDto)7 Disease (de.symeda.sormas.api.Disease)4 ImmunizationDto (de.symeda.sormas.api.immunization.ImmunizationDto)4 VaccinationDto (de.symeda.sormas.api.vaccination.VaccinationDto)4 VaccinationListCriteria (de.symeda.sormas.api.vaccination.VaccinationListCriteria)4 CaseReferenceDto (de.symeda.sormas.api.caze.CaseReferenceDto)3 VaccinationStatus (de.symeda.sormas.api.caze.VaccinationStatus)3 ContactReferenceDto (de.symeda.sormas.api.contact.ContactReferenceDto)3 EventParticipantReferenceDto (de.symeda.sormas.api.event.EventParticipantReferenceDto)3 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)3 Strings (de.symeda.sormas.api.i18n.Strings)3 Validations (de.symeda.sormas.api.i18n.Validations)3 ImmunizationManagementStatus (de.symeda.sormas.api.immunization.ImmunizationManagementStatus)3 ImmunizationStatus (de.symeda.sormas.api.immunization.ImmunizationStatus)3 MeansOfImmunization (de.symeda.sormas.api.immunization.MeansOfImmunization)3 DistrictReferenceDto (de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto)3 RegionReferenceDto (de.symeda.sormas.api.infrastructure.region.RegionReferenceDto)3 PersonReferenceDto (de.symeda.sormas.api.person.PersonReferenceDto)3 UserRight (de.symeda.sormas.api.user.UserRight)3 DataHelper (de.symeda.sormas.api.utils.DataHelper)3