예제 #1
0
        /// <summary>
        /// Create custodial data from either a RepositoryDevice or a HealthcareParticipant
        /// </summary>
        private Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.Custodian CreateCustodian(RegistrationEvent registrationEvent, TargetConfiguration configuration)
        {
            ISystemConfigurationService sysConfig = this.Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;

            var subject = registrationEvent.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;
            var iiSet   = new List <II>(CreateIISet(subject.AlternateIdentifiers));

            iiSet.RemoveAll(ii => !configuration.NotificationDomain.Exists(o => o.Domain.Equals(ii.Root)));

            var oidData = sysConfig.OidRegistrar.FindData(iiSet[0].Root);

            if (oidData == null)
            {
                throw new InvalidOperationException("Cannot find notification settings for " + oidData);
            }

            var retVal = new Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.Custodian(
                new Everest.RMIM.UV.NE2008.COCT_MT090003UV01.AssignedEntity()
                );

            // Device
            retVal.AssignedEntity.SetAssignedPrincipalChoiceList(
                new Everest.RMIM.UV.NE2008.COCT_MT090303UV01.Device(
                    SET <II> .CreateSET(new II(oidData.Attributes.Find(o => o.Key == "CustodialDeviceId").Value ?? oidData.Oid)),
                    null,
                    oidData.Attributes.Find(o => o.Key == "CustodialDeviceName").Value ?? oidData.Description
                    )
                );
            retVal.AssignedEntity.Id = SET <II> .CreateSET(new II(oidData.Oid));

            return(retVal);
        }
예제 #2
0
        /// <summary>
        /// Enrich the registration event
        /// </summary>
        internal void EnrichRegistrationEvent(IDbConnection conn, IDbTransaction tx, RegistrationEvent hsrEvent)
        {
            decimal tryDec;
            ISystemConfigurationService configService = ApplicationContext.ConfigurationService;

            // Create a query based on the person
            Person subject = hsrEvent.FindComponent(HealthServiceRecordSiteRoleType.SubjectOf) as Person;

            if (subject.AlternateIdentifiers.Exists(o => o.Domain == configService.OidRegistrar.GetOid(ClientRegistryOids.CLIENT_CRID).Oid))
            {
                subject = new Person()
                {
                    AlternateIdentifiers = new List <DomainIdentifier>(subject.AlternateIdentifiers.FindAll(o => o.Domain == configService.OidRegistrar.GetOid(ClientRegistryOids.CLIENT_CRID).Oid)),
                    Status = StatusType.Normal
                }
            }
            ;
            else if (subject.AlternateIdentifiers.Exists(o => o is AuthorityAssignedDomainIdentifier))
            {
                subject = new Person()
                {
                    AlternateIdentifiers = new List <DomainIdentifier>(subject.AlternateIdentifiers.FindAll(o => o is AuthorityAssignedDomainIdentifier)),
                    Status = StatusType.Normal
                }
            }
            ;
            else
            {
                subject = new Person()
                {
                    AlternateIdentifiers = new List <DomainIdentifier>(subject.AlternateIdentifiers),
                    Status = StatusType.Normal
                }
            };

            QueryEvent        query = new QueryEvent();
            RegistrationEvent evt   = new RegistrationEvent();

            query.Add(evt, "SUBJ", HealthServiceRecordSiteRoleType.SubjectOf, null);
            evt.Status = StatusType.Active | StatusType.Obsolete;
            evt.Add(subject, "SUBJ", HealthServiceRecordSiteRoleType.SubjectOf, null);
            query.Add(new QueryParameters()
            {
                MatchingAlgorithm = MatchAlgorithm.Exact,
                MatchStrength     = MatchStrength.Exact
            }, "FLTR", HealthServiceRecordSiteRoleType.FilterOf, null);
            var tRecordIds = QueryRecord(query);

            if (tRecordIds.Length != 1)
            {
                throw new MissingPrimaryKeyException(ApplicationContext.LocaleService.GetString("DBCF004"));
            }
            else if (tRecordIds[0].Domain != configService.OidRegistrar.GetOid(ClientRegistryOids.REGISTRATION_EVENT).Oid)
            {
                throw new MissingPrimaryKeyException(ApplicationContext.LocaleService.GetString("DBCF005"));
            }

            tryDec = Decimal.Parse(tRecordIds[0].Identifier);
            hsrEvent.AlternateIdentifier = tRecordIds[0];
        }
예제 #3
0
        /// <summary>
        /// Validate identifiers
        /// </summary>
        internal bool ValidateIdentifiers(RegistrationEvent data, List <IResultDetail> dtls)
        {
            Person subject = data.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;
            //var scoper = subject.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.PlaceOfEntry | SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.InformantTo) as HealthcareParticipant;
            //var custodian = data.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.PlaceOfRecord | SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.ResponsibleFor);

            bool isValid = true;

            //// Validate the root
            //foreach (var id in subject.AlternateIdentifiers)
            //    if (scoper != null && !scoper.AlternateIdentifiers.Exists(o => o.Domain == id.Domain))
            //    {
            //        isValid = false;
            //        dtls.Add(new FormalConstraintViolationResultDetail(ResultDetailType.Error, this.m_localeService.GetString("MSGW015"), null, null));
            //    }
            //    else if (scoper != null && String.IsNullOrEmpty(id.AssigningAuthority))
            //        id.AssigningAuthority = scoper.LegalName.Parts[0].Value;
            //    else if (String.IsNullOrEmpty(id.AssigningAuthority) && custodian is RepositoryDevice && (custodian as RepositoryDevice).AlternateIdentifier.Domain == id.Domain)
            //        id.AssigningAuthority = (custodian as RepositoryDevice).Name;
            //    else if (String.IsNullOrEmpty(id.AssigningAuthority) && custodian is HealthcareParticipant && (custodian as HealthcareParticipant).AlternateIdentifiers.Exists(o => o.Domain == id.Domain))
            //        id.AssigningAuthority = (custodian as HealthcareParticipant).LegalName.Parts[0].Value;


            // Validate we know all identifiers
            foreach (var id in subject.AlternateIdentifiers)
            {
                if (String.IsNullOrEmpty(id.AssigningAuthority))
                {
                    dtls.Add(new FormalConstraintViolationResultDetail(ResultDetailType.Error, String.Format(m_localeService.GetString("MSGE06A"), id.Domain), null, null));
                    isValid = false;
                }
            }

            return(isValid);
        }
예제 #4
0
        /// <summary>
        /// De-persist the component from the database
        /// </summary>
        public System.ComponentModel.IComponent DePersist(System.Data.IDbConnection conn, decimal identifier, IContainer container, HealthServiceRecordSiteRoleType?roleType, bool loadFast)
        {
            Place retVal = new Place();

            IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, null);

            try
            {
                // Determine the container
                RegistrationEvent hsrParent = container as RegistrationEvent;

                retVal = GetLocation(conn, null, new DomainIdentifier()
                {
                    Identifier = identifier.ToString()
                });

                // Data reader
                if (hsrParent != null)
                {
                    hsrParent.Add(retVal, Guid.NewGuid().ToString(), roleType.Value, retVal.AlternateIdentifiers);
                }
                else
                {
                    container.Add(retVal);
                }
            }
            finally
            {
                cmd.Dispose();
            }

            return(retVal);
        }
예제 #5
0
        public override int OnRegistrationEvent(RegistrationEvent e)
        {
            short code = e.getCode();
            tsip_register_event_type_t type = e.getType();
            String text;

            RegistrationSession session = e.getSession();

            switch (type)
            {
            case tsip_register_event_type_t.tsip_i_register:
            case tsip_register_event_type_t.tsip_ao_register:
            case tsip_register_event_type_t.tsip_i_unregister:
            case tsip_register_event_type_t.tsip_ao_unregister:
                break;
            }

            text = String.Format("OnRegistrationChanged() ==> {0}:{1}", code, e.getPhrase());

            if (this.form.InvokeRequired)
            {
                this.form.Invoke(this.form.mydel, new object[] { text });
            }

            return(0);
        }
