Esempio n. 1
0
    /// <summary>
    /// method
    /// updates an item with the values of the item specified
    /// </summary>
    /// <param name="iItem"></param>
    /// <returns></returns>
    public CStatus UpdateItem(CItemDataItem iItem)
    {
        //create a status object and check for valid dbconnection
        CStatus status = DBConnValid();

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

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

        // procedure specific parameters
        pList.AddInputParameter("pi_nItemID", iItem.ItemID);
        pList.AddInputParameter("pi_nItemTypeID", iItem.ItemTypeID);
        pList.AddInputParameter("pi_nItemGroupID", iItem.ItemGroupID);
        pList.AddInputParameter("pi_vItemLabel", iItem.ItemLabel);
        pList.AddInputParameter("pi_vItemDescription", iItem.ItemDescription);
        pList.AddInputParameter("pi_nLookbackTime", iItem.LookbackTime);
        pList.AddInputParameter("pi_nActiveID", (long)iItem.ActiveID);
        pList.AddInputParameter("pi_vMapID", iItem.MapID);

        //execute the SP
        status = DBConn.ExecuteOracleSP("PCK_ITEM.UpdateItem", pList);
        if (!status.Status)
        {
            return(status);
        }

        return(new CStatus());
    }
Esempio n. 2
0
    /// <summary>
    /// method
    /// US:902
    /// parses a double/triple specified place holder
    /// </summary>
    /// <param name="strPlaceHolder"></param>
    /// <returns></returns>
    private CStringStatus ParseSpecifiedPlaceHolder(string strPlaceHolder)
    {
        string[] straSpecifiers = strPlaceHolder.Split(
            new char[] { CExpression.SpecifierTkn },
            StringSplitOptions.RemoveEmptyEntries);

        CItemData     ItemData = new CItemData(BaseData);
        CItemDataItem di       = null;
        CStatus       status   = ItemData.GetItemDI(straSpecifiers[0], out di);

        if (!status.Status)
        {
            return(new CStringStatus(
                       false,
                       k_STATUS_CODE.Failed,
                       LogicModuleMessages.ERROR_PARSE + strPlaceHolder,
                       CExpression.NullTkn));
        }

        switch (straSpecifiers.Length)
        {
        case 2:
            return(ParseDoubleSpecified(di.ItemID, straSpecifiers[1]));

        case 3:
            return(ParseTripleSpecified(di.ItemID, straSpecifiers[1], straSpecifiers[2]));

        default:
            return(new CStringStatus(
                       false,
                       k_STATUS_CODE.Failed,
                       LogicModuleMessages.ERROR_PARSE + strPlaceHolder,
                       CExpression.NullTkn));
        }
    }
    /// <summary>
    /// US:1883
    /// method
    /// adds an item to the grid view
    /// </summary>
    /// <param name="lItemID"></param>
    /// <returns></returns>
    public CStatus AddItem(long lItemID)
    {
        if (CollectionItems.Select("ITEM_ID = " + lItemID.ToString()).Count() > 0)
        {
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

        CItemData     item   = new CItemData(BaseMstr.BaseData);
        CItemDataItem di     = null;
        CStatus       status = item.GetItemDI(lItemID, out di);

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

        DataRow dr = CollectionItems.NewRow();

        dr["COLLECTION_ITEM_ID"] = 0;
        dr["ITEM_ID"]            = lItemID;
        dr["ITEM_LABEL"]         = di.ItemLabel;
        dr["SORT_ORDER"]         = CollectionItems.Rows.Count + 1;

        CollectionItems.Rows.Add(dr);

        gvItemCollection.DataSource = CollectionItems;
        gvItemCollection.DataBind();

        return(new CStatus());
    }
    /// <summary>
    /// method
    /// adds an empty item to the item list
    /// </summary>
    /// <param name="lItemID"></param>
    /// <returns></returns>
    private CStatus AddItem(long lItemID)
    {
        if (Items.Select("ITEM_ID = " + lItemID.ToString()).Count() > 0)
        {
            return(new CStatus(false, k_STATUS_CODE.Failed, Resources.ErrorMessages.ERROR_CE_ITEMEXISTS));
        }

        CItemData     id       = new CItemData(BaseMstr.BaseData);
        CItemDataItem ItemData = new CItemDataItem();
        CStatus       status   = id.GetItemDI(lItemID, out ItemData);

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

        DataRow dr = Items.NewRow();

        dr["CHECKLIST_ID"] = 0;
        dr["ITEM_ID"]      = ItemData.ItemID;
        dr["ACTIVE_ID"]    = (long)k_ACTIVE_ID.Active;
        dr["ITEM_LABEL"]   = ItemData.ItemLabel;

        Items.Rows.Add(dr);

        gvChecklistItems.DataSource = Items;
        gvChecklistItems.DataBind();

        return(new CStatus());
    }
    /// <summary>
    /// US:1883 the selected item in the collection ddl was changed
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void OnSelIndexChangedColItem(object sender, EventArgs e)
    {
        txtComment.Text = string.Empty;

        if (ddlColItems.SelectedIndex > 0)
        {
            txtComment.Enabled = true;

            ItemID = Convert.ToInt64(ddlColItems.SelectedValue);

            CItemData     Item   = new CItemData(BaseMstr.BaseData);
            CItemDataItem di     = null;
            CStatus       status = Item.GetItemDI(ItemID, out di);
            if (!status.Status)
            {
                ShowStatusInfo(status);
                return;
            }

            ItemTypeID = di.ItemTypeID;

            status = LoadItemAndComponents(di);
            if (!status.Status)
            {
                ShowStatusInfo(status);
                return;
            }
        }
        else
        {
            txtComment.Enabled = false;
        }

        ShowMPE();
    }
Esempio n. 6
0
    /// <summary>
    /// US:912
    /// load the last result
    /// </summary>
    protected CStatus LoadLastResult()
    {
        pnlLastResult.Visible = false;
        ucCollection.Visible  = false;
        ucNoteTitle.Visible   = false;

        //get the raw item data for this item
        CItemDataItem idi    = new CItemDataItem();
        CItemData     id     = new CItemData(BaseMstr.BaseData);
        CStatus       status = id.GetItemDI(ItemID, out idi);

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

        //note title
        if (idi.ItemTypeID == (long)k_ITEM_TYPE_ID.NoteTitle)
        {
            ucNoteTitle.Visible   = true;
            ucNoteTitle.ItemID    = ItemID;
            ucNoteTitle.PatientID = PatientID;
            status = ucNoteTitle.LoadControl(k_EDIT_MODE.INITIALIZE);
            if (!status.Status)
            {
                return(status);
            }
        }
        else if (idi.ItemTypeID == (long)k_ITEM_TYPE_ID.Collection)
        {
            ucCollection.Visible          = true;
            ucCollection.CollectionItemID = ItemID;
            ucCollection.PatientID        = PatientID;
            status = ucCollection.LoadControl(k_EDIT_MODE.INITIALIZE);
            if (!status.Status)
            {
                return(status);
            }
        }
        else
        {
            pnlLastResult.Visible = true;

            //get the most recent result for this checklist item
            string strResult = string.Empty;
            status = GetMostRecentResult(out strResult);
            if (!status.Status)
            {
                return(status);
            }

            //display the result
            litLastResult.Text = strResult;
        }

        return(new CStatus());
    }
Esempio n. 7
0
    /// <summary>
    /// US:912
    /// load control
    /// </summary>
    /// <param name="lEditMode"></param>
    /// <returns></returns>
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        ((app_ucTimer)UCTimer).StopRefresh();

        //load the item and description
        CItemData     Item   = new CItemData(BaseMstr.BaseData);
        CItemDataItem di     = null;
        CStatus       status = Item.GetItemDI(ItemID, out di);

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

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

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

        //default the date to today
        DateTime dtNow = DateTime.Now;

        //load the dropdown lists
        status = CDecisionState.LoadCLIDecisionStatesDDL(
            BaseMstr.BaseData,
            ChecklistID,
            ItemID,
            ddlDS);
        if (!status.Status)
        {
            return(status);
        }

        //load/select TS,OS,DS
        status = LoadStates();
        if (!status.Status)
        {
            return(status);
        }

        //load the comments gridview
        status = LoadCommentsGridView();
        if (!status.Status)
        {
            return(status);
        }

        //clear the comment data entry
        txtComment.Text = string.Empty;

        return(new CStatus());
    }
    /// <summary>
    /// method
    /// saves a checklist item to the database
    /// </summary>
    /// <param name="dr"></param>
    /// <returns></returns>
    protected CStatus SaveChecklistItem(DataRow dr)
    {
        CChecklistItemDataItem clidi = new CChecklistItemDataItem();
        clidi.ChecklistID = Convert.ToInt64(dr["CHECKLIST_ID"]);
        clidi.ItemID = Convert.ToInt64(dr["ITEM_ID"]);
        clidi.CLITSTimePeriod = Convert.ToInt64(dr["CLI_TS_TIME_PERIOD"]);
        clidi.TimeUnitID = (k_TIME_UNIT_ID)Convert.ToInt64(dr["TIME_UNIT_ID"]);
        clidi.SortOrder = Convert.ToInt64(dr["SORT_ORDER"]);
        clidi.ActiveID = (k_ACTIVE_ID)Convert.ToInt64(dr["ACTIVE_ID"]);

        CChecklistItemData clid = new CChecklistItemData(BaseMstr.BaseData);
        if (clidi.ChecklistID < 1)
        {
            //get the item type id
            long lItemTypeID = -1;
            
            CItemDataItem idi = null;
            CItemData id = new CItemData(BaseMstr.BaseData);
            id.GetItemDI(clidi.ItemID, out idi);
            lItemTypeID = idi.ItemTypeID;
            
            clidi.ChecklistID = ChecklistID;
            
            //do not generate default logic for a collection item.
            //default logic for a collection is handled in a seperate call.
            if((k_ITEM_TYPE_ID)lItemTypeID == k_ITEM_TYPE_ID.Collection)
            {
                clidi.Logic = "";
            }
            else
            {
                clidi.Logic = CExpression.DefaultTemporalLogic
                + " " + CExpression.DefaultOutcomeLogic
                + " " + CExpression.DefaultDecisionLogic;
            }

            CStatus status = clid.InsertChecklistItem(clidi);
            if (!status.Status)
            {
                return status;
            }

            dr["CHECKLIST_ID"] = ChecklistID;
        }
        else
        {
            CStatus status = clid.UpdateChecklistItem(clidi);
            if (!status.Status)
            {
                return status;
            }
        }

        return new CStatus();
    }
