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("异常")); } }
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)); } }