using AIMS.OremrUserControl; using AIMSExtension; using AIMSModel; using DevComponents.DotNetBar; using DocumentManagement; using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; using System.Windows.Forms; namespace AIMS.DocManager { public partial class frmDocument : Form { //文档目录 private ucClassify ucClassify; //患者基本信息 private PatientRecord Patient; public frmDocument() { InitializeComponent(); //基本信息初始化 Patient = new PatientRecord(); } public frmDocument(PatientRecord p) { InitializeComponent(); Patient = p; StringBuilder sb = new StringBuilder(); string t = " "; sb.Append("患者:" + Patient.PatientName + t); sb.Append("住院号:" + Patient.MdrecNo + t); sb.Append("性别:" + Patient.Sex + t); sb.Append("手术名称:" + Patient.OperationInfoName + t); sb.Append("状态:" + Patient.State + t); this.lblPatient.Text = sb.ToString(); } void tsbDoc_TabItemClose(object sender, TabStripActionEventArgs e) { TabItem tb = (sender as DevComponents.DotNetBar.TabControl).SelectedTab; ucDocument doc = tb.AttachedControl.Controls[0] as ucDocument; doc.CloseMsg(tb.Text, ref e.Cancel); } /// /// 文档目录点击事件 /// /// /// void tv_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == MouseButtons.Left) { TreeNode node = e.Node; //父节点不操作 if (node.Parent == null) { foreach (TreeNode item in node.Nodes) { item.Checked = node.Checked; } return; } if (this.Patient.PatientId > 0) { //判断是否已经打开文书 foreach (var item in tsbDoc.Tabs) { if ((item as TabItem).Text.Replace("*", "").Equals(node.Text)) { tsbDoc.SelectedTab = item as TabItem; return; } } //创建该文书标签 TabItem tb = this.tsbDoc.CreateTab(node.Text); tsbDoc.SelectedTab = tb; Control c = tb.AttachedControl; ucDocument doc = new ucDocument(int.Parse(node.Name), int.Parse(node.Tag.ToString()), Patient); doc.RefreshUc += new ucDocument.RefreshUcClassify(ucClassify.RefreshTree); doc.ModifyT += new ucDocument.ModifyTitle(ModifyTitle); doc.ClearT += new ucDocument.ClearTitle(ClearTitle); doc.CloseP += new ucDocument.CloseParent(CloseTab); doc.Parent = c; doc.Dock = DockStyle.Fill; doc.Show(); } } } /// /// 关闭标签 /// private void CloseTab() { ucDocument doc = tsbDoc.SelectedTab.AttachedControl.Controls[0] as ucDocument; bool isCancel = false; doc.CloseMsg(tsbDoc.SelectedTab.Text, ref isCancel); if (!isCancel) { tsbDoc.Tabs.Remove(tsbDoc.SelectedTab); } } /// /// 添加标题*号 /// private void ModifyTitle() { if (!tsbDoc.SelectedTab.Text.EndsWith("*")) { tsbDoc.SelectedTab.Text += "*"; } } /// /// 清除标题*号 /// private void ClearTitle() { tsbDoc.SelectedTab.Text = tsbDoc.SelectedTab.Text.Replace("*", ""); } private void btnSel_Click(object sender, EventArgs e) { string showtext = ""; //判断是否已经打开文书 foreach (var item in tsbDoc.Tabs) { if ((item as TabItem).Text.Contains("*")) { tsbDoc.SelectedTab = item as TabItem; showtext += (item as TabItem).Text + " "; } } if (showtext != "") { MessageBox.Show(showtext + "未保存 请确认保存后批量打印!", "系统提示"); return; } tsbDoc.Tabs.Clear(); List Ids = new List(); for (int i = 0; i < ucClassify.tv.Nodes.Count; i++) { TreeNode item = ucClassify.tv.Nodes[i]; if (item != null && item.Parent == null) { foreach (TreeNode node in item.Nodes) { if (node.Tag != null && int.Parse(node.Tag.ToString()) > 0 && this.Patient.PatientId > 0 && node.Checked == true) { Ids.Add(int.Parse(node.Tag.ToString())); } } } } for (int i = 0; i < ucClassify.tv.Nodes.Count; i++) { TreeNode item = ucClassify.tv.Nodes[i]; if (item != null) { foreach (TreeNode node in item.Nodes) { if (Ids.Contains(int.Parse(node.Tag.ToString()))) { //创建该文书标签 TabItem tb = this.tsbDoc.CreateTab(node.Text); tsbDoc.SelectedTab = tb; Control c = tb.AttachedControl; ucDocument doc = new ucDocument(int.Parse(node.Name), int.Parse(node.Tag.ToString()), Patient); doc.RefreshUc += new ucDocument.RefreshUcClassify(ucClassify.RefreshTree); doc.ModifyT += new ucDocument.ModifyTitle(ModifyTitle); doc.ClearT += new ucDocument.ClearTitle(ClearTitle); doc.CloseP += new ucDocument.CloseParent(CloseTab); doc.Parent = c; doc.Dock = DockStyle.Fill; doc.Show(); doc.tsbSaveAndPrint_Click(null, null); } } } } } private void frmDocument2_Load(object sender, EventArgs e) { if (PublicMethod.OperatorNo == "admin" || PublicMethod.RoleName.Contains("数据中心")) { buttonX1.Visible = true; } //ucClassify初始化 ucClassify = new DocumentManagement.ucClassify(); this.expandablePanel1.Controls.Add(ucClassify); ucClassify.IsReadOnly = true; ucClassify.Dock = DockStyle.Fill; ucClassify.tv.NodeMouseClick += new TreeNodeMouseClickEventHandler(tv_NodeMouseClick); ucClassify.RefreshTree(Patient.PatientId); tsbDoc.TabItemClose += new TabStrip.UserActionEventHandler(tsbDoc_TabItemClose); } private void buttonX1_Click(object sender, EventArgs e) { EMRExtension.OpenEMRS(Patient.PatientId, Patient.ApplyId); } } }