using AIMSBLL; using AIMSExtension; using AIMSModel; using AxNsoOfficeLib; using DCSoftDotfuscate; using DevComponents.DotNetBar.Controls; using DrawGraph; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Windows.Forms; namespace AIMS.PublicUI.UI { public partial class frmCreateTemplate : Form { public OperationRecord _record; public string TemplateName; public string OperatorName; public bool IsPublic; public DateTime InRoomTime; public int PatientId = 0; public int TypeId = 0; //1 手术模板 2 手术复苏模板 public bool IsAdd; public DataRow[] PhysioParamdr; public frmCreateTemplate() { InitializeComponent(); } private void frmCreateTemplate_Load(object sender, EventArgs e) { Initial(); if (IsAdd == true) { txtOperatorName.Text = PublicMethod.OperatorName; txtName.Text = ""; List SelectOperationData = BFactOperationInfo.GetFactOperationInfoIdList(PatientId); foreach (int RowId in SelectOperationData) { txtName.Text += BOperation.SelectSingle(RowId).Name + " ,"; } if (txtName.Text != "") txtName.Text = txtName.Text.Substring(0, txtName.Text.LastIndexOf(" ,")); if (_record.FactDrugList.Count > 0) { cboDrug.Checked = true; SetDGVEvent(dgvDrugsSQ); _record.FactDrugList.Sort(new FactDrugComparer()); FullDrugsData(_record.FactDrugList); } if (_record.FactEventsList.Count > 0) { cboEvent.Checked = true; FullDGV(_record.FactEventsList); } if (_record.FactOutputLiquidsList.Count > 0) { cboOutput.Checked = true; BindOutPut(_record.FactOutputLiquidsList); } LoadPhysioData(); } else { txtOperatorName.Text = OperatorName; txtName.Text = TemplateName; if (IsPublic == true) { radioButton1.Checked = true; } else { radioButton2.Checked = true; } InputData(); } } #region 加载药品列表 private void FullDrugsData(List list) { if (list != null) { //添加入量 if (list.Count > 0) { dgvDrugsSQ.Rows.Clear(); foreach (FactDrug item in list) { if (item.ParentId > 0) continue; SetDGV(item); foreach (FactDrug sItem in list) { if (sItem.ParentId == item.Id) { SetDGV(sItem); } } } } else { dgvDrugsSQ.Rows.Clear(); } for (int i = 0; i < dgvDrugsSQ.Columns.Count; i++) { dgvDrugsSQ.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } } } private void SetDGV(FactDrug item) { int index = dgvDrugsSQ.Rows.Add(); dgvDrugsSQ.Rows[index].Tag = item.Id; if (item.ParentId == 0) { dgvDrugsSQ.Rows[index].Cells[1].Value = "主"; //dgvDrugsSQ.Rows[index].Cells[0].Value = imageList1.Images[0]; //zhuid = dgvDrugsSQ.Rows[index].Index; dgvDrugsSQ.Rows[index].Cells[1].Tag = item.ParentId; } else { dgvDrugsSQ.Rows[index].Cells[1].Value = " ..."; //if (zhuid != 0) dgvDrugsSQ.Rows[index].Cells[1].Tag = zhuid; //dgvDrugsSQ.Rows[index].Cells[0].Value = imageList1.Images[1]; dgvDrugsSQ.Rows[index].Cells[1].Tag = item.ParentId; } dgvDrugsSQ.Rows[index].Cells[2].Tag = item.DrugId;//药品编号 dgvDrugsSQ.Rows[index].Cells[2].Value = item.GiveDrugType;//药品编号 dgvDrugsSQ.Rows[index].Cells[3].Value = item.DrugName;//药品名称 dgvDrugsSQ.Rows[index].Cells[3].Tag = item.DrugId;//药品名称编号 dgvDrugsSQ.Rows[index].Cells[5].Value = item.DrugChannel;//途径 dgvDrugsSQ.Rows[index].Cells[4].Value = item.Remark;//备注 if (item.Dosage != 0) dgvDrugsSQ.Rows[index].Cells[10].Value = (double)item.Dosage;//剂量 dgvDrugsSQ.Rows[index].Cells[11].Value = item.DosageUnit;//剂量单位 if (item.BloodType != null && item.BloodType != "") dgvDrugsSQ.Rows[index].Cells[12].Value = item.BloodType;//血型 if (item.Density != 0) dgvDrugsSQ.Rows[index].Cells[6].Value = (double)item.Density;//浓度 if (item.DensityUnit != null && item.DensityUnit != "") dgvDrugsSQ.Rows[index].Cells[7].Value = item.DensityUnit;//浓度单位 if (item.Velocity != "") dgvDrugsSQ.Rows[index].Cells[8].Value = item.Velocity;//速度 if (item.VelocityUnit != null && item.VelocityUnit != "") dgvDrugsSQ.Rows[index].Cells[9].Value = item.VelocityUnit;//速度单位 if (Convert.ToDateTime(item.DrugBeginTime).ToString().Length > 0) { dgvDrugsSQ.Rows[index].Cells[14].Value = Convert.ToDateTime(item.DrugBeginTime);//开始时间 } if (item.IsContinue > 0) { dgvDrugsSQ.Rows[index].Cells[15].Value = "-->";//持续 } if (item.DrugEndTime.ToString("yyyy-MM-dd HH:mm") != item.DrugBeginTime.ToString("yyyy-MM-dd HH:mm")) { dgvDrugsSQ.Rows[index].Cells[16].Value = Convert.ToDateTime(item.DrugEndTime);//结束时间 } dgvDrugsSQ.Rows[index].Cells[17].Value = item.Access; dgvDrugsSQ.Rows[index].Cells[18].Value = cboDrug.Checked; } private void Initial() { if (ControlExtension._channelList == null) { ControlExtension._channelList = BBasicDictionary.GetBasicDictionaryByName("用药途径", "asc").SubItem; ControlExtension._channelList.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); ControlExtension._drugEffectList = BBasicDictionary.GetBasicDictionaryByName("加药方式").SubItem; ControlExtension._drugEffectList.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); ControlExtension._dUnitList = BBasicDictionary.GetBasicDictionaryByName("给药单位").SubItem; ControlExtension._dUnitList.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); ControlExtension._bloodTypeList = BBasicDictionary.GetBasicDictionaryByName("血型").SubItem; ControlExtension._bloodTypeList.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); ControlExtension._VelocityUnit = BBasicDictionary.GetBasicDictionaryByName("速度单位").SubItem; ControlExtension._VelocityUnit.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); ControlExtension._DensityUnit = BBasicDictionary.GetBasicDictionaryByName("浓度单位").SubItem; ControlExtension._DensityUnit.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); } } private void SetDGVEvent(DataGridView dgv) { dgv.CellClick -= new DataGridViewCellEventHandler(dgvDrugs_CellClick); dgv.CellEndEdit -= Dgv_CellEndEdit; dgv.RowsAdded -= new DataGridViewRowsAddedEventHandler(dgvDrugs_RowsAdded); dgv.CellClick += new DataGridViewCellEventHandler(dgvDrugs_CellClick); dgv.CellEndEdit += Dgv_CellEndEdit; dgv.RowsAdded += new DataGridViewRowsAddedEventHandler(dgvDrugs_RowsAdded); } private void Dgv_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 6) { dgvDrugsSQ.CurrentCell.Tag = dgvDrugsSQ.CurrentCell.EditedFormattedValue.ToString(); } } private void dgvDrugs_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { DataGridViewComboBoxCell channelCell; DataGridViewComboBoxCell dUnitCell; DataGridViewComboBoxCell drugEffectCell; DataGridViewComboBoxCell BloodTypeCell; DataGridViewComboBoxCell DensityUnit; DataGridViewComboBoxCell VelocityUnit; if (e == null) { channelCell = dgvDrugsSQ.Rows[0].Cells[5] as DataGridViewComboBoxCell;//途径 DensityUnit = dgvDrugsSQ.Rows[0].Cells[7] as DataGridViewComboBoxCell;//浓度单位 dUnitCell = dgvDrugsSQ.Rows[0].Cells[11] as DataGridViewComboBoxCell;//剂量单位 drugEffectCell = dgvDrugsSQ.Rows[0].Cells[13] as DataGridViewComboBoxCell;//速度 BloodTypeCell = dgvDrugsSQ.Rows[0].Cells[12] as DataGridViewComboBoxCell;//血型 VelocityUnit = dgvDrugsSQ.Rows[0].Cells[9] as DataGridViewComboBoxCell;//速度单位 //dgvDrugsSQ.Rows[0].Cells[0].Value = imageList1.Images[0]; } else { channelCell = dgvDrugsSQ.Rows[e.RowIndex].Cells[5] as DataGridViewComboBoxCell;//途径 DensityUnit = dgvDrugsSQ.Rows[e.RowIndex].Cells[7] as DataGridViewComboBoxCell;//浓度单位 dUnitCell = dgvDrugsSQ.Rows[e.RowIndex].Cells[11] as DataGridViewComboBoxCell;//剂量单位 drugEffectCell = dgvDrugsSQ.Rows[e.RowIndex].Cells[13] as DataGridViewComboBoxCell;//速度 BloodTypeCell = dgvDrugsSQ.Rows[e.RowIndex].Cells[12] as DataGridViewComboBoxCell;//血型 VelocityUnit = dgvDrugsSQ.Rows[e.RowIndex].Cells[9] as DataGridViewComboBoxCell;//速度单位 //dgvDrugsSQ.Rows[e.RowIndex].Cells[0].Value = imageList1.Images[0]; } channelCell.DataSource = ControlExtension._channelList; channelCell.DisplayMember = "Name"; channelCell.ValueMember = "Name"; dUnitCell.DataSource = ControlExtension._dUnitList; dUnitCell.DisplayMember = "Name"; dUnitCell.ValueMember = "Name"; drugEffectCell.DataSource = ControlExtension._drugEffectList; drugEffectCell.DisplayMember = "Name"; drugEffectCell.ValueMember = "Id"; DensityUnit.DataSource = ControlExtension._DensityUnit; DensityUnit.DisplayMember = "Name"; DensityUnit.ValueMember = "Id"; BloodTypeCell.DataSource = ControlExtension._bloodTypeList; BloodTypeCell.DisplayMember = "Name"; BloodTypeCell.ValueMember = "Id"; VelocityUnit.DataSource = ControlExtension._VelocityUnit; VelocityUnit.DisplayMember = "Name"; VelocityUnit.ValueMember = "Id"; } private void dgvDrugs_CellClick(object sender, DataGridViewCellEventArgs e) { //点击开始时间时显示时间 if (dgvDrugsSQ.CurrentCell != null) { dgvDrugsSQ.BeginEdit(true); //点击Sign列时显示持续事件标记 if (dgvDrugsSQ.CurrentCell.ColumnIndex == 15) { if (dgvDrugsSQ.CurrentCell.EditedFormattedValue.ToString() == "" && dgvDrugsSQ.CurrentRow.Cells[14].EditedFormattedValue.ToString() != "") { dgvDrugsSQ.CurrentCell.Value = "-->"; //SendKeys.Send("{Tab}"); txtName.Focus(); } else { dgvDrugsSQ.CurrentCell.Value = ""; dgvDrugsSQ.CurrentRow.Cells[16].Value = null;//结束时间 txtName.Focus(); } } //点击结束时间时判断是否持续事件,并显示时间 if (dgvDrugsSQ.CurrentCell.ColumnIndex == 16) { if (dgvDrugsSQ.CurrentRow.Cells[15].EditedFormattedValue.ToString() != "" && dgvDrugsSQ.CurrentCell.EditedFormattedValue.ToString() == "")//持续 { dgvDrugsSQ.CurrentCell.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm");//默认当前时间‘ TimeSpan tsp = DateTime.Now - _record.InRoomTime.Value; if (tsp.TotalHours > 12) { DateTime begindate = new DateTime(_record.InRoomTime.Value.Year, _record.InRoomTime.Value.Month, _record.InRoomTime.Value.Day, DateTime.Now.Hour, DateTime.Now.Minute, 0); if (begindate > _record.InRoomTime.Value) { begindate = DateTime.Now; } dgvDrugsSQ.CurrentCell.Value = begindate; } txtName.Focus(); } } } } private void dgvDrugsSQ_DataError(object sender, DataGridViewDataErrorEventArgs e) { if (e.Exception.Message == "DataGridViewComboBoxCell 值无效。") { try { object value = dgvDrugsSQ.Rows[e.RowIndex].Cells[e.ColumnIndex].Value; if (!((DataGridViewComboBoxCell)dgvDrugsSQ.Rows[e.RowIndex].Cells[e.ColumnIndex]).Items.Contains(value)) { //((DataGridViewComboBoxCell)dgvDrugsSQ.Rows[e.RowIndex].Cells[e.ColumnIndex]).Items.Add(value); e.ThrowException = false; } } catch (Exception) { e.ThrowException = false; } } } #endregion #region 加载事件 private void FullDGV(List list) { dgvEvents.AutoGenerateColumns = false; dgvEvents.Rows.Clear(); foreach (FactEvents item in list) { if (item.EventName == "入室") continue; int index = this.dgvEvents.Rows.Add(); this.dgvEvents.Rows[index].Tag = item.Id; this.dgvEvents.Rows[index].Cells["TypeName"].Value = "事件"; DataGridViewComboEditTipBoxCell col = (DataGridViewComboEditTipBoxCell)dgvEvents.Rows[index].Cells[6]; col.Items.Add(""); if (item.EventRemark != null && item.EventRemark != "") { string remark = item.EventRemark.ToString(); string[] s = remark.Split('|'); for (int i = 0; i < s.Length; i++) { if (s[i] != "") col.Items.Add(s[i]); } } if (item.Remark != null && item.Remark.Trim() != "" && !col.Items.Contains(item.Remark)) { col.Items.Add(item.Remark); } this.dgvEvents.Rows[index].Cells["Remark"].Value = item.Remark; this.dgvEvents.Rows[index].Cells["EventName"].Value = item.EventName; this.dgvEvents.Rows[index].Cells["EventName"].Tag = item.EventId; if (item.EventId < 10) { this.dgvEvents.Rows[index].Cells["EventName"].ReadOnly = true; } if (Convert.ToDateTime(item.EventBeginTime).ToString().Length > 0) { this.dgvEvents.Rows[index].Cells["BeginTime"].Value = item.EventBeginTime; } if (item.IsContinue > 0) { this.dgvEvents.Rows[index].Cells["Continue"].Value = "-->"; } if (Convert.ToDateTime(item.EventEndTime).ToString().Length > 0) { if (item.EventEndTime != item.EventBeginTime) { this.dgvEvents.Rows[index].Cells["EndTime"].Value = item.EventEndTime; } } this.dgvEvents.Rows[index].Cells["AddTemp2"].Value = cboEvent.Checked; } for (int i = 0; i < dgvEvents.Columns.Count; i++) { dgvEvents.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } } private void dgvEvents_CellClick(object sender, DataGridViewCellEventArgs e) { //点击开始时间时显示时间 if (dgvEvents.CurrentCell.ColumnIndex == 2 && dgvEvents.CurrentCell.EditedFormattedValue.ToString() == "") { dgvEvents.CurrentCell.Value = DateTime.Now; SendKeys.Send("{Tab}"); } //点击Sign列时显示持续事件标记 if (dgvEvents.CurrentCell.ColumnIndex == 3) { if (dgvEvents.CurrentCell.EditedFormattedValue.ToString() == "" && dgvEvents.CurrentRow.Cells["BeginTime"].EditedFormattedValue.ToString() != "") { dgvEvents.CurrentCell.Value = "-->"; txtName.Focus(); } else { dgvEvents.CurrentCell.Value = ""; dgvEvents.CurrentRow.Cells["EndTime"].Value = ""; txtName.Focus(); } } //点击结束时间时判断是否持续事件,并显示时间 if (dgvEvents.CurrentCell.ColumnIndex == 4) { if (dgvEvents.CurrentRow.Cells[3].EditedFormattedValue.ToString() != "" && dgvEvents.CurrentCell.EditedFormattedValue.ToString() == "") { dgvEvents.CurrentRow.Cells["EndTime"].Value = DateTime.Now; txtName.Focus(); } } } private static void GetEvent(DataGridViewRow dr, FactEvents _event) { try { if (dr.Cells["EventName"].Tag == null) { string name = dr.Cells["EventName"].EditedFormattedValue.ToString(); Events events = BEvents.SelectSingle(" Name='" + name + "'", null); if (events == null) { events = new Events(); events.Name = name; events.HelpCode = PublicMethod.GetFirstLetter(name); events.UseRate = 1; events.IsValid = 1; events.OperatorNo = PublicMethod.OperatorNo; events.OperatorName = PublicMethod.OperatorName; events.OperateDate = DateTime.Now; events.Id = BEvents.Insert(events); } _event.EventId = events.Id; _event.EventName = events.Name; } else { _event.EventId = Convert.ToInt32(dr.Cells["EventName"].Tag); _event.EventName = BEvents.SelectSingle(_event.EventId).Name; } } catch (Exception ex) { PublicMethod.WriteLog(ex); } } #endregion #region 加载生命体征 public System.Windows.Forms.Panel paneltop; public System.Windows.Forms.Panel paneltop2; private void LoadPhysioData() { System.Data.DataTable dtPhysioData = BOperationRecord.getByOpeIDIsPhysioData(_record.Id.Value); if (dtPhysioData.Rows.Count > 0) cboSmtz.Checked = true; } private void LoadPhysioData2(System.Data.DataTable dtPhysioData) { panelsmtz.Controls.Clear(); int rows = 2; int Width = panelsmtz.Width - (panelsmtz.Width / (240 / 5) * 3); //循环加载麻醉体征控件 for (int x = _record.PhysioAnesConfigList.Count - 1; x >= 0; x--) { PhysioDataConfig ade = _record.PhysioAnesConfigList[x]; if (ade.IsDefalultShow == false) continue; List list = new List(); for (int i = 0; i < dtPhysioData.Rows.Count; i++) { if (dtPhysioData.Rows[i]["Name"].ToString().Equals(ade.Name.ToString())) { PhysioData pdTemp = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString()); list.Add(pdTemp); } } System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel(); panel.Tag = ade; panel.BackColor = Color.White; panel.Dock = System.Windows.Forms.DockStyle.Top; panel.Size = new System.Drawing.Size(Width, 30); for (int i = (240 / ade.YAisx) - 1; i >= 0; i--) { DateTime SpanTime = _record.InRoomTime.Value.AddMinutes(i * ade.YAisx); PhysioData pdNew = null; foreach (var item in list) { if (item.RecordTime == SpanTime) { pdNew = item; pdNew.config = ade; break; } } if (pdNew == null) { pdNew = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, SpanTime, -1); } if (ade.ImgPath != null && ade.ImgPath != "") { System.Windows.Forms.ComboBox textNum = new System.Windows.Forms.ComboBox(); textNum.Items.AddRange(ade.ImgPath.Split('|')); textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm"); textNum.Tag = pdNew; if (pdNew.ValueString != "-1") textNum.Text = pdNew.ValueString.ToString(); textNum.Width = Width / (240 / ade.YAisx); textNum.Dock = System.Windows.Forms.DockStyle.Left; textNum.DropDownStyle = ComboBoxStyle.DropDownList; textNum.Font = new System.Drawing.Font("微软雅黑", 7f); panel.Controls.Add(textNum); } else { System.Windows.Forms.TextBox textNum = new System.Windows.Forms.TextBox(); textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm"); textNum.Tag = pdNew; if (pdNew.ValueString != "-1") textNum.Text = pdNew.ValueString.ToString(); textNum.Width = Width / (240 / ade.YAisx); textNum.Dock = System.Windows.Forms.DockStyle.Left; textNum.Font = new System.Drawing.Font("微软雅黑", 7f); panel.Controls.Add(textNum); } } System.Windows.Forms.Label textName = new System.Windows.Forms.Label(); textName.Name = "txt" + ade.Name; textName.Text = ade.Name; textName.Font = new System.Drawing.Font("微软雅黑", 8f); textName.Width = panelsmtz.Width / (240 / 5) * 3; textName.Dock = System.Windows.Forms.DockStyle.Left; panel.Controls.Add(textName); panelsmtz.Controls.Add(panel); rows++; } //循环加载数值生命体征 for (int x = _record.PhysioConfigList.Count - 1; x >= 0; x--) { PhysioDataConfig ade = _record.PhysioConfigList[x]; if (ade.IsDefalultShow == false) continue; List list = new List(); for (int i = 0; i < dtPhysioData.Rows.Count; i++) { if (dtPhysioData.Rows[i]["Name"].ToString().Equals(ade.Name.ToString())) { PhysioData pdTemp = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, DateTime.Parse(dtPhysioData.Rows[i]["RecordTime"].ToString()), dtPhysioData.Rows[i]["Value"].ToString()); list.Add(pdTemp); } } System.Windows.Forms.Panel panel = new System.Windows.Forms.Panel(); panel.Tag = ade; panel.BackColor = Color.White; panel.Dock = System.Windows.Forms.DockStyle.Top; panel.Size = new System.Drawing.Size(Width, 30); for (int i = (240 / 5) - 1; i >= 0; i--) { DateTime SpanTime = _record.InRoomTime.Value.AddMinutes(i * 5); System.Windows.Forms.TextBox textNum = new System.Windows.Forms.TextBox(); PhysioData pdNew = null; foreach (var item in list) { if (item.RecordTime == SpanTime) { pdNew = item; pdNew.config = ade; textNum.Text = pdNew.ValueString.ToString(); break; } } if (pdNew == null) { pdNew = PhysioDataConfig.newPhysioData(ade, _record.Id.Value, SpanTime, -1); } textNum.Name = pdNew.config.Id + "" + SpanTime.ToString("HHmm"); textNum.Tag = pdNew; textNum.Width = Width / (240 / 5); textNum.Font = new System.Drawing.Font("微软雅黑", 7f); textNum.Dock = System.Windows.Forms.DockStyle.Left; panel.Controls.Add(textNum); } System.Windows.Forms.Label textName = new System.Windows.Forms.Label(); textName.Name = "txt" + ade.Name; textName.Text = ade.Name; textName.Font = new System.Drawing.Font("微软雅黑", 8f); textName.Width = panelsmtz.Width / (240 / 5) * 3; textName.Dock = System.Windows.Forms.DockStyle.Left; panel.Controls.Add(textName); panelsmtz.Controls.Add(panel); rows++; } paneltop = new System.Windows.Forms.Panel(); paneltop.Dock = System.Windows.Forms.DockStyle.Top; paneltop.Location = new System.Drawing.Point(20, 0); paneltop.Size = new System.Drawing.Size(792, 35); for (int i = (240 / 5) - 1; i >= 0; i--) { System.Windows.Forms.Label textNum = new System.Windows.Forms.Label(); textNum.Name = "txt" + _record.InRoomTime.Value.AddMinutes(i * 5).ToString("yyyyMMddHHmm"); textNum.Text = _record.InRoomTime.Value.AddMinutes(i * 5).ToString("HH mm"); textNum.Font = new System.Drawing.Font("微软雅黑", 7f); textNum.Width = Width / (240 / 5); textNum.Dock = System.Windows.Forms.DockStyle.Left; textNum.TextAlign = ContentAlignment.MiddleCenter; paneltop.Controls.Add(textNum); } System.Windows.Forms.Label textTipName2 = new System.Windows.Forms.Label(); textTipName2.Text = "时间 "; textTipName2.Font = new System.Drawing.Font("微软雅黑", 9f, FontStyle.Bold); textTipName2.Width = panelsmtz.Width / (240 / 5) * 3 / 2; textTipName2.Dock = System.Windows.Forms.DockStyle.Left; textTipName2.TextAlign = ContentAlignment.MiddleRight; paneltop.Controls.Add(textTipName2); System.Windows.Forms.Label textTipName = new System.Windows.Forms.Label(); textTipName.Text = " 名称"; textTipName.Font = new System.Drawing.Font("微软雅黑", 9f, FontStyle.Bold); textTipName.Width = panelsmtz.Width / (240 / 5) * 3 / 2; textTipName.Dock = System.Windows.Forms.DockStyle.Left; textTipName.TextAlign = ContentAlignment.MiddleLeft; paneltop.Controls.Add(textTipName); panelsmtz.Controls.Add(paneltop); } #endregion #region 加载出量 public List _outputList; private void BindOutPut(List FactOutputLiquidsList) { if (ControlExtension._channelList == null) { ControlExtension._dUnitList = BBasicDictionary.GetBasicDictionaryByName("给药单位").SubItem; ControlExtension._dUnitList.Insert(0, new BasicDictionary() { Id = -1, Name = "" }); } _outputList = BOutputLiquids.Select(" IsValid=1", null); _outputList.Insert(0, new OutputLiquids() { Id = -1, Name = "" }); if (FactOutputLiquidsList.Count > 0) { FullDGVOut(FactOutputLiquidsList); } } private void FullDGVOut(List list) { //添加出量 if (list.Count > 0) { foreach (FactOutputLiquids item in list) { int index = this.dgvOutput.Rows.Add(); this.dgvOutput.Rows[index].Tag = item.Id; this.dgvOutput.Rows[index].Cells["Remark2"].Value = item.Remark; this.dgvOutput.Rows[index].Cells["OutputName"].Value = item.OutputLiquidsName; this.dgvOutput.Rows[index].Cells["OutputName"].Tag = item.OutputLiquidsId; this.dgvOutput.Rows[index].Cells["Dose"].Value = (double)item.Dosage; this.dgvOutput.Rows[index].Cells["DoseUnit"].Value = item.DosageUnit; if (Convert.ToDateTime(item.BeginTime).ToString().Length > 0) { this.dgvOutput.Rows[index].Cells["BeginTime2"].Value = item.BeginTime; } if (item.IsContinue > 0) { this.dgvOutput.Rows[index].Cells["Continue2"].Value = "-->"; } if (Convert.ToDateTime(item.EndTime).ToString().Length > 0) { if (item.EndTime != item.BeginTime) { this.dgvOutput.Rows[index].Cells["EndTime2"].Value = item.EndTime; } } this.dgvOutput.Rows[index].Cells["AddTemp3"].Value = cboOutput.Checked; } } } private void dgvOutput_CellClick(object sender, DataGridViewCellEventArgs e) { if (dgvOutput.CurrentCell != null) { //点击开始时间时显示时间 if (dgvOutput.CurrentCell.ColumnIndex == 4 && dgvOutput.CurrentCell.EditedFormattedValue.ToString() == "") { dgvOutput.CurrentCell.Value = DateTime.Now; SendKeys.Send("{Tab}"); } //点击Sign列时显示持续事件标记 if (dgvOutput.CurrentCell.ColumnIndex == 5) { if (dgvOutput.CurrentCell.EditedFormattedValue.ToString() == "" && dgvOutput.CurrentRow.Cells["BeginTime"].EditedFormattedValue.ToString() != "") { dgvOutput.CurrentCell.Value = "-->"; txtName.Focus(); SendKeys.Send("{Tab}"); } else { dgvOutput.CurrentCell.Value = ""; dgvOutput.CurrentRow.Cells["EndTime"].Value = ""; txtName.Focus(); } } //点击结束时间时判断是否持续事件,并显示时间 if (dgvOutput.CurrentCell.ColumnIndex == 6) { if (dgvOutput.CurrentRow.Cells[5].EditedFormattedValue.ToString() != "" && dgvOutput.CurrentCell.EditedFormattedValue.ToString() == "") { dgvOutput.CurrentCell.Value = DateTime.Now; txtName.Focus(); } } } } private void dgvOutput_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) { DataGridViewComboEditTipBoxCell nameCell; DataGridViewComboBoxCell unitCell; if (e == null) { nameCell = dgvOutput.Rows[dgvOutput.Rows.Count - 1].Cells["OutputName"] as DataGridViewComboEditTipBoxCell; unitCell = dgvOutput.Rows[dgvOutput.Rows.Count - 1].Cells["DoseUnit"] as DataGridViewComboBoxCell; } else { nameCell = dgvOutput.Rows[e.RowIndex].Cells["OutputName"] as DataGridViewComboEditTipBoxCell; unitCell = dgvOutput.Rows[e.RowIndex].Cells["DoseUnit"] as DataGridViewComboBoxCell; } foreach (var item in _outputList) { nameCell.Items.Add(item.Name); } unitCell.DataSource = ControlExtension._dUnitList; unitCell.DisplayMember = "Name"; unitCell.ValueMember = "Name"; } #endregion #region 加载模板 public void InputData() { DataTable dt = BOperationTemplate.GetDataTable2(TemplateName, TypeId); List drugsRS = new List(); DataRow[] drugdr = dt.Select("ItemKindName='药品' and Spare5='0' "); foreach (DataRow dr in drugdr) { int DrugId = int.Parse(dr["ItemId"].ToString()); FactDrug FactDrugObj = new FactDrug(); FactDrugObj.PatientId = PatientId; FactDrugObj.DrugId = DrugId; FactDrugObj.DrugBeginTime = DateTime.Parse(dr["BeginTime"].ToString()); FactDrugObj.DrugEndTime = DateTime.Parse(dr["EndTime"].ToString()); if (dr["BeginTime"].ToString() == dr["EndTime"].ToString()) { FactDrugObj.IsContinue = 0; } else { FactDrugObj.IsContinue = 1; } FactDrugObj.DrugTypeId = TypeId; if (dr["Value"].ToString() != "") { FactDrugObj.Dosage = decimal.Parse(dr["Value"].ToString()); } FactDrugObj.DosageUnit = dr["DosageUnit"].ToString(); if (dr["Spare1"].ToString() != "" && dr["Spare1"].ToString() != "0" && dr["Spare1"].ToString() != "0.00") { FactDrugObj.Density = decimal.Parse(dr["Spare1"].ToString()); FactDrugObj.DensityUnit = dr["Spare2"].ToString(); } if (dr["Spare3"].ToString() != "" && dr["Spare3"].ToString() != "0" && dr["Spare3"].ToString() != "0.00") { FactDrugObj.Velocity = dr["Spare3"].ToString(); FactDrugObj.VelocityUnit = dr["Spare4"].ToString(); } FactDrugObj.DrugChannel = dr["DrugChannel"].ToString(); FactDrugObj.GiveDrugType = dr["GiveDrugType"].ToString(); FactDrugObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; FactDrugObj.OperatorName = OperatorName; FactDrugObj.OperateDate = DateTime.Now; FactDrugObj.ParentId = 0;// int.Parse(dr["Spare5"].ToString()); FactDrugObj.DrugName = dr["Spare6"].ToString(); FactDrugObj.Access = dr["Spare7"].ToString(); FactDrugObj.Id = int.Parse(dr["Spare8"].ToString()); drugsRS.Add(FactDrugObj); DataRow[] drugchild = dt.Select("ItemKindName='药品' and Spare5='" + FactDrugObj.Id + "' "); foreach (DataRow child in drugchild) { int DrugId2 = int.Parse(child["ItemId"].ToString()); FactDrug FactDrugObjChild = new FactDrug(); FactDrugObjChild.PatientId = PatientId; FactDrugObjChild.ParentId = FactDrugObj.Id; FactDrugObjChild.DrugId = DrugId2; FactDrugObjChild.DrugBeginTime = DateTime.Parse(dr["BeginTime"].ToString()); FactDrugObjChild.DrugEndTime = DateTime.Parse(dr["EndTime"].ToString()); if (child["BeginTime"].ToString() == child["EndTime"].ToString()) { FactDrugObjChild.IsContinue = 0; } else { FactDrugObjChild.IsContinue = 1; } FactDrugObjChild.DrugTypeId = TypeId; if (child["Value"].ToString() != "") { FactDrugObjChild.Dosage = decimal.Parse(child["Value"].ToString()); } FactDrugObjChild.DosageUnit = child["DosageUnit"].ToString(); if (child["Spare1"].ToString() != "" && child["Spare1"].ToString() != "0" && child["Spare1"].ToString() != "0.00") { FactDrugObjChild.Density = decimal.Parse(child["Spare1"].ToString()); FactDrugObjChild.DensityUnit = child["Spare2"].ToString(); } if (child["Spare3"].ToString() != "" && child["Spare3"].ToString() != "0" && child["Spare3"].ToString() != "0.00") { FactDrugObjChild.Velocity = child["Spare3"].ToString(); FactDrugObjChild.VelocityUnit = child["Spare4"].ToString(); } FactDrugObjChild.DrugChannel = child["DrugChannel"].ToString(); FactDrugObjChild.GiveDrugType = child["GiveDrugType"].ToString(); FactDrugObjChild.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; FactDrugObjChild.OperatorName = OperatorName; FactDrugObjChild.OperateDate = DateTime.Now; FactDrugObjChild.DrugName = child["Spare6"].ToString(); FactDrugObjChild.Access = child["Spare7"].ToString(); FactDrugObjChild.Id = int.Parse(child["Spare8"].ToString()); drugsRS.Add(FactDrugObjChild); } } List factEvents = new List(); DataRow[] Eventdr = dt.Select("ItemKindName='事件'"); foreach (DataRow dr in Eventdr) { int EventId = int.Parse(dr["ItemId"].ToString()); FactEvents FactEventObj = new FactEvents(); FactEventObj.PatientId = PatientId; FactEventObj.EventId = EventId; FactEventObj.EventName = dr["Spare6"].ToString(); FactEventObj.EventBeginTime = DateTime.Parse(dr["BeginTime"].ToString()); FactEventObj.EventEndTime = DateTime.Parse(dr["EndTime"].ToString()); if (dr["BeginTime"].ToString() == dr["EndTime"].ToString()) { FactEventObj.IsContinue = 0; } else { FactEventObj.IsContinue = 1; } FactEventObj.EventTypeId = TypeId; if (dr["Spare8"].ToString() != "") FactEventObj.Id = int.Parse(dr["Spare8"].ToString()); FactEventObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; FactEventObj.OperatorName = OperatorName; FactEventObj.OperateDate = DateTime.Now; factEvents.Add(FactEventObj); } List factOutputLiquids = new List(); DataRow[] OutputLiquidsdr = dt.Select("ItemKindName='出量'"); foreach (DataRow dr in OutputLiquidsdr) { int OutputLiquidsId = int.Parse(dr["ItemId"].ToString()); FactOutputLiquids FactOutputLiquidsObj = new FactOutputLiquids(); FactOutputLiquidsObj.PatientId = PatientId; FactOutputLiquidsObj.OutputLiquidsId = OutputLiquidsId; FactOutputLiquidsObj.OutputLiquidsName = dr["Spare6"].ToString(); FactOutputLiquidsObj.BeginTime = DateTime.Parse(dr["BeginTime"].ToString()); FactOutputLiquidsObj.EndTime = DateTime.Parse(dr["EndTime"].ToString()); if (dr["BeginTime"].ToString() == dr["EndTime"].ToString()) { FactOutputLiquidsObj.IsContinue = 0; } else { FactOutputLiquidsObj.IsContinue = 1; } FactOutputLiquidsObj.OutputLiquidsTypeId = TypeId; if (dr["Value"].ToString() != "") { FactOutputLiquidsObj.Dosage = decimal.Parse(dr["Value"].ToString()); } FactOutputLiquidsObj.DosageUnit = dr["DosageUnit"].ToString(); if (dr["Spare8"].ToString() != "") FactOutputLiquidsObj.Id = int.Parse(dr["Spare8"].ToString()); FactOutputLiquidsObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; FactOutputLiquidsObj.OperatorName = OperatorName; FactOutputLiquidsObj.OperateDate = DateTime.Now; factOutputLiquids.Add(FactOutputLiquidsObj); } if (drugsRS.Count > 0) { cboDrug.Checked = true; SetDGVEvent(dgvDrugsSQ); drugsRS.Sort(new FactDrugComparer()); FullDrugsData(drugsRS); } if (factEvents.Count > 0) { cboEvent.Checked = true; FullDGV(factEvents); } if (factOutputLiquids.Count > 0) { cboOutput.Checked = true; BindOutPut(factOutputLiquids); } PhysioParamdr = dt.Select("ItemKindName='生命体征'"); if (PhysioParamdr != null && PhysioParamdr.Length > 0) { cboSmtz.Checked = true; } //foreach (DataRow dr in PhysioParamdr) //{ // int PhysioParamId = int.Parse(dr["ItemId"].ToString()); // TimeSpan BeginTimets = DateTime.Parse(dr["BeginTime"].ToString()).Subtract(DateTime.Parse(dr["InRoomTime"].ToString())); // OperationDoing.AnasRecordBill.Model.PhysioData PhysioDataObj = new OperationDoing.AnasRecordBill.Model.PhysioData(); // PhysioDataObj.PatientId = PatientId; // PhysioDataObj.PhysioDataType = TypeId; // PhysioDataObj.RecordTime = InRoomTime.AddSeconds(BeginTimets.TotalSeconds); // PhysioDataObj.PhysioParamID = PhysioParamId; // if (dr["Value"].ToString() != "") // { // PhysioDataObj.Value = double.Parse(dr["Value"].ToString()); // } // else // { // PhysioDataObj.Value = 0; // } //} } #endregion #region 保存模板 private void tsbSava_Click(object sender, EventArgs e) { txtName.Select(); if (txtName.Text.Trim() == "") { MessageBox.Show("模板名称不能为空!"); return; } try { if (IsAdd == true) { if (BOperationTemplate.Exists(txtName.Text.Trim(), TypeId)) { MessageBox.Show("名称不能重复!"); return; } TemplateName = txtName.Text.Trim(); OperatorName = txtOperatorName.Text.Trim(); int IsPublic = radioButton1.Checked == true ? 1 : 0; List OperationTemplates = GetOperationTemplates(InRoomTime, txtName.Text.Trim(), PatientId, TypeId, IsPublic); BOperationTemplate.Adds(OperationTemplates); MessageBox.Show("保存成功!"); Close(); } else { TemplateName = txtName.Text.Trim(); OperatorName = txtOperatorName.Text.Trim(); int IsPublic = radioButton1.Checked == true ? 1 : 0; List OperationTemplates = GetOperationTemplates(InRoomTime, txtName.Text.Trim(), PatientId, TypeId, IsPublic); if (OperationTemplates.Count > 0) { BOperationTemplate.Delete(TemplateName, TypeId); BOperationTemplate.Adds(OperationTemplates); MessageBox.Show("保存成功!"); Close(); } } } catch (Exception ex) { PublicMethod.WriteLog(ex); MessageBox.Show("保存失败!"); } } int second = 0; public List GetOperationTemplates(DateTime InRoomTime, string TemplateName, int PatientId, int TypeId, int IsPublic) { List OperationTemplates = new List(); List drugsRS = new List(); foreach (DataGridViewRow dr in dgvDrugsSQ.Rows) { if (dr.Cells[3].Value == null || dr.Cells[3].Value.ToString() == "")//药品名称 continue; if (Convert.ToBoolean(dr.Cells[18].Value) == false) continue; //实例化FactDrug对象 FactDrug drugsR = new FactDrug(); drugsR.PatientId = _record.PatientId.Value; drugsR.DrugId = Convert.ToInt32(dr.Cells[3].Tag);//药品名称 if (drugsR.DrugId == 0)//药品名称 continue; drugsR.ParentId = int.Parse(dr.Cells[1].Tag.ToString()); drugsR.GiveDrugType = dr.Cells[2].EditedFormattedValue.ToString();//药品名称 drugsR.DrugName = dr.Cells[3].EditedFormattedValue.ToString();//药品名称 drugsR.DrugChannel = dr.Cells[5].EditedFormattedValue.ToString();//途径 if (dr.Cells[10].EditedFormattedValue.ToString() != "")//剂量 { drugsR.Dosage = Convert.ToDecimal(dr.Cells[10].EditedFormattedValue.ToString());//剂量 } drugsR.DosageUnit = dr.Cells[11].EditedFormattedValue.ToString();//剂量单位 if (dr.Cells[6].EditedFormattedValue.ToString() != "") { drugsR.Density = Convert.ToDecimal(dr.Cells[6].EditedFormattedValue.ToString());//浓度 } else { drugsR.Density = 0; } drugsR.DensityUnit = dr.Cells[7].EditedFormattedValue.ToString();//浓度单位 if (dr.Cells[8].EditedFormattedValue.ToString() != "") { drugsR.Velocity = dr.Cells[8].EditedFormattedValue.ToString();//速度 } else { drugsR.Velocity = ""; } drugsR.VelocityUnit = dr.Cells[9].EditedFormattedValue.ToString();//速度单位 drugsR.BloodType = dr.Cells[12].EditedFormattedValue.ToString();//血型 if (dr.Cells[4].EditedFormattedValue.ToString() != "")//备注 drugsR.Remark = dr.Cells[4].EditedFormattedValue.ToString(); else drugsR.Remark = ""; if (dr.Cells[14].EditedFormattedValue.ToString() != "")//开始时间 { drugsR.DrugBeginTime = Convert.ToDateTime(dr.Cells[14].Value.ToString()); if (!drugsR.DrugName.Contains("氧气")) { second++; drugsR.DrugBeginTime = drugsR.DrugBeginTime.AddSeconds(second); if (second > 5) second = 1; } } drugsR.IsContinue = dr.Cells[15].EditedFormattedValue.ToString() != "" ? 1 : 0;//持续 if (drugsR.IsContinue == 1) { DateTime endTime = drugsR.DrugBeginTime; if (dr.Cells[16].EditedFormattedValue.ToString() != "") endTime = Convert.ToDateTime(dr.Cells[16].Value.ToString()); drugsR.DrugEndTime = endTime;//结束时间 } else { drugsR.DrugEndTime = drugsR.DrugBeginTime; } drugsR.OperatorNo = PublicMethod.OperatorNo; drugsR.OperatorName = OperatorName; drugsR.OperateDate = DateTime.Now; drugsR.DrugTypeId = TypeId; if (dr.Cells[17].Value != null) drugsR.Access = dr.Cells[17].Value.ToString(); else drugsR.Access = ""; drugsR.Id = Convert.ToInt32(dr.Tag); drugsRS.Add(drugsR); } //药品 for (int i = 0; i < drugsRS.Count; i++) { OperationTemplate OperationTemplateDrugObj = new OperationTemplate(); FactDrug drugsR = drugsRS[i]; OperationTemplateDrugObj.TemplateName = TemplateName; OperationTemplateDrugObj.TypeId = TypeId; OperationTemplateDrugObj.ItemKindName = "药品"; OperationTemplateDrugObj.InRoomTime = InRoomTime; OperationTemplateDrugObj.ItemId = drugsR.DrugId; OperationTemplateDrugObj.Value = drugsR.Dosage; OperationTemplateDrugObj.BeginTime = drugsR.DrugBeginTime; OperationTemplateDrugObj.EndTime = drugsR.DrugEndTime; OperationTemplateDrugObj.DosageUnit = drugsR.DosageUnit; OperationTemplateDrugObj.DrugChannel = drugsR.DrugChannel; OperationTemplateDrugObj.GiveDrugType = drugsR.GiveDrugType; OperationTemplateDrugObj.Spare1 = drugsR.Density.ToString(); OperationTemplateDrugObj.Spare2 = drugsR.DensityUnit; OperationTemplateDrugObj.Spare3 = drugsR.Velocity.ToString(); OperationTemplateDrugObj.Spare4 = drugsR.VelocityUnit; OperationTemplateDrugObj.Spare5 = drugsR.ParentId.ToString(); OperationTemplateDrugObj.Spare6 = drugsR.DrugName; OperationTemplateDrugObj.Spare7 = drugsR.Access; OperationTemplateDrugObj.Spare8 = drugsR.Id.ToString(); OperationTemplateDrugObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; OperationTemplateDrugObj.OperatorName = OperatorName; OperationTemplateDrugObj.OperateDate = DateTime.Now; OperationTemplateDrugObj.IsPublic = IsPublic; OperationTemplates.Add(OperationTemplateDrugObj); } //事件 List factEvents = new List(); foreach (DataGridViewRow dr in dgvEvents.Rows) { if (dr.Cells["EventName"].Value == null || dr.Cells["EventName"].Value.ToString().Trim() == "") continue; if (Convert.ToBoolean(dr.Cells["AddTemp2"].Value) == false) continue; //实例化FactEvents对象 FactEvents _event = new FactEvents(); _event.EventTypeId = TypeId; _event.PatientId = _record.PatientId; GetEvent(dr, _event); if (_event.EventName == null) continue; if (dr.Cells["BeginTime"].EditedFormattedValue.ToString() != "") { string begindate = Convert.ToDateTime(dr.Cells["BeginTime"].Value.ToString()).ToString("yyyy-MM-dd HH:mm:00"); _event.EventBeginTime = Convert.ToDateTime(begindate);//开始时间 if (dr.Cells["EventName"].Value.ToString() != "入室") { second++; _event.EventBeginTime = _event.EventBeginTime.Value.AddSeconds(second); if (second > 5) second = 0; } } _event.EventEndTime = dr.Cells["EndTime"].EditedFormattedValue.ToString() != "" ? Convert.ToDateTime(dr.Cells["EndTime"].Value.ToString()) : _event.EventBeginTime; if (dr.Cells["Remark"].EditedFormattedValue.ToString() != "") { _event.Remark = dr.Cells["Remark"].EditedFormattedValue.ToString(); } else { _event.Remark = ""; } _event.IsContinue = dr.Cells["Continue"].EditedFormattedValue.ToString() != "" ? 1 : 0; _event.Id = Convert.ToInt32(dr.Tag); factEvents.Add(_event); } for (int i = 0; i < factEvents.Count; i++) { OperationTemplate OperationTemplateEventObj = new OperationTemplate(); FactEvents factEventsObj = factEvents[i]; OperationTemplateEventObj.TemplateName = TemplateName; OperationTemplateEventObj.TypeId = TypeId; OperationTemplateEventObj.ItemKindName = "事件"; OperationTemplateEventObj.InRoomTime = InRoomTime; OperationTemplateEventObj.ItemId = factEventsObj.EventId; OperationTemplateEventObj.Value = 0; OperationTemplateEventObj.BeginTime = factEventsObj.EventBeginTime; OperationTemplateEventObj.EndTime = factEventsObj.EventEndTime; OperationTemplateEventObj.Spare6 = factEventsObj.EventName; OperationTemplateEventObj.Spare8 = factEventsObj.Id.ToString(); OperationTemplateEventObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; OperationTemplateEventObj.OperatorName = OperatorName; OperationTemplateEventObj.OperateDate = DateTime.Now; OperationTemplateEventObj.IsPublic = IsPublic; OperationTemplates.Add(OperationTemplateEventObj); } //出量 List factOutputLiquids = new List(); foreach (DataGridViewRow dr in dgvOutput.Rows) { if (dr.Cells["OutputName"].EditedFormattedValue.ToString() == "" || dr.Cells["Dose"].EditedFormattedValue.ToString() == "") { continue; } if (Convert.ToBoolean(dr.Cells["AddTemp3"].Value) == false) continue; string OutputName = dr.Cells["OutputName"].EditedFormattedValue.ToString().Trim(); int outId = 0; OutputLiquids OutputLiquidsRef = null; OutputLiquidsRef = BOutputLiquids.SelectSingle(" Name='" + OutputName + "'", null, RecursiveType.None, 0); if (OutputLiquidsRef == null) { OutputLiquidsRef = new OutputLiquids(); OutputLiquidsRef.Name = OutputName; OutputLiquidsRef.HelpCode = PublicMethod.GetFirstLetter(OutputName); OutputLiquidsRef.IsValid = 1; OutputLiquidsRef.OperatorNo = PublicMethod.OperatorNo; OutputLiquidsRef.OperateDate = DateTime.Now; OutputLiquidsRef.Id = BOutputLiquids.Insert(OutputLiquidsRef); } outId = OutputLiquidsRef.Id.Value; //实例化OutputLiquids对象 FactOutputLiquids liquids = new FactOutputLiquids(); liquids.OutputLiquidsName = OutputName; liquids.PatientId = _record.PatientId.Value; liquids.OutputLiquidsId = outId; liquids.OutputLiquidsTypeId = TypeId; liquids.Dosage = Convert.ToDecimal(dr.Cells["Dose"].Value); liquids.DosageUnit = dr.Cells["DoseUnit"].EditedFormattedValue.ToString(); if (dr.Cells["BeginTime2"].EditedFormattedValue.ToString() != "") { liquids.BeginTime = Convert.ToDateTime(dr.Cells["BeginTime2"].Value.ToString()); } liquids.EndTime = dr.Cells["EndTime2"].EditedFormattedValue.ToString() != "" ? Convert.ToDateTime(dr.Cells["EndTime2"].Value.ToString()) : liquids.BeginTime; liquids.IsContinue = dr.Cells["Continue2"].EditedFormattedValue.ToString() != "" ? 1 : 0; liquids.Remark = dr.Cells["Remark2"].EditedFormattedValue.ToString(); liquids.OperatorNo = PublicMethod.OperatorNo; liquids.OperatorName = OperatorName; liquids.OperateDate = DateTime.Now; liquids.Id = Convert.ToInt32(dr.Tag); factOutputLiquids.Add(liquids); } for (int i = 0; i < factOutputLiquids.Count; i++) { OperationTemplate OperationTemplateOutputLiquidsObj = new OperationTemplate(); FactOutputLiquids factOutput = factOutputLiquids[i]; OperationTemplateOutputLiquidsObj.TemplateName = TemplateName; OperationTemplateOutputLiquidsObj.TypeId = TypeId; OperationTemplateOutputLiquidsObj.ItemKindName = "出量"; OperationTemplateOutputLiquidsObj.InRoomTime = InRoomTime; OperationTemplateOutputLiquidsObj.ItemId = factOutput.OutputLiquidsId; OperationTemplateOutputLiquidsObj.BeginTime = factOutput.BeginTime; OperationTemplateOutputLiquidsObj.EndTime = factOutput.EndTime; OperationTemplateOutputLiquidsObj.Value = factOutput.Dosage; OperationTemplateOutputLiquidsObj.DosageUnit = factOutput.DosageUnit; OperationTemplateOutputLiquidsObj.Spare6 = factOutput.OutputLiquidsName; OperationTemplateOutputLiquidsObj.Spare8 = factOutput.Id.ToString(); OperationTemplateOutputLiquidsObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; OperationTemplateOutputLiquidsObj.OperatorName = OperatorName; OperationTemplateOutputLiquidsObj.OperateDate = DateTime.Now; OperationTemplateOutputLiquidsObj.IsPublic = IsPublic; OperationTemplates.Add(OperationTemplateOutputLiquidsObj); } if (cboSmtz.Checked == true && IsAdd == true) { System.Data.DataTable dtPhysioData = BOperationRecord.getByOpeIDIsPhysioData(_record.Id.Value); if (dtPhysioData.Rows.Count > 0) { foreach (DataRow item in dtPhysioData.Rows) { OperationTemplate OperationTemplateOutputLiquidsObj = new OperationTemplate(); OperationTemplateOutputLiquidsObj.TemplateName = TemplateName; OperationTemplateOutputLiquidsObj.TypeId = TypeId; OperationTemplateOutputLiquidsObj.ItemKindName = "生命体征"; OperationTemplateOutputLiquidsObj.InRoomTime = InRoomTime; OperationTemplateOutputLiquidsObj.ItemId = int.Parse(item["PhysioDataConfigId"].ToString()); OperationTemplateOutputLiquidsObj.BeginTime = DateTime.Parse(item["RecordTime"].ToString()); OperationTemplateOutputLiquidsObj.EndTime = DateTime.Parse(item["RecordTime"].ToString()); OperationTemplateOutputLiquidsObj.Value = Decimal.Parse(item["Value"].ToString()); OperationTemplateOutputLiquidsObj.DosageUnit = ""; OperationTemplateOutputLiquidsObj.Spare6 = item["Name"].ToString(); OperationTemplateOutputLiquidsObj.Spare8 = ""; OperationTemplateOutputLiquidsObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; OperationTemplateOutputLiquidsObj.OperatorName = OperatorName; OperationTemplateOutputLiquidsObj.OperateDate = DateTime.Now; OperationTemplateOutputLiquidsObj.IsPublic = IsPublic; OperationTemplates.Add(OperationTemplateOutputLiquidsObj); } } } if (cboSmtz.Checked == true && IsAdd == false) { if (PhysioParamdr != null && PhysioParamdr.Length > 0) { foreach (DataRow dr in PhysioParamdr) { OperationTemplate OperationTemplateOutputLiquidsObj = new OperationTemplate(); OperationTemplateOutputLiquidsObj.TemplateName = TemplateName; OperationTemplateOutputLiquidsObj.TypeId = TypeId; OperationTemplateOutputLiquidsObj.ItemKindName = "生命体征"; OperationTemplateOutputLiquidsObj.InRoomTime = InRoomTime; OperationTemplateOutputLiquidsObj.ItemId = int.Parse(dr["ItemId"].ToString()); OperationTemplateOutputLiquidsObj.BeginTime = DateTime.Parse(dr["BeginTime"].ToString()); OperationTemplateOutputLiquidsObj.EndTime = DateTime.Parse(dr["EndTime"].ToString()); OperationTemplateOutputLiquidsObj.Value = Decimal.Parse(dr["Value"].ToString()); OperationTemplateOutputLiquidsObj.DosageUnit = ""; OperationTemplateOutputLiquidsObj.Spare6 = dr["Spare6"].ToString(); OperationTemplateOutputLiquidsObj.Spare8 = ""; OperationTemplateOutputLiquidsObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo; OperationTemplateOutputLiquidsObj.OperatorName = OperatorName; OperationTemplateOutputLiquidsObj.OperateDate = DateTime.Now; OperationTemplateOutputLiquidsObj.IsPublic = IsPublic; OperationTemplates.Add(OperationTemplateOutputLiquidsObj); } } } return OperationTemplates; } private void tsbExit_Click(object sender, EventArgs e) { Close(); } private void cboDrug_CheckedChanged(object sender, EventArgs e) { foreach (DataGridViewRow item in dgvDrugsSQ.Rows) { item.Cells[18].Value = cboDrug.Checked; } } private void cboEvent_CheckedChanged(object sender, EventArgs e) { foreach (DataGridViewRow item in dgvEvents.Rows) { item.Cells["AddTemp2"].Value = cboEvent.Checked; } } private void cboOutput_CheckedChanged(object sender, EventArgs e) { foreach (DataGridViewRow item in dgvOutput.Rows) { item.Cells["AddTemp3"].Value = cboOutput.Checked; } } #endregion } }