InsuBusiness.cs 36 KB

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