Esempio n. 9
0
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        Title = "Item History";

        CItemData     id     = new CItemData(BaseMstr.BaseData);
        CItemDataItem diItem = null;
        CStatus       status = id.GetItemDI(ItemID, out diItem);

        if (!status.Status)
        {
            return(status);
        }
        hItem.InnerText = diItem.ItemLabel;

        CPatientItemData pid   = new CPatientItemData(BaseMstr.BaseData);
        DataSet          dsPIC = null;

        status = pid.GetPatItemCompDS(PatientID, ItemID, out dsPIC);
        if (!status.Status)
        {
            return(status);
        }
        PatientItemComponents = dsPIC.Tables[0];

        CItemComponentData icd  = new CItemComponentData(BaseMstr.BaseData);
        DataSet            dsIC = null;

        status = icd.GetItemComponentOJDS(ItemID, k_ACTIVE_ID.Active, out dsIC);
        if (!status.Status)
        {
            return(status);
        }

        ItemComponents = dsIC.Tables[0];
        if (ItemComponents.Rows.Count > 1)
        {
            pnlComponents.Visible    = true;
            rblComponents.DataSource = ItemComponents;
            rblComponents.DataBind();
            DataRow rdItemComponent = ItemComponents.Rows[0];
            rblComponents.SelectedValue = rdItemComponent["item_component_id"].ToString();
            GraphItemComponent(rdItemComponent);
        }
        else
        {
            pnlComponents.Visible = false;
            GraphItemComponent(ItemComponents.Rows[0]);
        }

        return(new CStatus());
    }
