Ejemplo n.º 1
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as DiagnosticOrderItemComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (Code != null)
                    {
                        dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
                    }
                    if (Specimen != null)
                    {
                        dest.Specimen = new List <Hl7.Fhir.Model.ResourceReference>(Specimen.DeepCopy());
                    }
                    if (BodySite != null)
                    {
                        dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopy();
                    }
                    if (StatusElement != null)
                    {
                        dest.StatusElement = (Code <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderStatus>)StatusElement.DeepCopy();
                    }
                    if (Event != null)
                    {
                        dest.Event = new List <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderEventComponent>(Event.DeepCopy());
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }
Ejemplo n.º 2
0
            public override ErrorList Validate()
            {
                var result = new ErrorList();

                result.AddRange(base.Validate());

                if (Code != null)
                {
                    result.AddRange(Code.Validate());
                }
                if (Specimen != null)
                {
                    Specimen.ForEach(elem => result.AddRange(elem.Validate()));
                }
                if (BodySite != null)
                {
                    result.AddRange(BodySite.Validate());
                }
                if (StatusElement != null)
                {
                    result.AddRange(StatusElement.Validate());
                }
                if (Event != null)
                {
                    Event.ForEach(elem => result.AddRange(elem.Validate()));
                }

                return(result);
            }
Ejemplo n.º 3
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DiagnosticOrder;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Orderer != null)
            {
                dest.Orderer = (Hl7.Fhir.Model.ResourceReference)Orderer.DeepCopy();
            }
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (Encounter != null)
            {
                dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
            }
            if (Reason != null)
            {
                dest.Reason = new List <Hl7.Fhir.Model.CodeableConcept>(Reason.DeepCopy());
            }
            if (SupportingInformation != null)
            {
                dest.SupportingInformation = new List <Hl7.Fhir.Model.ResourceReference>(SupportingInformation.DeepCopy());
            }
            if (Specimen != null)
            {
                dest.Specimen = new List <Hl7.Fhir.Model.ResourceReference>(Specimen.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderStatus>)StatusElement.DeepCopy();
            }
            if (PriorityElement != null)
            {
                dest.PriorityElement = (Code <Hl7.Fhir.Model.DiagnosticOrderPriority>)PriorityElement.DeepCopy();
            }
            if (Event != null)
            {
                dest.Event = new List <Hl7.Fhir.Model.DiagnosticOrder.EventComponent>(Event.DeepCopy());
            }
            if (Item != null)
            {
                dest.Item = new List <Hl7.Fhir.Model.DiagnosticOrder.ItemComponent>(Item.DeepCopy());
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            return(dest);
        }
            public override ErrorList Validate()
            {
                var result = new ErrorList();

                result.AddRange(base.Validate());

                if (Name != null)
                {
                    result.AddRange(Name.Validate());
                }
                if (Specimen != null)
                {
                    result.AddRange(Specimen.Validate());
                }
                if (Group != null)
                {
                    Group.ForEach(elem => result.AddRange(elem.Validate()));
                }
                if (Result != null)
                {
                    Result.ForEach(elem => result.AddRange(elem.Validate()));
                }

                return(result);
            }
