SettlementChecklist.cs 96 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using PTMedicalInsurance.Helper;
  11. using PTMedicalInsurance.Common;
  12. using Newtonsoft.Json.Linq;
  13. using PTMedicalInsurance.FormSetter;
  14. using PTMedicalInsurance.Variables;
  15. using FastReport;
  16. using Newtonsoft.Json;
  17. using System.Threading;
  18. using FastReportFrom;
  19. using PTMedicalInsurance.Business;
  20. using FastReportFunction = FastReport.FastReportFunction;
  21. using System.IO;
  22. using FastReport.Export.Dbf;
  23. using Sunny.UI;
  24. using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
  25. using System.Drawing.Drawing2D;
  26. using FastReport.Editor;
  27. namespace PTMedicalInsurance.Forms
  28. {
  29. public partial class SettlementChecklist : Form
  30. {
  31. private int hospitalDr;
  32. private int interfaceDr;
  33. private string hospitalNO;
  34. private string interfaceNO;
  35. private string hospitalName;
  36. private string hospitalAreaCode;
  37. private bool disposed = false;
  38. private HisIrisServices hIS = new HisIrisServices();
  39. private MIIrisServices mIS = new MIIrisServices();
  40. Thread thread_test;
  41. private InvokeHelper invoker = new InvokeHelper();
  42. public SettlementChecklist()
  43. {
  44. InitializeComponent();
  45. hospitalDr = Global.inf.hospitalDr;
  46. hospitalNO = Global.inf.hospitalNO;
  47. hospitalName = Global.inf.hospitalName;
  48. hospitalAreaCode = Global.inf.areaCode;
  49. interfaceDr = Global.inf.interfaceDr;
  50. }
  51. public SettlementChecklist(JObject joParam)
  52. {
  53. InitializeComponent();
  54. hospitalDr = Global.inf.hospitalDr;
  55. hospitalNO = Global.inf.hospitalNO;
  56. hospitalName = Global.inf.hospitalName;
  57. hospitalAreaCode = Global.inf.areaCode;
  58. if (joParam == null) return;
  59. string setl_id = JsonHelper.getDestValue(joParam, "setl_id");
  60. if (setl_id == "")
  61. {
  62. MessageBox.Show("根据传入的结算编号为查询到相关信息,请手动输入查询!");
  63. return;
  64. }
  65. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;
  66. sqlStr = sqlStr + " and SettlementID='" + setl_id + "'";
  67. JObject joSqlstr = new JObject();
  68. joSqlstr.Add("sqlStr", sqlStr);
  69. JArray jaParam = new JArray();
  70. jaParam.Add(joSqlstr);
  71. JObject joSettlQuery = new JObject();
  72. joSettlQuery.Add("params", jaParam);
  73. joSettlQuery.Add("code", "09010059");
  74. InvokeHelper invoker = new InvokeHelper();
  75. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  76. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  77. dgvSettlRecord.DataSource = dt;
  78. }
  79. public void Dispose()
  80. {
  81. Dispose1(true);
  82. GC.SuppressFinalize(this);
  83. }
  84. protected virtual void Dispose1(bool disposing)
  85. {
  86. if (thread_test == null) return;
  87. if (disposed == false)
  88. {
  89. if (disposing == true)
  90. {
  91. Thread.Sleep(100);
  92. Global.writeLog("Main - aborting my thread.");
  93. thread_test.Abort();//终止线程myThread
  94. thread_test.Join();//等待线程myThread结束
  95. Global.writeLog("Main - ending.");
  96. }
  97. //释放托管资源的代码
  98. }
  99. disposed = true;
  100. }
  101. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  102. {
  103. }
  104. private void btnQuery_Click(object sender, EventArgs e)
  105. {
  106. }
  107. private void btnQuery_Click_1(object sender, EventArgs e)
  108. {
  109. string sqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + hospitalDr ;
  110. sqlStr = sqlStr + " and OccurTime>'" + dpST.Text + "'";
  111. sqlStr = sqlStr + " and OccurTime<'" + dpED.Text + "'";
  112. if (tbName.Text != "")
  113. {
  114. sqlStr = sqlStr + " and PatientName='" + tbName.Text + "'";
  115. }
  116. if (tbPatSettlID.Text != "")
  117. {
  118. sqlStr = sqlStr + " and SettlementID='" + tbPatSettlID.Text + "'";
  119. }
  120. if (tbHisNO.Text != "")
  121. {
  122. sqlStr = sqlStr + " and Adm_Dr='" + tbHisNO.Text + "'";
  123. }
  124. if (cbxInterface.Text != "")
  125. {
  126. sqlStr = sqlStr + " and Interface_Dr=" + Global.inf.interfaceDr + "";
  127. }
  128. if (rbgAdmType.SelectedIndex == 1)
  129. {
  130. sqlStr = sqlStr + " and AdmType=2";
  131. }
  132. if (rbgAdmType.SelectedIndex == 2)
  133. {
  134. sqlStr = sqlStr + " and AdmType=1";
  135. }
  136. if (rbgBillType.SelectedIndex == 1)
  137. {
  138. sqlStr = sqlStr + " and BillType=1 and ValidFlag=1 ";
  139. }
  140. if (rbgBillType.SelectedIndex == 2)
  141. {
  142. sqlStr = sqlStr + " and BillType=-1 and ValidFlag=0 ";
  143. }
  144. JObject joSqlstr = new JObject();
  145. joSqlstr.Add("sqlStr", sqlStr);
  146. JArray jaParam = new JArray();
  147. jaParam.Add(joSqlstr);
  148. JObject joSettlQuery = new JObject();
  149. joSettlQuery.Add("params", jaParam);
  150. joSettlQuery.Add("code", "09010059");
  151. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  152. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  153. dgvSettlRecord.DataSource = dt;
  154. }
  155. private void SettlementChecklist_Load(object sender, EventArgs e)
  156. {
  157. dpST.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  158. dpED.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  159. ComboxSetter cbxSetter = new ComboxSetter();
  160. cbxSetter.setCbxInterfaceDataSource(cbxInterface);
  161. GridViewSetter grdSetter = new GridViewSetter();
  162. grdSetter.SetHeaderTextOfSettlList(dgvSettlRecord);
  163. rbgAdmType.SelectedIndex = 0;
  164. rbgBillType.SelectedIndex = 1;
  165. btnDesign.Visible = true;
  166. cbxInterface.SelectedValueChanged += new EventHandler(cbxInterface_SelectedValueChanged);
  167. }
  168. private void cbxInterface_SelectedValueChanged(object sender, EventArgs e)
  169. {
  170. DataTable dt = (DataTable)cbxInterface.DataSource;
  171. int i = cbxInterface.SelectedIndex;
  172. //赋值
  173. hospitalNO = dt.Rows[i]["HospitalNO"].ToString();
  174. //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString());
  175. //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
  176. hospitalDr = int.Parse(dt.Rows[i]["HospitalDr"].ToString());
  177. interfaceNO = dt.Rows[i]["InterfaceNO"].ToString();
  178. interfaceDr = int.Parse(dt.Rows[i]["ID"].ToString());
  179. hospitalAreaCode = dt.Rows[i]["AreaCode"].ToString();
  180. //Global.inf.centerURL = dt.Rows[i]["CenterURL"].ToString();
  181. //Global.inf.businessDllName = dt.Rows[i]["DLLName"].ToString();
  182. //Global.inf.patientAreaCode = dt.Rows[i]["AreaCode"].ToString();
  183. }
  184. private JObject getPatCheckList()
  185. {
  186. try
  187. {
  188. int i = dgvSettlRecord.CurrentRow.Index;
  189. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  190. JObject joSettel = new JObject();
  191. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  192. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  193. joSettel.Add("admID", dt.Rows[i]["AdmID"].ToString());
  194. joSettel.Add("SettlementID", dt.Rows[i]["SettlementID"].ToString());
  195. joSettel.Add("ValidFlag", dt.Rows[i]["ValidFlag"].ToString());
  196. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  197. return joRtn;
  198. }
  199. catch (Exception ex)
  200. {
  201. JObject joRtn = new JObject();
  202. joRtn.Add("errorCode", -1);
  203. joRtn.Add("errorMessage", ex.Message);
  204. return joRtn;
  205. }
  206. }
  207. private void uiPanel1_Click(object sender, EventArgs e)
  208. {
  209. }
  210. [STAThread]
  211. public void design()
  212. {
  213. //try
  214. //{
  215. // string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
  216. // FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
  217. // JObject joSettleCheckList = getPatCheckList();
  218. // string errMsg;
  219. // if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
  220. // {
  221. // MessageBox.Show("查询结算信息异常:" + errMsg);
  222. // return;
  223. // }
  224. // Report report = new Report();
  225. // try
  226. // {
  227. // var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  228. // report.RegisterData(json.result.data.classification, "classification");
  229. // report.RegisterData(json.result.data.settlement, "settlement");
  230. // report.RegisterData(json.result.data.reginfo, "reginfo");
  231. // report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  232. // }
  233. // catch (Exception ex)
  234. // {
  235. // MessageBox.Show(ex.Message);
  236. // return;
  237. // }
  238. // report.Load(Global.curEvt.path + "\\frx\\河南郑州结算单.frx");
  239. // PrintDesign pf = new PrintDesign();
  240. // pf.designerControl1.Report = report;
  241. // report.Design();
  242. // pf.WindowState = FormWindowState.Maximized;
  243. // pf.ShowDialog();
  244. //}
  245. //catch (Exception ex)
  246. //{
  247. // MessageBox.Show(ex.Message);
  248. //}
  249. }
  250. [STAThread]
  251. private void print()
  252. {
  253. //string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
  254. //FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
  255. //JObject joSettleCheckList = getPatCheckList();
  256. //string errMsg;
  257. //if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
  258. //{
  259. // MessageBox.Show("查询结算信息异常:" + errMsg);
  260. // return;
  261. //}
  262. //Report report = new Report();
  263. //try
  264. //{
  265. // var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  266. // report.RegisterData(json.result.data.classification, "classification");
  267. // report.RegisterData(json.result.data.settlement, "settlement");
  268. // report.RegisterData(json.result.data.reginfo, "reginfo");
  269. // report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  270. //}
  271. //catch (Exception ex)
  272. //{
  273. // MessageBox.Show(ex.Message);
  274. // return;
  275. //}
  276. ////report.Design();
  277. //report.Load(Global.curEvt.path + "\\frx\\河南郑州结算单.frx");
  278. //this.ShowInTaskbar = true;
  279. //PrintPreview pf = new PrintPreview();
  280. //report.Preview = pf.previewControl1;
  281. //report.Show();
  282. //pf.WindowState = FormWindowState.Maximized;
  283. //pf.ShowDialog();
  284. try
  285. {
  286. int i = dgvSettlRecord.CurrentRow.Index;
  287. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  288. string AdmID = dt.Rows[i]["AdmID"].ToString();
  289. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  290. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  291. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  292. string BillType = dt.Rows[i]["BillType"].ToString();
  293. JObject joRtn = GetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag, BillType);
  294. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  295. {
  296. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  297. return;
  298. }
  299. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  300. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  301. {
  302. MessageBox.Show("调用FastReport打印失败!" + errMsg);
  303. return;
  304. }
  305. }
  306. catch (Exception ex)
  307. {
  308. MessageBox.Show(ex.Message);
  309. return;
  310. }
  311. }
  312. public int FastReportPrint(string InParams, out string OutMsg)
  313. {
  314. Global.writeLog("调用FastReport入参:" + InParams);
  315. try
  316. {
  317. #region【调用正版FastReport打印】
  318. FastReportFrom.FastReportDll FrDll = new FastReportFrom.FastReportDll();
  319. string sRtnFr = FrDll.FastReport(InParams);
  320. JObject joRetObj = JObject.Parse(sRtnFr);
  321. if (JsonHelper.parseIrisRtnValue(joRetObj, out string errMsg) != 0)
  322. {
  323. OutMsg = "调用FastReport打印失败!" + errMsg;
  324. return -1;
  325. }
  326. else
  327. {
  328. OutMsg = "";
  329. return 0;
  330. }
  331. #endregion
  332. }
  333. catch (Exception ex)
  334. {
  335. OutMsg = "调用FastReport打印失败!" + ex.Message;
  336. return -1;
  337. }
  338. }
  339. public JObject GetFastReportParams(string designFlag, string admID, string MdtrtID, string settlementID, string validFlag,string BillType)
  340. {
  341. try
  342. {
  343. if (designFlag == "") { designFlag = "N"; }
  344. #region【获取HIS医保结算信息】
  345. JObject joSettel = new JObject();
  346. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  347. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  348. joSettel.Add("admID", admID);
  349. joSettel.Add("SettlementID", settlementID);
  350. joSettel.Add("ValidFlag", validFlag);
  351. joSettel.Add("BillType", BillType);
  352. joSettel.Add("MdtrtID", MdtrtID);
  353. JObject joRtnSettle = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  354. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out string errMsg) != 0)
  355. {
  356. JObject joRtnSet = new JObject();
  357. joRtnSet.Add("errorCode", -1);
  358. joRtnSet.Add("errorMessage", errMsg);
  359. joRtnSet.Add("result", "");
  360. return joRtnSet;
  361. }
  362. #endregion
  363. #region【获取住院号】
  364. JObject joTmp = new JObject();
  365. joTmp.Add("admID", joRtnSettle["result"]["data"]["settlement"][0]["AdmID"]);
  366. joTmp.Add("psn_no", joRtnSettle["result"]["data"]["settlement"][0]["PersonnelNO"]);
  367. //JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110001", joTmp).ToString(), "获取诊断信息");
  368. JObject joRtnDiag = invoker.invokeHISService(JsonHelper.setIrisInpar("05110014", joTmp).ToString(), "获取诊断信息");
  369. string medrcdno = "";
  370. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out errMsg) == 0)
  371. {
  372. medrcdno = joRtnDiag["mdtrtinfo"]["medrcdno"].ToString();
  373. }
  374. #endregion
  375. #region【数据转换】
  376. if (joRtnSettle["result"]["data"]["settlement"][0]["Gender"].ToString() == "1")
  377. {
  378. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "男";
  379. }
  380. else
  381. {
  382. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "女";
  383. }
  384. DateTime startDate = (DateTime)joRtnSettle["result"]["data"]["reginfo"][0]["RegDate"];
  385. DateTime endDate = (DateTime)joRtnSettle["result"]["data"]["settlement"][0]["SettlementTime"];
  386. int diffInDays = (int)(endDate - startDate).TotalDays;
  387. if (diffInDays == 0)
  388. {
  389. diffInDays = 1;
  390. }
  391. joRtnSettle["result"]["data"]["settlement"][0]["HospitalizationsDays"] = diffInDays;
  392. string str = joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"].ToString();
  393. if (str.Contains("."))
  394. {
  395. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str.Split('.')[0] + "岁";
  396. }
  397. else
  398. {
  399. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str + "岁";
  400. }
  401. #endregion
  402. #region【组织FastReport调用入参】
  403. JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
  404. JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
  405. JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
  406. JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
  407. JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
  408. //转换金额大写
  409. string Sumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt").ToString());
  410. string HealthInsurancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay").ToString());
  411. string ActualPayDeductible = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible").ToString());
  412. string PersonCashPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay").ToString());
  413. string AccountPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt").ToString());
  414. string FundPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt").ToString());
  415. string LargeExpensesSupplementPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay").ToString());
  416. string SeriousIllnessPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay").ToString());
  417. string CivilserviceAllowancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay").ToString());
  418. string MedicalAssistPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay").ToString());
  419. string OtherPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay").ToString());
  420. string HospitalPartAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount").ToString());
  421. string AccountMutualAidAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount").ToString());
  422. string InPolicyRangeAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].InPolicyRangeAmount").ToString());
  423. //退费前卡余额
  424. decimal BalanceBefore = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Balance")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) + Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount"));
  425. //退费撤销结算单负数显示
  426. decimal LSumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt")) * -1;
  427. decimal LHealthInsurancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay")) * -1;
  428. decimal LAccountPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) * -1;
  429. decimal LFundPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt")) * -1;
  430. decimal LCivilserviceAllowancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay")) * -1;
  431. decimal LMedicalAssistPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay")) * -1;
  432. decimal LPersonCashPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay")) * -1;
  433. decimal LAccountMutualAidAmount = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount")) * -1;
  434. decimal LBlZf = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonPaySumamt")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OwnPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PreSelfPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OverLimitAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible"));
  435. //string BeginDate = JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo[0].RegDate").ToString();
  436. //string EndDate = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HISDischargeTime").ToString();
  437. //string InHosDays = FastReportFunction.DateDiff(Convert.ToDateTime(BeginDate), Convert.ToDateTime(EndDate));
  438. JObject jaAmountChiness = new JObject();
  439. jaAmountChiness.Add("Sumamt", Sumamt);
  440. jaAmountChiness.Add("HealthInsurancePay", HealthInsurancePay);
  441. jaAmountChiness.Add("ActualPayDeductible", ActualPayDeductible);
  442. jaAmountChiness.Add("PersonCashPay", PersonCashPay);
  443. jaAmountChiness.Add("AccountPaySumamt", AccountPaySumamt);
  444. jaAmountChiness.Add("FundPaySumamt", FundPaySumamt);
  445. jaAmountChiness.Add("LargeExpensesSupplementPay", LargeExpensesSupplementPay);
  446. jaAmountChiness.Add("SeriousIllnessPay", SeriousIllnessPay);
  447. jaAmountChiness.Add("CivilserviceAllowancePay", CivilserviceAllowancePay);
  448. jaAmountChiness.Add("MedicalAssistPay", MedicalAssistPay);
  449. jaAmountChiness.Add("OtherPay", OtherPay);
  450. jaAmountChiness.Add("HospitalPartAmount", HospitalPartAmount);
  451. jaAmountChiness.Add("AccountMutualAidAmount", AccountMutualAidAmount);
  452. jaAmountChiness.Add("InPolicyRangeAmount", InPolicyRangeAmount); //合规费用
  453. jaAmountChiness.Add("SettlOpter", Global.user.name);
  454. jaAmountChiness.Add("medrcdno", medrcdno);
  455. //其他自定义处理字段
  456. jaAmountChiness.Add("BalanceBefore", BalanceBefore);//结算前卡余额
  457. jaAmountChiness.Add("LSumamt", LSumamt);
  458. jaAmountChiness.Add("LHealthInsurancePay", LHealthInsurancePay);
  459. jaAmountChiness.Add("LAccountPaySumamt", LAccountPaySumamt);
  460. jaAmountChiness.Add("LFundPaySumamt", LFundPaySumamt);
  461. jaAmountChiness.Add("LCivilserviceAllowancePay", LCivilserviceAllowancePay);
  462. jaAmountChiness.Add("LMedicalAssistPay", LMedicalAssistPay);
  463. jaAmountChiness.Add("LPersonCashPay", LPersonCashPay);
  464. jaAmountChiness.Add("LAccountMutualAidAmount", LAccountMutualAidAmount);
  465. jaAmountChiness.Add("LBlZf", LBlZf);
  466. JArray jachinessParams = new JArray();
  467. jachinessParams.Add(jaAmountChiness);
  468. JObject joDataResult = new JObject();
  469. joDataResult.Add("SettlementInfo", jaSettlement);
  470. joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
  471. joDataResult.Add("ClassificationInfo", jaClassification);
  472. joDataResult.Add("RegInfo", jaReginfo);
  473. joDataResult.Add("Patinsuinfo", japatinsuinfo);
  474. joDataResult.Add("ChinessSummat", jachinessParams);
  475. #region【门诊撤销结算单打印需要体现费用信息】
  476. String outParam;
  477. JObject joRtnRis = new JObject();
  478. JObject joHisFee = new JObject();
  479. if (Global.pat.admType == 1)
  480. {
  481. Global.pat.adm_Dr = int.Parse(joRtnSettle["result"]["data"]["settlement"][0]["AdmID"].ToString());
  482. Global.pat.billID = "";
  483. Global.pat.recordID = joRtnSettle["result"]["data"]["settlement"][0]["RecordID"].ToString();
  484. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  485. {
  486. JObject joRtnSet = new JObject();
  487. joRtnSet.Add("errorCode", -1);
  488. joRtnSet.Add("errorMessage", "获取HIS费用失败");
  489. joRtnSet.Add("result", "");
  490. return joRtnSet;
  491. }
  492. else
  493. {
  494. joRtnRis = JObject.Parse(outParam);
  495. }
  496. joHisFee = JObject.Parse(outParam);
  497. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  498. {
  499. JObject joRtnSet = new JObject();
  500. joRtnSet.Add("errorCode", -1);
  501. joRtnSet.Add("errorMessage", "医保平台转换费用失败");
  502. joRtnSet.Add("result", "");
  503. return joRtnSet;
  504. }
  505. joDataResult.Add("Feeinfo", JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data")));
  506. }
  507. #endregion【门诊撤销结算单打印需要体现费用信息】
  508. JObject joParams = new JObject();
  509. if (Global.pat.admType == 1)
  510. {
  511. joParams.Add("fastReportCode", "SP14"); //这个要从表取值
  512. }else
  513. {
  514. joParams.Add("fastReportCode", "SP11"); //湖北普瑞门诊结算单撤销结算单从SP14打印
  515. }
  516. joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
  517. joParams.Add("printCode", "14");
  518. joParams.Add("templateID", "");
  519. JArray jaParams = new JArray();
  520. jaParams.Add(joParams);
  521. JObject joReportParams = new JObject();
  522. joReportParams.Add("params", jaParams);
  523. joReportParams.Add("code", "01040306");
  524. JObject joParam = new JObject();
  525. joParam.Add("designFlag", designFlag);
  526. joParam.Add("logFlag", "N");
  527. joParam.Add("dataParams", "");
  528. joParam.Add("pdfName", "");
  529. joParam.Add("reportparams", joReportParams);
  530. joParam.Add("dataResult", joDataResult);
  531. JObject joDataURL = new JObject();
  532. joDataURL.Add("dataIP", Global.hisConfig.ip);
  533. joDataURL.Add("urlAddress", Global.hisConfig.url);
  534. joDataURL.Add("authorization", Global.hisConfig.authorization);
  535. joParam.Add("dataURL", joDataURL);
  536. JArray jaParam = new JArray();
  537. jaParam.Add(joParam);
  538. JObject joInparam = new JObject();
  539. joInparam.Add("params", JArray.FromObject(jaParam));
  540. joInparam.Add("session", Global.curEvt.jaSession);
  541. #endregion
  542. JObject joRtn = new JObject();
  543. joRtn.Add("errorCode", 0);
  544. joRtn.Add("errorMessage", "");
  545. joRtn.Add("result", joInparam.ToString());
  546. return joRtn;
  547. }
  548. catch (Exception ex)
  549. {
  550. JObject joRtnEx = new JObject();
  551. joRtnEx.Add("errorCode", -1);
  552. joRtnEx.Add("errorMessage", ex.Message);
  553. joRtnEx.Add("result", "");
  554. return joRtnEx;
  555. }
  556. }
  557. //湖北市医保单独fastReport打印方法
  558. [STAThread]
  559. private void cityPrint()
  560. {
  561. try
  562. {
  563. int i = dgvSettlRecord.CurrentRow.Index;
  564. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  565. string AdmID = dt.Rows[i]["AdmID"].ToString();
  566. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  567. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  568. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  569. string BillType = dt.Rows[i]["BillType"].ToString();
  570. JObject pJoInparm = new JObject();
  571. pJoInparm.Add("MdtrtCertType", dt.Rows[i]["MdtrtCertType"].ToString());
  572. JObject joRtn = cityGetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag, BillType, pJoInparm);
  573. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  574. {
  575. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  576. return;
  577. }
  578. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  579. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  580. {
  581. MessageBox.Show("调用FastReport打印失败!" + errMsg);
  582. return;
  583. }
  584. }
  585. catch (Exception ex)
  586. {
  587. MessageBox.Show(ex.Message);
  588. return;
  589. }
  590. }
  591. //湖北市医保单独获取fastReport打印入参
  592. public JObject cityGetFastReportParams(string designFlag, string admID, string MdtrtID, string settlementID, string validFlag, string BillType, JObject pJoInparm)
  593. {
  594. try
  595. {
  596. if (designFlag == "") { designFlag = "N"; }
  597. //string sqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE SettlementID='" + settlementID + "'";
  598. //sqlStr = sqlStr + " and Adm_Dr='" + admID + "'";
  599. //sqlStr = sqlStr + " and ValidFlag='" + validFlag + "'";
  600. //sqlStr = sqlStr + " and BillType='" + BillType + "'";
  601. //JObject joSqlstr = new JObject();
  602. //joSqlstr.Add("sqlStr", sqlStr);
  603. //JArray jaParam = new JArray();
  604. //jaParam.Add(joSqlstr);
  605. //JObject joSettlQuery = new JObject();
  606. //joSettlQuery.Add("params", jaParam);
  607. //joSettlQuery.Add("code", "09010059");
  608. //JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  609. //DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  610. #region【获取HIS医保结算信息】
  611. JObject joSettel = new JObject();
  612. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  613. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  614. joSettel.Add("admID", admID);
  615. joSettel.Add("SettlementID", settlementID);
  616. joSettel.Add("ValidFlag", validFlag);
  617. joSettel.Add("BillType", BillType);
  618. joSettel.Add("MdtrtID", MdtrtID);
  619. JObject joRtnSettle = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  620. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out string errMsg) != 0)
  621. {
  622. JObject joRtnSet = new JObject();
  623. joRtnSet.Add("errorCode", -1);
  624. joRtnSet.Add("errorMessage", errMsg);
  625. joRtnSet.Add("result", "");
  626. return joRtnSet;
  627. }
  628. #endregion
  629. #region【获取住院号】
  630. JObject joTmp = new JObject();
  631. joTmp.Add("admID", joRtnSettle["result"]["data"]["settlement"][0]["AdmID"]);
  632. joTmp.Add("psn_no", joRtnSettle["result"]["data"]["settlement"][0]["PersonnelNO"]);
  633. //JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110001", joTmp).ToString(), "获取诊断信息");
  634. JObject joRtnDiag = invoker.invokeHISService(JsonHelper.setIrisInpar("05110014", joTmp).ToString(), "获取诊断信息");
  635. string medrcdno = "";
  636. string mdtrtCertType = "";//医保使用凭证 电子凭证 身份证 社保卡
  637. string adtime = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SettlementTime").ToString();
  638. string distime = "";
  639. int billtype = int.Parse(BillType);
  640. //取就诊日期日期部分
  641. DateTime addateTime;
  642. if (DateTime.TryParse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SettlementTime").ToString(), out addateTime))
  643. {
  644. distime = addateTime.Date.ToString("yyyy-MM-dd"); // 格式化输出日期部分
  645. adtime = addateTime.Date.ToString("yyyy-MM-dd"); // 格式化输出日期部分
  646. }
  647. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out errMsg) == 0)
  648. {
  649. medrcdno = joRtnDiag["mdtrtinfo"]["medrcdno"].ToString();
  650. }
  651. #endregion
  652. #region【数据转换】
  653. if (joRtnSettle["result"]["data"]["settlement"][0]["Gender"].ToString() == "1")
  654. {
  655. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "男";
  656. }
  657. else
  658. {
  659. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "女";
  660. }
  661. if (pJoInparm["MdtrtCertType"].ToString() == "01")
  662. {
  663. mdtrtCertType = "医保电子凭证";
  664. }
  665. else if (pJoInparm["MdtrtCertType"].ToString() == "02")
  666. {
  667. mdtrtCertType = "居民身份证";
  668. }
  669. else if (pJoInparm["MdtrtCertType"].ToString() == "03")
  670. {
  671. mdtrtCertType = "社保卡";
  672. }
  673. DateTime startDate = (DateTime)joRtnSettle["result"]["data"]["reginfo"][0]["RegDate"];
  674. DateTime endDate = (DateTime)joRtnSettle["result"]["data"]["settlement"][0]["SettlementTime"];
  675. int diffInDays = (int)(endDate - startDate).TotalDays;
  676. if (diffInDays == 0)
  677. {
  678. diffInDays = 1;
  679. }
  680. joRtnSettle["result"]["data"]["settlement"][0]["HospitalizationsDays"] = diffInDays;
  681. string str = joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"].ToString();
  682. if (str.Contains("."))
  683. {
  684. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str.Split('.')[0] + "岁";
  685. }
  686. else
  687. {
  688. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str + "岁";
  689. }
  690. string ISCX = "";
  691. if (BillType == "-1")
  692. {
  693. ISCX = "撤销";
  694. }
  695. #endregion
  696. #region【组织FastReport调用入参】
  697. JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
  698. JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
  699. JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
  700. JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
  701. JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
  702. //退费前卡余额
  703. decimal BalanceBefore = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Balance")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) + Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount"));
  704. //退费撤销结算单负数显示
  705. decimal LSumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt")) * billtype;
  706. decimal LFundPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt")) * billtype;
  707. decimal LHealthInsurancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay")) * billtype;
  708. decimal LLargeExpensesSupplementPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay")) * billtype;
  709. decimal LSeriousIllnessPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay")) * billtype;
  710. decimal LMedicalAssistPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay")) * billtype;
  711. decimal LEnterpriseSupplementPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].EnterpriseSupplementPay")) * billtype;
  712. decimal LOtherPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay")) * billtype;
  713. decimal LCivilserviceAllowancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay")) * billtype;
  714. decimal LDEZF = LLargeExpensesSupplementPay + LSeriousIllnessPay;
  715. decimal LHospitalPartAmount = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount")) * billtype;
  716. decimal LPersonPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonPaySumamt")) * billtype;
  717. decimal LAccountPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) * billtype;
  718. decimal LPersonCashPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay")) * billtype;
  719. decimal LAccountMutualAidAmount = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount")) * billtype;
  720. decimal LBlZf = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonPaySumamt")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OwnPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PreSelfPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OverLimitAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible"));
  721. //转换金额大写
  722. string Sumamt = FastReportFunction.MoneyToUpper(LSumamt.ToString());
  723. string HealthInsurancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay").ToString());
  724. string ActualPayDeductible = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible").ToString());
  725. string PersonCashPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay").ToString());
  726. string AccountPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt").ToString());
  727. string FundPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt").ToString());
  728. string LargeExpensesSupplementPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay").ToString());
  729. string SeriousIllnessPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay").ToString());
  730. string CivilserviceAllowancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay").ToString());
  731. string MedicalAssistPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay").ToString());
  732. string OtherPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay").ToString());
  733. string HospitalPartAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount").ToString());
  734. string AccountMutualAidAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount").ToString());
  735. string InPolicyRangeAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].InPolicyRangeAmount").ToString());
  736. //string BeginDate = JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo[0].RegDate").ToString();
  737. //string EndDate = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HISDischargeTime").ToString();
  738. //string InHosDays = FastReportFunction.DateDiff(Convert.ToDateTime(BeginDate), Convert.ToDateTime(EndDate));
  739. JObject jaAmountChiness = new JObject();
  740. jaAmountChiness.Add("Sumamt", Sumamt);
  741. jaAmountChiness.Add("HealthInsurancePay", HealthInsurancePay);
  742. jaAmountChiness.Add("ActualPayDeductible", ActualPayDeductible);
  743. jaAmountChiness.Add("PersonCashPay", PersonCashPay);
  744. jaAmountChiness.Add("AccountPaySumamt", AccountPaySumamt);
  745. jaAmountChiness.Add("FundPaySumamt", FundPaySumamt);
  746. jaAmountChiness.Add("LargeExpensesSupplementPay", LargeExpensesSupplementPay);
  747. jaAmountChiness.Add("SeriousIllnessPay", SeriousIllnessPay);
  748. jaAmountChiness.Add("CivilserviceAllowancePay", CivilserviceAllowancePay);
  749. jaAmountChiness.Add("MedicalAssistPay", MedicalAssistPay);
  750. jaAmountChiness.Add("OtherPay", OtherPay);
  751. jaAmountChiness.Add("HospitalPartAmount", HospitalPartAmount);
  752. jaAmountChiness.Add("AccountMutualAidAmount", AccountMutualAidAmount);
  753. jaAmountChiness.Add("InPolicyRangeAmount", InPolicyRangeAmount); //合规费用
  754. jaAmountChiness.Add("SettlOpter", Global.user.name);
  755. jaAmountChiness.Add("medrcdno", medrcdno);
  756. jaAmountChiness.Add("mdtrtCertType", mdtrtCertType);
  757. jaAmountChiness.Add("hospitalNO",Global.inf.hospitalNO);
  758. jaAmountChiness.Add("hospitalName", Global.inf.hospitalName);
  759. //其他自定义处理字段
  760. jaAmountChiness.Add("BalanceBefore", BalanceBefore);//结算前卡余额
  761. jaAmountChiness.Add("LSumamt", LSumamt);
  762. jaAmountChiness.Add("LFundPaySumamt", LFundPaySumamt);
  763. jaAmountChiness.Add("LHealthInsurancePay", LHealthInsurancePay);
  764. jaAmountChiness.Add("LMedicalAssistPay", LMedicalAssistPay);
  765. jaAmountChiness.Add("LCivilserviceAllowancePay", LCivilserviceAllowancePay);
  766. jaAmountChiness.Add("LLargeExpensesSupplementPay", LLargeExpensesSupplementPay);
  767. jaAmountChiness.Add("LSeriousIllnessPay", LSeriousIllnessPay);
  768. jaAmountChiness.Add("LEnterpriseSupplementPay", LEnterpriseSupplementPay);
  769. jaAmountChiness.Add("LOtherPay", LOtherPay);
  770. jaAmountChiness.Add("LDEZF", LDEZF);
  771. jaAmountChiness.Add("LHospitalPartAmount", LHospitalPartAmount);
  772. jaAmountChiness.Add("LPersonPaySumamt", LPersonPaySumamt);
  773. jaAmountChiness.Add("LAccountPaySumamt", LAccountPaySumamt);
  774. jaAmountChiness.Add("LPersonCashPay", LPersonCashPay);
  775. jaAmountChiness.Add("LAccountMutualAidAmount", LAccountMutualAidAmount);
  776. jaAmountChiness.Add("LBlZf", LBlZf);
  777. jaAmountChiness.Add("adtime", adtime);
  778. jaAmountChiness.Add("distime", distime);
  779. jaAmountChiness.Add("iscx", ISCX);
  780. JArray jachinessParams = new JArray();
  781. jachinessParams.Add(jaAmountChiness);
  782. JObject joDataResult = new JObject();
  783. joDataResult.Add("SettlementInfo", jaSettlement);
  784. joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
  785. joDataResult.Add("ClassificationInfo", jaClassification);
  786. joDataResult.Add("RegInfo", jaReginfo);
  787. joDataResult.Add("Patinsuinfo", japatinsuinfo);
  788. joDataResult.Add("ChinessSummat", jachinessParams);
  789. JObject joParams = new JObject();
  790. joParams.Add("fastReportCode", "printSettlementList"); //这个要从表取值
  791. joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
  792. joParams.Add("printCode", "City");
  793. joParams.Add("templateID", "");
  794. JArray jaParams = new JArray();
  795. jaParams.Add(joParams);
  796. JObject joReportParams = new JObject();
  797. joReportParams.Add("params", jaParams);
  798. joReportParams.Add("code", "01040306");
  799. JObject joParam = new JObject();
  800. joParam.Add("designFlag", designFlag);
  801. joParam.Add("logFlag", "N");
  802. joParam.Add("dataParams", "");
  803. joParam.Add("pdfName", "");
  804. joParam.Add("reportparams", joReportParams);
  805. joParam.Add("dataResult", joDataResult);
  806. JObject joDataURL = new JObject();
  807. joDataURL.Add("dataIP", Global.hisConfig.ip);
  808. joDataURL.Add("urlAddress", Global.hisConfig.url);
  809. joDataURL.Add("authorization", Global.hisConfig.authorization);
  810. joParam.Add("dataURL", joDataURL);
  811. JArray jaParam = new JArray();
  812. jaParam.Add(joParam);
  813. JObject joInparam = new JObject();
  814. joInparam.Add("params", JArray.FromObject(jaParam));
  815. joInparam.Add("session", Global.curEvt.jaSession);
  816. #endregion
  817. JObject joRtn = new JObject();
  818. joRtn.Add("errorCode", 0);
  819. joRtn.Add("errorMessage", "");
  820. joRtn.Add("result", joInparam.ToString());
  821. return joRtn;
  822. }
  823. catch (Exception ex)
  824. {
  825. JObject joRtnEx = new JObject();
  826. joRtnEx.Add("errorCode", -1);
  827. joRtnEx.Add("errorMessage", ex.Message);
  828. joRtnEx.Add("result", "");
  829. return joRtnEx;
  830. }
  831. }
  832. [STAThread]
  833. private void preview()
  834. {
  835. //Report report = new Report();
  836. //try
  837. //{
  838. // var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  839. // report.RegisterData(json.result.data.classification, "classification");
  840. // report.RegisterData(json.result.data.settlement, "settlement");
  841. // report.RegisterData(json.result.data.reginfo, "reginfo");
  842. // report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  843. //}
  844. //catch (Exception ex)
  845. //{
  846. // MessageBox.Show(ex.Message);
  847. // return;
  848. //}
  849. ////report.Design();
  850. //report.Load(Global.curEvt.path + "\\frx\\湖北武汉结算单.frx");
  851. ////report.Show();
  852. //PrintPreview preview1 = new PrintPreview();
  853. //preview1.Show();
  854. //report.Preview = preview1.previewControl1;
  855. //report.Prepare(); //准备
  856. //report.ShowPrepared(); //显示
  857. //preview1.Show();
  858. }
  859. private void uiButton2_Click(object sender, EventArgs e)
  860. {
  861. Close();
  862. }
  863. public void btnPrint_Click(object sender, EventArgs e)
  864. {
  865. string errorMsg;
  866. int iHis = dgvSettlRecord.CurrentRow.Index;
  867. String BType = dgvSettlRecord.Rows[iHis].Cells["BillType"].Value.ToString();
  868. Global.pat.admType =int.Parse(dgvSettlRecord.Rows[iHis].Cells["admType"].Value.ToString());
  869. JObject joData = new JObject();
  870. joData.Add("mdtrt_id", dgvSettlRecord.Rows[iHis].Cells["MdtrtID"].Value.ToString());
  871. joData.Add("setl_id", dgvSettlRecord.Rows[iHis].Cells["SettlementID"].Value.ToString());
  872. joData.Add("psn_no", dgvSettlRecord.Rows[iHis].Cells["PersonnelNO"].Value.ToString());
  873. joData.Add("med_type", dgvSettlRecord.Rows[iHis].Cells["MedicalType"].Value.ToString());
  874. JObject joInput = new JObject();
  875. joInput.Add("data", joData);
  876. Global.pat.insuplc_admdvs = dgvSettlRecord.Rows[iHis].Cells["insuplc_admdvs"].Value.ToString();//更新参保地
  877. if (BType == "1") {
  878. #region【调用医保交易YH03打印】
  879. InvokeHelper invoker = new InvokeHelper();
  880. JObject joRtn = invoker.invokeCenterService("YH03", JsonHelper.setCenterInpar("YH03", joInput));
  881. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  882. {
  883. MessageBox.Show("打印失败:" + errorMsg);
  884. return;
  885. }
  886. #endregion
  887. }
  888. else if (BType == "-1")
  889. {
  890. #region【调用FastRepor打印】
  891. try
  892. {
  893. //Thread thread = new Thread(new ThreadStart(print));
  894. //thread.SetApartmentState(ApartmentState.STA); //重点
  895. //thread.Start();
  896. //thread.Join();
  897. print();
  898. }
  899. catch (Exception ex)
  900. {
  901. Global.writeLog("结算单打印异常:" + ex.Message);
  902. MessageBox.Show("打印异常:" + ex.Message);
  903. }
  904. #endregion
  905. }
  906. }
  907. public void btnDesign_Click(object sender, EventArgs e)
  908. {
  909. //try
  910. //{
  911. // Thread thread = new Thread(new ThreadStart(design));
  912. // thread.SetApartmentState(ApartmentState.STA); //重点
  913. // thread.Start();
  914. // thread.Join();
  915. //}
  916. //catch (Exception ex)
  917. //{
  918. // Global.writeLog("结算单设计预览异常:" + ex.Message);
  919. // MessageBox.Show("设计预览异常:" + ex.Message);
  920. //}
  921. if (dgvSettlRecord.RowCount <= 0)
  922. {
  923. MessageBox.Show("请先查询结算数据!");
  924. return;
  925. }
  926. try
  927. {
  928. int i = dgvSettlRecord.CurrentRow.Index;
  929. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  930. Global.pat.admType = int.Parse(dgvSettlRecord.Rows[i].Cells["admType"].Value.ToString());
  931. string AdmID = dt.Rows[i]["AdmID"].ToString();
  932. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  933. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  934. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  935. string BillType = dt.Rows[i]["BillType"].ToString();
  936. JObject joRtn = GetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag, BillType);
  937. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  938. {
  939. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  940. return;
  941. }
  942. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  943. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  944. {
  945. MessageBox.Show("调用FastReport设计失败!" + errMsg);
  946. return;
  947. }
  948. }
  949. catch (Exception ex)
  950. {
  951. MessageBox.Show(ex.Message);
  952. return;
  953. }
  954. }
  955. private void SettlementChecklist_FormClosed(object sender, FormClosedEventArgs e)
  956. {
  957. Dispose();
  958. }
  959. //市医保进销存992001结算信息上传
  960. private void JXCJSToolStripMenuItem_Click(object sender, EventArgs e)
  961. {
  962. if (dgvSettlRecord.RowCount <= 0)
  963. {
  964. MessageBox.Show("请先查询结算数据!");
  965. return;
  966. }
  967. string sqlStr;
  968. try
  969. {
  970. int m = dgvSettlRecord.CurrentRow.Index;
  971. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  972. string msgid = dt.Rows[m]["msgid"].ToString();
  973. string SettlementID = dt.Rows[m]["SettlementID"].ToString();
  974. string ValidFlag = dt.Rows[m]["ValidFlag"].ToString();
  975. string MdtrtID = dt.Rows[m]["MdtrtID"].ToString();
  976. string BillType = dt.Rows[m]["BillType"].ToString();
  977. string AdmID= dt.Rows[m]["AdmID"].ToString();
  978. string billID = dt.Rows[m]["billID"].ToString();
  979. string recordID = dt.Rows[m]["recordID"].ToString();
  980. Global.pat.adm_Dr = int.Parse(AdmID);
  981. Global.pat.billID = billID;
  982. Global.pat.recordID = recordID;
  983. //if (BillType == "-1")
  984. //{
  985. // MessageBox.Show("请选择结算正记录!该记录为退费记录");
  986. //}
  987. sqlStr = "SELECT * FROM BS_MedInsuTransactionLog WHERE MSGID='" + msgid + "'";
  988. JObject joSqlstr = new JObject();
  989. joSqlstr.Add("sqlStr", sqlStr);
  990. JObject joRtn = mIS.QueryTransactionLog(joSqlstr);
  991. if (joRtn["result"]["data"].ToString() == "[]")
  992. {
  993. MessageBox.Show("查询结果为空!");
  994. return;
  995. }
  996. //DataTable dtlog = (DataTable)joRtn["result"]["data"][0].ToObject(typeof(DataTable));
  997. JObject Outlog = JObject.Parse(joRtn["result"]["data"][0]["OutparamPlain"].ToString());
  998. dynamic setlinfo = new JObject();//结算信息节点
  999. setlinfo.setl_id = Outlog["output"]["setlinfo"]["setl_id"];//结算ID
  1000. setlinfo.mdtrt_id = Outlog["output"]["setlinfo"]["mdtrt_id"];//就诊ID
  1001. setlinfo.psn_no = Outlog["output"]["setlinfo"]["psn_no"];//人员编号
  1002. setlinfo.psn_name = Outlog["output"]["setlinfo"]["psn_name"];//人员姓名
  1003. setlinfo.psn_cert_type = Outlog["output"]["setlinfo"]["psn_cert_type"];//凭证类型
  1004. setlinfo.certno = Outlog["output"]["setlinfo"]["certno"];//证件号码
  1005. setlinfo.gend = Outlog["output"]["setlinfo"]["gend"];//性别
  1006. setlinfo.naty = Outlog["output"]["setlinfo"]["naty"];//民族
  1007. setlinfo.brdy = Outlog["output"]["setlinfo"]["brdy"];//出生日期
  1008. setlinfo.age = Outlog["output"]["setlinfo"]["age"];//年龄
  1009. setlinfo.insutype = Outlog["output"]["setlinfo"]["insutype"];//险种类型
  1010. setlinfo.psn_type = Outlog["output"]["setlinfo"]["psn_type"];//人员类别
  1011. setlinfo.cvlserv_flag = Outlog["output"]["setlinfo"]["cvlserv_flag"];//公务员标志
  1012. setlinfo.setl_time = Outlog["output"]["setlinfo"]["setl_time"];//结算时间
  1013. setlinfo.mdtrt_cert_type = Outlog["output"]["setlinfo"]["mdtrt_cert_type"];//就诊凭证类型
  1014. setlinfo.med_type = Outlog["output"]["setlinfo"]["med_type"];//医疗类别
  1015. setlinfo.medfee_sumamt = Outlog["output"]["setlinfo"]["medfee_sumamt"];//医疗费总额
  1016. setlinfo.fulamt_ownpay_amt = Outlog["output"]["setlinfo"]["fulamt_ownpay_amt"];//全自费金额
  1017. setlinfo.overlmt_selfpay = Outlog["output"]["setlinfo"]["overlmt_selfpay"];//超限价自费费用
  1018. setlinfo.preselfpay_amt = Outlog["output"]["setlinfo"]["preselfpay_amt"];//先行自付金额
  1019. setlinfo.inscp_scp_amt = Outlog["output"]["setlinfo"]["inscp_scp_amt"];//符合政策范围金额
  1020. setlinfo.act_pay_dedc = Outlog["output"]["setlinfo"]["act_pay_dedc"];//实际支付起付线
  1021. setlinfo.hifp_pay = Outlog["output"]["setlinfo"]["hifp_pay"];//基本医疗保险统筹基金支出
  1022. setlinfo.pool_prop_selfpay = Outlog["output"]["setlinfo"]["pool_prop_selfpay"];//基本医疗保险统筹基金支付比例
  1023. setlinfo.cvlserv_pay = Outlog["output"]["setlinfo"]["cvlserv_pay"];//公务员医疗补助资金支出
  1024. setlinfo.hifes_pay = Outlog["output"]["setlinfo"]["hifes_pay"];//企业补充医疗保险基金支出
  1025. setlinfo.hifmi_pay = Outlog["output"]["setlinfo"]["hifmi_pay"];//居民大病保险资金支出
  1026. setlinfo.hifob_pay = Outlog["output"]["setlinfo"]["hifob_pay"];//职工大额医疗费用补助基金支出
  1027. setlinfo.maf_pay = Outlog["output"]["setlinfo"]["maf_pay"];//医疗救助基金支出
  1028. setlinfo.oth_pay = Outlog["output"]["setlinfo"]["oth_pay"];//结算ID
  1029. setlinfo.fund_pay_sumamt = Outlog["output"]["setlinfo"]["fund_pay_sumamt"];//基金支付总额
  1030. setlinfo.psn_part_amt = Outlog["output"]["setlinfo"]["psn_part_amt"];//个人负担总金额
  1031. setlinfo.acct_pay = Outlog["output"]["setlinfo"]["acct_pay"];//个人账户支出
  1032. setlinfo.psn_cash_pay = Outlog["output"]["setlinfo"]["psn_cash_pay"];//个人现金支出
  1033. setlinfo.balc = Outlog["output"]["setlinfo"]["balc"];//余额
  1034. setlinfo.acct_mulaid_pay = Outlog["output"]["setlinfo"]["acct_mulaid_pay"];//个人账户共济支付金额
  1035. setlinfo.medins_setl_id = Outlog["output"]["setlinfo"]["medins_setl_id"];//医药机构结算结算ID
  1036. setlinfo.clr_optins = Outlog["output"]["setlinfo"]["clr_optins"];//clr_optins
  1037. setlinfo.clr_way = Outlog["output"]["setlinfo"]["clr_way"];//clr_way
  1038. setlinfo.clr_type = Outlog["output"]["setlinfo"]["clr_type"];//clr_type
  1039. setlinfo.exp_content = Outlog["output"]["setlinfo"]["exp_content"].ToString();//exp_content
  1040. setlinfo.hosp_part_amt = Outlog["output"]["setlinfo"]["hosp_part_amt"];//医院负担金额
  1041. setlinfo.hifdm_pay = 0;//伤残人员医疗保障基金支出
  1042. //string outParam = "";
  1043. ////获取IS费用
  1044. //if (hIS.getHisFee(Global.pat, out outParam) != 0)
  1045. //{
  1046. // MessageBox.Show("获取HIS费用失败");
  1047. //}
  1048. ////调用医保平台转换HIS费用(转换医保编码等)
  1049. //JObject joHisFee = JObject.Parse(outParam);
  1050. //if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  1051. //{
  1052. // MessageBox.Show("获取HIS费用医保对照关系失败");
  1053. //}
  1054. //JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  1055. // JObject jaFeeOne=new JObject();
  1056. //for (int i = 0; i < jaFeeDetail.Count; i++)
  1057. //{
  1058. // jaFeeOne.Add("feedetl_sn", jaFeeDetail[i]["feedetl_sn"]);//费用明细流水号
  1059. // jaFeeOne.Add("rxno", "");//处方号
  1060. // if (string.IsNullOrEmpty(jaFeeDetail[i]["rx_circ_flag"].ToString()))
  1061. // {
  1062. // jaFeeOne.Add("rx_circ_flag", "");//外购处方标志
  1063. // }
  1064. // else
  1065. // {
  1066. // jaFeeOne.Add("rx_circ_flag", jaFeeDetail[i]["rx_circ_flag"]);//外购处方标志
  1067. // }
  1068. // jaFeeOne.Add("fee_ocur_time", jaFeeDetail[i]["fee_ocur_time"]);
  1069. // jaFeeOne.Add("med_list_codg", jaFeeDetail[i]["med_list_codg"]);
  1070. // jaFeeOne.Add("medins_list_codg", jaFeeDetail[i]["medins_list_codg"]);
  1071. // jaFeeOne.Add("medins_list_name", jaFeeDetail[i]["medins_list_desc"]);
  1072. // jaFeeOne.Add("prodname", jaFeeDetail[i]["medins_list_desc"]);
  1073. // if (string.IsNullOrEmpty(jaFeeDetail[i]["spec"].ToString()))
  1074. // {
  1075. // jaFeeOne.Add("spec", "");
  1076. // }
  1077. // else
  1078. // {
  1079. // jaFeeOne.Add("spec", jaFeeDetail[i]["spec"]);
  1080. // }
  1081. // if (string.IsNullOrEmpty(jaFeeDetail[i]["doseForm"].ToString()))
  1082. // {
  1083. // jaFeeOne.Add("dosform_name", "");
  1084. // }
  1085. // else
  1086. // {
  1087. // jaFeeOne.Add("dosform_name", jaFeeDetail[i]["doseForm"]);
  1088. // }
  1089. // jaFeeOne.Add(" det_item_fee_sumamt", jaFeeDetail[i]["det_item_fee_sumamt"]);
  1090. // jaFeeOne.Add("cnt", jaFeeDetail[i]["cnt"]);
  1091. // jaFeeOne.Add("pric", jaFeeDetail[i]["pric"]);
  1092. // if (string.IsNullOrEmpty(jaFeeDetail[i]["sin_dos_dscr"].ToString()))
  1093. // {
  1094. // jaFeeOne.Add("sin_dos_dscr", "");
  1095. // }
  1096. // else
  1097. // {
  1098. // jaFeeOne.Add("sin_dos_dscr", jaFeeDetail[i]["sin_dos_dscr"]);
  1099. // }
  1100. // if (string.IsNullOrEmpty(jaFeeDetail[i]["used_frqu_dscr"].ToString()))
  1101. // {
  1102. // jaFeeOne.Add("used_frqu_dscr", "");
  1103. // }
  1104. // else
  1105. // {
  1106. // jaFeeOne.Add("used_frqu_dscr", jaFeeDetail[i]["used_frqu_dscr"]);
  1107. // }
  1108. // if (string.IsNullOrEmpty(jaFeeDetail[i]["prd_days"].ToString()))
  1109. // {
  1110. // jaFeeOne.Add("prd_days", "");
  1111. // }
  1112. // else
  1113. // {
  1114. // jaFeeOne.Add("prd_days", jaFeeDetail[i]["prd_days"]);
  1115. // }
  1116. // MessageBox.Show("555");
  1117. // if (string.IsNullOrEmpty(jaFeeDetail[i]["medc_way_dscr"].ToString()))
  1118. // {
  1119. // jaFeeOne.Add("medc_way_dscr", "");
  1120. // }
  1121. // else
  1122. // {
  1123. // jaFeeOne.Add("medc_way_dscr", jaFeeDetail[i]["medc_way_dscr"]);
  1124. // }
  1125. // if (string.IsNullOrEmpty(jaFeeDetail[i]["bilg_dr_codg"].ToString()))
  1126. // {
  1127. // jaFeeOne.Add("bilg_dr_codg", "");
  1128. // }
  1129. // else
  1130. // {
  1131. // jaFeeOne.Add("bilg_dr_codg", jaFeeDetail[i]["bilg_dr_codg"]);
  1132. // }
  1133. // if (string.IsNullOrEmpty(jaFeeDetail[i]["bilg_dr_name"].ToString()))
  1134. // {
  1135. // jaFeeOne.Add("bilg_dr_name", "");
  1136. // }
  1137. // else
  1138. // {
  1139. // jaFeeOne.Add("bilg_dr_name", jaFeeDetail[i]["bilg_dr_name"]);
  1140. // }
  1141. // MessageBox.Show("666");
  1142. // jaFeeOne.Add("phar_name", "");
  1143. // jaFeeOne.Add("phar_prac_cert_no", "");
  1144. // jaFeeOne.Add("tcmdrug_used_way", ""); //中药使用方式 1复方 2单方 必填
  1145. // jaFeeOne.Add("trdn_flag", "1");//拆零标志 必填 0否 1是
  1146. // jaFeeDetail.Add(jaFeeOne);
  1147. // jaFeeOne = new JObject();
  1148. // MessageBox.Show("777");
  1149. //}
  1150. JObject Jo992001 = new JObject();
  1151. //Jo992001.Add("setlinfo",JObject.Parse(setlinfo));//结算信息节点
  1152. Jo992001.Add("setlinfo", setlinfo);//结算信息节点
  1153. //Jo992001.Add("drugdetail", jaFeeDetail);//购药明细节点
  1154. JObject OutJo = invoker.invokeCenterServiceJXC("992001", JObject.Parse(JsonHelper.setCenterInpar("992001", Jo992001)));
  1155. MessageBox.Show("上传成功!!!,上传返回:" + OutJo.ToString());
  1156. }
  1157. catch (Exception ex)
  1158. {
  1159. MessageBox.Show(ex.Message);
  1160. return;
  1161. }
  1162. }
  1163. private void SYBJXCTFToolStripMenuItem_Click(object sender, EventArgs e)
  1164. {
  1165. if (dgvSettlRecord.RowCount <= 0)
  1166. {
  1167. MessageBox.Show("请先查询结算数据!");
  1168. return;
  1169. }
  1170. string sqlStr;
  1171. try
  1172. {
  1173. int m = dgvSettlRecord.CurrentRow.Index;
  1174. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  1175. string msgid = dt.Rows[m]["msgid"].ToString();
  1176. string SettlementID = dt.Rows[m]["SettlementID"].ToString();
  1177. string ValidFlag = dt.Rows[m]["ValidFlag"].ToString();
  1178. string MdtrtID = dt.Rows[m]["MdtrtID"].ToString();
  1179. string BillType = dt.Rows[m]["BillType"].ToString();
  1180. string AdmID = dt.Rows[m]["AdmID"].ToString();
  1181. string billID = dt.Rows[m]["billID"].ToString();
  1182. string recordID = dt.Rows[m]["recordID"].ToString();
  1183. Global.pat.adm_Dr = int.Parse(AdmID);
  1184. Global.pat.billID = billID;
  1185. Global.pat.recordID = recordID;
  1186. if (BillType == "1")
  1187. {
  1188. MessageBox.Show("请选择退费负记录!该记录为正交易记录");
  1189. }
  1190. sqlStr = "SELECT * FROM BS_MedInsuTransactionLog WHERE MSGID='" + msgid + "'";
  1191. JObject joSqlstr = new JObject();
  1192. joSqlstr.Add("sqlStr", sqlStr);
  1193. JObject joRtn = mIS.QueryTransactionLog(joSqlstr);
  1194. if (joRtn["result"]["data"].ToString() == "[]")
  1195. {
  1196. MessageBox.Show("查询结果为空!");
  1197. return;
  1198. }
  1199. //DataTable dtlog = (DataTable)joRtn["result"]["data"][0].ToObject(typeof(DataTable));
  1200. JObject Outlog = JObject.Parse(joRtn["result"]["data"][0]["OutparamPlain"].ToString());
  1201. dynamic setlinfo = new JObject();//结算信息节点
  1202. setlinfo.setl_id = Outlog["output"]["setlinfo"]["setl_id"];//结算ID
  1203. setlinfo.init_setl_id = "";//原结算ID
  1204. setlinfo.setl_time = Outlog["output"]["setlinfo"]["setl_time"];//结算退费时间
  1205. setlinfo.mdtrt_id = Outlog["output"]["setlinfo"]["mdtrt_id"];//就诊ID
  1206. setlinfo.psn_no = Outlog["output"]["setlinfo"]["psn_no"];//人员编号
  1207. setlinfo.exp_content = "";
  1208. string mdtrt_id = Outlog["output"]["setlinfo"]["mdtrt_id"].ToString();
  1209. sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE billType = 1 ";
  1210. sqlStr = sqlStr + " AND Hospital_Dr=" + Global.inf.hospitalDr + " AND Interface_Dr=" + Global.inf.interfaceDr;
  1211. sqlStr = sqlStr + " AND MdtrtID ='" + mdtrt_id + "'";
  1212. JObject joSql = new JObject();
  1213. joSql.Add("sqlStr", sqlStr);
  1214. JObject joSettlInfo = mIS.QuerySettlementInfo(joSql);
  1215. //查询结算信息
  1216. JObject Outpam = JObject.Parse(joSettlInfo["result"]["data"][0].ToString());
  1217. setlinfo.init_setl_id = Outpam["SettlementID"];//ADMID
  1218. setlinfo.psn_no = Outpam["PersonnelNO"];
  1219. JObject joParam992002 = new JObject();
  1220. joParam992002.Add("data", setlinfo);//结算信息节点
  1221. JObject OutJo = invoker.invokeCenterServiceJXC("992002", JObject.Parse(JsonHelper.setCenterInpar("992002", joParam992002)));
  1222. MessageBox.Show("上传成功+"+ OutJo.ToString());
  1223. }
  1224. catch (Exception ex)
  1225. {
  1226. MessageBox.Show(ex.Message);
  1227. return;
  1228. }
  1229. }
  1230. private void FYMXToolStripMenuItem_Click(object sender, EventArgs e)
  1231. {
  1232. if (dgvSettlRecord.RowCount <= 0)
  1233. {
  1234. MessageBox.Show("请先查询结算数据!");
  1235. return;
  1236. }
  1237. string sqlStr;
  1238. try
  1239. {
  1240. int m = dgvSettlRecord.CurrentRow.Index;
  1241. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  1242. string msgid = dt.Rows[m]["msgid"].ToString();
  1243. string SettlementID = dt.Rows[m]["SettlementID"].ToString();
  1244. string ValidFlag = dt.Rows[m]["ValidFlag"].ToString();
  1245. string MdtrtID = dt.Rows[m]["MdtrtID"].ToString();
  1246. string BillType = dt.Rows[m]["BillType"].ToString();
  1247. string AdmID = dt.Rows[m]["AdmID"].ToString();
  1248. string billID = dt.Rows[m]["billID"].ToString();
  1249. string recordID = dt.Rows[m]["recordID"].ToString();
  1250. Global.pat.adm_Dr = int.Parse(AdmID);
  1251. Global.pat.billID = billID;
  1252. Global.pat.recordID = recordID;
  1253. //if (BillType == "-1")
  1254. //{
  1255. // MessageBox.Show("请选择结算正记录!该记录为退费记录");
  1256. //}
  1257. sqlStr = "SELECT * FROM BS_MedInsuTransactionLog WHERE MSGID='" + msgid + "'";
  1258. JObject joSqlstr = new JObject();
  1259. joSqlstr.Add("sqlStr", sqlStr);
  1260. JObject joRtn = mIS.QueryTransactionLog(joSqlstr);
  1261. if (joRtn["result"]["data"].ToString() == "[]")
  1262. {
  1263. MessageBox.Show("查询结果为空!");
  1264. return;
  1265. }
  1266. //DataTable dtlog = (DataTable)joRtn["result"]["data"][0].ToObject(typeof(DataTable));
  1267. JObject Outlog = JObject.Parse(joRtn["result"]["data"][0]["OutparamPlain"].ToString());
  1268. dynamic setlinfo = new JObject();//结算信息节点
  1269. setlinfo.setl_id = Outlog["output"]["setlinfo"]["setl_id"];//结算ID
  1270. //setlinfo.mdtrt_id = Outlog["output"]["setlinfo"]["mdtrt_id"];//就诊ID
  1271. //setlinfo.psn_no = Outlog["output"]["setlinfo"]["psn_no"];//人员编号
  1272. //setlinfo.psn_name = Outlog["output"]["setlinfo"]["psn_name"];//人员姓名
  1273. //setlinfo.psn_cert_type = Outlog["output"]["setlinfo"]["psn_cert_type"];//凭证类型
  1274. //setlinfo.certno = Outlog["output"]["setlinfo"]["certno"];//证件号码
  1275. //setlinfo.gend = Outlog["output"]["setlinfo"]["gend"];//性别
  1276. //setlinfo.naty = Outlog["output"]["setlinfo"]["naty"];//民族
  1277. //setlinfo.brdy = Outlog["output"]["setlinfo"]["brdy"];//出生日期
  1278. //setlinfo.age = Outlog["output"]["setlinfo"]["age"];//年龄
  1279. //setlinfo.insutype = Outlog["output"]["setlinfo"]["insutype"];//险种类型
  1280. //setlinfo.psn_type = Outlog["output"]["setlinfo"]["psn_type"];//人员类别
  1281. //setlinfo.cvlserv_flag = Outlog["output"]["setlinfo"]["cvlserv_flag"];//公务员标志
  1282. setlinfo.setl_time = Outlog["output"]["setlinfo"]["setl_time"];//结算时间
  1283. //setlinfo.mdtrt_cert_type = Outlog["output"]["setlinfo"]["mdtrt_cert_type"];//就诊凭证类型
  1284. //setlinfo.med_type = Outlog["output"]["setlinfo"]["med_type"];//医疗类别
  1285. //setlinfo.medfee_sumamt = Outlog["output"]["setlinfo"]["medfee_sumamt"];//医疗费总额
  1286. //setlinfo.fulamt_ownpay_amt = Outlog["output"]["setlinfo"]["fulamt_ownpay_amt"];//全自费金额
  1287. //setlinfo.overlmt_selfpay = Outlog["output"]["setlinfo"]["overlmt_selfpay"];//超限价自费费用
  1288. //setlinfo.preselfpay_amt = Outlog["output"]["setlinfo"]["preselfpay_amt"];//先行自付金额
  1289. //setlinfo.inscp_scp_amt = Outlog["output"]["setlinfo"]["inscp_scp_amt"];//符合政策范围金额
  1290. //setlinfo.act_pay_dedc = Outlog["output"]["setlinfo"]["act_pay_dedc"];//实际支付起付线
  1291. //setlinfo.hifp_pay = Outlog["output"]["setlinfo"]["hifp_pay"];//基本医疗保险统筹基金支出
  1292. //setlinfo.pool_prop_selfpay = Outlog["output"]["setlinfo"]["pool_prop_selfpay"];//基本医疗保险统筹基金支付比例
  1293. //setlinfo.cvlserv_pay = Outlog["output"]["setlinfo"]["cvlserv_pay"];//公务员医疗补助资金支出
  1294. //setlinfo.hifes_pay = Outlog["output"]["setlinfo"]["hifes_pay"];//企业补充医疗保险基金支出
  1295. //setlinfo.hifmi_pay = Outlog["output"]["setlinfo"]["hifmi_pay"];//居民大病保险资金支出
  1296. //setlinfo.hifob_pay = Outlog["output"]["setlinfo"]["hifob_pay"];//职工大额医疗费用补助基金支出
  1297. //setlinfo.maf_pay = Outlog["output"]["setlinfo"]["maf_pay"];//医疗救助基金支出
  1298. //setlinfo.oth_pay = Outlog["output"]["setlinfo"]["oth_pay"];//结算ID
  1299. //setlinfo.fund_pay_sumamt = Outlog["output"]["setlinfo"]["fund_pay_sumamt"];//基金支付总额
  1300. //setlinfo.psn_part_amt = Outlog["output"]["setlinfo"]["psn_part_amt"];//个人负担总金额
  1301. //setlinfo.acct_pay = Outlog["output"]["setlinfo"]["acct_pay"];//个人账户支出
  1302. //setlinfo.psn_cash_pay = Outlog["output"]["setlinfo"]["psn_cash_pay"];//个人现金支出
  1303. //setlinfo.balc = Outlog["output"]["setlinfo"]["balc"];//余额
  1304. //setlinfo.acct_mulaid_pay = Outlog["output"]["setlinfo"]["acct_mulaid_pay"];//个人账户共济支付金额
  1305. //setlinfo.medins_setl_id = Outlog["output"]["setlinfo"]["medins_setl_id"];//医药机构结算结算ID
  1306. //setlinfo.clr_optins = Outlog["output"]["setlinfo"]["clr_optins"];//clr_optins
  1307. //setlinfo.clr_way = Outlog["output"]["setlinfo"]["clr_way"];//clr_way
  1308. //setlinfo.clr_type = Outlog["output"]["setlinfo"]["clr_type"];//clr_type
  1309. //// setlinfo.exp_content = Outlog["output"]["setlinfo"]["exp_content"];//exp_content
  1310. //setlinfo.exp_content = "";//exp_content
  1311. //setlinfo.hosp_part_amt = Outlog["output"]["setlinfo"]["hosp_part_amt"];//医院负担金额
  1312. //setlinfo.hifdm_pay = 0;//伤残人员医疗保障基金支出
  1313. string outParam = "";
  1314. //获取IS费用
  1315. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  1316. {
  1317. MessageBox.Show("获取HIS费用失败");
  1318. }
  1319. //调用医保平台转换HIS费用(转换医保编码等)
  1320. JObject joHisFee = JObject.Parse(outParam);
  1321. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  1322. {
  1323. MessageBox.Show("获取HIS费用医保对照关系失败");
  1324. }
  1325. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  1326. JArray jaFeeDetail1 = new JArray();
  1327. ; JObject jaFeeOne = new JObject();
  1328. for (int k = 0; k < jaFeeDetail.Count; k++)
  1329. { if (!(jaFeeDetail[k]["med_list_codg"].ToString().Substring(0, 1) == "X" || jaFeeDetail[k]["med_list_codg"].ToString().Substring(0, 1) == "Z")) continue;
  1330. jaFeeOne.Add("feedetl_sn", jaFeeDetail[k]["feedetl_sn"]);//费用明细流水号
  1331. jaFeeOne.Add("rxno", "");//处方号
  1332. if (string.IsNullOrEmpty(jaFeeDetail[k]["rx_circ_flag"].ToString()))
  1333. {
  1334. jaFeeOne.Add("rx_circ_flag", "0");//外购处方标志
  1335. }
  1336. else
  1337. {
  1338. jaFeeOne.Add("rx_circ_flag", jaFeeDetail[k]["rx_circ_flag"].ToString());//外购处方标志
  1339. }
  1340. if (BillType == "-1")
  1341. {
  1342. jaFeeOne.Add("fee_ocur_time", setlinfo.setl_time);
  1343. }
  1344. else{
  1345. jaFeeOne.Add("fee_ocur_time", jaFeeDetail[k]["fee_ocur_time"]);
  1346. }
  1347. jaFeeOne.Add("med_list_codg", jaFeeDetail[k]["med_list_codg"]);
  1348. jaFeeOne.Add("medins_list_codg", jaFeeDetail[k]["medins_list_codg"]);
  1349. jaFeeOne.Add("medins_list_name", jaFeeDetail[k]["medins_list_desc"]);
  1350. jaFeeOne.Add("prodname", jaFeeDetail[k]["medins_list_desc"]);
  1351. if (string.IsNullOrEmpty(jaFeeDetail[k]["spec"].ToString()))
  1352. {
  1353. jaFeeOne.Add("spec", "");
  1354. }
  1355. else
  1356. {
  1357. jaFeeOne.Add("spec", jaFeeDetail[k]["spec"]);
  1358. }
  1359. if (string.IsNullOrEmpty(jaFeeDetail[k]["doseForm"].ToString()))
  1360. {
  1361. jaFeeOne.Add("dosform_name", "");
  1362. }
  1363. else
  1364. {
  1365. jaFeeOne.Add("dosform_name", jaFeeDetail[k]["doseForm"]);
  1366. }
  1367. jaFeeOne.Add("det_item_fee_sumamt", decimal.Parse(jaFeeDetail[k]["det_item_fee_sumamt"].ToString()));
  1368. jaFeeOne.Add("cnt", decimal.Parse(jaFeeDetail[k]["cnt"].ToString()));
  1369. jaFeeOne.Add("pric", decimal.Parse(jaFeeDetail[k]["pric"].ToString()));
  1370. if (string.IsNullOrEmpty(jaFeeDetail[k]["sin_dos_dscr"].ToString()))
  1371. {
  1372. jaFeeOne.Add("sin_dos_dscr", "");
  1373. }
  1374. else
  1375. {
  1376. jaFeeOne.Add("sin_dos_dscr", jaFeeDetail[k]["sin_dos_dscr"]);
  1377. }
  1378. if (string.IsNullOrEmpty(jaFeeDetail[k]["used_frqu_dscr"].ToString()))
  1379. {
  1380. jaFeeOne.Add("used_frqu_dscr", "");
  1381. }
  1382. else
  1383. {
  1384. jaFeeOne.Add("used_frqu_dscr", jaFeeDetail[k]["used_frqu_dscr"]);
  1385. }
  1386. if (string.IsNullOrEmpty(jaFeeDetail[k]["prd_days"].ToString()))
  1387. {
  1388. jaFeeOne.Add("prd_days", 1);
  1389. }
  1390. else
  1391. {
  1392. jaFeeOne.Add("prd_days", decimal.Parse(jaFeeDetail[k]["prd_days"].ToString()));
  1393. }
  1394. if (string.IsNullOrEmpty(jaFeeDetail[k]["medc_way_dscr"].ToString()))
  1395. {
  1396. jaFeeOne.Add("medc_way_dscr", "");
  1397. }
  1398. else
  1399. {
  1400. jaFeeOne.Add("medc_way_dscr", jaFeeDetail[k]["medc_way_dscr"]);
  1401. }
  1402. if (string.IsNullOrEmpty(jaFeeDetail[k]["bilg_dr_codg"].ToString()))
  1403. {
  1404. jaFeeOne.Add("bilg_dr_codg", "");
  1405. }
  1406. else
  1407. {
  1408. jaFeeOne.Add("bilg_dr_codg", jaFeeDetail[k]["bilg_dr_codg"]);
  1409. }
  1410. if (string.IsNullOrEmpty(jaFeeDetail[k]["bilg_dr_name"].ToString()))
  1411. {
  1412. jaFeeOne.Add("bilg_dr_name", "");
  1413. }
  1414. else
  1415. {
  1416. jaFeeOne.Add("bilg_dr_name", jaFeeDetail[k]["bilg_dr_name"]);
  1417. }
  1418. jaFeeOne.Add("phar_name", "");
  1419. jaFeeOne.Add("phar_prac_cert_no", "");
  1420. jaFeeOne.Add("tcmdrug_used_way", "1"); //中药使用方式 1复方 2单方 必填
  1421. jaFeeOne.Add("trdn_flag", joHisFee["result"][k]["outApartFlag"].ToString());//拆零标志 必填 0否 1是
  1422. jaFeeDetail1.Add(jaFeeOne);
  1423. jaFeeOne = new JObject();
  1424. }
  1425. JObject Jo992004 = new JObject();
  1426. // JObject Jo992001 = new JObject();
  1427. //Jo992001.Add("setlinfo",JObject.Parse(setlinfo));//结算信息节点
  1428. Jo992004.Add("setlinfo", setlinfo);
  1429. Jo992004.Add("drugdetail", jaFeeDetail1);//结算信息节点
  1430. //Jo992001.Add("drugdetail", jaFeeDetail);//购药明细节点
  1431. MessageBox.Show("上传开始:" + Jo992004.ToString());
  1432. JObject OutJo = invoker.invokeCenterServiceJXC("9920004", JObject.Parse(JsonHelper.setCenterInpar("992004", Jo992004)));
  1433. MessageBox.Show("上传返回:" + OutJo.ToString());
  1434. }
  1435. catch (Exception ex)
  1436. {
  1437. MessageBox.Show(ex.Message);
  1438. return;
  1439. }
  1440. }
  1441. private void cityDesignToolStripMenuItem_Click(object sender, EventArgs e)
  1442. {
  1443. //try
  1444. //{
  1445. // Thread thread = new Thread(new ThreadStart(design));
  1446. // thread.SetApartmentState(ApartmentState.STA); //重点
  1447. // thread.Start();
  1448. // thread.Join();
  1449. //}
  1450. //catch (Exception ex)
  1451. //{
  1452. // Global.writeLog("结算单设计预览异常:" + ex.Message);
  1453. // MessageBox.Show("设计预览异常:" + ex.Message);
  1454. //}
  1455. if (dgvSettlRecord.RowCount <= 0)
  1456. {
  1457. MessageBox.Show("请先查询结算数据!");
  1458. return;
  1459. }
  1460. try
  1461. {
  1462. int i = dgvSettlRecord.CurrentRow.Index;
  1463. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  1464. Global.pat.admType = int.Parse(dgvSettlRecord.Rows[i].Cells["admType"].Value.ToString());
  1465. string AdmID = dt.Rows[i]["AdmID"].ToString();
  1466. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  1467. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  1468. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  1469. string BillType = dt.Rows[i]["BillType"].ToString();
  1470. JObject pJoInparm= new JObject();
  1471. pJoInparm.Add("MdtrtCertType", dt.Rows[i]["MdtrtCertType"].ToString());
  1472. JObject joRtn = cityGetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag, BillType, pJoInparm);
  1473. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  1474. {
  1475. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  1476. return;
  1477. }
  1478. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  1479. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  1480. {
  1481. MessageBox.Show("调用FastReport设计失败!" + errMsg);
  1482. return;
  1483. }
  1484. }
  1485. catch (Exception ex)
  1486. {
  1487. MessageBox.Show(ex.Message);
  1488. return;
  1489. }
  1490. }
  1491. private void cityToolStripMenuItem_Click(object sender, EventArgs e)
  1492. {
  1493. string errorMsg;
  1494. int iHis = dgvSettlRecord.CurrentRow.Index;
  1495. String BType = dgvSettlRecord.Rows[iHis].Cells["BillType"].Value.ToString();
  1496. Global.pat.admType = int.Parse(dgvSettlRecord.Rows[iHis].Cells["admType"].Value.ToString());
  1497. JObject joData = new JObject();
  1498. joData.Add("mdtrt_id", dgvSettlRecord.Rows[iHis].Cells["MdtrtID"].Value.ToString());
  1499. joData.Add("setl_id", dgvSettlRecord.Rows[iHis].Cells["SettlementID"].Value.ToString());
  1500. joData.Add("psn_no", dgvSettlRecord.Rows[iHis].Cells["PersonnelNO"].Value.ToString());
  1501. joData.Add("med_type", dgvSettlRecord.Rows[iHis].Cells["MedicalType"].Value.ToString());
  1502. JObject joInput = new JObject();
  1503. joInput.Add("data", joData);
  1504. Global.pat.insuplc_admdvs = dgvSettlRecord.Rows[iHis].Cells["insuplc_admdvs"].Value.ToString();//更新参保地
  1505. #region【调用FastRepor打印】
  1506. try
  1507. {
  1508. //Thread thread = new Thread(new ThreadStart(print));
  1509. //thread.SetApartmentState(ApartmentState.STA); //重点
  1510. //thread.Start();
  1511. //thread.Join();
  1512. cityPrint();
  1513. }
  1514. catch (Exception ex)
  1515. {
  1516. Global.writeLog("结算单打印异常:" + ex.Message);
  1517. MessageBox.Show("打印异常:" + ex.Message);
  1518. }
  1519. #endregion
  1520. }
  1521. }
  1522. // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
  1523. public class Classification
  1524. {
  1525. public string cwfSummat { get; set; }
  1526. public string cwfInScope { get; set; }
  1527. public string cwfPreSelfPay { get; set; }
  1528. public string cwfOverLimit { get; set; }
  1529. public string cwfFullOwnPay { get; set; }
  1530. public string zcfSummat { get; set; }
  1531. public string zcfInScope { get; set; }
  1532. public string zcfPreSelfPay { get; set; }
  1533. public string zcfOverLimit { get; set; }
  1534. public string zcfFullOwnPay { get; set; }
  1535. public string jcfSummat { get; set; }
  1536. public string jcfInScope { get; set; }
  1537. public string jcfPreSelfPay { get; set; }
  1538. public string jcfOverLimit { get; set; }
  1539. public string jcfFullOwnPay { get; set; }
  1540. public string hyfSummat { get; set; }
  1541. public string hyfInScope { get; set; }
  1542. public string hyfPreSelfPay { get; set; }
  1543. public string hyfOverLimit { get; set; }
  1544. public string hyfFullOwnPay { get; set; }
  1545. public string zlfSummat { get; set; }
  1546. public string zlfInScope { get; set; }
  1547. public string zlfPreSelfPay { get; set; }
  1548. public string zlfOverLimit { get; set; }
  1549. public string zlfFullOwnPay { get; set; }
  1550. public string ssfSummat { get; set; }
  1551. public string ssfInScope { get; set; }
  1552. public string ssfPreSelfPay { get; set; }
  1553. public string ssfOverLimit { get; set; }
  1554. public string ssfFullOwnPay { get; set; }
  1555. public string hlfSummat { get; set; }
  1556. public string hlfInScope { get; set; }
  1557. public string hlfPreSelfPay { get; set; }
  1558. public string hlfOverLimit { get; set; }
  1559. public string hlfFullOwnPay { get; set; }
  1560. public string wsclfSummat { get; set; }
  1561. public string wsclfInScope { get; set; }
  1562. public string wsclfPreSelfPay { get; set; }
  1563. public string wsclfOverLimit { get; set; }
  1564. public string wsclfFullOwnPay { get; set; }
  1565. public string xyfSummat { get; set; }
  1566. public string xyfInScope { get; set; }
  1567. public string xyfPreSelfPay { get; set; }
  1568. public string xyfOverLimit { get; set; }
  1569. public string xyfFullOwnPay { get; set; }
  1570. public string zyypfSummat { get; set; }
  1571. public string zyypfInScope { get; set; }
  1572. public string zyypfPreSelfPay { get; set; }
  1573. public string zyypfOverLimit { get; set; }
  1574. public string zyypfFullOwnPay { get; set; }
  1575. public string zcyfSummat { get; set; }
  1576. public string zcyfInScope { get; set; }
  1577. public string zcyfPreSelfPay { get; set; }
  1578. public string zcyfOverLimit { get; set; }
  1579. public string zcyfFullOwnPay { get; set; }
  1580. public string ybzlfSummat { get; set; }
  1581. public string ybzlfInScope { get; set; }
  1582. public string ybzlfPreSelfPay { get; set; }
  1583. public string ybzlfOverLimit { get; set; }
  1584. public string ybzlfFullOwnPay { get; set; }
  1585. public string ghfSummat { get; set; }
  1586. public string ghfInScope { get; set; }
  1587. public string ghfPreSelfPay { get; set; }
  1588. public string ghfOverLimit { get; set; }
  1589. public string ghfFullOwnPay { get; set; }
  1590. public string qtSummat { get; set; }
  1591. public string qtInScope { get; set; }
  1592. public string qtPreSelfPay { get; set; }
  1593. public string qtOverLimit { get; set; }
  1594. public string qtFullOwnPay { get; set; }
  1595. public string totalSummat { get; set; }
  1596. public string totalInScope { get; set; }
  1597. public string totalPreSelfPay { get; set; }
  1598. public string totalOverLimit { get; set; }
  1599. public string totalFullOwnPay { get; set; }
  1600. }
  1601. public class Data
  1602. {
  1603. public List<Classification> classification { get; set; }
  1604. public List<Settlement> settlement { get; set; }
  1605. public List<Reginfo> reginfo { get; set; }
  1606. public List<Patinsuinfo> patinsuinfo { get; set; }
  1607. }
  1608. public class Patinsuinfo
  1609. {
  1610. public string PsnCertType { get; set; }
  1611. public string PsnCertNO { get; set; }
  1612. public string Gend { get; set; }
  1613. public string Naty { get; set; }
  1614. public string Brdy { get; set; }
  1615. public string Age { get; set; }
  1616. public string Balc { get; set; }
  1617. public string PsnType { get; set; }
  1618. public string Cvlservflag { get; set; }
  1619. public string insuplcAdmdvs { get; set; }
  1620. public string EmpName { get; set; }
  1621. public string PsnIdettype { get; set; }
  1622. public string PsnTypeLv { get; set; }
  1623. }
  1624. public class Reginfo
  1625. {
  1626. public string AttendDoctorNO { get; set; }
  1627. public string ChiefPhyDocName { get; set; }
  1628. public string AdmitDepartmentCode { get; set; }
  1629. public string AdmitDepartmentName { get; set; }
  1630. public string AdmBed { get; set; }
  1631. public string MainDiagCode { get; set; }
  1632. public string MainDiagName { get; set; }
  1633. public string RegDate { get; set; }
  1634. public string ConerName { get; set; }
  1635. public string Tel { get; set; }
  1636. }
  1637. public class Result
  1638. {
  1639. public Data data { get; set; }
  1640. }
  1641. public class Root
  1642. {
  1643. public Result result { get; set; }
  1644. public int errorCode { get; set; }
  1645. public string errorMessage { get; set; }
  1646. }
  1647. public class Settlement
  1648. {
  1649. public string AdmID { get; set; }
  1650. public string MdtrtID { get; set; }
  1651. public string SettlementID { get; set; }
  1652. public string PersonnelNO { get; set; }
  1653. public string PatientName { get; set; }
  1654. public string birth { get; set; }
  1655. public string CertificateNO { get; set; }
  1656. public string Gender { get; set; }
  1657. public string InsuranceType { get; set; }
  1658. public string PersonType { get; set; }
  1659. public string CivilserviceFlag { get; set; }
  1660. public string SettlementTime { get; set; }
  1661. public string MedicalType { get; set; }
  1662. public string Sumamt { get; set; }
  1663. public string OwnPayAmount { get; set; }
  1664. public string OverLimitAmount { get; set; }
  1665. public string PreSelfPayAmount { get; set; }
  1666. public string InPolicyRangeAmount { get; set; }
  1667. public double ActualPayDeductible { get; set; }
  1668. public string HealthInsurancePay { get; set; }
  1669. public string HealthInsuranceRatio { get; set; }
  1670. public double CivilserviceAllowancePay { get; set; }
  1671. public string EnterpriseSupplementPay { get; set; }
  1672. public string SeriousIllnessPay { get; set; }
  1673. public string LargeExpensesSupplementPay { get; set; }
  1674. public string MedicalAssistPay { get; set; }
  1675. public string HospitalPartAmount { get; set; }
  1676. public string OtherPay { get; set; }
  1677. public string FundPaySumamt { get; set; }
  1678. public string PersonPaySumamt { get; set; }
  1679. public string AccountPaySumamt { get; set; }
  1680. public string PersonCashPay { get; set; }
  1681. public string Balance { get; set; }
  1682. public string AccountMutualAidAmount { get; set; }
  1683. public string OrganSettlementID { get; set; }
  1684. public string ClearingOrgan { get; set; }
  1685. public string ClearingWay { get; set; }
  1686. public string ClearingType { get; set; }
  1687. public string ValidFlag { get; set; }
  1688. public string msgid { get; set; }
  1689. public string HospitalizationsTimes { get; set; }
  1690. public string HospitalizationsDays { get; set; }
  1691. public string HISAdmTime { get; set; }
  1692. public string HISDischargeTime { get; set; }
  1693. public int BillType { get; set; }
  1694. public string BillID { get; set; }
  1695. public string admType { get; set; }
  1696. public string RecordID { get; set; }
  1697. public string insuplc_admdvs { get; set; }
  1698. }
  1699. }