forked from dshills/gofhir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobservation.go
39 lines (36 loc) · 1.04 KB
/
observation.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
package fhir
import (
"encoding/json"
"fmt"
"time"
)
// GetObservation will return a careplan for a patient with id pid
func (c *Connection) GetObservation(pid string, code string) (*Observation, error) {
b, err := c.Query(fmt.Sprintf("Observation?patient=%v&code=%v", pid, code))
if err != nil {
return nil, err
}
data := Observation{}
if err := json.Unmarshal(b, &data); err != nil {
return nil, err
}
return &data, nil
}
// Observation is a FHIR observation
type Observation struct {
SearchResult
Entry []struct {
EntryPartial
Resource struct {
ResourceType string `json:"resourceType"`
EffectiveDateTime time.Time `json:"effectiveDateTime"`
Status string `json:"status"`
ID string `json:"id"`
Code Concept `json:"code"`
ValueQuantity Quantity `json:"valueQuantity"`
Subject Thing `json:"subject"`
Performer []Person `json:"performer"`
Category Concept `json:"category"`
} `json:"resource"`
} `json:"entry"`
}