Example #1
0
        // [ValidateAntiForgeryToken]
        public ActionResult GetDoctorList()
        {
            ResponseBase <List <GetDoctorListResponse> > response = new ResponseBase <List <GetDoctorListResponse> >();

            response.IsSuccess = false;
            response.Reason    = "系统出错,请联系管理员";

            try
            {
                var doctorList = doctorApp.GetList(item => true).ToList();
                var visitList  = visitApp.GetList(item => true).ToList();
                List <GetDoctorListResponse> responseDoctorList = new List <GetDoctorListResponse>();
                if (doctorList != null && doctorList.Any())
                {
                    foreach (var doctor in doctorList)
                    {
                        GetDoctorListResponse doctorResponse = new GetDoctorListResponse();
                        doctorResponse.DoctorId   = doctor.DoctorId;
                        doctorResponse.DoctorName = doctor.DoctorName;
                        // doctorResponse.Avatar = doctor.Avatar;
                        doctorResponse.Avatar    = "/imgs/pic-doc.png";
                        doctorResponse.GootAt    = doctor.GootAt;
                        doctorResponse.VisitList = new List <int>();
                        if (visitList != null && visitList.Any())
                        {
                            //获取每周出诊信息
                            List <int> weekVisit = visitList.Where(item => item.DoctorId == doctor.DoctorId && (item.Morning == true || item.Afternoon == true || item.Night == true)).Select(item => item.Week).ToList();
                            if (weekVisit != null && weekVisit.Any())
                            {
                                doctorResponse.VisitList.AddRange(weekVisit);
                            }
                        }

                        responseDoctorList.Add(doctorResponse);
                    }
                    response.Result = responseDoctorList;
                }
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
            }
            return(Content(response.ToJson()));
        }
Example #2
0
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            var data = new
            {
                rows    = VisitApp.GetList(pagination, keyword),
                total   = pagination.total,
                page    = pagination.page,
                records = pagination.records
            };

            return(Content(data.ToJson()));
        }
Example #3
0
        /// <summary>
        /// 任务详情,单据需要什么 取什么数据
        /// </summary>
        /// <param name="id">任务id</param>
        /// <returns></returns>
        public ApiResult <dynamic> Details()
        {
            ApiResult <dynamic> api = new ApiResult <dynamic>();

            try
            {
                string      id           = Common.GetString("id");
                TaskApp     taskApp      = new TaskApp();
                var         taskData     = taskApp.GetForm(id);
                CustomerApp customerApp  = new CustomerApp();
                var         customerData = customerApp.GetForm(taskData.F_CustomerId);
                UserApp     userApp      = new UserApp();
                var         userData     = userApp.GetForm(taskData.F_UserId);
                VisitApp    visitApp     = new VisitApp();
                var         model        = visitApp.GetList(id).OrderByDescending(d => d.F_CreatorTime).FirstOrDefault();
                var         visitData    = visitApp.GetForm(model == null ? string.Empty : model.F_Id);
                var         data         = new
                {
                    VisitData      = visitData,
                    F_Shop_Name    = customerData.F_Shop_Name,
                    F_Shop_Address = customerData.F_Shop_Address,
                    F_Name         = customerData.F_Name,
                    F_Tel          = customerData.F_Tel,
                    F_User_Name    = userData.F_RealName,
                    F_Task_Time    = taskData.F_CreatorTime,
                    F_User_Tel     = userData.F_MobilePhone,
                    F_Status       = GetName(taskData.F_Status)
                };
                api.Message = "获取成功";
                api.Status  = true;
                api.Result  = data;
                return(api);
            }
            catch (Exception e)
            {
                api.Message = e.Message;
                return(api);
            }
        }