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