예제 #1
0
    /// <summary>
    /// override
    /// US:838
    /// load control
    /// </summary>
    /// <param name="lEditMode"></param>
    /// <returns></returns>
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        //load the checklist status dropdown list
        CStatus status = CSTAT.LoadChecklistStateDDL(BaseMstr.BaseData, ddlChecklistStatus);

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

        //load the service ddl
        status = LoadServiceDDL();
        if (!status.Status)
        {
            return(status);
        }

        //set the clinic date range to today
        if (String.IsNullOrEmpty(txtApptFromDate.Text))
        {
            DateTime dtNow = DateTime.Now;

            calApptFromDate.SelectedDate = dtNow;
            txtApptFromDate.Text         = CDataUtils.GetDateAsString(dtNow);

            calApptToDate.SelectedDate = dtNow;
            txtApptToDate.Text         = CDataUtils.GetDateAsString(dtNow);
        }

        return(new CStatus());
    }
    protected CStatus LoadPatItemAndComponents()
    {
        CPatientItemData     dta = new CPatientItemData(BaseMstr.BaseData);
        CPatientItemDataItem di  = null;
        CStatus status           = dta.GetPatientItemDI(
            PatientID,
            ItemID,
            Convert.ToInt64(ddlItems.SelectedValue),
            out di);

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

        // set date/time
        txtEntryDate.Text         = CDataUtils.GetDateAsString(di.EntryDate);
        calEntryDate.SelectedDate = di.EntryDate;
        ucTimePicker.SetTime(di.EntryDate);

        if (di.ItemTypeID == (long)k_ITEM_TYPE_ID.NoteTitle)
        {
            ucNoteTitle.ItemID        = di.ItemID;
            ucNoteTitle.PatientItemID = Convert.ToInt64(ddlItems.SelectedValue);
            ucNoteTitle.PatientID     = PatientID;
            status = ucNoteTitle.LoadControl(k_EDIT_MODE.UPDATE);
            if (!status.Status)
            {
                return(status);
            }
        }
        else
        {
            status = LoadPatComponents();
            if (!status.Status)
            {
                return(status);
            }
        }

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

        return(new CStatus());
    }
