001package org.hl7.fhir.convertors.conv10_30.resources10_30;
002
003import org.hl7.fhir.convertors.context.ConversionContext10_30;
004import org.hl7.fhir.convertors.conv10_30.datatypes10_30.Reference10_30;
005import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.CodeableConcept10_30;
006import org.hl7.fhir.convertors.conv10_30.datatypes10_30.complextypes10_30.Identifier10_30;
007import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.DateTime10_30;
008import org.hl7.fhir.convertors.conv10_30.datatypes10_30.primitivetypes10_30.String10_30;
009import org.hl7.fhir.exceptions.FHIRException;
010
011public class FamilyMemberHistory10_30 {
012
013  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus> convertFamilyHistoryStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus> src) throws FHIRException {
014    if (src == null || src.isEmpty())
015      return null;
016    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatusEnumFactory());
017    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
018    switch (src.getValue()) {
019      case PARTIAL:
020        tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL);
021        break;
022      case COMPLETED:
023        tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED);
024        break;
025      case ENTEREDINERROR:
026        tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR);
027        break;
028      case HEALTHUNKNOWN:
029        tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN);
030        break;
031      default:
032        tgt.setValue(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL);
033        break;
034    }
035    return tgt;
036  }
037
038  static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus> convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus> src) throws FHIRException {
039    if (src == null || src.isEmpty())
040      return null;
041    org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatusEnumFactory());
042    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyElement(src, tgt);
043    switch (src.getValue()) {
044      case PARTIAL:
045        tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL);
046        break;
047      case COMPLETED:
048        tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED);
049        break;
050      case ENTEREDINERROR:
051        tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR);
052        break;
053      case HEALTHUNKNOWN:
054        tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN);
055        break;
056      default:
057        tgt.setValue(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyHistoryStatus.NULL);
058        break;
059    }
060    return tgt;
061  }
062
063  public static org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu2.model.FamilyMemberHistory src) throws FHIRException {
064    if (src == null || src.isEmpty())
065      return null;
066    org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory();
067    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
068    for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
069      tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
070    if (src.hasPatient())
071      tgt.setPatient(Reference10_30.convertReference(src.getPatient()));
072    if (src.hasDate())
073      tgt.setDateElement(DateTime10_30.convertDateTime(src.getDateElement()));
074    if (src.hasStatus())
075      tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement()));
076    if (src.hasNameElement())
077      tgt.setNameElement(String10_30.convertString(src.getNameElement()));
078    if (src.hasRelationship())
079      tgt.setRelationship(CodeableConcept10_30.convertCodeableConcept(src.getRelationship()));
080    if (src.hasGender())
081      tgt.setGenderElement(Enumerations10_30.convertAdministrativeGender(src.getGenderElement()));
082    if (src.hasBorn())
083      tgt.setBorn(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getBorn()));
084    if (src.hasAge())
085      tgt.setAge(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getAge()));
086    if (src.hasDeceased())
087      tgt.setDeceased(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getDeceased()));
088    for (org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition())
089      tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t));
090    return tgt;
091  }
092
093  public static org.hl7.fhir.dstu2.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException {
094    if (src == null || src.isEmpty())
095      return null;
096    org.hl7.fhir.dstu2.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory();
097    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyDomainResource(src, tgt);
098    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
099      tgt.addIdentifier(Identifier10_30.convertIdentifier(t));
100    if (src.hasPatient())
101      tgt.setPatient(Reference10_30.convertReference(src.getPatient()));
102    if (src.hasDate())
103      tgt.setDateElement(DateTime10_30.convertDateTime(src.getDateElement()));
104    if (src.hasStatus())
105      tgt.setStatusElement(convertFamilyHistoryStatus(src.getStatusElement()));
106    if (src.hasNameElement())
107      tgt.setNameElement(String10_30.convertString(src.getNameElement()));
108    if (src.hasRelationship())
109      tgt.setRelationship(CodeableConcept10_30.convertCodeableConcept(src.getRelationship()));
110    if (src.hasGender())
111      tgt.setGenderElement(Enumerations10_30.convertAdministrativeGender(src.getGenderElement()));
112    if (src.hasBorn())
113      tgt.setBorn(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getBorn()));
114    if (src.hasAge())
115      tgt.setAge(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getAge()));
116    if (src.hasDeceased())
117      tgt.setDeceased(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getDeceased()));
118    for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition())
119      tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t));
120    return tgt;
121  }
122
123  public static org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException {
124    if (src == null || src.isEmpty())
125      return null;
126    org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
127    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyBackboneElement(src,tgt);
128    if (src.hasCode())
129      tgt.setCode(CodeableConcept10_30.convertCodeableConcept(src.getCode()));
130    if (src.hasOutcome())
131      tgt.setOutcome(CodeableConcept10_30.convertCodeableConcept(src.getOutcome()));
132    if (src.hasOnset())
133      tgt.setOnset(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getOnset()));
134    return tgt;
135  }
136
137  public static org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException {
138    if (src == null || src.isEmpty())
139      return null;
140    org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu2.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
141    ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().copyBackboneElement(src,tgt);
142    if (src.hasCode())
143      tgt.setCode(CodeableConcept10_30.convertCodeableConcept(src.getCode()));
144    if (src.hasOutcome())
145      tgt.setOutcome(CodeableConcept10_30.convertCodeableConcept(src.getOutcome()));
146    if (src.hasOnset())
147      tgt.setOnset(ConversionContext10_30.INSTANCE.getVersionConvertor_10_30().convertType(src.getOnset()));
148    return tgt;
149  }
150}