⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 urosexfuncfu.ascx.cs

📁 医疗决策支持系统
💻 CS
字号:
namespace Caisis.UI.Modules.All.PaperForms
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using Caisis.DataAccess;

	using Caisis.UI.Core.Classes;

	/// <summary>
	///		Summary description for UroSexFunc.
	/// </summary>
	public class UroSexFuncFU : BasePaperFormControl
	{
		protected static int NumHpiRowsAllowed = 10;
		protected Repeater erectileFunction;


		override protected void Page_Load(object sender, EventArgs e)
		{

			base.Page_Load(sender, e);

//			BuildReferringMD();
			BuildHPI();
//			BuildPotencyStatusValues();
			BuildHpiProstatectomies();
			BuildHpiProtocols();
			BuildHpiBiopsies(hpiBiopsyId);
			BuildHPINerveStatus();


			BuildErectileFunction(4, 1);
		}

		override protected void SetFormInfo()  
		{
			this._formName = "UroSexFuncFU";
			this._formTitle = "Urology Sexual Function Follow-Up";
		}



		protected void BuildHPI()
		{
			if (patientID != 0)
			{
				PatientDa hpiDa = new PatientDa();
				DataSet hpiDs = hpiDa.GetPatientHPI(this.patientID, 1, 1);
				hpi.DataSource = hpiDs.Tables[0].DefaultView;
				hpi.DataBind();

				int rowCount = hpiDs.Tables[0].Rows.Count;


				//nomograms are in a second result set
/*				preRPNomo.Text = hpiDs.Tables[1].Rows[0]["preRPNomo"].ToString();
				preXRTNomo.Text = hpiDs.Tables[1].Rows[0]["preXRTNomo"].ToString();
				preBrachyNomo.Text = hpiDs.Tables[1].Rows[0]["preBrachyNomo"].ToString();
				postRP7yrNomo.Text = hpiDs.Tables[1].Rows[0]["postRP7yrNomo"].ToString();
*/
				// set the value of the biopsy Id that is to be REMOVED from the results of the 
				// stored proc spFormListBiopsies so that the biopsy is only listed once in the 
				// hpi section of the form
				
				if (hpiDs.Tables[1].Rows[0]["DxBiopsyId"] != null && hpiDs.Tables[1].Rows[0]["DxBiopsyId"].ToString().Length > 0)
				{
					hpiBiopsyId = (int)hpiDs.Tables[1].Rows[0]["DxBiopsyId"];
				}

			}


		}


		protected void hpiItemDataBound(Object Sender, RepeaterItemEventArgs e) 
		{

			Literal StartNextHpiColumn;
			StartNextHpiColumn = (Literal) e.Item.FindControl("StartNextHpiColumn");

			if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
			{
				int rowNumber = e.Item.ItemIndex + 1;
				if (System.Math.IEEERemainder(rowNumber, NumHpiRowsAllowed) == 0)
				{
					StartNextHpiColumn.Text = "</td><td class=\"HPITextExtraColumns\" valign=\"top\">";
				}
				else
				{
					StartNextHpiColumn.Visible = false;
				}
			}
		}








		protected void appendToHpiItemDataBound(Object Sender, RepeaterItemEventArgs e) 
		{

			Literal StartNextHpiColumn;
			StartNextHpiColumn = (Literal) e.Item.FindControl("StartNextHpiColumn");

			int RowsAllowed = NumHpiRowsAllowed/2;

			if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
			{
				int rowNumber = e.Item.ItemIndex + 1;
				if (System.Math.IEEERemainder(rowNumber, RowsAllowed) == 0)
				{
					StartNextHpiColumn.Text = "</td><td class=\"HPITextExtraColumns\" valign=\"top\">";
				}
				else
				{
					StartNextHpiColumn.Visible = false;
				}
			}
		}

		protected void HpiProstatectomiesItemDataBound(Object Sender, RepeaterItemEventArgs e) 
		{

			Literal StartNextHpiColumn;
			StartNextHpiColumn = (Literal) e.Item.FindControl("StartNextHpiColumn");


			Label CaseSurgeonLabel;
			CaseSurgeonLabel = (Label) e.Item.FindControl("CaseSurgeonLabel");

			int RowsAllowed = NumHpiRowsAllowed/2;

			if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) 
			{
				int rowNumber = e.Item.ItemIndex + 1;
				if (System.Math.IEEERemainder(rowNumber, RowsAllowed) == 0)
				{
					StartNextHpiColumn.Text = "</td><td class=\"HPITextExtraColumns\" valign=\"top\">";
				}
				else
				{
					StartNextHpiColumn.Visible = false;
				}


				if (((DataRowView) e.Item.DataItem )["SurgCaseSurgeon"] == null || ((DataRowView) e.Item.DataItem )["SurgCaseSurgeon"].ToString() == "" )
				{
					CaseSurgeonLabel.Visible = false;
				}


			}
		}



		protected void BuildErectileFunction(int minNumRowsToShow, int minNumBlankRows)
		{
			if (patientID != 0)
			{

				DataTable eDt = ErectileFuntionDataTable();

				if (eDt != null && eDt.Columns.Count > 0)
				{
					int numBlankRows = minNumRowsToShow - eDt.Rows.Count;

					if (numBlankRows < minNumBlankRows)
					{
						numBlankRows = minNumBlankRows;
					}

					for (int i=0; i<numBlankRows; i++)
					{
						DataRow blankRow = eDt.NewRow();
						eDt.Rows.Add(blankRow);
					}
					erectileFunction.DataSource = eDt.DefaultView;
				}
				else
				{
					erectileFunction.DataSource = BlankErectileFunction(minNumRowsToShow).DefaultView;
				}

			}
			else
			{
				erectileFunction.DataSource = BlankErectileFunction(minNumRowsToShow).DefaultView;
			}
			
			erectileFunction.DataBind();

		}


		// create the datatable for erectile function.  Currently hits the database a lot - once for
		// each table cell populated on the form.  Also pulls column names from the lookup codes.  - jf
		protected DataTable ErectileFuntionDataTable()
		{
			SurveyDa sDa = new SurveyDa();

			DataSet SurveyIdDs = sDa.FormGetSurveysByType(this.patientID, this._formName, "Dynamic", "Mulhall Erection");
			DataTable eDt = new DataTable();
			
			if (SurveyIdDs.Tables.Count > 0 && SurveyIdDs.Tables[0].Rows.Count > 0)
			{



				LookupCodeDa lDa = new LookupCodeDa();
				DataTable lDt = lDa.GetLookupCodes("SurveyItem_MulhallErection");
				int numCols = 0;
					
				if (lDt.Rows.Count > 0)
				{
					numCols = lDt.Rows.Count;
				}


				MedicationDa OralAgentDa = new MedicationDa();
				DataSet OralAgentDs;


				if (numCols > 0)
				{

					// create date column
					DataColumn DateCol;
					DateCol = new DataColumn();
					DateCol.ColumnName = "Date";
					eDt.Columns.Add(DateCol);

					// create Oral Agent column
					DataColumn AgentCol;
					AgentCol = new DataColumn();
					AgentCol.ColumnName = "Oral Agent";
					eDt.Columns.Add(AgentCol);

					// create ICI Agent column
					DataColumn ICICol;
					ICICol = new DataColumn();
					ICICol.ColumnName = "ICI Agent";
					eDt.Columns.Add(ICICol);

					// create Dose column
					DataColumn DoseCol;
					DoseCol = new DataColumn();
					DoseCol.ColumnName = "Dose";
					eDt.Columns.Add(DoseCol);

					// add appropriately named columns to main table
					for (int i=0; i<numCols; i++)
					{
						DataColumn iCol;
						iCol = new DataColumn();
						iCol.ColumnName = lDt.Rows[i]["LkpCode"].ToString();
						eDt.Columns.Add(iCol);
					}


					// build the rows of the erectile function table
					for (int i=0; i<SurveyIdDs.Tables[0].Rows.Count; i++)
					{

	
						int SurvId = Convert.ToInt32(SurveyIdDs.Tables[0].Rows[i]["SurveyId"]);
						DataRow blankRow = eDt.NewRow();
						eDt.Rows.Add(blankRow);

						eDt.Rows[i]["Date"] = SurveyIdDs.Tables[0].Rows[i]["SurveyDateText"].ToString();

						OralAgentDs = new DataSet();
						OralAgentDs = OralAgentDa.FormGetErectileMedication(this.patientID, SurveyIdDs.Tables[0].Rows[i]["SurveyDate"].ToString());
						if (OralAgentDs.Tables.Count > 0 && OralAgentDs.Tables[0].Rows.Count > 0)
						{
							if (OralAgentDs.Tables[0].Rows[0]["MedRoute"].ToString().ToUpper().Equals("INTRACAVERNOSAL"))
							{
								eDt.Rows[i]["ICI Agent"] = OralAgentDs.Tables[0].Rows[0]["Medication"].ToString();
//								eDt.Rows[i]["Oral Agent"] = "&nbsp;";
							}
							else
							{
								eDt.Rows[i]["Oral Agent"] = OralAgentDs.Tables[0].Rows[0]["Medication"].ToString();
//								eDt.Rows[i]["ICI Agent"] = "&nbsp;";
							}

							eDt.Rows[i]["Dose"] = OralAgentDs.Tables[0].Rows[0]["MedDose"].ToString();
						}

						// add data to the columns of the current row
						for (int j=0; j<numCols; j++)
						{
							string SurvItem = lDt.Rows[j]["LkpCode"].ToString();
					
							DataSet dds = sDa.FormGetSurveyItemsResult(SurvId, this._formName, "Dynamic", SurvItem);	
		
							if (dds.Tables.Count > 0 && dds.Tables[0].Rows.Count > 0)
							{
								eDt.Rows[i][SurvItem] = dds.Tables[0].Rows[0]["SurveyItemResult"].ToString();
							}
								
						}






					}

				}
			}
			
			return eDt;

		}


		protected DataTable BlankErectileFunction(int MinNumRowsToShow)
		{
			DataTable eDt = new DataTable();
			LookupCodeDa lDa = new LookupCodeDa();
			DataTable lDt = lDa.GetLookupCodes("SurveyItem_MulhallErection");
			int numCols = 0;


			// create date column
			DataColumn DateCol;
			DateCol = new DataColumn();
			DateCol.ColumnName = "Date";
			eDt.Columns.Add(DateCol);

			// create Oral Agent column
			DataColumn AgentCol;
			AgentCol = new DataColumn();
			AgentCol.ColumnName = "Oral Agent";
			eDt.Columns.Add(AgentCol);

			// create ICI Agent column
			DataColumn ICICol;
			ICICol = new DataColumn();
			ICICol.ColumnName = "ICI Agent";
			eDt.Columns.Add(ICICol);

			// create Dose column
			DataColumn DoseCol;
			DoseCol = new DataColumn();
			DoseCol.ColumnName = "Dose";
			eDt.Columns.Add(DoseCol);


					
			if (lDt.Rows.Count > 0)
			{
				numCols = lDt.Rows.Count;
			}


			if (numCols > 0)
			{

				// add appropriately named columns to table
				for (int i=0; i<numCols; i++)
				{
					DataColumn iCol;
					iCol = new DataColumn();
					iCol.ColumnName = lDt.Rows[i]["LkpCode"].ToString();
					eDt.Columns.Add(iCol);
				}

			}

			for (int i=0; i<MinNumRowsToShow; i++)
			{
				DataRow BlankRow;
				BlankRow = eDt.NewRow();
				eDt.Rows.Add(BlankRow);
			}

			return eDt;

		}




	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -