From d79fbfa4b4f06ce516231f9dcec2b2af392210d6 Mon Sep 17 00:00:00 2001 From: Marin Date: Tue, 3 Dec 2024 07:49:35 +0200 Subject: [PATCH 1/3] Automate Case Details and Fields Preselection for Influenza Cases #13184 --- .../src/main/java/de/symeda/sormas/api/caze/CaseDataDto.java | 2 +- .../src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 aae97fc38d0..a6b0089068d 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 @@ -638,7 +638,7 @@ public static CaseDataDto build(PersonReferenceDto person, Disease disease, Heal caze.setPortHealthInfo(PortHealthInfoDto.build()); caze.setDisease(disease); caze.setInvestigationStatus(InvestigationStatus.PENDING); - caze.setCaseClassification(CaseClassification.NOT_CLASSIFIED); + caze.setCaseClassification(CaseClassification.CONFIRMED); caze.setOutcome(CaseOutcome.NO_OUTCOME); caze.setCaseOrigin(CaseOrigin.IN_COUNTRY); // TODO This is a workaround for transferring the followup comment while converting a contact to a case. This can be removed if the followup for cases is implemented in the mobile app diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java index 5554342567e..2b8e7811857 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java @@ -282,6 +282,7 @@ protected void addFields() { facilityOrHome.setId("facilityOrHome"); facilityOrHome.setWidth(100, Unit.PERCENTAGE); CssStyles.style(facilityOrHome, ValoTheme.OPTIONGROUP_HORIZONTAL); + facilityOrHome.setValue(Sets.newHashSet(TypeOfPlace.HOME)); facilityTypeGroup = ComboBoxHelper.createComboBoxV7(); facilityTypeGroup.setId("typeGroup"); facilityTypeGroup.setCaption(I18nProperties.getCaption(Captions.Facility_typeGroup)); @@ -550,6 +551,7 @@ private void setNoneFacility() { FacilityReferenceDto noFacilityRef = FacadeProvider.getFacilityFacade().getByUuid(FacilityDto.NONE_FACILITY_UUID).toReference(); facilityCombo.addItem(noFacilityRef); facilityCombo.setValue(noFacilityRef); + facilityType.setRequired(false); } private void updateFacility() { From 0bb1fc5c264e56f07d49aa481dac57e855d7ecf4 Mon Sep 17 00:00:00 2001 From: Marin Date: Tue, 10 Dec 2024 11:50:53 +0200 Subject: [PATCH 2/3] Automate Case Details and Fields Preselection for Influenza Cases #13184 - after review comments --- .../java/de/symeda/sormas/api/caze/CaseDataDto.java | 2 +- .../de/symeda/sormas/ui/caze/CaseCreateForm.java | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 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 a6b0089068d..aae97fc38d0 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 @@ -638,7 +638,7 @@ public static CaseDataDto build(PersonReferenceDto person, Disease disease, Heal caze.setPortHealthInfo(PortHealthInfoDto.build()); caze.setDisease(disease); caze.setInvestigationStatus(InvestigationStatus.PENDING); - caze.setCaseClassification(CaseClassification.CONFIRMED); + caze.setCaseClassification(CaseClassification.NOT_CLASSIFIED); caze.setOutcome(CaseOutcome.NO_OUTCOME); caze.setCaseOrigin(CaseOrigin.IN_COUNTRY); // TODO This is a workaround for transferring the followup comment while converting a contact to a case. This can be removed if the followup for cases is implemented in the mobile app diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java index 2b8e7811857..bdc58dbb03d 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java @@ -30,7 +30,9 @@ import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Objects; +import de.symeda.sormas.api.caze.CaseClassification; import org.apache.commons.collections4.CollectionUtils; import com.google.common.collect.Sets; @@ -282,7 +284,6 @@ protected void addFields() { facilityOrHome.setId("facilityOrHome"); facilityOrHome.setWidth(100, Unit.PERCENTAGE); CssStyles.style(facilityOrHome, ValoTheme.OPTIONGROUP_HORIZONTAL); - facilityOrHome.setValue(Sets.newHashSet(TypeOfPlace.HOME)); facilityTypeGroup = ComboBoxHelper.createComboBoxV7(); facilityTypeGroup.setId("typeGroup"); facilityTypeGroup.setCaption(I18nProperties.getCaption(Captions.Facility_typeGroup)); @@ -545,13 +546,21 @@ private void updateDiseaseVariant(Disease disease) { FieldHelper.updateItems(diseaseVariantField, diseaseVariants); diseaseVariantField .setVisible(disease != null && isVisibleAllowed(CaseDataDto.DISEASE_VARIANT) && CollectionUtils.isNotEmpty(diseaseVariants)); + if (Objects.nonNull(disease) && (Disease.INFLUENZA.compareTo(disease) == 0)) { + facilityOrHome.setValue(Sets.newHashSet(TypeOfPlace.HOME)); + facilityOrHome.select(TypeOfPlace.HOME); + getValue().setCaseClassification(CaseClassification.CONFIRMED); + } else { + facilityOrHome.setValue(null); + facilityOrHome.unselect(TypeOfPlace.HOME); + getValue().setCaseClassification(CaseClassification.NOT_CLASSIFIED); + } } private void setNoneFacility() { FacilityReferenceDto noFacilityRef = FacadeProvider.getFacilityFacade().getByUuid(FacilityDto.NONE_FACILITY_UUID).toReference(); facilityCombo.addItem(noFacilityRef); facilityCombo.setValue(noFacilityRef); - facilityType.setRequired(false); } private void updateFacility() { From 206e1ead71f5fd137f1c5a0c4309918070c79e95 Mon Sep 17 00:00:00 2001 From: Marin Date: Tue, 10 Dec 2024 14:58:48 +0200 Subject: [PATCH 3/3] Automate Case Details and Fields Preselection for Influenza Cases #13184 - after review comments. Simplified 1 if statement. --- .../src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java index bdc58dbb03d..6f26274534c 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/caze/CaseCreateForm.java @@ -30,7 +30,6 @@ import java.util.Collections; import java.util.Date; import java.util.List; -import java.util.Objects; import de.symeda.sormas.api.caze.CaseClassification; import org.apache.commons.collections4.CollectionUtils; @@ -546,7 +545,7 @@ private void updateDiseaseVariant(Disease disease) { FieldHelper.updateItems(diseaseVariantField, diseaseVariants); diseaseVariantField .setVisible(disease != null && isVisibleAllowed(CaseDataDto.DISEASE_VARIANT) && CollectionUtils.isNotEmpty(diseaseVariants)); - if (Objects.nonNull(disease) && (Disease.INFLUENZA.compareTo(disease) == 0)) { + if (disease == Disease.INFLUENZA) { facilityOrHome.setValue(Sets.newHashSet(TypeOfPlace.HOME)); facilityOrHome.select(TypeOfPlace.HOME); getValue().setCaseClassification(CaseClassification.CONFIRMED);