Search in sources :

Example 1 with SymptomsForm

use of de.symeda.sormas.ui.symptoms.SymptomsForm in project SORMAS-Project by hzi-braunschweig.

the class ClinicalVisitForm method addFields.

@Override
protected void addFields() {
    if (disease == null) {
        // workaround to stop initialization until disease is set
        return;
    }
    addField(ClinicalVisitDto.VISIT_DATE_TIME, DateTimeField.class);
    addField(ClinicalVisitDto.VISITING_PERSON, TextField.class);
    addField(ClinicalVisitDto.VISIT_REMARKS, TextField.class).setDescription(I18nProperties.getPrefixDescription(ClinicalVisitDto.I18N_PREFIX, ClinicalVisitDto.VISIT_REMARKS, "") + "\n" + I18nProperties.getDescription(Descriptions.descGdpr));
    ;
    symptomsForm = new SymptomsForm(null, disease, person, SymptomsContext.CLINICAL_VISIT, null, fieldAccessCheckers);
    getFieldGroup().bind(symptomsForm, ClinicalVisitDto.SYMPTOMS);
    getContent().addComponent(symptomsForm, ClinicalVisitDto.SYMPTOMS);
    setRequired(true, ClinicalVisitDto.VISIT_DATE_TIME);
    initializeAccessAndAllowedAccesses();
}
Also used : SymptomsForm(de.symeda.sormas.ui.symptoms.SymptomsForm) TextField(com.vaadin.v7.ui.TextField)

Example 2 with SymptomsForm

use of de.symeda.sormas.ui.symptoms.SymptomsForm in project SORMAS-Project by hzi-braunschweig.

the class CaseController method getSymptomsEditComponent.

public CommitDiscardWrapperComponent<SymptomsForm> getSymptomsEditComponent(final String caseUuid, ViewMode viewMode) {
    CaseDataDto caseDataDto = findCase(caseUuid);
    PersonDto person = FacadeProvider.getPersonFacade().getPersonByUuid(caseDataDto.getPerson().getUuid());
    SymptomsForm symptomsForm = new SymptomsForm(caseDataDto, caseDataDto.getDisease(), person, SymptomsContext.CASE, viewMode, UiFieldAccessCheckers.forSensitiveData(caseDataDto.isPseudonymized()));
    symptomsForm.setValue(caseDataDto.getSymptoms());
    CommitDiscardWrapperComponent<SymptomsForm> editView = new CommitDiscardWrapperComponent<SymptomsForm>(symptomsForm, UserProvider.getCurrent().hasUserRight(UserRight.CASE_EDIT), symptomsForm.getFieldGroup());
    editView.addCommitListener(() -> {
        CaseDataDto cazeDto = FacadeProvider.getCaseFacade().getCaseDataByUuid(caseUuid);
        cazeDto.setSymptoms(symptomsForm.getValue());
        saveCase(cazeDto);
    });
    return editView;
}
Also used : CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) PersonDto(de.symeda.sormas.api.person.PersonDto) SymptomsForm(de.symeda.sormas.ui.symptoms.SymptomsForm) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)

Example 3 with SymptomsForm

use of de.symeda.sormas.ui.symptoms.SymptomsForm in project SORMAS-Project by hzi-braunschweig.

the class VisitEditForm method addFields.

@Override
protected void addFields() {
    if (disease == null) {
        // workaround to stop initialization until disease is set
        return;
    }
    VerticalLayout layoutPhoneLink = new VerticalLayout();
    layoutPhoneLink.setSpacing(false);
    layoutPhoneLink.setMargin(false);
    layoutPhoneLink.setWidth(100, Unit.PERCENTAGE);
    Label labelPhoneLink = new Label((I18nProperties.getCaption(Captions.contactPersonPhoneNumber)));
    labelPhoneLink.setPrimaryStyleName("v-caption");
    layoutPhoneLink.addComponent(labelPhoneLink);
    Link linkPhone = new Link(this.person.getPhone(), new ExternalResource(PHONE_LINK_PREFIX + this.person.getPhone()));
    linkPhone.setWidth(100, Unit.PERCENTAGE);
    layoutPhoneLink.addComponent(linkPhone);
    getContent().addComponent(layoutPhoneLink, CONTACT_PERSON_PHONE_NUMBER_LOC);
    addField(VisitDto.VISIT_DATE_TIME, DateTimeField.class);
    NullableOptionGroup visitStatus = addField(VisitDto.VISIT_STATUS, NullableOptionGroup.class);
    addField(VisitDto.VISIT_REMARKS, TextField.class).setDescription(I18nProperties.getPrefixDescription(VisitDto.I18N_PREFIX, VisitDto.VISIT_REMARKS) + "\n" + I18nProperties.getDescription(Descriptions.descGdpr));
    symptomsForm = new SymptomsForm(null, disease, person, SymptomsContext.VISIT, null, fieldAccessCheckers);
    getFieldGroup().bind(symptomsForm, VisitDto.SYMPTOMS);
    getContent().addComponent(symptomsForm, VisitDto.SYMPTOMS);
    setRequired(true, VisitDto.VISIT_DATE_TIME, VisitDto.VISIT_STATUS);
    initializeAccessAndAllowedAccesses();
    if (contact != null) {
        Date startDate = ContactLogic.getStartDate(contact);
        addDateValidation(startDate, startDate, contact.getLastContactDate() != null ? Validations.visitBeforeLastContactDate : Validations.visitBeforeContactReport, contact.getFollowUpUntil());
    }
    if (caze != null) {
        addDateValidation(CaseLogic.getStartDate(caze), caze.getReportDate(), caze.getSymptoms().getOnsetDate() != null ? Validations.visitBeforeSymptomsOnSet : Validations.visitBeforeCaseReport, CaseLogic.getEndDate(caze.getSymptoms().getOnsetDate(), caze.getReportDate(), caze.getFollowUpUntil()));
    }
    symptomsForm.initializeSymptomRequirementsForVisit((NullableOptionGroup) getFieldGroup().getField(VisitDto.VISIT_STATUS));
    FieldHelper.setEnabledWhen(getFieldGroup(), visitStatus, Arrays.asList(VisitStatus.COOPERATIVE), Arrays.asList(VisitDto.SYMPTOMS), true);
}
Also used : NullableOptionGroup(de.symeda.sormas.ui.utils.NullableOptionGroup) SymptomsForm(de.symeda.sormas.ui.symptoms.SymptomsForm) Label(com.vaadin.ui.Label) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.v7.ui.TextField) ExternalResource(com.vaadin.server.ExternalResource) Link(com.vaadin.ui.Link) Date(java.util.Date)

Aggregations

SymptomsForm (de.symeda.sormas.ui.symptoms.SymptomsForm)3 TextField (com.vaadin.v7.ui.TextField)2 ExternalResource (com.vaadin.server.ExternalResource)1 Label (com.vaadin.ui.Label)1 Link (com.vaadin.ui.Link)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)1 PersonDto (de.symeda.sormas.api.person.PersonDto)1 CommitDiscardWrapperComponent (de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)1 NullableOptionGroup (de.symeda.sormas.ui.utils.NullableOptionGroup)1 Date (java.util.Date)1