public IHttpActionResult Post([FromBody] Request <IList <FileUpload> > request)
        {
            try
            {
                //获取参数
                string             eventID    = request.ID;
                IList <FileUpload> list       = request.Data;
                string             newEventID = Guid.NewGuid().ToString();

                //更新文件列表
                FileUploadBLL fileBLL  = new FileUploadBLL();
                string        fromUser = string.Empty;
                foreach (FileUpload item in list)
                {
                    item.FormId = newEventID;
                    fromUser    = item.CreatBy;
                    fileBLL.Edit(item);
                }

                bool result = bll.CloseEvent(eventID);
                if (result)
                {
                    UserInfo currentUser = new UserInfoService().GetCurrentUser();
                    string   _name       = currentUser == null ? "" : currentUser.LoginName;

                    UserEvent userEvent = bll.Get(p => p.EVENTID.Equals(eventID));
                    string    _applyId  = userEvent == null ? "" : userEvent.UserApplyId;

                    UserEvent newUEvent = new UserEvent();
                    newUEvent.EventID      = newEventID;
                    newUEvent.UserApplyId  = _applyId;
                    newUEvent.FromUser     = fromUser;
                    newUEvent.ActionType   = ((int)ActionType.待办事项).ToString();
                    newUEvent.ActionInfo   = string.Format("您收到了用户{0}上传的病历资料,请整理", _name);
                    newUEvent.ReceiptTime  = DateTime.Now;
                    newUEvent.ActionStatus = ((int)ActionStatus.Progress).ToString();
                    newUEvent.CreateTime   = DateTime.Now;
                    newUEvent.LinkUrl      = "UserArrange";

                    bll.AddUserEvent(newUEvent, UserType.医学编辑);
                }

                return(Ok("ok"));
            }
            catch (Exception ex)
            {
                LogHelper.WriteInfo(ex.ToString());
                return(BadRequest("异常"));
            }
        }
        public IHttpActionResult Post([FromBody] Request <IList <FileUpload> > request)
        {
            try
            {
                IList <FileUpload> list = request.Data;
                foreach (FileUpload item in list)
                {
                    item.FormId = "";
                    bll.Edit(item);
                }

                return(Ok("ok"));
            }
            catch (Exception ex)
            {
                LogHelper.WriteInfo(ex.ToString());
                return(BadRequest("异常"));
            }
        }
        public IHttpActionResult Post([FromBody] Request <IList <FileUpload> > request)
        {
            try
            {
                IList <FileUpload> files   = request.Data;
                FileUploadBLL      fileBLL = new FileUploadBLL();
                foreach (FileUpload file in files)
                {
                    switch (file.ModelCode)
                    {
                    case "0":
                        file.ModelName = "病历";
                        file.ModelCode = "SeeDoctorHistory";
                        break;

                    case "1":
                        file.ModelName = "实验室检查结果";
                        file.ModelCode = "LaboratoryResult";
                        break;

                    case "2":
                        file.ModelName = "影像学检查结果";
                        file.ModelCode = "ImageExamination";
                        break;

                    default:
                        break;
                    }

                    fileBLL.Edit(file);
                }

                return(Ok("ok"));
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.ToString());
                return(BadRequest(ex.Message));
            }
        }
Beispiel #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));
            }
        }
        public IHttpActionResult Post([FromBody] Request <TreatmentRequest> request)
        {
            try
            {
                IList <FileUpload> files        = request.Data.files;
                UserEvent          u            = request.Data.userEvent;
                string             eventID      = u.EventID;
                string             newEventID   = Guid.NewGuid().ToString();
                UserEvent          userEvent    = bll.Get(p => p.EVENTID.Equals(eventID));
                UserEvent          serviceEvent = bll.Get(p => p.REMARKS == eventID && p.USERAPPLYID == userEvent.UserApplyId && p.ACTIONSTATUS == "1");
                if (userEvent == null)
                {
                    return(BadRequest("该记录不存在!"));
                }

                //更新文件列表
                FileUploadBLL fileBLL  = new FileUploadBLL();
                string        fromUser = userEvent.ToUser;
                foreach (FileUpload item in files)
                {
                    item.FormId = newEventID;
                    fileBLL.Edit(item);
                }

                userEvent.Remarks      = u.Remarks;
                userEvent.ActionType   = "1";
                userEvent.ActionStatus = ((int)ActionStatus.Complete).ToString();
                userEvent.EndTime      = DateTime.Now;
                bool result = bll.Edit(userEvent);

                #region 结束客服待办
                if (serviceEvent != null)
                {
                    serviceEvent.ActionStatus = ((int)ActionStatus.Complete).ToString();
                    serviceEvent.EndTime      = DateTime.Now;
                    bll.Edit(serviceEvent);
                }
                #endregion

                if (result)
                {
                    UserInfo currentUser = new UserInfoService().GetCurrentUser();
                    string   _name       = currentUser == null ? "" : currentUser.LoginName;

                    UserEvent newUEvent = new UserEvent();
                    newUEvent.EventID      = newEventID;
                    newUEvent.UserApplyId  = userEvent.UserApplyId;
                    newUEvent.FromUser     = fromUser;
                    newUEvent.ActionType   = ((int)ActionType.待办事项).ToString();
                    newUEvent.ActionInfo   = string.Format("您收到了用户{0}上传的病历资料,请整理", _name);
                    newUEvent.ReceiptTime  = DateTime.Now;
                    newUEvent.ActionStatus = ((int)ActionStatus.Progress).ToString();
                    newUEvent.CreateTime   = DateTime.Now;
                    newUEvent.LinkUrl      = "UserArrange";

                    bll.AddUserEvent(newUEvent, UserType.医学编辑);
                }
                return(Ok("ok"));
            }
            catch (Exception ex)
            {
                LogService.WriteErrorLog("DoTreatmentController[Post]", ex.ToString());
                return(BadRequest(ex.ToString()));
            }
        }