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 2fba885f082..f14c7de5135 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 @@ -190,7 +190,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { 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 = 359; + public static final int DATABASE_VERSION = 360; private static DatabaseHelper instance = null; @@ -398,7 +398,7 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int // IMPORTANT: table and column names are CASE SENSITIVE! int currentVersion = oldVersion; try { - switch (oldVersion) { + switch (newVersion) { case 91: currentVersion = 91; getDao(District.class).executeRaw("ALTER TABLE district ADD COLUMN epidCode varchar(255);"); @@ -3201,8 +3201,28 @@ public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource, int getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN septicaemia varchar(255);"); getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN whoopsound varchar(255);"); - // ATTENTION: break should only be done after last version - break; + case 360: + currentVersion = 360; + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN acuteEncephalitis varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN eggyBurps varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN weightLoss varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN weightLossAmount float8;"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN reoccurrence varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN symptomCurrentStatus varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN durationOfSymptoms int;"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN overnightStayRequired varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN bloating varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN difficultyBreathingDuringMeals varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN paradoxicalBreathing varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN respiratoryFatigue varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN parentTimeOffWork varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN timeOffWorkDays float8;"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN unknownSymptom varchar(255);"); + getDao(Symptoms.class).executeRaw("ALTER TABLE symptoms ADD COLUMN skinRashOnsetDate timestamp;"); + + + // ATTENTION: break should only be done after last version + break; diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDao.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDao.java index 67c548a0da0..17326caca2d 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDao.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/contact/ContactDao.java @@ -219,7 +219,19 @@ private QueryBuilder buildQueryBuilder(ContactCriteria contactCri // Only use user filter if no restricting case is specified if (contactCriteria.getIncludeContactsFromOtherJurisdictions().equals(false)) { - whereStatements.add(where.or(createJurisdictionFilterForCase(where), createJurisdictionFilter(where))); +// whereStatements.add(where.or(createJurisdictionFilterForCase(where), createJurisdictionFilter(where))); + Where caseJurisdictionWhere = createJurisdictionFilterForCase(where); + Where jurisdictionWhere = createJurisdictionFilter(where); + if (caseJurisdictionWhere != null && jurisdictionWhere != null) { + whereStatements.add(where.or(caseJurisdictionWhere, jurisdictionWhere)); + } else { + if (caseJurisdictionWhere != null) { + whereStatements.add(caseJurisdictionWhere); + } + if (jurisdictionWhere != null) { + whereStatements.add(jurisdictionWhere); + } + } } if (contactCriteria != null) { @@ -283,8 +295,9 @@ public Where createJurisdictionFilterForCase(Where if (!whereJurisdictionFilterStatements.isEmpty()) { where.or(whereJurisdictionFilterStatements.size()); + return where; } - return where; + return null; } public Where createJurisdictionFilter(Where where) throws SQLException { @@ -316,9 +329,10 @@ public Where createJurisdictionFilter(Where where) if (!whereUserFilterStatements.isEmpty()) { where.or(whereUserFilterStatements.size()); + return where; } - return where; + return null; } public Where createCriteriaFilter(List> whereStatements, Where where, ContactCriteria criteria) diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/Symptoms.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/Symptoms.java index df6fab2dd66..8fb2a1b4e44 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/Symptoms.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/Symptoms.java @@ -473,6 +473,41 @@ public class Symptoms extends PseudonymizableAdo { private SymptomState shivering; @Enumerated(EnumType.STRING) private ClinicalPresentationStatus clinicalPresentationStatus; + @Enumerated(EnumType.STRING) + private SymptomState acuteEncephalitis; + @Enumerated(EnumType.STRING) + private SymptomState eggyBurps; + @Enumerated(EnumType.STRING) + private SymptomState weightLoss; + @Column + private Float weightLossAmount; + @Enumerated(EnumType.STRING) + private SymptomState reoccurrence; + @Enumerated(EnumType.STRING) + private SymptomState symptomCurrentStatus; + @Column + private Integer durationOfSymptoms; + @Enumerated(EnumType.STRING) + private SymptomState overnightStayRequired; + @Enumerated(EnumType.STRING) + private SymptomState bloating; + + @Enumerated(EnumType.STRING) + private SymptomState difficultyBreathingDuringMeals; + @Enumerated(EnumType.STRING) + private SymptomState paradoxicalBreathing; + @Enumerated(EnumType.STRING) + private SymptomState respiratoryFatigue; + @Enumerated(EnumType.STRING) + private YesNoUnknown parentTimeOffWork; + @Column + private Float timeOffWorkDays; + @Enumerated(EnumType.STRING) + private SymptomState unknownSymptom; + @DatabaseField(dataType = DataType.DATE_LONG) + private Date skinRashOnsetDate; + + @Override public String getI18nPrefix() { @@ -2045,4 +2080,136 @@ public ClinicalPresentationStatus getClinicalPresentationStatus() { public void setClinicalPresentationStatus(ClinicalPresentationStatus clinicalPresentationStatus) { this.clinicalPresentationStatus = clinicalPresentationStatus; } + + public SymptomState getBloating() { + return bloating; + } + + public void setBloating(SymptomState bloating) { + this.bloating = bloating; + } + + public SymptomState getOvernightStayRequired() { + return overnightStayRequired; + } + + public void setOvernightStayRequired(SymptomState overnightStayRequired) { + this.overnightStayRequired = overnightStayRequired; + } + + public Integer getDurationOfSymptoms() { + return durationOfSymptoms; + } + + public void setDurationOfSymptoms(Integer durationOfSymptoms) { + this.durationOfSymptoms = durationOfSymptoms; + } + + public SymptomState getSymptomCurrentStatus() { + return symptomCurrentStatus; + } + + public void setSymptomCurrentStatus(SymptomState symptomCurrentStatus) { + this.symptomCurrentStatus = symptomCurrentStatus; + } + + public SymptomState getReoccurrence() { + return reoccurrence; + } + + public void setReoccurrence(SymptomState reoccurrence) { + this.reoccurrence = reoccurrence; + } + + public Float getWeightLossAmount() { + return weightLossAmount; + } + + public void setWeightLossAmount(Float weightLossAmount) { + this.weightLossAmount = weightLossAmount; + } + + public SymptomState getWeightLoss() { + return weightLoss; + } + + public void setWeightLoss(SymptomState weightLoss) { + this.weightLoss = weightLoss; + } + + public SymptomState getEggyBurps() { + return eggyBurps; + } + + public void setEggyBurps(SymptomState eggyBurps) { + this.eggyBurps = eggyBurps; + } + + public SymptomState getAcuteEncephalitis() { + return acuteEncephalitis; + } + + public void setAcuteEncephalitis(SymptomState acuteEncephalitis) { + this.acuteEncephalitis = acuteEncephalitis; + } + + public Float getTimeOffWorkDays() { + return timeOffWorkDays; + } + + public void setTimeOffWorkDays(Float timeOffWorkDays) { + this.timeOffWorkDays = timeOffWorkDays; + } + + public YesNoUnknown getParentTimeOffWork() { + return parentTimeOffWork; + } + + public void setParentTimeOffWork(YesNoUnknown parentTimeOffWork) { + this.parentTimeOffWork = parentTimeOffWork; + } + + public SymptomState getRespiratoryFatigue() { + return respiratoryFatigue; + } + + public void setRespiratoryFatigue(SymptomState respiratoryFatigue) { + this.respiratoryFatigue = respiratoryFatigue; + } + + public SymptomState getParadoxicalBreathing() { + return paradoxicalBreathing; + } + + public void setParadoxicalBreathing(SymptomState paradoxicalBreathing) { + this.paradoxicalBreathing = paradoxicalBreathing; + } + + public SymptomState getDifficultyBreathingDuringMeals() { + return difficultyBreathingDuringMeals; + } + + public void setDifficultyBreathingDuringMeals(SymptomState difficultyBreathingDuringMeals) { + this.difficultyBreathingDuringMeals = difficultyBreathingDuringMeals; + } + + public void setNocturnalCough(SymptomState nocturnalCough) { + this.nocturnalCough = nocturnalCough; + } + + public Date getSkinRashOnsetDate() { + return skinRashOnsetDate; + } + + public void setSkinRashOnsetDate(Date skinRashOnsetDate) { + this.skinRashOnsetDate = skinRashOnsetDate; + } + + public SymptomState getUnknownSymptom() { + return unknownSymptom; + } + + public void setUnknownSymptom(SymptomState unknownSymptom) { + this.unknownSymptom = unknownSymptom; + } } diff --git a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/SymptomsDtoHelper.java b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/SymptomsDtoHelper.java index 42caefd61f2..43902c2069f 100644 --- a/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/SymptomsDtoHelper.java +++ b/sormas-app/app/src/main/java/de/symeda/sormas/app/backend/symptoms/SymptomsDtoHelper.java @@ -235,6 +235,23 @@ public void fillInnerFromDto(Symptoms target, SymptomsDto source) { target.setHighOrLowBloodPressure(source.getHighOrLowBloodPressure()); target.setUrinaryRetention(source.getUrinaryRetention()); target.setShivering(source.getShivering()); + target.setAcuteEncephalitis(source.getAcuteEncephalitis()); + target.setEggyBurps(source.getEggyBurps()); + target.setWeightLoss(source.getWeightLoss()); + target.setWeightLossAmount(source.getWeightLossAmount()); + target.setReoccurrence(source.getReoccurrence()); + target.setSymptomCurrentStatus(source.getSymptomCurrentStatus()); + target.setDurationOfSymptoms(source.getDurationOfSymptoms()); + target.setOvernightStayRequired(source.getOvernightStayRequired()); + target.setBloating(source.getBloating()); + target.setDifficultyBreathing(source.getDifficultyBreathing()); + target.setParadoxicalBreathing(source.getParadoxicalBreathing()); + target.setRespiratoryFatigue(source.getRespiratoryFatigue()); + target.setParentTimeOffWork(source.getParentTimeOffWork()); + target.setTimeOffWorkDays(source.getTimeOffWorkDays()); + target.setUnknownSymptom(source.getUnknownSymptom()); + target.setSkinRashOnsetDate(source.getSkinRashOnsetDate()); + target.setAsymptomatic(source.getAsymptomatic()); target.setPseudonymized(source.isPseudonymized()); } @@ -421,6 +438,23 @@ public void fillInnerFromAdo(SymptomsDto target, Symptoms source) { target.setHighOrLowBloodPressure(source.getHighOrLowBloodPressure()); target.setUrinaryRetention(source.getUrinaryRetention()); target.setShivering(source.getShivering()); + target.setAcuteEncephalitis(source.getAcuteEncephalitis()); + target.setEggyBurps(source.getEggyBurps()); + target.setWeightLoss(source.getWeightLoss()); + target.setWeightLossAmount(source.getWeightLossAmount()); + target.setReoccurrence(source.getReoccurrence()); + target.setSymptomCurrentStatus(source.getSymptomCurrentStatus()); + target.setDurationOfSymptoms(source.getDurationOfSymptoms()); + target.setOvernightStayRequired(source.getOvernightStayRequired()); + target.setBloating(source.getBloating()); + target.setDifficultyBreathing(source.getDifficultyBreathing()); + target.setParadoxicalBreathing(source.getParadoxicalBreathing()); + target.setRespiratoryFatigue(source.getRespiratoryFatigue()); + target.setParentTimeOffWork(source.getParentTimeOffWork()); + target.setTimeOffWorkDays(source.getTimeOffWorkDays()); + target.setUnknownSymptom(source.getUnknownSymptom()); + target.setSkinRashOnsetDate(source.getSkinRashOnsetDate()); + target.setAsymptomatic(source.getAsymptomatic()); target.setPseudonymized(source.isPseudonymized()); }