Example #1
0
        public IHttpActionResult Get(string id, int currentPage)
        {
            //数据异常判断处理
            if (string.IsNullOrEmpty(id))
            {
                return(BadRequest("数据异常"));
            }

            //查询数据
            IEnumerable <SeeDoctorHistory> _list = new List <SeeDoctorHistory>();
            int count = 1;

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

                _list = _repository.GetList(p => p.PERSONID == userEvent.FromUser);

                count = _list.Count();
                int _pageSize = 10;
                _list = _list.Skip((currentPage - 1) * _pageSize).Take(_pageSize);
                SeeDoctorHistoryBLL seeDoctorBLL = new SeeDoctorHistoryBLL();
                foreach (SeeDoctorHistory item in _list)
                {
                    item.ICD10 = seeDoctorBLL.GetICD10(item.HISTORYID);
                }

                count = count / _pageSize;
                if (count % _pageSize > 0)
                {
                    count += 1;
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.ToString());
                return(BadRequest(ex.Message));
            }

            Response <IEnumerable <object> > response = new Response <IEnumerable <object> >();

            response.Data       = _list;
            response.PagesCount = count;

            //返回
            return(Ok(response));
        }
Example #2
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="keyword"></param>
        /// <returns></returns>
        public IHttpActionResult Get(string uid, int currentPage, string keyword = "")
        {
            //数据异常判断处理
            if (string.IsNullOrEmpty(uid))
            {
                return(BadRequest("数据异常"));
            }

            //查询数据
            var list = new List <SeeDoctorHistory>();

            //int count = 1;
            try
            {
                Response <IEnumerable <SeeDoctorHistory> > response = new Response <IEnumerable <SeeDoctorHistory> >();
                SeeDoctorHistoryBLL sBll = new SeeDoctorHistoryBLL();

                PageInfo pageInfo = new PageInfo()
                {
                    PageIndex  = currentPage,
                    PageSize   = 10,
                    OrderField = "DIAGNOSISTIME",
                    Order      = OrderEnum.desc
                };

                list                = sBll.GetSeeDoctorHistories(pageInfo, keyword, uid);
                response.Data       = list;
                response.PagesCount = pageInfo.PagesCount;
                return(Ok(response));
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.ToString());
                return(BadRequest(ex.Message));
            }
        }
Example #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("异常"));
            }
        }
Example #4
0
        public IHttpActionResult Post([FromBody] Request <UserArrangeItem> request)
        {
            try
            {
                //获取数据
                UserArrangeItem         item      = request.Data;
                string                  eventID   = item.EventID;
                string                  historyID = item.HistoryId;
                string                  uid       = string.Empty;
                bool                    createNew = item.CreateNew;
                string                  remark    = item.Remark;
                IList <FileUserArrange> files     = item.Files;

                //申明返回
                string content = string.Empty;

                UserEventBLL userBLL   = new UserEventBLL();
                UserEvent    userEvent = userBLL.Get(p => p.EVENTID.Equals(eventID));
                if (userEvent == null)
                {
                    return(Json(new { Result = "no", Msg = "参数错误,\n请输入用户信息" }));
                }

                SeeDoctorHistoryBLL doctorBLL    = new SeeDoctorHistoryBLL();
                SeeDoctorHistory    doctorHModel = new SeeDoctorHistory();
                if (createNew)
                {
                    doctorHModel.PERSONID = userEvent.FromUser;
                    doctorHModel.REMARK   = remark;
                    historyID             = doctorBLL.Add(doctorHModel);
                }
                else
                {
                    doctorHModel        = doctorBLL.GetOne(p => p.HISTORYID.Equals(historyID));
                    doctorHModel.REMARK = remark;
                    doctorBLL.Edit(doctorHModel);
                }

                foreach (FileUserArrange file in files)
                {
                    //申明参数
                    string _formId    = string.Empty;
                    string _modelName = string.Empty;
                    string _modelCode = string.Empty;
                    switch (file.Type)
                    {
                    case "0":
                        _modelName = "病历";
                        _modelCode = "SeeDoctorHistory";
                        break;

                    case "1":
                        _modelName = "实验室检查结果";
                        _modelCode = "LaboratoryResult";
                        break;

                    case "2":
                        _modelName = "影像学检查结果";
                        _modelCode = "ImageExamination";
                        break;

                    default:
                        break;
                    }

                    //获取数据
                    FileUpload model = bll.Get(p => p.FILEUPLOADID.Equals(file.FileId));
                    if (model == null)
                    {
                        return(Json(new { Result = "false", ID = "" }));
                    }

                    model.ModelCode = _modelCode;
                    model.ModelName = _modelName;
                    model.FormId    = historyID;
                    bll.Edit(model);
                }

                SendEvent(userEvent, historyID);
                return(Json(new { Result = "ok", ID = historyID, Uid = userEvent.FromUser }));
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.ToString());
                return(BadRequest(ex.Message));
            }
        }