001package ca.cdr.api.model.enm; 002 003/*- 004 * #%L 005 * Smile CDR - CDR 006 * %% 007 * Copyright (C) 2016 - 2025 Smile CDR, Inc. 008 * %% 009 * All rights reserved. 010 * #L% 011 */ 012 013import ca.cdr.api.util.PublicApiConstants; 014import ca.uhn.fhir.context.FhirContext; 015import ca.uhn.fhir.context.FhirVersionEnum; 016import org.hl7.fhir.dstu3.model.Coding; 017 018import java.util.Collections; 019import java.util.HashMap; 020import java.util.Map; 021 022/** 023 * Stores commonly used CodeSystem information. Includes both the DSTU3 and R4 URIs, which can be accessed via 024 * FHIR context. 025 */ 026public enum CodeSystemEnum { 027 /* 028 * List more major, general use code systems up top 029 */ 030 SNOMED("2.16.840.1.113883.6.96", "SNOMED CT", "http://snomed.info/sct", "http://snomed.info/sct"), 031 LOINC("2.16.840.1.113883.6.1", "LOINC", "http://loinc.org", "http://loinc.org"), 032 RX_NORM( 033 "2.16.840.1.113883.6.88", 034 "RxNorm", 035 "http://www.nlm.nih.gov/research/umls/rxnorm", 036 "http://www.nlm.nih.gov/research/umls/rxnorm"), 037 NCI_THESAURUS( 038 "2.16.840.1.113883.3.26.1.1", "NCI Thesaurus", "http://ncicb.nci.nih.gov", "http://ncicb.nci.nih.gov"), 039 ICD_10_CM( 040 "2.16.840.1.113883.6.90", 041 "ICD-10-CM", 042 "http://hl7.org/fhir/sid/icd-10-cm", 043 "http://hl7.org/fhir/sid/icd-10-cm"), 044 ICD_10("2.16.840.1.113883.6.3", "ICD-10", "http://hl7.org/fhir/sid/icd-10", "http://hl7.org/fhir/sid/icd-10"), 045 ICD_9("2.16.840.1.113883.6.42", "ICD-9", "http://hl7.org/fhir/sid/icd-9-cm", "http://hl7.org/fhir/sid/icd-9-cm"), 046 ICD_9CM_DIAGNOSIS_CODES( 047 "2.16.840.1.113883.6.103", 048 "ICD-9-CM Diagnosis Codes", 049 "http://terminology.hl7.org/CodeSystem/ICD-9CM-diagnosiscodes", 050 "http://terminology.hl7.org/CodeSystem/ICD-9CM-diagnosiscodes"), 051 NDC("2.16.840.1.113883.6.69", "NDC/NHRIC", "http://hl7.org/fhir/sid/ndc", "http://hl7.org/fhir/sid/ndc"), 052 CVX("2.16.840.1.113883.12.292", "CDC Vaccine Code", "http://hl7.org/fhir/sid/cvx", "http://hl7.org/fhir/sid/cvx"), 053 PCS( 054 "2.16.840.1.113883.6.4", 055 "ICD-10 PCS Codes", 056 "http://www.icd10data.com/icd10pcs", 057 "http://www.icd10data.com/icd10pcs"), 058 CDT_2("2.16.840.1.113883.6.13", "Current Dental Terminology", "http://ada.org/cdt", "http://ada.org/cdt"), 059 UCUM( 060 "2.16.840.1.113883.6.8", 061 "UCUM - Unified Code for Units of Measure", 062 "http://unitsofmeasure.org", 063 "http://unitsofmeasure.org"), 064 065 /* 066 * Smaller more specific code systems 067 */ 068 HL7_ACT_CLASS( 069 "2.16.840.1.113883.5.6", 070 "v3 Code System ActClass", 071 "http://hl7.org/fhir/v3/ActClass", 072 "http://terminology.hl7.org/CodeSystem/v3-ActClass"), 073 HL7_ACT_CODE( 074 "2.16.840.1.113883.5.4", 075 "v3 Code System ActCode", 076 "http://hl7.org/fhir/v3/ActCode", 077 "http://terminology.hl7.org/CodeSystem/v3-ActCode"), 078 HL7_ACT_REASON( 079 "2.16.840.1.113883.5.8", 080 "v3 Code System ActReason", 081 "http://hl7.org/fhir/v3/ActReason", 082 "http://terminology.hl7.org/CodeSystem/v3-ActReason"), 083 CONDITION_CATEGORY_CS( 084 null, 085 "ConditionCategoryCS", 086 "http://standardhealthrecord.org/shr/condition/vs/ConditionCategoryVS", 087 null // JV 20210826: I did a quick look around the site but couldn't seem to find this ValueSet 088 ), 089 MARITAL_STATUS( 090 "2.16.840.1.113883.5.2", 091 "Code System MaritalStatus", 092 "http://hl7.org/fhir/v3/MaritalStatus", 093 "http://terminology.hl7.org/CodeSystem/v3-MaritalStatus"), 094 NULL_FLAVOR( 095 "2.16.840.1.113883.5.1008", 096 "Code System NullFlavor", 097 "http://hl7.org/fhir/v3/NullFlavor", 098 "http://terminology.hl7.org/CodeSystem/v3-NullFlavor"), 099 DIAGNOSIS_ROLE( 100 "2.16.840.1.113883.4.642.1.1054", 101 "Code System DiagnosisRole", 102 "http://hl7.org/fhir/diagnosis-role", 103 "http://terminology.hl7.org/CodeSystem/diagnosis-role"), 104 MEDICATION_ADMIN_STATUS( 105 "2.16.840.1.113883.4.642.4.1311", 106 "Code System MedicationAdmin Status", 107 "http://hl7.org/fhir/medication-admin-status", 108 "http://terminology.hl7.org/CodeSystem/medication-admin-status"), 109 ALLERGY_INTOLERANCE_CATEGORY( 110 "2.16.840.1.113883.4.642.4.134", 111 "Code System AllergyIntoleranceCategory", 112 "http://hl7.org/fhir/allergy-intolerance-category", 113 "http://hl7.org/fhir/allergy-intolerance-category"), 114 MEDICATION_REQUEST_STATUS_REASON( 115 "2.16.840.1.113883.4.642.1.1325", 116 "Code System MedicationRequest Status Reason", 117 null, 118 "http://terminology.hl7.org/CodeSystem/medicationrequest-status-reason"), 119 HL7_TBL_0063_RELATIONSHIP( 120 "2.16.840.1.113883.18.24", 121 "Code System Relationship", 122 "http://hl7.org/fhir/v2/0063", 123 "http://terminology.hl7.org/CodeSystem/v2-0063"), 124 HL7_TBL_0074_DIAGNOSTIC_SERVICE_SECTION( 125 "2.16.840.1.113883.18.29", 126 "Code System DiagnosticServiceSectionId", 127 "http://hl7.org/fhir/v2/0074", 128 "http://terminology.hl7.org/CodeSystem/v2-0074"), 129 HL7V2_TBL_0078( 130 null, 131 "v2 Interpretation Codes", 132 "http://hl7.org/fhir/v2/0078", 133 "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"), 134 ADMINISTRATIVE_GENDER( 135 "2.16.840.1.113883.4.642.4.2", 136 "AdministrativeGender", 137 "http://hl7.org/fhir/administrative-gender", 138 "http://hl7.org/fhir/administrative-gender"), 139 LOCATION_PHYSICAL_TYPE( 140 "2.16.840.1.113883.4.642.1.1108", 141 "Location Type", 142 "http://hl7.org/fhir/location-physical-type", 143 "http://terminology.hl7.org/CodeSystem/location-physical-type"), 144 HL7_TBL_0203( 145 "2.16.840.1.113883.18.108", 146 "Identifier Type", 147 "http://hl7.org/fhir/v2/0203", 148 "http://terminology.hl7.org/CodeSystem/v2-0203"), 149 HL7V2_TBL_0001( 150 "2.16.840.1.113883.18.2", 151 "v2 Sex", 152 "http://hl7.org/fhir/v2/0001", 153 "http://terminology.hl7.org/CodeSystem/v2-0001"), 154 HL7V2_TBL_0002( 155 "2.16.840.1.113883.18.179", 156 "v2 Marital Status", 157 "http://hl7.org/fhir/v2/0002", 158 "http://terminology.hl7.org/CodeSystem/v2-0002"), 159 HL7V2_TBL_0004( 160 "2.16.840.1.113883.18.5", 161 "v2 Patient Class", 162 PublicApiConstants.TABLE_0004_DSTU3, 163 PublicApiConstants.TABLE_0004_R4), 164 HL7V2_TBL_0003( 165 "2.16.840.1.113883.18.4", 166 "v2 Event Type", 167 PublicApiConstants.TABLE_0003_DSTU3, 168 PublicApiConstants.TABLE_0003_R4), 169 HL7V2_TBL_0038( 170 "2.16.840.1.113883.18.18", 171 "v2 Order Status", 172 "http://hl7.org/fhir/v2/0038", 173 "http://terminology.hl7.org/CodeSystem/v2-0038"), 174 HL7V2_TBL_0119( 175 "2.16.840.1.113883.18.48", 176 "v2 Order Control", 177 "http://hl7.org/fhir/v2/0119", 178 "http://terminology.hl7.org/CodeSystem/v2-0119"), 179 HL7V2_TBL_0123( 180 "2.16.840.1.113883.18.51", 181 "v2 Result status", 182 "http://hl7.org/fhir/v2/0123", 183 "http://terminology.hl7.org/CodeSystem/v2-0123"), 184 HL7V2_TBL_0127( 185 "2.16.840.1.113883.18.54", 186 "v2 Allergen Type", 187 "http://hl7.org/fhir/v2/0127", 188 "http://terminology.hl7.org/CodeSystem/v2-0127"), 189 HL7V2_TBL_0128( 190 "2.16.840.1.113883.18.55", 191 "v2 Allergy Severity", 192 "http://hl7.org/fhir/v2/0128", 193 "http://terminology.hl7.org/CodeSystem/v2-0128"), 194 HL7V2_TBL_0190( 195 "2.16.840.1.113883.18.101", 196 "v2 Address Type", 197 "http://hl7.org/fhir/v2/0190", 198 "http://terminology.hl7.org/CodeSystem/v2-0190"), 199 HL7V2_TBL_0191( 200 "2.16.840.1.113883.18.102", 201 "Content Data Type", 202 "http://hl7.org/fhir/v2/0191", 203 "http://terminology.hl7.org/CodeSystem/v2-0191"), 204 HL7V2_TBL_0834( 205 "2.16.840.1.113883.18.408", 206 "MimeTypes", 207 "http://hl7.org/fhir/v2/0834", 208 "http://terminology.hl7.org/CodeSystem/v2-0834"), 209 HL7V2_TBL_0202( 210 "2.16.840.1.113883.18.107", 211 "v2 Telecommunication Equipment Type", 212 "http://hl7.org/fhir/v2/0202", 213 "http://terminology.hl7.org/CodeSystem/v2-0202"), 214 HL7V2_TBL_0278( 215 "2.16.840.1.113883.18.171", 216 "v2 Filler status codes", 217 "http://hl7.org/fhir/v2/0278", 218 "http://terminology.hl7.org/CodeSystem/v2-0278"), 219 HL7V2_TBL_0276( 220 "2.16.840.1.113883.18.169", 221 "v2 Appointment Reason", 222 "http://hl7.org/fhir/v2/0276", 223 "http://terminology.hl7.org/CodeSystem/v2-0276"), 224 HL7V2_TBL_0305( 225 "2.16.840.1.113883.18.187", 226 "Person Location Type", 227 "http://hl7.org/fhir/v2/0305", 228 "http://terminology.hl7.org/CodeSystem/v2-0305"), 229 HL7V2_TBL_0322( 230 "2.16.840.1.113883.18.195", 231 "v2 Completion Status", 232 "http://hl7.org/fhir/v2/0322", 233 "http://terminology.hl7.org/CodeSystem/v2-0322"), 234 HL7V2_TBL_0438( 235 "2.16.840.1.113883.18.279", 236 "Allergy Clinical Status", 237 "http://hl7.org/fhir/v2/0438", 238 "http://terminology.hl7.org/CodeSystem/v2-0438"), 239 OBSERVATION_STATUS_CATEGORY( 240 "2.16.840.1.113883.4.642.1.393", 241 "Observation Category Codes", 242 "http://hl7.org/fhir/observation-category", 243 null // JV 20210826: this seems defunct as of R4--searching for the OID was useless 244 ), 245 OBSERVATION_VALUE( 246 "2.16.840.1.113883.5.1063", 247 "v3 Code System ObservationValue", 248 "http://hl7.org/fhir/v3/ObservationValue", 249 "http://terminology.hl7.org/CodeSystem/v3-ObservationValue"), 250 OBSERVATION_CATEGORY( 251 "2.16.840.1.113883.4.642.4.1125", 252 "Observation Category Codes", 253 null, 254 "http://terminology.hl7.org/CodeSystem/observation-category"), 255 OBSERVATION_INTERPRETATION( 256 "2.16.840.1.113883.5.83", 257 "v3 Code System ObservationInterpretation", 258 "http://hl7.org/fhir/v3/ObservationInterpretation", 259 "http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation"), 260 ROLE_CODE( 261 "2.16.840.1.113883.5.111", 262 "Role Code", 263 "http://hl7.org/fhir/v3/RoleCode", 264 "http://terminology.hl7.org/CodeSystem/v3-RoleCode"), 265 NUCC_HEALTHCARE_PROVIDER_TAXONOMY( 266 "2.16.840.1.113883.6.101", 267 "HealthCare Provider Taxonomy", 268 "http://nucc.org/provider-taxonomy", 269 "http://taxonomy.nucc.org"), 270 HSLOC( 271 "2.16.840.1.113883.6.259", 272 "NHSN Healthcare Facility Patient Care Location", 273 "https://www.cdc.gov/nhsn/cdaportal/terminology/codesystem/hsloc.html", 274 "https://www.cdc.gov/nhsn/cdaportal/terminology/codesystem/hsloc.html"), 275 IMMUNIZATION_RECOMMENDATION_STATUS( 276 "2.16.840.1.113883.4.642.4.1104", 277 "Immunization Recommendation Status Codes", 278 "http://hl7.org/fhir/immunization-recommendation-status", 279 "http://terminology.hl7.org/CodeSystem/immunization-recommendation-status"), 280 CPT_4( 281 "2.16.840.1.113883.6.12", 282 "Current Procedural Terminology", 283 "http://www.ama-assn.org/go/cpt", 284 "http://www.ama-assn.org/go/cpt"), 285 NDF_RT( 286 "2.16.840.1.113883.6.209", 287 "National Drug File ? Reference Terminology", 288 "http://hl7.org/fhir/ndfrt", 289 "http://hl7.org/fhir/ndfrt"), 290 ORGANIZATION_TYPE( 291 "2.16.840.1.113883.4.642.1.1128", 292 "Organization Type", 293 "http://hl7.org/fhir/organization-type", 294 "http://terminology.hl7.org/CodeSystem/organization-type"), 295 ADMIT_SOURCE( 296 "2.16.840.1.113883.4.642.1.1092", 297 "Admit Source", 298 "http://hl7.org/fhir/admit-source", 299 "http://terminology.hl7.org/CodeSystem/admit-source"), 300 DISCHARGE_DISPOSITION( 301 "2.16.840.1.113883.4.642.1.1093", 302 "Discharge Disposition", 303 "http://hl7.org/fhir/discharge-disposition", 304 "http://terminology.hl7.org/CodeSystem/discharge-disposition"), 305 CONDITION_CATEGORY( 306 "2.16.840.1.113883.4.642.1.1073", 307 "Condition Category", 308 "http://hl7.org/fhir/condition-category", 309 "http://terminology.hl7.org/CodeSystem/condition-category"), 310 US_CORE_CONDITION_CATEGORY( 311 "2.16.840.1.113883.4.642.40.2.16.2", 312 "US Core Condition Category", 313 "http://hl7.org/fhir/us/core/CodeSystem/condition-category", 314 "http://hl7.org/fhir/us/core/CodeSystem/condition-category"), 315 ALLERGY_INTOLERANCE_CLINICAL_STATUS( 316 "2.16.840.1.113883.4.642.1.1373", 317 "Allergy Intolerance Clinical Status", 318 "http://hl7.org/fhir/allergy-clinical-status", 319 "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical"), 320 ALLERGY_INTOLERANCE_VERIFICATION_STATUS( 321 "2.16.840.1.113883.4.642.1.1371", 322 "Allergy Intolerance Verification Status", 323 "http://hl7.org/fhir/allergy-verification-status", 324 "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification"), 325 SERVICE_TYPE( 326 "2.16.840.1.113883.4.642.1.1145", 327 "Service Type", 328 "http://hl7.org/fhir/service-type", 329 "http://terminology.hl7.org/CodeSystem/service-type"), 330 ENCOUNTER_STATUS( 331 "2.16.840.1.113883.4.642.4.247", 332 "Encounter Status", 333 "http://hl7.org/fhir/encounter-status", 334 "http://hl7.org/fhir/encounter-status"), 335 APPOINTMENT_STATUS( 336 "2.16.840.1.113883.4.642.4.485", 337 "Appointment Status", 338 "http://hl7.org/fhir/appointmentstatus", 339 "http://hl7.org/fhir/appointmentstatus"), 340 MEDICATION_REQUEST_STATUS( 341 "2.16.840.1.113883.4.642.4.1377", 342 "Medication Request Status Codes", 343 "http://hl7.org/fhir/medication-request-status", 344 "http://hl7.org/fhir/CodeSystem/medicationrequest-status"), 345 DIAGNOSTIC_REPORT_STATUS( 346 "2.16.840.1.113883.4.642.4.236", 347 "Diagnostic Report Status", 348 "http://hl7.org/fhir/diagnostic-report-status", 349 "http://hl7.org/fhir/diagnostic-report-status"), 350 REQUEST_STATUS( 351 "2.16.840.1.113883.4.642.1.112", 352 "Request Status", 353 "http://hl7.org/fhir/request-status", 354 "http://hl7.org/fhir/request-status"), 355 IMMUNIZATION_EVENT_STATUS( 356 "2.16.840.1.113883.4.642.1.110", 357 "Event Status", 358 "http://hl7.org/fhir/event-status", 359 "http://hl7.org/fhir/event-status"), 360 ADDRESS_TYPE( 361 "2.16.840.1.113883.4.642.1.70", 362 "Address Type", 363 "http://hl7.org/fhir/address-type", 364 "http://hl7.org/fhir/address-type"), 365 ADDRESS_USE( 366 "2.16.840.1.113883.4.642.1.68", 367 "Address Use", 368 "http://hl7.org/fhir/address-use", 369 "http://hl7.org/fhir/address-use"), 370 ALLERGY_INTOLERANCE_CRITICALITY( 371 "2.16.840.1.113883.4.642.4.130", 372 "Allergy Intolerance Criticality", 373 "http://hl7.org/fhir/allergy-intolerance-criticality", 374 "http://hl7.org/fhir/allergy-intolerance-criticality"), 375 CONTACT_POINT_USE( 376 "2.16.840.1.113883.4.642.1.74", 377 "Contact Point Use", 378 "http://hl7.org/fhir/contact-point-use", 379 "http://hl7.org/fhir/contact-point-use"), 380 CONTACT_POINT_SYSTEM( 381 "2.16.840.1.113883.4.642.1.72", 382 "Contact Point System", 383 "http://hl7.org/fhir/contact-point-system", 384 "http://hl7.org/fhir/contact-point-system"), 385 ACT_STATUS( 386 "2.16.840.1.113883.5.14", 387 "Act Status", 388 "http://terminology.hl7.org/CodeSystem/v3-ActStatus", 389 "http://terminology.hl7.org/CodeSystem/v3-ActStatus"), 390 HL7_TERMINOLOGY_ADMINISTRATIVE_GENDER( 391 "2.16.840.1.113883.5.1", 392 "HL7 Terminology Administrative Gender", 393 "http://terminology.hl7.org/CodeSystem/v3-AdministrativeGender", 394 "http://terminology.hl7.org/CodeSystem/v3-AdministrativeGender"), 395 ALLERGY_INTOLERANCE_TYPE( 396 "2.16.840.1.113883.4.642.4.132", 397 "Allergy Intolerance Type", 398 "http://hl7.org/fhir/allergy-intolerance-type", 399 "http://hl7.org/fhir/allergy-intolerance-type"), 400 ALLERGY_INTOLERANCE_REACTION_SEVERITY( 401 "2.16.840.1.113883.4.642.4.136", 402 "Allergy Intolerance Severity", 403 "http://hl7.org/fhir/reaction-event-severity", 404 "http://hl7.org/fhir/reaction-event-severity"), 405 DEVICE_STATUS( 406 "2.16.840.1.113883.4.642.4.210", 407 "Device Status", 408 "http://hl7.org/fhir/device-status", 409 "http://hl7.org/fhir/device-status"), 410 MEDICATION_STATUS( 411 "2.16.840.1.113883.4.642.4.1380", 412 "Nedication Status", 413 "http://hl7.org/fhir/CodeSystem/medication-status", 414 "http://hl7.org/fhir/CodeSystem/medication-status"), 415 OBSERVATION_STATUS( 416 "2.16.840.1.113883.4.642.4.401", 417 "Status of an observation", 418 "http://hl7.org/fhir/observation-status", 419 "http://hl7.org/fhir/observation-status"), 420 HISTORY_STATUS( 421 "2.16.840.1.113883.4.642.4.268", 422 "Family History Status", 423 "http://hl7.org/fhir/history-status", 424 "http://hl7.org/fhir/history-status"), 425 V2_TABLE_0131( 426 "2.16.840.1.113883.18.58", 427 "Master Code System for V2 table 0131 (Contact Role)", 428 "http://hl7.org/fhir/v2/0131", 429 "http://terminology.hl7.org/CodeSystem/v2-0131"), 430 HL7_CONDITION_CLINICAL_STATUS( 431 "2.16.840.1.113883.4.642.1.1074 ", 432 "Preferred value set for Condition Clinical Status", 433 "http://terminology.hl7.org/CodeSystem/condition-clinical", 434 "http://terminology.hl7.org/CodeSystem/condition-clinical"), 435 CONDITION_VERIFICATION_STATUS( 436 "2.16.840.1.113883.4.642.1.1075 ", 437 "The verification status to support or decline the clinical status of the condition or diagnosis", 438 "http://terminology.hl7.org/CodeSystem/condition-ver-status", 439 "http://terminology.hl7.org/CodeSystem/condition-ver-status"), 440 DATA_ABSENT_REASON( 441 "2.16.840.1.113883.4.642.4.1048", 442 "DataAbsentReason", 443 "http://hl7.org/fhir/data-absent-reason", 444 "http://terminology.hl7.org/CodeSystem/data-absent-reason"), 445 PROBLEM_ACT( 446 "2.16.840.1.113883.11.20.9.19", 447 "ProblemAct", 448 "urn:oid:2.16.840.1.113883.11.20.9.19", 449 "urn:oid:2.16.840.1.113883.11.20.9.19"), 450 RELIGIOUS_AFFILIATION( 451 "2.16.840.1.113883.5.1076", 452 "Assignment of spiritual faith affiliation", 453 "http://terminology.hl7.org/CodeSystem/v3-ReligiousAffiliation", 454 "http://terminology.hl7.org/CodeSystem/v3-ReligiousAffiliation"), 455 V3_US_TRIBAL_ENTITY( 456 "2.16.840.1.113883.5.140", 457 "Tribal Entity US", 458 "http://terminology.hl7.org/CodeSystem/v3-TribalEntityUS", 459 "http://terminology.hl7.org/CodeSystem/v3-TribalEntityUS"), 460 FAMILY_MEMBER_HISTORY( 461 "2.16.840.1.113883.4.642.4.268", 462 "FamilyHistoryStatus", 463 "http://hl7.org/fhir/history-status", 464 "http://hl7.org/fhir/history-status"), 465 NUBC_DISCHARGE_DISPOSITION( 466 "2.16.840.1.113883.6.301.5", 467 "NUBC code system for Patient Discharge Status", 468 "http://www.nubc.org/patient-discharge", 469 "http://www.nubc.org/patient-discharge"), 470 HL7_PARTICIPATION_FUNCTION( 471 "2.16.840.1.113883.5.88", 472 "ParticipationFunction", 473 "http://hl7.org/fhir/v3/ParticipationFunction", 474 "http://terminology.hl7.org/CodeSystem/v3-ParticipationFunction"), 475 HL7_ROLE_CLASS( 476 "2.16.840.1.113883.5.110", 477 "RoleClass", 478 "http://hl7.org/fhir/v3/RoleClass", 479 "http://terminology.hl7.org/CodeSystem/v3-RoleClass"), 480 CDA_CONFIDENTIALITY( 481 "2.16.840.1.113883.5.25", 482 null, 483 "http://hl7.org/fhir/v3/Confidentiality", 484 "http://terminology.hl7.org/CodeSystem/v3-Confidentiality"), 485 GOAL_LIFECYCLE_STATUS( 486 "2.16.840.1.113883.4.642.4.272", 487 "GoalLifecycleStatus", 488 "http://hl7.org/fhir/goal-status", 489 "http://hl7.org/fhir/goal-status"), 490 491 HL7_COMPOSITION_STATUS( 492 "2.16.840.1.113883.4.642.4.242", 493 "Composition Status", 494 "http://hl7.org/fhir/composition-status", 495 "http://hl7.org/fhir/composition-status"), 496 497 HL7_ENTITY_NAME_USE( 498 "2.16.840.1.113883.5.45", 499 "Entity Name Use", 500 "http://terminology.hl7.org/CodeSystem/v3-EntityNameUse", 501 "http://terminology.hl7.org/CodeSystem/v3-EntityNameUse"), 502 NAME_USE( 503 "2.16.840.1.113883.4.642.4.66", "Name Use", "http://hl7.org/fhir/name-use", "http://hl7.org/fhir/name-use"), 504 HL7_URL_SCHEME( 505 "2.16.840.1.113883.5.143", 506 "URL Scheme", 507 "http://terminology.hl7.org/CodeSystem/v3-URLScheme", 508 "http://terminology.hl7.org/CodeSystem/v3-URLScheme"), 509 US_CORE_DOCUMENT_REFERENCE_CATEGORY_CODES( 510 null, 511 "US Core DocumentReferences Category Codes", 512 "http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category", 513 "http://hl7.org/fhir/us/core/CodeSystem/us-core-documentreference-category"), 514 EVENT_STATUS( 515 "2.16.840.1.113883.4.642.4.110", 516 "Event Status", 517 "http://hl7.org/fhir/event-status", 518 "http://hl7.org/fhir/event-status"), 519 NCTS_DATA_COMPONENTS( 520 "1.2.36.1.2001.1001.101", 521 "Data Components", 522 "https://healthterminologies.gov.au/fhir/CodeSystem/nctis-data-components-1", 523 "https://healthterminologies.gov.au/fhir/CodeSystem/nctis-data-components-1"), 524 CONSENT_CATEGORY_CODES( 525 "2.16.840.1.113883.4.642.4.1226", 526 "Consent Category Codes", 527 "http://hl7.org/fhir/consentcategorycodes", 528 "http://terminology.hl7.org/CodeSystem/consentcategorycodes"), 529 HL7V2_TBL_0270( 530 "2.16.840.1.113883.18.163", 531 "Document Type", 532 "http://terminology.hl7.org/CodeSystem/v2-0270", 533 "http://terminology.hl7.org/CodeSystem/v2-0270"), 534 COVERAGE_CLASS( 535 "2.16.840.1.113883.4.642.4.1147", 536 "Coverage Class", 537 "http://terminology.hl7.org/CodeSystem/coverage-class", 538 "http://terminology.hl7.org/CodeSystem/coverage-class"), 539 SUBSCRIBER_RELATIONSHIP( 540 "2.16.840.1.113883.4.642.4.1386", 541 "Subscriber Relationship", 542 "http://terminology.hl7.org/CodeSystem/subscriber-relationship", 543 "http://terminology.hl7.org/CodeSystem/subscriber-relationship"), 544 US_CORE_CATEGORY( 545 "2.16.840.1.113883.4.642.40.2.16.3", 546 "US Core Category", 547 "http://hl7.org/fhir/us/core/CodeSystem/us-core-category", 548 "http://hl7.org/fhir/us/core/CodeSystem/us-core-category"), 549 FM_STATUS( 550 "2.16.840.1.113883.4.642.4.593", 551 "Financial Resource Status Codes", 552 "http://hl7.org/fhir/fm-status", 553 "http://hl7.org/fhir/fm-status"), 554 HL7V2_TBL_0136_YES_NO( 555 "2.16.840.1.113883.18.347", 556 "v2 Y/N Indicator", 557 "http://terminology.hl7.org/CodeSystem/v2-0136", 558 "http://terminology.hl7.org/CodeSystem/v2-0136"), 559 FORMAT_CODES( 560 "1.3.6.1.4.1.19376.1.2.3", 561 "Format Codes", 562 "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem", 563 "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem"), 564 HL7_DOCUMENT_FORMAT_CODES( 565 "2.16.840.1.113883.4.642.1.1407", 566 "Document Format Codes", 567 "http://terminology.hl7.org/CodeSystem/v3-HL7DocumentFormatCodes", 568 "http://terminology.hl7.org/CodeSystem/v3-HL7DocumentFormatCodes"); 569 570 final String myOid; 571 final String myDisplay; 572 final String myCodeSystemUriDstu3; 573 final String myCodeSystemUriR4; 574 static Map<String, CodeSystemEnum> ourByOid; 575 static Map<FhirContext, Map<String, CodeSystemEnum>> ourByFhirUris = new HashMap<>(); 576 577 CodeSystemEnum(String oid, String display, String codeSystemUriDstu3, String codeSystemUriR4) { 578 this.myOid = oid; 579 this.myDisplay = display; 580 this.myCodeSystemUriDstu3 = codeSystemUriDstu3; 581 this.myCodeSystemUriR4 = codeSystemUriR4; 582 } 583 584 public static CodeSystemEnum fromOid(String theOid) { 585 if (theOid == null) { 586 return null; 587 } 588 589 if (ourByOid == null) { 590 HashMap<String, CodeSystemEnum> values = new HashMap<>(); 591 for (CodeSystemEnum next : values()) { 592 values.put(next.getOid(), next); 593 } 594 ourByOid = Collections.unmodifiableMap(values); 595 } 596 return ourByOid.get(theOid); 597 } 598 599 public static CodeSystemEnum fromCodeSystemUri(String theFhirUri) { 600 // The legacy implementation assumes DSTU3, we have to preserve that for now. 601 // We can get rid of this after the old module is removed. 602 return fromCodeSystemUri(theFhirUri, FhirContext.forDstu3Cached()); 603 } 604 605 public static CodeSystemEnum fromCodeSystemUri(String theFhirUri, FhirContext theFhirContext) { 606 if (!ourByFhirUris.containsKey(theFhirContext)) { 607 HashMap<String, CodeSystemEnum> values = new HashMap<>(); 608 for (CodeSystemEnum next : values()) { 609 values.put(next.getCodeSystemUri(theFhirContext), next); 610 } 611 ourByFhirUris.put(theFhirContext, Collections.unmodifiableMap(values)); 612 } 613 return ourByFhirUris.get(theFhirContext).get(theFhirUri); 614 } 615 616 public String getOid() { 617 return myOid; 618 } 619 620 public boolean hasOid() { 621 return this.getOid() != null && !this.getOid().equals(""); 622 } 623 624 public String getDisplay() { 625 return myDisplay; 626 } 627 628 public boolean hasDisplay() { 629 return myDisplay != null; 630 } 631 632 public String getCodeSystemUri() { 633 return getCodeSystemUri((FhirVersionEnum) null); 634 } 635 636 public String getCodeSystemUri(FhirContext theCtx) { 637 if (theCtx != null) { 638 return getCodeSystemUri(theCtx.getVersion().getVersion()); 639 } 640 return myCodeSystemUriDstu3; 641 } 642 643 public String getCodeSystemUri(FhirVersionEnum theVersion) { 644 String retVal = myCodeSystemUriDstu3; 645 if ((null != theVersion) && theVersion.isEqualOrNewerThan(FhirVersionEnum.R4)) { 646 retVal = myCodeSystemUriR4; 647 } 648 return retVal; 649 } 650 651 public boolean hasCodeSystemUri() { 652 return myCodeSystemUriDstu3 != null; 653 } 654 655 /** 656 * @deprecated Only used in the legacy CDA transformer 657 */ 658 public Coding seedCoding() { 659 return new Coding().setSystem(this.getOid()); 660 } 661 662 public boolean isTheStringReferringToThisSystem(String systemCode) { 663 if (systemCode == null) { 664 return false; 665 } 666 return systemCode.equals(this.myCodeSystemUriDstu3) 667 || systemCode.equals(this.myOid) 668 || systemCode.equals("urn:oid:" + this.myOid); 669 } 670}