예제 #6
0
        /// <summary>
        /// Persist the specified data
        /// </summary>
        public VersionedDomainIdentifier Persist(IDbConnection conn, IDbTransaction tx, System.ComponentModel.IComponent data, bool isUpdate)
        {
            ISystemConfigurationService configServce = ApplicationContext.ConfigurationService; //ApplicationContext.Current.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;
            // First, we must determine if we're going to be performing an update or a put
            RegistrationEvent hsr = data as RegistrationEvent;

            try
            {
                // Does this record have an identifier that is valid?
                if (hsr.AlternateIdentifier != null && !hsr.AlternateIdentifier.Domain.Equals(configServce.OidRegistrar.GetOid(ClientRegistryOids.REGISTRATION_EVENT).Oid))
                {
                    throw new InvalidOperationException(String.Format("Could not find an identifier for the event that falls in the custodian domain '{0}'", configServce.OidRegistrar.GetOid(ClientRegistryOids.REGISTRATION_EVENT).Oid));
                }
                else if (hsr.AlternateIdentifier != null)
                {
                    hsr.Id = Decimal.Parse(hsr.AlternateIdentifier.Identifier);
                }
                else if (isUpdate && hsr.Site == null)
                {
                    throw new ArgumentException("Cannot update an event that is not identified");
                }

                // Is there a parent that we can grab a language code from
                var parent = DbUtil.GetRegistrationEvent(data);

                // Default language code
                hsr.LanguageCode = hsr.LanguageCode ?? (parent != null ? parent.LanguageCode : configServce.JurisdictionData.DefaultLanguageCode);

                // Create an HSR event if this is not one
                if (!isUpdate || hsr.AlternateIdentifier == null)
                {
                    hsr.AlternateIdentifier = CreateHSRRecord(conn, tx, hsr);
                    hsr.Id = Convert.ToDecimal(hsr.AlternateIdentifier.Identifier);
                    hsr.VersionIdentifier = Convert.ToDecimal(hsr.AlternateIdentifier.Version);

                    // Is there any sort of linkage we need to create
                    if (hsr.Site != null && hsr.Site.Container != null &&
                        !(hsr.Site as HealthServiceRecordSite).IsSymbolic)
                    {
                        LinkHSRRecord(conn, tx, hsr);
                    }
                }
                else
                {
                    hsr.VersionIdentifier           = CreateHSRVersion(conn, tx, hsr);
                    hsr.AlternateIdentifier.Version = hsr.VersionIdentifier.ToString();
                }

                DbUtil.PersistComponents(conn, tx, isUpdate, this, hsr);
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());
                throw;
            }

            return(hsr.AlternateIdentifier);
        }
예제 #7
0
        public async Task <ActionResult <bool> > AcceptToRegistrationEvent(RegistrationEvent registrationEvent)
        {
            var currentCountPacitipants = await _context.Event.CountAsync(x => x.EventId == registrationEvent.EventId);

            var currentEvent = await _context.Event.SingleOrDefaultAsync(x => x.EventId == registrationEvent.EventId);


            return(currentCountPacitipants + 1 < currentEvent.MaxParticipants);
        }
예제 #8
0
 internal override void ProcessReply(CallbackMessage message, bool moreComing)
 {
     if (message is RegisterCallbackMessage rcm)
     {
         var error      = rcm.Payload.Error;
         var descriptor = new ServiceDescriptor(rcm.Payload.InstanceName, rcm.Payload.ServiceType, rcm.Payload.Domain, rcm.Payload.InterfaceIndex);
         var type       = error == ServiceError.NoError ?
                          rcm.Payload.Flags.HasFlag(ServiceFlags.Add) ? RegistrationEventType.Added : RegistrationEventType.Removed :
                          RegistrationEventType.Error;
         RegistrationEvent?.Invoke(Token, new RegistrationEventArgs(type, descriptor, error, moreComing));
     }
 }
        public async Task <IOperationToken> RegisterAsync(string instanceName, string serviceType, string domain, string host, ushort port, byte[] txtRecord, uint interfaceIndex = 0, object context = null)
        {
            await CheckConnectionAsync();

            var op = new RegisterOperation(instanceName, serviceType, domain, host, port, txtRecord, interfaceIndex, context);

            op.RegistrationEvent += (s, e) => RegistrationEvent?.Invoke(s, e);

            await _connection.AddAndExecuteSubordinate(op);

            return(op.Token);
        }
예제 #10
0
        /// <summary>
        /// Link this HSR record to another
        /// </summary>
        private void LinkHSRRecord(IDbConnection conn, IDbTransaction tx, HealthServiceRecordComponentRef hsr)
        {
            // TODO: Check to ensure that we don't double replace or double succeed a record
            // An HSR can only be linked to another HSR, so ...
            // first we need to find the HSR container to link to
            IContainer hsrContainer = hsr.Site.Container;

            while (!(hsrContainer is RegistrationEvent) && hsrContainer != null)
            {
                hsrContainer = (hsrContainer as IComponent).Site.Container;
            }
            RegistrationEvent parentHsr = hsrContainer as RegistrationEvent;

            // Get the root container
            HealthServiceRecordContainer parentContainer = hsr.Site.Container as HealthServiceRecordContainer;

            while (parentContainer.Site != null)
            {
                parentContainer = parentContainer.Site.Container as HealthServiceRecordContainer;
            }

            // Now we want to link
            if (parentHsr == null)
            {
                throw new InvalidOperationException("Can only link a Health Service Record event to a Registration Event");
            }
            else if (parentContainer.Id.Equals(hsr.Id))
            {
                throw new InvalidOperationException("Can't link a record to itself");
            }

            // Insert link
            IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, tx);

            try
            {
                cmd.CommandText = "add_hsr_lnk";
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "cmp_hsr_id_in", DbType.Decimal, hsr.Id));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "cbc_hsr_id_in", DbType.Decimal, parentHsr.Id));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "lnk_cls_in", DbType.Decimal, (decimal)(hsr.Site as HealthServiceRecordSite).SiteRoleType));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "conduction_in", DbType.Boolean, (hsr.Site as HealthServiceRecordSite).ContextConduction));
                cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw new ConstraintException(String.Format("Cannot locate referenced record for '{0}' relationship", (hsr.Site as HealthServiceRecordSite).SiteRoleType));
            }
            finally
            {
                cmd.Dispose();
            }
        }
        public async Task AppendEvacueeRegistrationAuditEntryAsync(RegistrationEvent notification, string userId, string userName, string userType)
        {
            await db.EvacueeRegistrationAudits.AddAsync(new Models.Db.EvacueeRegistrationAudit
            {
                User          = userId,
                UserName      = userName,
                UserType      = userType,
                Action        = notification.GetType().Name,
                EssFileNumber = long.Parse(notification.EssFileNumber),
                Content       = JsonConvert.SerializeObject(notification)
            });

            await db.SaveChangesAsync();
        }
        /// <summary>
        /// Find conflicts using identifiers
        /// </summary>
        public IEnumerable <SVC.Core.DataTypes.VersionedDomainIdentifier> FindIdConflicts(RegistrationEvent registration)
        {
            var registrationService = this.Context.GetService(typeof(IDataRegistrationService)) as IDataRegistrationService;

            VersionedDomainIdentifier[] pid = null;

            // Check if the person exists just via the identifier?
            // This is important because it is not necessarily a merge but an "update if exists"
            var             subject = registration.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;
            QueryParameters qp      = new QueryParameters()
            {
                Confidence        = 1.0f,
                MatchingAlgorithm = MatchAlgorithm.Exact,
                MatchStrength     = MatchStrength.Exact
            };

            var config = this.Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;

            List <VersionedDomainIdentifier> conflictIds = new List <VersionedDomainIdentifier>();

            foreach (var id in subject.AlternateIdentifiers)
            {
                var data = config.OidRegistrar.FindData(id.Domain);
                if (data == null || !data.Attributes.Exists(a => a.Key == "IsUniqueIdentifier" && Convert.ToBoolean(a.Value)))
                {
                    continue;
                }
                var patientQuery      = new QueryEvent();
                var registrationEvent = new RegistrationEvent();
                patientQuery.Add(registrationEvent, "SUBJ", HealthServiceRecordSiteRoleType.SubjectOf, null);
                patientQuery.Add(qp, "FLT", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.FilterOf, null);
                registrationEvent.Add(new Person()
                {
                    AlternateIdentifiers = new List <DomainIdentifier>()
                    {
                        id
                    }
                }, "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);
                // Perform the query
                pid = registrationService.QueryRecord(patientQuery);
                foreach (var result in pid)
                {
                    if (!conflictIds.Exists(o => o.Identifier.ToString() == result.Identifier))
                    {
                        conflictIds.Add(result);
                    }
                }
            }
            return(conflictIds.ToArray());
        }
예제 #13
0
        public async Task <RegistrationEvent> RegisterAsync(RegistrationEvent registrationEvent)
        {
            var serializedRegistartionEvent = JsonConvert.SerializeObject(registrationEvent);

            var requestMessage = new HttpRequestMessage(HttpMethod.Post, $"{_config.Value.Domain}/api/RegistrationEvents/");

            requestMessage.Content = new StringContent(serializedRegistartionEvent);
            requestMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

            var response = await _httpClient.SendAsync(requestMessage);

            var responseBody = await response.Content.ReadAsStringAsync();

            var returnedRegister = JsonConvert.DeserializeObject <RegistrationEvent>(responseBody);

            return(await Task.FromResult(returnedRegister));
        }
예제 #14
0
        public async Task <ActionResult <RegistrationEvent> > PostRegistrationEvent(RegistrationEvent registrationEvent)
        {
            var currentCountPacitipants = await _context.Event.CountAsync(x => x.EventId == registrationEvent.EventId);

            var currentEvent = await _context.Event.SingleOrDefaultAsync(x => x.EventId == registrationEvent.EventId);

            if (currentCountPacitipants + 1 < currentEvent.MaxParticipants)
            {
                _context.RegistrationEvent.Add(registrationEvent);
                await _context.SaveChangesAsync();
            }
            else
            {
                return(Problem(detail: "MaxParticipants", statusCode: 404));
            }

            return(CreatedAtAction("GetRegistrationEvent", new { id = registrationEvent.RegistrationEventId }, registrationEvent));
        }
예제 #15
0
        /// <summary>
        /// Link this HSR record to another
        /// </summary>
        internal void LinkHSRRecord(IDbConnection conn, IDbTransaction tx, HealthServiceRecordContainer hsr)
        {
            // An HSR can only be linked to another HSR, so ...
            // first we need to find the HSR container to link to
            IContainer hsrContainer = hsr.Site.Container;

            while (!(hsrContainer is RegistrationEvent) && hsrContainer != null)
            {
                hsrContainer = (hsrContainer as IComponent).Site.Container;
            }
            RegistrationEvent parentHsr = hsrContainer as RegistrationEvent;

            // Now we want to link
            if (parentHsr == null)
            {
                throw new InvalidOperationException("Can only link an Health Service Record event to another Health Service Record Event");
            }

            // Insert link
            IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, tx);

            try
            {
                cmd.CommandText = "add_hsr_lnk";
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "cmp_hsr_id_in", DbType.Decimal, hsr.Id));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "cbc_hsr_id_in", DbType.Decimal, parentHsr.Id));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "lnk_cls_in", DbType.Decimal, (decimal)(hsr.Site as HealthServiceRecordSite).SiteRoleType));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "conduction_in", DbType.Boolean, (hsr.Site as HealthServiceRecordSite).ContextConduction));

                try
                {
                    cmd.ExecuteNonQuery();
                }
                catch (DbException e)
                {
                    throw new InvalidOperationException(string.Format("Cannot insert link between {0} and {1}. {2}",
                                                                      hsr.Id, parentHsr.Id, e.Message));
                }
            }
            finally
            {
                cmd.Dispose();
            }
        }
        public async Task <bool> SaveInDatabase(RegistrationModel model)
        {
            Log.Information("Beginning to save in db");

            try
            {
                Registrations registration = new Registrations();
                registration.FirstName             = model.FirstName;
                registration.LastName              = model.LastName;
                registration.Dob                   = DateTime.Parse(model.DateOfBirth);
                registration.AddressLine1          = model.AddressLine1;
                registration.AddressLine2          = model.AddressLine2;
                registration.City                  = model.City;
                registration.Province              = Int32.Parse(model.SelectedProvince);
                registration.PostalCode            = model.PostalCode;
                registration.PhoneNumber           = model.Phone;
                registration.Email                 = model.Email;
                registration.IsFirstTime           = model.IsFirstTime;
                registration.SendConfirmationEmail = model.EmailResult;
                registration.DateRegistered        = DateTime.Now;
                _dbContext.Registrations.Add(registration);

                foreach (var selectedEvent in model.EventCheckBoxes.Where(x => x.IsChecked))
                {
                    RegistrationEvent regEvent = new RegistrationEvent();
                    regEvent.EventId     = Int32.Parse(selectedEvent.EventId);
                    regEvent.DateCreated = DateTime.Now;
                    registration.RegistrationEvent.Add(regEvent);
                }

                await _dbContext.SaveChangesAsync();

                Log.Information("Model saved in db successfully");
                return(true);
            }
            catch (Exception ex)
            {
                Log.Error($"An error occured saving patient data in the database for pt {model.FirstName} {model.LastName}. Phone: {model.Phone}. Email: {model.Email}. Error: {ex.Message} {ex.InnerException}. Data: {model}");
            }

            return(false);
        }
