InsuBusiness.cs 34 KB

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