Skip to content

Commit 0c34caf

Browse files
authored
Merge pull request #13658 from SORMAS-Foundation/13323-therapy-view-updates-for-tb
update therapy form for TB. disable TB by default. drug susceptibility result entry fixes
2 parents 376596d + 353fa4c commit 0c34caf

5 files changed

Lines changed: 103 additions & 80 deletions

File tree

sormas-api/src/main/java/de/symeda/sormas/api/Disease.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public enum Disease
5757
DIARRHEA_BLOOD(true, false, false, true, false, 0, true, false, false),
5858
SNAKE_BITE(true, false, false, true, false, 0, true, false, false),
5959
RUBELLA(true, false, false, true, false, 0, true, false, false),
60-
TUBERCULOSIS(true, true, true, true, false, 0, true, false, false),
61-
LATENT_TUBERCULOSIS(true, true, true, true, false, 0, true, false, false),
60+
TUBERCULOSIS(false, true, true, true, false, 0, true, false, false),
61+
LATENT_TUBERCULOSIS(false, true, true, true, false, 0, true, false, false),
6262
LEPROSY(true, false, false, true, false, 0, true, false, false),
6363
LYMPHATIC_FILARIASIS(true, false, false, true, false, 0, true, false, false),
6464
BURULI_ULCER(true, false, false, true, false, 0, true, false, false),

