public ActionResult TestDllEvent(string primaryKey, TEST_PARAM_VIEWMODEL param) { var id = int.Parse(primaryKey); var model = _sDataItemService.Get(item => item.SITEM_ID == id); try { var result = _sDataItemService.TestUrl(param.url.Trim(), id, "", model, param); if (result == null) { return(Error("api接口调用失败,url或参数信息不正确!", null)); } //更新执行日志表 var proLog = new PDP_PROC_LOG() { SD_ID = int.Parse(model.SD_ID), PROC_CAT_CODE = _procLogService.SDataItemCatCode(), PROC_CONTENT_ID = model.SITEM_ID.ToString(), PROC_URL = param.url, PATIENT_ID = param.patientId }; if (param.startTime != DateTime.MinValue) { proLog.START_TIME = param.startTime; } if (param.startTime != DateTime.MinValue) { proLog.END_TIME = param.endTime; } _procLogService.Insert(proLog); return(Success("测试成功!", result)); } catch (Exception ex) { if (model.SD_ID != null) { _itemService.InsertErrorLog(int.Parse(model.SD_ID), 2, param.url, "数据项测试失败!异常信息:" + ex.Message, "4"); } return(Error("测试失败!")); } }
public ActionResult TestDllEvent(string primaryKey, TEST_PARAM_VIEWMODEL param) { var id = int.Parse(primaryKey); var model = _itemService.Get(item => item.SD_ITEM_ID == id); try { if (param.url.EndsWith("ManyDataItemApi")) { return(Error("url输入错误!接口应为:DataItemApi")); } var startTime = param.startTime; var endTime = param.endTime; if (param.endTime != DateTime.MinValue) { endTime = Convert.ToDateTime(param.endTime.ToDateString() + " 23:59:59"); } var cpats = new List <UN_SD_CPATS>(); var detailList = _itemResultService.GetCpatList(model.SD_ID.Value, param.startTime, endTime, param.patientId, ref cpats); if (cpats.Count == 0) { return(Info("没有找到符合条件的入组信息!", null)); } var result = _itemService.TestUrl(param.url.Trim(), id, model, param); if (result == null) { return(Error("测试失败!", null)); } //if (result.Count != cpatList.Count) return Error("测试失败!请检查信息填写是否正确!"); //更新执行日志表 var proLog = new PDP_PROC_LOG() { SD_ID = model.SD_ID, PROC_CAT_CODE = _procLogService.DataItemCatCode(), PROC_CONTENT_ID = model.SD_ITEM_ID.ToString(), PROC_URL = param.url, PATIENT_ID = param.patientId }; if (startTime != DateTime.MinValue) { proLog.START_TIME = startTime; } if (startTime != DateTime.MinValue) { proLog.END_TIME = endTime; } _procLogService.Insert(proLog); return(Success("测试成功!", result)); } catch (Exception ex) { if (model.SD_ID != null) { _itemService.InsertErrorLog(model.SD_ID.Value, 2, param.url, "数据项测试失败!异常信息:" + ex.Message, "2"); } return(Error("测试失败!")); } }