Esempio n. 10
0
    /// <summary>
    /// method
    /// US:902
    /// returns the attribute specified for the item identified by the item id
    /// </summary>
    /// <param name="lItemID"></param>
    /// <param name="strSpecifier"></param>
    /// <returns></returns>
    private CStringStatus ParseItem(long lItemID, string strSpecifier)
    {
        CItemData     Item   = new CItemData(BaseData);
        CItemDataItem di     = null;
        CStatus       status = Item.GetItemDI(lItemID, out di);

        if (!status.Status)
        {
            return(new CStringStatus(status, CExpression.NullTkn));
        }

        string strValue = CExpression.NullTkn;

        switch (strSpecifier)
        {
        case "lookbacktime":
            strValue = (di.LookbackTime < 1) ? CExpression.NullTkn : di.LookbackTime.ToString();
            break;
        }

        return(new CStringStatus(status, strValue));
    }
Esempio n. 11
0
    /// <summary>
    /// US:1384
    /// override
    /// calls the grid view loads
    /// </summary>
    /// <param name="lEditMode"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatusComment"></param>
    /// <returns></returns>
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        Title = "State/Logic Editor";
        btnucSave.Focus();

        CItemData     item   = new CItemData(BaseMstr.BaseData);
        CItemDataItem di     = null;
        CStatus       status = item.GetItemDI(ChecklistItemID, out di);

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

        hItem.InnerText = di.ItemLabel;

        //load the gridviews with static data
        ucStateLogicSelector.ChecklistID     = ChecklistID;
        ucStateLogicSelector.ChecklistItemID = ChecklistItemID;
        status = ucStateLogicSelector.LoadControl(lEditMode);
        if (!status.Status)
        {
            return(status);
        }

        CChecklistItemData     dta     = new CChecklistItemData(BaseMstr.BaseData);
        CChecklistItemDataItem diLogic = null;

        status = dta.GetCLItemDI(ChecklistID, ChecklistItemID, out diLogic);
        if (!status.Status)
        {
            return(status);
        }

        txtItemLogic.Text = diLogic.Logic;

        return(new CStatus());
    }
