using AIMS.PublicUI.UI; using AIMSBLL; using AIMSModel; using DevComponents.Editors.DateTimeAdv; using DrawGraph; using AIMSExtension; using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace AIMS.OperationAanesthesia { public partial class frmOperationInfoNew2 : Form, IMessageFilter { #region IMessageFilter 成员 public bool PreFilterMessage(ref Message m) { if (m.Msg == 522) { return true; } else { return false; } } #endregion public frmOperationInfoNew2() { InitializeComponent(); this.FormBorderStyle = FormBorderStyle.FixedSingle;//无边框 } /// /// 手术记录 /// public DrawGraph.OperationRecord _record; /// /// 穿刺及插管 /// public OperationRecordInfo OPInfo; #region 申请手术窗体加载事件 private void frmOperationInfoNew2_Load(object sender, EventArgs e) { Application.AddMessageFilter(this); //初始化各个控件 InitData(); FullPatientInfo(); dtpAnesthesiaByDoctor.MouseDown += new MouseEventHandler(txtDateTime_MouseDown); dtpTourNurseSucceed.MouseDown += new MouseEventHandler(txtDateTime_MouseDown); dtpInstrumentNurseSucceed.MouseDown += new MouseEventHandler(txtDateTime_MouseDown); dtpAnesthesiaByDoctor.LostFocus += new EventHandler(txtDateTime_LostFocus); dtpTourNurseSucceed.LostFocus += new EventHandler(txtDateTime_LostFocus); dtpInstrumentNurseSucceed.LostFocus += new EventHandler(txtDateTime_LostFocus); } #endregion public List listNew = new List(); public List listOnit = new List(); public List listNewNur = new List(); public List listOnitNur = new List(); public List listNewexperts = new List(); public List listOnitexperts = new List(); public int _isCompound; #region 初始化所有控件内容 private void InitData() { listOnit = BPerson.GetruleAnesthesiaDoctor(""); this.txtruleAnesthesiaDoctor.Items.AddRange(listOnit.ToArray()); listOnitNur = BPerson.GetruleNurse(""); this.txtruleNurse.Items.AddRange(listOnitNur.ToArray()); listOnitexperts = BPerson.Getexperts(""); this.txtexperts.Items.AddRange(listOnitexperts.ToArray()); cboOperationLevel.DisplayMember = "Name"; cboOperationLevel.ValueMember = "Id"; cboOperationLevel.DataSource = BOperationLevel.GetDataTable("IsValid=1"); cboOperationLevel.SelectedIndex = -1; if (txtOperationCut.DataSource == null) BindBasicDictionaryToComboBox(txtOperationCut, "手术切口"); if (!PublicMethod.RoleName.Contains("术中填写手术等级切口等级")) { cboOperationLevel.Enabled = false; txtOperationCut.Enabled = false; } } /// /// 绑定基础表项目数据 到 ComboBox /// /// /// public static void BindBasicDictionaryToComboBox(ComboBox loadCbo, string setDataName) { BasicDictionary basicDictionary = BBasicDictionary.GetBasicDictionaryByName(setDataName); if (basicDictionary == null) return; //basicDictionary.SubItem.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); loadCbo.DataSource = basicDictionary.SubItem; loadCbo.DisplayMember = "Name"; loadCbo.ValueMember = "Id"; loadCbo.SelectedIndex = -1; } #endregion #region 填充患者信息 public void SetOPInfoNewOpeRecordInfo() { OperationRecordInfo OpeRecordInfo = BOperationRecordInfo.SelectSingle("OperationRecordId=" + _record.Id, null); _record.OpeRecordInfo.OperationLevel = OpeRecordInfo.OperationLevel; _record.OpeRecordInfo.OperationLevelId = OpeRecordInfo.OperationLevelId; _record.OpeRecordInfo.OperationCutId = OpeRecordInfo.OperationCutId; _record.OpeRecordInfo.OperationCut = OpeRecordInfo.OperationCut; _record.OpeRecordInfo.AnesthesiaSucceed = OpeRecordInfo.AnesthesiaSucceed; _record.OpeRecordInfo.TourNurseSucceed = OpeRecordInfo.TourNurseSucceed; _record.OpeRecordInfo.InstrumentNurseSucceed = OpeRecordInfo.InstrumentNurseSucceed; _record.OpeRecordInfo.AnesthesiaSucceedTime = OpeRecordInfo.AnesthesiaSucceedTime; _record.OpeRecordInfo.InstrumentNurseSucceedTime = OpeRecordInfo.InstrumentNurseSucceedTime; _record.OpeRecordInfo.TourNurseSucceedTime = OpeRecordInfo.TourNurseSucceedTime; _record.OpeRecordInfo.Experts = OpeRecordInfo.Experts; _record.OpeRecordInfo.RuleAnesthesiaDoctor = OpeRecordInfo.RuleAnesthesiaDoctor; _record.OpeRecordInfo.RuleNurse = OpeRecordInfo.RuleNurse; _record.OpeRecordInfo.AnesthesiaMethodFirstName = OpeRecordInfo.AnesthesiaMethodFirstName; _record.OpeRecordInfo.AnesthesiaMethodLastName = OpeRecordInfo.AnesthesiaMethodLastName; _record.OpeRecordInfo.AnesthesiaMethodChangeReason = OpeRecordInfo.AnesthesiaMethodChangeReason; _record.OpeRecordInfo.AnesthesiaMethodChangeTime = OpeRecordInfo.AnesthesiaMethodChangeTime; } public void FullPatientInfo() { try { if (_record.OpeRecordInfo != null) { SetOPInfoNewOpeRecordInfo(); OPInfo = _record.OpeRecordInfo; cboOperationLevel.Text = OPInfo.OperationLevel; cboOperationLevel.Tag = OPInfo.OperationLevelId; txtOperationCut.Tag = OPInfo.OperationCutId; txtOperationCut.Text = OPInfo.OperationCut; //麻醉医生 || 麻醉接台 || 巡回护士|| 护士接台||器械护士||器械接台||体外循环 txtAnesthesiaByDoctor.Text = OPInfo.AnesthesiaSucceed; txtTourNurseSucceed.Text = OPInfo.TourNurseSucceed; txtInstrumentNurseSucceed.Text = OPInfo.InstrumentNurseSucceed; if (OPInfo.AnesthesiaSucceedTime != null) { dtpAnesthesiaByDoctor.CustomFormat = "MM-dd HH:mm"; dtpAnesthesiaByDoctor.Value = OPInfo.AnesthesiaSucceedTime.Value; dtpAnesthesiaByDoctor.Tag = OPInfo.AnesthesiaSucceedTime.Value; } if (OPInfo.InstrumentNurseSucceedTime != null) { dtpInstrumentNurseSucceed.CustomFormat = "MM-dd HH:mm"; dtpInstrumentNurseSucceed.Value = OPInfo.InstrumentNurseSucceedTime.Value; dtpInstrumentNurseSucceed.Tag = OPInfo.InstrumentNurseSucceedTime.Value; } if (OPInfo.TourNurseSucceedTime != null) { dtpTourNurseSucceed.CustomFormat = "MM-dd HH:mm"; dtpTourNurseSucceed.Value = OPInfo.TourNurseSucceedTime.Value; dtpTourNurseSucceed.Tag = OPInfo.TourNurseSucceedTime.Value; } if (OPInfo.Experts != null) txtexperts.Text = OPInfo.Experts; if (OPInfo.RuleAnesthesiaDoctor != null) txtruleAnesthesiaDoctor.Text = OPInfo.RuleAnesthesiaDoctor; if (OPInfo.RuleNurse != null) txtruleNurse.Text = OPInfo.RuleNurse; txtOperationCut.Text = OPInfo.OperationCut; cboOperationLevel.Text = OPInfo.OperationLevel; if (OPInfo.AnesthesiaMethodFirstName != null) { rdoYes.Checked = true; txtAnaesthesiaMethod.Text = OPInfo.AnesthesiaMethodFirstName; txtAnaesthesiaMethod.Tag = OPInfo.AnesthesiaMethodLastName; txtCause.Text = OPInfo.AnesthesiaMethodChangeReason; if (OPInfo.AnesthesiaMethodChangeTime != null) dtpTime.Value = OPInfo.AnesthesiaMethodChangeTime.Value; } } } catch (Exception ex) { PublicMethod.WriteLog(ex); } } #endregion #region 关闭保存手术信息 private void btExit_Click(object sender, EventArgs e) { try { if (OPInfo == null) OPInfo = new OperationRecordInfo(); OPInfo.OperationRecordId = _record.Id; OPInfo.PatientId = _record.PatientId; OPInfo.ApplyId = _record.OperationApplyId; OPInfo.OperatorTime = DateTime.Now; OPInfo.Experts = txtexperts.Text.Trim(); OPInfo.RuleAnesthesiaDoctor = txtruleAnesthesiaDoctor.Text.Trim(); OPInfo.RuleNurse = txtruleNurse.Text.Trim(); OPInfo.OperationCut = txtOperationCut.Text; OPInfo.OperationLevel = cboOperationLevel.Text; if (rdoYes.Checked == true && txtAnaesthesiaMethod.Text != "") { OPInfo.AnesthesiaMethodFirstName = txtAnaesthesiaMethod.Text; //OPInfo.AnesthesiaMethodLastName = txtAnaesthesiaMethod.Tag.ToString(); OPInfo.AnesthesiaMethodChangeReason = txtCause.Text.Trim(); OPInfo.AnesthesiaMethodChangeTime = dtpTime.Value; } else { OPInfo.AnesthesiaMethodFirstName = null; OPInfo.AnesthesiaMethodChangeReason = null; OPInfo.AnesthesiaMethodChangeTime = null; } OPInfo.OperatorId = PublicMethod.OperatorName; if (OPInfo.Id == null) { OPInfo.Id = BOperationRecordInfo.Insert(OPInfo); } else { BOperationRecordInfo.Update(OPInfo); } } catch (Exception exp) { PublicMethod.WriteLog(exp, ""); return; } } #endregion #region 选择医生术者 /// /// 麻醉接台医生 /// /// /// private void txtAnesthesiaByDoctor_TextChanged(object sender, EventArgs e) { setDoctor(sender as TextBox, "麻醉医生"); OPInfo.AnesthesiaSucceed = txtAnesthesiaByDoctor.Text; if (txtAnesthesiaByDoctor.Text != "") { txtDateTime_MouseDown(dtpAnesthesiaByDoctor, null); dtpAnesthesiaByDoctor.Enabled = true; } else { dtpAnesthesiaByDoctor.CustomFormat = " "; OPInfo.AnesthesiaSucceedTime = null; dtpAnesthesiaByDoctor.Tag = null; dtpAnesthesiaByDoctor.Enabled = false; } } /// /// 巡回接台护士 /// /// /// private void txtTourNurseSucceed_TextChanged(object sender, EventArgs e) { setDoctor(sender as TextBox, "护士"); OPInfo.TourNurseSucceed = txtTourNurseSucceed.Text; if (txtTourNurseSucceed.Text != "") { txtDateTime_MouseDown(dtpTourNurseSucceed, null); dtpTourNurseSucceed.Enabled = true; } else { dtpTourNurseSucceed.CustomFormat = " "; OPInfo.TourNurseSucceedTime = null; dtpTourNurseSucceed.Tag = null; dtpTourNurseSucceed.Enabled = false; } } /// /// 器械接台护士 /// /// /// private void txtInstrumentNurseSucceed_TextChanged(object sender, EventArgs e) { setDoctor(sender as TextBox, "护士"); ; OPInfo.InstrumentNurseSucceed = txtInstrumentNurseSucceed.Text; if (txtInstrumentNurseSucceed.Text != "") { txtDateTime_MouseDown(dtpInstrumentNurseSucceed, null); dtpInstrumentNurseSucceed.Enabled = true; } else { dtpInstrumentNurseSucceed.CustomFormat = " "; OPInfo.InstrumentNurseSucceedTime = null; dtpInstrumentNurseSucceed.Tag = null; dtpInstrumentNurseSucceed.Enabled = false; } } #endregion #region 修改手术信息 #region 选择手术体位 private void txtOperationPosition_TextChanged(object sender, EventArgs e) { frmSelectDictionary fsd = new frmSelectDictionary(); fsd._controlName = sender as TextBox; fsd._dictionaryName = "手术体位"; fsd.ShowDialog(); } #endregion #endregion #region 公共方法 /// /// 根据工作类型 选择医生术者赋值TextBox /// /// 医生术者TextBox /// 工作类型 public void setDoctor(TextBox controlTextBox, string workersType) { PublicUI.UI.frmSelectPerson frmOperationDoctor = new PublicUI.UI.frmSelectPerson(); frmOperationDoctor.PersonType = workersType; frmOperationDoctor.SelectDepartmentName = "手术室"; frmOperationDoctor.SelectPersonData = new List(); frmOperationDoctor.ShowDialog(); foreach (int RowId in frmOperationDoctor.SelectPersonData) { controlTextBox.Text += BPerson.GetModel(RowId).Name + " ,"; } if (controlTextBox.Text != "") { int idxStart = controlTextBox.Text.LastIndexOf(" ,"); controlTextBox.Text = controlTextBox.Text.Substring(0, idxStart); } } #endregion #region 手术特殊事件时间点处理事件 public void txtDateTime_MouseDown(object sender, MouseEventArgs e) { DateTimeInput tb = sender as DateTimeInput; if (tb.Text.Trim() == "" && tb.CustomFormat == " ") { tb.BackColor = Color.White; DateTime curTimeTemp = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); SetPic(0, sender, curTimeTemp); } else { tb.CustomFormat = "MM-dd HH:mm"; tb.ButtonDropDown.Visible = true; } } private void txtDateTime_LostFocus(object sender, EventArgs e) { DateTimeInput tb = sender as DateTimeInput; if (tb.Text.Trim() != "" && tb.Value.ToString() != tb.Tag.ToString()) { try { SetPic(0, sender, tb.Value); } catch (Exception exp) { tb.Focus(); PublicMethod.WriteLog(exp, ""); return; } } { if (tb.Tag != null && tb.Tag.ToString() != "") tb.Value = DateTime.Parse(tb.Tag.ToString()); } } #endregion #region 特殊事件触发时设置图片 private void SetPic(int state, Object obj, DateTime curTimeTemp) { DateTimeInput tb = obj as DateTimeInput; if (tb.Name == "dtpAnesthesiaByDoctor") { if (state == 0) { if (txtAnesthesiaByDoctor.Text == "") { MessageBox.Show("请选择接台人员!", "系统提示"); return; } tb.CustomFormat = "MM-dd HH:mm"; OPInfo.AnesthesiaSucceedTime = curTimeTemp; tb.Tag = curTimeTemp; tb.Value = curTimeTemp; } else { dtpAnesthesiaByDoctor.CustomFormat = " "; OPInfo.AnesthesiaSucceedTime = null; tb.Tag = null; } } if (tb.Name == "dtpTourNurseSucceed") { if (state == 0) { if (txtTourNurseSucceed.Text == "") { MessageBox.Show("请选择接台人员!", "系统提示"); return; } tb.CustomFormat = "MM-dd HH:mm"; OPInfo.TourNurseSucceedTime = curTimeTemp; tb.Tag = curTimeTemp; tb.Value = curTimeTemp; } else { tb.CustomFormat = " "; OPInfo.TourNurseSucceedTime = null; tb.Tag = null; } } if (tb.Name == "dtpInstrumentNurseSucceed") { if (state == 0) { if (txtInstrumentNurseSucceed.Text == "") { MessageBox.Show("请选择接台人员!", "系统提示"); return; } tb.CustomFormat = "MM-dd HH:mm"; OPInfo.InstrumentNurseSucceedTime = curTimeTemp; tb.Tag = curTimeTemp; tb.Value = curTimeTemp; } else { tb.CustomFormat = " "; OPInfo.InstrumentNurseSucceedTime = null; tb.Tag = null; } } } #endregion #region 关闭时触发 private void frmOperationInfoNew2_FormClosing(object sender, FormClosingEventArgs e) { if (ConnectionVerification() == false) { e.Cancel = true; return; } btExit_Click(null, null); //this.Hide(); //e.Cancel = true; Application.RemoveMessageFilter(this); } #endregion #region RadioButton RadioButton radd = null; private void radD_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (radd == null) { rdo.Checked = true; radd = rdo; } else if (radd != rdo) { rdo.Checked = true; radd.Checked = false; radd = rdo; } else { rdo.Checked = false; radd = null; } } RadioButton radz = null; private void radZ_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (radz == null) { rdo.Checked = true; radz = rdo; } else if (radd != rdo) { rdo.Checked = true; radz.Checked = false; radz = rdo; } else { rdo.Checked = false; radz = null; } } CheckBox radb = null; private void radB_Click(object sender, EventArgs e) { CheckBox rdo = (CheckBox)sender; if (radb == null) { rdo.Checked = true; radb = rdo; } else if (radb != rdo) { rdo.Checked = true; radb.Checked = false; radb = rdo; } else { rdo.Checked = false; radb = null; } } RadioButton rady = null; private void radY_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (rady == null) { rdo.Checked = true; rady = rdo; } else if (rady != rdo) { rdo.Checked = true; rady.Checked = false; rady = rdo; } else { rdo.Checked = false; rady = null; } } RadioButton radBM = null; private void radM_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (radBM == null) { rdo.Checked = true; radBM = rdo; } else if (radBM != rdo) { rdo.Checked = true; radBM.Checked = false; radBM = rdo; } else { rdo.Checked = false; radBM = null; } } RadioButton rdoNeuroPlexusAroundLef = null; private void rdoNeuroPlexusAroundLeft_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (rdoNeuroPlexusAroundLef == null) { rdo.Checked = true; rdoNeuroPlexusAroundLef = rdo; } else if (rdoNeuroPlexusAroundLef != rdo) { rdo.Checked = true; rdoNeuroPlexusAroundLef.Checked = false; rdoNeuroPlexusAroundLef = rdo; } else { rdo.Checked = false; rdoNeuroPlexusAroundLef = null; } } RadioButton chkshi = null; private void radMas_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (chkshi == null) { rdo.Checked = true; chkshi = rdo; } else if (chkshi != rdo) { rdo.Checked = true; chkshi.Checked = false; chkshi = rdo; } else { rdo.Checked = false; chkshi = null; } } RadioButton chkkshj = null; private void radKSHJ_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (chkkshj == null) { rdo.Checked = true; chkkshj = rdo; } else if (chkkshj != rdo) { rdo.Checked = true; chkkshj.Checked = false; chkkshj = rdo; } else { rdo.Checked = false; chkkshj = null; } } RadioButton chkdmcc = null; private void radDMCC_Click(object sender, EventArgs e) { RadioButton rdo = (RadioButton)sender; if (chkdmcc == null) { rdo.Checked = true; chkdmcc = rdo; } else if (chkdmcc != rdo) { rdo.Checked = true; chkdmcc.Checked = false; chkdmcc = rdo; } else { rdo.Checked = false; chkdmcc = null; } } #endregion #region 接台验证 private bool ConnectionVerification() { bool b = true; if (PublicMethod.RoleName.Contains("术中填写手术等级切口等级")) { if (cboOperationLevel.Text == "" || cboOperationLevel.Text == "未分级") { MessageBox.Show("请填手术分级"); label19.ForeColor = Color.Red; cboOperationLevel.Focus(); b = false; } if (txtOperationCut.Text == "") { MessageBox.Show("请填写切口类型"); label20.ForeColor = Color.Red; txtOperationCut.Focus(); b = false; } } return b; } #endregion private void cboODepartment_TextUpdate(object sender, EventArgs e) { //清空combobox this.txtruleAnesthesiaDoctor.Items.Clear(); //清空listNew listNew.Clear(); //遍历全部备查数据 listNew = BPerson.GetruleAnesthesiaDoctor(txtruleAnesthesiaDoctor.Text); //combobox添加已经查到的关键词 this.txtruleAnesthesiaDoctor.Items.AddRange(listNew.ToArray()); //设置光标位置,否则光标位置始终保持在第一列,造成输入关键词的倒序排列 this.txtruleAnesthesiaDoctor.SelectionStart = this.txtruleAnesthesiaDoctor.Text.Length; //保持鼠标指针原来状态,有时候鼠标指针会被下拉框覆盖,所以要进行一次设置。 Cursor = Cursors.Default; //自动弹出下拉框 this.txtruleAnesthesiaDoctor.DroppedDown = true; } private void txtruleNurse_TextUpdate(object sender, EventArgs e) { //清空combobox this.txtruleNurse.Items.Clear(); //清空listNew listNewNur.Clear(); //遍历全部备查数据 listNewNur = BPerson.GetruleNurse(txtruleNurse.Text); //combobox添加已经查到的关键词 this.txtruleNurse.Items.AddRange(listNewNur.ToArray()); //设置光标位置,否则光标位置始终保持在第一列,造成输入关键词的倒序排列 this.txtruleNurse.SelectionStart = this.txtruleNurse.Text.Length; //保持鼠标指针原来状态,有时候鼠标指针会被下拉框覆盖,所以要进行一次设置。 Cursor = Cursors.Default; //自动弹出下拉框 this.txtruleNurse.DroppedDown = true; } private void txtexperts_TextUpdate(object sender, EventArgs e) { //清空combobox this.txtexperts.Items.Clear(); //清空listNew listNewexperts.Clear(); //遍历全部备查数据 listNewexperts = BPerson.Getexperts(txtexperts.Text); //combobox添加已经查到的关键词 this.txtexperts.Items.AddRange(listNewexperts.ToArray()); //设置光标位置,否则光标位置始终保持在第一列,造成输入关键词的倒序排列 this.txtexperts.SelectionStart = this.txtexperts.Text.Length; //保持鼠标指针原来状态,有时候鼠标指针会被下拉框覆盖,所以要进行一次设置。 Cursor = Cursors.Default; //自动弹出下拉框 this.txtexperts.DroppedDown = true; } private void rdoYes_CheckedChanged(object sender, EventArgs e) { if (rdoYes.Checked == true) { label10.Visible = true; label15.Visible = true; label16.Visible = true; txtAnaesthesiaMethod.Visible = true; txtCause.Visible = true; dtpTime.Visible = true; } else { label10.Visible = false; label15.Visible = false; label16.Visible = false; txtAnaesthesiaMethod.Visible = false; txtCause.Visible = false; dtpTime.Visible = false; } } public List SelectAnaesthesiaMethodData = new List(); frmAnaesthesiaMethod frmAnaesthesia; private void txtAnaesthesiaMethod_Click(object sender, EventArgs e) { frmAnaesthesia = new PublicUI.UI.frmAnaesthesiaMethod(); frmAnaesthesia.FormClosed += new FormClosedEventHandler(frmAnaesthesiaMethod_FormClosed); frmAnaesthesia.SelectAnaesthesiaMethodData = SelectAnaesthesiaMethodData; frmAnaesthesia.ShowDialog(); } void frmAnaesthesiaMethod_FormClosed(object sender, FormClosedEventArgs e) { txtAnaesthesiaMethod.Text = ""; if (frmAnaesthesia.SelectAnaesthesiaMethodData.Count > 0) { SelectAnaesthesiaMethodData = frmAnaesthesia.SelectAnaesthesiaMethodData; foreach (int RowId in frmAnaesthesia.SelectAnaesthesiaMethodData) { txtAnaesthesiaMethod.Text += BAnaesthesiaMethod.GetModel(RowId).Name + " ,"; } int idxStart = txtAnaesthesiaMethod.Text.LastIndexOf(" ,"); txtAnaesthesiaMethod.Text = txtAnaesthesiaMethod.Text.Substring(0, idxStart); } } } }