private static PrescribedPharmaceuticalCompounding ToCompounding(PrescribedMedicationDescriptor medication) { return(new PrescribedPharmaceuticalCompounding ( medication.NameOrDescription, medication.Posology, medication.Quantity )); }
private static PrescribedPharmaceuticalSubstance ToSubstance(PrescribedMedicationDescriptor medication) { return(new PrescribedPharmaceuticalSubstance ( medication.NameOrDescription, medication.Posology, medication.Quantity, BelgianMedicationCode.CreateIfNotEmpty(medication.Code) )); }
private static PrescribedPharmaceuticalProduct ToProduct(PrescribedMedicationDescriptor medication) { return(new PrescribedPharmaceuticalProduct ( medication.NameOrDescription, medication.Posology, medication.Quantity, medication.Duration, BelgianMedicationCode.CreateIfNotEmpty(medication.Code) )); }
private static PrescribedPharmaceuticalSubstance ToSubstance(PrescribedMedicationDescriptor medication) { return(new PrescribedPharmaceuticalSubstance ( medication.NameOrDescription, medication.Posology, medication.Quantity, medication.Duration, string.IsNullOrWhiteSpace(medication.Code) ? null : new BelgianMedicationCode(medication.Code) )); }
private static PrescribedMedication ToPrescribedMedication(PrescribedMedicationDescriptor medication) { switch (medication.MedicationType) { case PrescribedMedicationType.Product: return(ToProduct(medication)); case PrescribedMedicationType.Substance: return(ToSubstance(medication)); case PrescribedMedicationType.Compounding: return(ToCompounding(medication)); default: throw new ArgumentException($"Medication type '{medication.MedicationType}' not expected.", nameof(medication)); } }