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