SettlementChecklist.cs 34 KB

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