public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as CoverageComponent; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Coverage != null) { dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopy(); } if (PriorityElement != null) { dest.PriorityElement = (Hl7.Fhir.Model.PositiveInt)PriorityElement.DeepCopy(); } return(dest); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as EligibilityRequest; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.FinancialResourceStatusCodes>)StatusElement.DeepCopy(); } if (Priority != null) { dest.Priority = (Hl7.Fhir.Model.CodeableConcept)Priority.DeepCopy(); } if (Patient != null) { dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy(); } if (Serviced != null) { dest.Serviced = (Hl7.Fhir.Model.Element)Serviced.DeepCopy(); } if (CreatedElement != null) { dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopy(); } if (Enterer != null) { dest.Enterer = (Hl7.Fhir.Model.ResourceReference)Enterer.DeepCopy(); } if (Provider != null) { dest.Provider = (Hl7.Fhir.Model.ResourceReference)Provider.DeepCopy(); } if (Organization != null) { dest.Organization = (Hl7.Fhir.Model.ResourceReference)Organization.DeepCopy(); } if (Insurer != null) { dest.Insurer = (Hl7.Fhir.Model.ResourceReference)Insurer.DeepCopy(); } if (Facility != null) { dest.Facility = (Hl7.Fhir.Model.ResourceReference)Facility.DeepCopy(); } if (Coverage != null) { dest.Coverage = (Hl7.Fhir.Model.ResourceReference)Coverage.DeepCopy(); } if (BusinessArrangementElement != null) { dest.BusinessArrangementElement = (Hl7.Fhir.Model.FhirString)BusinessArrangementElement.DeepCopy(); } if (BenefitCategory != null) { dest.BenefitCategory = (Hl7.Fhir.Model.CodeableConcept)BenefitCategory.DeepCopy(); } if (BenefitSubCategory != null) { dest.BenefitSubCategory = (Hl7.Fhir.Model.CodeableConcept)BenefitSubCategory.DeepCopy(); } return(dest); }
public static void SerializeCoverage(Hl7.Fhir.Model.Coverage value, IFhirWriter writer, bool summary) { writer.WriteStartRootObject("Coverage"); writer.WriteStartComplexContent(); // Serialize element _id if (value.LocalIdElement != null) { writer.WritePrimitiveContents("_id", value.LocalIdElement, XmlSerializationHint.Attribute); } // Serialize element extension if (value.Extension != null && !summary && value.Extension.Count > 0) { writer.WriteStartArrayElement("extension"); foreach (var item in value.Extension) { writer.WriteStartArrayMember("extension"); ExtensionSerializer.SerializeExtension(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element language if (value.LanguageElement != null && !summary) { writer.WriteStartElement("language"); CodeSerializer.SerializeCode(value.LanguageElement, writer, summary); writer.WriteEndElement(); } // Serialize element text if (value.Text != null && !summary) { writer.WriteStartElement("text"); NarrativeSerializer.SerializeNarrative(value.Text, writer, summary); writer.WriteEndElement(); } // Serialize element contained if (value.Contained != null && !summary && value.Contained.Count > 0) { writer.WriteStartArrayElement("contained"); foreach (var item in value.Contained) { writer.WriteStartArrayMember("contained"); FhirSerializer.SerializeResource(item, writer, summary); writer.WriteEndArrayMember(); } writer.WriteEndArrayElement(); } // Serialize element issuer if (value.Issuer != null && !summary) { writer.WriteStartElement("issuer"); ResourceReferenceSerializer.SerializeResourceReference(value.Issuer, writer, summary); writer.WriteEndElement(); } // Serialize element period if (value.Period != null && !summary) { writer.WriteStartElement("period"); PeriodSerializer.SerializePeriod(value.Period, writer, summary); writer.WriteEndElement(); } // Serialize element type if (value.Type != null && !summary) { writer.WriteStartElement("type"); CodingSerializer.SerializeCoding(value.Type, writer, summary); writer.WriteEndElement(); } // Serialize element identifier if (value.Identifier != null && !summary) { writer.WriteStartElement("identifier"); IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary); writer.WriteEndElement(); } // Serialize element group if (value.Group != null && !summary) { writer.WriteStartElement("group"); IdentifierSerializer.SerializeIdentifier(value.Group, writer, summary); writer.WriteEndElement(); } // Serialize element plan if (value.Plan != null && !summary) { writer.WriteStartElement("plan"); IdentifierSerializer.SerializeIdentifier(value.Plan, writer, summary); writer.WriteEndElement(); } // Serialize element subplan if (value.Subplan != null && !summary) { writer.WriteStartElement("subplan"); IdentifierSerializer.SerializeIdentifier(value.Subplan, writer, summary); writer.WriteEndElement(); } // Serialize element dependent if (value.DependentElement != null && !summary) { writer.WriteStartElement("dependent"); IntegerSerializer.SerializeInteger(value.DependentElement, writer, summary); writer.WriteEndElement(); } // Serialize element sequence if (value.SequenceElement != null && !summary) { writer.WriteStartElement("sequence"); IntegerSerializer.SerializeInteger(value.SequenceElement, writer, summary); writer.WriteEndElement(); } // Serialize element subscriber if (value.Subscriber != null && !summary) { writer.WriteStartElement("subscriber"); CoverageSerializer.SerializeCoverageSubscriberComponent(value.Subscriber, writer, summary); writer.WriteEndElement(); } writer.WriteEndComplexContent(); writer.WriteEndRootObject(); }
/// <summary> /// Parse Coverage /// </summary> public static Hl7.Fhir.Model.Coverage ParseCoverage(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Coverage existingInstance = null) { Hl7.Fhir.Model.Coverage result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Coverage(); string currentElementName = reader.CurrentElementName; reader.EnterElement(); while (reader.HasMoreElements()) { var atName = reader.CurrentElementName; // Parse element extension if (atName == "extension") { result.Extension = new List <Hl7.Fhir.Model.Extension>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "extension")) { result.Extension.Add(ExtensionParser.ParseExtension(reader, errors)); } reader.LeaveArray(); } // Parse element language else if (atName == "language") { result.LanguageElement = CodeParser.ParseCode(reader, errors); } // Parse element text else if (atName == "text") { result.Text = NarrativeParser.ParseNarrative(reader, errors); } // Parse element contained else if (atName == "contained") { result.Contained = new List <Hl7.Fhir.Model.Resource>(); reader.EnterArray(); while (ParserUtils.IsAtArrayElement(reader, "contained")) { result.Contained.Add(ParserUtils.ParseContainedResource(reader, errors)); } reader.LeaveArray(); } // Parse element _id else if (atName == "_id") { result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id))); } // Parse element issuer else if (atName == "issuer") { result.Issuer = ResourceReferenceParser.ParseResourceReference(reader, errors); } // Parse element period else if (atName == "period") { result.Period = PeriodParser.ParsePeriod(reader, errors); } // Parse element type else if (atName == "type") { result.Type = CodingParser.ParseCoding(reader, errors); } // Parse element identifier else if (atName == "identifier") { result.Identifier = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element group else if (atName == "group") { result.Group = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element plan else if (atName == "plan") { result.Plan = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element subplan else if (atName == "subplan") { result.Subplan = IdentifierParser.ParseIdentifier(reader, errors); } // Parse element dependent else if (atName == "dependent") { result.DependentElement = IntegerParser.ParseInteger(reader, errors); } // Parse element sequence else if (atName == "sequence") { result.SequenceElement = IntegerParser.ParseInteger(reader, errors); } // Parse element subscriber else if (atName == "subscriber") { result.Subscriber = CoverageParser.ParseCoverageSubscriberComponent(reader, errors); } else { errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader); reader.SkipSubElementsFor(currentElementName); result = null; } } reader.LeaveElement(); return(result); }
public Bundle SetBundleOrder(Order order, DiagnosticOrder diagnosticOrder, Specimen specimen, Encounter encounter, Condition condition, Observation observation, Practitioner practitioner, Coverage coverage, Patient patient) { Bundle bundle = new Bundle(); bundle.Meta = new Meta() { Profile = new string[] { MetaBundleOrder } }; bundle.Entry = new List<Bundle.BundleEntryComponent>(); if (order != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = order, Transaction = new Bundle.BundleEntryTransactionComponent { Method = Bundle.HTTPVerb.POST, Url = "Order" } }; bundle.Entry.Add(component); } if (diagnosticOrder != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = diagnosticOrder, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "DiagnosticOrder" } }; bundle.Entry.Add(component); } if (specimen != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = specimen, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Specimen" } }; bundle.Entry.Add(component); } if (encounter != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = encounter, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Encounter" } }; bundle.Entry.Add(component); } if (condition != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = condition, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Condition" } }; bundle.Entry.Add(component); } if (observation != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = observation, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Observation" } }; bundle.Entry.Add(component); } if (practitioner != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = practitioner, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Practitioner" } }; bundle.Entry.Add(component); } if (coverage != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = coverage, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Coverage" } }; bundle.Entry.Add(component); } if (patient != null) { Bundle.BundleEntryComponent component = new Bundle.BundleEntryComponent { Resource = patient, Transaction = new Bundle.BundleEntryTransactionComponent() { Method = Bundle.HTTPVerb.POST, Url = "Patient" } }; bundle.Entry.Add(component); } return bundle; }