예제 #1
0
    protected void OnContinueExisting(object sender, CAppUserControlArgs e)
    {
        CPatChecklistDataItem di = new CPatChecklistDataItem();

        di.ProcedureDate    = CDataUtils.GetNullDate();
        di.AssignmentDate   = DateTime.Now;
        di.ChecklistID      = ucExistingChecklist.ChecklistID;
        di.ChecklistStateID = k_CHECKLIST_STATE_ID.Open;
        di.PatientID        = PatientID;
        di.StateID          = k_STATE_ID.Unknown;

        long lPatCLID            = 0;
        CPatChecklistData pcld   = new CPatChecklistData(BaseMstr.BaseData);
        CStatus           status = pcld.InsertPatChecklist(di, out lPatCLID);

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

        if (BaseMstr.MDWSTransfer)
        {
            //talk to the communicator to update the
            //patient checklist from mdws
            CCommunicator com = new CCommunicator();
            status = com.RefreshPatientCheckList(
                BaseMstr.DBConn,
                BaseMstr.BaseData,
                PatientID,
                lPatCLID);
            if (!status.Status)
            {
                ShowStatusInfo(status);
                return;
            }
        }

        CPatientChecklist pcl = new CPatientChecklist();

        status = pcl.LoadPatientChecklists(BaseMstr, PatientID, ddlPatChecklist);
        if (!status.Status)
        {
            ShowStatusInfo(status);
            return;
        }
        ddlPatChecklist.SelectedValue = lPatCLID.ToString();

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

        //set the UI permissions based on the user logged in
        SetPermissions(btnTIU.Enabled);
    }
예제 #2
0
    /// <summary>
    /// US:891
    /// US:894
    /// event
    /// refreshes the page with vista data
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void OnRefresh(object sender, EventArgs e)
    {
        //if MDWS is on, transfer data from mdws to the vappct db
        if (Master.MDWSTransfer)
        {
            //set the date from and date to
            DateTime dtFrom = CDataUtils.GetNullDate();
            DateTime dtTo   = CDataUtils.GetNullDate();
            if (chkFilterByEvent.Checked)
            {
                dtFrom = CDataUtils.GetDate(txtFromDate.Text);
                dtTo   = CDataUtils.GetDate(txtToDate.Text);
            }

            //checklist id
            long lChecklistID = -1;
            if (chkChecklist.Checked)
            {
                lChecklistID = ChecklistID;
            }

            //set the checklist Status
            long lChecklistStatus = -1;
            if (chkChecklistStatus.Checked &&
                ddlChecklistStatus.SelectedItem != null &&
                ddlChecklistStatus.SelectedValue != "-1")
            {
                lChecklistStatus = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue);
            }

            //set the checklist Status
            long lChecklistServiceID = -1;
            if (chkFilterByCLService.Checked &&
                ddlFilterByService.SelectedItem != null &&
                ddlFilterByService.SelectedValue != "-1")
            {
                lChecklistServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue);
            }

            ThreadType = k_MULTI_PAT_THREAD_TYPE.Refresh;

            GetPatCLIDs(
                dtFrom,
                dtTo,
                lChecklistID,
                lChecklistStatus,
                lChecklistServiceID);

            ProcessingCancelled = false;
            Master.ShowStatusInfo(ThreadMultiPatient());
        }
    }
