use of de.symeda.sormas.api.therapy.TherapyDto in project SORMAS-Project by hzi-braunschweig.
the class TherapyFacadeEjb method toDto.
public static TherapyDto toDto(Therapy source) {
if (source == null) {
return null;
}
TherapyDto target = new TherapyDto();
DtoHelper.fillDto(target, source);
return target;
}
use of de.symeda.sormas.api.therapy.TherapyDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbTest method testCreateCaseWithoutUuid.
@Test
public void testCreateCaseWithoutUuid() {
RDCF rdcf = creator.createRDCF();
CaseDataDto caze = new CaseDataDto();
caze.setReportDate(new Date());
caze.setReportingUser(creator.createUser(rdcf, UserRole.SURVEILLANCE_OFFICER).toReference());
caze.setCaseClassification(CaseClassification.PROBABLE);
caze.setInvestigationStatus(InvestigationStatus.PENDING);
caze.setDisease(Disease.CORONAVIRUS);
caze.setPerson(creator.createPerson().toReference());
caze.setResponsibleRegion(rdcf.region);
caze.setResponsibleDistrict(rdcf.district);
caze.setFacilityType(FacilityType.HOSPITAL);
caze.setHealthFacility(rdcf.facility);
caze.setTherapy(new TherapyDto());
caze.setSymptoms(new SymptomsDto());
EpiDataDto epiData = new EpiDataDto();
ExposureDto exposure = new ExposureDto();
exposure.setExposureType(ExposureType.WORK);
epiData.setExposures(Collections.singletonList(exposure));
caze.setEpiData(epiData);
CaseDataDto savedCaze = getCaseFacade().save(caze);
MatcherAssert.assertThat(savedCaze.getUuid(), not(isEmptyOrNullString()));
MatcherAssert.assertThat(savedCaze.getTherapy().getUuid(), not(isEmptyOrNullString()));
MatcherAssert.assertThat(savedCaze.getSymptoms().getUuid(), not(isEmptyOrNullString()));
MatcherAssert.assertThat(savedCaze.getEpiData().getUuid(), not(isEmptyOrNullString()));
MatcherAssert.assertThat(savedCaze.getEpiData().getExposures().get(0).getUuid(), not(isEmptyOrNullString()));
}
use of de.symeda.sormas.api.therapy.TherapyDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjbTest method createCaseOfFacilityType.
private CaseDataDto createCaseOfFacilityType(RDCF rdcf, PersonReferenceDto personDto, FacilityType facilityType) {
CaseDataDto caze1 = CaseDataDto.build(personDto, Disease.CORONAVIRUS);
caze1.setReportDate(new Date());
UserDto user = getUserFacade().getByUserName("SomeUser");
if (user == null) {
user = creator.createUser(rdcf, "Some", "User", UserRole.SURVEILLANCE_OFFICER);
}
caze1.setReportingUser(user.toReference());
caze1.setCaseClassification(CaseClassification.PROBABLE);
caze1.setInvestigationStatus(InvestigationStatus.PENDING);
caze1.setDisease(Disease.CORONAVIRUS);
caze1.setPerson(personDto);
caze1.setResponsibleRegion(rdcf.region);
caze1.setResponsibleDistrict(rdcf.district);
caze1.setFacilityType(facilityType);
caze1.setHealthFacility(rdcf.facility);
caze1.setTherapy(new TherapyDto());
caze1.setSymptoms(new SymptomsDto());
EpiDataDto epiData = new EpiDataDto();
ExposureDto exposure = new ExposureDto();
exposure.setExposureType(ExposureType.WORK);
epiData.setExposures(Collections.singletonList(exposure));
caze1.setEpiData(epiData);
return getCaseFacade().save(caze1);
}
use of de.symeda.sormas.api.therapy.TherapyDto in project SORMAS-Project by hzi-braunschweig.
the class TherapyView method update.
private void update(CaseDataDto caze) {
// TODO: Remove this once a proper ViewModel system has been introduced
if (caze.getTherapy() == null) {
TherapyDto therapy = TherapyDto.build();
caze.setTherapy(therapy);
caze = FacadeProvider.getCaseFacade().save(caze);
}
prescriptionCriteria.therapy(caze.getTherapy().toReference());
treatmentCriteria.therapy(caze.getTherapy().toReference());
applyingCriteria = true;
prescriptionTypeFilter.setValue(prescriptionCriteria.getPrescriptionType());
prescriptionTextFilter.setValue(prescriptionCriteria.getTextFilter());
treatmentTypeFilter.setValue(treatmentCriteria.getTreatmentType());
treatmentTextFilter.setValue(treatmentCriteria.getTextFilter());
applyingCriteria = false;
}
Aggregations