mpiMatch() public method

public mpiMatch ( DataSource src, string ssn ) : Patient[]
src DataSource
ssn string
return Patient[]
Beispiel #1
0
        public PatientArray mpiMatchSSN(string ssn)
        {
            PatientArray result = new PatientArray();
            if (!SocSecNum.isValid(ssn))
            {
                result.fault = new FaultTO("Invalid SSN");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                PatientApi api = new PatientApi();
                Site site = mySession.SiteTable.getSite("500");
                Patient[] p = api.mpiMatch(site.Sources[0], ssn);
                addHomeData(p);
                result = new PatientArray(p);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }
Beispiel #2
0
        /// <summary>
        /// Lookup a patient in the Medora Patient Index. This can be a stateless call (i.e. not currently required to login)
        /// </summary>
        /// <param name="SSN">Patient SSN (required)</param>
        /// <param name="lastName">Patient Last Name (optional)</param>
        /// <param name="firstName">Patient First Name (optional)</param>
        /// <param name="middleName">Patient Middle Name (optional)</param>
        /// <param name="nameSuffix">Patient Name Suffix (optional)</param>
        /// <param name="DOB">Patient Date Of Birth (optional)</param>
        /// <param name="gender">Patient Gender (not currently used for matching)</param>
        /// <returns>PatientArray of matches</returns>
        public PatientArray mpiLookup(
            string SSN,
            string lastName,
            string firstName,
            string middleName,
            string nameSuffix,
            string DOB,
            string gender)
        {
            PatientArray result = new PatientArray();

            if (String.IsNullOrEmpty(SSN))
            {
                result.fault = new FaultTO("Missing SSN");
            }
            else if (!SocSecNum.isValid(SSN))
            {
                result.fault = new FaultTO("Invalid SSN");
            }
            // hard coded the cxn string since our MPI database should really be a service for everyone
            //else if (mySession == null || mySession.MdwsConfiguration == null || mySession.MdwsConfiguration.SqlConfiguration == null ||
            //    String.IsNullOrEmpty(mySession.MdwsConfiguration.SqlConfiguration.ConnectionString))
            //{
            //    result.fault = new FaultTO("Your MDWS configuration does not contain a valid SQL connection string");
            //}
            if (result.fault != null)
            {
                return result;
            }

            Patient patient = new Patient();
            patient.SSN = new SocSecNum(SSN);

            if (!String.IsNullOrEmpty(lastName) && !String.IsNullOrEmpty(firstName))
            {
                patient.Name = new PersonName();
                patient.Name.Lastname = lastName;
                patient.Name.Firstname = firstName;
                if(!String.IsNullOrEmpty(middleName))
                {
                    patient.Name.Firstname = firstName + " " + middleName;
                }
                patient.Name.Suffix = nameSuffix;
            }
            if(!String.IsNullOrEmpty(DOB))
            {
                patient.DOB = DOB;
            }
            // SQL query doesn't care about gender so just ignore it for now
            //patient.Gender = gender;

            try
            {
                PatientApi api = new PatientApi();
                Patient[] matches = null;

                Site site = mySession.SiteTable.getSite("500");
                matches = api.mpiMatch(site.Sources[0], SSN);
                //if (patient.Name != null && !String.IsNullOrEmpty(patient.Name.LastNameFirst)) // match all patient info if present
                //{
                //    matches = api.mpiLookup(patient);
                //}
                //else // otherwise just match on SSN
                //{
                //    matches = api.mpiLookup(SSN);
                //}

                result = new PatientArray(matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }