SettlementChecklist.cs 33 KB

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