SettlementChecklist.cs 37 KB

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