コード例 #1
0
        /// <summary>
        /// 根据科室分类代码,取此分类下的科室列表
        /// </summary>
        /// <returns></returns>
        public ArrayList LoadDepartmentStat(string statCode)
        {
            string sql = "";

            if (this.Sql.GetSql("Manager.DepartmentStatManager.LoadDepartmentStat", ref sql) == -1)
            {
                return(null);
            }

            try {
                sql = string.Format(sql, statCode);
            }
            catch (Exception ex) {
                this.Err = ex.Message;
                return(null);
            }

            if (this.ExecQuery(sql) == -1)
            {
                return(null);
            }

            ArrayList list = new ArrayList();

            while (this.Reader.Read())
            {
                Neusoft.HISFC.Models.Base.DepartmentStat info = PrepareData();

                list.Add(info);
            }
            this.Reader.Close();

            return(list);
        }
コード例 #2
0
        /// <summary>
        /// 根据父级节点和父级科室,在树型控件中插入一个新的子节点
        /// </summary>
        /// <param name="node">父级节点</param>
        /// <param name="dept">父级科室</param>
        public void AddDepartment(TreeNode node, Neusoft.HISFC.Models.Base.DepartmentStat dept)
        {
            //将添加的节点显示在TreeView中
            TreeNode deptNode = new TreeNode(dept.DeptName);

            deptNode.Text = dept.DeptName;
            if (dept.NodeKind == 0)
            {
                deptNode.ImageIndex = 1;  //分类
            }
            else
            {
                deptNode.ImageIndex = 2; //科室
            }
            deptNode.SelectedImageIndex = deptNode.ImageIndex;
            deptNode.Tag = dept;
            node.Nodes.Add(deptNode);

            //将此科室付与其父级科室的Childs属性。
            Neusoft.HISFC.Models.Base.DepartmentStat parentDept = node.Tag as Neusoft.HISFC.Models.Base.DepartmentStat;
            if (parentDept != null)
            {
                parentDept.Childs.Add(dept);
            }
        }
コード例 #3
0
        /// <summary>
        /// 根据父级节点和父级科室,在树型控件中递归显示其子节点
        /// </summary>
        /// <param name="statNode">父级节点位置</param>
        /// <param name="stat">父级科室</param>
        private void AddStatNode(TreeNode statNode, Neusoft.HISFC.Models.Base.DepartmentStat stat)
        {
            if (stat.Childs.Count > 0)
            {
                //将所有儿子节点显示在树型控件中
                foreach (Neusoft.HISFC.Models.Base.DepartmentStat child in stat.Childs)
                {
                    //{31FD985A-A165-4812-8CBE-CA2E2C7B9A7B}  更新科室名称
                    if (this.deptNameDictionary.ContainsKey(child.DeptCode))
                    {
                        child.DeptName = this.deptNameDictionary[child.DeptCode];
                    }

                    TreeNode node = new TreeNode(child.DeptName);
                    node.Text        = child.DeptName;
                    node.ToolTipText = child.DeptName;
                    if (child.NodeKind == 0)
                    {
                        node.ImageIndex = 1;  //分类
                    }
                    else
                    {
                        node.ImageIndex = 2; //科室
                    }
                    node.SelectedImageIndex = node.ImageIndex;

                    node.Tag = child;
                    statNode.Nodes.Add(node);
                    //插入完本节点后,继续找其子节点
                    AddStatNode(node, child);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// 取科室分类数据,保存在实体中
        /// </summary>
        /// <returns></returns>
        private Neusoft.HISFC.Models.Base.DepartmentStat PrepareData()
        {
            Neusoft.HISFC.Models.Base.DepartmentStat info = new Neusoft.HISFC.Models.Base.DepartmentStat();

            try {
                info.PkID       = this.Reader[0].ToString();
                info.StatCode   = this.Reader[1].ToString();
                info.PardepCode = this.Reader[2].ToString();
                info.PardepName = this.Reader[3].ToString();
                info.DeptCode   = this.Reader[4].ToString();
                info.DeptName   = this.Reader[5].ToString();
                info.SpellCode  = this.Reader[6].ToString();
                info.WBCode     = this.Reader[7].ToString();
                info.NodeKind   = Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[8]);
                info.GradeCode  = Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[9]);
                info.SortId     = Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[10]);
                info.ValidState = (EnumValidState)Neusoft.FrameWork.Function.NConvert.ToInt32(this.Reader[11]);
                info.ExtFlag    = FrameWork.Function.NConvert.ToBoolean(this.Reader[12].ToString());
                info.Ext1Flag   = FrameWork.Function.NConvert.ToBoolean(this.Reader[13].ToString());
                info.Memo       = this.Reader[14].ToString();
            }
            catch (Exception e) {
                this.ErrCode = e.Message;
                this.Err     = e.Message;
                return(null);
            }

            return(info);
        }
