From 8d143e1a0c855e123a0d85b2a0166463ffe67edd Mon Sep 17 00:00:00 2001 From: Levente Gal Date: Mon, 14 Oct 2024 13:00:40 +0300 Subject: [PATCH] #13156 Hide Case Classification for RSV and Automatically Set Default Values --- .../symeda/sormas/api/caze/CaseDataDto.java | 15 ++++++++++ .../sormas/backend/caze/CaseFacadeEjb.java | 16 +++++++--- .../symeda/sormas/ui/caze/CaseDataForm.java | 29 ++++++++++--------- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java b/sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java index 8500490afa3..1fbfea11ef4 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java @@ -283,16 +283,20 @@ public class CaseDataDto extends SormasToSormasShareableDto implements IsCase { COUNTRY_CODE_SWITZERLAND }) private Date districtLevelDate; @Outbreaks + @Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true) private CaseClassification caseClassification; @HideForCountriesExcept private CaseIdentificationSource caseIdentificationSource; @HideForCountriesExcept private ScreeningType screeningType; @Outbreaks + @Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true) private UserReferenceDto classificationUser; @Outbreaks + @Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true) private Date classificationDate; @Outbreaks + @Diseases(value = Disease.RESPIRATORY_SYNCYTIAL_VIRUS, hide = true) @SensitiveData @Size(max = FieldConstraints.CHARACTER_LIMIT_DEFAULT, message = Validations.textTooLong) private String classificationComment; @@ -567,21 +571,32 @@ public class CaseDataDto extends SormasToSormasShareableDto implements IsCase { private YesNoUnknown bloodOrganOrTissueDonated; @HideForCountriesExcept + @Diseases(value = { + Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true) private boolean notACaseReasonNegativeTest; @HideForCountriesExcept + @Diseases(value = { + Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true) private boolean notACaseReasonPhysicianInformation; @HideForCountriesExcept + @Diseases(value = { + Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true) private boolean notACaseReasonDifferentPathogen; @HideForCountriesExcept + @Diseases(value = { + Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true) private boolean notACaseReasonOther; @HideForCountriesExcept @SensitiveData + @Diseases(value = { + Disease.RESPIRATORY_SYNCYTIAL_VIRUS }, hide = true) @Size(max = FieldConstraints.CHARACTER_LIMIT_TEXT, message = Validations.textTooLong) private String notACaseReasonDetails; + private Date followUpStatusChangeDate; private UserReferenceDto followUpStatusChangeUser; diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java index a698d2c3ba4..9583ee83690 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java @@ -2066,7 +2066,8 @@ private void updateTasksOnCaseChanged(Case newCase, CaseDataDto existingCase) { @PermitAll public void onCaseSampleChanged(Case associatedCase) { // Update case classification if the feature is enabled - if (configFacade.getCaseClassificationCalculationMode(associatedCase.getDisease()).isAutomaticEnabled()) { + if (configFacade.getCaseClassificationCalculationMode(associatedCase.getDisease()).isAutomaticEnabled() + & associatedCase.getDisease() != Disease.RESPIRATORY_SYNCYTIAL_VIRUS) { if (associatedCase.getCaseClassification() != CaseClassification.NO_CASE) { Long pathogenTestsCount = pathogenTestService.countByCase(associatedCase); if (pathogenTestsCount == 0) { @@ -2200,8 +2201,14 @@ public void onCaseChanged(CaseDataDto existingCase, Case newCase, boolean syncSh service.updateFollowUpDetails(newCase, existingCase != null && newCase.getFollowUpStatus() != existingCase.getFollowUpStatus()); updateTasksOnCaseChanged(newCase, existingCase); - - handleClassificationOnCaseChange(existingCase, newCase); + if ((existingCase == null || existingCase.getDisease() != newCase.getDisease()) + && newCase.getDisease() == Disease.RESPIRATORY_SYNCYTIAL_VIRUS) { + newCase.setCaseClassification(CaseClassification.CONFIRMED); + newCase.setClassificationDate(newCase.getReportDate()); + newCase.setClassificationUser(newCase.getReportingUser()); + } else { + handleClassificationOnCaseChange(existingCase, newCase); + } // Set Yes/No/Unknown fields associated with embedded lists to Yes if the lists // are not empty @@ -2263,7 +2270,8 @@ private void handleClassificationOnCaseChange(CaseDataDto existingDto, Case save // Update case classification if the feature is enabled CaseClassification classification = null; boolean setClassificationInfo = true; - if (configFacade.getCaseClassificationCalculationMode(savedCase.getDisease()).isAutomaticEnabled()) { + if (configFacade.getCaseClassificationCalculationMode(savedCase.getDisease()).isAutomaticEnabled() + & savedCase.getDisease() != Disease.RESPIRATORY_SYNCYTIAL_VIRUS) { if (savedCase.getCaseClassification() != CaseClassification.NO_CASE || configFacade.isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)) { // calculate classification diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java index 5fc2d4a525b..b7d82324f84 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseDataForm.java @@ -523,19 +523,6 @@ protected void addFields() { caseClassificationGroup.removeItem(CaseClassification.CONFIRMED_UNKNOWN_SYMPTOMS); } - if (diseaseClassificationExists() && FacadeProvider.getConfigFacade().getCaseClassificationCalculationMode(disease).isManualEnabled()) { - Button caseClassificationCalculationButton = ButtonHelper.createButton(Captions.caseClassificationCalculationButton, e -> { - CaseClassification classification = FacadeProvider.getCaseClassificationFacade().getClassification(getValue()); - ((Field) getField(CaseDataDto.CASE_CLASSIFICATION)).setValue(classification); - }, ValoTheme.BUTTON_PRIMARY, FORCE_CAPTION); - - getContent().addComponent(caseClassificationCalculationButton, CASE_CLASSIFICATION_CALCULATE_BTN_LOC); - - if (!UiUtil.permitted(UserRight.CASE_CLASSIFY)) { - caseClassificationCalculationButton.setEnabled(false); - } - } - boolean extendedClassification = FacadeProvider.getDiseaseConfigurationFacade().usesExtendedClassification(disease); if (extendedClassification) { @@ -1033,6 +1020,22 @@ protected void addFields() { CaseDataDto.OUTCOME, CaseDataDto.DISEASE); setSoftRequired(true, CaseDataDto.INVESTIGATED_DATE, CaseDataDto.OUTCOME_DATE, CaseDataDto.PLAGUE_TYPE, CaseDataDto.SURVEILLANCE_OFFICER); + + if (diseaseClassificationExists() + && FacadeProvider.getConfigFacade().getCaseClassificationCalculationMode(disease).isManualEnabled() + && isVisibleAllowed(CaseDataDto.CASE_CLASSIFICATION)) { + Button caseClassificationCalculationButton = ButtonHelper.createButton(Captions.caseClassificationCalculationButton, e -> { + CaseClassification classification = FacadeProvider.getCaseClassificationFacade().getClassification(getValue()); + ((Field) getField(CaseDataDto.CASE_CLASSIFICATION)).setValue(classification); + }, ValoTheme.BUTTON_PRIMARY, FORCE_CAPTION); + + getContent().addComponent(caseClassificationCalculationButton, CASE_CLASSIFICATION_CALCULATE_BTN_LOC); + + if (!UiUtil.permitted(UserRight.CASE_CLASSIFY)) { + caseClassificationCalculationButton.setEnabled(false); + } + } + if (isEditableAllowed(CaseDataDto.INVESTIGATED_DATE)) { FieldHelper.setVisibleWhen( getFieldGroup(),