12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028 |
-
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Net;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using PTMedicalInsurance.Helper;
- using Newtonsoft.Json;
- using PTMedicalInsurance.Common;
- using PTMedicalInsurance.Variables;
- using System.Runtime.InteropServices;
- using PTMedicalInsurance.Forms;
- namespace PTMedicalInsurance.Helper
- {
- class InvokeHelper
- {
- private string serviceURL;
- private string authorization;
-
-
-
-
-
-
-
-
-
- [DllImport("CHSInterface.dll", EntryPoint = "Init", CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
- static extern int Init(string fixmedins_code, string infosyscode, string infosyssign, string url, StringBuilder pErrMsg);
-
-
-
-
-
-
-
-
-
-
- [DllImport("CHSInterface.dll", EntryPoint = "DownloadFile", CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
- static extern int DownloadFile(string fixmedins_code, string infosyscode, string infosyssign, string inputData, StringBuilder outputData, StringBuilder pErrMsg);
-
-
-
-
-
-
-
-
-
-
- [DllImport("CHSInterface.dll", EntryPoint = "UploadFile", CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
- static extern int UploadFile(string fixmedins_code, string infosyscode, string infosyssign, string fileName,string inputData, StringBuilder outputData, StringBuilder pErrMsg);
-
-
-
-
-
-
-
-
-
-
- [DllImport("CHSInterface.dll", EntryPoint = "BusinessHandle", CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
- static extern int BusinessHandle(string fixmedins_code, string infosyscode, string infosyssign, string inputData, StringBuilder outputData, StringBuilder errmsg);
-
-
-
-
-
-
-
-
-
-
- [DllImport("CHSInterface.dll", EntryPoint = "BusinessHandleW", CharSet = CharSet.Unicode, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
- static extern int BusinessHandleW(StringBuilder fixmedins_code, StringBuilder infosyscode, StringBuilder infosyssign, StringBuilder inputData, StringBuilder outputData, StringBuilder errmsg);
- public InvokeHelper()
- {
- IniFile ini = new IniFile(Global.curEvt.path + @"\CenterServiceURL.ini");
-
- if (Global.inf.interfaceDr == 12)
- {
- Global.inf.uploadURL = "http://10.88.29.31:80/fsi/api/fileupload/upload";
- Global.inf.downURL = "http://10.88.29.31:80/fsi/api/fileupload/download";
- Global.inf.ecURL = "http://10.67.0.49:8080/localcfc/api/hsecfc/localQrCodeQuery";
- }
- if (Global.inf.interfaceDr == 16)
- {
- Global.inf.uploadURL = "http://10.67.240.56:80/fsi/api/fileupload/upload";
- Global.inf.downURL = "http://10.67.240.56:80/fsi/api/fileupload/download";
- Global.inf.ecURL = "http://10.66.159.55:8080/localcfc/api/hsecfc/localQrCodeQuery";
- }
-
-
-
- }
-
-
-
-
-
-
-
- public JObject invokeIrisService(string data, string serviceDesc)
- {
- string rtn = "", url = "";
- JObject joRtn = new JObject();
- try
- {
-
- url = serviceURL;
- ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
- ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
-
- HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
-
- byte[] buf = System.Text.Encoding.GetEncoding("UTF-8").GetBytes(data);
-
- myRequest.Method = "POST";
- myRequest.ContentLength = buf.Length;
- myRequest.ContentType = "application/json";
- myRequest.Headers.Add("Authorization", authorization);
- myRequest.MaximumAutomaticRedirections = 1;
- myRequest.AllowAutoRedirect = true;
-
- Stream stream = myRequest.GetRequestStream();
- stream.Write(buf, 0, buf.Length);
- stream.Close();
-
-
- HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
- rtn = getResponseData(myResponse);
- joRtn = JObject.Parse(rtn);
- return joRtn;
- }
- catch (Exception ex)
- {
- joRtn = JsonHelper.setExceptionJson(-1, serviceDesc, ex.Message);
- rtn = JsonConvert.SerializeObject(joRtn);
- return joRtn;
- }
- }
-
-
-
-
-
-
- public JObject invokeHISService(string data, string serviceDesc)
- {
- JObject joRtn = new JObject();
- try
- {
-
- serviceURL = string.Format("{0}/{1}", Global.hisConfig.ip, Global.hisConfig.url);
- authorization = Global.hisConfig.authorization;
- joRtn = invokeIrisService(data, serviceDesc);
- return joRtn;
- }
- catch (Exception ex)
- {
- joRtn = JsonHelper.setExceptionJson(-1, serviceDesc, ex.Message);
- return joRtn;
- }
- finally
- {
- Global.writeLog_Iris(serviceDesc + "(" + serviceURL + ")" + "Authorization:" + (authorization), JsonHelper.Compress(data), JsonHelper.Compress(joRtn));
- }
- }
-
-
-
-
-
- public JObject invokeInsuService(string data, string serviceDesc)
- {
- string rtn = "";
- JObject joRtn = new JObject();
- try
- {
-
- serviceURL = string.Format("{0}/{1}", Global.insuConfig.ip, Global.insuConfig.url);
- authorization = Global.insuConfig.authorization;
- joRtn = invokeIrisService(data, serviceDesc);
- rtn = JsonConvert.SerializeObject(joRtn);
-
-
-
-
- return joRtn;
- }
- catch (Exception ex)
- {
- joRtn = JsonHelper.setExceptionJson(-1, serviceDesc, ex.Message);
- rtn = JsonConvert.SerializeObject(joRtn);
- return joRtn;
- }
- finally
- {
- Global.writeLog_Iris(serviceDesc + "(" + serviceURL + ")" + "Authorization:" + (authorization), JsonHelper.Compress(data), rtn);
- }
- }
-
-
-
-
-
- private JObject invokeCenterService(string data)
- {
- string postContent = "";
- JObject joRtn = new JObject();
- try
- {
- Global.writeLog(string.Format("调用中心{0}接口入参:{1}",data, Global.curEvt.URL));
-
-
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Global.curEvt.URL);
-
- request.Method = "POST";
-
-
-
-
-
-
- request.ContentType = "application/json";
-
-
-
-
-
-
-
-
-
-
- string paraUrlCoded = data;
- byte[] payload;
-
- payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
-
- request.ContentLength = payload.Length;
-
- Stream writer;
- writer = request.GetRequestStream();
-
- writer.Write(payload, 0, payload.Length);
- writer.Close();
-
- HttpWebResponse response = null;
- try
- {
-
- response = (HttpWebResponse)request.GetResponse();
- }
- catch (Exception ex)
- {
- return JsonHelper.setExceptionJson(-99, "centerServeiceInvok中获得响应流异常", ex.Message);
- }
- postContent = getResponseData(response);
- joRtn = JObject.Parse(postContent);
- if (joRtn.ContainsKey("body")) {
- joRtn = (JObject)joRtn.GetValue("body");
- }
- return joRtn;
- }
- catch (Exception ex)
- {
- postContent = "调用中心服务异常" + ex.Message;
- joRtn.Add("infcode", -1);
- joRtn.Add("err_msg", "invokeCenterService(1):" + ex.Message);
- return joRtn;
- }
- }
- private string getResponseData(HttpWebResponse response) {
- string data = "";
- if (response != null)
- {
- Stream s = response.GetResponseStream();
- StreamReader sRead = new StreamReader(s);
- data = sRead.ReadToEnd();
- sRead.Close();
- response.Close();
- }
- return data;
- }
-
-
-
-
-
-
-
-
-
-
- private int invokeDownloadFileByDLL(string fixmedins_code, string infosyscode, string infosyssign, string inputData, ref string outputData, ref string pErrMsg)
- {
- pErrMsg = "";
- outputData = "";
- try
- {
- StringBuilder errmsgSb = new StringBuilder(4096);
- StringBuilder outSb = new StringBuilder(40960);
- int pRtn = DownloadFile(fixmedins_code, infosyscode, infosyssign, inputData, outSb, errmsgSb);
- if (pRtn < 0)
- {
- pErrMsg = errmsgSb.ToString();
- return -1;
- }
- else
- {
- outputData = outSb.ToString();
- }
- return pRtn;
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.DownloadFile 异常:" + ex.Message;
- return -1;
- }
- finally
- {
- Global.writeLog("invokeInitByDLL.DownloadFile 医保动态库文件下载函数", inputData, outputData);
- }
- }
-
-
-
-
-
-
- public JObject invokeCenterService(string funNO, JObject data)
- {
- JObject joRtn = new JObject();
- string outPar = "";
- try
- {
-
- if (Global.curEvt.enabledDebug)
- {
- CenterResult center = new CenterResult();
- center.setTradeNo(funNO);
- if (center.ShowDialog() == DialogResult.OK)
- {
- outPar = center.returnData;
- return JObject.Parse(outPar);
- }
- }
-
- string prefix = Global.inf.centerURL;
- switch (funNO)
- {
- case "9101":
- prefix = Global.inf.uploadURL;
- break;
- case "9102":
- prefix = Global.inf.downURL;
- break;
- default:
- prefix = Global.inf.centerURL;
- break;
- }
- Global.curEvt.URL = prefix + funNO;
- joRtn = invokeCenterService(data.ToString());
- outPar = JsonHelper.Compress(joRtn);
- return joRtn;
- }
- catch (Exception ex)
- {
- if (joRtn["infcode"] == null)
- { joRtn.Add("infcode", -1); }
- if (joRtn["err_msg"] == null)
- { joRtn.Add("err_msg", "invokeCenterService(2):" + ex.Message); }
- outPar = JsonHelper.Compress(joRtn);
- return joRtn;
- }
- finally
- {
- Global.writeLog(funNO + "(" + Global.curEvt.URL + ")", JsonHelper.Compress(data), joRtn.ToString());
- this.saveCenterLog(JsonHelper.Compress(data), joRtn.ToString(), JsonHelper.Compress(data), joRtn.ToString());
- }
- }
-
-
-
-
-
-
- public JObject invokeCenterService(string funNO, string data)
- {
- JObject joRtn = new JObject();
- try
- {
-
- if (Global.curEvt.enabledDebug)
- {
- CenterResult center = new CenterResult();
- center.setTradeNo(funNO);
- if (center.ShowDialog() == DialogResult.OK)
- {
- string outPar = center.returnData;
- return JObject.Parse(outPar);
- }
- }
-
- Global.curEvt.URL = Global.inf.centerURL + funNO;
- joRtn = invokeCenterService(data);
- return joRtn;
- }
- catch (Exception ex)
- {
- if (joRtn["infcode"] == null)
- { joRtn.Add("infcode", -1); }
- if (joRtn["err_msg"] == null)
- { joRtn.Add("err_msg", "invokeCenterService(3):" + ex.Message); }
- return joRtn;
- }
- finally
- {
- Global.writeLog(funNO + "(" + Global.curEvt.URL + ")", JsonHelper.Compress(data), joRtn.ToString());
- this.saveCenterLog(JsonHelper.Compress(data), joRtn.ToString(), JsonHelper.Compress(data), joRtn.ToString());
- }
- }
-
-
-
-
-
-
- public JObject invokeMPService(string funNO, string data)
- {
- JObject joRtn = new JObject();
- String outPar = "";
- try
- {
-
- Global.curEvt.URL = Global.inf.centerURL + funNO;
- joRtn = invokeCenterService(data);
- outPar = JsonHelper.Compress(joRtn);
- return joRtn;
-
- }
- catch (Exception ex)
- {
- if (joRtn["infcode"] == null)
- { joRtn.Add("infcode", -1); }
- if (joRtn["err_msg"] == null)
- { joRtn.Add("err_msg", "invokeCenterService(3):" + ex.Message); }
- outPar = JsonHelper.Compress(joRtn);
- return joRtn;
- }
- finally
- {
- Global.writeLog(funNO + "(" + Global.curEvt.URL + ")", JsonHelper.Compress(data), joRtn.ToString());
- this.saveCenterLog(JsonHelper.Compress(data), joRtn.ToString(), JsonHelper.Compress(data), joRtn.ToString());
- }
- }
-
-
-
-
-
-
- private void invokeSetDirByOCX(ref string pErrMsg)
- {
- try
- {
-
-
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.SetDir 异常:" + ex.Message;
- MessageBox.Show(pErrMsg);
- }
- finally
- {
-
- }
- }
-
-
-
-
-
- public JObject DownloadCenterFile(string data)
- {
- string error = string.Empty; int errorCode = 0;
- string sRtn = "";
- try
- {
- JObject jsonInParam = JObject.Parse(data);
-
- Utils.removeWrapper(jsonInParam);
- string fileName = (string)jsonInParam["input"]["fsDownloadIn"]["filename"];
- string filePath = Global.curEvt.path + "\\Download\\" + fileName;
-
- if (!Directory.Exists(Global.curEvt.path + "\\Download"))
- {
-
- DirectoryInfo dirInfo = Directory.CreateDirectory(Global.curEvt.path + "\\Download");
- }
- if (File.Exists(filePath))
- {
- File.Delete(filePath);
- }
- FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
-
- Global.curEvt.URL = Global.inf.downURL;
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Global.curEvt.URL);
-
- request.Method = "POST";
-
-
-
-
-
-
- request.ContentType = "application/json";
-
-
-
-
-
-
-
-
-
-
- string paraUrlCoded = JsonHelper.toJsonString(jsonInParam);
- byte[] payload;
-
- payload = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
-
- request.ContentLength = payload.Length;
- Stream writer;
- try
- {
- writer = request.GetRequestStream();
- }
- catch (Exception)
- {
- writer = null;
- errorCode = -100;
- error = "连接服务器失败!";
- }
-
- writer.Write(payload, 0, payload.Length);
- writer.Close();
-
-
- HttpWebResponse response = request.GetResponse() as HttpWebResponse;
-
- Stream responseStream = response.GetResponseStream();
-
- byte[] bArr = new byte[1024];
- int iTotalSize = 0;
- int size = responseStream.Read(bArr, 0, (int)bArr.Length);
- while (size > 0)
- {
- iTotalSize += size;
- fs.Write(bArr, 0, size);
- size = responseStream.Read(bArr, 0, (int)bArr.Length);
- }
- fs.Close();
- responseStream.Close();
- dynamic joReturn = new JObject();
- joReturn.errorCode = errorCode;
- joReturn.errorMessage = error;
- joReturn.filePath = filePath;
- sRtn = joReturn.ToString();
- return joReturn;
- }
- catch (Exception ex)
- {
- errorCode = -100;
- error = ex.Message;
- dynamic joReturn = new JObject();
- joReturn.errorCode = errorCode;
- joReturn.errorMessage = error;
- sRtn = joReturn.ToString();
- return joReturn;
- }
- finally
- {
- Global.writeLog("DownloadCenterFile" +"(" + Global.curEvt.URL + ")", data, sRtn);
- }
- }
-
-
-
-
-
-
-
-
-
- private int invokeInitByOCX(string fixmedins_code, string infosyscode, string infosyssign, string url, ref string pErrMsg)
- {
-
- JObject joRtn = new JObject();
- try
- {
-
-
-
- if (joRtn["infcode"].ToString() != "0")
- {
- pErrMsg = joRtn["err_msg"].ToString();
- return -1;
- }
- else
- {
- return 0;
- }
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.Init 异常:" + ex.Message;
- return -1;
- }
- finally
- {
- Global.writeLog("invokeInitByDLL.Init医保动态库初始化(" + url + ")", "", pErrMsg);
- }
- }
-
-
-
-
-
-
-
-
-
-
- private int invokeBusiessByOCX(string fixmedins_code, string infosyscode, string infosyssign, string inputData, ref string outputData, ref string pErrMsg)
- {
- pErrMsg = "";
- outputData = "";
- JObject joRtn = new JObject();
- try
- {
- try
- {
-
-
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.SetDir 异常:" + ex.Message;
- MessageBox.Show(pErrMsg);
- }
- finally
- {
-
- }
- inputData = inputData.Replace("\n", "").Replace("\t", "").Replace("\r", "");
-
-
-
-
-
- if (joRtn["infcode"].ToString() != "0")
- {
- pErrMsg = joRtn["err_msg"].ToString();
-
- return -1;
- }
- else
- {
-
- return 0;
- }
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.BusinessHandle 异常:" + ex.Message;
- return -1;
- }
- finally
- {
- Global.writeLog("invokeInitByDLL.BusinessHandle医保动态库通用业务函数", inputData, outputData);
- }
- }
-
-
-
-
-
- public JObject DownloadCenterFileByDll(string data)
- {
- string error = string.Empty; int errorCode = 0;
- string sRtn = "";
- try
- {
- JObject jsonInParam = JObject.Parse(data);
- string fileName = (string)jsonInParam["input"]["fsDownloadIn"]["filename"];
- string filePath = Global.curEvt.path + "\\Download\\" + fileName;
-
- if (!Directory.Exists(Global.curEvt.path + "\\Download"))
- {
-
- DirectoryInfo dirInfo = Directory.CreateDirectory(Global.curEvt.path + "\\Download");
- }
- if (File.Exists(filePath))
- {
- File.Delete(filePath);
- }
- FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
-
- Global.curEvt.URL = Global.inf.centerURL;
- int iRes = invokeDownloadFileByDLL(Global.inf.hospitalNO, Global.inf.CreditID, Global.inf.BusinessID, data.ToString(),ref sRtn, ref error);
- if (iRes == 0)
- {
- dynamic joReturn = new JObject();
- joReturn.errorCode = errorCode;
- joReturn.errorMessage = error;
- joReturn.filePath = filePath;
- sRtn = joReturn.ToString();
- return joReturn;
- }
- else
- {
- errorCode = -100;
- dynamic joReturn = new JObject();
- joReturn.errorCode = errorCode;
- joReturn.errorMessage = error;
- sRtn = joReturn.ToString();
- return joReturn;
- }
- }
- catch (Exception ex)
- {
- errorCode = -100;
- error = ex.Message;
- dynamic joReturn = new JObject();
- joReturn.errorCode = errorCode;
- joReturn.errorMessage = error;
- sRtn = joReturn.ToString();
- return joReturn;
- }
- finally
- {
- Global.writeLog("DownloadCenterFile" + "(" + Global.curEvt.URL + ")", data, sRtn);
- }
- }
-
-
-
-
-
-
-
- private void saveCenterLog(string inParam, string outParam, string inParamPlain, string outParamPlain)
- {
- dynamic joIris = new JObject();
- string sRtn = "";
- try
- {
-
- JObject joInParam = new JObject(JObject.Parse(inParam));
-
- JObject joIn = Utils.removeWrapper(joInParam);
- JObject joOut = new JObject(JObject.Parse(outParam));
- JObject joInPlain = new JObject(JObject.Parse(inParamPlain));
- JObject joOutPlain = new JObject(JObject.Parse(outParamPlain));
- JArray jaParams = new JArray();
- JObject joParam = new JObject();
- joParam.Add("inParam", JObject.FromObject(joIn));
- joParam.Add("outParam", JObject.FromObject(joOut));
- joParam.Add("inParamPlain", JObject.FromObject(joInPlain));
- joParam.Add("outParamPlain", JObject.FromObject(joOutPlain));
- joParam.Add("HospitalDr", Global.inf.hospitalDr);
- joParam.Add("InterfaceDr", Global.inf.interfaceDr);
- joParam.Add("updateUserID", Global.user.ID);
- joParam.Add("psn_no", Global.pat.psn_no);
- jaParams.Add(joParam);
- joIris.code = "09010021";
- joIris.Add("params", jaParams);
-
- sRtn = invokeInsuService(joIris.ToString(), "保存日志到数据库").ToString();
- }
- catch (Exception ex)
- {
- sRtn = JsonHelper.setExceptionJson(-100, "保存日志异常", ex.Message).ToString();
- Global.writeLog_Iris("保存日志异常:" + sRtn.ToString());
- }
- }
-
- public int InvokeInitByDLL(ref string pErrMsg)
- {
-
- int pRtn =-1;
- JObject joRtn = new JObject();
- try
- {
- StringBuilder outSb = new StringBuilder(40960);
- pRtn = Init(Global.inf.hospitalNO, Global.inf.CreditID, Global.inf.BusinessID, Global.inf.centerURL, outSb);
- if (pRtn != 0)
- {
- pErrMsg = outSb.ToString();
- return -1;
- }
- else
- {
- return 0;
- }
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.Init 异常:" + ex.Message;
- return -1;
- }
- finally
- {
- Global.writeLog("InvokeInitByDLL(" + Global.inf.centerURL + ")", Global.inf.CreditID +":" + Global.inf.BusinessID,pRtn.ToString() + pErrMsg);
- }
- }
- private int invokeBusiessByDLL(string inputData, ref string outputData, ref string pErrMsg)
- {
- pErrMsg = "";
- outputData = "";
- JObject joRtn = new JObject();
- try
- {
- inputData = inputData.Replace("\n", "").Replace("\t", "").Replace("\r", "");
- StringBuilder errmsgSb = new StringBuilder(4096);
- StringBuilder outSb = new StringBuilder(40960);
-
- int pRtn = BusinessHandle(Global.inf.hospitalNO, Global.inf.CreditID, Global.inf.BusinessID, inputData, outSb, errmsgSb);
- if (pRtn != 0)
- {
- outputData = outSb.ToString();
- pErrMsg = errmsgSb.ToString();
- return -1;
- }
- else
- {
- outputData = outSb.ToString();
- return 0;
- }
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.BusinessHandle 异常:" + ex.Message;
- return -1;
- }
- finally
- {
- Global.writeLog("CreditID11", Global.inf.CreditID, Global.inf.BusinessID);
- Global.writeLog("invokeInitByDLL.BusinessHandle医保动态库通用业务函数", inputData, outputData);
- }
- }
- private int invokeBusiessWByDLL(string inputData, ref string outputData, ref string pErrMsg)
- {
- pErrMsg = "";
- outputData = "";
- JObject joRtn = new JObject();
- try
- {
-
- StringBuilder errmsgSb = new StringBuilder(4096);
- StringBuilder outSb = new StringBuilder(40960);
- StringBuilder sbHospitalNO = new StringBuilder(Global.inf.hospitalNO);
- StringBuilder sbCreditID = new StringBuilder(Global.inf.CreditID);
- StringBuilder sbBusinessID = new StringBuilder(Global.inf.BusinessID);
- StringBuilder sbInput = new StringBuilder(inputData);
-
- int pRtn = BusinessHandleW(sbHospitalNO, sbCreditID, sbBusinessID, sbInput, outSb, errmsgSb);
- if (pRtn != 0)
- {
- outputData = outSb.ToString();
- pErrMsg = errmsgSb.ToString();
- return -1;
- }
- else
- {
- outputData = outSb.ToString();
- return 0;
- }
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeInitByDLL.BusinessHandle 异常:" + ex.Message;
- return -1;
- }
- finally
- {
- Global.writeLog("CreditID12", Global.inf.CreditID, Global.inf.BusinessID);
- Global.writeLog("invokeInitByDLL.BusinessHandleW医保动态库通用业务函数", inputData, outputData);
- }
- }
- private int invokeUploadFileByDLL(string inputData, ref string outputData, ref string pErrMsg)
- {
- pErrMsg = "";
- outputData = "";
- JObject joRtn = new JObject();
- try
- {
- inputData = inputData.Replace("\n", "").Replace("\t", "").Replace("\r", "");
- StringBuilder errmsgSb = new StringBuilder(4096);
- StringBuilder outSb = new StringBuilder(40960);
-
- int pRtn = UploadFile(Global.inf.hospitalNO, Global.inf.CreditID, Global.inf.BusinessID, Global.inf.fileName,inputData, outSb, errmsgSb);
- if (pRtn != 0)
- {
- outputData = outSb.ToString();
- pErrMsg = errmsgSb.ToString();
- return -1;
- }
- else
- {
- outputData = outSb.ToString();
- return 0;
- }
- }
- catch (Exception ex)
- {
- pErrMsg = "invokeUploadFileByDLL.UploadFile 异常:" + ex.Message;
- return -1;
- }
- finally
- {
- Global.writeLog("invokeUploadFileByDLL.UploadFile医保动态库上传业务函数", inputData, outputData);
- }
- }
- }
- }
|