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