Skip to content

Commit

Permalink
Merge pull request #13151 from SORMAS-Foundation/feature-13147_phone_…
Browse files Browse the repository at this point in the history
…number_validation_for_e-sante

#13147 - Phone Number Validation for E-Santé Reports – Remove and Sto…
  • Loading branch information
leventegal-she authored Oct 8, 2024
2 parents e393b45 + 2452c70 commit 4fdea77
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ public class ExternalMessageDto extends SormasToSormasShareableDto {

private boolean automaticProcessingPossible;

@Size(max = FieldConstraints.CHARACTER_LIMIT_TEXT, message = Validations.textTooLong)
private String personAdditionalDetails;

public ExternalMessageType getType() {
return type;
}
Expand Down Expand Up @@ -507,4 +510,12 @@ public boolean isAutomaticProcessingPossible() {
public void setAutomaticProcessingPossible(boolean automaticProcessingPossible) {
this.automaticProcessingPossible = automaticProcessingPossible;
}

public String getPersonAdditionalDetails() {
return personAdditionalDetails;
}

public void setPersonAdditionalDetails(String personAdditionalDetails) {
this.personAdditionalDetails = personAdditionalDetails;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@

package de.symeda.sormas.api.externalmessage.processing;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutableTriple;

import de.symeda.sormas.api.CountryHelper;
import de.symeda.sormas.api.customizableenum.CustomEnumNotFoundException;
import de.symeda.sormas.api.disease.DiseaseVariant;
Expand All @@ -45,6 +34,16 @@
import de.symeda.sormas.api.sample.SampleDto;
import de.symeda.sormas.api.utils.DataHelper;
import de.symeda.sormas.api.utils.DateHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutableTriple;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public final class ExternalMessageMapper {

Expand Down Expand Up @@ -83,7 +82,12 @@ public List<String[]> mapToPerson(PersonDto person) {
person::setNationalHealthId,
person.getNationalHealthId(),
externalMessage.getPersonNationalHealthId(),
PersonDto.NATIONAL_HEALTH_ID)));
PersonDto.NATIONAL_HEALTH_ID),
Mapping.of(
person::setAdditionalDetails,
person.getAdditionalDetails(),
externalMessage.getPersonAdditionalDetails(),
PersonDto.ADDITIONAL_DETAILS)));

