Exemple #1
0
    protected void btnUpdateInfo_Click(object sender, EventArgs e)
    {
        CEncounter enc        = new CEncounter();
        long       lInches    = 0;
        long       lFeet      = 0;
        long       lPatHeight = 0;
        long       lPatWeight = 0;

        if (cboFeet.SelectedIndex > 0)
        {
            lFeet = Convert.ToInt32(cboFeet.SelectedValue) * 12;
        }

        if (cboInches.SelectedIndex > 0)
        {
            lInches = Convert.ToInt32(cboInches.SelectedValue);
        }

        lPatHeight           = lFeet + lInches;
        Master.PatientHeight = lPatHeight;

        if (txtWeight.Text.Trim().Length > 0)
        {
            lPatWeight = Convert.ToInt32(txtWeight.Text.Trim());
        }

        Master.PatientWeight = lPatWeight;

        //update patient details
        enc.UpdatePatientDetails(Master, Master.SelectedEncounterID, lPatHeight, lPatWeight);

        GetPatientDetails();

        ScriptManager.RegisterStartupScript(upUpdatePatInfo, typeof(string), "updateinfo", "var hasWightHeight = " + HasWeightHeight.ToString().ToLower() + ";", true);
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CEncounter enc = new CEncounter();
        if (!IsPostBack)
        {
            if (String.IsNullOrEmpty(Master.SelectedEncounterID) || String.IsNullOrEmpty(Master.SelectedPatientID))
            {
                Server.Transfer("Default.aspx");
            }

            //check if module is assigned
            if (!String.IsNullOrEmpty(Master.SelectedPatientID))
            {
                if (!enc.IsModuleAssigned(Master, lMID))
                {
                    Server.Transfer("Default.aspx");
                }
            }
        }

        //get module group id
        if (Request.QueryString["grp"] != null)
        {
            lGRP = Convert.ToInt32(Request.QueryString["grp"]);
        }

        lEncIntakeID = enc.GetEncIntakeId(Master, lMID);

        btnSubmit.Attributes.Add("onclick", "return questions.validateResponses();");
    }
Exemple #3
0
    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
        CEncounter enc = new CEncounter();

        string strAllResponse = String.Empty;
        string strQResponse = String.Empty;
        Int32 nCount = 0;

        String strResponseCount = Request.Form["ResponseCount"];
        if (strResponseCount != null)
        {
            nCount = Convert.ToInt32(strResponseCount);
        }
        else
        {
            //ERROR
            return;
        }

        long nScore = 0;

        //loop thru the responses
        for (int a = 1; a < nCount; a++)
        {
            //get responses controls
            string strRadio = "grpRadio_" + a.ToString();

            //get radio response
            if (Request.Form[strRadio] != null)
            {
                string[] splitResponse = Request.Form[strRadio].Split(new Char[] { '|' });
                strQResponse += enc.GetRecordForInsert(splitResponse);
                nScore += Convert.ToInt64(splitResponse[2]);
            }


            strAllResponse += strQResponse;
            strQResponse = null;
        }


        // Write responses
        if (enc.WriteIntakeResponses(Master, Master.SelectedEncounterID, lEncIntakeID, lMID, lGRP, strAllResponse) == false)
        {
            return;
        }

        long lScoreType = 3002;
        if (Score(lEncIntakeID, lMID, nScore, lScoreType) == false)
        {
            return;
        }

        //mark module complete
        if (enc.CompleteModule(Master, lMID, lGRP))
        {
            Response.Redirect("patient_assessment.aspx");
        }
    }
Exemple #4
0
 public CVerticalMenu(BaseMaster BaseMstr, DataSet dsTreatments, DataSet dsEncounters, DataSet dsIntakes)
 {
     m_BaseMstr         = BaseMstr;
     m_dsTreatments     = dsTreatments;
     m_dsEncounters     = dsEncounters;
     m_dsAssessments    = dsIntakes;
     usrsec             = new CSec();
     enctype            = new CEncounter();
     m_dsEncounterTypes = enctype.GetAllEncounterTypesDS(BaseMstr);
 }
Exemple #5
0
    //Load problem list dataset
    protected void LoadProblemList()
    {
        CEncounter enc = new CEncounter();

        if (Session["PROBLEMS_LIST_DS"] == null)
        {
            Session["PROBLEMS_LIST_DS"] = tplan.GetTreatmentProblemDS(
                BaseMstr,
                BaseMstr.SelectedPatientID,
                BaseMstr.SelectedTreatmentID);
        }
        dsProblemList = (DataSet)Session["PROBLEMS_LIST_DS"];
    }
Exemple #6
0
    protected void CheckModuleGroupStatus(BaseMaster BaseMstr)
    {
        CPatientEvent evt = new CPatientEvent(BaseMstr);

        CEncounter enc    = new CEncounter();
        DataSet    dsGrps = enc.GetModuleGroupStatusDS(BaseMstr);
        DataSet    dsEvts = evt.GetPatientEventsDS();
        bool       bRedirectToBaselineScreen = false;

        if (dsGrps != null)
        {
            foreach (DataTable dt in dsGrps.Tables)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    long lEventID = 0;
                    long lPending = 1;

                    if (!dr.IsNull("EVENT_ID"))
                    {
                        lEventID = Convert.ToInt32(dr["EVENT_ID"]);
                    }

                    if (!dr.IsNull("PENDING"))
                    {
                        lPending = Convert.ToInt32(dr["PENDING"]);
                    }

                    if (lPending == 0 && lEventID != 0)
                    {
                        if (lEventID == _BASELINE_INTAKES_EVENT)
                        {
                            bRedirectToBaselineScreen = !IsBaselineMarkedCompleted(dsEvts, _BASELINE_INTAKES_EVENT);
                        }
                        evt.CompletedEvent(lEventID);
                    }
                }
            }

            if (bRedirectToBaselineScreen)
            {
                Response.Redirect("portal_start.aspx");
            }
        }
    }
