Beispiel #1
0
        /// <summary>
        /// Get recent changes
        /// </summary>
        public static Models.PatientMatch[] GetRecentActivity(TimeSpan since, int offset, int count)
        {
            try
            {
                ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();

                DateTime high = DateTime.Now,
                         low  = DateTime.Now.Subtract(since);

                TimestampSet1 sinceRange = new TimestampSet1()
                {
                    part = new TimestampPart1[] {
                        new TimestampPart1()
                        {
                            value = low, type = TimestampPartType1.LowBound
                        },
                        new TimestampPart1()
                        {
                            value = high, type = TimestampPartType1.HighBound
                        }
                    }
                };

                var registrations = client.GetRecentActivity(sinceRange, offset, count, false);
                ClientRegistryAdmin.Models.PatientMatch[] retVal = new PatientMatch[registrations.count];
                for (int i = 0; i < registrations.registration.Length; i++)
                {
                    ClientRegistryAdmin.Models.PatientMatch pm = ConvertRegistrationEvent(registrations.registration[i]);
                    // Address?
                    retVal[offset + i] = pm;
                }
                return(retVal);
            }
            catch
            {
                return(null);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Search
        /// </summary>
        public static Models.PatientMatch[] Search(string familyName, string givenName, string dob, string identifier, int offset, int count)
        {
            ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();

            // Query prototype
            Person   queryPrototype = new Person();
            NameSet  name           = new NameSet();
            NamePart familyNamePart = null,
                     givenNamePart  = null;

            if (familyName != null)
            {
                familyNamePart = new NamePart()
                {
                    type  = NamePartType.Family,
                    value = familyName
                }
            }
            ;
            if (givenName != null)
            {
                givenNamePart = new NamePart()
                {
                    type  = NamePartType.Given,
                    value = givenName
                }
            }
            ;
            List <NamePart> parts = new List <NamePart>();

            if (givenNamePart != null)
            {
                parts.Add(givenNamePart);
            }
            if (familyNamePart != null)
            {
                parts.Add(familyNamePart);
            }
            name.part = parts.ToArray();
            if (name.part.Length > 0)
            {
                queryPrototype.name = new NameSet[] { name }
            }
            ;

            if (identifier != null)
            {
                queryPrototype.altId = new DomainIdentifier[] { new DomainIdentifier()
                                                                {
                                                                    uid = identifier
                                                                } }
            }
            ;
            // dob
            if (dob != null)
            {
                TS tsDob = (TS)dob;
                queryPrototype.birthTime = new TimestampPart()
                {
                    type      = TimestampPartType.Standlone,
                    value     = tsDob.DateValue,
                    precision = tsDob.DateValuePrecision == DatePrecision.Day ? "D" :
                                tsDob.DateValuePrecision == DatePrecision.Month ? "M" :
                                tsDob.DateValuePrecision == DatePrecision.Year ? "Y" :
                                "F"
                };
            }

            try
            {
                var registrations = client.GetRegistrations(queryPrototype, offset, count);
                ClientRegistryAdmin.Models.PatientMatch[] retVal = new PatientMatch[registrations.count];
                for (int i = 0; i < registrations.registration.Length; i++)
                {
                    ClientRegistryAdmin.Models.PatientMatch pm = ConvertRegistrationEvent(registrations.registration[i]);
                    // Address?
                    retVal[offset + i] = pm;
                }

                return(retVal);
            }
            catch
            {
                return(null);
            }
        }