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;
}
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()));
}
}
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;
}
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]);
}
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);
}
}
Aggregations