001 002package ca.uhn.fhir.model.dstu2.valueset; 003 004import ca.uhn.fhir.model.api.*; 005import java.util.HashMap; 006import java.util.Map; 007 008public enum PractitionerRoleEnum { 009 010 /** 011 * Display: <b>Doctor</b><br> 012 * Code Value: <b>doctor</b> 013 */ 014 DOCTOR("doctor", "http://hl7.org/fhir/practitioner-role"), 015 016 /** 017 * Display: <b>Nurse</b><br> 018 * Code Value: <b>nurse</b> 019 */ 020 NURSE("nurse", "http://hl7.org/fhir/practitioner-role"), 021 022 /** 023 * Display: <b>Pharmacist</b><br> 024 * Code Value: <b>pharmacist</b> 025 */ 026 PHARMACIST("pharmacist", "http://hl7.org/fhir/practitioner-role"), 027 028 /** 029 * Display: <b>Researcher</b><br> 030 * Code Value: <b>researcher</b> 031 */ 032 RESEARCHER("researcher", "http://hl7.org/fhir/practitioner-role"), 033 034 /** 035 * Display: <b>Teacher/educator</b><br> 036 * Code Value: <b>teacher</b> 037 */ 038 TEACHER_EDUCATOR("teacher", "http://hl7.org/fhir/practitioner-role"), 039 040 /** 041 * Display: <b>ICT professional</b><br> 042 * Code Value: <b>ict</b> 043 */ 044 ICT_PROFESSIONAL("ict", "http://hl7.org/fhir/practitioner-role"), 045 046 ; 047 048 /** 049 * Identifier for this Value Set: 050 * 051 */ 052 public static final String VALUESET_IDENTIFIER = ""; 053 054 /** 055 * Name for this Value Set: 056 * PractitionerRole 057 */ 058 public static final String VALUESET_NAME = "PractitionerRole"; 059 060 private static Map<String, PractitionerRoleEnum> CODE_TO_ENUM = new HashMap<String, PractitionerRoleEnum>(); 061 private static Map<String, Map<String, PractitionerRoleEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, PractitionerRoleEnum>>(); 062 063 private final String myCode; 064 private final String mySystem; 065 066 static { 067 for (PractitionerRoleEnum next : PractitionerRoleEnum.values()) { 068 CODE_TO_ENUM.put(next.getCode(), next); 069 070 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 071 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, PractitionerRoleEnum>()); 072 } 073 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 074 } 075 } 076 077 /** 078 * Returns the code associated with this enumerated value 079 */ 080 public String getCode() { 081 return myCode; 082 } 083 084 /** 085 * Returns the code system associated with this enumerated value 086 */ 087 public String getSystem() { 088 return mySystem; 089 } 090 091 /** 092 * Returns the enumerated value associated with this code 093 */ 094 public static PractitionerRoleEnum forCode(String theCode) { 095 PractitionerRoleEnum retVal = CODE_TO_ENUM.get(theCode); 096 return retVal; 097 } 098 099 /** 100 * Converts codes to their respective enumerated values 101 */ 102 public static final IValueSetEnumBinder<PractitionerRoleEnum> VALUESET_BINDER = new IValueSetEnumBinder<PractitionerRoleEnum>() { 103 @Override 104 public String toCodeString(PractitionerRoleEnum theEnum) { 105 return theEnum.getCode(); 106 } 107 108 @Override 109 public String toSystemString(PractitionerRoleEnum theEnum) { 110 return theEnum.getSystem(); 111 } 112 113 @Override 114 public PractitionerRoleEnum fromCodeString(String theCodeString) { 115 return CODE_TO_ENUM.get(theCodeString); 116 } 117 118 @Override 119 public PractitionerRoleEnum fromCodeString(String theCodeString, String theSystemString) { 120 Map<String, PractitionerRoleEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 121 if (map == null) { 122 return null; 123 } 124 return map.get(theCodeString); 125 } 126 127 }; 128 129 /** 130 * Constructor 131 */ 132 PractitionerRoleEnum(String theCode, String theSystem) { 133 myCode = theCode; 134 mySystem = theSystem; 135 } 136 137 138}