diff options
author | vlad <vlad@driver.xyz> | 2017-06-30 23:06:43 -0700 |
---|---|---|
committer | vlad <vlad@driver.xyz> | 2017-06-30 23:06:43 -0700 |
commit | 56187bec9276f51886a01a2752c663f2227d9fc3 (patch) | |
tree | 3ddafc15152df5c1b2a6c69f0aa97a03ef7e819d /src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala | |
parent | 96d81a36286e41035ff4068859a3b0f9da924fbc (diff) | |
download | rest-query-56187bec9276f51886a01a2752c663f2227d9fc3.tar.gz rest-query-56187bec9276f51886a01a2752c663f2227d9fc3.tar.bz2 rest-query-56187bec9276f51886a01a2752c663f2227d9fc3.zip |
Export entities JSON formatsv0.1.13
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala')
-rw-r--r-- | src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala | 28 |
1 files changed, 28 insertions, 0 deletions
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 new file mode 100644 index 0000000..b38c2a0 --- /dev/null +++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/export/ApiExportPatientLabelEvidence.scala @@ -0,0 +1,28 @@ +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.pdsuidomain.entities.export.patient.ExportPatientLabelEvidence + +final case class ApiExportPatientLabelEvidence(evidenceId: String, + labelValue: String, + evidenceText: String, + document: ApiExportPatientLabelEvidenceDocument) + +object ApiExportPatientLabelEvidence { + + implicit val format: Format[ApiExportPatientLabelEvidence] = ( + (JsPath \ "evidenceId").format[String] and + (JsPath \ "labelValue").format[String](Writes[String](x => JsString(x.toUpperCase))) and + (JsPath \ "evidenceText").format[String] and + (JsPath \ "document").format[ApiExportPatientLabelEvidenceDocument] + ) (ApiExportPatientLabelEvidence.apply, unlift(ApiExportPatientLabelEvidence.unapply)) + + def fromDomain(evidence: ExportPatientLabelEvidence) = ApiExportPatientLabelEvidence( + evidenceId = evidence.id.toString, + labelValue = FuzzyValue.valueToString(evidence.value), + evidenceText = evidence.evidenceText, + document = ApiExportPatientLabelEvidenceDocument.fromDomain(evidence.document) + ) +} |