Search in sources :

Example 1 with CaseSimilarityCriteria

use of de.symeda.sormas.api.caze.CaseSimilarityCriteria in project SORMAS-Project by hzi-braunschweig.

the class LabMessageController method getSimilarCases.

private List<CaseSelectionDto> getSimilarCases(PersonReferenceDto selectedPerson, LabMessageDto labMessage) {
    CaseCriteria caseCriteria = new CaseCriteria();
    caseCriteria.person(selectedPerson);
    caseCriteria.disease(labMessage.getTestedDisease());
    CaseSimilarityCriteria caseSimilarityCriteria = new CaseSimilarityCriteria();
    caseSimilarityCriteria.caseCriteria(caseCriteria);
    caseSimilarityCriteria.personUuid(selectedPerson.getUuid());
    return FacadeProvider.getCaseFacade().getSimilarCases(caseSimilarityCriteria);
}
Also used : CaseSimilarityCriteria(de.symeda.sormas.api.caze.CaseSimilarityCriteria) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria)

Example 2 with CaseSimilarityCriteria

use of de.symeda.sormas.api.caze.CaseSimilarityCriteria in project SORMAS-Project by hzi-braunschweig.

the class AbstractLabMessageProcessingFlow method getSimilarCases.

private List<CaseSelectionDto> getSimilarCases(PersonReferenceDto selectedPerson, LabMessageDto labMessage) {
    CaseCriteria caseCriteria = new CaseCriteria();
    caseCriteria.person(selectedPerson);
    caseCriteria.disease(labMessage.getTestedDisease());
    CaseSimilarityCriteria caseSimilarityCriteria = new CaseSimilarityCriteria();
    caseSimilarityCriteria.caseCriteria(caseCriteria);
    caseSimilarityCriteria.personUuid(selectedPerson.getUuid());
    return FacadeProvider.getCaseFacade().getSimilarCases(caseSimilarityCriteria);
}
Also used : CaseSimilarityCriteria(de.symeda.sormas.api.caze.CaseSimilarityCriteria) CaseCriteria(de.symeda.sormas.api.caze.CaseCriteria)

Example 3 with CaseSimilarityCriteria

use of de.symeda.sormas.api.caze.CaseSimilarityCriteria in project SORMAS-Project by hzi-braunschweig.

the class CaseController method selectOrCreateCase.

public void selectOrCreateCase(CaseDataDto caseDto, PersonDto person, Consumer<String> selectedCaseUuidConsumer) {
    CaseSimilarityCriteria criteria = CaseSimilarityCriteria.forCase(caseDto, person.getUuid());
    // Check for similar cases for the **given person**.
    // This is a case similarity check for a fixed person and will not return cases where persons are similar.
    List<CaseSelectionDto> similarCases = FacadeProvider.getCaseFacade().getSimilarCases(criteria);
    if (similarCases.size() > 0) {
        CasePickOrCreateField pickOrCreateField = new CasePickOrCreateField(caseDto, person, similarCases);
        pickOrCreateField.setWidth(1280, Unit.PIXELS);
        final CommitDiscardWrapperComponent<CasePickOrCreateField> component = new CommitDiscardWrapperComponent<>(pickOrCreateField);
        component.getCommitButton().setCaption(I18nProperties.getCaption(Captions.actionConfirm));
        component.getCommitButton().setEnabled(false);
        component.addCommitListener(() -> {
            CaseSelectionDto pickedCase = pickOrCreateField.getValue();
            if (pickedCase != null) {
                selectedCaseUuidConsumer.accept(pickedCase.getUuid());
            } else {
                selectedCaseUuidConsumer.accept(null);
            }
        });
        pickOrCreateField.setSelectionChangeCallback((commitAllowed) -> {
            component.getCommitButton().setEnabled(commitAllowed);
        });
        VaadinUiUtil.showModalPopupWindow(component, I18nProperties.getString(Strings.headingPickOrCreateCase));
    } else {
        selectedCaseUuidConsumer.accept(null);
    }
}
Also used : CaseSimilarityCriteria(de.symeda.sormas.api.caze.CaseSimilarityCriteria) CaseSelectionDto(de.symeda.sormas.api.caze.CaseSelectionDto) CommitDiscardWrapperComponent(de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)

Aggregations

CaseSimilarityCriteria (de.symeda.sormas.api.caze.CaseSimilarityCriteria)3 CaseCriteria (de.symeda.sormas.api.caze.CaseCriteria)2 CaseSelectionDto (de.symeda.sormas.api.caze.CaseSelectionDto)1 CommitDiscardWrapperComponent (de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)1