Exemplo n.º 1
0
        public ActionResult ExecuteDllEvent(string primaryKey, TEST_PARAM_VIEWMODEL param)// string url)
        {
            var id    = int.Parse(primaryKey);
            var model = _itemService.Get(item => item.SD_ITEM_ID == id);

            try
            {
                var cpats      = new List <UN_SD_CPATS>();
                var detailList = _itemResultService.GetCpatList(model.SD_ID.Value, param.startTime, param.endTime, param.patientId, ref cpats);
                if (cpats.Count == 0)
                {
                    return(Info("没有找到符合条件的入组信息!"));
                }
                _itemService.ExecuteUrl(param.url.Trim(), id, param.clientKey, model, param);
                //更新执行状态表
                if (model.SD_ID != null)
                {
                    _procStateService.DataItemDoExecute(model.SD_ID.Value,
                                                        model.SD_ITEM_ID.ToString());
                    //更新执行日志表
                    var proLog = new PDP_PROC_LOG()
                    {
                        SD_ID           = model.SD_ID,
                        PROC_CAT_CODE   = _procLogService.DataItemCatCode(),
                        PROC_CONTENT_ID = model.SD_ITEM_ID.ToString(),
                        PATIENT_ID      = param.patientId,
                        PROC_URL        = param.url,
                        PROC_STAT_CODE  = 2
                    };
                    if (param.startTime != DateTime.MinValue)
                    {
                        proLog.START_TIME = param.startTime;
                    }
                    if (param.endTime != DateTime.MinValue)
                    {
                        proLog.END_TIME = param.endTime;
                    }
                    _procLogService.Insert(proLog);
                }
                var proc = _procStateService.Get(item => item.PROC_CONTENT_ID == primaryKey && item.SD_ID == model.SD_ID.Value);
                var data = new Dictionary <string, string>
                {
                    { "exeUser", proc.UPD_USER_ID },
                    { "exeTime", proc.UPD_DATE.ToString() }
                };
                return(Success("数据项正在后台执行,可在首页查看进度!", data));// : Error("执行失败!请检查信息是否完整!");
            }
            catch (Exception ex)
            {
                if (model.SD_ID != null)
                {
                    _itemService.InsertErrorLog(model.SD_ID.Value, 1, param.url, "数据项执行失败!异常信息:" + ex.Message, "2");
                }
                return(Error("执行失败!" + ex.ToString()));
            }
        }