Пример #1
0
    /// <summary>
    /// method
    /// US:902
    /// returns the attribute specified by the place holder for the patient specified by the patient id
    /// </summary>
    /// <param name="strPatientID"></param>
    /// <param name="strPlaceHolder"></param>
    /// <returns></returns>
    private CStringStatus ParsePatient(string strPatientID, string strPlaceHolder)
    {
        CPatientData     Patient = new CPatientData(BaseData);
        CPatientDataItem di      = null;
        CStatus          status  = Patient.GetPatientDI(strPatientID, out di);

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

        string strValue = CExpression.NullTkn;

        switch (strPlaceHolder)
        {
        case "patient.age":
            strValue = (di.Age < 1) ? CExpression.NullTkn : di.Age.ToString();
            break;

        case "patient.sex":
            strValue = (Convert.ToInt64(di.Sex) < 1) ? CExpression.NullTkn : Convert.ToInt64(di.Sex).ToString();
            break;
        }

        return(new CStringStatus(status, strValue));
    }
Пример #2
0
    /// <summary>
    /// builds the patient blurb
    /// </summary>
    /// <param name="strPatientID"></param>
    /// <param name="strBlurb"></param>
    /// <returns></returns>
    public CStatus GetPatientBlurb(string strPatientID, out string strBlurb)
    {
        strBlurb = string.Empty;
        CPatientData     p      = new CPatientData(this);
        CPatientDataItem di     = null;
        CStatus          status = p.GetPatientDI(strPatientID, out di);

        if (status.Status)
        {
            strBlurb = di.FirstName + " " + di.LastName + " " + di.SSNLast4 + ", " + di.Age + " yo " + di.SexLabel;
        }

        return(status);
    }
Пример #3
0
    /// <summary>
    /// saves a loaded patient to the database.
    /// pass in lUserID > 0 if you want this patient to
    /// belong to this provider
    /// </summary>
    /// <param name="pdi"></param>
    /// <returns></returns>
    public CStatus SavePatient(
        long lProviderUserID,
        long lTeamID,
        long lSpecialtyID,
        long lWardID,
        long lClinicID,
        long lXferSystemID,
        CPatientDataItem pdi)
    {
        if (pdi == null || String.IsNullOrEmpty(pdi.PatientID))
        {
            return(new CStatus(false, k_STATUS_CODE.Failed, "Could not save patient, invalid data!"));;
        }

        CStatus status = DBConnValid();

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

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

        pList.AddInputParameter("pi_nXferSystemID", lXferSystemID);
        pList.AddInputParameter("pi_vPatientID", pdi.PatientID);
        pList.AddInputParameter("pi_nProviderUserID", lProviderUserID);
        pList.AddInputParameter("pi_nTeamID", lTeamID);
        pList.AddInputParameter("pi_nSpecialtyID", lSpecialtyID);
        pList.AddInputParameter("pi_nWardID", lWardID);
        pList.AddInputParameter("pi_nClinicID", lClinicID);
        pList.AddInputParameter("pi_vSSN", pdi.SSN);
        pList.AddInputParameter("pi_dtDOB", pdi.DOB);
        pList.AddInputParameter("pi_vFirstName", pdi.FirstName);
        pList.AddInputParameter("pi_vFullName", pdi.FullName);
        pList.AddInputParameter("pi_vLastName", pdi.LastName);
        pList.AddInputParameter("pi_vMI", pdi.MI);
        pList.AddInputParameter("pi_nSex", (long)pdi.Sex);

        return(DBConn.ExecuteOracleSP("PCK_PATIENT.SavePatient", pList));
    }
Пример #4
0
    /// <summary>
    /// loads a patient data item by patient id
    /// </summary>
    /// <param name="strPatientID"></param>
    /// <param name="itm"></param>
    /// <param name="lStatusCode"></param>
    /// <param name="strStatus"></param>
    /// <returns></returns>
    public CStatus GetPatientDI(string strPatientID, out CPatientDataItem itm)
    {
        //initialize parameters
        itm = null;

        CStatus status = DBConnValid();

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

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

        pList.AddInputParameter("pi_vPatientID", strPatientID);

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

        status = cds.GetOracleDataSet(
            base.DBConn,
            "PCK_PATIENT.GetPatientIDRS",
            pList,
            out ds);

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

        itm = new CPatientDataItem(ds);

        return(status);
    }
Пример #5
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);
    }