private static Hospital ToHospital(CreatePharmaceuticalPrescriptions command) { return(new Hospital ( command.HealthFacilityIdentifier, command.HealthFacilityName, new BelgianHealthFacilityLicenseNumber(command.HealthFacilityLicenseNumber), command.HealthFacilityCode )); }
private static HealthcareProvider ToProvider(CreatePharmaceuticalPrescriptions command) { switch (command.PrescriberType) { case HealthcareProviderType.Physician: return(ToPhysician(command)); default: throw new ArgumentException($"Prescriber type '{command.PrescriberType}' not expected.", nameof(command)); } }
private static Patient ToPatient(CreatePharmaceuticalPrescriptions command) { return(new Patient ( command.PatientIdentifier, new FullName(command.PatientLastName, command.PatientFirstName), Enumeration.FromValue <BelgianSex>((int)command.PatientSex), BelgianSocialSecurityNumber.CreateIfNotEmpty(command.PatientSocialSecurityNumber), null, command.PatientBirthdate )); }
private static PostalAddress ToProviderPostalAddress(CreatePharmaceuticalPrescriptions command) { return(PostalAddress.CreateIfNotEmpty ( command.PrescriberStreet, command.PrescriberCity, command.PrescriberPostalCode, Alpha2CountryCode.CreateIfNotEmpty(command.PrescriberCountryCode), command.PrescriberHouseNumber, command.PrescriberBoxNumber )); }
private static ContactInformation ToProviderContactInformation(CreatePharmaceuticalPrescriptions command) { return(new ContactInformation (ToProviderPostalAddress(command), command.PrescriberPrimaryTelephoneNumber, command.PrescriberSecondaryTelephoneNumber, null, EmailAddress.CreateIfNotEmpty(command.PrescriberPrimaryEmailAddress), EmailAddress.CreateIfNotEmpty(command.PrescriberSecondaryEmailAddress), string.IsNullOrWhiteSpace(command.PrescriberWebSite) ? null : new Uri(command.PrescriberWebSite) )); }
private static Patient ToPatient(CreatePharmaceuticalPrescriptions command) { return(new Patient ( command.PatientIdentifier, new FullName(command.PatientLastName, command.PatientFirstName), Enumeration.FromValue <BelgianSex>((int)command.PatientSex), string.IsNullOrWhiteSpace(command.PatientSocialSecurityNumber) ? null : new BelgianSocialSecurityNumber(command.PatientSocialSecurityNumber), null, command.PatientBirthdate )); }
private static Physician ToPhysician(CreatePharmaceuticalPrescriptions command) { return(new Physician ( command.PrescriberIdentifier, new FullName(command.PrescriberLastName, command.PrescriberFirstName), new BelgianPractitionerLicenseNumber(command.PrescriberLicenseNumber), BelgianSocialSecurityNumber.CreateIfNotEmpty(command.PrescriberSocialSecurityNumber), ToProviderContactInformation(command), command.PrescriberSpeciality, command.PrescriberDisplayName )); }
private static HealthFacility ToHealthFacility(CreatePharmaceuticalPrescriptions command) { switch (command.HealthFacilityType) { case HealthFacilityType.Hospital: return(ToHospital(command)); case HealthFacilityType.Center: return(ToCenter(command)); default: throw new ArgumentException($"Health facility type '{command.HealthFacilityType}' not expected.", nameof(command)); } }
private static PostalAddress ToProviderPostalAddress(CreatePharmaceuticalPrescriptions command) { if (string.IsNullOrWhiteSpace(command.PrescriberStreet) || string.IsNullOrWhiteSpace(command.PrescriberCity)) { return(null); } return(new PostalAddress ( command.PrescriberStreet, command.PrescriberCity, command.PrescriberPostalCode, string.IsNullOrWhiteSpace(command.PrescriberCountryCode) ? null : new Alpha2CountryCode(command.PrescriberCountryCode), command.PrescriberHouseNumber, command.PrescriberBoxNumber )); }
public IEnumerable <PharmaceuticalPrescription> Translate(CreatePharmaceuticalPrescriptions command) { Condition.Requires(command, nameof(command)).IsNotNull(); var provider = ToProvider(command); var patient = ToPatient(command); var facility = ToHealthFacility(command); var languageCode = new Alpha2LanguageCode(command.LanguageCode); foreach (var prescription in command.Prescriptions) { yield return(PharmaceuticalPrescription.Create ( new PrescriptionIdentifier(prescription.PrescriptionIdentifier), provider, patient, facility, prescription.Medications.Select(m => ToPrescribedMedication(m)), prescription.CreatedOn, languageCode, prescription.DelivrableAt )); } }