42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package diagnosticreport
|
|
|
|
import (
|
|
"service/internal/interfaces/satusehat"
|
|
"time"
|
|
)
|
|
|
|
func MapRequestToFHIR(req DiagnosticReportRequest) satusehat.FHIRPayload {
|
|
return satusehat.NewFHIRPayload("DiagnosticReport").
|
|
Set("status", req.Status).
|
|
Set("category", []map[string]interface{}{
|
|
{
|
|
"coding": []map[string]interface{}{
|
|
{
|
|
"system": "http://terminology.hl7.org/CodeSystem/v2-0074",
|
|
"code": req.CategoryCode,
|
|
"display": req.CategoryDisplay,
|
|
},
|
|
},
|
|
},
|
|
}).
|
|
Set("code", map[string]interface{}{
|
|
"coding": []map[string]interface{}{
|
|
{
|
|
"system": "http://loinc.org",
|
|
"code": req.Code,
|
|
"display": req.Display,
|
|
},
|
|
},
|
|
}).
|
|
Set("subject", map[string]interface{}{
|
|
"reference": "Patient/" + req.PatientID,
|
|
"display": req.PatientName,
|
|
}).
|
|
Set("encounter", map[string]interface{}{"reference": "Encounter/" + req.EncounterID}).
|
|
Set("performer", []map[string]interface{}{
|
|
{"reference": "Practitioner/" + req.PractitionerID, "display": req.PractitionerName},
|
|
}).
|
|
Set("issued", req.Issued.Format(time.RFC3339)).
|
|
Set("conclusion", req.Conclusion)
|
|
}
|