Skip to content

Commit

Permalink
SORMAS-Foundation#1981: Add Trimester and Postpartum selection to case
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Riedel committed May 19, 2020
1 parent d090241 commit ed840db
Show file tree
Hide file tree
Showing 16 changed files with 209 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ public class CaseDataDto extends EntityDto {
public static final String QUARANTINE_HOME_SUPPLY_ENSURED = "quarantineHomeSupplyEnsured";
public static final String QUARANTINE_HOME_SUPPLY_ENSURED_COMMENT = "quarantineHomeSupplyEnsuredComment";
public static final String REPORTING_TYPE = "reportingType";
public static final String POSTPARTUM = "postpartum";
public static final String TRIMESTER = "trimester";

// Fields are declared in the order they should appear in the import template

Expand Down Expand Up @@ -256,6 +258,8 @@ public class CaseDataDto extends EntityDto {
private YesNoUnknown quarantineHomeSupplyEnsured;
private String quarantineHomeSupplyEnsuredComment;
private ReportingType reportingType;
private YesNoUnknown postpartum;
private Trimester trimester;

public static CaseDataDto build(PersonReferenceDto person, Disease disease) {
CaseDataDto caze = new CaseDataDto();
Expand Down Expand Up @@ -899,4 +903,20 @@ public ReportingType getReportingType() {
public void setReportingType(ReportingType reportingType) {
this.reportingType = reportingType;
}

public YesNoUnknown getPostpartum() {
return postpartum;
}

public void setPostpartum(YesNoUnknown postpartum) {
this.postpartum = postpartum;
}

public Trimester getTrimester() {
return trimester;
}

public void setTrimester(Trimester trimester) {
this.trimester = trimester;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ public class CaseExportDto implements Serializable {
private Date quarantineFrom;
private Date quarantineTo;

private YesNoUnknown postpartum;
private Trimester trimester;

public CaseExportDto(long id, long personId, long personAddressId, long epiDataId, long symptomsId,
long hospitalizationId, long districtId, long healthConditionsId, String uuid, String epidNumber,
Disease disease, String diseaseDetails, String firstName, String lastName, Sex sex, YesNoUnknown pregnant,
Expand All @@ -180,7 +183,8 @@ public CaseExportDto(long id, long personId, long personAddressId, long epiDataI
String occupationFacilityUuid, String occupationFacilityDetails, YesNoUnknown traveled,
YesNoUnknown burialAttended, YesNoUnknown directContactConfirmedCase, YesNoUnknown directContactProbableCase, YesNoUnknown contactWithRodent,
//Date onsetDate,
Vaccination vaccination, String vaccinationDoses, Date vaccinationDate, VaccinationInfoSource vaccinationInfoSource) {
Vaccination vaccination, String vaccinationDoses, Date vaccinationDate,
VaccinationInfoSource vaccinationInfoSource, YesNoUnknown postpartum, Trimester trimester) {
this.id = id;
this.personId = personId;
this.personAddressId = personAddressId;
Expand Down Expand Up @@ -238,6 +242,8 @@ public CaseExportDto(long id, long personId, long personAddressId, long epiDataI
this.vaccinationDoses = vaccinationDoses;
this.vaccinationDate = vaccinationDate;
this.vaccinationInfoSource = vaccinationInfoSource;
this.postpartum = postpartum;
this.trimester = trimester;
}

public CaseReferenceDto toReference() {
Expand Down Expand Up @@ -345,22 +351,38 @@ public YesNoUnknown getPregnant() {
}

@Order(14)
@ExportTarget(caseExportTypes = { CaseExportType.CASE_SURVEILLANCE, CaseExportType.CASE_MANAGEMENT })
@ExportProperty(CaseDataDto.TRIMESTER)
@ExportGroup(ExportGroupType.SENSITIVE)
public Trimester getTrimester() {
return trimester;
}

@Order(15)
@ExportTarget(caseExportTypes = { CaseExportType.CASE_SURVEILLANCE, CaseExportType.CASE_MANAGEMENT })
@ExportProperty(CaseDataDto.POSTPARTUM)
@ExportGroup(ExportGroupType.SENSITIVE)
public YesNoUnknown getPostpartum() {
return postpartum;
}

@Order(16)
@ExportTarget(caseExportTypes = {CaseExportType.CASE_SURVEILLANCE, CaseExportType.CASE_MANAGEMENT})
@ExportProperty(PersonDto.APPROXIMATE_AGE)
@ExportGroup(ExportGroupType.SENSITIVE)
public String getApproximateAge() {
return approximateAge;
}

@Order(15)
@Order(17)
@ExportTarget(caseExportTypes = {CaseExportType.CASE_SURVEILLANCE, CaseExportType.CASE_MANAGEMENT})
@ExportProperty(AGE_GROUP)
@ExportGroup(ExportGroupType.PERSON)
public String getAgeGroup() {
return ageGroup;
}

@Order(16)
@Order(18)
@ExportTarget(caseExportTypes = {CaseExportType.CASE_SURVEILLANCE, CaseExportType.CASE_MANAGEMENT})
@ExportProperty(PersonDto.BIRTH_DATE)
@ExportGroup(ExportGroupType.SENSITIVE)
Expand Down Expand Up @@ -922,6 +944,14 @@ public void setPregnant(YesNoUnknown pregnant) {
this.pregnant = pregnant;
}

public void setTrimester(Trimester trimester) {
this.trimester = trimester;
}

public void setPostpartum(YesNoUnknown postpartum) {
this.postpartum = postpartum;
}

public void setApproximateAge(String age) {
this.approximateAge = age;
}
Expand Down
12 changes: 12 additions & 0 deletions sormas-api/src/main/java/de/symeda/sormas/api/caze/Trimester.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.symeda.sormas.api.caze;

import de.symeda.sormas.api.i18n.I18nProperties;

public enum Trimester {

FIRST, SECOND, THIRD, UNKNOWN;

public String toString() {
return I18nProperties.getEnumCaption(this);
}
}
2 changes: 2 additions & 0 deletions sormas-api/src/main/resources/captions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ CaseData.pointOfEntry = Point of entry
CaseData.pointOfEntryDetails = Point of entry name & description
CaseData.pointOfEntryName = Point of entry
CaseData.portHealthInfo = Port health
CaseData.postpartum = Postpartum
CaseData.pregnant = Pregnancy
CaseData.regionLevelDate = Date received at region level
CaseData.reportDate = Date of report
Expand All @@ -242,6 +243,7 @@ CaseData.smallpoxVaccinationScar = Is a Smallpox vaccination scar present?
CaseData.surveillanceOfficer = Responsible surveillance officer
CaseData.symptoms = Symptoms
CaseData.therapy = Therapy
CaseData.trimester = Trimester
CaseData.uuid = Case ID
CaseData.vaccination = Vaccination status for this disease
CaseData.vaccinationDate = Date of last vaccination
Expand Down
6 changes: 6 additions & 0 deletions sormas-api/src/main/resources/enum.properties
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,12 @@ TreatmentType.INVASIVE_MECHANICAL_VENTILATION = Invasive mechanical ventilation
TreatmentType.VASOPRESSORS_INOTROPES = Vasopressors/Inotropes
TreatmentType.OTHER = Other

# Trimester
Trimester.FIRST = First
Trimester.SECOND = Second
Trimester.THIRD = Third
Trimester.UNKNOWN = Unknown

# TypeOfDrug
TypeOfDrug.ANTIMICROBIAL = Antimicrobial
TypeOfDrug.ANTIVIRAL = Antiviral
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import de.symeda.sormas.api.caze.InvestigationStatus;
import de.symeda.sormas.api.caze.PlagueType;
import de.symeda.sormas.api.caze.ReportingType;
import de.symeda.sormas.api.caze.Trimester;
import de.symeda.sormas.api.caze.Vaccination;
import de.symeda.sormas.api.caze.VaccinationInfoSource;
import de.symeda.sormas.api.contact.QuarantineType;
Expand Down Expand Up @@ -279,6 +280,10 @@ public class Case extends AbstractDomainObject {
private String quarantineHomeSupplyEnsuredComment;
@Enumerated(EnumType.STRING)
private ReportingType reportingType;
@Enumerated(EnumType.STRING)
private YesNoUnknown postpartum;
@Enumerated(EnumType.STRING)
private Trimester trimester;


public boolean isUnreferredPortHealthCase() {
Expand Down Expand Up @@ -874,4 +879,20 @@ public ReportingType getReportingType() {
public void setReportingType(ReportingType reportingType) {
this.reportingType = reportingType;
}

public YesNoUnknown getPostpartum() {
return postpartum;
}

public void setPostpartum(YesNoUnknown postpartum) {
this.postpartum = postpartum;
}

public Trimester getTrimester() {
return trimester;
}

public void setTrimester(Trimester trimester) {
this.trimester = trimester;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ public void fillInnerFromDto(Case target, CaseDataDto source) {
target.setQuarantineHomeSupplyEnsured(source.getQuarantineHomeSupplyEnsured());
target.setQuarantineHomeSupplyEnsuredComment(source.getQuarantineHomeSupplyEnsuredComment());
target.setReportingType(source.getReportingType());

target.setPostpartum(source.getPostpartum());
target.setTrimester(source.getTrimester());
}

@Override
Expand Down Expand Up @@ -350,6 +353,9 @@ public void fillInnerFromAdo(CaseDataDto target, Case source) {
target.setQuarantineHomeSupplyEnsured(source.getQuarantineHomeSupplyEnsured());
target.setQuarantineHomeSupplyEnsuredComment(source.getQuarantineHomeSupplyEnsuredComment());
target.setReportingType(source.getReportingType());

target.setPostpartum(source.getPostpartum());
target.setTrimester(source.getTrimester());
}

public static CaseReferenceDto toReferenceDto(Case ado) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
// name of the database file for your application. Stored in data/data/de.symeda.sormas.app/databases
public static final String DATABASE_NAME = "sormas.db";
// any time you make changes to your database objects, you may have to increase the database version
public static final int DATABASE_VERSION = 202;
public static final int DATABASE_VERSION = 203;

private static DatabaseHelper instance = null;
public static void init(Context context) {
Expand Down Expand Up @@ -1531,6 +1531,10 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int
case 201:
currentVersion = 201;
getDao(Contact.class).executeRaw("ALTER TABLE contacts ADD COLUMN additionalDetails varchar(512);");
case 202:
currentVersion = 202;
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN postpartum varchar(255);");
getDao(Case.class).executeRaw("ALTER TABLE cases ADD COLUMN trimester varchar(255);");

// ATTENTION: break should only be done after last version
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import de.symeda.sormas.api.caze.PlagueType;
import de.symeda.sormas.api.caze.RabiesType;
import de.symeda.sormas.api.caze.ReportingType;
import de.symeda.sormas.api.caze.Trimester;
import de.symeda.sormas.api.caze.Vaccination;
import de.symeda.sormas.api.caze.VaccinationInfoSource;
import de.symeda.sormas.api.contact.QuarantineType;
Expand Down Expand Up @@ -111,7 +112,8 @@ private void setUpFieldVisibilities(final FragmentCaseEditLayoutBinding contentB

// Pregnancy
if (record.getPerson().getSex() != Sex.FEMALE) {
contentBinding.caseDataPregnant.setVisibility(View.GONE);
contentBinding.caseDataPregnant.setVisibility(GONE);
contentBinding.caseDataPostpartum.setVisibility(GONE);
}

// Smallpox vaccination scar image
Expand Down Expand Up @@ -264,6 +266,7 @@ public void onChange(ControlPropertyField field) {
contentBinding.setData(record);
contentBinding.setYesNoUnknownClass(YesNoUnknown.class);
contentBinding.setVaccinationClass(Vaccination.class);
contentBinding.setTrimesterClass(Trimester.class);

InfrastructureHelper.initializeHealthFacilityDetailsFieldVisibility(contentBinding.caseDataHealthFacility,
contentBinding.caseDataHealthFacilityDetails);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private void setUpFieldVisibilities(FragmentCaseReadLayoutBinding contentBinding
// Pregnancy
if (record.getPerson().getSex() != Sex.FEMALE) {
contentBinding.caseDataPregnant.setVisibility(GONE);
contentBinding.caseDataPostpartum.setVisibility(GONE);
}

// Port Health fields
Expand Down
15 changes: 15 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 @@ -42,6 +42,7 @@
<variable name="data" type="de.symeda.sormas.app.backend.caze.Case"/>
<variable name="yesNoUnknownClass" type="Class" />
<variable name="vaccinationClass" type="Class" />
<variable name="trimesterClass" type="Class" />
</data>

<ScrollView
Expand Down Expand Up @@ -396,6 +397,20 @@
app:value="@={data.pregnant}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/caseData_trimester"
app:enumClass="@{trimesterClass}"
app:dependencyParentField="@{caseDataPregnant}"
app:dependencyParentValue="@{YesNoUnknown.YES}"
app:value="@={data.trimester}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/caseData_postpartum"
app:enumClass="@{yesNoUnknownClass}"
app:value="@={data.postpartum}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlSwitchField
android:id="@+id/caseData_vaccination"
app:enumClass="@{vaccinationClass}"
Expand Down
23 changes: 21 additions & 2 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 @@ -381,9 +381,28 @@
android:text="@string/heading_additional_medical_information"
style="@style/SubHeadingStyle" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

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

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

</LinearLayout>

<de.symeda.sormas.app.component.controls.ControlTextReadField
android:id="@+id/caseData_pregnant"
app:value="@{data.pregnant}"
android:id="@+id/caseData_trimester"
app:dependencyParentField="@{caseDataPregnant}"
app:dependencyParentValue="@{YesNoUnknown.YES}"
app:value="@{data.trimester}"
style="@style/ControlSingleColumnStyle" />

<de.symeda.sormas.app.component.controls.ControlTextReadField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import de.symeda.sormas.api.caze.PlagueType;
import de.symeda.sormas.api.caze.RabiesType;
import de.symeda.sormas.api.caze.ReportingType;
import de.symeda.sormas.api.caze.Trimester;
import de.symeda.sormas.api.caze.Vaccination;
import de.symeda.sormas.api.caze.VaccinationInfoSource;
import de.symeda.sormas.api.contact.QuarantineType;
Expand Down Expand Up @@ -139,6 +140,8 @@ public class Case extends CoreAdo {
public static final String QUARANTINE_HOME_SUPPLY_ENSURED = "quarantineHomeSupplyEnsured";
public static final String QUARANTINE_HOME_SUPPLY_ENSURED_COMMENT = "quarantineHomeSupplyEnsuredComment";
public static final String REPORTING_TYPE = "reportingType";
public static final String POSTPARTUM = "postpartum";
public static final String TRIMESTER = "trimester";

private Person person;
private String description;
Expand Down Expand Up @@ -236,6 +239,9 @@ public class Case extends CoreAdo {
private String quarantineHomeSupplyEnsuredComment;
private ReportingType reportingType;

private YesNoUnknown postpartum;
private Trimester trimester;

private List<Task> tasks;

@ManyToOne(cascade = {})
Expand Down Expand Up @@ -993,4 +999,22 @@ public ReportingType getReportingType() {
public void setReportingType(ReportingType reportingType) {
this.reportingType = reportingType;
}

@Enumerated(EnumType.STRING)
public YesNoUnknown getPostpartum() {
return postpartum;
}

public void setPostpartum(YesNoUnknown postpartum) {
this.postpartum = postpartum;
}

@Enumerated(EnumType.STRING)
public Trimester getTrimester() {
return trimester;
}

public void setTrimester(Trimester trimester) {
this.trimester = trimester;
}
}
Loading

0 comments on commit ed840db

Please sign in to comment.