Exemple #7
0
    protected void GetCreateSelfMgntEncounter(BaseMaster BaseMstr)
    {
        CDataUtils utils = new CDataUtils();
        CEncounter enc   = new CEncounter();
        DataSet    dsEnc = enc.GetSelfMgntEncounterDS(BaseMstr);
        string     strNewEncounterID;

        if (dsEnc != null)
        {
            string strEncounterID = utils.GetStringValueFromDS(dsEnc, "ENCOUNTER_ID");
            if (!String.IsNullOrEmpty(strEncounterID))
            {
                BaseMstr.SelectedEncounterID = strEncounterID;

                //Check if the module group is complete -> trigger event
                CheckModuleGroupStatus(BaseMstr);

                //If no more pending modules, close the encounter
                enc.CloseSelfMgntEncounter(BaseMstr, BaseMstr.SelectedEncounterID);
            }
            else
            {
                if (HasPendingModules(Master))
                {
                    if (enc.CreateSelfMgntEncounter(BaseMstr, out strNewEncounterID))
                    {
                        BaseMstr.SelectedEncounterID = strNewEncounterID;
                    }
                }
            }
        }
        else
        {
            if (HasPendingModules(Master))
            {
                if (enc.CreateSelfMgntEncounter(BaseMstr, out strNewEncounterID))
                {
                    BaseMstr.SelectedEncounterID = strNewEncounterID;
                }
            }
        }
    }
Exemple #8
0
    protected bool HasPendingModules(BaseMaster BaseMstr)
    {
        long       lPending = 0;
        CEncounter enc      = new CEncounter();
        DataSet    dsEnc    = enc.GetModuleGroupStatusDS(BaseMstr);

        if (dsEnc != null)
        {
            foreach (DataTable dt in dsEnc.Tables)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    if (!dr.IsNull("PENDING"))
                    {
                        lPending += Convert.ToInt32(dr["PENDING"]);
                    }
                }
            }
        }
        return(lPending > 0);
    }
Exemple #9
0
    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
        CEncounter enc = new CEncounter();

        string strAllResponse = String.Empty;
        string strQResponse = String.Empty;

        for (int a = 1; a <= nQuestionCount; a++)
        {
            // build name attribute string to retrieve selected responses
            string strRadio = "grpRadio_" + a.ToString();

            if (Request.Form[strRadio] != null)
            {
                string[] splitResponse = Request.Form[strRadio].Split(cSplitChars);
                strQResponse += enc.GetRecordForInsert(splitResponse);
            }

            strAllResponse += strQResponse;
            strQResponse = null;
        }

        if (!enc.WriteIntakeResponses(Master, Master.SelectedEncounterID, lEncIntakeID, lMID, lGRP, strAllResponse))
        {
            return;
        }

        if (!Score(lEncIntakeID, lMID, 3020))
        {
            return;
        }

        //mark module complete
        if (enc.CompleteModule(Master, lMID, lGRP))
        {
            Response.Redirect("patient_assessment.aspx");
        }
    }
    //toggle note's lock state
    protected void btnLockNote_OnClick(object sender, EventArgs e)
    {
        CEncounter encnote = new CEncounter();

        if (encnote.LockNote(BaseMstr,
                             BaseMstr.SelectedPatientID,
                             BaseMstr.SelectedEncounterID,
                             BaseMstr.SelectedTreatmentID))
        {
            Session["ENCOUNTERDS"]        = null;
            Session["ENCOUNTERS_LIST_DS"] = null;

            string strPostBackURL = "pat_encounter.aspx?op0=" + BaseMstr.SelectedPatientID;
            strPostBackURL += "&op1=" + BaseMstr.SelectedEncounterID;
            strPostBackURL += "&op2=" + BaseMstr.SelectedTreatmentID.ToString();

            Response.Redirect(strPostBackURL);
        }
        else
        {
            ShowSysFeedback();
        }
    }
Exemple #11
0
    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
        CEncounter enc = new CEncounter();

        string strAllResponse = String.Empty;
        string strQResponse = String.Empty;
        Int32 nCount = 0;

        String strResponseCount = Request.Form["ResponseCount"];
        if (strResponseCount != null)
        {
            nCount = Convert.ToInt32(strResponseCount);
        }
        else
        {
            //ERROR
            return;
        }

        long nScore = 0;

        //loop thru the responses
        for (int a = 1; a < nCount; a++)
        {
            String strResponse = null;
            String strRID = null;
            String strScore = null;

            int iQID = a;

            //get responses controls
            string strRadio = "grpRadio_" + iQID.ToString();
            string strCheckbox = "grpCheck_" + iQID.ToString();
            string strText = "grpCtrlText_" + iQID.ToString();
            string strHiddenText = "grpHidden_" + iQID.ToString();

            //get radio response
            if (Request.Form[strRadio] != null)
            {
                string[] splitResponse = Request.Form[strRadio].Split(new Char[] { '|' });
                strQResponse += enc.GetRecordForInsert(splitResponse);
            }

            //get checkbox response
            if (Request.Form[strCheckbox] != null)
            {
                string[] splitResponse = Request.Form[strCheckbox].Split(new Char[] { '|' });
                strQResponse += enc.GetRecordForInsert(splitResponse);
            }

            //get textbox response
            String strT = null;
            strT = Request.Form[strText];
            if (strT != null)
            {
                if (strT.Trim().Length > 0)
                {
                    String strH = null;
                    strH = Request.Form[strHiddenText];

                    if (String.IsNullOrEmpty(strH) == false)
                    {
                        string[] strHidden = Request.Form[strHiddenText].Split(new Char[] { '|' });
                        strQResponse += enc.GetRecordForInsert(strHidden, strT);
                    }
                }
            }


            strAllResponse += strQResponse;
            strQResponse = null;
        }


        // Write responses
        if (enc.WriteIntakeResponses(Master, Master.SelectedEncounterID, lEncIntakeID, lMID, lGRP, strAllResponse) == false)
        {
            return;
        }

        //mark module complete
        if (enc.CompleteModule(Master, lMID, lGRP))
        {
            Response.Redirect("patient_assessment.aspx");
        }
    }
