43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package allergyintolerance
|
|
|
|
import (
|
|
"time"
|
|
|
|
"service/internal/interfaces/satusehat"
|
|
)
|
|
|
|
func MapRequestToFHIR(req AllergyIntoleranceRequest) satusehat.FHIRPayload {
|
|
return satusehat.NewFHIRPayload("AllergyIntolerance").
|
|
Set("clinicalStatus", map[string]interface{}{
|
|
"coding": []map[string]interface{}{
|
|
{
|
|
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
|
|
"code": req.ClinicalStatus,
|
|
},
|
|
},
|
|
}).
|
|
Set("verificationStatus", map[string]interface{}{
|
|
"coding": []map[string]interface{}{
|
|
{
|
|
"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
|
|
"code": req.VerificationStatus,
|
|
},
|
|
},
|
|
}).
|
|
Set("category", []string{req.Category}).
|
|
Set("code", map[string]interface{}{
|
|
"coding": []map[string]interface{}{
|
|
{
|
|
"system": "http://snomed.info/sct",
|
|
"code": req.Code,
|
|
"display": req.Display,
|
|
},
|
|
},
|
|
}).
|
|
Set("patient", map[string]interface{}{
|
|
"reference": "Patient/" + req.PatientID,
|
|
"display": req.PatientName,
|
|
}).
|
|
Set("recordedDate", req.RecordedDate.Format(time.RFC3339))
|
|
}
|