Esempio n. 12
0
    /// <summary>
    /// method
    /// US:902
    /// returns the attribute specified by the specifier for the patient item component
    /// specified by the patient id, item id and item component id
    /// </summary>
    /// <param name="strPatientID"></param>
    /// <param name="lItemID"></param>
    /// <param name="lItemComponentID"></param>
    /// <param name="strSpecifier"></param>
    /// <returns></returns>
    private CStringStatus ParsePatItemComp(string strPatientID, long lItemID, long lItemComponentID, string strSpecifier)
    {
        CStatus status = null;

        CPatientItemData PatientItem            = new CPatientItemData(BaseData);
        CPatientItemComponentDataItem diPatItem = null;

        status = PatientItem.GetMostRecentPatientItemCompDI(strPatientID, lItemID, lItemComponentID, out diPatItem);
        if (!status.Status)
        {
            return(new CStringStatus(status, CExpression.NullTkn));
        }

        string strValue = CExpression.NullTkn;

        switch (strSpecifier)
        {
        case "value":
            strValue = (string.IsNullOrEmpty(diPatItem.ComponentValue)) ? CExpression.NullTkn : diPatItem.ComponentValue;
            break;
        }

        CItemData     Item   = new CItemData(BaseData);
        CItemDataItem diItem = null;

        status = Item.GetItemDI(lItemID, out diItem);
        if (!status.Status)
        {
            return(new CStringStatus(status, CExpression.NullTkn));
        }

        if (diItem.ItemTypeID != (long)k_ITEM_TYPE_ID.Laboratory)
        {
            strValue = CExpression.StringTkn + strValue + CExpression.StringTkn;
        }

        return(new CStringStatus(status, strValue));
    }
Esempio n. 13
0
    /// <summary>
    /// method
    /// used to get an individual item matching the label specified
    /// </summary>
    /// <param name="strItemLabel"></param>
    /// <param name="iItem"></param>
    /// <returns></returns>
    public CStatus GetItemDI(string strItemLabel, out CItemDataItem iItem)
    {
        //initialize parameters
        iItem = null;

        //create a status object and check for valid dbconnection
        CStatus status = DBConnValid();

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

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

        // procedure specific parameters
        pList.AddInputParameter("pi_vItemLabel", strItemLabel);

        //get the dataset
        CDataSet cds = new CDataSet();
        DataSet  ds  = null;

        status = cds.GetOracleDataSet(
            DBConn,
            "PCK_ITEM.GetItemDIRS",
            pList,
            out ds);
        if (!status.Status)
        {
            return(status);
        }

        iItem = new CItemDataItem(ds);

        return(status);
    }
    /// <summary>
    /// event
    /// US:902
    /// loads the item component PH list box
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void OnSelIndexChangedItemComp(object sender, EventArgs e)
    {
        ShowMPE();
        lbItemPH.ClearSelection();
        lbItemCompPH.Items.Clear();

        // bind standard options
        CPlaceHolderData PHData = new CPlaceHolderData(BaseMstr.BaseData);
        DataSet          ds     = null;

        CStatus status = PHData.GetPlaceHolderChildDS(k_ITEM_COMPONENT, out ds);

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

        if (ds.Tables[0].Rows.Count > 0)
        {
            lbItemCompPH.DataTextField  = "PLACE_HOLDER_LABEL";
            lbItemCompPH.DataValueField = "PLACE_HOLDER_ID";
            lbItemCompPH.DataSource     = ds;
            lbItemCompPH.DataBind();
            lblItemCompPH.Visible = true;
            lbItemCompPH.Visible  = true;
        }
        else
        {
            lblItemCompPH.Visible = false;
            lbItemCompPH.Visible  = false;
        }

        // bind selection specific options
        CItemData     IData   = new CItemData(BaseMstr.BaseData);
        CItemDataItem di      = null;
        long          lItemID = Convert.ToInt64(lbItem.SelectedValue);

        status = IData.GetItemDI(lItemID, out di);
        if (!status.Status)
        {
            ShowStatusInfo(status);
            return;
        }

        if (di.ItemID != lItemID)
        {
            status.Status        = false;
            status.StatusCode    = k_STATUS_CODE.Failed;
            status.StatusComment = "TODO";
            ShowStatusInfo(status);
            return;
        }

        long lPlaceHolderID = -1;

        switch (di.ItemTypeID)
        {
        case (long)k_ITEM_TYPE_ID.Laboratory:
            lPlaceHolderID = k_IC_RANGE;
            break;

        case (long)k_ITEM_TYPE_ID.QuestionSelection:
            lPlaceHolderID = k_IC_STATE;
            break;

        case (long)k_ITEM_TYPE_ID.QuestionFreeText:
            // there are not any options specific to question free text
            return;
        }

        status = PHData.GetPlaceHolderChildDS(lPlaceHolderID, out ds);
        if (!status.Status)
        {
            ShowStatusInfo(status);
            return;
        }

        lbItemCompPH.DataSource = ds;
        lbItemCompPH.DataBind();
    }
