use of de.symeda.sormas.api.caze.CaseIndexDetailedDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjb method getIndexDetailedList.
@Override
public List<CaseIndexDetailedDto> getIndexDetailedList(CaseCriteria caseCriteria, Integer first, Integer max, List<SortProperty> sortProperties) {
CriteriaQuery<CaseIndexDetailedDto> cq = listQueryBuilder.buildIndexDetailedCriteria(caseCriteria, sortProperties);
List<CaseIndexDetailedDto> cases = QueryHelper.getResultList(em, cq, first, max);
// Load latest events info
// Adding a second query here is not perfect, but selecting the last event with a criteria query
// doesn't seem to be possible and using a native query is not an option because of user filters
List<EventSummaryDetails> eventSummaries = eventService.getEventSummaryDetailsByCases(cases.stream().map(CaseIndexDetailedDto::getId).collect(Collectors.toList()));
Map<String, ExternalShareInfoCountAndLatestDate> survToolShareCountAndDates = null;
if (externalSurveillanceToolGatewayFacade.isFeatureEnabled()) {
survToolShareCountAndDates = externalShareInfoService.getCaseShareCountAndLatestDate(cases.stream().map(CaseIndexDto::getId).collect(Collectors.toList())).stream().collect(Collectors.toMap(ExternalShareInfoCountAndLatestDate::getAssociatedObjectUuid, Function.identity()));
}
Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight, I18nProperties.getCaption(Captions.inaccessibleValue));
for (CaseIndexDetailedDto caze : cases) {
if (survToolShareCountAndDates != null) {
ExternalShareInfoCountAndLatestDate survToolShareCountAndDate = survToolShareCountAndDates.get(caze.getUuid());
if (survToolShareCountAndDate != null) {
caze.setSurveillanceToolShareCount(survToolShareCountAndDate.getCount());
caze.setSurveillanceToolLastShareDate(survToolShareCountAndDate.getLatestDate());
caze.setSurveillanceToolStatus(survToolShareCountAndDate.getLatestStatus());
}
}
if (caze.getEventCount() > 0) {
eventSummaries.stream().filter(v -> v.getCaseId() == caze.getId()).max(Comparator.comparing(EventSummaryDetails::getEventDate)).ifPresent(eventSummary -> {
caze.setLatestEventId(eventSummary.getEventUuid());
caze.setLatestEventStatus(eventSummary.getEventStatus());
caze.setLatestEventTitle(eventSummary.getEventTitle());
});
}
Boolean isInJurisdiction = caze.getInJurisdiction();
pseudonymizer.pseudonymizeDto(CaseIndexDetailedDto.class, caze, isInJurisdiction, c -> {
pseudonymizer.pseudonymizeDto(AgeAndBirthDateDto.class, caze.getAgeAndBirthDate(), isInJurisdiction, null);
pseudonymizer.pseudonymizeUser(userService.getByUuid(caze.getReportingUser().getUuid()), userService.getCurrentUser(), caze::setReportingUser);
});
}
return cases;
}
use of de.symeda.sormas.api.caze.CaseIndexDetailedDto in project SORMAS-Project by hzi-braunschweig.
the class CaseGridDetailed method initColumns.
@SuppressWarnings("unchecked")
@Override
protected void initColumns() {
addColumn(caze -> {
if (caze.getLatestSampleDateTime() != null) {
return DateFormatHelper.formatLocalDateTime(caze.getLatestSampleDateTime()) + " [" + caze.getSampleCount() + "]";
} else {
return null;
}
}).setCaption(I18nProperties.getPrefixCaption(CaseIndexDetailedDto.I18N_PREFIX, CaseIndexDetailedDto.LATEST_SAMPLE_DATE_TIME)).setId(LATEST_SAMPLE_DATE_TIME_AND_SAMPLE_COUNT).setSortable(false).setWidth(150);
super.initColumns();
if (!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_GERMANY)) {
getColumn(CaseIndexDetailedDto.RE_INFECTION).setHidden(true);
}
getColumn(CaseIndexDetailedDto.SEX).setWidth(80);
getColumn(CaseIndexDetailedDto.AGE_AND_BIRTH_DATE).setWidth(100);
getColumn(CaseIndexDetailedDto.POSTAL_CODE).setWidth(100);
getColumn(CaseIndexDetailedDto.CITY).setWidth(150);
getColumn(CaseIndexDetailedDto.STREET).setWidth(150);
getColumn(CaseIndexDetailedDto.HOUSE_NUMBER).setWidth(50);
getColumn(CaseIndexDetailedDto.ADDITIONAL_INFORMATION).setWidth(200);
getColumn(CaseIndexDetailedDto.PHONE).setWidth(100);
getColumn(CaseIndexDetailedDto.EVENT_COUNT).setWidth(80).setSortable(false);
getColumn(CaseIndexDetailedDto.LATEST_EVENT_ID).setWidth(80).setSortable(false);
getColumn(CaseIndexDetailedDto.LATEST_EVENT_STATUS).setWidth(80).setSortable(false);
getColumn(CaseIndexDetailedDto.LATEST_EVENT_TITLE).setWidth(150).setSortable(false);
((Column<CaseIndexDetailedDto, String>) getColumn(CaseIndexDetailedDto.LATEST_EVENT_ID)).setRenderer(new UuidRenderer());
addItemClickListener(new ShowDetailsListener<>(CaseIndexDetailedDto.LATEST_EVENT_ID, c -> ControllerProvider.getEventController().navigateToData(c.getLatestEventId())));
((Column<CaseIndexDetailedDto, AgeAndBirthDateDto>) getColumn(CaseIndexDetailedDto.AGE_AND_BIRTH_DATE)).setRenderer(value -> value == null ? "" : PersonHelper.getAgeAndBirthdateString(value.getAge(), value.getAgeType(), value.getDateOfBirthDD(), value.getDateOfBirthMM(), value.getDateOfBirthYYYY()), new TextRenderer());
((Column<CaseIndexDetailedDto, Date>) getColumn(CaseIndexDetailedDto.SYMPTOM_ONSET_DATE)).setRenderer(new DateRenderer(DateFormatHelper.getDateFormat())).setCaption(I18nProperties.getPrefixCaption(SymptomsDto.I18N_PREFIX, SymptomsDto.ONSET_DATE)).setWidth(80);
}
Aggregations