InsuBusiness.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819
  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 System.Threading;
  17. namespace PTMedicalInsurance
  18. {
  19. public class InsuBusiness : IInsuBusiness
  20. {
  21. //定义相关的变量
  22. //private Patients patient;
  23. //private Fees fee;
  24. //private Settlements settlement;
  25. //json对象属性
  26. private JObject joInParam;
  27. private JArray jaSession ;
  28. private JArray jaParams;
  29. private JObject joParam;
  30. private JObject joInterface;
  31. private JObject joInsuAdmObj;
  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. //
  39. private string businessType;
  40. private string operationType;
  41. public InsuBusiness()
  42. {
  43. Global.curEvt.path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
  44. ComputerInfo comp = new ComputerInfo();
  45. Global.curEvt.mac = comp.GetMAC();
  46. Global.curEvt.ip = comp.GetIP();
  47. Global.pat.insuplc_admdvs = ""; //如果是NULL中心会报错
  48. }
  49. private int parseInparam(string inParam,out string errMsg)
  50. {
  51. errMsg = "";
  52. try
  53. {
  54. joInParam = JObject.Parse(inParam);
  55. jaSession = JArray.Parse(JsonHelper.getDestValue(joInParam, "session"));
  56. Global.curEvt.jaSession = jaSession;
  57. jaParams = JArray.Parse(JsonHelper.getDestValue(joInParam, "params"));
  58. joParam = JObject.FromObject(jaParams[0]);
  59. if (JsonHelper.getDestValue(joInParam, "insuAdmObj") != "")
  60. joInsuAdmObj = JObject.Parse(JsonHelper.getDestValue(joInParam, "insuAdmObj"));
  61. joInterface = JObject.Parse(JsonHelper.getDestValue(joInParam, "interfaceinfo"));
  62. businessType = JsonHelper.getDestValue(joInParam, "businessType");
  63. operationType = JsonHelper.getDestValue(joInParam, "operationType");
  64. if ((businessType == "M6") || (businessType == "M6C") || (businessType == "M6Confirm"))
  65. {
  66. Environment.CurrentDirectory = @"D:\HttpServerAPI\bin";
  67. }
  68. return 0;
  69. }
  70. catch (Exception ex)
  71. {
  72. errMsg = "parseInparam 解析入参异常:" + errMsg;
  73. return -1;
  74. }
  75. }
  76. /// <summary>
  77. /// 签到
  78. /// </summary>
  79. /// <param name="InParam"></param>
  80. /// <returns></returns>
  81. public string Init(string InParam)
  82. {
  83. string errMsg, rtnResult ="";
  84. JObject joRtn = new JObject();
  85. try
  86. {
  87. if (hBus.initEnvironment(InParam, out errMsg) != 0)
  88. {
  89. return JsonHelper.setExceptionJson(-100, "initEnvironment 失败", errMsg).ToString();
  90. }
  91. else
  92. {
  93. if (mIS.isSigned(ref Global.curEvt.signno) != true)
  94. {
  95. if ((businessType != "BasicData") && (businessType != "Print") && (businessType != "MedInsuQuery"))//如果是打开数据对照界面不调用初始化
  96. {
  97. CallResult callResult = new SignInProcess().Process(joRtn);
  98. rtnResult = callResult.Data;
  99. }
  100. else
  101. {
  102. Global.curEvt.signno = "ABC123";
  103. rtnResult = JsonHelper.setIrisReturnValue(0, "非必要初始化业务!", null).ToString();
  104. }
  105. }
  106. else
  107. {
  108. rtnResult = JsonHelper.setIrisReturnValue(0, "初始化成功!", null).ToString();
  109. }
  110. return rtnResult;
  111. }
  112. }
  113. catch (Exception ex)
  114. {
  115. rtnResult = JsonHelper.setExceptionJson(-100, "Init 异常", ex.Message).ToString();
  116. return rtnResult;
  117. }
  118. finally
  119. {
  120. Global.writeLog("初始化结果:" + rtnResult);
  121. }
  122. }
  123. /// <summary>
  124. /// 初始化
  125. /// </summary>
  126. /// <param name="inParam"></param>
  127. /// <param name="outParam"></param>
  128. /// <returns></returns>
  129. private int init(string inParam, out string outParam)
  130. {
  131. string errMsg;
  132. outParam = "";
  133. try
  134. {
  135. //BS架构调用方式问题,每次调用都需要重新初始化
  136. JObject joInitRtn = JObject.Parse(Init(inParam));
  137. if (JsonHelper.parseIrisRtnValue(joInitRtn, out errMsg) != 0)
  138. {
  139. outParam = JsonHelper.setExceptionJson(-100, "init(HIS医保环境初始化)", errMsg).ToString();
  140. return -1;
  141. }
  142. else
  143. {
  144. return 0;
  145. }
  146. }
  147. catch (Exception ex)
  148. {
  149. outParam = JsonHelper.setExceptionJson(-100, "init(HIS医保环境初始化)异常", ex.Message).ToString();
  150. return -1;
  151. }
  152. }
  153. /// <summary>
  154. /// 获取患者信息
  155. /// </summary>
  156. /// <param name="InParam"></param>
  157. /// <returns></returns>
  158. public string GetPatientInfo(string InParam)
  159. {
  160. Global.writeLog("GetPatientInfo入参:" + JsonHelper.Compress(InParam));
  161. //设置返回值,错误信息
  162. string rtnResult = "",outParam;
  163. //BS架构调用方式问题,每次调用都需要重新初始化
  164. if (init(InParam,out outParam)!= 0)
  165. {
  166. rtnResult = outParam;
  167. return rtnResult;
  168. }
  169. JObject joInParam = JObject.Parse(InParam);
  170. string businessType = JsonHelper.getDestValue(joInParam,"businessType");
  171. Global.pat.presetIDNO = JsonHelper.getDestValue(joInParam, "params[0].idNo");
  172. try
  173. {
  174. switch (businessType)
  175. {
  176. case "M1"://门诊读卡
  177. case "Z1"://住院读卡
  178. {
  179. Global.pat.admID = JsonHelper.getDestValue(joInParam, "params[0].admID");
  180. if (!string.IsNullOrEmpty(Global.pat.admID)) {
  181. Global.pat.adm_Dr = int.Parse(Global.pat.admID);
  182. }
  183. //打开读卡窗口,操作员选择读卡类型后进行读卡器读卡,再进行1101获取参保信息
  184. PatientService patientService = new PatientService();
  185. patientService.readPatientInfo(out outParam);
  186. // 同时支持返回错误信息和对象
  187. rtnResult = outParam.ParseReturnObject();
  188. break;
  189. }
  190. }
  191. return rtnResult;
  192. }
  193. catch (Exception ex)
  194. {
  195. rtnResult = JsonHelper.setIrisReturnValue(-1 , "GetPatientInfo发生异常;" + ex.Message,null).ToString();
  196. return rtnResult;
  197. }
  198. finally
  199. {
  200. Global.writeLog("GetPatientInfo出参:" + JsonHelper.Compress(rtnResult));
  201. }
  202. }
  203. /// <summary>
  204. /// 登记
  205. /// </summary>
  206. /// <param name="InParam"></param>
  207. /// <returns></returns>
  208. public string Register(string InParam)
  209. {
  210. Global.writeLog("Register 入参:" + JsonHelper.Compress(InParam));
  211. //设置返回值,错误信息
  212. string errMsg, rtnResult = "", outParam;
  213. try
  214. {
  215. //解析入参
  216. if (parseInparam(InParam, out errMsg) != 0)
  217. {
  218. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  219. return rtnResult;
  220. }
  221. //BS架构调用方式问题,每次调用都需要重新初始化
  222. if (init(InParam, out outParam) != 0)
  223. {
  224. rtnResult = outParam;
  225. return rtnResult;
  226. }
  227. //获取pat
  228. hBus.GetRegPatInfo(businessType, joInParam, out Global.pat);
  229. switch (businessType)
  230. {
  231. case "M2"://门诊登记
  232. {
  233. //string patInfo = "";
  234. //errMsg = showPatientInfo(out patInfo, out outParam);
  235. //if (!errMsg.Equals("0"))
  236. //{
  237. // return errMsg;
  238. //}
  239. //Global.writeLog("获取到病人信息:" + patInfo);
  240. //JObject reg = JObject.Parse(patInfo);
  241. //this.OutpatientReg(reg,patInfo);
  242. break;
  243. }
  244. case "M2C"://门诊登记撤销
  245. {
  246. break;
  247. }
  248. case "Z0"://住院修改
  249. {
  250. break;
  251. }
  252. case "Z2"://入院登记
  253. {
  254. Global.Set.clearingWay = "1"; //住院
  255. rtnResult = new InpatientRegistionProcess().Process(joParam).Data;
  256. break;
  257. }
  258. case "Z2C"://入院登记取消
  259. {
  260. rtnResult = new InpatientRegCancelProcess().Process(joParam).Data;
  261. break;
  262. }
  263. case "Z6"://出院登记
  264. {
  265. break;
  266. }
  267. case "Z6C"://出院登记取消
  268. {
  269. rtnResult = new InpatientExitCancelProcess().Process(joParam).Data;
  270. break;
  271. }
  272. default:
  273. {
  274. rtnResult = JsonHelper.setExceptionJson(-1, "Register 交易", "传入的业务编码不对!").ToString();
  275. return rtnResult;
  276. }
  277. }
  278. }
  279. catch (Exception ex)
  280. {
  281. rtnResult = JsonHelper.setIrisReturnValue(-1, "Register 发生异常;" + ex.Message, null).ToString();
  282. return rtnResult;
  283. }
  284. finally
  285. {
  286. Global.writeLog("Register 出参:" + JsonHelper.Compress(rtnResult));
  287. }
  288. return rtnResult;
  289. }
  290. /// <summary>
  291. /// 费用上传
  292. /// </summary>
  293. /// <param name="InParam"></param>
  294. /// <returns></returns>
  295. public string FeeUpload(string InParam)
  296. {
  297. Global.writeLog("FeeUpload 入参:" + JsonHelper.Compress(InParam));
  298. //设置返回值,错误信息
  299. string errMsg, rtnResult = "", outParam;
  300. try
  301. {
  302. //解析入参
  303. if (parseInparam(InParam, out errMsg) != 0)
  304. {
  305. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  306. return rtnResult;
  307. }
  308. //BS架构调用方式问题,每次调用都需要重新初始化
  309. if (init(InParam, out outParam) != 0)
  310. {
  311. rtnResult = outParam;
  312. return rtnResult;
  313. }
  314. //获取pat
  315. hBus.GetFeeHisInfo(businessType, joInParam, out Global.pat);
  316. switch (businessType)
  317. {
  318. case "M3"://门诊费用上传
  319. {
  320. break;
  321. }
  322. case "M3C"://门诊费用撤销
  323. {
  324. break;
  325. }
  326. case "Z3"://入院费用上传
  327. {
  328. rtnResult = new InpatientFeeUploadProcess().Process(joParam).Data;
  329. break;
  330. }
  331. case "Z3C"://住院费用上传取消
  332. {
  333. rtnResult = new InpatientFeeUploadCancelProcess().Process(joParam).Data;
  334. break;
  335. }
  336. default:
  337. {
  338. rtnResult = JsonHelper.setExceptionJson(-1, "FeeUpload 交易", "传入的业务编码不对!").ToString();
  339. return rtnResult;
  340. }
  341. }
  342. return rtnResult;
  343. }
  344. catch (Exception ex)
  345. {
  346. rtnResult = JsonHelper.setExceptionJson(-1, "FeeUpload 交易", ex.Message).ToString();
  347. return rtnResult;
  348. }
  349. finally
  350. {
  351. Global.writeLog("FeeUpload 出参:" + JsonHelper.Compress(rtnResult));
  352. }
  353. }
  354. /// <summary>
  355. /// 结算
  356. /// </summary>
  357. /// <param name="InParam"></param>
  358. /// <returns></returns>
  359. public string Settlement(string InParam)
  360. {
  361. Global.writeLog("Settlement 入参:" + JsonHelper.Compress(InParam));
  362. //设置返回值,错误信息
  363. string errMsg, rtnResult = "", outParam;
  364. try
  365. {
  366. //解析入参
  367. if (parseInparam(InParam, out errMsg) != 0)
  368. {
  369. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  370. return rtnResult;
  371. }
  372. //BS架构调用方式问题,每次调用都需要重新初始化
  373. if (init(InParam, out outParam) != 0)
  374. {
  375. rtnResult = outParam;
  376. return rtnResult;
  377. }
  378. //获取pat
  379. hBus.GetSettlementHisInfo(businessType, joInParam, out Global.pat);
  380. switch (businessType)
  381. {
  382. case "M4"://门诊预结算
  383. {
  384. // 没有做任何处理?是否必须???
  385. //OutpatientRegistration frmReg = new OutpatientRegistration();
  386. //if (frmReg.ShowDialog() == DialogResult.OK)
  387. //{
  388. // rtnResult = "调用结束";
  389. //}
  390. break;
  391. }
  392. case "M4C"://门诊预结算撤销
  393. {
  394. break;
  395. }
  396. case "M5"://门诊结算
  397. {
  398. Global.Set.clearingWay = "6"; //门诊
  399. OPSettlementService opService = new OPSettlementService();
  400. rtnResult = opService.Charge(operationType, joInParam);
  401. break;
  402. }
  403. case "M5C"://门诊结算撤销
  404. {
  405. OPSettlementService opService = new OPSettlementService();
  406. rtnResult = opService.DisCharge(joParam);
  407. break;
  408. }
  409. case "M6"://门诊移动支付结算
  410. {
  411. #region 移动支付
  412. MobilePay mp = new MobilePay(InParam, out errMsg);
  413. if (errMsg != "")
  414. {
  415. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", errMsg).ToString();
  416. return rtnResult;
  417. }
  418. if (mp.MobilePaySettlement(out outParam) != 0)
  419. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", outParam).ToString();
  420. else
  421. rtnResult = outParam;
  422. return rtnResult;
  423. #endregion
  424. }
  425. case "M6C"://门诊移动支付结算撤销
  426. {
  427. #region 移动支付取消
  428. string onlineYBFalg = JsonHelper.getDestValue(joInsuAdmObj, "onlineYBFalg");
  429. MobilePay mp = new MobilePay(InParam, out errMsg);
  430. if (errMsg != "")
  431. {
  432. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", errMsg).ToString();
  433. return rtnResult;
  434. }
  435. if (String.IsNullOrEmpty(onlineYBFalg))
  436. {
  437. mp.MSettl.onlineYBFalg = "N";
  438. }
  439. else
  440. {
  441. mp.MSettl.onlineYBFalg = onlineYBFalg;
  442. }
  443. if (mp.MobilePayCancelSettlement(out outParam) != 0)
  444. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", outParam).ToString();
  445. else
  446. rtnResult = outParam;
  447. return rtnResult;
  448. #endregion
  449. }
  450. case "M6Confirm"://门诊移动支付确认
  451. {
  452. #region 移动支付确认
  453. MobilePay mp = new MobilePay(InParam, out errMsg);
  454. if (errMsg != "")
  455. {
  456. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", errMsg).ToString();
  457. return rtnResult;
  458. }
  459. if (mp.MobilePayConfirmSettlement(out outParam) != 0)
  460. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", outParam).ToString();
  461. else
  462. rtnResult = outParam;
  463. return rtnResult;
  464. #endregion
  465. }
  466. case "M6Q":
  467. {
  468. MobilePay mp = new MobilePay(InParam, out errMsg);
  469. if (errMsg != "")
  470. {
  471. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", errMsg).ToString();
  472. return rtnResult;
  473. }
  474. mp.MobilePayQuery(out outParam);
  475. return outParam;
  476. }
  477. case "Z4"://住院预结算
  478. {
  479. #region 预结算
  480. Global.pat.RYorCY = "2";
  481. JObject joSettle = new JObject();
  482. CallResult result = new IPPreSettlementProcess().Process(joParam);
  483. if (result.Success)
  484. {
  485. rtnResult = JsonHelper.setExceptionJson(-1, "结算信息展示", result.Data).ToString();
  486. }
  487. else
  488. {
  489. rtnResult = JsonHelper.setIrisReturnValue(0, "预结算成功", null).ToString();
  490. }
  491. break;
  492. #endregion
  493. }
  494. case "Z4C"://住院预结算撤销
  495. {
  496. rtnResult = JsonHelper.setExceptionJson(-100, "该接口不支持预结算取消!", null).ToString();
  497. return rtnResult;
  498. }
  499. case "Z5"://住院结算
  500. {
  501. Global.Set.clearingWay = "1"; //住院
  502. IPSettlementService ipService = new IPSettlementService();
  503. rtnResult = ipService.Charge(operationType,joParam);
  504. break;
  505. }
  506. case "Z5C"://住院结算撤销
  507. {
  508. IPSettlementService ipService = new IPSettlementService();
  509. rtnResult = ipService.DisCharge(joParam);
  510. break;
  511. }
  512. default:
  513. {
  514. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", "传入的业务编码不对!").ToString();
  515. return rtnResult;
  516. }
  517. }
  518. return rtnResult;
  519. }
  520. catch (Exception ex)
  521. {
  522. rtnResult = JsonHelper.setExceptionJson(-1, "Settlement 交易", ex.Message).ToString();
  523. return rtnResult;
  524. }
  525. finally
  526. {
  527. Global.writeLog("Settlement 出参:" + JsonHelper.Compress(rtnResult));
  528. }
  529. }
  530. /// <summary>
  531. /// 辅助交易
  532. /// </summary>
  533. /// <param name="InParam"></param>
  534. /// <returns></returns>
  535. public string AgentFun(string InParam)
  536. {
  537. Global.writeLog("AgentFun 入参:" + JsonHelper.Compress(InParam));
  538. //设置返回值,错误信息
  539. string errMsg, rtnResult = "", outParam;
  540. try
  541. {
  542. //解析入参
  543. if (parseInparam(InParam, out errMsg) != 0)
  544. {
  545. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  546. return rtnResult;
  547. }
  548. //BS架构调用方式问题,每次调用都需要重新初始化
  549. if (init(InParam, out outParam) != 0)
  550. {
  551. Global.writeLog("初始化异常:"+outParam);
  552. rtnResult = outParam;
  553. // 基础数据没有初始化成功,也可以运行
  554. //if ((!businessType.Equals("BasicData")) && (!businessType.Equals("Print")))
  555. //{
  556. // return rtnResult;
  557. //}
  558. }
  559. //获取pat
  560. hBus.GetAgentFunHisInfo(businessType, joInParam, out Global.pat);
  561. switch (businessType)
  562. {
  563. case "BasicData"://基础数据维护
  564. {
  565. BasicData bd = new BasicData();
  566. if (bd.ShowDialog() != DialogResult.OK)
  567. {
  568. rtnResult = JsonHelper.setExceptionJson(-100, "", "已退出基础数据维护界面").ToString();
  569. return rtnResult;
  570. }
  571. break;
  572. }
  573. case "Exception"://异常处理
  574. {
  575. //显示异常处理界面
  576. HandleException frmEX = new HandleException();
  577. if (frmEX.ShowDialog() == DialogResult.OK)
  578. {
  579. rtnResult = JsonHelper.setExceptionJson(-100, "", "已退出异常处理界面").ToString();
  580. return rtnResult;
  581. }
  582. break;
  583. }
  584. case "CheckAndClearing"://对账清算
  585. {
  586. Clearing frmEX = new Clearing();
  587. if (frmEX.ShowDialog() != DialogResult.OK)
  588. {
  589. rtnResult = JsonHelper.setExceptionJson(-100, "", "已退出对账清算界面").ToString();
  590. return rtnResult;
  591. }
  592. break;
  593. }
  594. case "Print"://打印
  595. {
  596. printFastReport();
  597. return JsonHelper.setIrisReturnValue(0, "", null).ToString();
  598. }
  599. case "PrescribeCirculation"://处方流转
  600. {
  601. STA sta = new STA();
  602. Thread thread = new Thread(sta.PrescribeCirculation);
  603. thread.SetApartmentState(ApartmentState.STA); //重点
  604. thread.IsBackground = true;
  605. thread.Start();
  606. thread.Join();
  607. break;
  608. }
  609. case "Log"://日志
  610. {
  611. MessageBox.Show(businessType);
  612. break;
  613. }
  614. case "RecordUpload"://上传记录
  615. {
  616. MessageBox.Show(businessType);
  617. break;
  618. }
  619. case "HospitalRegister"://备案
  620. {
  621. ToRecordChoose Referral = new ToRecordChoose();
  622. Referral.ShowDialog();
  623. break;
  624. }
  625. case "ToPutOnRecord"://医保备案相关
  626. {
  627. STA sta = new STA();
  628. Thread thread = new Thread(sta.ToPutOnRecord);
  629. thread.SetApartmentState(ApartmentState.STA); //重点
  630. thread.IsBackground = true;
  631. thread.Start();
  632. thread.Join();
  633. break;
  634. }
  635. case "PreAndInProcessAnalysis"://事前分析 诊间只有住院的事前分析
  636. {
  637. if (string.IsNullOrEmpty(Global.pat.insuplc_admdvs))
  638. {
  639. //通过查询医保平台登记信息表获取参保地
  640. if (mIS.queryRegisterInfo(3, out outParam) == 0)
  641. {
  642. JObject joReg = JObject.Parse(outParam);
  643. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joReg, "data.InsuranceAreaCode");
  644. }
  645. }
  646. Global.pat.adm_Dr = int.Parse(JsonHelper.getDestValue(joInParam, "params[0].admID"));
  647. JObject joResult = new JObject();
  648. joResult.Add("result", JObject.Parse(JsonHelper.getDestValue(joParam, "insuData")));
  649. //事前分析
  650. if (Global.curEvt.ext.isOpenAnalysis)
  651. {
  652. if (hBus.PreAnalysis("5", joResult.ToString(), out errMsg) != 0)
  653. {
  654. MessageBox.Show(errMsg);
  655. break;
  656. }
  657. }
  658. break;
  659. }
  660. case "HistoryPrescriptionQuery":
  661. // 历史处方查询
  662. string funNo = JsonHelper.getDestValue(joInParam, "funNO");
  663. TradeEnum trade = TradeEnum.DEFAULT.GetByCode(funNo);
  664. new OtherQueryProcess(trade).Process(JObject.Parse(InParam));
  665. break;
  666. case "DualChannelRecord":
  667. // 双通道备案
  668. DualChannelRecordForm recordForm = new DualChannelRecordForm();
  669. recordForm.ShowDialog();
  670. break;
  671. case "CenterQuery"://中心查询
  672. {
  673. STA sta = new STA();
  674. Thread thread = new Thread(sta.CenterQuery);
  675. thread.SetApartmentState(ApartmentState.STA); //重点
  676. thread.IsBackground = true;
  677. thread.Start();
  678. thread.Join();
  679. break;
  680. }
  681. case "MedInsuQuery"://医保查询
  682. {
  683. MedInsuQuery MedQuery = new MedInsuQuery();
  684. if (MedQuery.ShowDialog() != DialogResult.OK)
  685. {
  686. rtnResult = JsonHelper.setExceptionJson(-100, "", "已退出医保查询界面").ToString();
  687. return rtnResult;
  688. }
  689. break;
  690. }
  691. default:
  692. {
  693. rtnResult = JsonHelper.setExceptionJson(-1, "AgentFun 交易", "传入的业务编码不对!").ToString();
  694. break;
  695. }
  696. }
  697. return rtnResult;
  698. }
  699. catch (Exception ex)
  700. {
  701. rtnResult = JsonHelper.setExceptionJson(-1, "AgentFun 交易", ex.Message).ToString();
  702. return rtnResult;
  703. }
  704. finally
  705. {
  706. Global.writeLog("AgentFun 出参:" + JsonHelper.Compress(rtnResult));
  707. }
  708. }
  709. private void printFastReport()
  710. {
  711. SettlementBillPrint frmSettlList;
  712. string insuAdmObj = JsonHelper.getDestValue(joInParam, "insuAdmObj");
  713. if (insuAdmObj == "")
  714. {
  715. frmSettlList = new SettlementBillPrint();
  716. frmSettlList.ShowDialog();
  717. }
  718. else
  719. {
  720. JObject joInsuAdmObj = JObject.Parse(insuAdmObj);
  721. frmSettlList = new SettlementBillPrint(joInsuAdmObj);
  722. string groupID = JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "groupID");
  723. DataTable dt = (DataTable)frmSettlList.dgvSettlRecord.DataSource;
  724. frmSettlList.btnPrint_Click(null, null);
  725. }
  726. }
  727. public string PlatformDirectConnect(string InParam)
  728. {
  729. //设置返回值,错误信息
  730. string errMsg, rtnResult = "", outParam;
  731. try
  732. {
  733. Global.writeLog("PlatformDirectConnect 入参:" + JsonHelper.Compress(InParam));
  734. //解析入参
  735. if (parseInparam(InParam, out errMsg) != 0)
  736. {
  737. rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
  738. return rtnResult;
  739. }
  740. Global.businessType = businessType;
  741. string funNO = JsonHelper.getDestValue(joInParam, "funNO");
  742. //BS架构调用方式问题,每次调用都需要重新初始化
  743. if (init(InParam, out outParam) != 0)
  744. {
  745. rtnResult = outParam;
  746. return rtnResult;
  747. }
  748. Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joInParam, "insuplc_admdvs");
  749. JObject joRtn = invoker.invokeCenterAgentService(funNO, joParam);
  750. if (JsonHelper.parseCenterRtnValue(joRtn, out errMsg) != 0)
  751. {
  752. rtnResult = JsonHelper.setExceptionJson(-1, "平台直连错误", errMsg).ToString();
  753. return rtnResult;
  754. }
  755. else
  756. {
  757. rtnResult = JsonHelper.setIrisReturnValue(0, "", joRtn).ToString();
  758. return rtnResult;
  759. }
  760. }
  761. catch (Exception ex)
  762. {
  763. rtnResult = JsonHelper.setExceptionJson(-1, "PlatformDirectConnect 交易", ex.Message).ToString();
  764. return rtnResult;
  765. }
  766. finally
  767. {
  768. Global.writeLog("PlatformDirectConnect 出参:" + JsonHelper.Compress(rtnResult));
  769. }
  770. }
  771. }
  772. }