Esempio n. 15
0
    /// <summary>
    /// US:1945 US:1883
    /// save the control
    /// </summary>
    /// <returns></returns>
    public override CStatus SaveControl()
    {
        CItemDataItem item = new CItemDataItem();

        item.ItemTypeID      = Convert.ToInt64(ddlType.SelectedValue);
        item.ItemGroupID     = Convert.ToInt64(ddlGroup.SelectedValue);
        tbLabel.Text         = tbLabel.Text.Trim();
        item.ItemLabel       = tbLabel.Text;
        item.ItemDescription = tbDescription.Text;
        item.LookbackTime    = Convert.ToInt64(tbLookback.Text);
        item.ActiveID        = (chkActive.Checked) ? k_ACTIVE_ID.Active : k_ACTIVE_ID.Inactive;
        item.MapID           = hfMapID.Value;

        CStatus   status   = new CStatus();
        CItemData ItemData = new CItemData(BaseMstr.BaseData);

        if (EditMode == k_EDIT_MODE.INSERT)
        {
            long lItemID = 0;
            status = ItemData.InsertItem(item, out lItemID);
            if (status.Status)
            {
                EditMode = k_EDIT_MODE.UPDATE;
                LongID   = lItemID;
            }
        }
        else if (EditMode == k_EDIT_MODE.UPDATE)
        {
            item.ItemID = LongID;
            status      = ItemData.UpdateItem(item);
        }

        if (status.Status)
        {
            switch (item.ItemTypeID)
            {
            case (long)k_ITEM_TYPE_ID.Laboratory:
            case (long)k_ITEM_TYPE_ID.NoteTitle:
            case (long)k_ITEM_TYPE_ID.QuestionFreeText:
            case (long)k_ITEM_TYPE_ID.QuestionSelection:
                ucItemComponentEditor.ItemID = LongID;
                status = ucItemComponentEditor.SaveControl();
                break;

            case (long)k_ITEM_TYPE_ID.Collection:
                ucItemCollectionEditor.LongID = LongID;
                status = ucItemCollectionEditor.SaveControl();
                break;
            }
        }

        if (status.Status)
        {
            if (ucItemComponentEditor.Count > 0 && hfMapID.Value != "-1")
            {
                ucItemComponentEditor.AddEnabled = false;
            }
        }

        btnCancel.Text = "Close";
        return(status);
    }
