Exemple #1
0
    /// <summary>
    /// audits page access and determines whether the user is allowed access
    /// </summary>
    /// <param name="strPageName"></param>
    /// <returns></returns>
    public bool AuditPageAccess(string strPageName)
    {
        CStatus   status = new CStatus();
        CUserData ud     = new CUserData(this);

        status = ud.AuditPageAccess(strPageName);
        return(status.Status);
    }
    private static int SetPara(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        Dictionary <string, string> dicPara = (Dictionary <string, string>)LuaScriptMgr.GetNetObject(L, 1, typeof(Dictionary <string, string>));

        CUserData.SetPara(dicPara);
        return(0);
    }
    private static int setUserInfo(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        CUserData     data = (CUserData)LuaScriptMgr.GetNetObjectSelf(L, 1, "com.tencent.pandora.CUserData");
        CUserInfoData u    = (CUserInfoData)LuaScriptMgr.GetNetObject(L, 2, typeof(CUserInfoData));

        data.setUserInfo(u);
        return(0);
    }
 private static int _Createcom_tencent_pandora_CUserData(IntPtr L)
 {
     if (LuaDLL.lua_gettop(L) == 0)
     {
         CUserData o = new CUserData();
         LuaScriptMgr.PushObject(L, o);
         return(1);
     }
     LuaDLL.luaL_error(L, "invalid arguments to method: com.tencent.pandora.CUserData.New");
     return(0);
 }
