/// <summary> /// 选择所有的使用范围和职务职称等 /// </summary> private void RangeSelectAllByNode(TreeNode node) { Doc_Ranges.Clear(); //Doc_Job.Clear(); //Doc_Other.Clear(); Class_Text_A selectdoc = (Class_Text_A)node.Tag; /* * 使用范围部分 */ string Sql_textusearea = "select * from t_textusearea where texttype=" + selectdoc.Id + ""; DataSet ds_textusearea = App.GetDataSet(Sql_textusearea); for (int i = 0; i < ds_textusearea.Tables[0].Rows.Count; i++) { Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Texttype = selectdoc.Id; temp.Workgroup = Convert.ToInt16(ds_textusearea.Tables[0].Rows[i]["WORKGROUP"]); cboWorkGroup.SelectedValue = temp.Workgroup; Doc_Ranges.Add(temp); } Save_WorkGroup(); }
/// <summary> /// 移除某一分院所有的科室或病区 /// </summary> /// <param name="shid">分院ID</param> private void RemoveAllSectionByShid(int shid) { for (int i = 0; i < Doc_Ranges.Count; i++) { Class_Doc_User_Range temp = (Class_Doc_User_Range)Doc_Ranges[i]; if (temp.Belonghospital == shid) { Doc_Ranges.Remove(Doc_Ranges[i]); RemoveAllSectionByShid(shid); } } }
/// <summary> /// 范围修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void chkListSection_MouseUp(object sender, MouseEventArgs e) { if (chkListFenyuan.SelectedItem != null) { Class_Sub_Hospital temp_hospital = (Class_Sub_Hospital)chkListFenyuan.SelectedItem; RemoveAllSectionByShid(Convert.ToInt16(temp_hospital.Id)); /* * 加载新设置的分院科室或病区 */ for (int i = 0; i < chkListSection.CheckedItems.Count; i++) { Class_Sections temp_section = (Class_Sections)chkListSection.CheckedItems[i]; Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Belonghospital = Convert.ToInt16(temp_hospital.Id); temp.Section = temp_section.Sid; temp.Texttype = CurrentSelectDocId; temp.Workgroup = Convert.ToInt16(cboWorkGroup.SelectedValue); Doc_Ranges.Add(temp); } } }
/// <summary> /// 所有文书子节点的使用范围设置 /// </summary> private void ChildNodeRangeSet(TreeNodeCollection nodes) { for (int i = 0; i < nodes.Count; i++) { if (nodes[i].Nodes.Count > 0) { ChildNodeRangeSet(nodes[i].Nodes); } else { if (nodes[i].Tag.GetType().ToString().Contains("Class_Text_A")) { Class_Text_A selectdoc = (Class_Text_A)nodes[i].Tag; ArrayList strSqls = new ArrayList(); strSqls.Add("delete from T_TEXTUSEAREA where TEXTTYPE=" + selectdoc.Id.ToString() + ""); //分院信息 string Sql = "select * from T_SUB_HOSPITALINFO"; DataSet ds_hospital = App.GetDataSet(Sql); //医生组 string Sql_section = "select * from T_SECTIONINFO"; DataSet ds_section = App.GetDataSet(Sql_section); for (int i1 = 0; i1 < ds_hospital.Tables[0].Rows.Count; i1++) { DataRow[] Rows = ds_section.Tables[0].Select("shid = " + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ""); if (Rows.Length > 0) { for (int j = 0; j < Rows.Length; j++) { Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Texttype = selectdoc.Id; temp.Section = Convert.ToInt16(Rows[j]["sid"].ToString()); temp.Belonghospital = Convert.ToInt16(ds_hospital.Tables[0].Rows[i1]["SHID"].ToString()); temp.Workgroup = 212; strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + temp.Texttype.ToString() + "," + temp.Belonghospital.ToString() + "," + temp.Section.ToString() + "," + temp.Workgroup.ToString() + ")"); } } else { strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + selectdoc.Id.ToString() + "," + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ",0," + 212 + ")"); } } //护士组 string Sql_sickarea = "select * from t_sickareainfo"; DataSet ds_sickarea = App.GetDataSet(Sql_sickarea); for (int i1 = 0; i1 < ds_hospital.Tables[0].Rows.Count; i1++) { DataRow[] Rows = ds_sickarea.Tables[0].Select("shid = " + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ""); if (Rows.Length > 0) { for (int j = 0; j < Rows.Length; j++) { Class_Doc_User_Range temp = new Class_Doc_User_Range(); temp.Texttype = selectdoc.Id; temp.Section = Convert.ToInt16(Rows[j]["said"].ToString()); temp.Belonghospital = Convert.ToInt16(ds_hospital.Tables[0].Rows[i1]["SHID"].ToString()); temp.Workgroup = 213; strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + temp.Texttype.ToString() + "," + temp.Belonghospital.ToString() + "," + temp.Section.ToString() + "," + temp.Workgroup.ToString() + ")"); } } else { strSqls.Add("insert into T_TEXTUSEAREA(TEXTTYPE,BELONGHOSPITAL,SECTION,WORKGROUP)values(" + selectdoc.Id.ToString() + "," + ds_hospital.Tables[0].Rows[i1]["SHID"].ToString() + ",0," + 213 + ")"); } } string[] strsqls2 = new string[strSqls.Count]; for (int k = 0; k < strsqls2.Length; k++) { strsqls2[k] = strSqls[k].ToString(); } if (App.ExecuteBatch(strsqls2) > 0) { SaveCount++; } } } } }