public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            TypeConceptId.GetHashCode() ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0) ^
            (StopReason != null ? StopReason.GetHashCode() : 0) ^
            Refills.GetHashCode() ^
            VisitOccurrenceId.GetHashCode() ^
            Quantity.GetHashCode() ^
            DaysSupply.GetHashCode() ^
            RouteConceptId.GetHashCode() ^
            EffectiveDrugDose.GetHashCode() ^
            DoseUnitConceptId.GetHashCode() ^
            SourceConceptId.GetHashCode() ^
            (Sig != null ? Sig.GetHashCode() : 0) ^
            (LotNumber != null ? LotNumber.GetHashCode() : 0) ^
            (RouteSourceValue != null ? RouteSourceValue.GetHashCode() : 0) ^
            (DoseUnitSourceValue != null ? DoseUnitSourceValue.GetHashCode() : 0) ^
            ProviderId.GetHashCode() ^
            (StartDate.GetHashCode()) ^
            (EndDate.GetHashCode()) ^
            (VerbatimEndDate.GetHashCode()) ^
            (StartTime != null ? StartTime.GetHashCode() : 0) ^
            (EndTime != null ? EndTime.GetHashCode() : 0));
 }
 public void Validate()
 {
     PrescribedBy.ValidateRequired("PrescribedBy");
     DatePrescribed.ValidateOptional("DatePrescribed");
     Amount.ValidateOptional("Amount");
     Substitution.ValidateOptional("Substitution");
     Refills.ValidateOptional("Refills");
     DaysSupply.ValidateOptional("DaysSupply");
     Expiration.ValidateOptional("Expiration");
     Instructions.ValidateOptional("Instructions");
 }
Beispiel #3
0
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            TypeConceptId.GetHashCode() ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0) ^
            (StopReason != null ? StopReason.GetHashCode() : 0) ^
            Refills.GetHashCode() ^
            VisitOccurrenceId.GetHashCode() ^
            Quantity.GetHashCode() ^
            DaysSupply.GetHashCode() ^
            (Sig != null ? Sig.GetHashCode() : 0) ^
            ProviderId.GetHashCode() ^
            RelevantConditionConceptId.GetHashCode() ^
            (StartDate.GetHashCode()) ^
            (EndDate.GetHashCode()));
 }
        public string ToFileLine( )
        {
            string sizePlusUnit = Size.ToString("f3") + Unit;

            string daysSupplyFormatted;

            if (DaysSupply >= 1_000_000)
            {
                daysSupplyFormatted = DaysSupply.ToString("0.#####e+000");
            }
            else
            {
                daysSupplyFormatted = DaysSupply.ToString("f0");
            }

            return($"{Code,-7}{Name,-30}{Id,-13}{sizePlusUnit,-14}{Quantity,-16:f0}"
                   + $"{Lowest,-10:#.0000;-#.0000}{IngredientCost,-12:#.00;-#.00}{NumTar,-8}"
                   + $"{TotalPaid,-14:#.00;-#.00}{AveragePaid,-10:#.00;-#.00}"
                   + $"{daysSupplyFormatted,-14}{ClaimLines,-10}");
        }
        /// <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();
            }
        }
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as MedicationDispense;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (Identifier != null)
                {
                    dest.Identifier = (Hl7.Fhir.Model.Identifier)Identifier.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseStatus>)StatusElement.DeepCopy();
                }
                if (Patient != null)
                {
                    dest.Patient = (Hl7.Fhir.Model.ResourceReference)Patient.DeepCopy();
                }
                if (Dispenser != null)
                {
                    dest.Dispenser = (Hl7.Fhir.Model.ResourceReference)Dispenser.DeepCopy();
                }
                if (AuthorizingPrescription != null)
                {
                    dest.AuthorizingPrescription = new List <Hl7.Fhir.Model.ResourceReference>(AuthorizingPrescription.DeepCopy());
                }
                if (Type != null)
                {
                    dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                }
                if (Quantity != null)
                {
                    dest.Quantity = (Hl7.Fhir.Model.Quantity)Quantity.DeepCopy();
                }
                if (DaysSupply != null)
                {
                    dest.DaysSupply = (Hl7.Fhir.Model.Quantity)DaysSupply.DeepCopy();
                }
                if (Medication != null)
                {
                    dest.Medication = (Hl7.Fhir.Model.ResourceReference)Medication.DeepCopy();
                }
                if (WhenPreparedElement != null)
                {
                    dest.WhenPreparedElement = (Hl7.Fhir.Model.FhirDateTime)WhenPreparedElement.DeepCopy();
                }
                if (WhenHandedOverElement != null)
                {
                    dest.WhenHandedOverElement = (Hl7.Fhir.Model.FhirDateTime)WhenHandedOverElement.DeepCopy();
                }
                if (Destination != null)
                {
                    dest.Destination = (Hl7.Fhir.Model.ResourceReference)Destination.DeepCopy();
                }
                if (Receiver != null)
                {
                    dest.Receiver = new List <Hl7.Fhir.Model.ResourceReference>(Receiver.DeepCopy());
                }
                if (NoteElement != null)
                {
                    dest.NoteElement = (Hl7.Fhir.Model.FhirString)NoteElement.DeepCopy();
                }
                if (DosageInstruction != null)
                {
                    dest.DosageInstruction = new List <Hl7.Fhir.Model.MedicationDispense.MedicationDispenseDosageInstructionComponent>(DosageInstruction.DeepCopy());
                }
                if (Substitution != null)
                {
                    dest.Substitution = (Hl7.Fhir.Model.MedicationDispense.MedicationDispenseSubstitutionComponent)Substitution.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }