Skip to content

Commit

Permalink
#180: Added Disease diagnosis and event diagnosis to case create for …
Browse files Browse the repository at this point in the history
…IDSR
  • Loading branch information
Flava177 committed Oct 14, 2024
1 parent e05764b commit 2db6073
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class DiseaseFieldConfigurations {

diseaseFieldConfigurations.put(new DiseaseFormTypeKey(Disease.YELLOW_FEVER, FormType.CASE_EDIT),
Arrays.asList(
R.id.case_uuid_investigationStatus_fields_layout, R.id.caseData_reportDate, R.id.caseData_reportingUser, R.id.classifying_fields_layout, R.id.caseData_caseClassification,R.id.caseData_epidNumber, R.id.caseData_disease, R.id.caseData_caseOrigin, R.id.caseData_headingCaseResponsibleJurisidction, R.id.region_district_fields_layout, R.id.caseData_responsibleCommunity, R.id.caseData_healthFacility, R.id.caseData_healthFacilityDetails, R.id.caseData_headingAdditionalMedicalInformation, R.id.caseData_vaccinationStatus, R.id.caseData_vaccinationType, R.id.caseData_numberOfDoses, R.id.caseData_reportingOfficerTitle, R.id.caseData_functionOfReportingOfficer, R.id.caseData_reportingOfficerContactPhone, R.id.caseData_reportingOfficerEmail
R.id.case_uuid_investigationStatus_fields_layout, R.id.caseData_reportDate, R.id.caseData_reportingUser, R.id.classifying_fields_layout, R.id.caseData_caseClassification,R.id.caseData_epidNumber, R.id.caseData_disease, R.id.caseData_caseOrigin, R.id.caseData_headingCaseResponsibleJurisidction, R.id.region_district_fields_layout, R.id.caseData_responsibleCommunity, R.id.caseData_healthFacility, R.id.caseData_healthFacilityDetails, R.id.caseData_medicalInformationHeading, R.id.caseData_vaccinationStatus, R.id.caseData_vaccinationType, R.id.caseData_numberOfDoses, R.id.caseData_reportingOfficerTitle, R.id.caseData_functionOfReportingOfficer, R.id.caseData_reportingOfficerContactPhone, R.id.caseData_reportingOfficerEmail
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import de.symeda.sormas.api.caze.DengueFeverType;
import de.symeda.sormas.api.caze.EndOfIsolationReason;
import de.symeda.sormas.api.caze.HospitalWardType;
import de.symeda.sormas.api.caze.IdsrType;
import de.symeda.sormas.api.caze.InfectionSetting;
import de.symeda.sormas.api.caze.InvestigationStatus;
import de.symeda.sormas.api.caze.PlagueType;
Expand Down Expand Up @@ -123,6 +124,12 @@ public class Case extends PseudonymizableAdo {
private String diseaseVariantString;
private DiseaseVariant diseaseVariant;

@Enumerated(EnumType.STRING)
private IdsrType idsrDiagnosis;

@Column(name = "specifyEventDiagnosis")
private String specifyEventDiagnosis;

@Column(length = CHARACTER_LIMIT_DEFAULT)
private String diseaseDetails;

Expand Down Expand Up @@ -477,6 +484,22 @@ public void setDiseaseVariantString(String diseaseVariantString) {
this.diseaseVariantString = diseaseVariantString;
}

public IdsrType getIdsrDiagnosis() {
return idsrDiagnosis;
}

public void setIdsrDiagnosis(IdsrType idsrDiagnosis) {
this.idsrDiagnosis = idsrDiagnosis;
}

public String getSpecifyEventDiagnosis() {
return specifyEventDiagnosis;
}

public void setSpecifyEventDiagnosis(String specifyEventDiagnosis) {
this.specifyEventDiagnosis = specifyEventDiagnosis;
}

@Transient
public DiseaseVariant getDiseaseVariant() {
if (StringUtils.isBlank(diseaseVariantString)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ public Case build(Person person, Case caze) {
newCase.setDiseaseDetails(caze.getDiseaseDetails());
newCase.setPlagueType(caze.getPlagueType());
newCase.setDengueFeverType(caze.getDengueFeverType());
newCase.setIdsrDiagnosis(caze.getIdsrDiagnosis());
newCase.setSpecifyEventDiagnosis(caze.getSpecifyEventDiagnosis());
}

return newCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public void fillInnerFromDto(Case target, CaseDataDto source) {
target.setDisease(source.getDisease());
target.setDiseaseVariant(source.getDiseaseVariant());
target.setDiseaseDetails(source.getDiseaseDetails());
target.setIdsrDiagnosis(source.getIdsrDiagnosis());
target.setSpecifyEventDiagnosis(source.getSpecifyEventDiagnosis());
target.setDiseaseVariantDetails(source.getDiseaseVariantDetails());
target.setPlagueType(source.getPlagueType());
target.setDengueFeverType(source.getDengueFeverType());
Expand Down Expand Up @@ -281,6 +283,8 @@ public void fillInnerFromAdo(CaseDataDto target, Case source) {
target.setDisease(source.getDisease());
target.setDiseaseVariant(source.getDiseaseVariant());
target.setDiseaseDetails(source.getDiseaseDetails());
target.setIdsrDiagnosis(source.getIdsrDiagnosis());
target.setSpecifyEventDiagnosis(source.getSpecifyEventDiagnosis());
target.setDiseaseVariantDetails(source.getDiseaseVariantDetails());
target.setPlagueType(source.getPlagueType());
target.setDengueFeverType(source.getDengueFeverType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {

// public static final int DATABASE_VERSION = 307;
//public static final int DATABASE_VERSION = 343;
public static final int DATABASE_VERSION = 369;
public static final int DATABASE_VERSION = 368;

private static DatabaseHelper instance = null;

Expand Down Expand Up @@ -3297,7 +3297,6 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN trimester VARCHAR(255);");
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN postpartum VARCHAR(10);");
getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN pregnant VARCHAR(10);");
case 359:
getDao(PersonTravelHistory.class).executeRaw(
"CREATE TABLE persontravelhistory ("
+ " id INTEGER PRIMARY KEY AUTOINCREMENT,"
Expand Down Expand Up @@ -3344,11 +3343,17 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
+ " UNIQUE (snapshot ASC, uuid ASC)"
+ ");"
);
case 360:
currentVersion = 360;
case 359:
currentVersion = 359;
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN sampleDispatchMode VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN ipSampleSent VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN ipSampleTestResultsString VARCHAR(512);");

case 360:
currentVersion = 360;
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN idsrDiagnosis varchar(255);");
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN specifyEventDiagnosis varchar(255);");

case 361:
currentVersion = 361;
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN selectedResultIGM VARCHAR(255);");
Expand Down Expand Up @@ -3376,7 +3381,7 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN confirmedAsGuineaWorm VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN requestedSampleMaterialsString varchar(512);");
case 362:
currentVersion = 363;
currentVersion = 362;
getDao(PathogenTest.class).executeRaw("ALTER TABLE pathogentest ADD COLUMN virusDetectionGenotype varchar(255);");
getDao(PathogenTest.class).executeRaw("ALTER TABLE pathogentest ADD COLUMN dateLabResultsSentDistrict Date;");
getDao(PathogenTest.class).executeRaw("ALTER TABLE pathogentest ADD COLUMN finalClassification varchar(255);");
Expand All @@ -3402,13 +3407,13 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
+ " UNIQUE (snapshot ASC, uuid ASC)"
+ ");"
);
case 364:
currentVersion = 364;
case 363:
currentVersion = 363;
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN receivedHealthEducation VARCHAR(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientEnteredWaterSource VARCHAR(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN placeManaged VARCHAR(255);");
case 365:
currentVersion = 365;
case 364:
currentVersion = 364;
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN specimenSavedAndPreservedInAlcohol VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN specimenSavedAndPreservedInAlcoholWhy VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateSpecimenSentToRegion DATE;");
Expand All @@ -3425,13 +3430,13 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN frequencyOfChangingFilters VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN remarks VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN confirmedAsGuineaWorm VARCHAR(255);");
case 366:
currentVersion = 366;
case 365:
currentVersion = 365;
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN secondVaccinationDate DATE;");
getDao(Hospitalization.class).executeRaw("ALTER TABLE hospitalizations ADD COLUMN patientVentilated VARCHAR(255);");
getDao(Hospitalization.class).executeRaw("ALTER TABLE hospitalizations ADD COLUMN dateFormSentToDistrict DATE;");
case 367:
currentVersion = 367;
case 366:
currentVersion = 366;
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientTravelledTwoWeeksPrior VARCHAR(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientTravelledInCountryOne VARCHAR(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientTravelledInCountryTwo VARCHAR(255);");
Expand All @@ -3445,8 +3450,8 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientCloseContactWithARI VARCHAR(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientContactWithConfirmedCase VARCHAR(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientContactWithConfirmedCaseExposureLocationCityCountry VARCHAR(255);");
case 368:
currentVersion = 368;
case 367:
currentVersion = 367;
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientContactWithConfirmedCaseExposureLocationsString VARCHAR(255);");
getDao(EpiData.class).executeRaw("ALTER TABLE epidata ADD COLUMN patientCloseContactWithARIContactSettingsString VARCHAR(255);");
getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormSentToDistrict DATE;");
Expand All @@ -3456,6 +3461,11 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
break;
default:
throw new IllegalStateException("onUpgrade() with unknown oldVersion " + oldVersion);

// ATTENTION: break should only be done after last version
break;
default:
throw new IllegalStateException("onUpgrade() with unknown oldVersion " + oldVersion);
}
} catch (

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import de.symeda.sormas.api.FormType;
import de.symeda.sormas.api.caze.CaseOrigin;
import de.symeda.sormas.api.caze.DengueFeverType;
import de.symeda.sormas.api.caze.IdsrType;
import de.symeda.sormas.api.caze.PlagueType;
import de.symeda.sormas.api.caze.RabiesType;
import de.symeda.sormas.api.customizableenum.CustomizableEnumType;
Expand Down Expand Up @@ -86,6 +87,7 @@ public class CaseNewFragment extends BaseEditFragment<FragmentCaseNewLayoutBindi
private List<Item> facilityOrHomeList;
private List<Item> facilityTypeGroupList;
private List<Item> caseTransmissionClassificationsList;
private List<Item> idsrTypeList;

public static CaseNewFragment newInstance(Case activityRootData) {
return newInstance(CaseNewFragment.class, CaseNewActivity.buildBundle().get(), activityRootData);
Expand Down Expand Up @@ -143,6 +145,7 @@ record = getActivityRootData();

facilityOrHomeList = DataUtils.toItems(TypeOfPlace.FOR_CASES, true);
facilityTypeGroupList = DataUtils.toItems(FacilityTypeGroup.getAccomodationGroups(), true);
idsrTypeList = DataUtils.getEnumItems(IdsrType.class, true);
}

@Override
Expand Down Expand Up @@ -226,6 +229,7 @@ public void onLayoutBinding(FragmentCaseNewLayoutBinding contentBinding) {

contentBinding.caseDataDisease.initializeSpinner(diseaseList, DiseaseConfigurationCache.getInstance().getDefaultDisease());
contentBinding.caseDataDiseaseVariant.initializeSpinner(diseaseVariantList);
contentBinding.caseDataIdsrDiagnosis.initializeSpinner(idsrTypeList);

contentBinding.caseDataPlagueType.initializeSpinner(plagueTypeList);
contentBinding.caseDataDengueFeverType.initializeSpinner(dengueFeverTypeList);
Expand Down
15 changes: 15 additions & 0 deletions sormas-app/app/src/main/res/layout/fragment_case_new_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

<data>
<import type="de.symeda.sormas.api.Disease" />
<import type="de.symeda.sormas.api.caze.IdsrType" />
<import type="de.symeda.sormas.api.user.UserRight" />
<import type="de.symeda.sormas.api.event.TypeOfPlace" />
<import type="de.symeda.sormas.api.i18n.I18nProperties" />
Expand Down Expand Up @@ -58,6 +59,20 @@
app:required="true"
app:value="@={data.disease}" />

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/caseData_idsrDiagnosis"
style="@style/ControlSingleColumnStyle"
app:dependencyParentField="@{caseDataDisease}"
app:dependencyParentValue="@{Disease.IMMEDIATE_CASE_BASED_FORM_OTHER_CONDITIONS}"
app:value="@={data.idsrDiagnosis}" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_specifyEventDiagnosis"
style="@style/ControlSingleColumnStyle"
app:dependencyParentField="@{caseDataIdsrDiagnosis}"
app:dependencyParentValue="@{IdsrType.OTHER}"
app:value="@={data.specifyEventDiagnosis}" />

<de.symeda.sormas.app.component.controls.ControlCheckBoxField
android:id="@+id/rapid_case_entry_checkBox"
android:visibility="gone"
Expand Down

0 comments on commit 2db6073

Please sign in to comment.