using HelperDB; using AIMSExtension; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using AIMSModel; using AIMSBLL; namespace AIMS.OperationFront.UI { public partial class frmOperationFrontVisit : Form { public frmOperationFrontVisit() { InitializeComponent(); } private void frmOperationFrontVisit_Load(object sender, EventArgs e) { dgv1.BackgroundColor = System.Drawing.Color.Snow; dgv2.BackgroundColor = System.Drawing.Color.Snow; dtpBegInDate.Value = DateTime.Parse(dtpBegInDate.Value.ToString("yyyy-MM-dd")); dtpEndDate.Value = DateTime.Parse(dtpEndDate.Value.ToString("yyyy-MM-dd")).AddDays(4); dtpBegInDate2.Value = DateTime.Parse(dtpBegInDate2.Value.ToString("yyyy-MM-dd")); dtpEndDate2.Value = DateTime.Parse(dtpEndDate2.Value.ToString("yyyy-MM-dd")).AddDays(4); List list = new List(); list = BDepartment.GetDepartmentAllList(); list.Insert(0, new Department { Id = -1, Name = "全部科室" }); cboDepartment.DataSource = list; cboDepartment.DisplayMember = "Name"; cboDepartment.ValueMember = "Id"; cboDepartment.SelectedIndex = -1; cboDepartment.Text = "全部科室"; dtpBegInDate2.Value = DateTime.Parse(dtpBegInDate2.Value.ToString("yyyy-MM-dd")); dtpEndDate2.Value = DateTime.Parse(dtpEndDate2.Value.ToString("yyyy-MM-dd")).AddDays(4); List list2 = new List(); list2 = BDepartment.GetDepartmentAllList(); list2.Insert(0, new Department { Id = -1, Name = "全部科室" }); cboDepartment2.DataSource = list2; cboDepartment2.DisplayMember = "Name"; cboDepartment2.ValueMember = "Id"; cboDepartment2.SelectedIndex = -1; cboDepartment2.Text = "全部科室"; tabControl1_Selected(null, null); btnFind_Click(null, null); } private void btnFind_Click(object sender, EventArgs e) { string Department = cboDepartment.Text; if (Department == "全部科室") { Department = ""; } DataTable dt = BOperationApply.GetOperationFrontDataTableByPlanOperationTime(dtpBegInDate.Value.ToString("yyyy-MM-dd"), dtpEndDate.Value.ToString("yyyy-MM-dd")); DataTable Newdt = AIMSExtension.PublicMethod.GetNewDataTable(dt, "State IN ('已排程') and ApplyDepName LIKE '%" + Department + "%' AND MdrecNo LIKE '%" + txtMdrecNo.Text.Trim() + "%'", ""); dgv1.DataSource = Newdt; for (int i = 0; i < dgv1.Rows.Count; i++) { if (dgv1.Rows[i].Cells["OperationTypeColumn1"].Value.ToString() == "急诊") { dgv1.Rows[i].DefaultCellStyle.BackColor = Color.LightSalmon; } if (dgv1.Rows[i].Cells["OperationTypeColumn1"].Value.ToString() == "特急") { dgv1.Rows[i].DefaultCellStyle.BackColor = Color.Red; } } } private void btnFind2_Click(object sender, EventArgs e) { string Department = cboDepartment2.Text; if (Department == "全部科室") { Department = ""; } DataTable dt = BOperationApply.GetOperationFrontDataTableByPlanOperationTime(dtpBegInDate2.Value.ToString("yyyy-MM-dd"), dtpEndDate2.Value.ToString("yyyy-MM-dd")); DataTable Newdt = AIMSExtension.PublicMethod.GetNewDataTable(dt, "State IN ('已访视') and ApplyDepName LIKE '%" + Department + "%' AND MdrecNo LIKE '%" + txtMdrecNo.Text.Trim() + "%'", ""); dgv2.DataSource = Newdt; for (int i = 0; i < dgv2.Rows.Count; i++) { if (dgv2.Rows[i].Cells["OperationTypeColumn2"].Value.ToString() == "急诊") { dgv2.Rows[i].DefaultCellStyle.BackColor = Color.LightSalmon; } if (dgv2.Rows[i].Cells["OperationTypeColumn2"].Value.ToString() == "特急") { dgv2.Rows[i].DefaultCellStyle.BackColor = Color.Red; } } } private void tabControl1_Selected(object sender, TabControlEventArgs e) { if (this.tabControl1.SelectedTab.Name == "tabPage1") { tsbAdd.Enabled = true; tsbModify.Enabled = false; btnFind_Click(null, null); } else if (this.tabControl1.SelectedTab.Name == "tabPage2") { tsbAdd.Enabled = false; tsbModify.Enabled = true; btnFind2_Click(null, null); } } private void tsbAdd_Click(object sender, EventArgs e) { if (dgv1.Rows.Count > 0) { //frmOperationFrontVisitDetail frmOperationFrontVisitDetail = new frmOperationFrontVisitDetail(); //frmOperationFrontVisitDetail.ApplyId = int.Parse(dgv1.CurrentRow.Cells["ApplyIdColumn1"].Value.ToString()); //frmOperationFrontVisitDetail.State = AIMSExtension.EditState.ADD; //frmOperationFrontVisitDetail.FormClosed += new FormClosedEventHandler(frmOperationFrontVisitDetail_FormClosed); //frmOperationFrontVisitDetail.ShowDialog(); AIMS.DocManager.frmDocumentSingle frmDocumentSingle = new DocManager.frmDocumentSingle(); frmDocumentSingle.ApplyId = int.Parse(dgv1.CurrentRow.Cells["ApplyIdColumn1"].Value.ToString()); frmDocumentSingle.PatientId = int.Parse(dgv1.CurrentRow.Cells["PatientIdColumn1"].Value.ToString()); frmDocumentSingle.TempName = "麻醉术前访视单"; frmDocumentSingle.WindowState = FormWindowState.Maximized; frmDocumentSingle.ShowDialog(); btnFind_Click(null, null); } } void frmOperationFrontVisitDetail_FormClosed(object sender, FormClosedEventArgs e) { btnFind_Click(null, null); btnFind2_Click(null, null); } private void tsbModify_Click(object sender, EventArgs e) { if (dgv2.Rows.Count > 0) { //frmOperationFrontVisitDetail frmOperationFrontVisitDetail = new frmOperationFrontVisitDetail(); //frmOperationFrontVisitDetail.ApplyId = int.Parse(dgv2.CurrentRow.Cells["ApplyIdColumn2"].Value.ToString()); //frmOperationFrontVisitDetail.State = AIMSExtension.EditState.EDIT; //frmOperationFrontVisitDetail.FormClosed += new FormClosedEventHandler(frmOperationFrontVisitDetail_FormClosed); //frmOperationFrontVisitDetail.ShowDialog(); AIMS.DocManager.frmDocumentSingle frmDocumentSingle = new DocManager.frmDocumentSingle(); frmDocumentSingle.ApplyId = int.Parse(dgv2.CurrentRow.Cells["ApplyIdColumn2"].Value.ToString()); frmDocumentSingle.PatientId = int.Parse(dgv2.CurrentRow.Cells["PatientIdColumn2"].Value.ToString()); frmDocumentSingle.WindowState = FormWindowState.Maximized; frmDocumentSingle.ShowDialog(); btnFind2_Click(null, null); } } private void tsbExit_Click(object sender, EventArgs e) { Close(); } private void tsbWaitSet_Click(object sender, EventArgs e) { } private void tsbAlreadySet_Click(object sender, EventArgs e) { } } }