예제 #17
0
        /// <summary>
        /// Aync mark conflicts code
        /// </summary>
        private void MarkConflictsAsync(object state)
        {
            Trace.TraceInformation("Performing fuzzy conflict check asynchronously");
            try
            {
                VersionedDomainIdentifier vid      = state as VersionedDomainIdentifier;
                RegistrationEvent         hsrEvent = this.GetContainer(vid, true) as RegistrationEvent;
                var pid = this.m_clientRegistryMerge.FindFuzzyConflicts(hsrEvent);

                Trace.TraceInformation("Post-Update Record matched with {0} records", pid.Count());
                if (pid.Count() > 0)
                {
                    this.m_clientRegistryMerge.MarkConflicts(hsrEvent.AlternateIdentifier, pid);
                }
            }
            catch (Exception e)
            {
                Trace.TraceError(e.ToString());
            }
        }
예제 #18
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!parent.ValidationNotNull(this))
            {
                MessageBox.Show("All Data must be filled");
                return;
            }
            if (checkBox2.Checked == false && checkBox3.Checked == false && checkBox4.Checked == false)
            {
                MessageBox.Show("At least 1 event must be chosen");
                return;
            }
            var q = db.Runners.Where(x => x.Email.Equals(core.Email)).FirstOrDefault();

            Registration r = new Registration();

            r.RunnerId             = q.RunnerId;
            r.RegistrationDateTime = DateTime.Now;
            r.RaceKitOptionId      = radioButton1.Checked ? 'A' : radioButton2.Checked ? 'B' : 'C';
            r.RegistrationStatusId = 1;
            r.Cost              = total;
            r.CharityId         = int.Parse(comboBox1.SelectedValue.ToString());
            r.SponsorshipTarget = decimal.Parse(textBox1.Text);
            db.Registrations.InsertOnSubmit(r);
            db.SubmitChanges();

            for (int i = 0; i < EventSelected.Count; i++)
            {
                RegistrationEvent re = new RegistrationEvent();
                re.RegistrationId = r.RegistrationId;
                re.EventId        = EventSelected[i];
                re.BibNumber      = 0;
                re.RaceTime       = 0;
                db.RegistrationEvents.InsertOnSubmit(re);
                db.SubmitChanges();
            }
            parent.LoadForm("REGISTRATIONCONFIRMATION");
        }
예제 #19
0
        /// <summary>
        /// Update QRI
        /// </summary>
        private void UpdateQRI(RegistrationEvent res, NHapi.Model.V25.Segment.QRI qri)
        {
            var subject    = res.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;
            var confidence = subject.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.CommentOn | SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.ComponentOf) as QueryParameters;

            if (confidence != null)
            {
                if (confidence.MatchingAlgorithm == MatchAlgorithm.Soundex)
                {
                    qri.AlgorithmDescriptor.Identifier.Value = "Soundex";
                }
                else if (confidence.MatchingAlgorithm == MatchAlgorithm.Variant)
                {
                    qri.AlgorithmDescriptor.Identifier.Value = "Variant";
                }

                if (confidence.MatchingAlgorithm == MatchAlgorithm.Unspecified) // identifier match
                {
                    qri.GetMatchReasonCode(qri.MatchReasonCodeRepetitionsUsed).Value = "ID";
                }
                else if (confidence.MatchingAlgorithm == MatchAlgorithm.Soundex) // soundex
                {
                    qri.GetMatchReasonCode(qri.MatchReasonCodeRepetitionsUsed).Value = "NP";
                }
                else if (confidence.MatchingAlgorithm == MatchAlgorithm.Exact) // match
                {
                    qri.GetMatchReasonCode(qri.MatchReasonCodeRepetitionsUsed).Value = "NA";
                }
                else if (confidence.MatchingAlgorithm == MatchAlgorithm.Variant) // variant
                {
                    qri.GetMatchReasonCode(qri.MatchReasonCodeRepetitionsUsed).Value = "VAR";
                }

                // Confidence
                qri.CandidateConfidence.Value = confidence.Confidence.ToString("0.##");
            }
        }
