Search in sources :

Example 1 with CaseSelectionDto

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

the class CaseFacadeEjb method getCaseSelectionList.

@Override
public List<CaseSelectionDto> getCaseSelectionList(CaseCriteria caseCriteria) {
    List<CaseSelectionDto> entries = service.getCaseSelectionList(caseCriteria);
    Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue));
    pseudonymizer.pseudonymizeDtoCollection(CaseSelectionDto.class, entries, CaseSelectionDto::isInJurisdiction, null);
    return entries;
}
Also used : Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer) CaseSelectionDto(de.symeda.sormas.api.caze.CaseSelectionDto)

Example 2 with CaseSelectionDto

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

the class CaseSelectionGrid method buildGrid.

private void buildGrid() {
    setSizeFull();
    setSelectionMode(SelectionMode.SINGLE);
    setHeightMode(HeightMode.ROW);
    BeanItemContainer<CaseSelectionDto> container = new BeanItemContainer<>(CaseSelectionDto.class);
    GeneratedPropertyContainer generatedContainer = new GeneratedPropertyContainer(container);
    setContainerDataSource(generatedContainer);
    setColumns(CaseSelectionDto.UUID, CaseSelectionDto.EPID_NUMBER, CaseSelectionDto.EXTERNAL_ID, CaseSelectionDto.PERSON_FIRST_NAME, CaseSelectionDto.PERSON_LAST_NAME, CaseSelectionDto.AGE_AND_BIRTH_DATE, CaseSelectionDto.RESPONSIBLE_DISTRICT_NAME, CaseSelectionDto.HEALTH_FACILITY_NAME, CaseSelectionDto.REPORT_DATE, CaseSelectionDto.SEX, CaseSelectionDto.CASE_CLASSIFICATION, CaseSelectionDto.OUTCOME);
    if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY)) {
        getColumn(CaseSelectionDto.EPID_NUMBER).setHidden(true);
    } else {
        getColumn(CaseSelectionDto.EXTERNAL_ID).setHidden(true);
    }
    getColumn(CaseSelectionDto.UUID).setRenderer(new V7UuidRenderer());
    getColumn(CaseSelectionDto.AGE_AND_BIRTH_DATE).setConverter(new AgeAndBirthDateDtoConverterV7());
    getColumn(CaseSelectionDto.REPORT_DATE).setRenderer(new DateRenderer(DateHelper.getLocalDateTimeFormat(I18nProperties.getUserLanguage())));
    for (Column column : getColumns()) {
        column.setHeaderCaption(I18nProperties.getPrefixCaption(CaseSelectionDto.I18N_PREFIX, column.getPropertyId().toString(), column.getHeaderCaption()));
    }
}
Also used : CaseSelectionDto(de.symeda.sormas.api.caze.CaseSelectionDto) GeneratedPropertyContainer(com.vaadin.v7.data.util.GeneratedPropertyContainer) AgeAndBirthDateDtoConverterV7(de.symeda.sormas.ui.utils.AgeAndBirthDateDtoConverterV7) BeanItemContainer(com.vaadin.v7.data.util.BeanItemContainer) DateRenderer(com.vaadin.v7.ui.renderers.DateRenderer) V7UuidRenderer(de.symeda.sormas.ui.utils.V7UuidRenderer)

Example 3 with CaseSelectionDto

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

the class CaseFacadeEjb method getSimilarCases.

@Override
public List<CaseSelectionDto> getSimilarCases(CaseSimilarityCriteria criteria) {
    List<CaseSelectionDto> entries = service.getSimilarCases(criteria);
    Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue));
    pseudonymizer.pseudonymizeDtoCollection(CaseSelectionDto.class, entries, CaseSelectionDto::isInJurisdiction, null);
    return entries;
}
Also used : Pseudonymizer(de.symeda.sormas.backend.util.Pseudonymizer) CaseSelectionDto(de.symeda.sormas.api.caze.CaseSelectionDto)

Example 4 with CaseSelectionDto

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

the class CaseSelectionDtoResultTransformer method transformTuple.

@Override
public Object transformTuple(Object[] objects, String[] strings) {
    Integer age = objects[6] != null ? (int) objects[6] : null;
    ApproximateAgeType approximateAgeType = (ApproximateAgeType) objects[7];
    Integer birthdateDD = objects[8] != null ? (int) objects[8] : null;
    Integer birthdateMM = objects[9] != null ? (int) objects[9] : null;
    Integer birthdateYYYY = objects[10] != null ? (int) objects[10] : null;
    String healthFacilityName = FacilityHelper.buildFacilityString((String) objects[12], (String) objects[13], (String) objects[14]);
    return new CaseSelectionDto((String) objects[0], (String) objects[1], (String) objects[2], (Disease) objects[3], (String) objects[4], (String) objects[5], new AgeAndBirthDateDto(age, approximateAgeType, birthdateDD, birthdateMM, birthdateYYYY), (String) objects[11], healthFacilityName, (Date) objects[15], (Sex) objects[16], (CaseClassification) objects[17], (CaseOutcome) objects[18], (Boolean) objects[19]);
}
Also used : AgeAndBirthDateDto(de.symeda.sormas.api.caze.AgeAndBirthDateDto) ApproximateAgeType(de.symeda.sormas.api.person.ApproximateAgeType) CaseSelectionDto(de.symeda.sormas.api.caze.CaseSelectionDto)

Example 5 with CaseSelectionDto

use of de.symeda.sormas.api.caze.CaseSelectionDto 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

CaseSelectionDto (de.symeda.sormas.api.caze.CaseSelectionDto)7 Pseudonymizer (de.symeda.sormas.backend.util.Pseudonymizer)2 CommitDiscardWrapperComponent (de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent)2 Button (com.vaadin.ui.Button)1 BeanItemContainer (com.vaadin.v7.data.util.BeanItemContainer)1 GeneratedPropertyContainer (com.vaadin.v7.data.util.GeneratedPropertyContainer)1 DateRenderer (com.vaadin.v7.ui.renderers.DateRenderer)1 AgeAndBirthDateDto (de.symeda.sormas.api.caze.AgeAndBirthDateDto)1 CaseSimilarityCriteria (de.symeda.sormas.api.caze.CaseSimilarityCriteria)1 SimilarContactDto (de.symeda.sormas.api.contact.SimilarContactDto)1 SimilarEventParticipantDto (de.symeda.sormas.api.event.SimilarEventParticipantDto)1 ApproximateAgeType (de.symeda.sormas.api.person.ApproximateAgeType)1 PersonDto (de.symeda.sormas.api.person.PersonDto)1 CaseImportSimilarityResult (de.symeda.sormas.ui.importer.CaseImportSimilarityResult)1 AgeAndBirthDateDtoConverterV7 (de.symeda.sormas.ui.utils.AgeAndBirthDateDtoConverterV7)1 DiscardListener (de.symeda.sormas.ui.utils.CommitDiscardWrapperComponent.DiscardListener)1 V7UuidRenderer (de.symeda.sormas.ui.utils.V7UuidRenderer)1