using AIMS.DocManager; using AIMS.OperationAanesthesia; using AIMSBLL; using AIMSExtension; using AIMSModel; using DevComponents.DotNetBar; using DevComponents.DotNetBar.Metro.ColorTables; using DocumentManagement; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Threading.Tasks; using System.Windows.Forms; namespace AIMS { public partial class FormMainManage : Office2007Form { public FormMainManage() { InitializeComponent(); Control.CheckForIllegalCrossThreadCalls = false; //Task.Factory.StartNew(() => { PreLoad(); }); comboBoxEx1.Items.AddRange(new object[] { eStyle.Office2013 , eStyle.Office2016 , eStyle.Office2007Blue , eStyle.Office2007Silver , eStyle.Office2007Black, eStyle.Office2007VistaGlass, eStyle.Office2010Silver, eStyle.Office2010Blue, eStyle.Office2010Black , eStyle.Windows7Blue , eStyle.VisualStudio2010Blue , eStyle.VisualStudio2012Light , eStyle.VisualStudio2012Dark , eStyle.OfficeMobile2014 }); comboBoxEx1.SelectedIndex = 1; comboBoxEx2.Items.AddRange(MetroColorGeneratorParameters.GetAllPredefinedThemes().Cast() .ToArray()); SetGridAlternatingRows(lv1); SetGridAlternatingRows(lv2); SetGridAlternatingRows(lv3); SetGridAlternatingRows(lv4); SetGridAlternatingRows(lv5); SetGridAlternatingRows(lv6); } private void switchButton1_ValueChanged(object sender, EventArgs e) { sideNav1.EnableClose = switchButton1.Value; UpdateSideNavDock(); } private void switchButton2_ValueChanged(object sender, EventArgs e) { sideNav1.EnableMaximize = switchButton2.Value; UpdateSideNavDock(); } private void switchButton3_ValueChanged(object sender, EventArgs e) { sideNav1.EnableSplitter = switchButton3.Value; UpdateSideNavDock(); } private void UpdateSideNavDock() { if (sideNav1.EnableClose || sideNav1.EnableMaximize || sideNav1.EnableSplitter) { if (sideNav1.Dock != DockStyle.Left) { sideNav1.Dock = DockStyle.Left; sideNav1.Width = this.ClientRectangle.Width - 32; ToastNotification.Close(this); // Closes any toast messages if already open ToastNotification.Show(this, "With current settings SideNav control must be able to resize itself so its Dock is set to Left.", 4000); } } else if (sideNav1.Dock != DockStyle.Fill) { sideNav1.Dock = DockStyle.Fill; ToastNotification.Close(this); // Closes any toast messages if already open ToastNotification.Show(this, "SideNav control Dock is set to Fill.", 2000); } } private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxEx1.SelectedItem == null) return; eStyle style = (eStyle)comboBoxEx1.SelectedItem; if (styleManager1.ManagerStyle != style) styleManager1.ManagerStyle = style; styleManager1.MetroColorParameters = MetroColorGeneratorParameters.Cherry; } private void comboBoxEx2_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxEx1.SelectedItem == null) return; var style = (MetroColorGeneratorParameters)comboBoxEx2.SelectedItem; //if (styleManager1.MetroColorParameters != style) styleManager1.MetroColorParameters = style; //styleManager1.MetroColorParameters = MetroColorGeneratorParameters.Cherry; } private void FormMainManage_Load(object sender, EventArgs e) { this.Text = " 登录人:" + AIMSExtension.PublicMethod.OperatorName + " " + AIMSExtension.PublicMethod.OperatorNo; int PanelWidth = Convert.ToInt32(sideNavPanel1.Size.Width / 3.4); int PanelHeight = Convert.ToInt32(sideNavPanel1.Size.Height / 2.4); int WidthSplit = sideNavPanel1.Size.Width / 3 / 11; int HeightSplit = sideNavPanel1.Size.Height / 3 / 9; expandablePanel2.Location = new Point(WidthSplit, HeightSplit); expandablePanel2.Size = new Size(PanelWidth, PanelHeight); expandablePanel1.Location = new Point(WidthSplit + PanelWidth + WidthSplit, HeightSplit); expandablePanel1.Size = new Size(PanelWidth, PanelHeight); expandablePanel3.Location = new Point(WidthSplit + PanelWidth + WidthSplit + PanelWidth + WidthSplit, HeightSplit); expandablePanel3.Size = new Size(PanelWidth, PanelHeight); expandablePanel4.Location = new Point(WidthSplit, HeightSplit + PanelHeight + HeightSplit); expandablePanel4.Size = new Size(PanelWidth, PanelHeight); expandablePanel5.Location = new Point(WidthSplit + PanelWidth + WidthSplit, HeightSplit + PanelHeight + HeightSplit); expandablePanel5.Size = new Size(PanelWidth, PanelHeight); expandablePanel6.Location = new Point(WidthSplit + PanelWidth + WidthSplit + PanelWidth + WidthSplit, HeightSplit + PanelHeight + HeightSplit); expandablePanel6.Size = new Size(PanelWidth, PanelHeight); superTabControl1.Size = new Size(PanelWidth - 5, PanelHeight - 35); superTabControl1.Location = new Point(2, 28); superTabControl2.Size = new Size(PanelWidth - 5, PanelHeight - 35); superTabControl2.Location = new Point(2, 28); superTabControl3.Size = new Size(PanelWidth - 5, PanelHeight - 35); superTabControl3.Location = new Point(2, 28); chart1.Size = new Size(PanelWidth - 5, PanelHeight - 35); chart1.Location = new Point(2, 28); chart2.Size = new Size(PanelWidth - 5, PanelHeight - 35); chart2.Location = new Point(2, 28); lv7.Size = new Size(PanelWidth - 5, PanelHeight - 35); lv7.Location = new Point(2, 28); List menuListP = new List(); AIMSModel.Menu menu = new AIMSModel.Menu(); menuListP = BMenu.GetMenuRootListManage(AIMSExtension.PublicMethod.RoleId, "0"); for (int i = 0; i < menuListP.Count; i++) { var menuSec = menuListP[i]; if (menuSec.Name == "功能权限") continue; DevComponents.DotNetBar.Controls.SideNavPanel sideNavPanel = new DevComponents.DotNetBar.Controls.SideNavPanel(); sideNavPanel.AutoScroll = true; sideNavPanel.Dock = System.Windows.Forms.DockStyle.Fill; sideNavPanel.Location = new System.Drawing.Point(156, 32); sideNavPanel.Name = "sideNavPanel" + menuSec.Name; sideNavPanel.Size = new System.Drawing.Size(696, 508); sideNavPanel.TabIndex = i; this.sideNav1.Controls.Add(sideNavPanel); DevComponents.DotNetBar.Controls.SideNavItem sideNavItem = new DevComponents.DotNetBar.Controls.SideNavItem(); sideNavItem.Checked = false; sideNavItem.Name = menuSec.Name; sideNavItem.Panel = sideNavPanel; sideNavItem.Text = menuSec.Name; sideNavItem.Tag = menuSec; if (menuSec.Name == "手术申请") sideNavItem.Symbol = "\uf044"; if (menuSec.Name == "手术排程") sideNavItem.Symbol = "\uf073"; if (menuSec.Name == "麻醉记录") sideNavItem.Symbol = "\uf15b"; if (menuSec.Name == "恢复记录") sideNavItem.Symbol = "\uf15c"; if (menuSec.Name == "诱导记录") sideNavItem.Symbol = "\uf044"; if (menuSec.Name == "镇痛记录") sideNavItem.Symbol = "\uf044"; if (menuSec.Name == "内镜麻醉") sideNavItem.Symbol = "\uf044"; if (menuSec.Name == "介入手术") sideNavItem.Symbol = "\uf044"; if (menuSec.Name == "科室登记") sideNavItem.Symbol = "\uf044"; if (menuSec.Name == "复苏记录") sideNavItem.Symbol = "\uf15c"; if (menuSec.Name == "查询管理") sideNavItem.Symbol = "\uf00e"; if (menuSec.Name == "收费管理") sideNavItem.Symbol = "\uf00e"; if (menuSec.Name == "术后回顾") sideNavItem.Symbol = "\uf0cb"; if (menuSec.Name == "病案管理") sideNavItem.Symbol = "\uf0cb"; if (menuSec.Name == "排程查询") sideNavItem.Symbol = "\uf0c5"; if (menuSec.Name == "医疗文书") sideNavItem.Symbol = "\uf14b"; if (menuSec.Name == "人员管理") sideNavItem.Symbol = "\uf0f0"; if (menuSec.Name == "系统管理") sideNavItem.Symbol = "\uf1de"; if (menuSec.Name == "报表统计") sideNavItem.Symbol = "\uf080"; if (menuSec.Name == "排班管理") sideNavItem.Symbol = "\uf03a"; if (menuSec.Name == "中央监护") sideNavItem.Symbol = "\uf109"; if (menuSec.Name == "大屏公告") sideNavItem.Symbol = "\uf022"; if (menuSec.Name == "质控管理") sideNavItem.Symbol = "\uf200"; if (menuSec.Name == "室外登记") sideNavItem.Symbol = "\uf183"; if (menuSec.Name == "交班管理") sideNavItem.Symbol = "\uf18d"; if (menuSec.Name == "手术清点") sideNavItem.Symbol = "\uf0ea"; this.sideNav1.Items.Add(sideNavItem); } LoadDataRescue(); } private System.Windows.Forms.Timer timerLoadRescue; public void LoadDataRescue() { timerLoadRescue = new System.Windows.Forms.Timer(); timerLoadRescue.Enabled = true;//调试时设置为FALSE , timerLoadRescue.Interval = 300; timerLoadRescue.Tick -= timerLoadRescue_Tick; timerLoadRescue.Tick += timerLoadRescue_Tick; timerLoadRescue.Start(); } private void timerLoadRescue_Tick(object sender, EventArgs e) { timerLoadRescue.Dispose(); //Task.Factory.StartNew(() => //{ BindOperationsList(lv1, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), labTa, true); BindOperationsList(lv3, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(2), labTo, true); BindOperationsList(lv5, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(-7), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), labWeek, true, true); //}); //Task.Factory.StartNew(() => //{ BindOperationsListChart(); SetBackColor(expandablePanel5.Controls.Find("button" + DateTime.Now.Month, false)[0] as Button); BindOperationsListChart2(DateTime.Now.Month.ToString()); BindfrmNoticeMain(); //}); } public void BindOperationsList(DevComponents.DotNetBar.Controls.DataGridViewX lvex, DateTime beginTime, DateTime endTime, DevComponents.DotNetBar.LabelX labCount, bool isLoginPerson, bool isEnOpe = false) { lvex.Rows.Clear(); DataTable dt = SelectPatient.GetSelectPatientDataTable (beginTime, endTime, isLoginPerson, AIMSExtension.PublicMethod.OperatorName, isEnOpe); if (dt.Rows.Count == 0) labCount.Visible = false; else labCount.Visible = true; labCount.Text = dt.Rows.Count.ToString() + "台"; for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; string patient = dr["OperationRoom"].ToString() + (dr["PlanOrder"].ToString() == "" ? "" : ("-" + dr["PlanOrder"].ToString() + " ")) + dr["MdrecNo"].ToString() + " " + dr["PatientName"].ToString(); if (isEnOpe == true) patient = dr["InRoomTime"].ToString() + " " + patient; string AnesthesiaDoctor = dr["AnesthesiaDoctor"].ToString() == "" ? "" : (" 麻醉:" + dr["AnesthesiaDoctor"].ToString()); string Nurse = (dr["InstrumentNurse"].ToString() == "" & dr["TourNurse"].ToString() == "") ? "" : (" 护士:" + dr["InstrumentNurse"].ToString() + " " + dr["TourNurse"].ToString()); string message = patient + AnesthesiaDoctor + Nurse; //if (AIMSExtension.PublicMethod.RoleId == 7 || AIMSExtension.PublicMethod.RoleId == 10) //{ // message = patient + AnesthesiaDoctor + Nurse; //} //else if (AIMSExtension.PublicMethod.RoleId == 6 || AIMSExtension.PublicMethod.RoleId == 8) //{ // message = patient + Nurse; //} DataGridViewRow drc = new DataGridViewRow(); drc.CreateCells(lvex); drc.Cells[0].Value = dr["ApplyId"].ToString(); drc.Cells[1].Value = dr["PatientId"].ToString(); drc.Cells[2].Value = message; drc.Cells[3].Value = dr["State"].ToString(); lvex.Rows.Insert(i, drc); lvex.ClearSelection(); } } public void BindOperationsListChart() { try { DataTable dt = SelectPatient.GetSelectPatientChart(); List xData = new List(); List yData = new List(); foreach (DataRow item in dt.Rows) { xData.Add(item["dat"].ToString()); yData.Add((int)(double.Parse(item["DiffDate"].ToString()))); } chart1.Series[0].Points.DataBindXY(xData, yData); } catch (Exception) { } } public void BindOperationsListChart2(string Months) { DateTime dateTime = new DateTime(DateTime.Now.Year, int.Parse(Months), 1); DataTable dt = SelectPatient.GetSelectPatientChart2(dateTime); List xData = new List(); List yData = new List(); foreach (DataRow item in dt.Rows) { xData.Add(item["dat"].ToString()); yData.Add(int.Parse(item["con"].ToString())); } chart2.Series[0]["PieLabelStyle"] = "Outside";//将文字移到外侧 chart2.Series[0]["PieLineColor"] = "Black";//绘制黑色的连线。 chart2.Series[0].Points.DataBindXY(xData, yData); } public DevComponents.DotNetBar.Controls.SideNavItem selsideNavItem = null; private void sideNav1_SelectedItemChanged(object sender, EventArgs e) { if (selsideNavItem != null) selsideNavItem.Text = selsideNavItem.Text.Replace(" →", ""); DevComponents.DotNetBar.Controls.SideNavItem sideNavItem = sideNav1.SelectedItem; if (sideNavItem.Tag == null) return; selsideNavItem = sideNavItem; sideNavItem.Text = sideNavItem.Text + " →"; AIMSModel.Menu menu = sideNavItem.Tag as AIMSModel.Menu; if (menu.Name == "大屏公告") { BrowserHelper.OpenBrowserUrlChrome(menu.Path); } else if (menu.Name == "报表统计") { DialogResult dialog = MessageBox.Show("是否打开网页版报表?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.Yes) BrowserHelper.OpenBrowserUrlChrome(menu.Path); menu.Path = "AIMS.frmReportExport"; } if (menu.Path.Contains("AIMS.")) { string path = menu.Path; if (path.Length > 0) { try { Form frm = GetForm(path); if (menu.IsAloneOpen == 1) sideNav1.IsMenuExpanded = false; frm.TopLevel = false; frm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; frm.WindowState = FormWindowState.Maximized; sideNavItem.Panel.Controls.Clear(); sideNavItem.Panel.Controls.Add(frm); frm.Show(); frm.BringToFront(); } catch (Exception) { if (path.Contains("MainFormManage")) { MainFormManage frm = new MainFormManage(); frm.Show(); frm.BringToFront(); } } } } } public Form GetForm(string Path) { object result = null; Type type = Type.GetType(Path); result = (Form)Activator.CreateInstance(type); return (Form)result; } private void btnExit_Click(object sender, EventArgs e) { AIMS.PublicUI.UI.frmEditPassWord frmEditPassWord = new PublicUI.UI.frmEditPassWord(); //frmEditPassWord.FormClosing += (s, er) => { btnOk_Click(null, null); }; frmEditPassWord.ShowDialog(); } private void btnOk_Click(object sender, EventArgs e) { foreach (Form frm in Application.OpenForms) { if (frm.Name != "FormLogin" && frm.Name != this.Name) { frm.Close(); break; } } foreach (Form frm in Application.OpenForms) { if (frm.Name == "FormLogin") { frm.Show(); isClose = true; this.Close(); break; } } } bool isClose = false; private void FormMainManage_FormClosing(object sender, FormClosingEventArgs e) { if (isClose == false) { if (MessageBox.Show(this, "确定要退出当前系统?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { GC.Collect(); GC.WaitForPendingFinalizers(); this.Dispose(); Environment.Exit(0); } e.Cancel = true; } } private void buttonX1_Click(object sender, EventArgs e) { AIMS.PublicUI.UI.frmAbout frmEditPassWord = new PublicUI.UI.frmAbout(); frmEditPassWord.ShowDialog(); } private void buttonX2_Click(object sender, EventArgs e) { AIMS.PublicUI.UI.frmNoticeMain main = new PublicUI.UI.frmNoticeMain(); main.FormClosing += (s, er) => { BindfrmNoticeMain(); }; main.ShowDialog(); } public void BindfrmNoticeMain() { List NoticeList = BNotice.HistoryNoticeData(); System.Windows.Forms.ListViewItem[] lists = new System.Windows.Forms.ListViewItem[NoticeList.Count]; lv7.Items.Clear(); for (int i = 0; i < NoticeList.Count; i++) { lists[i] = new System.Windows.Forms.ListViewItem(new string[] { NoticeList[i].Id.ToString(), NoticeList[i].Contents, NoticeList[i].OperateDate.Value.ToString("yyyy-MM-dd") }, i); } lv7.Items.AddRange(lists); } private void buttonX3_Click(object sender, EventArgs e) { AIMS.OperationFront.UI.frmOperationApplyDetail frmOperationApplyDetail = new AIMS.OperationFront.UI.frmOperationApplyDetail(); frmOperationApplyDetail.State = AIMSExtension.EditState.ADD; frmOperationApplyDetail.FormClosed += (ee, err) => { BindOperationsList(lv1, DateTime.Now, DateTime.Now.AddDays(1), labTa, true); }; frmOperationApplyDetail.ShowDialog(); } private void superTabControl1_SelectedTabChanged(object sender, SuperTabStripSelectedTabChangedEventArgs e) { if (superTabControl1.SelectedTab.Name == "P1") { BindOperationsList(lv1, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), labTa, true); } if (superTabControl1.SelectedTab.Name == "P2") { BindOperationsList(lv2, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), labTa, false); } } private void superTabControl2_SelectedTabChanged(object sender, SuperTabStripSelectedTabChangedEventArgs e) { if (superTabControl2.SelectedTab.Name == "P3") { BindOperationsList(lv3, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(2), labTo, true); } if (superTabControl2.SelectedTab.Name == "P4") { BindOperationsList(lv4, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(2), labTo, false); } } private void superTabControl3_SelectedTabChanged(object sender, SuperTabStripSelectedTabChangedEventArgs e) { if (superTabControl3.SelectedTab.Name == "P5") { BindOperationsList(lv5, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(-7), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), labWeek, true, true); } if (superTabControl3.SelectedTab.Name == "P6") { BindOperationsList(lv6, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(-7), DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(1), labWeek, false, true); } } private void lv2_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { DataGridView dataGridView = sender as DataGridView; int SelApplyId = int.Parse(dataGridView.CurrentRow.Cells[0].Value.ToString()); int SelPatientId = int.Parse(dataGridView.CurrentRow.Cells[1].Value.ToString()); if (SelPatientId == 0) { return; } PatientRecord patient = PatientRecord.GetPatientRecord(SelPatientId); frmDocument frmDocument = new frmDocument(patient); frmDocument.StartPosition = FormStartPosition.CenterScreen; frmDocument.WindowState = FormWindowState.Maximized; frmDocument.ShowDialog(); } private void lv5_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { DataGridView dataGridView = sender as DataGridView; int SelApplyId = int.Parse(dataGridView.CurrentRow.Cells[0].Value.ToString()); if (SelApplyId != 0) { OperationApply apply = BOperationApply.GetModel(SelApplyId); frmAanesthesiaRecord frmAnasRecord = new frmAanesthesiaRecord(); frmAnasRecord.PatientId = apply.OrisPatientId.Value; frmAnasRecord.ApplyId = apply.Id.Value; frmAnasRecord.State = AIMSExtension.EditState.BROWSE; frmAnasRecord.Show(); } } public void SetGridAlternatingRows(DataGridView dg) { if (dg != null) { dg.RowsDefaultCellStyle.BackColor = Color.FromArgb(255, 255, 255); dg.AlternatingRowsDefaultCellStyle.BackColor = Color.AliceBlue; } } private void button1_Click(object sender, EventArgs e) { SetBackColor(sender as Button); BindOperationsListChart2((sender as Button).Text.Replace("月", "")); } public void SetBackColor(Button btn) { btn.BackColor = Color.DeepSkyBlue; foreach (var item in btn.Parent.Controls) { if (item != btn) if (item is Button) { (item as Button).BackColor = Color.White; } } } //static void PreLoad() //{ // string msg = DCSoft.Writer.Controls.WriterControl.CheckSystemEnvironment(false); // if (msg != null) // { // MessageBox.Show(null, msg, "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Error); // return; // } // // 预先初始化一些数据 // DCSoft.Writer.WriterAppHost.PreloadSystem(); // DCSoft.Writer.Controls.WriterControl.StaticSetRegisterCode(AIMSExtension.PublicMethod.Decrypt(AIMSControls.Properties.Resources.C)); //} } }