예제 #3
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);
    }
    /// <summary>
    /// event
    /// loads the selected patient item into the grid view
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void OnSelIndexChangedItem(object sender, EventArgs e)
    {
        ShowMPE();

        if (ddlItems.SelectedIndex == 0)
        {
            foreach (GridViewRow gvr in gvComponents.Rows)
            {
                RadioButton rbSelect = (RadioButton)gvr.FindControl("rbSelComponent");
                TextBox     txtValue = (TextBox)gvr.FindControl("txtValue");

                if (rbSelect == null || txtValue == null)
                {
                    ShowStatusInfo(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
                }
                rbSelect.Checked  = false;
                rbSelect.Enabled  = true;
                txtValue.Text     = string.Empty;
                txtValue.ReadOnly = false;
            }

            if (ddlItems.SelectedItem.Text == "[New Result]")
            {
                ShowEditOptions(true);

                // set date/time
                txtEntryDate.ReadOnly     = false;
                calEntryDate.Enabled      = true;
                ucTimePicker.Enabled      = true;
                txtEntryDate.Text         = CDataUtils.GetDateAsString(DateTime.Now);
                calEntryDate.SelectedDate = DateTime.Now;
                ucTimePicker.SetTime(DateTime.Now);
                txtComment.Enabled = true;
            }
            else if (ddlItems.SelectedItem.Text == "[Select Result]")
            {
                txtEntryDate.ReadOnly     = true;
                calEntryDate.Enabled      = false;
                ucTimePicker.Enabled      = false;
                txtEntryDate.Text         = string.Empty;
                calEntryDate.SelectedDate = null;
                ucTimePicker.SetTime(0, 0, 0);
                txtComment.Enabled = false;

                ucNoteTitle.Clear();

                ShowEditOptions(false);
            }

            txtComment.Text       = string.Empty;
            gvComments.DataSource = null;
            gvComments.DataBind();
        }
        else
        {
            ShowEditOptions(true);

            foreach (GridViewRow gvr in gvComponents.Rows)
            {
                RadioButton rbSelect = (RadioButton)gvr.FindControl("rbSelComponent");
                TextBox     txtValue = (TextBox)gvr.FindControl("txtValue");
                if (rbSelect == null || txtValue == null)
                {
                    ShowStatusInfo(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
                }
                rbSelect.Enabled  = false;
                txtValue.ReadOnly = true;
            }

            txtEntryDate.ReadOnly = true;
            calEntryDate.Enabled  = false;
            ucTimePicker.Enabled  = false;
            txtComment.Enabled    = true;
            CStatus status = LoadPatItemAndComponents();
            if (!status.Status)
            {
                ShowStatusInfo(status);
                return;
            }
        }
    }
    protected CStatus LoadItemAndComponents(CItemDataItem di)
    {
        if (di == null)
        {
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

        lblItem.Text            = di.ItemLabel;
        lblItemDescription.Text = di.ItemDescription;

        //load a ddl with all results ordered newest to oldest
        CStatus status = CPatientItem.LoadPatientItemsDDL(
            BaseMstr.BaseData,
            ddlItems,
            PatientID,
            ItemID);

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

        if (di.MapID != "-1")
        {
            ddlItems.Items[0].Text    = "[Select Result]";
            txtEntryDate.ReadOnly     = true;
            calEntryDate.Enabled      = false;
            ucTimePicker.Enabled      = false;
            txtEntryDate.Text         = string.Empty;
            calEntryDate.SelectedDate = null;
            ucTimePicker.SetTime(0, 0, 0);
            txtComment.Enabled = false;

            ShowEditOptions(false);
        }
        else
        {
            ddlItems.Items[0].Text    = "[New Result]";
            txtEntryDate.ReadOnly     = false;
            calEntryDate.Enabled      = true;
            ucTimePicker.Enabled      = true;
            txtEntryDate.Text         = CDataUtils.GetDateAsString(DateTime.Now);
            calEntryDate.SelectedDate = DateTime.Now;
            ucTimePicker.SetTime(DateTime.Now);
            txtComment.Enabled = true;

            ShowEditOptions(true);
        }

        if (di.ItemTypeID == (long)k_ITEM_TYPE_ID.NoteTitle)
        {
            pnlComponents.Visible = false;

            ucNoteTitle.Visible = false;
            ucNoteTitle.Clear();

            if (ddlItems.Items[0].Text != "[Select Result]")
            {
                if (ddlItems.Items[0].Text != "")
                {
                    ucNoteTitle.Visible = true;
                }
            }
        }
        else
        {
            pnlComponents.Visible = false;
            if (ddlItems.Items[0].Text != "[Select Result]")
            {
                if (ddlItems.Items[0].Text != "")
                {
                    pnlComponents.Visible = true;
                }
            }

            ucNoteTitle.Visible = false;

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

        txtComment.Text       = string.Empty;
        gvComments.DataSource = null;
        gvComments.DataBind();

        return(new CStatus());
    }
예제 #6
0
    /// <summary>
    /// US:1880 method
    /// loads the selected checklist
    /// </summary>
    /// <returns></returns>
    protected CStatus LoadChecklist()
    {
        PatCLID = Convert.ToInt64(ddlPatChecklist.SelectedValue);
        if (PatCLID < 1)
        {
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

        CPatientChecklist pcl    = new CPatientChecklist();
        CStatus           status = pcl.LoadPatientChecklists(BaseMstr, PatientID, ddlPatChecklist);

        if (!status.Status)
        {
            return(status);
        }
        ddlPatChecklist.SelectedValue = PatCLID.ToString();

        CPatChecklistData     pcld = new CPatChecklistData(BaseMstr.BaseData);
        CPatChecklistDataItem di   = null;

        status = pcld.GetPatChecklistDI(PatCLID, out di);
        if (!status.Status)
        {
            return(status);
        }
        ddlChecklistState.SelectedValue = Convert.ToInt64(di.ChecklistStateID).ToString();
        ChecklistID      = di.ChecklistID;
        ChecklistStateID = di.ChecklistStateID;
        EnableBasedOnChecklistState();

        //enable/disable the button based on the checklist selected
        CPatChecklistData dta  = new CPatChecklistData(BaseMstr.BaseData);
        DataSet           dsCL = null;

        dta.GetOutOfDatePatCLDS(PatientID, ChecklistID, out dsCL);
        if (!CDataUtils.IsEmpty(dsCL))
        {
            btnUpdateCLVersion.Enabled = true;
            lblVersion.Text            = "New Version Available!";
        }
        else
        {
            btnUpdateCLVersion.Enabled = false;
            lblVersion.Text            = "Version is Current.";
        }


        if (!CDataUtils.IsDateNull(di.ProcedureDate))
        {
            tbProcedureDate.Text          = CDataUtils.GetDateAsString(di.ProcedureDate);
            calProcedureDate.SelectedDate = di.ProcedureDate;
            ucProcedureTime.SetTime(di.ProcedureDate);
        }
        else
        {
            tbProcedureDate.Text          = string.Empty;
            calProcedureDate.SelectedDate = null;
            ucProcedureTime.HH            = 0;
            ucProcedureTime.MM            = 0;
            ucProcedureTime.SS            = 0;
        }

        //checklist data - check for notetitle and disable tiu if we dont have one
        CChecklistData     clData      = new CChecklistData(BaseMstr.BaseData);
        CChecklistDataItem diChecklist = null;

        status = clData.GetCheckListDI(di.ChecklistID, out diChecklist);
        if (!status.Status)
        {
            return(status);
        }

        btnTIU.Enabled = (diChecklist.NoteTitleTag != "-1") ? true: false;

        CPatientData p        = new CPatientData(BaseMstr.BaseData);
        string       strBlurb = string.Empty;

        status = p.GetPatientBlurb(PatientID, out strBlurb);
        if (!status.Status)
        {
            return(status);
        }

        sPatientBlurb.InnerText = strBlurb + " for " + diChecklist.ChecklistLabel;

        ucPatCLItems.PatientChecklistID = di.PatCLID;
        ucPatCLItems.PatientID          = di.PatientID;
        ucPatCLItems.ChecklistID        = di.ChecklistID;
        status = LoadPatientChecklistItems();
        if (!status.Status)
        {
            return(status);
        }

        EnableTIU();

        return(new CStatus());
    }