if (person.getBirthdateYYYY() != null) {
DataHelper.Pair<Integer, ApproximateAgeType> ageAndAgeType = ApproximateAgeType.ApproximateAgeHelper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,15 @@

package de.symeda.sormas.api.externalmessage.processing.labmessage;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.symeda.sormas.api.Disease;
import de.symeda.sormas.api.FacadeProvider;
import de.symeda.sormas.api.caze.CaseDataDto;
import de.symeda.sormas.api.caze.CaseSelectionDto;
import de.symeda.sormas.api.caze.surveillancereport.ReportingType;
import de.symeda.sormas.api.caze.surveillancereport.SurveillanceReportDto;
import de.symeda.sormas.api.contact.ContactDto;
import de.symeda.sormas.api.contact.SimilarContactDto;
import de.symeda.sormas.api.event.EventCriteria;
import de.symeda.sormas.api.event.EventDto;
import de.symeda.sormas.api.event.EventIndexDto;
import de.symeda.sormas.api.event.EventParticipantCriteria;
import de.symeda.sormas.api.event.EventParticipantDto;
import de.symeda.sormas.api.event.EventParticipantReferenceDto;
import de.symeda.sormas.api.event.SimilarEventParticipantDto;
import de.symeda.sormas.api.event.*;
import de.symeda.sormas.api.externalmessage.ExternalMessageDto;
import de.symeda.sormas.api.externalmessage.ExternalMessageStatus;
import de.symeda.sormas.api.externalmessage.ExternalMessageType;
Expand All @@ -66,6 +49,17 @@
import de.symeda.sormas.api.utils.dataprocessing.ProcessingResult;
import de.symeda.sormas.api.utils.dataprocessing.ProcessingResultStatus;
import de.symeda.sormas.api.utils.dataprocessing.flow.FlowThen;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.stream.Collectors;

/**
* Abstract class defining the flow of processing a lab message allowing to choose between multiple options like create or select a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.symeda.sormas.backend.externalmessage;

import static de.symeda.sormas.api.utils.FieldConstraints.CHARACTER_LIMIT_DEFAULT;
import static de.symeda.sormas.api.utils.FieldConstraints.CHARACTER_LIMIT_TEXT;

import java.util.Date;
import java.util.List;
Expand Down Expand Up @@ -123,6 +124,7 @@ public class ExternalMessage extends AbstractDomainObject {
private List<SampleReport> sampleReports;
private SurveillanceReport surveillanceReport;
private String tsv;
private String personAdditionalDetails;

@Enumerated(EnumType.STRING)
public ExternalMessageType getType() {
Expand Down Expand Up @@ -449,4 +451,13 @@ public String getTsv() {
public void setTsv(String tsv) {
this.tsv = tsv;
}

@Column(length = CHARACTER_LIMIT_TEXT)
public String getPersonAdditionalDetails() {
return personAdditionalDetails;
}

public void setPersonAdditionalDetails(String personAdditionalDetails) {
this.personAdditionalDetails = personAdditionalDetails;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ ExternalMessage fillOrBuildEntity(@NotNull ExternalMessageDto source, ExternalMe
target.setReporterName(source.getReporterName());
target.setReporterPostalCode(source.getReporterPostalCode());
target.setReportMessageId(source.getReportMessageId());
target.setPersonAdditionalDetails(source.getPersonAdditionalDetails());

target.setReportId(source.getReportId());
if (source.getAssignee() != null) {
Expand Down Expand Up @@ -354,6 +355,7 @@ public ExternalMessageDto toDto(ExternalMessage source) {
target.setReporterPostalCode(source.getReporterPostalCode());
target.setStatus(source.getStatus());
target.setReportMessageId(source.getReportMessageId());
target.setPersonAdditionalDetails(source.getPersonAdditionalDetails());

target.setReportId(source.getReportId());
if (source.getSampleReports() != null) {
Expand Down
8 changes: 8 additions & 0 deletions sormas-backend/src/main/resources/sql/sormas_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13249,4 +13249,12 @@ ALTER TABLE users_history ADD COLUMN externalid text;

INSERT INTO schema_version (version_number, comment) VALUES (550, '#13080 Keycloak username modification is not synced by sormas');

-- 2024-09-23 #13147 Phone Number Validation for E-Santé Reports – Remove and Store Non-Numeric Text
ALTER TABLE externalmessage
ADD COLUMN personadditionaldetails text;

ALTER TABLE externalmessage_history
ADD COLUMN personadditionaldetails text;

INSERT INTO schema_version (version_number, comment) VALUES (551, '#13147 Phone Number Validation for E-Santé Reports – Remove and Store Non-Numeric Text');
-- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. ***
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

package de.symeda.sormas.ui.externalmessage.physiciansreport;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

import de.symeda.sormas.api.FacadeProvider;
import de.symeda.sormas.api.caze.CaseDataDto;
import de.symeda.sormas.api.caze.CaseSelectionDto;
Expand All @@ -36,6 +32,10 @@
import de.symeda.sormas.api.utils.dataprocessing.ProcessingResult;
import de.symeda.sormas.api.utils.dataprocessing.ProcessingResultStatus;

import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;

public abstract class AbstractPhysiciansReportProcessingFlow extends AbstractProcessingFlow {

public AbstractPhysiciansReportProcessingFlow(UserDto user, ExternalMessageMapper mapper, ExternalMessageProcessingFacade processingFacade) {
Expand Down

0 comments on commit 4fdea77

Please sign in to comment.