-
Notifications
You must be signed in to change notification settings - Fork 2
/
immunization.go
38 lines (33 loc) · 1.02 KB
/
immunization.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
package hdsfhir
import fhir "github.com/intervention-engine/fhir/models"
type Immunization struct {
Entry
SeriesNumber *uint32 `json:"seriesNumber"`
}
func (i *Immunization) FHIRModels() []interface{} {
fhirImmunization := &fhir.Immunization{}
fhirImmunization.Id = i.GetTempID()
fhirImmunization.Status = "completed"
if i.Time != nil {
fhirImmunization.Date = i.Time.FHIRDateTime()
}
fhirImmunization.VaccineCode = i.Codes.FHIRCodeableConcept(i.Description)
fhirImmunization.Patient = i.Patient.FHIRReference()
if i.NegationInd {
t := true
fhirImmunization.WasNotGiven = &t
}
if i.NegationReason != nil {
cc := i.NegationReason.FHIRCodeableConcept("")
fhirImmunization.Explanation = &fhir.ImmunizationExplanationComponent{
ReasonNotGiven: []fhir.CodeableConcept{*cc},
}
}
if i.SeriesNumber != nil {
fhirImmunization.VaccinationProtocol = []fhir.ImmunizationVaccinationProtocolComponent{
{DoseSequence: i.SeriesNumber},
}
}
// Ignoring dosage, route, etc.
return []interface{}{fhirImmunization}
}