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