📄 patientsform.ascx.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.Security;//for delete patient permission
using Caisis.UI.Core.Classes;
using Caisis.UI.Core.Classes.CustomControls;
public abstract class PatientsForm : DataEntryControl
{
protected HtmlInputText PtMRN;
protected HtmlSelect PtTitle;
protected HtmlInputText PtFirstName;
protected HtmlInputText PtMiddleName;
protected HtmlInputText PtLastName;
protected HtmlSelect PtSuffix;
protected HtmlInputText PtAlias;
protected HtmlInputText PtMaidenName;
protected HtmlSelect PtGender;
protected HtmlInputText PtCompany;
protected HtmlInputText PtBusinessCity;
protected ComboBox PtBusinessState;
protected HtmlInputText PtAddress1;
protected HtmlInputText PtAddress2;
protected HtmlInputText PtCity;
protected ComboBox PtState;
protected HtmlInputText PtPostalCode;
protected ComboBox PtCountry;
protected HtmlInputText PtEmail;
protected HtmlInputText PtBirthDateText;
protected HtmlInputText PtBirthDate;
protected HtmlInputText PtBirthPlace;
protected HtmlInputText PtDeathDateText;
protected HtmlInputText PtDeathDate;
protected HtmlSelect PtDeathType;
protected HtmlInputText PtDeathCause;
protected HtmlInputText PtContactPerson;
protected HtmlInputText PtContactAddress1;
protected HtmlInputText PtContactAddress2;
protected HtmlInputText PtContactCity;
protected ComboBox PtContactState;
protected HtmlInputText PtContactPostalCode;
protected HtmlInputText PtContactPhone;
protected HtmlInputText PtSpouse;
protected HtmlSelect PtRace;
protected ComboBox PtEthnicity;
protected ComboBox PtLanguage;
protected HtmlSelect PtContactStatus;
protected HtmlTextArea PtNotes;
public HtmlInputHidden PatientId;
protected HtmlInputText age;//used only for calculated age. Not stored in DB
protected HtmlInputHidden StoreDoNotContactValue;
protected HtmlImage PtBirthDateTextCal, PtDeathDateTextCal;
protected Repeater rptInstitutions;//rptDiseases;
// protected System.Web.UI.HtmlControls.HtmlContainerControl PatientMessageLayer;
override protected void Page_Load(object sender, System.EventArgs e)
{
//get Patient Institution(s) and Disease(s) for display only
PatientInstitutionDa instDa = new PatientInstitutionDa();
DataSet instDs = instDa.GetRecords(this.patientID);
rptInstitutions.DataSource = instDs.Tables[0].DefaultView;
rptInstitutions.DataBind();
//PatientDiseaseDa disDa = new PatientDiseaseDa();
//DataSet disDs = disDa.GetRecords(this.patientID);
//rptDiseases.DataSource = disDs.Tables[0].DefaultView;
//rptDiseases.DataBind();
//populate look up and distinct value select boxes
PageUtil.FillLkpDropDown(PtTitle, "Title", Request.Form);
PageUtil.FillLkpDropDown(PtSuffix, "Suffix", Request.Form);
PageUtil.FillLkpDropDown(PtGender, "PtGender", Request.Form);
PageUtil.FillLkpDropDown(PtDeathType, "DeathType", Request.Form);
PageUtil.FillLkpDropDown(PtRace, "PtRace", Request.Form);
PageUtil.FillLkpDropDown(PtContactStatus, "PtContactStatus", Request.Form);
//create arrays that populate combo boxes
Page.RegisterClientScriptBlock("PtBusinessState", PageUtil.FillComboDropDown(PtBusinessState.RefBy, "State"));
Page.RegisterClientScriptBlock("PtState", PageUtil.FillComboDropDown(PtState.RefBy, "State"));
Page.RegisterClientScriptBlock("PtContactState", PageUtil.FillComboDropDown(PtContactState.RefBy, "State"));
//Select Distinct
Page.RegisterClientScriptBlock("PtEthnicity", PageUtil.FillComboDropDown(PtEthnicity.RefBy, "PtEthnicity"));
//Select Distinct
Page.RegisterClientScriptBlock("PtLanguage", PageUtil.FillComboDropDown(PtLanguage.RefBy, "PtLanguage"));
Page.RegisterClientScriptBlock("PtCountry", PageUtil.FillComboDropDown(PtCountry.RefBy, "Country"));
//array created holding required fields
Page.RegisterArrayDeclaration("requiredFieldArray","'"+PtLastName.ClientID+"', '"+PtMRN.ClientID+"'");
// added here, should figure out how to disable IsDirtyFunction from gridForm
PageUtil.DisableIsDirtyFunction((HtmlInputHidden)Parent.FindControl("IsDirtyPostBack"));
//add calendar function
PageUtil.AddCalendarFunction(PtBirthDateTextCal,PtBirthDateText);
PageUtil.AddFuzzyDateFunction(PtBirthDateText, PtBirthDate);
PageUtil.AddCalendarFunction(PtDeathDateTextCal,PtDeathDateText);
PageUtil.AddFuzzyDateFunction(PtDeathDateText, PtDeathDate);
base.Page_Load(sender, e);
}
//contact status only enabled sometimes
override public void EnableFormFields()
{
base.EnableFormFields();
//DEPENDENCY:
if(PtContactStatus.Value.Equals("DoNotContactPerMD") || PtContactStatus.Value.Equals("DoNotContactPerPt"))
{
StoreDoNotContactValue.Value = PtContactStatus.Value;
PtContactStatus.Disabled = true;
PtContactStatus.Attributes.Add("onClick", "alert('Status of Do Not Contact is not editable. Please ask system admin to update if necessary.')");
}
}
override protected object SaveViewState()
{
//add select and combo boxes to view state
PageUtil.AddSelectToViewState(ViewState,PtTitle);
PageUtil.AddSelectToViewState(ViewState,PtSuffix);
PageUtil.AddSelectToViewState(ViewState,PtGender);
PageUtil.AddSelectToViewState(ViewState,PtDeathType);
PageUtil.AddSelectToViewState(ViewState,PtRace);
PageUtil.AddSelectToViewState(ViewState,PtContactStatus);
PageUtil.AddComboToViewState(ViewState,PtBusinessState);
PageUtil.AddComboToViewState(ViewState,PtState);
PageUtil.AddComboToViewState(ViewState,PtContactState);
PageUtil.AddComboToViewState(ViewState,PtEthnicity);
PageUtil.AddComboToViewState(ViewState,PtLanguage);
PageUtil.AddComboToViewState(ViewState,PtCountry);
return base.SaveViewState();
}
override public HtmlInputHidden GetPrimKeyField()
{
return PatientId;
}
/// <summary>
/// Patient requires a unique controller. Overide generic controller retrival.
/// </summary>
/// <returns></returns>
override protected DataEntryController GetController()
{
return new PatientController(new PatientDa());
}
override protected void SetDataEntryInfo()
{
this._tableInfo = "Patients";
this._dataEntryTitle = "Demographics";
}
override protected BizObject GetParams()
{
Patient biz = new Patient();
DataRow dr = biz.Tables[Patient.Table_Patients].NewRow();
//if (!PatientId.Value.Equals(""))
//{
// dr[Patient.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[Patient.PtMRN] = PtMRN.Value;
dr[Patient.PatientId] = this.patientID;
dr[Patient.PtTitle] = Request.Form[PtTitle.UniqueID].ToString();
dr[Patient.PtFirstName] = PtFirstName.Value;
dr[Patient.PtMiddleName] = PtMiddleName.Value;
dr[Patient.PtLastName] = PtLastName.Value;
dr[Patient.PtSuffix] = Request.Form[PtSuffix.UniqueID].ToString();
dr[Patient.PtAlias] = PtAlias.Value;
dr[Patient.PtMaidenName] = PtMaidenName.Value;
dr[Patient.PtGender] = Request.Form[PtGender.UniqueID].ToString();
dr[Patient.PtCompany] = PtCompany.Value;
dr[Patient.PtBusinessCity] = PtBusinessCity.Value;
dr[Patient.PtBusinessState] = Request.Form[PtBusinessState.UniqueID].ToString();
dr[Patient.PtAddress1] = PtAddress1.Value;
dr[Patient.PtAddress2] = PtAddress2.Value;
dr[Patient.PtCity] = PtCity.Value;
dr[Patient.PtState] = Request.Form[PtState.UniqueID].ToString();
dr[Patient.PtPostalCode] = PtPostalCode.Value;
dr[Patient.PtCountry] = Request.Form[PtCountry.UniqueID].ToString();
dr[Patient.PtEmail] = PtEmail.Value;
dr[Patient.PtBirthDateText] = Request.Form[PtBirthDateText.UniqueID].ToString();
dr[Patient.PtBirthDate] = PageUtil.ObjToDateTime(PtBirthDate.Value);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -