Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit 00e74c3

Browse files
lgallgal
authored andcommitted
SORMAS-Foundation#3411 export salutation
1 parent 281746c commit 00e74c3

9 files changed

Lines changed: 92 additions & 18 deletions

File tree

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

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@
4848
import de.symeda.sormas.api.person.PersonDto;
4949
import de.symeda.sormas.api.person.PersonHelper;
5050
import de.symeda.sormas.api.person.PresentCondition;
51+
import de.symeda.sormas.api.person.Salutation;
5152
import de.symeda.sormas.api.person.Sex;
5253
import de.symeda.sormas.api.sample.PathogenTestResultType;
5354
import de.symeda.sormas.api.symptoms.SymptomsDto;
55+
import de.symeda.sormas.api.utils.EnumHelper;
5456
import de.symeda.sormas.api.utils.HideForCountriesExcept;
5557
import de.symeda.sormas.api.utils.Order;
5658
import de.symeda.sormas.api.utils.PersonalData;
@@ -122,6 +124,8 @@ public class CaseExportDto implements Serializable {
122124
@PersonalData
123125
@SensitiveData
124126
private String lastName;
127+
@SensitiveData
128+
private String salutation;
125129
private Sex sex;
126130
private YesNoUnknown pregnant;
127131
private String approximateAge;
@@ -242,7 +246,7 @@ public class CaseExportDto implements Serializable {
242246
//@formatter:off
243247
public CaseExportDto(long id, long personId, long personAddressId, long epiDataId, long symptomsId,
244248
long hospitalizationId, long districtId, long healthConditionsId, String uuid, String epidNumber,
245-
Disease disease, String diseaseDetails, String firstName, String lastName, Sex sex, YesNoUnknown pregnant,
249+
Disease disease, String diseaseDetails, String firstName, String lastName, Salutation salutation, String otherSalutation, Sex sex, YesNoUnknown pregnant,
246250
Integer approximateAge, ApproximateAgeType approximateAgeType, Integer birthdateDD, Integer birthdateMM,
247251
Integer birthdateYYYY, Date reportDate, String reportingUserUuid, String regionUuid, String region,
248252
String districtUuid, String district, String communityUuid, String community,
@@ -281,6 +285,7 @@ public CaseExportDto(long id, long personId, long personAddressId, long epiDataI
281285
this.disease = disease;
282286
this.firstName = firstName;
283287
this.lastName = lastName;
288+
this.salutation = EnumHelper.toString(salutation, otherSalutation, Salutation.OTHER);
284289
this.sex = sex;
285290
this.pregnant = pregnant;
286291
this.approximateAge = ApproximateAgeHelper.formatApproximateAge(approximateAge, approximateAgeType);
@@ -456,6 +461,17 @@ public String getLastName() {
456461
}
457462

458463
@Order(12)
464+
@ExportTarget(caseExportTypes = {
465+
CaseExportType.CASE_SURVEILLANCE,
466+
CaseExportType.CASE_MANAGEMENT })
467+
@ExportProperty(PersonDto.SALUTATION)
468+
@ExportGroup(ExportGroupType.SENSITIVE)
469+
@HideForCountriesExcept
470+
public String getSalutation() {
471+
return salutation;
472+
}
473+
474+
@Order(13)
459475
@ExportTarget(caseExportTypes = {
460476
CaseExportType.CASE_SURVEILLANCE,
461477
CaseExportType.CASE_MANAGEMENT })
@@ -465,7 +481,7 @@ public Sex getSex() {
465481
return sex;
466482
}
467483

468-
@Order(13)
484+
@Order(14)
469485
@ExportTarget(caseExportTypes = {
470486
CaseExportType.CASE_SURVEILLANCE,
471487
CaseExportType.CASE_MANAGEMENT })
@@ -475,7 +491,7 @@ public YesNoUnknown getPregnant() {
475491
return pregnant;
476492
}
477493

478-
@Order(14)
494+
@Order(15)
479495
@ExportTarget(caseExportTypes = {
480496
CaseExportType.CASE_SURVEILLANCE,
481497
CaseExportType.CASE_MANAGEMENT })
@@ -485,7 +501,7 @@ public Trimester getTrimester() {
485501
return trimester;
486502
}
487503

488-
@Order(15)
504+
@Order(16)
489505
@ExportTarget(caseExportTypes = {
490506
CaseExportType.CASE_SURVEILLANCE,
491507
CaseExportType.CASE_MANAGEMENT })
@@ -495,7 +511,7 @@ public YesNoUnknown getPostpartum() {
495511
return postpartum;
496512
}
497513

498-
@Order(16)
514+
@Order(17)
499515
@ExportTarget(caseExportTypes = {
500516
CaseExportType.CASE_SURVEILLANCE,
501517
CaseExportType.CASE_MANAGEMENT })
@@ -505,7 +521,7 @@ public String getApproximateAge() {
505521
return approximateAge;
506522
}
507523

508-
@Order(17)
524+
@Order(18)
509525
@ExportTarget(caseExportTypes = {
510526
CaseExportType.CASE_SURVEILLANCE,
511527
CaseExportType.CASE_MANAGEMENT })
@@ -515,7 +531,7 @@ public String getAgeGroup() {
515531
return ageGroup;
516532
}
517533

518-
@Order(18)
534+
@Order(19)
519535
@ExportTarget(caseExportTypes = {
520536
CaseExportType.CASE_SURVEILLANCE,
521537
CaseExportType.CASE_MANAGEMENT })

sormas-api/src/main/java/de/symeda/sormas/api/contact/ContactExportDto.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import de.symeda.sormas.api.person.OccupationType;
3232
import de.symeda.sormas.api.person.PersonHelper;
3333
import de.symeda.sormas.api.person.PresentCondition;
34+
import de.symeda.sormas.api.person.Salutation;
3435
import de.symeda.sormas.api.person.Sex;
36+
import de.symeda.sormas.api.utils.EnumHelper;
3537
import de.symeda.sormas.api.utils.HideForCountriesExcept;
3638
import de.symeda.sormas.api.utils.Order;
3739
import de.symeda.sormas.api.utils.PersonalData;
@@ -59,6 +61,8 @@ public class ContactExportDto implements Serializable {
5961
private String firstName;
6062
@PersonalData
6163
private String lastName;
64+
@SensitiveData
65+
private String salutation;
6266
private Sex sex;
6367
private BirthDateDto birthdate;
6468
private String approximateAge;
@@ -143,7 +147,8 @@ public class ContactExportDto implements Serializable {
143147

144148
//@formatter:off
145149
public ContactExportDto(long id, long personId, String uuid, String sourceCaseUuid, CaseClassification caseClassification, Disease disease, String diseaseDetails,
146-
ContactClassification contactClassification, Date lastContactDate, String firstName, String lastName, Sex sex,
150+
ContactClassification contactClassification, Date lastContactDate, String firstName, String lastName,
151+
Salutation salutation, String otherSalutation, Sex sex,
147152
Integer birthdateDD, Integer birthdateMM, Integer birthdateYYYY,
148153
Integer approximateAge, ApproximateAgeType approximateAgeType, Date reportDate, ContactIdentificationSource contactIdentificationSource,
149154
String contactIdentificationSourceDetails, TracingApp tracingApp, String tracingAppDetails, ContactProximity contactProximity,
@@ -173,6 +178,7 @@ public ContactExportDto(long id, long personId, String uuid, String sourceCaseUu
173178
this.lastContactDate = lastContactDate;
174179
this.firstName = firstName;
175180
this.lastName = lastName;
181+
this.salutation = EnumHelper.toString(salutation, otherSalutation, Salutation.OTHER);
176182
this.sex = sex;
177183
this.birthdate = new BirthDateDto(birthdateDD, birthdateMM, birthdateYYYY);
178184
this.approximateAge = ApproximateAgeHelper.formatApproximateAge(approximateAge, approximateAgeType);
@@ -299,36 +305,42 @@ public String getLastName() {
299305
}
300306

301307
@Order(12)
308+
@HideForCountriesExcept
309+
public String getSalutation() {
310+
return salutation;
311+
}
312+
313+
@Order(13)
302314
public Sex getSex() {
303315
return sex;
304316
}
305317

306-
@Order(13)
318+
@Order(14)
307319
public BirthDateDto getBirthdate() {
308320
return birthdate;
309321
}
310322

311-
@Order(14)
323+
@Order(15)
312324
public String getApproximateAge() {
313325
return approximateAge;
314326
}
315327

316-
@Order(15)
328+
@Order(16)
317329
public Date getReportDate() {
318330
return reportDate;
319331
}
320332

321-
@Order(16)
333+
@Order(17)
322334
public String getRegion() {
323335
return region;
324336
}
325337

326-
@Order(17)
338+
@Order(18)
327339
public String getDistrict() {
328340
return district;
329341
}
330342

331-
@Order(18)
343+
@Order(19)
332344
public String getCommunity() {
333345
return community;
334346
}

sormas-api/src/main/java/de/symeda/sormas/api/event/EventParticipantExportDto.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@
3333
import de.symeda.sormas.api.person.ApproximateAgeType;
3434
import de.symeda.sormas.api.person.BurialConductor;
3535
import de.symeda.sormas.api.person.PresentCondition;
36+
import de.symeda.sormas.api.person.Salutation;
3637
import de.symeda.sormas.api.person.Sex;
38+
import de.symeda.sormas.api.utils.EnumHelper;
39+
import de.symeda.sormas.api.utils.HideForCountriesExcept;
3740
import de.symeda.sormas.api.utils.Order;
3841
import de.symeda.sormas.api.utils.PersonalData;
3942
import de.symeda.sormas.api.utils.SensitiveData;
@@ -100,6 +103,8 @@ public class EventParticipantExportDto implements Serializable {
100103
@PersonalData
101104
@SensitiveData
102105
private String lastName;
106+
@SensitiveData
107+
private String salutation;
103108
private Sex sex;
104109
private String approximateAge;
105110
private String ageGroup;
@@ -149,7 +154,7 @@ public EventParticipantExportDto(long id, long personId, String personUuid, Stri
149154

150155
EventStatus eventStatus, EventInvestigationStatus eventInvestigationStatus, Disease eventDisease, TypeOfPlace typeOfPlace, Date eventStartDate, Date eventEndDate, String eventTitle, String eventDesc,
151156
String eventRegion, String eventDistrict, String eventCommunity, String eventCity, String eventStreet, String eventHouseNumber,
152-
String firstName, String lastName, Sex sex, String involvmentDescription, Integer approximateAge, ApproximateAgeType approximateAgeType,
157+
String firstName, String lastName, Salutation salutation, String otherSalutation, Sex sex, String involvmentDescription, Integer approximateAge, ApproximateAgeType approximateAgeType,
153158
Integer birthdateDD, Integer birthdateMM, Integer birthdateYYYY, PresentCondition presentCondition, Date deathDate, Date burialDate,
154159
BurialConductor burialConductor, String burialPlaceDescription, String addressRegion, String addressDistrict, String addressCommunity, String city, String street, String houseNumber,
155160
String additionalInformation, String postalCode, String phone, String emailAddress, String caseUuid) {
@@ -180,6 +185,7 @@ public EventParticipantExportDto(long id, long personId, String personUuid, Stri
180185

181186
this.firstName = firstName;
182187
this.lastName = lastName;
188+
this.salutation = EnumHelper.toString(salutation, otherSalutation, Salutation.OTHER);
183189
this.sex = sex;
184190
this.involvmentDescription = involvmentDescription;
185191
this.approximateAge = ApproximateAgeType.ApproximateAgeHelper.formatApproximateAge(approximateAge, approximateAgeType);
@@ -240,6 +246,12 @@ public String getLastName() {
240246
}
241247

242248
@Order(15)
249+
@HideForCountriesExcept
250+
public String getSalutation() {
251+
return salutation;
252+
}
253+
254+
@Order(16)
243255
public Sex getSex() {
244256
return sex;
245257
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
3+
* Copyright © 2016-2020 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
* You should have received a copy of the GNU General Public License
13+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
package de.symeda.sormas.api.utils;
17+
18+
public class EnumHelper {
19+
20+
public static String toString(Enum<?> enumValue, String otherValue, Enum<?> otherEnumItem) {
21+
if (enumValue == null) {
22+
return null;
23+
}
24+
25+
return enumValue.equals(otherEnumItem) ? otherValue : enumValue.toString();
26+
}
27+
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,8 @@ public List<CaseExportDto> getExportList(
531531
joins.getEpiData().get(EpiData.ID), joins.getSymptoms().get(Symptoms.ID), joins.getHospitalization().get(Hospitalization.ID),
532532
joins.getDistrict().get(District.ID), joins.getHealthConditions().get(HealthConditions.ID), caseRoot.get(Case.UUID),
533533
caseRoot.get(Case.EPID_NUMBER), caseRoot.get(Case.DISEASE), caseRoot.get(Case.DISEASE_DETAILS),
534-
joins.getPerson().get(Person.FIRST_NAME), joins.getPerson().get(Person.LAST_NAME), joins.getPerson().get(Person.SEX),
534+
joins.getPerson().get(Person.FIRST_NAME), joins.getPerson().get(Person.LAST_NAME),
535+
joins.getPerson().get(Person.SALUTATION), joins.getPerson().get(Person.OTHER_SALUTATION), joins.getPerson().get(Person.SEX),
535536
caseRoot.get(Case.PREGNANT), joins.getPerson().get(Person.APPROXIMATE_AGE),
536537
joins.getPerson().get(Person.APPROXIMATE_AGE_TYPE), joins.getPerson().get(Person.BIRTHDATE_DD),
537538
joins.getPerson().get(Person.BIRTHDATE_MM), joins.getPerson().get(Person.BIRTHDATE_YYYY),

sormas-backend/src/main/java/de/symeda/sormas/backend/contact/ContactFacadeEjb.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import javax.persistence.criteria.Subquery;
6060
import javax.validation.constraints.NotNull;
6161

62-
import de.symeda.sormas.api.person.JournalPersonDto;
6362
import org.apache.commons.collections.CollectionUtils;
6463
import org.slf4j.Logger;
6564
import org.slf4j.LoggerFactory;
@@ -95,6 +94,7 @@
9594
import de.symeda.sormas.api.i18n.I18nProperties;
9695
import de.symeda.sormas.api.i18n.Validations;
9796
import de.symeda.sormas.api.location.LocationDto;
97+
import de.symeda.sormas.api.person.JournalPersonDto;
9898
import de.symeda.sormas.api.person.PersonReferenceDto;
9999
import de.symeda.sormas.api.region.DistrictReferenceDto;
100100
import de.symeda.sormas.api.region.RegionReferenceDto;
@@ -447,6 +447,8 @@ public List<ContactExportDto> getExportList(ContactCriteria contactCriteria, int
447447
contact.get(Contact.LAST_CONTACT_DATE),
448448
joins.getPerson().get(Person.FIRST_NAME),
449449
joins.getPerson().get(Person.LAST_NAME),
450+
joins.getPerson().get(Person.SALUTATION),
451+
joins.getPerson().get(Person.OTHER_SALUTATION),
450452
joins.getPerson().get(Person.SEX),
451453
joins.getPerson().get(Person.BIRTHDATE_DD),
452454
joins.getPerson().get(Person.BIRTHDATE_MM),

sormas-backend/src/main/java/de/symeda/sormas/backend/event/EventParticipantFacadeEjb.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ public List<EventParticipantExportDto> getExportList(
377377

378378
person.get(Person.FIRST_NAME),
379379
person.get(Person.LAST_NAME),
380+
person.get(Person.SALUTATION),
381+
person.get(Person.OTHER_SALUTATION),
380382
person.get(Person.SEX),
381383
eventParticipant.get(EventParticipant.INVOLVEMENT_DESCRIPTION),
382384
person.get(Person.APPROXIMATE_AGE),

sormas-backend/src/main/java/de/symeda/sormas/backend/person/Person.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public class Person extends AbstractDomainObject {
7373

7474
public static final String FIRST_NAME = "firstName";
7575
public static final String LAST_NAME = "lastName";
76+
public static final String SALUTATION = "salutation";
77+
public static final String OTHER_SALUTATION = "otherSalutation";
7678
public static final String NICKNAME = "nickname";
7779
public static final String MOTHERS_MAIDEN_NAME = "mothersMaidenName";
7880
public static final String APPROXIMATE_AGE = "approximateAge";

sormas-backend/src/main/resources/sql/sormas_schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5903,6 +5903,6 @@ ALTER TABLE person_history
59035903
ADD COLUMN salutation varchar(255),
59045904
ADD COLUMN othersalutation varchar(512);
59055905

5906-
INSERT INTO schema_version (version_number, comment) VALUES (283, 'SurvNet Adaptations - Create new field “Salutation” for persons #3411');
5906+
INSERT INTO schema_version (version_number, comment) VALUES (284, 'SurvNet Adaptations - Create new field “Salutation” for persons #3411');
59075907

59085908
-- *** Insert new sql commands BEFORE this line ***

0 commit comments

Comments
 (0)