예제 #3
0
    /// <summary>
    /// override
    /// validates the checklist's fields
    /// </summary>
    /// <param name="lStatusCode"></param>
    /// <param name="plistStatus"></param>
    /// <returns></returns>
    public override CStatus ValidateUserInput(out CParameterList plistStatus)
    {
        plistStatus = new CParameterList();
        CPatChecklistData     pcld = new CPatChecklistData(BaseMstr.BaseData);
        CPatChecklistDataItem di   = null;
        CStatus status             = pcld.GetPatChecklistDI(Convert.ToInt64(ddlPatChecklist.SelectedValue), out di);

        if (!status.Status)
        {
            plistStatus.AddInputParameter("ERROR_SP_CURCHECKLIST", Resources.ErrorMessages.ERROR_SP_CURCHECKLIST);
            return(status);
        }

        if (ChecklistStateID != di.ChecklistStateID &&
            (di.ChecklistStateID == k_CHECKLIST_STATE_ID.Cancelled || di.ChecklistStateID == k_CHECKLIST_STATE_ID.Closed))
        {
            plistStatus.AddInputParameter("ERROR_SP_CHECKLISTSTATE", Resources.ErrorMessages.ERROR_SP_CHECKLISTSTATE);
            status.Status     = false;
            status.StatusCode = k_STATUS_CODE.Failed;
            return(status);
        }

        DateTime dtProceduteDate = CDataUtils.GetDate(
            tbProcedureDate.Text,
            ucProcedureTime.HH,
            ucProcedureTime.MM,
            ucProcedureTime.SS);

        if (dtProceduteDate != CDataUtils.GetNullDate() && dtProceduteDate < DateTime.Now)
        {
            plistStatus.AddInputParameter("ERROR_PROCEDURE_DATE", Resources.ErrorMessages.ERROR_PROCEDURE_DATE);
        }

        if (plistStatus.Count > 0)
        {
            status.Status     = false;
            status.StatusCode = k_STATUS_CODE.Failed;
        }

        return(status);
    }
    /// <summary>
    /// do the actual work of assigning the checklist
    /// </summary>
    /// <param name="state"></param>
    public void DoWork(Object state)
    {
        //thread hashcount work
        lock (HashCount)
        {
            if (!HashCount.ContainsKey(Thread.CurrentThread.GetHashCode()))
            {
                HashCount.Add(Thread.CurrentThread.GetHashCode(), 0);
            }

            HashCount[Thread.CurrentThread.GetHashCode()] = ((int)HashCount[Thread.CurrentThread.GetHashCode()]) + 1;
        }

        //do the real work here
        //////////////////////////////////////////////////////////////

        //create a new connection for the thread
        CDataDBConn conn = new CDataDBConn();

        conn.Connect();
        CData data = new CData(
            conn,
            this.ClientIP,
            this.UserID,
            this.SessionID,
            this.WebSession,
            this.MDWSTransfer);


        CPatChecklistData     pcl          = new CPatChecklistData(data);
        string                strPatientID = PatientID;
        CPatChecklistDataItem di           = new CPatChecklistDataItem();

        di.ProcedureDate    = CDataUtils.GetNullDate();
        di.AssignmentDate   = DateTime.Now;
        di.ChecklistID      = ChecklistID;
        di.ChecklistStateID = k_CHECKLIST_STATE_ID.Open;
        di.PatientID        = strPatientID;
        di.StateID          = k_STATE_ID.Unknown;

        long lPatCLID = 0;

        Status = pcl.InsertPatChecklist(di, out lPatCLID);
        if (Status.Status)
        {
            if (MDWSTransfer)
            {
                //talk to the communicator to update the
                //patient checklist from mdws
                CCommunicator com = new CCommunicator();
                Status = com.RefreshPatientCheckList(
                    conn,
                    data,
                    strPatientID,
                    lPatCLID);
            }

            if (Status.Status)
            {
                CPatientChecklistLogic pcll = new CPatientChecklistLogic(data);
                Status = pcll.RunLogic(lPatCLID);
            }
        }

        //cleanup the database connection
        conn.Close();

        //signals we are done.
        Interlocked.Increment(ref ThreadCount);
        if (ThreadCount == ThreadMax)
        {
            if (eventX != null)
            {
                eventX.Set();
                ThreadCount = 0;
                ThreadMax   = 0;
            }
        }
    }
    /// <summary>
    /// method
    /// US:902
    /// evaluates all the expressions in the list
    /// </summary>
    /// <returns></returns>
    public CStatus Evaluate()
    {
        CParseExpression ParseExp = new CParseExpression(BaseData, PatientID, PatCLID, ChecklistID, ItemID);
        CStatus          status   = new CStatus();

        foreach (CExpression exp in this)
        {
            CStringStatus ss = ParseExp.Parse(exp.GetIf());
            if (!ss.Status)
            {
                status = ss;
                break;
            }

            if (ss.Value.IndexOf(CExpression.NullTkn) >= 0)
            {
                CPatChecklistItemData     PatChecklistItem = new CPatChecklistItemData(BaseData);
                CPatChecklistItemDataItem di = null;
                status = PatChecklistItem.GetPatCLItemDI(PatCLID, ItemID, out di);
                if (!status.Status)
                {
                    return(status);
                }

                di.TSID         = Convert.ToInt64(k_DEFAULT_STATE_ID.Bad);
                di.OSID         = Convert.ToInt64(k_DEFAULT_STATE_ID.Unknown);
                di.IsOverridden = k_TRUE_FALSE_ID.False;
                di.OverrideDate = CDataUtils.GetNullDate();
                di.DSID         = Convert.ToInt64(k_DEFAULT_STATE_ID.Bad);

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

                continue;
            }

            int nResult = CLogic.Evaluate(ss.Value);
            CExecuteExpression ExecuteExp = new CExecuteExpression(
                BaseData,
                PatientID,
                PatCLID,
                ChecklistID,
                ItemID);
            switch (nResult)
            {
            // false
            case 0:
                string strElse = exp.GetElse();
                if (!string.IsNullOrEmpty(strElse))
                {
                    status = ExecuteExp.Execute(strElse);
                }
                break;

            // true
            case 1:
                status = ExecuteExp.Execute(exp.GetThen());
                break;

            // error
            case 2:
                status.Status        = false;
                status.StatusCode    = k_STATUS_CODE.Failed;
                status.StatusComment = LogicModuleMessages.ERROR_LOGIC + exp.Expression;
                break;
            }

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

        return(status);
    }
예제 #6
0
    /// <summary>
    /// method
    /// US:910
    /// executes the action specified by the action string on the patient checklist item specified by the patient checklist id and item id
    /// </summary>
    /// <param name="lPatCLID"></param>
    /// <param name="lItemID"></param>
    /// <param name="strProperty"></param>
    /// <param name="strAction"></param>
    /// <param name="lID"></param>
    /// <returns></returns>
    private CStatus ExecutePatCLI(
        long lPatCLID,
        long lItemID,
        string strProperty,
        string strAction,
        long lID)
    {
        CPatChecklistItemData     PatChecklistItem = new CPatChecklistItemData(BaseData);
        CPatChecklistItemDataItem di = null;
        CStatus status = PatChecklistItem.GetPatCLItemDI(lPatCLID, lItemID, out di);

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

        switch (strAction)
        {
        case "set":
            switch (strProperty)
            {
            case "temporalstate":
                di.TSID = lID;
                break;

            case "outcomestate":
                di.OSID = lID;
                break;

            case "decisionstate":
                if (di.IsOverridden == k_TRUE_FALSE_ID.True)
                {
                    CPatientItemData     pi   = new CPatientItemData(BaseData);
                    CPatientItemDataItem pidi = null;
                    status = pi.GetMostRecentPatientItemDI(
                        PatientID,
                        lItemID,
                        out pidi);
                    if (!status.Status)
                    {
                        return(status);
                    }

                    if (di.OverrideDate < pidi.EntryDate)
                    {
                        di.IsOverridden = k_TRUE_FALSE_ID.False;
                        di.OverrideDate = CDataUtils.GetNullDate();
                        di.DSID         = lID;
                    }
                }
                else
                {
                    di.DSID = lID;
                }
                break;
            }
            return(PatChecklistItem.UpdatePatChecklistItem(di));

        default:
            return(new CStatus(false,
                               k_STATUS_CODE.Failed,
                               LogicModuleMessages.ERROR_EXE_EXP + strProperty + CExpression.SpecifierTkn + strAction
                               + CExpression.ParamStartTkn + lID.ToString() + CExpression.ParamEndTkn));
        }
    }
예제 #7
0
    /// <summary>
    /// method to run logic over a colletion
    ///     1. all items in multi select must be have an option selected
    ///     2. all free text items must have data entered
    ///     3. labs and note titles are ignored
    ///     4. items that are not ACTIVE are ignored
    /// </summary>
    public CStatus RunCollectionLogic(string strPatientID,
                                      long lPatChecklistID,
                                      long lChecklistID,
                                      long lCollectionItemID)
    {
        //Get the patient checklist item data
        CPatChecklistItemData     PatChecklistItem = new CPatChecklistItemData(this);
        CPatChecklistItemDataItem pdi = null;

        PatChecklistItem.GetPatCLItemDI(lPatChecklistID,
                                        lCollectionItemID,
                                        out pdi);

        //get all the items in the collection
        CItemCollectionData coll   = new CItemCollectionData(this);
        DataSet             dsColl = null;
        CStatus             status = coll.GetItemCollectionDS(lCollectionItemID, out dsColl);

        //get all the patient item components in the collection
        DataSet dsPatItemComps = null;

        status = coll.GetItemColMostRecentPatICDS(lCollectionItemID, strPatientID, out dsPatItemComps);

        //if this collection item is overridden just return and don't update the state
        if (pdi.IsOverridden == k_TRUE_FALSE_ID.True)
        {
            bool bReturn = true;

            //check to see if there is a new result and override if there is...
            foreach (DataTable tableI in dsColl.Tables)
            {
                foreach (DataRow drI in tableI.Rows)
                {
                    //get values from the the item in the collection (not the patient items, the collection items)
                    long lItemID     = CDataUtils.GetDSLongValue(drI, "ITEM_ID");
                    long lItemTypeID = CDataUtils.GetDSLongValue(drI, "ITEM_TYPE_ID");
                    long lActiveID   = CDataUtils.GetDSLongValue(drI, "ACTIVE_ID");

                    //get the item so we can check entry date against TS etc...
                    CPatientItemDataItem patItemDI = null;
                    CPatientItemData     patData   = new CPatientItemData(this);
                    patData.GetMostRecentPatientItemDI(strPatientID, lItemID, out patItemDI);
                    DateTime dtEntryDate = patItemDI.EntryDate;

                    if (dtEntryDate > pdi.OverrideDate)
                    {
                        pdi.OverrideDate = CDataUtils.GetNullDate();
                        pdi.IsOverridden = k_TRUE_FALSE_ID.False;
                        PatChecklistItem.UpdatePatChecklistItem(pdi);
                        bReturn = false;
                        break;
                    }
                }
            }

            if (bReturn)
            {
                //return if this item is overridden and there are no new results
                return(new CStatus());
            }
        }

        //get the checklist item di
        CChecklistItemDataItem cidDI = null;
        CChecklistItemData     cid   = new CChecklistItemData(this);

        cid.GetCLItemDI(lChecklistID, lCollectionItemID, out cidDI);

        //calculate how far the TS can go back
        long     lTS         = cidDI.CLITSTimePeriod;
        DateTime dtNow       = DateTime.Now;
        DateTime dtTSCompare = dtNow.AddDays(-1 * lTS);

        //keeps the overall OS state of the items
        k_STATE_ID kOverallOSStateID = k_STATE_ID.NotSelected;

        //keeps the overall TS state of the items
        k_STATE_ID kOverallTSStateID = k_STATE_ID.NotSelected;

        //loop over the collection items
        foreach (DataTable table in dsColl.Tables)
        {
            foreach (DataRow dr in table.Rows)
            {
                //get values from the the item in the collection (not the patient items, the collection items)
                long lItemID     = CDataUtils.GetDSLongValue(dr, "ITEM_ID");
                long lItemTypeID = CDataUtils.GetDSLongValue(dr, "ITEM_TYPE_ID");
                long lActiveID   = CDataUtils.GetDSLongValue(dr, "ACTIVE_ID");

                //get the item so we can check entry date against TS etc...
                CPatientItemDataItem patItemDI = null;
                CPatientItemData     patData   = new CPatientItemData(this);
                patData.GetMostRecentPatientItemDI(strPatientID, lItemID, out patItemDI);
                DateTime dtEntryDate = patItemDI.EntryDate;

                //only interested in ACTIVE items
                if ((k_ACTIVE)lActiveID == k_ACTIVE.ACTIVE)
                {
                    //check the TS and set overall TS state
                    k_COMPARE kTS = CDataUtils.CompareDates(dtEntryDate, dtTSCompare);
                    if (kTS == k_COMPARE.GREATERTHAN ||
                        kTS == k_COMPARE.EQUALTO)
                    {
                        //good
                        if (kOverallTSStateID != k_STATE_ID.Bad)
                        {
                            kOverallTSStateID = k_STATE_ID.Good;
                        }
                    }
                    else
                    {
                        //bad
                        kOverallTSStateID = k_STATE_ID.Bad;
                    }

                    //list to hold the created component items
                    CPatientItemCompList PatItemCompList = new CPatientItemCompList();

                    //build a pat item component list loaded with the most recent
                    //values
                    foreach (DataTable tableComp in dsPatItemComps.Tables)
                    {
                        foreach (DataRow drComp in tableComp.Rows)
                        {
                            //values to load the component item
                            long   lCompItemID       = CDataUtils.GetDSLongValue(drComp, "ITEM_ID");
                            long   lComponentID      = CDataUtils.GetDSLongValue(drComp, "ITEM_COMPONENT_ID");
                            string strComponentValue = CDataUtils.GetDSStringValue(drComp, "COMPONENT_VALUE");
                            long   lPatItemID        = CDataUtils.GetDSLongValue(drComp, "PAT_ITEM_ID");
                            //only this item
                            if (lCompItemID == lItemID)
                            {
                                CPatientItemComponentDataItem diComp = new CPatientItemComponentDataItem();
                                diComp.PatientID      = strPatientID;
                                diComp.ItemID         = lCompItemID;
                                diComp.ComponentID    = lComponentID;
                                diComp.ComponentValue = strComponentValue;
                                diComp.PatItemID      = lPatItemID;

                                PatItemCompList.Add(diComp);
                            }
                        }

                        //we now have a list of item components for this item
                        //loop and get status for this item and update the overall status
                        bool bHasSelectedValue = false;
                        foreach (CPatientItemComponentDataItem diPatItemComp in PatItemCompList)
                        {
                            //get the state id for this component
                            CICStateDataItem   sdi = null;
                            CItemComponentData icd = new CItemComponentData(this);
                            icd.GetICStateDI(lItemID, diPatItemComp.ComponentID, out sdi);

                            //switch on the type and get the value
                            switch ((k_ITEM_TYPE_ID)lItemTypeID)
                            {
                            case k_ITEM_TYPE_ID.Laboratory:
                            {
                                bHasSelectedValue = true;

                                //get the ranges
                                CICRangeDataItem rdi = null;
                                icd.GetICRangeDI(lItemID, diPatItemComp.ComponentID, out rdi);
                                if (String.IsNullOrEmpty(diPatItemComp.ComponentValue))
                                {
                                    //does not have a value?
                                    kOverallOSStateID = k_STATE_ID.Unknown;
                                }
                                else
                                {
                                    try
                                    {
                                        double dblValue = Convert.ToDouble(diPatItemComp.ComponentValue);

                                        //max/high check
                                        if (dblValue >= rdi.LegalMax)
                                        {
                                            if (kOverallOSStateID != k_STATE_ID.Bad)
                                            {
                                                kOverallOSStateID = k_STATE_ID.Unknown;
                                            }
                                        }
                                        else
                                        {
                                            if (dblValue >= rdi.High)
                                            {
                                                kOverallOSStateID = k_STATE_ID.Bad;
                                            }
                                            else
                                            {
                                                if (kOverallOSStateID != k_STATE_ID.Bad)
                                                {
                                                    kOverallOSStateID = k_STATE_ID.Good;
                                                }
                                            }
                                        }

                                        //min/low check
                                        if (dblValue <= rdi.LegalMin)
                                        {
                                            if (kOverallOSStateID != k_STATE_ID.Bad)
                                            {
                                                kOverallOSStateID = k_STATE_ID.Unknown;
                                            }
                                        }
                                        else
                                        {
                                            if (dblValue <= rdi.Low)
                                            {
                                                kOverallOSStateID = k_STATE_ID.Bad;
                                            }
                                            else
                                            {
                                                if (kOverallOSStateID != k_STATE_ID.Bad)
                                                {
                                                    kOverallOSStateID = k_STATE_ID.Good;
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        if (kOverallOSStateID != k_STATE_ID.Bad)
                                        {
                                            kOverallOSStateID = k_STATE_ID.Unknown;
                                        }
                                    }
                                }

                                break;
                            }

                            case k_ITEM_TYPE_ID.NoteTitle:
                            {
                                //note titles are excluded from quick entry
                                //so if we have one our os state is unknown
                                bHasSelectedValue = true;
                                kOverallOSStateID = k_STATE_ID.Unknown;
                                break;
                            }

                            case k_ITEM_TYPE_ID.QuestionFreeText:
                            {
                                bHasSelectedValue = true;
                                if (diPatItemComp.ComponentValue.Length < 1)
                                {
                                    //if they did not enter a value
                                    //then the overall state is bad!
                                    kOverallOSStateID = k_STATE_ID.Bad;
                                }
                                break;
                            }

                            case k_ITEM_TYPE_ID.QuestionSelection:
                                if (!String.IsNullOrEmpty(diPatItemComp.ComponentValue))
                                {
                                    //only interested in the one they selected
                                    if ((k_TRUE_FALSE_ID)Convert.ToInt64(diPatItemComp.ComponentValue) != k_TRUE_FALSE_ID.False)
                                    {
                                        bHasSelectedValue = true;
                                        if (kOverallOSStateID != k_STATE_ID.Bad)
                                        {
                                            if ((k_STATE_ID)sdi.StateID == k_STATE_ID.Bad)
                                            {
                                                kOverallOSStateID = k_STATE_ID.Bad;
                                            }
                                            else
                                            {
                                                if ((k_STATE_ID)sdi.StateID == k_STATE_ID.Good)
                                                {
                                                    if (kOverallOSStateID != k_STATE_ID.Unknown)
                                                    {
                                                        kOverallOSStateID = k_STATE_ID.Good;
                                                    }
                                                }
                                                else
                                                {
                                                    kOverallOSStateID = k_STATE_ID.Unknown;
                                                }
                                            }
                                        }
                                    }
                                }
                                break;
                            }
                        }//for each

                        //if there is nothing selected then the
                        //overall TS state is bad and the OS state is unknown
                        if (!bHasSelectedValue)
                        {
                            kOverallOSStateID = k_STATE_ID.Unknown;
                            kOverallTSStateID = k_STATE_ID.Bad;
                        }
                    }
                }
            }
        }

        //
        //now update the collection item states.
        //

        //get the ts,os and ds possible values
        CChecklistItemData dCL  = new CChecklistItemData(this);
        DataSet            dsTS = null;

        dCL.GetTemporalStateDS(lChecklistID, lCollectionItemID, out dsTS);
        long lGoodTSID    = dCL.GetTSDefaultStateID(dsTS, k_STATE_ID.Good);
        long lBadTSID     = dCL.GetTSDefaultStateID(dsTS, k_STATE_ID.Bad);
        long lUnknownTSID = dCL.GetTSDefaultStateID(dsTS, k_STATE_ID.Unknown);

        DataSet dsOS = null;

        dCL.GetOutcomeStateDS(lChecklistID, lCollectionItemID, out dsOS);
        long lGoodOSID    = dCL.GetOSDefaultStateID(dsOS, k_STATE_ID.Good);
        long lBadOSID     = dCL.GetOSDefaultStateID(dsOS, k_STATE_ID.Bad);
        long lUnknownOSID = dCL.GetOSDefaultStateID(dsOS, k_STATE_ID.Unknown);

        DataSet dsDS = null;

        dCL.GetDecisionStateDS(lChecklistID, lCollectionItemID, out dsDS);
        long lGoodDSID    = dCL.GetDSDefaultStateID(dsDS, k_STATE_ID.Good);
        long lBadDSID     = dCL.GetDSDefaultStateID(dsDS, k_STATE_ID.Bad);
        long lUnknownDSID = dCL.GetDSDefaultStateID(dsDS, k_STATE_ID.Unknown);

        //update the TS state on the data item
        if (kOverallTSStateID == k_STATE_ID.Bad)
        {
            pdi.TSID = lBadTSID;
        }
        else if (kOverallTSStateID == k_STATE_ID.Good)
        {
            pdi.TSID = lGoodTSID;
        }
        else
        {
            pdi.TSID = lUnknownTSID;
        }

        //update the OS state on the data item
        if (kOverallOSStateID == k_STATE_ID.Bad)
        {
            pdi.OSID = lBadOSID;
        }
        else if (kOverallOSStateID == k_STATE_ID.Good)
        {
            pdi.OSID = lGoodOSID;
        }
        else
        {
            pdi.OSID = lUnknownOSID;
        }

        //update the ds state on the item data
        if (kOverallTSStateID == k_STATE_ID.Good &&
            kOverallOSStateID == k_STATE_ID.Good)
        {
            pdi.DSID = lGoodDSID;
        }
        else
        {
            pdi.DSID = lBadDSID;
        }

        //update the checklist item state
        status = PatChecklistItem.UpdatePatChecklistItem(pdi);

        return(status);
    }
예제 #8
0
    /// <summary>
    /// method
    /// US:838
    /// do the actual search for patients
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    /// <param name="strUserID"></param>
    /// <returns></returns>
    protected CStatus PatientLookup(
        Object sender,
        EventArgs e,
        string strUserID)
    {
        CParameterList pListStatus = null;

        //validate the user input
        CStatus status = ValidateUserInput(out pListStatus);

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

        //get values for the query

        //date from and date to
        DateTime dtFrom = CDataUtils.GetNullDate();
        DateTime dtTo   = CDataUtils.GetNullDate();

        if (chkFilterByEvent.Checked)
        {
            dtFrom = CDataUtils.GetDate(txtFromDate.Text);
            dtTo   = CDataUtils.GetDate(txtToDate.Text);
        }

        //last name
        string strLastName = String.Empty;

        if (chkLastName.Checked)
        {
            strLastName = txtLastName.Text;
        }

        //lssn
        string strLSSN = String.Empty;

        if (chkLSSN.Checked)
        {
            strLSSN = txtLSSN.Text;
        }

        //checklist id
        long lChecklistID = -1;

        if (chkChecklist.Checked)
        {
            lChecklistID = ChecklistID;
        }

        //checklist Status
        long lChecklistStatus = -1;

        if (chkChecklistStatus.Checked)
        {
            if (ddlChecklistStatus.SelectedItem != null)
            {
                if (ddlChecklistStatus.SelectedValue != "-1")
                {
                    lChecklistStatus = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue);
                }
            }
        }

        //service
        long lServiceID = -1;

        if (chkFilterByCLService.Checked)
        {
            if (ddlFilterByService.SelectedItem != null)
            {
                if (ddlFilterByService.SelectedValue != "-1")
                {
                    lServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue);
                }
            }
        }

        //do we have left side checklist criteria for the query
        bool bHasChecklistCriteria = HasChecklistCriteria(strUserID);

        //team
        string strTeamID = String.Empty;

        status = GetSelectedOptionID(
            OPTION_TEAMS,
            bHasChecklistCriteria,
            out strTeamID);
        if (!status.Status)
        {
            return(status);
        }

        //specialty
        string strSpecialtyID = String.Empty;

        status = GetSelectedOptionID(
            OPTION_SPECIALTIES,
            bHasChecklistCriteria,
            out strSpecialtyID);
        if (!status.Status)
        {
            return(status);
        }

        //ward
        string strWardID = String.Empty;

        status = GetSelectedOptionID(
            OPTION_WARDS,
            bHasChecklistCriteria,
            out strWardID);
        if (!status.Status)
        {
            return(status);
        }

        //clinic
        string strClinicID = String.Empty;

        status = GetSelectedOptionID(
            OPTION_CLINICS,
            bHasChecklistCriteria,
            out strClinicID);
        if (!status.Status)
        {
            return(status);
        }

        //if team, ward or specialty are loaded then we have criteria
        //beacause the user can search for patients without cl criteria
        //for team,ward,specialty searches
        if (!String.IsNullOrEmpty(strTeamID))
        {
            bHasChecklistCriteria = true;
        }
        if (!String.IsNullOrEmpty(strWardID))
        {
            bHasChecklistCriteria = true;
        }
        if (!String.IsNullOrEmpty(strSpecialtyID))
        {
            bHasChecklistCriteria = true;
        }
        if (!String.IsNullOrEmpty(strClinicID))
        {
            bHasChecklistCriteria = true;
        }

        //make sure some criteria is selected before searching
        if (!bHasChecklistCriteria)
        {
            status.Status        = false;
            status.StatusCode    = k_STATUS_CODE.Failed;
            status.StatusComment = "Please select at least one checklist search criteria before searching.";
            return(status);
        }

        //get a dataset matching criteria
        CPatientData pat = new CPatientData(BaseMstr.BaseData);
        DataSet      ds  = null;

        status = pat.GetPatientSearchDS(dtFrom,
                                        dtTo,
                                        strLastName,
                                        strLSSN,
                                        lChecklistID,
                                        lChecklistStatus,
                                        strUserID,
                                        strTeamID,
                                        strWardID,
                                        strSpecialtyID,
                                        strClinicID,
                                        lServiceID,
                                        out ds);
        if (status.Status)
        {
            //keep a copy of the full DS for paging if needed
            PatientDataTable = ds.Tables[0];

            //raise the event
            if (_Search != null)
            {
                _Search(sender, e);
            }
        }

        return(status);
    }
예제 #9
0
    /// <summary>
    /// method
    /// US:838
    /// helper to determine if the user has selected criteria
    /// from the left side checklist options for the query
    /// </summary>
    /// <returns></returns>
    protected bool HasChecklistCriteria(string strUserID)
    {
        //has date range
        bool     bHasDateRange = false;
        DateTime dtFrom        = CDataUtils.GetNullDate();
        DateTime dtTo          = CDataUtils.GetNullDate();

        if (chkFilterByEvent.Checked)
        {
            dtFrom = CDataUtils.GetDate(txtFromDate.Text);
            dtTo   = CDataUtils.GetDate(txtToDate.Text);
        }

        if (!CDataUtils.IsDateNull(dtFrom))
        {
            if (chkFilterByEvent.Checked)
            {
                bHasDateRange = true;
            }
        }

        //has last name
        bool bHasLastName = false;

        if (!String.IsNullOrEmpty(txtLastName.Text))
        {
            bHasLastName = true;
            if (chkLastName.Checked)
            {
                bHasLastName = true;
            }
        }

        //has lssn
        bool bHasLSSN = false;

        if (!String.IsNullOrEmpty(txtLSSN.Text))
        {
            if (chkLSSN.Checked)
            {
                bHasLSSN = true;
            }
        }

        //has checklist
        bool bHasChecklist = false;

        if (ChecklistID > 0)
        {
            if (chkChecklist.Checked)
            {
                bHasChecklist = true;
            }
        }

        //has checklist status
        bool bHasChecklistStatus = false;

        if (ddlChecklistStatus.SelectedIndex > 0)
        {
            if (chkChecklistStatus.Checked)
            {
                bHasChecklistStatus = true;
            }
        }

        //has checklist service
        bool bHasChecklistService = false;

        if (ddlFilterByService.SelectedIndex > 0)
        {
            if (chkFilterByCLService.Checked)
            {
                bHasChecklistService = true;
            }
        }

        bool bHasChecklistCriteria = false;

        if (bHasDateRange ||
            bHasLastName ||
            bHasLSSN ||
            bHasChecklist ||
            bHasChecklistStatus ||
            bHasChecklistService)
        {
            bHasChecklistCriteria = true;
        }

        if (!String.IsNullOrEmpty(strUserID))
        {
            bHasChecklistCriteria = true;
        }

        return(bHasChecklistCriteria);
    }
예제 #10
0
    /// <summary>
    /// US:894
    /// US:899
    /// user clicked the search button
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void OnClickSearch(object sender, EventArgs e)
    {
        Master.ClearStatusInfo();

        CParameterList pListStatus = null;
        CStatus        status      = ValidateUserInput(out pListStatus);

        if (!status.Status)
        {
            Master.ShowStatusInfo(status.StatusCode, pListStatus);
            return;
        }

        //set the date from and date to
        DateTime dtFrom = CDataUtils.GetNullDate();
        DateTime dtTo   = CDataUtils.GetNullDate();

        if (chkFilterByEvent.Checked)
        {
            dtFrom = CDataUtils.GetDate(txtFromDate.Text);
            dtTo   = CDataUtils.GetDate(txtToDate.Text);
        }

        //checklist id
        long lChecklistID = -1;

        if (chkChecklist.Checked)
        {
            lChecklistID = ChecklistID;
        }

        //set the checklist Status
        long lChecklistStatusID = -1;

        if (chkChecklistStatus.Checked &&
            ddlChecklistStatus.SelectedItem != null &&
            ddlChecklistStatus.SelectedValue != "-1")
        {
            lChecklistStatusID = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue);
        }

        ThreadType = k_MULTI_PAT_THREAD_TYPE.Logic;


        //service
        long lServiceID = -1;

        if (chkFilterByCLService.Checked)
        {
            if (ddlFilterByService.SelectedItem != null)
            {
                if (ddlFilterByService.SelectedValue != "-1")
                {
                    lServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue);
                }
            }
        }

        //has checklist service
        bool bHasChecklistService = false;

        if (ddlFilterByService.SelectedIndex > 0)
        {
            if (chkFilterByCLService.Checked)
            {
                bHasChecklistService = true;
            }
        }

        //get patient checklist ids
        GetPatCLIDs(
            dtFrom,
            dtTo,
            lChecklistID,
            lChecklistStatusID,
            lServiceID);

        ProcessingCancelled = false;

        //thread off the multi patient search
        status = ThreadMultiPatient();

        //handle a bad status that comes back with no message
        if (!status.Status)
        {
            if (String.IsNullOrEmpty(status.StatusComment))
            {
                status.StatusComment = "An error occured while processing records!";
            }
        }

        //show the status
        Master.ShowStatusInfo(status);
    }
