Пример #1
0
        public static void SerializeXdsEntryAuthenticatorComponent(XdsEntry.XdsEntryAuthenticatorComponent value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element id
            if (value.Id != null)
            {
                writer.WriteStartElement("id");
                IdentifierSerializer.SerializeIdentifier(value.Id, writer);
                writer.WriteEndElement();
            }

            // Serialize element name
            if (value.Name != null)
            {
                writer.WriteStartElement("name");
                HumanNameSerializer.SerializeHumanName(value.Name, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
Пример #2
0
        public static void SerializePrescription(Prescription value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Prescription");
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element status
            if (value.Status != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Prescription.PrescriptionStatus>(value.Status, writer);
                writer.WriteEndElement();
            }

            // Serialize element patient
            if (value.Patient != null)
            {
                writer.WriteStartElement("patient");
                ResourceReferenceSerializer.SerializeResourceReference(value.Patient, writer);
                writer.WriteEndElement();
            }

            // Serialize element prescriber
            if (value.Prescriber != null)
            {
                writer.WriteStartElement("prescriber");
                ResourceReferenceSerializer.SerializeResourceReference(value.Prescriber, writer);
                writer.WriteEndElement();
            }

            // Serialize element prescribed
            if (value.Prescribed != null)
            {
                writer.WriteStartElement("prescribed");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.Prescribed, writer);
                writer.WriteEndElement();
            }

            // Serialize element dispense
            if (value.Dispense != null)
            {
                writer.WriteStartElement("dispense");
                PrescriptionSerializer.SerializePrescriptionDispenseComponent(value.Dispense, writer);
                writer.WriteEndElement();
            }

            // Serialize element medicine
            if (value.Medicine != null)
            {
                writer.WriteStartElement("medicine");
                PrescriptionSerializer.SerializePrescriptionMedicineComponent(value.Medicine, writer);
                writer.WriteEndElement();
            }

            // Serialize element administrationRequest
            if (value.AdministrationRequest != null)
            {
                writer.WriteStartElement("administrationRequest");
                PrescriptionSerializer.SerializePrescriptionAdministrationRequestComponent(value.AdministrationRequest, writer);
                writer.WriteEndElement();
            }

            // Serialize element reason
            if (value.Reason != null)
            {
                writer.WriteStartElement("reason");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Reason, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeDocumentInformation(DocumentInformation value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element id
            if (value.Id != null)
            {
                writer.WriteStartElement("id");
                IdentifierSerializer.SerializeIdentifier(value.Id, writer);
                writer.WriteEndElement();
            }

            // Serialize element versionId
            if (value.VersionId != null)
            {
                writer.WriteStartElement("versionId");
                IdentifierSerializer.SerializeIdentifier(value.VersionId, writer);
                writer.WriteEndElement();
            }

            // Serialize element created
            if (value.Created != null)
            {
                writer.WriteStartElement("created");
                InstantSerializer.SerializeInstant(value.Created, writer);
                writer.WriteEndElement();
            }

            // Serialize element class
            if (value.Class != null)
            {
                writer.WriteStartElement("class");
                CodingSerializer.SerializeCoding(value.Class, writer);
                writer.WriteEndElement();
            }

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

            // Serialize element title
            if (value.Title != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.Title, writer);
                writer.WriteEndElement();
            }

            // Serialize element confidentiality
            if (value.Confidentiality != null)
            {
                writer.WriteStartElement("confidentiality");
                CodingSerializer.SerializeCoding(value.Confidentiality, writer);
                writer.WriteEndElement();
            }

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

            // Serialize element author
            if (value.Author != null && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element attester
            if (value.Attester != null && value.Attester.Count > 0)
            {
                writer.WriteStartArrayElement("attester");
                foreach (var item in value.Attester)
                {
                    writer.WriteStartArrayMember("attester");
                    DocumentInformationSerializer.SerializeDocumentInformationAttesterComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element custodian
            if (value.Custodian != null)
            {
                writer.WriteStartElement("custodian");
                ResourceReferenceSerializer.SerializeResourceReference(value.Custodian, writer);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.Event != null)
            {
                writer.WriteStartElement("event");
                DocumentInformationSerializer.SerializeDocumentInformationEventComponent(value.Event, writer);
                writer.WriteEndElement();
            }

            // Serialize element encounter
            if (value.Encounter != null)
            {
                writer.WriteStartElement("encounter");
                ResourceReferenceSerializer.SerializeResourceReference(value.Encounter, writer);
                writer.WriteEndElement();
            }

            // Serialize element facilityType
            if (value.FacilityType != null)
            {
                writer.WriteStartElement("facilityType");
                CodeableConceptSerializer.SerializeCodeableConcept(value.FacilityType, writer);
                writer.WriteEndElement();
            }

            // Serialize element practiceSetting
            if (value.PracticeSetting != null)
            {
                writer.WriteStartElement("practiceSetting");
                CodeableConceptSerializer.SerializeCodeableConcept(value.PracticeSetting, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeVisit(Hl7.Fhir.Model.Visit value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Visit");
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalId != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalId, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element status
            if (value.Status != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Visit.EncounterState>(value.Status, writer);
                writer.WriteEndElement();
            }

            // Serialize element class
            if (value.Class != null)
            {
                writer.WriteStartElement("class");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Visit.EncounterClass>(value.Class, writer);
                writer.WriteEndElement();
            }

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

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

            // Serialize element participant
            if (value.Participant != null && value.Participant.Count > 0)
            {
                writer.WriteStartArrayElement("participant");
                foreach (var item in value.Participant)
                {
                    writer.WriteStartArrayMember("participant");
                    VisitSerializer.SerializeVisitParticipantComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element fulfills
            if (value.Fulfills != null)
            {
                writer.WriteStartElement("fulfills");
                ResourceReferenceSerializer.SerializeResourceReference(value.Fulfills, writer);
                writer.WriteEndElement();
            }

            // Serialize element length
            if (value.Length != null)
            {
                writer.WriteStartElement("length");
                QuantitySerializer.SerializeQuantity(value.Length, writer);
                writer.WriteEndElement();
            }

            // Serialize element reason
            if (value.Reason != null)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("reason", value.Reason.GetType()));
                FhirSerializer.SerializeElement(value.Reason, writer);
                writer.WriteEndElement();
            }

            // Serialize element indication
            if (value.Indication != null)
            {
                writer.WriteStartElement("indication");
                ResourceReferenceSerializer.SerializeResourceReference(value.Indication, writer);
                writer.WriteEndElement();
            }

            // Serialize element priority
            if (value.Priority != null)
            {
                writer.WriteStartElement("priority");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Priority, writer);
                writer.WriteEndElement();
            }

            // Serialize element hospitalization
            if (value.Hospitalization != null)
            {
                writer.WriteStartElement("hospitalization");
                VisitSerializer.SerializeVisitHospitalizationComponent(value.Hospitalization, writer);
                writer.WriteEndElement();
            }

            // Serialize element location
            if (value.Location != null && value.Location.Count > 0)
            {
                writer.WriteStartArrayElement("location");
                foreach (var item in value.Location)
                {
                    writer.WriteStartArrayMember("location");
                    VisitSerializer.SerializeVisitLocationComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element serviceProvider
            if (value.ServiceProvider != null)
            {
                writer.WriteStartElement("serviceProvider");
                ResourceReferenceSerializer.SerializeResourceReference(value.ServiceProvider, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #5
0
        public static void SerializeDiagnosticOrder(Hl7.Fhir.Model.DiagnosticOrder value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DiagnosticOrder");
            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 subject
            if (value.Subject != null && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

            // Serialize element clinicalNotes
            if (value.ClinicalNotesElement != null && !summary)
            {
                writer.WriteStartElement("clinicalNotes");
                FhirStringSerializer.SerializeFhirString(value.ClinicalNotesElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element specimen
            if (value.Specimen != null && !summary && value.Specimen.Count > 0)
            {
                writer.WriteStartArrayElement("specimen");
                foreach (var item in value.Specimen)
                {
                    writer.WriteStartArrayMember("specimen");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element priority
            if (value.PriorityElement != null && !summary)
            {
                writer.WriteStartElement("priority");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.DiagnosticOrder.DiagnosticOrderPriority>(value.PriorityElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.Event != null && !summary && value.Event.Count > 0)
            {
                writer.WriteStartArrayElement("event");
                foreach (var item in value.Event)
                {
                    writer.WriteStartArrayMember("event");
                    DiagnosticOrderSerializer.SerializeDiagnosticOrderEventComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeMedicationAdministration(Hl7.Fhir.Model.MedicationAdministration value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("MedicationAdministration");
            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 && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.MedicationAdministration.MedicationAdministrationStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

            // Serialize element wasNotGiven
            if (value.WasNotGivenElement != null && !summary)
            {
                writer.WriteStartElement("wasNotGiven");
                FhirBooleanSerializer.SerializeFhirBoolean(value.WasNotGivenElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reasonNotGiven
            if (value.ReasonNotGiven != null && !summary && value.ReasonNotGiven.Count > 0)
            {
                writer.WriteStartArrayElement("reasonNotGiven");
                foreach (var item in value.ReasonNotGiven)
                {
                    writer.WriteStartArrayMember("reasonNotGiven");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element whenGiven
            if (value.WhenGiven != null && !summary)
            {
                writer.WriteStartElement("whenGiven");
                PeriodSerializer.SerializePeriod(value.WhenGiven, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element administrationDevice
            if (value.AdministrationDevice != null && !summary && value.AdministrationDevice.Count > 0)
            {
                writer.WriteStartArrayElement("administrationDevice");
                foreach (var item in value.AdministrationDevice)
                {
                    writer.WriteStartArrayMember("administrationDevice");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element dosage
            if (value.Dosage != null && !summary && value.Dosage.Count > 0)
            {
                writer.WriteStartArrayElement("dosage");
                foreach (var item in value.Dosage)
                {
                    writer.WriteStartArrayMember("dosage");
                    MedicationAdministrationSerializer.SerializeMedicationAdministrationDosageComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #7
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();
        }
Пример #8
0
        public static void SerializeXdsFolder(XdsFolder value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("XdsFolder");
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element code
            if (value.Code != null && value.Code.Count > 0)
            {
                writer.WriteStartArrayElement("code");
                foreach (var item in value.Code)
                {
                    writer.WriteStartArrayMember("code");
                    CodingSerializer.SerializeCoding(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element title
            if (value.Title != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.Title, writer);
                writer.WriteEndElement();
            }

            // Serialize element patientId
            if (value.PatientId != null)
            {
                writer.WriteStartElement("patientId");
                IdentifierSerializer.SerializeIdentifier(value.PatientId, writer);
                writer.WriteEndElement();
            }

            // Serialize element homeCommunity
            if (value.HomeCommunity != null)
            {
                writer.WriteStartElement("homeCommunity");
                FhirStringSerializer.SerializeFhirString(value.HomeCommunity, writer);
                writer.WriteEndElement();
            }

            // Serialize element comments
            if (value.Comments != null)
            {
                writer.WriteStartElement("comments");
                FhirStringSerializer.SerializeFhirString(value.Comments, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #9
0
        public static void SerializeXdsEntry(XdsEntry value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("XdsEntry");
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element url
            if (value.Url != null)
            {
                writer.WriteStartElement("url");
                FhirUriSerializer.SerializeFhirUri(value.Url, writer);
                writer.WriteEndElement();
            }

            // Serialize element repositoryId
            if (value.RepositoryId != null)
            {
                writer.WriteStartElement("repositoryId");
                FhirUriSerializer.SerializeFhirUri(value.RepositoryId, writer);
                writer.WriteEndElement();
            }

            // Serialize element mimeType
            if (value.MimeType != null)
            {
                writer.WriteStartElement("mimeType");
                FhirStringSerializer.SerializeFhirString(value.MimeType, writer);
                writer.WriteEndElement();
            }

            // Serialize element format
            if (value.Format != null)
            {
                writer.WriteStartElement("format");
                CodingSerializer.SerializeCoding(value.Format, writer);
                writer.WriteEndElement();
            }

            // Serialize element class
            if (value.Class != null)
            {
                writer.WriteStartElement("class");
                CodingSerializer.SerializeCoding(value.Class, writer);
                writer.WriteEndElement();
            }

            // Serialize element type
            if (value.Type != null)
            {
                writer.WriteStartElement("type");
                CodingSerializer.SerializeCoding(value.Type, writer);
                writer.WriteEndElement();
            }

            // Serialize element title
            if (value.Title != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.Title, writer);
                writer.WriteEndElement();
            }

            // Serialize element documentId
            if (value.DocumentId != null)
            {
                writer.WriteStartElement("documentId");
                FhirUriSerializer.SerializeFhirUri(value.DocumentId, writer);
                writer.WriteEndElement();
            }

            // Serialize element availability
            if (value.Availability != null)
            {
                writer.WriteStartElement("availability");
                CodeSerializer.SerializeCode <XdsEntry.XdsEntryAvailability>(value.Availability, writer);
                writer.WriteEndElement();
            }

            // Serialize element confidentialityCode
            if (value.ConfidentialityCode != null)
            {
                writer.WriteStartElement("confidentialityCode");
                CodingSerializer.SerializeCoding(value.ConfidentialityCode, writer);
                writer.WriteEndElement();
            }

            // Serialize element created
            if (value.Created != null)
            {
                writer.WriteStartElement("created");
                InstantSerializer.SerializeInstant(value.Created, writer);
                writer.WriteEndElement();
            }

            // Serialize element event
            if (value.Event != null && value.Event.Count > 0)
            {
                writer.WriteStartArrayElement("event");
                foreach (var item in value.Event)
                {
                    writer.WriteStartArrayMember("event");
                    CodingSerializer.SerializeCoding(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element hash
            if (value.Hash != null)
            {
                writer.WriteStartElement("hash");
                FhirStringSerializer.SerializeFhirString(value.Hash, writer);
                writer.WriteEndElement();
            }

            // Serialize element size
            if (value.Size != null)
            {
                writer.WriteStartElement("size");
                FhirStringSerializer.SerializeFhirString(value.Size, writer);
                writer.WriteEndElement();
            }

            // Serialize element lang
            if (value.Lang != null)
            {
                writer.WriteStartElement("lang");
                FhirStringSerializer.SerializeFhirString(value.Lang, writer);
                writer.WriteEndElement();
            }

            // Serialize element folder
            if (value.Folder != null && value.Folder.Count > 0)
            {
                writer.WriteStartArrayElement("folder");
                foreach (var item in value.Folder)
                {
                    writer.WriteStartArrayMember("folder");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element patientId
            if (value.PatientId != null)
            {
                writer.WriteStartElement("patientId");
                IdentifierSerializer.SerializeIdentifier(value.PatientId, writer);
                writer.WriteEndElement();
            }

            // Serialize element sourcePatientId
            if (value.SourcePatientId != null)
            {
                writer.WriteStartElement("sourcePatientId");
                IdentifierSerializer.SerializeIdentifier(value.SourcePatientId, writer);
                writer.WriteEndElement();
            }

            // Serialize element patientInfo
            if (value.PatientInfo != null)
            {
                writer.WriteStartElement("patientInfo");
                ResourceReferenceSerializer.SerializeResourceReference(value.PatientInfo, writer);
                writer.WriteEndElement();
            }

            // Serialize element author
            if (value.Author != null && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    XdsEntrySerializer.SerializeXdsEntryAuthorComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element authenticator
            if (value.Authenticator != null)
            {
                writer.WriteStartElement("authenticator");
                XdsEntrySerializer.SerializeXdsEntryAuthenticatorComponent(value.Authenticator, writer);
                writer.WriteEndElement();
            }

            // Serialize element facilityType
            if (value.FacilityType != null)
            {
                writer.WriteStartElement("facilityType");
                CodingSerializer.SerializeCoding(value.FacilityType, writer);
                writer.WriteEndElement();
            }

            // Serialize element practiceSetting
            if (value.PracticeSetting != null)
            {
                writer.WriteStartElement("practiceSetting");
                CodingSerializer.SerializeCoding(value.PracticeSetting, writer);
                writer.WriteEndElement();
            }

            // Serialize element homeCommunity
            if (value.HomeCommunity != null)
            {
                writer.WriteStartElement("homeCommunity");
                FhirUriSerializer.SerializeFhirUri(value.HomeCommunity, writer);
                writer.WriteEndElement();
            }

            // Serialize element service
            if (value.Service != null)
            {
                writer.WriteStartElement("service");
                XdsEntrySerializer.SerializeXdsEntryServiceComponent(value.Service, writer);
                writer.WriteEndElement();
            }

            // Serialize element comments
            if (value.Comments != null)
            {
                writer.WriteStartElement("comments");
                FhirStringSerializer.SerializeFhirString(value.Comments, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #10
0
        public static void SerializeXdsEntryAuthorComponent(XdsEntry.XdsEntryAuthorComponent value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element name
            if (value.Name != null)
            {
                writer.WriteStartElement("name");
                HumanNameSerializer.SerializeHumanName(value.Name, writer);
                writer.WriteEndElement();
            }

            // Serialize element id
            if (value.Id != null)
            {
                writer.WriteStartElement("id");
                IdentifierSerializer.SerializeIdentifier(value.Id, writer);
                writer.WriteEndElement();
            }

            // Serialize element role
            if (value.Role != null && value.Role.Count > 0)
            {
                writer.WriteStartArrayElement("role");
                foreach (var item in value.Role)
                {
                    writer.WriteStartArrayMember("role");
                    FhirStringSerializer.SerializeFhirString(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element specialty
            if (value.Specialty != null && value.Specialty.Count > 0)
            {
                writer.WriteStartArrayElement("specialty");
                foreach (var item in value.Specialty)
                {
                    writer.WriteStartArrayMember("specialty");
                    FhirStringSerializer.SerializeFhirString(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element institution
            if (value.Institution != null && value.Institution.Count > 0)
            {
                writer.WriteStartArrayElement("institution");
                foreach (var item in value.Institution)
                {
                    writer.WriteStartArrayMember("institution");
                    XdsEntrySerializer.SerializeXdsEntryAuthorInstitutionComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element contact
            if (value.Contact != null && value.Contact.Count > 0)
            {
                writer.WriteStartArrayElement("contact");
                foreach (var item in value.Contact)
                {
                    writer.WriteStartArrayMember("contact");
                    ContactSerializer.SerializeContact(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
        }
Пример #11
0
        public static void SerializeAllergyIntolerance(Hl7.Fhir.Model.AllergyIntolerance value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("AllergyIntolerance");
            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 criticality
            if (value.Criticality_Element != null && !summary)
            {
                writer.WriteStartElement("criticality");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.AllergyIntolerance.Criticality>(value.Criticality_Element, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element sensitivityType
            if (value.SensitivityType_Element != null && !summary)
            {
                writer.WriteStartElement("sensitivityType");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.AllergyIntolerance.SensitivityType>(value.SensitivityType_Element, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.AllergyIntolerance.SensitivityStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

            // Serialize element reaction
            if (value.Reaction != null && !summary && value.Reaction.Count > 0)
            {
                writer.WriteStartArrayElement("reaction");
                foreach (var item in value.Reaction)
                {
                    writer.WriteStartArrayMember("reaction");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element sensitivityTest
            if (value.SensitivityTest != null && !summary && value.SensitivityTest.Count > 0)
            {
                writer.WriteStartArrayElement("sensitivityTest");
                foreach (var item in value.SensitivityTest)
                {
                    writer.WriteStartArrayMember("sensitivityTest");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeSubstance(Hl7.Fhir.Model.Substance value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Substance");
            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 name
            if (value.NameElement != null && !summary)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, 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 description
            if (value.DescriptionElement != null && !summary)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element effectiveTime
            if (value.EffectiveTime != null && !summary)
            {
                writer.WriteStartElement("effectiveTime");
                PeriodSerializer.SerializePeriod(value.EffectiveTime, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element quantity
            if (value.Quantity != null && !summary)
            {
                writer.WriteStartElement("quantity");
                QuantitySerializer.SerializeQuantity(value.Quantity, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element ingredient
            if (value.Ingredient != null && !summary && value.Ingredient.Count > 0)
            {
                writer.WriteStartArrayElement("ingredient");
                foreach (var item in value.Ingredient)
                {
                    writer.WriteStartArrayMember("ingredient");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeImagingStudy(Hl7.Fhir.Model.ImagingStudy value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("ImagingStudy");
            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 dateTime
            if (value.DateTimeElement != null && !summary)
            {
                writer.WriteStartElement("dateTime");
                FhirDateTimeSerializer.SerializeFhirDateTime(value.DateTimeElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element uid
            if (value.UidElement != null && !summary)
            {
                writer.WriteStartElement("uid");
                OidSerializer.SerializeOid(value.UidElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element accessionNo
            if (value.AccessionNo != null && !summary)
            {
                writer.WriteStartElement("accessionNo");
                IdentifierSerializer.SerializeIdentifier(value.AccessionNo, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element modality
            if (value.Modality_Element != null && !summary && value.Modality_Element.Count > 0)
            {
                writer.WriteStartArrayElement("modality");
                foreach (var item in value.Modality_Element)
                {
                    writer.WriteStartArrayMember("modality");
                    CodeSerializer.SerializeCode <Hl7.Fhir.Model.ImagingStudy.ImagingModality>(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element availability
            if (value.AvailabilityElement != null && !summary)
            {
                writer.WriteStartElement("availability");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ImagingStudy.InstanceAvailability>(value.AvailabilityElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element url
            if (value.UrlElement != null && !summary)
            {
                writer.WriteStartElement("url");
                FhirUriSerializer.SerializeFhirUri(value.UrlElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element numberOfSeries
            if (value.NumberOfSeriesElement != null && !summary)
            {
                writer.WriteStartElement("numberOfSeries");
                IntegerSerializer.SerializeInteger(value.NumberOfSeriesElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element numberOfInstances
            if (value.NumberOfInstancesElement != null && !summary)
            {
                writer.WriteStartElement("numberOfInstances");
                IntegerSerializer.SerializeInteger(value.NumberOfInstancesElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element clinicalInformation
            if (value.ClinicalInformationElement != null && !summary)
            {
                writer.WriteStartElement("clinicalInformation");
                FhirStringSerializer.SerializeFhirString(value.ClinicalInformationElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element procedure
            if (value.Procedure != null && !summary && value.Procedure.Count > 0)
            {
                writer.WriteStartArrayElement("procedure");
                foreach (var item in value.Procedure)
                {
                    writer.WriteStartArrayMember("procedure");
                    CodingSerializer.SerializeCoding(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element description
            if (value.DescriptionElement != null && !summary)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element series
            if (value.Series != null && !summary && value.Series.Count > 0)
            {
                writer.WriteStartArrayElement("series");
                foreach (var item in value.Series)
                {
                    writer.WriteStartArrayMember("series");
                    ImagingStudySerializer.SerializeImagingStudySeriesComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #14
0
        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();
        }
Пример #15
0
        public static void SerializeDocumentReference(Hl7.Fhir.Model.DocumentReference value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DocumentReference");
            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 masterIdentifier
            if (value.MasterIdentifier != null && !summary)
            {
                writer.WriteStartElement("masterIdentifier");
                IdentifierSerializer.SerializeIdentifier(value.MasterIdentifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element identifier
            if (value.Identifier != null && !summary && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(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 type
            if (value.Type != null && !summary)
            {
                writer.WriteStartElement("type");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element author
            if (value.Author != null && !summary && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

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

            // Serialize element indexed
            if (value.IndexedElement != null && !summary)
            {
                writer.WriteStartElement("indexed");
                InstantSerializer.SerializeInstant(value.IndexedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.DocumentReference.DocumentReferenceStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

            // Serialize element description
            if (value.DescriptionElement != null && !summary)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element primaryLanguage
            if (value.PrimaryLanguageElement != null && !summary)
            {
                writer.WriteStartElement("primaryLanguage");
                CodeSerializer.SerializeCode(value.PrimaryLanguageElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element mimeType
            if (value.MimeTypeElement != null && !summary)
            {
                writer.WriteStartElement("mimeType");
                CodeSerializer.SerializeCode(value.MimeTypeElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element size
            if (value.SizeElement != null && !summary)
            {
                writer.WriteStartElement("size");
                IntegerSerializer.SerializeInteger(value.SizeElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element hash
            if (value.HashElement != null && !summary)
            {
                writer.WriteStartElement("hash");
                FhirStringSerializer.SerializeFhirString(value.HashElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element location
            if (value.LocationElement != null && !summary)
            {
                writer.WriteStartElement("location");
                FhirUriSerializer.SerializeFhirUri(value.LocationElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element service
            if (value.Service != null && !summary)
            {
                writer.WriteStartElement("service");
                DocumentReferenceSerializer.SerializeDocumentReferenceServiceComponent(value.Service, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element context
            if (value.Context != null && !summary)
            {
                writer.WriteStartElement("context");
                DocumentReferenceSerializer.SerializeDocumentReferenceContextComponent(value.Context, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #16
0
        public static void SerializeQuestionnaire(Hl7.Fhir.Model.Questionnaire value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Questionnaire");
            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 status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ObservationStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

            // Serialize element identifier
            if (value.Identifier != null)
            {
                writer.WriteStartElement("identifier");
                IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element question
            if (value.Question != null && !summary && value.Question.Count > 0)
            {
                writer.WriteStartArrayElement("question");
                foreach (var item in value.Question)
                {
                    writer.WriteStartArrayMember("question");
                    QuestionnaireSerializer.SerializeQuestionComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element group
            if (value.Group != null && !summary && value.Group.Count > 0)
            {
                writer.WriteStartArrayElement("group");
                foreach (var item in value.Group)
                {
                    writer.WriteStartArrayMember("group");
                    QuestionnaireSerializer.SerializeGroupComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #17
0
        public static void SerializeOrganization(Hl7.Fhir.Model.Organization value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Organization");
            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 && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element name
            if (value.NameElement != null && !summary)
            {
                writer.WriteStartElement("name");
                FhirStringSerializer.SerializeFhirString(value.NameElement, 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 telecom
            if (value.Telecom != null && !summary && value.Telecom.Count > 0)
            {
                writer.WriteStartArrayElement("telecom");
                foreach (var item in value.Telecom)
                {
                    writer.WriteStartArrayMember("telecom");
                    ContactSerializer.SerializeContact(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element address
            if (value.Address != null && !summary && value.Address.Count > 0)
            {
                writer.WriteStartArrayElement("address");
                foreach (var item in value.Address)
                {
                    writer.WriteStartArrayMember("address");
                    AddressSerializer.SerializeAddress(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element contact
            if (value.Contact != null && !summary && value.Contact.Count > 0)
            {
                writer.WriteStartArrayElement("contact");
                foreach (var item in value.Contact)
                {
                    writer.WriteStartArrayMember("contact");
                    OrganizationSerializer.SerializeOrganizationContactComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element active
            if (value.ActiveElement != null && !summary)
            {
                writer.WriteStartElement("active");
                FhirBooleanSerializer.SerializeFhirBoolean(value.ActiveElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeDeviceObservation(Hl7.Fhir.Model.DeviceObservation value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DeviceObservation");
            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 code
            if (value.Code != null && !summary)
            {
                writer.WriteStartElement("code");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Code, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element issued
            if (value.IssuedElement != null && !summary)
            {
                writer.WriteStartElement("issued");
                InstantSerializer.SerializeInstant(value.IssuedElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

            // Serialize element measurement
            if (value.Measurement != null && !summary && value.Measurement.Count > 0)
            {
                writer.WriteStartArrayElement("measurement");
                foreach (var item in value.Measurement)
                {
                    writer.WriteStartArrayMember("measurement");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #19
0
        public static void SerializeSpecimenContainerComponent(Hl7.Fhir.Model.Specimen.SpecimenContainerComponent value, IFhirWriter writer, bool summary)
        {
            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 identifier
            if (value.Identifier != null && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element description
            if (value.DescriptionElement != null)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.DescriptionElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element capacity
            if (value.Capacity != null)
            {
                writer.WriteStartElement("capacity");
                QuantitySerializer.SerializeQuantity(value.Capacity, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element specimenQuantity
            if (value.SpecimenQuantity != null)
            {
                writer.WriteStartElement("specimenQuantity");
                QuantitySerializer.SerializeQuantity(value.SpecimenQuantity, writer, summary);
                writer.WriteEndElement();
            }

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


            writer.WriteEndComplexContent();
        }
Пример #20
0
        public static void SerializeStudy(Hl7.Fhir.Model.Study value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Study");
            writer.WriteStartComplexContent();

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element _id
            if (value.LocalId != null)
            {
                writer.WriteStartElement("_id");
                IdSerializer.SerializeId(value.LocalId, writer);
                writer.WriteEndElement();
            }

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

            // Serialize element sponsor
            if (value.Sponsor != null)
            {
                writer.WriteStartElement("sponsor");
                FhirStringSerializer.SerializeFhirString(value.Sponsor, writer);
                writer.WriteEndElement();
            }

            // Serialize element title
            if (value.Title != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.Title, writer);
                writer.WriteEndElement();
            }

            // Serialize element description
            if (value.Description != null)
            {
                writer.WriteStartElement("description");
                FhirStringSerializer.SerializeFhirString(value.Description, writer);
                writer.WriteEndElement();
            }

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

            // Serialize element condition
            if (value.Condition != null && value.Condition.Count > 0)
            {
                writer.WriteStartArrayElement("condition");
                foreach (var item in value.Condition)
                {
                    writer.WriteStartArrayMember("condition");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element controlType
            if (value.ControlType != null && value.ControlType.Count > 0)
            {
                writer.WriteStartArrayElement("controlType");
                foreach (var item in value.ControlType)
                {
                    writer.WriteStartArrayMember("controlType");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element objective
            if (value.Objective != null && value.Objective.Count > 0)
            {
                writer.WriteStartArrayElement("objective");
                foreach (var item in value.Objective)
                {
                    writer.WriteStartArrayMember("objective");
                    FhirStringSerializer.SerializeFhirString(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element outcomeMeasure
            if (value.OutcomeMeasure != null && value.OutcomeMeasure.Count > 0)
            {
                writer.WriteStartArrayElement("outcomeMeasure");
                foreach (var item in value.OutcomeMeasure)
                {
                    writer.WriteStartArrayMember("outcomeMeasure");
                    FhirStringSerializer.SerializeFhirString(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element eligibility
            if (value.Eligibility != null && value.Eligibility.Count > 0)
            {
                writer.WriteStartArrayElement("eligibility");
                foreach (var item in value.Eligibility)
                {
                    writer.WriteStartArrayMember("eligibility");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element period
            if (value.Period != null)
            {
                writer.WriteStartElement("period");
                PeriodSerializer.SerializePeriod(value.Period, writer);
                writer.WriteEndElement();
            }

            // Serialize element duration
            if (value.Duration != null)
            {
                writer.WriteStartElement("duration");
                QuantitySerializer.SerializeQuantity(value.Duration, writer);
                writer.WriteEndElement();
            }

            // Serialize element plannedEnrollment
            if (value.PlannedEnrollment != null)
            {
                writer.WriteStartElement("plannedEnrollment");
                IntegerSerializer.SerializeInteger(value.PlannedEnrollment, writer);
                writer.WriteEndElement();
            }

            // Serialize element intervention
            if (value.Intervention != null)
            {
                writer.WriteStartElement("intervention");
                StudySerializer.SerializeStudyInterventionComponent(value.Intervention, writer);
                writer.WriteEndElement();
            }

            // Serialize element protocol
            if (value.Protocol != null && value.Protocol.Count > 0)
            {
                writer.WriteStartArrayElement("protocol");
                foreach (var item in value.Protocol)
                {
                    writer.WriteStartArrayMember("protocol");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element dataStructure
            if (value.DataStructure != null)
            {
                writer.WriteStartElement("dataStructure");
                ResourceReferenceSerializer.SerializeResourceReference(value.DataStructure, writer);
                writer.WriteEndElement();
            }

            // Serialize element data
            if (value.Data != null && value.Data.Count > 0)
            {
                writer.WriteStartArrayElement("data");
                foreach (var item in value.Data)
                {
                    writer.WriteStartArrayMember("data");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #21
0
        public static void SerializeProvider(Provider value, IFhirWriter writer)
        {
            writer.WriteStartRootObject("Provider");
            writer.WriteStartComplexContent();

            // Serialize element's localId attribute
            if (value.InternalId != null && !String.IsNullOrEmpty(value.InternalId.Contents))
            {
                writer.WriteRefIdContents(value.InternalId.Contents);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element language
            if (value.Language != null)
            {
                writer.WriteStartElement("language");
                CodeSerializer.SerializeCode(value.Language, writer);
                writer.WriteEndElement();
            }

            // Serialize element text
            if (value.Text != null)
            {
                writer.WriteStartElement("text");
                NarrativeSerializer.SerializeNarrative(value.Text, writer);
                writer.WriteEndElement();
            }

            // Serialize element contained
            if (value.Contained != null && value.Contained.Count > 0)
            {
                writer.WriteStartArrayElement("contained");
                foreach (var item in value.Contained)
                {
                    writer.WriteStartArrayMember("contained");
                    FhirSerializer.SerializeResource(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element details
            if (value.Details != null)
            {
                writer.WriteStartElement("details");
                DemographicsSerializer.SerializeDemographics(value.Details, writer);
                writer.WriteEndElement();
            }

            // Serialize element organization
            if (value.Organization != null)
            {
                writer.WriteStartElement("organization");
                ResourceReferenceSerializer.SerializeResourceReference(value.Organization, writer);
                writer.WriteEndElement();
            }

            // Serialize element role
            if (value.Role != null && value.Role.Count > 0)
            {
                writer.WriteStartArrayElement("role");
                foreach (var item in value.Role)
                {
                    writer.WriteStartArrayMember("role");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element specialty
            if (value.Specialty != null && value.Specialty.Count > 0)
            {
                writer.WriteStartArrayElement("specialty");
                foreach (var item in value.Specialty)
                {
                    writer.WriteStartArrayMember("specialty");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element period
            if (value.Period != null)
            {
                writer.WriteStartElement("period");
                PeriodSerializer.SerializePeriod(value.Period, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializePatient(Hl7.Fhir.Model.Patient value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Patient");
            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 && value.Identifier.Count > 0)
            {
                writer.WriteStartArrayElement("identifier");
                foreach (var item in value.Identifier)
                {
                    writer.WriteStartArrayMember("identifier");
                    IdentifierSerializer.SerializeIdentifier(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element name
            if (value.Name != null && value.Name.Count > 0)
            {
                writer.WriteStartArrayElement("name");
                foreach (var item in value.Name)
                {
                    writer.WriteStartArrayMember("name");
                    HumanNameSerializer.SerializeHumanName(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element telecom
            if (value.Telecom != null && value.Telecom.Count > 0)
            {
                writer.WriteStartArrayElement("telecom");
                foreach (var item in value.Telecom)
                {
                    writer.WriteStartArrayMember("telecom");
                    ContactSerializer.SerializeContact(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

            // Serialize element deceased
            if (value.Deceased != null)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("deceased", value.Deceased.GetType()));
                FhirSerializer.SerializeElement(value.Deceased, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element address
            if (value.Address != null && value.Address.Count > 0)
            {
                writer.WriteStartArrayElement("address");
                foreach (var item in value.Address)
                {
                    writer.WriteStartArrayMember("address");
                    AddressSerializer.SerializeAddress(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element multipleBirth
            if (value.MultipleBirth != null)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("multipleBirth", value.MultipleBirth.GetType()));
                FhirSerializer.SerializeElement(value.MultipleBirth, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element photo
            if (value.Photo != null && !summary && value.Photo.Count > 0)
            {
                writer.WriteStartArrayElement("photo");
                foreach (var item in value.Photo)
                {
                    writer.WriteStartArrayMember("photo");
                    AttachmentSerializer.SerializeAttachment(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element contact
            if (value.Contact != null && !summary && value.Contact.Count > 0)
            {
                writer.WriteStartArrayElement("contact");
                foreach (var item in value.Contact)
                {
                    writer.WriteStartArrayMember("contact");
                    PatientSerializer.SerializeContactComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element animal
            if (value.Animal != null)
            {
                writer.WriteStartElement("animal");
                PatientSerializer.SerializeAnimalComponent(value.Animal, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element communication
            if (value.Communication != null && !summary && value.Communication.Count > 0)
            {
                writer.WriteStartArrayElement("communication");
                foreach (var item in value.Communication)
                {
                    writer.WriteStartArrayMember("communication");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element link
            if (value.Link != null && value.Link.Count > 0)
            {
                writer.WriteStartArrayElement("link");
                foreach (var item in value.Link)
                {
                    writer.WriteStartArrayMember("link");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element active
            if (value.ActiveElement != null)
            {
                writer.WriteStartElement("active");
                FhirBooleanSerializer.SerializeFhirBoolean(value.ActiveElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #23
0
        public static void SerializeDocument(Hl7.Fhir.Model.Document value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Document");
            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)
            {
                writer.WriteStartElement("identifier");
                IdentifierSerializer.SerializeIdentifier(value.Identifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element versionIdentifier
            if (value.VersionIdentifier != null)
            {
                writer.WriteStartElement("versionIdentifier");
                IdentifierSerializer.SerializeIdentifier(value.VersionIdentifier, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element created
            if (value.CreatedElement != null)
            {
                writer.WriteStartElement("created");
                InstantSerializer.SerializeInstant(value.CreatedElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

            // Serialize element title
            if (value.TitleElement != null)
            {
                writer.WriteStartElement("title");
                FhirStringSerializer.SerializeFhirString(value.TitleElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Document.DocumentStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element confidentiality
            if (value.Confidentiality != null)
            {
                writer.WriteStartElement("confidentiality");
                CodingSerializer.SerializeCoding(value.Confidentiality, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element author
            if (value.Author != null && value.Author.Count > 0)
            {
                writer.WriteStartArrayElement("author");
                foreach (var item in value.Author)
                {
                    writer.WriteStartArrayMember("author");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element attester
            if (value.Attester != null && value.Attester.Count > 0)
            {
                writer.WriteStartArrayElement("attester");
                foreach (var item in value.Attester)
                {
                    writer.WriteStartArrayMember("attester");
                    DocumentSerializer.SerializeDocumentAttesterComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

            // Serialize element event
            if (value.Event != null)
            {
                writer.WriteStartElement("event");
                DocumentSerializer.SerializeDocumentEventComponent(value.Event, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element replaces
            if (value.ReplacesElement != null)
            {
                writer.WriteStartElement("replaces");
                IdSerializer.SerializeId(value.ReplacesElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element provenance
            if (value.Provenance != null && !summary && value.Provenance.Count > 0)
            {
                writer.WriteStartArrayElement("provenance");
                foreach (var item in value.Provenance)
                {
                    writer.WriteStartArrayMember("provenance");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element stylesheet
            if (value.Stylesheet != null && !summary)
            {
                writer.WriteStartElement("stylesheet");
                AttachmentSerializer.SerializeAttachment(value.Stylesheet, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element representation
            if (value.Representation != null && !summary)
            {
                writer.WriteStartElement("representation");
                AttachmentSerializer.SerializeAttachment(value.Representation, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element section
            if (value.Section != null && !summary && value.Section.Count > 0)
            {
                writer.WriteStartArrayElement("section");
                foreach (var item in value.Section)
                {
                    writer.WriteStartArrayMember("section");
                    DocumentSerializer.SerializeSectionComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #24
0
        public static void SerializeDiagnosticReportRequestDetailComponent(Hl7.Fhir.Model.DiagnosticReport.DiagnosticReportRequestDetailComponent value, IFhirWriter writer, bool summary)
        {
            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 encounter
            if (value.Encounter != null)
            {
                writer.WriteStartElement("encounter");
                ResourceReferenceSerializer.SerializeResourceReference(value.Encounter, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element requestOrderId
            if (value.RequestOrderId != null)
            {
                writer.WriteStartElement("requestOrderId");
                IdentifierSerializer.SerializeIdentifier(value.RequestOrderId, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element receiverOrderId
            if (value.ReceiverOrderId != null)
            {
                writer.WriteStartElement("receiverOrderId");
                IdentifierSerializer.SerializeIdentifier(value.ReceiverOrderId, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element requestTest
            if (value.RequestTest != null && value.RequestTest.Count > 0)
            {
                writer.WriteStartArrayElement("requestTest");
                foreach (var item in value.RequestTest)
                {
                    writer.WriteStartArrayMember("requestTest");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

            // Serialize element clinicalInfo
            if (value.ClinicalInfoElement != null)
            {
                writer.WriteStartElement("clinicalInfo");
                FhirStringSerializer.SerializeFhirString(value.ClinicalInfoElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
        public static void SerializeVisitHospitalizationComponent(Hl7.Fhir.Model.Visit.VisitHospitalizationComponent value, IFhirWriter writer)
        {
            writer.WriteStartComplexContent();

            // Serialize element _id
            if (value.LocalId != null)
            {
                writer.WritePrimitiveContents("_id", value.LocalId, XmlSerializationHint.Attribute);
            }

            // Serialize element extension
            if (value.Extension != null && value.Extension.Count > 0)
            {
                writer.WriteStartArrayElement("extension");
                foreach (var item in value.Extension)
                {
                    writer.WriteStartArrayMember("extension");
                    ExtensionSerializer.SerializeExtension(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element preAdmissionIdentifier
            if (value.PreAdmissionIdentifier != null)
            {
                writer.WriteStartElement("preAdmissionIdentifier");
                IdentifierSerializer.SerializeIdentifier(value.PreAdmissionIdentifier, writer);
                writer.WriteEndElement();
            }

            // Serialize element preAdmissionTest
            if (value.PreAdmissionTest != null)
            {
                writer.WriteStartElement("preAdmissionTest");
                CodeableConceptSerializer.SerializeCodeableConcept(value.PreAdmissionTest, writer);
                writer.WriteEndElement();
            }

            // Serialize element origin
            if (value.Origin != null)
            {
                writer.WriteStartElement("origin");
                ResourceReferenceSerializer.SerializeResourceReference(value.Origin, writer);
                writer.WriteEndElement();
            }

            // Serialize element admitSource
            if (value.AdmitSource != null)
            {
                writer.WriteStartElement("admitSource");
                CodeableConceptSerializer.SerializeCodeableConcept(value.AdmitSource, writer);
                writer.WriteEndElement();
            }

            // Serialize element period
            if (value.Period != null)
            {
                writer.WriteStartElement("period");
                PeriodSerializer.SerializePeriod(value.Period, writer);
                writer.WriteEndElement();
            }

            // Serialize element accomodation
            if (value.Accomodation != null && value.Accomodation.Count > 0)
            {
                writer.WriteStartArrayElement("accomodation");
                foreach (var item in value.Accomodation)
                {
                    writer.WriteStartArrayMember("accomodation");
                    VisitSerializer.SerializeVisitHospitalizationAccomodationComponent(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element diet
            if (value.Diet != null)
            {
                writer.WriteStartElement("diet");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Diet, writer);
                writer.WriteEndElement();
            }

            // Serialize element specialCourtesy
            if (value.SpecialCourtesy != null && value.SpecialCourtesy.Count > 0)
            {
                writer.WriteStartArrayElement("specialCourtesy");
                foreach (var item in value.SpecialCourtesy)
                {
                    writer.WriteStartArrayMember("specialCourtesy");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element specialArrangement
            if (value.SpecialArrangement != null && value.SpecialArrangement.Count > 0)
            {
                writer.WriteStartArrayElement("specialArrangement");
                foreach (var item in value.SpecialArrangement)
                {
                    writer.WriteStartArrayMember("specialArrangement");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element destination
            if (value.Destination != null)
            {
                writer.WriteStartElement("destination");
                ResourceReferenceSerializer.SerializeResourceReference(value.Destination, writer);
                writer.WriteEndElement();
            }

            // Serialize element dischargeDisposition
            if (value.DischargeDisposition != null)
            {
                writer.WriteStartElement("dischargeDisposition");
                CodeableConceptSerializer.SerializeCodeableConcept(value.DischargeDisposition, writer);
                writer.WriteEndElement();
            }

            // Serialize element reAdmission
            if (value.ReAdmission != null)
            {
                writer.WriteStartElement("reAdmission");
                FhirBooleanSerializer.SerializeFhirBoolean(value.ReAdmission, writer);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
        }
Пример #26
0
        public static void SerializeDiagnosticReport(Hl7.Fhir.Model.DiagnosticReport value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("DiagnosticReport");
            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 status
            if (value.StatusElement != null)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ObservationStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

            // Serialize element reportId
            if (value.ReportId != null)
            {
                writer.WriteStartElement("reportId");
                IdentifierSerializer.SerializeIdentifier(value.ReportId, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element requestDetail
            if (value.RequestDetail != null && !summary && value.RequestDetail.Count > 0)
            {
                writer.WriteStartArrayElement("requestDetail");
                foreach (var item in value.RequestDetail)
                {
                    writer.WriteStartArrayMember("requestDetail");
                    DiagnosticReportSerializer.SerializeDiagnosticReportRequestDetailComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

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

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

            // Serialize element results
            if (value.Results != null && !summary)
            {
                writer.WriteStartElement("results");
                DiagnosticReportSerializer.SerializeResultGroupComponent(value.Results, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element image
            if (value.Image != null && !summary && value.Image.Count > 0)
            {
                writer.WriteStartArrayElement("image");
                foreach (var item in value.Image)
                {
                    writer.WriteStartArrayMember("image");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element conclusion
            if (value.ConclusionElement != null && !summary)
            {
                writer.WriteStartElement("conclusion");
                FhirStringSerializer.SerializeFhirString(value.ConclusionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element codedDiagnosis
            if (value.CodedDiagnosis != null && !summary && value.CodedDiagnosis.Count > 0)
            {
                writer.WriteStartArrayElement("codedDiagnosis");
                foreach (var item in value.CodedDiagnosis)
                {
                    writer.WriteStartArrayMember("codedDiagnosis");
                    CodeableConceptSerializer.SerializeCodeableConcept(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element representation
            if (value.Representation != null && !summary && value.Representation.Count > 0)
            {
                writer.WriteStartArrayElement("representation");
                foreach (var item in value.Representation)
                {
                    writer.WriteStartArrayMember("representation");
                    AttachmentSerializer.SerializeAttachment(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeObservation(Hl7.Fhir.Model.Observation value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Observation");
            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 name
            if (value.Name != null && !summary)
            {
                writer.WriteStartElement("name");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Name, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element value
            if (value.Value != null && !summary)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("value", value.Value.GetType()));
                FhirSerializer.SerializeElement(value.Value, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element comments
            if (value.CommentsElement != null && !summary)
            {
                writer.WriteStartElement("comments");
                FhirStringSerializer.SerializeFhirString(value.CommentsElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element applies
            if (value.Applies != null && !summary)
            {
                writer.WriteStartElement(SerializationUtil.BuildPolymorphicName("applies", value.Applies.GetType()));
                FhirSerializer.SerializeElement(value.Applies, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element issued
            if (value.IssuedElement != null && !summary)
            {
                writer.WriteStartElement("issued");
                InstantSerializer.SerializeInstant(value.IssuedElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.ObservationStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element reliability
            if (value.ReliabilityElement != null && !summary)
            {
                writer.WriteStartElement("reliability");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Observation.ObservationReliability>(value.ReliabilityElement, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element method
            if (value.Method != null && !summary)
            {
                writer.WriteStartElement("method");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Method, 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 subject
            if (value.Subject != null && !summary)
            {
                writer.WriteStartElement("subject");
                ResourceReferenceSerializer.SerializeResourceReference(value.Subject, writer, summary);
                writer.WriteEndElement();
            }

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

            // Serialize element referenceRange
            if (value.ReferenceRange != null && !summary && value.ReferenceRange.Count > 0)
            {
                writer.WriteStartArrayElement("referenceRange");
                foreach (var item in value.ReferenceRange)
                {
                    writer.WriteStartArrayMember("referenceRange");
                    ObservationSerializer.SerializeObservationReferenceRangeComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element component
            if (value.Component != null && !summary && value.Component.Count > 0)
            {
                writer.WriteStartArrayElement("component");
                foreach (var item in value.Component)
                {
                    writer.WriteStartArrayMember("component");
                    ObservationSerializer.SerializeObservationComponentComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #28
0
        public static void SerializeDevice(Hl7.Fhir.Model.Device value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Device");
            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 type
            if (value.Type != null && !summary)
            {
                writer.WriteStartElement("type");
                CodeableConceptSerializer.SerializeCodeableConcept(value.Type, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element manufacturer
            if (value.ManufacturerElement != null && !summary)
            {
                writer.WriteStartElement("manufacturer");
                FhirStringSerializer.SerializeFhirString(value.ManufacturerElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element model
            if (value.ModelElement != null && !summary)
            {
                writer.WriteStartElement("model");
                FhirStringSerializer.SerializeFhirString(value.ModelElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element version
            if (value.VersionElement != null && !summary)
            {
                writer.WriteStartElement("version");
                FhirStringSerializer.SerializeFhirString(value.VersionElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element expiry
            if (value.ExpiryElement != null && !summary)
            {
                writer.WriteStartElement("expiry");
                DateSerializer.SerializeDate(value.ExpiryElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element identity
            if (value.Identity != null && !summary)
            {
                writer.WriteStartElement("identity");
                DeviceSerializer.SerializeDeviceIdentityComponent(value.Identity, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

            // Serialize element contact
            if (value.Contact != null && !summary && value.Contact.Count > 0)
            {
                writer.WriteStartArrayElement("contact");
                foreach (var item in value.Contact)
                {
                    writer.WriteStartArrayMember("contact");
                    ContactSerializer.SerializeContact(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element url
            if (value.UrlElement != null && !summary)
            {
                writer.WriteStartElement("url");
                FhirUriSerializer.SerializeFhirUri(value.UrlElement, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
Пример #29
0
        public static void SerializeMedia(Hl7.Fhir.Model.Media value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("Media");
            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 type
            if (value.TypeElement != null)
            {
                writer.WriteStartElement("type");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.Media.MediaType>(value.TypeElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

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

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

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

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

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

            // Serialize element deviceName
            if (value.DeviceNameElement != null)
            {
                writer.WriteStartElement("deviceName");
                FhirStringSerializer.SerializeFhirString(value.DeviceNameElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element height
            if (value.HeightElement != null)
            {
                writer.WriteStartElement("height");
                IntegerSerializer.SerializeInteger(value.HeightElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element width
            if (value.WidthElement != null)
            {
                writer.WriteStartElement("width");
                IntegerSerializer.SerializeInteger(value.WidthElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element frames
            if (value.FramesElement != null)
            {
                writer.WriteStartElement("frames");
                IntegerSerializer.SerializeInteger(value.FramesElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element length
            if (value.LengthElement != null)
            {
                writer.WriteStartElement("length");
                IntegerSerializer.SerializeInteger(value.LengthElement, writer, summary);
                writer.WriteEndElement();
            }

            // Serialize element content
            if (value.Content != null && !summary)
            {
                writer.WriteStartElement("content");
                AttachmentSerializer.SerializeAttachment(value.Content, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }
        public static void SerializeMedicationDispense(Hl7.Fhir.Model.MedicationDispense value, IFhirWriter writer, bool summary)
        {
            writer.WriteStartRootObject("MedicationDispense");
            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 status
            if (value.StatusElement != null && !summary)
            {
                writer.WriteStartElement("status");
                CodeSerializer.SerializeCode <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>(value.StatusElement, writer, summary);
                writer.WriteEndElement();
            }

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

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

            // Serialize element authorizingPrescription
            if (value.AuthorizingPrescription != null && !summary && value.AuthorizingPrescription.Count > 0)
            {
                writer.WriteStartArrayElement("authorizingPrescription");
                foreach (var item in value.AuthorizingPrescription)
                {
                    writer.WriteStartArrayMember("authorizingPrescription");
                    ResourceReferenceSerializer.SerializeResourceReference(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element dispense
            if (value.Dispense != null && !summary && value.Dispense.Count > 0)
            {
                writer.WriteStartArrayElement("dispense");
                foreach (var item in value.Dispense)
                {
                    writer.WriteStartArrayMember("dispense");
                    MedicationDispenseSerializer.SerializeMedicationDispenseDispenseComponent(item, writer, summary);
                    writer.WriteEndArrayMember();
                }
                writer.WriteEndArrayElement();
            }

            // Serialize element substitution
            if (value.Substitution != null && !summary)
            {
                writer.WriteStartElement("substitution");
                MedicationDispenseSerializer.SerializeMedicationDispenseSubstitutionComponent(value.Substitution, writer, summary);
                writer.WriteEndElement();
            }


            writer.WriteEndComplexContent();
            writer.WriteEndRootObject();
        }