Exemple #5
0
    /// <summary>
    /// Generates the TIU text for a patient checklist
    /// </summary>
    /// <param name="strPatientID"></param>
    /// <param name="lPatCLID"></param>
    /// <param name="strText"></param>
    /// <returns></returns>
    public CStatus GetTIUText(string strPatientID,
                              long lPatCLID,
                              out string strNoteTitleTag,
                              out string strText)
    {
        strText         = string.Empty;
        strNoteTitleTag = string.Empty;

        CStatus status = new CStatus();

        //patient data - get the di just in case we need more than the blurb
        CPatientDataItem diPat   = new CPatientDataItem();
        CPatientData     patData = new CPatientData(this);

        status = patData.GetPatientDI(strPatientID, out diPat);

        //get the patient blurb
        string strBlurb = String.Empty;

        patData.GetPatientBlurb(strPatientID, out strBlurb);

        //build the TIU note text...

        //legend
        strText += "Definitions:\r\n";

        //ts
        strText += CDataUtils.DelimitString("TS = The temporal state of an attribute defines whether the patient has had the test or event within a given time period",
                                            "\r\n",
                                            80);
        strText += "\r\n";

        //os
        strText += CDataUtils.DelimitString("OS = The outcome state of an attribute defines the resultant state of an attribute (e.g. normal, abnormal, problem/decision required)",
                                            "\r\n",
                                            80);
        strText += "\r\n";

        //ds
        strText += CDataUtils.DelimitString("DS = The decision state of an attribute defines a rule-based state of an attribute (e.g. Go, No-Go)",
                                            "\r\n",
                                            80);

        strText += "\r\n";


        strText += "\r\n";

        DateTime dtNoteDate  = DateTime.Now;
        string   strNoteDate = CDataUtils.GetDateTimeAsString(dtNoteDate);

        strText += "Date: " + strNoteDate;
        strText += "\r\n\r\n";

        //--demographics
        strText += CDataUtils.DelimitString(strBlurb, "\r\n", 80);
        strText += "\r\n";

        //patient checklist data
        CPatChecklistDataItem diPatChecklist = new CPatChecklistDataItem();

        status = GetPatChecklistDI(lPatCLID, out diPatChecklist);

        //checklist data
        CChecklistDataItem diChecklist = new CChecklistDataItem();
        CChecklistData     clData      = new CChecklistData(this);

        status = clData.GetCheckListDI(diPatChecklist.ChecklistID, out diChecklist);

        //get the note title tag for the checklist, this is used to
        //write the correct note to MDWS
        strNoteTitleTag = diChecklist.NoteTitleTag;

        //--Checklist Name
        strText += "Checklist: ";
        strText += CDataUtils.DelimitString(diChecklist.ChecklistLabel, "\r\n", 80);
        strText += "\r\n";

        //--Procedure Date
        strText += "Procedure Date: ";
        if (!CDataUtils.IsDateNull(diPatChecklist.ProcedureDate))
        {
            strText += CDataUtils.GetDateAsString(diPatChecklist.ProcedureDate);
        }
        else
        {
            strText += "None";
        }
        strText += "\r\n\r\n";

        //patient checklist items and overall state
        long    lColTSStateID       = 0;
        long    lColOSStateID       = 0;
        long    lColDSStateID       = 0;
        long    lSummaryStateID     = 0;
        DataSet dsItems             = null;
        CPatChecklistItemData diCLI = new CPatChecklistItemData(this);

        status = diCLI.GetPatCLItemsByPatCLIDDS(lPatCLID,
                                                out lColTSStateID,
                                                out lColOSStateID,
                                                out lColDSStateID,
                                                out lSummaryStateID,
                                                out dsItems);
        //--overall Checklist state
        string strOverallState = "Unknown";

        switch (lSummaryStateID)
        {
        case (long)k_STATE_ID.Bad:
            strOverallState = "Bad";
            break;

        case (long)k_STATE_ID.Good:
            strOverallState = "Good";
            break;
        }

        strText += "Overall Checklist State: ";
        strText += strOverallState;
        strText += "\r\n\r\n";

        strText += "Checklist Items:";
        strText += "\r\n\r\n";

        //loop over checklist items
        foreach (DataTable table in dsItems.Tables)
        {
            foreach (DataRow dr in table.Rows)
            {
                CPatChecklistItemDataItem itm = new CPatChecklistItemDataItem(dr);
                if (itm != null)
                {
                    //get the data for the item
                    CItemDataItem idi     = new CItemDataItem();
                    CItemData     itmData = new CItemData(this);

                    itmData.GetItemDI(itm.ItemID, out idi);
                    strText += CDataUtils.DelimitString("* " + idi.ItemLabel, "\r\n", 80);
                    strText += "\r\n";

                    //temporal state
                    CTemporalStateDataItem diTSi = new CTemporalStateDataItem();
                    CTemporalStateData     tsdi  = new CTemporalStateData(this);
                    tsdi.GetTemporalStateDI(itm.TSID, out diTSi);
                    strText += "TS: ";
                    strText += CDataUtils.DelimitString(diTSi.TSLabel, "\r\n", 80);
                    strText += "  ";

                    //outcome state
                    COutcomeStateDataItem diOSi = new COutcomeStateDataItem();
                    COutcomeStateData     osdi  = new COutcomeStateData(this);
                    osdi.GetOutcomeStateDI(itm.OSID, out diOSi);
                    strText += "OS: ";
                    strText += CDataUtils.DelimitString(diOSi.OSLabel, "\r\n", 80);
                    strText += " ";

                    //decision state
                    CDecisionStateDataItem diDSi = new CDecisionStateDataItem();
                    CDecisionStateData     dsdi  = new CDecisionStateData(this);
                    dsdi.GetDecisionStateDI(itm.DSID, out diDSi);

                    string strDS = String.Empty;
                    strDS += "DS: ";
                    strDS += diDSi.DSLabel;

                    //if decision state is overriden pull out the
                    //last comment
                    if (itm.IsOverridden == k_TRUE_FALSE_ID.True)
                    {
                        DataSet dsComments = null;

                        //todo: override history is now stored in a diff table
                        //this is obsolete will delete after testing
                        //status = diCLI.GetPatientItemCommmentDS(
                        //    itm.PatCLID,
                        //    itm.ItemID,
                        //    out dsComments);

                        status = diCLI.GetPatItemOverrideCommmentDS(itm.PatCLID,
                                                                    itm.ChecklistID,
                                                                    itm.ItemID,
                                                                    out dsComments);
                        //first record is the newest comment
                        if (!CDataUtils.IsEmpty(dsComments))
                        {
                            //string strComment = CDataUtils.GetDSStringValue(dsComments, "comment_text");
                            //DateTime dtComment = CDataUtils.GetDSDateTimeValue(dsComments, "comment_date");
                            //
                            string   strComment     = CDataUtils.GetDSStringValue(dsComments, "override_comment");
                            DateTime dtComment      = CDataUtils.GetDSDateTimeValue(dsComments, "override_date");
                            long     lCommentUserID = CDataUtils.GetDSLongValue(dsComments, "user_id");

                            DataSet   dsUser = null;
                            CUserData ud     = new CUserData(this);
                            ud.GetUserDS(lCommentUserID, out dsUser);
                            string strUser = String.Empty;
                            if (!CDataUtils.IsEmpty(dsUser))
                            {
                                strUser = CDataUtils.GetDSStringValue(dsUser, "name");
                            }

                            strDS += " Overridden ";
                            strDS += CDataUtils.GetDateAsString(dtComment);
                            strDS += " ";
                            strDS += strUser;
                            strDS += "\r\n\r\n";

                            strDS += strComment;
                        }
                    }

                    //ds
                    strText += CDataUtils.DelimitString(strDS, "\r\n", 80);

                    strText += "\r\n\r\n";
                }
            }
        }

        return(status);
    }
