/// <summary> /// 保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { string temp = GetXmlContent(); int message = 0; try { string updateLable = "update T_Follow_TempPlate_Cont set Content=:divContent where tid=" + id; Bifrost.WebReference.OracleParameter[] xmlPars = new Bifrost.WebReference.OracleParameter[1]; xmlPars[0] = new Bifrost.WebReference.OracleParameter(); xmlPars[0].ParameterName = "divContent"; xmlPars[0].Value = temp;//bodyNode.InnerXml; xmlPars[0].OracleType = Bifrost.WebReference.OracleType.Clob; xmlPars[0].Direction = Bifrost.WebReference.ParameterDirection.Input; message = App.ExecuteSQL(updateLable, xmlPars); if (message > 0) { App.Msg("保存成功"); } else { App.MsgErr("保存失败"); } } catch (Exception ex) { App.MsgErr("保存失败,错误原因:" + ex.Message); } }
/// <summary> /// 将模版插入数据库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { string temp = GetXmlContent(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.PreserveWhitespace = true; xmlDoc.LoadXml(temp); if (current_id == "") { Template.XmlClearInfo(ref xmlDoc); frmFollowTemplateSave tpSave = new frmFollowTemplateSave(xmlDoc, trvModel, Template.fmT.MyDoc); App.FormStytleSet(tpSave, false); tpSave.ShowDialog(); } else { int message = 0; try { string updateLable = "update T_Follow_TempPlate_Cont set Content=:divContent where tid=" + current_id; Bifrost.WebReference.OracleParameter[] xmlPars = new Bifrost.WebReference.OracleParameter[1]; xmlPars[0] = new Bifrost.WebReference.OracleParameter(); xmlPars[0].ParameterName = "divContent"; xmlPars[0].Value = temp;//bodyNode.InnerXml; xmlPars[0].OracleType = Bifrost.WebReference.OracleType.Clob; xmlPars[0].Direction = Bifrost.WebReference.ParameterDirection.Input; message = App.ExecuteSQL(updateLable, xmlPars); if (message > 0) { App.Msg("保存成功"); } else { App.MsgErr("保存失败"); } // } // } //} } catch (Exception ex) { App.MsgErr("保存失败,错误原因:" + ex.Message); } } }
/// <summary> /// 插入标签模板 /// </summary> /// <param name="doc">文书代码</param> /// <param name="xmlDoc">标签模板</param> /// <returns></returns> public string InsertLableContent(int tid, string xmlDoc) { XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; doc.LoadXml(xmlDoc); XmlElement xmlElement = doc.DocumentElement; string insertLable = ""; int message = 0; try { string divTitle = "test"; int id = App.GenId("T_Follow_TempPlate_Cont", "ID"); //插入标签模块 insertLable = "insert into T_Follow_TempPlate_Cont(ID,TID,LableName,Content)values(" + id + "," + tid + ",'" + divTitle + "',:divContent)"; Bifrost.WebReference.OracleParameter[] xmlPars = new Bifrost.WebReference.OracleParameter[1]; xmlPars[0] = new Bifrost.WebReference.OracleParameter(); xmlPars[0].ParameterName = "divContent"; //xmlPars[0].Value = divNode.OuterXml; xmlPars[0].Value = xmlDoc; xmlPars[0].OracleType = Bifrost.WebReference.OracleType.Clob; xmlPars[0].Direction = Bifrost.WebReference.ParameterDirection.Input; message = App.ExecuteSQL(insertLable, xmlPars); if (message != 0) { return("成功!"); } else { return("失败!"); } } catch (Exception ex) { return("数据库异常!----------------" + ex.ToString()); } finally { //NClose(); } }
private void btnSave_Click(object sender, EventArgs e) { if (txtName.Text == "") { App.Msg("模板标题不得为空"); txtName.Focus(); } //检查是否重名 DataSet ds = App.GetDataSet("select * from T_FOLLOW_RECORD_DOC where doc_name='" + txtName.Text.Trim() + "'"); if (ds != null) { if (ds.Tables[0].Rows.Count != 0) { App.Msg("模板标题重复,请重新输入"); txtName.Text = ""; return; } } string r_name = txtName.Text.Trim(); //标题 string f_time = App.GetSystemTime().ToShortDateString(); //创建时间 string creator = App.UserAccount.UserInfo.User_id; string insertLable = ""; int message = 0; try { XmlNode root = xmldoc.FirstChild; bool atrribue = false; foreach (XmlNode firstNode in root.ChildNodes) { if (firstNode.Name == "body") { foreach (XmlNode secondNode in firstNode.ChildNodes) { if (secondNode.Name == "div") { if (secondNode != null) { for (int i = 0; i < secondNode.Attributes.Count; i++) { if (secondNode.Attributes[i].Name.Trim().ToLower() == "timetitle") { atrribue = true; } } if (atrribue) { firstNode.RemoveChild(secondNode); break; } } } } } if (atrribue) { break; } } //过滤模板文件 DataInit.filterInfo(xmldoc.DocumentElement, Convert.ToInt32(text_type)); int Id = App.GenId("T_FOLLOW_RECORD", "ID"); //T_FOLLOW_RECORD表主键 int Did = App.GenId("T_FOLLOW_RECORD_DOC", "ID"); //T_FOLLOW_RECORD_DOC表主键 string MaxTimes = ""; int Times = 0; if (GetMaxTimes(patient_id, solution_id) != "") { MaxTimes = GetMaxTimes(patient_id, solution_id); Times = Convert.ToInt32(MaxTimes) + 1; } string sql = ""; //插入标签模块 sql = "insert into T_FOLLOW_RECORD(id,patient_id,follow_times,solution_id,lasttime,creator_id) values(" + Id + "," + patient_id + "," + "" + Times + "," + solution_id + ",to_date('" + f_time + "','yyyy-MM-dd')," + creator + ")"; App.ExecuteSQL(sql); insertLable = "insert into T_FOLLOW_RECORD_DOC(ID,RECORD_ID,DOC_NAME,TEXT_TYPE,DOC_CONTENT) VALUES(" + Did + "," + Id + ",'" + r_name + "'," + text_type + ",:divContent)"; Bifrost.WebReference.OracleParameter[] xmlPars = new Bifrost.WebReference.OracleParameter[1]; xmlPars[0] = new Bifrost.WebReference.OracleParameter(); xmlPars[0].ParameterName = "divContent"; //xmlPars[0].Value = divNode.OuterXml; xmlPars[0].Value = xmldoc.OuterXml; xmlPars[0].OracleType = Bifrost.WebReference.OracleType.Clob; xmlPars[0].Direction = Bifrost.WebReference.ParameterDirection.Input; message = App.ExecuteSQL(insertLable, xmlPars); if (message != 0) { UpdateTree(treeView1, text_type, Did, r_name); Template.fmT.MyDoc.ClearContent(); treeView1.ExpandAll(); this.Close(); App.Msg("插入成功!"); } else { App.Msg("失败!"); } } catch (Exception ex) { App.MsgErr("数据库异常!----------------" + ex.ToString()); } finally { //NClose(); } }
/// <summary> /// 添加或者 修改复杂元素 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tspSave_Click(object sender, EventArgs e) { if (this.tvDirectory.SelectedNode != null) { if (this.tvDirectory.SelectedNode.ImageIndex == 2) { if (this.txtComplexName.Text.Trim() == "") { App.Msg("复杂元素名称不能为空!"); return; } if (complexAction == "ADD") //添加 { try { foreach (TreeNode oldNode in this.tvList.Nodes) { if (oldNode.Text.Trim() == this.txtComplexName.Text.Trim()) { App.Msg("你输入的值与当前目录下的值重复!"); return; } } DataTable dt = App.GetDataSet("select max(objectid) from ET_DOCUMENT").Tables[0]; string evalueCode = ""; if (dt.Rows.Count > 0) { evalueCode = (Convert.ToInt32(dt.Rows[0][0].ToString()) + 1).ToString(); } string id = App.GenId("TABLE_E", "ID").ToString(); string sql = string.Format("insert into TABLE_E(name,EVALUE,EVALUECODE,SIMPLEMETAID_F,ITEM_STYLE,NUM,ID)values('{0}','{1}','{2}','{3}','{4}','{5}','{6}')" , this.tvDirectory.SelectedNode.Text , this.txtComplexName.Text.Trim() , evalueCode , this.tvDirectory.SelectedNode.Tag.ToString() , "100" , this.tvList.Nodes.Count, id); XmlDocument tempxmldoc = new XmlDocument(); tempxmldoc.LoadXml("<emrtextdoc/>"); fmText.MyDoc.ToXML(tempxmldoc.DocumentElement); string sql2 = string.Format("insert into ET_DOCUMENT(OBJECTID,OBJECTNAME,OBJECTTYPE,OBJECTDATA)values('{0}','{1}','{2}',:doc)" , evalueCode , this.txtComplexName.Text.Trim() , "-1"); Bifrost.WebReference.OracleParameter[] op = new Bifrost.WebReference.OracleParameter[] { new Bifrost.WebReference.OracleParameter() }; op[0].ParameterName = "doc"; op[0].OracleType = Bifrost.WebReference.OracleType.Clob; op[0].Value = tempxmldoc.OuterXml; if (App.ExecuteSQL(sql) > 0 && App.ExecuteSQL(sql2, op) > 0) { App.Msg("复杂元素保存成功!"); TreeNode newTn = new TreeNode(); newTn.ImageIndex = 5; newTn.SelectedImageIndex = 5; newTn.Text = this.txtComplexName.Text.Trim(); newTn.Tag = evalueCode; newTn.Name = id; enable(); this.tvList.Nodes.Add(newTn); this.tvDirectory_AfterSelect(null, null); this.tvDirectory.Focus(); } } catch { App.Msg("网络不通"); } } else //修改 { foreach (TreeNode oldNode in this.tvList.Nodes) { if (oldNode.Text.Trim() == this.txtComplexName.Text.Trim() && oldNode.Name != this.tvList.SelectedNode.Name) { App.ShowTip("知识库", "你输入的值与当前目录下的值重复!"); return; } } try { string sql = string.Format("UPDATE TABLE_E SET EVALUE = '{0}' WHERE ID = '{1}'" , this.txtComplexName.Text.Trim() , this.tvList.SelectedNode.Name); XmlDocument temxmldoc = new XmlDocument(); temxmldoc.LoadXml("<emrtextdoc/>"); fmText.MyDoc.ToXML(temxmldoc.DocumentElement); string sql2 = string.Format("UPDATE ET_DOCUMENT SET OBJECTDATA=:doc,OBJECTNAME='{0}' where objectid='{1}'" , this.txtComplexName.Text , this.tvList.SelectedNode.Tag.ToString()); Bifrost.WebReference.OracleParameter[] op2 = new Bifrost.WebReference.OracleParameter[] { new Bifrost.WebReference.OracleParameter() }; op2[0].ParameterName = "doc"; op2[0].OracleType = Bifrost.WebReference.OracleType.Clob; op2[0].Value = temxmldoc.OuterXml; if (App.ExecuteSQL(sql) > 0 && App.ExecuteSQL(sql2, op2) > 0) { App.Msg("复杂元素保存成功!"); this.tvList.SelectedNode.Text = this.txtComplexName.Text.Trim(); enable(); this.tvList.Focus(); } } catch { App.Msg("复杂元素保存失败!"); } } } } }
/// <summary> /// 提交保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { if (tctlDoc.Tabs.Count != 0) { if (tctlDoc.SelectedTabIndex != -1) { try { TabItem CurrentItem = tctlDoc.SelectedTab; //currentPatient = currentPage.Tag as InPatientInfo; string Infomation = CurrentItem.Name; //string[] ids = Infomation.Split(':'); string isSimple = "1"; //是否为单例文书 string text_name = ""; //文书名 bool isNewdoc = false; //是否新建文书 string text_type = ""; //文书类型号 string Key = ""; //主键 text_type = Infomation.Substring(0, Infomation.IndexOf(":")); if (CurrentItem.Text.IndexOf(":") != -1) { isSimple = "1"; text_name = CurrentItem.Text.Substring(0, CurrentItem.Text.IndexOf(":")); Key = CurrentItem.Text.Substring(CurrentItem.Text.IndexOf(":") + 1); } else { text_name = CurrentItem.Text; isSimple = "0"; Key = text_name; } //新建文书保存 if (Infomation.Contains(":New:")) { isNewdoc = true; } string content = GetXmlContent(); int id = App.GenId("T_FOLLOW_RECORD_DOC", "ID"); XmlDocument doc = new XmlDocument(); doc.PreserveWhitespace = true; doc.LoadXml(content); XmlElement xmlElement = doc.DocumentElement; //插入到统计数据表内 //StaticsToDB InsertXml = new StaticsToDB(); //InsertXml.xmlSpit(doc); frmText Text = tctlDoc.SelectedPanel.Controls[0] as frmText; if (!Text.MyDoc._InsertSignature()) { return; } string docSql = ""; if (isNewdoc) { docSql = "insert into T_FOLLOW_RECORD_DOC(id,record_id,text_type,doc_name,text_name,doc_content,creator_id,issimpleinstance) values(" + id + "," + myRecord.Id + "," + text_type + ",'" + Key + "','" + text_name + "',:docContent," + App.UserAccount.UserInfo.User_id + ",'" + isSimple + "')"; } else { if (CurrentItem.Text.IndexOf(":") == -1) { docSql = "update T_FOLLOW_RECORD_DOC set doc_content=:docContent where text_type=" + text_type + " and record_id=" + myRecord.Id + ""; } else { docSql = "update T_FOLLOW_RECORD_DOC set doc_content=:docContent where record_id=" + myRecord.Id + " and doc_name='" + Key + "'"; } } Bifrost.WebReference.OracleParameter[] xmlPars = new Bifrost.WebReference.OracleParameter[1]; xmlPars[0] = new Bifrost.WebReference.OracleParameter(); xmlPars[0].ParameterName = "docContent"; xmlPars[0].Value = doc.OuterXml; xmlPars[0].OracleType = Bifrost.WebReference.OracleType.Clob; xmlPars[0].Direction = Bifrost.WebReference.ParameterDirection.Input; int message = App.ExecuteSQL(docSql, xmlPars); if (message > 0) { App.Msg("保存成功!"); tctlDoc.Tabs.RemoveAt(tctlDoc.SelectedTabIndex); IniFinishedDoc(); } } catch (Exception ex) { App.MsgErr(ex.Message); } if (App.ReadSqlVal("Select id from T_FOLLOW_DOC_ATTACH where record_id=" + myRecord.Id + "", 0, "id") == null) { int flag = 0; for (int i = 0; i < tctlDoc.Tabs.Count; i++) { if (tctlDoc.Tabs[i].Name == "100:Custom") { tctlDoc.SelectedTab = tctlDoc.Tabs[i]; flag = 1; break; } } if (flag == 0) { if (!ExistTab("100")) { CreateCustomPage(); } } } } } }