public void InitTreeControl(TreeView treeView1) { treeView1.Nodes.Clear(); DataSet ds = App.GetDataSet("select Tid,TName from T_TempPlate"); patients = new Class_Patients[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { patients[i] = new Class_Patients(); patients[i].Tid = Convert.ToInt32(ds.Tables[0].Rows[i]["TID"].ToString()); patients[i].TName = ds.Tables[0].Rows[i]["TName"].ToString(); TreeNode tnRoot = new TreeNode(); tnRoot.Tag = patients[i]; tnRoot.Text = patients[i].TName; treeView1.Nodes.Add(tnRoot); } }
private void btnSure_Click(object sender, EventArgs e) { string tempxml = GetXmlContent(); xmldoc = new XmlDocument(); xmldoc.PreserveWhitespace = true; xmldoc.LoadXml(tempxml); //if (xmldoc.GetElementsByTagName("input").Count > 0 || xmldoc.GetElementsByTagName("div").Count > 0 || xmldoc.GetElementsByTagName("table").Count > 0 || xmldoc.GetElementsByTagName("img").Count > 0) //{ // App.Msg("提示:小模板中不能存在输入框,图片,表格,文本块等多结构化的元素!\r\n(注意:多结构化东西只能保存到大模板中!)"); // return; //} if (txtAutoTPName.Text.Trim() == "") { App.MsgWaring("小模板名称不能为空!"); txtAutoTPName.Focus(); return; } bool flag = false; for (int i = 0; i < treeView1.Nodes[0].Nodes.Count; i++) { if (current_id == "") { if (treeView1.Nodes[0].Nodes[i].Text.Trim() == txtAutoTPName.Text.Trim()) { flag = true; break; } } else { if (treeView1.Nodes[0].Nodes[i].Text.Trim() == txtAutoTPName.Text.Trim()) { if (treeView1.Nodes[0].Nodes[i].Name.Trim() != current_id.Trim()) { flag = true; } break; } } } if (flag) { App.MsgWaring("已经存在相同名称的小模板!"); txtAutoTPName.Focus(); return; } if (current_id == "") { if (cboModelType.Text == "请选择...") { App.Msg("请选择小模板类型!"); cboModelType.Focus(); return; } Class_Patients cpd = new Class_Patients(); string modeltype; //string SectionId = ""; //模版Id cpd.Tid = App.GenId("T_TempPlate", "TID"); modeltype = cboModelType.SelectedValue.ToString(); //病种Id //使用范围 if (this.rdoPersonal.Checked == true) { cpd.TempPlate_Level = 'P'; //个人 if (!App.IsHigherMasterDoctor(App.UserAccount.UserInfo.User_id)) { /* * 主治一下级别的医生,创建个人模板的时候有创建数量的限制 */ DataSet ds_get_count = App.GetDataSet("select t.max_count from t_small_template_count_set t where t.section_id=" + App.UserAccount.CurrentSelectRole.Section_Id + ""); if (ds_get_count != null) { if (ds_get_count.Tables[0].Rows.Count > 0) { DataSet ds_count = App.GetDataSet("select count(tid) from t_tempplate t where t.tempplate_level='P' and t.temptype='S' and t.section_id=" + App.UserAccount.CurrentSelectRole.Section_Id + " and t.Creator_Id=" + App.UserAccount.Account_id + ""); if (Convert.ToInt32(ds_count.Tables[0].Rows[0][0]) >= Convert.ToInt32(ds_get_count.Tables[0].Rows[0][0])) { App.MsgWaring("主治以下级别的医生,创建个人模板的时候有创建数量的限制,您的小模板数已经超过了上限" + ds_get_count.Tables[0].Rows[0][0].ToString() + ""); return; } } } } } if (this.rdoSection.Checked == true) { cpd.TempPlate_Level = 'S'; //科室 } cpd.TName = txtAutoTPName.Text; //模板名称 cpd.Ages = -1; //性别 if (rdoSexNull.Checked) { cpd.Sex = 'N'; } else if (rdoMale.Checked) { cpd.Sex = '0'; } else if (rdoFemale.Checked) { cpd.Sex = '1'; } cpd.Section_ID = 0; //科室ID if (App.UserAccount.CurrentSelectRole.Role_name != "系统管理员") { cpd.Section_ID = Convert.ToInt32(App.UserAccount.CurrentSelectRole.Section_Id); } else { if (cmbSection.Visible) { cpd.Section_ID = Convert.ToInt32(cmbSection.SelectedValue); } } //病区ID if (App.UserAccount.CurrentSelectRole.Sickarea_Id != string.Empty) { cpd.SickArea_ID = Convert.ToInt32(App.UserAccount.CurrentSelectRole.Sickarea_Id); } //创建时间 cpd.Create_Time = this.dtpTime.Value.ToString("yyyy-MM-dd HH:mm"); //创建人ID cpd.Creator_ID = Convert.ToInt32(App.UserAccount.Account_id); ArrayList Sqls = new ArrayList(); //设置默认模板 string ISDEFAULT = "N"; //设置是更新或者新增 string temp = ""; //DataSet samedocs = App.GetDataSet("select tid from T_TempPlate where tname='" + cpd.TName + "' and TEMPTYPE='S'"); //if (samedocs.Tables[0] != null) //{ // if (samedocs.Tables[0].Rows.Count > 0) // { // App.MsgWaring("已经存在相同名称的文书,请先修改名称"); // return; // } //} string sick_Id = "0"; //病种Id if (chkBzfl.Enabled) { //if (cboSicknessKind.Text != "请选择...") if (cboSicknessKind.SelectedIndex >= 0) { sick_Id = cboSicknessKind.SelectedValue.ToString(); } //else //{ // App.MsgWaring("请选择病种类"); // return; //} } //插入模版表 if (cpd.Section_ID != 0) { temp = "insert into T_TempPlate(tid, tname, shortcut, text_type, tempplate_level, sex, ages, sickarea_id, creator_id, create_time, updater_id, update_time, verify_id1, verify_time1, verify_id2, verify_time2, verify_sign, isdiag, enable_flag,ISDEFAULT,SECTION_ID,SMALLTEMPTYPE,TEMPTYPE,SICK_ID) values(" + cpd.Tid + ",'" + cpd.TName + "','" + cpd.Shortcut + "'," + "'" + cpd.TextKind + "','" + cpd.TempPlate_Level + "','" + cpd.Sex + "'," + cpd.Ages + "," + cpd.SickArea_ID + "," + cpd.Creator_ID + ",to_timestamp(" + " '" + cpd.Create_Time + "','yyyy-MM-dd HH24:mi')," + cpd.Updater_ID + ",'" + cpd.Update_Time + "'," + cpd.Verify_ID1 + "," + "'" + cpd.Verify_Time1 + "'," + cpd.Verify_ID2 + ",'" + cpd.Verify_Time2 + "','" + cpd.Verify_Sign + "'," + "'N','N','" + ISDEFAULT + "'," + cpd.Section_ID + ",'" + modeltype + "','S'," + sick_Id + ")"; } else { temp = "insert into T_TempPlate(tid, tname, shortcut, text_type, tempplate_level, sex, ages, sickarea_id, creator_id, create_time, updater_id, update_time, verify_id1, verify_time1, verify_id2, verify_time2, verify_sign, isdiag, enable_flag,ISDEFAULT,SECTION_ID,SMALLTEMPTYPE,TEMPTYPE,SICK_ID) values(" + cpd.Tid + ",'" + cpd.TName + "','" + cpd.Shortcut + "'," + "'" + cpd.TextKind + "','" + cpd.TempPlate_Level + "','" + cpd.Sex + "'," + cpd.Ages + "," + cpd.SickArea_ID + "," + cpd.Creator_ID + ",to_timestamp(" + " '" + cpd.Create_Time + "','yyyy-MM-dd HH24:mi')," + cpd.Updater_ID + ",'" + cpd.Update_Time + "'," + cpd.Verify_ID1 + "," + "'" + cpd.Verify_Time1 + "'," + cpd.Verify_ID2 + ",'" + cpd.Verify_Time2 + "','" + cpd.Verify_Sign + "'," + "'N','N','" + ISDEFAULT + "'," + cpd.Section_ID + ",'" + modeltype + "','S'," + sick_Id + ")"; } Sqls.Add(temp); /* * 移除含有timeTitle属性的div节点 */ 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; } } string temp3 = Template.fmS.MyDoc.InsertLableContent(cpd.Tid, xmldoc.OuterXml); if (temp3.Trim() == "") { App.MsgErr("保存失败!"); Template.fmT.MyDoc.ClearContent(); this.Close(); return; } string[] AddSqls = new string[Sqls.Count]; for (int i = 0; i < Sqls.Count; i++) { AddSqls[i] = Sqls[i].ToString(); } int x = App.ExecuteBatch(AddSqls); if (x > 0) { App.Msg("模版保存成功!"); btnSearch_Click(sender, e); } else { App.MsgErr("保存失败!"); } } else { XmlElement xmlElement = xmldoc.DocumentElement; int message = 0; try { foreach (XmlNode bodyNode in xmlElement.ChildNodes) { if (bodyNode.Name == "body") { if (bodyNode.HasChildNodes) { //int i = 1; string updateLable = "update T_TempPlate_Cont set Content=:divContent where tid=" + current_id; MySqlDBParameter[] xmlPars = new MySqlDBParameter[1]; xmlPars[0] = new MySqlDBParameter(); xmlPars[0].ParameterName = "divContent"; //xmlPars[0].Value = divNode.OuterXml; xmlPars[0].Value = bodyNode.InnerXml; xmlPars[0].DBType = MySqlDbType.Text; xmlPars[0].Direction = ParameterDirection.Input; message = App.ExecuteSQL(updateLable, xmlPars); if (message > 0) { string sick_Id = "0"; //病种Id if (chkBzfl.Checked) { sick_Id = cboSicknessKind.SelectedValue.ToString(); } string Sql = "update t_tempplate set tname='" + txtAutoTPName.Text + "',SICK_ID='" + sick_Id + "' where tid=" + current_id + ""; if (radp1.Checked) { char lever = 'P'; if (this.rdoSection.Checked) { lever = 'S'; //科室 } Sql = "update t_tempplate set tname='" + txtAutoTPName.Text + "',tempplate_level='" + lever + "',SICK_ID='" + sick_Id + "' where tid=" + current_id + ""; } App.ExecuteSQL(Sql); App.Msg("保存成功"); btnSearch_Click(sender, e); } else { App.MsgErr("保存失败"); } } } } } catch (Exception ex) { App.MsgErr("保存失败,错误原因:" + ex.Message); } } }
private void btnOK_Click(object sender, EventArgs e) { Class_Patients cpd = new Class_Patients(); string modeltype; //string SectionId = ""; if (cboModelType.Text == "请选择...") { App.Msg("请选择小模板类型!"); cboModelType.Focus(); return; } //模版Id cpd.Tid = App.GenId("T_TempPlate", "TID"); modeltype = cboModelType.SelectedValue.ToString(); //病种Id //使用范围 if (this.rdoPersonal.Checked == true) { cpd.TempPlate_Level = 'P'; //个人 } if (this.rdoSection.Checked == true) { cpd.TempPlate_Level = 'S'; //科室 } cpd.TName = txtAutoTPName.Text; //模板名称 cpd.Ages = -1; //性别 if (rdoSexNull.Checked) { cpd.Sex = 'N'; } else if (rdoMale.Checked) { cpd.Sex = '0'; } else if (rdoFemale.Checked) { cpd.Sex = '1'; } cpd.Section_ID = 0; //科室ID if (App.UserAccount.CurrentSelectRole.Role_name != "系统管理员") { cpd.Section_ID = Convert.ToInt32(App.UserAccount.CurrentSelectRole.Section_Id); } else { if (cmbSection.Visible) { cpd.Section_ID = Convert.ToInt32(cmbSection.SelectedValue); } } //病区ID if (App.UserAccount.CurrentSelectRole.Sickarea_Id != string.Empty) { cpd.SickArea_ID = Convert.ToInt32(App.UserAccount.CurrentSelectRole.Sickarea_Id); } //创建时间 cpd.Create_Time = this.dtpTime.Value.ToString("yyyy-MM-dd HH:mm"); //创建人ID cpd.Creator_ID = Convert.ToInt32(App.UserAccount.Account_id); ArrayList Sqls = new ArrayList(); //设置默认模板 string ISDEFAULT = "N"; //设置是更新或者新增 string temp = ""; DataSet samedocs = App.GetDataSet("select tid from T_TempPlate where tname='" + cpd.TName + "' and TEMPTYPE='S'"); if (samedocs.Tables[0] != null) { if (samedocs.Tables[0].Rows.Count > 0) { App.MsgWaring("已经存在相同名称的文书,请先修改名称"); return; } } //插入模版表 if (cpd.Section_ID != 0) { temp = "insert into T_TempPlate(tid, tname, shortcut, text_type, tempplate_level, sex, ages, sickarea_id, creator_id, create_time, updater_id, update_time, verify_id1, verify_time1, verify_id2, verify_time2, verify_sign, isdiag, enable_flag,ISDEFAULT,SECTION_ID,SMALLTEMPTYPE,TEMPTYPE) values(" + cpd.Tid + ",'" + cpd.TName + "','" + cpd.Shortcut + "'," + "'" + cpd.TextKind + "','" + cpd.TempPlate_Level + "','" + cpd.Sex + "'," + cpd.Ages + "," + cpd.SickArea_ID + "," + cpd.Creator_ID + ",to_timestamp(" + " '" + cpd.Create_Time + "','yyyy-MM-dd HH24:mi')," + cpd.Updater_ID + ",'" + cpd.Update_Time + "'," + cpd.Verify_ID1 + "," + "'" + cpd.Verify_Time1 + "'," + cpd.Verify_ID2 + ",'" + cpd.Verify_Time2 + "','" + cpd.Verify_Sign + "'," + "'N','N','" + ISDEFAULT + "'," + cpd.Section_ID + ",'" + modeltype + "','S')"; } else { temp = "insert into T_TempPlate(tid, tname, shortcut, text_type, tempplate_level, sex, ages, sickarea_id, creator_id, create_time, updater_id, update_time, verify_id1, verify_time1, verify_id2, verify_time2, verify_sign, isdiag, enable_flag,ISDEFAULT,SECTION_ID,SMALLTEMPTYPE,TEMPTYPE) values(" + cpd.Tid + ",'" + cpd.TName + "','" + cpd.Shortcut + "'," + "'" + cpd.TextKind + "','" + cpd.TempPlate_Level + "','" + cpd.Sex + "'," + cpd.Ages + "," + cpd.SickArea_ID + "," + cpd.Creator_ID + ",to_timestamp(" + " '" + cpd.Create_Time + "','yyyy-MM-dd HH24:mi')," + cpd.Updater_ID + ",'" + cpd.Update_Time + "'," + cpd.Verify_ID1 + "," + "'" + cpd.Verify_Time1 + "'," + cpd.Verify_ID2 + ",'" + cpd.Verify_Time2 + "','" + cpd.Verify_Sign + "'," + "'N','N','" + ISDEFAULT + "'," + cpd.Section_ID + ",'" + modeltype + "','S')"; } Sqls.Add(temp); /* * 移除含有timeTitle属性的div节点 */ 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; } } string temp3 = this.doc.InsertLableContent(cpd.Tid, xmldoc.OuterXml); if (temp3.Trim() == "") { App.MsgErr("保存失败!"); Template.fmT.MyDoc.ClearContent(); this.Close(); return; } string[] AddSqls = new string[Sqls.Count]; for (int i = 0; i < Sqls.Count; i++) { AddSqls[i] = Sqls[i].ToString(); } int x = App.ExecuteBatch(AddSqls); if (x > 0) { App.Msg("模版保存成功!"); this.Close(); } else { App.MsgErr("保存失败!"); } }
//保存模板 private void btnOK_Click(object sender, EventArgs e) { Class_Patients cpd = new Class_Patients(); if (InputValid()) { //模版Id cpd.Tid = App.GenId("T_TempPlate", "TID"); string sick_Id = cboSicknessKind.SelectedValue.ToString(); //病种Id //使用范围 if (this.rdoPersonal.Checked == true) { cpd.TempPlate_Level = 'P'; //个人 } if (this.rdoSection.Checked == true) { cpd.TempPlate_Level = 'S'; //科室 } if (this.rdoHospital.Checked == true) { cpd.TempPlate_Level = 'H'; //全院 } cpd.TName = txtAutoTPName.Text; //模板名称 //文书类型 --需要通过登录者当前操作的文书来判断是哪一个文书类型 (例如:入院记录、手术小结) cpd.TextKind = ucTemplateManagement.text_kind.ToString(); //if (cboAges.SelectedIndex != 0) //{ // cpd.Ages = Convert.ToInt32(this.cboAges.SelectedValue.ToString()); //} //else //{ // App.MsgErr("请选择年龄段"); // return; //} //年龄段 if (rdoAgeNull.Checked) { cpd.Ages = -1; } else if (rdoEnfant.Checked) { cpd.Ages = Convert.ToInt32(App.GetDataSet("select ID from t_data_code where Name='儿童'").Tables[0].Rows[0]["ID"]); } else if (rdoLad.Checked) { cpd.Ages = Convert.ToInt32(App.GetDataSet("select ID from t_data_code where Name='少年'").Tables[0].Rows[0]["ID"]); } else if (rdoYouth.Checked) { cpd.Ages = Convert.ToInt32(App.GetDataSet("select ID from t_data_code where Name='青年'").Tables[0].Rows[0]["ID"]); } else if (rdoMiddle.Checked) { cpd.Ages = Convert.ToInt32(App.GetDataSet("select ID from t_data_code where Name='中年'").Tables[0].Rows[0]["ID"]); } else if (rdoOld.Checked) { cpd.Ages = Convert.ToInt32(App.GetDataSet("select ID from t_data_code where Name='老年'").Tables[0].Rows[0]["ID"]); } //if (cboSex.SelectedIndex != 0) //{ // string sex = this.cboSex.SelectedItem.ToString(); // if (sex == "男") // { // cpd.Sex = '0'; // } // else // { // cpd.Sex = '1'; //女 // } //} //else //{ // App.MsgErr("请选择性别"); // return; //} //性别 if (rdoSexNull.Checked) { cpd.Sex = 'N'; } else if (rdoMale.Checked) { cpd.Sex = '0'; } else if (rdoFemale.Checked) { cpd.Sex = '1'; } //科室ID if (App.UserAccount.CurrentSelectRole.Section_Id != string.Empty) { cpd.Section_ID = Convert.ToInt32(App.UserAccount.CurrentSelectRole.Section_Id); } //病区ID if (App.UserAccount.CurrentSelectRole.Sickarea_Id != string.Empty) { cpd.SickArea_ID = Convert.ToInt32(App.UserAccount.CurrentSelectRole.Sickarea_Id); } //创建时间 cpd.Create_Time = this.dtpTime.Value.ToString("yyyy-MM-dd HH:mm"); //创建人ID cpd.Creator_ID = Convert.ToInt32(App.UserAccount.Account_id); ArrayList Sqls = new ArrayList(); //设置默认模板 string ISDEFAULT = "N"; if (this.rdbYes.Checked) { //默认模板 Sqls.Add("update T_TempPlate set ISDEFAULT='N' where text_type='" + cpd.TextKind + "'"); ISDEFAULT = "Y"; } else { ISDEFAULT = "N"; } //设置是更新或者新增 string temp = ""; if (cboTextKind.SelectedIndex != 0) { DataSet samedocs = App.GetDataSet("select tid from T_TempPlate where tname='" + cpd.TName + "' and tid='" + cboTextKind.SelectedValue.ToString() + "'"); if (samedocs.Tables[0] != null) { if (samedocs.Tables[0].Rows.Count > 0) { App.MsgWaring("已经存在相同名称的文书,请先修改名称"); return; } } } else { string sql = "select * from T_TempPlate where tname='" + cpd.TName + "' and sick_Id='" + sick_Id + "'"; DataSet ds = App.GetDataSet(sql); if (ds.Tables[0].Rows.Count > 0) { App.Msg("此模板已经存在,请更换其它模板名!"); return; } } //插入模版表 if (App.UserAccount.CurrentSelectRole.Section_Id != "") { temp = "insert into T_TempPlate(tid, tname, shortcut, text_type, tempplate_level, sex, ages, sickarea_id, creator_id, create_time, updater_id, update_time, verify_id1, verify_time1, verify_id2, verify_time2, verify_sign, isdiag, enable_flag,ISDEFAULT,SICK_ID,SECTION_ID) values(" + cpd.Tid + ",'" + cpd.TName + "','" + cpd.Shortcut + "'," + "'" + cpd.TextKind + "','" + cpd.TempPlate_Level + "','" + cpd.Sex + "'," + cpd.Ages + "," + cpd.SickArea_ID + "," + cpd.Creator_ID + ",to_timestamp(" + " '" + cpd.Create_Time + "','yyyy-MM-dd HH24:mi')," + cpd.Updater_ID + ",'" + cpd.Update_Time + "'," + cpd.Verify_ID1 + "," + "'" + cpd.Verify_Time1 + "'," + cpd.Verify_ID2 + ",'" + cpd.Verify_Time2 + "','" + cpd.Verify_Sign + "'," + "'N','N','" + ISDEFAULT + "','" + sick_Id + "'," + App.UserAccount.CurrentSelectRole.Section_Id + ")"; } else { temp = "insert into T_TempPlate(tid, tname, shortcut, text_type, tempplate_level, sex, ages, sickarea_id, creator_id, create_time, updater_id, update_time, verify_id1, verify_time1, verify_id2, verify_time2, verify_sign, isdiag, enable_flag,ISDEFAULT,SICK_ID) values(" + cpd.Tid + ",'" + cpd.TName + "','" + cpd.Shortcut + "'," + "'" + cpd.TextKind + "','" + cpd.TempPlate_Level + "','" + cpd.Sex + "'," + cpd.Ages + "," + cpd.SickArea_ID + "," + cpd.Creator_ID + ",to_timestamp(" + " '" + cpd.Create_Time + "','yyyy-MM-dd HH24:mi')," + cpd.Updater_ID + ",'" + cpd.Update_Time + "'," + cpd.Verify_ID1 + "," + "'" + cpd.Verify_Time1 + "'," + cpd.Verify_ID2 + ",'" + cpd.Verify_Time2 + "','" + cpd.Verify_Sign + "'," + "'N','N','" + ISDEFAULT + "','" + sick_Id + "')"; } Sqls.Add(temp); //if (App.UserAccount.CurrentSelectRole.Role_type == "D") //{ //科室医生保存模板 if (cpd.TempPlate_Level == 'S') { Sqls.Add("insert into T_TEMPPLATE_SECTION(TEMPLATE_ID,SECTION_ID,ISDEFAULT)values(" + cpd.Tid + ",'" + App.UserAccount.CurrentSelectRole.Section_Id + "','N')"); } //} /* * 移除含有timeTitle属性的div节点 */ 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(cpd.TextKind)); string temp3 = InsertLableContent(cpd.Tid, xmldoc.OuterXml); if (temp3.Trim() == "") { App.MsgErr("保存失败!"); Template.fmT.MyDoc.ClearContent(); this.Close(); return; } string[] AddSqls = new string[Sqls.Count]; for (int i = 0; i < Sqls.Count; i++) { AddSqls[i] = Sqls[i].ToString(); } int x = App.ExecuteBatch(AddSqls); if (x > 0) { App.Msg("模版保存成功!"); this.Close(); if (treeView1 != null) { TreeNode node = new TreeNode(); node.Tag = cpd; if (txtAutoTPName.Text.Trim() == "") { node.Text = cpd.Create_Time; } else { node.Text = txtAutoTPName.Text; } node.ImageIndex = 13; node.SelectedImageIndex = 13; treeView1.SelectedNode.ImageIndex = 6; treeView1.SelectedNode.SelectedImageIndex = 6; treeView1.SelectedNode.Nodes.Add(node); treeView1.Refresh(); } //frmTemplateManageMent.ReflashBookTree(treeView1); //InitTree it = new InitTree(); // it.InitTreeControl(treeView1); } else { App.MsgErr("保存失败!"); } } }
//加载模板信息 private void LoadTemplateInfo() { if (this.txtAutoTPName.Text != "") { string tName = this.txtAutoTPName.Text; string sql = "select * from T_TempPlate where tname='" + tName + "'"; DataSet dsTemplate = App.GetDataSet(sql); Class_Patients cpd = null; string isDefault = ""; int sick_Id = 0; if (dsTemplate.Tables[0].Rows.Count > 0) { cpd = new Class_Patients(); dataTable = dsTemplate.Tables[0]; cpd.Tid = Convert.ToInt32(dataTable.Rows[0]["tid"].ToString()); cpd.TName = dataTable.Rows[0]["tname"].ToString(); cpd.Shortcut = dataTable.Rows[0]["shortcut"].ToString(); cpd.TextKind = dataTable.Rows[0]["text_type"].ToString(); cpd.TempPlate_Level = Convert.ToChar(dataTable.Rows[0]["tempplate_level"].ToString()); cpd.Sex = Convert.ToChar(dataTable.Rows[0]["sex"].ToString()); if (dataTable.Rows[0]["ages"] != null) { cpd.Ages = Convert.ToInt32(dataTable.Rows[0]["ages"].ToString()); } if (dataTable.Rows[0]["section_id"] != null) { cpd.Section_ID = Convert.ToInt32(dataTable.Rows[0]["section_id"].ToString()); } if (dataTable.Rows[0]["sickarea_id"] != null) { cpd.SickArea_ID = Convert.ToInt32(dataTable.Rows[0]["sickarea_id"].ToString()); } if (dataTable.Rows[0]["creator_id"] != null) { cpd.Creator_ID = Convert.ToInt32(dataTable.Rows[0]["creator_id"]); } cpd.Create_Time = dataTable.Rows[0]["create_time"].ToString(); if (dataTable.Rows[0]["updater_id"] != null) { cpd.Updater_ID = Convert.ToInt32(dataTable.Rows[0]["updater_id"]); } cpd.Update_Time = dataTable.Rows[0]["update_time"].ToString(); if (dataTable.Rows[0]["verify_id1"] != null) { cpd.Verify_ID1 = Convert.ToInt32(dataTable.Rows[0]["verify_id1"]); } cpd.Verify_Time1 = dataTable.Rows[0]["verify_time1"].ToString(); if (dataTable.Rows[0]["verify_id2"] != null) { cpd.Verify_ID2 = Convert.ToInt32(dataTable.Rows[0]["verify_id2"]); } cpd.Verify_Time2 = dataTable.Rows[0]["verify_time2"].ToString(); if (dataTable.Rows[0]["verify_sign"] != null) { cpd.Verify_Sign = Convert.ToInt32(dataTable.Rows[0]["verify_sign"]); } if (dataTable.Rows[0]["isdiag"] != null) { cpd.IsDiag = Convert.ToChar(dataTable.Rows[0]["isdiag"]); } if (dataTable.Rows[0]["enable_flag"] != null) { cpd.Enable_Flag = Convert.ToChar(dataTable.Rows[0]["enable_flag"]); } isDefault = dataTable.Rows[0]["ISDEFAULT"].ToString(); //是否默认模板 if (dataTable.Rows[0]["sick_id"] != null) { sick_Id = Convert.ToInt32(dataTable.Rows[0]["sick_id"]); } } //加载使用范围信息 if (cpd.TempPlate_Level == 'P') { rdoPersonal.Checked = true; } else if (cpd.TempPlate_Level == 'S') { rdoSection.Checked = true; } else if (cpd.TempPlate_Level == 'H') { rdoHospital.Checked = true; } string ageName = ""; if (cpd.Ages != -1) { ageName = App.GetDataSet("select Name from t_data_code where ID=" + cpd.Ages + "").Tables[0].Rows[0]["Name"].ToString(); } //加载年龄段 if (ageName == "儿童") { rdoEnfant.Checked = true; } else if (ageName == "少年") { rdoLad.Checked = true; } else if (ageName == "青年") { rdoYouth.Checked = true; } else if (ageName == "中年") { rdoMiddle.Checked = true; } else if (ageName == "老年") { rdoOld.Checked = true; } else { rdoAgeNull.Checked = true; } //加载性别 if (cpd.Sex == '0') { rdoMale.Checked = true; } else if (cpd.Sex == '1') { rdoFemale.Checked = true; } else { rdoSexNull.Checked = true; } //加载时间 if (cpd.Create_Time != "" && cpd.Create_Time != null) { this.dtpTime.Value = Convert.ToDateTime(cpd.Create_Time); } //加载默认模板 if (isDefault == "Y") { rdbYes.Checked = true; } else { rdbNo.Checked = true; } } }