コード例 #5
0
        /// <summary>
        /// 取科室分类中全部科室列表
        /// </summary>
        /// <returns></returns>
        public ArrayList LoadAll()
        {
            string sql = "";

            if (this.Sql.GetSql("Manager.DepartmentStatManager.LoadAll", ref sql) == -1)
            {
                return(null);
            }

            if (this.ExecQuery(sql) == -1)
            {
                return(null);
            }

            ArrayList list = new ArrayList();

            while (this.Reader.Read())
            {
                Neusoft.HISFC.Models.Base.DepartmentStat info = PrepareData();

                list.Add(info);
            }
            this.Reader.Close();

            return(list);
        }
コード例 #6
0
 /// <summary>
 /// 要插入的子节点插入在父级节点下
 /// </summary>
 /// <param name="parentNode">父级节点</param>
 /// <param name="node">要插入的节点</param>
 public void AddDepartment(TreeNode parentNode, TreeNode node)
 {
     //在父级节点中插入子节点
     parentNode.Nodes.Add(node);
     //将父级节点转换成科室。
     Neusoft.HISFC.Models.Base.DepartmentStat parentDept = parentNode.Tag as Neusoft.HISFC.Models.Base.DepartmentStat;
     if (parentDept != null)
     {
         Neusoft.HISFC.Models.Base.DepartmentStat dept = node.Tag as Neusoft.HISFC.Models.Base.DepartmentStat;
         parentDept.Childs.Add(dept);
     }
     //选中当前节点
     this.SelectedNode = node;
 }
コード例 #7
0
        /// <summary>
        /// 根据统计分类编码,儿子科室编码提取其父级节点科室信息。
        /// </summary>
        /// <param name="statCode">统计分类编码</param>
        /// <param name="deptCode">科室编码(儿子科室)</param>
        /// <returns></returns>
        public ArrayList LoadByChildren(string statCode, string deptCode)
        {
            string sql = "";

            if (this.Sql.GetSql("Manager.DepartmentStatManager.LoadAll", ref sql) == -1)
            {
                return(null);
            }

            string sqlWhere = "";

            if (this.Sql.GetSql("Manager.DepartmentStatManager.LoadByChildren", ref sqlWhere) == -1)
            {
                return(null);
            }

            try {
                sql = string.Format(sql + " " + sqlWhere, statCode, deptCode);
            }
            catch (Exception ex) {
                this.ErrCode = ex.Message;
                this.Err     = " " + ex.Message;
                this.WriteErr();
                return(null);
            }

            //执行sql语句
            if (this.ExecQuery(sql) == -1)
            {
                return(null);
            }

            ArrayList list = new ArrayList();

            while (this.Reader.Read())
            {
                Neusoft.HISFC.Models.Base.DepartmentStat info = PrepareData();
                if (info == null)
                {
                    this.Reader.Close();
                    return(null);
                }
                list.Add(info);
            }

            this.Reader.Close();
            return(list);
        }
コード例 #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="statCode"></param>
        /// <param name="endNode"></param>
        /// <returns></returns>
        public ArrayList LoadByNodeKind(string statCode, bool endNode)
        {
            int nodeKind = 1;

            if (endNode)
            {
                nodeKind = 1;
            }
            else
            {
                nodeKind = 0;
            }
            string sql = "";

            if (this.Sql.GetSql("Manager.DepartmentStatManager.LoadByStatNodeKind", ref sql) == -1)
            {
                return(null);
            }

            try {
                sql = string.Format(sql, statCode, nodeKind);
            }
            catch (Exception ex) {
                this.ErrCode = ex.Message;
                this.Err     = " " + ex.Message;
                this.WriteErr();
                return(null);
            }

            if (this.ExecQuery(sql) == -1)
            {
                return(null);
            }

            ArrayList list = new ArrayList();

            while (this.Reader.Read())
            {
                Neusoft.HISFC.Models.Base.DepartmentStat info = PrepareData();

                list.Add(info);
            }
            this.Reader.Close();

            return(list);
        }
