aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json/export
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/export')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala10
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala14
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala15
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala11
4 files changed, 45 insertions, 5 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
index 1d5a171..0ef1c68 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabel.scala
@@ -2,9 +2,17 @@ package xyz.driver.pdsuidomain.formats.json.export
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath}
+import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuidomain.entities.export.patient.ExportPatientLabel
-final case class ApiExportPatientLabel(id: String, evidences: List[ApiExportPatientLabelEvidence])
+final case class ApiExportPatientLabel(id: String, evidences: List[ApiExportPatientLabelEvidence]) {
+
+ def toDomain = ExportPatientLabel(
+ id = LongId(this.id.toLong),
+ evidences = this.evidences.map(_.toDomain)
+ )
+
+}
object ApiExportPatientLabel {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala
index 9ce281e..d141762 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala
@@ -2,13 +2,23 @@ package xyz.driver.pdsuidomain.formats.json.export
import play.api.libs.functional.syntax._
import play.api.libs.json._
-import xyz.driver.pdsuicommon.domain.FuzzyValue
+import xyz.driver.pdsuicommon.domain.{FuzzyValue, LongId}
import xyz.driver.pdsuidomain.entities.export.patient.ExportPatientLabelEvidence
final case class ApiExportPatientLabelEvidence(evidenceId: String,
labelValue: String,
evidenceText: String,
- document: ApiExportPatientLabelEvidenceDocument)
+ document: ApiExportPatientLabelEvidenceDocument) {
+
+ def toDomain = ExportPatientLabelEvidence(
+ id = LongId(this.evidenceId.toLong),
+ value = FuzzyValue.fromString
+ .applyOrElse(this.labelValue, (s: String) => throw new NoSuchElementException(s"Unknown fuzzy value $s")),
+ evidenceText = this.evidenceText,
+ document = this.document.toDomain
+ )
+
+}
object ApiExportPatientLabelEvidence {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala
index 99bb2cf..6999301 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidenceDocument.scala
@@ -1,16 +1,29 @@
package xyz.driver.pdsuidomain.formats.json.export
import java.time.LocalDate
+import java.util.UUID
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath}
+import xyz.driver.pdsuicommon.domain.LongId
+import xyz.driver.pdsuidomain.entities.RecordRequestId
import xyz.driver.pdsuidomain.entities.export.patient.ExportPatientLabelEvidenceDocument
final case class ApiExportPatientLabelEvidenceDocument(documentId: String,
requestId: String,
documentType: String,
providerType: String,
- date: LocalDate)
+ date: LocalDate) {
+
+ def toDomain = ExportPatientLabelEvidenceDocument(
+ documentId = LongId(this.documentId.toLong),
+ requestId = RecordRequestId(UUID.fromString(this.requestId)),
+ documentType = this.documentType,
+ providerType = this.providerType,
+ date = this.date
+ )
+
+}
object ApiExportPatientLabelEvidenceDocument {
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala
index 8ce970b..fc9bab7 100644
--- a/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientWithLabels.scala
@@ -2,9 +2,18 @@ package xyz.driver.pdsuidomain.formats.json.export
import play.api.libs.functional.syntax._
import play.api.libs.json.{Format, JsPath}
+import xyz.driver.pdsuicommon.domain.UuidId
import xyz.driver.pdsuidomain.entities.export.patient.ExportPatientWithLabels
-final case class ApiExportPatientWithLabels(patientId: String, labelVersion: Long, labels: List[ApiExportPatientLabel])
+final case class ApiExportPatientWithLabels(patientId: String, labelVersion: Long, labels: List[ApiExportPatientLabel]) {
+
+ def toDomain = ExportPatientWithLabels(
+ patientId = UuidId(this.patientId),
+ labelVersion = this.labelVersion,
+ labels = this.labels.map(_.toDomain)
+ )
+
+}
object ApiExportPatientWithLabels {