Esempio n. 1
0
    /// <summary>
    /// US:1945 US:1880 load control
    /// </summary>
    /// <param name="lEditMode"></param>
    /// <returns></returns>
    public override CStatus LoadControl(k_EDIT_MODE lEditMode)
    {
        EditMode = lEditMode;

        tbNoteTitle.Text = string.Empty;

        CPatientItemData     PatientItemData = new CPatientItemData(BaseMstr.BaseData);
        CPatientItemDataItem di = null;

        CStatus status = new CStatus();

        //if no pat item id then load the most recent
        if (PatientItemID < 1)
        {
            status = PatientItemData.GetMostRecentPatientItemDI(PatientID,
                                                                ItemID,
                                                                out di);
            if (!status.Status)
            {
                return(status);
            }
        }
        else
        {
            status = PatientItemData.GetPatientItemDI(PatientID,
                                                      ItemID,
                                                      PatientItemID,
                                                      out di);
            if (!status.Status)
            {
                return(status);
            }
        }

        if (string.IsNullOrEmpty(di.PatientID))
        {
            return(new CStatus());
        }

        DataSet ds = null;

        status = PatientItemData.GetPatientItemComponentDS(di.PatientID, di.PatItemID, di.ItemID, out ds);
        if (!status.Status)
        {
            return(status);
        }

        tbNoteTitle.Text = di.ItemLabel + "\r\n";
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            tbNoteTitle.Text += dr["ITEM_COMPONENT_LABEL"].ToString() + "\r\n";
            tbNoteTitle.Text += dr["COMPONENT_VALUE"].ToString() + "\r\n";
        }

        tbNoteTitle.Text += "\r\n";

        return(new CStatus());
    }
    protected CStatus LoadPatComponents()
    {
        CPatientItemData pid     = new CPatientItemData(BaseMstr.BaseData);
        DataSet          dsComps = null;
        CStatus          status  = pid.GetPatientItemComponentDS(
            PatientID,
            Convert.ToInt64(ddlItems.SelectedValue),
            ItemID,
            out dsComps);

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

        DataTable dtComps = dsComps.Tables[0];

        if (dtComps == null || dtComps.Rows.Count != gvComponents.Rows.Count)
        {
            return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
        }

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

            DataRow drComp = dtComps.Select("ITEM_COMPONENT_ID = " + gvComponents.DataKeys[gvr.DataItemIndex][nItemComponentIDIndex].ToString())[0];
            switch ((k_ITEM_TYPE_ID)ItemTypeID)
            {
            case k_ITEM_TYPE_ID.Laboratory:
                txtVal.Text = drComp["COMPONENT_VALUE"].ToString();
                break;

            case k_ITEM_TYPE_ID.QuestionFreeText:
                txtVal.Text = drComp["COMPONENT_VALUE"].ToString();
                break;

            case k_ITEM_TYPE_ID.QuestionSelection:
                rbSelect.Checked = (drComp["COMPONENT_VALUE"].ToString() == "1") ? true : false;
                break;

            default:
                return(new CStatus(false, k_STATUS_CODE.Failed, "TODO"));
            }
        }

        return(new CStatus());
    }
