Ejemplo n.º 1
0
        // GET: F8YLManage
        public ActionResult ManageIndex()
        {
            try
            {
                var token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString();
                ViewBag.Token = token;
                if (token == "XXXXXXX")//未登录返回首页
                {
                    return(RedirectToAction("Index", "F8YLHome"));
                }

                UserRequest            user     = new UserRequest();
                HospitalSearchResponse hsr      = new HospitalSearchResponse();
                HospitalSearchResponse hsr80    = new HospitalSearchResponse();
                UserProfileResponse    userFile = user.profile(token, "");
                //Session["ManageUserRole"] = userFile.data.role;
                if (Convert.ToInt32(userFile.data.role) < 80)//只有医院管理员(80)和后台管理员(90)账号才能访问管理页面
                {
                    return(Content("<script>alert('此用户无权限访问,请使用医院或者后台管理员账号。');window.location.href='/F8YLHome/Index';</script>"));
                }


                if (userFile != null)
                {
                    hsr = hospitalRequest.Search(token, 1, "");
                }
                if (userFile.data.role == "80")
                {
                    hsr80.code      = hsr.code;
                    hsr.message     = hsr.message;
                    hsr80.data      = new HospitalSearchEntity();
                    hsr80.data.data = new List <HospitalEntity>();
                    hsr80.data.data.Add(hsr.data.data.Find(x => x.id == userFile.data.hospitalid));
                    hsr = hsr80;
                }
                ViewBag.LoginUserRole = userFile.data.role;
                ViewBag.UserFile      = userFile.data;
                ViewBag.HospitalList  = hsr;
            }
            catch (Exception ex)
            {
                AppLog.Instance.Write("ManageIndex", AppLog.LogMessageType.Error, ex);
            }
            return(View());
        }
Ejemplo n.º 2
0
        //ProjectDetail
        public ActionResult ProjectDetail(string id)
        {
            var token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString();

            ViewBag.role     = Session["role"] == null ? "XXXXXXX" : Session["role"].ToString();
            ViewBag.username = Session["username"] == null ? "XXXXXXX" : Session["username"].ToString();

            ViewBag.sessionHospitalid = Session["hospitalid"] == null ? "XXXXXXX" : Session["hospitalid"].ToString();


            //实体
            ProjectDetailResponse projectDetailResponse = new ProjectDetailResponse();

            HospitalRequest hospitalrequest = new HospitalRequest();

            HospitalSearchResponse response = new HospitalSearchResponse();                  //医院列表

            HospitalUserProfileResponse hospitalprofile = new HospitalUserProfileResponse(); //医院pi

            ProjectTplListResponse tplListResponse = new ProjectTplListResponse();           //模板列表

            TplDetailResponse tpldetailresponse = new TplDetailResponse();                   //模板详情

            //方法
            UserRequest userrequest = new UserRequest();

            ViewBag.UserFile = userrequest.profile(token, "").data;

            ProjectRequest projecttplrequest = new ProjectRequest();

            //TplRequest tplrequest = new TplRequest();

            List <HospitalUserProfileResponse> listhospitalfrofile = new List <HospitalUserProfileResponse>();

            string apiResponse = string.Empty;

            try
            {
                projectDetailResponse = projectRequest.detail(token, id);

                if (projectDetailResponse.data != null)
                {
                    if (projectDetailResponse.data.tpl == null)
                    {
                        projectDetailResponse.data.tpl = new List <ProjectDetailTplInfo>();
                    }

                    //模板列表
                    tplListResponse = projecttplrequest.ProjectTplList(token, projectDetailResponse.data.id, "", 1);

                    if (tplListResponse.data != null)
                    {
                        //列表detail
                        tpldetailresponse = tplrequest.TplDetail(token, tplListResponse.data.data[0].tplid);
                    }

                    //医院列表
                    response = hospitalrequest.Search(token, 1, "");

                    //医院pi
                    if (response.data != null)
                    {
                        foreach (HospitalEntity hs in response.data.data)
                        {
                            hospitalprofile = userrequest.SearchHospitalPi(token, hs.id, "");
                            if (hospitalprofile.data != null)
                            {
                                listhospitalfrofile.Add(hospitalprofile);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            ViewBag.TplList        = tplListResponse;     //tpllist
            ViewBag.hospitalSearch = response;            //hospitallist
            ViewBag.hopital        = listhospitalfrofile; //pi
            ViewBag.TplDetail      = tpldetailresponse;   //tpldetail
            ViewBag.Token          = token;
            return(View(projectDetailResponse));
        }