Search in sources :

Example 11 with VaccinationDto

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

the class EventParticipantImporterTest method testImportWithVaccinations.

@Test
@Ignore("Remove ignore once we have replaced H2, and feature properties can be changed by code")
public void testImportWithVaccinations() throws URISyntaxException, IOException, InterruptedException, CsvValidationException, InvalidColumnException {
    RDCF rdcf = creator.createRDCF("Region", "District", "Community", "Facility");
    UserDto user = creator.createUser(rdcf.region.getUuid(), rdcf.district.getUuid(), rdcf.facility.getUuid(), "Surv", "Sup", UserRole.SURVEILLANCE_SUPERVISOR);
    EventDto event = creator.createEvent(EventStatus.SIGNAL, "Title", "Description", "First", "Name", "12345", TypeOfPlace.PUBLIC_PLACE, DateHelper.subtractDays(new Date(), 2), new Date(), user.toReference(), user.toReference(), Disease.CORONAVIRUS);
    // Successful import of 5 event participant
    File csvFile = new File(getClass().getClassLoader().getResource("sormas_eventparticipant_import_test_vaccinations.csv").toURI());
    EventParticipantImporterExtension eventParticipantImporter = new EventParticipantImporterExtension(csvFile, user, event);
    ImportResultStatus importResult = eventParticipantImporter.runImport();
    assertEquals(eventParticipantImporter.stringBuilder.toString(), ImportResultStatus.COMPLETED, importResult);
    assertEquals(ImportResultStatus.COMPLETED, importResult);
    List<EventParticipantDto> eventParticipants = getEventParticipantFacade().getByEventUuids(Collections.singletonList(event.getUuid()));
    assertEquals(3, eventParticipants.size());
    EventParticipantDto ep1 = eventParticipants.stream().filter(e -> e.getPerson().getFirstName().equals("Günther")).findFirst().get();
    EventParticipantDto ep2 = eventParticipants.stream().filter(e -> e.getPerson().getFirstName().equals("Peter")).findFirst().get();
    EventParticipantDto ep3 = eventParticipants.stream().filter(e -> e.getPerson().getFirstName().equals("Hans")).findFirst().get();
    List<VaccinationDto> case1Vaccinations = FacadeProvider.getVaccinationFacade().getAllVaccinations(ep1.getPerson().getUuid(), Disease.CORONAVIRUS);
    assertEquals(0, case1Vaccinations.size());
    List<VaccinationDto> case2Vaccinations = FacadeProvider.getVaccinationFacade().getAllVaccinations(ep2.getPerson().getUuid(), Disease.CORONAVIRUS);
    assertEquals(1, case2Vaccinations.size());
    assertEquals(Vaccine.COMIRNATY, case2Vaccinations.get(0).getVaccineName());
    assertNull(case2Vaccinations.get(0).getHealthConditions().getChronicPulmonaryDisease());
    List<VaccinationDto> case3Vaccinations = FacadeProvider.getVaccinationFacade().getAllVaccinations(ep3.getPerson().getUuid(), Disease.CORONAVIRUS);
    assertEquals(2, case3Vaccinations.size());
    assertEquals(Vaccine.MRNA_1273, case3Vaccinations.get(0).getVaccineName());
    assertEquals(YesNoUnknown.YES, case3Vaccinations.get(0).getHealthConditions().getChronicPulmonaryDisease());
    assertEquals(Vaccine.MRNA_1273, case3Vaccinations.get(1).getVaccineName());
    assertNull(case3Vaccinations.get(1).getHealthConditions().getChronicPulmonaryDisease());
}
Also used : RDCF(de.symeda.sormas.ui.TestDataCreator.RDCF) UserDto(de.symeda.sormas.api.user.UserDto) EventDto(de.symeda.sormas.api.event.EventDto) EventParticipantDto(de.symeda.sormas.api.event.EventParticipantDto) VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto) ImportResultStatus(de.symeda.sormas.ui.importer.ImportResultStatus) File(java.io.File) Date(java.util.Date) Ignore(org.junit.Ignore) AbstractBeanTest(de.symeda.sormas.ui.AbstractBeanTest) Test(org.junit.Test)

Example 12 with VaccinationDto

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

the class ImmunizationDtoHelper method fillInnerFromDto.

