public void testBuildPatientObject() { DemographicSet patientDemogs = new DemographicSet(); Address addr = new Address() { City = "Hooville", State = "MI", County = "Eggs and Ham", Street1 = "123 Elm St.", Street2 = "Apt 4", Zipcode = "90210" }; PhoneNum phone = new PhoneNum() { Description = "Cell phone", AreaCode = "555", Exchange = "867", Number = "5309" }; EmailAddress email = new EmailAddress() { Address = "*****@*****.**" }; IList <Address> addresses = new List <Address>() { addr }; IList <PhoneNum> telephones = new List <PhoneNum>() { phone }; IList <EmailAddress> emails = new List <EmailAddress>() { email }; patientDemogs.EmailAddresses = emails.ToList <EmailAddress>(); patientDemogs.PhoneNumbers = telephones.ToList <PhoneNum>(); patientDemogs.StreetAddresses = addresses.ToList <Address>(); CCRHelper helper = new CCRHelper(); ActorType patient = helper.buildPatientObject("1234567890", "987654321", "USER", "ONE", "O", "0000/12/25", "2011", "M", patientDemogs); Assert.IsNotNull(patient); Assert.IsTrue(patient.Item is ActorTypePerson); Assert.AreEqual(patient.Address.Count, 1); Assert.AreEqual(patient.EMail.Count, 1); Assert.AreEqual(patient.Telephone.Count, 1); Assert.AreEqual(patient.IDs.Count, 2); Assert.IsTrue(String.Equals(patient.IDs[0].ID, "1234567890")); Assert.IsTrue(String.Equals(patient.IDs[0].Type.Text, "ID")); Assert.IsTrue(String.Equals(patient.IDs[1].ID, "987654321")); Assert.IsTrue(String.Equals(patient.IDs[1].Type.Text, "SSN")); Assert.IsTrue(String.Equals(patient.Address[0].City, "Hooville")); Assert.IsTrue(String.Equals(patient.Address[0].County, "Eggs and Ham")); Assert.IsTrue(String.Equals(patient.Address[0].Line1, "123 Elm St.")); Assert.IsTrue(String.Equals(patient.Address[0].Line2, "Apt 4")); Assert.IsTrue(String.Equals(patient.Address[0].PostalCode, "90210")); Assert.IsTrue(String.Equals(patient.Address[0].State, "MI")); Assert.IsTrue(String.Equals(patient.EMail[0].Value, "*****@*****.**")); Assert.IsTrue(String.Equals(patient.Telephone[0].Value, "5558675309")); ActorTypePerson person = (ActorTypePerson)patient.Item; Assert.IsTrue(String.Equals(person.DateOfBirth.ExactDateTime, "0000/12/25")); Assert.IsTrue(String.Equals(person.DateOfBirth.Age.Value, "2011")); Assert.IsTrue(String.Equals(person.Gender.Text, "M")); Assert.IsTrue(String.Equals(person.Name.CurrentName.Family.First(), "ONE")); Assert.IsTrue(String.Equals(person.Name.CurrentName.Given.First(), "USER")); Assert.IsTrue(String.Equals(person.Name.CurrentName.Middle.First(), "O")); }
public ActorType buildPatientObject(string id, string ssn, string firstname, string lastName, string middleName, string dob, string age, string gender, DemographicSet demogs) { ActorType patient = new ActorType(); ActorTypePerson person = new ActorTypePerson() { Name = new ActorTypePersonName() { CurrentName = new PersonNameType() { Family = new List <string>() { lastName }, Given = new List <string>() { firstname }, Middle = new List <string>() { middleName } } }, Gender = new CodedDescriptionType() { Text = gender } }; person.DateOfBirth = new DateTimeType() { ExactDateTime = dob, Age = new MeasureType() { Value = age } }; patient.Item = person; patient.Address = new List <ActorTypeAddress>(); if (demogs != null && demogs.StreetAddresses != null && demogs.StreetAddresses.Count > 0) { foreach (Address addr in demogs.StreetAddresses) { ActorTypeAddress newAddr = new ActorTypeAddress() { City = addr.City, County = addr.County, Line1 = addr.Street1, Line2 = addr.Street2, PostalCode = addr.Zipcode, State = addr.State }; patient.Address.Add(newAddr); } } patient.EMail = new List <CommunicationType>(); if (demogs != null && demogs.EmailAddresses != null && demogs.EmailAddresses.Count > 0) { foreach (EmailAddress addy in demogs.EmailAddresses) { CommunicationType newEmail = new CommunicationType() { Type = new CodedDescriptionType() { Text = "Email" }, Value = addy.Address }; patient.EMail.Add(newEmail); } } patient.Telephone = new List <CommunicationType>(); if (demogs != null && demogs.PhoneNumbers != null && demogs.PhoneNumbers.Count > 0) { foreach (PhoneNum phone in demogs.PhoneNumbers) { CommunicationType newPhone = new CommunicationType() { Value = phone.ToString() }; if (String.IsNullOrEmpty(phone.Description)) { newPhone.Type = new CodedDescriptionType() { Text = "Telephone" }; } else { newPhone.Type = new CodedDescriptionType() { Text = phone.Description }; } patient.Telephone.Add(newPhone); } } IDType patientId = new IDType() { ID = id, Type = new CodedDescriptionType() { Text = "ID" } }; IDType patientSSN = new IDType() { ID = ssn, Type = new CodedDescriptionType() { Text = "SSN" } }; patient.IDs = new List <IDType>() { patientId, patientSSN }; return(patient); }