Пример #1
0
        public TaggedTextArray getCrisisNotes(string fromDate, string toDate, int nrpts)
        {
            TaggedTextArray result = new TaggedTextArray();

            string msg = MdwsUtils.isAuthorizedConnection(_mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (toDate == "")
            {
                result.fault = new FaultTO("Missing toDate");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                NoteApi          api = new NoteApi();
                IndexedHashtable t   = api.getCrisisNotes(_mySession.ConnectionSet, fromDate, toDate, nrpts);
                return(new TaggedTextArray(t));
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
                return(result);
            }
        }
Пример #2
0
        public TaggedNoteArrays getDischargeSummaries(String fromDate, String toDate, int nNotes)
        {
            TaggedNoteArrays result = new TaggedNoteArrays();

            string msg = MdwsUtils.isAuthorizedConnection(_mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (toDate == "")
            {
                result.fault = new FaultTO("Missing toDate");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                NoteApi          api = new NoteApi();
                IndexedHashtable t   = api.getDischargeSummaries(_mySession.ConnectionSet, fromDate, toDate, nNotes);
                result = new TaggedNoteArrays(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #3
0
        public TextTO getNote(string siteId, string noteId)
        {
            TextTO result = new TextTO();

            string msg = MdwsUtils.isAuthorizedConnection(_mySession, siteId);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (siteId == "")
            {
                result.fault = new FaultTO("Missing siteId");
            }
            else if (noteId == "")
            {
                result.fault = new FaultTO("Missing noteId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                NoteApi api = new NoteApi();
                string  s   = api.getNoteText(_mySession.ConnectionSet.getConnection(siteId), noteId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #4
0
        public TaggedTextArray getNoteTitles(string sitecode, string target, string direction)
        {
            TaggedTextArray result = new TaggedTextArray();
            string          msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            if (direction == "")
            {
                direction = "1";
            }

            try
            {
                AbstractConnection             cxn = _mySession.ConnectionSet.getConnection(sitecode);
                Dictionary <string, ArrayList> x   = _api.getNoteTitles(cxn, target, direction);
                IndexedHashtable t = new IndexedHashtable();
                t.Add(sitecode, x);
                result = new TaggedTextArray(t);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #5
0
        public PatientRecordFlagArray getPrfNoteActions(string sitecode, string noteDefinitionIEN)
        {
            PatientRecordFlagArray result = new PatientRecordFlagArray();
            string msg = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteDefinitionIEN == "")
            {
                result.fault = new FaultTO("Missing noteDefinitionIEN");
            }
            if (result.fault != null)
            {
                return(result);
            }
            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection  cxn   = _mySession.ConnectionSet.getConnection(sitecode);
                PatientRecordFlag[] flags = _api.getPrfNoteActions(cxn, noteDefinitionIEN);
                result = new PatientRecordFlagArray(flags);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #6
0
        public TextTO getNoteText(string sitecode, string noteIEN)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteIEN == "")
            {
                result.fault = new FaultTO("Missing noteIEN");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                result.text = _api.getNoteText(cxn, noteIEN);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #7
0
        public TaggedText isOneVisitNote(string sitecode, string noteDefinitionIEN, string noteTitle, string visitStr)
        {
            TaggedText result = new TaggedText();
            string     msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (String.IsNullOrEmpty(noteDefinitionIEN))
            {
                result.fault = new FaultTO("Missing noteDefinitionIEN");
            }
            // TODO - this arg is superfluous - remove from future versions or rename to dfn (patient IEN) to remove need to select patient
            //else if (String.IsNullOrEmpty(noteTitle))
            //{
            //    result.fault = new FaultTO("Missing noteTitle");
            //}
            else if (String.IsNullOrEmpty(visitStr))
            {
                result.fault = new FaultTO("Missing visitStr");
            }
            else if (String.IsNullOrEmpty(_mySession.ConnectionSet.BaseConnection.Pid))
            {
                result.fault = new FaultTO("No patient selected", "Need to select patient");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                bool f = _api.isOneVisitNote(cxn, noteDefinitionIEN, _mySession.ConnectionSet.BaseConnection.Pid, visitStr);
                if (f)
                {
                    result.tag  = "Y";
                    result.text = "There is already a " + noteTitle + " note for this visit.\r\n" +
                                  "Only ONE record of this type per Visit is allowed...\r\n\r\n" +
                                  "You can addend the existing record.";
                }
                else
                {
                    result.tag  = "N";
                    result.text = "";
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #8
0
        public TextTO signNote(string sitecode, string noteId, string userId, string esig)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteId == "")
            {
                result.fault = new FaultTO("Missing noteId");
            }
            else if (esig == "")
            {
                result.fault = new FaultTO("Missing esig");
            }
            if (userId == "")
            {
                if (_mySession.User.Uid == "")
                {
                    result.fault = new FaultTO("Missing userId");
                }
                else
                {
                    userId = _mySession.User.Uid;
                }
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                NoteApi            api = new NoteApi();
                string             s   = api.signNote(cxn, noteId, userId, esig);
                if (s != "OK")
                {
                    result.fault = new FaultTO(s);
                }
                else
                {
                    result = new TextTO(s);
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #9
0
        public PatientTO select(string sitecode, string localPid)
        {
            PatientTO result = new PatientTO();
            string    msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (String.IsNullOrEmpty(localPid))
            {
                result.fault = new FaultTO("Missing local PID");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (String.IsNullOrEmpty(sitecode))
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                PatientApi         api = new PatientApi();
                Patient            p   = api.select(cxn, localPid);
                result            = new PatientTO(p);
                mySession.Patient = p;
                mySession.ConnectionSet.getConnection(sitecode).Pid = result.localPid;
                if (p.Confidentiality.Key > 0)
                {
                    if (p.Confidentiality.Key == 1)
                    {
                        // do nothing here - M code takes care of this per documentation
                    }
                    else if (p.Confidentiality.Key == 2)
                    {
                        api.issueConfidentialityBulletin(mySession.ConnectionSet);
                    }
                    else if (p.Confidentiality.Key > 2)
                    {
                        mySession.ConnectionSet.disconnectAll();
                        throw new ApplicationException(p.Confidentiality.Value);
                    }
                }
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #10
0
        /// <summary>
        /// Visit multiple data sources after a login.
        /// </summary>
        /// <remarks>
        /// Requires a previous login so the credentials are already in mySession and are
        /// not altered.  Can visit a single source or multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionString">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string permissionString)
        {
            TaggedTextArray result = new TaggedTextArray();

            //Say the magic word
            // TBD - needed?????
            //if (pwd != mySession.AppPwd)
            //{
            //    result.fault = new FaultTO("Invalid application password");
            //}
            if (mySession == null || mySession.SiteTable == null)
            {
                result.fault = new FaultTO("No site table");
            }
            else if (sourceList == "")
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            //else if (mySession.user == null)
            //{
            //    result.fault = new FaultTO("No logged in user");
            //}
            else if (mySession.Credentials == null)
            {
                result.fault = new FaultTO("Cannot use this method without previous login");
            }
            if (result.fault != null)
            {
                return(result);
            }

            Site[]            sites   = MdwsUtils.parseSiteList(mySession.SiteTable, sourceList);
            List <DataSource> sources = new List <DataSource>(sites.Length);

            for (int i = 0; i < sites.Length; i++)
            {
                for (int j = 0; j < sites[i].Sources.Length; j++)
                {
                    if (sites[i].Sources[j].Protocol == "VISTA" ||
                        sites[i].Sources[j].Protocol == "FHIE" || sites[i].Sources[j].Protocol == "XVISTA")
                    {
                        sources.Add(sites[i].Sources[j]);
                    }
                }
            }
            return(setupMultiSourceQuery(pwd, sources, permissionString));
        }
Пример #11
0
        public List <OrderCheckTO> getOrderChecks(String patientId, String orderStartStr, String locationId, String orderableItemId)
        {
            List <OrderCheckTO> result           = new List <OrderCheckTO>();
            DateTime            orderStartParsed = new DateTime();

            if ("OK" != MdwsUtils.isAuthorizedConnection(_mySession))
            {
                result.Add(new OrderCheckTO(new UnauthorizedAccessException("No active session. You need to login first")));
            }
            else if (String.IsNullOrEmpty(patientId) || String.IsNullOrEmpty(orderStartStr) || String.IsNullOrEmpty(locationId) || String.IsNullOrEmpty(orderableItemId))
            {
                result.Add(new OrderCheckTO(new ArgumentNullException("Must supply all arguments")));
            }
            else if (!DateTime.TryParse(orderStartStr, out orderStartParsed))
            {
                if (orderStartStr.StartsWith("2") && orderStartStr.Contains(".")) // looks like a yyyymmDD.HHmmss date/time string
                {
                    orderStartParsed = DateUtils.IsoDateStringToDateTime(orderStartStr);
                }
                else
                {
                    result.Add(new OrderCheckTO(new ArgumentException("Invalid order start date/time string")));
                }
            }

            if (result.Count > 0)
            {
                return(result);
            }

            try
            {
                IList <OrderCheck> mdos = new RadiologyApi().getOrderChecks(_mySession.ConnectionSet.BaseConnection, patientId, orderStartParsed, locationId, orderableItemId);
                foreach (OrderCheck oc in mdos)
                {
                    result.Add(new OrderCheckTO(oc));
                }
            }
            catch (Exception exc)
            {
                result.Add(new OrderCheckTO(exc));
            }

            return(result);
        }
Пример #12
0
        //public UserTO getUserInfo(string DUZ)
        //{
        //    return getUserInfo(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserTO getUserInfo(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserTO result = new UserTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getUserInfo(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserTO getUserInfo(AbstractConnection cxn, string DUZ)
        //{
        //    UserTO result = new UserTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        User u = api.getUserInfo(cxn, DUZ);
        //        result = new UserTO(u);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public UserSecurityKeyArray getSecurityKeys(string DUZ)
        //{
        //    return getSecurityKeys(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserSecurityKeyArray getSecurityKeys(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserSecurityKeyArray result = new UserSecurityKeyArray();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getSecurityKeys(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserSecurityKeyArray getSecurityKeys(AbstractConnection cxn, string DUZ)
        //{
        //    UserSecurityKeyArray result = new UserSecurityKeyArray();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        UserSecurityKey[] keys = api.getSecurityKeys(cxn, DUZ);
        //        result = new UserSecurityKeyArray(keys);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addSecurityKeyForContext(string DUZ, string context)
        //{
        //    return addSecurityKeyForContext(mySession.cxnMgr.LoginConnection, DUZ, context);
        //}

        //public TextTO addSecurityKeyForContext(string sitecode, string DUZ, string context)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addSecurityKeyForContext(mySession.cxns.getConnection(sitecode), DUZ, context);
        //}

        //internal TextTO addSecurityKeyForContext(Connection cxn, string DUZ, string context)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (context == "")
        //    {
        //        result.fault = new FaultTO("Missing context");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addSecurityKeyForContext(cxn, DUZ, context);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addSecurityKey(string DUZ, string securityKey)
        //{
        //    return addSecurityKey(mySession.cxnMgr.LoginConnection, DUZ, securityKey);
        //}

        //public TextTO addSecurityKey(string sitecode, string DUZ, string securityKey)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addSecurityKey(mySession.cxns.getConnection(sitecode), DUZ, securityKey);
        //}

        //internal TextTO addSecurityKey(Connection cxn, string DUZ, string securityKey)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (securityKey == "")
        //    {
        //        result.fault = new FaultTO("Missing security key");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addSecurityKey(cxn, DUZ, securityKey);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO removeSecurityKey(string DUZ, string securityKey)
        //{
        //    return removeSecurityKey(mySession.cxnMgr.LoginConnection, DUZ, securityKey);
        //}

        //public TextTO removeSecurityKey(string sitecode, string DUZ, string securityKey)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return removeSecurityKey(mySession.cxns.getConnection(sitecode), DUZ, securityKey);
        //}

        //internal TextTO removeSecurityKey(Connection cxn, string DUZ, string securityKey)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (securityKey == "")
        //    {
        //        result.fault = new FaultTO("Missing security key");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.removeSecurityKey(cxn, DUZ, securityKey);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public UserOptionArray getMenuOptions(string DUZ)
        //{
        //    return getMenuOptions(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserOptionArray getMenuOptions(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserOptionArray result = new UserOptionArray();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getMenuOptions(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserOptionArray getMenuOptions(Connection cxn, string DUZ)
        //{
        //    UserOptionArray result = new UserOptionArray();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        UserOption[] o = api.getMenuOptions(cxn, DUZ);
        //        result = new UserOptionArray(o);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public UserOptionArray getDelegatedOptions(string DUZ)
        //{
        //    return getDelegatedOptions(mySession.cxnMgr.LoginConnection, DUZ);
        //}

        //public UserOptionArray getDelegatedOptions(string sitecode, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        UserOptionArray result = new UserOptionArray();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return getDelegatedOptions(mySession.cxns.getConnection(sitecode), DUZ);
        //}

        //internal UserOptionArray getDelegatedOptions(Connection cxn, string DUZ)
        //{
        //    UserOptionArray result = new UserOptionArray();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        UserOption[] o = api.getDelegatedOptions(cxn, DUZ);
        //        result = new UserOptionArray(o);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addMenuOption(string context, string DUZ)
        //{
        //    return addMenuOption(mySession.cxnMgr.LoginConnection, context, DUZ);
        //}

        //public TextTO addMenuOption(string sitecode, string context, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addMenuOption(mySession.cxns.getConnection(sitecode), context, DUZ);
        //}

        //internal TextTO addMenuOption(Connection cxn, string context, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (context == "")
        //    {
        //        result.fault = new FaultTO("Missing context");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addMenuOption(cxn, context, DUZ);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO addDelegatedOption(string context, string DUZ)
        //{
        //    return addDelegatedOption(mySession.cxnMgr.LoginConnection, context, DUZ);
        //}

        //public TextTO addDelegatedOption(string sitecode, string context, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return addDelegatedOption(mySession.cxns.getConnection(sitecode), context, DUZ);
        //}

        //internal TextTO addDelegatedOption(Connection cxn, string context, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (context == "")
        //    {
        //        result.fault = new FaultTO("Missing context");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        string s = api.addDelegatedOption(cxn, context, DUZ);
        //        result = new TextTO(s);
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO removeMenuOption(string optNum, string DUZ)
        //{
        //    return removeMenuOption(mySession.cxnMgr.LoginConnection, optNum, DUZ);
        //}

        //public TextTO removeMenuOption(string sitecode, string optNum, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return removeMenuOption(mySession.cxns.getConnection(sitecode), optNum, DUZ);
        //}

        //internal TextTO removeMenuOption(Connection cxn, string optNum, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (optNum == "")
        //    {
        //        result.fault = new FaultTO("Missing optNum");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        api.removeMenuOption(cxn, optNum, DUZ);
        //        result = new TextTO("OK");
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        //public TextTO removeDelegatedOption(string optNum, string DUZ)
        //{
        //    return removeDelegatedOption(mySession.cxnMgr.LoginConnection, optNum, DUZ);
        //}

        //public TextTO removeDelegatedOption(string sitecode, string optNum, string DUZ)
        //{
        //    if (sitecode == "")
        //    {
        //        TextTO result = new TextTO();
        //        result.fault = new FaultTO("Missing sitecode");
        //        return result;
        //    }
        //    return removeDelegatedOption(mySession.cxns.getConnection(sitecode), optNum, DUZ);
        //}

        //internal TextTO removeDelegatedOption(Connection cxn, string optNum, string DUZ)
        //{
        //    TextTO result = new TextTO();
        //    if (DUZ == "")
        //    {
        //        result.fault = new FaultTO("Missing DUZ");
        //    }
        //    else if (optNum == "")
        //    {
        //        result.fault = new FaultTO("Missing optNum");
        //    }
        //    if (result.fault != null)
        //    {
        //        return result;
        //    }
        //    try
        //    {
        //        UserApi api = new UserApi();
        //        api.removeDelegatedOption(cxn, optNum, DUZ);
        //        result = new TextTO("OK");
        //    }
        //    catch (Exception e)
        //    {
        //        result.fault = new FaultTO(e.Message);
        //    }
        //    return result;
        //}

        public TextTO isValidEsig(string esig)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (String.IsNullOrEmpty(esig))
            {
                result.fault = new FaultTO("No E-Signature provided.", "Need to provide an E-Signature code");
            }
            if (result.fault != null)
            {
                return(result);
            }
            return(isValidEsig(mySession.ConnectionSet.BaseConnection, esig));
        }
Пример #13
0
        public TextArray ddrLister(
            string sitecode,
            string file,
            string iens,
            string fields,
            string flags,
            string maxrex,
            string from,
            string part,
            string xref,
            string screen,
            string identifier)
        {
            TextArray result = new TextArray();
            string    msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                ToolsApi           api = new ToolsApi();
                string[]           s   = api.ddrLister(cxn, file, iens, fields, flags, maxrex, from, part, xref, screen, identifier);
                result = new TextArray(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #14
0
        public TextTO isCosignerRequired(string sitecode, string noteDefinitionIEN, string authorDUZ)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteDefinitionIEN == "")
            {
                result.fault = new FaultTO("Missing noteDefinitionIEN");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                bool f = false;
                if (authorDUZ == "")
                {
                    f = _api.isCosignerRequired(cxn, _mySession.User.Uid, noteDefinitionIEN);
                }
                else
                {
                    f = _api.isCosignerRequired(cxn, _mySession.User.Uid, noteDefinitionIEN, authorDUZ);
                }
                result.text = (f ? "Y" : "N");
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #15
0
        // This is the core visit method the others are using. The permission must have been set before
        // getting here.
        internal User doTheVisit(string sitecode, AbstractCredentials credentials, AbstractPermission permission)
        {
            Site       site = mySession.SiteTable.getSite(sitecode);
            DataSource src  = site.getDataSourceByModality("HIS");

            if (src == null)
            {
                throw new Exception("No HIS data source at site " + sitecode);
            }

            AbstractDaoFactory factory = AbstractDaoFactory.getDaoFactory(AbstractDaoFactory.getConstant(src.Protocol));

            myCxn = factory.getConnection(src);
            myCxn.Account.AuthenticationMethod = mySession.DefaultVisitMethod;

            if (!MdwsUtils.isValidCredentials(myCxn.Account.AuthenticationMethod, credentials, permission))
            {
                throw new Exception("Invalid credentials");
            }

            object result = null;

            if (myCxn.Account.AuthenticationMethod == VistaConstants.BSE_CREDENTIALS_V2WEB)
            {
                result = myCxn.authorizedConnect(credentials, permission,
                                                 new DataSource()
                {
                    ConnectionString = mySession.MdwsConfiguration.BseValidatorConnectionString
                });
            }
            else
            {
                result = myCxn.authorizedConnect(credentials, permission, null);
            }
            if (result.GetType().Name.EndsWith("Exception"))
            {
                throw (Exception)result;
            }
            else
            {
                return((User)result);
            }
        }
Пример #16
0
        public TaggedPatientArrays matchByNameCityStateMS(string name, string city, string stateAbbr)
        {
            TaggedPatientArrays result = new TaggedPatientArrays();
            string msg = MdwsUtils.isAuthorizedConnection(mySession);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            if (name == "")
            {
                result.fault = new FaultTO("Missing name");
            }
            else if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (stateAbbr == "")
            {
                result.fault = new FaultTO("Missing stateAbbr");
            }
            else if (!State.isValidAbbr(stateAbbr))
            {
                result.fault = new FaultTO("Invalid stateAbbr");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                PatientApi       api     = new PatientApi();
                IndexedHashtable matches = api.matchByNameCityState(mySession.ConnectionSet, name, city, stateAbbr);
                result = new TaggedPatientArrays(matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #17
0
        public BoolTO isValidStopCode(string stopCodeId)
        {
            BoolTO result = new BoolTO();

            try
            {
                MdwsUtils.checkNullArgs(MdwsUtils.getArgsDictionary(
                                            System.Reflection.MethodInfo.GetCurrentMethod().GetParameters(), new List <object>()
                {
                    stopCodeId
                }));

                result.trueOrFalse = new EncounterApi().isValidStopCode(_mySession.ConnectionSet.BaseConnection, stopCodeId);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }
Пример #18
0
        public TaggedVisitArray getVisits(string sitecode, string fromDate, string toDate)
        {
            TaggedVisitArray result = new TaggedVisitArray();
            string           msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (fromDate == "")
            {
                result.fault = new FaultTO("Missing fromDate");
            }
            else if (toDate == "")
            {
                toDate = DateTime.Today.ToString("yyyyMMdd");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api = new EncounterApi();
                Visit[]            v   = api.getVisits(cxn, fromDate, toDate);
                result = new TaggedVisitArray(sitecode, v);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e);
            }
            return(result);
        }
Пример #19
0
        public TextTO isRpcAvailable(string sitecode, string target, string context)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (target == "")
            {
                result.fault = new FaultTO("Missing target");
            }
            else if (context == "")
            {
                result.fault = new FaultTO("Missing context");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = mySession.ConnectionSet.getConnection(sitecode);
                ToolsApi           api = new ToolsApi();
                string             s   = api.isRpcAvailable(cxn, target, context);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #20
0
        public UserArray lookup(string sitecode, string target, string maxRex)
        {
            UserArray result = new UserArray();
            string    msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (target == "")
            {
                result.fault = new FaultTO("Missing target");
            }
            else if (!StringUtils.isNumeric(maxRex))
            {
                result.fault = new FaultTO("Non-numeric maxRex");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (String.IsNullOrEmpty(sitecode))
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn     = mySession.ConnectionSet.Connections[sitecode];
                UserApi            api     = new UserApi();
                User[]             matches = api.userLookup(cxn, new KeyValuePair <string, string>("NAME", target)); //.userLookupByName(cxn, target, maxRex);
                result = new UserArray(matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #21
0
        /// <summary>
        /// Visit multiple data sources after a login.
        /// </summary>
        /// <remarks>
        /// Requires a previous login so the credentials are already in mySession and are
        /// not altered.  Can visit a single source or multiple sources.  Sources may be
        /// VAMCs, VISNs, some combination of VAMCs and VISNs, or the entire VHA.  See the
        /// sourceList parameter.
        /// </remarks>
        /// <param name="pwd">Client app's BSE security phrase</param>
        /// <param name="sourceList">
        /// A comma-delimited list of station numbers and/or VISN IDs, as in
        /// "402,550" or "V12,V22" or "V1,V2,456".  To visit all VistA systems set the param
        /// to "*".  Duplicate station #'s are ignored.
        /// </param>
        /// <param name="permissionString">If blank defaults to CPRS context</param>
        /// <returns>TaggedTextArray: each site with user DUZ or an error message</returns>
        public TaggedTextArray visitSites(string pwd, string sourceList, string permissionString)
        {
            TaggedTextArray result = new TaggedTextArray();

            if (mySession == null || mySession.SiteTable == null)
            {
                result.fault = new FaultTO("No site table");
            }
            else if (sourceList == "")
            {
                result.fault = new FaultTO("Missing sitelist");
            }
            else if (mySession.Credentials == null)
            {
                result.fault = new FaultTO("Cannot use this method without previous login");
            }
            if (result.fault != null)
            {
                return(result);
            }

            Site[]            sites   = MdwsUtils.parseSiteList(mySession.SiteTable, sourceList);
            List <DataSource> sources = new List <DataSource>(sites.Length);

            for (int i = 0; i < sites.Length; i++)
            {
                for (int j = 0; j < sites[i].Sources.Length; j++)
                {
                    if (sites[i].Sources[j].Protocol == "VISTA" ||
                        sites[i].Sources[j].Protocol == "FHIE" || sites[i].Sources[j].Protocol == "XVISTA")
                    {
                        sources.Add(sites[i].Sources[j]);
                    }
                }
            }
            return(setupMultiSourceQuery(pwd, sources, permissionString));
        }
Пример #22
0
        public TaggedHospitalLocationArray getLocations(string sitecode, string target, string direction)
        {
            TaggedHospitalLocationArray result = new TaggedHospitalLocationArray();
            string msg = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            if (direction == "")
            {
                direction = "1";
            }

            try
            {
                AbstractConnection cxn       = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api       = new EncounterApi();
                HospitalLocation[] locations = api.getLocations(cxn, target, direction);
                result = new TaggedHospitalLocationArray(sitecode, locations);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #23
0
        public TaggedText isSurgeryNote(string sitecode, string noteDefinitionIEN)
        {
            TaggedText result = new TaggedText();
            string     msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteDefinitionIEN == "")
            {
                result.fault = new FaultTO("Missing noteDefinitionIEN");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                bool f = _api.isSurgeryNote(cxn, noteDefinitionIEN);
                result.tag  = (f ? "Y" : "N");
                result.text = (f ? "Cannot create new surgery note at this time" : "");
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #24
0
        public OrderDialogItemArray getOrderDialogItems(string dialogId)
        {
            OrderDialogItemArray result = new OrderDialogItemArray();

            if (!(MdwsUtils.isAuthorizedConnection(mySession) == "OK"))
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(dialogId))
            {
                result.fault = new FaultTO("Empty Dialog ID");
            }
            if (result.fault != null)
            {
                return(result);
            }

            try
            {
                List <OrderDialogItem> lst = Order.getOrderDialogItems(mySession.ConnectionSet.BaseConnection, dialogId);
                if (lst == null || lst.Count == 0)
                {
                    return(result);
                }
                result.items = new OrderDialogItemTO[lst.Count];
                for (int i = 0; i < lst.Count; i++)
                {
                    result.items[i] = new OrderDialogItemTO(lst[i]);
                }
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Пример #25
0
        public TaggedPatientArray getPatientsByProvider(string sitecode, string duz)
        {
            TaggedPatientArray result = new TaggedPatientArray();
            string             msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (duz == "")
            {
                result.fault = new FaultTO("Missing duz");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn        = mySession.ConnectionSet.getConnection(sitecode);
                PatientApi         patientApi = new PatientApi();
                Patient[]          matches    = patientApi.getPatientsByProvider(cxn, duz);
                result = new TaggedPatientArray(sitecode, matches);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #26
0
        public TextTO getLocalPid(string sitecode, string mpiPid)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (mpiPid == "")
            {
                result.fault = new FaultTO("Missing mpiPid");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (String.IsNullOrEmpty(sitecode))
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn      = mySession.ConnectionSet.getConnection(sitecode);
                PatientApi         api      = new PatientApi();
                string             localPid = api.getLocalPid(cxn, mpiPid);
                result = new TextTO(localPid);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #27
0
        public TextTO getLrDfn(string sitecode, string dfn)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (dfn == "")
            {
                result.fault = new FaultTO("Missing dfn");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn   = mySession.ConnectionSet.getConnection(sitecode);
                LabsApi            api   = new LabsApi();
                string             lrdfn = api.getLrDfn(cxn, dfn);
                result = new TextTO(lrdfn);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #28
0
        public TextTO closeNote(string sitecode, string noteId, string consultId)
        {
            TextTO result = new TextTO();
            string msg    = MdwsUtils.isAuthorizedConnection(_mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (noteId == "")
            {
                result.fault = new FaultTO("Missing noteId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = _mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn = _mySession.ConnectionSet.getConnection(sitecode);
                NoteApi            api = new NoteApi();
                string             s   = api.closeNote(cxn, noteId, consultId);
                result = new TextTO(s);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #29
0
        public InpatientStayTO getStayMovements(string sitecode, string checkinId)
        {
            InpatientStayTO result = new InpatientStayTO();
            string          msg    = MdwsUtils.isAuthorizedConnection(mySession, sitecode);

            if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            else if (checkinId == "")
            {
                result.fault = new FaultTO("Missing checkinId");
            }
            if (result.fault != null)
            {
                return(result);
            }

            if (sitecode == null)
            {
                sitecode = mySession.ConnectionSet.BaseSiteId;
            }

            try
            {
                AbstractConnection cxn  = mySession.ConnectionSet.getConnection(sitecode);
                EncounterApi       api  = new EncounterApi();
                InpatientStay      stay = api.getStayMovements(cxn, checkinId);
                result = new InpatientStayTO(stay);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Пример #30
0
        public OrderTO saveNewRadiologyOrder(
            String patientId,
            String duz,
            String locationIEN,
            String dlgDisplayGroupId,
            String orderableItemIen,
            String urgencyCode,
            String modeCode,
            String classCode,
            String contractSharingIen,
            String submitTo,
            String pregnant,
            String isolation,
            String reasonForStudy,
            String clinicalHx,
            String startDateTime,
            String preOpDateTime,
            String modifierIds,
            String eSig,
            String orderCheckOverrideReason)
        {
            OrderTO result = new OrderTO();

            if ("OK" != MdwsUtils.isAuthorizedConnection(_mySession))
            {
                result.fault = new FaultTO("No connection - need to login?");
            }

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

            try
            {
                IList <String> modifierIdList = new List <String>();
                if (!String.IsNullOrEmpty(modifierIds))
                {
                    modifierIdList = new List <String>(StringUtils.split(modifierIds, StringUtils.STICK));
                }

                bool pregnantParsed = false;
                if (!String.IsNullOrEmpty(pregnant) && StringUtils.parseBool(pregnant))
                {
                    pregnantParsed = true;
                }
                bool isolationParsed = false;
                if (!String.IsNullOrEmpty(isolation) && StringUtils.parseBool(isolation))
                {
                    isolationParsed = true;
                }

                DateTime startDtParsed = DateUtils.IsoDateStringToDateTime(startDateTime);
                DateTime preOpDtParsed = DateUtils.IsoDateStringToDateTime(preOpDateTime);

                Order mdo = new RadiologyApi().saveNewOrder(_mySession.ConnectionSet.BaseConnection, patientId, duz, locationIEN, dlgDisplayGroupId, orderableItemIen,
                                                            urgencyCode, modeCode, classCode, contractSharingIen, submitTo, pregnantParsed, isolationParsed, reasonForStudy, clinicalHx, startDtParsed, preOpDtParsed, modifierIdList, eSig, orderCheckOverrideReason);

                result = new OrderTO(mdo);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return(result);
        }