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>CodingDt</b> Datatype 078 * () 079 * 080 * <p> 081 * <b>Definition:</b> 082 * A reference to a code defined by a terminology system 083 * </p> 084 * 085 * <p> 086 * <b>Requirements:</b> 087 * References to codes are very common in healthcare models 088 * </p> 089 */ 090@DatatypeDef(name="Coding") 091public class CodingDt 092 extends BaseCodingDt implements ICompositeDatatype, org.hl7.fhir.instance.model.api.IBaseCoding { 093 094 /** 095 * Constructor 096 */ 097 public CodingDt() { 098 // nothing 099 } 100 101 /** 102 * Creates a new Coding with the given system and code 103 */ 104 public CodingDt(String theSystem, String theCode) { 105 setSystem(theSystem); 106 setCode(theCode); 107 } 108 109 /** 110 * Copy constructor: Creates a new Coding with the system and code copied out of the given coding 111 */ 112 public CodingDt(BaseCodingDt theCoding) { 113 this(theCoding.getSystemElement().getValueAsString(), theCoding.getCodeElement().getValue()); 114 } 115 116 117 @Child(name="system", type=UriDt.class, order=0, min=0, max=1, summary=true, modifier=false) 118 @Description( 119 shortDefinition="", 120 formalDefinition="The identification of the code system that defines the meaning of the symbol in the code." 121 ) 122 private UriDt mySystem; 123 124 @Child(name="version", type=StringDt.class, order=1, min=0, max=1, summary=true, modifier=false) 125 @Description( 126 shortDefinition="", 127 formalDefinition="The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged" 128 ) 129 private StringDt myVersion; 130 131 @Child(name="code", type=CodeDt.class, order=2, min=0, max=1, summary=true, modifier=false) 132 @Description( 133 shortDefinition="", 134 formalDefinition="A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)" 135 ) 136 private CodeDt myCode; 137 138 @Child(name="display", type=StringDt.class, order=3, min=0, max=1, summary=true, modifier=false) 139 @Description( 140 shortDefinition="", 141 formalDefinition="A representation of the meaning of the code in the system, following the rules of the system" 142 ) 143 private StringDt myDisplay; 144 145 @Child(name="userSelected", type=BooleanDt.class, order=4, min=0, max=1, summary=true, modifier=false) 146 @Description( 147 shortDefinition="", 148 formalDefinition="Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays)" 149 ) 150 private BooleanDt myUserSelected; 151 152 153 @Override 154 public boolean isEmpty() { 155 return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myCode, myDisplay, myUserSelected); 156 } 157 158 @Override 159 public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) { 160 return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySystem, myVersion, myCode, myDisplay, myUserSelected); 161 } 162 163 /** 164 * Gets the value(s) for <b>system</b> (). 165 * creating it if it does 166 * not exist. Will not return <code>null</code>. 167 * 168 * <p> 169 * <b>Definition:</b> 170 * The identification of the code system that defines the meaning of the symbol in the code. 171 * </p> 172 */ 173 public UriDt getSystemElement() { 174 if (mySystem == null) { 175 mySystem = new UriDt(); 176 } 177 return mySystem; 178 } 179 180 181 /** 182 * Gets the value(s) for <b>system</b> (). 183 * creating it if it does 184 * not exist. This method may return <code>null</code>. 185 * 186 * <p> 187 * <b>Definition:</b> 188 * The identification of the code system that defines the meaning of the symbol in the code. 189 * </p> 190 */ 191 public String getSystem() { 192 return getSystemElement().getValue(); 193 } 194 195 /** 196 * Sets the value(s) for <b>system</b> () 197 * 198 * <p> 199 * <b>Definition:</b> 200 * The identification of the code system that defines the meaning of the symbol in the code. 201 * </p> 202 */ 203 public CodingDt setSystem(UriDt theValue) { 204 mySystem = theValue; 205 return this; 206 } 207 208 209 210 /** 211 * Sets the value for <b>system</b> () 212 * 213 * <p> 214 * <b>Definition:</b> 215 * The identification of the code system that defines the meaning of the symbol in the code. 216 * </p> 217 */ 218 public CodingDt setSystem( String theUri) { 219 mySystem = new UriDt(theUri); 220 return this; 221 } 222 223 224 /** 225 * Gets the value(s) for <b>version</b> (). 226 * creating it if it does 227 * not exist. Will not return <code>null</code>. 228 * 229 * <p> 230 * <b>Definition:</b> 231 * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged 232 * </p> 233 */ 234 public StringDt getVersionElement() { 235 if (myVersion == null) { 236 myVersion = new StringDt(); 237 } 238 return myVersion; 239 } 240 241 242 /** 243 * Gets the value(s) for <b>version</b> (). 244 * creating it if it does 245 * not exist. This method may return <code>null</code>. 246 * 247 * <p> 248 * <b>Definition:</b> 249 * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged 250 * </p> 251 */ 252 public String getVersion() { 253 return getVersionElement().getValue(); 254 } 255 256 /** 257 * Sets the value(s) for <b>version</b> () 258 * 259 * <p> 260 * <b>Definition:</b> 261 * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged 262 * </p> 263 */ 264 public CodingDt setVersion(StringDt theValue) { 265 myVersion = theValue; 266 return this; 267 } 268 269 270 271 /** 272 * Sets the value for <b>version</b> () 273 * 274 * <p> 275 * <b>Definition:</b> 276 * The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged 277 * </p> 278 */ 279 public CodingDt setVersion( String theString) { 280 myVersion = new StringDt(theString); 281 return this; 282 } 283 284 285 /** 286 * Gets the value(s) for <b>code</b> (). 287 * creating it if it does 288 * not exist. Will not return <code>null</code>. 289 * 290 * <p> 291 * <b>Definition:</b> 292 * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) 293 * </p> 294 */ 295 public CodeDt getCodeElement() { 296 if (myCode == null) { 297 myCode = new CodeDt(); 298 } 299 return myCode; 300 } 301 302 303 /** 304 * Gets the value(s) for <b>code</b> (). 305 * creating it if it does 306 * not exist. This method may return <code>null</code>. 307 * 308 * <p> 309 * <b>Definition:</b> 310 * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) 311 * </p> 312 */ 313 public String getCode() { 314 return getCodeElement().getValue(); 315 } 316 317 /** 318 * Sets the value(s) for <b>code</b> () 319 * 320 * <p> 321 * <b>Definition:</b> 322 * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) 323 * </p> 324 */ 325 public CodingDt setCode(CodeDt theValue) { 326 myCode = theValue; 327 return this; 328 } 329 330 331 332 /** 333 * Sets the value for <b>code</b> () 334 * 335 * <p> 336 * <b>Definition:</b> 337 * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) 338 * </p> 339 */ 340 public CodingDt setCode( String theCode) { 341 myCode = new CodeDt(theCode); 342 return this; 343 } 344 345 346 /** 347 * Gets the value(s) for <b>display</b> (). 348 * creating it if it does 349 * not exist. Will not return <code>null</code>. 350 * 351 * <p> 352 * <b>Definition:</b> 353 * A representation of the meaning of the code in the system, following the rules of the system 354 * </p> 355 */ 356 public StringDt getDisplayElement() { 357 if (myDisplay == null) { 358 myDisplay = new StringDt(); 359 } 360 return myDisplay; 361 } 362 363 364 /** 365 * Gets the value(s) for <b>display</b> (). 366 * creating it if it does 367 * not exist. This method may return <code>null</code>. 368 * 369 * <p> 370 * <b>Definition:</b> 371 * A representation of the meaning of the code in the system, following the rules of the system 372 * </p> 373 */ 374 public String getDisplay() { 375 return getDisplayElement().getValue(); 376 } 377 378 /** 379 * Sets the value(s) for <b>display</b> () 380 * 381 * <p> 382 * <b>Definition:</b> 383 * A representation of the meaning of the code in the system, following the rules of the system 384 * </p> 385 */ 386 public CodingDt setDisplay(StringDt theValue) { 387 myDisplay = theValue; 388 return this; 389 } 390 391 392 393 /** 394 * Sets the value for <b>display</b> () 395 * 396 * <p> 397 * <b>Definition:</b> 398 * A representation of the meaning of the code in the system, following the rules of the system 399 * </p> 400 */ 401 public CodingDt setDisplay( String theString) { 402 myDisplay = new StringDt(theString); 403 return this; 404 } 405 406 407 /** 408 * Gets the value(s) for <b>userSelected</b> (). 409 * creating it if it does 410 * not exist. Will not return <code>null</code>. 411 * 412 * <p> 413 * <b>Definition:</b> 414 * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) 415 * </p> 416 */ 417 public BooleanDt getUserSelectedElement() { 418 if (myUserSelected == null) { 419 myUserSelected = new BooleanDt(); 420 } 421 return myUserSelected; 422 } 423 424 425 /** 426 * Gets the value(s) for <b>userSelected</b> (). 427 * creating it if it does 428 * not exist. This method may return <code>null</code>. 429 * 430 * <p> 431 * <b>Definition:</b> 432 * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) 433 * </p> 434 */ 435 public Boolean getUserSelected() { 436 return getUserSelectedElement().getValue(); 437 } 438 439 /** 440 * Sets the value(s) for <b>userSelected</b> () 441 * 442 * <p> 443 * <b>Definition:</b> 444 * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) 445 * </p> 446 */ 447 public CodingDt setUserSelected(BooleanDt theValue) { 448 myUserSelected = theValue; 449 return this; 450 } 451 452 453 454 /** 455 * Sets the value for <b>userSelected</b> () 456 * 457 * <p> 458 * <b>Definition:</b> 459 * Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays) 460 * </p> 461 */ 462 public CodingDt setUserSelected( boolean theBoolean) { 463 myUserSelected = new BooleanDt(theBoolean); 464 return this; 465 } 466 467 468 469 470}