@Override
protected void fillInnerFromDto(Immunization target, ImmunizationDto source) {
    target.setDisease(source.getDisease());
    target.setDiseaseDetails(source.getDiseaseDetails());
    target.setPerson(DatabaseHelper.getPersonDao().getByReferenceDto(source.getPerson()));
    target.setReportDate(source.getReportDate());
    target.setReportingUser(DatabaseHelper.getUserDao().getByReferenceDto(source.getReportingUser()));
    target.setArchived(source.isArchived());
    target.setImmunizationStatus(source.getImmunizationStatus());
    target.setMeansOfImmunization(source.getMeansOfImmunization());
    target.setMeansOfImmunizationDetails(source.getMeansOfImmunizationDetails());
    target.setImmunizationManagementStatus(source.getImmunizationManagementStatus());
    target.setExternalId(source.getExternalId());
    target.setResponsibleRegion(DatabaseHelper.getRegionDao().getByReferenceDto(source.getResponsibleRegion()));
    target.setResponsibleDistrict(DatabaseHelper.getDistrictDao().getByReferenceDto(source.getResponsibleDistrict()));
    target.setResponsibleCommunity(DatabaseHelper.getCommunityDao().getByReferenceDto(source.getResponsibleCommunity()));
    target.setFacilityType(source.getFacilityType());
    target.setHealthFacility(DatabaseHelper.getFacilityDao().getByReferenceDto(source.getHealthFacility()));
    target.setHealthFacilityDetails(source.getHealthFacilityDetails());
    target.setCountry(DatabaseHelper.getCountryDao().getByReferenceDto(source.getCountry()));
    target.setStartDate(source.getStartDate());
    target.setEndDate(source.getEndDate());
    target.setValidFrom(source.getValidFrom());
    target.setValidUntil(source.getValidUntil());
    target.setNumberOfDoses(source.getNumberOfDoses());
    target.setPreviousInfection(source.getPreviousInfection());
    target.setLastInfectionDate(source.getLastInfectionDate());
    target.setAdditionalDetails(source.getAdditionalDetails());
    target.setPositiveTestResultDate(source.getPositiveTestResultDate());
    target.setRecoveryDate(source.getRecoveryDate());
    target.setRelatedCase(DatabaseHelper.getCaseDao().getByReferenceDto(source.getRelatedCase()));
    List<Vaccination> vaccinations = new ArrayList<>();
    if (!source.getVaccinations().isEmpty()) {
        for (VaccinationDto vaccinationDto : source.getVaccinations()) {
            Vaccination vaccination = vaccinationDtoHelper.fillOrCreateFromDto(null, vaccinationDto);
            vaccination.setImmunization(target);
            vaccinations.add(vaccination);
        }
    }
    target.setVaccinations(vaccinations);
    target.setSormasToSormasOriginInfo(sormasToSormasOriginInfoDtoHelper.fillOrCreateFromDto(target.getSormasToSormasOriginInfo(), source.getSormasToSormasOriginInfo()));
    target.setOwnershipHandedOver(source.isOwnershipHandedOver());
    target.setPseudonymized(source.isPseudonymized());
}
Also used : Vaccination(de.symeda.sormas.app.backend.vaccination.Vaccination) ArrayList(java.util.ArrayList) VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto)

Example 13 with VaccinationDto

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

the class DocumentTemplateEntitiesBuilder method getQuarantineOrderEntities.

public DocumentTemplateEntities getQuarantineOrderEntities(DocumentWorkflow workflow, ReferenceDto rootEntityRef, SampleReferenceDto sampleRef, PathogenTestReferenceDto pathogenTestRef, VaccinationReferenceDto vaccinationRef) throws DocumentTemplateException {
    SampleDto sample = null;
    if (sampleRef != null) {
        sample = sampleFacadeEjb.getSampleByUuid(sampleRef.getUuid());
    }
    PathogenTestDto pathogenTest = null;
    if (pathogenTestRef != null) {
        pathogenTest = pathogenTestFacade.getByUuid(pathogenTestRef.getUuid());
    }
    VaccinationDto vaccination = null;
    if (vaccinationRef != null) {
        vaccination = vaccinationFacade.getByUuid(vaccinationRef.getUuid());
    }
    String rootEntityUuid = rootEntityRef.getUuid();
    switch(workflow) {
        case QUARANTINE_ORDER_CASE:
            CaseDataDto caseDataDto = caseFacade.getCaseDataByUuid(rootEntityUuid);
            return buildEntities(RootEntityType.ROOT_CASE, caseDataDto, caseDataDto.getPerson(), sample, pathogenTest, vaccination);
        case QUARANTINE_ORDER_CONTACT:
            ContactDto contactDto = contactFacade.getByUuid(rootEntityUuid);
            return buildEntities(ROOT_CONTACT, contactDto, contactDto.getPerson(), sample, pathogenTest, vaccination);
        case QUARANTINE_ORDER_EVENT_PARTICIPANT:
            EventParticipantDto eventParticipantDto = eventParticipantFacade.getByUuid(rootEntityUuid);
            return buildEntities(ROOT_EVENT_PARTICIPANT, eventParticipantDto, eventParticipantDto.getPerson().toReference(), sample, pathogenTest, vaccination);
        case QUARANTINE_ORDER_TRAVEL_ENTRY:
            TravelEntryDto travelEntryDto = travelEntryFacade.getByUuid(rootEntityUuid);
            return buildEntities(ROOT_TRAVEL_ENTRY, travelEntryDto, travelEntryDto.getPerson(), null, null, null);
        default:
            throw new DocumentTemplateException(I18nProperties.getString(Strings.errorQuarantineOnlySupportedEntities));
    }
}
Also used : DocumentTemplateException(de.symeda.sormas.api.docgeneneration.DocumentTemplateException) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) TravelEntryDto(de.symeda.sormas.api.travelentry.TravelEntryDto) ContactDto(de.symeda.sormas.api.contact.ContactDto) VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto) EventParticipantDto(de.symeda.sormas.api.event.EventParticipantDto) PathogenTestDto(de.symeda.sormas.api.sample.PathogenTestDto) SampleDto(de.symeda.sormas.api.sample.SampleDto)

