Beispiel #1
0
        /// <summary>
        /// Cross reference an identifier only
        /// </summary>
        public String CrossReferenceQuery(PatientIdentifier localId, String targetDomain)
        {
            if (this.m_sender == null)
            {
                throw new InvalidOperationException("Connection not open");
            }
            ;
            try
            {
                var request = this.CreatePIXSearch(localId, targetDomain);
                var retVal  = this.m_sender.SendAndReceive <RSP_K23>(request);

                // Is the response success?
                if (retVal == null || !retVal.MSA.AcknowledgmentCode.Value.EndsWith("A"))
                {
                    foreach (var err in retVal.ERR.GetErrorCodeAndLocation())
                    {
                        Trace.TraceError("CR ERR: {0} ({1})", err.CodeIdentifyingError.Text, err.CodeIdentifyingError.AlternateText);
                    }
                    throw new IntegrationException(retVal.ERR.GetErrorCodeAndLocation(0).CodeIdentifyingError.Text.Value);
                }

                return(retVal.QUERY_RESPONSE.PID.GetPatientIdentifierList().FirstOrDefault(o => o.AssigningAuthority.NamespaceID.Value == targetDomain)?.IDNumber.Value);
            }
            catch (Exception e)
            {
                Trace.TraceError("Error registering patient: {0}", e);
                throw;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Create a PIX search message
        /// </summary>
        private QBP_Q21 CreatePIXSearch(PatientIdentifier localId, string targetDomain)
        {
            QBP_Q21 retVal = new QBP_Q21();

            this.UpdateMSH(retVal.MSH, "QBP_Q21", "QBP", "Q23");
            Terser terser = new Terser(retVal);

            terser.Set("/QPD-1", "IHE PIX Query");
            terser.Set("/QPD-2", Guid.NewGuid().ToString().Substring(0, 8));
            terser.Set("/QPD-3-1", localId.Value);
            terser.Set("/QPD-3-4-1", localId.Domain);
            terser.Set("/QPD-4-4-1", targetDomain);
            return(retVal);
        }