Пример #1
0
        private static RxaDto GetRxaDto(Activity activity)
        {
            var immunization = ( Immunization )activity;

            var rxaDto = new RxaDto();

            if (immunization.ImmunizationAdministration != null)
            {
                if (immunization.ImmunizationAdministration.AdministeredAmount.HasValue)
                {
                    rxaDto.AdministeredAmount = immunization.ImmunizationAdministration.AdministeredAmount.Value.ToString();
                }

                rxaDto.AdministredUnits = Hl7TypeConverter.ConvertToHl7(immunization.ImmunizationAdministration.ImmunizationUnitOfMeasure);
            }

            if (immunization.ImmunizationVaccineInfo != null)
            {
                rxaDto.AdministeredCode = Hl7TypeConverter.ConvertToHl7(immunization.ImmunizationVaccineInfo.VaccineCodedConcept);

                if (immunization.ImmunizationVaccineInfo.ImmunizationVaccineManufacturer != null)
                {
                    if (!string.IsNullOrWhiteSpace(immunization.ImmunizationVaccineInfo.ImmunizationVaccineManufacturer.VaccineManufacturerCode))
                    {
                        rxaDto.SubstanceManufacturer =
                            VaccineManufacturer.GetVaccineManufacturerByCode(
                                immunization.ImmunizationVaccineInfo.ImmunizationVaccineManufacturer.VaccineManufacturerCode);
                    }
                    else if (
                        !string.IsNullOrWhiteSpace(
                            immunization.ImmunizationVaccineInfo.ImmunizationVaccineManufacturer.VaccineManufacturerName))
                    {
                        rxaDto.SubstanceManufacturer =
                            VaccineManufacturer.GetVaccineManufacturerByName(
                                immunization.ImmunizationVaccineInfo.ImmunizationVaccineManufacturer.VaccineManufacturerName);
                    }
                    else if (
                        (!string.IsNullOrWhiteSpace(
                             immunization.ImmunizationVaccineInfo.ImmunizationVaccineManufacturer.VaccineManufacturerCode)
                         ||
                         !string.IsNullOrWhiteSpace(
                             immunization.ImmunizationVaccineInfo.ImmunizationVaccineManufacturer.VaccineManufacturerName)))
                    {
                        rxaDto.SubstanceManufacturer = VaccineManufacturer.UnknownManufacturer;
                    }
                }

                rxaDto.SubstanceLotNumber = immunization.ImmunizationVaccineInfo.VaccineLotNumber;
            }

            if (activity.Visit != null && activity.Visit.CheckedInDateTime.HasValue)
            {
                rxaDto.AdministrationDate = activity.Visit.CheckedInDateTime.Value;
            }
            return(rxaDto);
        }
        private PidDto GetPidDto()
        {
            var pidDto = new PidDto
            {
                IdentifierTypeCodeset = IdentifierTypeCodeset.MedicalRecordNumber,

                // BirthDate is currently not required in the domain.
                // If BirthDate is not provided when an Hl7 message is generated an exception will be thrown.
                PatientDateOfBirth       = _patient.Profile.BirthDate.Value,
                IdNumber                 = _patient.Key.ToString(),
                PatientAdministrativeSex = Hl7TypeConverter.ConvertToHl7(_patient.Profile.PatientGender),
                PatientEthnicity         = _patient.Ethnicity == null ? null : Hl7TypeConverter.ConvertToHl7(_patient.Ethnicity.Ethnicity),
                PatientFirstName         = _patient.Name.First,
                PatientMiddleName        = _patient.Name.Middle,
                PatientLastName          = _patient.Name.Last,
            };

            return(pidDto);
        }
Пример #3
0
        private static PidDto GetPidDto(Activity activity)
        {
            var patient = activity.ClinicalCase.Patient;

            var pidDto = new PidDto {
                IdentifierTypeCodeset = IdentifierTypeCodeset.MedicalRecordNumber
            };

            if (patient.Profile.BirthDate.HasValue)
            {
                pidDto.PatientDateOfBirth = patient.Profile.BirthDate.Value;
            }

            pidDto.IdNumber         = patient.Key.ToString();
            pidDto.PatientFirstName = patient.Name.First;
            if (!string.IsNullOrWhiteSpace(patient.Name.Middle))
            {
                pidDto.PatientMiddleName = patient.Name.Middle;
            }

            pidDto.PatientLastName = patient.Name.Last;

            var patientAddress = patient.Addresses.FirstOrDefault();

            if (patientAddress != null)
            {
                pidDto.PatientCity          = patientAddress.Address.CityName;
                pidDto.PatientState         = patientAddress.Address.StateProvince.ShortName;
                pidDto.PatientStreetAddress = (string.IsNullOrWhiteSpace(patientAddress.Address.FirstStreetAddress)
                                                    ? string.Empty
                                                    : patientAddress.Address.FirstStreetAddress)
                                              +
                                              (string.IsNullOrWhiteSpace(patientAddress.Address.SecondStreetAddress)
                                                    ? string.Empty
                                                    : " " + patientAddress.Address.SecondStreetAddress);
                pidDto.PatientZipCode     = patientAddress.Address.PostalCode.Code;
                pidDto.PatientAddressType = Hl7TypeConverter.ConvertToHl7(patientAddress.PatientAddressType);
            }

            pidDto.PatientAdministrativeSex = Hl7TypeConverter.ConvertToHl7(patient.Profile.PatientGender);
            if (patient.Ethnicity != null)
            {
                pidDto.PatientEthnicity = Hl7TypeConverter.ConvertToHl7(patient.Ethnicity.Ethnicity);
            }

            var patientPhoneNumber = patient.PhoneNumbers.FirstOrDefault();

            if (patientPhoneNumber != null)
            {
                if (patientPhoneNumber.PhoneNumber != null)
                {
                    var phoneNumber = patientPhoneNumber.PhoneNumber.Replace("-", string.Empty);

                    pidDto.PatientHomeTelephoneAreaCityCode = phoneNumber.Substring(0, 3);
                    pidDto.PatientHomeTelephoneLocalNumber  = phoneNumber.Substring(3, phoneNumber.Length - 3);
                }

                pidDto.PatientTelecommunicationUseCode = Hl7TypeConverter.ConvertToHl7(patientPhoneNumber.PatientPhoneType);
            }

            var patientRace = patient.PrimaryPatientRace;

            if (patientRace != null)
            {
                pidDto.PatientRace = Hl7TypeConverter.ConvertToHl7(patientRace.Race);
            }
            return(pidDto);
        }