/// <summary> /// 实例化多例文书 /// </summary> /// <param name="ds"></param> private Class_Follow_Doc[] GetClassDoc(DataSet ds) { if (ds != null) { if (ds.Tables[0].Rows.Count != 0) { Class_Follow_Doc[] docs = new Class_Follow_Doc[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { docs[i] = new Class_Follow_Doc(); docs[i].Id = ds.Tables[0].Rows[i]["id"].ToString(); docs[i].Record_id = ds.Tables[0].Rows[i]["Record_id"].ToString(); docs[i].Doc_name = ds.Tables[0].Rows[i]["Doc_name"].ToString(); docs[i].Text_type = ds.Tables[0].Rows[i]["Text_type"].ToString(); docs[i].Doc_content = ds.Tables[0].Rows[i]["Doc_content"].ToString(); docs[i].Issimpleinstance = ds.Tables[0].Rows[i]["Issimpleinstance"].ToString(); docs[i].Text_name = ds.Tables[0].Rows[i]["Text_name"].ToString(); docs[i].Creator_id = ds.Tables[0].Rows[i]["Creator_id"].ToString(); docs[i].Doc_content = ds.Tables[0].Rows[i]["Doc_content"].ToString(); } return(docs); } else { return(null); } } else { return(null); } }
//} /// <summary> /// 双击已完成文书树 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void advFinishDoc_DoubleClick(object sender, EventArgs e) { if (SelectedNode.Name != null) { if (SelectedNode != null) { if (SelectedNode.Name == "100") { if (!ExistTab(SelectedNode.Text)) { CreateCustomPage(SelectedNode); } else { for (int i = 0; i < tctlDoc.Tabs.Count; i++) { if (SelectedNode.Text == tctlDoc.Tabs[i].Text) { tctlDoc.SelectedTabIndex = i; break; } } } trvRelatedDoc.Nodes.Clear(); } else { //排除多例的头节点 if (SelectedNode.Tag != null) { if (SelectedNode.Tag.ToString().Contains("Class_Follow_Doc")) { Class_Follow_Doc Doc = SelectedNode.Tag as Class_Follow_Doc; if (!ExistTab(SelectedNode.Parent.Text + ":" + Doc.Doc_name)) { CreateTab(true); IniRelatedDoc(Doc.Text_type, ""); } else { for (int i = 0; i < tctlDoc.Tabs.Count; i++) { if (SelectedNode.Text + ":" + Doc.Doc_name == tctlDoc.Tabs[i].Text) { tctlDoc.SelectedTabIndex = i; break; } } } } else { if (!ExistTab(SelectedNode.Text)) { CreateTab(true); IniRelatedDoc(SelectedNode.Name, ""); } else { for (int i = 0; i < tctlDoc.Tabs.Count; i++) { if (SelectedNode.Text == tctlDoc.Tabs[i].Text) { tctlDoc.SelectedTabIndex = i; break; } } } } } else { CreateTab(false); IniRelatedDoc(SelectedNode.Name, ""); } } } } }
/// <summary> /// 添加选项卡 /// </summary> /// <param name="name"></param> /// <param name="Finish"></param> public void CreateTab(bool Finish) { DevComponents.DotNetBar.TabControlPanel DocPnl = new TabControlPanel(); DocPnl.AutoScroll = true; DevComponents.DotNetBar.TabItem DocItem = new TabItem(); DocItem.Click += new EventHandler(Item_Click); DocItem.AttachedControl = DocPnl; string DocContent = ""; //初始化Item及Panel,根据是否是已完成文书->是否是单例文书分类 if (Finish) { //点击AllDoc,或者FinishedDoc if (SelectedNode.Tag.ToString().Contains("Class_Follow_Text")) { Class_Follow_Text Text = SelectedNode.Tag as Class_Follow_Text; string creator = App.ReadSqlVal("select creator_id from T_FOLLOW_RECORD_DOC where text_type=" + Text.Id + " and record_id=" + myRecord.Id + "", 0, "creator_id"); if (creator != App.UserAccount.UserInfo.User_id) { App.Msg("无权对该文书进行修改,只可浏览"); btnSave.Enabled = false; btnCancel.Enabled = false; } else { btnSave.Enabled = true; btnCancel.Enabled = true; } DocItem.Name = Text.Id + ":Finish:" + SelectedNode.ToString(); DocItem.Text = Text.Textname; DocContent = App.ReadSqlVal("select doc_content from T_FOLLOW_RECORD_DOC where text_type=" + Text.Id + " and record_id=" + myRecord.Id + "", 0, "doc_content"); } if (SelectedNode.Tag.ToString().Contains("Class_Follow_Doc")) { Class_Follow_Doc Doc = SelectedNode.Tag as Class_Follow_Doc; if (Doc.Creator_id != App.UserAccount.UserInfo.User_id) { App.Msg("无权对该文书进行修改,只可浏览"); btnSave.Enabled = false; btnCancel.Enabled = false; } else { btnSave.Enabled = true; btnCancel.Enabled = true; } DocItem.Name = Doc.Text_type + ":Finish:" + SelectedNode.ToString(); DocItem.Text = Doc.Text_name + ":" + Doc.Doc_name; DocContent = App.ReadSqlVal("select doc_content from T_FOLLOW_RECORD_DOC where text_type=" + Doc.Text_type + " and doc_name='" + Doc.Doc_name + "' and record_id=" + myRecord.Id + "", 0, "doc_content"); } } else { // string TimeStamp = App.GetSystemTime().ToString(); if (SelectedNode.Tag != null) { Class_Follow_Text Text = SelectedNode.Tag as Class_Follow_Text; //新增单例文书 if (Text.Issimpleinstance != "1") { DocItem.Name = Text.Id + ":New:" + SelectedNode.ToString(); DocItem.Text = Text.Textname; } //AllDoc上新增多例文书 else { DocItem.Name = SelectedNode.Name + ":New:" + SelectedNode.ToString(); DocItem.Text = SelectedNode.Text + ":" + TimeStamp; } } //FinishDoc上新增多例文书 else { DocItem.Name = SelectedNode.Name + ":New:" + SelectedNode.ToString(); DocItem.Text = SelectedNode.Text + ":" + TimeStamp; } DocContent = App.ReadSqlVal("select content from T_FOLLOW_TEMPPLATE_CONT where tid in (select tid from T_FOLLOW_TEMPPLATE t join T_FOLLOW_TEMPPLATE_SECTION s on t.tid=s.template_id where s.isdefault='Y' and t.text_type=" + SelectedNode.Name + ")", 0, "Content"); } if (DocContent == null) { DocContent = ""; } frmText text = new frmText(); //0, 0, 0, name, 0, currentPatient, true, true, "", ""); text.MyDoc.HaveTubebedSign = "N"; //管床医生是否审签 text.MyDoc.HaveSuperiorSignature = "N"; //是否已经有过上级医生签名 text.MyDoc.IgnoreLine = false; text.MyDoc.SetToolEvent(); XmlDocument tmpxml = new System.Xml.XmlDocument(); tmpxml.PreserveWhitespace = true; //没有模板的时候,传空的进来 if (DocContent.Contains("emrtextdoc")) { tmpxml.LoadXml(DocContent); } else { tmpxml.LoadXml("<emrtextdoc/>"); text.MyDoc.ClearContent(); text.MyDoc.ToXML(tmpxml.DocumentElement); } text.MyDoc.FromXML(tmpxml.DocumentElement); text.MyDoc.ContentChanged(); text.Dock = DockStyle.Fill; DocPnl.Controls.Add(text); DocPnl.TabItem = DocItem; DocPnl.Dock = DockStyle.Fill; this.tctlDoc.Controls.Add(DocPnl); this.tctlDoc.Tabs.Add(DocItem); this.tctlDoc.Refresh(); this.tctlDoc.SelectedTab = DocItem; }