コード例 #9
0
        /// <summary>
        /// 更新科室分类表中的一条记录
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public int UpdateDepartmentStat(Neusoft.HISFC.Models.Base.DepartmentStat info)
        {
            //取SQL语句
            string strSql = "";

            if (this.Sql.GetSql("Manager.DepartmentStatManager.UpdateDepartmentStat", ref strSql) == -1)
            {
                return(-1);
            }

            //替换参数
            try {
                strSql = string.Format(strSql,
                                       info.PkID,
                                       info.StatCode,                                      //统计大类
                                       info.PardepCode,                                    //父级科室编码
                                       info.PardepName,                                    //父级科室名称
                                       info.DeptCode,                                      //科室编码
                                       info.DeptName,                                      //科室名称
                                       info.SpellCode,                                     //拼音码
                                       info.WBCode,                                        //五笔码
                                       info.NodeKind,                                      //节点类型
                                       info.GradeCode,                                     //节点等级
                                       info.SortId,                                        //排序
                                       ((int)info.ValidState).ToString(),                  //是否有效
                                       FrameWork.Function.NConvert.ToInt32(info.ExtFlag),  //扩展标记
                                       FrameWork.Function.NConvert.ToInt32(info.Ext1Flag), //扩展标记
                                       info.Memo,                                          //备注
                                       this.Operator.ID);                                  //操作人
            }
            catch (Exception ex) {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(-1);
            }

            try {
                return(this.ExecNoQuery(strSql));
            }
            catch (Exception ex) {
                this.ErrCode = ex.Message;
                this.Err     = ex.Message;
                return(-1);
            }
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="stat"></param>
        /// <param name="state"></param>
        /// <param name="deptStats"></param>
        private void RecursionDept(Neusoft.HISFC.Models.Base.DepartmentStat stat, Array state, ArrayList deptStats)
        {
            //if(stat.NodeKind == 1) return;
            int index = 0;

            foreach (Neusoft.HISFC.Models.Base.DepartmentStat info in deptStats)
            {
                if ((int)state.GetValue(index) == 0)
                {
                    if (stat.DeptCode == info.PardepCode && stat.StatCode == info.StatCode)
                    {
                        stat.Childs.Add(info);
                        state.SetValue(1, index);                       //state[index] = 1;
                        RecursionDept(info, state, deptStats);
                    }
                }
                ++index;
            }
        }
コード例 #11
0
        /// <summary>
        /// 根据操作员编码提取操作员可以登录的科室信息。{36DEFA19-3650-443f-A173-E2A355FA00C2}
        /// </summary>
        /// <param name="operCode"></param>
        /// <returns></returns>
        public ArrayList GetMultiDeptNewForNurser(string operCode)
        {
            string sql = "";

            if (this.Sql.GetSql("Manager.DepartmentStatManager.GetMultiDeptNewForNuser", ref sql) == -1)
            {
                return(null);
            }

            try
            {
                sql = string.Format(sql, operCode);
            }
            catch (Exception ex)
            {
                this.ErrCode = ex.Message;
                this.Err     = " " + ex.Message;
                this.WriteErr();
                return(null);
            }

            //执行sql语句
            if (this.ExecQuery(sql) == -1)
            {
                return(null);
            }

            ArrayList list = new ArrayList();

            while (this.Reader.Read())
            {
                Neusoft.HISFC.Models.Base.DepartmentStat info = PrepareData();
                if (info == null)
                {
                    this.Reader.Close();
                    return(null);
                }
                list.Add(info);
            }
            this.Reader.Close();

            return(list);
        }
コード例 #12
0
        /// <summary>
        /// 根据传入的科室实体,找出其所属分类
        /// </summary>
        /// <param name="stat"></param>
        /// <returns></returns>
        private TreeNode SearchParentNode(Neusoft.HISFC.Models.Base.DepartmentStat stat)
        {
            //在一级节点中找科室的所属分类
            foreach (TreeNode node in this.Nodes)
            {
                if (node.Tag.ToString() == stat.StatCode)
                {
                    return(node);
                }
            }

            //如果在一级节点中找不到科室的所属分类,则增加一个统计分类
            TreeNode statnode = new TreeNode(stat.StatCode);

            statnode.Tag         = stat.StatCode;
            statnode.Text        = stat.StatCode;
            statnode.ToolTipText = stat.StatCode;
            this.Nodes.Add(statnode);
            return(statnode);
        }
コード例 #13
0
 /// <summary>
 /// 删除传入的节点
 /// </summary>
 /// <param name="node">待删除的节点</param>
 public void DelDepartment(TreeNode node)
 {
     try
     {
         //将此科室从其父级科室的Childs属性中删除。
         Neusoft.HISFC.Models.Base.DepartmentStat parentDept = node.Parent.Tag as Neusoft.HISFC.Models.Base.DepartmentStat;
         //将节点删除
         node.Remove();
         if (parentDept != null)
         {
             //取本级科室信息
             Neusoft.HISFC.Models.Base.DepartmentStat dept = node.Tag as Neusoft.HISFC.Models.Base.DepartmentStat;
             parentDept.Childs.Remove(dept);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return;
     }
 }