This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
forked from samply/golang-fhir-models
/
questionnaireItemType.go
213 lines (207 loc) · 7.27 KB
/
questionnaireItemType.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// 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
// QuestionnaireItemType is documented here http://hl7.org/fhir/ValueSet/item-type
type QuestionnaireItemType int
const (
QuestionnaireItemTypeGroup QuestionnaireItemType = iota
QuestionnaireItemTypeDisplay
QuestionnaireItemTypeQuestion
QuestionnaireItemTypeBoolean
QuestionnaireItemTypeDecimal
QuestionnaireItemTypeInteger
QuestionnaireItemTypeDate
QuestionnaireItemTypeDateTime
QuestionnaireItemTypeTime
QuestionnaireItemTypeString
QuestionnaireItemTypeText
QuestionnaireItemTypeUrl
QuestionnaireItemTypeChoice
QuestionnaireItemTypeOpenChoice
QuestionnaireItemTypeAttachment
QuestionnaireItemTypeReference
QuestionnaireItemTypeQuantity
)
func (code *QuestionnaireItemType)MarshalJSON() ([]byte, error) {
return json.Marshal(code.Code())
}
func (code *QuestionnaireItemType) UnmarshalJSON(json []byte) error {
s := strings.Trim(string(json), "\"")
switch s {
case "group":
*code = QuestionnaireItemTypeGroup
case "display":
*code = QuestionnaireItemTypeDisplay
case "question":
*code = QuestionnaireItemTypeQuestion
case "boolean":
*code = QuestionnaireItemTypeBoolean
case "decimal":
*code = QuestionnaireItemTypeDecimal
case "integer":
*code = QuestionnaireItemTypeInteger
case "date":
*code = QuestionnaireItemTypeDate
case "dateTime":
*code = QuestionnaireItemTypeDateTime
case "time":
*code = QuestionnaireItemTypeTime
case "string":
*code = QuestionnaireItemTypeString
case "text":
*code = QuestionnaireItemTypeText
case "url":
*code = QuestionnaireItemTypeUrl
case "choice":
*code = QuestionnaireItemTypeChoice
case "open-choice":
*code = QuestionnaireItemTypeOpenChoice
case "attachment":
*code = QuestionnaireItemTypeAttachment
case "reference":
*code = QuestionnaireItemTypeReference
case "quantity":
*code = QuestionnaireItemTypeQuantity
default:
return fmt.Errorf("unknown QuestionnaireItemType code `%s`", s)
}
return nil
}
func (code QuestionnaireItemType) String() string {
return code.Code()
}
func (code QuestionnaireItemType) Code() string {
switch code {
case QuestionnaireItemTypeGroup:
return "group"
case QuestionnaireItemTypeDisplay:
return "display"
case QuestionnaireItemTypeQuestion:
return "question"
case QuestionnaireItemTypeBoolean:
return "boolean"
case QuestionnaireItemTypeDecimal:
return "decimal"
case QuestionnaireItemTypeInteger:
return "integer"
case QuestionnaireItemTypeDate:
return "date"
case QuestionnaireItemTypeDateTime:
return "dateTime"
case QuestionnaireItemTypeTime:
return "time"
case QuestionnaireItemTypeString:
return "string"
case QuestionnaireItemTypeText:
return "text"
case QuestionnaireItemTypeUrl:
return "url"
case QuestionnaireItemTypeChoice:
return "choice"
case QuestionnaireItemTypeOpenChoice:
return "open-choice"
case QuestionnaireItemTypeAttachment:
return "attachment"
case QuestionnaireItemTypeReference:
return "reference"
case QuestionnaireItemTypeQuantity:
return "quantity"
}
return "<unknown>"
}
func (code QuestionnaireItemType) Display() string {
switch code {
case QuestionnaireItemTypeGroup:
return "Group"
case QuestionnaireItemTypeDisplay:
return "Display"
case QuestionnaireItemTypeQuestion:
return "Question"
case QuestionnaireItemTypeBoolean:
return "Boolean"
case QuestionnaireItemTypeDecimal:
return "Decimal"
case QuestionnaireItemTypeInteger:
return "Integer"
case QuestionnaireItemTypeDate:
return "Date"
case QuestionnaireItemTypeDateTime:
return "Date Time"
case QuestionnaireItemTypeTime:
return "Time"
case QuestionnaireItemTypeString:
return "String"
case QuestionnaireItemTypeText:
return "Text"
case QuestionnaireItemTypeUrl:
return "Url"
case QuestionnaireItemTypeChoice:
return "Choice"
case QuestionnaireItemTypeOpenChoice:
return "Open Choice"
case QuestionnaireItemTypeAttachment:
return "Attachment"
case QuestionnaireItemTypeReference:
return "Reference"
case QuestionnaireItemTypeQuantity:
return "Quantity"
}
return "<unknown>"
}
func (code QuestionnaireItemType) Definition() string {
switch code {
case QuestionnaireItemTypeGroup:
return "An item with no direct answer but should have at least one child item."
case QuestionnaireItemTypeDisplay:
return "Text for display that will not capture an answer or have child items."
case QuestionnaireItemTypeQuestion:
return "An item that defines a specific answer to be captured, and which may have child items. (the answer provided in the QuestionnaireResponse should be of the defined datatype)."
case QuestionnaireItemTypeBoolean:
return "Question with a yes/no answer (valueBoolean)."
case QuestionnaireItemTypeDecimal:
return "Question with is a real number answer (valueDecimal)."
case QuestionnaireItemTypeInteger:
return "Question with an integer answer (valueInteger)."
case QuestionnaireItemTypeDate:
return "Question with a date answer (valueDate)."
case QuestionnaireItemTypeDateTime:
return "Question with a date and time answer (valueDateTime)."
case QuestionnaireItemTypeTime:
return "Question with a time (hour:minute:second) answer independent of date. (valueTime)."
case QuestionnaireItemTypeString:
return "Question with a short (few words to short sentence) free-text entry answer (valueString)."
case QuestionnaireItemTypeText:
return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString)."
case QuestionnaireItemTypeUrl:
return "Question with a URL (website, FTP site, etc.) answer (valueUri)."
case QuestionnaireItemTypeChoice:
return "Question with a Coding drawn from a list of possible answers (specified in either the answerOption property, or via the valueset referenced in the answerValueSet property) as an answer (valueCoding)."
case QuestionnaireItemTypeOpenChoice:
return "Answer is a Coding drawn from a list of possible answers (as with the choice type) or a free-text entry in a string (valueCoding or valueString)."
case QuestionnaireItemTypeAttachment:
return "Question with binary content such as an image, PDF, etc. as an answer (valueAttachment)."
case QuestionnaireItemTypeReference:
return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)."
case QuestionnaireItemTypeQuantity:
return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used to define what unit should be captured (or the unit that has a ucum conversion from the provided unit)."
}
return "<unknown>"
}