/// <summary>
    /// Used to insert an outcome state
    /// </summary>
    /// <param name="osdi"></param>
    /// <param name="lOSID"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus InsertOutcomeState(COutcomeStateDataItem osdi, out long lOSID)
    {
        //initialize parameters
        lOSID = 0;

        //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);

        //add the rest of the parameters
        pList.AddInputParameter("pi_vOSLabel", osdi.OSLabel);
        pList.AddInputParameter("pi_nOSDefinitionID", osdi.OSDefinitionID);
        pList.AddInputParameter("pi_nIsActive", (long)((osdi.IsActive) ? k_TRUE_FALSE_ID.True : k_TRUE_FALSE_ID.False));
        pList.AddOutputParameter("po_nOSID", osdi.OSID);

        //execute the SP
        status = DBConn.ExecuteOracleSP("PCK_VARIABLE.InsertOutcomeState", pList);
        if (status.Status)
        {
            //get the TS_ID returned from the SP call
            lOSID = pList.GetParamLongValue("po_nOSID");
        }

        return(status);
    }
    /// <summary>
    /// update an outcome state
    /// </summary>
    /// <param name="lOSID"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatusComment"></param>
    /// <returns></returns>
    private CStatus UpdateOutcomeState(long lOSID)
    {
        COutcomeStateDataItem osdi = LoadNewDataItem();

        osdi.OSID = lOSID;

        COutcomeStateData osd = new COutcomeStateData(BaseMstr.BaseData);

        return(osd.UpdateOutcomeState(osdi));
    }
    /// <summary>
    /// method
    /// creates a new outcome state data item and loads it with the values from the dialog
    /// </summary>
    /// <returns></returns>
    private COutcomeStateDataItem LoadNewDataItem()
    {
        COutcomeStateDataItem di = new COutcomeStateDataItem();

        di.OSID           = -1;
        di.OSLabel        = txtOSLabel.Text;
        di.OSDefinitionID = Convert.ToInt64(ddlOSDefinition.SelectedValue);
        di.IsActive       = chkOSActive.Checked;
        return(di);
    }
    /// <summary>
    /// insert an outcome state
    /// </summary>
    /// <param name="lOSID"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatusComment"></param>
    /// <returns></returns>
    private CStatus InsertOutcomeState(out long lOSID)
    {
        lOSID = -1;

        COutcomeStateDataItem osdi = LoadNewDataItem();

        COutcomeStateData osd    = new COutcomeStateData(BaseMstr.BaseData);
        CStatus           status = osd.InsertOutcomeState(osdi, out lOSID);

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

        LongID = lOSID;

        return(status);
    }
    /// <summary>
    /// load the control
    /// </summary>
    /// <param name="lEditMode"></param>
    /// <returns></returns>
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        //cache the editmode for postbacks
        EditMode = lEditMode;

        //load the OS definition drop down
        CStatus status = LoadOSDefinitionDropDown();

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

        //clear/reset the controls
        txtOSLabel.Text = string.Empty;
        txtOSLabel.Focus();
        ddlOSDefinition.SelectedIndex = -1;
        chkOSActive.Checked           = false;

        if (lEditMode == k_EDIT_MODE.INSERT)
        {
            chkOSActive.Checked = true;
        }
        else if (lEditMode == k_EDIT_MODE.UPDATE)
        {
            //get a 1 record TS dataset
            COutcomeStateDataItem di     = null;
            COutcomeStateData     osData = new COutcomeStateData(BaseMstr.BaseData);
            status = osData.GetOutcomeStateDI(LongID, out di);
            if (!status.Status)
            {
                return(status);
            }

            txtOSLabel.Text = di.OSLabel;
            OriginalLabel   = txtOSLabel.Text;
            ddlOSDefinition.SelectedValue = di.OSDefinitionID.ToString();
            chkOSActive.Checked           = di.IsActive;
        }

        return(status);
    }
