aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienthistory/ApiPatientHistory.scala
diff options
context:
space:
mode:
authorKseniya Tomskikh <ktomskih@datamonsters.co>2017-08-02 15:25:17 +0600
committerKseniya Tomskikh <ktomskih@datamonsters.co>2017-08-02 16:54:04 +0600
commit98cecaebc650584f66d8c28c8424e8481c4814cc (patch)
tree01e7b230c5ce8599b4f726a5abc7664d8e08bb07 /src/main/scala/xyz/driver/pdsuidomain/formats/json/patienthistory/ApiPatientHistory.scala
parent31d5b35549fa49413692ecb3ecba7ee4c0b9cb4d (diff)
downloadrest-query-98cecaebc650584f66d8c28c8424e8481c4814cc.tar.gz
rest-query-98cecaebc650584f66d8c28c8424e8481c4814cc.tar.bz2
rest-query-98cecaebc650584f66d8c28c8424e8481c4814cc.zip
PDSUI-2181 Created entities for patient history
Diffstat (limited to 'src/main/scala/xyz/driver/pdsuidomain/formats/json/patienthistory/ApiPatientHistory.scala')
-rw-r--r--src/main/scala/xyz/driver/pdsuidomain/formats/json/patienthistory/ApiPatientHistory.scala28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienthistory/ApiPatientHistory.scala b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienthistory/ApiPatientHistory.scala
new file mode 100644
index 0000000..cdcd510
--- /dev/null
+++ b/src/main/scala/xyz/driver/pdsuidomain/formats/json/patienthistory/ApiPatientHistory.scala
@@ -0,0 +1,28 @@
+package xyz.driver.pdsuidomain.formats.json.patienthistory
+
+import java.time.{ZoneId, ZonedDateTime}
+import java.util.UUID
+
+import play.api.libs.json.{Format, Json}
+import xyz.driver.pdsuidomain.entities.PatientHistory
+
+final case class ApiPatientHistory(id: Long,
+ executor: String,
+ patientId: UUID,
+ state: String,
+ action: String,
+ created: ZonedDateTime)
+
+object ApiPatientHistory {
+ implicit val format: Format[ApiPatientHistory] =
+ Json.format[ApiPatientHistory]
+
+ def fromDomain(x: PatientHistory) = ApiPatientHistory(
+ id = x.id.id,
+ executor = x.executor.id,
+ patientId = x.patientId.id,
+ state = PatientHistory.State.stateToString(x.state),
+ action = PatientHistory.Action.actionToString(x.action),
+ created = ZonedDateTime.of(x.created, ZoneId.of("Z"))
+ )
+}