예제 #1
0
        /// <summary>
        /// Deserialize JSON into a FHIR MedicationDispense
        /// </summary>
        public static void DeserializeJson(this MedicationDispense current, ref Utf8JsonReader reader, JsonSerializerOptions options)
        {
            string propertyName;

            while (reader.Read())
            {
                if (reader.TokenType == JsonTokenType.EndObject)
                {
                    return;
                }

                if (reader.TokenType == JsonTokenType.PropertyName)
                {
                    propertyName = reader.GetString();
                    if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug)
                    {
                        Console.WriteLine($"MedicationDispense >>> MedicationDispense.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"MedicationDispense: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
        protected MedicationPrescription GetAndValidateMedicationPrescription(MedicationDispense medicationDispense)
        {
            var medicationPrescription = FhirBase.Read(ResourceType.MedicationPrescription.ToString(), medicationDispense.AuthorizingPrescription.First().ExtractId()) as MedicationPrescription;

            if (medicationPrescription == null)
            {
                throw new FhirHttpResponseException(HttpStatusCode.NotFound, "MedicationPrescription на который ссылаеться MedicationDispense не найден");
            }

            if (DateTime.Parse(medicationPrescription.Dispense.ValidityPeriod.End) < DateTime.Today)
            {
                throw new FhirHttpResponseException(HttpStatusCode.BadRequest, "У MedicationPrescription не активный срок действия");
            }

            return(medicationPrescription);
        }
예제 #3
0
        /// <summary>
        /// Serialize a FHIR MedicationDispense into JSON
        /// </summary>
        public static void SerializeJson(this MedicationDispense current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            writer.WriteString("resourceType", "MedicationDispense");
            // Complex: MedicationDispense, Export: MedicationDispense, Base: DomainResource (DomainResource)
            ((Hl7.Fhir.Model.DomainResource)current).SerializeJson(writer, options, false);

            if ((current.Identifier != null) && (current.Identifier.Count != 0))
            {
                writer.WritePropertyName("identifier");
                writer.WriteStartArray();
                foreach (Identifier val in current.Identifier)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if ((current.PartOf != null) && (current.PartOf.Count != 0))
            {
                writer.WritePropertyName("partOf");
                writer.WriteStartArray();
                foreach (ResourceReference val in current.PartOf)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            writer.WriteString("status", Hl7.Fhir.Utility.EnumUtility.GetLiteral(current.StatusElement.Value));

            if (current.StatusReason != null)
            {
                switch (current.StatusReason)
                {
                case CodeableConcept v_CodeableConcept:
                    writer.WritePropertyName("statusReasonCodeableConcept");
                    v_CodeableConcept.SerializeJson(writer, options);
                    break;

                case ResourceReference v_ResourceReference:
                    writer.WritePropertyName("statusReasonReference");
                    v_ResourceReference.SerializeJson(writer, options);
                    break;
                }
            }
            if (current.Category != null)
            {
                writer.WritePropertyName("category");
                current.Category.SerializeJson(writer, options);
            }

            if (current.Medication != null)
            {
                switch (current.Medication)
                {
                case CodeableConcept v_CodeableConcept:
                    writer.WritePropertyName("medicationCodeableConcept");
                    v_CodeableConcept.SerializeJson(writer, options);
                    break;

                case ResourceReference v_ResourceReference:
                    writer.WritePropertyName("medicationReference");
                    v_ResourceReference.SerializeJson(writer, options);
                    break;
                }
            }
            if (current.Subject != null)
            {
                writer.WritePropertyName("subject");
                current.Subject.SerializeJson(writer, options);
            }

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

            if ((current.SupportingInformation != null) && (current.SupportingInformation.Count != 0))
            {
                writer.WritePropertyName("supportingInformation");
                writer.WriteStartArray();
                foreach (ResourceReference val in current.SupportingInformation)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if ((current.Performer != null) && (current.Performer.Count != 0))
            {
                writer.WritePropertyName("performer");
                writer.WriteStartArray();
                foreach (MedicationDispense.PerformerComponent val in current.Performer)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.Location != null)
            {
                writer.WritePropertyName("location");
                current.Location.SerializeJson(writer, options);
            }

            if ((current.AuthorizingPrescription != null) && (current.AuthorizingPrescription.Count != 0))
            {
                writer.WritePropertyName("authorizingPrescription");
                writer.WriteStartArray();
                foreach (ResourceReference val in current.AuthorizingPrescription)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

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

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

            if (current.DaysSupply != null)
            {
                writer.WritePropertyName("daysSupply");
                current.DaysSupply.SerializeJson(writer, options);
            }

            if (current.WhenPreparedElement != null)
            {
                if (!string.IsNullOrEmpty(current.WhenPreparedElement.Value))
                {
                    writer.WriteString("whenPrepared", current.WhenPreparedElement.Value);
                }
                if (current.WhenPreparedElement.HasExtensions() || (!string.IsNullOrEmpty(current.WhenPreparedElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_whenPrepared", false, current.WhenPreparedElement.Extension, current.WhenPreparedElement.ElementId);
                }
            }

            if (current.WhenHandedOverElement != null)
            {
                if (!string.IsNullOrEmpty(current.WhenHandedOverElement.Value))
                {
                    writer.WriteString("whenHandedOver", current.WhenHandedOverElement.Value);
                }
                if (current.WhenHandedOverElement.HasExtensions() || (!string.IsNullOrEmpty(current.WhenHandedOverElement.ElementId)))
                {
                    JsonStreamUtilities.SerializeExtensionList(writer, options, "_whenHandedOver", false, current.WhenHandedOverElement.Extension, current.WhenHandedOverElement.ElementId);
                }
            }

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

            if ((current.Receiver != null) && (current.Receiver.Count != 0))
            {
                writer.WritePropertyName("receiver");
                writer.WriteStartArray();
                foreach (ResourceReference val in current.Receiver)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if ((current.Note != null) && (current.Note.Count != 0))
            {
                writer.WritePropertyName("note");
                writer.WriteStartArray();
                foreach (Annotation val in current.Note)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if ((current.DosageInstruction != null) && (current.DosageInstruction.Count != 0))
            {
                writer.WritePropertyName("dosageInstruction");
                writer.WriteStartArray();
                foreach (Dosage val in current.DosageInstruction)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (current.Substitution != null)
            {
                writer.WritePropertyName("substitution");
                current.Substitution.SerializeJson(writer, options);
            }

            if ((current.DetectedIssue != null) && (current.DetectedIssue.Count != 0))
            {
                writer.WritePropertyName("detectedIssue");
                writer.WriteStartArray();
                foreach (ResourceReference val in current.DetectedIssue)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if ((current.EventHistory != null) && (current.EventHistory.Count != 0))
            {
                writer.WritePropertyName("eventHistory");
                writer.WriteStartArray();
                foreach (ResourceReference val in current.EventHistory)
                {
                    val.SerializeJson(writer, options, true);
                }
                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
예제 #4
0
        /// <summary>
        /// Deserialize JSON into a FHIR MedicationDispense
        /// </summary>
        public static void DeserializeJsonProperty(this MedicationDispense current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "identifier":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'identifier' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Identifier = new List <Identifier>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Identifier v_Identifier = new Hl7.Fhir.Model.Identifier();
                    v_Identifier.DeserializeJson(ref reader, options);
                    current.Identifier.Add(v_Identifier);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'identifier' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Identifier.Count == 0)
                {
                    current.Identifier = null;
                }
                break;

            case "partOf":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'partOf' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.PartOf = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_PartOf = new Hl7.Fhir.Model.ResourceReference();
                    v_PartOf.DeserializeJson(ref reader, options);
                    current.PartOf.Add(v_PartOf);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'partOf' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.PartOf.Count == 0)
                {
                    current.PartOf = null;
                }
                break;

            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatusCodes>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "statusReasonCodeableConcept":
                current.StatusReason = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.StatusReason).DeserializeJson(ref reader, options);
                break;

            case "statusReasonReference":
                current.StatusReason = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.StatusReason).DeserializeJson(ref reader, options);
                break;

            case "category":
                current.Category = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Category).DeserializeJson(ref reader, options);
                break;

            case "medicationCodeableConcept":
                current.Medication = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Medication).DeserializeJson(ref reader, options);
                break;

            case "medicationReference":
                current.Medication = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Medication).DeserializeJson(ref reader, options);
                break;

            case "subject":
                current.Subject = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Subject).DeserializeJson(ref reader, options);
                break;

            case "context":
                current.Context = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Context).DeserializeJson(ref reader, options);
                break;

            case "supportingInformation":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'supportingInformation' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.SupportingInformation = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_SupportingInformation = new Hl7.Fhir.Model.ResourceReference();
                    v_SupportingInformation.DeserializeJson(ref reader, options);
                    current.SupportingInformation.Add(v_SupportingInformation);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'supportingInformation' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.SupportingInformation.Count == 0)
                {
                    current.SupportingInformation = null;
                }
                break;

            case "performer":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'performer' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Performer = new List <MedicationDispense.PerformerComponent>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.MedicationDispense.PerformerComponent v_Performer = new Hl7.Fhir.Model.MedicationDispense.PerformerComponent();
                    v_Performer.DeserializeJson(ref reader, options);
                    current.Performer.Add(v_Performer);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'performer' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Performer.Count == 0)
                {
                    current.Performer = null;
                }
                break;

            case "location":
                current.Location = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Location).DeserializeJson(ref reader, options);
                break;

            case "authorizingPrescription":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'authorizingPrescription' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.AuthorizingPrescription = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_AuthorizingPrescription = new Hl7.Fhir.Model.ResourceReference();
                    v_AuthorizingPrescription.DeserializeJson(ref reader, options);
                    current.AuthorizingPrescription.Add(v_AuthorizingPrescription);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'authorizingPrescription' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.AuthorizingPrescription.Count == 0)
                {
                    current.AuthorizingPrescription = null;
                }
                break;

            case "type":
                current.Type = new Hl7.Fhir.Model.CodeableConcept();
                ((Hl7.Fhir.Model.CodeableConcept)current.Type).DeserializeJson(ref reader, options);
                break;

            case "quantity":
                current.Quantity = new Hl7.Fhir.Model.Quantity();
                ((Hl7.Fhir.Model.Quantity)current.Quantity).DeserializeJson(ref reader, options);
                break;

            case "daysSupply":
                current.DaysSupply = new Hl7.Fhir.Model.Quantity();
                ((Hl7.Fhir.Model.Quantity)current.DaysSupply).DeserializeJson(ref reader, options);
                break;

            case "whenPrepared":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.WhenPreparedElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.WhenPreparedElement = new FhirDateTime(reader.GetString());
                }
                break;

            case "_whenPrepared":
                if (current.WhenPreparedElement == null)
                {
                    current.WhenPreparedElement = new FhirDateTime();
                }
                ((Hl7.Fhir.Model.Element)current.WhenPreparedElement).DeserializeJson(ref reader, options);
                break;

            case "whenHandedOver":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.WhenHandedOverElement = new FhirDateTime();
                    reader.Skip();
                }
                else
                {
                    current.WhenHandedOverElement = new FhirDateTime(reader.GetString());
                }
                break;

            case "_whenHandedOver":
                if (current.WhenHandedOverElement == null)
                {
                    current.WhenHandedOverElement = new FhirDateTime();
                }
                ((Hl7.Fhir.Model.Element)current.WhenHandedOverElement).DeserializeJson(ref reader, options);
                break;

            case "destination":
                current.Destination = new Hl7.Fhir.Model.ResourceReference();
                ((Hl7.Fhir.Model.ResourceReference)current.Destination).DeserializeJson(ref reader, options);
                break;

            case "receiver":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'receiver' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Receiver = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_Receiver = new Hl7.Fhir.Model.ResourceReference();
                    v_Receiver.DeserializeJson(ref reader, options);
                    current.Receiver.Add(v_Receiver);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'receiver' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Receiver.Count == 0)
                {
                    current.Receiver = null;
                }
                break;

            case "note":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'note' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.Note = new List <Annotation>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Annotation v_Note = new Hl7.Fhir.Model.Annotation();
                    v_Note.DeserializeJson(ref reader, options);
                    current.Note.Add(v_Note);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'note' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.Note.Count == 0)
                {
                    current.Note = null;
                }
                break;

            case "dosageInstruction":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'dosageInstruction' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.DosageInstruction = new List <Dosage>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.Dosage v_DosageInstruction = new Hl7.Fhir.Model.Dosage();
                    v_DosageInstruction.DeserializeJson(ref reader, options);
                    current.DosageInstruction.Add(v_DosageInstruction);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'dosageInstruction' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.DosageInstruction.Count == 0)
                {
                    current.DosageInstruction = null;
                }
                break;

            case "substitution":
                current.Substitution = new Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent();
                ((Hl7.Fhir.Model.MedicationDispense.SubstitutionComponent)current.Substitution).DeserializeJson(ref reader, options);
                break;

            case "detectedIssue":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'detectedIssue' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.DetectedIssue = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_DetectedIssue = new Hl7.Fhir.Model.ResourceReference();
                    v_DetectedIssue.DeserializeJson(ref reader, options);
                    current.DetectedIssue.Add(v_DetectedIssue);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'detectedIssue' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.DetectedIssue.Count == 0)
                {
                    current.DetectedIssue = null;
                }
                break;

            case "eventHistory":
                if ((reader.TokenType != JsonTokenType.StartArray) || (!reader.Read()))
                {
                    throw new JsonException($"MedicationDispense error reading 'eventHistory' expected StartArray, found {reader.TokenType}! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                }

                current.EventHistory = new List <ResourceReference>();

                while (reader.TokenType != JsonTokenType.EndArray)
                {
                    Hl7.Fhir.Model.ResourceReference v_EventHistory = new Hl7.Fhir.Model.ResourceReference();
                    v_EventHistory.DeserializeJson(ref reader, options);
                    current.EventHistory.Add(v_EventHistory);

                    if (!reader.Read())
                    {
                        throw new JsonException($"MedicationDispense error reading 'eventHistory' array, read failed! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    if (reader.TokenType == JsonTokenType.EndObject)
                    {
                        reader.Read();
                    }
                }

                if (current.EventHistory.Count == 0)
                {
                    current.EventHistory = null;
                }
                break;

            // Complex: MedicationDispense, Export: MedicationDispense, Base: DomainResource
            default:
                ((Hl7.Fhir.Model.DomainResource)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }