InsuBusiness.cs 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using PTMedicalInsurance.Common;
  7. using PTMedicalInsurance.Business;
  8. using System.Windows.Forms;
  9. using PTMedicalInsurance.Helper;
  10. using Newtonsoft.Json.Linq;
  11. using PTMedicalInsurance.Variables;
  12. using PTMedicalInsurance.Forms;
  13. using System.IO;
  14. using System.Reflection;
  15. using System.Data;
  16. using CCunMI.Forms;
  17. namespace PTMedicalInsurance
  18. {
  19. public class InsuBusiness : IInsuBusiness
  20. {
  21. //定义相关的变量
  22. private Patients patient;
  23. private Fees fee;
  24. private Settlements settlement;
  25. //json对象属性
  26. private JObject joInParam;
  27. private JArray jaSession ;
  28. private JArray jaParams;
  29. private JObject joParam;
  30. private JObject joInterface;
  31. //设置业务实例
  32. CenterBusiness cBus = new CenterBusiness();
  33. HisMainBusiness hBus = new HisMainBusiness();
  34. HisIrisServices hIS = new HisIrisServices();
  35. MIIrisServices mIS= new MIIrisServices();
  36. InvokeHelper invoker = new InvokeHelper();
  37. DRGBusiness DrgBus = new DRGBusiness();
  38. private string businessType;
  39. public InsuBusiness()
  40. {
  41. Global.curEvt.path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
  42. ComputerInfo comp = new ComputerInfo();
  43. Global.curEvt.mac = comp.GetMAC();
  44. Global.curEvt.ip = comp.GetIP();
  45. Global.pat.insuplc_admdvs = ""; //如果是NULL中心会报错
  46. }
  47. private int parseInparam(string inParam,out string errMsg)
  48. {
  49. errMsg = "";
  50. try
  51. {
  52. joInParam = JObject.Parse(inParam);
  53. jaSession = JArray.Parse(JsonHelper.getDestValue(joInParam, "session"));
  54. Global.curEvt.jaSession = jaSession;
  55. jaParams = JArray.Parse(JsonHelper.getDestValue(joInParam, "params"));
  56. joParam = JObject.FromObject(jaParams[0]);
  57. joInterface = JObject.Parse(JsonHelper.getDestValue(joInParam, "interfaceinfo"));
  58. businessType = JsonHelper.getDestValue(joInParam, "businessType");
  59. return 0;
  60. }
  61. catch (Exception ex)
  62. {
  63. errMsg = "parseInparam 解析入参异常:" + errMsg;
  64. return -1;
  65. }
  66. }
  67. /// <summary>
  68. /// 签到
  69. /// </summary>
  70. /// <param name="InParam"></param>
  71. /// <returns></returns>
  72. public string Init(string InParam)
  73. {
  74. string errMsg, rtnResult ="";
  75. JObject joRtn = new JObject();
  76. try
  77. {
  78. //MessageBox.Show("进入医保接口程序");
  79. if (hBus.initEnvironment(InParam, out errMsg) != 0)
  80. {
  81. return JsonHelper.setExceptionJson(-100, "initEnvironment 失败", errMsg).ToString();
  82. }
  83. else
  84. {
  85. InvokeHelper invoker = new InvokeHelper();
  86. if (Global.inf.interfaceDr == 9)
  87. {
  88. Global.curEvt.token = invoker.GetToken("http://ddjk.jlhs.gov.cn:20215", 1);//获取市医保TOKEN地址 MessageBox.Show("Token:" + Global.curEvt.token);
  89. }
  90. else
  91. {
  92. Global.curEvt.token = invoker.GetToken("http://ddjk.jlhs.gov.cn:20215", 2);//获取市医保TOKEN地址 MessageBox.Show("Token:" + Global.curEvt.token);
  93. }
  94. //MessageBox.Show("准备签到");
  95. if (mIS.isSigned(ref Global.curEvt.signno) != true)
  96. {
  97. //MessageBox.Show("开始调用签到");
  98. //签到
  99. if (cBus.signIn(out joRtn) != 0)
  100. {
  101. rtnResult = JsonHelper.setExceptionJson(-1, "签到异常", (string)joRtn["err_msg"]).ToString();
  102. return rtnResult;
  103. }
  104. else
  105. {
  106. Global.curEvt.signno = JsonHelper.getDestValue(joRtn, "output.signinoutb.sign_no");
  107. //插入签到表
  108. if (mIS.saveSignRecord(Global.curEvt.signno, out errMsg) != 0)
  109. {
  110. rtnResult = JsonHelper.setIrisReturnValue(0, "中心签到成功但插入签到表失败:" + errMsg, null).ToString();
  111. }
  112. else
  113. {
  114. rtnResult = JsonHelper.setIrisReturnValue(0, "签到成功", joRtn).ToString();
  115. }
  116. }
  117. }
  118. else
  119. {
  120. rtnResult = JsonHelper.setIrisReturnValue(0, "初始化成功!", null).ToString();
  121. }
  122. return rtnResult;
  123. }
  124. }
  125. catch (Exception ex)
  126. {
  127. rtnResult = JsonHelper.setExceptionJson(-100, "Init 异常", ex.Message).ToString();
  128. return rtnResult;
  129. }
  130. finally
  131. {
  132. Global.writeLog("初始化结果:" + rtnResult);
  133. }
  134. }
  135. /// <summary>
  136. /// 初始化
  137. /// </summary>
  138. /// <param name="inParam"></param>
  139. /// <param name="outParam"></param>
  140. /// <returns></returns>
  141. private int init(string inParam, out string outParam)
  142. {
  143. string errMsg;
  144. outParam = "";
  145. try
  146. {
  147. //BS架构调用方式问题,每次调用都需要重新初始化
  148. JObject joInitRtn = JObject.Parse(Init(inParam));
  149. if (JsonHelper.parseIrisRtnValue(joInitRtn, out errMsg) != 0)
  150. {
  151. outParam = JsonHelper.setExceptionJson(-100, "init(HIS医保环境初始化)", errMsg).ToString();
  152. return -1;
  153. }
  154. else
  155. {
  156. return 0;
  157. }
  158. return 0;
  159. }
  160. catch (Exception ex)
  161. {
  162. outParam = JsonHelper.setExceptionJson(-100, "init(HIS医保环境初始化)异常", ex.Message).ToString();
  163. return -1;
  164. }
  165. }
  166. /// <summary>
  167. /// 获取患者信息
  168. /// </summary>
  169. /// <param name="InParam"></param>
  170. /// <returns></returns>
  171. public string GetPatientInfo(string InParam)
  172. {
  173. Global.writeLog("GetPatientInfo入参:" + JsonHelper.Compress(InParam));
  174. //设置返回值,错误信息
  175. int errCode;
  176. string errMsg, rtnResult = "",outParam;
  177. //BS架构调用方式问题,每次调用都需要重新初始化
  178. if (init(InParam,out outParam)!= 0)
  179. {
  180. rtnResult = outParam;
  181. return rtnResult;
  182. }
  183. JObject joInParam = JObject.Parse(InParam);
  184. string businessType = JsonHelper.getDestValue(joInParam,"businessType");
  185. try
  186. {
  187. switch (businessType)
  188. {
  189. case "M1"://门诊读卡
  190. {
  191. //打开读卡窗口,操作员选择读卡类型后进行读卡器读卡,再进行1101获取参保信息
  192. if (hBus.readCard(out outParam) != 0)
  193. {
  194. rtnResult = JsonHelper.setExceptionJson(-100, "读卡失败!", outParam).ToString();
  195. }
  196. else
  197. {
  198. //展示患者信息界面
  199. if (hBus.showPatInfo(outParam, out outParam) != 0)
  200. {
  201. rtnResult = outParam;
  202. }
  203. else
  204. {
  205. rtnResult = outParam;
  206. }
  207. }
  208. break;
  209. }
  210. case "Z1"://住院读卡
  211. {
  212. //打开读卡窗口,操作员选择读卡类型后进行读卡器读卡,再进行1101获取参保信息
  213. if (hBus.readCard(out outParam) != 0)
  214. {
  215. rtnResult = JsonHelper.setExceptionJson(-100, "读卡失败!", outParam).ToString();
  216. }
  217. else
  218. {
  219. string patInfo = outParam;
  220. //展示患者信息界面
  221. if (hBus.showPatInfo(patInfo, out outParam) != 0)
  222. {
  223. rtnResult = outParam;
  224. }
  225. else
  226. {
  227. rtnResult = JsonHelper.setIrisReturnValue(0,"",JObject.Parse(outParam)).ToString();
  228. }
  229. }
  230. break;
  231. }
  232. }
  233. return rtnResult;
  234. }
  235. catch (Exception ex)
  236. {
  237. rtnResult = JsonHelper.setIrisReturnValue(-1 , "GetPatientInfo发生异常;" + ex.Message,null).ToString();
  238. return rtnResult;
  239. }
  240. finally
  241. {
  242. Global.writeLog("GetPatientInfo出参:" + JsonHelper.Compress(rtnResult));
  243. }
  244. }
  245. /// <summary>
  246. /// 登记
  247. /// </summary>
  248. /// <param name="InParam"></param>
  249. /// <returns></returns>
  250. public string Register(string InParam)
  251. {
  252. Global.writeLog("Register 入参:" + JsonHelper.Compress(InParam));
  253. //设置返回值,错误信息
  254. string errMsg, rtnResult = "", outParam;
  255. try
  256. {
  257. //解析入参
  258. if (parseInparam(InParam, out errMsg) != 0)
  259. {
  260. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  261. return rtnResult;
  262. }
  263. //BS架构调用方式问题,每次调用都需要重新初始化
  264. if (init(InParam, out outParam) != 0)
  265. {
  266. rtnResult = outParam;
  267. return rtnResult;
  268. }
  269. //获取pat
  270. hBus.GetRegPatInfo(businessType, joInParam, out Global.pat);
  271. switch (businessType)
  272. {
  273. case "M2"://门诊登记
  274. {
  275. break;
  276. }
  277. case "M2C"://门诊登记撤销
  278. {
  279. break;
  280. }
  281. case "Z0"://住院修改
  282. {
  283. break;
  284. }
  285. case "Z2"://入院登记
  286. {
  287. Global.writeLog(Global.pat.insuType);
  288. string regInParam = "";
  289. //显示登记面板
  290. if (hBus.showInPatRegisterForm( out regInParam) == 0)
  291. {
  292. Global.writeLog(regInParam);
  293. JObject joRegIn_plain = JObject.Parse(JsonHelper.setCenterInpar_plain("2401", regInParam));
  294. JObject joRegIn = JObject.Parse(JsonHelper.setCenterInpar("2401", regInParam));
  295. //上传给中心
  296. JObject joRegOut = invoker.invokeCenterService("2401", joRegIn);
  297. //将中心返回的结果返回HIS,调用HIS服务进行保存
  298. if (JsonHelper.parseCenterRtnValue(joRegOut,out errMsg) == 0)
  299. {
  300. joRegOut.Add("validflag",1);
  301. joRegOut.Add("regstate", 1);
  302. joRegOut.Add("type", 1);
  303. Global.pat.mdtrtID = JsonHelper.getDestValue(joRegOut, "output.result.mdtrt_id");
  304. //插入患者本次就诊用的参保信息
  305. if (hBus.insertPatCurInsuInfo(JsonHelper.getDestValue(joParam, "patientInfo"), out outParam) != 0)
  306. {
  307. if (DialogResult.Yes == MessageBox.Show(outParam, " 是否继续? ", MessageBoxButtons.YesNo))
  308. {
  309. }
  310. else
  311. {
  312. rtnResult = JsonHelper.setExceptionJson(-1, "插入患者本次就诊用的参保信息,请联系管理员!", outParam).ToString();
  313. return rtnResult;
  314. }
  315. }
  316. //插入医保平台
  317. if (mIS.saveInpatRegisterInfo(joRegIn_plain, joRegOut, out outParam) != 0)
  318. {
  319. rtnResult = JsonHelper.setExceptionJson(-1, "云平台保存登记信息", outParam).ToString();
  320. return rtnResult;
  321. }
  322. //返回登记信息,插入HIS
  323. if (hIS.returnRegisterInfo(joRegIn_plain, joRegOut, out outParam) != 0)
  324. {
  325. rtnResult = JsonHelper.setExceptionJson(-1, "HIS平台保存登记信息", outParam).ToString();
  326. return rtnResult;
  327. }
  328. else
  329. {
  330. rtnResult = JsonHelper.setIrisReturnValue(0, "登记成功", null).ToString();
  331. return rtnResult;
  332. }
  333. }
  334. else
  335. {
  336. rtnResult = JsonHelper.setExceptionJson(-1, "展示登记界面", errMsg).ToString();
  337. return rtnResult;
  338. }
  339. }
  340. else
  341. {
  342. rtnResult = JsonHelper.setExceptionJson(-1, "展示登记界面", regInParam).ToString();
  343. return rtnResult;
  344. }
  345. }
  346. case "Z2C"://入院登记取消
  347. {
  348. //if (DialogResult.Yes == MessageBox.Show("即将进行取消中心医保登记,确定继续吗?", " 询问? ", MessageBoxButtons.YesNo))
  349. //{
  350. //}
  351. //else
  352. //{
  353. // rtnResult = JsonHelper.setExceptionJson(-1, "收费员撤销取消登记操作!", outParam).ToString();
  354. // return rtnResult;
  355. //}
  356. //中心取消传送
  357. if (cBus.cancleFeeUpload("2302", out errMsg) != 0)
  358. {
  359. //rtnResult = JsonHelper.setExceptionJson(-1, "取消中心费用", errMsg).ToString();
  360. //return rtnResult;
  361. }
  362. //取消中心登记
  363. if (cBus.cancleRegister("2404", out outParam) != 0)
  364. {
  365. //如果医保中心没有HIS所传的医保登记信息则默认撤销HIS登记信息
  366. int i = outParam.IndexOf("不存在有效的就诊登记信息");
  367. if (i != 0)
  368. {
  369. if (DialogResult.Yes != MessageBox.Show("医保中心提示:" + outParam+ ",是否强制撤销HIS医保登记信息?", "提示", MessageBoxButtons.YesNo))
  370. {
  371. rtnResult = JsonHelper.setExceptionJson(-1, "中心取消登记失败,", outParam).ToString();
  372. return rtnResult;
  373. }
  374. }
  375. }
  376. //取消医保平台登记
  377. if (mIS.cancleRegister(1, out outParam) != 0)
  378. {
  379. rtnResult = JsonHelper.setExceptionJson(-1, "中心取消登记成功,但云医保平台取消失败,", outParam).ToString();
  380. return rtnResult;
  381. }
  382. //取消HIS 登记
  383. if (hIS.cancleRegister( out outParam) != 0)
  384. {
  385. rtnResult = JsonHelper.setExceptionJson(-1, "中心和云医保平台取消登记成功,但HIS取消失败,", outParam).ToString();
  386. return rtnResult;
  387. }
  388. else
  389. {
  390. rtnResult = JsonHelper.setIrisReturnValue(0, "取消医保登记成功", null).ToString();
  391. return rtnResult;
  392. }
  393. }
  394. case "Z6"://出院登记
  395. {
  396. break;
  397. }
  398. case "Z6C"://出院登记取消
  399. {
  400. if (cBus.cancleRegister("2405", out errMsg) != 0)
  401. {
  402. rtnResult = JsonHelper.setExceptionJson(-1, "取消出院登记", errMsg).ToString();
  403. return rtnResult;
  404. }
  405. else
  406. {
  407. rtnResult = JsonHelper.setIrisReturnValue(0, "取消出院登记成功", null).ToString();
  408. return rtnResult;
  409. }
  410. break;
  411. }
  412. default:
  413. {
  414. rtnResult = JsonHelper.setExceptionJson(-1, "Register 交易", "传入的业务编码不对!").ToString();
  415. return rtnResult;
  416. }
  417. }
  418. }
  419. catch (Exception ex)
  420. {
  421. rtnResult = JsonHelper.setIrisReturnValue(-1, "Register 发生异常;" + ex.Message, null).ToString();
  422. return rtnResult;
  423. }
  424. finally
  425. {
  426. Global.writeLog("Register 出参:" + JsonHelper.Compress(rtnResult));
  427. }
  428. return "";
  429. }
  430. /// <summary>
  431. /// 费用上传
  432. /// </summary>
  433. /// <param name="InParam"></param>
  434. /// <returns></returns>
  435. public string FeeUpload(string InParam)
  436. {
  437. Global.writeLog("FeeUpload 入参:" + JsonHelper.Compress(InParam));
  438. //设置返回值,错误信息
  439. int errCode;
  440. string errMsg, rtnResult = "", outParam;
  441. try
  442. {
  443. //解析入参
  444. if (parseInparam(InParam, out errMsg) != 0)
  445. {
  446. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  447. return rtnResult;
  448. }
  449. //BS架构调用方式问题,每次调用都需要重新初始化
  450. if (init(InParam, out outParam) != 0)
  451. {
  452. rtnResult = outParam;
  453. return rtnResult;
  454. }
  455. //获取pat
  456. hBus.GetFeeHisInfo(businessType, joInParam, out Global.pat);
  457. switch (businessType)
  458. {
  459. case "M3"://门诊费用上传
  460. {
  461. break;
  462. }
  463. case "M3C"://门诊费用撤销
  464. {
  465. break;
  466. }
  467. case "Z3"://入院费用上传
  468. {
  469. //从医保平台获取患者详细的医保登记信息
  470. if (mIS.queryRegisterInfo(1, out outParam) != 0)
  471. {
  472. rtnResult = JsonHelper.setExceptionJson(-1, "查询患者云平台登记信息", outParam).ToString();
  473. return rtnResult;
  474. }
  475. JObject joReg = JObject.Parse(outParam);
  476. Global.pat.medType = JsonHelper.getDestValue(joReg, "data.MedicalType");
  477. Global.pat.insuType = JsonHelper.getDestValue(joReg, "data.InsuType");
  478. //先取消中心费用传送
  479. cBus.cancleFeeUpload("2302", out errMsg);
  480. //再删除医保传送表的数据
  481. mIS.deleteFee( out errMsg);
  482. #region【住院费用上传前调用3101事前服务】
  483. //1.获取3101入参报文
  484. /* 20221207 CM 朱鹏飞要求屏蔽调用事前事中服务交易
  485. if (hIS.GetInsuPatInfo("5", Global.pat, out outParam) != 0)
  486. {
  487. rtnResult = JsonHelper.setExceptionJson(-1, "获取3101医保明细审核事前分析服务入参失败:", outParam).ToString();
  488. return rtnResult;
  489. }
  490. else
  491. {
  492. //2.调用医保3101明细审核事前分析服务
  493. JObject joInput = new JObject();
  494. joInput = JObject.Parse(outParam);
  495. JObject jo3101Rtn = invoker.invokeCenterService("3101", JsonHelper.setCenterInpar("3101", joInput.ToString().Replace("\r\n", "")));
  496. if (JsonHelper.parseCenterRtnValue(jo3101Rtn, out errMsg) != 0)
  497. {
  498. DialogResult dr = MessageBox.Show("【3101】医保明细审核事前分析服务医保中心返回结果:" + errMsg + "!是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  499. if (dr != DialogResult.OK)
  500. {
  501. rtnResult = JsonHelper.setExceptionJson(-1, "【3101】医保明细审核事前分析服务调用失败:", errMsg).ToString();
  502. return rtnResult;
  503. }
  504. }
  505. }
  506. */
  507. #endregion
  508. //开始进行费用传送
  509. //调用HIS费用查询信息
  510. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  511. {
  512. rtnResult = JsonHelper.setExceptionJson(-1, "获取HIS费用", outParam).ToString();
  513. return rtnResult;
  514. }
  515. //调用医保平台转换
  516. JObject joHisFee = JObject.Parse(outParam);
  517. if (mIS.convertHisFeeWithInsuCode(joHisFee,out outParam) != 0)
  518. {
  519. rtnResult = JsonHelper.setExceptionJson(-1, "转换HIS费用", outParam).ToString();
  520. return rtnResult;
  521. }
  522. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  523. //按指定条数分割后上传,保存,更新
  524. if (hBus.uploadFeeToCenter("2301",10, jaFeeDetail, out outParam) != 0)
  525. {
  526. rtnResult = JsonHelper.setExceptionJson(-1, "上传费用", outParam).ToString();
  527. return rtnResult;
  528. }
  529. else
  530. {
  531. rtnResult = JsonHelper.setIrisReturnValue(0, "住院费用上传成功", null).ToString();
  532. return rtnResult;
  533. }
  534. }
  535. case "Z3C"://住院费用上传取消
  536. {
  537. if (cBus.cancleFeeUpload("2302", out errMsg) != 0)
  538. {
  539. rtnResult = JsonHelper.setExceptionJson(-1, "取消中心费用", errMsg).ToString();
  540. return rtnResult;
  541. }
  542. if (mIS.deleteFee( out errMsg) != 0)
  543. {
  544. rtnResult = JsonHelper.setExceptionJson(-1, "删除医保平台费用", errMsg).ToString();
  545. return rtnResult;
  546. }
  547. else
  548. {
  549. rtnResult = JsonHelper.setIrisReturnValue(0, "住院费用上传取消成功", null).ToString();
  550. return rtnResult;
  551. }
  552. }
  553. default:
  554. {
  555. rtnResult = JsonHelper.setExceptionJson(-1, "FeeUpload 交易", "传入的业务编码不对!").ToString();
  556. return rtnResult;
  557. }
  558. }
  559. return rtnResult;
  560. }
  561. catch (Exception ex)
  562. {
  563. rtnResult = JsonHelper.setExceptionJson(-1, "FeeUpload 交易", ex.Message).ToString();
  564. return rtnResult;
  565. }
  566. finally
  567. {
  568. Global.writeLog("FeeUpload 出参:" + JsonHelper.Compress(rtnResult));
  569. }
  570. }
  571. /// <summary>
  572. /// 结算
  573. /// </summary>
  574. /// <param name="InParam"></param>
  575. /// <returns></returns>
  576. public string Settlement(string InParam)
  577. {
  578. Global.writeLog("Settlement 入参:" + JsonHelper.Compress(InParam));
  579. //设置返回值,错误信息
  580. string errMsg, rtnResult = "", outParam;
  581. try
  582. {
  583. //解析入参
  584. if (parseInparam(InParam, out errMsg) != 0)
  585. {
  586. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  587. return rtnResult;
  588. }
  589. //BS架构调用方式问题,每次调用都需要重新初始化
  590. if (init(InParam, out outParam) != 0)
  591. {
  592. rtnResult = outParam;
  593. return rtnResult;
  594. }
  595. //获取pat
  596. hBus.GetSettlementHisInfo(businessType, joInParam, out Global.pat);
  597. switch (businessType)
  598. {
  599. case "M4"://门诊预结算
  600. {
  601. OutpatientRegistration frmReg = new OutpatientRegistration();
  602. if (frmReg.ShowDialog() == DialogResult.OK)
  603. {
  604. rtnResult = "调用结束";
  605. }
  606. break;
  607. }
  608. case "M4C"://门诊预结算撤销
  609. {
  610. break;
  611. }
  612. case "M5"://门诊结算
  613. {
  614. string patInfo ="";
  615. //打开读卡窗口,操作员选择读卡类型后进行读卡器读卡,再进行1101获取参保信息
  616. if (hBus.readCard(out outParam) != 0)
  617. {
  618. rtnResult = JsonHelper.setExceptionJson(-100, "读卡失败!", outParam).ToString();
  619. return rtnResult;
  620. }
  621. else
  622. {
  623. patInfo = outParam;
  624. //展示患者信息界面
  625. if (hBus.showPatInfo(patInfo, out outParam) != 0)
  626. {
  627. rtnResult = outParam;
  628. return rtnResult;
  629. }
  630. }
  631. //患者信息赋值给全局变量
  632. patInfo = outParam;
  633. //校验HIS姓名与医保姓名是否一致
  634. if (hBus.checkName(Global.pat.name, out errMsg) != 0)
  635. {
  636. rtnResult = JsonHelper.setExceptionJson(-1, "校验HIS与医保姓名是否一致", errMsg).ToString();
  637. return rtnResult;
  638. }
  639. if (hBus.setGlobalPatAfaterShowPatInfo(patInfo, out errMsg) != 0)
  640. {
  641. rtnResult = JsonHelper.setExceptionJson(-1, "setGlobalPatAfaterShowPatInfo", errMsg).ToString();
  642. return rtnResult;
  643. }
  644. ////如果患者异地的则就医地需要该为 459900
  645. //Global.writeLog(Global.pat.insuplc_admdvs);
  646. //if (Global.pat.insuplc_admdvs.Substring(0, 4) != Global.inf.areaCode.Substring(0, 4))
  647. //{
  648. // Global.inf.areaCode = "459900";
  649. //}
  650. //显示登记面板
  651. if (hBus.showOutPatRegisterForm(out outParam) != 0)
  652. {
  653. rtnResult = JsonHelper.setExceptionJson(-1, "显示登记面板", outParam).ToString();
  654. return rtnResult;
  655. }
  656. JObject joReg = JObject.Parse(outParam);
  657. //医保挂号
  658. JObject jo2201Inpar = JObject.Parse(JsonHelper.getDestProperty(joReg, "data"));
  659. JObject jo2201Inpar_plain = JObject.Parse(JsonHelper.getDestProperty(joReg, "data"));
  660. jo2201Inpar = JObject.Parse(JsonHelper.setCenterInpar("2201", jo2201Inpar));
  661. jo2201Inpar_plain = JObject.Parse(JsonHelper.setCenterInpar_plain("2201", jo2201Inpar_plain));
  662. //此处先取到就诊信息上传的入参,只要挂号成功就保存到云HIS后台(保存后台需要用到2203入参)
  663. JObject jo2203Inpar = new JObject();
  664. JObject jo2203Inpar_plain = new JObject();
  665. jo2203Inpar.Add("mdtrtinfo", JObject.Parse(JsonHelper.getDestValue(joReg, "mdtrtinfo")));
  666. jo2203Inpar.Add("diseinfo",JArray.Parse(JsonHelper.getDestValue(joReg, "diseinfo")));
  667. JObject jo2201Rtn = invoker.invokeCenterService("2201", jo2201Inpar);
  668. if (JsonHelper.parseCenterRtnValue(jo2201Rtn, out errMsg) != 0)
  669. {
  670. rtnResult = JsonHelper.setExceptionJson(-1, "医保挂号", errMsg).ToString();
  671. return rtnResult;
  672. }
  673. else
  674. {
  675. Global.pat.mdtrtID = JsonHelper.getDestValue(jo2201Rtn, "output.data.mdtrt_id");
  676. //插入患者本次就诊用的参保信息
  677. if (hBus.insertPatCurInsuInfo(patInfo, out outParam) != 0)
  678. {
  679. if (DialogResult.Yes == MessageBox.Show(outParam, " 是否继续? ", MessageBoxButtons.YesNo))
  680. {
  681. }
  682. else
  683. {
  684. rtnResult = JsonHelper.setExceptionJson(-1, "插入患者本次就诊用的参保信息,请联系管理员!是否继续?", outParam).ToString();
  685. return rtnResult;
  686. }
  687. }
  688. jo2203Inpar["mdtrtinfo"]["mdtrt_id"] = Global.pat.mdtrtID;
  689. jo2203Inpar_plain = JObject.Parse(JsonHelper.setCenterInpar_plain("2203", jo2203Inpar));
  690. jo2203Inpar = JObject.Parse(JsonHelper.setCenterInpar("2203", jo2203Inpar));
  691. //门诊登记信息,插入云医保平台
  692. jo2201Rtn.Add("validflag", 1);
  693. jo2201Rtn.Add("regstate", 1);
  694. jo2201Rtn.Add("type", 3);
  695. Global.writeLog(jo2201Inpar_plain.ToString());
  696. if (mIS.saveOutpatRegisterInfo(jo2201Inpar_plain, jo2201Rtn, jo2203Inpar_plain, out errMsg) != 0)
  697. {
  698. rtnResult = JsonHelper.setExceptionJson(-1, "中心登记成功但医保平台保存失败,请联系管理员!", errMsg).ToString();
  699. return rtnResult;
  700. }
  701. }
  702. //门诊就诊信息上传
  703. JObject jo2203Rtn = invoker.invokeCenterService("2203",jo2203Inpar );
  704. if (JsonHelper.parseCenterRtnValue(jo2203Rtn, out errMsg) != 0)
  705. {
  706. rtnResult = JsonHelper.setExceptionJson(-1, "门诊就诊信息上传", errMsg).ToString();
  707. return rtnResult;
  708. }
  709. #region【门诊就诊信息上传成功后调用3101事前服务】
  710. //1.获取3101入参报文
  711. /*
  712. if (hIS.GetInsuPatInfo("1", Global.pat, out outParam) != 0)
  713. {
  714. rtnResult = JsonHelper.setExceptionJson(-1, "获取3101医保明细审核事前分析服务入参失败:", outParam).ToString();
  715. return rtnResult;
  716. }
  717. else
  718. {
  719. //2.调用医保3101明细审核事前分析服务
  720. JObject joInput = new JObject();
  721. //joInput.Add("data", JObject.Parse(outParam));
  722. joInput = JObject.Parse(outParam);
  723. JObject jo3101Rtn = invoker.invokeCenterService("3101", JsonHelper.setCenterInpar("3101", joInput.ToString().Replace("\r\n", ""))); //.Replace(" ", "")
  724. if (JsonHelper.parseCenterRtnValue(jo3101Rtn, out errMsg) != 0)
  725. {
  726. DialogResult dr = MessageBox.Show("【3101】医保明细审核事前分析服务医保中心返回结果:" + errMsg + "!是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  727. if (dr != DialogResult.OK)
  728. {
  729. rtnResult = JsonHelper.setExceptionJson(-1, "【3101】医保明细审核事前分析服务调用失败:", errMsg).ToString();
  730. return rtnResult;
  731. }
  732. }
  733. }
  734. */
  735. #endregion
  736. //费用上传
  737. if (hBus.uploadFee("2204", 50, out outParam) != 0)
  738. {
  739. rtnResult = JsonHelper.setExceptionJson(-1, "费用上传", outParam).ToString();
  740. return rtnResult;
  741. }
  742. #region【门诊预结算2206前调用3102医保明细审核事中服务】
  743. //1.获取3102入参报文
  744. /*
  745. if (hIS.GetInsuPatInfo("2", Global.pat, out outParam) != 0)
  746. {
  747. rtnResult = JsonHelper.setExceptionJson(-1, "获取3102医保明细审核事中分析服务入参失败:", outParam).ToString();
  748. return rtnResult;
  749. }
  750. else
  751. {
  752. //2.调用医保3102明细审核事前分析服务
  753. JObject joInput = new JObject();
  754. //joInput.Add("data", JObject.Parse(outParam));
  755. joInput = JObject.Parse(outParam);
  756. JObject jo3101Rtn = invoker.invokeCenterService("3102", JsonHelper.setCenterInpar("3102", joInput.ToString().Replace("\r\n", "")));
  757. if (JsonHelper.parseCenterRtnValue(jo3101Rtn, out errMsg) != 0)
  758. {
  759. DialogResult dr = MessageBox.Show("【3102】医保明细审核事中分析服务医保中心返回结果:" + errMsg + "!是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  760. if (dr != DialogResult.OK)
  761. {
  762. rtnResult = JsonHelper.setExceptionJson(-1, "【3102】医保明细审核事中分析服务调用失败:", errMsg).ToString();
  763. return rtnResult;
  764. }
  765. }
  766. }
  767. */
  768. #endregion
  769. //调用IRIS获取医保各项金额
  770. if (mIS.getSumFee(out outParam) != 0)
  771. {
  772. rtnResult = JsonHelper.setExceptionJson(-1, "获取医保费用各项汇总金额", outParam).ToString();
  773. return rtnResult;
  774. }
  775. JObject joSumFee = JObject.Parse(outParam);
  776. JObject joSettlement = JObject.Parse(JsonHelper.getDestValue(joReg, "settlement"));
  777. //修改joSettlement的就诊ID ,总金额等
  778. joSettlement["mdtrt_id"] = Global.pat.mdtrtID;
  779. joSettlement["medfee_sumamt"] = JsonHelper.getDestValue(joSumFee, "data.Sumamt");
  780. //预结算2206
  781. if (hBus.preSettlement_OutPat(joSettlement, out outParam) != 0)
  782. {
  783. rtnResult = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  784. return rtnResult;
  785. }
  786. #region【门诊正式结算前调用1192身份验证】
  787. //if (hBus.IdentityVerify("2207", out errMsg) != 0)
  788. //{
  789. // rtnResult = JsonHelper.setExceptionJson(-1, "调用门诊正式结算2207前,身份核验1192失败", errMsg).ToString();
  790. // return rtnResult;
  791. //}
  792. //else
  793. //{
  794. // JObject joDataExp = new JObject();
  795. // joDataExp.Add("cardtoken", Global.pat.card.Cardtoken);
  796. // joDataExp.Add("acct_payamt", Global.Set.acctPay);
  797. // joDataExp.Add("elec_bill_code", "");
  798. // joDataExp.Add("elec_billno_code", "");
  799. // joDataExp.Add("elec_bill_chkcode", "");
  800. // joSettlement["exp_content"] = joDataExp;
  801. //}
  802. #endregion
  803. //正式结算
  804. JObject joData = new JObject();
  805. joData.Add("data",joSettlement);
  806. JObject joRtn = invoker.invokeCenterService("2207", JsonHelper.setCenterInpar("2207", joData));
  807. if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  808. {
  809. rtnResult = JsonHelper.setExceptionJson(-1, "结算失败", errMsg).ToString();
  810. return rtnResult;
  811. }
  812. else
  813. {
  814. //返回给云医保平台结算信息
  815. if (mIS.saveSettlement(joRtn, out errMsg) != 0)
  816. {
  817. rtnResult = JsonHelper.setExceptionJson(-1, "结算成功,但云医保平台保存失败", errMsg).ToString();
  818. return rtnResult;
  819. }
  820. //返回给云医保平台结算明细信息
  821. if (mIS.saveSettlementDetail(joRtn, out errMsg) != 0)
  822. {
  823. rtnResult = JsonHelper.setExceptionJson(-1, "云医保平台保存结算明细失败", errMsg).ToString();
  824. return rtnResult;
  825. }
  826. //返回给HIS
  827. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(joRtn, "output.setlinfo"));
  828. if (hIS.returnOutpatSettlementInfo(joSettlement, joSetlinfo, out outParam) != 0)
  829. {
  830. rtnResult = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  831. return rtnResult;
  832. }
  833. else
  834. {
  835. JObject joHisServieRtn = JObject.Parse(outParam);
  836. hBus.returnToFrontEndAfterSettlement(joRtn, joHisServieRtn, out outParam);
  837. rtnResult = JsonHelper.setIrisReturnValue(0, "结算成功", JObject.Parse(outParam)).ToString();
  838. return rtnResult;
  839. }
  840. }
  841. }
  842. case "M5C"://门诊结算撤销
  843. {
  844. //查询HIS医保结算记录表获取该病人的参保地
  845. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE billType = 1 and ValidFlag = 1 ";
  846. sqlStr = sqlStr + " AND Hospital_Dr=" + Global.inf.hospitalDr + " AND Interface_Dr=" + Global.inf.interfaceDr;
  847. sqlStr = sqlStr + " AND SettlementID ='" + Global.pat.settlID + "'";
  848. JObject joSql = new JObject();
  849. joSql.Add("sqlStr", sqlStr);
  850. JObject joSettlInfo = mIS.QuerySettlementInfo(joSql);
  851. //if (JsonHelper.parseIrisRtnValue(joSettlInfo, out errMsg) != 0)
  852. //{
  853. // rtnResult = JsonHelper.setExceptionJson(-1, "查询结算信息失败!", errMsg).ToString();
  854. // return rtnResult;
  855. //}
  856. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joSettlInfo, "result.data[0].insuplc_admdvs");
  857. //退中心结算
  858. string newSettleID = "";
  859. if (cBus.cancleSettlement("2208", out outParam) != 0)
  860. {
  861. int i = outParam.IndexOf("获取到的就诊信息为无效状态,不能办理结算撤销业务");
  862. if (i != 0)
  863. {
  864. if (DialogResult.Yes != MessageBox.Show("医保中心提示:" + outParam + ",是否强制撤销HIS结算信息?", "提示", MessageBoxButtons.YesNo))
  865. {
  866. rtnResult = JsonHelper.setExceptionJson(-1, "中心取消结算失败,", outParam).ToString();
  867. return rtnResult;
  868. }
  869. newSettleID = "YC";
  870. }
  871. else
  872. {
  873. rtnResult = JsonHelper.setExceptionJson(-1, "取消中心结算", outParam).ToString();
  874. //查看是医保平台是否已经退费,如果是,则询问是否继续退费
  875. string SqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE ValidFlag = 0 AND BillType = -1 ";
  876. SqlStr = SqlStr + " AND Hospital_Dr=" + Global.inf.hospitalDr + " AND Interface_Dr=" + Global.inf.interfaceDr;
  877. SqlStr = SqlStr + " AND SettlementID ='" + Global.pat.settlID + "'";
  878. JObject joSqlStr = new JObject();
  879. joSqlStr.Add("sqlStr", SqlStr);
  880. JObject joCancleSettlInfo = mIS.QuerySettlementInfo(joSqlStr);
  881. JArray jaCancleSettlInfo = JArray.Parse(JsonHelper.getDestValue(joCancleSettlInfo, "result.data"));
  882. if (jaCancleSettlInfo.Count == 1)
  883. {
  884. //询问收款员是否继续进行HIS退费
  885. if (DialogResult.Yes == MessageBox.Show("中心提示:" + outParam, " 该费用在医保中心已成功退费但在HIS未成功退费,是否强制退HIS费用? ", MessageBoxButtons.YesNo))
  886. {
  887. rtnResult = JsonHelper.setExceptionJson(0, "该费用在医保中心已成功退费但在HIS未成功退费,收款员选择强制退HIS费用!", outParam).ToString();
  888. }
  889. }
  890. else
  891. {
  892. rtnResult = JsonHelper.setExceptionJson(-1, "取消中心结算(云医保平台未退费或未查询到退费记录)", outParam).ToString();
  893. }
  894. return rtnResult;
  895. }
  896. }
  897. else
  898. {
  899. newSettleID = JsonHelper.getDestValue(JObject.Parse(outParam), "output.setlinfo.setl_id");
  900. }
  901. //退云医保平台结算
  902. if (mIS.cancleSettlement(newSettleID, out outParam) != 0)
  903. {
  904. rtnResult = JsonHelper.setExceptionJson(-1, "取消平台结算信息", outParam).ToString();
  905. //return rtnResult;
  906. }
  907. //中心取消传送
  908. if (cBus.cancleFeeUpload("2205", out errMsg) != 0)
  909. {
  910. rtnResult = JsonHelper.setExceptionJson(-1, "取消中心费用", errMsg).ToString();
  911. return rtnResult;
  912. }
  913. //云平台取消传送
  914. if (mIS.deleteFee(out errMsg) != 0)
  915. {
  916. rtnResult = JsonHelper.setExceptionJson(-1, "删除医保平台费用", errMsg).ToString();
  917. return rtnResult;
  918. }
  919. //取消中心登记
  920. if (cBus.cancleRegister("2202", out outParam) != 0)
  921. {
  922. rtnResult = JsonHelper.setExceptionJson(-1, "中心取消登记失败,", outParam).ToString();
  923. return rtnResult;
  924. }
  925. //取消医保平台登记
  926. if (mIS.cancleRegister(3, out outParam) != 0)
  927. {
  928. rtnResult = JsonHelper.setExceptionJson(-1, "中心取消登记成功,但云医保平台取消失败,", outParam).ToString();
  929. return rtnResult;
  930. }
  931. //退HIS结算
  932. if (hIS.cancleSettlementInfo(joParam, out outParam) != 0)
  933. {
  934. rtnResult = JsonHelper.setExceptionJson(-1, "取消HIS结算信息", outParam).ToString();
  935. return rtnResult;
  936. }
  937. else
  938. {
  939. rtnResult = JsonHelper.setIrisReturnValue(0, "取消结算成功", null).ToString();
  940. return rtnResult;
  941. }
  942. }
  943. case "Z4"://住院预结算
  944. {
  945. #region【住院预结算2303前调用3102医保明细审核事中服务】
  946. //1.获取3102入参报文
  947. /*
  948. if (hIS.GetInsuPatInfo("9", Global.pat, out outParam) != 0)
  949. {
  950. rtnResult = JsonHelper.setExceptionJson(-1, "获取3102医保明细审核事中分析服务入参失败:", outParam).ToString();
  951. return rtnResult;
  952. }
  953. else
  954. {
  955. //2.调用医保3102明细审核事前分析服务
  956. JObject joInput = new JObject();
  957. joInput = JObject.Parse(outParam);
  958. JObject jo3102Rtn = invoker.invokeCenterService("3102", JsonHelper.setCenterInpar("3102", joInput.ToString().Replace("\r\n", "")));
  959. if (JsonHelper.parseCenterRtnValue(jo3102Rtn, out errMsg) != 0)
  960. {
  961. DialogResult dr = MessageBox.Show("【3102】医保明细审核事中分析服务医保中心返回结果2:" + errMsg + "!是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  962. if (dr != DialogResult.OK)
  963. {
  964. rtnResult = JsonHelper.setExceptionJson(-1, "【3102】医保明细审核事中分析服务调用失败:", errMsg).ToString();
  965. return rtnResult;
  966. }
  967. }
  968. }
  969. */
  970. #endregion
  971. Global.pat.RYorCY = "2";
  972. JObject joSettle = new JObject();
  973. if (hBus.preSettlement("2303",out joSettle, out outParam) != 0)
  974. {
  975. rtnResult = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  976. return rtnResult;
  977. }
  978. else
  979. {
  980. rtnResult = JsonHelper.setIrisReturnValue(0, "预结算成功", null).ToString();
  981. return rtnResult;
  982. }
  983. }
  984. case "Z4C"://住院预结算撤销
  985. {
  986. rtnResult = JsonHelper.setExceptionJson(-100, "该接口不支持预结算取消!", null).ToString();
  987. return rtnResult;
  988. }
  989. case "Z5"://住院结算
  990. {
  991. #region【住院预结算2303前调用3102医保明细审核事中服务】
  992. //1.获取3102入参报文
  993. /*
  994. if (hIS.GetInsuPatInfo("9", Global.pat, out outParam) != 0)
  995. {
  996. rtnResult = JsonHelper.setExceptionJson(-1, "获取3102医保明细审核事中分析服务入参失败:", outParam).ToString();
  997. return rtnResult;
  998. }
  999. else
  1000. {
  1001. //2.调用医保3102明细审核事前分析服务
  1002. JObject joInput = new JObject();
  1003. joInput = JObject.Parse(outParam);
  1004. JObject jo3102Rtn = invoker.invokeCenterService("3102", JsonHelper.setCenterInpar("3102", joInput.ToString().Replace("\r\n", "")));
  1005. if (JsonHelper.parseCenterRtnValue(jo3102Rtn, out errMsg) != 0)
  1006. {
  1007. DialogResult dr = MessageBox.Show("【3102】医保明细审核事中分析服务医保中心返回结果1:" + errMsg + "!是否继续?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
  1008. if (dr != DialogResult.OK)
  1009. {
  1010. rtnResult = JsonHelper.setExceptionJson(-1, "【3102】医保明细审核事中分析服务调用失败:", errMsg).ToString();
  1011. return rtnResult;
  1012. }
  1013. }
  1014. }
  1015. */
  1016. #endregion
  1017. #region【调用银海COM组件读卡弹框-1401交易:出院结算前校验身份信息】
  1018. //调用银海com组件读卡弹框 1401交易
  1019. /* InvokeHelper yinhaiCom = new InvokeHelper();
  1020. JObject joInput1401 = new JObject();
  1021. dynamic joData1401 = new JObject();
  1022. joData1401.fixmedinsCode = Global.inf.hospitalNO;
  1023. joData1401.psnNo = "";
  1024. //交易输入报文格式
  1025. joInput1401["transNo"] = "1401";
  1026. joInput1401["transType"] = "passwordCheck";
  1027. joInput1401["timestamp"] = DateTime.Now.ToString("YYYYMMDDHH24MISS");
  1028. joInput1401.Add("data", JObject.FromObject(joData1401));
  1029. string sRtnValue1401 = string.Empty;
  1030. yinhaiCom.Call("1401", joInput1401.ToString(), out sRtnValue1401);
  1031. JObject joRtn1401 = new JObject();
  1032. joRtn1401 = JObject.Parse(sRtnValue1401);
  1033. if (JsonHelper.parseCenterRtnValue(joRtn1401, out errMsg) != 0)
  1034. {
  1035. rtnResult = JsonHelper.setExceptionJson(-1, "结算前验证身份信息调用银海控件失败:", errMsg).ToString();
  1036. return rtnResult;
  1037. }
  1038. else
  1039. {
  1040. outParam = joRtn1401.ToString();
  1041. Global.pat.certNO = JsonHelper.getDestValue(JObject.Parse(outParam), "output.certno"); //证件号码
  1042. Global.pat.name = JsonHelper.getDestValue(JObject.Parse(outParam), "output.psn_name"); //姓名
  1043. Global.pat.card.NO = JsonHelper.getDestValue(JObject.Parse(outParam), "output.card_no"); //社会保障卡号
  1044. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(JObject.Parse(outParam), "output.insuplc_admdvs"); //参保地
  1045. Global.pat.card.SN = JsonHelper.getDestValue(JObject.Parse(outParam), "output.card_sn"); //卡识别码
  1046. Global.pat.certType = JsonHelper.getDestValue(JObject.Parse(outParam), "output.psn_cert_type"); //证件类别
  1047. Global.pat.mdtrtcertNO = JsonHelper.getDestValue(JObject.Parse(outParam), "output.mdtrt_cert_no"); //就诊凭证编号
  1048. Global.pat.mdtrtcertType = JsonHelper.getDestValue(JObject.Parse(outParam), "output.mdtrt_cert_type"); //就诊凭证类型
  1049. Global.pat.IDNO = Global.pat.certNO;
  1050. #region【1101获取身份信息】
  1051. JObject joData1101 = new JObject();
  1052. joData1101.Add("mdtrt_cert_type", Global.pat.mdtrtcertType); //就诊凭证类型
  1053. joData1101.Add("mdtrt_cert_no", Global.pat.mdtrtcertNO); //就诊凭证编码
  1054. joData1101.Add("card_sn", Global.pat.card.SN); //卡识别码
  1055. joData1101.Add("begntime", "");
  1056. joData1101.Add("psn_cert_type", Global.pat.certType); //证件类别
  1057. joData1101.Add("certno", Global.pat.certNO); //证件号码
  1058. joData1101.Add("psn_name", Global.pat.name); //姓名
  1059. JObject joInput1101 = new JObject();
  1060. joInput1101.Add("data", joData1101);
  1061. InvokeHelper invoker = new InvokeHelper();
  1062. JObject joRtn1101 = invoker.invokeCenterService("1101", JsonHelper.setCenterInpar("1101", joInput1101));
  1063. if (JsonHelper.parseCenterRtnValue(joRtn1101, out errMsg) != 0)
  1064. {
  1065. rtnResult = JsonHelper.setExceptionJson(-1, "结算前验证身份信息调用1101交易失败:", errMsg).ToString();
  1066. return rtnResult;
  1067. }
  1068. else
  1069. {
  1070. if (Global.pat.psn_no != JsonHelper.getDestValue(JObject.Parse(joRtn1101.ToString()), "output.baseinfo.psn_no")) //医保编号
  1071. {
  1072. rtnResult = JsonHelper.setExceptionJson(-1, "结算前验证身份信息失败:", "通过就诊凭证获取到的参保人信息与就诊人信息不一致!").ToString();
  1073. return rtnResult;
  1074. }
  1075. }
  1076. #endregion
  1077. }*/
  1078. #endregion
  1079. #region【住院结算前调用读卡重新获取加密卡串】
  1080. string patInfo = "";
  1081. //打开读卡窗口,操作员选择读卡类型后进行读卡器读卡,再进行1101获取参保信息
  1082. if (hBus.readCard(out outParam) != 0)
  1083. {
  1084. rtnResult = JsonHelper.setExceptionJson(-100, "读卡失败!", outParam).ToString();
  1085. return rtnResult;
  1086. }
  1087. else
  1088. {
  1089. patInfo = outParam;
  1090. //展示患者信息界面
  1091. if (hBus.showPatInfo(patInfo, out outParam) != 0)
  1092. {
  1093. rtnResult = outParam;
  1094. return rtnResult;
  1095. }
  1096. }
  1097. //患者信息赋值给全局变量
  1098. patInfo = outParam;
  1099. if (hBus.setGlobalPatAfaterShowPatInfo(patInfo, out errMsg) != 0)
  1100. {
  1101. rtnResult = JsonHelper.setExceptionJson(-1, "setGlobalPatAfaterShowPatInfo", errMsg).ToString();
  1102. return rtnResult;
  1103. }
  1104. #endregion
  1105. Global.pat.RYorCY = "2";
  1106. JObject joPreSetOutpar ;
  1107. if (hBus.preSettlement("2303",out joPreSetOutpar, out outParam) != 0)
  1108. {
  1109. rtnResult = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  1110. //预结算出错,后取消出院登记
  1111. if (cBus.cancleRegister("2405", out outParam) != 0)
  1112. {
  1113. rtnResult = rtnResult+ JsonHelper.setExceptionJson(0, "取消出院登记失败!", outParam).ToString();
  1114. // return rtnResult;
  1115. }
  1116. //rtnResult = JsonHelper.setExceptionJson(-1, "结算信息展示", outParam).ToString();
  1117. return rtnResult;
  1118. }
  1119. else
  1120. {
  1121. JObject joSettlement = JObject.Parse(JsonHelper.getDestValue(joPreSetOutpar, "Settlement"));
  1122. ////出院登记
  1123. //JObject joDischargeRegister = JObject.Parse(JsonHelper.getDestValue(joPreSetOutpar, "DischargeRegister"));
  1124. //JObject jo2402Rtn = invoker.invokeCenterService("2402", JsonHelper.setCenterInpar("2402", joDischargeRegister));
  1125. //if (JsonHelper.parseCenterRtnValue(jo2402Rtn, out errMsg) != 0)
  1126. //{
  1127. // rtnResult = JsonHelper.setExceptionJson(-1, "结算失败", errMsg).ToString();
  1128. // return rtnResult;
  1129. //}
  1130. //正式结算
  1131. joSettlement.Add("data", joSettlement);
  1132. JObject jo2304Rtn = invoker.invokeCenterService("2304",JsonHelper.setCenterInpar("2304",joSettlement));
  1133. if (JsonHelper.parseCenterRtnValue(jo2304Rtn, out errMsg) != 0)
  1134. {
  1135. rtnResult = JsonHelper.setExceptionJson(-1, "结算失败", errMsg).ToString();
  1136. cBus.cancleRegister("2405", out errMsg);
  1137. return rtnResult;
  1138. }
  1139. else
  1140. {
  1141. //返回给云医保平台结算信息
  1142. if (mIS.saveSettlement(jo2304Rtn, out errMsg) != 0)
  1143. {
  1144. rtnResult = JsonHelper.setExceptionJson(-1, "结算成功,但云医保平台保存失败", errMsg).ToString();
  1145. return rtnResult;
  1146. }
  1147. //返回给云医保平台结算明细信息
  1148. if (mIS.saveSettlementDetail(jo2304Rtn, out errMsg) != 0)
  1149. {
  1150. rtnResult = JsonHelper.setExceptionJson(-1, "云医保平台保存结算明细失败", errMsg).ToString();
  1151. Global.writeLog(rtnResult);
  1152. MessageBox.Show(errMsg);
  1153. }
  1154. //返回给HIS
  1155. JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2304Rtn, "output.setlinfo"));
  1156. if (hIS.returnInpatSettlementInfo(joParam, joSetlinfo, out outParam) != 0)
  1157. {
  1158. rtnResult = JsonHelper.setExceptionJson(-1, "返回结算信息给HIS", outParam).ToString();
  1159. return rtnResult;
  1160. }
  1161. else
  1162. {
  1163. //返回给前端
  1164. JObject joHisServieRtn = JObject.Parse(outParam);
  1165. hBus.returnToFrontEndAfterSettlement(jo2304Rtn, joHisServieRtn, out outParam);
  1166. rtnResult = JsonHelper.setIrisReturnValue(0, "结算成功", JObject.Parse(outParam)).ToString();
  1167. return rtnResult;
  1168. }
  1169. }
  1170. }
  1171. }
  1172. case "Z5C"://住院结算撤销
  1173. {
  1174. //查询结算表
  1175. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE billType = 1 and Hospital_Dr=" + Global.inf.hospitalDr
  1176. + " and Adm_Dr='" + Global.pat.adm_Dr + "'"
  1177. + " and MdtrtID='" + Global.pat.mdtrtID + "'"
  1178. + " Order By ID DESC ";
  1179. JObject joSql = new JObject();
  1180. joSql.Add("sqlStr", sqlStr);
  1181. JObject joSettlInfo = mIS.QuerySettlementInfo(joSql);
  1182. //if (JsonHelper.parseIrisRtnValue(joSettlInfo, out errMsg) != 0)
  1183. //{
  1184. // rtnResult = JsonHelper.setExceptionJson(-1, "查询结算信息失败!", errMsg).ToString();
  1185. // return rtnResult;
  1186. //}
  1187. //MessageBox.Show(joSettlInfo.ToString());
  1188. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joSettlInfo, "result.data[0].insuplc_admdvs");
  1189. Global.pat.SettID_YBJSB = JsonHelper.getDestValue(joSettlInfo, "result.data[0].SettlementID");
  1190. if (Global.pat.settlID != Global.pat.SettID_YBJSB)
  1191. {
  1192. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", "通过09010059服务获取到的SettlementID<" + Global.pat.settlID + ">与DLL通过SQL语句" +
  1193. joSql + ",获取到的SettlementID<" + Global.pat.SettID_YBJSB + ">不同,可能存在HIS单边账,请联系医保开发人员处理该笔结算记录!").ToString();
  1194. //return rtnResult;
  1195. }
  1196. Global.pat.settlID = Global.pat.SettID_YBJSB;
  1197. //取消中心结算信息
  1198. if (cBus.cancleSettlement("2305", out outParam) != 0)
  1199. {
  1200. rtnResult = JsonHelper.setExceptionJson(-1, "取消中心结算信息失败!", outParam).ToString();
  1201. //查看是医保平台是否已经退费,如果是,则询问是否继续退费
  1202. string SqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE ValidFlag = 0 AND BillType = -1 ";
  1203. SqlStr = SqlStr + " AND Hospital_Dr=" + Global.inf.hospitalDr + " AND Interface_Dr=" + Global.inf.interfaceDr;
  1204. SqlStr = SqlStr + " AND SettlementID ='" + Global.pat.settlID + "'";
  1205. JObject joSqlStr = new JObject();
  1206. joSqlStr.Add("sqlStr", SqlStr);
  1207. JObject joCancleSettlInfo = mIS.QuerySettlementInfo(joSqlStr);
  1208. JArray jaCancleSettlInfo = JArray.Parse(JsonHelper.getDestValue(joCancleSettlInfo, "result.data"));
  1209. if (jaCancleSettlInfo.Count == 1)
  1210. {
  1211. //询问收款员是否继续进行HIS退费
  1212. if (DialogResult.Yes == MessageBox.Show("中心提示:" + outParam, " 该费用在医保中心已成功退费但在HIS未成功退费,是否强制退HIS费用? ", MessageBoxButtons.YesNo))
  1213. {
  1214. rtnResult = JsonHelper.setExceptionJson(0, "该费用在医保中心已成功退费但在HIS未成功退费,收款员选择强制退HIS费用!", outParam).ToString();
  1215. }
  1216. }
  1217. else
  1218. {
  1219. rtnResult = JsonHelper.setExceptionJson(-1, "取消中心结算(云医保平台未退费或未查询到退费记录)", outParam).ToString();
  1220. }
  1221. return rtnResult;
  1222. }
  1223. else
  1224. {
  1225. //退结算会返一个新的ID
  1226. string newSettleID = JsonHelper.getDestValue(JObject.Parse(outParam), "output.setlinfo.setl_id");
  1227. //取消平台结算信息
  1228. if (mIS.cancleSettlement(newSettleID, out outParam) != 0)
  1229. {
  1230. rtnResult = JsonHelper.setExceptionJson(-1, "中心结算取消成功,医保平台结算信息取消失败!", outParam).ToString();
  1231. return rtnResult;
  1232. }
  1233. //中心取消传送
  1234. if (cBus.cancleFeeUpload("2302", out errMsg) != 0)
  1235. {
  1236. //rtnResult = JsonHelper.setExceptionJson(-1, "取消中心费用", errMsg).ToString();
  1237. //return rtnResult;
  1238. }
  1239. //云平台取消传送
  1240. if (mIS.deleteFee(out errMsg) != 0)
  1241. {
  1242. //rtnResult = JsonHelper.setExceptionJson(-1, "删除医保平台费用", errMsg).ToString();
  1243. //return rtnResult;
  1244. }
  1245. //取消HIS医保结算信息
  1246. if (hIS.cancleSettlementInfo(joParam, out outParam) != 0)
  1247. {
  1248. rtnResult = JsonHelper.setExceptionJson(-1, "中心跟医保平台结算取消成功, 取消HIS结算信息失败!", outParam).ToString();
  1249. return rtnResult;
  1250. }
  1251. //取消出院登记
  1252. if (cBus.cancleRegister("2405", out outParam) != 0)
  1253. {
  1254. rtnResult = JsonHelper.setExceptionJson(0, "中心,医保平台及HIS结算信息取消成功,取消出院登记失败!请手工取消出院登记!", outParam).ToString();
  1255. return rtnResult;
  1256. }
  1257. rtnResult = JsonHelper.setIrisReturnValue(0, "取消结算成功", null).ToString();
  1258. return rtnResult;
  1259. }
  1260. }
  1261. default:
  1262. {
  1263. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", "传入的业务编码不对!").ToString();
  1264. return rtnResult;
  1265. }
  1266. }
  1267. return rtnResult;
  1268. }
  1269. catch (Exception ex)
  1270. {
  1271. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", ex.Message).ToString();
  1272. return rtnResult;
  1273. }
  1274. finally
  1275. {
  1276. Global.writeLog("Settlement 出参:" + JsonHelper.Compress(rtnResult));
  1277. }
  1278. }
  1279. //[STAThread]
  1280. //public void print(JObject joInParam)
  1281. //{
  1282. // //显示打印界面
  1283. // SettlementChecklist frmSettlList;
  1284. // string insuAdmObj = JsonHelper.getDestValue(joInParam, "insuAdmObj");
  1285. // if (insuAdmObj == "")
  1286. // {
  1287. // frmSettlList = new SettlementChecklist();
  1288. // }
  1289. // else
  1290. // {
  1291. // JObject joInsuAdmObj = JObject.Parse(insuAdmObj);
  1292. // frmSettlList = new SettlementChecklist(joInsuAdmObj);
  1293. // }
  1294. // if (frmSettlList.ShowDialog() == DialogResult.OK)
  1295. // {
  1296. // };
  1297. //}
  1298. //[STAThread]
  1299. /// <summary>
  1300. /// 辅助交易
  1301. /// </summary>
  1302. /// <param name="InParam"></param>
  1303. /// <returns></returns>
  1304. public string AgentFun(string InParam)
  1305. {
  1306. Global.writeLog("AgentFun 入参:" + JsonHelper.Compress(InParam));
  1307. //设置返回值,错误信息
  1308. int errCode;
  1309. string errMsg, rtnResult = "", outParam;
  1310. try
  1311. {
  1312. //解析入参
  1313. if (parseInparam(InParam, out errMsg) != 0)
  1314. {
  1315. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  1316. return rtnResult;
  1317. }
  1318. //BS架构调用方式问题,每次调用都需要重新初始化
  1319. if (init(InParam, out outParam) != 0)
  1320. {
  1321. rtnResult = outParam;
  1322. if (businessType== "BasicData")
  1323. {
  1324. BasicData bd = new BasicData();
  1325. bd.ShowDialog();
  1326. }
  1327. return rtnResult;
  1328. }
  1329. //获取pat
  1330. //hBus.GetFeeHisInfo(businessType, joInParam, out Global.pat);
  1331. switch (businessType)
  1332. {
  1333. case "BasicData"://基础数据维护
  1334. {
  1335. BasicData bd = new BasicData();
  1336. bd.ShowDialog();
  1337. break;
  1338. }
  1339. case "Exception"://异常处理
  1340. {
  1341. //显示异常处理界面
  1342. HandleException frmEX = new HandleException();
  1343. if (frmEX.ShowDialog() == DialogResult.OK)
  1344. {
  1345. }
  1346. break;
  1347. }
  1348. case "CheckAndClearing"://对账清算
  1349. {
  1350. Clearing frmEX = new Clearing();
  1351. if (frmEX.ShowDialog() == DialogResult.OK)
  1352. {
  1353. }
  1354. break;
  1355. }
  1356. case "Print"://打印
  1357. {
  1358. //显示打印界面
  1359. SettlementChecklist frmSettlList;
  1360. string insuAdmObj = JsonHelper.getDestValue(joInParam, "insuAdmObj");
  1361. if (insuAdmObj == "")
  1362. {
  1363. frmSettlList = new SettlementChecklist();
  1364. frmSettlList.ShowDialog();
  1365. }
  1366. else
  1367. {
  1368. JObject joInsuAdmObj = JObject.Parse(insuAdmObj);
  1369. frmSettlList = new SettlementChecklist(joInsuAdmObj);
  1370. string groupID = JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "groupID");
  1371. DataTable dt = (DataTable)frmSettlList.dgvSettlRecord.DataSource;
  1372. if (dt.Rows.Count != 1)
  1373. {
  1374. frmSettlList.ShowDialog();
  1375. }
  1376. else
  1377. {
  1378. frmSettlList.btnPrint_Click(null,null);
  1379. }
  1380. }
  1381. return JsonHelper.setIrisReturnValue(0, "", null).ToString();
  1382. break;
  1383. }
  1384. case "Log"://日志
  1385. {
  1386. MessageBox.Show(businessType);
  1387. break;
  1388. }
  1389. case "RecordUpload"://上传记录
  1390. {
  1391. MessageBox.Show(businessType);
  1392. break;
  1393. }
  1394. case "HospitalRegister"://备案
  1395. {
  1396. ToRecordChoose Referral = new ToRecordChoose();
  1397. Referral.ShowDialog();
  1398. break;
  1399. }
  1400. case "AssistSelect"://辅助查询
  1401. {
  1402. AssistSelect Serach = new AssistSelect();
  1403. Serach.ShowDialog();
  1404. break;
  1405. }
  1406. case "DRG"://DRG付费管理
  1407. {
  1408. if (hBus.initEnvironment(InParam, out errMsg) != 0)
  1409. {
  1410. return JsonHelper.setExceptionJson(-100, "initEnvironment 失败", errMsg).ToString();
  1411. }
  1412. string drginfo = JsonHelper.getDestValue(joInParam, "params[0].drginfo");
  1413. MessageBox.Show("这是从前端传来的业务入参,请核对一下:" + drginfo);
  1414. if (drginfo != "")
  1415. {
  1416. string ReMsg;
  1417. if (DrgBus.BussinesDRG(drginfo, out ReMsg) == 0)
  1418. rtnResult = JsonHelper.setExceptionJson(0, "调用BUSINESS_HANDLE业务交易成功,医保动态库返回", ReMsg).ToString();
  1419. else
  1420. rtnResult = JsonHelper.setExceptionJson(-1, "调用BUSINESS_HANDLE业务交易失败,医保动态库返回", ReMsg).ToString();
  1421. return rtnResult;
  1422. }
  1423. else
  1424. {
  1425. rtnResult = JsonHelper.setExceptionJson(-1, "入参drginfo为空", joInParam.ToString()).ToString();
  1426. return rtnResult;
  1427. }
  1428. break;
  1429. }
  1430. default:
  1431. {
  1432. rtnResult = JsonHelper.setExceptionJson(-1, "AgentFun 交易", "传入的业务编码不对!").ToString();
  1433. return rtnResult;
  1434. }
  1435. }
  1436. return rtnResult;
  1437. }
  1438. catch (Exception ex)
  1439. {
  1440. rtnResult = JsonHelper.setExceptionJson(-1, "AgentFun 交易", ex.Message).ToString();
  1441. return rtnResult;
  1442. }
  1443. finally
  1444. {
  1445. Global.writeLog("AgentFun 出参:" + JsonHelper.Compress(rtnResult));
  1446. }
  1447. }
  1448. public string Download(string InParam)
  1449. {
  1450. Global.writeLog("Download 入参:" + JsonHelper.Compress(InParam));
  1451. //设置返回值,错误信息
  1452. int errCode;
  1453. string errMsg, rtnResult = "", outParam;
  1454. try
  1455. {
  1456. //解析入参
  1457. if (parseInparam(InParam, out errMsg) != 0)
  1458. {
  1459. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  1460. return rtnResult;
  1461. }
  1462. //BS架构调用方式问题,每次调用都需要重新初始化
  1463. if (init(InParam, out outParam) != 0)
  1464. {
  1465. rtnResult = outParam;
  1466. return rtnResult;
  1467. }
  1468. dynamic joData = new JObject();
  1469. joData.data = joParam["data"];
  1470. //string code = (string)joInParam["code"];
  1471. string funNO = (string)joParam["funNO"];
  1472. switch (businessType)
  1473. {
  1474. case "DirectoryDownload":
  1475. {
  1476. string downloadParam = JsonHelper.setCenterInpar(funNO, joData.ToString());
  1477. rtnResult = hBus.DownloadDirectory(funNO, downloadParam).ToString();
  1478. break;
  1479. }
  1480. case "DictionayDownload":
  1481. {
  1482. string downloadParam = JsonHelper.setCenterInpar(funNO, joData.ToString());
  1483. rtnResult = hBus.downDictionary(downloadParam);
  1484. break;
  1485. }
  1486. }
  1487. return rtnResult;
  1488. }
  1489. catch (Exception ex)
  1490. {
  1491. rtnResult = JsonHelper.setExceptionJson(-100, "Download", ex.Message).ToString();
  1492. return rtnResult;
  1493. }
  1494. finally
  1495. {
  1496. Global.writeLog("Download 出参:" + rtnResult);
  1497. }
  1498. }
  1499. public string PlatformDirectConnect(string InParam)
  1500. {
  1501. //设置返回值,错误信息
  1502. int errCode;
  1503. string errMsg, rtnResult = "", outParam;
  1504. try
  1505. {
  1506. Global.writeLog("PlatformDirectConnect 入参:" + JsonHelper.Compress(InParam));
  1507. //解析入参
  1508. if (parseInparam(InParam, out errMsg) != 0)
  1509. {
  1510. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  1511. return rtnResult;
  1512. }
  1513. Global.businessType = businessType;
  1514. string funNO = JsonHelper.getDestValue(joInParam, "funNO");
  1515. //BS架构调用方式问题,每次调用都需要重新初始化
  1516. if (init(InParam, out outParam) != 0)
  1517. {
  1518. rtnResult = outParam;
  1519. return rtnResult;
  1520. }
  1521. JObject joRtn = invoker.invokeCenterService(funNO, JsonHelper.setCenterInpar(funNO, joParam));
  1522. if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  1523. {
  1524. rtnResult = JsonHelper.setExceptionJson(-1, "平台直连错误", errMsg).ToString();
  1525. return rtnResult;
  1526. }
  1527. else
  1528. {
  1529. rtnResult = JsonHelper.setIrisReturnValue(0, "", joRtn).ToString();
  1530. return rtnResult;
  1531. }
  1532. }
  1533. catch (Exception ex)
  1534. {
  1535. rtnResult = JsonHelper.setExceptionJson(-1, "PlatformDirectConnect 交易", ex.Message).ToString();
  1536. return rtnResult;
  1537. }
  1538. finally
  1539. {
  1540. Global.writeLog("PlatformDirectConnect 出参:" + JsonHelper.Compress(rtnResult));
  1541. }
  1542. }
  1543. }
  1544. }