Skip to content

Commit 63005de

Browse files
committed
Fixed IMI serogroup not being set from externalmessage
- also added the DrugSusceptibilityForm changes
1 parent e474eac commit 63005de

3 files changed

Lines changed: 54 additions & 16 deletions

File tree

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-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestForm.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,10 @@ public class PathogenTestForm extends AbstractEditForm<PathogenTestDto> {
238238
private ComboBox specieField;
239239
private ComboBox genoTypingCB;
240240
private TextField genoTypingResultTextTF;
241-
// List of tests that are used for serogrouping
241+
242+
private ComboBox seroGrpSepcCB;
243+
private TextField seroGrpSpecTxt;
244+
242245

243246
public PathogenTestForm(
244247
AbstractSampleForm sampleForm,
@@ -399,11 +402,21 @@ public void setValue(PathogenTestDto newFieldValue) throws ReadOnlyException, Co
399402
specieField.setValue(newFieldValue.getSpecie());
400403
if (!genoTypingCB.isReadOnly()) {
401404
genoTypingCB.setValue(newFieldValue.getGenoTypeResult());
402-
// We only set the genotyping result text if the genotyping result is not read only
403-
if (!genoTypingResultTextTF.isReadOnly()) {
404-
genoTypingResultTextTF.setValue(newFieldValue.getGenoTypeResultText());
405-
}
405+
406+
}
407+
408+
if (!genoTypingResultTextTF.isReadOnly()) {
409+
genoTypingResultTextTF.setValue(newFieldValue.getGenoTypeResultText());
406410
}
411+
412+
if (!seroGrpSepcCB.isReadOnly()) {
413+
seroGrpSepcCB.setValue(newFieldValue.getSeroGroupSpecification());
414+
}
415+
416+
if (!seroGrpSpecTxt.isReadOnly()) {
417+
seroGrpSpecTxt.setValue(newFieldValue.getSeroGroupSpecificationText());
418+
}
419+
407420
drugSusceptibilityField.forceUpdateDrugSusceptibilityFields();
408421
markAsDirty();
409422
}
@@ -582,9 +595,10 @@ protected void addFields() {
582595

583596
ComboBox seroTypeMetCB = addField(PathogenTestDto.SEROTYPING_METHOD, ComboBox.class);
584597
seroTypeMetCB.setVisible(false);
585-
ComboBox seroGrpSepcCB = addField(PathogenTestDto.SERO_GROUP_SPECIFICATION, ComboBox.class);
598+
seroGrpSepcCB = addField(PathogenTestDto.SERO_GROUP_SPECIFICATION, ComboBox.class);
586599
seroGrpSepcCB.setVisible(false);
587-
TextField seroGrpSpecTxt = addField(PathogenTestDto.SERO_GROUP_SPECIFICATION_TEXT, TextField.class);
600+
seroGrpSpecTxt = addField(PathogenTestDto.SERO_GROUP_SPECIFICATION_TEXT, TextField.class);
601+
588602
TextField cqValueField = addField(FieldConfiguration.withConversionError(PathogenTestDto.CQ_VALUE, Validations.onlyNumbersAllowed));
589603
if (!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)) {
590604
cqValueField.setVisible(false);

sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,34 @@ public void updateFieldsVisibility(Disease disease, PathogenTestType pathogenTes
301301
FieldHelper.hideFieldsNotInList(getFieldGroup(), List.of(), true);
302302
formHeadingLabel.setVisible(false);
303303

304-
// Drug susceptibility fields are hidden for other countries than Luxembourg
305-
if(!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)) {
304+
// we hide if we don't have a disease
305+
if (disease == null) {
306306
return;
307307
}
308308

309-
if (disease != null && pathogenTestType != null) {
310-
List<String> applicableFieldIds =
311-
AnnotationFieldHelper.getFieldNamesWithMatchingDiseaseAndTestAnnotations(DrugSusceptibilityDto.class, disease, pathogenTestType);
309+
// we hide if we have another test type than antibiotic susceptibility
310+
if (pathogenTestType != PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY) {
311+
return;
312+
}
313+
314+
// we have a disease and a ANTIBIOTIC_SUSCEPTIBILITY test type, so we can proceed
315+
316+
// TODO: this is kind of temporary as it should be consolidated with the logic in the PathogenTestForm
317+
// For other countries if the disease is Tuberculosis/Latent Tuberculosis, drug susceptibility fields should remain hidden
318+
if (!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)
319+
&& (disease == Disease.TUBERCULOSIS || disease == Disease.LATENT_TUBERCULOSIS)) {
320+
//quit, we do not want to show the fields if TUBERCULOSIS/LATENT_TUBERCULOSIS and we are not in Luxembourg
321+
return;
322+
}
323+
324+
// if we passed the exclusions, we show or hide the fields based on annotations
325+
List<String> applicableFieldIds =
326+
AnnotationFieldHelper.getFieldNamesWithMatchingDiseaseAndTestAnnotations(DrugSusceptibilityDto.class, disease, pathogenTestType);
312327

313-
formHeadingLabel.setVisible(!applicableFieldIds.isEmpty());
328+
formHeadingLabel.setVisible(!applicableFieldIds.isEmpty());
314329

315-
if (!applicableFieldIds.isEmpty()) {
316-
FieldHelper.showOnlyFields(getFieldGroup(), applicableFieldIds, true);
317-
}
330+
if (!applicableFieldIds.isEmpty()) {
331+
FieldHelper.showOnlyFields(getFieldGroup(), applicableFieldIds, true);
318332
}
319333
}
320334
}

0 commit comments

Comments
 (0)