001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017package ca.uhn.fhir.model.dstu2.composite; 018 019import java.net.URI; 020import java.math.BigDecimal; 021import org.apache.commons.lang3.StringUtils; 022import java.util.*; 023import ca.uhn.fhir.model.api.*; 024import ca.uhn.fhir.model.primitive.*; 025import ca.uhn.fhir.model.api.annotation.*; 026import ca.uhn.fhir.model.base.composite.*; 027 028import ca.uhn.fhir.model.dstu2.valueset.AddressTypeEnum; 029import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum; 030import ca.uhn.fhir.model.dstu2.valueset.AggregationModeEnum; 031import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum; 032import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; 033import ca.uhn.fhir.model.dstu2.composite.CodingDt; 034import ca.uhn.fhir.model.dstu2.valueset.ConstraintSeverityEnum; 035import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum; 036import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum; 037import ca.uhn.fhir.model.dstu2.resource.Device; 038import ca.uhn.fhir.model.dstu2.valueset.EventTimingEnum; 039import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum; 040import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum; 041import ca.uhn.fhir.model.dstu2.valueset.NameUseEnum; 042import ca.uhn.fhir.model.dstu2.resource.Organization; 043import ca.uhn.fhir.model.dstu2.resource.Patient; 044import ca.uhn.fhir.model.dstu2.composite.PeriodDt; 045import ca.uhn.fhir.model.dstu2.resource.Practitioner; 046import ca.uhn.fhir.model.dstu2.valueset.PropertyRepresentationEnum; 047import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum; 048import ca.uhn.fhir.model.dstu2.composite.QuantityDt; 049import ca.uhn.fhir.model.dstu2.composite.RangeDt; 050import ca.uhn.fhir.model.dstu2.resource.RelatedPerson; 051import ca.uhn.fhir.model.dstu2.valueset.SignatureTypeCodesEnum; 052import ca.uhn.fhir.model.dstu2.valueset.SlicingRulesEnum; 053import ca.uhn.fhir.model.api.TemporalPrecisionEnum; 054import ca.uhn.fhir.model.dstu2.valueset.TimingAbbreviationEnum; 055import ca.uhn.fhir.model.dstu2.valueset.UnitsOfTimeEnum; 056import ca.uhn.fhir.model.dstu2.resource.ValueSet; 057import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt; 058import ca.uhn.fhir.model.dstu2.composite.DurationDt; 059import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt; 060import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt; 061import ca.uhn.fhir.model.primitive.Base64BinaryDt; 062import ca.uhn.fhir.model.primitive.BooleanDt; 063import ca.uhn.fhir.model.primitive.BoundCodeDt; 064import ca.uhn.fhir.model.primitive.CodeDt; 065import ca.uhn.fhir.model.primitive.DateTimeDt; 066import ca.uhn.fhir.model.primitive.DecimalDt; 067import ca.uhn.fhir.model.primitive.IdDt; 068import ca.uhn.fhir.model.primitive.InstantDt; 069import ca.uhn.fhir.model.primitive.IntegerDt; 070import ca.uhn.fhir.model.primitive.MarkdownDt; 071import ca.uhn.fhir.model.primitive.PositiveIntDt; 072import ca.uhn.fhir.model.primitive.StringDt; 073import ca.uhn.fhir.model.primitive.UnsignedIntDt; 074import ca.uhn.fhir.model.primitive.UriDt; 075 076/** 077 * HAPI/FHIR <b>CodeableConceptDt</b> Datatype 078 * () 079 * 080 * <p> 081 * <b>Definition:</b> 082 * A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text 083 * </p> 084 * 085 * <p> 086 * <b>Requirements:</b> 087 * This is a common pattern in healthcare - a concept that may be defined by one or more codes from formal definitions including LOINC and SNOMED CT, and/or defined by the provision of text that captures a human sense of the concept 088 * </p> 089 */ 090@DatatypeDef(name="CodeableConcept") 091public class CodeableConceptDt 092 extends BaseIdentifiableElement implements ICompositeDatatype{ 093 094 /** 095 * Constructor 096 */ 097 public CodeableConceptDt() { 098 // nothing 099 } 100 101 /** 102 * Constructor which creates a CodeableConceptDt with one coding repetition, containing 103 * the given system and code 104 */ 105 public CodeableConceptDt(String theSystem, String theCode) { 106 addCoding().setSystem(theSystem).setCode(theCode); 107 } 108 109 @Child(name="coding", type=CodingDt.class, order=0, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) 110 @Description( 111 shortDefinition="", 112 formalDefinition="A reference to a code defined by a terminology system" 113 ) 114 private java.util.List<CodingDt> myCoding; 115 116 @Child(name="text", type=StringDt.class, order=1, min=0, max=1, summary=true, modifier=false) 117 @Description( 118 shortDefinition="", 119 formalDefinition="A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user" 120 ) 121 private StringDt myText; 122 123 124 @Override 125 public boolean isEmpty() { 126 return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCoding, myText); 127 } 128 129 @Override 130 public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) { 131 return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myCoding, myText); 132 } 133 134 /** 135 * Gets the value(s) for <b>coding</b> (). 136 * creating it if it does 137 * not exist. Will not return <code>null</code>. 138 * 139 * <p> 140 * <b>Definition:</b> 141 * A reference to a code defined by a terminology system 142 * </p> 143 */ 144 public java.util.List<CodingDt> getCoding() { 145 if (myCoding == null) { 146 myCoding = new java.util.ArrayList<CodingDt>(); 147 } 148 return myCoding; 149 } 150 151 /** 152 * Sets the value(s) for <b>coding</b> () 153 * 154 * <p> 155 * <b>Definition:</b> 156 * A reference to a code defined by a terminology system 157 * </p> 158 */ 159 public CodeableConceptDt setCoding(java.util.List<CodingDt> theValue) { 160 myCoding = theValue; 161 return this; 162 } 163 164 165 166 /** 167 * Adds and returns a new value for <b>coding</b> () 168 * 169 * <p> 170 * <b>Definition:</b> 171 * A reference to a code defined by a terminology system 172 * </p> 173 */ 174 public CodingDt addCoding() { 175 CodingDt newType = new CodingDt(); 176 getCoding().add(newType); 177 return newType; 178 } 179 180 /** 181 * Adds a given new value for <b>coding</b> () 182 * 183 * <p> 184 * <b>Definition:</b> 185 * A reference to a code defined by a terminology system 186 * </p> 187 * @param theValue The coding to add (must not be <code>null</code>) 188 */ 189 public CodeableConceptDt addCoding(CodingDt theValue) { 190 if (theValue == null) { 191 throw new NullPointerException("theValue must not be null"); 192 } 193 getCoding().add(theValue); 194 return this; 195 } 196 197 /** 198 * Gets the first repetition for <b>coding</b> (), 199 * creating it if it does not already exist. 200 * 201 * <p> 202 * <b>Definition:</b> 203 * A reference to a code defined by a terminology system 204 * </p> 205 */ 206 public CodingDt getCodingFirstRep() { 207 if (getCoding().isEmpty()) { 208 return addCoding(); 209 } 210 return getCoding().get(0); 211 } 212 213 /** 214 * Gets the value(s) for <b>text</b> (). 215 * creating it if it does 216 * not exist. Will not return <code>null</code>. 217 * 218 * <p> 219 * <b>Definition:</b> 220 * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user 221 * </p> 222 */ 223 public StringDt getTextElement() { 224 if (myText == null) { 225 myText = new StringDt(); 226 } 227 return myText; 228 } 229 230 231 /** 232 * Gets the value(s) for <b>text</b> (). 233 * creating it if it does 234 * not exist. This method may return <code>null</code>. 235 * 236 * <p> 237 * <b>Definition:</b> 238 * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user 239 * </p> 240 */ 241 public String getText() { 242 return getTextElement().getValue(); 243 } 244 245 /** 246 * Sets the value(s) for <b>text</b> () 247 * 248 * <p> 249 * <b>Definition:</b> 250 * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user 251 * </p> 252 */ 253 public CodeableConceptDt setText(StringDt theValue) { 254 myText = theValue; 255 return this; 256 } 257 258 259 260 /** 261 * Sets the value for <b>text</b> () 262 * 263 * <p> 264 * <b>Definition:</b> 265 * A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user 266 * </p> 267 */ 268 public CodeableConceptDt setText( String theString) { 269 myText = new StringDt(theString); 270 return this; 271 } 272 273 274 275 276}