示例#1
0
        public PatientArray getPatientsByClinic(string clinicId, string startDate, string stopDate)
        {
            PatientArray result = new PatientArray();

            string msg = MdwsUtils.isAuthorizedConnection(_mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (String.IsNullOrEmpty(clinicId))
            {
                result.fault = new FaultTO("Missing clinicId");
            }

            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                Patient[] matches = new PatientApi().getPatientsByClinic(_mySession.ConnectionSet.BaseConnection, clinicId, startDate, stopDate);
                result = new PatientArray(matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }

            return(result);
        }
示例#2
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);
        }
示例#3
0
        /// <summary>
        /// Retrieve patients with a scheduled appointment in a clinic. Notice: data structure may be modified to accomodate appointment information
        /// </summary>
        /// <param name="clinicId">Clinic's ID</param>
        /// <param name="startDate">Beginning date</param>
        /// <param name="stopDate">Stop date</param>
        /// <returns></returns>
        public IList <PatientTO> getPatientsByClinic(string clinicId, string startDate, string stopDate)
        {
            PatientArray result = _svc.getPatientsByClinic(clinicId, startDate, stopDate);

            if (result.fault != null)
            {
                throw new ApplicationException(result.fault.message);
            }
            IList <PatientTO> patients = new List <PatientTO>();

            foreach (PatientTO patient in result.patients)
            {
                patients.Add(patient);
            }
            return(patients);
        }
示例#4
0
        public PatientArray nptLookup(
            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("Must supply SSN");
            }
            else if (!SocSecNum.isValid(SSN))
            {
                result.fault = new FaultTO("Invalid SSN");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                PatientApi api      = new PatientApi();
                Patient[]  patients = api.nptMatch(SSN);
                result = new PatientArray(patients);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
示例#5
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);
        }