001package org.hl7.fhir.r5.model.codesystems; 002 003/* 004 * #%L 005 * org.hl7.fhir.r5 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023/* 024 Copyright (c) 2011+, HL7, Inc. 025 All rights reserved. 026 027 Redistribution and use in source and binary forms, with or without modification, 028 are permitted provided that the following conditions are met: 029 030 * Redistributions of source code must retain the above copyright notice, this 031 list of conditions and the following disclaimer. 032 * Redistributions in binary form must reproduce the above copyright notice, 033 this list of conditions and the following disclaimer in the documentation 034 and/or other materials provided with the distribution. 035 * Neither the name of HL7 nor the names of its contributors may be used to 036 endorse or promote products derived from this software without specific 037 prior written permission. 038 039 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 040 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 041 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 042 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 043 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 044 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 045 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 046 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 047 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 048 POSSIBILITY OF SUCH DAMAGE. 049 050*/ 051 052// Generated on Thu, Oct 17, 2019 09:42+1100 for FHIR v4.1.0 053 054 055import org.hl7.fhir.exceptions.FHIRException; 056 057public enum ItemType { 058 059 /** 060 * An item with no direct answer but should have at least one child item. 061 */ 062 GROUP, 063 /** 064 * Text for display that will not capture an answer or have child items. 065 */ 066 DISPLAY, 067 /** 068 * 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). 069 */ 070 QUESTION, 071 /** 072 * Question with a yes/no answer (valueBoolean). 073 */ 074 BOOLEAN, 075 /** 076 * Question with is a real number answer (valueDecimal). 077 */ 078 DECIMAL, 079 /** 080 * Question with an integer answer (valueInteger). 081 */ 082 INTEGER, 083 /** 084 * Question with a date answer (valueDate). 085 */ 086 DATE, 087 /** 088 * Question with a date and time answer (valueDateTime). 089 */ 090 DATETIME, 091 /** 092 * Question with a time (hour:minute:second) answer independent of date. (valueTime). 093 */ 094 TIME, 095 /** 096 * Question with a short (few words to short sentence) free-text entry answer (valueString). 097 */ 098 STRING, 099 /** 100 * Question with a long (potentially multi-paragraph) free-text entry answer (valueString). 101 */ 102 TEXT, 103 /** 104 * Question with a URL (website, FTP site, etc.) answer (valueUri). 105 */ 106 URL, 107 /** 108 * 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). 109 */ 110 CHOICE, 111 /** 112 * 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). 113 */ 114 OPENCHOICE, 115 /** 116 * Question with binary content such as an image, PDF, etc. as an answer (valueAttachment). 117 */ 118 ATTACHMENT, 119 /** 120 * Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference). 121 */ 122 REFERENCE, 123 /** 124 * 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). 125 */ 126 QUANTITY, 127 /** 128 * added to help the parsers 129 */ 130 NULL; 131 public static ItemType fromCode(String codeString) throws FHIRException { 132 if (codeString == null || "".equals(codeString)) 133 return null; 134 if ("group".equals(codeString)) 135 return GROUP; 136 if ("display".equals(codeString)) 137 return DISPLAY; 138 if ("question".equals(codeString)) 139 return QUESTION; 140 if ("boolean".equals(codeString)) 141 return BOOLEAN; 142 if ("decimal".equals(codeString)) 143 return DECIMAL; 144 if ("integer".equals(codeString)) 145 return INTEGER; 146 if ("date".equals(codeString)) 147 return DATE; 148 if ("dateTime".equals(codeString)) 149 return DATETIME; 150 if ("time".equals(codeString)) 151 return TIME; 152 if ("string".equals(codeString)) 153 return STRING; 154 if ("text".equals(codeString)) 155 return TEXT; 156 if ("url".equals(codeString)) 157 return URL; 158 if ("choice".equals(codeString)) 159 return CHOICE; 160 if ("open-choice".equals(codeString)) 161 return OPENCHOICE; 162 if ("attachment".equals(codeString)) 163 return ATTACHMENT; 164 if ("reference".equals(codeString)) 165 return REFERENCE; 166 if ("quantity".equals(codeString)) 167 return QUANTITY; 168 throw new FHIRException("Unknown ItemType code '"+codeString+"'"); 169 } 170 public String toCode() { 171 switch (this) { 172 case GROUP: return "group"; 173 case DISPLAY: return "display"; 174 case QUESTION: return "question"; 175 case BOOLEAN: return "boolean"; 176 case DECIMAL: return "decimal"; 177 case INTEGER: return "integer"; 178 case DATE: return "date"; 179 case DATETIME: return "dateTime"; 180 case TIME: return "time"; 181 case STRING: return "string"; 182 case TEXT: return "text"; 183 case URL: return "url"; 184 case CHOICE: return "choice"; 185 case OPENCHOICE: return "open-choice"; 186 case ATTACHMENT: return "attachment"; 187 case REFERENCE: return "reference"; 188 case QUANTITY: return "quantity"; 189 default: return "?"; 190 } 191 } 192 public String getSystem() { 193 return "http://hl7.org/fhir/item-type"; 194 } 195 public String getDefinition() { 196 switch (this) { 197 case GROUP: return "An item with no direct answer but should have at least one child item."; 198 case DISPLAY: return "Text for display that will not capture an answer or have child items."; 199 case QUESTION: 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)."; 200 case BOOLEAN: return "Question with a yes/no answer (valueBoolean)."; 201 case DECIMAL: return "Question with is a real number answer (valueDecimal)."; 202 case INTEGER: return "Question with an integer answer (valueInteger)."; 203 case DATE: return "Question with a date answer (valueDate)."; 204 case DATETIME: return "Question with a date and time answer (valueDateTime)."; 205 case TIME: return "Question with a time (hour:minute:second) answer independent of date. (valueTime)."; 206 case STRING: return "Question with a short (few words to short sentence) free-text entry answer (valueString)."; 207 case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry answer (valueString)."; 208 case URL: return "Question with a URL (website, FTP site, etc.) answer (valueUri)."; 209 case CHOICE: 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)."; 210 case OPENCHOICE: 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)."; 211 case ATTACHMENT: return "Question with binary content such as an image, PDF, etc. as an answer (valueAttachment)."; 212 case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer (valueReference)."; 213 case QUANTITY: 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)."; 214 default: return "?"; 215 } 216 } 217 public String getDisplay() { 218 switch (this) { 219 case GROUP: return "Group"; 220 case DISPLAY: return "Display"; 221 case QUESTION: return "Question"; 222 case BOOLEAN: return "Boolean"; 223 case DECIMAL: return "Decimal"; 224 case INTEGER: return "Integer"; 225 case DATE: return "Date"; 226 case DATETIME: return "Date Time"; 227 case TIME: return "Time"; 228 case STRING: return "String"; 229 case TEXT: return "Text"; 230 case URL: return "Url"; 231 case CHOICE: return "Choice"; 232 case OPENCHOICE: return "Open Choice"; 233 case ATTACHMENT: return "Attachment"; 234 case REFERENCE: return "Reference"; 235 case QUANTITY: return "Quantity"; 236 default: return "?"; 237 } 238 } 239 240 241} 242