-
Notifications
You must be signed in to change notification settings - Fork 2
/
vital_sign.go
31 lines (27 loc) · 990 Bytes
/
vital_sign.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
package hdsfhir
import fhir "github.com/intervention-engine/fhir/models"
type VitalSign struct {
Entry
Description string `json:"description"`
Interpretation *CodeObject `json:"interpretation"`
Values []ResultValue `json:"values"`
}
func (v *VitalSign) FHIRModels() []interface{} {
var fhirObservation *fhir.Observation
switch {
default:
fhirObservation = &fhir.Observation{}
case len(v.Values) == 1:
fhirObservation = v.Values[0].FHIRModels()[0].(*fhir.Observation)
case len(v.Values) > 1:
panic("FHIR Observations cannot have more than one value")
}
fhirObservation.Code = v.Codes.FHIRCodeableConcept(v.Description)
fhirObservation.Encounter = v.Patient.MatchingEncounterReference(v.Entry)
fhirObservation.EffectivePeriod = v.GetFHIRPeriod()
if v.Interpretation != nil {
fhirObservation.Interpretation = v.Interpretation.FHIRCodeableConcept("")
}
fhirObservation.Subject = v.Patient.FHIRReference()
return []interface{}{fhirObservation}
}