blob: 54744130ded18aa3e501b5fa4fa0bcfc2f119bb3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package xyz.driver.pdsuidomain.entities.export.patient
import xyz.driver.pdsuicommon.domain.LongId
import xyz.driver.pdsuicommon.logging._
import xyz.driver.pdsuidomain.entities.{Label, RawPatientLabel}
final case class ExportPatientLabel(id: LongId[Label],
name: String,
evidences: List[ExportPatientLabelEvidence])
object ExportPatientLabel extends PhiLogging {
implicit def toPhiString(x: ExportPatientLabel): PhiString = {
import x._
phi"ExportPatientLabel(id=$id, evidences=$evidences)"
}
def fromRaw(labelId: LongId[Label], rawPatientLabels: List[RawPatientLabel]): ExportPatientLabel = {
val firstLabel = rawPatientLabels.headOption
if (firstLabel.isEmpty) {
logger.warn(phi"rawPatientLabels is empty, labelId: $labelId")
}
ExportPatientLabel(
id = labelId,
name = firstLabel.map(_.label).getOrElse(""),
evidences = rawPatientLabels.map(ExportPatientLabelEvidence.fromRaw)
)
}
}
|