Search in sources :

Example 1 with TherapyDto

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;
}
Also used : TherapyDto(de.symeda.sormas.api.therapy.TherapyDto)

Example 2 with TherapyDto

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()));
}
Also used : SymptomsDto(de.symeda.sormas.api.symptoms.SymptomsDto) EpiDataDto(de.symeda.sormas.api.epidata.EpiDataDto) RDCF(de.symeda.sormas.backend.TestDataCreator.RDCF) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) ExposureDto(de.symeda.sormas.api.exposure.ExposureDto) TherapyDto(de.symeda.sormas.api.therapy.TherapyDto) Date(java.util.Date) LocalDate(java.time.LocalDate) AbstractBeanTest(de.symeda.sormas.backend.AbstractBeanTest) Test(org.junit.Test)

Example 3 with TherapyDto

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);
}
Also used : SymptomsDto(de.symeda.sormas.api.symptoms.SymptomsDto) EpiDataDto(de.symeda.sormas.api.epidata.EpiDataDto) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) ExposureDto(de.symeda.sormas.api.exposure.ExposureDto) UserDto(de.symeda.sormas.api.user.UserDto) TherapyDto(de.symeda.sormas.api.therapy.TherapyDto) Date(java.util.Date) LocalDate(java.time.LocalDate)

Example 4 with TherapyDto

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;
}
Also used : TherapyDto(de.symeda.sormas.api.therapy.TherapyDto)

Aggregations

TherapyDto (de.symeda.sormas.api.therapy.TherapyDto)4 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)2 EpiDataDto (de.symeda.sormas.api.epidata.EpiDataDto)2 ExposureDto (de.symeda.sormas.api.exposure.ExposureDto)2 SymptomsDto (de.symeda.sormas.api.symptoms.SymptomsDto)2 LocalDate (java.time.LocalDate)2 Date (java.util.Date)2 UserDto (de.symeda.sormas.api.user.UserDto)1 AbstractBeanTest (de.symeda.sormas.backend.AbstractBeanTest)1 RDCF (de.symeda.sormas.backend.TestDataCreator.RDCF)1 Test (org.junit.Test)1