コード例 #1
0
 private static Hospital ToHospital(CreatePharmaceuticalPrescriptions command)
 {
     return(new Hospital
            (
                command.HealthFacilityIdentifier,
                command.HealthFacilityName,
                new BelgianHealthFacilityLicenseNumber(command.HealthFacilityLicenseNumber),
                command.HealthFacilityCode
            ));
 }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
 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
            ));
 }
コード例 #4
0
 private static PostalAddress ToProviderPostalAddress(CreatePharmaceuticalPrescriptions command)
 {
     return(PostalAddress.CreateIfNotEmpty
            (
                command.PrescriberStreet,
                command.PrescriberCity,
                command.PrescriberPostalCode,
                Alpha2CountryCode.CreateIfNotEmpty(command.PrescriberCountryCode),
                command.PrescriberHouseNumber,
                command.PrescriberBoxNumber
            ));
 }
コード例 #5
0
 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)
                ));
 }
コード例 #6
0
 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
            ));
 }
コード例 #7
0
 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
            ));
 }
コード例 #8
0
        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));
            }
        }
コード例 #9
0
 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
            ));
 }
コード例 #10
0
        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
                             ));
            }
        }