use of de.symeda.sormas.api.Disease in project SORMAS-Project by hzi-braunschweig.
the class CaseEditFragment method updateCaseConfirmationVisibility.
private void updateCaseConfirmationVisibility(FragmentCaseEditLayoutBinding contentBinding) {
Disease disease = record.getDisease();
boolean extendedClassification = DiseaseConfigurationCache.getInstance().usesExtendedClassification(disease);
if (extendedClassification) {
boolean extendedClassificationMulti = DiseaseConfigurationCache.getInstance().usesExtendedClassificationMulti(disease);
if (extendedClassificationMulti) {
contentBinding.caseDataClinicalConfirmation.setVisibility(VISIBLE);
contentBinding.caseDataEpidemiologicalConfirmation.setVisibility(VISIBLE);
contentBinding.caseDataLaboratoryDiagnosticConfirmation.setVisibility(VISIBLE);
contentBinding.caseDataCaseConfirmationBasis.setVisibility(GONE);
} else {
contentBinding.caseDataClinicalConfirmation.setVisibility(GONE);
contentBinding.caseDataEpidemiologicalConfirmation.setVisibility(GONE);
contentBinding.caseDataLaboratoryDiagnosticConfirmation.setVisibility(GONE);
contentBinding.caseDataCaseConfirmationBasis.setVisibility(record.getCaseClassification() == CaseClassification.CONFIRMED ? VISIBLE : GONE);
}
} else {
contentBinding.caseDataClinicalConfirmation.setVisibility(GONE);
contentBinding.caseDataEpidemiologicalConfirmation.setVisibility(GONE);
contentBinding.caseDataLaboratoryDiagnosticConfirmation.setVisibility(GONE);
contentBinding.caseDataCaseConfirmationBasis.setVisibility(GONE);
}
}
use of de.symeda.sormas.api.Disease in project SORMAS-Project by hzi-braunschweig.
the class CaseNewFragment method onAfterLayoutBinding.
@Override
public void onAfterLayoutBinding(final FragmentCaseNewLayoutBinding contentBinding) {
InfrastructureDaoHelper.initializeHealthFacilityDetailsFieldVisibility(contentBinding.caseDataHealthFacility, contentBinding.caseDataHealthFacilityDetails);
InfrastructureDaoHelper.initializePointOfEntryDetailsFieldVisibility(contentBinding.caseDataPointOfEntry, contentBinding.caseDataPointOfEntryDetails);
if (!ConfigProvider.isConfiguredServer(CountryHelper.COUNTRY_CODE_GERMANY) && !ConfigProvider.isConfiguredServer(CountryHelper.COUNTRY_CODE_SWITZERLAND)) {
contentBinding.caseDataExternalID.setVisibility(GONE);
contentBinding.caseDataExternalToken.setVisibility(GONE);
} else {
contentBinding.caseDataEpidNumber.setVisibility(GONE);
}
contentBinding.caseDataResponsibleRegion.setEnabled(false);
contentBinding.caseDataResponsibleRegion.setRequired(false);
contentBinding.caseDataResponsibleDistrict.setEnabled(false);
contentBinding.caseDataResponsibleDistrict.setRequired(false);
User user = ConfigProvider.getUser();
if (user.getPointOfEntry() == null) {
contentBinding.facilityOrHome.setValue(TypeOfPlace.FACILITY);
}
if (user.hasUserRole(UserRole.HOSPITAL_INFORMANT) && user.getHealthFacility() != null) {
// Hospital Informants are not allowed to create cases in another health facility
contentBinding.caseDataCommunity.setEnabled(false);
contentBinding.caseDataCommunity.setRequired(false);
contentBinding.caseDataHealthFacility.setEnabled(false);
contentBinding.caseDataHealthFacility.setRequired(false);
contentBinding.facilityOrHome.setEnabled(false);
contentBinding.facilityTypeGroup.setEnabled(false);
contentBinding.caseDataFacilityType.setEnabled(false);
contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setEnabled(false);
contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setVisibility(GONE);
}
if (user.hasUserRole(UserRole.POE_INFORMANT) && user.getPointOfEntry() != null) {
contentBinding.caseDataPointOfEntry.setEnabled(false);
contentBinding.caseDataPointOfEntry.setRequired(false);
}
if (user.hasUserRole(UserRole.COMMUNITY_INFORMANT) && user.getCommunity() != null) {
// Community Informants are not allowed to create cases in another community
contentBinding.caseDataCommunity.setEnabled(false);
contentBinding.caseDataCommunity.setRequired(false);
}
// Disable personal details and disease fields when case is created from contact
// or event person
Bundler bundler = new Bundler(getArguments());
if (bundler.getContactUuid() != null || bundler.getEventParticipantUuid() != null) {
contentBinding.caseDataFirstName.setEnabled(false);
contentBinding.caseDataLastName.setEnabled(false);
contentBinding.personSex.setEnabled(false);
contentBinding.personBirthdateYYYY.setEnabled(false);
contentBinding.personBirthdateMM.setEnabled(false);
contentBinding.personBirthdateDD.setEnabled(false);
contentBinding.caseDataDisease.setEnabled(false);
contentBinding.caseDataDiseaseDetails.setEnabled(false);
contentBinding.caseDataPlagueType.setEnabled(false);
contentBinding.caseDataDengueFeverType.setEnabled(false);
contentBinding.caseDataHumanRabiesType.setEnabled(false);
}
// Set up port health visibilities
if (UserRole.isPortHealthUser(ConfigProvider.getUser().getUserRoles())) {
contentBinding.caseDataCaseOrigin.setVisibility(GONE);
contentBinding.caseDataDisease.setVisibility(GONE);
contentBinding.facilityOrHome.setVisibility(GONE);
contentBinding.caseDataCommunity.setVisibility(GONE);
contentBinding.facilityTypeFieldsLayout.setVisibility(GONE);
contentBinding.caseDataHealthFacility.setVisibility(GONE);
contentBinding.facilityTypeGroup.setRequired(false);
contentBinding.caseDataFacilityType.setRequired(false);
contentBinding.caseDataHealthFacility.setRequired(false);
contentBinding.caseDataHealthFacilityDetails.setRequired(false);
} else if (DatabaseHelper.getPointOfEntryDao().hasActiveEntriesInDistrict()) {
if (record.getCaseOrigin() == CaseOrigin.IN_COUNTRY) {
contentBinding.caseDataPointOfEntry.setRequired(false);
contentBinding.caseDataPointOfEntry.setVisibility(GONE);
} else {
contentBinding.caseDataHealthFacility.setRequired(false);
}
contentBinding.caseDataCaseOrigin.addValueChangedListener(e -> {
if (e.getValue() == CaseOrigin.IN_COUNTRY) {
contentBinding.caseDataPointOfEntry.setVisibility(GONE);
contentBinding.caseDataPointOfEntry.setRequired(false);
contentBinding.caseDataPointOfEntry.setValue(null);
contentBinding.caseDataHealthFacility.setRequired(true);
} else {
contentBinding.caseDataPointOfEntry.setVisibility(VISIBLE);
contentBinding.caseDataHealthFacility.setRequired(false);
contentBinding.caseDataPointOfEntry.setRequired(true);
}
});
} else {
contentBinding.caseDataCaseOrigin.setVisibility(GONE);
contentBinding.caseDataPointOfEntry.setVisibility(GONE);
}
}
use of de.symeda.sormas.api.Disease in project SORMAS-Project by hzi-braunschweig.
the class StartupShutdownService method createMissingDiseaseConfigurations.
private void createMissingDiseaseConfigurations() {
List<DiseaseConfiguration> diseaseConfigurations = diseaseConfigurationService.getAll();
List<Disease> configuredDiseases = diseaseConfigurations.stream().map(DiseaseConfiguration::getDisease).collect(Collectors.toList());
Arrays.stream(Disease.values()).filter(d -> !configuredDiseases.contains(d)).forEach(d -> {
DiseaseConfiguration configuration = DiseaseConfiguration.build(d);
diseaseConfigurationService.ensurePersisted(configuration);
});
}
use of de.symeda.sormas.api.Disease in project SORMAS-Project by hzi-braunschweig.
the class AggregateReportFacadeEjb method getIndexList.
@Override
public List<AggregatedCaseCountDto> getIndexList(AggregateReportCriteria criteria) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Object[]> cq = cb.createQuery(Object[].class);
Root<AggregateReport> root = cq.from(AggregateReport.class);
Predicate filter = service.createUserFilter(cb, cq, root);
if (criteria != null) {
Predicate criteriaFilter = service.createCriteriaFilter(criteria, cb, cq, root);
filter = CriteriaBuilderHelper.and(cb, filter, criteriaFilter);
}
if (filter != null) {
cq.where(filter);
}
cq.multiselect(root.get(AggregateReport.DISEASE), cb.sum(root.get(AggregateReport.NEW_CASES)), cb.sum(root.get(AggregateReport.LAB_CONFIRMATIONS)), cb.sum(root.get(AggregateReport.DEATHS)));
cq.groupBy(root.get(AggregateReport.DISEASE));
List<Object[]> resultList = em.createQuery(cq).getResultList();
Map<Disease, AggregatedCaseCountDto> reportSet = new HashMap<>();
for (Object[] result : resultList) {
reportSet.put((Disease) result[0], new AggregatedCaseCountDto((Disease) result[0], ((Long) result[1]).intValue(), ((Long) result[2]).intValue(), ((Long) result[3]).intValue()));
}
for (Disease disease : diseaseConfigurationFacade.getAllDiseases(true, false, false)) {
if (!reportSet.containsKey(disease)) {
reportSet.put(disease, new AggregatedCaseCountDto(disease, 0, 0, 0));
}
}
List<AggregatedCaseCountDto> reportList = new ArrayList<>(reportSet.values());
reportList.sort(Comparator.comparing(r -> r.getDisease().toString()));
return reportList;
}
use of de.symeda.sormas.api.Disease in project SORMAS-Project by hzi-braunschweig.
the class PathogenTestFacadeEjb method onPathogenTestChanged.
private void onPathogenTestChanged(PathogenTestDto existingPathogenTest, PathogenTest newPathogenTest) {
// Send an email to all responsible supervisors when a new non-pending sample test is created or the status of
// a formerly pending test result has changed
final String sampleUuid = newPathogenTest.getSample().getUuid();
final Sample sample = sampleService.getByUuid(sampleUuid);
final Case caze = sample.getAssociatedCase();
final Contact contact = sample.getAssociatedContact();
final EventParticipant eventParticipant = sample.getAssociatedEventParticipant();
Disease disease = null;
Set<NotificationType> notificationTypes = new HashSet<>();
List<Region> regions = new ArrayList<>();
if (caze != null) {
disease = caze.getDisease();
notificationTypes.add(NotificationType.CASE_LAB_RESULT_ARRIVED);
regions.addAll(JurisdictionHelper.getCaseRegions(caze));
}
if (contact != null) {
disease = contact.getDisease() != null ? contact.getDisease() : contact.getCaze().getDisease();
notificationTypes.add(NotificationType.CONTACT_LAB_RESULT_ARRIVED);
regions.addAll(JurisdictionHelper.getContactRegions(contact));
}
if (eventParticipant != null) {
disease = eventParticipant.getEvent().getDisease();
notificationTypes.add(NotificationType.EVENT_PARTICIPANT_LAB_RESULT_ARRIVED);
regions.add(eventParticipant.getEvent().getEventLocation().getRegion());
if (disease == null) {
sendMessageOnPathogenTestChanged(existingPathogenTest, newPathogenTest, null, notificationTypes, regions, MessageContents.CONTENT_LAB_RESULT_ARRIVED_EVENT_PARTICIPANT_NO_DISEASE, DataHelper.getShortUuid(eventParticipant.getUuid()));
}
}
if (disease != null) {
final String contentLabResultArrived = caze != null ? MessageContents.CONTENT_LAB_RESULT_ARRIVED : contact != null ? MessageContents.CONTENT_LAB_RESULT_ARRIVED_CONTACT : MessageContents.CONTENT_LAB_RESULT_ARRIVED_EVENT_PARTICIPANT;
final String shortUuid = DataHelper.getShortUuid(caze != null ? caze.getUuid() : contact != null ? contact.getUuid() : eventParticipant.getUuid());
sendMessageOnPathogenTestChanged(existingPathogenTest, newPathogenTest, disease, notificationTypes, regions, contentLabResultArrived, shortUuid);
}
}
Aggregations