Ejemplo n.º 1
0
        public TaggedNoteArrays getNotesForBhie(string pwd, string mpiPid, string fromDate, string toDate, string nNotes)
        {
            TaggedNoteArrays result = new TaggedNoteArrays();

            if (pwd != "iBnOfs55iEZ,d")
            {
                result.fault = new FaultTO("Invalid application password");
            }
            else if (String.IsNullOrEmpty(mpiPid))
            {
                result.fault = new FaultTO("Missing mpiPid");
            }
            else if (String.IsNullOrEmpty(fromDate))
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (String.IsNullOrEmpty(toDate))
            {
                result.fault = new FaultTO("Missing toDate");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (nNotes == "")
            {
                nNotes = "50";
            }

            try
            {
                int             maxNotes = Convert.ToInt16(nNotes);
                PatientLib      patLib   = new PatientLib(_mySession);
                TaggedTextArray sites    = patLib.getPatientSitesByMpiPid(mpiPid);
                if (sites == null)
                {
                    return(null);
                }
                if (sites.fault != null)
                {
                    result.fault = sites.fault;
                    return(result);
                }

                string sitelist = "";
                for (int i = 0; i < sites.count; i++)
                {
                    if ((string)sites.results[i].tag == "200")
                    {
                        continue;
                    }
                    if (sites.results[i].fault != null)
                    {
                    }
                    else
                    {
                        sitelist += (string)sites.results[i].tag + ',';
                    }
                }
                sitelist = sitelist.Substring(0, sitelist.Length - 1);

                AccountLib acctLib = new AccountLib(_mySession);
                sites = acctLib.visitSites("BHIE", sitelist, MdwsConstants.CPRS_CONTEXT);
                if (sites.fault != null)
                {
                    result.fault = sites.fault;
                    return(result);
                }

                PatientApi       patApi = new PatientApi();
                IndexedHashtable t      = patApi.setLocalPids(_mySession.ConnectionSet, mpiPid);
                NoteApi          api    = new NoteApi();
                IndexedHashtable tNotes = api.getNotes(_mySession.ConnectionSet, fromDate, toDate, maxNotes);
                IndexedHashtable tSumms = api.getDischargeSummaries(_mySession.ConnectionSet, fromDate, toDate, 50);
                result = new TaggedNoteArrays(mergeNotesAndDischargeSummaries(tNotes, tSumms));
            }
            catch (Exception ex)
            {
                result.fault = new FaultTO(ex);
            }
            finally
            {
                if (_mySession.ConnectionSet != null)
                {
                    _mySession.ConnectionSet.disconnectAll();
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public PatientTO getDemographics()
        {
            PatientLib lib = new PatientLib(MySession);

            return(lib.getDemographics());
        }
Ejemplo n.º 3
0
        public TaggedNoteArrays getNotesForBhie(string pwd, string mpiPid, string fromDate, string toDate, string nNotes)
        {
            TaggedNoteArrays result = new TaggedNoteArrays();
            if (String.Equals(pwd, _mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.PRIMARY_CONFIG_SECTION][MdwsConfigConstants.BHIE_PASSWORD]))
            {
                result.fault = new FaultTO("Invalid application password");
            }
            else if (String.IsNullOrEmpty(mpiPid))
            {
                result.fault = new FaultTO("Missing mpiPid");
            }
            else if (String.IsNullOrEmpty(fromDate))
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (String.IsNullOrEmpty(toDate))
            {
                result.fault = new FaultTO("Missing toDate");
            }
            if (result.fault != null)
            {
                return result;
            }

            if (nNotes == "")
            {
                nNotes = "50";
            }

            try
            {
                int maxNotes = Convert.ToInt16(nNotes);
                PatientLib patLib = new PatientLib(_mySession);
                TaggedTextArray sites = patLib.getPatientSitesByMpiPid(mpiPid);
                if (sites == null)
                {
                    return null;
                }
                if (sites.fault != null)
                {
                    result.fault = sites.fault;
                    return result;
                }

                string sitelist = "";
                for (int i = 0; i < sites.count; i++)
                {
                    if ((string)sites.results[i].tag == "200")
                    {
                        continue;
                    }
                    if (sites.results[i].fault != null)
                    {
                    }
                    else
                    {
                        sitelist += (string)sites.results[i].tag + ',';
                    }
                }
                sitelist = sitelist.Substring(0, sitelist.Length - 1);

                AccountLib acctLib = new AccountLib(_mySession);
                sites = acctLib.visitSites("BHIE", sitelist, MdwsConstants.CPRS_CONTEXT);
                if (sites.fault != null)
                {
                    result.fault = sites.fault;
                    return result;
                }

                PatientApi patApi = new PatientApi();
                IndexedHashtable t = patApi.setLocalPids(_mySession.ConnectionSet, mpiPid);
                NoteApi api = new NoteApi();
                IndexedHashtable tNotes = api.getNotes(_mySession.ConnectionSet, fromDate, toDate, maxNotes);
                IndexedHashtable tSumms = api.getDischargeSummaries(_mySession.ConnectionSet, fromDate, toDate, 50);
                result = new TaggedNoteArrays(mergeNotesAndDischargeSummaries(tNotes, tSumms));
            }
            catch (Exception ex)
            {
                result.fault = new FaultTO(ex);
            }
            finally
            {
                if (_mySession.ConnectionSet != null)
                {
                    _mySession.ConnectionSet.disconnectAll();
                }
            }
            return result;
        }
Ejemplo n.º 4
0
 public PatientTO getDemographics()
 {
     PatientLib lib = new PatientLib(MySession);
     return lib.getDemographics();
 }
Ejemplo n.º 5
0
        public BoolTO getIdProofingStatus(string patientId, string patientName, string patientDOB)
        {
            BoolTO result = new BoolTO();

            if (mySession == null || mySession.ConnectionSet == null || !mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(patientId))
            {
                result.fault = new FaultTO("Must supply patient ID");
            }

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

            Patient patient = new Patient()
            {
                SSN  = new SocSecNum(patientId),
                Name = new PersonName(patientName),
                DOB  = patientDOB
            };

            try
            {
                if (SocSecNum.isValid(patientId)) // if ID passed was SSN - turn in to
                {
                    Patient[] matches = new PatientApi().match(mySession.ConnectionSet.BaseConnection, patient.SSN.toString());
                    if (matches == null || matches.Length == 0)
                    {
                        result.fault = new FaultTO("No patient found with that SSN!");
                        return(result);
                    }
                    if (matches.Length > 0)
                    {
                        result.fault = new FaultTO("Duplicate SSN found", "Please contact the system administrator");
                        return(result);
                    }
                    if (String.IsNullOrEmpty(matches[0].LocalPid))
                    {
                        result.fault = new FaultTO("Invalid record associated with that SSN", "Please contact the system administrator");
                        return(result);
                    }
                    PatientTO vistaPatient = new PatientLib(mySession).select(matches[0].LocalPid);
                    patient.LocalPid = matches[0].LocalPid;
                    patient.MpiPid   = vistaPatient.mpiPid;
                }

                //new AccountLib(mySession).setupMultiSourceQuery("pwd", patient.s
                mySession.ConnectionSet.setLocalPids(patient.MpiPid);

                IndexedHashtable ihs = new PatientApi().getIdProofingStatus(mySession.ConnectionSet, patient);
                if (ihs == null || ihs.Count == 0)
                {
                    result.trueOrFalse = false;
                }
                else
                {
                    result.trueOrFalse = true;

                    for (int i = 0; i < ihs.Count; i++) // loop through - if any are false, result is false
                    {
                        if (!(bool)ihs.GetValue(i))
                        {
                            result.trueOrFalse = false;
                            break;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            finally
            {
                try { mySession.ConnectionSet.disconnectAll(); }
                catch (Exception) { }
            }
            return(result);
        }