Skip to content

Commit 5cb10e8

Browse files
leventegal-sheLevente Gal
andauthored
#13197 Add Survey filters to the cases view (#13274)
* #13197 Add Survey filters to the cases view * #13197 Add Survey filters to the cases view - fix UI issue --------- Co-authored-by: Levente Gal <levente.gal.ext@vitagroup.ag>
1 parent cbe1cf9 commit 5cb10e8

File tree

17 files changed

+337
-15
lines changed

17 files changed

+337
-15
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/caze/CaseCriteria.java

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import de.symeda.sormas.api.person.PresentCondition;
3737
import de.symeda.sormas.api.person.SymptomJournalStatus;
3838
import de.symeda.sormas.api.share.ExternalShareCriteria;
39+
import de.symeda.sormas.api.survey.SurveyReferenceDto;
3940
import de.symeda.sormas.api.user.UserReferenceDto;
4041
import de.symeda.sormas.api.user.UserRoleReferenceDto;
4142
import de.symeda.sormas.api.utils.DateFilterOption;
@@ -87,6 +88,10 @@ public class CaseCriteria extends CriteriaWithDateType implements ExternalShareC
8788
public static final String PERSON_LIKE = "personLike";
8889
public static final String JURISDICTION_TYPE = "jurisdictionType";
8990
public static final String ENTITY_RELEVANCE_STATUS = "relevanceStatus";
91+
public static final String SURVEY_ASSIGNED_FROM = "surveyAssignedFrom";
92+
public static final String SURVEY_ASSIGNED_TO = "surveyAssignedTo";
93+
public static final String SURVEY_RESPONSE_STATUS = "surveyResponseStatus";
94+
public static final String SURVEY = "survey";
9095

9196
private UserRoleReferenceDto reportingUserRole;
9297
private Disease disease;
@@ -154,6 +159,11 @@ public class CaseCriteria extends CriteriaWithDateType implements ExternalShareC
154159
private Boolean onlyShowCasesWithFulfilledReferenceDefinition;
155160
private String personLike;
156161
private Boolean withOwnership;
162+
private Date surveyAssignedFrom;
163+
private Date surveyAssignedTo;
164+
private SurveyResponseStatus surveyResponseStatus;
165+
private SurveyReferenceDto survey;
166+
157167
/**
158168
* Used for filtering merge-able cases to filter both lead and similar cases.
159169
*/
@@ -833,4 +843,36 @@ public CaseCriteria caseReferenceNumber(String caseReferenceNumber) {
833843
this.caseReferenceNumber = caseReferenceNumber;
834844
return this;
835845
}
846+
847+
public Date getSurveyAssignedFrom() {
848+
return surveyAssignedFrom;
849+
}
850+
851+
public void setSurveyAssignedFrom(Date surveyAssignedFrom) {
852+
this.surveyAssignedFrom = surveyAssignedFrom;
853+
}
854+
855+
public Date getSurveyAssignedTo() {
856+
return surveyAssignedTo;
857+
}
858+
859+
public void setSurveyAssignedTo(Date surveyAssignedTo) {
860+
this.surveyAssignedTo = surveyAssignedTo;
861+
}
862+
863+
public SurveyResponseStatus getSurveyResponseStatus() {
864+
return surveyResponseStatus;
865+
}
866+
867+
public void setSurveyResponseStatus(SurveyResponseStatus surveyResponseStatus) {
868+
this.surveyResponseStatus = surveyResponseStatus;
869+
}
870+
871+
public SurveyReferenceDto getSurvey() {
872+
return survey;
873+
}
874+
875+
public void setSurvey(SurveyReferenceDto survey) {
876+
this.survey = survey;
877+
}
836878
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2025 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
package de.symeda.sormas.api.caze;
20+
21+
import de.symeda.sormas.api.i18n.I18nProperties;
22+
23+
public enum SurveyResponseStatus {
24+
RECEIVED,
25+
NOT_RECEIVED;
26+
27+
@Override
28+
public String toString() {
29+
return I18nProperties.getEnumCaption(this);
30+
}
31+
}

