001package org.hl7.fhir.r4.model.codesystems; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0 033 034import org.hl7.fhir.exceptions.FHIRException; 035 036public enum ItemType { 037 038 /** 039 * An item with no direct answer but should have at least one child item. 040 */ 041 GROUP, 042 /** 043 * Text for display that will not capture an answer or have child items. 044 */ 045 DISPLAY, 046 /** 047 * An item that defines a specific answer to be captured, and which may have 048 * child items. (the answer provided in the QuestionnaireResponse should be of 049 * the defined datatype). 050 */ 051 QUESTION, 052 /** 053 * Question with a yes/no answer (valueBoolean). 054 */ 055 BOOLEAN, 056 /** 057 * Question with is a real number answer (valueDecimal). 058 */ 059 DECIMAL, 060 /** 061 * Question with an integer answer (valueInteger). 062 */ 063 INTEGER, 064 /** 065 * Question with a date answer (valueDate). 066 */ 067 DATE, 068 /** 069 * Question with a date and time answer (valueDateTime). 070 */ 071 DATETIME, 072 /** 073 * Question with a time (hour:minute:second) answer independent of date. 074 * (valueTime). 075 */ 076 TIME, 077 /** 078 * Question with a short (few words to short sentence) free-text entry answer 079 * (valueString). 080 */ 081 STRING, 082 /** 083 * Question with a long (potentially multi-paragraph) free-text entry answer 084 * (valueString). 085 */ 086 TEXT, 087 /** 088 * Question with a URL (website, FTP site, etc.) answer (valueUri). 089 */ 090 URL, 091 /** 092 * Question with a Coding drawn from a list of possible answers (specified in 093 * either the answerOption property, or via the valueset referenced in the 094 * answerValueSet property) as an answer (valueCoding). 095 */ 096 CHOICE, 097 /** 098 * Answer is a Coding drawn from a list of possible answers (as with the choice 099 * type) or a free-text entry in a string (valueCoding or valueString). 100 */ 101 OPENCHOICE, 102 /** 103 * Question with binary content such as an image, PDF, etc. as an answer 104 * (valueAttachment). 105 */ 106 ATTACHMENT, 107 /** 108 * Question with a reference to another resource (practitioner, organization, 109 * etc.) as an answer (valueReference). 110 */ 111 REFERENCE, 112 /** 113 * Question with a combination of a numeric value and unit, potentially with a 114 * comparator (<, >, etc.) as an answer. (valueQuantity) There is an extension 115 * 'http://hl7.org/fhir/StructureDefinition/questionnaire-unit' that can be used 116 * to define what unit should be captured (or the unit that has a ucum 117 * conversion from the provided unit). 118 */ 119 QUANTITY, 120 /** 121 * added to help the parsers 122 */ 123 NULL; 124 125 public static ItemType fromCode(String codeString) throws FHIRException { 126 if (codeString == null || "".equals(codeString)) 127 return null; 128 if ("group".equals(codeString)) 129 return GROUP; 130 if ("display".equals(codeString)) 131 return DISPLAY; 132 if ("question".equals(codeString)) 133 return QUESTION; 134 if ("boolean".equals(codeString)) 135 return BOOLEAN; 136 if ("decimal".equals(codeString)) 137 return DECIMAL; 138 if ("integer".equals(codeString)) 139 return INTEGER; 140 if ("date".equals(codeString)) 141 return DATE; 142 if ("dateTime".equals(codeString)) 143 return DATETIME; 144 if ("time".equals(codeString)) 145 return TIME; 146 if ("string".equals(codeString)) 147 return STRING; 148 if ("text".equals(codeString)) 149 return TEXT; 150 if ("url".equals(codeString)) 151 return URL; 152 if ("choice".equals(codeString)) 153 return CHOICE; 154 if ("open-choice".equals(codeString)) 155 return OPENCHOICE; 156 if ("attachment".equals(codeString)) 157 return ATTACHMENT; 158 if ("reference".equals(codeString)) 159 return REFERENCE; 160 if ("quantity".equals(codeString)) 161 return QUANTITY; 162 throw new FHIRException("Unknown ItemType code '" + codeString + "'"); 163 } 164 165 public String toCode() { 166 switch (this) { 167 case GROUP: 168 return "group"; 169 case DISPLAY: 170 return "display"; 171 case QUESTION: 172 return "question"; 173 case BOOLEAN: 174 return "boolean"; 175 case DECIMAL: 176 return "decimal"; 177 case INTEGER: 178 return "integer"; 179 case DATE: 180 return "date"; 181 case DATETIME: 182 return "dateTime"; 183 case TIME: 184 return "time"; 185 case STRING: 186 return "string"; 187 case TEXT: 188 return "text"; 189 case URL: 190 return "url"; 191 case CHOICE: 192 return "choice"; 193 case OPENCHOICE: 194 return "open-choice"; 195 case ATTACHMENT: 196 return "attachment"; 197 case REFERENCE: 198 return "reference"; 199 case QUANTITY: 200 return "quantity"; 201 case NULL: 202 return null; 203 default: 204 return "?"; 205 } 206 } 207 208 public String getSystem() { 209 return "http://hl7.org/fhir/item-type"; 210 } 211 212 public String getDefinition() { 213 switch (this) { 214 case GROUP: 215 return "An item with no direct answer but should have at least one child item."; 216 case DISPLAY: 217 return "Text for display that will not capture an answer or have child items."; 218 case QUESTION: 219 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)."; 220 case BOOLEAN: 221 return "Question with a yes/no answer (valueBoolean)."; 222 case DECIMAL: 223 return "Question with is a real number answer (valueDecimal)."; 224 case INTEGER: 225 return "Question with an integer answer (valueInteger)."; 226 case DATE: 227 return "Question with a date answer (valueDate)."; 228 case DATETIME: 229 return "Question with a date and time answer (valueDateTime)."; 230 case TIME: 231 return "Question with a time (hour:minute:second) answer independent of date. (valueTime)."; 232 case STRING: 233 return "Question with a short (few words to short sentence) free-text entry answer (valueString)."; 234 case TEXT: 235 return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString)."; 236 case URL: 237 return "Question with a URL (website, FTP site, etc.) answer (valueUri)."; 238 case CHOICE: 239 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)."; 240 case OPENCHOICE: 241 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)."; 242 case ATTACHMENT: 243 return "Question with binary content such as an image, PDF, etc. as an answer (valueAttachment)."; 244 case REFERENCE: 245 return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)."; 246 case QUANTITY: 247 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)."; 248 case NULL: 249 return null; 250 default: 251 return "?"; 252 } 253 } 254 255 public String getDisplay() { 256 switch (this) { 257 case GROUP: 258 return "Group"; 259 case DISPLAY: 260 return "Display"; 261 case QUESTION: 262 return "Question"; 263 case BOOLEAN: 264 return "Boolean"; 265 case DECIMAL: 266 return "Decimal"; 267 case INTEGER: 268 return "Integer"; 269 case DATE: 270 return "Date"; 271 case DATETIME: 272 return "Date Time"; 273 case TIME: 274 return "Time"; 275 case STRING: 276 return "String"; 277 case TEXT: 278 return "Text"; 279 case URL: 280 return "Url"; 281 case CHOICE: 282 return "Choice"; 283 case OPENCHOICE: 284 return "Open Choice"; 285 case ATTACHMENT: 286 return "Attachment"; 287 case REFERENCE: 288 return "Reference"; 289 case QUANTITY: 290 return "Quantity"; 291 case NULL: 292 return null; 293 default: 294 return "?"; 295 } 296 } 297 298}