Esempio n. 3
0
    /// <summary>
    /// US:1880 gets the most recent result, loops over all components and pieces together a string
    /// </summary>
    /// <param name="pid"></param>
    /// <param name="pidi"></param>
    /// <param name="strResult"></param>
    /// <returns></returns>
    public CStatus GetMostRecentResult(out string strResult)
    {
        strResult = string.Empty;

        //load the last result for this item
        CPatientItemData     pid  = new CPatientItemData(BaseMstr.BaseData);
        CPatientItemDataItem pidi = new CPatientItemDataItem();
        CStatus status            = pid.GetMostRecentPatientItemDI(PatientID, ItemID, out pidi);

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

        if (pidi.PatItemID < 1)
        {
            return(new CStatus());
        }

        DataSet dsComps = null;

        status = pid.GetPatientItemComponentDS(
            PatientID,
            pidi.PatItemID,
            pidi.ItemID,
            out dsComps);
        if (!status.Status)
        {
            return(status);
        }

        foreach (DataRow row in dsComps.Tables[0].Rows)
        {
            string strLabel = CDataUtils.GetDSStringValue(row, "item_component_label");
            string strValue = CDataUtils.GetDSStringValue(row, "component_value");
            string strUnits = CDataUtils.GetDSStringValue(row, "units");

            string strWarning = String.Empty;

            //question selection
            if (pidi.ItemTypeID == (long)k_ITEM_TYPE_ID.QuestionSelection)
            {
                if (strValue == "1")
                {
                    strResult += "<font face=\"verdana,arial\" size=\"-1\">";
                    strResult += strLabel;
                    strResult += "<br /></font>";
                }
            }

            //question free text
            else if (pidi.ItemTypeID == (long)k_ITEM_TYPE_ID.QuestionFreeText)
            {
                strResult += "<font face=\"verdana,arial\" size=\"-1\">";
                strResult += strLabel;
                strResult += ": ";
                strResult += strValue;
                strResult += "<br /></font>";
            }

            //lab
            else if (pidi.ItemTypeID == (long)k_ITEM_TYPE_ID.Laboratory)
            {
                if (CDataUtils.IsNumeric(strValue))
                {
                    double dblLegalMin     = CDataUtils.GetDSDoubleValue(row, "LEGAL_MIN");
                    double dblLow          = CDataUtils.GetDSDoubleValue(row, "LOW");
                    double dblCritialLow   = CDataUtils.GetDSDoubleValue(row, "CRITICAL_LOW");
                    double dblHigh         = CDataUtils.GetDSDoubleValue(row, "HIGH");
                    double dblCriticalHigh = CDataUtils.GetDSDoubleValue(row, "CRITICAL_HIGH");
                    double dblLegalMax     = CDataUtils.GetDSDoubleValue(row, "LEGAL_MAX");

                    double dblValue = Convert.ToDouble(strValue);
                    if (dblValue < dblLegalMin)
                    {
                        strWarning = "LESS THAN LEGAL MIN";
                    }
                    else if (dblValue < dblCritialLow)
                    {
                        strWarning = "CRITICAL LOW";
                    }
                    else if (dblValue < dblLow)
                    {
                        strWarning = "LOW";
                    }
                    else if (dblValue > dblLegalMax)
                    {
                        strWarning = "GREATER THAN LEGAL MAX";
                    }
                    else if (dblValue > dblCriticalHigh)
                    {
                        strWarning = "CRITICAL HIGH";
                    }
                    else if (dblValue > dblHigh)
                    {
                        strWarning = "HIGH";
                    }
                }

                strResult += "<font face=\"verdana,arial\" size=\"-1\">";
                strResult += strLabel;
                strResult += ": ";
                strResult += strValue;
                strResult += " ";
                strResult += strUnits;
                strResult += " ";
                strResult += strWarning;
                strResult += "<br /></font>";

                string strLegalMin     = CDataUtils.GetDSStringValue(row, "LEGAL_MIN");
                string strLow          = CDataUtils.GetDSStringValue(row, "LOW");
                string strCritialLow   = CDataUtils.GetDSStringValue(row, "CRITICAL_LOW");
                string strHigh         = CDataUtils.GetDSStringValue(row, "HIGH");
                string strCriticalHigh = CDataUtils.GetDSStringValue(row, "CRITICAL_HIGH");
                string strLegalMax     = CDataUtils.GetDSStringValue(row, "LEGAL_MAX");

                strResult += "<font face=\"verdana,arial\" size=\"-2\">";
                strResult += "(Legal Min: " + strLegalMin + " ";
                strResult += "Low: " + strLow + " ";
                strResult += "Critical Low: " + strCritialLow + " ";
                strResult += "High: " + strHigh + " ";
                strResult += "Critical High: " + strCriticalHigh + " ";
                strResult += "Legal Max: " + strLegalMax + ") ";
                strResult += "<br /><br /></font>";
            }
        }

        return(new CStatus());
    }