Exemple #12
0
    protected void GetPatientDetails()
    {
        trEditInfo.Visible = true;
        trReadInfo.Visible = false;

        Session["PATIENT_DOB"]    = null;
        Session["PATIENT_AGE"]    = null;
        Session["PATIENT_GENDER"] = null;
        Session["PATIENT_WEIGHT"] = null;
        Session["PATIENT_HEIGHT"] = null;

        CDataUtils utils   = new CDataUtils();
        CPatient   patient = new CPatient();
        CEncounter enc     = new CEncounter();

        DataSet dsPat = patient.GetPatientDemographicsDS(Master);

        if (dsPat != null)
        {
            Master.PatientDOB    = Convert.ToDateTime(utils.GetDateValueAsStringFromDS(dsPat, "DOB"));
            Master.PatientAge    = utils.GetLongValueFromDS(dsPat, "PATIENT_AGE");
            Master.PatientGender = utils.GetStringValueFromDS(dsPat, "GENDER");
        }

        DataSet dsEnc = enc.GetPatientDetailsDS(Master, Master.SelectedEncounterID);

        if (dsEnc != null)
        {
            long lPatHeight = utils.GetLongValueFromDS(dsEnc, "PATIENT_HEIGHT");
            if (lPatHeight > 0)
            {
                int iFeet   = (int)lPatHeight / 12;
                int iInches = (int)lPatHeight % 12;

                lblPatHeight.Text      = iFeet.ToString() + "' - " + iInches.ToString() + "\"";
                htxtHeightFeet.Value   = iFeet.ToString();
                htxtHeightInches.Value = iInches.ToString();

                Master.PatientHeight = lPatHeight;

                foreach (ListItem li in cboFeet.Items)
                {
                    if (li.Value == iFeet.ToString())
                    {
                        li.Selected = true;
                    }
                }

                foreach (ListItem li in cboInches.Items)
                {
                    if (li.Value == iInches.ToString())
                    {
                        li.Selected = true;
                    }
                }
            }
            else
            {
                lblPatHeight.Text      = String.Empty;
                htxtHeightFeet.Value   = String.Empty;
                htxtHeightInches.Value = String.Empty;

                cboFeet.SelectedIndex   = 0;
                cboInches.SelectedIndex = 0;

                Master.PatientHeight = 0;
            }

            long lPatWeight = utils.GetLongValueFromDS(dsEnc, "PATIENT_WEIGHT");
            if (lPatWeight > 0)
            {
                txtWeight.Text = lPatWeight.ToString();

                lblPatWeight.Text      = lPatWeight.ToString() + " pounds";
                htxtWeightPounds.Value = lPatWeight.ToString();

                Master.PatientWeight = lPatWeight;
            }
            else
            {
                txtWeight.Text = String.Empty;

                lblPatWeight.Text      = String.Empty;
                htxtWeightPounds.Value = String.Empty;

                Master.PatientWeight = 0;
            }

            if (lPatHeight > 0 && lPatWeight > 0)
            {
                trEditInfo.Visible = false;
                trReadInfo.Visible = true;
                HasWeightHeight    = true;
            }
            else
            {
                trEditInfo.Visible = true;
                trReadInfo.Visible = false;
                HasWeightHeight    = false;
            }
        }
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //1. check to see if a patient is looked up
        if (Master.SelectedPatientID.Length < 1)
        {
            //should never be in this state but just in case...
            divStatus.InnerHtml  = "<font size='+0'>";
            divStatus.InnerHtml += "Please lookup a patient before creating a new encounter!";
            divStatus.InnerHtml += "</font>";
            return;
        }

        //requires the treatment id be passed in on the query string
        //requires the encounter type be passsed in on the query string
        if (Request.QueryString.Keys.Count < 2)
        {
            divStatus.InnerHtml  = "<font size='+0'>";
            divStatus.InnerHtml += "failed to create a new encounter!";
            divStatus.InnerHtml += "</font>";
            return;
        }

        //requires the treatment id be passed in on the query string
        Master.SelectedTreatmentID = Convert.ToInt32(Request.QueryString[0].ToString());

        //requires the encounter type be passsed in on the query string
        long lEncounterType = Convert.ToInt32(Request.QueryString[1].ToString());

        //create a new "other" encounter (this is all normal encs other than the initial one)
        string     strNewEnc = "";
        CEncounter enc       = new CEncounter();

        //Encounter Types
        //create an encounter - INITIAL_PHONE_CALL = 0, ONE_WEEK_FU = 1, ONE_MONTH_FU = 2, AFTER_1_MONTH_FU = 3,
        //THREE_MONTHS_FU = 4, AFTER_THREE_MONTHS_FU = 5, PHONE_CALL_FU = 6, SELF_MANAGEMENT = 99

        if ((lEncounterType == (long)ReVamp_EncounterType.INITIAL_EVALUATION) ||
            (lEncounterType == (long)ReVamp_EncounterType.INITIAL_PHONE_CALL) ||
            (lEncounterType == (long)ReVamp_EncounterType.ONE_WEEK_FU) ||
            (lEncounterType == (long)ReVamp_EncounterType.ONE_MONTH_FU) ||
            (lEncounterType == (long)ReVamp_EncounterType.AFTER_1_MONTH_FU) ||
            (lEncounterType == (long)ReVamp_EncounterType.THREE_MONTHS_FU) ||
            (lEncounterType == (long)ReVamp_EncounterType.AFTER_THREE_MONTHS_FU) ||
            (lEncounterType == (long)ReVamp_EncounterType.PHONE_CALL_FU) ||
            (lEncounterType == (long)ReVamp_EncounterType.SELF_MANAGEMENT))
        {
            if (enc.CreateEncounter(Master,
                                    Master.SelectedPatientID,
                                    Master.SelectedTreatmentID,
                                    lEncounterType,
                                    out strNewEnc))
            {
                //set the selected encounter to the new encounter
                Master.SelectedEncounterID = strNewEnc;

                string strURL = "";
                strURL += "pat_encounter.aspx?op0=";
                strURL += Master.SelectedPatientID;
                strURL += "&op1=";
                strURL += strNewEnc;
                strURL += "&op2=";
                strURL += Convert.ToString(Master.SelectedTreatmentID);

                Response.Redirect(strURL);
                return;
            }
            else
            {
                divStatus.InnerHtml  = "<font size='+0'>";
                divStatus.InnerHtml += Master.StatusComment;
                divStatus.InnerHtml += "</font>";
                return;
            }
        }
    }
