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 47029c5347c..db58d3b71a5 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 @@ -218,7 +218,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 = 402; + public static final int DATABASE_VERSION = 403; private static DatabaseHelper instance = null; @@ -3917,6 +3917,24 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int currentVersion = 401; getDao(Hospitalization.class).executeRaw("ALTER TABLE hospitalizations ADD COLUMN diseaseOnsetDate Date;"); + case 402: + currentVersion = 402; + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN appearanceOfCsf varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN inoculationTimeTransportMedia Date;"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN sampleSentToLab varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateSampleSentToLab Date;"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN sampleContainerUsed varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN containerOther varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN rdtPerformed varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN rdtResults varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN districtNotificationDate Date;"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN nameOfPerson varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN telNumber varchar(255);"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormSentToRegion Date;"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormReceivedAtRegion Date;"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormSentToNational Date;"); + getDao(Sample.class).executeRaw("ALTER TABLE samples ADD COLUMN dateFormReceivedAtNational Date;"); + // ATTENTION: break should only be done after last version break; diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/Sample.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/Sample.java index 7ae2fdca950..cbcc2376f18 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/Sample.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/Sample.java @@ -48,6 +48,8 @@ import de.symeda.sormas.api.sample.SampleSource; import de.symeda.sormas.api.sample.SamplingReason; import de.symeda.sormas.api.sample.SpecimenCondition; +import de.symeda.sormas.api.utils.CsfAppearance; +import de.symeda.sormas.api.utils.SampleContainerUsed; import de.symeda.sormas.api.utils.YesNo; import de.symeda.sormas.api.utils.YesNoUnknown; import de.symeda.sormas.api.utils.pseudonymization.SampleDispatchMode; @@ -289,7 +291,36 @@ public class Sample extends PseudonymizableAdo { @Column(length = CHARACTER_LIMIT_DEFAULT) private String personCompletingForm; - + @Enumerated(EnumType.STRING) + private CsfAppearance appearanceOfCsf; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date inoculationTimeTransportMedia; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date dateSampleSentToLab; + @Enumerated(EnumType.STRING) + private YesNo sampleSentToLab; + @Enumerated(EnumType.STRING) + private SampleContainerUsed sampleContainerUsed; + @Column(length = CHARACTER_LIMIT_DEFAULT) + private String containerOther; + @Enumerated(EnumType.STRING) + private YesNo rdtPerformed; + @Column(length = CHARACTER_LIMIT_DEFAULT) + private String rdtResults; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date districtNotificationDate; + @Column(length = CHARACTER_LIMIT_DEFAULT) + private String nameOfPerson; + @Column(length = CHARACTER_LIMIT_DEFAULT) + private String telNumber; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date dateFormSentToRegion; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date dateFormReceivedAtRegion; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date dateFormSentToNational; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date dateFormReceivedAtNational; public Case getAssociatedCase() { @@ -1015,4 +1046,115 @@ public YesNo getHasSampleBeenCollected() { public void setHasSampleBeenCollected(YesNo hasSampleBeenCollected) { this.hasSampleBeenCollected = hasSampleBeenCollected; } + + public CsfAppearance getAppearanceOfCsf() {return appearanceOfCsf; } + public void setAppearanceOfCsf(CsfAppearance appearanceOfCsf) { + this.appearanceOfCsf = appearanceOfCsf; + } + + public Date getInoculationTimeTransportMedia() { + return inoculationTimeTransportMedia; + } + + public void setInoculationTimeTransportMedia(Date inoculationTimeTransportMedia) { + this.inoculationTimeTransportMedia = inoculationTimeTransportMedia; + } + public YesNo getSampleSentToLab() { + return sampleSentToLab; + } + public void setSampleSentToLab(YesNo sampleSentToLab) { + this.sampleSentToLab = sampleSentToLab; + } + + public Date getDateSampleSentToLab() { + return dateSampleSentToLab; + } + + public void setDateSampleSentToLab(Date dateSampleSentToLab) { + this.dateSampleSentToLab = dateSampleSentToLab; + } + + public SampleContainerUsed getSampleContainerUsed() { + return sampleContainerUsed; + } + public void setSampleContainerUsed(SampleContainerUsed sampleContainerUsed) { + this.sampleContainerUsed = sampleContainerUsed; + } + + public String getContainerOther() { + return containerOther; + } + + public void setContainerOther(String containerOther) { + this.containerOther = containerOther; + } + + public YesNo getRdtPerformed() { + return rdtPerformed; + } + public void setRdtPerformed(YesNo rdtPerformed) { + this.rdtPerformed = rdtPerformed; + } + + public String getRdtResults() { + return rdtResults; + } + + public void setRdtResults(String rdtResults) { + this.rdtResults = rdtResults; + } + + public Date getDistrictNotificationDate() { + return districtNotificationDate; + } + + public void setDistrictNotificationDate(Date districtNotificationDate) { + this.districtNotificationDate = districtNotificationDate; + } + public String getNameOfPerson() { + return nameOfPerson; + } + + public void setNameOfPerson(String nameOfPerson) { + this.nameOfPerson = nameOfPerson; + } + public String getTelNumber() { + return telNumber; + } + + public void setTelNumber(String telNumber) { + this.telNumber = telNumber; + } + + public Date getDateFormSentToRegion() { + return dateFormSentToRegion; + } + + public void setDateFormSentToRegion(Date dateFormSentToRegion) { + this.dateFormSentToRegion = dateFormSentToRegion; + } + + public Date getDateFormReceivedAtRegion() { + return dateFormReceivedAtRegion; + } + + public void setDateFormReceivedAtRegion(Date dateFormReceivedAtRegion) { + this.dateFormReceivedAtRegion = dateFormReceivedAtRegion; + } + + public Date getDateFormSentToNational() { + return dateFormSentToNational; + } + + public void setDateFormSentToNational(Date dateFormSentToNational) { + this.dateFormSentToNational = dateFormSentToNational; + } + + public Date getDateFormReceivedAtNational() { + return dateFormReceivedAtNational; + } + + public void setDateFormReceivedAtNational(Date dateFormReceivedAtNational) { + this.dateFormReceivedAtNational = dateFormReceivedAtNational; + } } diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/SampleDtoHelper.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/SampleDtoHelper.java index 9663355de37..4a0e523cc6f 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/SampleDtoHelper.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/sample/SampleDtoHelper.java @@ -253,6 +253,21 @@ public void fillInnerFromAdo(SampleDto target, Sample source) { target.setPseudonymized(source.isPseudonymized()); target.setRequestedSampleMaterials(source.getRequestedSampleMaterials()); target.setHasSampleBeenCollected(source.getHasSampleBeenCollected()); + target.setAppearanceOfCsf(source.getAppearanceOfCsf()); + target.setInoculationTimeTransportMedia(source.getInoculationTimeTransportMedia()); + target.setSampleSentToLab(source.getSampleSentToLab()); + target.setDateSampleSentToLab(source.getDateSampleSentToLab()); + target.setSampleContainerUsed(source.getSampleContainerUsed()); + target.setContainerOther(source.getContainerOther()); + target.setRdtPerformed(source.getRdtPerformed()); + target.setRdtResults(source.getRdtResults()); + target.setDistrictNotificationDate(source.getDistrictNotificationDate()); + target.setNameOfPerson(source.getNameOfPerson()); + target.setTelNumber(source.getTelNumber()); + target.setDateFormSentToRegion(source.getDateFormSentToRegion()); + target.setDateFormReceivedAtRegion(source.getDateFormReceivedAtRegion()); + target.setDateFormSentToNational(source.getDateFormSentToNational()); + target.setDateFormReceivedAtNational(source.getDateFormReceivedAtNational()); } @Override diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/sample/edit/SampleEditFragment.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/sample/edit/SampleEditFragment.java index 81a64c75ada..d332d9ca658 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/sample/edit/SampleEditFragment.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/sample/edit/SampleEditFragment.java @@ -53,6 +53,8 @@ import de.symeda.sormas.api.sample.SamplingReason; import de.symeda.sormas.api.sample.SpecimenCondition; import de.symeda.sormas.api.user.UserRight; +import de.symeda.sormas.api.utils.CsfAppearance; +import de.symeda.sormas.api.utils.SampleContainerUsed; import de.symeda.sormas.api.utils.YesNo; import de.symeda.sormas.api.utils.fieldaccess.UiFieldAccessCheckers; import de.symeda.sormas.api.utils.fieldvisibility.FieldVisibilityCheckers; @@ -249,6 +251,8 @@ public void onLayoutBinding(FragmentSampleEditLayoutBinding contentBinding) { contentBinding.setYesNoClass(YesNo.class); contentBinding.setIpSampleTestTypeClass(IpSampleTestType.class); contentBinding.setSampleMaterialClass(SampleMaterial.class); + contentBinding.setCsfAppearanceClass(CsfAppearance.class); + contentBinding.setSampleContainerUsedClass(SampleContainerUsed.class); contentBinding.sampleSelectedResultIGM.initializeSpinner(posNegEqList); contentBinding.sampleSelectedResultPcr.initializeSpinner(posNegList); @@ -269,6 +273,13 @@ public void onLayoutBinding(FragmentSampleEditLayoutBinding contentBinding) { contentBinding.sampleDateFormReceivedAtDistrict.initializeDateField(getFragmentManager()); contentBinding.sampleDateFormSentToDistrict.initializeDateField(getFragmentManager()); contentBinding.sampleDateFormSentToHigherLevel.initializeDateField(getFragmentManager()); + contentBinding.sampleInoculationTimeTransportMedia.initializeDateField(getFragmentManager()); + contentBinding.sampleDateSampleSentToLab.initializeDateField(getFragmentManager()); + contentBinding.sampleDistrictNotificationDate.initializeDateField(getFragmentManager()); + contentBinding.sampleDateFormSentToRegion.initializeDateField(getFragmentManager()); + contentBinding.sampleDateFormReceivedAtRegion.initializeDateField(getFragmentManager()); + contentBinding.sampleDateFormSentToNational.initializeDateField(getFragmentManager()); + contentBinding.sampleDateFormReceivedAtNational.initializeDateField(getFragmentManager()); if(record.getAssociatedCase().getDisease() != null){ super.hideFieldsForDisease(record.getAssociatedCase().getDisease(), contentBinding.mainContent, FormType.SAMPLE_EDIT); @@ -446,6 +457,8 @@ public void onAfterLayoutBinding(final FragmentSampleEditLayoutBinding contentBi handleAHF(); case NEW_INFLUENZA: handleILI(); + case CSM: + handleCSM(); } @@ -571,4 +584,23 @@ private void handleILI() { getContentBinding().sampleSampleMaterial.initializeSpinner(DataUtils.toItems(iliSampleMaterialList)); } + private void handleCSM() { + getContentBinding().samplePurpose.setValue(SamplePurpose.EXTERNAL); + getContentBinding().samplePurpose.setVisibility(GONE); + getContentBinding().sampleHasSampleBeenCollected.setCaption("CSF Sample Collected? Note: If NO, (Please STILL complete the form and send to district control officer)"); + + if (getContentBinding().sampleHasSampleBeenCollected.getValue() == null) { + getContentBinding().sampleSampleDateTime.setVisibility(View.GONE); + } else { + int visibility = (getContentBinding().sampleHasSampleBeenCollected.getValue() == YesNo.YES ? View.VISIBLE : View.GONE); + getContentBinding().sampleSampleDateTime.setVisibility(visibility); + } + + getContentBinding().sampleHasSampleBeenCollected.addValueChangedListener(field -> { + int visibility = (field.getValue() == YesNo.YES ? View.VISIBLE : View.GONE); + getContentBinding().sampleSampleDateTime.setVisibility(visibility); + }); + + } + } diff --git a/sormas-app/app/src/main/res/layout/fragment_sample_edit_layout.xml b/sormas-app/app/src/main/res/layout/fragment_sample_edit_layout.xml index abeca518475..7877cccc65a 100644 --- a/sormas-app/app/src/main/res/layout/fragment_sample_edit_layout.xml +++ b/sormas-app/app/src/main/res/layout/fragment_sample_edit_layout.xml @@ -39,6 +39,7 @@ + @@ -51,6 +52,8 @@ + + @@ -639,6 +643,115 @@ app:value="@={data.remarks}" style="@style/ControlSingleColumnStyle" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +