Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Map;
import java.util.function.Consumer;

import de.symeda.sormas.api.DiseaseHelper;
import org.apache.commons.collections4.CollectionUtils;

import com.vaadin.ui.Label;
Expand Down Expand Up @@ -206,7 +207,7 @@ private static void setCqValueVisibility(TextField cqValueField, PathogenTestTyp
}

private void updateTuberculosisFieldSpecifications(PathogenTestType testType, Disease disease) {
if ((FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG))) {
if ((FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG))|| DiseaseHelper.checkDiseaseIsInvasiveBacterialDiseases((Disease)diseaseField.getValue())) {
boolean wasReadOnly = testResultField.isReadOnly();

if (disease == Disease.TUBERCULOSIS && testType != null) {
Expand Down Expand Up @@ -452,15 +453,6 @@ protected void addFields() {
FieldHelper.setVisibleWhen(getFieldGroup(), PathogenTestDto.PATTERN_PROFILE, tuberculosisMiruCodeDependencies, true);
//FieldHelper.setRequiredWhen(getFieldGroup(), PathogenTestDto.PATTERN_PROFILE, tuberculosisMiruCodeDependencies);

//tuberculosis-antibiotic test specification
Map<Object, List<Object>> tuberculosisAntibioticDependencies = new HashMap<>() {

{
put(PathogenTestDto.TESTED_DISEASE, Arrays.asList(Disease.TUBERCULOSIS, Disease.INVASIVE_MENINGOCOCCAL_INFECTION, Disease.INVASIVE_PNEUMOCOCCAL_INFECTION));
put(PathogenTestDto.TEST_TYPE, Arrays.asList(PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY));
}
};
FieldHelper.setVisibleWhen(getFieldGroup(), PathogenTestDto.DRUG_SUSCEPTIBILITY, tuberculosisAntibioticDependencies, true);

//test result - read only
Map<Object, List<Object>> tuberculosisTestResultReadOnlyDependencies = new HashMap<>() {
Expand All @@ -479,6 +471,17 @@ protected void addFields() {
FieldHelper.setReadOnlyWhen(getFieldGroup(), PathogenTestDto.TEST_RESULT, tuberculosisTestResultReadOnlyDependencies, true, false);
}

//tuberculosis-antibiotic test specification
// Same applies for Invasive diseases as well, for all the countries.
Map<Object, List<Object>> tuberculosisAntibioticDependencies = new HashMap<>() {

{
put(PathogenTestDto.TESTED_DISEASE, Arrays.asList(Disease.TUBERCULOSIS, Disease.INVASIVE_MENINGOCOCCAL_INFECTION, Disease.INVASIVE_PNEUMOCOCCAL_INFECTION));
put(PathogenTestDto.TEST_TYPE, Arrays.asList(PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY));
}
};
FieldHelper.setVisibleWhen(getFieldGroup(), PathogenTestDto.DRUG_SUSCEPTIBILITY, tuberculosisAntibioticDependencies, true);

seroTypeTF.setVisible(false);
ComboBox seroTypeMetCB = addField(PathogenTestDto.SEROTYPING_METHOD, ComboBox.class);
seroTypeMetCB.setVisible(false);
Expand Down Expand Up @@ -670,7 +673,7 @@ protected void addFields() {
testResultField.setEnabled(true);
}

if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)) {
if (FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG) || DiseaseHelper.checkDiseaseIsInvasiveBacterialDiseases((Disease)diseaseField.getValue())) {
updateTuberculosisFieldSpecifications(testType, (Disease) diseaseField.getValue());
// If disease is IMI or IPI and test type is antibiotic susceptibility, then test result is set to positive
if ((diseaseField.getValue() == Disease.INVASIVE_PNEUMOCOCCAL_INFECTION || diseaseField.getValue() == Disease.INVASIVE_MENINGOCOCCAL_INFECTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ protected String createHtmlLayout() {

@Override
protected void addFields() {
if ((FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG))) {
boolean isLUXConfigured = FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG);
CheckBox dotField = addField(TherapyDto.DIRECTLY_OBSERVED_TREATMENT, CheckBox.class);
dotField.addStyleName(VSPACE_3);
dotField.setVisible(disease == Disease.TUBERCULOSIS);
dotField.setVisible(isLUXConfigured && disease == Disease.TUBERCULOSIS);

CheckBox mdrXdrTuberculosisField = addField(TherapyDto.MDR_XDR_TUBERCULOSIS, CheckBox.class);
mdrXdrTuberculosisField.addStyleName(VSPACE_3);
mdrXdrTuberculosisField.setVisible(disease == Disease.TUBERCULOSIS);
mdrXdrTuberculosisField.setVisible(isLUXConfigured && disease == Disease.TUBERCULOSIS);
mdrXdrTuberculosisField.addValueChangeListener(e -> {
if (drugSusceptibilityResultPanel != null) {
drugSusceptibilityResultPanel.setVisible((Boolean) e.getProperty().getValue());
Expand All @@ -159,7 +159,7 @@ protected void addFields() {

CheckBox beijingLineageField = addField(TherapyDto.BEIJING_LINEAGE, CheckBox.class);
beijingLineageField.addStyleName(VSPACE_3);
beijingLineageField.setVisible(disease == Disease.TUBERCULOSIS);
beijingLineageField.setVisible(isLUXConfigured && disease == Disease.TUBERCULOSIS);

List<SampleDto> samples = FacadeProvider.getSampleFacade().getByCaseUuids(Collections.singletonList(caze.getUuid()));
List<String> sampleUuids = Collections.emptyList();
Expand All @@ -182,7 +182,6 @@ protected void addFields() {
drugSusceptibilityResultPanel.setVisible(disease != Disease.TUBERCULOSIS);
getContent().addComponent(drugSusceptibilityResultPanel, DRUD_SUSCEPTIBILITY_LOC);
drugSusceptibilityResultPanel.addStyleNames(VSPACE_TOP_4, VSPACE_3);
}

//prescription
CustomLayout prescriptionsLayout = new CustomLayout();
Expand Down
Loading