Skip to content

Commit

Permalink
#170: implemented case edit features for Mpox.
Browse files Browse the repository at this point in the history
  • Loading branch information
Flava177 committed Dec 13, 2024
1 parent 587452c commit b3911c6
Show file tree
Hide file tree
Showing 6 changed files with 320 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ public class Case extends PseudonymizableAdo {
private Region regionOfResidence;
@DatabaseField(foreign = true, foreignAutoRefresh = true)
private District districtOfResidence;
@Column(length = CHARACTER_LIMIT_DEFAULT)
private String investigationOfficerAddress;

public boolean isUnreferredPortHealthCase() {
return caseOrigin == CaseOrigin.POINT_OF_ENTRY && healthFacility == null;
Expand Down Expand Up @@ -2011,5 +2013,10 @@ public District getDistrictOfResidence() {
public void setDistrictOfResidence(District districtOfResidence) {
this.districtOfResidence = districtOfResidence;
}
public String getInvestigationOfficerAddress() {return investigationOfficerAddress;}

public void setInvestigationOfficerAddress(String investigationOfficerAddress) {
this.investigationOfficerAddress = investigationOfficerAddress;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ public void fillInnerFromDto(Case target, CaseDataDto source) {
target.setOccupation(source.getOccupation());
target.setRegionOfResidence(DatabaseHelper.getRegionDao().getByReferenceDto(source.getRegionOfResidence()));
target.setDistrictOfResidence(DatabaseHelper.getDistrictDao().getByReferenceDto(source.getDistrictOfResidence()));
target.setInvestigationOfficerAddress(source.getInvestigationOfficerAddress());

if (source.getDisease() == Disease.MONKEYPOX) {
if (source.getHospitalization() != null) {
Expand Down Expand Up @@ -677,6 +678,7 @@ public void fillInnerFromAdo(CaseDataDto target, Case source) {
target.setNationality(source.getNationality());
target.setEthnicity(source.getEthnicity());
target.setOccupation(source.getOccupation());
target.setInvestigationOfficerAddress(source.getInvestigationOfficerAddress());

if (source.getRegionOfResidence() != null) {
Region regionOfResidence = DatabaseHelper.getRegionDao().queryForId(source.getRegionOfResidence().getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4305,6 +4305,7 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN nationality varchar(255);");
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN ethnicity varchar(255);");
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN occupation varchar(255);");
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN investigationOfficerAddress varchar(255);");
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN regionOfResidence_id bigint REFERENCES region(id);");
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN districtOfResidence_id bigint REFERENCES district(id);");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,9 @@ public void onChange(ControlPropertyField field) {
if (record.getDisease() == Disease.YELLOW_FEVER){
handleYellowFever();
}
if (record.getDisease() == Disease.MONKEYPOX){
handleMpox();
}
}

private void fillConfirmedCaseClassificationCombo() {
Expand Down Expand Up @@ -929,6 +932,13 @@ private void handleYellowFever() {

}

private void handleMpox(){
getContentBinding().caseDataReportingOfficerName.setCaption("Name");
getContentBinding().caseDataReportingOfficerTitle.setCaption("Job Title");
getContentBinding().caseDataReportingOfficerEmail.setCaption("Email Address");
getContentBinding().caseDataReportingOfficerContactPhone.setCaption("Contact Number");
}

private void handleNNT() {
FragmentCaseEditLayoutBinding contentBinding = getContentBinding();
YesNoUnknown caseDataMotherHaveCard = contentBinding.caseDataMotherHaveCard != null ? (YesNoUnknown) contentBinding.caseDataMotherHaveCard.getValue() : null;
Expand Down
184 changes: 184 additions & 0 deletions sormas-app/app/src/main/res/layout/fragment_case_edit_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,190 @@

</LinearLayout>

<LinearLayout
android:id="@+id/name_fields_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_firstName"
style="@style/ControlFirstOfTwoColumnsStyle"
app:required="true"
app:value="@={data.person.firstName}" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_lastName"
style="@style/ControlSecondOfTwoColumnsStyle"
app:required="true"
app:value="@={data.person.lastName}" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_otherName"
style="@style/ControlSecondOfTwoColumnsStyle"
app:required="false"
app:value="@={data.person.otherName}" />

</LinearLayout>

<TextView
android:id="@+id/person_birthdateLabel"
style="@style/ControlLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/caption_date_of_birth" />

<LinearLayout
android:id="@+id/birthday_fields_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/person_birthdateYYYY"
style="@style/ControlFirstOfTwoColumnsStyle"
app:hint="@string/hint_select_year"
app:showCaption="false"
app:value="@={data.person.birthdateYYYY}" />

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/person_birthdateMM"
style="@style/ControlSecondOfTwoColumnsStyle"
app:hint="@string/hint_select_month"
app:showCaption="false"
app:value="@={data.person.birthdateMM}" />

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/person_birthdateDD"
style="@style/ControlSecondOfTwoColumnsStyle"
app:hint="@string/hint_select_day"
app:showCaption="false"
app:value="@={data.person.birthdateDD}" />

</LinearLayout>

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/person_sex"
style="@style/ControlSingleColumnStyle"
app:required="true"
app:value="@={data.person.sex}" />

<LinearLayout
android:id="@+id/age_fields_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/person_approximateAge"
app:value="@={data.person.approximateAge}"
app:inputType="number"
app:maxLength="3"
style="@style/ControlFirstOfTwoColumnsStyle" />

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/person_approximateAgeType"
app:value="@={data.person.approximateAgeType}"
style="@style/ControlSecondOfTwoColumnsStyle" />

</LinearLayout>

<LinearLayout
android:id="@+id/addressVillageCity_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_addressMpox"
style="@style/ControlFirstOfTwoColumnsStyle"
app:value="@={data.addressMpox}" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_village"
style="@style/ControlSecondOfTwoColumnsStyle"
app:value="@={data.village}" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_city"
style="@style/ControlSecondOfTwoColumnsStyle"
app:value="@={data.city}" />

</LinearLayout>

<TextView
android:id="@+id/caseData_coorLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{I18nProperties.getCaption(Captions.coorLabel)}"
style="@style/SubHeadingStyle" />

<LinearLayout
android:id="@+id/gps_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_reportLon"
style="@style/ControlFirstOfTwoColumnsStyle"
app:inputType="number"
app:value="@={data.reportLon}" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_reportLat"
style="@style/ControlSecondOfTwoColumnsStyle"
app:inputType="number"
app:value="@={data.reportLat}" />

</LinearLayout>

<LinearLayout
android:id="@+id/nationalityEthnicty_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_nationality"
style="@style/ControlFirstOfTwoColumnsStyle"
app:value="@={data.nationality}" />

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_ethnicity"
style="@style/ControlSecondOfTwoColumnsStyle"
app:value="@={data.ethnicity}" />

</LinearLayout>

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_occupation"
style="@style/ControlSingleColumnStyle"
app:value="@={data.occupation}" />

<LinearLayout
android:id="@+id/mpoxRegionDistrict_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/caseData_regionOfResidence"
app:value="@={data.regionOfResidence}"
style="@style/ControlFirstOfTwoColumnsStyle" />

<de.symeda.sormas.app.component.controls.ControlSpinnerField
android:id="@+id/caseData_districtOfResidence"
app:value="@={data.districtOfResidence}"
style="@style/ControlSecondOfTwoColumnsStyle" />

</LinearLayout>

<de.symeda.sormas.app.component.controls.ControlTextEditField
android:id="@+id/caseData_investigationOfficerAddress"
app:value="@{data.investigationOfficerAddress}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/caseData_supplementalImmunization"
app:enumClass="@{yesNoUnknownClass}"
Expand Down
116 changes: 116 additions & 0 deletions sormas-app/app/src/main/res/layout/fragment_case_read_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,122 @@
app:dependencyParentValue="@{YesNoUnknown.YES}"
style="@style/ControlSingleColumnStyle"/>

<LinearLayout
android:id="@+id/age_fields_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/person_approximateAge"
app:value="@{data.person.approximateAge}"
app:inputType="number"
app:maxLength="3"
style="@style/ControlFirstOfTwoColumnsStyle" />

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/person_approximateAgeType"
app:value="@{data.person.approximateAgeType}"
style="@style/ControlSecondOfTwoColumnsStyle" />

</LinearLayout>

<LinearLayout
android:id="@+id/addressVillageCity_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_addressMpox"
style="@style/ControlFirstOfTwoColumnsStyle"
app:value="@{data.addressMpox}" />

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_village"
style="@style/ControlSecondOfTwoColumnsStyle"
app:value="@{data.village}" />

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_city"
style="@style/ControlSecondOfTwoColumnsStyle"
app:value="@{data.city}" />

</LinearLayout>

<TextView
android:id="@+id/caseData_coorLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{I18nProperties.getCaption(Captions.coorLabel)}"
style="@style/SubHeadingStyle" />

<LinearLayout
android:id="@+id/gps_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_reportLon"
style="@style/ControlFirstOfTwoColumnsStyle"
app:inputType="number"
app:value="@{data.reportLon}" />

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_reportLat"
style="@style/ControlSecondOfTwoColumnsStyle"
app:inputType="number"
app:value="@{data.reportLat}" />

</LinearLayout>

<LinearLayout
android:id="@+id/nationalityEthnicty_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_nationality"
style="@style/ControlFirstOfTwoColumnsStyle"
app:value="@{data.nationality}" />

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_ethnicity"
style="@style/ControlSecondOfTwoColumnsStyle"
app:value="@{data.ethnicity}" />

</LinearLayout>

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_occupation"
style="@style/ControlSingleColumnStyle"
app:value="@{data.occupation}" />

<LinearLayout
android:id="@+id/mpoxRegionDistrict_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_regionOfResidence"
app:value="@{data.regionOfResidence}"
style="@style/ControlFirstOfTwoColumnsStyle" />

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_districtOfResidence"
app:value="@{data.districtOfResidence}"
style="@style/ControlSecondOfTwoColumnsStyle" />

</LinearLayout>

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_investigationOfficerAddress"
app:value="@{data.investigationOfficerAddress}"
style="@style/ControlSingleColumnStyle" />

</LinearLayout>


Expand Down

0 comments on commit b3911c6

Please sign in to comment.