This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
forked from samply/golang-fhir-models
/
eventStatus.go
132 lines (126 loc) · 4.22 KB
/
eventStatus.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright 2019 - 2022 The Samply Community
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package fhir
import (
"encoding/json"
"fmt"
"strings"
)
// THIS FILE IS GENERATED BY https://github.com/stat/golang-fhir-models
// PLEASE DO NOT EDIT BY HAND
// EventStatus is documented here http://hl7.org/fhir/ValueSet/event-status
type EventStatus int
const (
EventStatusPreparation EventStatus = iota
EventStatusInProgress
EventStatusNotDone
EventStatusOnHold
EventStatusStopped
EventStatusCompleted
EventStatusEnteredInError
EventStatusUnknown
)
func (code *EventStatus)MarshalJSON() ([]byte, error) {
return json.Marshal(code.Code())
}
func (code *EventStatus) UnmarshalJSON(json []byte) error {
s := strings.Trim(string(json), "\"")
switch s {
case "preparation":
*code = EventStatusPreparation
case "in-progress":
*code = EventStatusInProgress
case "not-done":
*code = EventStatusNotDone
case "on-hold":
*code = EventStatusOnHold
case "stopped":
*code = EventStatusStopped
case "completed":
*code = EventStatusCompleted
case "entered-in-error":
*code = EventStatusEnteredInError
case "unknown":
*code = EventStatusUnknown
default:
return fmt.Errorf("unknown EventStatus code `%s`", s)
}
return nil
}
func (code EventStatus) String() string {
return code.Code()
}
func (code EventStatus) Code() string {
switch code {
case EventStatusPreparation:
return "preparation"
case EventStatusInProgress:
return "in-progress"
case EventStatusNotDone:
return "not-done"
case EventStatusOnHold:
return "on-hold"
case EventStatusStopped:
return "stopped"
case EventStatusCompleted:
return "completed"
case EventStatusEnteredInError:
return "entered-in-error"
case EventStatusUnknown:
return "unknown"
}
return "<unknown>"
}
func (code EventStatus) Display() string {
switch code {
case EventStatusPreparation:
return "Preparation"
case EventStatusInProgress:
return "In Progress"
case EventStatusNotDone:
return "Not Done"
case EventStatusOnHold:
return "On Hold"
case EventStatusStopped:
return "Stopped"
case EventStatusCompleted:
return "Completed"
case EventStatusEnteredInError:
return "Entered in Error"
case EventStatusUnknown:
return "Unknown"
}
return "<unknown>"
}
func (code EventStatus) Definition() string {
switch code {
case EventStatusPreparation:
return "The core event has not started yet, but some staging activities have begun (e.g. surgical suite preparation). Preparation stages may be tracked for billing purposes."
case EventStatusInProgress:
return "The event is currently occurring."
case EventStatusNotDone:
return "The event was terminated prior to any activity beyond preparation. I.e. The 'main' activity has not yet begun. The boundary between preparatory and the 'main' activity is context-specific."
case EventStatusOnHold:
return "The event has been temporarily stopped but is expected to resume in the future."
case EventStatusStopped:
return "The event was terminated prior to the full completion of the intended activity but after at least some of the 'main' activity (beyond preparation) has occurred."
case EventStatusCompleted:
return "The event has now concluded."
case EventStatusEnteredInError:
return "This electronic record should never have existed, though it is possible that real-world decisions were based on it. (If real-world activity has occurred, the status should be \"stopped\" rather than \"entered-in-error\".)."
case EventStatusUnknown:
return "The authoring/source system does not know which of the status values currently applies for this event. Note: This concept is not to be used for \"other\" - one of the listed statuses is presumed to apply, but the authoring/source system does not know which."
}
return "<unknown>"
}