/// <summary> /// 23、 模板分类列表 /// </summary> /// <param name="token">token</param> /// <param name="page">分页id(未启用)</param> /// <returns></returns> /// Jerry Shi public TplKindListResponse TplKindList(string token, string page) { try { string ApiResponse = string.Empty; TplKindListResponse tplKindListResponse = new TplKindListResponse(); Dictionary <string, string> sPara = new Dictionary <string, string>(); sPara.Add("page", page); ApiResponse = F8YLSubmit.BuildGetRequest(sPara, "tpl/kind/list?token=" + token); tplKindListResponse = JsonHelper.DeserializeJsonToObject <TplKindListResponse>(ApiResponse); return(tplKindListResponse); } catch { throw; } }
// GET: F8YLMessage public ActionResult MessageIndex(string pageType, string projectId, string hospitalId, string patientId) { //patientId = "93"; //ViewBag.patientId = patientId; var token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString(); // Session["role"] ViewBag.Token = token; var currentUserId = Session["CurrentUserID"] == null ? "-1" : Session["CurrentUserID"].ToString(); var currentUserHospitalID = Session["CurrentUserHospitalID"] == null ? "-1" : Session["CurrentUserHospitalID"].ToString(); var currentUserRole = Session["role"] == null ? "XXXXXXX" : Session["role"].ToString(); string dateParam = Convert.ToString(DateTime.Today.AddMonths(-1).ToString("yyyy-MM-01")); ViewBag.currentUserId = currentUserId; ViewBag.pageType = pageType; ViewBag.projectId = projectId == null ? "-1" : projectId; ViewBag.hospitalId = hospitalId == null ? "-1" : hospitalId; ViewBag.patientId = string.IsNullOrEmpty(patientId) ? currentUserId : patientId; ViewBag.currentUserRole = currentUserRole; List <JoinedProjectEntity> projectList = new List <JoinedProjectEntity>(); //if (currentUserRole != "90") //{ // // 生成项目列表,传递到页面; // ProjectJoined projectJoined = projectRequest.Joined(token); // if (projectJoined.data != null) // { // projectList = projectJoined.data; // } //} // 生成项目列表,传递到页面; ProjectJoined projectJoined = projectRequest.Joined(token, "0"); if (projectJoined.data != null) { projectList = projectJoined.data; } ViewBag.ProjectList = projectList; // 生成用户列表,传递到页面; //HospitalUserProfileResponse hospitalUsers = new HospitalUserProfileResponse(); //hospitalUsers = userRequest.SearchUsers(token, currentUserHospitalID, ""); //ProjectRelativeUserResponse projectRelativeUserResponse = new ProjectRelativeUserResponse(); //projectRelativeUserResponse = projectRequest.ProjectRelativeUsers(token, "", ""); List <UserDataEntity> userList = new List <UserDataEntity>(); string userHospitalID = currentUserHospitalID; if (currentUserRole == "90" || currentUserRole == "80") { if (currentUserRole == "90") { userHospitalID = ""; } HospitalUserProfileResponse hospitalUsers = new HospitalUserProfileResponse(); hospitalUsers = userRequest.SearchUsers(token, userHospitalID, ""); if (hospitalUsers.data != null && hospitalUsers.data.data != null) { foreach (HospitalUserProfileInfo u in hospitalUsers.data.data) { UserDataEntity user = new UserDataEntity(); user.dataId = u.id; user.role = u.role; user.username = u.username; userList.Add(user); } } } else { Dictionary <string, UserDataEntity> messageUserList = projectRequest.GenerageProjectRelativeUsers(token, "", ""); userList = FilterBusersByCurrentUserRole(messageUserList, currentUserRole, currentUserId); } ViewBag.ProjectUsers = userList; // 调用接口,获取发送给自己的消息列表和公告列表 //RecvResponse recvResponseMessage = messageRequest.Recv(token, "0", dateParam, ""); ChatResponse recvResponseMessage = messageRequest.Chat(token, "0"); // 生成消息列表,传递到页面; List <PageMessageEntity> pageMessageList = new List <PageMessageEntity>(); if (recvResponseMessage.data != null) { Dictionary <string, string> usersInfo = new Dictionary <string, string>(); foreach (ChatResponseDataChatEntity item in recvResponseMessage.data.data) { PageMessageEntity pageMessageEntity = new PageMessageEntity(); pageMessageEntity.id = item.id; pageMessageEntity.userid = item.userid; pageMessageEntity.ctime = item.ctime; pageMessageEntity.msg = item.msg; pageMessageEntity.label = ""; pageMessageEntity.username = item.user.username; //if (usersInfo.ContainsKey(item.userid) == true) //{ // pageMessageEntity.username = usersInfo[item.userid]; //} //else //{ // UserProfileResponse user = userRequest.profile(token, item.userid); // if (user.data != null) // { // pageMessageEntity.username = user.data.username; // } // else // { // pageMessageEntity.username = "******"; // } // usersInfo.Add(item.userid, pageMessageEntity.username); //} //bool isExists = false; // foreach (PageMessageEntity msg in pageMessageList) //{ // if (msg.userid == pageMessageEntity.userid) // { // if (Convert.ToDateTime(pageMessageEntity.ctime) > Convert.ToDateTime(msg.ctime)) // { // pageMessageList.Remove(msg); // pageMessageList.Add(pageMessageEntity); // } // isExists = true; // } //} //if (isExists == false) //{ pageMessageList.Add(pageMessageEntity); //} } } //foreach (PageMessageEntity msg in pageMessageList) //{ // ChatResponse chatResponse = messageRequest.Chat(token, msg.userid); // if (chatResponse.data != null) // { // msg.msg = chatResponse.data.data.First<ChatResponseDataChatEntity>().msg; // msg.ctime = chatResponse.data.data.First<ChatResponseDataChatEntity>().ctime; // } //} ViewBag.MessageList = pageMessageList; // 生成公告列表,传递到页面; List <PageMessageEntity> pageBroadcastList = new List <PageMessageEntity>(); if (currentUserRole == "90" || currentUserRole == "80") { RecvResponse recvResponseBroadcast = messageRequest.Recv(token, "10", dateParam, ""); if (recvResponseBroadcast.data != null) { foreach (RecvResponseDataMessageEntity item in recvResponseBroadcast.data.data) { PageMessageEntity pageBroadcastEntity = new PageMessageEntity(); pageBroadcastEntity.id = item.id; pageBroadcastEntity.userid = item.userid; pageBroadcastEntity.ctime = item.ctime; pageBroadcastEntity.msg = item.content; pageBroadcastEntity.url = item.url; //add by jack if (item.label == string.Empty) { pageBroadcastEntity.label = "公告标题"; } else { pageBroadcastEntity.label = item.label; } UserProfileResponse user = userRequest.profile(token, item.userid); pageBroadcastEntity.username = user.data == null ? "OOO" : user.data.username; pageBroadcastList.Add(pageBroadcastEntity); } } } else { foreach (JoinedProjectEntity projectItem in projectList) { RecvResponse recvResponseBroadcast = messageRequest.Recv(token, "10", dateParam, projectItem.id); if (recvResponseBroadcast.data != null) { foreach (RecvResponseDataMessageEntity item in recvResponseBroadcast.data.data) { PageMessageEntity pageBroadcastEntity = new PageMessageEntity(); pageBroadcastEntity.id = item.id; pageBroadcastEntity.userid = item.userid; pageBroadcastEntity.ctime = item.ctime; pageBroadcastEntity.msg = item.content; pageBroadcastEntity.url = item.url; //add by jack if (item.label == string.Empty) { pageBroadcastEntity.label = "公告标题"; } else { pageBroadcastEntity.label = item.label; } UserProfileResponse user = userRequest.profile(token, item.userid); pageBroadcastEntity.username = user.data == null ? "OOO" : user.data.username; pageBroadcastList.Add(pageBroadcastEntity); } } } } ViewBag.BroadcastList = pageBroadcastList; //取模板类型列表 TplKindListResponse tplkindList = tplRequest.TplKindList(token, "1"); ViewBag.tplkindList = tplkindList; //取第一个分类下的所有模板 TplListResponse tpllistDefault = tplRequest.TplList(token, tplkindList.data[0].id, ""); ViewBag.tpllistDefault = tpllistDefault; return(View()); }