forked from dshills/gofhir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcareplan.go
43 lines (40 loc) · 1.02 KB
/
careplan.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
package fhir
import (
"encoding/json"
"fmt"
)
// GetCarePlan will return a careplan for a patient with id pid
func (c *Connection) GetCarePlan(pid string) (*CarePlan, error) {
b, err := c.Query(fmt.Sprintf("CarePlan?patient=%v", pid))
if err != nil {
return nil, err
}
data := CarePlan{}
if err := json.Unmarshal(b, &data); err != nil {
return nil, err
}
return &data, nil
}
// CarePlan is a FHIR care plan
type CarePlan struct {
ResourceType string `json:"resourceType"`
Type string `json:"type"`
Total int `json:"total"`
Link []Link `json:"link"`
Entry []struct {
EntryPartial
Resource struct {
ResourcePartial
Addresses []Address `json:"addresses"`
Goal []Thing `json:"goal"`
Activity []struct {
Detail struct {
Prohibited bool `json:"prohibited"`
Category Concept `json:"category"`
Code Note `json:"code"`
} `json:"detail"`
} `json:"activity"`
Category []Concept `json:"category"`
} `json:"resource"`
} `json:"entry"`
}