first commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package immunization
|
||||
|
||||
import (
|
||||
"service/internal/interfaces/satusehat"
|
||||
"time"
|
||||
)
|
||||
|
||||
func MapRequestToFHIR(req ImmunizationRequest) satusehat.FHIRPayload {
|
||||
payload := satusehat.NewFHIRPayload("Immunization").
|
||||
Set("status", req.Status).
|
||||
Set("vaccineCode", map[string]interface{}{
|
||||
"coding": []map[string]interface{}{
|
||||
{"system": "http://sys-ids.kemkes.go.id/kfa", "code": req.VaccineCode, "display": req.VaccineDisplay},
|
||||
},
|
||||
}).
|
||||
Set("patient", map[string]interface{}{"reference": "Patient/" + req.PatientID, "display": req.PatientName}).
|
||||
Set("encounter", map[string]interface{}{"reference": "Encounter/" + req.EncounterID}).
|
||||
Set("occurrenceDateTime", req.OccurrenceDateTime.Format(time.RFC3339)).
|
||||
Set("primarySource", req.PrimarySource).
|
||||
Set("performer", []map[string]interface{}{
|
||||
{
|
||||
"actor": map[string]interface{}{
|
||||
"reference": "Practitioner/" + req.PractitionerID,
|
||||
"display": req.PractitionerName,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
if req.LotNumber != "" {
|
||||
payload.Set("lotNumber", req.LotNumber)
|
||||
}
|
||||
return payload
|
||||
}
|
||||
Reference in New Issue
Block a user