public static async Task <ObservableCollection <NewsCommentModel> > GetNewsComments(int id)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/NewsComment/Gets", new Dictionary <string, string>
            {
                { "Id", id.ToString() }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObCollection <NewsCommentModel>(content, out string msg)));
        }
        public static async Task <IEnumerable <RecipeRecordPreviewModel> > GetTimeLinePreview(string idNo, int year)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/UserRecipeRecord/GetPageByIdNoYear", new Dictionary <string, string>
            {
                { "IdNo", idNo }, { "Year", year.ToString() },
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseList <RecipeRecordPreviewModel>(content, out string msg)));
        }
        public static async Task <ObservableCollection <NewsModel> > GetCollectNewsDetails(Guid userId)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/UserCollectNews/GetsNewsDetail", new Dictionary <string, string>
            {
                { "uid", userId.ToString() }
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObCollection <NewsModel>(content, out string msg)));
        }
        public static async Task <NewsPageModel> GetNews(PageInquireModel page)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/News/GetsPage", new Dictionary <string, string>
            {
                { "Index", page.Index.ToString() }, { "Size", page.Size.ToString() }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(function : () => ParseResponseJsonContent.ParseObj <NewsPageModel>(content, out string msg)));
        }
        public static async Task <NewsModel> GetNewsDetail(int id)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/News/Get", new Dictionary <string, string>
            {
                { "Id", id.ToString() }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObj <NewsModel>(content, out string msg)));
        }
        public static async Task <ChatMainModel> GetChatInfo(Guid userId, Guid anotherId)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/ChatMain/Get", new Dictionary <string, string>
            {
                { "userId", userId.ToString() }, { "anotherId", anotherId.ToString() },
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObj <ChatMainModel>(content, out string msg)));
        }
        public static async Task <ObservableCollection <ChatContentViewModel> > GetChatContent(int chatId)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/ChatContent/Gets", new Dictionary <string, string>
            {
                { "chatId", chatId.ToString() }
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObCollection <ChatContentViewModel>(content, out string msg)));
        }
        public static async Task <ObservableCollection <ReserveDoctorViewModel> > GetReserveDoctors(Guid uid)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/UserReserveRecord/Gets", new Dictionary <string, string>
            {
                { "uid", uid.ToString() }
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObCollection <ReserveDoctorViewModel>(content, out string msg)));
        }
        public static async Task <List <FollowDoctorModel> > GetStartDoctors(Guid userId)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/UserFollowDoctor/Gets", new Dictionary <string, string>
            {
                { "uid", userId.ToString() }
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return((List <FollowDoctorModel>) await Task.Run(() => ParseResponseJsonContent.ParseList <FollowDoctorModel>(content, out string msg)));
        }
        public static async Task <ObservableCollection <DoctorViewModel> > GetDoctorsByName(string hosCode, string name)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/DoctorInfo/GetsByName", new Dictionary <string, string>
            {
                { "hosCode", hosCode }, { "name", name }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObCollection <DoctorViewModel>(content, out string msg)));
        }
        public static async Task <PageDataModel <DoctorViewModel> > GetDoctorsPage(string hosCode, int index, int size)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/DoctorInfo/GetsPage", new Dictionary <string, string>
            {
                { "hosCode", hosCode }, { "index", index.ToString() }, { "size", size.ToString() }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseObj <PageDataModel <DoctorViewModel> >(content, out string msg)));
        }
        public static async Task <IEnumerable <HospitalViewModel> > GetHospitalsByName(string input)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/HospitalInfo/GetsByName", new Dictionary <string, string>
            {
                { "name", input }
            });
            string content = await RestClientUtil.GetUnTokenAsync(url);

            return(await Task.Run(() => ParseResponseJsonContent.ParseList <HospitalViewModel>(content, out string msg)));
        }
        public static async Task <DoctorViewModel> GetDoctorDetail(Guid doctorId)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/DoctorInfo/Get", new Dictionary <string, string>
            {
                { "id", doctorId.ToString() }
            });
            string msg     = String.Empty;
            string content = await RestClientUtil.GetUnTokenAsync(url);

            var data = await Task.Run(() => ParseResponseJsonContent.ParseObj <DoctorViewModel>(content, out msg));

            if (data == null)
            {
                Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg));
            }
            return(data);
        }
        public static bool CancelReserveDoctor(int id)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/UserReserveRecord/Delete", new Dictionary <string, string>
            {
                { "id", id.ToString() }
            });
            bool res = ParseResponseJsonContent.ParseBool(RestClientUtil.DeleteToken(url), out string msg);

            if (!res)
            {
                Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert(msg));
            }
            else
            {
                Device.BeginInvokeOnMainThread(() => DependencyService.Get <IToast>().ShortAlert("取消预约成功!"));
            }
            return(res);
        }
        public static async Task <ObservableCollection <string> > GetTimeLineYear(string idNo)
        {
            string url = RestClientUtil.GetSpliceUrl("/api/UserRecipeRecord/GetTimeLineByIdNo", new Dictionary <string, string>
            {
                { "IdNo", idNo }
            });
            string content = await RestClientUtil.GetTokenAsync(url);

            return(await Task.Run(() =>
            {
                string msg = String.Empty;
                if (!string.IsNullOrWhiteSpace(content))
                {
                    try
                    {
                        var obj = JsonConvert.DeserializeObject <ResponseBaseModel>(content);
                        if (obj.code == 0)
                        {
                            if (!string.IsNullOrEmpty(obj.data.ToString()))
                            {
                                var temp = JsonConvert.DeserializeObject <ObservableCollection <string> >(obj.data.ToString());
                                msg = obj.msg;
                                return temp;
                            }
                        }
                        msg = obj.msg;
                        return null;
                    }
                    catch (Exception ex)
                    {
                        //logger.ErrorLog($"JSON->List数据反序列化出错!", ex);
                        throw new Exception($"JSON->List数据反序列化出错!", ex);
                    }
                }
                msg = "响应返回数据为空!";
                return null;
            }));
        }