
001package org.hl7.fhir.convertors.conv30_40.resources30_40; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_40; 004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40; 005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40; 006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40; 007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Period30_40; 008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.*; 009import org.hl7.fhir.exceptions.FHIRException; 010 011public class Appointment30_40 { 012 013 public static org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { 014 if (src == null) 015 return null; 016 org.hl7.fhir.r4.model.Appointment tgt = new org.hl7.fhir.r4.model.Appointment(); 017 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 018 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 019 tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); 020 if (src.hasStatus()) 021 tgt.setStatusElement(convertAppointmentStatus(src.getStatusElement())); 022 if (src.hasServiceCategory()) 023 tgt.addServiceCategory(CodeableConcept30_40.convertCodeableConcept(src.getServiceCategory())); 024 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) 025 tgt.addServiceType(CodeableConcept30_40.convertCodeableConcept(t)); 026 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) 027 tgt.addSpecialty(CodeableConcept30_40.convertCodeableConcept(t)); 028 if (src.hasAppointmentType()) 029 tgt.setAppointmentType(CodeableConcept30_40.convertCodeableConcept(src.getAppointmentType())); 030 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) 031 tgt.addReasonCode(CodeableConcept30_40.convertCodeableConcept(t)); 032 for (org.hl7.fhir.dstu3.model.Reference t : src.getIndication()) 033 tgt.addReasonReference(Reference30_40.convertReference(t)); 034 if (src.hasPriority()) 035 tgt.setPriorityElement(UnsignedInt30_40.convertUnsignedInt(src.getPriorityElement())); 036 if (src.hasDescription()) 037 tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement())); 038 for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) 039 tgt.addSupportingInformation(Reference30_40.convertReference(t)); 040 if (src.hasStart()) 041 tgt.setStartElement(Instant30_40.convertInstant(src.getStartElement())); 042 if (src.hasEnd()) 043 tgt.setEndElement(Instant30_40.convertInstant(src.getEndElement())); 044 if (src.hasMinutesDuration()) 045 tgt.setMinutesDurationElement(PositiveInt30_40.convertPositiveInt(src.getMinutesDurationElement())); 046 for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) tgt.addSlot(Reference30_40.convertReference(t)); 047 if (src.hasCreated()) 048 tgt.setCreatedElement(DateTime30_40.convertDateTime(src.getCreatedElement())); 049 if (src.hasComment()) 050 tgt.setCommentElement(String30_40.convertString(src.getCommentElement())); 051 for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) 052 tgt.addBasedOn(Reference30_40.convertReference(t)); 053 for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) 054 tgt.addParticipant(convertAppointmentParticipantComponent(t)); 055 for (org.hl7.fhir.dstu3.model.Period t : src.getRequestedPeriod()) 056 tgt.addRequestedPeriod(Period30_40.convertPeriod(t)); 057 return tgt; 058 } 059 060 public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r4.model.Appointment src) throws FHIRException { 061 if (src == null) 062 return null; 063 org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); 064 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt); 065 for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) 066 tgt.addIdentifier(Identifier30_40.convertIdentifier(t)); 067 if (src.hasStatus()) 068 tgt.setStatusElement(convertAppointmentStatus(src.getStatusElement())); 069 if (src.hasServiceCategory()) 070 tgt.setServiceCategory(CodeableConcept30_40.convertCodeableConcept(src.getServiceCategoryFirstRep())); 071 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType()) 072 tgt.addServiceType(CodeableConcept30_40.convertCodeableConcept(t)); 073 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty()) 074 tgt.addSpecialty(CodeableConcept30_40.convertCodeableConcept(t)); 075 if (src.hasAppointmentType()) 076 tgt.setAppointmentType(CodeableConcept30_40.convertCodeableConcept(src.getAppointmentType())); 077 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) 078 tgt.addReason(CodeableConcept30_40.convertCodeableConcept(t)); 079 for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) 080 tgt.addIndication(Reference30_40.convertReference(t)); 081 if (src.hasPriority()) 082 tgt.setPriorityElement(UnsignedInt30_40.convertUnsignedInt(src.getPriorityElement())); 083 if (src.hasDescription()) 084 tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement())); 085 for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) 086 tgt.addSupportingInformation(Reference30_40.convertReference(t)); 087 if (src.hasStart()) 088 tgt.setStartElement(Instant30_40.convertInstant(src.getStartElement())); 089 if (src.hasEnd()) 090 tgt.setEndElement(Instant30_40.convertInstant(src.getEndElement())); 091 if (src.hasMinutesDuration()) 092 tgt.setMinutesDurationElement(PositiveInt30_40.convertPositiveInt(src.getMinutesDurationElement())); 093 for (org.hl7.fhir.r4.model.Reference t : src.getSlot()) tgt.addSlot(Reference30_40.convertReference(t)); 094 if (src.hasCreated()) 095 tgt.setCreatedElement(DateTime30_40.convertDateTime(src.getCreatedElement())); 096 if (src.hasComment()) 097 tgt.setCommentElement(String30_40.convertString(src.getCommentElement())); 098 for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) 099 tgt.addIncomingReferral(Reference30_40.convertReference(t)); 100 for (org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) 101 tgt.addParticipant(convertAppointmentParticipantComponent(t)); 102 for (org.hl7.fhir.r4.model.Period t : src.getRequestedPeriod()) 103 tgt.addRequestedPeriod(Period30_40.convertPeriod(t)); 104 return tgt; 105 } 106 107 public static org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { 108 if (src == null) 109 return null; 110 org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); 111 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 112 for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType()) 113 tgt.addType(CodeableConcept30_40.convertCodeableConcept(t)); 114 if (src.hasActor()) 115 tgt.setActor(Reference30_40.convertReference(src.getActor())); 116 if (src.hasRequired()) 117 tgt.setRequiredElement(convertParticipantRequired(src.getRequiredElement())); 118 if (src.hasStatus()) 119 tgt.setStatusElement(convertParticipationStatus(src.getStatusElement())); 120 return tgt; 121 } 122 123 public static org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { 124 if (src == null) 125 return null; 126 org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent(); 127 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 128 for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) 129 tgt.addType(CodeableConcept30_40.convertCodeableConcept(t)); 130 if (src.hasActor()) 131 tgt.setActor(Reference30_40.convertReference(src.getActor())); 132 if (src.hasRequired()) 133 tgt.setRequiredElement(convertParticipantRequired(src.getRequiredElement())); 134 if (src.hasStatus()) 135 tgt.setStatusElement(convertParticipationStatus(src.getStatusElement())); 136 return tgt; 137 } 138 139 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus> convertAppointmentStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.AppointmentStatus> src) throws FHIRException { 140 if (src == null || src.isEmpty()) 141 return null; 142 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Appointment.AppointmentStatusEnumFactory()); 143 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 144 switch (src.getValue()) { 145 case PROPOSED: 146 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED); 147 break; 148 case PENDING: 149 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING); 150 break; 151 case BOOKED: 152 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED); 153 break; 154 case ARRIVED: 155 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED); 156 break; 157 case FULFILLED: 158 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED); 159 break; 160 case CANCELLED: 161 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED); 162 break; 163 case NOSHOW: 164 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW); 165 break; 166 case ENTEREDINERROR: 167 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR); 168 break; 169 default: 170 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL); 171 break; 172 } 173 return tgt; 174 } 175 176 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.AppointmentStatus> convertAppointmentStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus> src) throws FHIRException { 177 if (src == null || src.isEmpty()) 178 return null; 179 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.AppointmentStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Appointment.AppointmentStatusEnumFactory()); 180 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 181 switch (src.getValue()) { 182 case PROPOSED: 183 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PROPOSED); 184 break; 185 case PENDING: 186 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.PENDING); 187 break; 188 case BOOKED: 189 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.BOOKED); 190 break; 191 case ARRIVED: 192 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ARRIVED); 193 break; 194 case FULFILLED: 195 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.FULFILLED); 196 break; 197 case CANCELLED: 198 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.CANCELLED); 199 break; 200 case NOSHOW: 201 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NOSHOW); 202 break; 203 case ENTEREDINERROR: 204 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.ENTEREDINERROR); 205 break; 206 default: 207 tgt.setValue(org.hl7.fhir.r4.model.Appointment.AppointmentStatus.NULL); 208 break; 209 } 210 return tgt; 211 } 212 213 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired> convertParticipantRequired(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.ParticipantRequired> src) throws FHIRException { 214 if (src == null || src.isEmpty()) 215 return null; 216 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Appointment.ParticipantRequiredEnumFactory()); 217 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 218 switch (src.getValue()) { 219 case REQUIRED: 220 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED); 221 break; 222 case OPTIONAL: 223 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL); 224 break; 225 case INFORMATIONONLY: 226 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY); 227 break; 228 default: 229 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL); 230 break; 231 } 232 return tgt; 233 } 234 235 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.ParticipantRequired> convertParticipantRequired(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired> src) throws FHIRException { 236 if (src == null || src.isEmpty()) 237 return null; 238 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.ParticipantRequired> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Appointment.ParticipantRequiredEnumFactory()); 239 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 240 switch (src.getValue()) { 241 case REQUIRED: 242 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED); 243 break; 244 case OPTIONAL: 245 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL); 246 break; 247 case INFORMATIONONLY: 248 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY); 249 break; 250 default: 251 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL); 252 break; 253 } 254 return tgt; 255 } 256 257 static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.ParticipationStatus> convertParticipationStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus> src) throws FHIRException { 258 if (src == null || src.isEmpty()) 259 return null; 260 org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.ParticipationStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Appointment.ParticipationStatusEnumFactory()); 261 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 262 switch (src.getValue()) { 263 case ACCEPTED: 264 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED); 265 break; 266 case DECLINED: 267 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED); 268 break; 269 case TENTATIVE: 270 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE); 271 break; 272 case NEEDSACTION: 273 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION); 274 break; 275 default: 276 tgt.setValue(org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL); 277 break; 278 } 279 return tgt; 280 } 281 282 static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus> convertParticipationStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Appointment.ParticipationStatus> src) throws FHIRException { 283 if (src == null || src.isEmpty()) 284 return null; 285 org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Appointment.ParticipationStatusEnumFactory()); 286 ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt); 287 switch (src.getValue()) { 288 case ACCEPTED: 289 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED); 290 break; 291 case DECLINED: 292 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED); 293 break; 294 case TENTATIVE: 295 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE); 296 break; 297 case NEEDSACTION: 298 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION); 299 break; 300 default: 301 tgt.setValue(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL); 302 break; 303 } 304 return tgt; 305 } 306}