예제 #11
0
    /// <summary>
    /// loads the gridview after we are done updating the checklists
    /// </summary>
    protected CStatus LoadGridView()
    {
        //done processing the logic so now load the gridview
        //set the date from and date to
        DateTime dtFrom = CDataUtils.GetNullDate();
        DateTime dtTo   = CDataUtils.GetNullDate();

        if (chkFilterByEvent.Checked)
        {
            dtFrom = CDataUtils.GetDate(txtFromDate.Text);
            dtTo   = CDataUtils.GetDate(txtToDate.Text);
        }
        MPEventStartDate = dtFrom;
        MPEventEndDate   = dtTo;

        //checklist id
        long lChecklistID = -1;

        if (chkChecklist.Checked)
        {
            lChecklistID = ChecklistID;
        }
        MPChecklistID = lChecklistID;

        //set the checklist Status
        long lChecklistStatusID = -1;

        if (chkChecklistStatus.Checked &&
            ddlChecklistStatus.SelectedItem != null &&
            ddlChecklistStatus.SelectedValue != "-1")
        {
            lChecklistStatusID = CDataUtils.ToLong(ddlChecklistStatus.SelectedValue);
        }
        MPChecklistStatusID = lChecklistStatusID;

        long lChecklistServiceID = -1;

        if (chkFilterByCLService.Checked &&
            ddlFilterByService.SelectedItem != null &&
            ddlFilterByService.SelectedValue != "-1")
        {
            lChecklistServiceID = CDataUtils.ToLong(ddlFilterByService.SelectedValue);
        }
        MPChecklistServiceID = lChecklistServiceID;

        CStatus status = GetPatients(dtFrom,
                                     dtTo,
                                     lChecklistID,
                                     lChecklistStatusID,
                                     lChecklistServiceID);

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

        AddColumns();

        gvMultiPatientView.EmptyDataText = "No result(s) found.";
        gvMultiPatientView.DataSource    = MultiPatients;
        gvMultiPatientView.DataBind();

        //now that the grid is loaded check for new versions...

        //get all the patients for the mulitpatient
        string strCLIDs  = string.Empty;
        string strPatIDs = string.Empty;

        CPatientData pat = new CPatientData(Master.BaseData);
        DataSet      dsMultiPatientSearch = null;

        status = pat.GetMultiPatientSearchDS(
            MPEventStartDate,
            MPEventEndDate,
            MPChecklistID,
            MPChecklistStatusID,
            MPChecklistServiceID,
            out dsMultiPatientSearch);
        if (!status.Status)
        {
            return(status);
        }

        //patient ids
        CDataUtils.GetDSDelimitedData(
            dsMultiPatientSearch,
            "PATIENT_ID",
            ",",
            out strPatIDs);
        strPatIDs = "," + strPatIDs;

        //pat cl ids
        CDataUtils.GetDSDelimitedData(
            dsMultiPatientSearch,
            "CHECKLIST_ID",
            ",",
            out strCLIDs);

        strCLIDs = "," + strCLIDs;

        CPatChecklistData dta  = new CPatChecklistData(Master.BaseData);
        DataSet           dsCL = null;

        status = dta.GetOutOfDatePatCLDS(
            MPEventStartDate,
            MPEventEndDate,
            MPChecklistID,
            MPChecklistStatusID,
            strPatIDs,
            strCLIDs,
            out dsCL);
        if (!status.Status)
        {
            return(status);
        }

        btnUpdateCLVersion.Enabled = (!CDataUtils.IsEmpty(dsCL)) ? true : false;
        //EnableVersionUpdate = (!CDataUtils.IsEmpty(dsCL)) ? true : false;
        upLookup.Update();

        return(new CStatus());
    }