Ejemplo n.º 5
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DiagnosticOrder;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Orderer != null)
                {
                    dest.Orderer = (Hl7.Fhir.Model.ResourceReference)Orderer.DeepCopy();
                }
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (ClinicalNotesElement != null)
                {
                    dest.ClinicalNotesElement = (Hl7.Fhir.Model.FhirString)ClinicalNotesElement.DeepCopy();
                }
                if (Specimen != null)
                {
                    dest.Specimen = new List <Hl7.Fhir.Model.ResourceReference>(Specimen.DeepCopy());
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderStatus>)StatusElement.DeepCopy();
                }
                if (PriorityElement != null)
                {
                    dest.PriorityElement = (Code <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderPriority>)PriorityElement.DeepCopy();
                }
                if (Event != null)
                {
                    dest.Event = new List <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderEventComponent>(Event.DeepCopy());
                }
                if (Item != null)
                {
                    dest.Item = new List <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderItemComponent>(Item.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Ejemplo n.º 6
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (Subject != null)
            {
                result.AddRange(Subject.Validate());
            }
            if (Orderer != null)
            {
                result.AddRange(Orderer.Validate());
            }
            if (Identifier != null)
            {
                Identifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Encounter != null)
            {
                result.AddRange(Encounter.Validate());
            }
            if (ClinicalNotesElement != null)
            {
                result.AddRange(ClinicalNotesElement.Validate());
            }
            if (Specimen != null)
            {
                Specimen.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (StatusElement != null)
            {
                result.AddRange(StatusElement.Validate());
            }
            if (PriorityElement != null)
            {
                result.AddRange(PriorityElement.Validate());
            }
            if (Event != null)
            {
                Event.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Item != null)
            {
                Item.ForEach(elem => result.AddRange(elem.Validate()));
            }

            return(result);
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DiagnosticReport;

            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 (BasedOn != null)
            {
                dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus>)StatusElement.DeepCopy();
            }
            if (Category != null)
            {
                dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
            }
            if (Code != null)
            {
                dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Encounter != null)
            {
                dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
            }
            if (Effective != null)
            {
                dest.Effective = (Hl7.Fhir.Model.Element)Effective.DeepCopy();
            }
            if (IssuedElement != null)
            {
                dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopy();
            }
            if (Performer != null)
            {
                dest.Performer = new List <Hl7.Fhir.Model.ResourceReference>(Performer.DeepCopy());
            }
            if (ResultsInterpreter != null)
            {
                dest.ResultsInterpreter = new List <Hl7.Fhir.Model.ResourceReference>(ResultsInterpreter.DeepCopy());
            }
            if (Specimen != null)
            {
                dest.Specimen = new List <Hl7.Fhir.Model.ResourceReference>(Specimen.DeepCopy());
            }
            if (Result != null)
            {
                dest.Result = new List <Hl7.Fhir.Model.ResourceReference>(Result.DeepCopy());
            }
            if (ImagingStudy != null)
            {
                dest.ImagingStudy = new List <Hl7.Fhir.Model.ResourceReference>(ImagingStudy.DeepCopy());
            }
            if (Media != null)
            {
                dest.Media = new List <Hl7.Fhir.Model.DiagnosticReport.MediaComponent>(Media.DeepCopy());
            }
            if (ConclusionElement != null)
            {
                dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)ConclusionElement.DeepCopy();
            }
            if (ConclusionCode != null)
            {
                dest.ConclusionCode = new List <Hl7.Fhir.Model.CodeableConcept>(ConclusionCode.DeepCopy());
            }
            if (PresentedForm != null)
            {
                dest.PresentedForm = new List <Hl7.Fhir.Model.Attachment>(PresentedForm.DeepCopy());
            }
            return(dest);
        }
