Beispiel #1
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();
        }
Beispiel #2
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();
        }