/// <summary> /// 实例Class_Text化查询结果 /// </summary> /// <param Name="tempds"></param> /// <returns></returns> private static Class_Text[] GetSelectClassDs(DataSet tempds) { if (tempds != null) { if (tempds.Tables[0].Rows.Count > 0) { Class_Text[] class_text = new Class_Text[tempds.Tables[0].Rows.Count]; for (int i = 0; i < tempds.Tables[0].Rows.Count; i++) { class_text[i] = new Class_Text(); class_text[i].Id = Convert.ToInt32(tempds.Tables[0].Rows[i]["ID"].ToString()); if (tempds.Tables[0].Rows[i]["PARENTID"].ToString() != "0") { class_text[i].Parentid = Convert.ToInt32(tempds.Tables[0].Rows[i]["PARENTID"].ToString()); } class_text[i].Textcode = tempds.Tables[0].Rows[i]["TEXTCODE"].ToString();; class_text[i].Textname = tempds.Tables[0].Rows[i]["TEXTNAME"].ToString(); class_text[i].Isenable = tempds.Tables[0].Rows[i]["ISENABLE"].ToString(); class_text[i].Txxttype = tempds.Tables[0].Rows[i]["ISBELONGTOTYPE"].ToString(); } return(class_text); } else { return(null); } } else { return(null); } }
private void trvDictionary_MouseDoubleClick(object sender, MouseEventArgs e) { if (trvDictionary.SelectedNode != null) { if (trvDictionary.SelectedNode.Tag.GetType().ToString().Contains("Class_Text")) { selectClasstext = (Class_Text)trvDictionary.SelectedNode.Tag; bool flag = false; //当前节点不是本身或有关子节点 flag = isChild(SelectId, trvDictionary.SelectedNode); if (!flag) { ucWrite_Type.fahterId = selectClasstext.Id.ToString(); ucWrite_Type.fahterName = selectClasstext.Textname; ucWrite_Type.texttype = selectClasstext.Txxttype; this.Close(); } else { App.Msg("你选择的节点是本身或者界别更低的节点!"); } } } }
private void trvDoctorBook_DoubleClick(object sender, EventArgs e) { XmlDocument tempXml = new XmlDocument(); string xml = null; if (trvDoctorBook.SelectedNode == null) { return; } if (trvDoctorBook.SelectedNode.Tag.GetType().ToString().Contains("Class_Text")) { Class_Text text = this.trvDoctorBook.SelectedNode.Tag as Class_Text; if (text.Issimpleinstance == "1") //多例 { StringBuilder strBuilder = new StringBuilder(); int i = 1; foreach (Node node in trvDoctorBook.SelectedNode.Nodes) { Patient_Doc pDoc = node.Tag as Patient_Doc; xml = GetSelectNodes(pDoc); if (xml != null) { tempXml.LoadXml(xml); XmlNode xmlNode = tempXml.GetElementsByTagName("text")[0]; strBuilder.Append(text.Textname + ":子文书" + i.ToString() + "\r\n" + xmlNode.InnerText + "\r\n"); i++; } } txtContent.Text = strBuilder.ToString(); } else { xml = GetSelectNodes(text); if (xml != null) { tempXml.LoadXml(xml); XmlNode xmlNode = tempXml.GetElementsByTagName("text")[0]; txtContent.Text = xmlNode.InnerText; } } } else if (trvDoctorBook.SelectedNode.Tag.GetType().ToString().Contains("Patient_Doc")) { Patient_Doc pDoc = this.trvDoctorBook.SelectedNode.Tag as Patient_Doc; xml = GetSelectNodes(pDoc); if (xml != null) { tempXml.LoadXml(xml); XmlNode xmlNode = tempXml.GetElementsByTagName("text")[0]; txtContent.Text = xmlNode.InnerText; } } }
/// <summary> /// 对文书进行分类设置 /// </summary> /// <param Name="Directionarys">所有文书节点集合</param> /// <param Name="current">当前文书节点</param> private void SetTreeView(Class_Text[] Directionarys, TreeNode current) { for (int i = 0; i < Directionarys.Length; i++) { Class_Text cunrrentDir = (Class_Text)current.Tag; if (Directionarys[i].Parentid == cunrrentDir.Id) { TreeNode tn = new TreeNode(); tn.Tag = Directionarys[i]; tn.Text = Directionarys[i].Textname; current.Nodes.Add(tn); SetTreeView(Directionarys, tn); } } }
/// <summary> /// 实例Class_Text化查询结果 /// </summary> /// <param Name="tempds"></param> /// <returns></returns> private static Class_Text[] GetSelectClassDs(DataSet tempds) { string bbtextlist = "6980234,6980235,6980236,6980237,6980238";//新生儿相关文书ID if (tempds != null) { if (tempds.Tables[0].Rows.Count > 0) { Class_Text[] class_text = new Class_Text[tempds.Tables[0].Rows.Count]; for (int i = 0; i < tempds.Tables[0].Rows.Count; i++) { class_text[i] = new Class_Text(); class_text[i].Id = Convert.ToInt32(tempds.Tables[0].Rows[i]["ID"].ToString()); if (tempds.Tables[0].Rows[i]["PARENTID"].ToString() != "0") { if (bbtextlist.Contains(tempds.Tables[0].Rows[i]["PARENTID"].ToString())) { continue; } class_text[i].Parentid = Convert.ToInt32(tempds.Tables[0].Rows[i]["PARENTID"].ToString()); } class_text[i].Sid = tempds.Tables[0].Rows[i]["sid"].ToString(); class_text[i].Textcode = tempds.Tables[0].Rows[i]["TEXTCODE"].ToString();; class_text[i].Textname = tempds.Tables[0].Rows[i]["TEXTNAME"].ToString(); class_text[i].Isenable = tempds.Tables[0].Rows[i]["ISENABLE"].ToString(); class_text[i].Txxttype = tempds.Tables[0].Rows[i]["ISBELONGTOTYPE"].ToString(); class_text[i].Issimpleinstance = tempds.Tables[0].Rows[i]["issimpleinstance"].ToString(); class_text[i].Ishighersign = tempds.Tables[0].Rows[i]["ishighersign"].ToString(); class_text[i].Right_range = tempds.Tables[0].Rows[i]["right_range"].ToString(); class_text[i].Ishavetime = tempds.Tables[0].Rows[i]["ishavetime"].ToString(); class_text[i].Formname = tempds.Tables[0].Rows[i]["formname"].ToString(); class_text[i].Other_textname = tempds.Tables[0].Rows[i]["OTHER_TEXTNAME"].ToString(); class_text[i].Isneedsign = tempds.Tables[0].Rows[i]["ISNEEDSIGN"].ToString(); class_text[i].IsProblemName = tempds.Tables[0].Rows[i]["ISPROBLEM_NAME"].ToString(); class_text[i].IsProblemTime = tempds.Tables[0].Rows[i]["ISPROBLEM_TIME"].ToString(); } return(class_text); } else { return(null); } } else { return(null); } }
/// <summary> /// 对文书进行分类设置 /// </summary> /// <param Name="Directionarys">所有文书节点集合</param> /// <param Name="currentnode">当前文书节点</param> private static void SetTreeView(Class_Text[] Directionarys, TreeNode current) { for (int i = 0; i < Directionarys.Length; i++) { Class_Text cunrrentDir = (Class_Text)current.Tag; if (Directionarys[i].Parentid == cunrrentDir.Id) { TreeNode tn = new TreeNode(); tn.Tag = Directionarys[i]; tn.Text = Directionarys[i].Textname; tn.Name = Directionarys[i].Id.ToString(); tn.ImageIndex = 9; tn.SelectedImageIndex = 9; current.Nodes.Add(tn); SetTreeView(Directionarys, tn); } } }
/// <summary> /// 判断是否是选择的本身或子节点 /// </summary> /// <param name="selectid">当前修改父节点的节点</param> /// <returns></returns> private bool isChild(string selectid, TreeNode node) { if (node.Tag != null) { Class_Text temp = (Class_Text)node.Tag; if (temp.Id.ToString() == selectid) { return(true); } else { if (node.Parent != null) { return(isChild(selectid, node.Parent)); } } } return(false); }
/// <summary> /// 设置文书节点 /// </summary> private void SetNode() { //查出当前病人所有知情同意书类型 string sql_text = "select * from t_text where id in" + "(select textkind_id from t_patients_doc where textkind_id in(select id from t_text where isbelongtotype=915) and patient_id=" + currentPatient.Id + ")"; DataSet ds_text = App.GetDataSet(sql_text); if (ds_text != null) { for (int i = 0; i < ds_text.Tables[0].Rows.Count; i++) { Node nodeText = new Node(); nodeText.Text = ds_text.Tables[0].Rows[i]["textname"].ToString(); nodeText.Name = ds_text.Tables[0].Rows[i]["id"].ToString(); Class_Text text = new Class_Text(); text.Id = Convert.ToInt32(ds_text.Tables[0].Rows[i]["ID"].ToString()); if (ds_text.Tables[0].Rows[i]["PARENTID"].ToString() != "0") { text.Parentid = Convert.ToInt32(ds_text.Tables[0].Rows[i]["PARENTID"].ToString()); } text.Sid = ds_text.Tables[0].Rows[i]["sid"].ToString(); text.Textcode = ds_text.Tables[0].Rows[i]["TEXTCODE"].ToString();; text.Textname = ds_text.Tables[0].Rows[i]["TEXTNAME"].ToString(); text.Isenable = ds_text.Tables[0].Rows[i]["ISENABLE"].ToString(); text.Txxttype = ds_text.Tables[0].Rows[i]["ISBELONGTOTYPE"].ToString(); text.Issimpleinstance = ds_text.Tables[0].Rows[i]["issimpleinstance"].ToString(); text.Ishighersign = ds_text.Tables[0].Rows[i]["ishighersign"].ToString(); text.Right_range = ds_text.Tables[0].Rows[i]["right_range"].ToString(); text.Ishavetime = ds_text.Tables[0].Rows[i]["ishavetime"].ToString(); text.Formname = ds_text.Tables[0].Rows[i]["formname"].ToString(); nodeText.Tag = text; nodeText.CheckBoxVisible = true; nodeText.NodeClick += new EventHandler(CheckedSonNode); nodeText.NodeDoubleClick += new EventHandler(CheckedSonNode); nodeAllChecked.Nodes.Add(nodeText); } } }
public void GetPatientDoc(NodeCollection nodes, Node node) { Patient_Doc doc = node.Tag as Patient_Doc; foreach (Node TempNode in nodes) { Class_Text text = TempNode.Tag as Class_Text; if (text != null) { if (text.Issimpleinstance == "1") //多例文书 { if (doc.Textkind_id == text.Id) { TempNode.Nodes.Add(node.DeepCopy()); //TempNode.SelectedImageIndex = 6; //TempNode.ImageIndex = 6; break; } } else { if (TempNode.Nodes.Count == 0) { if (doc.Textkind_id == text.Id) { //TempNode.SelectedImageIndex = 7; TempNode.ImageIndex = 7; break; } } } } if (TempNode.Nodes.Count > 0) { GetPatientDoc(TempNode.Nodes, node); } } }
/// <summary> /// 获得当前节点下面所有病人文书的节点 /// </summary> /// <param name="nodes">当前节点下的所有文书内容</param> /// <returns>返回Patient_Doc集合</returns> private string GetSelectNodes(Class_Text text) { string sql = "select tid from t_patients_doc where patient_id='" + patient_Id + "' and textkind_id=" + text.Id + ""; DataSet ds = App.GetDataSet(sql); string arrs = null; if (ds != null) { DataTable dt = ds.Tables[0]; if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { string content = App.DownLoadFtpPatientDoc(dt.Rows[i]["tid"].ToString() + ".xml", patient_Id.ToString()); if (content == "") { content = App.ReadSqlVal("select * from T_PATIENT_DOC_COLB where tid=" + dt.Rows[i]["tid"].ToString() + "", 0, "CONTENT"); } arrs += content; } } } return(arrs); }
private void advTree1_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e) { txtContent.Text = ""; if (trvDoctorBook.SelectedNode.Parent != null) { XmlDocument tempXml = new XmlDocument(); if (trvDoctorBook.SelectedNode.Tag.GetType().ToString().Contains("Class_Text")) { Class_Text text = this.trvDoctorBook.SelectedNode.Tag as Class_Text; if (text.Issimpleinstance == "1") //多例 { StringBuilder strBuilder = new StringBuilder(); int i = 1; foreach (Node node in trvDoctorBook.SelectedNode.Nodes) { Patient_Doc pDoc = node.Tag as Patient_Doc; string xml = GetSelectNodes(pDoc); if (xml != null && xml != string.Empty) { tempXml.LoadXml(xml); StringBuilder builder = new StringBuilder(); XmlNodeList xmlNodes = tempXml.SelectNodes("emrtextdoc/body/span"); tempXml.GetElementsByTagName("span"); foreach (XmlNode childNode in xmlNodes) { builder.Append(childNode.InnerText); } strBuilder.Append(text.Textname + ":子文书" + i.ToString() + "\r\n" + builder.ToString() + "\r\n"); i++; } } txtContent.Text = strBuilder.ToString(); } else { string xml = GetSelectNodes(text); if (xml != null && xml != string.Empty) { tempXml.LoadXml(xml); XmlNodeList xmlNodes = tempXml.SelectNodes("emrtextdoc/text"); //body/span foreach (XmlNode node in xmlNodes) { txtContent.Text += node.InnerText + "\r\n"; } } } } else if (trvDoctorBook.SelectedNode.Tag.GetType().ToString().Contains("Patient_Doc")) { Patient_Doc pDoc = this.trvDoctorBook.SelectedNode.Tag as Patient_Doc; string xml = GetSelectNodes(pDoc); if (xml != null && xml != string.Empty) { tempXml.LoadXml(xml); XmlNodeList xmlNodes = tempXml.SelectNodes("emrtextdoc/body/span"); foreach (XmlNode node in xmlNodes) { txtContent.Text += node.InnerText; } } } } }
/// <summary> /// 获得当前选中节点下面所有病人文书的节点 /// </summary> /// <param name="nodes">当前节点下的所有文书内容</param> /// <returns>返回Patient_Doc集合</returns> private Patient_Doc[] GetSelectNodes() { string allTextId = ""; //if (nodeAllChecked.Checked) //{ for (int i = 0; i < nodeAllChecked.Nodes.Count; i++) { Class_Text text = nodeAllChecked.Nodes[i].Tag as Class_Text; if (text != null) { if (text.Issimpleinstance == "1")//多例文书循环子节点获取文书ID { for (int j = 0; j < nodeAllChecked.Nodes[i].Nodes.Count; j++) { if (nodeAllChecked.Nodes[i].Nodes[j].Checked)//节点被选中,获取tid拼接字符串 { Patient_Doc pat_doc = nodeAllChecked.Nodes[i].Nodes[j].Tag as Patient_Doc; if (pat_doc != null) { if (allTextId == "") { allTextId = pat_doc.Id.ToString(); } else { allTextId += "," + pat_doc.Id; } } } } } else //单例文书 { if (nodeAllChecked.Nodes[i].Checked) { string docId = isExitRecord(text.Id, currentPatient.Id); if (allTextId == "") { allTextId = docId; } else { allTextId += "," + docId; } } } } } if (allTextId != "") { Patient_Doc[] patient_Docs = null; if (currentPatient != null) { string sql_doc = "select a.tid,a.textname,a.textkind_id,a.doc_name,c.issimpleinstance,a.section_name from t_patients_doc a" + " inner join t_text c on a.textkind_id = c.id" + " where a.tid in(" + allTextId + ")"; DataSet ds = App.GetDataSet(sql_doc); if (ds != null) { DataTable dt = ds.Tables[0]; if (dt != null) { //arrs = new string[dt.Rows.Count,2]; //去掉相同的文书 int tid = 0; patient_Docs = new Patient_Doc[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { if (tid != Convert.ToInt32(dt.Rows[i]["tid"].ToString())) { patient_Docs[i] = new Patient_Doc(); patient_Docs[i].Patients_doc = App.DownLoadFtpPatientDoc(dt.Rows[i]["tid"].ToString() + ".xml", currentPatient.Id.ToString()); if (patient_Docs[i].Patients_doc == "") { patient_Docs[i].Patients_doc = App.ReadSqlVal("select * from T_PATIENT_DOC_COLB where tid=" + dt.Rows[i]["tid"].ToString() + "", 0, "CONTENT"); } patient_Docs[i].Id = Convert.ToInt32(dt.Rows[i]["tid"].ToString()); patient_Docs[i].Textkind_id = Convert.ToInt32(dt.Rows[i]["textkind_id"].ToString()); patient_Docs[i].Belongtosys_id = Convert.ToInt32(dt.Rows[i]["issimpleinstance"].ToString()); patient_Docs[i].Docname = dt.Rows[i]["doc_name"].ToString(); patient_Docs[i].Section_name = dt.Rows[i]["section_name"].ToString(); patient_Docs[i].Textname = dt.Rows[i]["textname"].ToString(); tid = Convert.ToInt32(dt.Rows[i]["tid"].ToString()); } } } } } return(patient_Docs); } else { return(null); } }