MobilePay.cs 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781
  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 MobilePay
  13. {
  14. private HisIrisServices hIS = new HisIrisServices();
  15. private MIIrisServices mIS = new MIIrisServices();
  16. private CenterBusiness cBus = new CenterBusiness();
  17. private InvokeHelper invoker = new InvokeHelper();
  18. private Patients MPat;
  19. public Settlements MSettl;
  20. private JArray jaFee;
  21. //
  22. //private string fixmedins_code;//定点医疗服务机构编码
  23. //private string yhappid;//渠道ID
  24. //private string orgId;//电子凭证机构号
  25. //前端传过来的入参,从这里面取值
  26. private JObject joParam;
  27. private JObject joInsuAdmObj;
  28. public MobilePay(string inpar, out string errMsg)
  29. {
  30. errMsg = "";
  31. try
  32. {
  33. JObject joInpar = JObject.Parse(inpar);
  34. joParam = JObject.Parse(JsonHelper.getDestValue(joInpar, "params[0]"));
  35. joInsuAdmObj = JObject.Parse(JsonHelper.getDestValue(joInpar, "insuAdmObj"));
  36. setPatientByInPar();
  37. setSettlementsByInPar();
  38. }
  39. catch (Exception ex)
  40. {
  41. errMsg = "MobilePay异常:" + ex.Message;
  42. }
  43. }
  44. private JObject OutpatientReg()
  45. {
  46. string diagnoses;
  47. if (hIS.getPatDiagnoses(Global.pat, out diagnoses) != 0)
  48. {
  49. return JsonHelper.setExceptionJson(-1, "挂号", "获取诊断异常" + diagnoses);
  50. }
  51. JObject joHisRtnInfo = JObject.Parse(diagnoses);
  52. JObject joRegInpar = new JObject();
  53. string occurTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  54. joRegInpar.Add("psn_no", Global.pat.psn_no);
  55. joRegInpar.Add("insutype", Global.pat.insuType);
  56. joRegInpar.Add("begntime", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.begntime"));//挂号时间 occurTime
  57. joRegInpar.Add("mdtrt_cert_type", "02");//就诊凭证类型
  58. joRegInpar.Add("mdtrt_cert_no", MPat.certNO);//就诊凭证编号
  59. joRegInpar.Add("ipt_otp_no", Global.pat.adm_Dr);
  60. joRegInpar.Add("atddr_no", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.atddr_no"));
  61. joRegInpar.Add("dr_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.chfpdr_name"));
  62. joRegInpar.Add("dept_code", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_codg"));
  63. joRegInpar.Add("dept_name", JsonHelper.getDestValue(joHisRtnInfo, "mdtrtinfo.adm_dept_name"));
  64. joRegInpar.Add("caty", "72");
  65. JObject joReg = new JObject();
  66. joReg.Add("data", joRegInpar);
  67. JObject jo2201Inpar = JObject.Parse(JsonHelper.setCenterInpar("2201", joReg));
  68. JObject jo2201Rtn = invoker.invokeCenterService("2201", jo2201Inpar);
  69. string errMsg = "";
  70. if (JsonHelper.parseCenterRtnValue(jo2201Rtn, out errMsg) != 0)
  71. {
  72. return JsonHelper.setExceptionJson(-1, "医保挂号", errMsg);
  73. }
  74. else
  75. {
  76. Global.pat.mdtrtID = JsonHelper.getDestValue(jo2201Rtn, "output.data.mdtrt_id");
  77. }
  78. return jo2201Rtn;
  79. }
  80. public int MobilePaySettlement(out string outPar)
  81. {
  82. string errMsg, patInfo, M6201Inpar, M6202Inpar;
  83. //M6201Rtn, M6202Rtn,M6301Inpar,M6301Rtn;
  84. outPar = "";
  85. try
  86. {
  87. if (GetPatientInfo(out errMsg) != 0)
  88. {
  89. outPar = errMsg;
  90. return -1;
  91. }
  92. patInfo = errMsg;
  93. if (string.IsNullOrEmpty(Global.pat.insuplc_admdvs)) { Global.pat.insuplc_admdvs = "650100"; }
  94. JObject jo1194Rtn = invoker.invokeCenterService("1101", JsonHelper.setCenterInpar("1101", patInfo));
  95. if (JsonHelper.parseCenterRtnValue(jo1194Rtn, out errMsg) != 0)
  96. {
  97. outPar = errMsg;
  98. return -1;
  99. }
  100. setPatientInsuInfo(jo1194Rtn);
  101. //2201
  102. //JObject jo2201Rtn = OutpatientReg();
  103. if (Get6201Inpar(out errMsg) != 0)
  104. {
  105. outPar = errMsg;
  106. return -1;
  107. }
  108. M6201Inpar = errMsg;
  109. JObject joM6201Rtn = invoker.invokeMPService("6201", errMsg);
  110. if (JsonHelper.parseMPRtnValue(joM6201Rtn, out errMsg) != 0)
  111. {
  112. outPar = errMsg;
  113. return -1;
  114. }
  115. JObject joEncData = JObject.Parse(errMsg);
  116. //设置
  117. setPatientBy6201Rtn(joEncData);
  118. //存入MI 患者表,登记表,费用表
  119. if (saveToMi(out errMsg) != 0)
  120. {
  121. outPar = errMsg;
  122. return -1;
  123. }
  124. //M6202
  125. if (Get6202Inpar(JObject.Parse(M6201Inpar), out errMsg) != 0)
  126. {
  127. outPar = errMsg;
  128. return -1;
  129. }
  130. M6202Inpar = errMsg;
  131. JObject joM6202Rtn = invoker.invokeMPService("6202", M6202Inpar);
  132. if (JsonHelper.parseMPRtnValue(joM6202Rtn, out errMsg) != 0)
  133. {
  134. outPar = errMsg;
  135. return -1;
  136. }
  137. joEncData = JObject.Parse(errMsg);
  138. //设置
  139. setSettlementsBy6202Rtn(joEncData);
  140. MSettl.confirmFlag = 0;
  141. //存入MI 结算表
  142. if (saveSettlement(out errMsg) != 0)
  143. {
  144. outPar = errMsg;
  145. return -1;
  146. }
  147. //6301查询具体明细信息
  148. //if (Get6301Inpar(out errMsg) != 0)
  149. //{
  150. // outPar = errMsg;
  151. // return -1;
  152. //}
  153. //M6301Inpar = errMsg;
  154. //JObject joM6301Rtn = invoker.invokeMPService("6301", eh.encrypt(M6301Inpar));
  155. //if (JsonHelper.parseMPRtnValue(joM6301Rtn, out errMsg) != 0)
  156. //{
  157. // outPar = errMsg;
  158. // return -1;
  159. //}
  160. //joEncData = JObject.Parse(eh.decrypt(errMsg));
  161. //JObject joSettlInfo = JObject.Parse(JsonHelper.getDestValue(joEncData, "extData.SETLINFO"));
  162. //Global.writeLog(JsonHelper.Compress(joEncData));
  163. ////设置
  164. //setSettlementsBy6301Rtn(joSettlInfo);
  165. ////存入MI 结算表
  166. //if (saveSettlement(out errMsg) != 0)
  167. //{
  168. // outPar = errMsg;
  169. //}
  170. //返回给HIS后端
  171. JObject joPreSettl = JObject.Parse(JsonHelper.getDestValue(joEncData, "extData.preSetl"));
  172. joPreSettl["setl_id"] = MPat.payOrdId; //预结算返回为空,空值返回给HIS 报错
  173. //JObject joTmp = JObject.Parse(JsonHelper.getDestValue(joM6201Rtn, "encData"));
  174. JObject joTmp = new JObject();
  175. joTmp.Add("insutype", MPat.insuType);
  176. joTmp.Add("psn_no", MPat.psn_no);
  177. joTmp.Add("insuplc_admdvs", MPat.insuplc_admdvs);
  178. joTmp.Add("mdtrtId", MPat.mdtrtID);
  179. joTmp.Add("mdtrt_id", MPat.mdtrtID);
  180. joTmp.Add("setl_id", MPat.payOrdId);
  181. joTmp.Add("mdtrt_cert_type", JsonHelper.getDestValue(joPreSettl, "mdtrt_cert_type"));
  182. joTmp.Add("mdtrt_cert_no", JsonHelper.getDestValue(joPreSettl, "certno"));
  183. joTmp.Add("med_type", JsonHelper.getDestValue(joPreSettl, "med_type"));
  184. if (returnMPSettlementInfo(joTmp, joPreSettl, out errMsg) != 0)
  185. {
  186. outPar = errMsg;
  187. return -1;
  188. }
  189. //返回给HIS前端
  190. outPar = errMsg;
  191. return 0;
  192. }
  193. catch (Exception ex)
  194. {
  195. outPar = ex.Message;
  196. return -1;
  197. }
  198. }
  199. public int MobilePayConfirmSettlement(out string outPar)
  200. {
  201. string errMsg, M6301Inpar;
  202. outPar = "";
  203. try
  204. {
  205. //EncryptHelper eh = new EncryptHelper();
  206. //6301查询具体明细信息
  207. if (Get6301Inpar(out errMsg) != 0)
  208. {
  209. outPar = errMsg;
  210. return -1;
  211. }
  212. M6301Inpar = errMsg;
  213. JObject joM6301Rtn = invoker.invokeMPService("6301", M6301Inpar);
  214. if (JsonHelper.parseMPRtnValue(joM6301Rtn, out errMsg) != 0)
  215. {
  216. outPar = errMsg;
  217. return -1;
  218. }
  219. JObject joEncData = JObject.Parse((errMsg));
  220. JObject joSettlInfo = JObject.Parse(JsonHelper.getDestValue(joEncData, "extData.SETLINFO"));
  221. //设置
  222. setSettlementsBy6301Rtn(joSettlInfo);
  223. MSettl.confirmFlag = 1;
  224. //存入MI 结算表
  225. if (updateSettlement(out errMsg) != 0)
  226. {
  227. outPar = errMsg;
  228. return -1;
  229. }
  230. else
  231. {
  232. //返回给HIS前端
  233. outPar = JsonHelper.setExceptionJson(0, "云医保平台", "确认成功!").ToString();
  234. return 0;
  235. }
  236. }
  237. catch (Exception ex)
  238. {
  239. outPar = ex.Message;
  240. return -1;
  241. }
  242. }
  243. public int MobilePayCallbackSettlement(out string outPar)
  244. {
  245. string errMsg;
  246. outPar = "";
  247. try
  248. {
  249. if (Get6302Result(out errMsg) != 0)
  250. {
  251. JObject joResult = new JObject();
  252. JObject joData = new JObject();
  253. joData.Add("success", "false");
  254. joData.Add("message", errMsg);
  255. joResult.Add("data", joData);
  256. joResult.Add("errorCode", -1);
  257. joResult.Add("result", joData);
  258. outPar = joResult.ToString();
  259. return -1;
  260. }
  261. else
  262. {
  263. JObject joResult = new JObject();
  264. JObject joData = new JObject();
  265. joData.Add("success", "true");
  266. joData.Add("message", errMsg);
  267. joResult.Add("data", joData);
  268. joResult.Add("errorCode", 0);
  269. joResult.Add("result", joData);
  270. outPar = joResult.ToString();
  271. return 0;
  272. }
  273. }
  274. catch (Exception ex)
  275. {
  276. outPar = "MobilePayCallbackSettlement:" + ex.Message;
  277. return -1;
  278. }
  279. finally
  280. {
  281. Global.writeLog("MobilePayCallbackSettlement","",outPar);
  282. }
  283. }
  284. public int MobilePayCancelSettlement(out string outPar)
  285. {
  286. string errMsg, YH6203Inpar, YH6203Rtn;
  287. outPar = "";
  288. try
  289. {
  290. EncryptHelper eh = new EncryptHelper(Global.inf.MobilePay.appid, Global.inf.MobilePay.secretKey, Global.inf.MobilePay.publicKey, Global.inf.MobilePay.privateKey);
  291. if (MSettl.onlineYBFalg != "Y")
  292. {
  293. //读电子凭证
  294. if (ReadEc(out errMsg) != 0)
  295. {
  296. outPar = errMsg;
  297. return -1;
  298. }
  299. MPat.token = Global.pat.mdtrtcertNO;
  300. }
  301. //获取6203入参
  302. if (Get6203Inpar(out errMsg) != 0)
  303. {
  304. outPar = errMsg;
  305. return -1;
  306. }
  307. YH6203Inpar = errMsg;
  308. JObject jo6203Rtn = invoker.invokeMPService("6203", YH6203Inpar);
  309. //YH6202
  310. if (JsonHelper.parseMPRtnValue(jo6203Rtn, out errMsg) != 0)
  311. {
  312. outPar = errMsg;
  313. return -1;
  314. }
  315. else
  316. {
  317. JObject joEncData = JObject.Parse(errMsg);
  318. string newSettlID = JsonHelper.getDestValue(joEncData, "extData.setlInfo.setl_id");
  319. //处理撤销数据
  320. if (cancleSettlement(MPat.settlID, out errMsg) != 0)
  321. {
  322. outPar = errMsg;
  323. return -1;
  324. }
  325. //joParam.Add("mdtrt_id", MPat.mdtrtID);
  326. //joParam.Add("insuplc_admdvs", MPat.insuplc_admdvs);
  327. //joParam.Add("setl_id", MPat.settlID);
  328. joParam.Add("middleSettleFlag", "");
  329. //退HIS结算
  330. if (hIS.cancleSettlementInfo(joParam, out errMsg) != 0)
  331. {
  332. outPar = errMsg;
  333. return -1;
  334. }
  335. else
  336. {
  337. outPar = errMsg;
  338. return 0;
  339. }
  340. }
  341. }
  342. catch (Exception ex)
  343. {
  344. Global.writeLog("MobilePayCancelSettlement:" + ex.Message);
  345. outPar = ex.Message;
  346. return -1;
  347. }
  348. }
  349. #region 赋值MPat,Msettle结构体
  350. public void setPatientByInPar()
  351. {
  352. if (JsonHelper.getDestValue(joParam, "admID") != "")
  353. MPat.adm_Dr = int.Parse(JsonHelper.getDestValue(joParam, "admID"));
  354. Global.pat.adm_Dr = MPat.adm_Dr;
  355. MPat.recordID = JsonHelper.getDestValue(joParam, "recordID");
  356. MPat.billID = JsonHelper.getDestValue(joParam, "billID");
  357. MPat.medType = JsonHelper.getDestValue(joInsuAdmObj, "medType");
  358. MPat.certType = JsonHelper.getDestValue(joInsuAdmObj, "mdtrtCertType");
  359. MPat.token = JsonHelper.getDestValue(joInsuAdmObj, "ecToken");
  360. MPat.payAuthNo = JsonHelper.getDestValue(joInsuAdmObj, "payAuthNo");
  361. MPat.uldLatlnt = JsonHelper.getDestValue(joInsuAdmObj, "uldLatlnt");
  362. MPat.payOrdId = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId");
  363. MPat.mdtrtID = JsonHelper.getDestValue(joInsuAdmObj, "mdtrt_id");
  364. if (string.IsNullOrEmpty(MPat.payOrdId))
  365. {
  366. MPat.payOrdId = JsonHelper.getDestValue(joParam, "data.payOrdId");
  367. }
  368. MPat.settlID = JsonHelper.getDestValue(joInsuAdmObj, "setl_id");
  369. Global.pat.mdtrtID = MPat.mdtrtID;
  370. }
  371. public void setPatientBy6201Rtn(JObject jo)
  372. {
  373. MPat.payOrdId = JsonHelper.getDestValue(jo, "payOrdId");
  374. MPat.payToken = JsonHelper.getDestValue(jo, "payToken");
  375. //MPat.psn_no = JsonHelper.getDestValue(jo, "psn_no");
  376. //MPat.insuType = JsonHelper.getDestValue(jo, "insutype");
  377. //MPat.insuplc_admdvs = JsonHelper.getDestValue(jo, "insuplc_admdvs");
  378. MPat.mdtrtID = JsonHelper.getDestValue(jo, "extData.mdtrtId");
  379. }
  380. //{"errorCode":0,"errorMessage":"","result":{"patName":"张振","patBirthdate":"1993-02-07","patSex":"男","credCode":"01","credNo":"522226199302073619"}}
  381. public void setPatientByHisBaseInfo(JObject jo)
  382. {
  383. MPat.name = JsonHelper.getDestValue(jo, "result.patName");
  384. MPat.brdy = JsonHelper.getDestValue(jo, "result.patBirthdate");
  385. MPat.gend = JsonHelper.getDestValue(jo, "result.patSex");
  386. MPat.age = JsonHelper.getDestValue(jo, "result.Age");
  387. MPat.naty = JsonHelper.getDestValue(jo, "result.naty");
  388. MPat.certNO = JsonHelper.getDestValue(jo, "result.credNo");
  389. MPat.IDNO = MPat.certNO;
  390. MPat.certType = JsonHelper.getDestValue(jo, "result.credCode");
  391. }
  392. public void setPatientByMiRegInfo(JObject jo)
  393. {
  394. MPat.name = JsonHelper.getDestValue(jo, "data.PatientName");
  395. MPat.psn_no = JsonHelper.getDestValue(jo, "data.PersonalNO");
  396. MPat.certNO = JsonHelper.getDestValue(jo, "data.CertificateNO");
  397. MPat.IDNO = MPat.certNO;
  398. MPat.certType = JsonHelper.getDestValue(jo, "data.CertificateType");
  399. MPat.payToken = JsonHelper.getDestValue(jo, "data.payToken");
  400. MPat.insuplc_admdvs = JsonHelper.getDestValue(jo, "data.InsuranceAreaCode");
  401. }
  402. public void setPatientInsuInfo(JObject jo)
  403. {
  404. MPat.insuplc_admdvs = JsonHelper.getDestValue(jo, "output.insuinfo[0].insuplc_admdvs");
  405. MPat.psn_no = JsonHelper.getDestValue(jo, "output.baseinfo.psn_no");
  406. MPat.insuType = JsonHelper.getDestValue(jo, "output.insuinfo[0].insutype");
  407. Global.pat.insuplc_admdvs = MPat.insuplc_admdvs;
  408. Global.pat.psn_no = MPat.psn_no;
  409. Global.pat.insuType = MPat.insuType;
  410. }
  411. public void setPatientByDiagnoseInfo(JObject jo)
  412. {
  413. MPat.admAttendDoctorNO = JsonHelper.getDestValue(jo, "atddr_no");
  414. MPat.admDiagCode = JsonHelper.getDestValue(jo, "dscg_maindiag_code");
  415. MPat.admDiagName = JsonHelper.getDestValue(jo, "dscg_maindiag_name");
  416. MPat.AdmInDepCode = JsonHelper.getDestValue(jo, "adm_dept_codg");
  417. }
  418. public void setSettlementsBy6202Rtn(JObject jo)
  419. {
  420. MSettl.settlID = JsonHelper.getDestValue(jo, "payOrdId");
  421. MPat.payOrdId = JsonHelper.getDestValue(jo, "payOrdId");
  422. MSettl.payOrdId = JsonHelper.getDestValue(jo, "payOrdId");
  423. MSettl.ordStas = JsonHelper.getDestValue(jo, "ordStas");
  424. MSettl.sumamt = getDecimalFee(jo, "feeSumamt");
  425. MSettl.personCashPay = getDecimalFee(jo, "ownPayAmt");
  426. MSettl.accountPaySumamt = getDecimalFee(jo, "psnAcctPay");
  427. MSettl.fundPaySumamt = getDecimalFee(jo, "fundPay");
  428. MSettl.deposit = getDecimalFee(jo, "deposit");
  429. MSettl.clearingOrgan = JsonHelper.getDestValue(jo, "extData.preSetl.clr_optins");
  430. MSettl.clearingType = JsonHelper.getDestValue(jo, "extData.preSetl.clr_type");
  431. MSettl.clearingWay = JsonHelper.getDestValue(jo, "extData.preSetl.clr_way");
  432. MSettl.civilserviceAllowancePay = getDecimalFee(jo, "extData.preSetl.cvlserv_pay");
  433. MSettl.ownPayAmount = getDecimalFee(jo, "extData.preSetl.fulamt_ownpay_amt");
  434. MSettl.overLimitAmountmt = getDecimalFee(jo, "extData.preSetl.overlmt_selfpay");
  435. MSettl.preSelfPayAmount = getDecimalFee(jo, "extData.preSetl.preselfpay_amt");
  436. MSettl.inPolicyRangeAmount = getDecimalFee(jo, "extData.preSetl.inscp_scp_amt");
  437. MSettl.actualPayDeductible = getDecimalFee(jo, "extData.preSetl.act_pay_dedc");
  438. MSettl.healthInsurancePay = getDecimalFee(jo, "extData.preSetl.hifp_pay");
  439. MSettl.healthInsuranceRatio = getDecimalFee(jo, "extData.preSetl.pool_prop_selfpay");
  440. MSettl.enterpriseSupplementPay = getDecimalFee(jo, "extData.preSetl.hifes_pay");
  441. MSettl.seriousIllnessPay = getDecimalFee(jo, "extData.preSetl.hifmi_pay");
  442. MSettl.largeExpensesSupplementPay = getDecimalFee(jo, "extData.preSetl.hifob_pay");
  443. MSettl.medicalAssistPay = getDecimalFee(jo, "extData.preSetl.maf_pay");
  444. MSettl.hospitalPartAmount = getDecimalFee(jo, "extData.preSetl.hosp_part_amt");
  445. MSettl.otherPay = getDecimalFee(jo, "extData.preSetl.oth_pay");
  446. MSettl.personPaySumamt = getDecimalFee(jo, "extData.preSetl.psn_part_amt");
  447. MSettl.balance = getDecimalFee(jo, "extData.preSetl.balc");
  448. MSettl.accountMutualAidAmount = getDecimalFee(jo, "extData.preSetl.acct_mulaid_pay");
  449. }
  450. public void setSettlementsBy6301Rtn(JObject jo)
  451. {
  452. MSettl.settlID = JsonHelper.getDestValue(jo, "setl_id");
  453. MPat.psn_no = JsonHelper.getDestValue(jo, "psn_no");
  454. MPat.naty = JsonHelper.getDestValue(jo, "naty");
  455. //MPat.name = JsonHelper.getDestValue(jo, "name");
  456. MPat.age = JsonHelper.getDestValue(jo, "age");
  457. MPat.gend = JsonHelper.getDestValue(jo, "gend");
  458. MPat.certNO = JsonHelper.getDestValue(jo, "certno");
  459. MPat.brdy = JsonHelper.getDestValue(jo, "brdy");
  460. MPat.insuType = JsonHelper.getDestValue(jo, "insutype");
  461. MPat.psn_type = JsonHelper.getDestValue(jo, "psn_type");
  462. MPat.mdtrtcertType = JsonHelper.getDestValue(jo, "mdtrt_cert_type");
  463. MPat.medType = JsonHelper.getDestValue(jo, "med_type");
  464. //MPat.insuplc_admdvs = JsonHelper.getDestValue(jo, "insuplc_admdvs");
  465. //MPat.payOrdId = JsonHelper.getDestValue(jo, "payOrdId");
  466. MSettl.ordStas = JsonHelper.getDestValue(jo, "ordStas");
  467. MSettl.sumamt = getDecimalFee(jo, "medfee_sumamt");
  468. MSettl.personCashPay = getDecimalFee(jo, "psn_cash_pay");
  469. MSettl.accountPaySumamt = getDecimalFee(jo, "acct_pay");
  470. MSettl.fundPaySumamt = getDecimalFee(jo, "fund_pay_sumamt");
  471. //MSettl.deposit = getDecimalFee(jo, "deposit");
  472. MSettl.clearingOrgan = JsonHelper.getDestValue(jo, "clr_optins");
  473. MSettl.clearingType = JsonHelper.getDestValue(jo, "clr_type");
  474. MSettl.clearingWay = JsonHelper.getDestValue(jo, "clr_way");
  475. MSettl.civilserviceAllowancePay = getDecimalFee(jo, "cvlserv_pay");
  476. MSettl.ownPayAmount = getDecimalFee(jo, "fulamt_ownpay_amt");
  477. MSettl.overLimitAmountmt = getDecimalFee(jo, "overlmt_selfpay");
  478. MSettl.preSelfPayAmount = getDecimalFee(jo, "preselfpay_amt");
  479. MSettl.inPolicyRangeAmount = getDecimalFee(jo, "inscp_scp_amt");
  480. MSettl.actualPayDeductible = getDecimalFee(jo, "act_pay_dedc");
  481. MSettl.healthInsurancePay = getDecimalFee(jo, "hifp_pay");
  482. MSettl.healthInsuranceRatio = getDecimalFee(jo, "pool_prop_selfpay");
  483. MSettl.enterpriseSupplementPay = getDecimalFee(jo, "hifes_pay");
  484. MSettl.seriousIllnessPay = getDecimalFee(jo, "hifmi_pay");
  485. MSettl.largeExpensesSupplementPay = getDecimalFee(jo, "hifob_pay");
  486. MSettl.medicalAssistPay = getDecimalFee(jo, "maf_pay");
  487. MSettl.hospitalPartAmount = getDecimalFee(jo, "hosp_part_amt");
  488. MSettl.otherPay = getDecimalFee(jo, "oth_pay");
  489. MSettl.personPaySumamt = getDecimalFee(jo, "psn_part_amt");
  490. MSettl.balance = getDecimalFee(jo, "balc");
  491. MSettl.accountMutualAidAmount = getDecimalFee(jo, "acct_mulaid_pay");
  492. }
  493. public void setSettlementsByInPar()
  494. {
  495. MSettl.clearingWay = JsonHelper.getDestValue(joInsuAdmObj, "psnSetlway");
  496. MSettl.settlID = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId");
  497. MSettl.payOrdId = JsonHelper.getDestValue(joInsuAdmObj, "payOrdId");
  498. }
  499. public void setPatientByEc(JObject jo)
  500. {
  501. MPat.name = JsonHelper.getDestValue(jo, "userName");
  502. MPat.IDNO = JsonHelper.getDestValue(jo, "idNo");
  503. MPat.certType = JsonHelper.getDestValue(jo, "idType");
  504. MPat.token = JsonHelper.getDestValue(jo, "ecToken");
  505. MPat.insuplc_admdvs = JsonHelper.getDestValue(jo, "insuOrg");
  506. MPat.payAuthNo = JsonHelper.getDestValue(jo, "authNo");
  507. MPat.gend = JsonHelper.getDestValue(jo, "gender");
  508. MPat.brdy = JsonHelper.getDestValue(jo, "birthday");
  509. MPat.naty = JsonHelper.getDestValue(jo, "nationality");
  510. MPat.payOrdId = "";
  511. }
  512. #endregion
  513. #region 组织入参
  514. public int GetPatientInfo(out string outparam)
  515. {
  516. string errMsg = "";
  517. outparam = "";
  518. try
  519. {
  520. JObject joInpar = new JObject();
  521. //查询患者基本信息
  522. if (hIS.GetHisPatBaseInfo(out errMsg) != 0)
  523. {
  524. outparam = errMsg;
  525. return -1;
  526. }
  527. setPatientByHisBaseInfo(JObject.Parse(errMsg));
  528. //入参
  529. joInpar.Add("mdtrt_cert_type", "02");//就诊凭证类型
  530. joInpar.Add("mdtrt_cert_no", MPat.certNO);//就诊凭证编号
  531. joInpar.Add("card_sn", "");//卡识别码
  532. joInpar.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));//开始时间 获取历史参保信息时传入
  533. joInpar.Add("psn_cert_type", "01");//就诊凭证类型为“ 02” 时默认传 01 代表身份 证,其他证件类型按实际上传
  534. joInpar.Add("certno", MPat.certNO);//证件号码
  535. joInpar.Add("psn_name", MPat.name);//姓名
  536. JObject joData = new JObject();
  537. joData.Add("data", joInpar);
  538. outparam = joData.ToString();
  539. return 0;
  540. }
  541. catch (Exception ex)
  542. {
  543. outparam = "GetPatientInfo:" + ex.Message;
  544. return -1;
  545. }
  546. finally
  547. {
  548. Global.writeLog("GetPatientInfo", "", outparam);
  549. }
  550. }
  551. //组织M6201入参
  552. public int Get6201Inpar(out string outparam)
  553. {
  554. string errMsg = "";
  555. outparam = "";
  556. try
  557. {
  558. JObject joInpar = new JObject();
  559. //查询患者基本信息
  560. if (hIS.GetHisPatBaseInfo(out errMsg) != 0)
  561. {
  562. outparam = errMsg;
  563. return -1;
  564. }
  565. setPatientByHisBaseInfo(JObject.Parse(errMsg));
  566. JObject joPatBaseInfo = JObject.Parse(JsonHelper.getDestValue(JObject.Parse(errMsg), "result"));
  567. //获取诊断
  568. if (getDiagnoses(out errMsg) != 0)
  569. {
  570. outparam = errMsg;
  571. return -1;
  572. }
  573. JObject joDiagnoses = JObject.Parse(errMsg);
  574. JArray jaDiseinfoList = JArray.Parse(JsonHelper.getDestValue(joDiagnoses, "diseinfoList"));
  575. JObject joMdtrtinfo = JObject.Parse(JsonHelper.getDestValue(joDiagnoses, "mdtrtinfo"));
  576. setPatientByDiagnoseInfo(joMdtrtinfo);
  577. //获取费用
  578. if (GetFee(out errMsg) != 0)
  579. {
  580. outparam = errMsg;
  581. return -1;
  582. }
  583. JObject joFee = JObject.Parse(errMsg);
  584. JArray jaFeedetailList = JArray.Parse(JsonHelper.getDestValue(joFee, "feedetailList"));
  585. for (int i = 0; i < jaFeedetailList.Count; i++)
  586. {
  587. JObject joTmp = new JObject();
  588. joTmp.Add("act_purc_pric", jaFeedetailList[i]["pric"]);
  589. joTmp.Add("sin_dos", jaFeedetailList[i]["sinDosDscr"]);
  590. //joTmp.Add("medins_list_name", jaFeedetailList[i]["medListName"]);
  591. //((JObject)jaFeedetailList[i]).Property("chrgBchno").Remove();
  592. //((JObject)jaFeedetailList[i]).Property("diseCodg").Remove();
  593. ((JObject)jaFeedetailList[i]).Property("rxno").Remove();
  594. //((JObject)jaFeedetailList[i]).Property("feeOcurTime").Remove();
  595. ((JObject)jaFeedetailList[i]).Property("sinDosDscr").Remove();
  596. ((JObject)jaFeedetailList[i]).Property("usedFrquDscr").Remove();
  597. ((JObject)jaFeedetailList[i]).Property("prdDays").Remove();
  598. ((JObject)jaFeedetailList[i]).Property("medcWayDscr").Remove();
  599. //((JObject)jaFeedetailList[i]).Property("bilgDeptCodg").Remove();
  600. ((JObject)jaFeedetailList[i]).Property("acordDeptCodg").Remove();
  601. ((JObject)jaFeedetailList[i]).Property("acordDeptName").Remove();
  602. ((JObject)jaFeedetailList[i]).Property("ordersDrCode").Remove();
  603. ((JObject)jaFeedetailList[i]).Property("ordersDrName").Remove();
  604. ((JObject)jaFeedetailList[i]).Property("tcmdrugUsedWay").Remove();
  605. ((JObject)jaFeedetailList[i]).Property("etipFlag").Remove();
  606. ((JObject)jaFeedetailList[i]).Property("etipHospCode").Remove();
  607. ((JObject)jaFeedetailList[i]).Property("dscgTkdrugFlag").Remove();
  608. ((JObject)jaFeedetailList[i]).Property("matnFeeFlag").Remove();
  609. ((JObject)jaFeedetailList[i]).Property("initFeedetlSn").Remove();
  610. ((JObject)jaFeedetailList[i]).Property("medType").Remove();
  611. ((JObject)jaFeedetailList[i]).Property("memo").Remove();
  612. //((JObject)jaFeedetailList[i]).Property("expContent").Remove();
  613. //((JObject)jaFeedetailList[i]).Property("medListName").Remove();
  614. //((JObject)jaFeedetailList[i]).Property("medListSpc").Remove();
  615. ((JObject)jaFeedetailList[i]).Property("combNo").Remove();
  616. //jaFeedetailList[i]["chrgBchno"] = MPat.adm_Dr.ToString();
  617. jaFeedetailList[i]["expContent"] = joTmp.ToString();
  618. jaFeedetailList[i]["medType"] = JsonHelper.getDestValue(joInsuAdmObj, "medType");
  619. jaFeedetailList[i]["psnNo"] = MPat.psn_no;
  620. }
  621. //入参
  622. joInpar.Add("orgCodg", Global.inf.hospitalNO);//机构编码
  623. //joInpar.Add("orgId", "");//电子凭证机构号
  624. joInpar.Add("psnNo", MPat.psn_no);//人员编号
  625. joInpar.Add("insutype", MPat.insuType);//险种类型
  626. joInpar.Add("medOrgOrd", MPat.recordID);//医疗机构订单号 前端传入
  627. joInpar.Add("initRxOrd", JsonHelper.getDestValue(joInsuAdmObj, "initRxOrd"));//要续方的原处方流水 前端传入
  628. joInpar.Add("rxCircFlag", JsonHelper.getDestValue(joInsuAdmObj, "rxCircFlag"));//电子处方流转标志 前端传入
  629. MSettl.settlTime = Convert.ToDateTime(JsonHelper.getDestValue(joMdtrtinfo, "begntime"));
  630. joInpar.Add("begntime", JsonHelper.getDestValue(joMdtrtinfo, "begntime"));//开始时间
  631. joInpar.Add("idNo", JsonHelper.getDestValue(joPatBaseInfo, "credNo"));//证件号码
  632. joInpar.Add("userName", JsonHelper.getDestValue(joPatBaseInfo, "patName"));//用户姓名
  633. joInpar.Add("idType", JsonHelper.getDestValue(joPatBaseInfo, "credCode"));//证件类别
  634. joInpar.Add("ecToken", JsonHelper.getDestValue(joInsuAdmObj, "ecToken"));//电子凭证授权ecToken 前端传入
  635. joInpar.Add("insuCode", Global.inf.areaCode);//就诊参保地行政区划
  636. joInpar.Add("iptOtpNo", JsonHelper.getDestValue(joMdtrtinfo, "ipt_no"));//住院/门诊号
  637. joInpar.Add("atddrNo", JsonHelper.getDestValue(joMdtrtinfo, "atddr_no"));//医师编码
  638. joInpar.Add("drName", JsonHelper.getDestValue(joMdtrtinfo, "chfpdr_name"));//医师姓名
  639. joInpar.Add("deptCode", JsonHelper.getDestValue(joMdtrtinfo, "adm_dept_codg"));//科室编码
  640. joInpar.Add("deptName", JsonHelper.getDestValue(joMdtrtinfo, "adm_dept_name"));//科室名称
  641. joInpar.Add("caty", "A10");//科别
  642. //joInpar.Add("mdtrtId", Global.pat.mdtrtID);//医保就诊ID
  643. joInpar.Add("medType", MPat.medType);//医疗类别 前端传入
  644. joInpar.Add("feeType", JsonHelper.getDestValue(joInsuAdmObj, "feeType"));//费用类型 前端传入
  645. joInpar.Add("medfeeSumamt", JsonHelper.getDestValue(joFee, "medfeeSumamt"));//医疗费总额
  646. joInpar.Add("acctUsedFlag", JsonHelper.getDestValue(joInsuAdmObj, "acctUsedFlag"));//个人账户使用标志 前端传入
  647. joInpar.Add("mainCondDscr", JsonHelper.getDestValue(joMdtrtinfo, "mainCondDscr"));//主要病情描述
  648. joInpar.Add("diseCodg", JsonHelper.getDestValue(joMdtrtinfo, "diseCodg"));//病种编码
  649. joInpar.Add("diseName", JsonHelper.getDestValue(joMdtrtinfo, "diseName"));//病种名称
  650. joInpar.Add("psnSetlway", JsonHelper.getDestValue(joInsuAdmObj, "psnSetlway"));//个人结算方式 前端传入
  651. joInpar.Add("chrgBchno", JsonHelper.getDestValue(joFee, "chrgBchno"));//收费批次号
  652. //joInpar.Add("pubHospRfomFlag", JsonHelper.getDestValue(joInsuAdmObj, "pubHospRfomFlag"));//公立医院改革标志
  653. //joInpar.Add("invono", JsonHelper.getDestValue(joMdtrtinfo, "invono"));//发票号
  654. //joInpar.Add("endtime", JsonHelper.getDestValue(joMdtrtinfo, "endtime"));//出院时间
  655. //joInpar.Add("fulamtOwnpayAmt", JsonHelper.getDestValue(joMdtrtinfo, "fulamtOwnpayAmt"));//全自费金额
  656. //joInpar.Add("overlmtSelfpay", JsonHelper.getDestValue(joMdtrtinfo, "overlmtSelfpay"));//超限价金额
  657. //joInpar.Add("preselfpayAmt", JsonHelper.getDestValue(joMdtrtinfo, "preselfpayAmt"));//先行自付金额
  658. //joInpar.Add("inscpScpAmt", JsonHelper.getDestValue(joMdtrtinfo, "inscpScpAmt"));//符合政策范围金额
  659. //joInpar.Add("oprnOprtCode", JsonHelper.getDestValue(joMdtrtinfo, "oprnOprtCode"));//手术操作代码
  660. //joInpar.Add("oprnOprtName", JsonHelper.getDestValue(joMdtrtinfo, "oprnOprtName"));//手术操作名称
  661. //joInpar.Add("fpscNo", JsonHelper.getDestValue(joMdtrtinfo, "fpscNo"));//计划生育服务证号
  662. //joInpar.Add("latechbFlag", JsonHelper.getDestValue(joMdtrtinfo, "latechbFlag"));//晚育标志
  663. joInpar.Add("gesoVal", JsonHelper.getDestValue(joMdtrtinfo, "gesoVal"));//孕周数
  664. joInpar.Add("fetts", JsonHelper.getDestValue(joMdtrtinfo, "fetts"));//胎次
  665. joInpar.Add("fetusCnt", JsonHelper.getDestValue(joMdtrtinfo, "fetusCnt"));//胎儿数
  666. //joInpar.Add("pretFlag", JsonHelper.getDestValue(joMdtrtinfo, "pretFlag"));//早产标志
  667. //joInpar.Add("birctrlType", JsonHelper.getDestValue(joMdtrtinfo, "birctrlType"));//计划生育手术类别
  668. //joInpar.Add("birctrlMatnDate", JsonHelper.getDestValue(joMdtrtinfo, "birctrlMatnDate"));//计划生育手术或生育日期
  669. //joInpar.Add("copFlag", JsonHelper.getDestValue(joMdtrtinfo, "copFlag"));//伴有并发症标志
  670. //joInpar.Add("dscgDeptCodg", JsonHelper.getDestValue(joMdtrtinfo, "dscgDeptCodg"));//出院科室编码
  671. //joInpar.Add("dscgDeptName", JsonHelper.getDestValue(joMdtrtinfo, "dscgDeptName"));//出院科室名称
  672. //joInpar.Add("dscgDed", JsonHelper.getDestValue(joMdtrtinfo, "dscgDed"));//出院床位
  673. //joInpar.Add("dscgWay", JsonHelper.getDestValue(joMdtrtinfo, "dscgWay"));//离院方式
  674. //joInpar.Add("dieDate", JsonHelper.getDestValue(joMdtrtinfo, "dieDate"));//死亡日期
  675. joInpar.Add("matnType", JsonHelper.getDestValue(joMdtrtinfo, "matnType"));//生育类别
  676. joInpar.Add("expContent", JsonHelper.getDestValue(joInsuAdmObj, "expContent"));//扩展参数 前端传入
  677. //joInpar.Add("midSetlFlag", JsonHelper.getDestValue(joInsuAdmObj, "midSetlFlag"));//中途结算标志 前端传入
  678. joInpar.Add("diseinfoList", jaDiseinfoList);//诊断或症状明细
  679. joInpar.Add("feedetailList", jaFeedetailList);//费用明细
  680. //joInpar.Add("admDiagDscr", JsonHelper.getDestValue(joMdtrtinfo, "admDiagDscr"));//入院诊断描述
  681. //joInpar.Add("admDeptCodg", JsonHelper.getDestValue(joMdtrtinfo, "admDeptCodg"));//入院科室编码
  682. //joInpar.Add("admDeptName", JsonHelper.getDestValue(joMdtrtinfo, "admDeptName"));//入院科室名称
  683. //joInpar.Add("admBed", JsonHelper.getDestValue(joMdtrtinfo, "admBed"));//入院床位
  684. joInpar.Add("payAuthNo", JsonHelper.getDestValue(joInsuAdmObj, "payAuthNo"));//支付授权码 前端传入
  685. joInpar.Add("uldLatlnt", JsonHelper.getDestValue(joInsuAdmObj, "uldLatlnt"));//经纬度 前端传入
  686. joInpar.Add("mdtrtCertType", JsonHelper.getDestValue(joInsuAdmObj, "mdtrtCertType"));//就诊凭证类型 前端传入
  687. joInpar.Add("insuplcAdmdvs", MPat.insuplc_admdvs);//用户参保地行政区划
  688. //JObject joData = new JObject();
  689. //joData.Add("data",joInpar);
  690. outparam = joInpar.ToString();
  691. return 0;
  692. }
  693. catch (Exception ex)
  694. {
  695. outparam = "Get6201Inpar:" + ex.Message;
  696. return -1;
  697. }
  698. finally
  699. {
  700. Global.writeLog("Get6201Inpar", "", outparam);
  701. }
  702. }
  703. //获取入参,入参基本为类局部变量
  704. public int Get6202Inpar(JObject joM6201Inpar, out string outparam)
  705. {
  706. outparam = "";
  707. try
  708. {
  709. //获取其他入参
  710. JObject joInpar = new JObject();
  711. joInpar.Add("payAuthNo", MPat.payAuthNo);//支付授权码 前端传入
  712. joInpar.Add("payOrdId", MPat.payOrdId);//待支付订单号
  713. joInpar.Add("payToken", MPat.payToken);//支付订单对应的token
  714. joInpar.Add("orgCodg", Global.inf.hospitalNO);//定点机构编码
  715. joInpar.Add("orgBizSer", DateTime.Now.ToString("yyyyMMddHHmmssffff"));//业务流水号 前端传入
  716. //joInpar.Add("ecAuthCode", "");
  717. //joInpar.Add("ecChnlAppId", "");
  718. //joInpar.Add("ecChnlUserId", "");
  719. //joInpar.Add("mdtrtId", MPat.mdtrtID);
  720. joInpar.Add("chrgBchno", JsonHelper.getDestValue(joM6201Inpar, "chrgBchno"));//收费批次号
  721. //joInpar.Add("feeType", JsonHelper.getDestValue(joM6201Inpar, "feeType"));//费用类别
  722. //joInpar.Add("deposit", JsonHelper.getDestValue(joInsuAdmObj, "deposit"));//住院押金
  723. //joInpar.Add("expContent", "");//扩展数据
  724. //joInpar.Add("acctUsedFlag", "1");//个账使用标识
  725. //JObject joData = new JObject();
  726. //joData.Add("data", joInpar);
  727. outparam = joInpar.ToString();
  728. return 0;
  729. }
  730. catch (Exception ex)
  731. {
  732. outparam = "Get6202Inpar:" + ex.Message;
  733. return -1;
  734. }
  735. finally
  736. {
  737. Global.writeLog("Get6202Inpar", "", outparam);
  738. }
  739. }
  740. //组织M6203入参
  741. public int Get6203Inpar(out string outparam)
  742. {
  743. string errMsg = "";
  744. outparam = "";
  745. try
  746. {
  747. JObject joInpar = new JObject();
  748. //获取医保平台结算信息
  749. if (QuerySettleInfo(out errMsg) != 0)
  750. {
  751. outparam = errMsg;
  752. return -1;
  753. }
  754. JObject joRtn = JObject.Parse(errMsg);
  755. JObject joSettl = JObject.Parse(JsonHelper.getDestValue(joRtn, "result.data[0]"));
  756. MPat.settlID = JsonHelper.getDestValue(joSettl, "SettlementID");
  757. //MPat.mdtrtID = JsonHelper.getDestValue(joSettl, "MdtrtID");
  758. //入参
  759. joInpar.Add("payOrdId", JsonHelper.getDestValue(joSettl, "PayOrdID"));//支付订单号
  760. joInpar.Add("appRefdSn", MPat.recordID);//应用退款流水号
  761. joInpar.Add("appRefdTime", DateTime.Now.ToString("yyyyMMddHHmmss"));//应用退费时间
  762. joInpar.Add("totlRefdAmt", JsonHelper.getDestValue(joSettl, "Sumamt"));//总退费金额
  763. joInpar.Add("psnAcctRefdAmt", JsonHelper.getDestValue(joSettl, "AccountPaySumamt"));//医保个人账户支付
  764. joInpar.Add("fundRefdAmt", JsonHelper.getDestValue(joSettl, "FundPaySumamt"));//基金支付
  765. joInpar.Add("cashRefdAmt", JsonHelper.getDestValue(joSettl, "PersonCashPay"));//现金退费金额
  766. joInpar.Add("ecToken", MPat.token);//电子凭证授权Token 前端传入
  767. joInpar.Add("refdType", "HI");//退费类型 前端传入
  768. joInpar.Add("expContent", "");//扩展数据 前端传入
  769. joInpar.Add("payAuthNo", MPat.payAuthNo);//支付授权码 前端传入
  770. //JObject joData = new JObject();
  771. //joData.Add("data", joInpar);
  772. outparam = joInpar.ToString();
  773. return 0;
  774. }
  775. catch (Exception ex)
  776. {
  777. outparam = "GetYH6203Inpar:" + ex.Message;
  778. return -1;
  779. }
  780. finally
  781. {
  782. Global.writeLog("GetYH6203Inpar", "", outparam);
  783. }
  784. }
  785. //获取入参,入参基本为类局部变量
  786. public int Get6301Inpar(out string outparam)
  787. {
  788. outparam = "";
  789. try
  790. {
  791. string errMsg;
  792. //查询登记信息
  793. if (mIS.queryRegisterInfo(4, out errMsg) != 0)
  794. {
  795. outparam = errMsg;
  796. return -1;
  797. }
  798. setPatientByMiRegInfo(JObject.Parse(errMsg));
  799. //获取其他入参
  800. JObject joInpar = new JObject();
  801. joInpar.Add("payOrdId", MPat.payOrdId);//待支付订单号
  802. joInpar.Add("payToken", MPat.payToken);//支付订单对应的token
  803. joInpar.Add("orgCodg", Global.inf.hospitalNO);//定点机构编码
  804. joInpar.Add("idNo", MPat.IDNO);//业务流水号 前端传入
  805. joInpar.Add("userName", MPat.name);
  806. joInpar.Add("idType", "01");
  807. joInpar.Add("expData", "");
  808. //JObject joData = new JObject();
  809. //joData.Add("data", joInpar);
  810. outparam = joInpar.ToString();
  811. return 0;
  812. }
  813. catch (Exception ex)
  814. {
  815. outparam = "Get6301Inpar:" + ex.Message;
  816. return -1;
  817. }
  818. finally
  819. {
  820. Global.writeLog("Get6301Inpar", "", outparam);
  821. }
  822. }
  823. public int Get6401Inpar(out string outparam)
  824. {
  825. string errMsg = "";
  826. outparam = "";
  827. try
  828. {
  829. JObject joInpar = new JObject();
  830. //获取医保平台结算信息
  831. if (QuerySettleInfo(out errMsg) != 0)
  832. {
  833. outparam = errMsg;
  834. return -1;
  835. }
  836. JObject joRtn = JObject.Parse(errMsg);
  837. JObject joSettl = JObject.Parse(JsonHelper.getDestValue(joRtn, "data"));
  838. //入参
  839. joInpar.Add("payOrdId", JsonHelper.getDestValue(joSettl, "SettlementID"));//支付订单号
  840. joInpar.Add("appRefdSn", JsonHelper.getDestValue(joSettl, ""));//应用退款流水号
  841. joInpar.Add("appRefdTime", JsonHelper.getDestValue(joSettl, ""));//应用退费时间
  842. joInpar.Add("totlRefdAmt", JsonHelper.getDestValue(joSettl, "Sumamt"));//总退费金额
  843. joInpar.Add("psnAcctRefdAmt", JsonHelper.getDestValue(joSettl, "AccountPaySumamt"));//医保个人账户支付
  844. joInpar.Add("fundRefdAmt", JsonHelper.getDestValue(joSettl, "FundPaySumamt"));//基金支付
  845. joInpar.Add("cashRefdAmt", JsonHelper.getDestValue(joInsuAdmObj, "PersonCashPay"));//现金退费金额
  846. joInpar.Add("ecToken", MPat.token);//电子凭证授权Token 前端传入
  847. joInpar.Add("refdType", "ALL");//退费类型 前端传入
  848. joInpar.Add("expData", "");//扩展数据 前端传入
  849. joInpar.Add("payAuthNo", MPat.payAuthNo);//支付授权码 前端传入
  850. //JObject joData = new JObject();
  851. //joData.Add("data", joInpar);
  852. outparam = joInpar.ToString();
  853. return 0;
  854. }
  855. catch (Exception ex)
  856. {
  857. outparam = "Get6203Inpar:" + ex.Message;
  858. return -1;
  859. }
  860. finally
  861. {
  862. Global.writeLog("Get6203Inpar", "", outparam);
  863. }
  864. }
  865. public int Get6302Result(out string outparam)
  866. {
  867. string errMsg = "";
  868. outparam = "";
  869. try
  870. {
  871. JObject joInpar = new JObject();
  872. //获取医保平台结算信息
  873. if (QuerySettleInfoBy6302(out errMsg) != 0)
  874. {
  875. outparam = errMsg;
  876. return -1;
  877. }
  878. JObject joRtn = JObject.Parse(errMsg);
  879. JArray jaSettl = JArray.Parse(JsonHelper.getDestValue(joRtn, "result.data"));
  880. if (jaSettl.Count != 1)
  881. {
  882. outparam = "该订单数据不唯一!";
  883. return -1;
  884. }
  885. else
  886. {
  887. //if (jaSettl[0]["ConfirmFlag"].ToString() != "1")
  888. //{
  889. // outparam = "确认标志不为1!";
  890. // return -1;
  891. //}
  892. //else
  893. {
  894. outparam = "回调成功!查询正确!";
  895. return 0;
  896. }
  897. }
  898. }
  899. catch (Exception ex)
  900. {
  901. outparam = "Get6302Result:" + ex.Message;
  902. return -1;
  903. }
  904. finally
  905. {
  906. Global.writeLog("Get6302Result", "", outparam);
  907. }
  908. }
  909. #endregion
  910. #region 诊断
  911. //获取诊断信息
  912. public int getDiagnoses(out string errMsg)
  913. {
  914. errMsg = "";
  915. try
  916. {
  917. //调用服务获取门诊诊断信息
  918. string outparam = "";
  919. if (hIS.getPatDiagnoses(MPat, out outparam) != 0)
  920. {
  921. return -1;
  922. }
  923. JObject joRtn = JObject.Parse(outparam);
  924. JObject joMdtrtInfo = JObject.Parse(JsonHelper.getDestValue(joRtn, "mdtrtinfo"));
  925. JArray jaDiagnoses = JArray.Parse(JsonHelper.getDestValue(joRtn, "diseinfo"));
  926. //组织门诊结算诊断入参
  927. JArray jaRow = new JArray();
  928. for (int i = 0; i < jaDiagnoses.Count; i++)
  929. {
  930. JObject joTmp = new JObject();
  931. joTmp.Add("diagType", jaDiagnoses[i]["diag_type"]);//
  932. joTmp.Add("diagSrtNo", jaDiagnoses[i]["diag_srt_no"]);//
  933. joTmp.Add("diagCode", jaDiagnoses[i]["diag_code"]);//
  934. joTmp.Add("diagName", jaDiagnoses[i]["diag_name"]);//
  935. joTmp.Add("diagDept", jaDiagnoses[i]["diag_dept"]);//
  936. joTmp.Add("diseDorNo", jaDiagnoses[i]["dise_dor_no"]);//
  937. joTmp.Add("diseDorName", jaDiagnoses[i]["dise_dor_name"]);//
  938. joTmp.Add("diagTime", jaDiagnoses[i]["diag_time"]);//
  939. joTmp.Add("valiFlag", "1");//
  940. jaRow.Add(joTmp);
  941. }
  942. JObject joDiagRow = new JObject();
  943. joDiagRow.Add("diseinfoList", jaRow);
  944. joDiagRow.Add("mdtrtinfo", joMdtrtInfo);
  945. outparam = joDiagRow.ToString();
  946. errMsg = outparam;
  947. return 0;
  948. }
  949. catch (Exception ex)
  950. {
  951. errMsg = "getDiagnoses:" + ex.Message;
  952. return -1;
  953. }
  954. }
  955. #endregion
  956. #region 费用
  957. private int GetFee(out string outparam)
  958. {
  959. string hisFee, chrgBchno = "";
  960. JObject jo = new JObject();
  961. JObject joRow = new JObject();
  962. JArray jaRow = new JArray();
  963. try
  964. {
  965. //获取HIS费用
  966. if (hIS.getHisFee(MPat, out hisFee) != 0)
  967. {
  968. outparam = hisFee;
  969. return -1;
  970. }
  971. JObject joFee = JObject.Parse(hisFee);
  972. //处理
  973. //调用医保平台转换HIS费用(转换医保编码等)
  974. JObject joHisFee = JObject.Parse(hisFee);
  975. if (mIS.convertHisFeeWithInsuCodeOfMobilePay(MPat, joHisFee, out outparam) != 0)
  976. {
  977. return -1;
  978. }
  979. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outparam), "data"));
  980. jaFee = (JArray)jaFeeDetail.DeepClone();
  981. decimal sumFee = 0;
  982. //转换
  983. for (int i = 0; i < jaFeeDetail.Count; i++)
  984. {
  985. decimal cnt = decimal.Parse(jaFeeDetail[i]["cnt"].ToString());
  986. decimal pric = decimal.Parse(jaFeeDetail[i]["pric"].ToString());
  987. decimal sumamt = decimal.Parse(jaFeeDetail[i]["det_item_fee_sumamt"].ToString());
  988. sumFee = sumFee + sumamt;
  989. JObject joTmp = new JObject();
  990. joTmp.Add("feedetlSn", jaFeeDetail[i]["feedetl_sn"]);//费用明细流水号
  991. //joTmp.Add("mdtrtId", Global.pat.mdtrtID);//医保就诊ID
  992. //joTmp.Add("psnNo", jaFeeDetail[i]["psnNo"]);//人员编号
  993. chrgBchno = jaFeeDetail[i]["chrg_bchno"].ToString();
  994. joTmp.Add("chrgBchno", jaFeeDetail[i]["chrg_bchno"]);//收费批次号
  995. joTmp.Add("diseCodg", "");//病种编码
  996. joTmp.Add("rxno", jaFeeDetail[i]["rxno"]);//处方号
  997. joTmp.Add("rxCircFlag", jaFeeDetail[i]["rx_circ_flag"]);//外购处方标志
  998. joTmp.Add("feeOcurTime", jaFeeDetail[i]["fee_ocur_time"]);//费用发生时间
  999. joTmp.Add("medListCodg", jaFeeDetail[i]["med_list_codg"]);//医疗目录编码
  1000. joTmp.Add("medinsListCodg", jaFeeDetail[i]["medins_list_codg"]);//医药机构目录编码
  1001. joTmp.Add("detItemFeeSumamt", sumamt.ToString("#0.00"));//明细项目费用总额
  1002. joTmp.Add("cnt", cnt.ToString("#0.0000"));//数量
  1003. joTmp.Add("pric", pric.ToString("#0.000000"));//单价
  1004. joTmp.Add("sinDosDscr", jaFeeDetail[i]["sin_dos_dscr"]);//单次剂量描述
  1005. joTmp.Add("usedFrquDscr", jaFeeDetail[i]["used_frqu_dscr"]);//使用频次描述
  1006. joTmp.Add("prdDays", jaFeeDetail[i]["prd_days"]);//周期天数
  1007. joTmp.Add("medcWayDscr", jaFeeDetail[i]["medc_way_dscr"]);//用药途径描述
  1008. joTmp.Add("bilgDeptCodg", jaFeeDetail[i]["bilg_dept_codg"]);//开单科室编码
  1009. joTmp.Add("bilgDeptName", jaFeeDetail[i]["bilg_dept_name"]);//开单科室名称
  1010. joTmp.Add("bilgDrCodg", jaFeeDetail[i]["bilg_dr_codg"]);//开单医生编码
  1011. joTmp.Add("bilgDrName", jaFeeDetail[i]["bilg_dr_name"]);//开单医师姓名
  1012. joTmp.Add("acordDeptCodg", jaFeeDetail[i]["acord_dept_codg"]);//受单科室编码
  1013. joTmp.Add("acordDeptName", jaFeeDetail[i]["acord_dept_name"]);//受单科室名称
  1014. joTmp.Add("ordersDrCode", jaFeeDetail[i]["orders_dr_code"]);//受单医生编码
  1015. joTmp.Add("ordersDrName", jaFeeDetail[i]["orders_dr_name"]);//受单医生姓名
  1016. joTmp.Add("hospApprFlag", jaFeeDetail[i]["hosp_appr_flag"]);//医院审批标志
  1017. joTmp.Add("tcmdrugUsedWay", jaFeeDetail[i]["tcmdrug_used_way"]);//中药使用方式
  1018. joTmp.Add("etipFlag", jaFeeDetail[i]["etip_flag"]);//外检标志
  1019. joTmp.Add("etipHospCode", jaFeeDetail[i]["etip_hosp_code"]);//外检医院编码
  1020. joTmp.Add("dscgTkdrugFlag", jaFeeDetail[i]["dscg_tkdrug_flag"]);//出院带药标志
  1021. joTmp.Add("matnFeeFlag", jaFeeDetail[i]["matn_fee_flag"]);//生育费用标志
  1022. joTmp.Add("initFeedetlSn", jaFeeDetail[i]["init_feedetl_sn"]);//原费用流水号
  1023. joTmp.Add("drordNo", jaFeeDetail[i]["drord_no"]);//医嘱号
  1024. joTmp.Add("medType", jaFeeDetail[i]["med_type"]);//医疗类别
  1025. joTmp.Add("memo", "");//备注
  1026. joTmp.Add("expContent", jaFeeDetail[i]["expContent"]);//扩展字段
  1027. joTmp.Add("medListName", jaFeeDetail[i]["medins_list_name"]);//医疗目录名称
  1028. joTmp.Add("medListSpc", jaFeeDetail[i]["med_list_spc"]);//医疗目录规格
  1029. joTmp.Add("combNo", jaFeeDetail[i]["comb_no"]);//组套编号
  1030. jaRow.Add(joTmp);
  1031. }
  1032. jo.Add("medfeeSumamt", sumFee.ToString("#0.00"));
  1033. jo.Add("chrgBchno", chrgBchno);
  1034. jo.Add("feedetailList", jaRow);
  1035. outparam = jo.ToString();
  1036. return 0;
  1037. }
  1038. catch (Exception ex)
  1039. {
  1040. outparam = "获取费用异常:" + ex.Message;
  1041. Global.writeLog("GetFee", jo.ToString(), "获取费用异常:" + ex.Message);
  1042. return -1;
  1043. }
  1044. }
  1045. /// <summary>
  1046. /// 汇总医保返回的结算金额(按照HIS的原则汇总,后期HIS按照这个来进行勾稽关系判断)
  1047. /// </summary>
  1048. /// <param name="jo"></param>
  1049. /// <returns></returns>
  1050. public int sumInsuRtnSettlInfo(JObject jo, out JObject joSumFee, out string errMsg)
  1051. {
  1052. // 医疗费总额是患者在医药机构花费的所有诊疗、药品、耗材、服务设施等项目费用的总和 = 基金支付总额 + 个人负担总金额 + 其他(如医院负担金额);
  1053. //3、基金支付总额 = 基本医保统筹基金支出(含职工基本医疗保险、居民基本医疗保险)+补充医疗保险基金支出 (含覆盖全体参保人的居民大病保险和大额医疗费用补助、覆盖部分参保人的企业职工大额医疗费用补助和公务员医疗补助等)+医疗救助基金支出 + 其他支出(如伤残人员医疗保障基金支出);
  1054. //5、个人账户支出中包含账户共济支付金额
  1055. joSumFee = new JObject();
  1056. errMsg = "";
  1057. decimal ybAmt, psnAcctAmt, hospAmt, psnCashAmt, medFee;
  1058. try
  1059. {
  1060. ybAmt = 0; psnAcctAmt = 0; hospAmt = 0; psnCashAmt = 0; medFee = 0;
  1061. ybAmt = MSettl.fundPaySumamt;
  1062. psnAcctAmt = MSettl.accountPaySumamt;
  1063. psnCashAmt = MSettl.personCashPay;
  1064. hospAmt = MSettl.hospitalPartAmount;
  1065. medFee = MSettl.sumamt;
  1066. joSumFee.Add("sumamt", medFee);
  1067. joSumFee.Add("ybAmt", ybAmt);
  1068. joSumFee.Add("psnAcctAmt", psnAcctAmt);
  1069. joSumFee.Add("hospAmt", hospAmt);
  1070. joSumFee.Add("psnCashAmt", psnCashAmt);
  1071. if (medFee != (ybAmt + psnAcctAmt + psnCashAmt + hospAmt))
  1072. {
  1073. errMsg = "ybAmt(" + ybAmt.ToString() + ")+" + "psnAcctAmt(" + psnAcctAmt.ToString() + ")+" + "psnCashAmt(" + psnCashAmt.ToString() + ")+" + "hospAmt(" + hospAmt.ToString() + ")" + "!=medFee(" + medFee.ToString() + ")";
  1074. return -1;
  1075. }
  1076. return 0;
  1077. }
  1078. catch (Exception ex)
  1079. {
  1080. errMsg = ex.Message;
  1081. return 1;
  1082. }
  1083. }
  1084. /// <summary>
  1085. /// 获取结算费用的封装
  1086. /// </summary>
  1087. /// <param name="jo"></param>
  1088. /// <param name="path"></param>
  1089. /// <returns></returns>
  1090. private decimal getDecimalFee(JObject jo, string path)
  1091. {
  1092. try
  1093. {
  1094. string temp = JsonHelper.getDestValue(jo, path);
  1095. if (temp == "")
  1096. {
  1097. return 0;
  1098. }
  1099. else
  1100. {
  1101. return decimal.Parse(temp);
  1102. }
  1103. }
  1104. catch (Exception ex)
  1105. {
  1106. Global.writeLog("getFee异常:" + ex.Message);
  1107. return 0;
  1108. }
  1109. }
  1110. #endregion
  1111. #region 读卡
  1112. public int ReadEc(out string outParam)
  1113. {
  1114. outParam = "";
  1115. JObject joInput = new JObject();
  1116. try
  1117. {
  1118. STA sta = new STA();
  1119. object[] o = new object[2];
  1120. sta.ReadCard(o);
  1121. if (int.Parse(o[0].ToString()) != 0)
  1122. {
  1123. outParam = o[1].ToString();
  1124. return -1;
  1125. }
  1126. else
  1127. {
  1128. outParam = o[1].ToString();
  1129. return 0;
  1130. }
  1131. }
  1132. catch (Exception ex)
  1133. {
  1134. outParam = "异常:" + ex.Message;
  1135. return -1;
  1136. }
  1137. }
  1138. #endregion
  1139. #region 结算
  1140. /// <summary>
  1141. /// 返回移动支付结算信息给HIS
  1142. /// </summary>
  1143. /// <param name="joSetlInpar"></param>
  1144. /// <param name="joSetlinfo"></param>中心返回的信息
  1145. /// <param name="outParam"></param>
  1146. /// <returns></returns>
  1147. public int returnMPSettlementInfo(JObject joReg, JObject joSettl, out string outParam)
  1148. {
  1149. string errMsg;
  1150. try
  1151. {
  1152. JObject joSumFee = new JObject();
  1153. if (sumInsuRtnSettlInfo(joSettl, out joSumFee, out errMsg) != 0)
  1154. {
  1155. outParam = "返回结算结果给HIS失败,请联系管理员!" + errMsg;
  1156. return -1;
  1157. }
  1158. dynamic joTmp = new JObject();
  1159. joTmp.settleInfo = joSettl;
  1160. joTmp.updateUserID = Global.user.ID;
  1161. joTmp.regInfo = joReg;
  1162. joTmp.middleSettleFlag = "";
  1163. joTmp.interfaceDr = Global.inf.interfaceDr;
  1164. dynamic joHisInfo = new JObject();
  1165. joHisInfo.admID = MPat.adm_Dr;
  1166. joHisInfo.billID = MPat.billID;
  1167. joHisInfo.recordID = MPat.recordID;
  1168. joTmp.hisInfo = joHisInfo;
  1169. joTmp.psn_type = MPat.psn_type;
  1170. joTmp.mobilePayFlag = "Y";
  1171. joTmp.sumFeeObj = joSumFee;
  1172. joTmp.mdtrtinfo = MPat.mdtrtID;
  1173. JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110018", joTmp).ToString(), "返回移动支付结算结果给HIS");
  1174. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1175. {
  1176. outParam = "返回移动支付结算结果给HIS失败,请联系管理员!" + errMsg;
  1177. return -1;
  1178. }
  1179. else
  1180. {
  1181. joSumFee.Add("payAuthNo", MPat.payAuthNo);
  1182. joSumFee.Add("payOrdId", MPat.payOrdId);
  1183. joSumFee.Add("setlLatlnt", MPat.uldLatlnt);
  1184. joSumFee.Add("org_no", Global.inf.hospitalNO);
  1185. joSumFee.Add("medOrgOrd", MPat.recordID);
  1186. joSumFee.Add("mdtrtId", MPat.mdtrtID);
  1187. joSumFee.Add("gmt_out_create", MSettl.settlTime.ToString("yyyy-MM-dd HH:mm:ss"));
  1188. joRtn["result"] = joSumFee;
  1189. outParam = joRtn.ToString();
  1190. return 0;
  1191. }
  1192. }
  1193. catch (Exception ex)
  1194. {
  1195. outParam = "返回移动支付结算结果给HIS出现异常:!" + ex.Message;
  1196. return -1;
  1197. }
  1198. }
  1199. //查询结算信息
  1200. public int QuerySettleInfo(out string errMsg)
  1201. {
  1202. errMsg = "";
  1203. try
  1204. {
  1205. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr= " + Global.inf.hospitalDr;
  1206. sqlStr = sqlStr + " and AdmType = 3 and Adm_Dr= " + MPat.adm_Dr + " and PayOrdID= '" + MPat.payOrdId + "'";
  1207. JObject joSqlstr = new JObject();
  1208. joSqlstr.Add("sqlStr", sqlStr);
  1209. JObject joRtn = mIS.DynamicQuerySettlInfo(joSqlstr);
  1210. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1211. {
  1212. return -1;
  1213. }
  1214. else
  1215. {
  1216. errMsg = joRtn.ToString();
  1217. return 0;
  1218. }
  1219. }
  1220. catch (Exception ex)
  1221. {
  1222. errMsg = ex.Message;
  1223. return -1;
  1224. }
  1225. }
  1226. public int QuerySettleInfoBy6302(out string errMsg)
  1227. {
  1228. errMsg = "";
  1229. try
  1230. {
  1231. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr= " + Global.inf.hospitalDr;
  1232. sqlStr = sqlStr + " and AdmType = 3 and PayOrdID= '" + MPat.payOrdId + "'";
  1233. JObject joSqlstr = new JObject();
  1234. joSqlstr.Add("sqlStr", sqlStr);
  1235. JObject joRtn = mIS.DynamicQuerySettlInfo(joSqlstr);
  1236. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1237. {
  1238. return -1;
  1239. }
  1240. else
  1241. {
  1242. errMsg = joRtn.ToString();
  1243. return 0;
  1244. }
  1245. }
  1246. catch (Exception ex)
  1247. {
  1248. errMsg = ex.Message;
  1249. return -1;
  1250. }
  1251. }
  1252. #endregion
  1253. #region 存入MI
  1254. /// <summary>
  1255. /// 插入患者该次就诊参保信息
  1256. /// </summary>
  1257. /// <param name="joBaseInfo"></param>
  1258. /// <param name="joInsuInfo"></param>
  1259. /// <param name="joIdetInfo"></param>
  1260. /// <param name="outParam"></param>
  1261. /// <returns></returns>
  1262. private int insertPatCurInsuInfo(out string outParam)
  1263. {
  1264. JObject joTmp = new JObject();
  1265. string errMsg = "";
  1266. try
  1267. {
  1268. joTmp.Add("HospitalDr", Global.inf.hospitalDr);
  1269. joTmp.Add("InterfaceDr", Global.inf.interfaceDr);
  1270. joTmp.Add("AdmID", MPat.adm_Dr);
  1271. joTmp.Add("PatientName", MPat.name);
  1272. joTmp.Add("PersonalNO", MPat.psn_no);
  1273. joTmp.Add("MdtrtID", MPat.mdtrtID);
  1274. joTmp.Add("PsnCertType", "");
  1275. joTmp.Add("PsnCertNO", MPat.certNO);
  1276. joTmp.Add("Gend", MPat.gend);
  1277. joTmp.Add("Naty", "");
  1278. joTmp.Add("Brdy", MPat.brdy);
  1279. joTmp.Add("Age", MPat.age);
  1280. joTmp.Add("Balc", MPat.balc);
  1281. joTmp.Add("Insutype", MPat.insuType);
  1282. joTmp.Add("PsnType", MPat.psn_type);
  1283. joTmp.Add("PsnInsuStas", "");
  1284. joTmp.Add("PsnInsuDate", "");
  1285. joTmp.Add("PausInsuDate", "");
  1286. joTmp.Add("Cvlservflag", "");
  1287. joTmp.Add("insuplcAdmdvs", MPat.insuplc_admdvs);
  1288. joTmp.Add("EmpName", MPat.emp_name);
  1289. joTmp.Add("PsnIdettype", "");
  1290. joTmp.Add("PsnTypeLv", "");
  1291. joTmp.Add("IdetBegntime", "");
  1292. joTmp.Add("IdetEndtime", "");
  1293. if (string.IsNullOrEmpty(Global.user.ID)) Global.user.ID = "0";
  1294. joTmp.Add("updateUserID", Global.user.ID);
  1295. string serviceCode = "09010070";
  1296. string inpar = JsonHelper.setIrisInpar(serviceCode, joTmp).ToString();
  1297. JObject joRtn = invoker.invokeInsuService(inpar, "插入患者该次就诊参保信息");
  1298. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1299. {
  1300. outParam = errMsg;
  1301. return -1;
  1302. }
  1303. else
  1304. {
  1305. outParam = joRtn.ToString();
  1306. return 0;
  1307. }
  1308. }
  1309. catch (Exception ex)
  1310. {
  1311. outParam = "医保平台插入患者该次就诊参保信息:" + ex.Message;
  1312. return -1;
  1313. }
  1314. }
  1315. /// <summary>
  1316. /// 插入登记信息
  1317. /// </summary>
  1318. /// <param name="joInpar"></param> 48交易入参
  1319. /// <param name="joOutpar"></param>48交易出参
  1320. /// <param name="outParam"></param>
  1321. /// <returns></returns>
  1322. private int saveRegisterInfo(out string outParam)
  1323. {
  1324. //插入云医保平台
  1325. JObject joTmp = new JObject();
  1326. string errMsg = "";
  1327. try
  1328. {
  1329. joTmp.Add("HospitalDr", Global.inf.hospitalDr);
  1330. joTmp.Add("InterfaceDr", Global.inf.interfaceDr);
  1331. joTmp.Add("AdmDr", MPat.adm_Dr);
  1332. joTmp.Add("PatientName", MPat.name);
  1333. joTmp.Add("PersonalNO", MPat.psn_no);
  1334. joTmp.Add("InsuRegID", MPat.mdtrtID);
  1335. joTmp.Add("RegDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1336. joTmp.Add("InsuType", MPat.insuType);
  1337. joTmp.Add("CertificateType", MPat.certType);
  1338. joTmp.Add("CertificateNO", MPat.certNO);
  1339. joTmp.Add("MedicalType", MPat.medType);
  1340. joTmp.Add("AttendDoctorNO", MPat.admAttendDoctorNO);
  1341. joTmp.Add("ChiefPhyDocName", "");
  1342. joTmp.Add("AdmInDiagDesc", "");
  1343. joTmp.Add("AdmInDepCode", MPat.AdmInDepCode);
  1344. joTmp.Add("AdmInDepName", "");
  1345. joTmp.Add("AdmBed", "");
  1346. joTmp.Add("MainDiagCode", MPat.admDiagCode);
  1347. joTmp.Add("MainDiagName", MPat.admDiagName);
  1348. joTmp.Add("MainConditionDesc", "");
  1349. joTmp.Add("DiseasecCode", "");
  1350. joTmp.Add("DiseasecName", "");
  1351. joTmp.Add("OperationCode", "");
  1352. joTmp.Add("OperationName", "");
  1353. joTmp.Add("DiseasecTypeCode", "");
  1354. joTmp.Add("InsuranceAreaCode", MPat.insuplc_admdvs);
  1355. joTmp.Add("TreatmentAreaCode", Global.inf.areaCode);
  1356. joTmp.Add("payOrdId", MPat.payOrdId);
  1357. joTmp.Add("payToken", MPat.payToken);
  1358. joTmp.Add("RegState", "1");
  1359. joTmp.Add("ValidFlag", "1");
  1360. joTmp.Add("Type", "4");//线上支付门诊
  1361. joTmp.Add("updateUserID", Global.user.ID);
  1362. joTmp.Add("msgid", Global.curEvt.msgid);
  1363. joTmp.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1364. string serviceCode = "09010044";
  1365. string inpar = JsonHelper.setIrisInpar(serviceCode, joTmp).ToString();
  1366. JObject joRtn = invoker.invokeInsuService(inpar, "新增门诊登记信息");
  1367. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1368. {
  1369. outParam = joRtn.ToString();
  1370. return -1;
  1371. }
  1372. else
  1373. {
  1374. outParam = joRtn.ToString();
  1375. return 0;
  1376. }
  1377. }
  1378. catch (Exception ex)
  1379. {
  1380. outParam = "保存门诊登记信息异常:" + ex.Message;
  1381. return -1;
  1382. }
  1383. }
  1384. /// <summary>
  1385. /// 插入结算信息
  1386. /// </summary>
  1387. /// <param name="joSettlement"></param>
  1388. /// <param name="outParam"></param>
  1389. /// <returns></returns>
  1390. public int saveSettlement(out string outParam)
  1391. {
  1392. JObject joTmp = new JObject();
  1393. string errMsg = "";
  1394. try
  1395. {
  1396. JObject joSetlinfo = new JObject();
  1397. joSetlinfo.Add("HospitalDr", Global.inf.hospitalDr);
  1398. joSetlinfo.Add("admID", MPat.adm_Dr);
  1399. joSetlinfo.Add("mdtrt_id", MPat.mdtrtID);
  1400. joSetlinfo.Add("setl_id", MSettl.settlID);//
  1401. joSetlinfo.Add("pay_ord_id", MSettl.payOrdId);
  1402. joSetlinfo.Add("psn_no", MPat.psn_no);
  1403. joSetlinfo.Add("psn_name", MPat.name);
  1404. //joSetlinfo.Add("mdtrt_cert_type", JsonHelper.getDestValue(joRtnSetlinfo, "mdtrt_cert_type"));
  1405. joSetlinfo.Add("certno", MPat.certNO);
  1406. joSetlinfo.Add("gend", MPat.gend);
  1407. joSetlinfo.Add("naty", MPat.naty);
  1408. joSetlinfo.Add("brdy", MPat.brdy);
  1409. joSetlinfo.Add("age", MPat.age);
  1410. joSetlinfo.Add("insutype", MPat.insuType);
  1411. joSetlinfo.Add("psn_type", MPat.psn_type);
  1412. joSetlinfo.Add("cvlserv_flag", "");
  1413. joSetlinfo.Add("setl_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1414. joSetlinfo.Add("mdtrt_cert_type", MPat.mdtrtcertType);
  1415. joSetlinfo.Add("med_type", MPat.medType);
  1416. joSetlinfo.Add("medfee_sumamt", MSettl.sumamt);//总费用
  1417. joSetlinfo.Add("fulamt_ownpay_amt", MSettl.ownPayAmount);//全自费金额
  1418. joSetlinfo.Add("overlmt_selfpay", MSettl.overLimitAmountmt);//超限价自费费用
  1419. joSetlinfo.Add("preselfpay_amt", MSettl.preSelfPayAmount);//先行自付金额
  1420. joSetlinfo.Add("inscp_scp_amt", MSettl.inPolicyRangeAmount);//符合政策范围金额
  1421. joSetlinfo.Add("act_pay_dedc", MSettl.actualPayDeductible);//实际支付起付线
  1422. joSetlinfo.Add("hifp_pay", MSettl.healthInsurancePay);//基本医疗保险统筹基金支出
  1423. joSetlinfo.Add("pool_prop_selfpay", MSettl.healthInsuranceRatio);//基本医疗保险统筹基金支付比例
  1424. joSetlinfo.Add("cvlserv_pay", MSettl.civilserviceAllowancePay);//公务员医疗补助资金支出
  1425. joSetlinfo.Add("hifes_pay", MSettl.enterpriseSupplementPay);//企业支付 占用 大病报销金额
  1426. joSetlinfo.Add("hifmi_pay", MSettl.seriousIllnessPay);// 居民大病保险资金支出
  1427. joSetlinfo.Add("hifob_pay", MSettl.largeExpensesSupplementPay);//职工大额医疗费用补助基金支出
  1428. joSetlinfo.Add("maf_pay", MSettl.medicalAssistPay);//医疗救助基金支出
  1429. joSetlinfo.Add("hosp_part_amt", MSettl.hospitalPartAmount);//医院负担金额
  1430. joSetlinfo.Add("oth_pay", MSettl.otherPay);//其他支出
  1431. joSetlinfo.Add("fund_pay_sumamt", MSettl.fundPaySumamt);//基金支付总额
  1432. joSetlinfo.Add("psn_part_amt", MSettl.personPaySumamt);//个人负担总金额
  1433. joSetlinfo.Add("acct_pay", MSettl.accountPaySumamt);//个人账户支出
  1434. joSetlinfo.Add("psn_cash_pay", MSettl.personCashPay);//个人现金支出
  1435. joSetlinfo.Add("balc", MSettl.balance);// 余额
  1436. joSetlinfo.Add("acct_mulaid_pay", "");//个人账户共济支付金额
  1437. joSetlinfo.Add("medins_setl_id", "");//医药机构结算ID
  1438. joSetlinfo.Add("clr_optins", MSettl.clearingOrgan);//清算经办机构
  1439. joSetlinfo.Add("clr_way", MSettl.clearingWay);//清算方式
  1440. joSetlinfo.Add("clr_type", MSettl.clearingType);//清算类别
  1441. joSetlinfo.Add("ValidFlag", 1);
  1442. joSetlinfo.Add("BillType", 1);
  1443. joSetlinfo.Add("msgid", Global.curEvt.msgid);
  1444. joSetlinfo.Add("admType", "3");
  1445. joSetlinfo.Add("billID", MPat.billID);
  1446. joSetlinfo.Add("recordID", MPat.recordID);
  1447. joSetlinfo.Add("interfaceDr", Global.inf.interfaceDr);
  1448. joSetlinfo.Add("insuplc_admdvs", MPat.insuplc_admdvs);
  1449. joSetlinfo.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1450. joSetlinfo.Add("HospitalizationsDays", MSettl.hospitalizationsDays);
  1451. joSetlinfo.Add("HospitalizationsTimes", MSettl.hospitalizationsTimes);
  1452. joSetlinfo.Add("HISAdmTime", MSettl.hisAdmTime);
  1453. joSetlinfo.Add("HISDischargeTime", MSettl.hisDischargeTime);
  1454. joSetlinfo.Add("updateUserID", Global.user.ID);
  1455. joSetlinfo.Add("ConfirmFlag", MSettl.confirmFlag);
  1456. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010051", joSetlinfo).ToString(), "插入结算信息");
  1457. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1458. {
  1459. outParam = errMsg;
  1460. return -1;
  1461. }
  1462. else
  1463. {
  1464. outParam = joSetlinfo.ToString();
  1465. return 0;
  1466. }
  1467. }
  1468. catch (Exception ex)
  1469. {
  1470. outParam = "插入结算信息:" + ex.Message;
  1471. return -1;
  1472. }
  1473. }
  1474. public int updateSettlement(out string outParam)
  1475. {
  1476. JObject joTmp = new JObject();
  1477. string errMsg = "";
  1478. try
  1479. {
  1480. JObject joSetlinfo = new JObject();
  1481. joSetlinfo.Add("HospitalDr", Global.inf.hospitalDr);
  1482. joSetlinfo.Add("AdmDr", MPat.adm_Dr);
  1483. joSetlinfo.Add("MdtrtID", MPat.mdtrtID);
  1484. joSetlinfo.Add("SettlementID", MSettl.settlID);//
  1485. joSetlinfo.Add("PayOrdID", MSettl.payOrdId);
  1486. joSetlinfo.Add("PersonnelNO", MPat.psn_no);
  1487. joSetlinfo.Add("PatientName", MPat.name);
  1488. //joSetlinfo.Add("CertificateType", JsonHelper.getDestValue(joRtnSetlinfo, "mdtrt_cert_type"));
  1489. joSetlinfo.Add("CertificateNO", MPat.certNO);
  1490. joSetlinfo.Add("Gender", MPat.gend);
  1491. joSetlinfo.Add("Nation", MPat.naty);
  1492. joSetlinfo.Add("BirthDay", MPat.brdy);
  1493. joSetlinfo.Add("Age", MPat.age);
  1494. joSetlinfo.Add("InsuranceType", MPat.insuType);
  1495. joSetlinfo.Add("PersonType", MPat.psn_type);
  1496. joSetlinfo.Add("CivilserviceFlag", "");
  1497. joSetlinfo.Add("SettlementDateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1498. joSetlinfo.Add("MdtrtCertType", MPat.mdtrtcertType);
  1499. joSetlinfo.Add("MedicalType", MPat.medType);
  1500. joSetlinfo.Add("Sumamt", MSettl.sumamt);//总费用
  1501. joSetlinfo.Add("OwnPayAmount", MSettl.ownPayAmount);//全自费金额
  1502. joSetlinfo.Add("OverLimitAmount", MSettl.overLimitAmountmt);//超限价自费费用
  1503. joSetlinfo.Add("PreSelfPayAmount", MSettl.preSelfPayAmount);//先行自付金额
  1504. joSetlinfo.Add("InPolicyRangeAmount", MSettl.inPolicyRangeAmount);//符合政策范围金额
  1505. joSetlinfo.Add("ActualPayDeductible", MSettl.actualPayDeductible);//实际支付起付线
  1506. joSetlinfo.Add("HealthInsurancePay", MSettl.healthInsurancePay);//基本医疗保险统筹基金支出
  1507. joSetlinfo.Add("HealthInsuranceRatio", MSettl.healthInsuranceRatio);//基本医疗保险统筹基金支付比例
  1508. joSetlinfo.Add("CivilserviceAllowancePay", MSettl.civilserviceAllowancePay);//公务员医疗补助资金支出
  1509. joSetlinfo.Add("EnterpriseSupplementPay", MSettl.enterpriseSupplementPay);//企业支付
  1510. joSetlinfo.Add("SeriousIllnessPay", MSettl.seriousIllnessPay);// 居民大病保险资金支出
  1511. joSetlinfo.Add("LargeExpensesSupplementPay", MSettl.largeExpensesSupplementPay);//职工大额医疗费用补助基金支出
  1512. joSetlinfo.Add("MedicalAssistPay", MSettl.medicalAssistPay);//医疗救助基金支出
  1513. joSetlinfo.Add("HospitalPartAmount", MSettl.hospitalPartAmount);//医院负担金额
  1514. joSetlinfo.Add("OtherPay", MSettl.otherPay);//其他支出
  1515. joSetlinfo.Add("FundPaySumamt", MSettl.fundPaySumamt);//基金支付总额
  1516. joSetlinfo.Add("PersonPaySumamt", MSettl.personPaySumamt);//个人负担总金额
  1517. joSetlinfo.Add("AccountPaySumamt", MSettl.accountPaySumamt);//个人账户支出
  1518. joSetlinfo.Add("PersonCashPay", MSettl.personCashPay);//个人现金支出
  1519. joSetlinfo.Add("Balance", MSettl.balance);// 余额
  1520. joSetlinfo.Add("AccountMutualAidAmount", "");//个人账户共济支付金额
  1521. joSetlinfo.Add("OrganSettlementID", "");//医药机构结算ID
  1522. joSetlinfo.Add("ClearingOrgan", MSettl.clearingOrgan);//清算经办机构
  1523. joSetlinfo.Add("ClearingWay", MSettl.clearingWay);//清算方式
  1524. joSetlinfo.Add("ClearingType", MSettl.clearingType);//清算类别
  1525. joSetlinfo.Add("ValidFlag", 1);
  1526. joSetlinfo.Add("BillType", 1);
  1527. joSetlinfo.Add("ConfirmFlag", MSettl.confirmFlag);
  1528. joSetlinfo.Add("MSGID", Global.curEvt.msgid);
  1529. joSetlinfo.Add("AdmType", "3");
  1530. joSetlinfo.Add("BillID", MPat.billID);
  1531. joSetlinfo.Add("RecordID", MPat.recordID);
  1532. joSetlinfo.Add("InterfaceDr", Global.inf.interfaceDr);
  1533. joSetlinfo.Add("InsuranceAreaCode", MPat.insuplc_admdvs);
  1534. joSetlinfo.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1535. joSetlinfo.Add("HospitalizationsDays", MSettl.hospitalizationsDays);
  1536. joSetlinfo.Add("HospitalizationsTimes", MSettl.hospitalizationsTimes);
  1537. joSetlinfo.Add("HISAdmTime", MSettl.hisAdmTime);
  1538. joSetlinfo.Add("HISDischargeTime", MSettl.hisDischargeTime);
  1539. joSetlinfo.Add("updateUserID", Global.user.ID);
  1540. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010089", joSetlinfo).ToString(), "通过订单号更新结算信息");
  1541. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1542. {
  1543. outParam = errMsg;
  1544. return -1;
  1545. }
  1546. else
  1547. {
  1548. outParam = joSetlinfo.ToString();
  1549. return 0;
  1550. }
  1551. }
  1552. catch (Exception ex)
  1553. {
  1554. outParam = "插入结算信息:" + ex.Message;
  1555. return -1;
  1556. }
  1557. }
  1558. /// <summary>
  1559. /// 取消结算
  1560. /// </summary>
  1561. /// <param name="outParam"></param>
  1562. /// <returns></returns>
  1563. public int cancleSettlement(string newSettlID, out string outParam)
  1564. {
  1565. JObject joTmp = new JObject();
  1566. string errMsg = "";
  1567. try
  1568. {
  1569. joTmp.Add("HospitalDr", Global.inf.hospitalDr);
  1570. joTmp.Add("InterfaceDr", Global.inf.interfaceDr);
  1571. joTmp.Add("admID", MPat.adm_Dr);
  1572. joTmp.Add("mdtrt_id", MPat.mdtrtID);
  1573. joTmp.Add("setl_id", MPat.settlID);
  1574. joTmp.Add("new_setl_id", newSettlID);
  1575. joTmp.Add("updateUserID", Global.user.ID);
  1576. joTmp.Add("msgid", Global.curEvt.msgid);
  1577. joTmp.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  1578. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010052", joTmp).ToString(), "取消结算信息");
  1579. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1580. {
  1581. outParam = errMsg;
  1582. return -1;
  1583. }
  1584. else
  1585. {
  1586. outParam = JsonHelper.setExceptionJson(0, "云医保平台", "取消结算成功").ToString();
  1587. return 0;
  1588. }
  1589. }
  1590. catch (Exception ex)
  1591. {
  1592. outParam = "取消结算信息:" + ex.Message;
  1593. return -1;
  1594. }
  1595. }
  1596. /// <summary>
  1597. /// 插入医保费用
  1598. /// </summary>
  1599. /// <param name="jaTmp"></param>
  1600. /// <param name="outParam"></param>
  1601. /// <returns></returns>
  1602. public int insertFee(JArray jaTmp, out string outParam)
  1603. {
  1604. try
  1605. {
  1606. outParam = "";
  1607. string errMsg;
  1608. dynamic joTmp = new JObject();
  1609. joTmp = new JObject();
  1610. joTmp.code = "09010046";
  1611. joTmp.HospitalDr = Global.inf.hospitalDr;
  1612. joTmp.admID = MPat.adm_Dr;
  1613. joTmp.mdtrt_id = MPat.mdtrtID;
  1614. joTmp.updateUserID = Global.user.ID;
  1615. joTmp.Add("params", jaTmp);
  1616. ;
  1617. JObject joRtn = invoker.invokeInsuService(joTmp.ToString(), "插入2301明细");
  1618. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  1619. {
  1620. outParam = errMsg;
  1621. return -1;
  1622. }
  1623. else
  1624. {
  1625. outParam = joRtn.ToString();
  1626. return 0;
  1627. }
  1628. }
  1629. catch (Exception ex)
  1630. {
  1631. outParam = "insertFee 异常:" + ex.Message;
  1632. return -1;
  1633. }
  1634. }
  1635. private int saveToMi(out string errMsg)
  1636. {
  1637. errMsg = "";
  1638. try
  1639. {
  1640. //存储参保信息
  1641. if (insertPatCurInsuInfo(out errMsg) != 0)
  1642. {
  1643. return -1;
  1644. }
  1645. //存储登记信息
  1646. if (saveRegisterInfo(out errMsg) != 0)
  1647. {
  1648. return -1;
  1649. }
  1650. //处理jaFee
  1651. foreach (var jo in jaFee)
  1652. {
  1653. jo["mdtrt_id"] = MPat.mdtrtID;
  1654. jo["psn_no"] = MPat.psn_no;
  1655. }
  1656. //存储费用信息
  1657. if (insertFee(jaFee, out errMsg) != 0)
  1658. {
  1659. return -1;
  1660. }
  1661. return 0;
  1662. }
  1663. catch (Exception ex)
  1664. {
  1665. errMsg = "saveToMi:" + ex.Message;
  1666. return -1;
  1667. }
  1668. }
  1669. #endregion
  1670. #region 解析中心返回
  1671. /// <summary>
  1672. /// 解析银海移动支付返参
  1673. /// </summary>
  1674. /// <param name="joRtn"></param>
  1675. /// <param name="errorMsg"></param>
  1676. /// <returns></returns>
  1677. public int ParseCenterRtnValue(JObject joRtn, out string errorMsg)
  1678. {
  1679. try
  1680. {
  1681. errorMsg = JsonHelper.getDestValue(joRtn, "message");
  1682. return int.Parse(JsonHelper.getDestValue(joRtn, "code")); //0 成功-1 失败
  1683. }
  1684. catch (Exception ex)
  1685. {
  1686. errorMsg = "解析银海移动支付返参发生异常:" + ex.Message;
  1687. return -1;
  1688. }
  1689. }
  1690. #endregion
  1691. }
  1692. }