InsuBusiness.cs 37 KB

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