override protected void BuildProstateBiopsies(int PatientID) { DataTable biopsiesDt; BiopsyDa bDa = new BiopsyDa(); biopsiesDt = bDa.GetProstateBiopsies(PatientID); if (biopsiesDt.Rows.Count > 0) { DataView BiopsiesToDisplay = new DataView(biopsiesDt); // don't display any OUT Path records that have been reviewed DataView ReviewedBiopsies = new DataView(biopsiesDt); ReviewedBiopsies.RowFilter = BOL.Pathology.PathQuality + " IN ('REV', 'RR')"; if (ReviewedBiopsies.Count > 0) { List <string> OutsidePathRecordsToFilter = new List <string>(); foreach (DataRowView ReviewedBiopsy in ReviewedBiopsies) { string ProcedureIdStr = ReviewedBiopsy["PrimaryKey"].ToString(); OutsidePathRecordsToFilter.Add(ProcedureIdStr); } string biopsyFilter = "NOT (" + BOL.Pathology.PathQuality + " = 'OUT' AND PrimaryKey IN (" + string.Join(",", OutsidePathRecordsToFilter.ToArray()) + "))"; BiopsiesToDisplay.RowFilter = biopsyFilter; } Biopsies.DataSource = BiopsiesToDisplay; Biopsies.DataBind(); } }
protected virtual void BuildProstateBiopsies(int PatientID) { DataTable biopsiesDt; BiopsyDa bDa = new BiopsyDa(); biopsiesDt = bDa.GetProstateBiopsies(PatientID); if (biopsiesDt.Rows.Count > 0) { Biopsies.DataSource = biopsiesDt.DefaultView; Biopsies.DataBind(); } }
protected void BuildBiopsies(int PatientID, string FormName, string FormType) { DataSet biopsiesDs; BiopsyDa bDa = new BiopsyDa(); biopsiesDs = bDa.FormGetRecords(PatientID, "", FormName, FormType); if (biopsiesDs.Tables.Count > 0 && biopsiesDs.Tables[0].Rows.Count > 0) { Biopsies.DataSource = biopsiesDs.Tables[0].DefaultView; Biopsies.DataBind(); } }
override protected void BuildProstateBiopsies(int PatientID) { DataTable biopsiesDt; BiopsyDa bDa = new BiopsyDa(); biopsiesDt = bDa.GetProstateBiopsies(PatientID); if (biopsiesDt.Rows.Count > 0) { ProstateBiopsies = biopsiesDt; // for use in calculating active surveillance date foreach (DataRow row in biopsiesDt.Rows) { if (row[Procedure.ProcQuality].ToString().Equals("STD") && row[Procedure.ProcDate].ToString().Length > 0 && ((DateTime)row[Procedure.ProcDate]) < FirstMSKBiopsyDate) { FirstMSKBiopsyDate = (DateTime)row[Procedure.ProcDate]; FirstMSKBiopsyDateText = row[Procedure.ProcDateText].ToString(); FirstMSKBiopsyProcId = (int)row["PrimaryKey"]; break; } } DataView BiopsiesToDisplay = new DataView(biopsiesDt); DataView ReviewedBiopsies = new DataView(biopsiesDt); ReviewedBiopsies.RowFilter = BOL.Pathology.PathQuality + " IN ('REV', 'RR')"; if (ReviewedBiopsies.Count > 0) { List <string> OutsidePathRecordsToFilter = new List <string>(); foreach (DataRowView ReviewedBiopsy in ReviewedBiopsies) { string ProcedureIdStr = ReviewedBiopsy["PrimaryKey"].ToString(); OutsidePathRecordsToFilter.Add(ProcedureIdStr); } string biopsyFilter = "NOT (" + BOL.Pathology.PathQuality + " = 'OUT' AND PrimaryKey IN (" + string.Join(",", OutsidePathRecordsToFilter.ToArray()) + "))"; BiopsiesToDisplay.RowFilter = biopsyFilter; } Biopsies.DataSource = BiopsiesToDisplay; Biopsies.DataBind(); BlankBiopsyRecord.Visible = false; } }
protected void BuildHpiBiopsies(int PatientID, string FormName, string FormType, int hpiBiopsyId) { DataSet biopsiesDs; string sendBiopsyId = ""; BiopsyDa bDa = new BiopsyDa(); if (hpiBiopsyId.ToString().Length > 0) { sendBiopsyId = hpiBiopsyId.ToString(); } biopsiesDs = bDa.FormGetRecords(PatientID, sendBiopsyId, FormName, FormType); if (biopsiesDs.Tables.Count > 0 && biopsiesDs.Tables[0].Rows.Count > 0) { hpiBiopsies.DataSource = biopsiesDs.Tables[0].DefaultView; hpiBiopsies.DataBind(); } }
override protected void EFormRepeaterOnDataBound(Object Sender, RepeaterItemEventArgs e) { base.EFormRepeaterOnDataBound(Sender, e); Literal ResultField = (Literal)e.Item.FindControl("ResultField"); Literal CommentsField = (Literal)e.Item.FindControl("CommentsField"); if ((e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) && e.Item.DataItem != null) { DataRowView record = ((DataRowView)e.Item.DataItem); if (record["BxType"].ToString().Length > 0 && (record["BxType"].ToString().ToUpper().IndexOf("PROSTATE") > -1)) { string resultText = ""; if (record["PathGG1"].ToString().Length > 0 || record["PathGG2"].ToString().Length > 0) { resultText = record["PathGG1"].ToString() + " + " + record["PathGG2"].ToString(); if (record["PathGGS"].ToString().Length > 0) { resultText += (" = " + record["PathGGS"].ToString()); } if (record["PathResult"].ToString().Length > 0) { resultText += (" (" + record["PathResult"].ToString() + ")"); } } else { resultText = record["PathResult"].ToString(); } ResultField.Text = resultText; } else { ResultField.Text = record["PathResult"].ToString(); } string comments = ""; if (record[BOL.ProstatectomyPathology.PathHG_PIN].ToString().Length > 0) { comments += "PIN:" + record[BOL.ProstatectomyPathology.PathHG_PIN].ToString() + ", "; } if (record["PathASAP"].ToString().Length > 0) { comments += "ASAP:" + record["PathASAP"].ToString(); } if (comments.Length > 0) { CommentsField.Text = comments; } if (record[BOL.BiopsyCoreProstatePathology.PathologyId].ToString().Length > 0) { BiopsyDa b = new BiopsyDa(); DataTable coresDt = b.FormGetBiopsyCorePathsByPathologyId((int)record[BOL.BiopsyCoreProstatePathology.PathologyId]); if (coresDt.Rows.Count > 0) { string corefilter = "LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGG1 + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGG2 + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGGS + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCorePercCancer + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreMaxCancerLength + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreLength + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCorePerineuralInv + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCorePNI_Diam + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreHG_PIN + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreNumCores + ") > 0"; DataView coresDv = new DataView(coresDt); coresDv.RowFilter = corefilter; if (coresDv.Count > 0) { HtmlTableRow CoresContainer = (HtmlTableRow)e.Item.FindControl("CoresContainer"); CoresContainer.Visible = true; Repeater Cores = (Repeater)e.Item.FindControl("Cores"); Cores.DataSource = coresDv; Cores.DataBind(); } } } } }
protected void BiopsiesOnDataBound(Object Sender, RepeaterItemEventArgs e) { Literal ResultField = (Literal)e.Item.FindControl("ResultField"); Literal CommentsField = (Literal)e.Item.FindControl("CommentsField"); if ((e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) && e.Item.DataItem != null) { DataRowView record = ((DataRowView)e.Item.DataItem); if (record["BxType"].ToString().Length > 0 && (record["BxType"].ToString().ToUpper().IndexOf("PROSTATE") > -1)) { string resultText = ""; if (record["PathGG1"].ToString().Length > 0 || record["PathGG2"].ToString().Length > 0) { resultText = record["PathGG1"].ToString() + " + " + record["PathGG2"].ToString(); if (record["PathGGS"].ToString().Length > 0) { resultText += (" = " + record["PathGGS"].ToString()); } if (record["PathResult"].ToString().Length > 0) { resultText += (" (" + record["PathResult"].ToString() + ")"); } } else { resultText = record["PathResult"].ToString(); } ResultField.Text = resultText; } else { ResultField.Text = record["PathResult"].ToString(); } string comments = ""; if (record[BOL.ProstatectomyPathology.PathHG_PIN].ToString().Length > 0) { comments += "PIN:" + record[BOL.ProstatectomyPathology.PathHG_PIN].ToString() + ", "; } if (record["PathASAP"].ToString().Length > 0) { comments += "ASAP:" + record["PathASAP"].ToString(); } if (comments.Length > 0) { CommentsField.Text = comments; } if (record[BOL.BiopsyCoreProstatePathology.PathologyId].ToString().Length > 0) { BiopsyDa b = new BiopsyDa(); DataTable coresDt = b.FormGetBiopsyCorePathsByPathologyId((int)record["PathologyId"]); if (coresDt.Rows.Count > 0) { // string corefilter = "LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGG1 + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGG2 + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGGS + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCorePercCancer + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreMaxCancerLength + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreLength + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCorePerineuralInv + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCorePNI_Diam + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreHG_PIN + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreNumCores + ") > 0"; string corefilter = "LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGG1 + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGG2 + ") > 0 or LEN(" + BOL.BiopsyCoreProstatePathology.PathCoreGGS + ") > 0"; DataView coresDv = new DataView(coresDt); coresDv.RowFilter = corefilter; if (coresDv.Count > 0) { HtmlTableRow CoresContainer = (HtmlTableRow)e.Item.FindControl("CoresContainer"); CoresContainer.Visible = true; BiopsyCoresBlankDataTable.Visible = false; Repeater Cores = (Repeater)e.Item.FindControl("Cores"); Cores.DataSource = coresDv; Cores.DataBind(); } } } // add class to MSK Biopsies if (FirstMSKBiopsyProcId > 0 && ((int)record["PrimaryKey"]).Equals(FirstMSKBiopsyProcId)) { HtmlTableRow BiopsyPopDataRow = (HtmlTableRow)e.Item.FindControl("BiopsyPopDataRow"); BiopsyPopDataRow.Attributes.Add("class", "local-institution"); } } }
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); }