use of de.symeda.sormas.api.caze.MapCaseDto in project SORMAS-Project by hzi-braunschweig.
the class CaseService method getCasesForMap.
public List<MapCaseDto> getCasesForMap(Region region, District district, Disease disease, Date from, Date to, NewCaseDateType dateType) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<MapCaseDto> cq = cb.createQuery(MapCaseDto.class);
Root<Case> caze = cq.from(getElementClass());
CaseQueryContext caseQueryContext = new CaseQueryContext(cb, cq, caze);
CaseJoins<Case> joins = (CaseJoins<Case>) caseQueryContext.getJoins();
Predicate filter = createMapCasesFilter(cb, cq, caze, joins, region, district, disease, from, to, dateType);
List<MapCaseDto> result;
if (filter != null) {
cq.where(filter);
cq.multiselect(caze.get(Case.UUID), caze.get(Case.REPORT_DATE), caze.get(Case.CASE_CLASSIFICATION), caze.get(Case.DISEASE), joins.getPerson().get(Person.UUID), joins.getPerson().get(Person.FIRST_NAME), joins.getPerson().get(Person.LAST_NAME), joins.getFacility().get(Facility.UUID), joins.getFacility().get(Facility.LATITUDE), joins.getFacility().get(Facility.LONGITUDE), caze.get(Case.REPORT_LAT), caze.get(Case.REPORT_LON), joins.getPersonAddress().get(Location.LATITUDE), joins.getPersonAddress().get(Location.LONGITUDE), JurisdictionHelper.booleanSelector(cb, inJurisdictionOrOwned(caseQueryContext)));
result = em.createQuery(cq).getResultList();
} else {
result = Collections.emptyList();
}
return result;
}
use of de.symeda.sormas.api.caze.MapCaseDto in project SORMAS-Project by hzi-braunschweig.
the class CaseFacadeEjb method getCasesForMap.
@Override
public List<MapCaseDto> getCasesForMap(RegionReferenceDto regionRef, DistrictReferenceDto districtRef, Disease disease, Date from, Date to, NewCaseDateType dateType) {
Region region = regionService.getByReferenceDto(regionRef);
District district = districtService.getByReferenceDto(districtRef);
List<MapCaseDto> cases = service.getCasesForMap(region, district, disease, from, to, dateType);
Pseudonymizer pseudonymizer = Pseudonymizer.getDefault(userService::hasRight);
pseudonymizer.pseudonymizeDtoCollection(MapCaseDto.class, cases, c -> c.getInJurisdiction(), (c, isInJurisdiction) -> pseudonymizer.pseudonymizeDto(PersonReferenceDto.class, c.getPerson(), isInJurisdiction, null));
return cases;
}
Aggregations