Esempio n. 1
0
        public ActionResult GetOrgsJson(bool forSearch = true)
        {
            SystemBLL bll   = new SystemBLL();
            var       orgs  = bll.GetOrgs(null);
            var       items = new Dictionary <string, string>();

            if (forSearch)
            {
                items.Add("", "不限考核主体");
            }
            foreach (var item in orgs)
            {
                items.Add(item.ORGID, item.ORGNAME);
            }
            return(ToJsonResult(SetComboBoxValue(items)));
        }
Esempio n. 2
0
        /// <summary>
        /// 科室列表
        /// </summary>
        /// <param name="keyword">关键字</param>
        /// <returns>返回机构+科室树形Json</returns>
        public ActionResult GetMorTreeJson(string value)
        {
            //var organizedata = organizeCache.GetList();
            var mordata = sysBLL.GetOrgs(null).ToList();
            //var departmentdata = departmentBLL.GetList();
            //var offiecesdata = sysBLL.GetPMR008OffiecesList();
            string parentId = value == null ? "ROOT" : value;
            //var filterdata = areaBLL.GetList(parentId).ToList();
            var filterdata = sysBLL.GetPMR002MorDeptList(parentId).ToList();
            var treeList   = new List <TreeEntity>();

            foreach (PMR001MorEntity item in mordata)
            {
                #region 机构
                TreeEntity tree = new TreeEntity();
                //bool hasChildren = organizedata.Count(t => t.PARENTORG == item.ORGCODE) == 0 ? false : true;
                bool hasChildren = false;
                if (hasChildren == false)
                {
                    //hasChildren = offiecesdata.Count(t => t.ORGID == item.ORGID) == 0 ? false : true;
                    hasChildren = filterdata.Count(t => t.ORGID == item.ORGID) == 0 ? false : true;
                    if (hasChildren == false)
                    {
                        continue;
                    }
                }
                tree.id    = item.ORGID;
                tree.text  = item.ORGNAME;
                tree.value = item.ORGID;
                //tree.parentId = item.PARENTORG;
                tree.parentId       = item.PID == "ROOT" ? "0" : item.PID;
                tree.isexpand       = true;
                tree.complete       = true;
                tree.hasChildren    = hasChildren;
                tree.Attribute      = "Sort";
                tree.AttributeValue = "Organize-" + item.ID;
                treeList.Add(tree);
                #endregion
            }
            foreach (PMR002MorDeptEntity item in filterdata)
            {
                #region 部门
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = filterdata.Count(t => t.PARENTDEPT == item.DEPTID) == 0 ? false : true;
                tree.id    = item.DEPTID;
                tree.text  = item.DEPTNAME;
                tree.value = item.DEPTID;
                if (item.PARENTDEPT == "ROOT")
                {
                    tree.parentId = item.ORGID;
                    //tree.parentId = item.ORGID;
                }
                else
                {
                    tree.parentId = item.PARENTDEPT;
                }
                tree.isexpand       = true;
                tree.complete       = true;
                tree.hasChildren    = hasChildren;
                tree.Attribute      = "Sort";
                tree.AttributeValue = "Department-" + item.ORGID;
                //tree.AttributeValue = item.ToJson();
                treeList.Add(tree);
                #endregion
            }

            return(Content(treeList.TreeToJson()));
        }
Esempio n. 3
0
        /// <summary>
        /// 科室列表
        /// </summary>
        /// <param name="keyword">关键字</param>
        /// <returns>返回机构+科室树形Json</returns>

        #region 获取数据
        public ActionResult GetMorTreeJson(string value)
        {
            var    mordata      = sysBLL.GetOrgs(null).ToList();
            string parentId     = value == null ? "ROOT" : value;
            var    orgdata      = sysBLL.GetPMR002MorDeptList(parentId).ToList();
            var    organizedata = sysBLL.Get005Orgs(null).ToList();
            var    offiecesdata = sysBLL.GetPMR008OffiecesList();
            var    treeList     = new List <TreeEntity>();

            foreach (PMR001MorEntity item in mordata)
            {
                #region 机构
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = false;
                if (hasChildren == false)
                {
                    hasChildren = orgdata.Count(t => t.ORGID == item.ORGID) == 0 ? false : true;
                    if (hasChildren == false)
                    {
                        hasChildren = organizedata.FirstOrDefault() != null;
                        if (hasChildren == false)
                        {
                            continue;
                        }
                    }
                }
                tree.id          = item.ORGID;
                tree.text        = item.ORGNAME;
                tree.value       = item.ORGID;
                tree.parentId    = item.PID == "ROOT" ? "0" : item.PID;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.Attribute   = "Sort";
                //tree.AttributeValue = "Organize-" + item.ID;
                tree.AttributeValue = "Mor";
                treeList.Add(tree);
                #endregion
            }
            foreach (PMR002MorDeptEntity item in orgdata)
            {
                #region 部门
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = orgdata.Count(t => t.PARENTDEPT == item.DEPTID) == 0 ? false : true;
                tree.id    = item.DEPTID;
                tree.text  = item.DEPTNAME;
                tree.value = item.DEPTID;
                if (item.PARENTDEPT == "ROOT")
                {
                    tree.parentId = item.ORGID;
                }
                else
                {
                    tree.parentId = item.PARENTDEPT;
                }
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.Attribute   = "Sort";
                //tree.AttributeValue = "Department-" + item.ORGID;
                tree.AttributeValue = "Department";
                treeList.Add(tree);
                #endregion
            }

            foreach (PMR005OrgEntity item in organizedata)
            {
                #region 机构
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = organizedata.Count(t => t.PARENTORG == item.ORGCODE) == 0 ? false : true;
                if (hasChildren == false)
                {
                    hasChildren = offiecesdata.Count(t => t.ORGID == item.ORGID) == 0 ? false : true;
                    if (hasChildren == false)
                    {
                        continue;
                    }
                }
                tree.id    = item.ORGCODE;
                tree.text  = item.MANAGERORGNAME;
                tree.value = item.ORGCODE;
                //tree.parentId = item.PARENTORG;
                //tree.parentId = item.PARENTORG == "ROOT" ? "0" : item.PARENTORG;
                if (item.PARENTORG == "ROOT")
                {
                    if (mordata != null && mordata.Count > 0)
                    {
                        tree.parentId = mordata.FirstOrDefault().ORGID;
                    }
                    else
                    {
                        tree.parentId = "0";
                    }
                }
                else
                {
                    tree.parentId = item.PARENTORG;
                }
                tree.isexpand       = true;
                tree.complete       = true;
                tree.hasChildren    = hasChildren;
                tree.Attribute      = "Sort";
                tree.AttributeValue = "Organize";
                treeList.Add(tree);
                #endregion
            }
            foreach (PMR008OffiecesEntity item in offiecesdata)
            {
                #region 部门
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = false;
                tree.id             = item.ID;
                tree.text           = item.OFFICENAME;
                tree.value          = item.ID;
                tree.parentId       = item.ORGID;
                tree.isexpand       = true;
                tree.complete       = true;
                tree.hasChildren    = hasChildren;
                tree.Attribute      = "Sort";
                tree.AttributeValue = "Department";
                treeList.Add(tree);
                #endregion
            }
            return(Content(treeList.TreeToJson()));
        }