001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.r4.model.EnumFactory;
035
036public class AppointmentCancellationReasonEnumFactory implements EnumFactory<AppointmentCancellationReason> {
037
038  public AppointmentCancellationReason fromCode(String codeString) throws IllegalArgumentException {
039    if (codeString == null || "".equals(codeString))
040      return null;
041    if ("pat".equals(codeString))
042      return AppointmentCancellationReason.PAT;
043    if ("pat-crs".equals(codeString))
044      return AppointmentCancellationReason.PATCRS;
045    if ("pat-cpp".equals(codeString))
046      return AppointmentCancellationReason.PATCPP;
047    if ("pat-dec".equals(codeString))
048      return AppointmentCancellationReason.PATDEC;
049    if ("pat-fb".equals(codeString))
050      return AppointmentCancellationReason.PATFB;
051    if ("pat-lt".equals(codeString))
052      return AppointmentCancellationReason.PATLT;
053    if ("pat-mt".equals(codeString))
054      return AppointmentCancellationReason.PATMT;
055    if ("pat-mv".equals(codeString))
056      return AppointmentCancellationReason.PATMV;
057    if ("pat-preg".equals(codeString))
058      return AppointmentCancellationReason.PATPREG;
059    if ("pat-swl".equals(codeString))
060      return AppointmentCancellationReason.PATSWL;
061    if ("pat-ucp".equals(codeString))
062      return AppointmentCancellationReason.PATUCP;
063    if ("prov".equals(codeString))
064      return AppointmentCancellationReason.PROV;
065    if ("prov-pers".equals(codeString))
066      return AppointmentCancellationReason.PROVPERS;
067    if ("prov-dch".equals(codeString))
068      return AppointmentCancellationReason.PROVDCH;
069    if ("prov-edu".equals(codeString))
070      return AppointmentCancellationReason.PROVEDU;
071    if ("prov-hosp".equals(codeString))
072      return AppointmentCancellationReason.PROVHOSP;
073    if ("prov-labs".equals(codeString))
074      return AppointmentCancellationReason.PROVLABS;
075    if ("prov-mri".equals(codeString))
076      return AppointmentCancellationReason.PROVMRI;
077    if ("prov-onc".equals(codeString))
078      return AppointmentCancellationReason.PROVONC;
079    if ("maint".equals(codeString))
080      return AppointmentCancellationReason.MAINT;
081    if ("meds-inc".equals(codeString))
082      return AppointmentCancellationReason.MEDSINC;
083    if ("other".equals(codeString))
084      return AppointmentCancellationReason.OTHER;
085    if ("oth-cms".equals(codeString))
086      return AppointmentCancellationReason.OTHCMS;
087    if ("oth-err".equals(codeString))
088      return AppointmentCancellationReason.OTHERR;
089    if ("oth-fin".equals(codeString))
090      return AppointmentCancellationReason.OTHFIN;
091    if ("oth-iv".equals(codeString))
092      return AppointmentCancellationReason.OTHIV;
093    if ("oth-int".equals(codeString))
094      return AppointmentCancellationReason.OTHINT;
095    if ("oth-mu".equals(codeString))
096      return AppointmentCancellationReason.OTHMU;
097    if ("oth-room".equals(codeString))
098      return AppointmentCancellationReason.OTHROOM;
099    if ("oth-oerr".equals(codeString))
100      return AppointmentCancellationReason.OTHOERR;
101    if ("oth-swie".equals(codeString))
102      return AppointmentCancellationReason.OTHSWIE;
103    if ("oth-weath".equals(codeString))
104      return AppointmentCancellationReason.OTHWEATH;
105    throw new IllegalArgumentException("Unknown AppointmentCancellationReason code '" + codeString + "'");
106  }
107
108  public String toCode(AppointmentCancellationReason code) {
109    if (code == AppointmentCancellationReason.PAT)
110      return "pat";
111    if (code == AppointmentCancellationReason.PATCRS)
112      return "pat-crs";
113    if (code == AppointmentCancellationReason.PATCPP)
114      return "pat-cpp";
115    if (code == AppointmentCancellationReason.PATDEC)
116      return "pat-dec";
117    if (code == AppointmentCancellationReason.PATFB)
118      return "pat-fb";
119    if (code == AppointmentCancellationReason.PATLT)
120      return "pat-lt";
121    if (code == AppointmentCancellationReason.PATMT)
122      return "pat-mt";
123    if (code == AppointmentCancellationReason.PATMV)
124      return "pat-mv";
125    if (code == AppointmentCancellationReason.PATPREG)
126      return "pat-preg";
127    if (code == AppointmentCancellationReason.PATSWL)
128      return "pat-swl";
129    if (code == AppointmentCancellationReason.PATUCP)
130      return "pat-ucp";
131    if (code == AppointmentCancellationReason.PROV)
132      return "prov";
133    if (code == AppointmentCancellationReason.PROVPERS)
134      return "prov-pers";
135    if (code == AppointmentCancellationReason.PROVDCH)
136      return "prov-dch";
137    if (code == AppointmentCancellationReason.PROVEDU)
138      return "prov-edu";
139    if (code == AppointmentCancellationReason.PROVHOSP)
140      return "prov-hosp";
141    if (code == AppointmentCancellationReason.PROVLABS)
142      return "prov-labs";
143    if (code == AppointmentCancellationReason.PROVMRI)
144      return "prov-mri";
145    if (code == AppointmentCancellationReason.PROVONC)
146      return "prov-onc";
147    if (code == AppointmentCancellationReason.MAINT)
148      return "maint";
149    if (code == AppointmentCancellationReason.MEDSINC)
150      return "meds-inc";
151    if (code == AppointmentCancellationReason.OTHER)
152      return "other";
153    if (code == AppointmentCancellationReason.OTHCMS)
154      return "oth-cms";
155    if (code == AppointmentCancellationReason.OTHERR)
156      return "oth-err";
157    if (code == AppointmentCancellationReason.OTHFIN)
158      return "oth-fin";
159    if (code == AppointmentCancellationReason.OTHIV)
160      return "oth-iv";
161    if (code == AppointmentCancellationReason.OTHINT)
162      return "oth-int";
163    if (code == AppointmentCancellationReason.OTHMU)
164      return "oth-mu";
165    if (code == AppointmentCancellationReason.OTHROOM)
166      return "oth-room";
167    if (code == AppointmentCancellationReason.OTHOERR)
168      return "oth-oerr";
169    if (code == AppointmentCancellationReason.OTHSWIE)
170      return "oth-swie";
171    if (code == AppointmentCancellationReason.OTHWEATH)
172      return "oth-weath";
173    return "?";
174  }
175
176  public String toSystem(AppointmentCancellationReason code) {
177    return code.getSystem();
178  }
179
180}