first commit
This commit is contained in:
No files matched your search
@@ -0,0 +1,30 @@
|
||||
package episodeofcare
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"service/internal/interfaces/satusehat"
|
||||
)
|
||||
|
||||
func MapRequestToFHIR(req EpisodeOfCareRequest) satusehat.FHIRPayload {
|
||||
payload := satusehat.NewFHIRPayload("EpisodeOfCare").
|
||||
Set("status", req.Status).
|
||||
Set("patient", map[string]interface{}{
|
||||
"reference": "Patient/" + req.PatientID,
|
||||
"display": req.PatientName,
|
||||
})
|
||||
|
||||
if req.OrganizationID != "" {
|
||||
payload.Set("managingOrganization", map[string]interface{}{
|
||||
"reference": "Organization/" + req.OrganizationID,
|
||||
})
|
||||
}
|
||||
|
||||
period := map[string]interface{}{"start": req.PeriodStart.Format(time.RFC3339)}
|
||||
if req.PeriodEnd != nil {
|
||||
period["end"] = req.PeriodEnd.Format(time.RFC3339)
|
||||
}
|
||||
payload.Set("period", period)
|
||||
|
||||
return payload
|
||||
}
|
||||
Reference in New Issue
Block a user