예제 #20
0
        /// <summary>
        /// Create an HSR version
        /// </summary>
        private decimal CreateHSRVersion(IDbConnection conn, IDbTransaction tx, RegistrationEvent hsr)
        {
            IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, tx);

            try
            {
                cmd.CommandText = "crt_hsr_vrsn";
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "hsr_id_in", DbType.Decimal, hsr.Id));

                decimal?codeId = null;
                if (hsr.EventType != null)
                {
                    codeId = DbUtil.CreateCodedValue(conn, tx, hsr.EventType);
                }
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "evt_typ_cd_id_in", DbType.Decimal, codeId.HasValue ? (object)codeId.Value : DBNull.Value));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "refuted_ind_in", DbType.Boolean, hsr.Refuted));

                // Effective time if needed
                decimal?hsrEfftTsId = null;
                if (hsr.EffectiveTime != null)
                {
                    hsrEfftTsId = DbUtil.CreateTimeset(conn, tx, hsr.EffectiveTime);
                }

                // Parameters
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "efft_ts_set_id_in", DbType.Decimal, (object)hsrEfftTsId ?? DBNull.Value));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "status_cs_in", DbType.Decimal, hsr.Status == StatusType.Unknown ? (object)DBNull.Value : (int)hsr.Status));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "aut_utc_in", DbType.DateTime, hsr.Timestamp == default(DateTime) ? (object)DBNull.Value : hsr.Timestamp));
                cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "lang_cs_in", DbType.StringFixedLength, (object)hsr.LanguageCode ?? DBNull.Value));

                return(Convert.ToDecimal(cmd.ExecuteScalar()));
            }
            finally
            {
                cmd.Dispose();
            }
        }
예제 #21
0
        public override int OnRegistrationEvent(RegistrationEvent e)
        {
            short code = e.getCode();
            tsip_register_event_type_t type    = e.getType();
            RegistrationSession        session = e.getSession();
            SipMessage message = e.getSipMessage();

            if (message != null)
            {
                Console.WriteLine("call-id={0}", message.getSipHeaderValue("call-id"));
                //byte[] bytes = message.getContent();
            }

            switch (type)
            {
            case tsip_register_event_type_t.tsip_ao_register:
            case tsip_register_event_type_t.tsip_ao_unregister:
                break;
            }

            Console.WriteLine("OnRegistrationChanged() ==> {0}:{1}", code, e.getPhrase());

            return(0);
        }
