/// <summary> /// Serialize to a JSON object /// </summary> public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true) { if (includeStartObject) { writer.WriteStartObject(); } ((fhirCsR4.Models.BackboneElement) this).SerializeJson(writer, options, false); if (TherapyRelationshipType != null) { writer.WritePropertyName("therapyRelationshipType"); TherapyRelationshipType.SerializeJson(writer, options); } if (MedicationCodeableConcept != null) { writer.WritePropertyName("medicationCodeableConcept"); MedicationCodeableConcept.SerializeJson(writer, options); } if (MedicationReference != null) { writer.WritePropertyName("medicationReference"); MedicationReference.SerializeJson(writer, options); } if (includeStartObject) { writer.WriteEndObject(); } }
/// <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 ((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 (StatusReasonCodeableConcept != null) { writer.WritePropertyName("statusReasonCodeableConcept"); StatusReasonCodeableConcept.SerializeJson(writer, options); } if (StatusReasonReference != null) { writer.WritePropertyName("statusReasonReference"); StatusReasonReference.SerializeJson(writer, options); } if (Category != null) { writer.WritePropertyName("category"); Category.SerializeJson(writer, options); } if (MedicationCodeableConcept != null) { writer.WritePropertyName("medicationCodeableConcept"); MedicationCodeableConcept.SerializeJson(writer, options); } if (MedicationReference != null) { writer.WritePropertyName("medicationReference"); MedicationReference.SerializeJson(writer, options); } if (Subject != null) { writer.WritePropertyName("subject"); Subject.SerializeJson(writer, options); } if (Context != null) { writer.WritePropertyName("context"); Context.SerializeJson(writer, options); } if ((SupportingInformation != null) && (SupportingInformation.Count != 0)) { writer.WritePropertyName("supportingInformation"); writer.WriteStartArray(); foreach (Reference valSupportingInformation in SupportingInformation) { valSupportingInformation.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Performer != null) && (Performer.Count != 0)) { writer.WritePropertyName("performer"); writer.WriteStartArray(); foreach (MedicationDispensePerformer valPerformer in Performer) { valPerformer.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Location != null) { writer.WritePropertyName("location"); Location.SerializeJson(writer, options); } if ((AuthorizingPrescription != null) && (AuthorizingPrescription.Count != 0)) { writer.WritePropertyName("authorizingPrescription"); writer.WriteStartArray(); foreach (Reference valAuthorizingPrescription in AuthorizingPrescription) { valAuthorizingPrescription.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Type != null) { writer.WritePropertyName("type"); Type.SerializeJson(writer, options); } if (Quantity != null) { writer.WritePropertyName("quantity"); Quantity.SerializeJson(writer, options); } if (DaysSupply != null) { writer.WritePropertyName("daysSupply"); DaysSupply.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(WhenPrepared)) { writer.WriteString("whenPrepared", (string)WhenPrepared !); } if (_WhenPrepared != null) { writer.WritePropertyName("_whenPrepared"); _WhenPrepared.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(WhenHandedOver)) { writer.WriteString("whenHandedOver", (string)WhenHandedOver !); } if (_WhenHandedOver != null) { writer.WritePropertyName("_whenHandedOver"); _WhenHandedOver.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 ((Note != null) && (Note.Count != 0)) { writer.WritePropertyName("note"); writer.WriteStartArray(); foreach (Annotation valNote in Note) { valNote.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((DosageInstruction != null) && (DosageInstruction.Count != 0)) { writer.WritePropertyName("dosageInstruction"); writer.WriteStartArray(); foreach (Dosage valDosageInstruction in DosageInstruction) { valDosageInstruction.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Substitution != null) { writer.WritePropertyName("substitution"); Substitution.SerializeJson(writer, options); } if ((DetectedIssue != null) && (DetectedIssue.Count != 0)) { writer.WritePropertyName("detectedIssue"); writer.WriteStartArray(); foreach (Reference valDetectedIssue in DetectedIssue) { valDetectedIssue.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((EventHistory != null) && (EventHistory.Count != 0)) { writer.WritePropertyName("eventHistory"); writer.WriteStartArray(); foreach (Reference valEventHistory in EventHistory) { valEventHistory.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
/// <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 ((Instantiates != null) && (Instantiates.Count != 0)) { writer.WritePropertyName("instantiates"); writer.WriteStartArray(); foreach (string valInstantiates in Instantiates) { writer.WriteStringValue(valInstantiates); } writer.WriteEndArray(); } if ((_Instantiates != null) && (_Instantiates.Count != 0)) { writer.WritePropertyName("_instantiates"); writer.WriteStartArray(); foreach (Element val_Instantiates in _Instantiates) { val_Instantiates.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 ((StatusReason != null) && (StatusReason.Count != 0)) { writer.WritePropertyName("statusReason"); writer.WriteStartArray(); foreach (CodeableConcept valStatusReason in StatusReason) { valStatusReason.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Category != null) { writer.WritePropertyName("category"); Category.SerializeJson(writer, options); } if (MedicationCodeableConcept != null) { writer.WritePropertyName("medicationCodeableConcept"); MedicationCodeableConcept.SerializeJson(writer, options); } if (MedicationReference != null) { writer.WritePropertyName("medicationReference"); MedicationReference.SerializeJson(writer, options); } if (Subject != null) { writer.WritePropertyName("subject"); Subject.SerializeJson(writer, options); } if (Context != null) { writer.WritePropertyName("context"); Context.SerializeJson(writer, options); } if ((SupportingInformation != null) && (SupportingInformation.Count != 0)) { writer.WritePropertyName("supportingInformation"); writer.WriteStartArray(); foreach (Reference valSupportingInformation in SupportingInformation) { valSupportingInformation.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (!string.IsNullOrEmpty(EffectiveDateTime)) { writer.WriteString("effectiveDateTime", (string)EffectiveDateTime !); } if (_EffectiveDateTime != null) { writer.WritePropertyName("_effectiveDateTime"); _EffectiveDateTime.SerializeJson(writer, options); } if (EffectivePeriod != null) { writer.WritePropertyName("effectivePeriod"); EffectivePeriod.SerializeJson(writer, options); } if ((Performer != null) && (Performer.Count != 0)) { writer.WritePropertyName("performer"); writer.WriteStartArray(); foreach (MedicationAdministrationPerformer valPerformer in Performer) { valPerformer.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 (Request != null) { writer.WritePropertyName("request"); Request.SerializeJson(writer, options); } if ((Device != null) && (Device.Count != 0)) { writer.WritePropertyName("device"); writer.WriteStartArray(); foreach (Reference valDevice in Device) { valDevice.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 (Dosage != null) { writer.WritePropertyName("dosage"); Dosage.SerializeJson(writer, options); } if ((EventHistory != null) && (EventHistory.Count != 0)) { writer.WritePropertyName("eventHistory"); writer.WriteStartArray(); foreach (Reference valEventHistory in EventHistory) { valEventHistory.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }
/// <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 ((StatusReason != null) && (StatusReason.Count != 0)) { writer.WritePropertyName("statusReason"); writer.WriteStartArray(); foreach (CodeableConcept valStatusReason in StatusReason) { valStatusReason.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (Category != null) { writer.WritePropertyName("category"); Category.SerializeJson(writer, options); } if (MedicationCodeableConcept != null) { writer.WritePropertyName("medicationCodeableConcept"); MedicationCodeableConcept.SerializeJson(writer, options); } if (MedicationReference != null) { writer.WritePropertyName("medicationReference"); MedicationReference.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(EffectiveDateTime)) { writer.WriteString("effectiveDateTime", (string)EffectiveDateTime !); } if (_EffectiveDateTime != null) { writer.WritePropertyName("_effectiveDateTime"); _EffectiveDateTime.SerializeJson(writer, options); } if (EffectivePeriod != null) { writer.WritePropertyName("effectivePeriod"); EffectivePeriod.SerializeJson(writer, options); } if (!string.IsNullOrEmpty(DateAsserted)) { writer.WriteString("dateAsserted", (string)DateAsserted !); } if (_DateAsserted != null) { writer.WritePropertyName("_dateAsserted"); _DateAsserted.SerializeJson(writer, options); } if (InformationSource != null) { writer.WritePropertyName("informationSource"); InformationSource.SerializeJson(writer, options); } if ((DerivedFrom != null) && (DerivedFrom.Count != 0)) { writer.WritePropertyName("derivedFrom"); writer.WriteStartArray(); foreach (Reference valDerivedFrom in DerivedFrom) { valDerivedFrom.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 ((Note != null) && (Note.Count != 0)) { writer.WritePropertyName("note"); writer.WriteStartArray(); foreach (Annotation valNote in Note) { valNote.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if ((Dosage != null) && (Dosage.Count != 0)) { writer.WritePropertyName("dosage"); writer.WriteStartArray(); foreach (Dosage valDosage in Dosage) { valDosage.SerializeJson(writer, options, true); } writer.WriteEndArray(); } if (includeStartObject) { writer.WriteEndObject(); } }