Skip to content

Commit

Permalink
#170: implemented pathogen features for Mpox.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flava177 committed Dec 13, 2024
1 parent 710512c commit 2c47b5e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
import android.util.Log;
import android.view.Menu;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.disease.DiseaseVariant;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.i18n.Strings;
Expand Down Expand Up @@ -92,6 +97,13 @@ public void saveData() {
}

final PathogenTest pathogenTestToSave = getStoredRootEntity();

if (pathogenTestToSave.getTestDateTime() == null && pathogenTestToSave.getTestedDisease() == Disease.MONKEYPOX) {
LocalDateTime now = LocalDateTime.now();
Date currentDateTime = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
pathogenTestToSave.setTestDateTime(currentDateTime);
}

final Case associatedCase = pathogenTestToSave.getSample().getAssociatedCase();

if (associatedCase != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@

import android.view.View;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.EnumSet;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -311,6 +314,9 @@ public void onChange(ControlPropertyField field) {
case CSM:
handleCSM();
break;
case MONKEYPOX:
handleMPox();
break;
default:
}

Expand Down Expand Up @@ -428,6 +434,11 @@ private void applySampleTestsVisibility(List<String> selectedItems) {
getContentBinding().pathogenTestSampleTestResultImmunoDate.setVisibility(isImmunoSelected ? View.VISIBLE : View.GONE);
}

private void handleMPox() {
getContentBinding().pathogenTestTestDateTime.setEnabled(false);
}



private void handleILI(){
List<PathogenTestType> iliTestTypeList = Arrays.asList(PathogenTestType.PCR_RT_PCR, PathogenTestType.OTHER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@

import androidx.annotation.NonNull;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.disease.DiseaseVariant;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.i18n.Strings;
Expand Down Expand Up @@ -128,6 +133,13 @@ public void saveData() {
}

final PathogenTest pathogenTestToSave = getStoredRootEntity();

if (pathogenTestToSave.getTestedDisease() == Disease.MONKEYPOX) {
LocalDateTime now = LocalDateTime.now();
Date currentDateTime = Date.from(now.atZone(ZoneId.systemDefault()).toInstant());
pathogenTestToSave.setTestDateTime(currentDateTime);
}

final Case associatedCase = pathogenTestToSave.getSample().getAssociatedCase();

if (associatedCase != null) {
Expand Down

0 comments on commit 2c47b5e

Please sign in to comment.