Example 14 with VaccinationDto

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

the class TestDataCreator method createVaccinationDto.

@NotNull
public VaccinationDto createVaccinationDto(UserReferenceDto reportingUser, ImmunizationReferenceDto immunization, HealthConditionsDto healthConditions) {
    VaccinationDto vaccination = new VaccinationDto();
    vaccination.setUuid(DataHelper.createUuid());
    vaccination.setReportingUser(reportingUser);
    vaccination.setReportDate(new Date());
    vaccination.setImmunization(immunization);
    vaccination.setHealthConditions(healthConditions);
    return vaccination;
}
Also used : VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto) Date(java.util.Date) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with VaccinationDto

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

the class CaseClassificationLogicTest method createImmunizationWithVaccination.

private void createImmunizationWithVaccination(CaseDataDto caze, Date vaccinationDate) {
    ImmunizationDto immunization = creator.createImmunization(caze.getDisease(), caze.getPerson(), caze.getReportingUser(), ImmunizationStatus.ACQUIRED, MeansOfImmunization.VACCINATION, ImmunizationManagementStatus.COMPLETED, new TestDataCreator.RDCF(caze.getRegion(), caze.getDistrict(), caze.getCommunity(), caze.getHealthFacility()));
    VaccinationDto vaccination = creator.createVaccination(caze.getReportingUser(), immunization.toReference(), new HealthConditionsDto());
    vaccination.setVaccinationDate(vaccinationDate);
    getVaccinationFacade().save(vaccination);
}
Also used : ImmunizationDto(de.symeda.sormas.api.immunization.ImmunizationDto) TestDataCreator(de.symeda.sormas.backend.TestDataCreator) VaccinationDto(de.symeda.sormas.api.vaccination.VaccinationDto) HealthConditionsDto(de.symeda.sormas.api.clinicalcourse.HealthConditionsDto)

Aggregations

VaccinationDto (de.symeda.sormas.api.vaccination.VaccinationDto)31 Date (java.util.Date)13 PersonDto (de.symeda.sormas.api.person.PersonDto)12 Test (org.junit.Test)11 ImmunizationDto (de.symeda.sormas.api.immunization.ImmunizationDto)10 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)9 ArrayList (java.util.ArrayList)9 UserDto (de.symeda.sormas.api.user.UserDto)8 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)8 Disease (de.symeda.sormas.api.Disease)5 ContactDto (de.symeda.sormas.api.contact.ContactDto)5 EventDto (de.symeda.sormas.api.event.EventDto)4 EventParticipantDto (de.symeda.sormas.api.event.EventParticipantDto)4 PathogenTestDto (de.symeda.sormas.api.sample.PathogenTestDto)4 ValidationRuntimeException (de.symeda.sormas.api.utils.ValidationRuntimeException)4 LocalDate (java.time.LocalDate)4 EntityDto (de.symeda.sormas.api.EntityDto)3 Captions (de.symeda.sormas.api.i18n.Captions)3 I18nProperties (de.symeda.sormas.api.i18n.I18nProperties)3 ImmunizationReferenceDto (de.symeda.sormas.api.immunization.ImmunizationReferenceDto)3