Esempio n. 16
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);
    }
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        ((app_ucTimer)UCTimer).StopRefresh();

        //clear the collection and items ddl
        ddlColItems.Items.Clear();
        ddlItems.Items.Clear();

        pnlMapped.Visible     = false;
        ucNoteTitle.Visible   = false;
        pnlComponents.Visible = false;

        CItemData     Item   = new CItemData(BaseMstr.BaseData);
        CItemDataItem di     = null;
        CStatus       status = Item.GetItemDI(ItemID, out di);

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

        ItemTypeID = di.ItemTypeID;

        if (di.ItemTypeID == (long)k_ITEM_TYPE_ID.Collection)
        {
            lblColl.Text     = di.ItemLabel;
            lblCollDesc.Text = di.ItemDescription;

            status = CItem.LoadItemCollectionDDL(
                BaseMstr.BaseData,
                ddlColItems,
                ItemID);
            if (!status.Status)
            {
                return(status);
            }

            lblItem.Text            = string.Empty;
            lblItemDescription.Text = string.Empty;

            pnlCollection.Visible = true;
            pnlComponents.Visible = false;
            ucNoteTitle.Visible   = true;
            ucNoteTitle.Clear();

            txtEntryDate.ReadOnly     = true;
            calEntryDate.Enabled      = false;
            ucTimePicker.Enabled      = false;
            txtEntryDate.Text         = string.Empty;
            calEntryDate.SelectedDate = null;
            ucTimePicker.SetTime(0, 0, 0);

            txtComment.Enabled = false;
            txtComment.Text    = string.Empty;

            gvComponents.DataSource = null;
            gvComponents.DataBind();

            gvComments.DataSource = null;
            gvComments.DataBind();

            //hide the panels and labels for
            //edit until they
            //pick an option
            lblDate.Visible           = false;
            txtEntryDate.Visible      = false;
            ucTimePicker.Visible      = false;
            pnlComments.Visible       = false;
            pnlComponents.Visible     = false;
            lblItemComps.Visible      = false;
            lblNewComment.Visible     = false;
            lblCommentHistory.Visible = false;
            txtComment.Visible        = false;
            ucNoteTitle.Visible       = false;
        }
        else
        {
            pnlCollection.Visible = false;

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

        return(new CStatus());
    }
Esempio n. 18
0
    /// <summary>
    /// US:1945 US:1883
    /// load the control
    /// </summary>
    /// <param name="lEditMode"></param>
    /// <returns></returns>
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        EditMode = lEditMode;
        LoadItemDDLs();

        if (EditMode == k_EDIT_MODE.UPDATE)
        {
            CItemData     ItemData = new CItemData(BaseMstr.BaseData);
            CItemDataItem iItem    = null;
            CStatus       status   = ItemData.GetItemDI(LongID, out iItem);
            if (!status.Status)
            {
                return(status);
            }

            ddlType.SelectedValue = Convert.ToString(iItem.ItemTypeID);
            tbLabel.Text          = iItem.ItemLabel;
            tbDescription.Text    = iItem.ItemDescription;
            tbLookback.Text       = Convert.ToString(iItem.LookbackTime);
            chkActive.Checked     = (iItem.ActiveID == k_ACTIVE_ID.Active) ? true : false;
            hfMapID.Value         = iItem.MapID;
            tbMapID.Text          = (hfMapID.Value != "-1") ? hfMapID.Value : string.Empty;

            try
            {
                ddlGroup.SelectedValue = Convert.ToString(iItem.ItemGroupID);
            }
            catch (Exception)
            {
                ddlGroup.ClearSelection();
            }

            ucItemComponentEditor.ItemID     = LongID;
            ucItemComponentEditor.ItemTypeID = iItem.ItemTypeID;
            ucItemCollectionEditor.LongID    = LongID;

            ShowHideUC(iItem.ItemTypeID);

            switch (iItem.ItemTypeID)
            {
            case (long)k_ITEM_TYPE_ID.Laboratory:
            case (long)k_ITEM_TYPE_ID.NoteTitle:
            case (long)k_ITEM_TYPE_ID.QuestionFreeText:
            case (long)k_ITEM_TYPE_ID.QuestionSelection:
                status = ucItemComponentEditor.LoadControl(EditMode);
                if (!status.Status)
                {
                    return(status);
                }

                if (ucItemComponentEditor.Count > 0 && hfMapID.Value != "-1")
                {
                    ucItemComponentEditor.AddEnabled = false;
                }
                break;

            case (long)k_ITEM_TYPE_ID.Collection:
                status = ucItemCollectionEditor.LoadControl(EditMode);
                if (!status.Status)
                {
                    return(status);
                }
                break;

            default:
                return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
            }
        }
        else if (EditMode == k_EDIT_MODE.INSERT)
        {
            chkActive.Checked = true;
            CStatus status = ucItemComponentEditor.LoadControl(EditMode);
            if (!status.Status)
            {
                return(status);
            }
            ucItemComponentEditor.AddEnabled = false;

            status = ucItemCollectionEditor.LoadControl(EditMode);
            if (!status.Status)
            {
                return(status);
            }
        }

        chkActive.Focus();
        return(new CStatus());
    }
    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());
    }