Exemple #14
0
    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
        CEncounter enc = new CEncounter();

        string strAllResponse   = String.Empty,
               strQResponse     = String.Empty,
               strResponseCount = Request.Form["ResponseCount"];

        Int32 nCount = 0;

        if (strResponseCount != null)
        {
            nCount = Convert.ToInt32(strResponseCount);
        }
        else
        {
            //ERROR
            return;
        }

        //loop thru the responses
        for (int a = 1; a < nCount; a++)
        {
            int    iQID            = a;
            string strCurrResponse = String.Empty;

            //get responses controls
            string strRadio      = "grpRadio_" + iQID.ToString(),
                   strCheckbox   = "grpCheck_" + iQID.ToString(),
                   strText       = "grpCtrlText_" + iQID.ToString(),
                   strCombo      = "grpCombo_" + iQID.ToString(),
                   strHiddenText = "grpHidden_" + iQID.ToString();

            //get radio response
            if (Request.Form[strRadio] != null)
            {
                strCurrResponse = Request.Form[strRadio];
                string[] splitResponse = strCurrResponse.Split(new Char[] { '|' });
                strQResponse += enc.GetRecordForInsert(splitResponse);
            }

            //get checkbox response
            if (Request.Form[strCheckbox] != null)
            {
                strCurrResponse = Request.Form[strCheckbox];
                string[] splitResponse = strCurrResponse.Split(new Char[] { '|' });
                strQResponse += enc.GetRecordForInsert(splitResponse);
            }

            //get textbox response
            String strT = null;
            strT = Request.Form[strText];
            if (strT != null)
            {
                if (strT.Trim().Length > 0)
                {
                    strT = strT.Trim();

                    strCurrResponse = strT;

                    String strH = null;
                    strH = Request.Form[strHiddenText];

                    if (String.IsNullOrEmpty(strH) == false)
                    {
                        strCurrResponse += " " + Request.Form[strHiddenText];
                        string[] strHidden = Request.Form[strHiddenText].Split(new Char[] { '|' });
                        strQResponse += enc.GetRecordForInsert(strHidden, strT);
                    }
                }
            }

            //get combo response
            if (Request.Form[strCombo] != null)
            {
                strCurrResponse = Request.Form[strCombo];
                string[] splitResponse = strCurrResponse.Split(new Char[] { '|' });
                strQResponse += enc.GetRecordForInsert(splitResponse);
            }


            object objResponse = new { rIndex = iQID, rString = strCurrResponse };

            //start computing the individual variables
            QResponse resp = new QResponse(iQID, strCurrResponse);
            SetPSQIVariables(resp);

            strAllResponse += strQResponse;
            strQResponse    = null;
        }


        if (!enc.WriteIntakeResponses(Master, Master.SelectedEncounterID, lEncIntakeID, lMID, lGRP, strAllResponse))
        {
            return;
        }

        if (!Score(lEncIntakeID, lMID))
        {
            return;
        }

        //mark module complete
        if (enc.CompleteModule(Master, lMID, lGRP))
        {
            Response.Redirect("patient_assessment.aspx");
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsLoggedIn())
        {
            Response.Redirect("Default.aspx", true);
        }

        //set session time remaining
        strMilisecondsSessionExpire = SessionTimeRemaining();
        strSessionTimeout           = SessionTimeRemaining();

        // register Ext.NET library icons
        ResourceManager1.RegisterIcon(Icon.Information);

        //pass the master to the popup
        ucPatLookup.BaseMstr     = this;
        ucLogin.BaseMstr         = this;
        ucVerticalMenu.BaseMstr  = this;
        ucEncounterType.BaseMstr = this;

        if (!this.IsLoggedIn())
        {
            //put us back in login mode
            ucLogin.SetMode(1);

            this.ClosePatient();
        }

        //------------------------------------------------------------------------------
        // Get "Last updated" info
        string strLastUpdated = this.GetVSStringValue("LAST_UPDATED");

        if (!String.IsNullOrEmpty(strLastUpdated))
        {
            divLastModified.Visible   = true;
            divLastModified.InnerText = strLastUpdated;
        }

        //remove PATIENTNAME session variable if
        //not logged in and patient_id is empty
        if (!this.IsLoggedIn() || String.IsNullOrEmpty(this.SelectedPatientID))
        {
            Session["PATIENTNAME"] = null;
        }

        //------------------------------------------------------------------------------
        // NOT POSTBACK
        //------------------------------------------------------------------------------
        #region not_postback
        if (!IsPostBack)
        {
            //get system settings
            DataSet dsSys = new DataSet();

            if (Session["SYSSETTINGS"] == null)
            {
                CSystemSettings sys = new CSystemSettings();
                Session["SYSSETTINGS"] = sys.GetSystemSettingsDS(this);
            }
            dsSys = (DataSet)Session["SYSSETTINGS"];

            //get site
            if (Session["SiteID"] == null)
            {
                CSystemSettings SysSettings = new CSystemSettings();
                DataSet         dsSite      = SysSettings.GetSiteDS(this);
                string          strSiteID   = utils.GetStringValueFromDS(dsSite, "SITE_ID");
                Session["SiteID"] = strSiteID;
            }
        }
        #endregion

        //------------------------------------------------------------------------------
        // IS POSTBACK
        //------------------------------------------------------------------------------
        #region isPostBack
        if (IsPostBack)
        {
            //get the postback control
            string strPostBackControl = Request.Params["__EVENTTARGET"];
            if (strPostBackControl != null)
            {
                #region PatientLookup
                //did we do a patient lookup?
                if (strPostBackControl.Equals("PATIENT_LOOKUP"))
                {
                    //Clears previously looked up patient id, treatment id
                    this.SelectedPatientID   = "";
                    this.SelectedTreatmentID = -1;
                    this.SelectedEncounterID = "";
                    this.SelectedProblemID   = -1;

                    this.ClosePatient();


                    //get the patient id
                    string[] strArg = Request.Form["__EVENTARGUMENT"].Split('|');

                    //pass the patient id to the base, this will cache
                    //it in the db fx_session_value table
                    this.SelectedPatientID = strArg[0];

                    //check if it is an event lookup
                    if (strArg.Length > 1)
                    {
                        if (strArg[1].ToLower().Equals("event"))
                        {
                            Session["EVENT_LOOKUP"] = true;
                        }
                    }

                    //set the current treatment id, gets list of records with newest first
                    DataSet t_recs = treatment.GetRecordList(this,
                                                             this.SelectedPatientID,
                                                             2);  //OPEN CASES - Revamp only uses this

                    if (t_recs != null && t_recs.Tables[0].Rows.Count > 0)
                    {
                        this.SelectedTreatmentID = Convert.ToInt32(t_recs.Tables[0].Rows[0]["treatment_id"].ToString());
                    }

                    //------------------------------------------------------------------------------
                    //GET INITIAL VISIT ID
                    //GET PATIENT NAME FOR THE DEMOGRAPHICS BLURB
                    if (this.IsLoggedIn() && !String.IsNullOrEmpty(this.SelectedPatientID))//must be logged in too...
                    {
                        if (Session["InitialVisit"] == null)
                        {
                            CEncounter patInitVisit = new CEncounter();
                            CDataUtils dUtils       = new CDataUtils();
                            DataSet    dsInitVisit  = patInitVisit.GetInitialVisitDS(this, this.SelectedPatientID, this.SelectedTreatmentID);
                            Session["InitialVisit"] = dUtils.GetStringValueFromDS(dsInitVisit, "encounter_id");
                        }

                        if (Session["PATIENTNAME"] == null)
                        {
                            CPatient cpat = new CPatient();
                            Session["PATIENTNAME"] = cpat.GetPatientName(this);
                        }

                        //GET SELECTED PATIENT'S DEMOGRAPHICS
                        CPatient   pat   = new CPatient();
                        CDataUtils utils = new CDataUtils();
                        DataSet    clientDemographics = new DataSet();

                        Session["PAT_DEMOGRAPHICS_DS"] = pat.GetPatientDemographicsDS(this);
                        clientDemographics             = (DataSet)Session["PAT_DEMOGRAPHICS_DS"];

                        foreach (DataTable patTable in clientDemographics.Tables)
                        {
                            foreach (DataRow patRow in patTable.Rows)
                            {
                                this.APPMaster.PatientHasOpenCase = false;
                                if (!patRow.IsNull("OPENCASE_COUNT"))
                                {
                                    if (Convert.ToInt32(patRow["OPENCASE_COUNT"]) > 0)
                                    {
                                        this.APPMaster.PatientHasOpenCase = true;
                                    }
                                }
                            }
                        }
                    }
                    //--------------------------------------------------------------------------------------

                    //VERIFY STATUS OF THE PATIENT RECORD
                    CPatientLock plock = new CPatientLock(this);

                    string strLockProviderName  = String.Empty;
                    string strLockProviderEmail = String.Empty;

                    this.IsPatientLocked         = plock.IsPatientLocked(this.SelectedPatientID, out strLockProviderName, out strLockProviderEmail);
                    Session["PAT_LOCK_PROVIDER"] = strLockProviderName;
                    Session["PAT_LOCK_EMAIL"]    = strLockProviderEmail;

                    //REDIRECT USER ------------------------------------------------------------------------
                    long lSoapNoteUR = (long)SUATUserRight.NoteSubjectiveUR
                                       + (long)SUATUserRight.NoteObjectiveUR
                                       + (long)SUATUserRight.NoteAssessmentUR
                                       + (long)SUATUserRight.NotePlanUR;


                    if (this.APPMaster.HasUserRight(lSoapNoteUR))
                    {
                        Response.Redirect("pat_summary.aspx", true);
                    }
                    else if (this.APPMaster.HasUserRight((long)SUATUserRight.ProcessNewPatientsUR))
                    {
                        Response.Redirect("pat_demographics.aspx", false);
                    }
                    else
                    {
                        Response.Redirect("revamp.aspx", true);
                    }
                }
                #endregion

                #region OtherLookups
                //did we do a user lookup?
                if (strPostBackControl.Equals("USER_LOOKUP"))
                {
                    //get the uidpwd
                    string strArg = Request.Form["__EVENTARGUMENT"];
                    //pass the patient id to the base, this will cache
                    //it in the db fx_session_value table
                    this.SelectedProviderID = strArg;

                    Response.Redirect("user_admin.aspx", true);
                }

                //did we do a Portal Patient Lookup?
                if (strPostBackControl.Equals("PORTAL_PATIENT_LOOKUP"))
                {
                    //get the uidpwd
                    string strArg = Request.Form["__EVENTARGUMENT"];
                    //pass the patient id to the base, this will cache
                    //it in the db fx_session_value table
                    this.SelectedPatientID = strArg;

                    Response.Redirect("pat_portal_account.aspx", true);
                }

                //-- 2/22/2011 close currently looked up patient
                if (strPostBackControl.Equals("CLOSE_PATIENT"))
                {
                    this.SelectedPatientID   = "";
                    this.SelectedTreatmentID = -1;
                    this.LookupSearchCase    = -1;

                    Response.Redirect("revamp.aspx", true);
                }
                #endregion
            }
        }
        #endregion

        #region ShowUsernameAndPatientDemographics
        if (this.IsLoggedIn())
        {
            //Name Of User Currently logged on.
            string strUserLoggedOn = String.Empty;
            if (Session["USERLOGGEDON"] == null)
            {
                strUserLoggedOn        += "<img alt=\"Account Activity\" src=\"Images/information.png\" style=\"cursor: pointer; vertical-align: middle; margin-right: 3px;\" onclick=\"showAccDetails();\" />";
                strUserLoggedOn        += UserLoggedOn();
                strUserLoggedOn        += " - ";
                strUserLoggedOn        += DateTime.Now.ToShortDateString();
                strUserLoggedOn        += " ";
                strUserLoggedOn        += DateTime.Now.ToShortTimeString();
                lblUserLoggedOn.Text    = strUserLoggedOn;
                Session["USERLOGGEDON"] = strUserLoggedOn;
            }
            else
            {
                lblUserLoggedOn.Text = Session["USERLOGGEDON"].ToString();
            }

            //draw the patient info bar at the top
            patDemoInfoBar.InnerHtml = "";

            //GET PATIENT NAME for the demographics blurb
            //Render Left Vertical Menu for selected patient
            if (this.IsLoggedIn() && !String.IsNullOrEmpty(this.SelectedPatientID))//must be logged in too...
            {
                if (Session["PATIENTNAME"] == null)
                {
                    CPatient cpat = new CPatient();
                    Session["PATIENTNAME"] = cpat.GetPatientName(this);
                }
                string[] strPatInfo = (string[])Session["PATIENTNAME"];

                patDemoInfoBar.InnerHtml = strPatInfo[0];

                //render vertical menu
                ucVerticalMenu.RenderVerticalMenu();
            }
            else
            {
                this.ClosePatient();
            }
        }
        #endregion

        //load the patient treatment/encounter info
        //if we are in group note, hide it...

        bool   bSkipSelectedPatientCheck = false;
        string strPage = "";
        strPage = this.GetPageName().ToLower();
        if (strPage.IndexOf("pat_portal_account.aspx") > -1)
        {
            pnlTxTree.Visible         = false;
            bSkipSelectedPatientCheck = true;
        }
        else if (strPage.IndexOf("cms_menu_edit.aspx") > -1)
        {
            pnlTxTree.Visible         = false;
            bSkipSelectedPatientCheck = true;

            if (IsPostBack)
            {
                if (this.OnMasterSAVE())
                {
                    BuildMenu();
                }
            }
        }
        else if (strPage.IndexOf("cms_page_edit.aspx") > -1)
        {
            pnlTxTree.Visible         = false;
            bSkipSelectedPatientCheck = true;
        }
        else
        {
            pnlTxTree.Visible         = true;
            patDemoInfoBar.Visible    = true;
            bSkipSelectedPatientCheck = false;
        }

        // ----------------
        if (!bSkipSelectedPatientCheck)
        {
            if (!String.IsNullOrEmpty(this.SelectedPatientID))
            {
                pnlTxTree.Visible      = true;
                pnlDemoInfoBar.Visible = true;
            }
            else
            {
                pnlTxTree.Visible      = false;
                pnlDemoInfoBar.Visible = false;
            }
        }

        if (!this.IsLoggedIn())
        {
            pnlLogoff.Visible = false;
        }
        else
        {
            pnlLogoff.Visible = true;
        }

        //get account activity details
        GetAccountDetails();

        // Build the Menu & Toolbar HTML string
        BuildMenu();

        //check if user has new messages
        btnEmailNew.Attributes.CssStyle.Add("vertical-align", "middle");
        btnEmailNew.Attributes.CssStyle.Add("margin-right", "8px");
        btnEmailNew.Attributes.CssStyle.Add("cursor", "pointer");
        btnEmailNew.Visible = this.HasNewMessage();
        btnEmailNew.Attributes.Add("onclick", "winrpt.showReport('messagescenter',['null'],{maximizable:false, width:($(window).width() - 50), height:($(window).height() - 50)});");
    }
