Skip to content

Commit 75e5985

Browse files
Merge pull request #13594 from SORMAS-Foundation/bugfix-13507-imi-case-classification-issue
Bugfix 13507 imi case classification issue
2 parents 7e8bd31 + 4b55b04 commit 75e5985

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseFacadeEjb.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2204,6 +2204,26 @@ public void onCaseChanged(CaseDataDto existingCase, Case newCase, boolean syncSh
22042204
}
22052205
}
22062206

2207+
if (existingCase != null && newCase.getEpiData() != null) {
2208+
// If contact with source case is known and at least one source case (same disease) is confirmed, set YES.
2209+
final YesNoUnknown contactKnown = newCase.getEpiData().getContactWithSourceCaseKnown();
2210+
if (contactKnown == YesNoUnknown.YES) {
2211+
// Check if at least one source case is confirmed
2212+
// We only check for contacts that have this case as resulting case
2213+
final boolean hasConfirmedSourceCase = contactService.getAllByResultingCase(caseService.getByUuid(existingCase.getUuid())).stream()
2214+
.map(Contact::getCaze)
2215+
.filter(Objects::nonNull)
2216+
.anyMatch(src ->
2217+
src.getDisease() == newCase.getDisease()
2218+
&& CaseClassification.getConfirmedClassifications().contains(src.getCaseClassification()));
2219+
newCase.setEpidemiologicalConfirmation(hasConfirmedSourceCase ? YesNoUnknown.YES : YesNoUnknown.NO);
2220+
} else if (contactKnown == YesNoUnknown.NO) {
2221+
newCase.setEpidemiologicalConfirmation(YesNoUnknown.NO);
2222+
} else {
2223+
newCase.setEpidemiologicalConfirmation(YesNoUnknown.UNKNOWN);
2224+
}
2225+
}
2226+
22072227
// Update follow-up
22082228
service.updateFollowUpDetails(newCase, existingCase != null && newCase.getFollowUpStatus() != existingCase.getFollowUpStatus());
22092229

sormas-ui/src/main/java/de/symeda/sormas/ui/contact/SourceContactListComponent.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.vaadin.ui.VerticalLayout;
2626
import com.vaadin.ui.themes.ValoTheme;
2727

28+
import de.symeda.sormas.api.FacadeProvider;
2829
import de.symeda.sormas.api.ReferenceDto;
2930
import de.symeda.sormas.api.caze.CaseReferenceDto;
3031
import de.symeda.sormas.api.contact.ContactReferenceDto;
@@ -76,7 +77,12 @@ private void createSourceContactListComponent(SourceContactList sourceContactLis
7677
Button createButton = ButtonHelper.createIconButton(
7778
Captions.contactNewContact,
7879
VaadinIcons.PLUS_CIRCLE,
79-
e -> view.showUnsavedChangesPopup(() -> ControllerProvider.getContactController().create(caseReference, true, SormasUI::refreshView)),
80+
e -> view.showUnsavedChangesPopup(() -> ControllerProvider.getContactController().create(caseReference, true, () -> {
81+
// For case classification effectiveness, extra save is needed.
82+
// Ideally, we should mark the epi case data form as dirty when a contact is created, but we couldn't find a way to do that.
83+
FacadeProvider.getCaseFacade().save(FacadeProvider.getCaseFacade().getByUuid(caseReference.getUuid()));
84+
SormasUI.refreshView();
85+
})),
8086
ValoTheme.BUTTON_PRIMARY);
8187
componentHeader.addComponent(createButton);
8288
componentHeader.setComponentAlignment(createButton, Alignment.MIDDLE_RIGHT);

0 commit comments

Comments
 (0)