Exemple #6
0
    /// <summary>
    /// US:836 US:1882 this is the proper place to do initialization in a master page
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Init(object sender, EventArgs e)
    {
        CStatus status = new CStatus();

        //Returns a string that can be used in a client
        //event to cause postback to the server.
        Page.ClientScript.GetPostBackEventReference(this, String.Empty);

        //set the character set, since all pages derive from basemaster
        //this will set the encoding for all pages...
        Response.ContentEncoding = Encoding.UTF8;

        //is MDWS on?
        MDWSTransfer = false;
        if (System.Configuration.ConfigurationManager.AppSettings["MDWSTransfer"] != null)
        {
            string strMDWS = System.Configuration.ConfigurationManager.AppSettings["MDWSTransfer"].ToString();
            if (strMDWS == "1")
            {
                MDWSTransfer = true;
            }
        }

        //connect to the data source
        if (m_DBConn != null)
        {
            status = m_DBConn.Connect();
            if (!status.Status)
            {
                //redirect to an error page
                Response.Redirect("ep_error_page.htm");
                Response.End();
            }
        }

        //one and only basedata, used as a base class for all
        //data items. allows us to share data classes from
        //VAPPCT.Data
        BaseData = new CData(DBConn,
                             ClientIP,
                             UserID,
                             SessionID,
                             Session,
                             MDWSTransfer);

        //one and only appuser holds data in session state
        AppUser = new CAppUser(BaseData);

        //because basedata gets set before appuser and
        //app user id is stored in session state we must
        //set it here again to avoid a 0 user id if the
        //user is logged in...
        BaseData.UserID = AppUser.UserID;

        //timeout for the application is 20 minutes
        Session.Timeout = TimeOutInMinutes;

        //check for a valid session
        if (AppUser.LoggedIn)
        {
            CUserData ud = new CUserData(BaseData);
            status = ud.CheckFXSession();
            if (!status.Status)
            {
                LogOff();
                return;
            }
        }

        //if we are not logged in and not on the home page
        //redirct to the home page...
        if (!AppUser.LoggedIn)
        {
            if (GetPageName().ToLower() != "vappcthome.aspx")
            {
                Response.Redirect("VAPPCTHome.aspx");
            }
        }
        else
        {
            //if we are logged in but not connected to mdws
            //then reconnect
            if (MDWSTransfer)
            {
                CStatus s = new CStatus();
                s = AppUser.CheckMDWSConnection();
            }
        }


        //if the user does not have access to this page
        //then logg them off
        if (GetPageName().ToLower() != "vappcthome.aspx")
        {
            if (!AppUser.AuditPageAccess(GetPageName()))
            {
                LogOff();
            }
        }
    }
Exemple #7
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);
    }
Exemple #8
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);
    }
Exemple #9
0
    /// <summary>
    /// event
    /// US:838
    /// handler for the Search button for filtering the options list.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSearchOptions_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(rblOptions.SelectedValue))
        {
            //clear current options
            lbOptions.Items.Clear();

            string strValue = rblOptions.SelectedValue;
            if (strValue == OPTION_PROVIDERS)
            {
                string strSearch    = txtSearchOptions.Text;
                string strFirstName = string.Empty;
                string strLastName  = string.Empty;

                string[] splitSearch = strSearch.Split(',');
                if (splitSearch.Length > 0)
                {
                    strLastName = splitSearch[0];
                }
                if (splitSearch.Length > 1)
                {
                    strFirstName = splitSearch[1];
                }

                if (strLastName.Length < 3)
                {
                    ShowStatusInfo(new CStatus(false, k_STATUS_CODE.Failed, "Please enter at least 3 characters to search for"));
                    return;
                }

                //1=providers
                //get the dataset from our db
                DataSet   dsUsers = null;
                CUserData ud      = new CUserData(BaseMstr.BaseData);
                CStatus   status  = ud.GetUserDS(strLastName, strFirstName, out dsUsers);

                CListBox lb = new CListBox();
                lb.RenderDataSet(dsUsers,
                                 lbOptions,
                                 "",
                                 "LAST_NAME,FIRST_NAME",
                                 "USER_ID");
            }
            else if (strValue == OPTION_TEAMS)
            {
                //load the team lb
                LoadOptionsListBox(false);
                //filter the listbox using helper
                CListBox clb = new CListBox();
                clb.FilterListBox(lbOptions, txtSearchOptions.Text);
            }
            else if (strValue == OPTION_SPECIALTIES)
            {
                //load the specialties lb
                LoadOptionsListBox(false);
                //filter the listbox using helper
                CListBox clb = new CListBox();
                clb.FilterListBox(lbOptions, txtSearchOptions.Text);
            }
            else if (strValue == OPTION_CLINICS)
            {
            }
            else if (strValue == OPTION_WARDS)
            {
                //load the wards lb
                LoadOptionsListBox(false);
                //filter the listbox using helper
                CListBox clb = new CListBox();
                clb.FilterListBox(lbOptions, txtSearchOptions.Text);
            }
        }
    }
Exemple #10
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);
    }