Exemple #16
0
    protected bool DefultEncounterSelect(string strPatientID, long lTreatmentID)
    {
        bool       bTreatClosed = false;
        CEncounter enc          = new CEncounter();
        CTreatment treatment    = new CTreatment();
        DataSet    dsTreatment  = treatment.GetTreatmentListDS(Master, Master.SelectedPatientID);
        DataSet    dsEncs       = enc.GetAllEncounterListDS(Master, strPatientID);

        long lTreatmentCount = dsTreatment.Tables[0].Rows.Count;

        DataRow[] drClosedCases     = dsTreatment.Tables[0].Select("case_closed = 1");
        long      lTreatClosed      = drClosedCases.GetLength(0);
        bool      bAllowClosedCases = (lTreatmentCount == lTreatClosed) ? true : false;

        foreach (DataTable tdt in dsTreatment.Tables)
        {
            foreach (DataRow tdr in tdt.Rows)
            {
                if (!tdr.IsNull("case_closed"))
                {
                    bTreatClosed = (Convert.ToInt32(tdr["case_closed"]) == 1) ? true : false;
                }

                if (!bTreatClosed || (bTreatClosed && bAllowClosedCases))
                {
                    bool bCaseClosed = false;

                    DataRow[] drEncs = dsEncs.Tables[0].Select("treatment_id = " + Convert.ToInt32(tdr["treatment_id"]));

                    long lEncCount  = drEncs.GetLength(0);
                    long lClosedEnc = 0;
                    foreach (DataRow drEncDr in drEncs)
                    {
                        if (!drEncDr.IsNull("closed"))
                        {
                            if (Convert.ToInt32(drEncDr["closed"]) == 1)
                            {
                                ++lClosedEnc;
                            }
                        }
                    }
                    bool bAllowClosedEncs = (lEncCount == lClosedEnc) ? true : false;

                    if (dsEncs != null)
                    {
                        foreach (DataTable dt in dsEncs.Tables)
                        {
                            foreach (DataRow dr in dt.Rows)
                            {
                                if (!dr.IsNull("closed"))
                                {
                                    bCaseClosed = (Convert.ToInt32(dr["closed"]) == 1) ? true : false;
                                }
                                if (!dr.IsNull("encounter_type_id"))
                                {
                                    long lEncounterType = Convert.ToInt32(dr["encounter_type_id"]);
                                    if ((lEncounterType != (long)EncounterType.ADMIN_NOTE && lEncounterType != (long)EncounterType.GROUP_NOTE) && (!bCaseClosed || (bCaseClosed && bAllowClosedEncs)))
                                    {
                                        Master.SelectedEncounterID = dr["encounter_id"].ToString();
                                        return(true);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return(false);
    }
Exemple #17
0
    //save the first view
    protected bool SaveDemographics()
    {
        Session["PAT_DEMOGRAPHICS_DS"] = null;
        Session["PATIENTNAME"]         = null;

        long lHomePhoneMsg = 0;
        long lEmailMsg     = 0;

        if (rblHomePhoneMsg.SelectedIndex > -1)
        {
            lHomePhoneMsg = Convert.ToInt32(rblHomePhoneMsg.SelectedValue);
        }

        if (rblEmailMessage.SelectedIndex > -1)
        {
            lEmailMsg = Convert.ToInt32(rblEmailMessage.SelectedValue);
        }

        //check data entry for errors
        string strMessage = CheckPatientDemoErrors();

        if (!string.IsNullOrEmpty(strMessage))
        {
            Master.StatusCode    = 1;
            Master.StatusComment = strMessage;
            //ShowSysFeedback();
            return(false);
        }

        ConvertPatientDemographics();

        CPatient pat = new CPatient();

        // if new patient then insert else update
        if (m_bNewPatient)
        {
            m_strNewPatientID   = Master.APPMaster.GetNewPatientID();
            m_strNewEncounterID = Master.APPMaster.GetNewEncounterID();

            //insert the actual record
            bool bStatus = pat.InsertPatientDemographics(
                Master,
                m_strNewPatientID,
                m_strNewEncounterID,
                txtFirstName.Text,
                txtMiddleName.Text,
                txtLastName.Text,
                m_strFMPSSN,
                m_strFMPSSNConfirm,
                m_strGender,
                m_strDOB,
                cboProvider.SelectedValue,
                txtAddress1.Text,
                txtAddress2.Text,
                txtCity.Text,
                txtPostCode.Text,
                txtHomePhone.Text,
                txtCelPhone.Text,
                txtWorkPhone.Text,
                txtPatEmail.Text,
                cboState.SelectedValue,
                Convert.ToInt32(cboCallPreference.SelectedValue),
                lHomePhoneMsg,
                lEmailMsg);

            if (!bStatus)
            {
                //ShowSysFeedback();
                return(false);
            }

            //reset these so the RFR tab will show
            Master.APPMaster.PatientHasOpenCase = true;

            Master.SetVSValue("IsNewPatient", false);
            Master.SetVSValue("ReloadPage", true);

            //set the selected patient id, basically they are
            //"looked up" at this point...
            Master.SelectedPatientID = m_strNewPatientID;

            //Add all patient events
            CPatientEvent evt = new CPatientEvent(Master);
            evt.AddAllEvents();

            //add patient step
            CPatientTxStep patstep = new CPatientTxStep(Master);
            patstep.InsertPatientStep(0);

            //get current (new) treatment id
            CEncounter enc             = new CEncounter();
            long       lNewTreatmentID = 1;
            enc.GetCurrentTreatmentID(Master, m_strNewPatientID, out lNewTreatmentID);
            Master.SelectedTreatmentID = lNewTreatmentID;

            //assign initial questionnaires
            CIntake intake = new CIntake();
            intake.AssignInitialAssessments(Master, m_strNewPatientID);

            if (!SaveEthnicityRaceSource())
            {
                //ShowSysFeedback();
                return(false);
            }

            return(true);
        }
        else
        {
            bool bStatus = pat.UpdatePatientDemographics(
                Master,
                txtFirstName.Text,
                txtMiddleName.Text,
                txtLastName.Text,
                m_strFMPSSN,
                m_strFMPSSNConfirm,
                m_strGender,
                m_strDOB,
                cboProvider.SelectedValue,
                txtAddress1.Text,
                txtAddress2.Text,
                txtCity.Text,
                txtPostCode.Text,
                txtHomePhone.Text,
                txtCelPhone.Text,
                txtWorkPhone.Text,
                txtPatEmail.Text,
                cboState.SelectedValue,
                Convert.ToInt32(cboCallPreference.SelectedValue),
                lHomePhoneMsg,
                lEmailMsg);

            if (!bStatus)
            {
                return(false);
            }

            if (!SaveEthnicityRaceSource())
            {
                return(false);
            }
        }

        return(true);
    }
Exemple #18
0
    protected void btnSubmit_OnClick(object sender, EventArgs e)
    {
        CEncounter enc = new CEncounter();

        string strAllResponse = String.Empty;
        string strQResponse = String.Empty;
        Int32 nCount = 0;

        nScore = 0;
        nScore1 = 0;
        nScore2 = 0;
        nScore3 = 0;
        nScore4 = 0;
        nScore5 = 0;

        String strResponseCount = Request.Form["ResponseCount"];
        if (strResponseCount != null)
        {
            nCount = Convert.ToInt32(strResponseCount);
        }
        else
        {
            //ERROR
            return;
        }

        //loop thru the responses
        for (int a = 1; a < nCount; a++)
        {
            String strResponse = null;
            String strRID = null;
            String strScore = null;

            int iQID = a;

            //get responses controls
            string strRadio = "grpRadio_" + iQID.ToString();

            //get radio response
            if (Request.Form[strRadio] != null)
            {
                string[] splitResponse = Request.Form[strRadio].Split(new Char[] { '|' });
                strQResponse += enc.GetRecordForInsert(splitResponse);

                //comupte sections scores

                //general productivity
                if (iQID == 1 || iQID == 2)
                {
                    nScore1 += Convert.ToInt32(splitResponse[2]);
                }

                //activity level
                if (iQID == 6 || iQID == 8 || iQID == 9)
                {
                    nScore2 += Convert.ToInt32(splitResponse[2]);
                }

                //vigilance
                if (iQID == 3 || iQID == 4 || iQID == 7)
                {
                    nScore3 += Convert.ToInt32(splitResponse[2]);
                }

                //social outcome
                if (iQID == 5)
                {
                    nScore4 += Convert.ToInt32(splitResponse[2]);
                }

                //intimacy and sexual relationships
                if (iQID == 10)
                {
                    nScore5 += Convert.ToInt32(splitResponse[2]);
                }

            }

            strAllResponse += strQResponse;
            strQResponse = null;
        }


        // Write responses
        if (enc.WriteIntakeResponses(Master, Master.SelectedEncounterID, lEncIntakeID, lMID, lGRP, strAllResponse) == false)
        {
            return;
        }

        //scores
        if (WriteScores() == false) 
        {
            return;
        }
        
        //mark module complete
        if (enc.CompleteModule(Master, lMID, lGRP))
        {
            Response.Redirect("patient_assessment.aspx");
        }
    }
Exemple #19
0
    protected void HasCompletedFollowUp()
    {
        Session["COMPLETED_FOLLOWUP"] = null;
        Regex reREF = new Regex("mid\\d*.aspx", RegexOptions.IgnoreCase);

        if (reREF.IsMatch(Request.UrlReferrer.ToString()))
        {
            string strPath  = Request.UrlReferrer.ToString();
            string strGroup = strPath.Substring(strPath.IndexOf("grp=") + 4);

            string strFollowUpGrps = ",3,5,7,";
            string strCSQGrps      = ",2,4,6,8,";

            CPatientEvent evt    = new CPatientEvent(Master);
            CEncounter    enc    = new CEncounter();
            DataSet       dsGrps = enc.GetModuleGroupStatusDS(Master);

            if (dsGrps != null)
            {
                foreach (DataTable dt in dsGrps.Tables)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        long lMIDGRP  = 0;
                        long lPending = 1;

                        if (!dr.IsNull("MODULE_GROUP_ID"))
                        {
                            lMIDGRP = Convert.ToInt32(dr["MODULE_GROUP_ID"]);
                        }

                        if (!dr.IsNull("PENDING"))
                        {
                            lPending = Convert.ToInt32(dr["PENDING"]);
                        }

                        if (lPending == 0 && lMIDGRP != 0)
                        {
                            if (strGroup.Length > 0)
                            {
                                string strCurrGroup = "," + strGroup + ",";

                                if (lMIDGRP == Convert.ToInt32(strGroup) && (strFollowUpGrps.IndexOf(strCurrGroup) > -1))
                                {
                                    Session["COMPLETED_FOLLOWUP"] = 1;
                                    Response.Redirect("portal_start.aspx");
                                }
                                else if (lMIDGRP == Convert.ToInt32(strGroup) && (strCSQGrps.IndexOf(strCurrGroup) > -1))
                                {
                                    Session["COMPLETED_FOLLOWUP"] = 2;
                                    Response.Redirect("portal_start.aspx");
                                }
                            }
                        }
                    }
                }
            }

            if (!HasPendingModules(Master))
            {
                Response.Redirect("portal_start.aspx");
            }
        }
    }
Exemple #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region notpostback
        if (!IsPostBack)
        {
            //get values from the query string for this encounter
            Master.SelectedPatientID   = Request.QueryString[0].ToString();
            Master.SelectedEncounterID = Request.QueryString[1].ToString();
            Master.SelectedTreatmentID = Convert.ToInt32(Request.QueryString[2].ToString());

            //------------------------------------------------------------------------------
            //GET INITIAL VISIT ID
            //GET PATIENT NAME FOR THE DEMOGRAPHICS BLURB
            if (Master.IsLoggedIn() && !String.IsNullOrEmpty(Master.SelectedPatientID))//must be logged in too...
            {
                if (Session["InitialVisit"] == null)
                {
                    CEncounter patInitVisit = new CEncounter();
                    CDataUtils dUtils       = new CDataUtils();
                    DataSet    dsInitVisit  = patInitVisit.GetInitialVisitDS(Master, Master.SelectedPatientID, Master.SelectedTreatmentID);
                    Session["InitialVisit"] = dUtils.GetStringValueFromDS(dsInitVisit, "encounter_id");
                }

                if (Session["PATIENTNAME"] == null)
                {
                    CPatient cpat = new CPatient();
                    Session["PATIENTNAME"] = cpat.GetPatientName(Master);
                }

                //GET SELECTED PATIENT'S DEMOGRAPHICS
                CPatient   pat   = new CPatient();
                CDataUtils utils = new CDataUtils();
                DataSet    clientDemographics = new DataSet();

                Session["PAT_DEMOGRAPHICS_DS"] = pat.GetPatientDemographicsDS(Master);
                clientDemographics             = (DataSet)Session["PAT_DEMOGRAPHICS_DS"];

                foreach (DataTable patTable in clientDemographics.Tables)
                {
                    foreach (DataRow patRow in patTable.Rows)
                    {
                        Master.APPMaster.PatientHasOpenCase = false;
                        if (!patRow.IsNull("OPENCASE_COUNT"))
                        {
                            if (Convert.ToInt32(patRow["OPENCASE_COUNT"]) > 0)
                            {
                                Master.APPMaster.PatientHasOpenCase = true;
                            }
                        }
                    }
                }
            }

            CEncounter enc = new CEncounter();

            //Reset all Sessions valriables related to the Encounter
            Session["ENCOUNTERDS"]        = null;
            Session["ENCOUNTERS_LIST_DS"] = null;
            Session["INTAKESCOREDS"]      = null;
            Session["INTAKE_SCORES_DS"]   = null;

            //------------------
            Session["PROBLEMS_LIST_DS"] = null;
        }
        #endregion

        ucPatSOAPP.BaseMstr = Master;

        if (!IsPostBack)
        {
            //todo: a readonly mode if already signed, waiting on jeff
            //init the soap with the values passed in

            ucPatSOAPP.Initialize(Master.SelectedPatientID,
                                  Master.SelectedTreatmentID,
                                  Master.SelectedEncounterID,
                                  "",
                                  "",
                                  "",
                                  "");
        }
    }