SettlementChecklist.cs 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  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. JArray jaDiags= JArray.Parse(JsonHelper.getDestValue(joRtnDiag, "diseinfo"));
  436. string ryzd = "";
  437. string cyzd = "";
  438. for (int i = 0; i < jaDiags.Count; i++)
  439. {
  440. if (jaDiags[i]["diaTypeCode"].ToString() == "ADD"|| jaDiags[i]["maindiag_flag"].ToString() == "1") //ADD 入院 OPD 门诊
  441. {
  442. ryzd = jaDiags[i]["diag_name"].ToString();
  443. }
  444. if (jaDiags[i]["diaTypeCode"].ToString() == "DIS" || jaDiags[i]["maindiag_flag"].ToString() == "1") //ADD 入院 OPD 门诊
  445. {
  446. cyzd = jaDiags[i]["diag_name"].ToString();
  447. }
  448. }
  449. #endregion
  450. #region【数据转换】
  451. if (joRtnSettle["result"]["data"]["settlement"][0]["Gender"].ToString() == "1")
  452. {
  453. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "男";
  454. }
  455. else
  456. {
  457. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "女";
  458. }
  459. DateTime startDate = (DateTime)joRtnSettle["result"]["data"]["reginfo"][0]["RegDate"];
  460. DateTime endDate = (DateTime)joRtnSettle["result"]["data"]["settlement"][0]["SettlementTime"];
  461. Global.writeLog("startDate:" + startDate.ToString());
  462. Global.writeLog("endDate:" + endDate.ToString());
  463. //int diffInDays = (int)(endDate - startDate).TotalDays;
  464. int diffInDays = (endDate.Date - startDate.Date).Days;
  465. if (diffInDays == 0)
  466. {
  467. diffInDays = 1;
  468. }
  469. joRtnSettle["result"]["data"]["settlement"][0]["HospitalizationsDays"] = diffInDays;
  470. string str = joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"].ToString();
  471. if (str.Contains("."))
  472. {
  473. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str.Split('.')[0] + "岁";
  474. }
  475. else
  476. {
  477. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str + "岁";
  478. }
  479. #endregion
  480. #region【组织FastReport调用入参】
  481. JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
  482. JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
  483. JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
  484. JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
  485. JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
  486. //转换金额大写
  487. string Sumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt").ToString());
  488. string HealthInsurancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay").ToString());
  489. string ActualPayDeductible = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible").ToString());
  490. string PersonCashPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay").ToString());
  491. string AccountPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt").ToString());
  492. string FundPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt").ToString());
  493. string LargeExpensesSupplementPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay").ToString());
  494. string SeriousIllnessPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay").ToString());
  495. string CivilserviceAllowancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay").ToString());
  496. string MedicalAssistPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay").ToString());
  497. string OtherPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay").ToString());
  498. string HospitalPartAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount").ToString());
  499. string AccountMutualAidAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount").ToString());
  500. string InPolicyRangeAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].InPolicyRangeAmount").ToString());
  501. //string BeginDate = JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo[0].RegDate").ToString();
  502. //string EndDate = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HISDischargeTime").ToString();
  503. //string InHosDays = FastReportFunction.DateDiff(Convert.ToDateTime(BeginDate), Convert.ToDateTime(EndDate));
  504. JObject jaAmountChiness = new JObject();
  505. jaAmountChiness.Add("Sumamt", Sumamt);
  506. jaAmountChiness.Add("HealthInsurancePay", HealthInsurancePay);
  507. jaAmountChiness.Add("ActualPayDeductible", ActualPayDeductible);
  508. jaAmountChiness.Add("PersonCashPay", PersonCashPay);
  509. jaAmountChiness.Add("AccountPaySumamt", AccountPaySumamt);
  510. jaAmountChiness.Add("FundPaySumamt", FundPaySumamt);
  511. jaAmountChiness.Add("LargeExpensesSupplementPay", LargeExpensesSupplementPay);
  512. jaAmountChiness.Add("SeriousIllnessPay", SeriousIllnessPay);
  513. jaAmountChiness.Add("CivilserviceAllowancePay", CivilserviceAllowancePay);
  514. jaAmountChiness.Add("MedicalAssistPay", MedicalAssistPay);
  515. jaAmountChiness.Add("OtherPay", OtherPay);
  516. jaAmountChiness.Add("HospitalPartAmount", HospitalPartAmount);
  517. jaAmountChiness.Add("AccountMutualAidAmount", AccountMutualAidAmount);
  518. jaAmountChiness.Add("InPolicyRangeAmount", InPolicyRangeAmount); //合规费用
  519. jaAmountChiness.Add("SettlOpter", Global.user.name);
  520. jaAmountChiness.Add("medrcdno", medrcdno);
  521. jaAmountChiness.Add("ryzd", ryzd);
  522. jaAmountChiness.Add("cyzd", cyzd);
  523. JArray jachinessParams = new JArray();
  524. jachinessParams.Add(jaAmountChiness);
  525. JObject joDataResult = new JObject();
  526. joDataResult.Add("SettlementInfo", jaSettlement);
  527. joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
  528. joDataResult.Add("ClassificationInfo", jaClassification);
  529. joDataResult.Add("RegInfo", jaReginfo);
  530. joDataResult.Add("Patinsuinfo", japatinsuinfo);
  531. joDataResult.Add("ChinessSummat", jachinessParams);
  532. JObject joParams = new JObject();
  533. joParams.Add("fastReportCode", "SP11"); //这个要从表取值
  534. joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
  535. joParams.Add("printCode", Global.inf.interfaceDr.ToString());
  536. joParams.Add("templateID", "");
  537. JArray jaParams = new JArray();
  538. jaParams.Add(joParams);
  539. JObject joReportParams = new JObject();
  540. joReportParams.Add("params", jaParams);
  541. joReportParams.Add("code", "01040306");
  542. JObject joParam = new JObject();
  543. joParam.Add("designFlag", designFlag);
  544. joParam.Add("logFlag", "N");
  545. joParam.Add("dataParams", "");
  546. joParam.Add("pdfName", "");
  547. joParam.Add("reportparams", joReportParams);
  548. joParam.Add("dataResult", joDataResult);
  549. JObject joDataURL = new JObject();
  550. joDataURL.Add("dataIP", Global.hisConfig.ip);
  551. joDataURL.Add("urlAddress", Global.hisConfig.url);
  552. joDataURL.Add("authorization", Global.hisConfig.authorization);
  553. joParam.Add("dataURL", joDataURL);
  554. JArray jaParam = new JArray();
  555. jaParam.Add(joParam);
  556. JObject joInparam = new JObject();
  557. joInparam.Add("params", JArray.FromObject(jaParam));
  558. joInparam.Add("session", Global.curEvt.jaSession);
  559. #endregion
  560. JObject joRtn = new JObject();
  561. joRtn.Add("errorCode", 0);
  562. joRtn.Add("errorMessage", "");
  563. joRtn.Add("result", joInparam.ToString());
  564. return joRtn;
  565. }
  566. catch (Exception ex)
  567. {
  568. JObject joRtnEx = new JObject();
  569. joRtnEx.Add("errorCode", -1);
  570. joRtnEx.Add("errorMessage", ex.Message);
  571. joRtnEx.Add("result", "");
  572. return joRtnEx;
  573. }
  574. }
  575. private void btnDesign_Click(object sender, EventArgs e)
  576. {
  577. /*
  578. thread_test = new Thread(new ThreadStart(design));
  579. thread_test.SetApartmentState(ApartmentState.STA); //重点
  580. thread_test.Start();*/
  581. if (dgvSettlRecord.RowCount <= 0)
  582. {
  583. MessageBox.Show("请先查询结算数据!");
  584. return;
  585. }
  586. try
  587. {
  588. int i = dgvSettlRecord.CurrentRow.Index;
  589. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  590. string AdmID = dt.Rows[i]["AdmID"].ToString();
  591. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  592. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  593. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  594. JObject joRtn = GetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag);
  595. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  596. {
  597. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  598. return;
  599. }
  600. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  601. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  602. {
  603. MessageBox.Show("调用FastReport设计失败!" + errMsg);
  604. return;
  605. }
  606. }
  607. catch (Exception ex)
  608. {
  609. MessageBox.Show(ex.Message);
  610. return;
  611. }
  612. }
  613. private void SettlementChecklist_FormClosed(object sender, FormClosedEventArgs e)
  614. {
  615. Dispose();
  616. }
  617. }
  618. // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
  619. public class Classification
  620. {
  621. public string cwfSummat { get; set; }
  622. public string cwfInScope { get; set; }
  623. public string cwfPreSelfPay { get; set; }
  624. public string cwfOverLimit { get; set; }
  625. public string cwfFullOwnPay { get; set; }
  626. public string zcfSummat { get; set; }
  627. public string zcfInScope { get; set; }
  628. public string zcfPreSelfPay { get; set; }
  629. public string zcfOverLimit { get; set; }
  630. public string zcfFullOwnPay { get; set; }
  631. public string jcfSummat { get; set; }
  632. public string jcfInScope { get; set; }
  633. public string jcfPreSelfPay { get; set; }
  634. public string jcfOverLimit { get; set; }
  635. public string jcfFullOwnPay { get; set; }
  636. public string hyfSummat { get; set; }
  637. public string hyfInScope { get; set; }
  638. public string hyfPreSelfPay { get; set; }
  639. public string hyfOverLimit { get; set; }
  640. public string hyfFullOwnPay { get; set; }
  641. public string zlfSummat { get; set; }
  642. public string zlfInScope { get; set; }
  643. public string zlfPreSelfPay { get; set; }
  644. public string zlfOverLimit { get; set; }
  645. public string zlfFullOwnPay { get; set; }
  646. public string ssfSummat { get; set; }
  647. public string ssfInScope { get; set; }
  648. public string ssfPreSelfPay { get; set; }
  649. public string ssfOverLimit { get; set; }
  650. public string ssfFullOwnPay { get; set; }
  651. public string hlfSummat { get; set; }
  652. public string hlfInScope { get; set; }
  653. public string hlfPreSelfPay { get; set; }
  654. public string hlfOverLimit { get; set; }
  655. public string hlfFullOwnPay { get; set; }
  656. public string wsclfSummat { get; set; }
  657. public string wsclfInScope { get; set; }
  658. public string wsclfPreSelfPay { get; set; }
  659. public string wsclfOverLimit { get; set; }
  660. public string wsclfFullOwnPay { get; set; }
  661. public string xyfSummat { get; set; }
  662. public string xyfInScope { get; set; }
  663. public string xyfPreSelfPay { get; set; }
  664. public string xyfOverLimit { get; set; }
  665. public string xyfFullOwnPay { get; set; }
  666. public string zyypfSummat { get; set; }
  667. public string zyypfInScope { get; set; }
  668. public string zyypfPreSelfPay { get; set; }
  669. public string zyypfOverLimit { get; set; }
  670. public string zyypfFullOwnPay { get; set; }
  671. public string zcyfSummat { get; set; }
  672. public string zcyfInScope { get; set; }
  673. public string zcyfPreSelfPay { get; set; }
  674. public string zcyfOverLimit { get; set; }
  675. public string zcyfFullOwnPay { get; set; }
  676. public string ybzlfSummat { get; set; }
  677. public string ybzlfInScope { get; set; }
  678. public string ybzlfPreSelfPay { get; set; }
  679. public string ybzlfOverLimit { get; set; }
  680. public string ybzlfFullOwnPay { get; set; }
  681. public string ghfSummat { get; set; }
  682. public string ghfInScope { get; set; }
  683. public string ghfPreSelfPay { get; set; }
  684. public string ghfOverLimit { get; set; }
  685. public string ghfFullOwnPay { get; set; }
  686. public string qtSummat { get; set; }
  687. public string qtInScope { get; set; }
  688. public string qtPreSelfPay { get; set; }
  689. public string qtOverLimit { get; set; }
  690. public string qtFullOwnPay { get; set; }
  691. public string totalSummat { get; set; }
  692. public string totalInScope { get; set; }
  693. public string totalPreSelfPay { get; set; }
  694. public string totalOverLimit { get; set; }
  695. public string totalFullOwnPay { get; set; }
  696. }
  697. public class Data
  698. {
  699. public List<Classification> classification { get; set; }
  700. public List<Settlement> settlement { get; set; }
  701. public List<Reginfo> reginfo { get; set; }
  702. public List<Patinsuinfo> patinsuinfo { get; set; }
  703. }
  704. public class Patinsuinfo
  705. {
  706. public string PsnCertType { get; set; }
  707. public string PsnCertNO { get; set; }
  708. public string Gend { get; set; }
  709. public string Naty { get; set; }
  710. public string Brdy { get; set; }
  711. public string Age { get; set; }
  712. public string Balc { get; set; }
  713. public string PsnType { get; set; }
  714. public string Cvlservflag { get; set; }
  715. public string insuplcAdmdvs { get; set; }
  716. public string EmpName { get; set; }
  717. public string PsnIdettype { get; set; }
  718. public string PsnTypeLv { get; set; }
  719. }
  720. public class Reginfo
  721. {
  722. public string AttendDoctorNO { get; set; }
  723. public string ChiefPhyDocName { get; set; }
  724. public string AdmitDepartmentCode { get; set; }
  725. public string AdmitDepartmentName { get; set; }
  726. public string AdmBed { get; set; }
  727. public string MainDiagCode { get; set; }
  728. public string MainDiagName { get; set; }
  729. public string RegDate { get; set; }
  730. public string ConerName { get; set; }
  731. public string Tel { get; set; }
  732. }
  733. public class Result
  734. {
  735. public Data data { get; set; }
  736. }
  737. public class Root
  738. {
  739. public Result result { get; set; }
  740. public int errorCode { get; set; }
  741. public string errorMessage { get; set; }
  742. }
  743. public class Settlement
  744. {
  745. public string AdmID { get; set; }
  746. public string MdtrtID { get; set; }
  747. public string SettlementID { get; set; }
  748. public string PersonnelNO { get; set; }
  749. public string PatientName { get; set; }
  750. public string birth { get; set; }
  751. public string CertificateNO { get; set; }
  752. public string Gender { get; set; }
  753. public string InsuranceType { get; set; }
  754. public string PersonType { get; set; }
  755. public string CivilserviceFlag { get; set; }
  756. public string SettlementTime { get; set; }
  757. public string MedicalType { get; set; }
  758. public string Sumamt { get; set; }
  759. public string OwnPayAmount { get; set; }
  760. public string OverLimitAmount { get; set; }
  761. public string PreSelfPayAmount { get; set; }
  762. public string InPolicyRangeAmount { get; set; }
  763. public double ActualPayDeductible { get; set; }
  764. public string HealthInsurancePay { get; set; }
  765. public string HealthInsuranceRatio { get; set; }
  766. public double CivilserviceAllowancePay { get; set; }
  767. public string EnterpriseSupplementPay { get; set; }
  768. public string SeriousIllnessPay { get; set; }
  769. public string LargeExpensesSupplementPay { get; set; }
  770. public string MedicalAssistPay { get; set; }
  771. public string HospitalPartAmount { get; set; }
  772. public string OtherPay { get; set; }
  773. public string FundPaySumamt { get; set; }
  774. public string PersonPaySumamt { get; set; }
  775. public string AccountPaySumamt { get; set; }
  776. public string PersonCashPay { get; set; }
  777. public string Balance { get; set; }
  778. public string AccountMutualAidAmount { get; set; }
  779. public string OrganSettlementID { get; set; }
  780. public string ClearingOrgan { get; set; }
  781. public string ClearingWay { get; set; }
  782. public string ClearingType { get; set; }
  783. public string ValidFlag { get; set; }
  784. public string msgid { get; set; }
  785. public string HospitalizationsTimes { get; set; }
  786. public string HospitalizationsDays { get; set; }
  787. public string HISAdmTime { get; set; }
  788. public string HISDischargeTime { get; set; }
  789. public int BillType { get; set; }
  790. public string BillID { get; set; }
  791. public string admType { get; set; }
  792. public string RecordID { get; set; }
  793. public string insuplc_admdvs { get; set; }
  794. }
  795. }