Ejemplo n.º 8
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DiagnosticReport;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Name != null)
                {
                    dest.Name = (Hl7.Fhir.Model.CodeableConcept)Name.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportStatus>)StatusElement.DeepCopy();
                }
                if (IssuedElement != null)
                {
                    dest.IssuedElement = (Hl7.Fhir.Model.FhirDateTime)IssuedElement.DeepCopy();
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Performer != null)
                {
                    dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (Identifier != null)
                {
                    dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
                }
                if (RequestDetail != null)
                {
                    dest.RequestDetail = new List <Hl7.Fhir.Model.ResourceReference>(RequestDetail.DeepCopy());
                }
                if (ServiceCategory != null)
                {
                    dest.ServiceCategory = (Hl7.Fhir.Model.CodeableConcept)ServiceCategory.DeepCopy();
                }
                if (Diagnostic != null)
                {
                    dest.Diagnostic = (Hl7.Fhir.Model.Element)Diagnostic.DeepCopy();
                }
                if (Specimen != null)
                {
                    dest.Specimen = new List <Hl7.Fhir.Model.ResourceReference>(Specimen.DeepCopy());
                }
                if (Result != null)
                {
                    dest.Result = new List <Hl7.Fhir.Model.ResourceReference>(Result.DeepCopy());
                }
                if (ImagingStudy != null)
                {
                    dest.ImagingStudy = new List <Hl7.Fhir.Model.ResourceReference>(ImagingStudy.DeepCopy());
                }
                if (Image != null)
                {
                    dest.Image = new List <Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportImageComponent>(Image.DeepCopy());
                }
                if (ConclusionElement != null)
                {
                    dest.ConclusionElement = (Hl7.Fhir.Model.FhirString)ConclusionElement.DeepCopy();
                }
                if (CodedDiagnosis != null)
                {
                    dest.CodedDiagnosis = new List <Hl7.Fhir.Model.CodeableConcept>(CodedDiagnosis.DeepCopy());
                }
                if (PresentedForm != null)
                {
                    dest.PresentedForm = new List <Hl7.Fhir.Model.Attachment>(PresentedForm.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Ejemplo n.º 9
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Observation;

            if (dest != null)
            {
                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.Observation.ObservationStatus>)StatusElement.DeepCopy();
                }
                if (Category != null)
                {
                    dest.Category = (Hl7.Fhir.Model.CodeableConcept)Category.DeepCopy();
                }
                if (Code != null)
                {
                    dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Encounter != null)
                {
                    dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                }
                if (Effective != null)
                {
                    dest.Effective = (Hl7.Fhir.Model.Element)Effective.DeepCopy();
                }
                if (IssuedElement != null)
                {
                    dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopy();
                }
                if (Performer != null)
                {
                    dest.Performer = new List <Hl7.Fhir.Model.ResourceReference>(Performer.DeepCopy());
                }
                if (Value != null)
                {
                    dest.Value = (Hl7.Fhir.Model.Element)Value.DeepCopy();
                }
                if (DataAbsentReason != null)
                {
                    dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopy();
                }
                if (Interpretation != null)
                {
                    dest.Interpretation = (Hl7.Fhir.Model.CodeableConcept)Interpretation.DeepCopy();
                }
                if (CommentsElement != null)
                {
                    dest.CommentsElement = (Hl7.Fhir.Model.FhirString)CommentsElement.DeepCopy();
                }
                if (BodySite != null)
                {
                    dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopy();
                }
                if (Method != null)
                {
                    dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopy();
                }
                if (Specimen != null)
                {
                    dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopy();
                }
                if (Device != null)
                {
                    dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopy();
                }
                if (ReferenceRange != null)
                {
                    dest.ReferenceRange = new List <Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent>(ReferenceRange.DeepCopy());
                }
                if (Related != null)
                {
                    dest.Related = new List <Hl7.Fhir.Model.Observation.ObservationRelatedComponent>(Related.DeepCopy());
                }
                if (Component != null)
                {
                    dest.Component = new List <Hl7.Fhir.Model.Observation.ObservationComponentComponent>(Component.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Ejemplo n.º 10
0
        public static void SerializeSpecimen(Hl7.Fhir.Model.Specimen value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Specimen");
            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 identifier
            if (value.Identifier != null && !summary)
            {
                writer.WriteStartElement("identifier");
                IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element type
            if (value.Type != null && !summary)
            {
                writer.WriteStartElement("type");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element source
            if (value.Source != null && !summary && value.Source.Count > 0)
            {
                writer.WriteStartArrayElement("source");
                foreach (var item in value.Source)
                {
                    writer.WriteStartArrayMember("source");
                    SpecimenSerializer.SerializeSpecimenSourceComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element subject
            if (value.Subject != null && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element accessionIdentifier
            if (value.AccessionIdentifier != null && !summary && value.AccessionIdentifier.Count > 0)
            {
                writer.WriteStartArrayElement("accessionIdentifier");
                foreach (var item in value.AccessionIdentifier)
                {
                    writer.WriteStartArrayMember("accessionIdentifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element receivedTime
            if (value.ReceivedTimeElement != null && !summary)
            {
                writer.WriteStartElement("receivedTime");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.ReceivedTimeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element collection
            if (value.Collection != null && !summary)
            {
                writer.WriteStartElement("collection");
                SpecimenSerializer.SerializeSpecimenCollectionComponent(value.Collection, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element treatment
            if (value.Treatment != null && !summary && value.Treatment.Count > 0)
            {
                writer.WriteStartArrayElement("treatment");
                foreach (var item in value.Treatment)
                {
                    writer.WriteStartArrayMember("treatment");
                    SpecimenSerializer.SerializeSpecimenTreatmentComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element container
            if (value.Container != null && !summary && value.Container.Count > 0)
            {
                writer.WriteStartArrayElement("container");
                foreach (var item in value.Container)
                {
                    writer.WriteStartArrayMember("container");
                    SpecimenSerializer.SerializeSpecimenContainerComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as ProcedureRequest;

            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 (Definition != null)
            {
                dest.Definition = new List <Hl7.Fhir.Model.ResourceReference>(Definition.DeepCopy());
            }
            if (BasedOn != null)
            {
                dest.BasedOn = new List <Hl7.Fhir.Model.ResourceReference>(BasedOn.DeepCopy());
            }
            if (Replaces != null)
            {
                dest.Replaces = new List <Hl7.Fhir.Model.ResourceReference>(Replaces.DeepCopy());
            }
            if (Requisition != null)
            {
                dest.Requisition = (Hl7.Fhir.Model.Identifier)Requisition.DeepCopy();
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.RequestStatus>)StatusElement.DeepCopy();
            }
            if (IntentElement != null)
            {
                dest.IntentElement = (Code <Hl7.Fhir.Model.RequestIntent>)IntentElement.DeepCopy();
            }
            if (PriorityElement != null)
            {
                dest.PriorityElement = (Code <Hl7.Fhir.Model.RequestPriority>)PriorityElement.DeepCopy();
            }
            if (DoNotPerformElement != null)
            {
                dest.DoNotPerformElement = (Hl7.Fhir.Model.FhirBoolean)DoNotPerformElement.DeepCopy();
            }
            if (Category != null)
            {
                dest.Category = new List <Hl7.Fhir.Model.CodeableConcept>(Category.DeepCopy());
            }
            if (Code != null)
            {
                dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy();
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (Context != null)
            {
                dest.Context = (Hl7.Fhir.Model.ResourceReference)Context.DeepCopy();
            }
            if (Occurrence != null)
            {
                dest.Occurrence = (Hl7.Fhir.Model.DataType)Occurrence.DeepCopy();
            }
            if (AsNeeded != null)
            {
                dest.AsNeeded = (Hl7.Fhir.Model.DataType)AsNeeded.DeepCopy();
            }
            if (AuthoredOnElement != null)
            {
                dest.AuthoredOnElement = (Hl7.Fhir.Model.FhirDateTime)AuthoredOnElement.DeepCopy();
            }
            if (Requester != null)
            {
                dest.Requester = (Hl7.Fhir.Model.ProcedureRequest.RequesterComponent)Requester.DeepCopy();
            }
            if (PerformerType != null)
            {
                dest.PerformerType = (Hl7.Fhir.Model.CodeableConcept)PerformerType.DeepCopy();
            }
            if (Performer != null)
            {
                dest.Performer = (Hl7.Fhir.Model.ResourceReference)Performer.DeepCopy();
            }
            if (ReasonCode != null)
            {
                dest.ReasonCode = new List <Hl7.Fhir.Model.CodeableConcept>(ReasonCode.DeepCopy());
            }
            if (ReasonReference != null)
            {
                dest.ReasonReference = new List <Hl7.Fhir.Model.ResourceReference>(ReasonReference.DeepCopy());
            }
            if (SupportingInfo != null)
            {
                dest.SupportingInfo = new List <Hl7.Fhir.Model.ResourceReference>(SupportingInfo.DeepCopy());
            }
            if (Specimen != null)
            {
                dest.Specimen = new List <Hl7.Fhir.Model.ResourceReference>(Specimen.DeepCopy());
            }
            if (BodySite != null)
            {
                dest.BodySite = new List <Hl7.Fhir.Model.CodeableConcept>(BodySite.DeepCopy());
            }
            if (Note != null)
            {
                dest.Note = new List <Hl7.Fhir.Model.Annotation>(Note.DeepCopy());
            }
            if (RelevantHistory != null)
            {
                dest.RelevantHistory = new List <Hl7.Fhir.Model.ResourceReference>(RelevantHistory.DeepCopy());
            }
            return(dest);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Parse Specimen
        /// </summary>
        public static Hl7.Fhir.Model.Specimen ParseSpecimen(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Specimen existingInstance = null)
        {
            Hl7.Fhir.Model.Specimen result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Specimen();
            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 identifier
                else if (atName == "identifier")
                {
                    result.Identifier = IdentifierParser.ParseIdentifier(reader, errors);
                }

                // Parse element type
                else if (atName == "type")
                {
                    result.Type = CodeableConceptParser.ParseCodeableConcept(reader, errors);
                }

                // Parse element source
                else if (atName == "source")
                {
                    result.Source = new List <Hl7.Fhir.Model.Specimen.SpecimenSourceComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "source"))
                    {
                        result.Source.Add(SpecimenParser.ParseSpecimenSourceComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element subject
                else if (atName == "subject")
                {
                    result.Subject = ResourceReferenceParser.ParseResourceReference(reader, errors);
                }

                // Parse element accessionIdentifier
                else if (atName == "accessionIdentifier")
                {
                    result.AccessionIdentifier = new List <Hl7.Fhir.Model.Identifier>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "accessionIdentifier"))
                    {
                        result.AccessionIdentifier.Add(IdentifierParser.ParseIdentifier(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element receivedTime
                else if (atName == "receivedTime")
                {
                    result.ReceivedTimeElement = FhirDateTimeParser.ParseFhirDateTime(reader, errors);
                }

                // Parse element collection
                else if (atName == "collection")
                {
                    result.Collection = SpecimenParser.ParseSpecimenCollectionComponent(reader, errors);
                }

                // Parse element treatment
                else if (atName == "treatment")
                {
                    result.Treatment = new List <Hl7.Fhir.Model.Specimen.SpecimenTreatmentComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "treatment"))
                    {
                        result.Treatment.Add(SpecimenParser.ParseSpecimenTreatmentComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                // Parse element container
                else if (atName == "container")
                {
                    result.Container = new List <Hl7.Fhir.Model.Specimen.SpecimenContainerComponent>();
                    reader.EnterArray();

                    while (ParserUtils.IsAtArrayElement(reader, "container"))
                    {
                        result.Container.Add(SpecimenParser.ParseSpecimenContainerComponent(reader, errors));
                    }

                    reader.LeaveArray();
                }

                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);
        }
Ejemplo n.º 13
0
        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;
        }
Ejemplo n.º 14
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Observation;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Name != null)
                {
                    dest.Name = (Hl7.Fhir.Model.CodeableConcept)Name.DeepCopy();
                }
                if (Value != null)
                {
                    dest.Value = (Hl7.Fhir.Model.Element)Value.DeepCopy();
                }
                if (Interpretation != null)
                {
                    dest.Interpretation = (Hl7.Fhir.Model.CodeableConcept)Interpretation.DeepCopy();
                }
                if (CommentsElement != null)
                {
                    dest.CommentsElement = (Hl7.Fhir.Model.FhirString)CommentsElement.DeepCopy();
                }
                if (Applies != null)
                {
                    dest.Applies = (Hl7.Fhir.Model.Element)Applies.DeepCopy();
                }
                if (IssuedElement != null)
                {
                    dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.Observation.ObservationStatus>)StatusElement.DeepCopy();
                }
                if (ReliabilityElement != null)
                {
                    dest.ReliabilityElement = (Code <Hl7.Fhir.Model.Observation.ObservationReliability>)ReliabilityElement.DeepCopy();
                }
                if (BodySite != null)
                {
                    dest.BodySite = (Hl7.Fhir.Model.CodeableConcept)BodySite.DeepCopy();
                }
                if (Method != null)
                {
                    dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopy();
                }
                if (Identifier != null)
                {
                    dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy();
                }
                if (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Specimen != null)
                {
                    dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopy();
                }
                if (Performer != null)
                {
                    dest.Performer = new List <Hl7.Fhir.Model.ResourceReference>(Performer.DeepCopy());
                }
                if (ReferenceRange != null)
                {
                    dest.ReferenceRange = new List <Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent>(ReferenceRange.DeepCopy());
                }
                if (Related != null)
                {
                    dest.Related = new List <Hl7.Fhir.Model.Observation.ObservationRelatedComponent>(Related.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }