Exemple #1
0
 /// <summary>
 /// Get conflicts
 /// </summary>
 public static Models.ConflictPatientMatch[] GetConflicts(int offset, int count)
 {
     try
     {
         ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();
         var conflicts = client.GetConflicts(offset, count, false);
         Models.ConflictPatientMatch[] retVal = new ConflictPatientMatch[conflicts.count];
         if (conflicts == null || conflicts.conflict == null)
         {
             return(retVal);
         }
         for (int i = 0; i < conflicts.conflict.Length; i++)
         {
             ConflictPatientMatch match = new ConflictPatientMatch();
             match.Patient  = ConvertRegistrationEvent(conflicts.conflict[i].source);
             match.Matching = new List <PatientMatch>();
             foreach (var m in conflicts.conflict[i].matches)
             {
                 match.Matching.Add(ConvertRegistrationEvent(m));
             }
             retVal[offset + i] = match;
         }
         return(retVal);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemple #2
0
        /// <summary>
        /// Count recent activity
        /// </summary>
        public static int CountRecentActivity(TimeSpan since)
        {
            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
                        }
                    }
                };

                return(client.GetRecentActivity(sinceRange, 0, 0, true).count);
            }
            catch (Exception e)
            {
                return(0);
            }
        }
Exemple #3
0
        public ActionResult Resolve()
        {
            ConflictPatientMatch model = new ConflictPatientMatch();

            try
            {
                if (Request.Form["action"] == "cancel")
                {
                    return(RedirectToAction("Conflict"));
                }

                ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();
                decimal survivor = Decimal.Parse(Request.Form["id"]);

                if (Request.Form["action"] == "merge" && Request.Form["mrg"] != null)
                {
                    decimal[] ids = Request.Form["mrg"].Split(',').Select(o => Decimal.Parse(o)).ToArray();
                    client.Merge(ids, survivor);
                }
                client.Resolve(survivor);
                return(RedirectToAction("View", new { id = survivor }));
            }
            catch (Exception e)
            {
                Trace.TraceError(e.ToString());
                model = new ConflictPatientMatch();
            }
            return(View(model));
        }
Exemple #4
0
        /// <summary>
        /// Count conflicts
        /// </summary>
        /// <returns></returns>
        public static int CountConflicts()
        {
            try
            {
                ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();

                return(client.GetConflicts(0, Int32.MaxValue, true).count);
            }
            catch (Exception e)
            {
                return(0);
            }
        }
Exemple #5
0
        /// <summary>
        /// Get the specified patient identifier
        /// </summary>
        internal static Models.PatientMatch Get(decimal id)
        {
            try
            {
                ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();
                var regEvent = client.GetRegistrationEvent(id);
                if (regEvent == null)
                {
                    return(null);
                }

                return(ConvertRegistrationEvent(regEvent));
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemple #6
0
        /// <summary>
        /// Get the specified patient identifier
        /// </summary>
        internal static Models.PatientMatch Get(decimal id)
        {
            try
            {
                ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();
                var regEvent = client.GetRegistrationEvent(id);
                if (regEvent == null)
                {
                    throw new Exception("Patient not found");
                }

                return(ConvertRegistrationEvent(regEvent));
            }
            catch (Exception e)
            {
                Trace.TraceError("Error getting patient: {0}", e);
                throw;
            }
        }
Exemple #7
0
 /// <summary>
 /// Get a particular conflict
 /// </summary>
 public static ConflictPatientMatch GetConflict(decimal id)
 {
     try
     {
         ClientRegistryAdminInterfaceClient client = new ClientRegistryAdminInterfaceClient();
         var conflicts = client.GetConflict(id).conflict;
         var conflict  = conflicts[0];
         ConflictPatientMatch retVal = new ConflictPatientMatch();
         retVal.Patient  = ConvertRegistrationEvent(conflict.source);
         retVal.Matching = new List <PatientMatch>();
         foreach (var m in conflict.matches)
         {
             retVal.Matching.Add(ConvertRegistrationEvent(m));
         }
         return(retVal);
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemple #8
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);
            }
        }
Exemple #9
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);
            }
        }