LocalMobilePayProcess.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Common;
  3. using PTMedicalInsurance.Helper;
  4. using PTMedicalInsurance.Variables;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace PTMedicalInsurance.Business
  11. {
  12. class LocalMobilePayProcess : AbstractProcess
  13. {
  14. private Patients MPat;
  15. public Settlements MSettl;
  16. private JObject joParam;
  17. private JObject joInsuAdmObj;
  18. private JObject joResponse;
  19. /// <summary>
  20. /// 支付请求
  21. /// </summary>
  22. /// <param name="input"></param>
  23. /// <returns></returns>
  24. public override CallResult Process(JObject input)
  25. {
  26. //调用HIS费用查询信息
  27. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  28. {
  29. return Exception("获取HIS费用", outParam);
  30. }
  31. //调用医保平台转换
  32. JObject joHisFee = JObject.Parse(outParam);
  33. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  34. {
  35. return Exception("转换HIS费用", outParam);
  36. }
  37. Decimal total = 0;
  38. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  39. jaFeeDetail.ToList().ForEach((fee) =>
  40. {
  41. fee["chrg_bchno"] = Global.pat.adm_Dr.ToString();
  42. fee["med_type"] = Global.pat.medType;
  43. fee["med_list_spc"] = fee["spec"];
  44. dynamic expContent = new JObject();
  45. JProperty exp = fee.Children<JProperty>().FirstOrDefault(p => p.Name == "expContent");
  46. if (exp != null)
  47. {
  48. exp.Remove();
  49. }
  50. string item_sum = JsonHelper.getDestValue((JObject)fee, "det_item_fee_sumamt");
  51. if (!string.IsNullOrEmpty(item_sum)) {
  52. total += Decimal.Parse(item_sum);
  53. }
  54. expContent.selfpay_prop = fee["SelfPayPercent"];
  55. expContent.drord_no = fee["drord_no"];
  56. fee["exp_content"] = expContent;
  57. });
  58. JObject joSettlement = (JObject)input["settlement"];
  59. joSettlement["medfee_sumamt"] = total;
  60. //合并参数
  61. dynamic joInput = new JObject();
  62. joInput.Add("feedetail", jaFeeDetail);
  63. joInput = mergeJson(joInput, (JObject)input["patInfo"]);
  64. joInput = mergeJson(joInput, (JObject)input["data"]);
  65. joInput = mergeJson(joInput, (JObject)input["mdtrtinfo"]);
  66. joInput = mergeJson(joInput, joSettlement);
  67. joInput.Add("diseinfo_list",input["diseinfo"]);
  68. joInput.Add("feedetail_list", jaFeeDetail);
  69. dynamic joExpContent = new JObject();
  70. joExpContent.op_swssc_flag = "0";
  71. joExpContent.itnt_hosp_flag = "0";
  72. joExpContent.mulaid_flag = "0";
  73. joInput.exp_content = joExpContent;
  74. outParam = JsonHelper.toJsonString(joInput);
  75. return Success();
  76. }
  77. private JObject mergeJson(JObject source,JObject target)
  78. {
  79. source.Merge(target, new JsonMergeSettings
  80. {
  81. MergeArrayHandling = MergeArrayHandling.Union
  82. });
  83. return source;
  84. }
  85. private void init(JObject joInpar)
  86. {
  87. joParam = JObject.Parse(JsonHelper.getDestValue(joInpar, "params[0]"));
  88. joInsuAdmObj = JObject.Parse(JsonHelper.getDestValue(joInpar, "insuAdmObj"));
  89. string response = JsonHelper.getDestValue(joInpar, "responsecontent");
  90. if(!string.IsNullOrEmpty(response))
  91. {
  92. joResponse = JObject.Parse(response);
  93. }
  94. setPatientByInPar();
  95. setSettlementsByInPar();
  96. }
  97. public void setSettlementsByInPar()
  98. {
  99. MSettl.clearingWay = JsonHelper.getDestValue(joInsuAdmObj, "psnSetlway");
  100. MSettl.settlID = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId");
  101. MSettl.payOrdId = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId");
  102. }
  103. public void setPatientByInPar()
  104. {
  105. MPat.adm_Dr = int.Parse(JsonHelper.getDestValue(joParam, "admID"));
  106. Global.pat.adm_Dr = MPat.adm_Dr;
  107. MPat.name = JsonHelper.getDestValue(joInsuAdmObj, "patName");
  108. MPat.recordID = JsonHelper.getDestValue(joParam, "recordID");
  109. MPat.billID = JsonHelper.getDestValue(joParam, "billID");
  110. MPat.medType = JsonHelper.getDestValue(joInsuAdmObj, "medType");
  111. MPat.certType = JsonHelper.getDestValue(joInsuAdmObj, "mdtrtCertType");
  112. MPat.token = JsonHelper.getDestValue(joInsuAdmObj, "ecToken");
  113. MPat.payAuthNo = JsonHelper.getDestValue(joInsuAdmObj, "payAuthNo");
  114. MPat.uldLatlnt = JsonHelper.getDestValue(joInsuAdmObj, "uldLatlnt");
  115. MPat.payOrdId = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId");
  116. MPat.mdtrtID = JsonHelper.getDestValue(joInsuAdmObj, "mdtrt_id");
  117. if (string.IsNullOrEmpty(MPat.mdtrtID) && joResponse != null)
  118. {
  119. MPat.mdtrtID = JsonHelper.getDestValue(joResponse, "SETLINFO.mdtrt_id");
  120. }
  121. MPat.settlID = JsonHelper.getDestValue(joInsuAdmObj, "setl_id");
  122. if (string.IsNullOrEmpty(MPat.settlID) && joResponse != null)
  123. {
  124. MPat.settlID = JsonHelper.getDestValue(joResponse, "SETLINFO.setl_id");
  125. MPat.psn_no = JsonHelper.getDestValue(joResponse, "SETLINFO.psn_no");
  126. MPat.payOrdId = MPat.settlID;
  127. MPat.insuplc_admdvs = JsonHelper.getDestValue(joResponse, "insuplcAdmdvs");
  128. }
  129. Global.pat.mdtrtID = MPat.mdtrtID;
  130. }
  131. /// <summary>
  132. /// 交易确认
  133. /// </summary>
  134. /// <param name="input"></param>
  135. public CallResult Confirm(JObject input)
  136. {
  137. outParam = "";
  138. string errMsg = "";
  139. init(input);
  140. // save
  141. //设置
  142. JObject joSettle = joResponse["SETLINFO"].ToObject<JObject>();
  143. setSettlementsBy6202Rtn(joSettle);
  144. MSettl.confirmFlag = 0;
  145. //存入MI 结算表
  146. if (saveSettlement(out errMsg) != 0)
  147. {
  148. outParam = errMsg;
  149. return Exception(-1, "保存结算信息失败",errMsg);
  150. }
  151. MobilePayConfirmSettlement(joSettle,out outParam);
  152. return IrisReturn("结算成功",null);
  153. }
  154. private int MobilePayConfirmSettlement(JObject joSettlInfo,out string outPar)
  155. {
  156. string errMsg;
  157. outPar = "";
  158. try
  159. {
  160. //设置
  161. setSettlementsBy6301Rtn(joSettlInfo);
  162. MSettl.confirmFlag = 1;
  163. //存入MI 结算表
  164. if (updateSettlement(out errMsg) != 0)
  165. {
  166. outPar = errMsg;
  167. return -1;
  168. }
  169. else
  170. {
  171. //返回给HIS前端
  172. outPar = JsonHelper.setExceptionJson(0, "云医保平台", "确认成功!").ToString();
  173. return 0;
  174. }
  175. }
  176. catch (Exception ex)
  177. {
  178. outPar = ex.Message;
  179. return -1;
  180. }
  181. }
  182. public void setSettlementsBy6202Rtn(JObject jo)
  183. {
  184. MSettl.settlID = JsonHelper.getDestValue(jo, "setl_id");
  185. MPat.payOrdId = MSettl.settlID;
  186. MSettl.payOrdId = MSettl.settlID;
  187. MSettl.ordStas = JsonHelper.getDestValue(jo, "ordStas");
  188. MSettl.sumamt = getDecimalFee(jo, "medfee_sumamt");
  189. MSettl.personCashPay = getDecimalFee(jo, "ownPayAmt");
  190. MSettl.accountPaySumamt = getDecimalFee(jo, "acct_pay");
  191. MSettl.fundPaySumamt = getDecimalFee(jo, "fund_pay_sumamt");
  192. MSettl.deposit = getDecimalFee(jo, "deposit");
  193. MSettl.clearingOrgan = JsonHelper.getDestValue(jo, "clr_optins");
  194. MSettl.clearingType = JsonHelper.getDestValue(jo, "clr_type");
  195. MSettl.clearingWay = JsonHelper.getDestValue(jo, "clr_way");
  196. MSettl.civilserviceAllowancePay = getDecimalFee(jo, "cvlserv_pay");
  197. MSettl.ownPayAmount = getDecimalFee(jo, "fulamt_ownpay_amt");
  198. MSettl.overLimitAmountmt = getDecimalFee(jo, "overlmt_selfpay");
  199. MSettl.preSelfPayAmount = getDecimalFee(jo, "preselfpay_amt");
  200. MSettl.inPolicyRangeAmount = getDecimalFee(jo, "inscp_scp_amt");
  201. MSettl.actualPayDeductible = getDecimalFee(jo, "act_pay_dedc");
  202. MSettl.healthInsurancePay = getDecimalFee(jo, "hifp_pay");
  203. MSettl.healthInsuranceRatio = getDecimalFee(jo, "pool_prop_selfpay");
  204. MSettl.enterpriseSupplementPay = getDecimalFee(jo, "hifes_pay");
  205. MSettl.seriousIllnessPay = getDecimalFee(jo, "hifmi_pay");
  206. MSettl.largeExpensesSupplementPay = getDecimalFee(jo, "hifob_pay");
  207. MSettl.medicalAssistPay = getDecimalFee(jo, "maf_pay");
  208. MSettl.hospitalPartAmount = getDecimalFee(jo, "hosp_part_amt");
  209. MSettl.otherPay = getDecimalFee(jo, "oth_pay");
  210. MSettl.personPaySumamt = getDecimalFee(jo, "psn_part_amt");
  211. MSettl.balance = getDecimalFee(jo, "balc");
  212. MSettl.accountMutualAidAmount = getDecimalFee(jo, "acct_mulaid_pay");
  213. }
  214. /// <summary>
  215. /// 插入结算信息
  216. /// </summary>
  217. /// <param name="joSettlement"></param>
  218. /// <param name="outParam"></param>
  219. /// <returns></returns>
  220. public int saveSettlement(out string outParam)
  221. {
  222. JObject joTmp = new JObject();
  223. string errMsg = "";
  224. try
  225. {
  226. JObject joSetlinfo = new JObject();
  227. joSetlinfo.Add("HospitalDr", Global.inf.hospitalDr);
  228. joSetlinfo.Add("admID", MPat.adm_Dr);
  229. joSetlinfo.Add("mdtrt_id", MPat.mdtrtID);
  230. joSetlinfo.Add("setl_id", MSettl.settlID);//
  231. joSetlinfo.Add("pay_ord_id", MSettl.payOrdId);
  232. joSetlinfo.Add("psn_no", MPat.psn_no);
  233. joSetlinfo.Add("psn_name", MPat.name);
  234. //joSetlinfo.Add("mdtrt_cert_type", JsonHelper.getDestValue(joRtnSetlinfo, "mdtrt_cert_type"));
  235. joSetlinfo.Add("certno", MPat.certNO);
  236. joSetlinfo.Add("gend", MPat.gend);
  237. joSetlinfo.Add("naty", MPat.naty);
  238. joSetlinfo.Add("brdy", MPat.brdy);
  239. joSetlinfo.Add("age", MPat.age);
  240. joSetlinfo.Add("insutype", MPat.insuType);
  241. joSetlinfo.Add("psn_type", MPat.psn_type);
  242. joSetlinfo.Add("cvlserv_flag", "");
  243. joSetlinfo.Add("setl_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  244. joSetlinfo.Add("mdtrt_cert_type", MPat.mdtrtcertType);
  245. joSetlinfo.Add("med_type", MPat.medType);
  246. joSetlinfo.Add("medfee_sumamt", MSettl.sumamt);//总费用
  247. joSetlinfo.Add("fulamt_ownpay_amt", MSettl.ownPayAmount);//全自费金额
  248. joSetlinfo.Add("overlmt_selfpay", MSettl.overLimitAmountmt);//超限价自费费用
  249. joSetlinfo.Add("preselfpay_amt", MSettl.preSelfPayAmount);//先行自付金额
  250. joSetlinfo.Add("inscp_scp_amt", MSettl.inPolicyRangeAmount);//符合政策范围金额
  251. joSetlinfo.Add("act_pay_dedc", MSettl.actualPayDeductible);//实际支付起付线
  252. joSetlinfo.Add("hifp_pay", MSettl.healthInsurancePay);//基本医疗保险统筹基金支出
  253. joSetlinfo.Add("pool_prop_selfpay", MSettl.healthInsuranceRatio);//基本医疗保险统筹基金支付比例
  254. joSetlinfo.Add("cvlserv_pay", MSettl.civilserviceAllowancePay);//公务员医疗补助资金支出
  255. joSetlinfo.Add("hifes_pay", MSettl.enterpriseSupplementPay);//企业支付 占用 大病报销金额
  256. joSetlinfo.Add("hifmi_pay", MSettl.seriousIllnessPay);// 居民大病保险资金支出
  257. joSetlinfo.Add("hifob_pay", MSettl.largeExpensesSupplementPay);//职工大额医疗费用补助基金支出
  258. joSetlinfo.Add("maf_pay", MSettl.medicalAssistPay);//医疗救助基金支出
  259. joSetlinfo.Add("hosp_part_amt", MSettl.hospitalPartAmount);//医院负担金额
  260. joSetlinfo.Add("oth_pay", MSettl.otherPay);//其他支出
  261. joSetlinfo.Add("fund_pay_sumamt", MSettl.fundPaySumamt);//基金支付总额
  262. joSetlinfo.Add("psn_part_amt", MSettl.personPaySumamt);//个人负担总金额
  263. joSetlinfo.Add("acct_pay", MSettl.accountPaySumamt);//个人账户支出
  264. joSetlinfo.Add("psn_cash_pay", MSettl.personCashPay);//个人现金支出
  265. joSetlinfo.Add("balc", MSettl.balance);// 余额
  266. joSetlinfo.Add("acct_mulaid_pay", "");//个人账户共济支付金额
  267. joSetlinfo.Add("medins_setl_id", "");//医药机构结算ID
  268. joSetlinfo.Add("clr_optins", MSettl.clearingOrgan);//清算经办机构
  269. joSetlinfo.Add("clr_way", MSettl.clearingWay);//清算方式
  270. joSetlinfo.Add("clr_type", MSettl.clearingType);//清算类别
  271. joSetlinfo.Add("ValidFlag", 1);
  272. joSetlinfo.Add("BillType", 1);
  273. joSetlinfo.Add("msgid", Global.curEvt.msgid);
  274. joSetlinfo.Add("admType", "3");
  275. joSetlinfo.Add("billID", MPat.billID);
  276. joSetlinfo.Add("recordID", MPat.recordID);
  277. joSetlinfo.Add("interfaceDr", Global.inf.interfaceDr);
  278. joSetlinfo.Add("insuplc_admdvs", MPat.insuplc_admdvs);
  279. joSetlinfo.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  280. joSetlinfo.Add("HospitalizationsDays", MSettl.hospitalizationsDays);
  281. joSetlinfo.Add("HospitalizationsTimes", MSettl.hospitalizationsTimes);
  282. joSetlinfo.Add("HISAdmTime", MSettl.hisAdmTime);
  283. joSetlinfo.Add("HISDischargeTime", MSettl.hisDischargeTime);
  284. joSetlinfo.Add("updateUserID", Global.user.ID);
  285. joSetlinfo.Add("ConfirmFlag", MSettl.confirmFlag);
  286. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010051", joSetlinfo).ToString(), "插入结算信息");
  287. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  288. {
  289. outParam = errMsg;
  290. return -1;
  291. }
  292. else
  293. {
  294. outParam = joSetlinfo.ToString();
  295. return 0;
  296. }
  297. }
  298. catch (Exception ex)
  299. {
  300. outParam = "插入结算信息:" + ex.Message;
  301. return -1;
  302. }
  303. }
  304. public void setSettlementsBy6301Rtn(JObject jo)
  305. {
  306. MSettl.settlID = MPat.payOrdId;
  307. MPat.psn_no = JsonHelper.getDestValue(jo, "psn_no");
  308. MPat.naty = JsonHelper.getDestValue(jo, "naty");
  309. //MPat.name = JsonHelper.getDestValue(jo, "name");
  310. MPat.age = JsonHelper.getDestValue(jo, "age");
  311. MPat.gend = JsonHelper.getDestValue(jo, "gend");
  312. MPat.certNO = JsonHelper.getDestValue(jo, "certno");
  313. MPat.brdy = JsonHelper.getDestValue(jo, "brdy");
  314. MPat.insuType = JsonHelper.getDestValue(jo, "insutype");
  315. MPat.psn_type = JsonHelper.getDestValue(jo, "psn_type");
  316. MPat.mdtrtcertType = JsonHelper.getDestValue(jo, "mdtrt_cert_type");
  317. MPat.medType = JsonHelper.getDestValue(jo, "med_type");
  318. //MPat.insuplc_admdvs = JsonHelper.getDestValue(jo, "insuplc_admdvs");
  319. //MPat.payOrdId = JsonHelper.getDestValue(jo, "payOrdId");
  320. MSettl.ordStas = JsonHelper.getDestValue(jo, "ordStas");
  321. MSettl.sumamt = getDecimalFee(jo, "medfee_sumamt");
  322. MSettl.personCashPay = getDecimalFee(jo, "psn_cash_pay");
  323. MSettl.accountPaySumamt = getDecimalFee(jo, "acct_pay");
  324. MSettl.fundPaySumamt = getDecimalFee(jo, "fund_pay_sumamt");
  325. //MSettl.deposit = getDecimalFee(jo, "deposit");
  326. MSettl.clearingOrgan = JsonHelper.getDestValue(jo, "clr_optins");
  327. MSettl.clearingType = JsonHelper.getDestValue(jo, "clr_type");
  328. MSettl.clearingWay = JsonHelper.getDestValue(jo, "clr_way");
  329. MSettl.civilserviceAllowancePay = getDecimalFee(jo, "cvlserv_pay");
  330. MSettl.ownPayAmount = getDecimalFee(jo, "fulamt_ownpay_amt");
  331. MSettl.overLimitAmountmt = getDecimalFee(jo, "overlmt_selfpay");
  332. MSettl.preSelfPayAmount = getDecimalFee(jo, "preselfpay_amt");
  333. MSettl.inPolicyRangeAmount = getDecimalFee(jo, "inscp_scp_amt");
  334. MSettl.actualPayDeductible = getDecimalFee(jo, "act_pay_dedc");
  335. MSettl.healthInsurancePay = getDecimalFee(jo, "hifp_pay");
  336. MSettl.healthInsuranceRatio = getDecimalFee(jo, "pool_prop_selfpay");
  337. MSettl.enterpriseSupplementPay = getDecimalFee(jo, "hifes_pay");
  338. MSettl.seriousIllnessPay = getDecimalFee(jo, "hifmi_pay");
  339. MSettl.largeExpensesSupplementPay = getDecimalFee(jo, "hifob_pay");
  340. MSettl.medicalAssistPay = getDecimalFee(jo, "maf_pay");
  341. MSettl.hospitalPartAmount = getDecimalFee(jo, "hosp_part_amt");
  342. MSettl.otherPay = getDecimalFee(jo, "oth_pay");
  343. MSettl.personPaySumamt = getDecimalFee(jo, "psn_part_amt");
  344. MSettl.balance = getDecimalFee(jo, "balc");
  345. MSettl.accountMutualAidAmount = getDecimalFee(jo, "acct_mulaid_pay");
  346. }
  347. /// <summary>
  348. /// 获取结算费用的封装
  349. /// </summary>
  350. /// <param name="jo"></param>
  351. /// <param name="path"></param>
  352. /// <returns></returns>
  353. private decimal getDecimalFee(JObject jo, string path)
  354. {
  355. try
  356. {
  357. string temp = JsonHelper.getDestValue(jo, path);
  358. if (temp == "")
  359. {
  360. return 0;
  361. }
  362. else
  363. {
  364. return decimal.Parse(temp);
  365. }
  366. }
  367. catch (Exception ex)
  368. {
  369. Global.writeLog("getFee异常:" + ex.Message);
  370. return 0;
  371. }
  372. }
  373. public int updateSettlement(out string outParam)
  374. {
  375. JObject joTmp = new JObject();
  376. string errMsg = "";
  377. try
  378. {
  379. JObject joSetlinfo = new JObject();
  380. joSetlinfo.Add("HospitalDr", Global.inf.hospitalDr);
  381. joSetlinfo.Add("AdmDr", MPat.adm_Dr);
  382. joSetlinfo.Add("MdtrtID", MPat.mdtrtID);
  383. joSetlinfo.Add("SettlementID", MSettl.settlID);//
  384. joSetlinfo.Add("PayOrdID", MSettl.payOrdId);
  385. joSetlinfo.Add("PersonnelNO", MPat.psn_no);
  386. joSetlinfo.Add("PatientName", MPat.name);
  387. //joSetlinfo.Add("CertificateType", JsonHelper.getDestValue(joRtnSetlinfo, "mdtrt_cert_type"));
  388. joSetlinfo.Add("CertificateNO", MPat.certNO);
  389. joSetlinfo.Add("Gender", MPat.gend);
  390. joSetlinfo.Add("Nation", MPat.naty);
  391. joSetlinfo.Add("BirthDay", MPat.brdy);
  392. joSetlinfo.Add("Age", MPat.age);
  393. joSetlinfo.Add("InsuranceType", MPat.insuType);
  394. joSetlinfo.Add("PersonType", MPat.psn_type);
  395. joSetlinfo.Add("CivilserviceFlag", "");
  396. joSetlinfo.Add("SettlementDateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  397. joSetlinfo.Add("MdtrtCertType", MPat.mdtrtcertType);
  398. joSetlinfo.Add("MedicalType", MPat.medType);
  399. joSetlinfo.Add("Sumamt", MSettl.sumamt);//总费用
  400. joSetlinfo.Add("OwnPayAmount", MSettl.ownPayAmount);//全自费金额
  401. joSetlinfo.Add("OverLimitAmount", MSettl.overLimitAmountmt);//超限价自费费用
  402. joSetlinfo.Add("PreSelfPayAmount", MSettl.preSelfPayAmount);//先行自付金额
  403. joSetlinfo.Add("InPolicyRangeAmount", MSettl.inPolicyRangeAmount);//符合政策范围金额
  404. joSetlinfo.Add("ActualPayDeductible", MSettl.actualPayDeductible);//实际支付起付线
  405. joSetlinfo.Add("HealthInsurancePay", MSettl.healthInsurancePay);//基本医疗保险统筹基金支出
  406. joSetlinfo.Add("HealthInsuranceRatio", MSettl.healthInsuranceRatio);//基本医疗保险统筹基金支付比例
  407. joSetlinfo.Add("CivilserviceAllowancePay", MSettl.civilserviceAllowancePay);//公务员医疗补助资金支出
  408. joSetlinfo.Add("EnterpriseSupplementPay", MSettl.enterpriseSupplementPay);//企业支付
  409. joSetlinfo.Add("SeriousIllnessPay", MSettl.seriousIllnessPay);// 居民大病保险资金支出
  410. joSetlinfo.Add("LargeExpensesSupplementPay", MSettl.largeExpensesSupplementPay);//职工大额医疗费用补助基金支出
  411. joSetlinfo.Add("MedicalAssistPay", MSettl.medicalAssistPay);//医疗救助基金支出
  412. joSetlinfo.Add("HospitalPartAmount", MSettl.hospitalPartAmount);//医院负担金额
  413. joSetlinfo.Add("OtherPay", MSettl.otherPay);//其他支出
  414. joSetlinfo.Add("FundPaySumamt", MSettl.fundPaySumamt);//基金支付总额
  415. joSetlinfo.Add("PersonPaySumamt", MSettl.personPaySumamt);//个人负担总金额
  416. joSetlinfo.Add("AccountPaySumamt", MSettl.accountPaySumamt);//个人账户支出
  417. joSetlinfo.Add("PersonCashPay", MSettl.personCashPay);//个人现金支出
  418. joSetlinfo.Add("Balance", MSettl.balance);// 余额
  419. joSetlinfo.Add("AccountMutualAidAmount", "");//个人账户共济支付金额
  420. joSetlinfo.Add("OrganSettlementID", "");//医药机构结算ID
  421. joSetlinfo.Add("ClearingOrgan", MSettl.clearingOrgan);//清算经办机构
  422. joSetlinfo.Add("ClearingWay", MSettl.clearingWay);//清算方式
  423. joSetlinfo.Add("ClearingType", MSettl.clearingType);//清算类别
  424. joSetlinfo.Add("ValidFlag", 1);
  425. joSetlinfo.Add("BillType", 1);
  426. joSetlinfo.Add("ConfirmFlag", MSettl.confirmFlag);
  427. joSetlinfo.Add("MSGID", Global.curEvt.msgid);
  428. joSetlinfo.Add("AdmType", "3");
  429. joSetlinfo.Add("BillID", MPat.billID);
  430. joSetlinfo.Add("RecordID", MPat.recordID);
  431. joSetlinfo.Add("InterfaceDr", Global.inf.interfaceDr);
  432. joSetlinfo.Add("InsuranceAreaCode", MPat.insuplc_admdvs);
  433. joSetlinfo.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  434. joSetlinfo.Add("HospitalizationsDays", MSettl.hospitalizationsDays);
  435. joSetlinfo.Add("HospitalizationsTimes", MSettl.hospitalizationsTimes);
  436. joSetlinfo.Add("HISAdmTime", MSettl.hisAdmTime);
  437. joSetlinfo.Add("HISDischargeTime", MSettl.hisDischargeTime);
  438. joSetlinfo.Add("updateUserID", Global.user.ID);
  439. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010089", joSetlinfo).ToString(), "通过订单号更新结算信息");
  440. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  441. {
  442. outParam = errMsg;
  443. return -1;
  444. }
  445. else
  446. {
  447. outParam = joSetlinfo.ToString();
  448. return 0;
  449. }
  450. }
  451. catch (Exception ex)
  452. {
  453. outParam = "插入结算信息:" + ex.Message;
  454. return -1;
  455. }
  456. }
  457. public void setPatientByMiRegInfo(JObject jo)
  458. {
  459. MPat.name = JsonHelper.getDestValue(jo, "data.PatientName");
  460. MPat.psn_no = JsonHelper.getDestValue(jo, "data.PersonalNO");
  461. MPat.certNO = JsonHelper.getDestValue(jo, "data.CertificateNO");
  462. MPat.IDNO = MPat.certNO;
  463. MPat.certType = JsonHelper.getDestValue(jo, "data.CertificateType");
  464. MPat.payToken = JsonHelper.getDestValue(jo, "data.payToken");
  465. MPat.insuplc_admdvs = JsonHelper.getDestValue(jo, "data.InsuranceAreaCode");
  466. }
  467. //获取入参,入参基本为类局部变量
  468. public int Get6301Inpar(out string outparam)
  469. {
  470. outparam = "";
  471. try
  472. {
  473. string errMsg;
  474. //查询登记信息
  475. if (mIS.queryRegisterInfo(4, out errMsg) != 0)
  476. {
  477. outparam = errMsg;
  478. return -1;
  479. }
  480. setPatientByMiRegInfo(JObject.Parse(errMsg));
  481. //获取其他入参
  482. JObject joInpar = new JObject();
  483. joInpar.Add("payOrdId", MPat.payOrdId);//待支付订单号
  484. joInpar.Add("payToken", MPat.payToken);//支付订单对应的token
  485. joInpar.Add("orgCodg", Global.inf.hospitalNO);//定点机构编码
  486. joInpar.Add("idNo", MPat.IDNO);//业务流水号 前端传入
  487. joInpar.Add("userName", MPat.name);
  488. joInpar.Add("idType", "01");
  489. joInpar.Add("expData", "");
  490. //JObject joData = new JObject();
  491. //joData.Add("data", joInpar);
  492. outparam = joInpar.ToString();
  493. return 0;
  494. }
  495. catch (Exception ex)
  496. {
  497. outparam = "Get6301Inpar:" + ex.Message;
  498. return -1;
  499. }
  500. finally
  501. {
  502. Global.writeLog("Get6301Inpar", "", outparam);
  503. }
  504. }
  505. private int MobilePayQuery(out string outPar)
  506. {
  507. string errMsg, M6301Inpar;
  508. outPar = "";
  509. //6301查询具体明细信息
  510. if (Get6301Inpar(out errMsg) != 0)
  511. {
  512. outPar = errMsg;
  513. return -1;
  514. }
  515. M6301Inpar = errMsg;
  516. JObject joM6301Rtn = invoker.invokeMPService("6301", M6301Inpar);
  517. if (JsonHelper.parseMPRtnValue(joM6301Rtn, out errMsg) != 0)
  518. {
  519. outPar = errMsg;
  520. return -1;
  521. }
  522. outPar = joM6301Rtn.ToString();
  523. return 0;
  524. }
  525. }
  526. }