예제 #22
0
        /// <summary>
        /// Notify the operation
        /// </summary>
        public void Notify(NotificationQueueWorkItem workItem)
        {
            // configuration service
            ISystemConfigurationService config = this.Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;
            ILocalizationService        locale = this.Context.GetService(typeof(ILocalizationService)) as ILocalizationService;

            // Common message bits we need to update
            IMessage notificationMessage = null;
            MSH      msh = null;
            PID      pid = null;
            EVN      evn = null;
            PV1      pv1 = null;
            MRG      mrg = null;

            // Identify the work item action
            switch (workItem.Action)
            {
            case MARC.HI.EHRS.CR.Notification.PixPdq.Configuration.ActionType.Create:
            {
                ADT_A01 message = new ADT_A01();
                msh = message.MSH;
                pid = message.PID;
                evn = message.EVN;
                pv1 = message.PV1;
                notificationMessage = message;
                msh.MessageType.TriggerEvent.Value = "A04";

                break;
            }

            case MARC.HI.EHRS.CR.Notification.PixPdq.Configuration.ActionType.DuplicatesResolved:
            {
                ADT_A39 message = new ADT_A39();
                msh = message.MSH;
                msh.MessageType.TriggerEvent.Value = "A40";
                pid = message.GetPATIENT(0).PID;
                evn = message.EVN;
                pv1 = message.GetPATIENT(0).PV1;
                mrg = message.GetPATIENT(0).MRG;
                notificationMessage = message;
                break;
            };

            case MARC.HI.EHRS.CR.Notification.PixPdq.Configuration.ActionType.Update:
            {
                ADT_A01 message = new ADT_A01();
                msh = message.MSH;
                pid = message.PID;
                evn = message.EVN;
                pv1 = message.PV1;
                notificationMessage = message;
                msh.MessageType.TriggerEvent.Value = "A08";
                break;
            }
            }

            // Populate the MSH header first
            this.UpdateMSH(msh, config);

            // Populate the EVN segment
            evn.EventTypeCode.Value = workItem.Event.Mode.ToString();
            evn.RecordedDateTime.TimeOfAnEvent.Value = (TS)workItem.Event.Timestamp;

            // Populate the PID segment
            Person subject = workItem.Event.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;

            this.UpdatePID(subject, pid, config);
            pv1.PatientClass.Value = "I";

            // Populate MRG
            if (mrg != null)
            {
                var registration = this.Context.GetService(typeof(IDataRegistrationService)) as IDataRegistrationService;
                var persistence  = this.Context.GetService(typeof(IDataPersistenceService)) as IDataPersistenceService;
                var replacements = subject.FindAllComponents(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.ReplacementOf);

                foreach (PersonRegistrationRef rplc in replacements)
                {
                    // First, need to de-persist the identifiers
                    QueryParameters qp = new QueryParameters()
                    {
                        Confidence        = 1.0f,
                        MatchingAlgorithm = MatchAlgorithm.Exact,
                        MatchStrength     = MatchStrength.Exact
                    };
                    var queryEvent   = new QueryEvent();
                    var patientQuery = new RegistrationEvent();
                    queryEvent.Add(qp, "FLT", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.FilterOf, null);
                    patientQuery.Add(new Person()
                    {
                        AlternateIdentifiers = rplc.AlternateIdentifiers
                    }, "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);
                    queryEvent.Add(patientQuery, "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);
                    // Perform the query
                    var patientIdentifiers = registration.QueryRecord(queryEvent);
                    if (patientIdentifiers.Length == 0)
                    {
                        throw new InvalidOperationException();
                    }
                    var replacedPerson = (persistence.GetContainer(patientIdentifiers[0], true) as RegistrationEvent).FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;

                    foreach (var ii in replacedPerson.AlternateIdentifiers.FindAll(o => this.Target.NotificationDomain.Exists(d => d.Domain == o.Domain)))
                    {
                        var cx = mrg.GetPriorPatientIdentifierList(mrg.PriorAlternatePatientIDRepetitionsUsed);
                        cx.ID.Value = ii.Identifier;
                        if (String.IsNullOrEmpty(ii.AssigningAuthority))
                        {
                            cx.AssigningAuthority.NamespaceID.Value = config.OidRegistrar.FindData(ii.Domain).Attributes.Find(o => o.Key == "AssigningAuthorityName").Value;
                        }
                        else
                        {
                            cx.AssigningAuthority.NamespaceID.Value = ii.AssigningAuthority;
                        }
                        cx.AssigningAuthority.UniversalID.Value     = ii.Domain;
                        cx.AssigningAuthority.UniversalIDType.Value = "ISO";
                    }
                }
            }

            // Send
            var queueItem = new Hl7MessageQueue.MessageQueueWorkItem(this.Target, notificationMessage);

            if (!queueItem.TrySend())
            {
                Trace.TraceWarning(locale.GetString("NTFW005"));
                Hl7MessageQueue.Current.EnqueueMessageItem(queueItem);
            }
        }
 protected virtual void OnRegActionTaken(RegistrationEvent e)
 {
     RegistrationActionTaken?.Invoke(this, e);
 }
예제 #24
0
        /// <summary>
        /// Create audit data
        /// </summary>
        internal AuditData CreateAuditData(string itiName, ActionType action, OutcomeIndicator outcome, Hl7MessageReceivedEventArgs msgEvent, List <VersionedDomainIdentifier> identifiers)
        {
            // Audit data
            AuditData retVal = null;

            AuditableObjectLifecycle lifecycle = AuditableObjectLifecycle.Access;

            // Get the config service
            ISystemConfigurationService config = Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;

            Terser terser = new Terser(msgEvent.Message);

            // Source and dest
            string sourceData = String.Format("{0}|{1}", terser.Get("/MSH-3"), terser.Get("/MSH-4")),
                   destData   = String.Format("{0}|{1}", terser.Get("/MSH-5"), terser.Get("/MSH-6"));


            switch (itiName)
            {
            case "ITI-21":
            {
                retVal = new AuditData(DateTime.Now, action, outcome, EventIdentifierType.Query, new CodeValue(itiName, "IHE Transactions")
                    {
                        DisplayName = "Patient Demographics Query"
                    });

                // Audit actor for Patient Identity Source
                retVal.Actors.Add(new AuditActorData()
                    {
                        UserIsRequestor = true,
                        UserIdentifier  = sourceData,
                        ActorRoleCode   = new List <CodeValue>()
                        {
                            new  CodeValue("110153", "DCM")
                            {
                                DisplayName = "Source"
                            }
                        },
                        NetworkAccessPointId   = msgEvent.SolicitorEndpoint.Host,
                        NetworkAccessPointType = msgEvent.SolicitorEndpoint.HostNameType == UriHostNameType.Dns ? NetworkAccessPointType.MachineName : NetworkAccessPointType.IPAddress
                    });


                // Add query parameters
                retVal.AuditableObjects.Add(
                    new AuditableObject()
                    {
                        IDTypeCode       = AuditableObjectIdType.Custom,
                        CustomIdTypeCode = new CodeValue(itiName, "IHE Transactions")
                        {
                            DisplayName = "Patient Demographics Query"
                        },
                        QueryData  = Convert.ToBase64String(CreateMessageSerialized(msgEvent.Message)),
                        Type       = AuditableObjectType.SystemObject,
                        Role       = AuditableObjectRole.Query,
                        ObjectId   = terser.Get("/QPD-2"),
                        ObjectData = new Dictionary <string, byte[]>()
                        {
                            { "MSH-10", System.Text.Encoding.ASCII.GetBytes(terser.Get("/MSH-10")) }
                        }
                    }
                    );

                // Audit actor for PDQ
                retVal.Actors.Add(new AuditActorData()
                    {
                        UserIdentifier  = destData,
                        UserIsRequestor = false,
                        ActorRoleCode   = new List <CodeValue>()
                        {
                            new CodeValue("110152", "DCM")
                            {
                                DisplayName = "Destination"
                            }
                        },
                        NetworkAccessPointType = NetworkAccessPointType.MachineName,
                        NetworkAccessPointId   = Dns.GetHostName(),
                        AlternativeUserId      = Process.GetCurrentProcess().Id.ToString()
                    });
                break;
            }

            case "ITI-8":
            {
                retVal = new AuditData(DateTime.Now, action, outcome, EventIdentifierType.PatientRecord, new CodeValue(itiName, "IHE Transactions")
                    {
                        DisplayName = "Patient Identity Feed"
                    });

                // Audit actor for Patient Identity Source
                retVal.Actors.Add(new AuditActorData()
                    {
                        UserIsRequestor = true,
                        UserIdentifier  = sourceData,
                        ActorRoleCode   = new List <CodeValue>()
                        {
                            new  CodeValue("110153", "DCM")
                            {
                                DisplayName = "Source"
                            }
                        },
                        NetworkAccessPointId   = msgEvent.SolicitorEndpoint.Host,
                        NetworkAccessPointType = msgEvent.SolicitorEndpoint.HostNameType == UriHostNameType.Dns ? NetworkAccessPointType.MachineName : NetworkAccessPointType.IPAddress
                    });

                // Audit actor for PDQ
                retVal.Actors.Add(new AuditActorData()
                    {
                        UserIdentifier  = destData,
                        UserIsRequestor = false,
                        ActorRoleCode   = new List <CodeValue>()
                        {
                            new CodeValue("110152", "DCM")
                            {
                                DisplayName = "Destination"
                            }
                        },
                        NetworkAccessPointType = NetworkAccessPointType.MachineName,
                        NetworkAccessPointId   = Dns.GetHostName(),
                        AlternativeUserId      = Process.GetCurrentProcess().Id.ToString()
                    });
                break;
            }

            case "ITI-9":
            {
                retVal = new AuditData(DateTime.Now, action, outcome, EventIdentifierType.Query, new CodeValue(itiName, "IHE Transactions")
                    {
                        DisplayName = "PIX Query"
                    });

                // Audit actor for Patient Identity Source
                retVal.Actors.Add(new AuditActorData()
                    {
                        UserIsRequestor = true,
                        UserIdentifier  = sourceData,
                        ActorRoleCode   = new List <CodeValue>()
                        {
                            new  CodeValue("110153", "DCM")
                            {
                                DisplayName = "Source"
                            }
                        },
                        NetworkAccessPointId   = msgEvent.SolicitorEndpoint.Host,
                        NetworkAccessPointType = msgEvent.SolicitorEndpoint.HostNameType == UriHostNameType.Dns ? NetworkAccessPointType.MachineName : NetworkAccessPointType.IPAddress
                    });

                // Add query parameters
                retVal.AuditableObjects.Add(
                    new AuditableObject()
                    {
                        IDTypeCode       = AuditableObjectIdType.Custom,
                        CustomIdTypeCode = new CodeValue("ITI-9", "IHE Transactions")
                        {
                            DisplayName = "PIX Query"
                        },
                        QueryData  = Convert.ToBase64String(CreateMessageSerialized(msgEvent.Message)),
                        Type       = AuditableObjectType.SystemObject,
                        Role       = AuditableObjectRole.Query,
                        ObjectId   = terser.Get("/QPD-2"),
                        ObjectData = new Dictionary <string, byte[]>()
                        {
                            { "MSH-10", System.Text.Encoding.ASCII.GetBytes(terser.Get("/MSH-10")) }
                        }
                    }
                    );

                // Audit actor for PDQ
                retVal.Actors.Add(new AuditActorData()
                    {
                        UserIdentifier  = destData,
                        UserIsRequestor = false,
                        ActorRoleCode   = new List <CodeValue>()
                        {
                            new CodeValue("110152", "DCM")
                            {
                                DisplayName = "Destination"
                            }
                        },
                        NetworkAccessPointType = NetworkAccessPointType.MachineName,
                        NetworkAccessPointId   = Dns.GetHostName(),
                        AlternativeUserId      = Process.GetCurrentProcess().Id.ToString()
                    });
                break;
            }
            }

            var expDatOid = config.OidRegistrar.GetOid("CR_CID");

            // HACK: Use only patient identifiers in the output
            foreach (var id in identifiers.Where(o => o.Domain != expDatOid.Oid).ToArray())
            {
                RegistrationEvent evt = this.m_dataPersistence.GetContainer(id, true) as RegistrationEvent;
                if (evt != null)
                {
                    identifiers.Remove(id);
                    foreach (Person subj in evt.FindAllComponents(HealthServiceRecordSiteRoleType.SubjectOf))
                    {
                        identifiers.Add(new VersionedDomainIdentifier()
                        {
                            Identifier = subj.Id.ToString(),
                            Domain     = expDatOid.Oid
                        });
                    }
                }
            }

            // Audit patients
            foreach (var id in identifiers)
            {
                // If the id is not a patient then
                // Construct the audit object
                AuditableObject aud = new AuditableObject()
                {
                    IDTypeCode = AuditableObjectIdType.PatientNumber,
                    Role       = AuditableObjectRole.Patient,
                    Type       = AuditableObjectType.Person
                };

                // Lifecycle
                switch (action)
                {
                case ActionType.Create:
                    aud.LifecycleType = AuditableObjectLifecycle.Creation;
                    break;

                case ActionType.Delete:
                    aud.LifecycleType = AuditableObjectLifecycle.LogicalDeletion;
                    break;

                case ActionType.Execute:
                    aud.LifecycleType = AuditableObjectLifecycle.Access;
                    break;

                case ActionType.Read:
                    aud.LifecycleType = AuditableObjectLifecycle.Disclosure;
                    break;

                case ActionType.Update:
                    aud.LifecycleType = AuditableObjectLifecycle.Amendment;
                    break;
                }

                aud.ObjectData.Add("MSH-10", System.Text.Encoding.ASCII.GetBytes(terser.Get("/MSH-10")));
                aud.ObjectId = String.Format("{1}^^^{2}&{0}&ISO", expDatOid.Oid, id.Identifier, expDatOid.Attributes.Find(o => o.Key == "AssigningAuthorityName").Value);
                retVal.AuditableObjects.Add(aud);
            }


            return(retVal);
        }
        /// <summary>
        /// Merge two items together
        /// </summary>
        public void Resolve(IEnumerable <SVC.Core.DataTypes.VersionedDomainIdentifier> victimIds, SVC.Core.DataTypes.VersionedDomainIdentifier survivorId, SVC.Core.Services.DataPersistenceMode mode)
        {
            // First, we load the survivor
            if (survivorId.Domain != ApplicationContext.ConfigurationService.OidRegistrar.GetOid(ClientRegistryOids.REGISTRATION_EVENT).Oid)
            {
                throw new ArgumentException(String.Format("Must be drawn from the '{0}' domain", ApplicationContext.ConfigurationService.OidRegistrar.GetOid(ClientRegistryOids.REGISTRATION_EVENT).Oid), "survivorId");
            }

            // Load the survivor
            var persistenceService        = this.Context.GetService(typeof(IDataPersistenceService)) as IDataPersistenceService;
            var survivorRegistrationEvent = persistenceService.GetContainer(survivorId, true) as RegistrationEvent;

            if (survivorRegistrationEvent == null)
            {
                throw new InvalidOperationException("Could not load target registration event");
            }
            var survivorPerson = survivorRegistrationEvent.FindComponent(HealthServiceRecordSiteRoleType.SubjectOf) as Person;

            if (survivorPerson == null)
            {
                throw new InvalidOperationException("Target registration event has no SubjectOf relationship of type Person");
            }

            // Create the merge registration event
            RegistrationEvent mergeRegistrationEvent = new RegistrationEvent()
            {
                Mode            = RegistrationEventType.Replace,
                EventClassifier = RegistrationEventType.Register,
                LanguageCode    = survivorRegistrationEvent.LanguageCode
            };

            mergeRegistrationEvent.EventType = new CodeValue("ADMIN_MRG");
            mergeRegistrationEvent.Add(new ChangeSummary()
            {
                ChangeType    = new CodeValue("ADMIN_MRG"),
                EffectiveTime = new TimestampSet()
                {
                    Parts = new List <TimestampPart>()
                    {
                        new TimestampPart(TimestampPart.TimestampPartType.Standlone, DateTime.Now, "F")
                    }
                },
                Timestamp    = DateTime.Now,
                LanguageCode = survivorRegistrationEvent.LanguageCode
            }, "CHG", HealthServiceRecordSiteRoleType.ReasonFor | HealthServiceRecordSiteRoleType.OlderVersionOf, null);
            survivorPerson.Site = null;

            mergeRegistrationEvent.Add(survivorPerson, "SUBJ", HealthServiceRecordSiteRoleType.SubjectOf, null);

            // Next, we do a replaces relationship for each of the victims (loading them as well since the ID is of the patient not reg event)
            foreach (var id in victimIds)
            {
                var replacementReg = persistenceService.GetContainer(id, true) as RegistrationEvent;
                if (replacementReg == null)
                {
                    throw new InvalidOperationException("Could not load victim registration event");
                }
                var replacementPerson = replacementReg.FindComponent(HealthServiceRecordSiteRoleType.SubjectOf) as Person;
                if (replacementPerson == null)
                {
                    throw new InvalidOperationException("Victim registration event has no SubjectOf relationship of type Person");
                }

                // Now, create replaces
                survivorPerson.Add(new PersonRegistrationRef()
                {
                    AlternateIdentifiers = new List <DomainIdentifier>()
                    {
                        new DomainIdentifier()
                        {
                            Domain     = ApplicationContext.ConfigurationService.OidRegistrar.GetOid(ClientRegistryOids.CLIENT_CRID).Oid,
                            Identifier = replacementPerson.Id.ToString()
                        }
                    }
                }, Guid.NewGuid().ToString(), HealthServiceRecordSiteRoleType.ReplacementOf, null);
            }

            // Now persist the replacement
            IDbConnection  conn = DatabasePersistenceService.ConnectionManager.GetConnection();
            IDbTransaction tx   = null;

            try
            {
                // Update container
                var vid = persistenceService.UpdateContainer(mergeRegistrationEvent, DataPersistenceMode.Production);

                tx = conn.BeginTransaction();

                foreach (var id in victimIds)
                {
                    using (IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, tx))
                    {
                        cmd.CommandText = "mrg_cand";
                        cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "from_id_in", DbType.Decimal, Decimal.Parse(id.Identifier)));
                        cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "to_id_in", DbType.Decimal, Decimal.Parse(survivorId.Identifier)));
                        cmd.ExecuteNonQuery();
                    }
                    // Obsolete the victim identifier merges
                    using (IDbCommand cmd = DbUtil.CreateCommandStoredProc(conn, tx))
                    {
                        cmd.CommandText = "obslt_mrg";
                        cmd.Parameters.Add(DbUtil.CreateParameterIn(cmd, "from_id_in", DbType.Decimal, Decimal.Parse(id.Identifier)));
                        cmd.ExecuteNonQuery();
                    }
                }
                tx.Commit();
            }
            catch (Exception e)
            {
                if (tx != null)
                {
                    tx.Rollback();
                }
                throw;
            }
            finally
            {
                DatabasePersistenceService.ConnectionManager.ReleaseConnection(conn);
            }
        }
        /// <summary>
        /// Find conflicts using fuzzy match
        /// </summary>
        public IEnumerable <VersionedDomainIdentifier> FindFuzzyConflicts(RegistrationEvent registration)
        {
            var registrationService = this.Context.GetService(typeof(IDataRegistrationService)) as IDataRegistrationService;
            var persistenceService  = this.Context.GetService(typeof(IDataPersistenceService)) as IDataPersistenceService;

            var clientRegistryConfigService = this.Context.GetService(typeof(IClientRegistryConfigurationService)) as IClientRegistryConfigurationService;

            VersionedDomainIdentifier[] pid = null;

            var             subject = registration.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;
            QueryParameters qp      = new QueryParameters()
            {
                Confidence        = 1.0f,
                MatchingAlgorithm = MatchAlgorithm.Exact,
                MatchStrength     = MatchStrength.Exact
            };

            if (subject.Status != StatusType.Active)
            {
                return(pid);
            }

            var patientQuery      = new QueryEvent();
            var registrationEvent = new RegistrationEvent();

            patientQuery.Add(registrationEvent, "SUBJ", HealthServiceRecordSiteRoleType.SubjectOf, null);
            patientQuery.Add(qp, "FLT", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.FilterOf, null);
            // Create merge filter for fuzzy match
            var ssubject = clientRegistryConfigService.CreateMergeFilter(subject);

            if (ssubject != null) // Minimum criteria was met
            {
                registrationEvent.Add(ssubject, "SUBJ", HealthServiceRecordSiteRoleType.SubjectOf, null);
                pid = registrationService.QueryRecord(patientQuery);
            }
            else
            {
                pid = new VersionedDomainIdentifier[0];
            }


            // Now, look for all with an assigning authority
            if (pid.Length > 0)
            {
                pid = pid.Where(o => !(o.Identifier == registration.Id.ToString() && o.Domain == ApplicationContext.ConfigurationService.OidRegistrar.GetOid(ClientRegistryOids.REGISTRATION_EVENT).Oid)).ToArray();
                // Load each match quickly and ensure that they don't already have a
                // different identifier from an assigning authority (not CR_CID) provided
                // in the registration method. For example, if John Smith, Male, 1984-05-22, 123 Main Street West is
                // registered from system X with ID 102 , and a subsequent registration message for John Smith, Male, 1984-05-22, 123 Main Street West
                // is received from system X with ID 104, it is pretty much assured they aren't the same person. If however the
                // latter message came from system Y with ID 104, then the two should be considered a match.
                ssubject.AlternateIdentifiers = new List <DomainIdentifier>();
                List <VersionedDomainIdentifier> exclude = new List <VersionedDomainIdentifier>();
                foreach (var altId in subject.AlternateIdentifiers)
                {
                    if (altId.Domain != ApplicationContext.ConfigurationService.OidRegistrar.GetOid(ClientRegistryOids.CLIENT_CRID).Oid)
                    {
                        var oidData = ApplicationContext.ConfigurationService.OidRegistrar.FindData(altId.Domain);
                        if (oidData == null ||
                            oidData.Attributes.Find(o => o.Key == "IsUniqueIdentifier").Value == null ||
                            Boolean.Parse(oidData.Attributes.Find(o => o.Key == "IsUniqueIdentifier").Value))
                        {
                            ssubject.AlternateIdentifiers.Add(new DomainIdentifier()
                            {
                                Domain = altId.Domain
                            });
                        }
                    }
                }


                foreach (var p in pid)
                {
                    var re  = persistenceService.GetContainer(p, true) as RegistrationEvent;
                    var pat = re.FindComponent(HealthServiceRecordSiteRoleType.SubjectOf) as Person;
                    if (pat.Id == subject.Id || pat.Status != StatusType.Active)  // same person
                    {
                        exclude.Add(re.AlternateIdentifier);
                    }
                    else if (pat.AlternateIdentifiers.Exists(o => ssubject.AlternateIdentifiers.Exists(r => r.Domain == o.Domain)))
                    {
                        exclude.Add(re.AlternateIdentifier);
                    }
                }

                pid = pid.Where(o => !exclude.Exists(i => i.Domain == o.Domain && i.Identifier == o.Identifier)).ToArray();
            }
            return(pid);
        }
