Esempio n. 1
0
    /// <summary>
    /// get a dataset of all specialties, used for patient lookups etc...
    /// </summary>
    /// <param name="ds"></param>
    /// <returns></returns>
    public CStatus GetClinicDS(out DataSet ds)
    {
        //initialize parameters
        ds = null;
        CStatus status = new CStatus();

        //transfer from MDWS if needed
        if (MDWSTransfer)
        {
            long     lCount = 0;
            CMDWSOps ops    = new CMDWSOps(this);
            status = ops.GetMDWSClinics(out lCount);
            if (!status.Status)
            {
                return(status);
            }
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(base.SessionID,
                                                  base.ClientIP,
                                                  base.UserID);

        //get the dataset
        CDataSet cds = new CDataSet();

        status = cds.GetOracleDataSet(base.DBConn,
                                      "PCK_CLINIC.GetClinicRS",
                                      pList,
                                      out ds);
        return(status);
    }
Esempio n. 2
0
    /// <summary>
    /// US:885 save the control
    /// </summary>
    /// <returns></returns>
    public override CStatus SaveControl()
    {
        CMDWSOps ops    = new CMDWSOps(this.BaseMstr.BaseData);
        CStatus  status = ops.WriteNote(
            PatientID,
            this.BaseMstr.UserID.ToString(),
            txtSign.Text,
            ddlClinics.SelectedValue,
            NoteTitleIEN,
            txtTIU.Text);

        if (!status.Status)
        {
            return(status);
        }

        //fire the NoteSaved event
        if (_NoteSaved != null)
        {
            CAppUserControlArgs args = new CAppUserControlArgs(
                k_EVENT.SELECT,
                k_STATUS_CODE.Success,
                string.Empty,
                "1");

            _NoteSaved(this, args);
        }

        return(new CStatus());
    }
Esempio n. 3
0
    /// <summary>
    /// Gets a dataset of patients matching a specialty id
    /// </summary>
    /// <param name="ds"></param>
    /// <returns></returns>
    public CStatus GetSpecialtyPatientsDS(long lSpecialtyID,
                                          out DataSet ds)
    {
        //initialize parameters
        ds = null;
        CStatus status = new CStatus();

        //transfer from MDWS if needed
        if (MDWSTransfer)
        {
            long     lCount = 0;
            CMDWSOps ops    = new CMDWSOps(this);
            status = ops.GetMDWSSpecialtyPatients(lSpecialtyID, out lCount);
            if (!status.Status)
            {
                return(status);
            }
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(base.SessionID,
                                                  base.ClientIP,
                                                  base.UserID);

        pList.AddInputParameter("pi_nSpecialtyID", lSpecialtyID);

        //get the dataset
        CDataSet cds = new CDataSet();

        status = cds.GetOracleDataSet(base.DBConn,
                                      "PCK_SPECIALTY.GetPatientSpecialtyRS",
                                      pList,
                                      out ds);
        return(status);
    }
Esempio n. 4
0
    /// <summary>
    /// US:1882 Check to see if we have a valid MDWS connection
    /// </summary>
    /// <returns></returns>
    public CStatus CheckMDWSConnection()
    {
        //performing a simple operation in MDWS
        //to make sure we are still connected.

        CStatus status = new CStatus();

        //todo: forcing a disconnect for testing
        //GetMDWSSOAPClient().disconnect();

        CMDWSOps ops    = new CMDWSOps(this);
        long     lCount = 0;

        status = ops.GetMDWSSecurityKeys(UserID, false, out lCount);

        if (!status.Status)
        {
            long             lUserID        = 0;
            EmrSvcSoapClient mdwsSOAPClient = null;
            status = ops.MDWSLogin(MDWSUID.ToString(),
                                   MDWSPWD.ToString(),
                                   SiteID,
                                   out lUserID,
                                   out mdwsSOAPClient);
        }


        return(status);
    }
Esempio n. 5
0
    /// <summary>
    /// does the user have a security keys by key name
    /// </summary>
    /// <param name="ds"></param>
    /// <returns></returns>
    public bool HasSecurityKey(long lUserID,
                               string strKeyName)
    {
        //initialize parameters
        DataSet ds     = null;
        CStatus status = new CStatus();

        //transfer from MDWS if needed
        if (MDWSTransfer)
        {
            long     lCount = 0;
            CMDWSOps ops    = new CMDWSOps(this);
            status = ops.GetMDWSSecurityKeys(lUserID,
                                             true,
                                             out lCount);
            if (!status.Status)
            {
                return(false);
            }
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(base.SessionID,
                                                  base.ClientIP,
                                                  base.UserID);

        pList.AddInputParameter("pi_vSecurityKeyName", strKeyName.Trim().ToUpper());

        //get the dataset
        CDataSet cds = new CDataSet();

        status = cds.GetOracleDataSet(base.DBConn,
                                      "PCK_SECURITY_KEY.GetSecurityKeyByNameRS",
                                      pList,
                                      out ds);

        if (!status.Status)
        {
            return(false);
        }

        string strKey = CDataUtils.GetDSStringValue(ds, "security_key_name");

        if (!String.IsNullOrEmpty(strKey))
        {
            if (strKey.Trim().ToLower() == strKeyName.Trim().ToLower())
            {
                return(true);
            }
        }

        return(false);
    }
Esempio n. 6
0
    /// <summary>
    ///US:852 gets lab tests matching search criteria
    /// </summary>
    /// <param name="strSearch"></param>
    /// <param name="ds"></param>
    /// <returns></returns>
    public CStatus GetLabTestDS(string strSearch,
                                out DataSet ds)
    {
        //initialize parameters
        ds = null;
        CStatus status = new CStatus();

        //transfer from MDWS if needed
        if (MDWSTransfer)
        {
            CMDWSOps ops = new CMDWSOps(this);
            status = ops.GetMDWSLabTests(strSearch);
            if (!status.Status)
            {
                return(status);
            }
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(base.SessionID,
                                                  base.ClientIP,
                                                  base.UserID);

        pList.AddInputParameter("pi_vSearch", strSearch);

        //get the dataset
        CDataSet cds = new CDataSet();

        status = cds.GetOracleDataSet(base.DBConn,
                                      "PCK_LAB.GetLabTestRS",
                                      pList,
                                      out ds);

        //todo: testing

        /*foreach (DataTable table in ds.Tables)
         * {
         *  foreach (DataRow dr in table.Rows)
         *  {
         *      string str = Convert.ToString(dr["lab_test_name"]);
         *      str += "";
         *  }
         *
         * }*/

        return(status);
    }
Esempio n. 7
0
    /// <summary>
    /// gets a dataset of user by last name and first name search criteria
    /// </summary>
    /// <param name="strLastName"></param>
    /// <param name="strFirstName"></param>
    /// <param name="ds"></param>
    /// <returns></returns>
    public CStatus GetUserDS(string strLastName,
                             string strFirstName,
                             out DataSet ds)
    {
        //initialize parameters
        ds = null;
        CStatus status = new CStatus();

        //transfer from MDWS if needed
        if (base.MDWSTransfer)
        {
            string strSearch = "";
            strSearch += strLastName;
            if (!String.IsNullOrEmpty(strFirstName))
            {
                strSearch += "," + strFirstName;
            }

            CMDWSOps ops = new CMDWSOps(this);
            status = ops.GetMDWSUsers(strSearch);

            //todo
            //if (!status.Status)
            //{
            //    return status;
            //}
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(base.SessionID,
                                                  base.ClientIP,
                                                  base.UserID);

        pList.AddInputParameter("pi_vLastName", strLastName);
        pList.AddInputParameter("pi_vFirstName", strFirstName);

        //get the dataset
        CDataSet cds = new CDataSet();

        status = cds.GetOracleDataSet(base.DBConn,
                                      "PCK_USR.GetUserRS",
                                      pList,
                                      out ds);
        return(status);
    }
Esempio n. 8
0
    /// <summary>
    /// get user patient ds
    /// </summary>
    /// <param name="lUserID"></param>
    /// <param name="ds"></param>
    /// <returns></returns>
    public CStatus GetUserPatientDS(long lUserID, out DataSet ds)
    {
        //initialize parameters
        ds = null;

        CStatus status = DBConnValid();

        if (!status.Status)
        {
            return(status);
        }

        //transfer patients from MDWS if we need to
        long lCount = 0;

        if (MDWSTransfer)
        {
            CMDWSOps MDWSOps = new CMDWSOps(this);
            status = MDWSOps.GetMDWSUserPatients(lUserID, out lCount);
            if (!status.Status)
            {
                return(status);
            }
        }

        //load the paramaters list
        CParameterList pList = new CParameterList(SessionID, ClientIP, UserID);

        pList.AddInputParameter("pi_nProviderUserID", lUserID);

        //get the dataset
        CDataSet cds = new CDataSet();

        return(cds.GetOracleDataSet(
                   DBConn,
                   "PCK_PATIENT.GetUserPatientsRS",
                   pList,
                   out ds));
    }
Esempio n. 9
0
    /// <summary>
    /// method
    /// US:838
    /// retrieves a dataset of patients matching search criteria
    /// </summary>
    /// <param name="dtEventStartDate"></param>
    /// <param name="dtEventEndDate"></param>
    /// <param name="strLastName"></param>
    /// <param name="strLSSN"></param>
    /// <param name="lChecklistID"></param>
    /// <param name="lChecklistStatusID"></param>
    /// <param name="strTeamIDs"></param>
    /// <param name="strWardIDs"></param>
    /// <param name="strSpecialtyIDs"></param>
    /// <param name="strClinicIDs"></param>
    /// <param name="ds"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus GetPatientSearchDS(
        DateTime dtEventStartDate,
        DateTime dtEventEndDate,
        string strLastName,
        string strLSSN,
        long lChecklistID,
        long lChecklistStatusID,
        string strUsrID,
        string strTeamID,
        string strWardID,
        string strSpecialtyID,
        string strClinicID,
        long lServiceID,
        out DataSet ds)
    {
        //initialize parameters
        ds = null;

        CStatus status = DBConnValid();

        if (!status.Status)
        {
            return(status);
        }

        //move patients from MDWS if needed
        if (MDWSTransfer)
        {
            string strMatch = String.Empty;
            if (!String.IsNullOrEmpty(strLSSN))
            {
                strMatch = strLSSN;
            }
            else
            {
                if (!String.IsNullOrEmpty(strLastName))
                {
                    strMatch = strLastName;
                }
            }

            if (!String.IsNullOrEmpty(strMatch))
            {
                long     lCount = 0;
                CMDWSOps ops    = new CMDWSOps(this);
                ops.GetMDWSMatchPatients(strMatch, out lCount);
            }
        }


        //load the paramaters list
        CParameterList pList = new CParameterList(SessionID, ClientIP, UserID);

        pList.AddInputParameter("pi_dtEventStartDate", dtEventStartDate);
        pList.AddInputParameter("pi_dtEventEndDate", dtEventEndDate);
        pList.AddInputParameter("pi_vLastName", strLastName);
        pList.AddInputParameter("pi_vLSSN", strLSSN);
        pList.AddInputParameter("pi_nChecklistID", lChecklistID);
        pList.AddInputParameter("pi_nChecklistStatusID", lChecklistStatusID);
        pList.AddInputParameter("pi_vUsrID", strUsrID);
        pList.AddInputParameter("pi_vTeamID", strTeamID);
        pList.AddInputParameter("pi_vWardID", strWardID);
        pList.AddInputParameter("pi_vSpecialtyID", strSpecialtyID);
        pList.AddInputParameter("pi_vClinicID", strClinicID);
        pList.AddInputParameter("pi_nServiceID", lServiceID);

        //get the dataset
        CDataSet cds = new CDataSet();

        return(cds.GetOracleDataSet(
                   DBConn,
                   "PCK_PATIENT.GetPatientSearchRS",
                   pList,
                   out ds));
    }
Esempio n. 10
0
    /// <summary>
    /// US:840 US:1882 US:836 US:866
    /// login to the checklist tool
    /// </summary>
    /// <param name="strUID"></param>
    /// <param name="strPWD"></param>
    /// <returns></returns>
    public CStatus Login(string strUID,
                         string strPWD,
                         long lSiteID)
    {
        //status
        CStatus status  = new CStatus();
        long    lUserID = 0;

        LoggedIn = false;

        //login to mdws if we are connecting to mdws
        if (MDWSTransfer)
        {
            EmrSvcSoapClient mdwsSOAPClient = null;
            CMDWSOps         ops            = new CMDWSOps(this);
            status = ops.MDWSLogin(
                strUID,
                strPWD,
                lSiteID,
                out lUserID,
                out mdwsSOAPClient);

            if (status.Status)
            {
                //create the session record
                UserID = lUserID;
                CUserData ud             = new CUserData(this);
                string    strFXSessionID = String.Empty;
                status = ud.CreateFXSession(out strFXSessionID);
                if (!status.Status)
                {
                    return(status);
                }

                //load the rest of the user data
                status = LoadUserData(lUserID);
                if (!status.Status)
                {
                    return(status);
                }

                //we are loged in at this point
                LoggedIn = true;

                //cache the encrypted login credentials so that we can re-login if
                //we timeout from MDWS.
                MDWSUID = strUID;
                MDWSPWD = strPWD;
                SiteID  = lSiteID;
            }

            return(status);
        }

        //simple login
        long lRoleID = 0;

        DataSet   ds  = null;
        CUserData cud = new CUserData(this);

        status = cud.GetLoginUserDS(
            strUID,
            strPWD,
            out ds,
            out lUserID,
            out lRoleID);
        if (status.Status)
        {
            //create the session record
            UserID = lUserID;
            CUserData ud             = new CUserData(this);
            string    strFXSessionID = String.Empty;
            status = ud.CreateFXSession(out strFXSessionID);
            if (!status.Status)
            {
                return(status);
            }

            //load the rest of the user date
            status = LoadUserData(lUserID);
            if (!status.Status)
            {
                return(status);
            }

            //we are loged in at this point
            LoggedIn = true;
        }

        return(status);
    }
Esempio n. 11
0
    /// <summary>
    /// US:866 Load the user data from the database
    /// </summary>
    /// <param name="lUserID"></param>
    /// <returns></returns>
    private CStatus LoadUserData(long lUserID)
    {
        DataSet ds = null;

        CUserData cud    = new CUserData(this);
        CStatus   status = cud.GetUserDS(lUserID, out ds);

        if (status.Status)
        {
            //cach the date the user logged in
            UserLoginDateTime = DateTime.Now;

            //cache the user id, role id, first name and last name
            UserID        = lUserID;
            UserRoleID    = CDataUtils.GetDSLongValue(ds, "user_role_id");
            UserFirstName = CDataUtils.GetDSStringValue(ds, "first_name");
            UserLastName  = CDataUtils.GetDSStringValue(ds, "last_name");
        }
        else
        {
            return(status);
        }

        //transfer user keys to our db
        if (MDWSTransfer)
        {
            CMDWSOps ops    = new CMDWSOps(this);
            long     lCount = 0;
            status = ops.GetMDWSSecurityKeys(lUserID, true, out lCount);
            if (!status.Status)
            {
                return(status);
            }
        }

        //set the admin, doc and nurse privs for this user
        DataSet dsRoles = null;

        status = cud.GetUserRolesDS(lUserID, out dsRoles);
        if (status.Status)
        {
            foreach (DataTable table in dsRoles.Tables)
            {
                foreach (DataRow dr in table.Rows)
                {
                    long lRoleID = CDataUtils.GetDSLongValue(dr, "USER_ROLE_ID");
                    if (lRoleID == (long)k_USER_ROLE_ID.Administrator)
                    {
                        IsAdministrator = true;
                    }
                    else if (lRoleID == (long)k_USER_ROLE_ID.Doctor)
                    {
                        IsDoctor = true;
                    }
                    else if (lRoleID == (long)k_USER_ROLE_ID.Nurse)
                    {
                        IsNurse = true;
                    }
                }
            }
        }

        return(status);
    }
Esempio n. 12
0
    /// <summary>
    /// US:834 Connect to the database using info from the
    /// app.config file will also load a CData object for use
    /// by other data classes and setup the connectsion to MDWS and
    /// return a mdwsSOAPClient for accessing MDWD methods
    /// </summary>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus Connect(out CData data,
                           out EmrSvcSoapClient mdwsSOAPClient)
    {
        data           = null;
        mdwsSOAPClient = null;

        //initialize parameters
        string strConnString = String.Empty;
        bool   bAudit        = false;

        //get the connection info from the web.config
        CStatus status = new CStatus();

        status = GetConnectionInfo(out strConnString, out bAudit);
        if (!status.Status)
        {
            return(status);
        }

        //Connect to the db, if successful caller can use the
        //CDataConnection::Conn property for access to the DB connection
        status = Connect(strConnString, bAudit);
        if (!status.Status)
        {
            //todo handle error
            return(status);
        }

        //create a new base data object
        //todo: more later
        //
        //get the ipaddress
        string      strIPAddress = String.Empty;
        string      strHost      = System.Net.Dns.GetHostName();
        IPHostEntry host;

        host = Dns.GetHostEntry(strHost);
        foreach (IPAddress ip in host.AddressList)
        {
            strIPAddress = ip.ToString();
        }

        //build the base data item used by data classes
        string strNow = CDataUtils.GetDateTimeAsString(DateTime.Now);

        data = new CData(this,
                         strIPAddress,
                         0,
                         "VAPPCTCOMM_" + strNow,
                         null,
                         true);

        //comm data class
        CVAPPCTCommData commData = new CVAPPCTCommData(data);

        //login to MDWS
        long     lUserID = 0;
        CMDWSOps ops     = new CMDWSOps(data);

        //uid and pwd need come from config file:
        //TODO: they need to be encrypted
        status = ops.MDWSLogin(ConfigurationSettings.AppSettings["MDWSEmrSvcUID"],
                               ConfigurationSettings.AppSettings["MDWSEmrSvcPWD"],
                               CDataUtils.ToLong(ConfigurationSettings.AppSettings["MDWSEmrSvcSiteList"]),
                               out lUserID,
                               out mdwsSOAPClient);
        if (!status.Status)
        {
            commData.SaveCommEvent("MDWSLogin_FAILED",
                                   status.StatusComment);
            return(status);
        }

        //set the user id on the CData object
        data.UserID = lUserID;

        //create the session so that we can call stored proc
        CUserData ud             = new CUserData(data);
        string    strFXSessionID = String.Empty;

        status = ud.CreateFXSession(out strFXSessionID);
        if (!status.Status)
        {
            commData.SaveCommEvent("MDWSSessionCreate_FAILED",
                                   status.StatusComment);
            return(status);
        }

        return(status);
    }