diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java b/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java index 779b8e6f048..fb9795c10fd 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java @@ -53,7 +53,8 @@ public enum FeatureType { MANUAL_EXTERNAL_MESSAGES(true, true, null), OTHER_NOTIFICATIONS(true, true, null), DOCUMENTS(true, false, null), - OUTBREAKS(true, true, null); + OUTBREAKS(true, true, null), + LAB_MESSAGES(true, false, null); /** * Server feature means that the feature only needs to be configured once per server since they define the way the system diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java b/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java index e18a047ff47..2312a1c80ae 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/i18n/Captions.java @@ -1000,6 +1000,32 @@ public interface Captions { String importSkips = "importSkips"; String inaccessibleValue = "inaccessibleValue"; String info = "info"; + String LabMessage = "LabMessage"; + String LabMessage_labMessageDetails = "LabMessage.labMessageDetails"; + String LabMessage_labSampleId = "LabMessage.labSampleId"; + String LabMessage_personBirthDateDD = "LabMessage.personBirthDateDD"; + String LabMessage_personBirthDateMM = "LabMessage.personBirthDateMM"; + String LabMessage_personBirthDateYYYY = "LabMessage.personBirthDateYYYY"; + String LabMessage_personCity = "LabMessage.personCity"; + String LabMessage_personFirstName = "LabMessage.personFirstName"; + String LabMessage_personHouseNumber = "LabMessage.personHouseNumber"; + String LabMessage_personLastName = "LabMessage.personLastName"; + String LabMessage_personPostalCode = "LabMessage.personPostalCode"; + String LabMessage_personSex = "LabMessage.personSex"; + String LabMessage_personStreet = "LabMessage.personStreet"; + String LabMessage_processed = "LabMessage.processed"; + String LabMessage_sampleDateTime = "LabMessage.sampleDateTime"; + String LabMessage_sampleMaterial = "LabMessage.sampleMaterial"; + String LabMessage_sampleReceivedDate = "LabMessage.sampleReceivedDate"; + String LabMessage_specimenCondition = "LabMessage.specimenCondition"; + String LabMessage_testDateTime = "LabMessage.testDateTime"; + String LabMessage_testedDisease = "LabMessage.testedDisease"; + String LabMessage_testLabCity = "LabMessage.testLabCity"; + String LabMessage_testLabExternalId = "LabMessage.testLabExternalId"; + String LabMessage_testLabName = "LabMessage.testLabName"; + String LabMessage_testLabPostalCode = "LabMessage.testLabPostalCode"; + String LabMessage_testResult = "LabMessage.testResult"; + String LabMessage_testType = "LabMessage.testType"; String lastName = "lastName"; String lineListingAddLine = "lineListingAddLine"; String lineListingDisableAll = "lineListingDisableAll"; diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/labmessage/LabMessageDto.java b/sormas-api/src/main/java/de/symeda/sormas/api/labmessage/LabMessageDto.java new file mode 100644 index 00000000000..cf1cefd6bcf --- /dev/null +++ b/sormas-api/src/main/java/de/symeda/sormas/api/labmessage/LabMessageDto.java @@ -0,0 +1,278 @@ +package de.symeda.sormas.api.labmessage; + +import java.util.Date; + +import de.symeda.sormas.api.Disease; +import de.symeda.sormas.api.EntityDto; +import de.symeda.sormas.api.person.Sex; +import de.symeda.sormas.api.sample.PathogenTestResultType; +import de.symeda.sormas.api.sample.PathogenTestType; +import de.symeda.sormas.api.sample.SampleMaterial; +import de.symeda.sormas.api.sample.SpecimenCondition; +import de.symeda.sormas.api.utils.DataHelper; + +public class LabMessageDto extends EntityDto { + + public static final String I18N_PREFIX = "Location"; + + public static final String SAMPLE_DATE_TIME = "sampleDateTime"; + public static final String SAMPLE_RECEIVED_DATE = "sampleReceivedDate"; + public static final String LAB_SAMPLE_ID = "labSampleId"; + public static final String SAMPLE_MATERIAL = "sampleMaterial"; + public static final String TEST_LAB_NAME = "testLabName"; + public static final String TEST_LAB_EXTERNAL_ID = "testLabExternalId"; + public static final String TEST_LAB_POSTAL_CODE = "testLabPostalCode"; + public static final String TEST_LAB_CITY = "testLabCity"; + public static final String SPECIMEN_CONDITION = "specimenCondition"; + public static final String TEST_TYPE = "testType"; + public static final String TESTED_DISEASE = "testedDisease"; + public static final String TEST_DATE_TIME = "testDateTime"; + public static final String TEST_RESULT = "testResult"; + public static final String PERSON_FIRST_NAME = "personFirstName"; + public static final String PERSON_LAST_NAME = "personLastName"; + public static final String PERSON_SEX = "personSex"; + public static final String PERSON_BIRTH_DATE_DD = "personBirthDateDD"; + public static final String PERSON_BIRTH_DATE_MM = "personBirthDateMM"; + public static final String PERSON_BIRTH_DATE_YYYY = "personBirthDateYYYY"; + public static final String PERSON_POSTAL_CODE = "personPostalCode"; + public static final String PERSON_CITY = "personCity"; + public static final String PERSON_STREET = "personStreet"; + public static final String PERSON_HOUSE_NUMBER = "personHouseNumber"; + public static final String LAB_MESSAGE_DETAILS = "labMessageDetails"; + public static final String PROCESSED = "processed"; + + private Date sampleDateTime; + private Date sampleReceivedDate; + private String labSampleId; + private SampleMaterial sampleMaterial; + private String testLabName; + private String testLabExternalId; + private String testLabPostalCode; + private String testLabCity; + private SpecimenCondition specimenCondition; + private PathogenTestType testType; + private Disease testedDisease; + private Date testDateTime; + private PathogenTestResultType testResult; + private String personFirstName; + private String personLastName; + private Sex personSex; + private Integer personBirthDateDD; + private Integer personBirthDateMM; + private Integer personBirthDateYYYY; + private String personPostalCode; + private String personCity; + private String personStreet; + private String personHouseNumber; + + private String labMessageDetails; + + private boolean processed; + + public Date getSampleDateTime() { + return sampleDateTime; + } + + public void setSampleDateTime(Date sampleDateTime) { + this.sampleDateTime = sampleDateTime; + } + + public Date getSampleReceivedDate() { + return sampleReceivedDate; + } + + public void setSampleReceivedDate(Date sampleReceivedDate) { + this.sampleReceivedDate = sampleReceivedDate; + } + + public String getLabSampleId() { + return labSampleId; + } + + public void setLabSampleId(String labSampleId) { + this.labSampleId = labSampleId; + } + + public SampleMaterial getSampleMaterial() { + return sampleMaterial; + } + + public void setSampleMaterial(SampleMaterial sampleMaterial) { + this.sampleMaterial = sampleMaterial; + } + + public String getTestLabName() { + return testLabName; + } + + public void setTestLabName(String testLabName) { + this.testLabName = testLabName; + } + + public String getTestLabExternalId() { + return testLabExternalId; + } + + public void setTestLabExternalId(String testLabExternalId) { + this.testLabExternalId = testLabExternalId; + } + + public String getTestLabPostalCode() { + return testLabPostalCode; + } + + public void setTestLabPostalCode(String testLabPostalCode) { + this.testLabPostalCode = testLabPostalCode; + } + + public String getTestLabCity() { + return testLabCity; + } + + public void setTestLabCity(String testLabCity) { + this.testLabCity = testLabCity; + } + + public SpecimenCondition getSpecimenCondition() { + return specimenCondition; + } + + public void setSpecimenCondition(SpecimenCondition specimenCondition) { + this.specimenCondition = specimenCondition; + } + + public PathogenTestType getTestType() { + return testType; + } + + public void setTestType(PathogenTestType testType) { + this.testType = testType; + } + + public Disease getTestedDisease() { + return testedDisease; + } + + public void setTestedDisease(Disease testedDisease) { + this.testedDisease = testedDisease; + } + + public Date getTestDateTime() { + return testDateTime; + } + + public void setTestDateTime(Date testDateTime) { + this.testDateTime = testDateTime; + } + + public PathogenTestResultType getTestResult() { + return testResult; + } + + public void setTestResult(PathogenTestResultType testResult) { + this.testResult = testResult; + } + + public String getPersonFirstName() { + return personFirstName; + } + + public void setPersonFirstName(String personFirstName) { + this.personFirstName = personFirstName; + } + + public String getPersonLastName() { + return personLastName; + } + + public void setPersonLastName(String personLastName) { + this.personLastName = personLastName; + } + + public Sex getPersonSex() { + return personSex; + } + + public void setPersonSex(Sex personSex) { + this.personSex = personSex; + } + + public Integer getPersonBirthDateDD() { + return personBirthDateDD; + } + + public void setPersonBirthDateDD(Integer personBirthDateDD) { + this.personBirthDateDD = personBirthDateDD; + } + + public Integer getPersonBirthDateMM() { + return personBirthDateMM; + } + + public void setPersonBirthDateMM(Integer personBirthDateMM) { + this.personBirthDateMM = personBirthDateMM; + } + + public Integer getPersonBirthDateYYYY() { + return personBirthDateYYYY; + } + + public void setPersonBirthDateYYYY(Integer personBirthDateYYYY) { + this.personBirthDateYYYY = personBirthDateYYYY; + } + + public String getPersonPostalCode() { + return personPostalCode; + } + + public void setPersonPostalCode(String personPostalCode) { + this.personPostalCode = personPostalCode; + } + + public String getPersonCity() { + return personCity; + } + + public void setPersonCity(String personCity) { + this.personCity = personCity; + } + + public String getPersonStreet() { + return personStreet; + } + + public void setPersonStreet(String personStreet) { + this.personStreet = personStreet; + } + + public String getPersonHouseNumber() { + return personHouseNumber; + } + + public void setPersonHouseNumber(String personHouseNumber) { + this.personHouseNumber = personHouseNumber; + } + + public String getLabMessageDetails() { + return labMessageDetails; + } + + public void setLabMessageDetails(String labMessageDetails) { + this.labMessageDetails = labMessageDetails; + } + + public boolean isProcessed() { + return processed; + } + + public void setProcessed(boolean processed) { + this.processed = processed; + } + + public static LabMessageDto build() { + + LabMessageDto labMessage = new LabMessageDto(); + labMessage.setUuid(DataHelper.createUuid()); + return labMessage; + } +} diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/labmessage/LabMessageFacade.java b/sormas-api/src/main/java/de/symeda/sormas/api/labmessage/LabMessageFacade.java new file mode 100644 index 00000000000..a188cd13aad --- /dev/null +++ b/sormas-api/src/main/java/de/symeda/sormas/api/labmessage/LabMessageFacade.java @@ -0,0 +1,9 @@ +package de.symeda.sormas.api.labmessage; + +import javax.ejb.Remote; + +@Remote +public interface LabMessageFacade { + + void save(LabMessageDto dto); +} diff --git a/sormas-api/src/main/resources/captions.properties b/sormas-api/src/main/resources/captions.properties index 314abd6a242..333b323d748 100644 --- a/sormas-api/src/main/resources/captions.properties +++ b/sormas-api/src/main/resources/captions.properties @@ -1107,6 +1107,34 @@ importLineListing=Line Listing Import importProcessed=%d/%d Processed importSkips=%d Skipped +#Lab Message +LabMessage=Lab Message +LabMessage.labMessageDetails=Lab message details +LabMessage.labSampleId=Lab sample ID +LabMessage.personBirthDateDD=Day of birth +LabMessage.personBirthDateMM=Month of birth +LabMessage.personBirthDateYYYY=Year of birth +LabMessage.personCity=City +LabMessage.personFirstName=First name +LabMessage.personHouseNumber=House number +LabMessage.personLastName=Last name +LabMessage.personPostalCode=Postal code +LabMessage.personSex=Sex +LabMessage.personStreet=Street +LabMessage.processed=Processed +LabMessage.sampleDateTime=Date sample was collected +LabMessage.sampleMaterial=Type of sample +LabMessage.sampleReceivedDate=Sample received +LabMessage.specimenCondition=Specimen condition +LabMessage.testDateTime=Date and time of result +LabMessage.testedDisease=Tested disease +LabMessage.testLabCity=Lab city +LabMessage.testLabExternalId=Lab external ID +LabMessage.testLabName=Lab name +LabMessage.testLabPostalCode=Lab postal code +LabMessage.testResult=Test result +LabMessage.testType=Type of test + #Line listing lineListingAddLine=Add line lineListingInfrastructureData=Take over infrastructure data from last line diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessage.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessage.java new file mode 100644 index 00000000000..58d6ccb02c1 --- /dev/null +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessage.java @@ -0,0 +1,301 @@ +package de.symeda.sormas.backend.labmessage; + +import static de.symeda.sormas.api.EntityDto.COLUMN_LENGTH_DEFAULT; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; + +import org.hibernate.annotations.Type; + +import de.symeda.auditlog.api.Audited; +import de.symeda.sormas.api.Disease; +import de.symeda.sormas.api.person.Sex; +import de.symeda.sormas.api.sample.PathogenTestResultType; +import de.symeda.sormas.api.sample.PathogenTestType; +import de.symeda.sormas.api.sample.SampleMaterial; +import de.symeda.sormas.api.sample.SpecimenCondition; +import de.symeda.sormas.backend.common.AbstractDomainObject; + +@Entity +@Audited +public class LabMessage extends AbstractDomainObject { + + public static final String TABLE_NAME = "labmessage"; + + public static final String SAMPLE_DATE_TIME = "sampleDateTime"; + public static final String SAMPLE_RECEIVED_DATE = "sampleReceivedDate"; + public static final String LAB_SAMPLE_ID = "labSampleId"; + public static final String SAMPLE_MATERIAL = "sampleMaterial"; + public static final String TEST_LAB_NAME = "testLabName"; + public static final String TEST_LAB_EXTERNAL_ID = "testLabExternalId"; + public static final String TEST_LAB_POSTAL_CODE = "testLabPostalCode"; + public static final String TEST_LAB_CITY = "testLabCity"; + public static final String SPECIMEN_CONDITION = "specimenCondition"; + public static final String TEST_TYPE = "testType"; + public static final String TESTED_DISEASE = "testedDisease"; + public static final String TEST_DATE_TIME = "testDateTime"; + public static final String TEST_RESULT = "testResult"; + public static final String PERSON_FIRST_NAME = "personFirstName"; + public static final String PERSON_LAST_NAME = "personLastName"; + public static final String PERSON_SEX = "personSex"; + public static final String PERSON_BIRTH_DATE_DD = "personBirthDateDD"; + public static final String PERSON_BIRTH_DATE_MM = "personBirthDateMM"; + public static final String PERSON_BIRTH_DATE_YYYY = "personBirthDateYYYY"; + public static final String PERSON_POSTAL_CODE = "personPostalCode"; + public static final String PERSON_CITY = "personCity"; + public static final String PERSON_STREET = "personStreet"; + public static final String PERSON_HOUSE_NUMBER = "personHouseNumber"; + public static final String LAB_MESSAGE_DETAILS = "labMessageDetails"; + public static final String PROCESSED = "processed"; + + private Date sampleDateTime; + private Date sampleReceivedDate; + private String labSampleId; + private SampleMaterial sampleMaterial; + private String testLabName; + private String testLabExternalId; + private String testLabPostalCode; + private String testLabCity; + private SpecimenCondition specimenCondition; + private PathogenTestType testType; + private Disease testedDisease; + private Date testDateTime; + private PathogenTestResultType testResult; + private String personFirstName; + private String personLastName; + private Sex personSex; + private Integer personBirthDateDD; + private Integer personBirthDateMM; + private Integer personBirthDateYYYY; + private String personPostalCode; + private String personCity; + private String personStreet; + private String personHouseNumber; + + private String labMessageDetails; + + private boolean processed; + + public Date getSampleDateTime() { + return sampleDateTime; + } + + public void setSampleDateTime(Date sampleDateTime) { + this.sampleDateTime = sampleDateTime; + } + + public Date getSampleReceivedDate() { + return sampleReceivedDate; + } + + public void setSampleReceivedDate(Date sampleReceivedDate) { + this.sampleReceivedDate = sampleReceivedDate; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getLabSampleId() { + return labSampleId; + } + + public void setLabSampleId(String labSampleId) { + this.labSampleId = labSampleId; + } + + @Enumerated(EnumType.STRING) + public SampleMaterial getSampleMaterial() { + return sampleMaterial; + } + + public void setSampleMaterial(SampleMaterial sampleMaterial) { + this.sampleMaterial = sampleMaterial; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getTestLabName() { + return testLabName; + } + + public void setTestLabName(String testLabName) { + this.testLabName = testLabName; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getTestLabExternalId() { + return testLabExternalId; + } + + public void setTestLabExternalId(String testLabExternalId) { + this.testLabExternalId = testLabExternalId; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getTestLabPostalCode() { + return testLabPostalCode; + } + + public void setTestLabPostalCode(String testLabPostalCode) { + this.testLabPostalCode = testLabPostalCode; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getTestLabCity() { + return testLabCity; + } + + public void setTestLabCity(String testLabCity) { + this.testLabCity = testLabCity; + } + + @Enumerated(EnumType.STRING) + public SpecimenCondition getSpecimenCondition() { + return specimenCondition; + } + + public void setSpecimenCondition(SpecimenCondition specimenCondition) { + this.specimenCondition = specimenCondition; + } + + @Enumerated(EnumType.STRING) + public PathogenTestType getTestType() { + return testType; + } + + public void setTestType(PathogenTestType testType) { + this.testType = testType; + } + + @Enumerated(EnumType.STRING) + public Disease getTestedDisease() { + return testedDisease; + } + + public void setTestedDisease(Disease testedDisease) { + this.testedDisease = testedDisease; + } + + public Date getTestDateTime() { + return testDateTime; + } + + public void setTestDateTime(Date testDateTime) { + this.testDateTime = testDateTime; + } + + @Enumerated(EnumType.STRING) + public PathogenTestResultType getTestResult() { + return testResult; + } + + public void setTestResult(PathogenTestResultType testResult) { + this.testResult = testResult; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getPersonFirstName() { + return personFirstName; + } + + public void setPersonFirstName(String personFirstName) { + this.personFirstName = personFirstName; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getPersonLastName() { + return personLastName; + } + + public void setPersonLastName(String personLastName) { + this.personLastName = personLastName; + } + + @Enumerated(EnumType.STRING) + public Sex getPersonSex() { + return personSex; + } + + public void setPersonSex(Sex personSex) { + this.personSex = personSex; + } + + public Integer getPersonBirthDateDD() { + return personBirthDateDD; + } + + public void setPersonBirthDateDD(Integer personBirthDateDD) { + this.personBirthDateDD = personBirthDateDD; + } + + public Integer getPersonBirthDateMM() { + return personBirthDateMM; + } + + public void setPersonBirthDateMM(Integer personBirthDateMM) { + this.personBirthDateMM = personBirthDateMM; + } + + public Integer getPersonBirthDateYYYY() { + return personBirthDateYYYY; + } + + public void setPersonBirthDateYYYY(Integer personBirthDateYYYY) { + this.personBirthDateYYYY = personBirthDateYYYY; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getPersonPostalCode() { + return personPostalCode; + } + + public void setPersonPostalCode(String personPostalCode) { + this.personPostalCode = personPostalCode; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getPersonCity() { + return personCity; + } + + public void setPersonCity(String personCity) { + this.personCity = personCity; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getPersonStreet() { + return personStreet; + } + + public void setPersonStreet(String personStreet) { + this.personStreet = personStreet; + } + + @Column(length = COLUMN_LENGTH_DEFAULT) + public String getPersonHouseNumber() { + return personHouseNumber; + } + + public void setPersonHouseNumber(String personHouseNumber) { + this.personHouseNumber = personHouseNumber; + } + + @Type(type = "json") + @Column(columnDefinition = "json") + public String getLabMessageDetails() { + return labMessageDetails; + } + + public void setLabMessageDetails(String labMessageDetails) { + this.labMessageDetails = labMessageDetails; + } + + public boolean isProcessed() { + return processed; + } + + public void setProcessed(boolean processed) { + this.processed = processed; + } +} diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessageFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessageFacadeEjb.java new file mode 100644 index 00000000000..31a2f7a5e3f --- /dev/null +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessageFacadeEjb.java @@ -0,0 +1,107 @@ +package de.symeda.sormas.backend.labmessage; + +import javax.ejb.EJB; +import javax.ejb.LocalBean; +import javax.ejb.Stateless; +import javax.validation.constraints.NotNull; + +import de.symeda.sormas.api.labmessage.LabMessageDto; +import de.symeda.sormas.api.labmessage.LabMessageFacade; +import de.symeda.sormas.backend.util.DtoHelper; + +@Stateless(name = "LabMessageFacade") +public class LabMessageFacadeEjb implements LabMessageFacade { + + @EJB + LabMessageService labMessageService; + + private LabMessage fromDto(@NotNull LabMessageDto source, LabMessage target) { + + if (target == null) { + target = new LabMessage(); + target.setUuid(source.getUuid()); + } + + DtoHelper.validateDto(source, target); + + target.setLabMessageDetails(source.getLabMessageDetails()); + target.setLabSampleId(source.getLabSampleId()); + target.setPersonBirthDateDD(source.getPersonBirthDateDD()); + target.setPersonBirthDateMM(source.getPersonBirthDateMM()); + target.setPersonBirthDateYYYY(source.getPersonBirthDateYYYY()); + target.setPersonCity(source.getPersonCity()); + target.setPersonFirstName(source.getPersonFirstName()); + target.setPersonHouseNumber(source.getPersonHouseNumber()); + target.setPersonLastName(source.getPersonLastName()); + target.setPersonPostalCode(source.getPersonPostalCode()); + target.setPersonSex(source.getPersonSex()); + target.setPersonStreet(source.getPersonStreet()); + target.setProcessed(source.isProcessed()); + target.setSampleDateTime(source.getSampleDateTime()); + target.setSampleMaterial(source.getSampleMaterial()); + target.setSampleReceivedDate(source.getSampleReceivedDate()); + target.setSpecimenCondition(source.getSpecimenCondition()); + target.setTestDateTime(source.getTestDateTime()); + target.setTestedDisease(source.getTestedDisease()); + target.setTestLabCity(source.getTestLabCity()); + target.setTestLabExternalId(source.getTestLabExternalId()); + target.setTestLabName(source.getTestLabName()); + target.setTestLabPostalCode(source.getTestLabPostalCode()); + target.setTestResult(source.getTestResult()); + target.setTestType(source.getTestType()); + + return target; + } + + @Override + public void save(LabMessageDto dto) { + + LabMessage labMessage = labMessageService.getByUuid(dto.getUuid()); + + labMessage = fromDto(dto, labMessage); + labMessageService.ensurePersisted(labMessage); + } + + public LabMessageDto toDto(LabMessage source) { + + if (source == null) { + return null; + } + LabMessageDto target = new LabMessageDto(); + DtoHelper.fillDto(target, source); + + target.setLabMessageDetails(source.getLabMessageDetails()); + target.setLabSampleId(source.getLabSampleId()); + target.setPersonBirthDateDD(source.getPersonBirthDateDD()); + target.setPersonBirthDateMM(source.getPersonBirthDateMM()); + target.setPersonBirthDateYYYY(source.getPersonBirthDateYYYY()); + target.setPersonCity(source.getPersonCity()); + target.setPersonFirstName(source.getPersonFirstName()); + target.setPersonHouseNumber(source.getPersonHouseNumber()); + target.setPersonLastName(source.getPersonLastName()); + target.setPersonPostalCode(source.getPersonPostalCode()); + target.setPersonSex(source.getPersonSex()); + target.setPersonStreet(source.getPersonStreet()); + target.setProcessed(source.isProcessed()); + target.setSampleDateTime(source.getSampleDateTime()); + target.setSampleMaterial(source.getSampleMaterial()); + target.setSampleReceivedDate(source.getSampleReceivedDate()); + target.setSpecimenCondition(source.getSpecimenCondition()); + target.setTestDateTime(source.getTestDateTime()); + target.setTestedDisease(source.getTestedDisease()); + target.setTestLabCity(source.getTestLabCity()); + target.setTestLabExternalId(source.getTestLabExternalId()); + target.setTestLabName(source.getTestLabName()); + target.setTestLabPostalCode(source.getTestLabPostalCode()); + target.setTestResult(source.getTestResult()); + target.setTestType(source.getTestType()); + + return target; + } + + @LocalBean + @Stateless + public static class LabMessageFacadeEjbLocal extends LabMessageFacadeEjb { + + } +} diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessageService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessageService.java new file mode 100644 index 00000000000..7ac162ff4cd --- /dev/null +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/labmessage/LabMessageService.java @@ -0,0 +1,20 @@ +package de.symeda.sormas.backend.labmessage; + +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.From; +import javax.persistence.criteria.Predicate; + +import de.symeda.sormas.backend.common.AbstractAdoService; + +public class LabMessageService extends AbstractAdoService { + + public LabMessageService() { + super(LabMessage.class); + } + + @Override + public Predicate createUserFilter(CriteriaBuilder cb, CriteriaQuery cq, From from) { + throw new UnsupportedOperationException(); + } +} diff --git a/sormas-backend/src/main/resources/sql/sormas_schema.sql b/sormas-backend/src/main/resources/sql/sormas_schema.sql index 43b898136a3..d1b75739a3f 100644 --- a/sormas-backend/src/main/resources/sql/sormas_schema.sql +++ b/sormas-backend/src/main/resources/sql/sormas_schema.sql @@ -6045,4 +6045,43 @@ ALTER TABLE manualmessagelog ADD CONSTRAINT fk_manualmessagelog_sendinguser_id F ALTER TABLE manualmessagelog ADD CONSTRAINT fk_manualmessagelog_recipientperson_id FOREIGN KEY (recipientperson_id) REFERENCES person(id); INSERT INTO schema_version (version_number, comment) VALUES (290, 'Manually send SMS #3253'); --- *** Insert new sql commands BEFORE this line *** \ No newline at end of file + +-- 2020-12-07 Add LabMessage #3486 +CREATE TABLE labmessage ( + id bigint not null, + uuid varchar(36) not null unique, + changedate timestamp not null, + creationdate timestamp not null, + sampledatetime timestamp, + samplereceiveddate timestamp, + labsampleid text, + samplematerial varchar(255), + testlabname varchar(255), + testlabexternalid varchar(255), + testlabpostalcode varchar(255), + testlabcity varchar(255), + specimencondition varchar(255), + testtype varchar(255), + testeddisease varchar(255), + testdatetime timestamp, + testresult varchar(255), + personfirstName varchar(255), + personlastName varchar(255), + personsex varchar(255), + personbirthdatedd integer, + personbirthdatemm integer, + personbirthdateyyyy integer, + personpostalcode varchar(255), + personcity varchar(255), + personstreet varchar(255), + personhousenumber varchar(255), + labMessageDetails text, + processed boolean default false, + sys_period tstzrange not null, + primary key(id) +); + +CREATE TABLE labmessage_history (LIKE labmessage); + +INSERT INTO schema_version (version_number, comment) VALUES (291, 'Add LabMessage #3486'); +-- *** Insert new sql commands BEFORE this line ***