/// <summary> /// 初始化treeview /// </summary> public void InitTree() { this.ImageList = this.imageList1; TreeNode Selectnode = new TreeNode(); //树的节点 this.Nodes.Clear(); ArrayList arrNurse = new ArrayList();//护士站列表 //arrNurse = Neusoft.HISFC.Models.Fee.FeeCodeStat.List(); TreeNode tnWard = new TreeNode(); TreeNode tnRoot = new TreeNode(); tnRoot.Text = "护士站列表"; Neusoft.HISFC.BizLogic.Manager.Department cDept = new Neusoft.HISFC.BizLogic.Manager.Department(); arrNurse = cDept.GetDeptment(Neusoft.HISFC.Models.Base.EnumDepartmentType.N); //{1E01AC87-5E6A-4dbc-AB55-7970C28DC843} wbo 2010-09-18 arrNurse.Sort(new CompareByName()); tnRoot.ImageIndex = 3; tnRoot.SelectedImageIndex = 3; //药物执行单 try { for (int i = 0; i < arrNurse.Count; i++) { TreeNode node = new TreeNode(arrNurse[i].ToString()); string strNurseID = ((Neusoft.FrameWork.Models.NeuObject)arrNurse[i]).ID.ToString(); node.Tag = strNurseID; Neusoft.HISFC.BizLogic.Manager.Bed oCBed = new Neusoft.HISFC.BizLogic.Manager.Bed(); node.ImageIndex = 2; node.SelectedImageIndex = 2; ArrayList arrWard = new ArrayList(); arrWard = oCBed.GetBedRoom(strNurseID); //{1E01AC87-5E6A-4dbc-AB55-7970C28DC843} wbo 2010-09-18 arrWard.Sort(); for (int j = 0; j < arrWard.Count; j++) { tnWard = new TreeNode(arrWard[j].ToString()); tnWard.Text = arrWard[j].ToString(); tnWard.SelectedImageIndex = 1; tnWard.ImageIndex = 0; node.Nodes.Add(tnWard); if (j == 0 && i == 0) { Selectnode = tnWard; //保存第一个节点 } } tnRoot.Nodes.Add(node); } this.Nodes.Add(tnRoot); // this.ExpandAll(); //展开所有树的节点 this.SelectedNode = Selectnode; //指定当前选定哪个节点 } catch (Exception ex) { MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("错误!") + ex.Message); } }
protected override int OnSetValue(object neuObject, TreeNode e) { //string strID = ""; ArrayList arr = new ArrayList(); Neusoft.HISFC.BizLogic.Manager.Bed oCBed = new Neusoft.HISFC.BizLogic.Manager.Bed(); if (e != null) { CurrentNode = e; if (e.Parent != null && e.Parent.Parent != null)//病房号 { string strNurse = e.Parent.Tag.ToString(); strID = e.Text.Trim(); arr = oCBed.GetBedListByRoom(strID, strNurse); //排序 {1E01AC87-5E6A-4dbc-AB55-7970C28DC843} wbo 2010-09-18 arr.Sort(new CompareByBedNO()); this.strTag = "1"; this.dataSet_Init(arr); this.NurseID = strNurse; //护士站 } else if (e.Parent != null) //护士站号 { if (e.Tag != null) { strID = e.Tag.ToString(); arr = oCBed.GetBedList(strID); //排序 {1E01AC87-5E6A-4dbc-AB55-7970C28DC843} wbo 2010-09-18 arr.Sort(new CompareByBedNO()); this.strTag = "0"; this.dataSet_Init(arr); strID = ""; } } else { strID = "ALL"; arr = oCBed.GetBedList(strID); //排序 {1E01AC87-5E6A-4dbc-AB55-7970C28DC843} wbo 2010-09-18 arr.Sort(new CompareByBedNO()); this.dataSet_Init(arr); } } return(base.OnSetValue(neuObject, e)); }