public IHttpActionResult Get(int CurrentPage, string Date = "")
        {
            //申明参数
            int _pageSize = 10;
            int count     = 1;

            try
            {
                UserInfo currentUser = new UserInfoService().GetCurrentUser();
                string   userId      = currentUser == null ? "" : currentUser.UserId;

                PageInfo pageInfo = new PageInfo()
                {
                    PageIndex  = CurrentPage,
                    PageSize   = _pageSize,
                    OrderField = "CreatTime",
                    Order      = OrderEnum.desc
                };
                Expression <Func <HR_FILEUPLOAD, bool> > predicate = p => true;
                if (string.IsNullOrEmpty(Date))
                {
                    predicate = p => p.CREATBY.Equals(userId);
                }
                else
                {
                    DateTime dt_start = DateTime.Parse(Date);
                    DateTime dt_end   = dt_start.AddHours(24);
                    predicate = p => p.CREATBY.Equals(userId) && p.CREATTIME >= dt_start && p.CREATTIME <= dt_end;
                }

                var list = bll.GetList(pageInfo, predicate);
                count = pageInfo.Total / _pageSize;
                if (pageInfo.Total % _pageSize > 0)
                {
                    count += 1;
                }

                Response <IEnumerable <FileUpload> > response = new Response <IEnumerable <FileUpload> >
                {
                    Data       = list,
                    PagesCount = count
                };
                return(Ok(response));
            }
            catch (Exception ex)
            {
                LogHelper.WriteInfo(ex.ToString());
                return(BadRequest("异常"));
            }
        }
        public IHttpActionResult Get(string Id)
        {
            try
            {
                Expression <Func <HR_FILEUPLOAD, bool> > predicate = p => p.FORMID.Equals(Id);

                FileUploadBLL fileBLL = new FileUploadBLL();
                var           list    = fileBLL.GetList(predicate);

                foreach (FileUpload item in list)
                {
                    switch (item.ModelCode)
                    {
                    case "SeeDoctorHistory":
                        item.ModelCode = "0";
                        break;

                    case "LaboratoryResult":
                        item.ModelCode = "1";
                        break;

                    case "ImageExamination":
                        item.ModelCode = "2";
                        break;

                    default:
                        item.ModelCode = "";
                        break;
                    }
                }

                return(Ok(list));
            }
            catch (Exception ex)
            {
                LogHelper.WriteInfo(ex.ToString());
                return(BadRequest("异常"));
            }
        }
Esempio n. 3
0
        public IHttpActionResult Get(int CurrentPage, string ID, string Date = "")
        {
            //申明参数
            int _pageSize = 10;
            int count     = 1;

            try
            {
                string       _creater  = string.Empty;
                UserEventBLL userBLL   = new UserEventBLL();
                UserEvent    userEvent = userBLL.Get(p => p.EVENTID.Equals(ID));
                if (userEvent == null)
                {
                    return(BadRequest("该记录不存在!"));
                }
                _creater = userEvent.FromUser;

                PageInfo pageInfo = new PageInfo()
                {
                    PageIndex  = CurrentPage,
                    PageSize   = _pageSize,
                    OrderField = "CreatTime",
                    Order      = OrderEnum.desc
                };
                Expression <Func <HR_FILEUPLOAD, bool> > predicate = p => true;
                if (string.IsNullOrEmpty(Date))
                {
                    predicate = p => p.CREATBY.Equals(_creater) && (p.FORMID.Equals(ID) || string.IsNullOrEmpty(p.FORMID));
                }
                else
                {
                    DateTime dt_start = DateTime.Parse(Date);
                    DateTime dt_end   = dt_start.AddHours(24);
                    predicate = p => p.CREATBY.Equals(_creater) && p.CREATTIME >= dt_start && p.CREATTIME <= dt_end && (p.FORMID.Equals(ID) || string.IsNullOrEmpty(p.FORMID));
                }

                var list = bll.GetList(pageInfo, predicate);
                count = pageInfo.Total / _pageSize;
                if (pageInfo.Total % _pageSize > 0)
                {
                    count += 1;
                }

                SeeDoctorHistoryBLL    doctorBLL = new SeeDoctorHistoryBLL();
                List <FileUserArrange> data      = new List <FileUserArrange>();
                foreach (FileUpload item in list)
                {
                    FileUserArrange model = new FileUserArrange();
                    model.FileId    = item.FileUploadid;
                    model.CreatTime = item.CreatTime;
                    model.FileName  = item.FileName;
                    model.FilePath  = item.FilePath;
                    model.FormId    = item.FormId;
                    model.Remark    = item.Remark;
                    switch (item.ModelCode)
                    {
                    case "SeeDoctorHistory":
                        model.Type = "0";
                        break;

                    case "LaboratoryResult":
                        model.Type = "1";
                        break;

                    case "ImageExamination":
                        model.Type = "2";
                        break;

                    default:
                        model.Type = "";
                        break;
                    }

                    SeeDoctorHistory doctorHModel = doctorBLL.GetOne(p => p.HISTORYID.Equals(item.FormId));
                    if (doctorHModel != null)
                    {
                        model.Date     = doctorHModel.DIAGNOSISTIME == null ? "" : ((DateTime)doctorHModel.DIAGNOSISTIME).ToString("yyyy-MM-dd");
                        model.Hosiptal = doctorHModel.HOSPITAL;
                    }

                    data.Add(model);
                }

                Response <IEnumerable <FileUserArrange> > response = new Response <IEnumerable <FileUserArrange> >
                {
                    Data       = data,
                    PagesCount = count
                };
                return(Ok(response));
            }
            catch (Exception ex)
            {
                LogHelper.WriteInfo(ex.ToString());
                return(BadRequest("异常"));
            }
        }