예제 #27
0
        /// <summary>
        /// Handle duplicates resolved message
        /// </summary>
        private IGraphable HandlePatientRegistryDuplicatesResolved(MARC.Everest.Connectors.UnsolicitedDataEventArgs e, MARC.Everest.Connectors.IReceiveResult receivedMessage)
        {
            // Setup the lists of details and issues
            List <IResultDetail> dtls = new List <IResultDetail>(receivedMessage.Details);

            // System configuration service
            ISystemConfigurationService configService = Context.GetService(typeof(ISystemConfigurationService)) as ISystemConfigurationService;

            // Localization service
            ILocalizationService locale = Context.GetService(typeof(ILocalizationService)) as ILocalizationService;

            // Data Service
            IClientRegistryDataService dataSvc = Context.GetService(typeof(IClientRegistryDataService)) as IClientRegistryDataService;

            // Do basic check and add common validation errors
            MessageUtil.ValidateTransportWrapperUv(receivedMessage.Structure as IInteraction, configService, dtls);

            // Check the request is valid
            var request = receivedMessage.Structure as PRPA_IN201304UV02;

            if (request == null)
            {
                return(null);
            }

            // Determine if the received message was interpreted properly
            bool isValid = MessageUtil.IsValid(receivedMessage);

            // set the URI
            if (request.controlActProcess != null)
            {
                request.controlActProcess.Code = request.controlActProcess.Code ?? Util.Convert <CD <String> >(PRPA_IN201302UV02.GetTriggerEvent());
            }
            if (request.Receiver.Count > 0)
            {
                request.Receiver[0].Telecom = request.Receiver[0].Telecom ?? e.ReceiveEndpoint.ToString();
            }

            // Construct the acknowledgment
            var response = new MCCI_IN000002UV01(
                new II(configService.OidRegistrar.GetOid("CR_MSGID").Oid, Guid.NewGuid().ToString()),
                DateTime.Now,
                MCCI_IN000002UV01.GetInteractionId(),
                request.ProcessingCode,
                request.ProcessingModeCode,
                MessageUtil.CreateReceiver(request.Sender),
                MessageUtil.CreateSenderUv(e.ReceiveEndpoint, configService)
                );


            // Create the support classes
            List <AuditData> audits = new List <AuditData>();

            IheAuditUtil dataUtil = new IheAuditUtil()
            {
                Context = this.Context
            };

            // Try to execute the record
            try
            {
                // Determine if the message is valid
                if (!isValid)
                {
                    throw new MessageValidationException(locale.GetString("MSGE00A"), receivedMessage.Structure);
                }

                // Construct the canonical data structure
                UvComponentUtil cu = new UvComponentUtil()
                {
                    Context = this.Context
                };
                RegistrationEvent data = cu.CreateComponents(request.controlActProcess, dtls);

                // Componentization fail?
                if (data == null || !dataUtil.ValidateIdentifiers(data, dtls))
                {
                    throw new MessageValidationException(locale.GetString("MSGE00A"), receivedMessage.Structure);
                }

                // Store
                var result = dataSvc.Merge(data, request.ProcessingCode != ProcessingID.Production ? DataPersistenceMode.Debugging : DataPersistenceMode.Production);

                if (result == null || result.VersionId == null)
                {
                    throw new Exception(locale.GetString("DTPE001"));
                }

                dtls.AddRange(result.Details);

                // prepare the delete audit
                var person = data.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;
                var replc  = person.FindAllComponents(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.ReplacementOf);

                foreach (PersonRegistrationRef rplc in replc)
                {
                    audits.Add(dataUtil.CreateAuditData("ITI-44",
                                                        ActionType.Delete,
                                                        dtls.Exists(r => r.Type == ResultDetailType.Error) ? OutcomeIndicator.MinorFail : OutcomeIndicator.Success,
                                                        e,
                                                        receivedMessage,
                                                        new List <VersionedDomainIdentifier>()
                    {
                        new VersionedDomainIdentifier()
                        {
                            Domain     = rplc.AlternateIdentifiers[0].Domain,
                            Identifier = rplc.AlternateIdentifiers[0].Identifier
                        }
                    },
                                                        data.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.AuthorOf) as HealthcareParticipant));
                }


                // Prepare for audit
                audits.Add(dataUtil.CreateAuditData("ITI-44",
                                                    ActionType.Update,
                                                    dtls.Exists(r => r.Type == ResultDetailType.Error) ? OutcomeIndicator.MinorFail : OutcomeIndicator.Success,
                                                    e,
                                                    receivedMessage,
                                                    new List <VersionedDomainIdentifier>()
                {
                    result.VersionId
                },
                                                    data.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.AuthorOf) as HealthcareParticipant
                                                    ));

                // Add ack
                response.Acknowledgement.Add(new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Acknowledgement(
                                                 AcknowledgementType.AcceptAcknowledgementCommitAccept,
                                                 new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.TargetMessage(request.Id)
                                                 ));
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());

                // Prepare for audit
                audits.Add(dataUtil.CreateAuditData("ITI-44", ActionType.Create, OutcomeIndicator.EpicFail, e, receivedMessage,
                                                    new List <VersionedDomainIdentifier>(),
                                                    null
                                                    ));

                dtls.Add(new ResultDetail(ResultDetailType.Error, ex.Message, ex));
                response.Acknowledgement.Add(new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.Acknowledgement(
                                                 AcknowledgementType.AcceptAcknowledgementCommitError,
                                                 new MARC.Everest.RMIM.UV.NE2008.MCCI_MT100200UV01.TargetMessage(request.Id)
                                                 ));
            }
            finally
            {
                IAuditorService auditService = Context.GetService(typeof(IAuditorService)) as IAuditorService;
                if (auditService != null)
                {
                    foreach (var aud in audits)
                    {
                        auditService.SendAudit(aud);
                    }
                }
            }

            // Common response parameters
            response.ProfileId     = new SET <II>(MCCI_IN000002UV01.GetProfileId());
            response.VersionCode   = HL7StandardVersionCode.Version3_Prerelease1;
            response.AcceptAckCode = AcknowledgementCondition.Never;
            response.Acknowledgement[0].AcknowledgementDetail.AddRange(MessageUtil.CreateAckDetailsUv(dtls.ToArray()));
            return(response);
        }
