示例#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 ((DefinitionUri != null) && (DefinitionUri.Count != 0))
            {
                writer.WritePropertyName("definitionUri");
                writer.WriteStartArray();

                foreach (string valDefinitionUri in DefinitionUri)
                {
                    writer.WriteStringValue(valDefinitionUri);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_DefinitionUri in _DefinitionUri)
                {
                    val_DefinitionUri.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (string valDefinitionCanonical in DefinitionCanonical)
                {
                    writer.WriteStringValue(valDefinitionCanonical);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_DefinitionCanonical in _DefinitionCanonical)
                {
                    val_DefinitionCanonical.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 ((PartOf != null) && (PartOf.Count != 0))
            {
                writer.WritePropertyName("partOf");
                writer.WriteStartArray();

                foreach (Reference valPartOf in PartOf)
                {
                    valPartOf.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

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

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

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

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

                foreach (ChargeItemPerformer valPerformer in Performer)
                {
                    valPerformer.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

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

                foreach (CodeableConcept valBodysite in Bodysite)
                {
                    valBodysite.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (FactorOverride != null)
            {
                writer.WriteNumber("factorOverride", (decimal)FactorOverride !);
            }

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

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

            if (!string.IsNullOrEmpty(OverrideReason))
            {
                writer.WriteString("overrideReason", (string)OverrideReason !);
            }

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

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

            if (!string.IsNullOrEmpty(EnteredDate))
            {
                writer.WriteString("enteredDate", (string)EnteredDate !);
            }

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

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

                foreach (CodeableConcept valReason in Reason)
                {
                    valReason.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valService in Service)
                {
                    valService.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

                writer.WriteEndArray();
            }

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

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valSupportingInformation in SupportingInformation)
                {
                    valSupportingInformation.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
示例#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 ((InstantiatesCanonical != null) && (InstantiatesCanonical.Count != 0))
            {
                writer.WritePropertyName("instantiatesCanonical");
                writer.WriteStartArray();

                foreach (string valInstantiatesCanonical in InstantiatesCanonical)
                {
                    writer.WriteStringValue(valInstantiatesCanonical);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_InstantiatesCanonical in _InstantiatesCanonical)
                {
                    val_InstantiatesCanonical.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (string valInstantiatesUri in InstantiatesUri)
                {
                    writer.WriteStringValue(valInstantiatesUri);
                }

                writer.WriteEndArray();
            }

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

                foreach (Element val_InstantiatesUri in _InstantiatesUri)
                {
                    val_InstantiatesUri.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valBasedOn in BasedOn)
                {
                    valBasedOn.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valPriorRequest in PriorRequest)
                {
                    valPriorRequest.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

            if (!string.IsNullOrEmpty(Intent))
            {
                writer.WriteString("intent", (string)Intent !);
            }

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

            if (!string.IsNullOrEmpty(Priority))
            {
                writer.WriteString("priority", (string)Priority !);
            }

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

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

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

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

                foreach (DeviceRequestParameter valParameter in Parameter)
                {
                    valParameter.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

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

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

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

            if (!string.IsNullOrEmpty(AuthoredOn))
            {
                writer.WriteString("authoredOn", (string)AuthoredOn !);
            }

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

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

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

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

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

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valInsurance in Insurance)
                {
                    valInsurance.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valSupportingInfo in SupportingInfo)
                {
                    valSupportingInfo.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valRelevantHistory in RelevantHistory)
                {
                    valRelevantHistory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
示例#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 ((BasedOn != null) && (BasedOn.Count != 0))
            {
                writer.WritePropertyName("basedOn");
                writer.WriteStartArray();

                foreach (Reference valBasedOn in BasedOn)
                {
                    valBasedOn.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReplaces in Replaces)
                {
                    valReplaces.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

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

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

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

                foreach (CodeableConcept valCategory in Category)
                {
                    valCategory.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Priority))
            {
                writer.WriteString("priority", (string)Priority !);
            }

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

            if (DoNotPerform != null)
            {
                writer.WriteBoolean("doNotPerform", (bool)DoNotPerform !);
            }

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

                foreach (CodeableConcept valMedium in Medium)
                {
                    valMedium.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (Reference valAbout in About)
                {
                    valAbout.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (CommunicationRequestPayload valPayload in Payload)
                {
                    valPayload.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

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

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

            if (!string.IsNullOrEmpty(AuthoredOn))
            {
                writer.WriteString("authoredOn", (string)AuthoredOn !);
            }

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

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

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

                foreach (Reference valRecipient in Recipient)
                {
                    valRecipient.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
示例#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 ((BasedOn != null) && (BasedOn.Count != 0))
            {
                writer.WritePropertyName("basedOn");
                writer.WriteStartArray();

                foreach (Reference valBasedOn in BasedOn)
                {
                    valBasedOn.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valPartOf in PartOf)
                {
                    valPartOf.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 (Patient != null)
            {
                writer.WritePropertyName("patient");
                Patient.SerializeJson(writer, options);
            }

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

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

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

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

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

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

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

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

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

                foreach (Reference valReceiver in Receiver)
                {
                    valReceiver.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
示例#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 !);
            }


            ((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 (Category != null)
            {
                writer.WritePropertyName("category");
                Category.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(Priority))
            {
                writer.WriteString("priority", (string)Priority !);
            }

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

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

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

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

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

                foreach (SupplyRequestParameter valParameter in Parameter)
                {
                    valParameter.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

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

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

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

            if (!string.IsNullOrEmpty(AuthoredOn))
            {
                writer.WriteString("authoredOn", (string)AuthoredOn !);
            }

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

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

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

                foreach (Reference valSupplier in Supplier)
                {
                    valSupplier.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

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

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
示例#6
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 (BasedOn != null)
            {
                writer.WritePropertyName("basedOn");
                BasedOn.SerializeJson(writer, options);
            }

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

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

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

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

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

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

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

            if (!string.IsNullOrEmpty(OccurrenceDateTime))
            {
                writer.WriteString("occurrenceDateTime", (string)OccurrenceDateTime !);
            }

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

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

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

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

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

                foreach (CodeableConcept valReasonCode in ReasonCode)
                {
                    valReasonCode.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valReasonReference in ReasonReference)
                {
                    valReasonReference.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (Reference valBasis in Basis)
                {
                    valBasis.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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

                foreach (RiskAssessmentPrediction valPrediction in Prediction)
                {
                    valPrediction.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (!string.IsNullOrEmpty(Mitigation))
            {
                writer.WriteString("mitigation", (string)Mitigation !);
            }

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

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

                foreach (Annotation valNote in Note)
                {
                    valNote.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

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