sormas-backend/src/main/java/de/symeda/sormas/backend/sample/PathogenTestFacadeEjb.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import de.symeda.sormas.api.sample.PathogenTestResultType;
5353
import de.symeda.sormas.api.sample.PathogenTestType;
5454
import de.symeda.sormas.api.sample.SampleReferenceDto;
55+
import de.symeda.sormas.api.therapy.DrugSusceptibilityType;
5556
import de.symeda.sormas.api.user.NotificationType;
5657
import de.symeda.sormas.api.user.UserRight;
5758
import de.symeda.sormas.api.utils.DataHelper;
@@ -80,6 +81,7 @@
8081
import de.symeda.sormas.backend.infrastructure.facility.FacilityService;
8182
import de.symeda.sormas.backend.infrastructure.region.Region;
8283
import de.symeda.sormas.backend.specialcaseaccess.SpecialCaseAccessService;
84+
import de.symeda.sormas.backend.therapy.DrugSusceptibility;
8385
import de.symeda.sormas.backend.therapy.DrugSusceptibilityMapper;
8486
import de.symeda.sormas.backend.user.User;
8587
import de.symeda.sormas.backend.user.UserFacadeEjb;
@@ -351,6 +353,18 @@ private void handleAssociatedEntityChanges(PathogenTest pathogenTest, boolean sy
351353
// Update case classification if necessary
352354
final Case associatedCase = pathogenTest.getSample().getAssociatedCase();
353355
if (associatedCase != null) {
356+
DrugSusceptibility drugSusceptibility = pathogenTest.getDrugSusceptibility();
357+
if (drugSusceptibility != null) {
358+
if (associatedCase.getTherapy() != null) {
359+
if (drugSusceptibility.getIsoniazidSusceptibility() == DrugSusceptibilityType.RESISTANT
360+
&& drugSusceptibility.getRifampicinSusceptibility() == DrugSusceptibilityType.RESISTANT) {
361+
associatedCase.getTherapy().setMdrXdrTuberculosis(true);
362+
} else {
363+
associatedCase.getTherapy().setMdrXdrTuberculosis(false);
364+
}
365+
}
366+
}
367+
354368
caseFacade.onCaseSampleChanged(associatedCase, syncShares);
355369
}
356370

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import java.util.function.Consumer;
3636

3737
import org.apache.commons.collections4.CollectionUtils;
38+
import org.slf4j.Logger;
39+
import org.slf4j.LoggerFactory;
3840

3941
import com.google.common.collect.ImmutableList;
4042
import com.google.common.collect.ImmutableMap;
@@ -88,6 +90,8 @@ public class PathogenTestForm extends AbstractEditForm<PathogenTestDto> {
8890

8991
private static final long serialVersionUID = -1218707278398543154L;
9092

93+
private final Logger logger = LoggerFactory.getLogger(getClass());
94+
9195
private static final String PATHOGEN_TEST_HEADING_LOC = "pathogenTestHeadingLoc";
9296

9397
private static final String PRESCRIBER_HEADING_LOC = "prescriberHeading";
@@ -220,6 +224,7 @@ private void updateDrugSusceptibilityFieldSpecifications(PathogenTestType testTy
220224
boolean wasReadOnly = testResultField.isReadOnly();
221225

222226
if ((disease == Disease.TUBERCULOSIS || disease == Disease.LATENT_TUBERCULOSIS) && testType != null) {
227+
223228
if (Arrays
224229
.asList(PathogenTestType.BEIJINGGENOTYPING, PathogenTestType.MIRU_PATTERN_CODE, PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY)
225230
.contains(testType)) {
@@ -250,6 +255,7 @@ private void updateDrugSusceptibilityFieldSpecifications(PathogenTestType testTy
250255
}
251256

252257
drugSusceptibilityField.updateFieldsVisibility(disease, testType);
258+
drugSusceptibilityField.setVisible(true);
253259
} else {
254260
if ((disease != Disease.TUBERCULOSIS && disease != Disease.LATENT_TUBERCULOSIS)
255261
&& (DiseaseHelper.checkDiseaseIsInvasiveBacterialDiseases(disease) && testType == PathogenTestType.ANTIBIOTIC_SUSCEPTIBILITY)) { // for non lux tb no drug susceptibility
@@ -527,6 +533,7 @@ protected void addFields() {
527533
}
528534
};
529535
FieldHelper.setVisibleWhen(getFieldGroup(), PathogenTestDto.DRUG_SUSCEPTIBILITY, tuberculosisAntibioticDependencies, true);
536+
530537
//test result - read only
531538
Map<Object, List<Object>> tuberculosisTestResultReadOnlyDependencies = new HashMap<>() {
532539

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

Lines changed: 67 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import static de.symeda.sormas.api.therapy.DrugSusceptibilityDto.RIFAMPICIN_SUSCEPTIBILITY;
3434
import static de.symeda.sormas.api.therapy.DrugSusceptibilityDto.STREPTOMYCIN_SUSCEPTIBILITY;
3535
import static de.symeda.sormas.ui.utils.CssStyles.H3;
36-
import static de.symeda.sormas.ui.utils.LayoutUtil.fluidColumn;
37-
import static de.symeda.sormas.ui.utils.LayoutUtil.fluidRow;
3836
import static de.symeda.sormas.ui.utils.LayoutUtil.fluidRowLocs;
3937
import static de.symeda.sormas.ui.utils.LayoutUtil.loc;
4038

@@ -78,30 +76,19 @@ public class DrugSusceptibilityResultPanel extends CustomLayout {
7876

7977
//@formatter:off
8078
private static final String HTML_LAYOUT =
81-
loc(FORM_HEADING_LOC) +
82-
fluidRow(
83-
fluidColumn(4, 0,
84-
fluidRowLocs(AMIKACIN_SUSCEPTIBILITY)
85-
+ fluidRowLocs(BEDAQUILINE_SUSCEPTIBILITY)
86-
+ fluidRowLocs(CAPREOMYCIN_SUSCEPTIBILITY)
87-
+ fluidRowLocs(CIPROFLOXACIN_SUSCEPTIBILITY)
88-
+ fluidRowLocs(DELAMANID_SUSCEPTIBILITY)
89-
+ fluidRowLocs(ETHAMBUTOL_SUSCEPTIBILITY)
90-
+ fluidRowLocs(GATIFLOXACIN_SUSCEPTIBILITY)
91-
+ fluidRowLocs("LAYOUT_CEFTRIAXONE")
92-
+ fluidRowLocs("LAYOUT_CIPROFLOXACIN")
93-
+ fluidRowLocs("LAYOUT_ERYTHROMYCIN")),
94-
fluidColumn(4, 0,
95-
fluidRowLocs(ISONIAZID_SUSCEPTIBILITY)
96-
+ fluidRowLocs(KANAMYCIN_SUSCEPTIBILITY)
97-
+ fluidRowLocs(LEVOFLOXACIN_SUSCEPTIBILITY)
98-
+ fluidRowLocs(MOXIFLOXACIN_SUSCEPTIBILITY)
99-
+ fluidRowLocs(OFLOXACIN_SUSCEPTIBILITY)
100-
+ fluidRowLocs(RIFAMPICIN_SUSCEPTIBILITY)
101-
+ fluidRowLocs(STREPTOMYCIN_SUSCEPTIBILITY)
102-
+ fluidRowLocs("LAYOUT_RIFAMPICIN")
103-
+fluidRowLocs("LAYOUT_PENICILLIN"))
104-
);
79+
loc(FORM_HEADING_LOC)
80+
+ fluidRowLocs(ISONIAZID_SUSCEPTIBILITY, RIFAMPICIN_SUSCEPTIBILITY, "", "")
81+
+ fluidRowLocs(ETHAMBUTOL_SUSCEPTIBILITY, STREPTOMYCIN_SUSCEPTIBILITY, "", "")
82+
+ fluidRowLocs(LEVOFLOXACIN_SUSCEPTIBILITY, MOXIFLOXACIN_SUSCEPTIBILITY, "", "")
83+
+ fluidRowLocs(BEDAQUILINE_SUSCEPTIBILITY, "", "", "")
84+
+ fluidRowLocs(DELAMANID_SUSCEPTIBILITY, CAPREOMYCIN_SUSCEPTIBILITY, "", "")
85+
+ fluidRowLocs(KANAMYCIN_SUSCEPTIBILITY, "", "", "")
86+
+ fluidRowLocs(CIPROFLOXACIN_SUSCEPTIBILITY, OFLOXACIN_SUSCEPTIBILITY, "", "")
87+
+ fluidRowLocs(GATIFLOXACIN_SUSCEPTIBILITY, "", "", "")
88+
+ fluidRowLocs(AMIKACIN_SUSCEPTIBILITY, "", "", "")
89+
+ fluidRowLocs("LAYOUT_CEFTRIAXONE", "LAYOUT_RIFAMPICIN", "", "")
90+
+ fluidRowLocs("LAYOUT_CIPROFLOXACIN", "LAYOUT_PENICILLIN", "", "")
91+
+ fluidRowLocs("LAYOUT_ERYTHROMYCIN", "", "", "");
10592
//@formatter:on
10693

10794
private static final List<String> componentLocationsList = List.of(
@@ -142,87 +129,103 @@ private void addFields() {
142129
DrugSusceptibilityDto drugSusceptibilityDto = pathogenTestDto.getDrugSusceptibility();
143130

144131
addResistanceResultField(
145-
AMIKACIN_SUSCEPTIBILITY,
146-
drugSusceptibilityDto.getAmikacinSusceptibility(),
147-
I18nProperties.getEnumCaption(Drug.AMIKACIN),
132+
ISONIAZID_SUSCEPTIBILITY,
133+
drugSusceptibilityDto.getIsoniazidSusceptibility(),
134+
I18nProperties.getEnumCaption(Drug.ISONIAZID),
148135
pathogenTestDto.getTestedDisease());
136+
149137
addResistanceResultField(
150-
BEDAQUILINE_SUSCEPTIBILITY,
151-
drugSusceptibilityDto.getBedaquilineSusceptibility(),
152-
I18nProperties.getEnumCaption(Drug.BEDAQUILINE),
138+
RIFAMPICIN_SUSCEPTIBILITY,
139+
drugSusceptibilityDto.getRifampicinSusceptibility(),
140+
I18nProperties.getEnumCaption(Drug.RIFAMPICIN),
153141
pathogenTestDto.getTestedDisease());
142+
154143
addResistanceResultField(
155-
CAPREOMYCIN_SUSCEPTIBILITY,
156-
drugSusceptibilityDto.getCapreomycinSusceptibility(),
157-
I18nProperties.getEnumCaption(Drug.CAPREOMYCIN),
144+
ETHAMBUTOL_SUSCEPTIBILITY,
145+
drugSusceptibilityDto.getEthambutolSusceptibility(),
146+
I18nProperties.getEnumCaption(Drug.ETHAMBUTOL),
158147
pathogenTestDto.getTestedDisease());
148+
159149
addResistanceResultField(
160-
CIPROFLOXACIN_SUSCEPTIBILITY,
161-
drugSusceptibilityDto.getCiprofloxacinSusceptibility(),
162-
I18nProperties.getEnumCaption(Drug.CIPROFLOXACIN),
150+
STREPTOMYCIN_SUSCEPTIBILITY,
151+
drugSusceptibilityDto.getStreptomycinSusceptibility(),
152+
I18nProperties.getEnumCaption(Drug.STREPTOMYCIN),
163153
pathogenTestDto.getTestedDisease());
154+
164155
addResistanceResultField(
165-
DELAMANID_SUSCEPTIBILITY,
166-
drugSusceptibilityDto.getDelamanidSusceptibility(),
167-
I18nProperties.getEnumCaption(Drug.DELAMANID),
156+
LEVOFLOXACIN_SUSCEPTIBILITY,
157+
drugSusceptibilityDto.getLevofloxacinSusceptibility(),
158+
I18nProperties.getEnumCaption(Drug.LEVOFLOXACIN),
168159
pathogenTestDto.getTestedDisease());
160+
169161
addResistanceResultField(
170-
ETHAMBUTOL_SUSCEPTIBILITY,
171-
drugSusceptibilityDto.getEthambutolSusceptibility(),
172-
I18nProperties.getEnumCaption(Drug.ETHAMBUTOL),
162+
MOXIFLOXACIN_SUSCEPTIBILITY,
163+
drugSusceptibilityDto.getMoxifloxacinSusceptibility(),
164+
I18nProperties.getEnumCaption(Drug.MOXIFLOXACIN),
173165
pathogenTestDto.getTestedDisease());
166+
174167
addResistanceResultField(
175-
GATIFLOXACIN_SUSCEPTIBILITY,
176-
drugSusceptibilityDto.getGatifloxacinSusceptibility(),
177-
I18nProperties.getEnumCaption(Drug.GATIFLOXACIN),
168+
BEDAQUILINE_SUSCEPTIBILITY,
169+
drugSusceptibilityDto.getBedaquilineSusceptibility(),
170+
I18nProperties.getEnumCaption(Drug.BEDAQUILINE),
178171
pathogenTestDto.getTestedDisease());
172+
179173
addResistanceResultField(
180-
ISONIAZID_SUSCEPTIBILITY,
181-
drugSusceptibilityDto.getIsoniazidSusceptibility(),
182-
I18nProperties.getEnumCaption(Drug.ISONIAZID),
174+
DELAMANID_SUSCEPTIBILITY,
175+
drugSusceptibilityDto.getDelamanidSusceptibility(),
176+
I18nProperties.getEnumCaption(Drug.DELAMANID),
183177
pathogenTestDto.getTestedDisease());
178+
179+
addResistanceResultField(
180+
CAPREOMYCIN_SUSCEPTIBILITY,
181+
drugSusceptibilityDto.getCapreomycinSusceptibility(),
182+
I18nProperties.getEnumCaption(Drug.CAPREOMYCIN),
183+
pathogenTestDto.getTestedDisease());
184+
184185
addResistanceResultField(
185186
KANAMYCIN_SUSCEPTIBILITY,
186187
drugSusceptibilityDto.getKanamycinSusceptibility(),
187188
I18nProperties.getEnumCaption(Drug.KANAMYCIN),
188189
pathogenTestDto.getTestedDisease());
190+
189191
addResistanceResultField(
190-
LEVOFLOXACIN_SUSCEPTIBILITY,
191-
drugSusceptibilityDto.getLevofloxacinSusceptibility(),
192-
I18nProperties.getEnumCaption(Drug.LEVOFLOXACIN),
193-
pathogenTestDto.getTestedDisease());
194-
addResistanceResultField(
195-
MOXIFLOXACIN_SUSCEPTIBILITY,
196-
drugSusceptibilityDto.getMoxifloxacinSusceptibility(),
197-
I18nProperties.getEnumCaption(Drug.MOXIFLOXACIN),
192+
CIPROFLOXACIN_SUSCEPTIBILITY,
193+
drugSusceptibilityDto.getCiprofloxacinSusceptibility(),
194+
I18nProperties.getEnumCaption(Drug.CIPROFLOXACIN),
198195
pathogenTestDto.getTestedDisease());
196+
199197
addResistanceResultField(
200198
OFLOXACIN_SUSCEPTIBILITY,
201199
drugSusceptibilityDto.getOfloxacinSusceptibility(),
202200
I18nProperties.getEnumCaption(Drug.OFLOXACIN),
203201
pathogenTestDto.getTestedDisease());
202+
204203
addResistanceResultField(
205-
RIFAMPICIN_SUSCEPTIBILITY,
206-
drugSusceptibilityDto.getRifampicinSusceptibility(),
207-
I18nProperties.getEnumCaption(Drug.RIFAMPICIN),
204+
GATIFLOXACIN_SUSCEPTIBILITY,
205+
drugSusceptibilityDto.getGatifloxacinSusceptibility(),
206+
I18nProperties.getEnumCaption(Drug.GATIFLOXACIN),
208207
pathogenTestDto.getTestedDisease());
208+
209209
addResistanceResultField(
210-
STREPTOMYCIN_SUSCEPTIBILITY,
211-
drugSusceptibilityDto.getStreptomycinSusceptibility(),
212-
I18nProperties.getEnumCaption(Drug.STREPTOMYCIN),
210+
AMIKACIN_SUSCEPTIBILITY,
211+
drugSusceptibilityDto.getAmikacinSusceptibility(),
212+
I18nProperties.getEnumCaption(Drug.AMIKACIN),
213213
pathogenTestDto.getTestedDisease());
214+
214215
// CEFTRIAXONE
215216
addResistanceResultField(
216217
CEFTRIAXONE_SUSCEPTIBILITY,
217218
drugSusceptibilityDto.getCeftriaxoneSusceptibility(),
218219
I18nProperties.getEnumCaption(Drug.CEFTRIAXONE),
219220
pathogenTestDto.getTestedDisease());
221+
220222
// PENICILLIN
221223
addResistanceResultField(
222224
PENICILLIN_SUSCEPTIBILITY,
223225
drugSusceptibilityDto.getPenicillinSusceptibility(),
224226
I18nProperties.getEnumCaption(Drug.PENICILLIN),
225227
pathogenTestDto.getTestedDisease());
228+
226229
// ERYTHROMYCIN
227230
addResistanceResultField(
228231
ERYTHROMYCIN_SUSCEPTIBILITY,

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public class TherapyForm extends AbstractEditForm<TherapyDto> {
8080

8181
//@formatter:off
8282
private static final String MAIN_HTML_LAYOUT =
83-
fluidRowLocs(TherapyDto.DIRECTLY_OBSERVED_TREATMENT, "", "") +
84-
fluidRowLocs(TherapyDto.MDR_XDR_TUBERCULOSIS, TherapyDto.BEIJING_LINEAGE, "") +
83+
fluidRowLocs(TherapyDto.DIRECTLY_OBSERVED_TREATMENT, "", "", "") +
84+
fluidRowLocs(TherapyDto.MDR_XDR_TUBERCULOSIS, TherapyDto.BEIJING_LINEAGE, "", "") +
8585
fluidRowLocs(DRUD_SUSCEPTIBILITY_LOC) +
8686
fluidRowLocs(PRESCRIPTION_LOC) +
8787
fluidRowLocs(TREATMENT_LOC) +
@@ -147,23 +147,20 @@ protected String createHtmlLayout() {
147147

148148
@Override
149149
protected void addFields() {
150-
boolean isLUXConfigured = FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG);
150+
boolean isLuxembourgServer = FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG);
151+
151152
CheckBox dotField = addField(TherapyDto.DIRECTLY_OBSERVED_TREATMENT, CheckBox.class);
152153
dotField.addStyleName(VSPACE_3);
153-
dotField.setVisible(isLUXConfigured && disease == Disease.TUBERCULOSIS);
154+
dotField.setVisible(isLuxembourgServer && disease == Disease.TUBERCULOSIS);
154155

155156
mdrXdrTuberculosisField = addField(TherapyDto.MDR_XDR_TUBERCULOSIS, CheckBox.class);
156157
mdrXdrTuberculosisField.addStyleName(VSPACE_3);
157-
mdrXdrTuberculosisField.setVisible(isLUXConfigured && disease == Disease.TUBERCULOSIS);
158-
mdrXdrTuberculosisField.addValueChangeListener(e -> {
159-
if (drugSusceptibilityResultPanel != null) {
160-
drugSusceptibilityResultPanel.setVisible((Boolean) e.getProperty().getValue());
161-
}
162-
});
158+
mdrXdrTuberculosisField.setVisible(isLuxembourgServer && disease == Disease.TUBERCULOSIS);
159+
mdrXdrTuberculosisField.setEnabled(false);
163160

164161
beijingLineageField = addField(TherapyDto.BEIJING_LINEAGE, CheckBox.class);
165162
beijingLineageField.addStyleName(VSPACE_3);
166-
beijingLineageField.setVisible(isLUXConfigured && disease == Disease.TUBERCULOSIS);
163+
beijingLineageField.setVisible(isLuxembourgServer && disease == Disease.TUBERCULOSIS);
167164

168165
List<SampleDto> samples = FacadeProvider.getSampleFacade().getByCaseUuids(Collections.singletonList(caze.getUuid()));
169166
List<String> sampleUuids = Collections.emptyList();
@@ -189,7 +186,7 @@ protected void addFields() {
189186
}
190187

191188
drugSusceptibilityResultPanel = new DrugSusceptibilityResultPanel(latestAntibioticTest);
192-
drugSusceptibilityResultPanel.setVisible(disease != Disease.TUBERCULOSIS);
189+
drugSusceptibilityResultPanel.setVisible(false);
193190
getContent().addComponent(drugSusceptibilityResultPanel, DRUD_SUSCEPTIBILITY_LOC);
194191
drugSusceptibilityResultPanel.addStyleNames(VSPACE_TOP_4, VSPACE_3);
195192

@@ -435,8 +432,10 @@ private boolean isEditAllowed() {
435432
public void attach() {
436433
super.attach();
437434

438-
if (latestAntibioticTest != null) {
439-
mdrXdrTuberculosisField.setValue(true);
435+
if (getValue() != null) {
436+
if (getValue().isMdrXdrTuberculosis()) {
437+
drugSusceptibilityResultPanel.setVisible(true);
438+
}
440439
}
441440

442441
if (latestBejingGenotypingTest != null) {

0 commit comments

Comments
 (0)