sormas-api/src/main/java/de/symeda/sormas/api/i18n/Strings.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,11 @@ public interface Strings {
18041804
String promptSelfReportEpiWeekFrom = "promptSelfReportEpiWeekFrom";
18051805
String promptSelfReportEpiWeekTo = "promptSelfReportEpiWeekTo";
18061806
String promptSelfReportFreeTextSearch = "promptSelfReportFreeTextSearch";
1807+
String promptSurvey = "promptSurvey";
1808+
String promptSurveyAssignedFrom = "promptSurveyAssignedFrom";
1809+
String promptSurveyAssignedTo = "promptSurveyAssignedTo";
18071810
String promptSurveyFreeTextSearch = "promptSurveyFreeTextSearch";
1811+
String promptSurveyResponseStatus = "promptSurveyResponseStatus";
18081812
String promptTaskDateFrom = "promptTaskDateFrom";
18091813
String promptTaskDateTo = "promptTaskDateTo";
18101814
String promptTaskDateType = "promptTaskDateType";

sormas-api/src/main/java/de/symeda/sormas/api/survey/SurveyFacade.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,6 @@ void uploadEmailTemplate(@NotNull SurveyReferenceDto surveyReference, DocumentTe
6565
boolean hasUnassignedTokens(SurveyReferenceDto survey);
6666

6767
DocumentVariables getDocumentVariables(SurveyReferenceDto surveyRef) throws DocumentTemplateException;
68+
69+
List<SurveyReferenceDto> getAllAsReference();
6870
}

sormas-api/src/main/java/de/symeda/sormas/api/survey/SurveyReferenceDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class SurveyReferenceDto extends ReferenceDto {
2121

2222
private static final long serialVersionUID = -8612115227784272980L;
2323

24+
public SurveyReferenceDto() {
25+
}
26+
2427
public SurveyReferenceDto(String uuid, String surveyName) {
2528
setUuid(uuid);
2629
setCaption(surveyName != null ? surveyName : "");

sormas-api/src/main/java/de/symeda/sormas/api/survey/SurveyTokenDto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ public static SurveyTokenDto build() {
6363
return token;
6464
}
6565

66-
public static SurveyTokenDto build(SurveyDto survey) {
66+
public static SurveyTokenDto build(SurveyReferenceDto survey) {
6767
SurveyTokenDto token = new SurveyTokenDto();
6868
token.setUuid(DataHelper.createUuid());
69-
token.setSurvey(new SurveyReferenceDto(survey.getUuid(), survey.getName()));
69+
token.setSurvey(survey);
7070

7171
return token;
7272
}

sormas-api/src/main/resources/enum.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,4 +2491,8 @@ AefiClassification.UNDETERMINED=Undetermined
24912491
AefiClassificationSubType.VACCINE_PRODUCT_RELATED=Vaccine product related
24922492
AefiClassificationSubType.VACCINE_QUALITY_DEFECT_RELATED=Vaccine quality defect related
24932493
AefiClassificationSubType.IMMUNIZATION_ERROR_RELATED=Immunization error related
2494-
AefiClassificationSubType.IMMUNIZATION_ANXIETY_RELATED=Immunization anxiety related
2494+
AefiClassificationSubType.IMMUNIZATION_ANXIETY_RELATED=Immunization anxiety related
2495+
2496+
# SurveyResponseStatus
2497+
SurveyResponseStatus.RECEIVED=Response received
2498+
SurveyResponseStatus.NOT_RECEIVED=No response received

sormas-api/src/main/resources/strings.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,11 @@ promptCustomizableEnumSearchField = Search by value or caption...
18221822

18231823
promptSurveyFreeTextSearch = Name
18241824

1825+
promptSurvey=Survey
1826+
promptSurveyResponseStatus=Response status
1827+
promptSurveyAssignedFrom=Assigned date from ...
1828+
promptSurveyAssignedTo=... to
1829+
18251830
# Unsaved changes
18261831
unsavedChanges.warningTitle = Unsaved changes
18271832
unsavedChanges.warningMessage = This form contains unsaved changes. Please decide whether you want to cancel the action you have just taken in order to review them, or save or discard the changes and continue.

sormas-backend/src/main/java/de/symeda/sormas/backend/caze/Case.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
import de.symeda.sormas.backend.sormastosormas.origin.SormasToSormasOriginInfo;
9797
import de.symeda.sormas.backend.sormastosormas.share.outgoing.SormasToSormasShareInfo;
9898
import de.symeda.sormas.backend.specialcaseaccess.SpecialCaseAccess;
99+
import de.symeda.sormas.backend.survey.SurveyToken;
99100
import de.symeda.sormas.backend.symptoms.Symptoms;
100101
import de.symeda.sormas.backend.task.Task;
101102
import de.symeda.sormas.backend.therapy.Therapy;
@@ -245,6 +246,7 @@ public class Case extends CoreAdo implements IsCase, SormasToSormasShareable, Ha
245246
public static final String CREATION_VERSION = "creationVersion";
246247
public static final String SPECIAL_CASE_ACCESSES = "specialCaseAccesses";
247248
public static final String SELF_REPORT = "selfReport";
249+
public static final String SURVEY_TOKENS = "surveyTokens";
248250

249251
private Person person;
250252
private String description;
@@ -430,6 +432,8 @@ public class Case extends CoreAdo implements IsCase, SormasToSormasShareable, Ha
430432

431433
private List<SelfReport> selfReport;
432434

435+
private List<SurveyToken> surveyTokens;
436+
433437
public static Case build() {
434438
Case caze = new Case();
435439
caze.setSystemCaseClassification(CaseClassification.NOT_CLASSIFIED);
@@ -1788,4 +1792,13 @@ public List<SelfReport> getSelfReport() {
17881792
public void setSelfReport(List<SelfReport> selfReport) {
17891793
this.selfReport = selfReport;
17901794
}
1795+
1796+
@OneToMany(mappedBy = SurveyToken.CASE_ASSIGNED_TO, fetch = FetchType.LAZY)
1797+
public List<SurveyToken> getSurveyTokens() {
1798+
return surveyTokens;
1799+
}
1800+
1801+
public void setSurveyTokens(List<SurveyToken> surveyTokens) {
1802+
this.surveyTokens = surveyTokens;
1803+
}
17911804
}

sormas-backend/src/main/java/de/symeda/sormas/backend/caze/CaseJoins.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
import de.symeda.sormas.backend.share.ExternalShareInfo;
4545
import de.symeda.sormas.backend.sormastosormas.share.outgoing.SormasToSormasShareInfo;
4646
import de.symeda.sormas.backend.specialcaseaccess.SpecialCaseAccess;
47+
import de.symeda.sormas.backend.survey.SurveyToken;
48+
import de.symeda.sormas.backend.survey.SurveyTokenJoins;
4749
import de.symeda.sormas.backend.symptoms.Symptoms;
4850
import de.symeda.sormas.backend.user.User;
4951
import de.symeda.sormas.backend.visit.Visit;
@@ -80,6 +82,8 @@ public class CaseJoins extends QueryJoins<Case> {
8082
private SampleJoins sampleJoins;
8183
private EventParticipantJoins eventParticipantJoins;
8284
private Join<Case, SpecialCaseAccess> specialCaseAccesses;
85+
private Join<Case, SurveyToken> surveyTokens;
86+
private SurveyTokenJoins surveyTokenJoins;
8387

8488
public CaseJoins(From<?, Case> caze) {
8589
super(caze);
@@ -344,4 +348,20 @@ public Join<Case, SpecialCaseAccess> getSpecialCaseAccesses() {
344348
private void setSpecialCaseAccesses(Join<Case, SpecialCaseAccess> specialCaseAccesses) {
345349
this.specialCaseAccesses = specialCaseAccesses;
346350
}
351+
352+
public Join<Case, SurveyToken> getSurveyTokens() {
353+
return getOrCreate(surveyTokens, Case.SURVEY_TOKENS, JoinType.LEFT, this::setSurveyTokens);
354+
}
355+
356+
private void setSurveyTokens(Join<Case, SurveyToken> surveyTokens) {
357+
this.surveyTokens = surveyTokens;
358+
}
359+
360+
public SurveyTokenJoins getSurveyTokenJoins() {
361+
return getOrCreate(surveyTokenJoins, () -> new SurveyTokenJoins(getSurveyTokens()), this::setSurveyTokenJoins);
362+
}
363+
364+
private void setSurveyTokenJoins(SurveyTokenJoins surveyTokenJoins) {
365+
this.surveyTokenJoins = surveyTokenJoins;
366+
}
347367
}

0 commit comments

Comments
 (0)