From 94773611ef5196291d53a28f4b0ef556285b3529 Mon Sep 17 00:00:00 2001 From: Flava177 Date: Sun, 13 Oct 2024 23:58:00 +0000 Subject: [PATCH] #180: Implemented hospitalization features for IDSR --- .../sormas/app/backend/common/DatabaseHelper.java | 6 +++++- .../app/backend/hospitalization/Hospitalization.java | 10 ++++++++++ .../hospitalization/HospitalizationDtoHelper.java | 2 ++ .../app/caze/edit/CaseEditHospitalizationFragment.java | 1 + .../fragment_case_edit_hospitalization_layout.xml | 5 +++++ 5 files changed, 23 insertions(+), 1 deletion(-) diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java index 9cce1a4a360..4506f6c9c5f 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/common/DatabaseHelper.java @@ -200,7 +200,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 = 363; + public static final int DATABASE_VERSION = 364; private static DatabaseHelper instance = null; @@ -3298,6 +3298,10 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int case 362: currentVersion = 362; getDao(Person.class).executeRaw("ALTER TABLE person ADD COLUMN applicable varchar(255);"); + + case 363: + currentVersion = 363; + getDao(Hospitalization.class).executeRaw("ALTER TABLE hospitalizations ADD COLUMN dateFormSentToDistrict Date;"); // ATTENTION: break should only be done after last version break; default: diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/Hospitalization.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/Hospitalization.java index 8c771168e22..e2793609f0f 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/Hospitalization.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/Hospitalization.java @@ -91,6 +91,8 @@ public class Hospitalization extends AbstractDomainObject { private Date dateFirstSeen; @DatabaseField(dataType = DataType.DATE_LONG) private Date notifyDistrictDate; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date dateFormSentToDistrict; // just for reference, not persisted in DB private List previousHospitalizations = new ArrayList<>(); @@ -190,6 +192,14 @@ public Date getNotifyDistrictDate() { public void setNotifyDistrictDate(Date notifyDistrictDate) { this.notifyDistrictDate = notifyDistrictDate; } + + public Date getDateFormSentToDistrict() { + return dateFormSentToDistrict; + } + + public void setDateFormSentToDistrict(Date dateFormSentToDistrict) { + this.dateFormSentToDistrict = dateFormSentToDistrict; + } public void setDateFirstSeen(Date dateFirstSeen) { this.dateFirstSeen = dateFirstSeen; } diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/HospitalizationDtoHelper.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/HospitalizationDtoHelper.java index 3764fda131f..ee63a603f7a 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/HospitalizationDtoHelper.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/hospitalization/HospitalizationDtoHelper.java @@ -79,6 +79,7 @@ public void fillInnerFromDto(Hospitalization a, HospitalizationDto b) { a.setSelectInpatientOutpatient(b.getSelectInpatientOutpatient()); a.setDateFirstSeen(b.getDateFirstSeen()); a.setNotifyDistrictDate(b.getNotifyDistrictDate()); + a.setDateFormSentToDistrict(b.getDateFormSentToDistrict()); // It would be better to merge with the existing hospitalizations @@ -114,6 +115,7 @@ public void fillInnerFromAdo(HospitalizationDto a, Hospitalization b) { a.setSelectInpatientOutpatient(b.getSelectInpatientOutpatient()); a.setDateFirstSeen(b.getDateFirstSeen()); a.setNotifyDistrictDate(b.getNotifyDistrictDate()); + a.setDateFormSentToDistrict(b.getDateFormSentToDistrict()); List previousHospitalizationDtos = new ArrayList<>(); for (PreviousHospitalization prevHosp : b.getPreviousHospitalizations()) { diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/caze/edit/CaseEditHospitalizationFragment.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/caze/edit/CaseEditHospitalizationFragment.java index 72fff26336f..bf04d960d6c 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/caze/edit/CaseEditHospitalizationFragment.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/caze/edit/CaseEditHospitalizationFragment.java @@ -215,6 +215,7 @@ protected void onAfterLayoutBinding(FragmentCaseEditHospitalizationLayoutBinding contentBinding.caseHospitalizationIsolationDate.initializeDateField(getFragmentManager()); contentBinding.caseHospitalizationDateFirstSeen.initializeDateField(getFragmentManager()); contentBinding.caseHospitalizationNotifyDistrictDate.initializeDateField(getFragmentManager()); + contentBinding.caseHospitalizationDateFormSentToDistrict.initializeDateField(getFragmentManager()); contentBinding.caseHospitalizationPatientConditionOnAdmission.initializeSpinner(patientCondition); contentBinding.caseDataOutcome.initializeSpinner(outcomeList); diff --git a/sormas-app/app/src/main/res/layout/fragment_case_edit_hospitalization_layout.xml b/sormas-app/app/src/main/res/layout/fragment_case_edit_hospitalization_layout.xml index f718b419439..87a2f4bf230 100644 --- a/sormas-app/app/src/main/res/layout/fragment_case_edit_hospitalization_layout.xml +++ b/sormas-app/app/src/main/res/layout/fragment_case_edit_hospitalization_layout.xml @@ -253,6 +253,11 @@ android:id="@+id/caseHospitalization_notifyDistrictDate" app:value="@={data.notifyDistrictDate}" style="@style/ControlSingleColumnStyle" /> + +