SettlementChecklist.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  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. ///
  336. public void btnPrint_Click(object sender, EventArgs e)
  337. {
  338. try
  339. {
  340. //Thread thread = new Thread(new ThreadStart(print));
  341. //Thread thread = new Thread(new ThreadStart(printReportCloud));
  342. //thread.SetApartmentState(ApartmentState.STA); //重点
  343. //thread.Start();
  344. //thread.Join();
  345. printReportCloud();
  346. }
  347. catch (Exception ex)
  348. {
  349. Global.writeLog("结算单打印异常:" + ex.Message);
  350. MessageBox.Show("打印异常:" + ex.Message);
  351. }
  352. //printReport();
  353. }
  354. /// <summary>
  355. /// 调用正版FastReport打印
  356. /// </summary>
  357. private void printReportCloud()
  358. {
  359. if (dgvSettlRecord.RowCount <= 0)
  360. {
  361. MessageBox.Show("请先查询结算数据!");
  362. return;
  363. }
  364. try
  365. {
  366. int i = dgvSettlRecord.CurrentRow.Index;
  367. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  368. string AdmID = dt.Rows[i]["AdmID"].ToString();
  369. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  370. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  371. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  372. JObject joRtn = GetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag);
  373. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  374. {
  375. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  376. return;
  377. }
  378. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  379. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  380. {
  381. MessageBox.Show("调用FastReport打印失败!" + errMsg);
  382. return;
  383. }
  384. }
  385. catch (Exception ex)
  386. {
  387. MessageBox.Show(ex.Message);
  388. return;
  389. }
  390. }
  391. private JArray GetDataSourceBySqlstr(string sqlStr,string desc)
  392. {
  393. JObject joRtn = mIS.DynamicQuery(sqlStr,desc);
  394. return JArray.Parse(JsonHelper.getDestValue(joRtn, "result.data"));
  395. }
  396. /// <summary>
  397. /// 组织正版FastReport需要的参数
  398. /// </summary>
  399. /// <param name="designFlag"></param>
  400. /// <param name="admID"></param>
  401. /// <param name="MdtrtID"></param>
  402. /// <param name="settlementID"></param>
  403. /// <param name="validFlag"></param>
  404. /// <returns></returns>
  405. public JObject GetFastReportParams(string designFlag, string admID, string MdtrtID, string settlementID, string validFlag)
  406. {
  407. try
  408. {
  409. if (designFlag == "") { designFlag = "N"; }
  410. #region【获取HIS医保结算信息】
  411. JObject joSettel = new JObject();
  412. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  413. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  414. joSettel.Add("admID", admID);
  415. joSettel.Add("SettlementID", settlementID);
  416. joSettel.Add("ValidFlag", validFlag);
  417. joSettel.Add("MdtrtID", MdtrtID);
  418. Global.pat.adm_Dr = int.Parse(admID);
  419. JObject joRtnSettle = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  420. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out string errMsg) != 0)
  421. {
  422. JObject joRtnSet = new JObject();
  423. joRtnSet.Add("errorCode", -1);
  424. joRtnSet.Add("errorMessage", errMsg);
  425. joRtnSet.Add("result", "");
  426. return joRtnSet;
  427. }
  428. JArray jaHisBaseInfo;
  429. jaHisBaseInfo = new JArray();
  430. hIS.GetHisPatBaseInfo(out errMsg);
  431. jaHisBaseInfo.Add(JObject.Parse(errMsg)["result"]);
  432. #endregion
  433. string sqlStr = "";
  434. JArray jaSettlementDetail;
  435. sqlStr = $"SELECT * FROM SQLUser.BS_MedInsuSettlementDetail WHERE SettlementID ='{settlementID}'";
  436. jaSettlementDetail = GetDataSourceBySqlstr(sqlStr,"查询结算明细");
  437. #region【组织FastReport调用入参】
  438. JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
  439. JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
  440. JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
  441. JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
  442. JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
  443. JObject joDataResult = new JObject();
  444. joDataResult.Add("SettlementInfo", jaSettlement);
  445. joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
  446. joDataResult.Add("ClassificationInfo", jaClassification);
  447. joDataResult.Add("RegInfo", jaReginfo);
  448. joDataResult.Add(" ", japatinsuinfo);
  449. joDataResult.Add("HisBaseInfo", jaHisBaseInfo);
  450. joDataResult.Add("SettlementDetail", jaSettlementDetail);
  451. JObject joParams = new JObject();
  452. string printCode = "";
  453. joParams.Add("fastReportCode", "printSettlementList"); //这个要从表取值
  454. joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
  455. joParams.Add("printCode", printCode);
  456. joParams.Add("templateID", "");
  457. JArray jaParams = new JArray();
  458. jaParams.Add(joParams);
  459. JObject joReportParams = new JObject();
  460. joReportParams.Add("params", jaParams);
  461. joReportParams.Add("code", "01040306");
  462. JObject joParam = new JObject();
  463. joParam.Add("designFlag", designFlag);
  464. joParam.Add("logFlag", "Y");
  465. joParam.Add("dataParams", "");
  466. joParam.Add("pdfName", "");
  467. joParam.Add("reportparams", joReportParams);
  468. joParam.Add("dataResult", joDataResult);
  469. JObject joDataURL = new JObject();
  470. joDataURL.Add("dataIP", Global.hisConfig.ip);
  471. joDataURL.Add("urlAddress", Global.hisConfig.url);
  472. joDataURL.Add("authorization", Global.hisConfig.authorization);
  473. joParam.Add("dataURL", joDataURL);
  474. JArray jaParam = new JArray();
  475. jaParam.Add(joParam);
  476. JObject joInparam = new JObject();
  477. joInparam.Add("params", JArray.FromObject(jaParam));
  478. joInparam.Add("session", Global.curEvt.jaSession);
  479. #endregion
  480. JObject joRtn = new JObject();
  481. joRtn.Add("errorCode", 0);
  482. joRtn.Add("errorMessage", "");
  483. joRtn.Add("result", joInparam.ToString());
  484. return joRtn;
  485. }
  486. catch (Exception ex)
  487. {
  488. JObject joRtnEx = new JObject();
  489. joRtnEx.Add("errorCode", -1);
  490. joRtnEx.Add("errorMessage", ex.Message);
  491. joRtnEx.Add("result", "");
  492. return joRtnEx;
  493. }
  494. }
  495. /// <summary>
  496. /// FastReport正版打印开始
  497. /// </summary>
  498. /// <param name="InParams"></param>
  499. /// <param name="OutMsg"></param>
  500. /// <returns></returns>
  501. public int FastReportPrint(string InParams, out string OutMsg)
  502. {
  503. Global.writeLog("调用FastReport入参:" + InParams);
  504. try
  505. {
  506. #region【调用正版FastReport打印】
  507. FastReportFrom.FastReportDll FrDll = new FastReportFrom.FastReportDll();
  508. string sRtnFr = FrDll.FastReport(InParams);
  509. JObject joRetObj = JObject.Parse(sRtnFr);
  510. if (JsonHelper.parseIrisRtnValue(joRetObj, out string errMsg) != 0)
  511. {
  512. OutMsg = "调用FastReport打印失败!" + errMsg;
  513. return -1;
  514. }
  515. else
  516. {
  517. OutMsg = "";
  518. return 0;
  519. }
  520. #endregion
  521. }
  522. catch (Exception ex)
  523. {
  524. OutMsg = "调用FastReport打印失败!" + ex.Message;
  525. return -1;
  526. }
  527. }
  528. /// <summary>
  529. /// 调用正版FastReport的设计模式
  530. /// </summary>
  531. private void designReport()
  532. {
  533. if (dgvSettlRecord.RowCount <= 0)
  534. {
  535. MessageBox.Show("请先查询结算数据!");
  536. return;
  537. }
  538. try
  539. {
  540. int i = dgvSettlRecord.CurrentRow.Index;
  541. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  542. string AdmID = dt.Rows[i]["AdmID"].ToString();
  543. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  544. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  545. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  546. JObject joRtn = GetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag);
  547. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  548. {
  549. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  550. return;
  551. }
  552. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  553. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  554. {
  555. MessageBox.Show("调用FastReport设计失败!" + errMsg);
  556. return;
  557. }
  558. }
  559. catch (Exception ex)
  560. {
  561. MessageBox.Show(ex.Message);
  562. return;
  563. }
  564. }
  565. /// <summary>
  566. /// 点击设计
  567. /// </summary>
  568. /// <param name="sender"></param>
  569. /// <param name="e"></param>
  570. private void btnDesign_Click(object sender, EventArgs e)
  571. {
  572. thread_test = new Thread(new ThreadStart(design));
  573. thread_test.SetApartmentState(ApartmentState.STA); //重点
  574. thread_test.Start();
  575. }
  576. private void SettlementChecklist_FormClosed(object sender, FormClosedEventArgs e)
  577. {
  578. Dispose();
  579. }
  580. }
  581. // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
  582. public class Classification
  583. {
  584. public string cwfSummat { get; set; }
  585. public string cwfInScope { get; set; }
  586. public string cwfPreSelfPay { get; set; }
  587. public string cwfOverLimit { get; set; }
  588. public string cwfFullOwnPay { get; set; }
  589. public string zcfSummat { get; set; }
  590. public string zcfInScope { get; set; }
  591. public string zcfPreSelfPay { get; set; }
  592. public string zcfOverLimit { get; set; }
  593. public string zcfFullOwnPay { get; set; }
  594. public string jcfSummat { get; set; }
  595. public string jcfInScope { get; set; }
  596. public string jcfPreSelfPay { get; set; }
  597. public string jcfOverLimit { get; set; }
  598. public string jcfFullOwnPay { get; set; }
  599. public string hyfSummat { get; set; }
  600. public string hyfInScope { get; set; }
  601. public string hyfPreSelfPay { get; set; }
  602. public string hyfOverLimit { get; set; }
  603. public string hyfFullOwnPay { get; set; }
  604. public string zlfSummat { get; set; }
  605. public string zlfInScope { get; set; }
  606. public string zlfPreSelfPay { get; set; }
  607. public string zlfOverLimit { get; set; }
  608. public string zlfFullOwnPay { get; set; }
  609. public string ssfSummat { get; set; }
  610. public string ssfInScope { get; set; }
  611. public string ssfPreSelfPay { get; set; }
  612. public string ssfOverLimit { get; set; }
  613. public string ssfFullOwnPay { get; set; }
  614. public string hlfSummat { get; set; }
  615. public string hlfInScope { get; set; }
  616. public string hlfPreSelfPay { get; set; }
  617. public string hlfOverLimit { get; set; }
  618. public string hlfFullOwnPay { get; set; }
  619. public string wsclfSummat { get; set; }
  620. public string wsclfInScope { get; set; }
  621. public string wsclfPreSelfPay { get; set; }
  622. public string wsclfOverLimit { get; set; }
  623. public string wsclfFullOwnPay { get; set; }
  624. public string xyfSummat { get; set; }
  625. public string xyfInScope { get; set; }
  626. public string xyfPreSelfPay { get; set; }
  627. public string xyfOverLimit { get; set; }
  628. public string xyfFullOwnPay { get; set; }
  629. public string zyypfSummat { get; set; }
  630. public string zyypfInScope { get; set; }
  631. public string zyypfPreSelfPay { get; set; }
  632. public string zyypfOverLimit { get; set; }
  633. public string zyypfFullOwnPay { get; set; }
  634. public string zcyfSummat { get; set; }
  635. public string zcyfInScope { get; set; }
  636. public string zcyfPreSelfPay { get; set; }
  637. public string zcyfOverLimit { get; set; }
  638. public string zcyfFullOwnPay { get; set; }
  639. public string ybzlfSummat { get; set; }
  640. public string ybzlfInScope { get; set; }
  641. public string ybzlfPreSelfPay { get; set; }
  642. public string ybzlfOverLimit { get; set; }
  643. public string ybzlfFullOwnPay { get; set; }
  644. public string ghfSummat { get; set; }
  645. public string ghfInScope { get; set; }
  646. public string ghfPreSelfPay { get; set; }
  647. public string ghfOverLimit { get; set; }
  648. public string ghfFullOwnPay { get; set; }
  649. public string qtSummat { get; set; }
  650. public string qtInScope { get; set; }
  651. public string qtPreSelfPay { get; set; }
  652. public string qtOverLimit { get; set; }
  653. public string qtFullOwnPay { get; set; }
  654. public string totalSummat { get; set; }
  655. public string totalInScope { get; set; }
  656. public string totalPreSelfPay { get; set; }
  657. public string totalOverLimit { get; set; }
  658. public string totalFullOwnPay { get; set; }
  659. }
  660. public class Data
  661. {
  662. public List<Classification> classification { get; set; }
  663. public List<Settlement> settlement { get; set; }
  664. public List<Reginfo> reginfo { get; set; }
  665. public List<Patinsuinfo> patinsuinfo { get; set; }
  666. }
  667. public class Patinsuinfo
  668. {
  669. public string PsnCertType { get; set; }
  670. public string PsnCertNO { get; set; }
  671. public string Gend { get; set; }
  672. public string Naty { get; set; }
  673. public string Brdy { get; set; }
  674. public string Age { get; set; }
  675. public string Balc { get; set; }
  676. public string PsnType { get; set; }
  677. public string Cvlservflag { get; set; }
  678. public string insuplcAdmdvs { get; set; }
  679. public string EmpName { get; set; }
  680. public string PsnIdettype { get; set; }
  681. public string PsnTypeLv { get; set; }
  682. }
  683. public class Reginfo
  684. {
  685. public string AttendDoctorNO { get; set; }
  686. public string ChiefPhyDocName { get; set; }
  687. public string AdmitDepartmentCode { get; set; }
  688. public string AdmitDepartmentName { get; set; }
  689. public string AdmBed { get; set; }
  690. public string AdmNo { get; set; }
  691. public string MainDiagCode { get; set; }
  692. public string MainDiagName { get; set; }
  693. public string RegDate { get; set; }
  694. public string ConerName { get; set; }
  695. public string Tel { get; set; }
  696. }
  697. public class Result
  698. {
  699. public Data data { get; set; }
  700. }
  701. public class Root
  702. {
  703. public Result result { get; set; }
  704. public int errorCode { get; set; }
  705. public string errorMessage { get; set; }
  706. }
  707. public class Settlement
  708. {
  709. public string AdmID { get; set; }
  710. public string MdtrtID { get; set; }
  711. public string SettlementID { get; set; }
  712. public string PersonnelNO { get; set; }
  713. public string PatientName { get; set; }
  714. public string birth { get; set; }
  715. public string CertificateNO { get; set; }
  716. public string Gender { get; set; }
  717. public string InsuranceType { get; set; }
  718. public string PersonType { get; set; }
  719. public string CivilserviceFlag { get; set; }
  720. public string SettlementTime { get; set; }
  721. public string MedicalType { get; set; }
  722. public string Sumamt { get; set; }
  723. public string OwnPayAmount { get; set; }
  724. public string OverLimitAmount { get; set; }
  725. public string PreSelfPayAmount { get; set; }
  726. public string InPolicyRangeAmount { get; set; }
  727. public double ActualPayDeductible { get; set; }
  728. public string HealthInsurancePay { get; set; }
  729. public string HealthInsuranceRatio { get; set; }
  730. public double CivilserviceAllowancePay { get; set; }
  731. public string EnterpriseSupplementPay { get; set; }
  732. public string SeriousIllnessPay { get; set; }
  733. public string LargeExpensesSupplementPay { get; set; }
  734. public string MedicalAssistPay { get; set; }
  735. public string HospitalPartAmount { get; set; }
  736. public string OtherPay { get; set; }
  737. public string FundPaySumamt { get; set; }
  738. public string PersonPaySumamt { get; set; }
  739. public string AccountPaySumamt { get; set; }
  740. public string PersonCashPay { get; set; }
  741. public string Balance { get; set; }
  742. public string AccountMutualAidAmount { get; set; }
  743. public string OrganSettlementID { get; set; }
  744. public string ClearingOrgan { get; set; }
  745. public string ClearingWay { get; set; }
  746. public string ClearingType { get; set; }
  747. public string ValidFlag { get; set; }
  748. public string msgid { get; set; }
  749. public string HospitalizationsTimes { get; set; }
  750. public string HospitalizationsDays { get; set; }
  751. public string HISAdmTime { get; set; }
  752. public string HISDischargeTime { get; set; }
  753. public int BillType { get; set; }
  754. public string BillID { get; set; }
  755. public string admType { get; set; }
  756. public string RecordID { get; set; }
  757. public string insuplc_admdvs { get; set; }
  758. }
  759. }