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 MedicationOrderStatusEnum { 009 010 /** 011 * Display: <b>Active</b><br> 012 * Code Value: <b>active</b> 013 * 014 * The prescription is 'actionable', but not all actions that are implied by it have occurred yet. 015 */ 016 ACTIVE("active", "http://hl7.org/fhir/medication-order-status"), 017 018 /** 019 * Display: <b>On Hold</b><br> 020 * Code Value: <b>on-hold</b> 021 * 022 * Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called "suspended". 023 */ 024 ON_HOLD("on-hold", "http://hl7.org/fhir/medication-order-status"), 025 026 /** 027 * Display: <b>Completed</b><br> 028 * Code Value: <b>completed</b> 029 * 030 * All actions that are implied by the prescription have occurred. 031 */ 032 COMPLETED("completed", "http://hl7.org/fhir/medication-order-status"), 033 034 /** 035 * Display: <b>Entered In Error</b><br> 036 * Code Value: <b>entered-in-error</b> 037 * 038 * The prescription was entered in error. 039 */ 040 ENTERED_IN_ERROR("entered-in-error", "http://hl7.org/fhir/medication-order-status"), 041 042 /** 043 * Display: <b>Stopped</b><br> 044 * Code Value: <b>stopped</b> 045 * 046 * Actions implied by the prescription are to be permanently halted, before all of them occurred. 047 */ 048 STOPPED("stopped", "http://hl7.org/fhir/medication-order-status"), 049 050 /** 051 * Display: <b>Draft</b><br> 052 * Code Value: <b>draft</b> 053 * 054 * The prescription is not yet 'actionable', i.e. it is a work in progress, requires sign-off or verification, and needs to be run through decision support process. 055 */ 056 DRAFT("draft", "http://hl7.org/fhir/medication-order-status"), 057 058 ; 059 060 /** 061 * Identifier for this Value Set: 062 * 063 */ 064 public static final String VALUESET_IDENTIFIER = ""; 065 066 /** 067 * Name for this Value Set: 068 * MedicationOrderStatus 069 */ 070 public static final String VALUESET_NAME = "MedicationOrderStatus"; 071 072 private static Map<String, MedicationOrderStatusEnum> CODE_TO_ENUM = new HashMap<String, MedicationOrderStatusEnum>(); 073 private static Map<String, Map<String, MedicationOrderStatusEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, MedicationOrderStatusEnum>>(); 074 075 private final String myCode; 076 private final String mySystem; 077 078 static { 079 for (MedicationOrderStatusEnum next : MedicationOrderStatusEnum.values()) { 080 CODE_TO_ENUM.put(next.getCode(), next); 081 082 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 083 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, MedicationOrderStatusEnum>()); 084 } 085 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 086 } 087 } 088 089 /** 090 * Returns the code associated with this enumerated value 091 */ 092 public String getCode() { 093 return myCode; 094 } 095 096 /** 097 * Returns the code system associated with this enumerated value 098 */ 099 public String getSystem() { 100 return mySystem; 101 } 102 103 /** 104 * Returns the enumerated value associated with this code 105 */ 106 public static MedicationOrderStatusEnum forCode(String theCode) { 107 MedicationOrderStatusEnum retVal = CODE_TO_ENUM.get(theCode); 108 return retVal; 109 } 110 111 /** 112 * Converts codes to their respective enumerated values 113 */ 114 public static final IValueSetEnumBinder<MedicationOrderStatusEnum> VALUESET_BINDER = new IValueSetEnumBinder<MedicationOrderStatusEnum>() { 115 @Override 116 public String toCodeString(MedicationOrderStatusEnum theEnum) { 117 return theEnum.getCode(); 118 } 119 120 @Override 121 public String toSystemString(MedicationOrderStatusEnum theEnum) { 122 return theEnum.getSystem(); 123 } 124 125 @Override 126 public MedicationOrderStatusEnum fromCodeString(String theCodeString) { 127 return CODE_TO_ENUM.get(theCodeString); 128 } 129 130 @Override 131 public MedicationOrderStatusEnum fromCodeString(String theCodeString, String theSystemString) { 132 Map<String, MedicationOrderStatusEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 133 if (map == null) { 134 return null; 135 } 136 return map.get(theCodeString); 137 } 138 139 }; 140 141 /** 142 * Constructor 143 */ 144 MedicationOrderStatusEnum(String theCode, String theSystem) { 145 myCode = theCode; 146 mySystem = theSystem; 147 } 148 149 150}