Exemplo n.º 1
0
        private ContactComponent GetContactInfoForKin(entitystorematerialised_CoreNextofkin1 nextOfKin)
        {
            if (nextOfKin.IsNull())
            {
                return(null);
            }

            ContactComponent contactComponent = new ContactComponent
            {
                Address = new Address()
            };

            string addresssLine = string.Join(nextOfKin.Addressstreet, ", ", nextOfKin.Addressstreet2);

            contactComponent.Address.Line       = contactComponent.Address.Line.Append(addresssLine);
            contactComponent.Address.City       = nextOfKin.Addresscity;
            contactComponent.Address.State      = nextOfKin.Addresscountystateprovince;
            contactComponent.Address.Country    = nextOfKin.Addresscountry;
            contactComponent.Address.PostalCode = nextOfKin.Addresspostalcode;
            contactComponent.Address.Type       = Address.AddressType.Both;

            List <CodeableConcept> relationships = new List <CodeableConcept>();

            CodeableConcept relationship = new CodeableConcept
            {
                Text = nextOfKin.Relationship
            };

            relationships.Add(relationship);

            contactComponent.Relationship = relationships;

            HumanName nextOfKinName = new HumanName();

            contactComponent.Name = nextOfKinName.WithGiven(nextOfKin.Givenname).AndFamily(nextOfKin.Familyname);

            ContactPoint contact = new ContactPoint();

            if (!string.IsNullOrEmpty(nextOfKin.Personalcontactinfo))
            {
                contact.Value  = nextOfKin.Personalcontactinfo;
                contact.System = ContactPoint.ContactPointSystem.Phone;
                contact.Use    = ContactPoint.ContactPointUse.Home;
            }

            if (string.IsNullOrEmpty(nextOfKin.Personalcontactinfo) && !string.IsNullOrEmpty(nextOfKin.Businesscontactinfo))
            {
                contact.Value  = nextOfKin.Businesscontactinfo;
                contact.System = ContactPoint.ContactPointSystem.Phone;
                contact.Use    = ContactPoint.ContactPointUse.Work;
            }

            contactComponent.Telecom.Add(contact);

            return(contactComponent);
        }
Exemplo n.º 2
0
        public List <ContactComponent> Resolve(entitystorematerialised_CoreNextofkin1 nextOfKins, Patient destination, List <ContactComponent> destMember, ResolutionContext context)
        {
            var kins = new List <ContactComponent>();

            if (destination.Contact.IsCollectionValid())
            {
                destination.Contact.Each(contact => kins.Add(contact));
            }

            if (nextOfKins.IsNull())
            {
                return(kins);
            }

            var kin = GetContactInfoForKin(nextOfKins);

            if (kin != null)
            {
                kins.Add(kin);
            }

            return(kins);
        }