forked from dshills/gofhir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcondition.go
37 lines (34 loc) · 935 Bytes
/
condition.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
package fhir
import (
"encoding/json"
"fmt"
)
// GetCondition will return a condition for a patient with id pid
func (c *Connection) GetCondition(pid string) (*Condition, error) {
b, err := c.Query(fmt.Sprintf("Condition?patient=%v", pid))
if err != nil {
return nil, err
}
data := Condition{}
if err := json.Unmarshal(b, &data); err != nil {
return nil, err
}
return &data, nil
}
// Condition is a FHIR condition
type Condition struct {
SearchResult
Entry []struct {
EntryPartial
Resource struct {
ResourcePartial
ClinicalStatus string `json:"clinicalStatus"`
OnsetDateTime string `json:"onsetDateTime"`
VerificationStatus string `json:"verificationStatus"`
Asserter Person `json:"asserter"`
Code Concept `json:"code"`
Category Concept `json:"category"`
Severity Note `json:"severity"`
} `json:"resource"`
} `json:"entry"`
}