예제 #28
0
        /// <summary>
        /// Convert registration event
        /// </summary>
        private static Models.PatientMatch ConvertRegistrationEvent(RegistrationEvent reg)
        {
            var psn = reg.Items1.Where(o => o.hsrSite.roleType == HealthServiceRecordSiteRoleType.SubjectOf).First() as Person;

            ClientRegistryAdmin.Models.PatientMatch pm = new Models.PatientMatch();
            NamePart familyNamePart = null,
                     givenNamePart  = null;

            pm.Status    = psn.status.ToString();
            pm.VersionId = psn.verId.ToString();
            // Name
            if (psn.name != null && psn.name[0].part != null)
            {
                familyNamePart = psn.name[0].part.FirstOrDefault(o => o.type == NamePartType.Family);
                givenNamePart  = psn.name[0].part.FirstOrDefault(o => o.type == NamePartType.Given);
                if (familyNamePart != null)
                {
                    pm.FamilyName = familyNamePart.value;
                }
                if (givenNamePart != null)
                {
                    pm.GivenName = givenNamePart.value;
                }
            }

            if (psn.birthTime != null)
            {
                pm.DateOfBirth = psn.birthTime.value;
            }
            pm.Gender = psn.genderCode;

            pm.Id                 = psn.id.ToString();
            pm.RegistrationId     = reg.id;
            pm.HealthServiceEvent = reg;
            pm.OriginalData       = psn;
            pm.OtherIds           = new List <KeyValuePair <string, string> >();
            foreach (var altid in psn.altId)
            {
                pm.OtherIds.Add(new KeyValuePair <string, string>(altid.domain, altid.uid));
            }

            // Address
            if (psn.addr != null)
            {
                AddressPart cityPart     = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.City),
                            countyPart   = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.County),
                            countryPart  = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.Country),
                            statePart    = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.State),
                            postalPart   = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.PostalCode),
                            censusPart   = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.CensusTract),
                            precinctPart = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.Precinct),
                            locatorPart  = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.AdditionalLocator),
                            streetPart   = psn.addr[0].part.FirstOrDefault(o => o.type == ClientRegistryAdminService.AddressPartType.AddressLine ||
                                                                           o.type == ClientRegistryAdminService.AddressPartType.StreetAddressLine);
                if (cityPart != null)
                {
                    pm.City = cityPart.value;
                }
                if (streetPart != null)
                {
                    pm.Address = streetPart.value;
                }
                if (countyPart != null)
                {
                    pm.County = countyPart.value;
                }
                if (countryPart != null)
                {
                    pm.Country = countryPart.value;
                }
                if (statePart != null)
                {
                    pm.State = statePart.value;
                }
                if (postalPart != null)
                {
                    pm.PostCode = postalPart.value;
                }
                if (censusPart != null)
                {
                    pm.CensusTract = censusPart.value;
                }
                if (precinctPart != null)
                {
                    pm.Precinct = precinctPart.value;
                }
                if (locatorPart != null)
                {
                    pm.Locator = locatorPart.value;
                }
            }

            // Relationships
            if (psn.Items != null)
            {
                var mother = psn.Items.Where(o => o.hsrSite.roleType == HealthServiceRecordSiteRoleType.RepresentitiveOf)
                             .Select(o => o as PersonalRelationship).FirstOrDefault(o => o.kind == "MTH");
                if (mother != null)
                {
                    pm.MothersId = mother.id.ToString();
                    if (mother.legalName != null && mother.legalName.part != null)
                    {
                        familyNamePart = mother.legalName.part.FirstOrDefault(o => o.type == NamePartType.Family);
                        givenNamePart  = mother.legalName.part.FirstOrDefault(o => o.type == NamePartType.Given);
                    }
                    else
                    {
                        familyNamePart = givenNamePart = new NamePart();
                    }

                    if (familyNamePart != null)
                    {
                        pm.MothersName = familyNamePart.value + ", ";
                    }
                    if (givenNamePart != null)
                    {
                        pm.MothersName += givenNamePart.value;
                    }

                    if (pm.MothersName.EndsWith(", "))
                    {
                        pm.MothersName = pm.MothersName.Substring(0, pm.MothersName.Length - 2);
                    }
                }
            }
            return(pm);
        }
        /// <summary>
        /// Get all registrations matching the query prototype
        /// </summary>
        public RegistrationEventCollection GetRegistrations(Person queryPrototype, int offset, int count)
        {
            // Get all Services
            IAuditorService          auditSvc = ApplicationContext.CurrentContext.GetService(typeof(IAuditorService)) as IAuditorService;
            IDataRegistrationService regSvc   = ApplicationContext.CurrentContext.GetService(typeof(IDataRegistrationService)) as IDataRegistrationService;
            IDataPersistenceService  repSvc   = ApplicationContext.CurrentContext.GetService(typeof(IDataPersistenceService)) as IDataPersistenceService;

            // Audit message
            AuditData audit = this.ConstructAuditData(ActionType.Read, EventIdentifierType.Export);

            audit.EventTypeCode = new CodeValue("ADM_GetRegistrations");

            try
            {
                // Result identifiers
                VersionedDomainIdentifier[] vids = null;
                var dummyQuery = new QueryEvent();
                var regEvt     = new RegistrationEvent()
                {
                    EventClassifier = RegistrationEventType.Register
                };
                dummyQuery.Add(regEvt, "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);

                if (queryPrototype == null)
                {
                    regEvt.Add(new Person(), "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);
                }
                else
                {
                    regEvt.Add(queryPrototype, "SUBJ", SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf, null);
                }
                vids = regSvc.QueryRecord(dummyQuery);

                RegistrationEventCollection retVal = new RegistrationEventCollection();
                Object syncLock = new object();
                retVal.Count = vids.Length;
                // Now fetch each one asynchronously
                using (WaitThreadPool thdPool = new WaitThreadPool(Environment.ProcessorCount * 2))
                {
                    foreach (var id in vids.Skip(offset).Take(count))
                    {
                        thdPool.QueueUserWorkItem(
                            delegate(object state)
                        {
                            try
                            {
                                var itm = repSvc.GetContainer(state as VersionedDomainIdentifier, true);

                                lock (syncLock)
                                    retVal.Event.Add(itm as RegistrationEvent);
                            }
                            catch (Exception e)
                            {
                                Trace.TraceError("Could not fetch result {0} : {1}", (state as VersionedDomainIdentifier).Identifier, e.ToString());
                            }
                        }
                            , id);
                    }

                    // Wait until fetch is done
                    thdPool.WaitOne(new TimeSpan(0, 0, 30), false);
                }
                //retVal.Event.Sort((a, b) => b.Timestamp.CompareTo(a.Timestamp));
                // Add audit data
                foreach (var res in retVal.Event)
                {
                    audit.AuditableObjects.Add(new AuditableObject()
                    {
                        IDTypeCode    = AuditableObjectIdType.ReportNumber,
                        LifecycleType = AuditableObjectLifecycle.Export,
                        ObjectId      = String.Format("{0}^^^&{1}&ISO", res.AlternateIdentifier.Identifier, res.AlternateIdentifier.Domain),
                        Role          = AuditableObjectRole.MasterFile,
                        Type          = AuditableObjectType.SystemObject,
                        QueryData     = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("loadFast=true"))
                    });
                }
                return(retVal);
            }
            catch (Exception e)
            {
                Trace.TraceError("Could not execute GetRegistrations : {0}", e.ToString());
                audit.Outcome = OutcomeIndicator.EpicFail;
#if DEBUG
                throw new FaultException(new FaultReason(e.ToString()), new FaultCode(e.GetType().Name));
#else
                throw new FaultException(new FaultReason(e.Message), new FaultCode(e.GetType().Name));
#endif
            }
            finally
            {
                if (auditSvc != null)
                {
                    auditSvc.SendAudit(audit);
                }
            }
        }
예제 #30
0
        /// <summary>
        /// Convert the specified patient record to a registration event
        /// </summary>
        internal MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object> CreateRegistrationEvent(RegistrationEvent res, List <IResultDetail> details)
        {
            // Patient
            var patient = res.FindComponent(SVC.Core.ComponentModel.HealthServiceRecordSiteRoleType.SubjectOf) as Person;

            if (patient == null)
            {
                return new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>()
                       {
                           NullFlavor = NullFlavor.NoInformation
                       }
            }
            ;

            var scoper         = patient.FindComponent(HealthServiceRecordSiteRoleType.PlaceOfEntry | HealthServiceRecordSiteRoleType.InformantTo) as HealthcareParticipant;
            var queryParameter = patient.FindComponent(HealthServiceRecordSiteRoleType.CommentOn | HealthServiceRecordSiteRoleType.ComponentOf) as QueryParameters;
            var mask           = patient.FindComponent(HealthServiceRecordSiteRoleType.FilterOf) as MaskingIndicator;

            var myOidData = this.m_configService.OidRegistrar.GetOid("CR_CID");

            // Return status
            var retVal = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.RegistrationEvent <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient, object>(
                ActStatus.Active,
                new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700711UV01.Subject2 <MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient>(
                    new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Patient(
                        CreateIISet(patient.AlternateIdentifiers, details),
                        ConvertStatus(patient.Status, details),
                        null,
                        new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization(
                            SET <II> .CreateSET(new II(myOidData.Oid, null)),
                            null,
                            BAG <ON> .CreateBAG(ON.CreateON(null, new ENXP(myOidData.Attributes.Find(o => o.Key == "CustodialOrgName").Value ?? myOidData.Description))),
                            new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty()
            {
                NullFlavor = NullFlavor.NoInformation
            }
                            ),
                        null
                        )
                    )
                );

            // Custodian
            retVal.Custodian = new MARC.Everest.RMIM.UV.NE2008.MFMI_MT700701UV01.Custodian(
                new MARC.Everest.RMIM.UV.NE2008.COCT_MT090003UV01.AssignedEntity(
                    SET <II> .CreateSET(new II(this.m_configService.Custodianship.Id.Domain))
                    )
            {
                RepresentedOrganization = new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.Organization(
                    SET <II> .CreateSET(new II(this.m_configService.Custodianship.Id.Domain, null)),
                    null,
                    BAG <ON> .CreateBAG(ON.CreateON(null, new ENXP(this.m_configService.Custodianship.Name))),
                    new MARC.Everest.RMIM.UV.NE2008.COCT_MT150003UV03.ContactParty()
                {
                    NullFlavor = NullFlavor.NoInformation
                }
                    )
            }
                );
            retVal.Subject1.registeredRole.SetPatientEntityChoiceSubject(CreatePersonDetail(patient, details));


            // Mask
            if (mask != null)
            {
                retVal.Subject1.registeredRole.ConfidentialityCode = new SET <CE <string> >(
                    CreateCD <String>(mask.MaskingCode, details)
                    );
            }

            if (patient.VipCode != null)
            {
                retVal.Subject1.registeredRole.VeryImportantPersonCode = CreateCD <String>(patient.VipCode, details);
            }

            // Query observation
            if (queryParameter != null)
            {
                retVal.Subject1.registeredRole.SubjectOf1.Add(new MARC.Everest.RMIM.UV.NE2008.PRPA_MT201310UV02.Subject(
                                                                  new MARC.Everest.RMIM.UV.NE2008.PRPA_MT202310UV02.QueryMatchObservation(
                                                                      new CD <string>(queryParameter.MatchingAlgorithm == MatchAlgorithm.Soundex ? "PHCM" : "PTNM", "2.16.840.1.113883.2.20.5.2"),
                                                                      new INT((int)(queryParameter.Confidence * 100))
                                                                      )
                                                                  ));
            }

            return(retVal);
        }
예제 #31
0
        public override int OnRegistrationEvent(RegistrationEvent e)
        {
            short code = e.getCode();
            tsip_register_event_type_t type = e.getType();
            String text;
            
            RegistrationSession session = e.getSession();

            switch (type)
            {
                case tsip_register_event_type_t.tsip_i_register:
                case tsip_register_event_type_t.tsip_ao_register:
                case tsip_register_event_type_t.tsip_i_unregister:
                case tsip_register_event_type_t.tsip_ao_unregister:
                    break;
            }

            text = String.Format("OnRegistrationChanged() ==> {0}:{1}", code, e.getPhrase());

            if (this.form.InvokeRequired)
            {
                this.form.Invoke(this.form.mydel, new object[] { text });
            }

            return 0;
        }