public string GetTplDetai() { string jsonDetailTpl = string.Empty; try { var token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString(); TplRequest tr = new TplRequest(); //TplDetailResponse tpl10 = new TplDetailResponse(); //TplDetailResponse tpl11 = new TplDetailResponse(); TplDetailResponse tpldetail = new TplDetailResponse(); List <TplDetailResponse> listTplDetail = new List <TplDetailResponse>(); TplListResponse tpllist = tr.TplList(token, "", ""); foreach (var tpl in tpllist.data.data) { tpldetail = tr.TplDetail(token, tpl.id); if (tpldetail.code == 0) { //if (tpldetail.data.id == "10" || tpldetail.data.id == "11" || tpldetail.data.id == "12") //{ //tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) - Convert.ToInt32(right.sharpid))); //tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid2) - Convert.ToInt32(right.sharpid2))); ////tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.termid) - Convert.ToInt32(right.termid))); tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.termid) - Convert.ToInt32(right.termid))); tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid2) - Convert.ToInt32(right.sharpid2))); tpldetail.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) - Convert.ToInt32(right.sharpid))); listTplDetail.Add(tpldetail); //} } } //tpl10 = tr.TplDetail(token, "10"); //tpl11 = tr.TplDetail(token, "11"); //if (tpl10.code == 0) //{ // tpl10.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) + Convert.ToInt32(left.sharpid2)) - (Convert.ToInt32(right.sharpid) + Convert.ToInt32(right.sharpid2))); // listTplDetail.Add(tpl10); //} //if (tpl11.code == 0) //{ // tpl11.data.tpl_detail.Sort((left, right) => (Convert.ToInt32(left.sharpid) + Convert.ToInt32(left.sharpid2)) - (Convert.ToInt32(right.sharpid) + Convert.ToInt32(right.sharpid2))); // listTplDetail.Add(tpl11); //} jsonDetailTpl = JsonHelper.SerializeObject(listTplDetail); ViewBag.listTplDetail = jsonDetailTpl; } catch (Exception ex) { AppLog.Instance.Write("GetTplDetai", AppLog.LogMessageType.Error, ex); } return(jsonDetailTpl); }
public string GetTplListByKindId(string kindid) { string strJson = string.Empty; try { var token = Session["token"] == null ? "XXXXXXX" : Session["token"].ToString(); TplRequest tr = new TplRequest(); TplListResponse tpllist = tr.TplList(token, kindid, ""); strJson = JsonHelper.SerializeObject(tpllist); } catch (Exception ex) { AppLog.Instance.Write("GetTplListByKindId", AppLog.LogMessageType.Error, ex); } return(strJson); }
// 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()); }