Exemplo n.º 1
0
        /// <summary>
        /// Generates the candidate registry.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="metadata">The metadata.</param>
        /// <returns>IMessage.</returns>
        public static IMessage GenerateCandidateRegistry(Core.Model.Common.Patient patient, PatientGenerator.Core.Model.Metadata metadata)
        {
            var message = CreateBaseMessage(metadata) as ADT_A01;

            var pid = message.PID;

            var cx = pid.GetPatientIdentifierList(0);

            cx.ID.Value = patient.HealthCardNo;
            cx.AssigningAuthority.UniversalID.Value     = metadata.AssigningAuthority;
            cx.AssigningAuthority.UniversalIDType.Value = "ISO";

            pid.Sex.Value = patient.Gender;
            pid.DateTimeOfBirth.TimeOfAnEvent.SetShortDate(patient.DateOfBirth);

            pid.GetPatientName(0).GivenName.Value = patient.FirstName;
            pid.GetPatientName(0).FamilyLastName.FamilyName.Value = patient.LastName;

            pid.GetPatientAddress(0).StreetAddress.Value   = patient.AddressLine;
            pid.GetPatientAddress(0).City.Value            = patient.City;
            pid.GetPatientAddress(0).StateOrProvince.Value = patient.Province;
            pid.GetPatientAddress(0).ZipOrPostalCode.Value = patient.PostalCode;
            pid.GetPatientAddress(0).Country.Value         = patient.Country;

            return(message);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates the candidate registry.
        /// </summary>
        /// <param name="patient">The patient.</param>
        /// <param name="metadata">The metadata.</param>
        /// <returns>Returns the generated patient from the given patient and the metadata.</returns>
        public static Patient GenerateCandidateRegistry(Core.Model.Common.Patient patient, Core.Model.Metadata metadata)
        {
            var fhirPatient = new Patient
            {
                Active  = true,
                Address = new List <Hl7.Fhir.Model.Address>
                {
                    new Hl7.Fhir.Model.Address
                    {
                        City    = patient.City,
                        Country = patient.Country,
                        Line    = new List <string>
                        {
                            patient.AddressLine
                        },
                        PostalCode = patient.PostalCode,
                        State      = patient.Province,
                        Use        = Hl7.Fhir.Model.Address.AddressUse.Home
                    }
                },
                BirthDate     = patient.DateOfBirth.ToString("yyyy-MM-dd"),
                Communication = new List <Patient.CommunicationComponent>
                {
                    new Patient.CommunicationComponent
                    {
                        Language  = new CodeableConcept("urn:ietf:bcp:47", "en", "English", "English"),
                        Preferred = true
                    },
                    new Patient.CommunicationComponent
                    {
                        Language = new CodeableConcept("urn:ietf:bcp:47", "sw", "Swahili", "Swahili")
                    }
                },
                Contact = new List <Patient.ContactComponent>
                {
                    new Patient.ContactComponent
                    {
                        Name = new HumanName
                        {
                            Family = patient.LastName,
                            Given  = new List <string>
                            {
                                "Smith",
                                "Mary"
                            },
                            Use = HumanName.NameUse.Official
                        },
                        Relationship = new List <CodeableConcept>
                        {
                            new CodeableConcept("", "MTH", "Mother")
                        }
                    }
                },
                Deceased   = new FhirDateTime(DateTime.Now),
                Id         = Guid.NewGuid().ToString(),
                Identifier = new List <Identifier>
                {
                    new Identifier($"urn:oid:{metadata.AssigningAuthority}", patient.HealthCardNo)
                },
                MultipleBirth = new FhirBoolean(true),
                Name          = new List <HumanName>
                {
                    new HumanName
                    {
                        Family = patient.LastName,
                        Given  = new List <string>
                        {
                            patient.FirstName,
                            patient.MiddleName
                        },
                        Use = HumanName.NameUse.Official
                    }
                },
                Telecom = new List <ContactPoint>
                {
                    new ContactPoint(ContactPoint.ContactPointSystem.Phone, ContactPoint.ContactPointUse.Mobile, patient.PhoneNo)
                }
            };

            switch (patient.Gender)
            {
            case "F":
            case "f":
            case "female":
            case "Female":
                fhirPatient.Gender = AdministrativeGender.Female;
                break;

            case "M":
            case "m":
            case "male":
            case "Male":
                fhirPatient.Gender = AdministrativeGender.Male;
                break;

            case "O":
            case "o":
            case "other":
            case "Other":
                fhirPatient.Gender = AdministrativeGender.Other;
                break;

            default:
                fhirPatient.Gender = AdministrativeGender.Unknown;
                break;
            }

            return(fhirPatient);
        }