Ejemplo n.º 1
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if ((StatusHistory != null) && (StatusHistory.Count != 0))
            {
                writer.WritePropertyName("statusHistory");
                writer.WriteStartArray();

                foreach (EpisodeOfCareStatusHistory valStatusHistory in StatusHistory)
                {
                    valStatusHistory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Type != null) && (Type.Count != 0))
            {
                writer.WritePropertyName("type");
                writer.WriteStartArray();

                foreach (CodeableConcept valType in Type)
                {
                    valType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Diagnosis != null) && (Diagnosis.Count != 0))
            {
                writer.WritePropertyName("diagnosis");
                writer.WriteStartArray();

                foreach (EpisodeOfCareDiagnosis valDiagnosis in Diagnosis)
                {
                    valDiagnosis.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Patient != null)
            {
                writer.WritePropertyName("patient");
                Patient.SerializeJson(writer, options);
            }

            if (ManagingOrganization != null)
            {
                writer.WritePropertyName("managingOrganization");
                ManagingOrganization.SerializeJson(writer, options);
            }

            if (Period != null)
            {
                writer.WritePropertyName("period");
                Period.SerializeJson(writer, options);
            }

            if ((ReferralRequest != null) && (ReferralRequest.Count != 0))
            {
                writer.WritePropertyName("referralRequest");
                writer.WriteStartArray();

                foreach (Reference valReferralRequest in ReferralRequest)
                {
                    valReferralRequest.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (CareManager != null)
            {
                writer.WritePropertyName("careManager");
                CareManager.SerializeJson(writer, options);
            }

            if ((Team != null) && (Team.Count != 0))
            {
                writer.WritePropertyName("team");
                writer.WriteStartArray();

                foreach (Reference valTeam in Team)
                {
                    valTeam.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Account != null) && (Account.Count != 0))
            {
                writer.WritePropertyName("account");
                writer.WriteStartArray();

                foreach (Reference valAccount in Account)
                {
                    valAccount.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Active != null)
            {
                writer.WriteBoolean("active", (bool)Active !);
            }

            if ((Name != null) && (Name.Count != 0))
            {
                writer.WritePropertyName("name");
                writer.WriteStartArray();

                foreach (HumanName valName in Name)
                {
                    valName.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Telecom != null) && (Telecom.Count != 0))
            {
                writer.WritePropertyName("telecom");
                writer.WriteStartArray();

                foreach (ContactPoint valTelecom in Telecom)
                {
                    valTelecom.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Gender))
            {
                writer.WriteString("gender", (string)Gender !);
            }

            if (_Gender != null)
            {
                writer.WritePropertyName("_gender");
                _Gender.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(BirthDate))
            {
                writer.WriteString("birthDate", (string)BirthDate !);
            }

            if (_BirthDate != null)
            {
                writer.WritePropertyName("_birthDate");
                _BirthDate.SerializeJson(writer, options);
            }

            if (DeceasedBoolean != null)
            {
                writer.WriteBoolean("deceasedBoolean", (bool)DeceasedBoolean !);
            }

            if (!string.IsNullOrEmpty(DeceasedDateTime))
            {
                writer.WriteString("deceasedDateTime", (string)DeceasedDateTime !);
            }

            if (_DeceasedDateTime != null)
            {
                writer.WritePropertyName("_deceasedDateTime");
                _DeceasedDateTime.SerializeJson(writer, options);
            }

            if ((Address != null) && (Address.Count != 0))
            {
                writer.WritePropertyName("address");
                writer.WriteStartArray();

                foreach (Address valAddress in Address)
                {
                    valAddress.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (MaritalStatus != null)
            {
                writer.WritePropertyName("maritalStatus");
                MaritalStatus.SerializeJson(writer, options);
            }

            if (MultipleBirthBoolean != null)
            {
                writer.WriteBoolean("multipleBirthBoolean", (bool)MultipleBirthBoolean !);
            }

            if (MultipleBirthInteger != null)
            {
                writer.WriteNumber("multipleBirthInteger", (int)MultipleBirthInteger !);
            }

            if ((Photo != null) && (Photo.Count != 0))
            {
                writer.WritePropertyName("photo");
                writer.WriteStartArray();

                foreach (Attachment valPhoto in Photo)
                {
                    valPhoto.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Contact != null) && (Contact.Count != 0))
            {
                writer.WritePropertyName("contact");
                writer.WriteStartArray();

                foreach (PatientContact valContact in Contact)
                {
                    valContact.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Communication != null) && (Communication.Count != 0))
            {
                writer.WritePropertyName("communication");
                writer.WriteStartArray();

                foreach (PatientCommunication valCommunication in Communication)
                {
                    valCommunication.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((GeneralPractitioner != null) && (GeneralPractitioner.Count != 0))
            {
                writer.WritePropertyName("generalPractitioner");
                writer.WriteStartArray();

                foreach (Reference valGeneralPractitioner in GeneralPractitioner)
                {
                    valGeneralPractitioner.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (ManagingOrganization != null)
            {
                writer.WritePropertyName("managingOrganization");
                ManagingOrganization.SerializeJson(writer, options);
            }

            if ((Link != null) && (Link.Count != 0))
            {
                writer.WritePropertyName("link");
                writer.WriteStartArray();

                foreach (PatientLink valLink in Link)
                {
                    valLink.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Name != null) && (Name.Count != 0))
            {
                writer.WritePropertyName("name");
                writer.WriteStartArray();

                foreach (HumanName valName in Name)
                {
                    valName.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Telecom != null) && (Telecom.Count != 0))
            {
                writer.WritePropertyName("telecom");
                writer.WriteStartArray();

                foreach (ContactPoint valTelecom in Telecom)
                {
                    valTelecom.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Gender))
            {
                writer.WriteString("gender", (string)Gender !);
            }

            if (_Gender != null)
            {
                writer.WritePropertyName("_gender");
                _Gender.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(BirthDate))
            {
                writer.WriteString("birthDate", (string)BirthDate !);
            }

            if (_BirthDate != null)
            {
                writer.WritePropertyName("_birthDate");
                _BirthDate.SerializeJson(writer, options);
            }

            if ((Address != null) && (Address.Count != 0))
            {
                writer.WritePropertyName("address");
                writer.WriteStartArray();

                foreach (Address valAddress in Address)
                {
                    valAddress.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Photo != null)
            {
                writer.WritePropertyName("photo");
                Photo.SerializeJson(writer, options);
            }

            if (ManagingOrganization != null)
            {
                writer.WritePropertyName("managingOrganization");
                ManagingOrganization.SerializeJson(writer, options);
            }

            if (Active != null)
            {
                writer.WriteBoolean("active", (bool)Active !);
            }

            if ((Link != null) && (Link.Count != 0))
            {
                writer.WritePropertyName("link");
                writer.WriteStartArray();

                foreach (PersonLink valLink in Link)
                {
                    valLink.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((fhirCsR4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if (ConnectionType != null)
            {
                writer.WritePropertyName("connectionType");
                ConnectionType.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

            if (_Name != null)
            {
                writer.WritePropertyName("_name");
                _Name.SerializeJson(writer, options);
            }

            if (ManagingOrganization != null)
            {
                writer.WritePropertyName("managingOrganization");
                ManagingOrganization.SerializeJson(writer, options);
            }

            if ((Contact != null) && (Contact.Count != 0))
            {
                writer.WritePropertyName("contact");
                writer.WriteStartArray();

                foreach (ContactPoint valContact in Contact)
                {
                    valContact.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Period != null)
            {
                writer.WritePropertyName("period");
                Period.SerializeJson(writer, options);
            }

            if ((PayloadType != null) && (PayloadType.Count != 0))
            {
                writer.WritePropertyName("payloadType");
                writer.WriteStartArray();

                foreach (CodeableConcept valPayloadType in PayloadType)
                {
                    valPayloadType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((PayloadMimeType != null) && (PayloadMimeType.Count != 0))
            {
                writer.WritePropertyName("payloadMimeType");
                writer.WriteStartArray();

                foreach (string valPayloadMimeType in PayloadMimeType)
                {
                    writer.WriteStringValue(valPayloadMimeType);
                }

                writer.WriteEndArray();
            }

            if ((_PayloadMimeType != null) && (_PayloadMimeType.Count != 0))
            {
                writer.WritePropertyName("_payloadMimeType");
                writer.WriteStartArray();

                foreach (Element val_PayloadMimeType in _PayloadMimeType)
                {
                    val_PayloadMimeType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Address))
            {
                writer.WriteString("address", (string)Address !);
            }

            if (_Address != null)
            {
                writer.WritePropertyName("_address");
                _Address.SerializeJson(writer, options);
            }

            if ((Header != null) && (Header.Count != 0))
            {
                writer.WritePropertyName("header");
                writer.WriteStartArray();

                foreach (string valHeader in Header)
                {
                    writer.WriteStringValue(valHeader);
                }

                writer.WriteEndArray();
            }

            if ((_Header != null) && (_Header.Count != 0))
            {
                writer.WritePropertyName("_header");
                writer.WriteStartArray();

                foreach (Element val_Header in _Header)
                {
                    val_Header.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            if (!string.IsNullOrEmpty(ResourceType))
            {
                writer.WriteString("resourceType", (string)ResourceType !);
            }


            ((Fhir.R4.Models.DomainResource) this).SerializeJson(writer, options, false);

            if ((Identifier != null) && (Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();

                foreach (Identifier valIdentifier in Identifier)
                {
                    valIdentifier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Status))
            {
                writer.WriteString("status", (string)Status !);
            }

            if (_Status != null)
            {
                writer.WritePropertyName("_status");
                _Status.SerializeJson(writer, options);
            }

            if (OperationalStatus != null)
            {
                writer.WritePropertyName("operationalStatus");
                OperationalStatus.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

            if (_Name != null)
            {
                writer.WritePropertyName("_name");
                _Name.SerializeJson(writer, options);
            }

            if ((Alias != null) && (Alias.Count != 0))
            {
                writer.WritePropertyName("alias");
                writer.WriteStartArray();

                foreach (string valAlias in Alias)
                {
                    writer.WriteStringValue(valAlias);
                }

                writer.WriteEndArray();
            }

            if ((_Alias != null) && (_Alias.Count != 0))
            {
                writer.WritePropertyName("_alias");
                writer.WriteStartArray();

                foreach (Element val_Alias in _Alias)
                {
                    val_Alias.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Description))
            {
                writer.WriteString("description", (string)Description !);
            }

            if (_Description != null)
            {
                writer.WritePropertyName("_description");
                _Description.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Mode))
            {
                writer.WriteString("mode", (string)Mode !);
            }

            if (_Mode != null)
            {
                writer.WritePropertyName("_mode");
                _Mode.SerializeJson(writer, options);
            }

            if ((Type != null) && (Type.Count != 0))
            {
                writer.WritePropertyName("type");
                writer.WriteStartArray();

                foreach (CodeableConcept valType in Type)
                {
                    valType.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((Telecom != null) && (Telecom.Count != 0))
            {
                writer.WritePropertyName("telecom");
                writer.WriteStartArray();

                foreach (ContactPoint valTelecom in Telecom)
                {
                    valTelecom.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (Address != null)
            {
                writer.WritePropertyName("address");
                Address.SerializeJson(writer, options);
            }

            if (PhysicalType != null)
            {
                writer.WritePropertyName("physicalType");
                PhysicalType.SerializeJson(writer, options);
            }

            if (Position != null)
            {
                writer.WritePropertyName("position");
                Position.SerializeJson(writer, options);
            }

            if (ManagingOrganization != null)
            {
                writer.WritePropertyName("managingOrganization");
                ManagingOrganization.SerializeJson(writer, options);
            }

            if (PartOf != null)
            {
                writer.WritePropertyName("partOf");
                PartOf.SerializeJson(writer, options);
            }

            if ((HoursOfOperation != null) && (HoursOfOperation.Count != 0))
            {
                writer.WritePropertyName("hoursOfOperation");
                writer.WriteStartArray();

                foreach (LocationHoursOfOperation valHoursOfOperation in HoursOfOperation)
                {
                    valHoursOfOperation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(AvailabilityExceptions))
            {
                writer.WriteString("availabilityExceptions", (string)AvailabilityExceptions !);
            }

            if (_AvailabilityExceptions != null)
            {
                writer.WritePropertyName("_availabilityExceptions");
                _AvailabilityExceptions.SerializeJson(writer, options);
            }

            if ((Endpoint != null) && (Endpoint.Count != 0))
            {
                writer.WritePropertyName("endpoint");
                writer.WriteStartArray();

                foreach (Reference valEndpoint in Endpoint)
                {
                    valEndpoint.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }