Skip to content
Merged
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 @@ -68,7 +68,6 @@ public class DrugSusceptibilityDto extends PseudonymizableDto {
public static final String ERYTHROMYCIN_MIC = "erythromycinMic";
public static final String ERYTHROMYCIN_SUSCEPTIBILITY = "erythromycinSusceptibility";


@Diseases(value = {
Disease.TUBERCULOSIS })
@ApplicableToPathogenTests(value = {
Expand Down Expand Up @@ -100,12 +99,14 @@ public class DrugSusceptibilityDto extends PseudonymizableDto {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType capreomycinSusceptibility;
@Diseases(value = {
Disease.TUBERCULOSIS, Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
Disease.TUBERCULOSIS,
Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private Float ciprofloxacinMic;
@Diseases(value = {
Disease.TUBERCULOSIS, Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
Disease.TUBERCULOSIS,
Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType ciprofloxacinSusceptibility;
Expand Down Expand Up @@ -142,14 +143,12 @@ public class DrugSusceptibilityDto extends PseudonymizableDto {
@Diseases(value = {
Disease.TUBERCULOSIS })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY,
PathogenTestType.PCR_RT_PCR })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private Float isoniazidMic;
@Diseases(value = {
Disease.TUBERCULOSIS })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY,
PathogenTestType.PCR_RT_PCR })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType isoniazidSusceptibility;
@Diseases(value = {
Disease.TUBERCULOSIS })
Expand Down Expand Up @@ -192,16 +191,16 @@ public class DrugSusceptibilityDto extends PseudonymizableDto {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType ofloxacinSusceptibility;
@Diseases(value = {
Disease.TUBERCULOSIS, Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
Disease.TUBERCULOSIS,
Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY,
PathogenTestType.PCR_RT_PCR })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private Float rifampicinMic;
@Diseases(value = {
Disease.TUBERCULOSIS, Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
Disease.TUBERCULOSIS,
Disease.INVASIVE_MENINGOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY,
PathogenTestType.PCR_RT_PCR })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType rifampicinSusceptibility;
@Diseases(value = {
Disease.TUBERCULOSIS })
Expand All @@ -215,36 +214,40 @@ public class DrugSusceptibilityDto extends PseudonymizableDto {
private DrugSusceptibilityType streptomycinSusceptibility;

@Diseases(value = {
Disease.INVASIVE_MENINGOCOCCAL_INFECTION, Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
Disease.INVASIVE_MENINGOCOCCAL_INFECTION,
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private Float ceftriaxoneMic;
@Diseases(value = {
Disease.INVASIVE_MENINGOCOCCAL_INFECTION, Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
Disease.INVASIVE_MENINGOCOCCAL_INFECTION,
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType ceftriaxoneSusceptibility;

@Diseases(value = {
Disease.INVASIVE_MENINGOCOCCAL_INFECTION, Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
Disease.INVASIVE_MENINGOCOCCAL_INFECTION,
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private Float penicillinMic;
@Diseases(value = {
Disease.INVASIVE_MENINGOCOCCAL_INFECTION, Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
Disease.INVASIVE_MENINGOCOCCAL_INFECTION,
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType penicillinSusceptibility;

@Diseases(value = {
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private Float erythromycinMic;
@Diseases(value = {
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
Disease.INVASIVE_PNEUMOCOCCAL_INFECTION })
@ApplicableToPathogenTests(value = {
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY })
private DrugSusceptibilityType erythromycinSusceptibility;

public static DrugSusceptibilityDto build() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@
import de.symeda.sormas.api.i18n.Descriptions;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.i18n.Strings;
import de.symeda.sormas.api.user.UserRight;
import de.symeda.sormas.api.utils.DateHelper;
import de.symeda.sormas.api.utils.YesNoUnknown;
import de.symeda.sormas.api.utils.fieldaccess.UiFieldAccessCheckers;
import de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers;
import de.symeda.sormas.ui.UiUtil;
import de.symeda.sormas.ui.utils.AbstractEditForm;
import de.symeda.sormas.ui.utils.CssStyles;
import de.symeda.sormas.ui.utils.FieldHelper;
Expand Down Expand Up @@ -210,12 +212,11 @@ protected void addFields() {
initializeVisibilitiesAndAllowedVisibilities();
initializeAccessAndAllowedAccesses();

if (Disease.TUBERCULOSIS.equals(disease)) {
if (UiUtil.permitted(UserRight.SEE_SENSITIVE_DATA_IN_JURISDICTION, UserRight.SEE_SENSITIVE_DATA_OUTSIDE_JURISDICTION)) {
Field<?> other = getField(OTHER_CONDITIONS);
if (other != null) {
other.setReadOnly(false);
other.setEnabled(true);

if (other instanceof AbstractTextField) {
((AbstractTextField) other).setInputPrompt("");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,19 @@ public PathogenTestForm(boolean create, int caseSampleCount, boolean isPseudonym
setWidth(900, Unit.PIXELS);
}

private static void setCqValueVisibility(TextField cqValueField, PathogenTestType testType, PathogenTestResultType testResultType) {
if (((testType == PathogenTestType.PCR_RT_PCR && testResultType == PathogenTestResultType.POSITIVE))
|| testType == PathogenTestType.CQ_VALUE_DETECTION) {
cqValueField.setVisible(true);
} else {
cqValueField.setVisible(false);
cqValueField.clear();
private static void setCqValueVisibility(
ComboBox diseaseField,
TextField cqValueField,
PathogenTestType testType,
PathogenTestResultType testResultType) {
if (!List.of(Disease.TUBERCULOSIS).contains((Disease) diseaseField.getValue())) {
if (((testType == PathogenTestType.PCR_RT_PCR && testResultType == PathogenTestResultType.POSITIVE))
|| testType == PathogenTestType.CQ_VALUE_DETECTION) {
cqValueField.setVisible(true);
} else {
cqValueField.setVisible(false);
cqValueField.clear();
}
}
}

Expand Down Expand Up @@ -260,6 +266,16 @@ private void updateDrugSusceptibilityFieldSpecifications(PathogenTestType testTy
testResultField.setReadOnly(false);
testResultField.setValue(null);
}
} else if (List.of(Disease.INVASIVE_MENINGOCOCCAL_INFECTION).contains(disease)) {
if (Arrays.asList(PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY).contains(testType)) {
if (wasReadOnly) {
testResultField.setReadOnly(false);
}
testResultField.setValue(PathogenTestResultType.NOT_APPLICABLE);
if (wasReadOnly) {
testResultField.setReadOnly(true);
}
}
}

if (List.of(PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY).contains(testType)) {
Expand Down Expand Up @@ -496,9 +512,6 @@ protected void addFields() {
}
};
FieldHelper.setVisibleWhen(getFieldGroup(), PathogenTestDto.RIFAMPICIN_RESISTANT, tuberculosisPcrDependencies, true);
//FieldHelper.setRequiredWhen(getFieldGroup(), PathogenTestDto.RIFAMPICIN_RESISTANT, tuberculosisPcrDependencies);
FieldHelper.setVisibleWhen(getFieldGroup(), PathogenTestDto.ISONIAZID_RESISTANT, tuberculosisPcrDependencies, true);
//FieldHelper.setRequiredWhen(getFieldGroup(), PathogenTestDto.ISONIAZID_RESISTANT, tuberculosisPcrDependencies);

//tuberculosis-microscopy test specification
Map<Object, List<Object>> tuberculosisMicroscopyDependencies = new HashMap<>() {
Expand Down Expand Up @@ -1185,17 +1198,30 @@ protected void addFields() {
fourFoldIncrease.setVisible(false);
fourFoldIncrease.setEnabled(false);
}

updateDrugSusceptibilityFieldSpecifications(testType, (Disease) diseaseField.getValue());

setVisibleClear(
PathogenTestType.PCR_RT_PCR == testType,
PathogenTestDto.CQ_VALUE,
PathogenTestDto.CT_VALUE_E,
PathogenTestDto.CT_VALUE_N,
PathogenTestDto.CT_VALUE_RDRP,
PathogenTestDto.CT_VALUE_S,
PathogenTestDto.CT_VALUE_ORF_1,
PathogenTestDto.CT_VALUE_RDRP_S);
if (!List.of(Disease.TUBERCULOSIS).contains((Disease) diseaseField.getValue())) {
setVisibleClear(
PathogenTestType.PCR_RT_PCR == testType,
PathogenTestDto.CQ_VALUE,
PathogenTestDto.CT_VALUE_E,
PathogenTestDto.CT_VALUE_N,
PathogenTestDto.CT_VALUE_RDRP,
PathogenTestDto.CT_VALUE_S,
PathogenTestDto.CT_VALUE_ORF_1,
PathogenTestDto.CT_VALUE_RDRP_S);
} else {
setVisibleClear(
false,
PathogenTestDto.CQ_VALUE,
PathogenTestDto.CT_VALUE_E,
PathogenTestDto.CT_VALUE_N,
PathogenTestDto.CT_VALUE_RDRP,
PathogenTestDto.CT_VALUE_S,
PathogenTestDto.CT_VALUE_ORF_1,
PathogenTestDto.CT_VALUE_RDRP_S);
}
// Show tube IGRA fields only for IGRA tests and Luxembourg
setVisibleClear(
PathogenTestType.IGRA == testType && FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG),
Expand Down Expand Up @@ -1244,12 +1270,12 @@ protected void addFields() {

testTypeField.addValueChangeListener(e -> {
PathogenTestType testType = (PathogenTestType) e.getProperty().getValue();
setCqValueVisibility(cqValueField, testType, (PathogenTestResultType) testResultField.getValue());
setCqValueVisibility(diseaseField, cqValueField, testType, (PathogenTestResultType) testResultField.getValue());
});

testResultField.addValueChangeListener(e -> {
PathogenTestResultType testResult = (PathogenTestResultType) e.getProperty().getValue();
setCqValueVisibility(cqValueField, (PathogenTestType) testTypeField.getValue(), testResult);
setCqValueVisibility(diseaseField, cqValueField, (PathogenTestType) testTypeField.getValue(), testResult);
});

if (SamplePurpose.INTERNAL.equals(getSamplePurpose())) { // this only works for already saved samples
Expand Down
Loading