Beispiel #1
0
        protected virtual void BuildKidneyDiseaseState(int PatientID, string FormName, string FormType)
        {
            StatusDa sDa = new StatusDa();
            DataSet  sDs = sDa.GetStatus(PatientID, "Kidney");

            if (sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
            {
                StatusRpt.DataSource = sDs.Tables[0].DefaultView;
                StatusRpt.DataBind();
            }
        }
Beispiel #2
0
        protected virtual void BuildStatus(int patientId, string PatientStatus)
        {
            StatusDa Da = new StatusDa();
            DataSet  Ds = Da.GetStatus(patientId, PatientStatus);

            if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
            {
                StatusRpt.DataSource = Ds.Tables[0].DefaultView;
                StatusRpt.DataBind();
            }
        }
Beispiel #3
0
        protected void BuildStatusRptr(int PatientId, string EformName, string EformType)
        {
            StatusDa statusDa = new StatusDa();
            DataSet  statusDs = statusDa.GetStatus(PatientId, "Salivary Cancer");
            DataView dv       = new DataView(statusDs.Tables[0]);

            dv.RowFilter = Status.Status_Field + " LIKE '%Recurrence%' OR " + Status.Status_Field + " LIKE '%Metastasis%' ";
            if (dv.Count > 0)
            {
                StatusRptr.DataSource = dv;
                StatusRptr.DataBind();
            }
        }
        protected void ShowLastStatus()
        {
            StatusDa sDa = new StatusDa();
            DataSet  sDs = sDa.GetStatus(this._patientId, "Prostate Cancer");

            if (sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
            {
                DataView sDv = new DataView(sDs.Tables[0]);
                sDv.Sort = BOL.Status.StatusDate + " DESC";

                lastProstateStatus.Text         = sDv[0][BOL.Status.Status_Field].ToString() + " on " + sDv[0][BOL.Status.StatusDateText].ToString();
                lastProstateStatusTable.Visible = true;
            }
        }
Beispiel #5
0
        protected virtual void BuildDiseaseStateForDisease(int PatientID, string Disease)
        {
            StatusDa sDa = new StatusDa();
            DataSet  sDs = sDa.GetStatus(PatientID, Disease);

            if (sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
            {
                if (StatusMsg != null)
                {
                    StatusMsg.Visible = false;
                }
                StatusRpt.DataSource = sDs.Tables[0].DefaultView;
                StatusRpt.DataBind();
            }
        }
Beispiel #6
0
        /// <summary>
        /// Displays the patients last status
        /// </summary>
        protected void ShowActiveSurveillance()
        {
            bool   ActiveSurveillanceStarted     = false;
            string ActiveSurveillanceStartedDate = "";
            bool   ActiveSurveillanceEnded       = false;
            string ActiveSurveillanceEndedDate   = "";

            StatusDa sDa = new StatusDa();
            DataSet  sDs = sDa.GetStatus(this._patientId, "Prostate Cancer");

            if (sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
            {
                DataTable sDt = sDs.Tables[0];
                DataView  ActiveSurveillanceRecords = new DataView(sDt);
                ActiveSurveillanceRecords.RowFilter = BOL.Status.Status_Field + " IN ('Active Surveillance', 'Watchful Waiting')";

                if (ActiveSurveillanceRecords.Count > 0)
                {
                    ActiveSurveillanceStarted     = true;
                    ActiveSurveillanceStartedDate = ActiveSurveillanceRecords[0][BOL.Status.StatusDateText].ToString();

                    DataView EndActiveSurveillanceRecords = new DataView(sDt);
                    EndActiveSurveillanceRecords.RowFilter = BOL.Status.Status_Field + " = 'End Active Surveillance'";

                    if (EndActiveSurveillanceRecords.Count > 0)
                    {
                        ActiveSurveillanceEnded     = true;
                        ActiveSurveillanceEndedDate = EndActiveSurveillanceRecords[0][BOL.Status.StatusDateText].ToString();
                    }
                }
            }

            if (ActiveSurveillanceStarted && !ActiveSurveillanceEnded)
            {
                EndActiveSurveilancePanel.Visible = true;
            }
        }
        /// <summary>
        /// Displays the patients last status
        /// </summary>
        protected void ShowLastStatus()
        {
            //string status = GetLastStatus(this._patientId, this._eformName, "Dynamic");
            //if (status.Length > 0)
            //{
            //    LastStatus.Text = status + "<br/><br/>";
            //}



            StatusDa sDa = new StatusDa();
            DataSet  sDs = sDa.GetStatus(_patientId, "Prostate Cancer");

            if (sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
            {
                LastStatusDisplayRow.Visible = true;
                DataRow sDr = sDs.Tables[0].Rows[sDs.Tables[0].Rows.Count - 1];
                LastStatus.Text = "Last Status: " + sDr[BOL.Status.Status_Field] + " on " + sDr[BOL.Status.StatusDateText];
                if (sDr[BOL.Status.StatusQuality].ToString().Length > 0)
                {
                    LastStatus.Text += " (Data Quality: " + sDr[BOL.Status.StatusQuality].ToString() + ")";
                }
            }
        }
        // add an active surveillance record to Caisis if the patient doesn't already have one
        private void AddActiveSurveillanceStatus()
        {
            StatusDa sDa            = new StatusDa();
            DataSet  sDs            = sDa.GetStatus(this._patientId, "Prostate%");
            bool     ASRecordExists = false;

            if (sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
            {
                DataView sDv = new DataView(sDs.Tables[0]);
                sDv.RowFilter = BOL.Status.Status_Field + " IN ('Active Surveillance', 'Watchful Waiting') and " + BOL.Status.StatusDate + " IS NOT NULL";

                if (sDv.Count > 0)
                {
                    ASRecordExists = true;
                }
            }


            if (!ASRecordExists)
            {
//                ActiveSurveillanceStatusMsg.Visible = true;
                ASStatus.Visible = true;
            }
        }
Beispiel #9
0
        public static string ActiveSurveillanceDate(int patientID)
        {
            string ASDateStr = "";

            if (patientID != 0)
            {
                DateTime ASStatusDate             = new DateTime();
                string   ASStatusDateText         = "";
                bool     PatientHasASStatusRecord = false;

                // check for Previous AS Status----------------------------------
                StatusDa sDa = new StatusDa();
                DataSet  sDs = sDa.GetStatus(patientID, "Prostate%");

                if (sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
                {
                    DataView sDv = new DataView(sDs.Tables[0]);
                    sDv.RowFilter = BOL.Status.Status_Field + " IN ('Active Surveillance', 'Watchful Waiting') and " + BOL.Status.StatusDate + " IS NOT NULL";
                    sDv.Sort      = "StatusDate ASC";

                    if (sDv.Count > 0)
                    {
                        ASStatusDate             = (DateTime)sDv[0][BOL.Status.StatusDate];
                        ASStatusDateText         = sDv[0][BOL.Status.StatusDateText].ToString();
                        PatientHasASStatusRecord = true;
                    }
                }
                //-------------------------------------------------------------------

                if (PatientHasASStatusRecord)
                {
                    DateTime ASDate     = new DateTime();
                    string   ASDateText = "";

                    DataTable ProstateBiopsies;
                    BiopsyDa  bDa = new BiopsyDa();
                    ProstateBiopsies = bDa.GetProstateBiopsies(patientID);

                    // make sure patient has biopsies
                    if (ProstateBiopsies.Rows.Count > 0)
                    {
                        // check for GGS > 0
                        DataView PVView = new DataView(ProstateBiopsies);
                        PVView.RowFilter = BOL.Procedure.ProcDate + " IS NOT NULL and (" + BOL.BiopsyProstatePathology.PathGG1 + " > 0 or " + BOL.BiopsyProstatePathology.PathGG2 + " > 0 or " + BOL.BiopsyProstatePathology.PathGGS + " > 0)";
                        if (PVView.Count > 0)
                        {
                            PVView.Sort = BOL.Procedure.ProcDate + " ASC";


                            // info on first positive biopsy--------------
                            DateTime FirstPosBiopsyDate     = ((DateTime)PVView[0][BOL.Procedure.ProcDate]);
                            string   FirstPosBiopsyDateText = PVView[0][BOL.Procedure.ProcDateText].ToString();
                            bool     FirstPosBiopsyIsSTD    = PVView[0][BOL.Procedure.ProcQuality].ToString().Equals("STD");



                            // info on first positive MSK biopsy (might be the same as above)--------------
                            DateTime FirstMSKPosBiopsyDate     = new DateTime();
                            string   FirstMSKPosBiopsyDateText = "";

                            DataView MSKPosBiopies = new DataView(PVView.ToTable());
                            MSKPosBiopies.RowFilter = BOL.Procedure.ProcQuality + " = 'STD'";



                            if (FirstPosBiopsyIsSTD)
                            {
                                FirstMSKPosBiopsyDate     = FirstPosBiopsyDate;
                                FirstMSKPosBiopsyDateText = FirstPosBiopsyDateText;
                            }
                            else
                            {
                                if (MSKPosBiopies.Count > 0)
                                {
                                    FirstMSKPosBiopsyDate     = ((DateTime)MSKPosBiopies[0][BOL.Procedure.ProcDate]);
                                    FirstMSKPosBiopsyDateText = MSKPosBiopies[0][BOL.Procedure.ProcDateText].ToString();
                                }
                            }



                            //all MSK Biopsies
                            DataView MSKAllBiopsies = new DataView(ProstateBiopsies);
                            MSKAllBiopsies.RowFilter = BOL.Procedure.ProcQuality + " = 'STD'";
                            DateTime FirstMSKBiopsyDate     = new DateTime();
                            string   FirstMSKBiopsyDateText = "";
                            DateTime LastMSKBiopsyDate      = new DateTime();
                            string   LastMSKBiopsyDateText  = "";
                            if (MSKAllBiopsies.Count > 0)
                            {
                                FirstMSKBiopsyDate     = ((DateTime)MSKAllBiopsies[0][BOL.Procedure.ProcDate]);
                                FirstMSKBiopsyDateText = MSKAllBiopsies[0][BOL.Procedure.ProcDate].ToString();
                                LastMSKBiopsyDate      = ((DateTime)MSKAllBiopsies[MSKAllBiopsies.Count - 1][BOL.Procedure.ProcDate]);
                                LastMSKBiopsyDateText  = MSKAllBiopsies[MSKAllBiopsies.Count - 1][BOL.Procedure.ProcDate].ToString();
                            }



                            if (FirstMSKBiopsyDate > DateTime.MinValue && ASStatusDate < FirstMSKBiopsyDate)  // patient has an MSK Pos biopsy and AS Record is earlier
                            {
                                if (!FirstPosBiopsyIsSTD && (FirstMSKBiopsyDate - FirstPosBiopsyDate).TotalDays > 365)
                                {
                                    // AS Date is set
                                    ASDate     = ASStatusDate;
                                    ASDateText = ASStatusDateText;
                                }
                                else
                                {
                                    // AS Date is set
                                    ASDate     = FirstMSKBiopsyDate;
                                    ASDateText = FirstMSKBiopsyDateText;
                                }
                            }



                            if (ASDate.Equals(DateTime.MinValue)) // AS Date is not set yet
                            {
                                if (FirstPosBiopsyIsSTD)
                                {
                                    if (MSKPosBiopies.Count > 1 && ((DateTime)MSKPosBiopies[1][BOL.Procedure.ProcDate] - FirstMSKPosBiopsyDate).TotalDays <= 365)
                                    {
                                        ASDate     = (DateTime)MSKPosBiopies[1][BOL.Procedure.ProcDate];
                                        ASDateText = MSKPosBiopies[1][BOL.Procedure.ProcDateText].ToString();
                                    }
                                    else
                                    {
                                        ASDate     = FirstPosBiopsyDate;     // same value as FirstMSKPosBiopsyDate;
                                        ASDateText = FirstPosBiopsyDateText; // same value as FirstMSKPosBiopsyDateText;
                                    }
                                }
                                else // first pos biopsy is outside
                                {
                                    int FirstBiopsyGG1 = 0;
                                    int FirstBiopsyGG2 = 0;
                                    int FirstBiopsyGGS = 0;

                                    if (PVView[0][BOL.BiopsyProstatePathology.PathGGS].ToString().Length > 0)
                                    {
                                        // if first biopsy has GGS = 6 AND has subsequent MSK biopsy         //not necessary anymore--> (msk biopsy is 1 yr or more later)
                                        // if the last MSK biopsy is after the first pos biopsy, there is a subsequent MSK biopsy
                                        if (MSKAllBiopsies.Count > 0 && (LastMSKBiopsyDate > FirstPosBiopsyDate)) //FirstBiopsyGGS == 6 &&
                                        {
                                            // get first MSK biopsy after first pos biopsy
                                            DataRowView ASMSKBiopsy = FirstBiopsyAfterDate(MSKAllBiopsies.ToTable(), FirstPosBiopsyDate);
                                            if (ASMSKBiopsy != null)
                                            {
                                                ASDate     = (DateTime)ASMSKBiopsy[BOL.Procedure.ProcDate];
                                                ASDateText = ASMSKBiopsy[BOL.Procedure.ProcDateText].ToString();
                                            }
                                        }
                                        else
                                        {
                                            ASDate     = ASStatusDate;
                                            ASDateText = ASStatusDateText;
                                        }
                                    }
                                    else if (int.TryParse(PVView[0][BOL.BiopsyProstatePathology.PathGG1].ToString(), out FirstBiopsyGG1) && int.TryParse(PVView[0][BOL.BiopsyProstatePathology.PathGG2].ToString(), out FirstBiopsyGG2))
                                    {
                                        //                                    FirstBiopsyGGS = FirstBiopsyGG1 + FirstBiopsyGG2;
                                        // if first biopsy has GGS = 6 AND has subsequent MSK biopsy         //not necessary anymore--> (msk biopsy is 1 yr or more later)
                                        // if the last MSK biopsy is after the first pos biopsy, there is a subsequent MSK biopsy
                                        if (MSKAllBiopsies.Count > 0 && (LastMSKBiopsyDate > FirstPosBiopsyDate)) //FirstBiopsyGGS == 6 &&
                                        {
                                            // get first MSK biopsy after first pos biopsy
                                            DataRowView ASMSKBiopsy = FirstBiopsyAfterDate(MSKAllBiopsies.ToTable(), FirstPosBiopsyDate);
                                            if (ASMSKBiopsy != null)
                                            {
                                                ASDate     = (DateTime)ASMSKBiopsy[BOL.Procedure.ProcDate];
                                                ASDateText = ASMSKBiopsy[BOL.Procedure.ProcDateText].ToString();
                                            }
                                        }
                                        else
                                        {
                                            ASDate     = ASStatusDate;
                                            ASDateText = ASStatusDateText;
                                        }
                                    }
                                    else
                                    {
                                        ASDate     = ASStatusDate;
                                        ASDateText = ASStatusDateText;
                                    }
                                }
                            }



                            // if ASDate has been set, display ASDateText
                            if (ASDate > DateTime.MinValue)
                            {
                                ASDateStr = ASDateText;
                            }
                        }
                        //else leave blank
                    }
                }
            }

            return(ASDateStr);
        }