Skip to content

Commit 67bac4d

Browse files
authored
Merge pull request #13765 from SORMAS-Foundation/bugfix-13763-enable-the-pathogen-test-result-field
Bugfix 13763 enable the pathogen test result field
2 parents 6b728b2 + 63005de commit 67bac4d

File tree

5 files changed

+238
-197
lines changed

5 files changed

+238
-197
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/externalmessage/processing/ExternalMessageMapper.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ public List<String[]> mapToPathogenTest(TestReportDto sourceTestReport, Pathogen
342342
pathogenTest.getGenoTypeResult(),
343343
sourceTestReport.getGenoTypeResult(),
344344
PathogenTestDto.GENOTYPE_RESULT),
345+
Mapping.of(
346+
pathogenTest::setSeroGroupSpecification,
347+
pathogenTest.getSeroGroupSpecification(),
348+
sourceTestReport.getSeroGroupSpecification(),
349+
PathogenTestDto.SERO_GROUP_SPECIFICATION),
350+
Mapping.of(
351+
pathogenTest::setSeroGroupSpecificationText,
352+
pathogenTest.getSeroGroupSpecificationText(),
353+
sourceTestReport.getSeroGroupSpecificationText(),
354+
PathogenTestDto.SERO_GROUP_SPECIFICATION),
345355
Mapping.of(
346356
pathogenTest::setRsvSubtype,
347357
pathogenTest.getRsvSubtype(),

sormas-api/src/main/java/de/symeda/sormas/api/symptoms/SymptomsDto.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,8 +2524,6 @@ public static SymptomsDto build() {
25242524
CRYPTOSPORIDIOSIS,
25252525
UNDEFINED,
25262526
OTHER })
2527-
@HideForCountriesExcept(countries = {
2528-
CountryHelper.COUNTRY_CODE_SWITZERLAND })
25292527
@SymptomGrouping(SymptomGroup.GENERAL)
25302528
private SymptomState fatigue;
25312529
@Diseases({

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestController.java

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
import java.util.function.Consumer;
2929
import java.util.stream.Collectors;
3030

31-
import de.symeda.sormas.api.DiseaseHelper;
32-
import de.symeda.sormas.api.event.EventReferenceDto;
33-
import de.symeda.sormas.api.sample.PathogenTestType;
3431
import org.apache.commons.collections4.CollectionUtils;
3532

3633
import com.vaadin.ui.Label;
@@ -40,6 +37,7 @@
4037

4138
import de.symeda.sormas.api.CountryHelper;
4239
import de.symeda.sormas.api.Disease;
40+
import de.symeda.sormas.api.DiseaseHelper;
4341
import de.symeda.sormas.api.FacadeProvider;
4442
import de.symeda.sormas.api.caze.CaseClassification;
4543
import de.symeda.sormas.api.caze.CaseDataDto;
@@ -54,13 +52,15 @@
5452
import de.symeda.sormas.api.event.EventDto;
5553
import de.symeda.sormas.api.event.EventParticipantDto;
5654
import de.symeda.sormas.api.event.EventParticipantReferenceDto;
55+
import de.symeda.sormas.api.event.EventReferenceDto;
5756
import de.symeda.sormas.api.feature.FeatureType;
5857
import de.symeda.sormas.api.i18n.Captions;
5958
import de.symeda.sormas.api.i18n.I18nProperties;
6059
import de.symeda.sormas.api.i18n.Strings;
6160
import de.symeda.sormas.api.sample.PathogenTestDto;
6261
import de.symeda.sormas.api.sample.PathogenTestFacade;
6362
import de.symeda.sormas.api.sample.PathogenTestResultType;
63+
import de.symeda.sormas.api.sample.PathogenTestType;
6464
import de.symeda.sormas.api.sample.SampleDto;
6565
import de.symeda.sormas.api.sample.SampleReferenceDto;
6666
import de.symeda.sormas.api.user.UserRight;
@@ -127,7 +127,8 @@ public CommitDiscardWrapperComponent<PathogenTestForm> getPathogenTestCreateComp
127127
associatedEventOrCaseOrContactDisease = caseDataDto.getDisease();
128128
}
129129
if (associatedEventOrCaseOrContactDisease == null && sampleDto.getAssociatedEventParticipant() != null) {
130-
EventParticipantDto eventParticipant = FacadeProvider.getEventParticipantFacade().getEventParticipantByUuid(sampleDto.getAssociatedEventParticipant().getUuid());
130+
EventParticipantDto eventParticipant =
131+
FacadeProvider.getEventParticipantFacade().getEventParticipantByUuid(sampleDto.getAssociatedEventParticipant().getUuid());
131132
EventReferenceDto eventDto = eventParticipant.getEvent();
132133
EventDto participantEvent = FacadeProvider.getEventFacade().getEventByUuid(eventDto.getUuid(), false);
133134
associatedEventOrCaseOrContactDisease = participantEvent.getDisease();
@@ -211,11 +212,22 @@ public CommitDiscardWrapperComponent<PathogenTestForm> getPathogenTestEditCompon
211212
final PathogenTestForm form;
212213
if (forHumanSample) {
213214
SampleDto sample = FacadeProvider.getSampleFacade().getSampleByUuid(pathogenTest.getSample().getUuid());
214-
form = new PathogenTestForm(sample, false, 0, pathogenTest.isPseudonymized(), pathogenTest.isInJurisdiction(), pathogenTest.getTestedDisease());
215+
form = new PathogenTestForm(
216+
sample,
217+
false,
218+
0,
219+
pathogenTest.isPseudonymized(),
220+
pathogenTest.isInJurisdiction(),
221+
pathogenTest.getTestedDisease());
215222
} else {
216223
EnvironmentSampleDto environmentSample =
217224
FacadeProvider.getEnvironmentSampleFacade().getByUuid(pathogenTest.getEnvironmentSample().getUuid());
218-
form = new PathogenTestForm(environmentSample, false, pathogenTest.isPseudonymized(), pathogenTest.isInJurisdiction(), pathogenTest.getTestedDisease());
225+
form = new PathogenTestForm(
226+
environmentSample,
227+
false,
228+
pathogenTest.isPseudonymized(),
229+
pathogenTest.isInJurisdiction(),
230+
pathogenTest.getTestedDisease());
219231
}
220232

221233
form.setValue(pathogenTest);
@@ -274,7 +286,7 @@ public static void showCaseUpdateWithNewDiseaseVariantDialog(
274286
existingCaseDto.getDiseaseVariant() == null
275287
? "[" + I18nProperties.getCaption(Captions.caseNoDiseaseVariant) + "]"
276288
: existingCaseDto.getDiseaseVariant().toString(),
277-
diseaseVariant.toString())),
289+
diseaseVariant != null ? diseaseVariant.toString() : "[" + I18nProperties.getCaption(Captions.caseNoDiseaseVariant) + "]")),
278290
I18nProperties.getString(Strings.yes),
279291
I18nProperties.getString(Strings.no),
280292
800,
@@ -317,10 +329,11 @@ public void savePathogenTests(List<PathogenTestDto> pathogenTests, SampleReferen
317329

318330
pathogenTests.forEach(p -> {
319331
p.setSample(sampleRef);
320-
boolean luxTB = FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG) && Disease.TUBERCULOSIS == p.getTestedDisease();
332+
boolean luxTB = FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)
333+
&& Disease.TUBERCULOSIS == p.getTestedDisease();
321334
boolean invasiveDisease = DiseaseHelper.checkDiseaseIsInvasiveBacterialDiseases(p.getTestedDisease());
322335
//the susceptibility test is applicable only for LUX TB and all-countries invasive disease
323-
if(PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY == p.getTestType() && !luxTB && !invasiveDisease) {
336+
if (PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY == p.getTestType() && !luxTB && !invasiveDisease) {
324337
p.setDrugSusceptibility(null);
325338
}
326339
facade.savePathogenTest(p);
@@ -367,14 +380,21 @@ private void handleAssociatedCase(List<PathogenTestDto> pathogenTests, CaseRefer
367380
.filter(t -> t.getTestResult() == PathogenTestResultType.NEGATIVE && t.getTestResultVerified())
368381
.findFirst();
369382

383+
PathogenTestDto resultedPathogenTest;
370384
if (positiveWithSameDisease.isPresent()) {
371-
showChangeAssociatedSampleResultDialog(positiveWithSameDisease.get(), (accepted) -> {
385+
resultedPathogenTest = positiveWithSameDisease.get();
386+
} else if (negativeWithSameDisease.isPresent()) {
387+
resultedPathogenTest = negativeWithSameDisease.get();
388+
} else {
389+
resultedPathogenTest = null;
390+
}
391+
392+
if (resultedPathogenTest != null) {
393+
showChangeAssociatedSampleResultDialog(resultedPathogenTest, (accepted) -> {
372394
if (accepted) {
373-
checkForDiseaseVariantUpdate(positiveWithSameDisease.get(), caze, suppressNavigateToCase, this::showConfirmCaseDialog);
395+
checkForDiseaseVariantUpdate(resultedPathogenTest, caze, suppressNavigateToCase, this::showConfirmCaseDialog);
374396
}
375397
});
376-
} else if (negativeWithSameDisease.isPresent()) {
377-
showChangeAssociatedSampleResultDialog(negativeWithSameDisease.get(), null);
378398
}
379399

380400
testsByDisease.keySet().stream().filter(disease -> disease != caze.getDisease()).forEach((disease) -> {
@@ -532,9 +552,7 @@ private void checkForDiseaseVariantUpdate(
532552
CaseDataDto caze,
533553
boolean suppressNavigateToCase,
534554
Consumer<CaseDataDto> callback) {
535-
if (test.getTestedDiseaseVariant() != null
536-
&& !DataHelper.equal(test.getTestedDiseaseVariant(), caze.getDiseaseVariant())
537-
&& isNotYetRelatedDiseaseVariant(test)) {
555+
if (!DataHelper.equal(test.getTestedDiseaseVariant(), caze.getDiseaseVariant()) && isNotYetRelatedDiseaseVariant(test)) {
538556
showCaseUpdateWithNewDiseaseVariantDialog(caze, test.getTestedDiseaseVariant(), test.getTestedDiseaseVariantDetails(), yes -> {
539557
if (yes && !suppressNavigateToCase) {
540558
ControllerProvider.getCaseController().navigateToCase(caze.getUuid());

0 commit comments

Comments
 (0)