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

📄 socialhistoriesform.ascx.cs

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

	using Caisis.Controller;
	using Caisis.DataAccess;
	using Caisis.BusinessObject;

	using Caisis.UI.Core.Classes;
	using Caisis.UI.Core.Classes.CustomControls;

	public abstract class SocialHistoriesForm : DataEntryControlRelOne
	{

		protected HtmlInputText SocHxOccupation;
		protected HtmlSelect SocHxMaritalStatus;
		protected HtmlInputText SocHxChildren;
		protected HtmlSelect SocHxTobaccoType;
		protected HtmlInputText SocHxTobaccoPacksPerDay;
		protected HtmlInputText SocHxTobaccoPacksPerYear;
		protected HtmlInputText SocHxTobaccoYears;
		protected HtmlInputText SocHxTobaccoQuitYear;
		protected HtmlInputText SocHxCarcinogen;
		protected ComboBox SocHxAlcohol;
		protected HtmlInputText SocHxOther;
		protected HtmlTextArea SocHxNotes;
		protected ComboBox SocHxDataSource;
		protected HtmlSelect SocHxQuality;
		protected HtmlInputHidden PatientId;

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

			

			//populate look up and distinct value select boxes
			
			PageUtil.FillLkpDropDown(SocHxMaritalStatus, "SocHxMaritalStatus", ViewState);
			PageUtil.FillLkpDropDown(SocHxTobaccoType, "SocHxTobaccoType", ViewState);
			PageUtil.FillLkpDropDown(SocHxQuality, "DataQuality", ViewState);

			//create arrays that populate combo boxes
			Page.RegisterClientScriptBlock("SocHxAlcohol", PageUtil.FillComboDropDown(SocHxAlcohol.RefBy, "AlcoholUsage"));
			Page.RegisterClientScriptBlock("SocHxDataSource", PageUtil.FillComboDropDown(SocHxDataSource.RefBy, "DataSource"));

			string reqFieldArray = PageUtil.CreateValidationScript("");
			Page.RegisterClientScriptBlock("requiredFieldArray", reqFieldArray);


			base.Page_Load(sender, e);
		}

		override protected object SaveViewState()
		{
			//add select and combo boxes to view state
			
			PageUtil.AddSelectToViewState(ViewState,SocHxMaritalStatus);
			PageUtil.AddSelectToViewState(ViewState,SocHxTobaccoType);
			PageUtil.AddSelectToViewState(ViewState,SocHxQuality);
			
			PageUtil.AddComboToViewState(ViewState,SocHxDataSource);
			PageUtil.AddComboToViewState(ViewState,SocHxAlcohol);
			
			return base.SaveViewState();
		}

		override public HtmlInputHidden GetPrimKeyField()
		{
			return PatientId;
		}

		override protected DataEntryController GetController()
		{
			return new DataEntryController(new SocialHistoryDa(), SocialHistory.PatientId); //NOTE: fix args
		}

		override protected void SetDataEntryInfo()
		{
			this._tableInfo = "SocialHistories";//button logic in DataEntryContainer depends on this string
			this._dataEntryTitle = "Social History";
		}

		override protected BizObject GetParams()
		{
			SocialHistory biz = new SocialHistory();
			DataRow dr = biz.Tables[SocialHistory.Table_SocialHistories].NewRow();

			if (!PatientId.Value.Equals(""))
			{
				dr[SocialHistory.PatientId] = PatientId.Value;
			}

			//selects use: Request.Form[FieldName.UniqueID].ToString();
			//dates use: PageUtil.ObjToDateTime(FieldName.Value);
			//checkbox use: if(FieldName.Checked){dr[BizObject.FieldName] = 1;}
			//Patient ID should = this.patientID
			
			dr[SocialHistory.PatientId] = this.patientID;
			dr[SocialHistory.SocHxOccupation] = SocHxOccupation.Value;
			dr[SocialHistory.SocHxMaritalStatus] = Request.Form[SocHxMaritalStatus.UniqueID].ToString();
			dr[SocialHistory.SocHxChildren] = SocHxChildren.Value;
			dr[SocialHistory.SocHxTobaccoType] = Request.Form[SocHxTobaccoType.UniqueID].ToString();
			dr[SocialHistory.SocHxTobaccoPacksPerDay] = SocHxTobaccoPacksPerDay.Value;
			dr[SocialHistory.SocHxTobaccoPacksPerYear] = SocHxTobaccoPacksPerYear.Value;
			dr[SocialHistory.SocHxTobaccoYears] = SocHxTobaccoYears.Value;
			dr[SocialHistory.SocHxTobaccoQuitYear] = SocHxTobaccoQuitYear.Value;
			dr[SocialHistory.SocHxCarcinogen] = SocHxCarcinogen.Value;
			dr[SocialHistory.SocHxOther] = SocHxOther.Value;
			dr[SocialHistory.SocHxNotes] = SocHxNotes.Value;
			dr[SocialHistory.SocHxAlcohol] = Request.Form[SocHxAlcohol.UniqueID].ToString();
			dr[SocialHistory.SocHxDataSource] = Request.Form[SocHxDataSource.UniqueID].ToString();
			dr[SocialHistory.SocHxQuality] = Request.Form[SocHxQuality.UniqueID].ToString();

			AddBaseParams(dr);
			biz.Tables[SocialHistory.Table_SocialHistories].Rows.Add(dr);
			biz.AcceptChanges();
			return biz;

		}

		protected override void SetFields(BizObject bz)
		{
			SocialHistory biz = (SocialHistory)bz;
			DataRow dr = biz.Tables[SocialHistory.Table_SocialHistories].Rows[0];

			//selects use: PageUtil.SelectDropDownItem(fieldIdName, dr[Object.FieldName]);
			
			PatientId.Value = dr[SocialHistory.PatientId].ToString();
			SocHxOccupation.Value = dr[SocialHistory.SocHxOccupation].ToString();
			PageUtil.SelectDropDownItem(SocHxMaritalStatus, dr[SocialHistory.SocHxMaritalStatus]);
			SocHxChildren.Value = dr[SocialHistory.SocHxChildren].ToString();
			PageUtil.SelectDropDownItem(SocHxTobaccoType, dr[SocialHistory.SocHxTobaccoType]);
			SocHxTobaccoPacksPerDay.Value = dr[SocialHistory.SocHxTobaccoPacksPerDay].ToString();
			SocHxTobaccoPacksPerYear.Value = dr[SocialHistory.SocHxTobaccoPacksPerYear].ToString();
			SocHxTobaccoYears.Value = dr[SocialHistory.SocHxTobaccoYears].ToString();
			SocHxTobaccoQuitYear.Value = dr[SocialHistory.SocHxTobaccoQuitYear].ToString();
			SocHxCarcinogen.Value = dr[SocialHistory.SocHxCarcinogen].ToString();
			SocHxOther.Value = dr[SocialHistory.SocHxOther].ToString();
			SocHxNotes.Value = dr[SocialHistory.SocHxNotes].ToString();
			SocHxAlcohol.Value = dr[SocialHistory.SocHxAlcohol].ToString();
			SocHxDataSource.Value = dr[SocialHistory.SocHxDataSource].ToString();
			PageUtil.SelectDropDownItem(SocHxQuality, dr[SocialHistory.SocHxQuality]);

			SetBaseFields(dr);
		}
		
		//
		//forms that are one to one with patients table override GetRecord (BrachyTherapy and SocialHistory)
		//TODO: fix button logic for new forms- currently must click edit first
		//
		protected override BizObject GetRecord()
		{
			DataEntryController ct = this.GetController();
			return ct.GetRecord(this.patientID);
		}

		protected override BizObject GetRecord(DataRow dr)  
		{			
			DataEntryController ct = (DataEntryController)this.GetController();
			return ct.GetRecord(this.patientID);
		}
		

	}
}

⌨️ 快捷键说明

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