InsuBusiness.cs 88 KB

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