示例#6
0
    /// <summary>
    /// US:912
    /// select the current ts,os and ds states
    /// </summary>
    /// <returns></returns>
    public CStatus LoadStates()
    {
        CPatChecklistItemDataItem di  = null;
        CPatChecklistItemData     cid = new CPatChecklistItemData(BaseMstr.BaseData);
        CStatus status = cid.GetPatCLItemDI(PatientChecklistID, ItemID, out di);

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

        //temporal state
        CTemporalStateDataItem diTSi = new CTemporalStateDataItem();
        CTemporalStateData     tsdi  = new CTemporalStateData(BaseMstr.BaseData);

        status = tsdi.GetTemporalStateDI(di.TSID, out diTSi);
        if (!status.Status)
        {
            return(status);
        }
        lblCurrentTS.Text = diTSi.TSLabel;

        //outcome state
        COutcomeStateDataItem diOSi = new COutcomeStateDataItem();
        COutcomeStateData     osdi  = new COutcomeStateData(BaseMstr.BaseData);

        status = osdi.GetOutcomeStateDI(di.OSID, out diOSi);
        if (!status.Status)
        {
            return(status);
        }
        lblCurrentOS.Text = diOSi.OSLabel;

        //DS ddl select
        CDropDownList.SelectItemByValue(ddlDS, di.DSID);

        return(new CStatus());
    }
    public CStatus GetOutcomeStateDI(string strOSLabel, out COutcomeStateDataItem di)
    {
        //initialize parameters
        di = 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);

        pList.AddInputParameter("pi_vOSLabel", strOSLabel);


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

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

        di = new COutcomeStateDataItem(ds);

        return(status);
    }
    /// <summary>
    /// Used to update an outcome state
    /// </summary>
    /// <param name="osdi"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus UpdateOutcomeState(COutcomeStateDataItem osdi)
    {
        //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);

        //add the rest of the parameters
        pList.AddInputParameter("pi_nOSID", osdi.OSID);
        pList.AddInputParameter("pi_vOSLabel", osdi.OSLabel);
        pList.AddInputParameter("pi_nOSDefinitionID", osdi.OSDefinitionID);
        pList.AddInputParameter("pi_nIsActive", (long)((osdi.IsActive) ? k_TRUE_FALSE_ID.True : k_TRUE_FALSE_ID.False));

        //execute the SP
        return(DBConn.ExecuteOracleSP("PCK_VARIABLE.UpdateOutcomeState", pList));
    }
示例#9
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);
    }
示例#10
0
    private CStringStatus ParseDynamicParam(string strExp)
    {
        string strOnlySpecifierTokens = strExp.Replace(CExpression.ParamStartTkn, CExpression.SpecifierTkn);

        strOnlySpecifierTokens = strOnlySpecifierTokens.Replace(CExpression.ParamEndTkn, CExpression.SpecifierTkn);

        string[] straSpecifiers = strOnlySpecifierTokens.Split(
            new char[] { CExpression.SpecifierTkn },
            StringSplitOptions.RemoveEmptyEntries);

        string strParamValue = string.Empty;

        switch (straSpecifiers.Length)
        {
        case 3:
            switch (straSpecifiers[0])
            {
            case "temporalstate":
                CTemporalStateData     TemporalState = new CTemporalStateData(BaseData);
                CTemporalStateDataItem diTS          = null;
                CStatus statusTS = TemporalState.GetTemporalStateDI(straSpecifiers[2], out diTS);
                if (!statusTS.Status)
                {
                    return(new CStringStatus(statusTS, string.Empty));
                }
                strParamValue = (diTS.TSID > 0) ? diTS.TSID.ToString() : CExpression.NullTkn;
                break;

            case "outcomestate":
                COutcomeStateData     OutcomeState = new COutcomeStateData(BaseData);
                COutcomeStateDataItem diOS         = null;
                CStatus statusOS = OutcomeState.GetOutcomeStateDI(straSpecifiers[2], out diOS);
                if (!statusOS.Status)
                {
                    return(new CStringStatus(statusOS, string.Empty));
                }
                strParamValue = (diOS.OSID > 0) ? diOS.OSID.ToString() : CExpression.NullTkn;
                break;

            case "decisionstate":
                CDecisionStateData     DecisionState = new CDecisionStateData(BaseData);
                CDecisionStateDataItem diDS          = null;
                CStatus statusDS = DecisionState.GetDecisionStateDI(straSpecifiers[2], out diDS);
                if (!statusDS.Status)
                {
                    return(new CStringStatus(statusDS, string.Empty));
                }
                strParamValue = (diDS.DSID > 0) ? diDS.DSID.ToString() : CExpression.NullTkn;
                break;

            default:
                return(new CStringStatus(
                           false,
                           k_STATUS_CODE.Failed,
                           LogicModuleMessages.ERROR_EXE_EXP + strExp,
                           string.Empty));
            }
            break;

        default:
            return(new CStringStatus(
                       false,
                       k_STATUS_CODE.Failed,
                       LogicModuleMessages.ERROR_EXE_EXP + strExp,
                       string.Empty));
        }

        return(new CStringStatus(
                   true,
                   k_STATUS_CODE.Success,
                   string.Empty,
                   strParamValue));
    }