InsuBusiness.cs 88 KB

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