SettlementChecklist.cs 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  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 PTMedicalInsurance.Business;
  19. using System.Reflection;
  20. using System.Runtime.InteropServices;
  21. using FastReportFrom;
  22. using System.IO;
  23. namespace PTMedicalInsurance.Forms
  24. {
  25. public partial class SettlementChecklist : Form
  26. {
  27. private int hospitalDr;
  28. private int interfaceDr;
  29. private string hospitalNO;
  30. private string interfaceNO;
  31. private string hospitalName;
  32. private string hospitalAreaCode;
  33. private bool disposed = false;
  34. Thread thread_test;
  35. private InvokeHelper invoker = new InvokeHelper();
  36. public SettlementChecklist()
  37. {
  38. InitializeComponent();
  39. hospitalDr = Global.inf.hospitalDr;
  40. hospitalNO = Global.inf.hospitalNO;
  41. hospitalName = Global.inf.hospitalName;
  42. hospitalAreaCode = Global.inf.areaCode;
  43. interfaceDr = Global.inf.interfaceDr;
  44. }
  45. public SettlementChecklist(JObject joParam)
  46. {
  47. InitializeComponent();
  48. hospitalDr = Global.inf.hospitalDr;
  49. hospitalNO = Global.inf.hospitalNO;
  50. hospitalName = Global.inf.hospitalName;
  51. hospitalAreaCode = Global.inf.areaCode;
  52. if (joParam == null) return;
  53. string setl_id = JsonHelper.getDestValue(joParam, "setl_id");
  54. if (setl_id == "")
  55. {
  56. MessageBox.Show("根据传入的结算编号为查询到相关信息,请手动输入查询!");
  57. return;
  58. }
  59. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;
  60. sqlStr = sqlStr + " and SettlementID='" + setl_id + "'";
  61. JObject joSqlStr = new JObject();
  62. joSqlStr.Add("sqlStr", sqlStr);
  63. MIIrisServices mIS = new MIIrisServices();
  64. JObject joRtn = mIS.QuerySettlementInfo(joSqlStr);
  65. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  66. dgvSettlRecord.DataSource = dt;
  67. }
  68. public void Dispose()
  69. {
  70. Dispose1(true);
  71. GC.SuppressFinalize(this);
  72. }
  73. protected virtual void Dispose1(bool disposing)
  74. {
  75. if (thread_test == null) return;
  76. if (disposed == false)
  77. {
  78. if (disposing == true)
  79. {
  80. Thread.Sleep(100);
  81. Global.writeLog("Main - aborting my thread.");
  82. thread_test.Abort();//终止线程myThread
  83. thread_test.Join();//等待线程myThread结束
  84. Global.writeLog("Main - ending.");
  85. }
  86. //释放托管资源的代码
  87. }
  88. disposed = true;
  89. }
  90. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  91. {
  92. }
  93. private void btnQuery_Click(object sender, EventArgs e)
  94. {
  95. }
  96. private void btnQuery_Click_1(object sender, EventArgs e)
  97. {
  98. string sqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + hospitalDr;
  99. sqlStr = sqlStr + " and OccurTime>'" + dpST.Text + "'";
  100. sqlStr = sqlStr + " and OccurTime<'" + dpED.Text + "'";
  101. if (tbName.Text != "")
  102. {
  103. sqlStr = sqlStr + " and PatientName='" + tbName.Text + "'";
  104. }
  105. if (tbPatSettlID.Text != "")
  106. {
  107. sqlStr = sqlStr + " and SettlementID='" + tbPatSettlID.Text + "'";
  108. }
  109. if (tbHisNO.Text != "")
  110. {
  111. sqlStr = sqlStr + " and Adm_Dr='" + tbHisNO.Text + "'";
  112. }
  113. if (cbxInterface.Text != "")
  114. {
  115. sqlStr = sqlStr + " and Interface_Dr=" + Global.inf.interfaceDr + "";
  116. }
  117. if (rbgAdmType.SelectedIndex == 1)
  118. {
  119. sqlStr = sqlStr + " and AdmType=2";
  120. }
  121. if (rbgAdmType.SelectedIndex == 2)
  122. {
  123. sqlStr = sqlStr + " and AdmType=1";
  124. }
  125. if (rbgBillType.SelectedIndex == 1)
  126. {
  127. sqlStr = sqlStr + " and BillType=1 and ValidFlag=1 ";
  128. }
  129. if (rbgBillType.SelectedIndex == 2)
  130. {
  131. sqlStr = sqlStr + " and BillType=-1 and ValidFlag=0 ";
  132. }
  133. JObject joSqlStr = new JObject();
  134. joSqlStr.Add("sqlStr", sqlStr);
  135. MIIrisServices mIS = new MIIrisServices();
  136. JObject joRtn = mIS.QuerySettlementInfo(joSqlStr);
  137. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  138. dgvSettlRecord.DataSource = dt;
  139. }
  140. private void SettlementChecklist_Load(object sender, EventArgs e)
  141. {
  142. dpST.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  143. dpED.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  144. ComboxSetter cbxSetter = new ComboxSetter();
  145. cbxSetter.setCbxInterfaceDataSource(cbxInterface);
  146. GridViewSetter grdSetter = new GridViewSetter();
  147. grdSetter.SetHeaderTextOfSettlList(dgvSettlRecord);
  148. rbgAdmType.SelectedIndex = 0;
  149. rbgBillType.SelectedIndex = 1;
  150. cbxInterface.SelectedValueChanged += new EventHandler(cbxInterface_SelectedValueChanged);
  151. }
  152. private void cbxInterface_SelectedValueChanged(object sender, EventArgs e)
  153. {
  154. DataTable dt = (DataTable)cbxInterface.DataSource;
  155. int i = cbxInterface.SelectedIndex;
  156. //赋值
  157. hospitalNO = dt.Rows[i]["HospitalNO"].ToString();
  158. //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString());
  159. //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
  160. hospitalDr = int.Parse(dt.Rows[i]["HospitalDr"].ToString());
  161. interfaceNO = dt.Rows[i]["InterfaceNO"].ToString();
  162. interfaceDr = int.Parse(dt.Rows[i]["ID"].ToString());
  163. hospitalAreaCode = dt.Rows[i]["AreaCode"].ToString();
  164. //Global.inf.centerURL = dt.Rows[i]["CenterURL"].ToString();
  165. //Global.inf.businessDllName = dt.Rows[i]["DLLName"].ToString();
  166. //Global.inf.patientAreaCode = dt.Rows[i]["AreaCode"].ToString();
  167. }
  168. private JObject getPatCheckList()
  169. {
  170. try
  171. {
  172. int i = dgvSettlRecord.CurrentRow.Index;
  173. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  174. JObject joSettel = new JObject();
  175. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  176. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  177. joSettel.Add("admID", dt.Rows[i]["AdmID"].ToString());
  178. joSettel.Add("SettlementID", dt.Rows[i]["SettlementID"].ToString());
  179. joSettel.Add("ValidFlag", dt.Rows[i]["ValidFlag"].ToString());
  180. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  181. return joRtn;
  182. }
  183. catch (Exception ex)
  184. {
  185. JObject joRtn = new JObject();
  186. joRtn.Add("errorCode", -1);
  187. joRtn.Add("errorMessage", ex.Message);
  188. return joRtn;
  189. }
  190. }
  191. private void uiPanel1_Click(object sender, EventArgs e)
  192. {
  193. }
  194. [STAThread]
  195. public void design()
  196. {
  197. try
  198. {
  199. string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
  200. // FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
  201. // FastReport.Utils.RegisteredObjects.AddFunctionCategory("FastReport.FastReportFunction.moneyToChinese", "moneyToChinese");
  202. //获取要注册的方法信息
  203. MethodInfo methodInfo = typeof(FastReport.FastReportFunction).GetMethod("moneyToChinese");
  204. // 注册函数目录为 FastReport MyFunction目录下
  205. // FastReport.Utils.RegisteredObjects.AddFunction(methodInfo, "MyFunction");
  206. JObject joSettleCheckList = getPatCheckList();
  207. string errMsg;
  208. if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
  209. {
  210. MessageBox.Show("查询结算信息异常:" + errMsg);
  211. return;
  212. }
  213. Report report = new Report();
  214. try
  215. {
  216. var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  217. report.RegisterData(json.result.data.classification, "classification");
  218. report.RegisterData(json.result.data.settlement, "settlement");
  219. report.RegisterData(json.result.data.reginfo, "reginfo");
  220. report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  221. }
  222. catch (Exception ex)
  223. {
  224. MessageBox.Show(ex.Message);
  225. return;
  226. }
  227. report.Load(Global.curEvt.path + "\\frx\\合肥瑶海普瑞医院.frx");
  228. PrintDesign pf = new PrintDesign();
  229. pf.designerControl1.Report = report;
  230. report.Design();
  231. pf.WindowState = FormWindowState.Maximized;
  232. pf.ShowDialog();
  233. }
  234. catch (Exception ex)
  235. {
  236. MessageBox.Show(ex.Message);
  237. }
  238. }
  239. [STAThread]
  240. private void print()
  241. {
  242. /*
  243. string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
  244. // FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
  245. JObject joSettleCheckList = getPatCheckList();
  246. string errMsg;
  247. if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
  248. {
  249. MessageBox.Show("查询结算信息异常:" + errMsg);
  250. return;
  251. }
  252. Report report = new Report();
  253. try
  254. {
  255. var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  256. report.RegisterData(json.result.data.classification, "classification");
  257. report.RegisterData(json.result.data.settlement, "settlement");
  258. report.RegisterData(json.result.data.reginfo, "reginfo");
  259. report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  260. }
  261. catch (Exception ex)
  262. {
  263. MessageBox.Show(ex.Message);
  264. return;
  265. }
  266. //report.Design();
  267. report.Load(Global.curEvt.path + "\\frx\\合肥瑶海普瑞医院.frx");
  268. this.ShowInTaskbar = true;
  269. PrintPreview pf = new PrintPreview();
  270. report.Preview = pf.previewControl1;
  271. report.Show();
  272. pf.WindowState = FormWindowState.Maximized;
  273. pf.ShowDialog();*/
  274. try
  275. {
  276. int i = dgvSettlRecord.CurrentRow.Index;
  277. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  278. string AdmID = dt.Rows[i]["AdmID"].ToString();
  279. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  280. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  281. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  282. JObject joRtn = GetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag);
  283. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  284. {
  285. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  286. return;
  287. }
  288. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  289. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  290. {
  291. MessageBox.Show("调用FastReport打印失败!" + errMsg);
  292. return;
  293. }
  294. }
  295. catch (Exception ex)
  296. {
  297. MessageBox.Show(ex.Message);
  298. return;
  299. }
  300. }
  301. [STAThread]
  302. private void preview()
  303. {
  304. //JObject joCheckList = getPatCheckList();
  305. Report report = new Report();
  306. try
  307. {
  308. var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  309. report.RegisterData(json.result.data.classification, "classification");
  310. report.RegisterData(json.result.data.settlement, "settlement");
  311. report.RegisterData(json.result.data.reginfo, "reginfo");
  312. report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  313. }
  314. catch (Exception ex)
  315. {
  316. MessageBox.Show(ex.Message);
  317. return;
  318. }
  319. //report.Design();
  320. report.Load(Global.curEvt.path + "\\frx\\合肥瑶海普瑞医院.frx");
  321. //report.Show();
  322. PrintPreview preview1 = new PrintPreview();
  323. preview1.Show();
  324. report.Preview = preview1.previewControl1;
  325. report.Prepare(); //准备
  326. report.ShowPrepared(); //显示
  327. preview1.Show();
  328. }
  329. private void uiButton2_Click(object sender, EventArgs e)
  330. {
  331. Close();
  332. }
  333. public void btnPrint_Click(object sender, EventArgs e)
  334. {
  335. try
  336. {
  337. //Thread thread_print = new Thread(new ThreadStart(print));
  338. //thread_print.SetApartmentState(ApartmentState.STA); //重点
  339. //thread_print.Start();
  340. //thread_print.Join();
  341. print();
  342. }
  343. catch (Exception ex)
  344. {
  345. Global.writeLog("结算单打印异常:" + ex.Message);
  346. MessageBox.Show("打印异常:" + ex.Message);
  347. }
  348. if (dgvSettlRecord.RowCount <= 0)
  349. {
  350. MessageBox.Show("请先查询结算数据!");
  351. return;
  352. }
  353. /*
  354. try
  355. {
  356. int i = dgvSettlRecord.CurrentRow.Index;
  357. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  358. string AdmID = dt.Rows[i]["AdmID"].ToString();
  359. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  360. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  361. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  362. JObject joRtn = GetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag);
  363. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  364. {
  365. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  366. return;
  367. }
  368. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  369. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  370. {
  371. MessageBox.Show("调用FastReport打印失败!" + errMsg);
  372. return;
  373. }
  374. }
  375. catch (Exception ex)
  376. {
  377. MessageBox.Show(ex.Message);
  378. return;
  379. }*/
  380. }
  381. public int FastReportPrint(string InParams, out string OutMsg)
  382. {
  383. Global.writeLog("调用FastReport入参:" + InParams);
  384. try
  385. {
  386. #region【调用正版FastReport打印】
  387. FastReportFrom.FastReportDll FrDll = new FastReportFrom.FastReportDll();
  388. string sRtnFr = FrDll.FastReport(InParams);
  389. JObject joRetObj = JObject.Parse(sRtnFr);
  390. if (JsonHelper.parseIrisRtnValue(joRetObj, out string errMsg) != 0)
  391. {
  392. OutMsg = "调用FastReport打印失败!" + errMsg;
  393. return -1;
  394. }
  395. else
  396. {
  397. OutMsg = "";
  398. return 0;
  399. }
  400. #endregion
  401. }
  402. catch (Exception ex)
  403. {
  404. OutMsg = "调用FastReport打印失败!" + ex.Message;
  405. return -1;
  406. }
  407. }
  408. public JObject GetFastReportParams(string designFlag, string admID, string MdtrtID, string settlementID, string validFlag)
  409. {
  410. try
  411. {
  412. if (designFlag == "") { designFlag = "N"; }
  413. #region【获取HIS医保结算信息】
  414. JObject joSettel = new JObject();
  415. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  416. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  417. joSettel.Add("admID", admID);
  418. joSettel.Add("SettlementID", settlementID);
  419. joSettel.Add("ValidFlag", validFlag);
  420. joSettel.Add("MdtrtID", MdtrtID);
  421. JObject joRtnSettle = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  422. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out string errMsg) != 0)
  423. {
  424. JObject joRtnSet = new JObject();
  425. joRtnSet.Add("errorCode", -1);
  426. joRtnSet.Add("errorMessage", errMsg);
  427. joRtnSet.Add("result", "");
  428. return joRtnSet;
  429. }
  430. #endregion
  431. #region【获取住院号】
  432. JObject joTmp = new JObject();
  433. joTmp.Add("admID", joRtnSettle["result"]["data"]["settlement"][0]["AdmID"]);
  434. joTmp.Add("psn_no", joRtnSettle["result"]["data"]["settlement"][0]["PersonnelNO"]);
  435. //JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110001", joTmp).ToString(), "获取诊断信息");
  436. JObject joRtnDiag = invoker.invokeHISService(JsonHelper.setIrisInpar("05110014", joTmp).ToString(), "获取诊断信息");
  437. string medrcdno = "";
  438. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out errMsg) == 0)
  439. {
  440. medrcdno= joRtnDiag["mdtrtinfo"]["medrcdno"].ToString();
  441. }
  442. #endregion
  443. #region【数据转换】
  444. if (joRtnSettle["result"]["data"]["settlement"][0]["Gender"].ToString() == "1")
  445. {
  446. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "男";
  447. }
  448. else
  449. {
  450. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "女";
  451. }
  452. DateTime startDate = (DateTime)joRtnSettle["result"]["data"]["reginfo"][0]["RegDate"];
  453. DateTime endDate = (DateTime)joRtnSettle["result"]["data"]["settlement"][0]["SettlementTime"];
  454. int diffInDays = (int)(endDate - startDate).TotalDays;
  455. if (diffInDays == 0)
  456. {
  457. diffInDays = 1;
  458. }
  459. joRtnSettle["result"]["data"]["settlement"][0]["HospitalizationsDays"] = diffInDays;
  460. string str = joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"].ToString();
  461. if (str.Contains("."))
  462. {
  463. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str.Split('.')[0] + "岁";
  464. }
  465. else
  466. {
  467. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str + "岁";
  468. }
  469. #endregion
  470. #region【组织FastReport调用入参】
  471. JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
  472. JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
  473. JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
  474. JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
  475. JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
  476. //转换金额大写
  477. string Sumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt").ToString());
  478. string HealthInsurancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay").ToString());
  479. string ActualPayDeductible = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible").ToString());
  480. string PersonCashPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay").ToString());
  481. string AccountPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt").ToString());
  482. string FundPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt").ToString());
  483. string LargeExpensesSupplementPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay").ToString());
  484. string SeriousIllnessPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay").ToString());
  485. string CivilserviceAllowancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay").ToString());
  486. string MedicalAssistPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay").ToString());
  487. string OtherPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay").ToString());
  488. string HospitalPartAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount").ToString());
  489. string AccountMutualAidAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount").ToString());
  490. string InPolicyRangeAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].InPolicyRangeAmount").ToString());
  491. //string BeginDate = JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo[0].RegDate").ToString();
  492. //string EndDate = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HISDischargeTime").ToString();
  493. //string InHosDays = FastReportFunction.DateDiff(Convert.ToDateTime(BeginDate), Convert.ToDateTime(EndDate));
  494. JObject jaAmountChiness = new JObject();
  495. jaAmountChiness.Add("Sumamt", Sumamt);
  496. jaAmountChiness.Add("HealthInsurancePay", HealthInsurancePay);
  497. jaAmountChiness.Add("ActualPayDeductible", ActualPayDeductible);
  498. jaAmountChiness.Add("PersonCashPay", PersonCashPay);
  499. jaAmountChiness.Add("AccountPaySumamt", AccountPaySumamt);
  500. jaAmountChiness.Add("FundPaySumamt", FundPaySumamt);
  501. jaAmountChiness.Add("LargeExpensesSupplementPay", LargeExpensesSupplementPay);
  502. jaAmountChiness.Add("SeriousIllnessPay", SeriousIllnessPay);
  503. jaAmountChiness.Add("CivilserviceAllowancePay", CivilserviceAllowancePay);
  504. jaAmountChiness.Add("MedicalAssistPay", MedicalAssistPay);
  505. jaAmountChiness.Add("OtherPay", OtherPay);
  506. jaAmountChiness.Add("HospitalPartAmount", HospitalPartAmount);
  507. jaAmountChiness.Add("AccountMutualAidAmount", AccountMutualAidAmount);
  508. jaAmountChiness.Add("InPolicyRangeAmount", InPolicyRangeAmount); //合规费用
  509. jaAmountChiness.Add("SettlOpter", Global.user.name);
  510. jaAmountChiness.Add("medrcdno", medrcdno);
  511. JArray jachinessParams = new JArray();
  512. jachinessParams.Add(jaAmountChiness);
  513. JObject joDataResult = new JObject();
  514. joDataResult.Add("SettlementInfo", jaSettlement);
  515. joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
  516. joDataResult.Add("ClassificationInfo", jaClassification);
  517. joDataResult.Add("RegInfo", jaReginfo);
  518. joDataResult.Add("Patinsuinfo", japatinsuinfo);
  519. joDataResult.Add("ChinessSummat", jachinessParams);
  520. JObject joParams = new JObject();
  521. joParams.Add("fastReportCode", "SP11"); //这个要从表取值
  522. joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
  523. joParams.Add("printCode", Global.inf.interfaceDr.ToString());
  524. joParams.Add("templateID", "");
  525. JArray jaParams = new JArray();
  526. jaParams.Add(joParams);
  527. JObject joReportParams = new JObject();
  528. joReportParams.Add("params", jaParams);
  529. joReportParams.Add("code", "01040306");
  530. JObject joParam = new JObject();
  531. joParam.Add("designFlag", designFlag);
  532. joParam.Add("logFlag", "N");
  533. joParam.Add("dataParams", "");
  534. joParam.Add("pdfName", "");
  535. joParam.Add("reportparams", joReportParams);
  536. joParam.Add("dataResult", joDataResult);
  537. JObject joDataURL = new JObject();
  538. joDataURL.Add("dataIP", Global.hisConfig.ip);
  539. joDataURL.Add("urlAddress", Global.hisConfig.url);
  540. joDataURL.Add("authorization", Global.hisConfig.authorization);
  541. joParam.Add("dataURL", joDataURL);
  542. JArray jaParam = new JArray();
  543. jaParam.Add(joParam);
  544. JObject joInparam = new JObject();
  545. joInparam.Add("params", JArray.FromObject(jaParam));
  546. joInparam.Add("session", Global.curEvt.jaSession);
  547. #endregion
  548. JObject joRtn = new JObject();
  549. joRtn.Add("errorCode", 0);
  550. joRtn.Add("errorMessage", "");
  551. joRtn.Add("result", joInparam.ToString());
  552. return joRtn;
  553. }
  554. catch (Exception ex)
  555. {
  556. JObject joRtnEx = new JObject();
  557. joRtnEx.Add("errorCode", -1);
  558. joRtnEx.Add("errorMessage", ex.Message);
  559. joRtnEx.Add("result", "");
  560. return joRtnEx;
  561. }
  562. }
  563. private void btnDesign_Click(object sender, EventArgs e)
  564. {
  565. /*
  566. thread_test = new Thread(new ThreadStart(design));
  567. thread_test.SetApartmentState(ApartmentState.STA); //重点
  568. thread_test.Start();*/
  569. if (dgvSettlRecord.RowCount <= 0)
  570. {
  571. MessageBox.Show("请先查询结算数据!");
  572. return;
  573. }
  574. try
  575. {
  576. int i = dgvSettlRecord.CurrentRow.Index;
  577. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  578. string AdmID = dt.Rows[i]["AdmID"].ToString();
  579. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  580. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  581. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  582. JObject joRtn = GetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag);
  583. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  584. {
  585. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  586. return;
  587. }
  588. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  589. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  590. {
  591. MessageBox.Show("调用FastReport设计失败!" + errMsg);
  592. return;
  593. }
  594. }
  595. catch (Exception ex)
  596. {
  597. MessageBox.Show(ex.Message);
  598. return;
  599. }
  600. }
  601. private void SettlementChecklist_FormClosed(object sender, FormClosedEventArgs e)
  602. {
  603. Dispose();
  604. }
  605. }
  606. // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
  607. public class Classification
  608. {
  609. public string cwfSummat { get; set; }
  610. public string cwfInScope { get; set; }
  611. public string cwfPreSelfPay { get; set; }
  612. public string cwfOverLimit { get; set; }
  613. public string cwfFullOwnPay { get; set; }
  614. public string zcfSummat { get; set; }
  615. public string zcfInScope { get; set; }
  616. public string zcfPreSelfPay { get; set; }
  617. public string zcfOverLimit { get; set; }
  618. public string zcfFullOwnPay { get; set; }
  619. public string jcfSummat { get; set; }
  620. public string jcfInScope { get; set; }
  621. public string jcfPreSelfPay { get; set; }
  622. public string jcfOverLimit { get; set; }
  623. public string jcfFullOwnPay { get; set; }
  624. public string hyfSummat { get; set; }
  625. public string hyfInScope { get; set; }
  626. public string hyfPreSelfPay { get; set; }
  627. public string hyfOverLimit { get; set; }
  628. public string hyfFullOwnPay { get; set; }
  629. public string zlfSummat { get; set; }
  630. public string zlfInScope { get; set; }
  631. public string zlfPreSelfPay { get; set; }
  632. public string zlfOverLimit { get; set; }
  633. public string zlfFullOwnPay { get; set; }
  634. public string ssfSummat { get; set; }
  635. public string ssfInScope { get; set; }
  636. public string ssfPreSelfPay { get; set; }
  637. public string ssfOverLimit { get; set; }
  638. public string ssfFullOwnPay { get; set; }
  639. public string hlfSummat { get; set; }
  640. public string hlfInScope { get; set; }
  641. public string hlfPreSelfPay { get; set; }
  642. public string hlfOverLimit { get; set; }
  643. public string hlfFullOwnPay { get; set; }
  644. public string wsclfSummat { get; set; }
  645. public string wsclfInScope { get; set; }
  646. public string wsclfPreSelfPay { get; set; }
  647. public string wsclfOverLimit { get; set; }
  648. public string wsclfFullOwnPay { get; set; }
  649. public string xyfSummat { get; set; }
  650. public string xyfInScope { get; set; }
  651. public string xyfPreSelfPay { get; set; }
  652. public string xyfOverLimit { get; set; }
  653. public string xyfFullOwnPay { get; set; }
  654. public string zyypfSummat { get; set; }
  655. public string zyypfInScope { get; set; }
  656. public string zyypfPreSelfPay { get; set; }
  657. public string zyypfOverLimit { get; set; }
  658. public string zyypfFullOwnPay { get; set; }
  659. public string zcyfSummat { get; set; }
  660. public string zcyfInScope { get; set; }
  661. public string zcyfPreSelfPay { get; set; }
  662. public string zcyfOverLimit { get; set; }
  663. public string zcyfFullOwnPay { get; set; }
  664. public string ybzlfSummat { get; set; }
  665. public string ybzlfInScope { get; set; }
  666. public string ybzlfPreSelfPay { get; set; }
  667. public string ybzlfOverLimit { get; set; }
  668. public string ybzlfFullOwnPay { get; set; }
  669. public string ghfSummat { get; set; }
  670. public string ghfInScope { get; set; }
  671. public string ghfPreSelfPay { get; set; }
  672. public string ghfOverLimit { get; set; }
  673. public string ghfFullOwnPay { get; set; }
  674. public string qtSummat { get; set; }
  675. public string qtInScope { get; set; }
  676. public string qtPreSelfPay { get; set; }
  677. public string qtOverLimit { get; set; }
  678. public string qtFullOwnPay { get; set; }
  679. public string totalSummat { get; set; }
  680. public string totalInScope { get; set; }
  681. public string totalPreSelfPay { get; set; }
  682. public string totalOverLimit { get; set; }
  683. public string totalFullOwnPay { get; set; }
  684. }
  685. public class Data
  686. {
  687. public List<Classification> classification { get; set; }
  688. public List<Settlement> settlement { get; set; }
  689. public List<Reginfo> reginfo { get; set; }
  690. public List<Patinsuinfo> patinsuinfo { get; set; }
  691. }
  692. public class Patinsuinfo
  693. {
  694. public string PsnCertType { get; set; }
  695. public string PsnCertNO { get; set; }
  696. public string Gend { get; set; }
  697. public string Naty { get; set; }
  698. public string Brdy { get; set; }
  699. public string Age { get; set; }
  700. public string Balc { get; set; }
  701. public string PsnType { get; set; }
  702. public string Cvlservflag { get; set; }
  703. public string insuplcAdmdvs { get; set; }
  704. public string EmpName { get; set; }
  705. public string PsnIdettype { get; set; }
  706. public string PsnTypeLv { get; set; }
  707. }
  708. public class Reginfo
  709. {
  710. public string AttendDoctorNO { get; set; }
  711. public string ChiefPhyDocName { get; set; }
  712. public string AdmitDepartmentCode { get; set; }
  713. public string AdmitDepartmentName { get; set; }
  714. public string AdmBed { get; set; }
  715. public string MainDiagCode { get; set; }
  716. public string MainDiagName { get; set; }
  717. public string RegDate { get; set; }
  718. public string ConerName { get; set; }
  719. public string Tel { get; set; }
  720. }
  721. public class Result
  722. {
  723. public Data data { get; set; }
  724. }
  725. public class Root
  726. {
  727. public Result result { get; set; }
  728. public int errorCode { get; set; }
  729. public string errorMessage { get; set; }
  730. }
  731. public class Settlement
  732. {
  733. public string AdmID { get; set; }
  734. public string MdtrtID { get; set; }
  735. public string SettlementID { get; set; }
  736. public string PersonnelNO { get; set; }
  737. public string PatientName { get; set; }
  738. public string birth { get; set; }
  739. public string CertificateNO { get; set; }
  740. public string Gender { get; set; }
  741. public string InsuranceType { get; set; }
  742. public string PersonType { get; set; }
  743. public string CivilserviceFlag { get; set; }
  744. public string SettlementTime { get; set; }
  745. public string MedicalType { get; set; }
  746. public string Sumamt { get; set; }
  747. public string OwnPayAmount { get; set; }
  748. public string OverLimitAmount { get; set; }
  749. public string PreSelfPayAmount { get; set; }
  750. public string InPolicyRangeAmount { get; set; }
  751. public double ActualPayDeductible { get; set; }
  752. public string HealthInsurancePay { get; set; }
  753. public string HealthInsuranceRatio { get; set; }
  754. public double CivilserviceAllowancePay { get; set; }
  755. public string EnterpriseSupplementPay { get; set; }
  756. public string SeriousIllnessPay { get; set; }
  757. public string LargeExpensesSupplementPay { get; set; }
  758. public string MedicalAssistPay { get; set; }
  759. public string HospitalPartAmount { get; set; }
  760. public string OtherPay { get; set; }
  761. public string FundPaySumamt { get; set; }
  762. public string PersonPaySumamt { get; set; }
  763. public string AccountPaySumamt { get; set; }
  764. public string PersonCashPay { get; set; }
  765. public string Balance { get; set; }
  766. public string AccountMutualAidAmount { get; set; }
  767. public string OrganSettlementID { get; set; }
  768. public string ClearingOrgan { get; set; }
  769. public string ClearingWay { get; set; }
  770. public string ClearingType { get; set; }
  771. public string ValidFlag { get; set; }
  772. public string msgid { get; set; }
  773. public string HospitalizationsTimes { get; set; }
  774. public string HospitalizationsDays { get; set; }
  775. public string HISAdmTime { get; set; }
  776. public string HISDischargeTime { get; set; }
  777. public int BillType { get; set; }
  778. public string BillID { get; set; }
  779. public string admType { get; set; }
  780. public string RecordID { get; set; }
  781. public string insuplc_admdvs { get; set; }
  782. }
  783. }