public bool Execute() { if (IsOpenInterface == false) { Open(); } if (OperationId == null) { throw new Exception("请先给业务号赋值!"); } if (IsComplete == false) { throw new Exception("当前业务并没有完成,不允许重新开始业务!"); } int index = 0; int ParamNum = PutParamByName == null ? 0 : PutParamByName.Count; int MaxRecNO = PutRecByName == null ? 0 : PutRecByName.Tables.Count; index = Hygeia.SetDebug(hInterface, HygeiaBaseData.DebugFlag, HygeiaBaseData.AppPath); int ret = Hygeia.Start(hInterface, OperationId); Console.Out.WriteLine("开始业务号:" + OperationId); if (ret < 0) { throw new Exception("开始调用接口:" + GetErrorMessage()); } else { index = Hygeia.Putcol(hInterface, "oper_centerid", HygeiaBaseData.Center_Id); index = Hygeia.Putcol(hInterface, "oper_hospitalid", HygeiaBaseData.HospId); index = Hygeia.Putcol(hInterface, "oper_staffid", "000"); } //传入参数 if (ParamNum > 0) { //Console.Out.WriteLine(PutParamByName.GetEnumerator()); for (int i = 0; i < ParamNum; i++) { index = Hygeia.Putcol(hInterface, PutParamByName.ToList()[i].Key, PutParamByName.ToList()[i].Value); Console.Out.WriteLine("传入参数:" + PutParamByName.ToList()[i].Key + " " + PutParamByName.ToList()[i].Value); if (index < 0) { throw new Exception("传入参数失败:" + GetErrorMessage()); } } } //传入数据集 if (MaxRecNO > 0) { Console.Out.WriteLine("传入数据集:" + PutRecByName.GetXml()); //表 for (int i = 0; i < MaxRecNO; i++) { //设置记录集 index = SetResultset(PutRecByName.Tables[i].TableName); //行 for (int j = 0; j < PutRecByName.Tables[i].Rows.Count; j++) { //列 for (int k = 0; k < PutRecByName.Tables[i].Columns.Count; k++) { string value = PutRecByName.Tables[i].Rows[j][k] == DBNull.Value ? "" : PutRecByName.Tables[i].Rows[j][k].ToString(); index = Hygeia.Put(hInterface, j + 1, PutRecByName.Tables[i].Columns[k].ColumnName, value); if (index < 0) { throw new Exception("传入数据集:" + GetErrorMessage()); } } } } } index = Hygeia.Run(hInterface); if (index < 0) { throw new Exception("运行失败:" + GetErrorMessage()); } //获取结果 return(true); }
/// <summary> /// 执行 /// </summary> /// <returns></returns> public bool Execute() { if (IsOpenInterface == false) { Open(); } if (OperationId == null) { throw new Exception("请先给业务号赋值!"); } if (IsComplete == false) { throw new Exception("当前业务并没有完成,不允许重新开始业务!"); } int MaxRecNO = PutRecByName == null ? 0 : PutRecByName.Tables.Count; int ParamNum = PutParamByName == null ? 0 : PutParamByName.Count; int index; //开始 index = CxNhInterface.Start(OperationId, MaxRecNO); Console.Out.WriteLine("开始业务号:" + OperationId); if (index < 0) { throw new Exception("开始调用接口:" + CxNhInterface.GetMessage()); } IsComplete = false; //传入参数 if (ParamNum > 0) { //Console.Out.WriteLine(PutParamByName.GetEnumerator()); for (int i = 0; i < ParamNum; i++) { index = CxNhInterface.PutParamByName(PutParamByName.ToList()[i].Key, PutParamByName.ToList()[i].Value); Console.Out.WriteLine("传入参数:" + PutParamByName.ToList()[i].Key + " " + PutParamByName.ToList()[i].Value); if (index < 0) { throw new Exception("传入参数:" + CxNhInterface.GetMessage()); } } } //传入数据集 if (MaxRecNO > 0) { Console.Out.WriteLine("传入数据集:" + PutRecByName.GetXml()); //表 for (int i = 0; i < MaxRecNO; i++) { //行 for (int j = 0; j < PutRecByName.Tables[i].Rows.Count; j++) { //列 for (int k = 0; k < PutRecByName.Tables[i].Columns.Count; k++) { string value = PutRecByName.Tables[i].Rows[j][k] == DBNull.Value?"":PutRecByName.Tables[i].Rows[j][k].ToString(); index = CxNhInterface.PutRecByName(i + 1, j + 1, PutRecByName.Tables[i].Columns[k].ColumnName, value); if (index < 0) { throw new Exception("传入数据集:" + CxNhInterface.GetMessage()); } } } } } //运行 index = CxNhInterface.Run(); if (index < 0) { throw new Exception("运行失败:" + CxNhInterface.GetMessage()); } //获取结果 return(true); }