SettlementChecklist.cs 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971
  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 FastReportFrom;
  19. using PTMedicalInsurance.Business;
  20. using FastReportFunction = FastReport.FastReportFunction;
  21. using System.IO;
  22. using FastReport.Export.Dbf;
  23. using Sunny.UI;
  24. using static System.Windows.Forms.VisualStyles.VisualStyleElement.Tab;
  25. using System.Drawing.Drawing2D;
  26. using FastReport.Editor;
  27. namespace PTMedicalInsurance.Forms
  28. {
  29. public partial class SettlementChecklist : Form
  30. {
  31. private int hospitalDr;
  32. private int interfaceDr;
  33. private string hospitalNO;
  34. private string interfaceNO;
  35. private string hospitalName;
  36. private string hospitalAreaCode;
  37. private bool disposed = false;
  38. private HisIrisServices hIS = new HisIrisServices();
  39. private MIIrisServices mIS = new MIIrisServices();
  40. Thread thread_test;
  41. private InvokeHelper invoker = new InvokeHelper();
  42. public SettlementChecklist()
  43. {
  44. MessageBox.Show("进入打印函数991");
  45. InitializeComponent();
  46. MessageBox.Show("进入打印函数992");
  47. hospitalDr = Global.inf.hospitalDr;
  48. hospitalNO = Global.inf.hospitalNO;
  49. hospitalName = Global.inf.hospitalName;
  50. hospitalAreaCode = Global.inf.areaCode;
  51. interfaceDr = Global.inf.interfaceDr;
  52. }
  53. public SettlementChecklist(JObject joParam)
  54. {
  55. InitializeComponent();
  56. hospitalDr = Global.inf.hospitalDr;
  57. hospitalNO = Global.inf.hospitalNO;
  58. hospitalName = Global.inf.hospitalName;
  59. hospitalAreaCode = Global.inf.areaCode;
  60. if (joParam == null) return;
  61. string setl_id = JsonHelper.getDestValue(joParam, "setl_id");
  62. if (setl_id == "")
  63. {
  64. MessageBox.Show("根据传入的结算编号为查询到相关信息,请手动输入查询!");
  65. return;
  66. }
  67. string sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;
  68. sqlStr = sqlStr + " and SettlementID='" + setl_id + "'";
  69. JObject joSqlstr = new JObject();
  70. joSqlstr.Add("sqlStr", sqlStr);
  71. JArray jaParam = new JArray();
  72. jaParam.Add(joSqlstr);
  73. JObject joSettlQuery = new JObject();
  74. joSettlQuery.Add("params", jaParam);
  75. joSettlQuery.Add("code", "09010059");
  76. InvokeHelper invoker = new InvokeHelper();
  77. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  78. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  79. dgvSettlRecord.DataSource = dt;
  80. }
  81. public void Dispose()
  82. {
  83. Dispose1(true);
  84. GC.SuppressFinalize(this);
  85. }
  86. protected virtual void Dispose1(bool disposing)
  87. {
  88. if (thread_test == null) return;
  89. if (disposed == false)
  90. {
  91. if (disposing == true)
  92. {
  93. Thread.Sleep(100);
  94. Global.writeLog("Main - aborting my thread.");
  95. thread_test.Abort();//终止线程myThread
  96. thread_test.Join();//等待线程myThread结束
  97. Global.writeLog("Main - ending.");
  98. }
  99. //释放托管资源的代码
  100. }
  101. disposed = true;
  102. }
  103. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  104. {
  105. }
  106. private void btnQuery_Click(object sender, EventArgs e)
  107. {
  108. }
  109. private void btnQuery_Click_1(object sender, EventArgs e)
  110. {
  111. string sqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE Hospital_Dr=" + hospitalDr ;
  112. sqlStr = sqlStr + " and OccurTime>'" + dpST.Text + "'";
  113. sqlStr = sqlStr + " and OccurTime<'" + dpED.Text + "'";
  114. if (tbName.Text != "")
  115. {
  116. sqlStr = sqlStr + " and PatientName='" + tbName.Text + "'";
  117. }
  118. if (tbPatSettlID.Text != "")
  119. {
  120. sqlStr = sqlStr + " and SettlementID='" + tbPatSettlID.Text + "'";
  121. }
  122. if (tbHisNO.Text != "")
  123. {
  124. sqlStr = sqlStr + " and Adm_Dr='" + tbHisNO.Text + "'";
  125. }
  126. if (cbxInterface.Text != "")
  127. {
  128. sqlStr = sqlStr + " and Interface_Dr=" + Global.inf.interfaceDr + "";
  129. }
  130. if (rbgAdmType.SelectedIndex == 1)
  131. {
  132. sqlStr = sqlStr + " and AdmType=2";
  133. }
  134. if (rbgAdmType.SelectedIndex == 2)
  135. {
  136. sqlStr = sqlStr + " and AdmType=1";
  137. }
  138. if (rbgBillType.SelectedIndex == 1)
  139. {
  140. sqlStr = sqlStr + " and BillType=1 and ValidFlag=1 ";
  141. }
  142. if (rbgBillType.SelectedIndex == 2)
  143. {
  144. sqlStr = sqlStr + " and BillType=-1 and ValidFlag=0 ";
  145. }
  146. JObject joSqlstr = new JObject();
  147. joSqlstr.Add("sqlStr", sqlStr);
  148. JArray jaParam = new JArray();
  149. jaParam.Add(joSqlstr);
  150. JObject joSettlQuery = new JObject();
  151. joSettlQuery.Add("params", jaParam);
  152. joSettlQuery.Add("code", "09010059");
  153. JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  154. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  155. dgvSettlRecord.DataSource = dt;
  156. }
  157. private void SettlementChecklist_Load(object sender, EventArgs e)
  158. {
  159. dpST.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00");
  160. dpED.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59");
  161. ComboxSetter cbxSetter = new ComboxSetter();
  162. cbxSetter.setCbxInterfaceDataSource(cbxInterface);
  163. GridViewSetter grdSetter = new GridViewSetter();
  164. grdSetter.SetHeaderTextOfSettlList(dgvSettlRecord);
  165. rbgAdmType.SelectedIndex = 0;
  166. rbgBillType.SelectedIndex = 1;
  167. btnDesign.Visible = true;
  168. cbxInterface.SelectedValueChanged += new EventHandler(cbxInterface_SelectedValueChanged);
  169. }
  170. private void cbxInterface_SelectedValueChanged(object sender, EventArgs e)
  171. {
  172. DataTable dt = (DataTable)cbxInterface.DataSource;
  173. int i = cbxInterface.SelectedIndex;
  174. //赋值
  175. hospitalNO = dt.Rows[i]["HospitalNO"].ToString();
  176. //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString());
  177. //MessageBox.Show(dt.Rows[i]["HospitalDr"].ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
  178. hospitalDr = int.Parse(dt.Rows[i]["HospitalDr"].ToString());
  179. interfaceNO = dt.Rows[i]["InterfaceNO"].ToString();
  180. interfaceDr = int.Parse(dt.Rows[i]["ID"].ToString());
  181. hospitalAreaCode = dt.Rows[i]["AreaCode"].ToString();
  182. //Global.inf.centerURL = dt.Rows[i]["CenterURL"].ToString();
  183. //Global.inf.businessDllName = dt.Rows[i]["DLLName"].ToString();
  184. //Global.inf.patientAreaCode = dt.Rows[i]["AreaCode"].ToString();
  185. }
  186. private JObject getPatCheckList()
  187. {
  188. try
  189. {
  190. int i = dgvSettlRecord.CurrentRow.Index;
  191. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  192. JObject joSettel = new JObject();
  193. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  194. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  195. joSettel.Add("admID", dt.Rows[i]["AdmID"].ToString());
  196. joSettel.Add("SettlementID", dt.Rows[i]["SettlementID"].ToString());
  197. joSettel.Add("ValidFlag", dt.Rows[i]["ValidFlag"].ToString());
  198. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  199. return joRtn;
  200. }
  201. catch (Exception ex)
  202. {
  203. JObject joRtn = new JObject();
  204. joRtn.Add("errorCode", -1);
  205. joRtn.Add("errorMessage", ex.Message);
  206. return joRtn;
  207. }
  208. }
  209. private void uiPanel1_Click(object sender, EventArgs e)
  210. {
  211. }
  212. [STAThread]
  213. public void design()
  214. {
  215. //try
  216. //{
  217. // string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
  218. // FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
  219. // JObject joSettleCheckList = getPatCheckList();
  220. // string errMsg;
  221. // if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
  222. // {
  223. // MessageBox.Show("查询结算信息异常:" + errMsg);
  224. // return;
  225. // }
  226. // Report report = new Report();
  227. // try
  228. // {
  229. // var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  230. // report.RegisterData(json.result.data.classification, "classification");
  231. // report.RegisterData(json.result.data.settlement, "settlement");
  232. // report.RegisterData(json.result.data.reginfo, "reginfo");
  233. // report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  234. // }
  235. // catch (Exception ex)
  236. // {
  237. // MessageBox.Show(ex.Message);
  238. // return;
  239. // }
  240. // report.Load(Global.curEvt.path + "\\frx\\河南郑州结算单.frx");
  241. // PrintDesign pf = new PrintDesign();
  242. // pf.designerControl1.Report = report;
  243. // report.Design();
  244. // pf.WindowState = FormWindowState.Maximized;
  245. // pf.ShowDialog();
  246. //}
  247. //catch (Exception ex)
  248. //{
  249. // MessageBox.Show(ex.Message);
  250. //}
  251. }
  252. [STAThread]
  253. private void print()
  254. {
  255. //string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
  256. //FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
  257. //JObject joSettleCheckList = getPatCheckList();
  258. //string errMsg;
  259. //if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
  260. //{
  261. // MessageBox.Show("查询结算信息异常:" + errMsg);
  262. // return;
  263. //}
  264. //Report report = new Report();
  265. //try
  266. //{
  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. //}
  273. //catch (Exception ex)
  274. //{
  275. // MessageBox.Show(ex.Message);
  276. // return;
  277. //}
  278. ////report.Design();
  279. //report.Load(Global.curEvt.path + "\\frx\\河南郑州结算单.frx");
  280. //this.ShowInTaskbar = true;
  281. //PrintPreview pf = new PrintPreview();
  282. //report.Preview = pf.previewControl1;
  283. //report.Show();
  284. //pf.WindowState = FormWindowState.Maximized;
  285. //pf.ShowDialog();
  286. try
  287. {
  288. int i = dgvSettlRecord.CurrentRow.Index;
  289. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  290. string AdmID = dt.Rows[i]["AdmID"].ToString();
  291. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  292. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  293. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  294. string BillType = dt.Rows[i]["BillType"].ToString();
  295. JObject joRtn = GetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag, BillType);
  296. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  297. {
  298. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  299. return;
  300. }
  301. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  302. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  303. {
  304. MessageBox.Show("调用FastReport打印失败!" + errMsg);
  305. return;
  306. }
  307. }
  308. catch (Exception ex)
  309. {
  310. MessageBox.Show(ex.Message);
  311. return;
  312. }
  313. }
  314. public int FastReportPrint(string InParams, out string OutMsg)
  315. {
  316. Global.writeLog("调用FastReport入参:" + InParams);
  317. try
  318. {
  319. #region【调用正版FastReport打印】
  320. FastReportFrom.FastReportDll FrDll = new FastReportFrom.FastReportDll();
  321. string sRtnFr = FrDll.FastReport(InParams);
  322. JObject joRetObj = JObject.Parse(sRtnFr);
  323. if (JsonHelper.parseIrisRtnValue(joRetObj, out string errMsg) != 0)
  324. {
  325. OutMsg = "调用FastReport打印失败!" + errMsg;
  326. return -1;
  327. }
  328. else
  329. {
  330. OutMsg = "";
  331. return 0;
  332. }
  333. #endregion
  334. }
  335. catch (Exception ex)
  336. {
  337. OutMsg = "调用FastReport打印失败!" + ex.Message;
  338. return -1;
  339. }
  340. }
  341. public JObject GetFastReportParams(string designFlag, string admID, string MdtrtID, string settlementID, string validFlag,string BillType)
  342. {
  343. try
  344. {
  345. if (designFlag == "") { designFlag = "N"; }
  346. #region【获取HIS医保结算信息】
  347. JObject joSettel = new JObject();
  348. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  349. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  350. joSettel.Add("admID", admID);
  351. joSettel.Add("SettlementID", settlementID);
  352. joSettel.Add("ValidFlag", validFlag);
  353. joSettel.Add("BillType", BillType);
  354. joSettel.Add("MdtrtID", MdtrtID);
  355. JObject joRtnSettle = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  356. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out string errMsg) != 0)
  357. {
  358. JObject joRtnSet = new JObject();
  359. joRtnSet.Add("errorCode", -1);
  360. joRtnSet.Add("errorMessage", errMsg);
  361. joRtnSet.Add("result", "");
  362. return joRtnSet;
  363. }
  364. #endregion
  365. #region【获取住院号】
  366. JObject joTmp = new JObject();
  367. joTmp.Add("admID", joRtnSettle["result"]["data"]["settlement"][0]["AdmID"]);
  368. joTmp.Add("psn_no", joRtnSettle["result"]["data"]["settlement"][0]["PersonnelNO"]);
  369. //JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110001", joTmp).ToString(), "获取诊断信息");
  370. JObject joRtnDiag = invoker.invokeHISService(JsonHelper.setIrisInpar("05110014", joTmp).ToString(), "获取诊断信息");
  371. string medrcdno = "";
  372. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out errMsg) == 0)
  373. {
  374. medrcdno = joRtnDiag["mdtrtinfo"]["medrcdno"].ToString();
  375. }
  376. #endregion
  377. #region【数据转换】
  378. if (joRtnSettle["result"]["data"]["settlement"][0]["Gender"].ToString() == "1")
  379. {
  380. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "男";
  381. }
  382. else
  383. {
  384. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "女";
  385. }
  386. DateTime startDate = (DateTime)joRtnSettle["result"]["data"]["reginfo"][0]["RegDate"];
  387. DateTime endDate = (DateTime)joRtnSettle["result"]["data"]["settlement"][0]["SettlementTime"];
  388. int diffInDays = (int)(endDate - startDate).TotalDays;
  389. if (diffInDays == 0)
  390. {
  391. diffInDays = 1;
  392. }
  393. joRtnSettle["result"]["data"]["settlement"][0]["HospitalizationsDays"] = diffInDays;
  394. string str = joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"].ToString();
  395. if (str.Contains("."))
  396. {
  397. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str.Split('.')[0] + "岁";
  398. }
  399. else
  400. {
  401. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str + "岁";
  402. }
  403. #endregion
  404. #region【组织FastReport调用入参】
  405. JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
  406. JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
  407. JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
  408. JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
  409. JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
  410. //转换金额大写
  411. string Sumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt").ToString());
  412. string HealthInsurancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay").ToString());
  413. string ActualPayDeductible = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible").ToString());
  414. string PersonCashPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay").ToString());
  415. string AccountPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt").ToString());
  416. string FundPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt").ToString());
  417. string LargeExpensesSupplementPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay").ToString());
  418. string SeriousIllnessPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay").ToString());
  419. string CivilserviceAllowancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay").ToString());
  420. string MedicalAssistPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay").ToString());
  421. string OtherPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay").ToString());
  422. string HospitalPartAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount").ToString());
  423. string AccountMutualAidAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount").ToString());
  424. string InPolicyRangeAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].InPolicyRangeAmount").ToString());
  425. //退费前卡余额
  426. decimal BalanceBefore = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Balance")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) + Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount"));
  427. //退费撤销结算单负数显示
  428. decimal LSumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt")) * -1;
  429. decimal LHealthInsurancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay")) * -1;
  430. decimal LAccountPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) * -1;
  431. decimal LFundPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt")) * -1;
  432. decimal LCivilserviceAllowancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay")) * -1;
  433. decimal LMedicalAssistPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay")) * -1;
  434. decimal LPersonCashPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay")) * -1;
  435. decimal LAccountMutualAidAmount = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount")) * -1;
  436. decimal LBlZf = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonPaySumamt")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OwnPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PreSelfPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OverLimitAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible"));
  437. //string BeginDate = JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo[0].RegDate").ToString();
  438. //string EndDate = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HISDischargeTime").ToString();
  439. //string InHosDays = FastReportFunction.DateDiff(Convert.ToDateTime(BeginDate), Convert.ToDateTime(EndDate));
  440. JObject jaAmountChiness = new JObject();
  441. jaAmountChiness.Add("Sumamt", Sumamt);
  442. jaAmountChiness.Add("HealthInsurancePay", HealthInsurancePay);
  443. jaAmountChiness.Add("ActualPayDeductible", ActualPayDeductible);
  444. jaAmountChiness.Add("PersonCashPay", PersonCashPay);
  445. jaAmountChiness.Add("AccountPaySumamt", AccountPaySumamt);
  446. jaAmountChiness.Add("FundPaySumamt", FundPaySumamt);
  447. jaAmountChiness.Add("LargeExpensesSupplementPay", LargeExpensesSupplementPay);
  448. jaAmountChiness.Add("SeriousIllnessPay", SeriousIllnessPay);
  449. jaAmountChiness.Add("CivilserviceAllowancePay", CivilserviceAllowancePay);
  450. jaAmountChiness.Add("MedicalAssistPay", MedicalAssistPay);
  451. jaAmountChiness.Add("OtherPay", OtherPay);
  452. jaAmountChiness.Add("HospitalPartAmount", HospitalPartAmount);
  453. jaAmountChiness.Add("AccountMutualAidAmount", AccountMutualAidAmount);
  454. jaAmountChiness.Add("InPolicyRangeAmount", InPolicyRangeAmount); //合规费用
  455. jaAmountChiness.Add("SettlOpter", Global.user.name);
  456. jaAmountChiness.Add("medrcdno", medrcdno);
  457. //其他自定义处理字段
  458. jaAmountChiness.Add("BalanceBefore", BalanceBefore);//结算前卡余额
  459. jaAmountChiness.Add("LSumamt", LSumamt);
  460. jaAmountChiness.Add("LHealthInsurancePay", LHealthInsurancePay);
  461. jaAmountChiness.Add("LAccountPaySumamt", LAccountPaySumamt);
  462. jaAmountChiness.Add("LFundPaySumamt", LFundPaySumamt);
  463. jaAmountChiness.Add("LCivilserviceAllowancePay", LCivilserviceAllowancePay);
  464. jaAmountChiness.Add("LMedicalAssistPay", LMedicalAssistPay);
  465. jaAmountChiness.Add("LPersonCashPay", LPersonCashPay);
  466. jaAmountChiness.Add("LAccountMutualAidAmount", LAccountMutualAidAmount);
  467. jaAmountChiness.Add("LBlZf", LBlZf);
  468. JArray jachinessParams = new JArray();
  469. jachinessParams.Add(jaAmountChiness);
  470. JObject joDataResult = new JObject();
  471. joDataResult.Add("SettlementInfo", jaSettlement);
  472. joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
  473. joDataResult.Add("ClassificationInfo", jaClassification);
  474. joDataResult.Add("RegInfo", jaReginfo);
  475. joDataResult.Add("Patinsuinfo", japatinsuinfo);
  476. joDataResult.Add("ChinessSummat", jachinessParams);
  477. #region【门诊撤销结算单打印需要体现费用信息】
  478. String outParam;
  479. JObject joRtnRis = new JObject();
  480. JObject joHisFee = new JObject();
  481. if (Global.pat.admType == 1)
  482. {
  483. Global.pat.adm_Dr = int.Parse(joRtnSettle["result"]["data"]["settlement"][0]["AdmID"].ToString());
  484. Global.pat.billID = "";
  485. Global.pat.recordID = joRtnSettle["result"]["data"]["settlement"][0]["RecordID"].ToString();
  486. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  487. {
  488. JObject joRtnSet = new JObject();
  489. joRtnSet.Add("errorCode", -1);
  490. joRtnSet.Add("errorMessage", "获取HIS费用失败");
  491. joRtnSet.Add("result", "");
  492. return joRtnSet;
  493. }
  494. else
  495. {
  496. joRtnRis = JObject.Parse(outParam);
  497. }
  498. joHisFee = JObject.Parse(outParam);
  499. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  500. {
  501. JObject joRtnSet = new JObject();
  502. joRtnSet.Add("errorCode", -1);
  503. joRtnSet.Add("errorMessage", "医保平台转换费用失败");
  504. joRtnSet.Add("result", "");
  505. return joRtnSet;
  506. }
  507. joDataResult.Add("Feeinfo", JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data")));
  508. }
  509. #endregion【门诊撤销结算单打印需要体现费用信息】
  510. JObject joParams = new JObject();
  511. if (Global.pat.admType == 1)
  512. {
  513. joParams.Add("fastReportCode", "SP14"); //这个要从表取值
  514. }else
  515. {
  516. joParams.Add("fastReportCode", "SP11"); //湖北普瑞门诊结算单撤销结算单从SP14打印
  517. }
  518. joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
  519. joParams.Add("printCode", "14");
  520. joParams.Add("templateID", "");
  521. JArray jaParams = new JArray();
  522. jaParams.Add(joParams);
  523. JObject joReportParams = new JObject();
  524. joReportParams.Add("params", jaParams);
  525. joReportParams.Add("code", "01040306");
  526. JObject joParam = new JObject();
  527. joParam.Add("designFlag", designFlag);
  528. joParam.Add("logFlag", "N");
  529. joParam.Add("dataParams", "");
  530. joParam.Add("pdfName", "");
  531. joParam.Add("reportparams", joReportParams);
  532. joParam.Add("dataResult", joDataResult);
  533. JObject joDataURL = new JObject();
  534. joDataURL.Add("dataIP", Global.hisConfig.ip);
  535. joDataURL.Add("urlAddress", Global.hisConfig.url);
  536. joDataURL.Add("authorization", Global.hisConfig.authorization);
  537. joParam.Add("dataURL", joDataURL);
  538. JArray jaParam = new JArray();
  539. jaParam.Add(joParam);
  540. JObject joInparam = new JObject();
  541. joInparam.Add("params", JArray.FromObject(jaParam));
  542. joInparam.Add("session", Global.curEvt.jaSession);
  543. #endregion
  544. JObject joRtn = new JObject();
  545. joRtn.Add("errorCode", 0);
  546. joRtn.Add("errorMessage", "");
  547. joRtn.Add("result", joInparam.ToString());
  548. return joRtn;
  549. }
  550. catch (Exception ex)
  551. {
  552. JObject joRtnEx = new JObject();
  553. joRtnEx.Add("errorCode", -1);
  554. joRtnEx.Add("errorMessage", ex.Message);
  555. joRtnEx.Add("result", "");
  556. return joRtnEx;
  557. }
  558. }
  559. //湖北市医保单独fastReport打印方法
  560. [STAThread]
  561. private void cityPrint()
  562. {
  563. try
  564. {
  565. int i = dgvSettlRecord.CurrentRow.Index;
  566. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  567. string AdmID = dt.Rows[i]["AdmID"].ToString();
  568. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  569. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  570. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  571. string BillType = dt.Rows[i]["BillType"].ToString();
  572. JObject pJoInparm = new JObject();
  573. pJoInparm.Add("MdtrtCertType", dt.Rows[i]["MdtrtCertType"].ToString());
  574. JObject joRtn = cityGetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag, BillType, pJoInparm);
  575. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  576. {
  577. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  578. return;
  579. }
  580. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  581. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  582. {
  583. MessageBox.Show("调用FastReport打印失败!" + errMsg);
  584. return;
  585. }
  586. }
  587. catch (Exception ex)
  588. {
  589. MessageBox.Show(ex.Message);
  590. return;
  591. }
  592. }
  593. //湖北市医保单独获取fastReport打印入参
  594. public JObject cityGetFastReportParams(string designFlag, string admID, string MdtrtID, string settlementID, string validFlag, string BillType, JObject pJoInparm)
  595. {
  596. try
  597. {
  598. if (designFlag == "") { designFlag = "N"; }
  599. //string sqlStr = " SELECT * FROM BS_MedInsuSettlement WHERE SettlementID='" + settlementID + "'";
  600. //sqlStr = sqlStr + " and Adm_Dr='" + admID + "'";
  601. //sqlStr = sqlStr + " and ValidFlag='" + validFlag + "'";
  602. //sqlStr = sqlStr + " and BillType='" + BillType + "'";
  603. //JObject joSqlstr = new JObject();
  604. //joSqlstr.Add("sqlStr", sqlStr);
  605. //JArray jaParam = new JArray();
  606. //jaParam.Add(joSqlstr);
  607. //JObject joSettlQuery = new JObject();
  608. //joSettlQuery.Add("params", jaParam);
  609. //joSettlQuery.Add("code", "09010059");
  610. //JObject joRtn = invoker.invokeInsuService(joSettlQuery.ToString(), "查询结算信息");
  611. //DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  612. #region【获取HIS医保结算信息】
  613. JObject joSettel = new JObject();
  614. joSettel.Add("HospitalDr", Global.inf.hospitalDr);
  615. joSettel.Add("interfaceDr", Global.inf.interfaceDr);
  616. joSettel.Add("admID", admID);
  617. joSettel.Add("SettlementID", settlementID);
  618. joSettel.Add("ValidFlag", validFlag);
  619. joSettel.Add("BillType", BillType);
  620. joSettel.Add("MdtrtID", MdtrtID);
  621. JObject joRtnSettle = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
  622. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out string errMsg) != 0)
  623. {
  624. JObject joRtnSet = new JObject();
  625. joRtnSet.Add("errorCode", -1);
  626. joRtnSet.Add("errorMessage", errMsg);
  627. joRtnSet.Add("result", "");
  628. return joRtnSet;
  629. }
  630. #endregion
  631. #region【获取住院号】
  632. JObject joTmp = new JObject();
  633. joTmp.Add("admID", joRtnSettle["result"]["data"]["settlement"][0]["AdmID"]);
  634. joTmp.Add("psn_no", joRtnSettle["result"]["data"]["settlement"][0]["PersonnelNO"]);
  635. //JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110001", joTmp).ToString(), "获取诊断信息");
  636. JObject joRtnDiag = invoker.invokeHISService(JsonHelper.setIrisInpar("05110014", joTmp).ToString(), "获取诊断信息");
  637. string medrcdno = "";
  638. string mdtrtCertType = "";//医保使用凭证 电子凭证 身份证 社保卡
  639. string adtime = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SettlementTime").ToString();
  640. string distime = "";
  641. int billtype = int.Parse(BillType);
  642. //取就诊日期日期部分
  643. DateTime addateTime;
  644. if (DateTime.TryParse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SettlementTime").ToString(), out addateTime))
  645. {
  646. distime = addateTime.Date.ToString("yyyy-MM-dd"); // 格式化输出日期部分
  647. adtime = addateTime.Date.ToString("yyyy-MM-dd"); // 格式化输出日期部分
  648. }
  649. if (JsonHelper.parseIrisRtnValue(joRtnSettle, out errMsg) == 0)
  650. {
  651. medrcdno = joRtnDiag["mdtrtinfo"]["medrcdno"].ToString();
  652. }
  653. #endregion
  654. #region【数据转换】
  655. if (joRtnSettle["result"]["data"]["settlement"][0]["Gender"].ToString() == "1")
  656. {
  657. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "男";
  658. }
  659. else
  660. {
  661. joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "女";
  662. }
  663. if (pJoInparm["MdtrtCertType"].ToString() == "01")
  664. {
  665. mdtrtCertType = "医保电子凭证";
  666. }
  667. else if (pJoInparm["MdtrtCertType"].ToString() == "02")
  668. {
  669. mdtrtCertType = "居民身份证";
  670. }
  671. else if (pJoInparm["MdtrtCertType"].ToString() == "03")
  672. {
  673. mdtrtCertType = "社保卡";
  674. }
  675. DateTime startDate = (DateTime)joRtnSettle["result"]["data"]["reginfo"][0]["RegDate"];
  676. DateTime endDate = (DateTime)joRtnSettle["result"]["data"]["settlement"][0]["SettlementTime"];
  677. int diffInDays = (int)(endDate - startDate).TotalDays;
  678. if (diffInDays == 0)
  679. {
  680. diffInDays = 1;
  681. }
  682. joRtnSettle["result"]["data"]["settlement"][0]["HospitalizationsDays"] = diffInDays;
  683. string str = joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"].ToString();
  684. if (str.Contains("."))
  685. {
  686. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str.Split('.')[0] + "岁";
  687. }
  688. else
  689. {
  690. joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str + "岁";
  691. }
  692. string ISCX = "";
  693. if (BillType == "-1")
  694. {
  695. ISCX = "撤销";
  696. }
  697. #endregion
  698. #region【组织FastReport调用入参】
  699. JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
  700. JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
  701. JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
  702. JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
  703. JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
  704. //退费前卡余额
  705. decimal BalanceBefore = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Balance")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) + Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount"));
  706. //退费撤销结算单负数显示
  707. decimal LSumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt")) * billtype;
  708. decimal LFundPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt")) * billtype;
  709. decimal LHealthInsurancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay")) * billtype;
  710. decimal LLargeExpensesSupplementPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay")) * billtype;
  711. decimal LSeriousIllnessPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay")) * billtype;
  712. decimal LMedicalAssistPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay")) * billtype;
  713. decimal LEnterpriseSupplementPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].EnterpriseSupplementPay")) * billtype;
  714. decimal LOtherPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay")) * billtype;
  715. decimal LCivilserviceAllowancePay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay")) * billtype;
  716. decimal LDEZF = LLargeExpensesSupplementPay + LSeriousIllnessPay;
  717. decimal LHospitalPartAmount = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount")) * billtype;
  718. decimal LPersonPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonPaySumamt")) * billtype;
  719. decimal LAccountPaySumamt = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt")) * billtype;
  720. decimal LPersonCashPay = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay")) * billtype;
  721. decimal LAccountMutualAidAmount = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount")) * billtype;
  722. decimal LBlZf = Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonPaySumamt")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OwnPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PreSelfPayAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OverLimitAmount")) - Convert.ToDecimal(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible"));
  723. //转换金额大写
  724. string Sumamt = FastReportFunction.MoneyToUpper(LSumamt.ToString());
  725. string HealthInsurancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HealthInsurancePay").ToString());
  726. string ActualPayDeductible = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible").ToString());
  727. string PersonCashPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay").ToString());
  728. string AccountPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt").ToString());
  729. string FundPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt").ToString());
  730. string LargeExpensesSupplementPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay").ToString());
  731. string SeriousIllnessPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay").ToString());
  732. string CivilserviceAllowancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay").ToString());
  733. string MedicalAssistPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay").ToString());
  734. string OtherPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay").ToString());
  735. string HospitalPartAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount").ToString());
  736. string AccountMutualAidAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount").ToString());
  737. string InPolicyRangeAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].InPolicyRangeAmount").ToString());
  738. //string BeginDate = JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo[0].RegDate").ToString();
  739. //string EndDate = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HISDischargeTime").ToString();
  740. //string InHosDays = FastReportFunction.DateDiff(Convert.ToDateTime(BeginDate), Convert.ToDateTime(EndDate));
  741. JObject jaAmountChiness = new JObject();
  742. jaAmountChiness.Add("Sumamt", Sumamt);
  743. jaAmountChiness.Add("HealthInsurancePay", HealthInsurancePay);
  744. jaAmountChiness.Add("ActualPayDeductible", ActualPayDeductible);
  745. jaAmountChiness.Add("PersonCashPay", PersonCashPay);
  746. jaAmountChiness.Add("AccountPaySumamt", AccountPaySumamt);
  747. jaAmountChiness.Add("FundPaySumamt", FundPaySumamt);
  748. jaAmountChiness.Add("LargeExpensesSupplementPay", LargeExpensesSupplementPay);
  749. jaAmountChiness.Add("SeriousIllnessPay", SeriousIllnessPay);
  750. jaAmountChiness.Add("CivilserviceAllowancePay", CivilserviceAllowancePay);
  751. jaAmountChiness.Add("MedicalAssistPay", MedicalAssistPay);
  752. jaAmountChiness.Add("OtherPay", OtherPay);
  753. jaAmountChiness.Add("HospitalPartAmount", HospitalPartAmount);
  754. jaAmountChiness.Add("AccountMutualAidAmount", AccountMutualAidAmount);
  755. jaAmountChiness.Add("InPolicyRangeAmount", InPolicyRangeAmount); //合规费用
  756. jaAmountChiness.Add("SettlOpter", Global.user.name);
  757. jaAmountChiness.Add("medrcdno", medrcdno);
  758. jaAmountChiness.Add("mdtrtCertType", mdtrtCertType);
  759. jaAmountChiness.Add("hospitalNO",Global.inf.hospitalNO);
  760. jaAmountChiness.Add("hospitalName", Global.inf.hospitalName);
  761. //其他自定义处理字段
  762. jaAmountChiness.Add("BalanceBefore", BalanceBefore);//结算前卡余额
  763. jaAmountChiness.Add("LSumamt", LSumamt);
  764. jaAmountChiness.Add("LFundPaySumamt", LFundPaySumamt);
  765. jaAmountChiness.Add("LHealthInsurancePay", LHealthInsurancePay);
  766. jaAmountChiness.Add("LMedicalAssistPay", LMedicalAssistPay);
  767. jaAmountChiness.Add("LCivilserviceAllowancePay", LCivilserviceAllowancePay);
  768. jaAmountChiness.Add("LLargeExpensesSupplementPay", LLargeExpensesSupplementPay);
  769. jaAmountChiness.Add("LSeriousIllnessPay", LSeriousIllnessPay);
  770. jaAmountChiness.Add("LEnterpriseSupplementPay", LEnterpriseSupplementPay);
  771. jaAmountChiness.Add("LOtherPay", LOtherPay);
  772. jaAmountChiness.Add("LDEZF", LDEZF);
  773. jaAmountChiness.Add("LHospitalPartAmount", LHospitalPartAmount);
  774. jaAmountChiness.Add("LPersonPaySumamt", LPersonPaySumamt);
  775. jaAmountChiness.Add("LAccountPaySumamt", LAccountPaySumamt);
  776. jaAmountChiness.Add("LPersonCashPay", LPersonCashPay);
  777. jaAmountChiness.Add("LAccountMutualAidAmount", LAccountMutualAidAmount);
  778. jaAmountChiness.Add("LBlZf", LBlZf);
  779. jaAmountChiness.Add("adtime", adtime);
  780. jaAmountChiness.Add("distime", distime);
  781. jaAmountChiness.Add("iscx", ISCX);
  782. JArray jachinessParams = new JArray();
  783. jachinessParams.Add(jaAmountChiness);
  784. JObject joDataResult = new JObject();
  785. joDataResult.Add("SettlementInfo", jaSettlement);
  786. joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
  787. joDataResult.Add("ClassificationInfo", jaClassification);
  788. joDataResult.Add("RegInfo", jaReginfo);
  789. joDataResult.Add("Patinsuinfo", japatinsuinfo);
  790. joDataResult.Add("ChinessSummat", jachinessParams);
  791. JObject joParams = new JObject();
  792. joParams.Add("fastReportCode", "printSettlementList"); //这个要从表取值
  793. joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
  794. joParams.Add("printCode", "City");
  795. joParams.Add("templateID", "");
  796. JArray jaParams = new JArray();
  797. jaParams.Add(joParams);
  798. JObject joReportParams = new JObject();
  799. joReportParams.Add("params", jaParams);
  800. joReportParams.Add("code", "01040306");
  801. JObject joParam = new JObject();
  802. joParam.Add("designFlag", designFlag);
  803. joParam.Add("logFlag", "N");
  804. joParam.Add("dataParams", "");
  805. joParam.Add("pdfName", "");
  806. joParam.Add("reportparams", joReportParams);
  807. joParam.Add("dataResult", joDataResult);
  808. JObject joDataURL = new JObject();
  809. joDataURL.Add("dataIP", Global.hisConfig.ip);
  810. joDataURL.Add("urlAddress", Global.hisConfig.url);
  811. joDataURL.Add("authorization", Global.hisConfig.authorization);
  812. joParam.Add("dataURL", joDataURL);
  813. JArray jaParam = new JArray();
  814. jaParam.Add(joParam);
  815. JObject joInparam = new JObject();
  816. joInparam.Add("params", JArray.FromObject(jaParam));
  817. joInparam.Add("session", Global.curEvt.jaSession);
  818. #endregion
  819. JObject joRtn = new JObject();
  820. joRtn.Add("errorCode", 0);
  821. joRtn.Add("errorMessage", "");
  822. joRtn.Add("result", joInparam.ToString());
  823. return joRtn;
  824. }
  825. catch (Exception ex)
  826. {
  827. JObject joRtnEx = new JObject();
  828. joRtnEx.Add("errorCode", -1);
  829. joRtnEx.Add("errorMessage", ex.Message);
  830. joRtnEx.Add("result", "");
  831. return joRtnEx;
  832. }
  833. }
  834. [STAThread]
  835. private void preview()
  836. {
  837. //Report report = new Report();
  838. //try
  839. //{
  840. // var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
  841. // report.RegisterData(json.result.data.classification, "classification");
  842. // report.RegisterData(json.result.data.settlement, "settlement");
  843. // report.RegisterData(json.result.data.reginfo, "reginfo");
  844. // report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
  845. //}
  846. //catch (Exception ex)
  847. //{
  848. // MessageBox.Show(ex.Message);
  849. // return;
  850. //}
  851. ////report.Design();
  852. //report.Load(Global.curEvt.path + "\\frx\\湖北武汉结算单.frx");
  853. ////report.Show();
  854. //PrintPreview preview1 = new PrintPreview();
  855. //preview1.Show();
  856. //report.Preview = preview1.previewControl1;
  857. //report.Prepare(); //准备
  858. //report.ShowPrepared(); //显示
  859. //preview1.Show();
  860. }
  861. private void uiButton2_Click(object sender, EventArgs e)
  862. {
  863. Close();
  864. }
  865. public void btnPrint_Click(object sender, EventArgs e)
  866. {
  867. string errorMsg;
  868. int iHis = dgvSettlRecord.CurrentRow.Index;
  869. String BType = dgvSettlRecord.Rows[iHis].Cells["BillType"].Value.ToString();
  870. Global.pat.admType =int.Parse(dgvSettlRecord.Rows[iHis].Cells["admType"].Value.ToString());
  871. JObject joData = new JObject();
  872. joData.Add("mdtrt_id", dgvSettlRecord.Rows[iHis].Cells["MdtrtID"].Value.ToString());
  873. joData.Add("setl_id", dgvSettlRecord.Rows[iHis].Cells["SettlementID"].Value.ToString());
  874. joData.Add("psn_no", dgvSettlRecord.Rows[iHis].Cells["PersonnelNO"].Value.ToString());
  875. joData.Add("med_type", dgvSettlRecord.Rows[iHis].Cells["MedicalType"].Value.ToString());
  876. JObject joInput = new JObject();
  877. joInput.Add("data", joData);
  878. Global.pat.insuplc_admdvs = dgvSettlRecord.Rows[iHis].Cells["insuplc_admdvs"].Value.ToString();//更新参保地
  879. if (BType == "1") {
  880. #region【调用医保交易YH03打印】
  881. InvokeHelper invoker = new InvokeHelper();
  882. JObject joRtn = invoker.invokeCenterService("YH03", JsonHelper.setCenterInpar("YH03", joInput));
  883. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  884. {
  885. MessageBox.Show("打印失败:" + errorMsg);
  886. return;
  887. }
  888. #endregion
  889. }
  890. else if (BType == "-1")
  891. {
  892. #region【调用FastRepor打印】
  893. try
  894. {
  895. //Thread thread = new Thread(new ThreadStart(print));
  896. //thread.SetApartmentState(ApartmentState.STA); //重点
  897. //thread.Start();
  898. //thread.Join();
  899. print();
  900. }
  901. catch (Exception ex)
  902. {
  903. Global.writeLog("结算单打印异常:" + ex.Message);
  904. MessageBox.Show("打印异常:" + ex.Message);
  905. }
  906. #endregion
  907. }
  908. }
  909. public void btnDesign_Click(object sender, EventArgs e)
  910. {
  911. //try
  912. //{
  913. // Thread thread = new Thread(new ThreadStart(design));
  914. // thread.SetApartmentState(ApartmentState.STA); //重点
  915. // thread.Start();
  916. // thread.Join();
  917. //}
  918. //catch (Exception ex)
  919. //{
  920. // Global.writeLog("结算单设计预览异常:" + ex.Message);
  921. // MessageBox.Show("设计预览异常:" + ex.Message);
  922. //}
  923. if (dgvSettlRecord.RowCount <= 0)
  924. {
  925. MessageBox.Show("请先查询结算数据!");
  926. return;
  927. }
  928. try
  929. {
  930. int i = dgvSettlRecord.CurrentRow.Index;
  931. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  932. Global.pat.admType = int.Parse(dgvSettlRecord.Rows[i].Cells["admType"].Value.ToString());
  933. string AdmID = dt.Rows[i]["AdmID"].ToString();
  934. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  935. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  936. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  937. string BillType = dt.Rows[i]["BillType"].ToString();
  938. JObject joRtn = GetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag, BillType);
  939. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  940. {
  941. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  942. return;
  943. }
  944. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  945. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  946. {
  947. MessageBox.Show("调用FastReport设计失败!" + errMsg);
  948. return;
  949. }
  950. }
  951. catch (Exception ex)
  952. {
  953. MessageBox.Show(ex.Message);
  954. return;
  955. }
  956. }
  957. private void SettlementChecklist_FormClosed(object sender, FormClosedEventArgs e)
  958. {
  959. Dispose();
  960. }
  961. //市医保进销存992001结算信息上传
  962. private void JXCJSToolStripMenuItem_Click(object sender, EventArgs e)
  963. {
  964. if (dgvSettlRecord.RowCount <= 0)
  965. {
  966. MessageBox.Show("请先查询结算数据!");
  967. return;
  968. }
  969. string sqlStr;
  970. try
  971. {
  972. int m = dgvSettlRecord.CurrentRow.Index;
  973. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  974. string msgid = dt.Rows[m]["msgid"].ToString();
  975. string SettlementID = dt.Rows[m]["SettlementID"].ToString();
  976. string ValidFlag = dt.Rows[m]["ValidFlag"].ToString();
  977. string MdtrtID = dt.Rows[m]["MdtrtID"].ToString();
  978. string BillType = dt.Rows[m]["BillType"].ToString();
  979. string AdmID= dt.Rows[m]["AdmID"].ToString();
  980. string billID = dt.Rows[m]["billID"].ToString();
  981. string recordID = dt.Rows[m]["recordID"].ToString();
  982. Global.pat.adm_Dr = int.Parse(AdmID);
  983. Global.pat.billID = billID;
  984. Global.pat.recordID = recordID;
  985. if (BillType == "-1")
  986. {
  987. MessageBox.Show("请选择结算正记录!该记录为退费记录");
  988. }
  989. sqlStr = "SELECT * FROM BS_MedInsuTransactionLog WHERE MSGID='" + msgid + "'";
  990. JObject joSqlstr = new JObject();
  991. joSqlstr.Add("sqlStr", sqlStr);
  992. JObject joRtn = mIS.QueryTransactionLog(joSqlstr);
  993. if (joRtn["result"]["data"].ToString() == "[]")
  994. {
  995. MessageBox.Show("查询结果为空!");
  996. return;
  997. }
  998. //DataTable dtlog = (DataTable)joRtn["result"]["data"][0].ToObject(typeof(DataTable));
  999. JObject Outlog = JObject.Parse(joRtn["result"]["data"][0]["OutparamPlain"].ToString());
  1000. dynamic setlinfo = new JObject();//结算信息节点
  1001. setlinfo.setl_id = Outlog["setl_id"];//结算ID
  1002. setlinfo.mdtrt_id = Outlog["mdtrt_id"];//就诊ID
  1003. setlinfo.psn_no = Outlog["psn_no"];//人员编号
  1004. setlinfo.psn_name = Outlog["psn_name"];//人员姓名
  1005. setlinfo.psn_cert_type = Outlog["psn_cert_type"];//凭证类型
  1006. setlinfo.certno = Outlog["certno"];//证件号码
  1007. setlinfo.gend = Outlog["gend"];//性别
  1008. setlinfo.naty = Outlog["naty"];//民族
  1009. setlinfo.brdy = Outlog["brdy"];//出生日期
  1010. setlinfo.age = Outlog["age"];//年龄
  1011. setlinfo.insutype = Outlog["insutype"];//险种类型
  1012. setlinfo.psn_type = Outlog["psn_type"];//人员类别
  1013. setlinfo.cvlserv_flag = Outlog["cvlserv_flag"];//公务员标志
  1014. setlinfo.setl_time = Outlog["setl_time"];//结算时间
  1015. setlinfo.mdtrt_cert_type = Outlog["mdtrt_cert_type"];//就诊凭证类型
  1016. setlinfo.med_type = Outlog["med_type"];//医疗类别
  1017. setlinfo.medfee_sumamt = Outlog["medfee_sumamt"];//医疗费总额
  1018. setlinfo.fulamt_ownpay_amt = Outlog["fulamt_ownpay_amt"];//全自费金额
  1019. setlinfo.overlmt_selfpay = Outlog["overlmt_selfpay"];//超限价自费费用
  1020. setlinfo.preselfpay_amt = Outlog["preselfpay_amt"];//先行自付金额
  1021. setlinfo.inscp_scp_amt = Outlog["inscp_scp_amt"];//符合政策范围金额
  1022. setlinfo.act_pay_dedc = Outlog["act_pay_dedc"];//实际支付起付线
  1023. setlinfo.hifp_pay = Outlog["hifp_pay"];//基本医疗保险统筹基金支出
  1024. setlinfo.pool_prop_selfpay = Outlog["pool_prop_selfpay"];//基本医疗保险统筹基金支付比例
  1025. setlinfo.cvlserv_pay = Outlog["cvlserv_pay"];//公务员医疗补助资金支出
  1026. setlinfo.hifes_pay = Outlog["hifes_pay"];//企业补充医疗保险基金支出
  1027. setlinfo.hifmi_pay = Outlog["hifmi_pay"];//居民大病保险资金支出
  1028. setlinfo.hifob_pay = Outlog["hifob_pay"];//职工大额医疗费用补助基金支出
  1029. setlinfo.maf_pay = Outlog["maf_pay"];//医疗救助基金支出
  1030. setlinfo.oth_pay = Outlog["oth_pay"];//结算ID
  1031. setlinfo.fund_pay_sumamt = Outlog["fund_pay_sumamt"];//基金支付总额
  1032. setlinfo.psn_part_amt = Outlog["psn_part_amt"];//个人负担总金额
  1033. setlinfo.acct_pay = Outlog["acct_pay"];//个人账户支出
  1034. setlinfo.psn_cash_pay = Outlog["psn_cash_pay"];//个人现金支出
  1035. setlinfo.balc = Outlog["balc"];//余额
  1036. setlinfo.acct_mulaid_pay = Outlog["acct_mulaid_pay"];//个人账户共济支付金额
  1037. setlinfo.medins_setl_id = Outlog["medins_setl_id"];//医药机构结算结算ID
  1038. setlinfo.clr_optins = Outlog["clr_optins"];//clr_optins
  1039. setlinfo.clr_way = Outlog["clr_way"];//clr_way
  1040. setlinfo.clr_type = Outlog["clr_type"];//clr_type
  1041. setlinfo.exp_content = Outlog["exp_content"];//exp_content
  1042. setlinfo.hosp_part_amt = Outlog["hosp_part_amt"];//医院负担金额
  1043. setlinfo.hifdm_pay = 0;//伤残人员医疗保障基金支出
  1044. //string outParam = "";
  1045. ////获取IS费用
  1046. //if (hIS.getHisFee(Global.pat, out outParam) != 0)
  1047. //{
  1048. // MessageBox.Show("获取HIS费用失败");
  1049. //}
  1050. ////调用医保平台转换HIS费用(转换医保编码等)
  1051. //JObject joHisFee = JObject.Parse(outParam);
  1052. //if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  1053. //{
  1054. // MessageBox.Show("获取HIS费用医保对照关系失败");
  1055. //}
  1056. //JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  1057. // JObject jaFeeOne=new JObject();
  1058. //for (int i = 0; i < jaFeeDetail.Count; i++)
  1059. //{
  1060. // jaFeeOne.Add("feedetl_sn", jaFeeDetail[i]["feedetl_sn"]);//费用明细流水号
  1061. // jaFeeOne.Add("rxno", "");//处方号
  1062. // if (string.IsNullOrEmpty(jaFeeDetail[i]["rx_circ_flag"].ToString()))
  1063. // {
  1064. // jaFeeOne.Add("rx_circ_flag", "");//外购处方标志
  1065. // }
  1066. // else
  1067. // {
  1068. // jaFeeOne.Add("rx_circ_flag", jaFeeDetail[i]["rx_circ_flag"]);//外购处方标志
  1069. // }
  1070. // jaFeeOne.Add("fee_ocur_time", jaFeeDetail[i]["fee_ocur_time"]);
  1071. // jaFeeOne.Add("med_list_codg", jaFeeDetail[i]["med_list_codg"]);
  1072. // jaFeeOne.Add("medins_list_codg", jaFeeDetail[i]["medins_list_codg"]);
  1073. // jaFeeOne.Add("medins_list_name", jaFeeDetail[i]["medins_list_desc"]);
  1074. // jaFeeOne.Add("prodname", jaFeeDetail[i]["medins_list_desc"]);
  1075. // if (string.IsNullOrEmpty(jaFeeDetail[i]["spec"].ToString()))
  1076. // {
  1077. // jaFeeOne.Add("spec", "");
  1078. // }
  1079. // else
  1080. // {
  1081. // jaFeeOne.Add("spec", jaFeeDetail[i]["spec"]);
  1082. // }
  1083. // if (string.IsNullOrEmpty(jaFeeDetail[i]["doseForm"].ToString()))
  1084. // {
  1085. // jaFeeOne.Add("dosform_name", "");
  1086. // }
  1087. // else
  1088. // {
  1089. // jaFeeOne.Add("dosform_name", jaFeeDetail[i]["doseForm"]);
  1090. // }
  1091. // jaFeeOne.Add(" det_item_fee_sumamt", jaFeeDetail[i]["det_item_fee_sumamt"]);
  1092. // jaFeeOne.Add("cnt", jaFeeDetail[i]["cnt"]);
  1093. // jaFeeOne.Add("pric", jaFeeDetail[i]["pric"]);
  1094. // if (string.IsNullOrEmpty(jaFeeDetail[i]["sin_dos_dscr"].ToString()))
  1095. // {
  1096. // jaFeeOne.Add("sin_dos_dscr", "");
  1097. // }
  1098. // else
  1099. // {
  1100. // jaFeeOne.Add("sin_dos_dscr", jaFeeDetail[i]["sin_dos_dscr"]);
  1101. // }
  1102. // if (string.IsNullOrEmpty(jaFeeDetail[i]["used_frqu_dscr"].ToString()))
  1103. // {
  1104. // jaFeeOne.Add("used_frqu_dscr", "");
  1105. // }
  1106. // else
  1107. // {
  1108. // jaFeeOne.Add("used_frqu_dscr", jaFeeDetail[i]["used_frqu_dscr"]);
  1109. // }
  1110. // if (string.IsNullOrEmpty(jaFeeDetail[i]["prd_days"].ToString()))
  1111. // {
  1112. // jaFeeOne.Add("prd_days", "");
  1113. // }
  1114. // else
  1115. // {
  1116. // jaFeeOne.Add("prd_days", jaFeeDetail[i]["prd_days"]);
  1117. // }
  1118. // MessageBox.Show("555");
  1119. // if (string.IsNullOrEmpty(jaFeeDetail[i]["medc_way_dscr"].ToString()))
  1120. // {
  1121. // jaFeeOne.Add("medc_way_dscr", "");
  1122. // }
  1123. // else
  1124. // {
  1125. // jaFeeOne.Add("medc_way_dscr", jaFeeDetail[i]["medc_way_dscr"]);
  1126. // }
  1127. // if (string.IsNullOrEmpty(jaFeeDetail[i]["bilg_dr_codg"].ToString()))
  1128. // {
  1129. // jaFeeOne.Add("bilg_dr_codg", "");
  1130. // }
  1131. // else
  1132. // {
  1133. // jaFeeOne.Add("bilg_dr_codg", jaFeeDetail[i]["bilg_dr_codg"]);
  1134. // }
  1135. // if (string.IsNullOrEmpty(jaFeeDetail[i]["bilg_dr_name"].ToString()))
  1136. // {
  1137. // jaFeeOne.Add("bilg_dr_name", "");
  1138. // }
  1139. // else
  1140. // {
  1141. // jaFeeOne.Add("bilg_dr_name", jaFeeDetail[i]["bilg_dr_name"]);
  1142. // }
  1143. // MessageBox.Show("666");
  1144. // jaFeeOne.Add("phar_name", "");
  1145. // jaFeeOne.Add("phar_prac_cert_no", "");
  1146. // jaFeeOne.Add("tcmdrug_used_way", ""); //中药使用方式 1复方 2单方 必填
  1147. // jaFeeOne.Add("trdn_flag", "1");//拆零标志 必填 0否 1是
  1148. // jaFeeDetail.Add(jaFeeOne);
  1149. // jaFeeOne = new JObject();
  1150. // MessageBox.Show("777");
  1151. //}
  1152. JObject Jo992001 = new JObject();
  1153. //Jo992001.Add("setlinfo",JObject.Parse(setlinfo));//结算信息节点
  1154. Jo992001.Add("setlinfo", setlinfo);//结算信息节点
  1155. //Jo992001.Add("drugdetail", jaFeeDetail);//购药明细节点
  1156. JObject OutJo = invoker.invokeCenterServiceJXC("992001", JObject.Parse(JsonHelper.setCenterInpar("992001", Jo992001)));
  1157. MessageBox.Show("上传成功!!!,上传返回:" + OutJo.ToString());
  1158. }
  1159. catch (Exception ex)
  1160. {
  1161. MessageBox.Show(ex.Message);
  1162. return;
  1163. }
  1164. }
  1165. private void SYBJXCTFToolStripMenuItem_Click(object sender, EventArgs e)
  1166. {
  1167. if (dgvSettlRecord.RowCount <= 0)
  1168. {
  1169. MessageBox.Show("请先查询结算数据!");
  1170. return;
  1171. }
  1172. string sqlStr;
  1173. try
  1174. {
  1175. int m = dgvSettlRecord.CurrentRow.Index;
  1176. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  1177. string msgid = dt.Rows[m]["msgid"].ToString();
  1178. string SettlementID = dt.Rows[m]["SettlementID"].ToString();
  1179. string ValidFlag = dt.Rows[m]["ValidFlag"].ToString();
  1180. string MdtrtID = dt.Rows[m]["MdtrtID"].ToString();
  1181. string BillType = dt.Rows[m]["BillType"].ToString();
  1182. string AdmID = dt.Rows[m]["AdmID"].ToString();
  1183. string billID = dt.Rows[m]["billID"].ToString();
  1184. string recordID = dt.Rows[m]["recordID"].ToString();
  1185. Global.pat.adm_Dr = int.Parse(AdmID);
  1186. Global.pat.billID = billID;
  1187. Global.pat.recordID = recordID;
  1188. if (BillType == "1")
  1189. {
  1190. MessageBox.Show("请选择退费负记录!该记录为正交易记录");
  1191. }
  1192. sqlStr = "SELECT * FROM BS_MedInsuTransactionLog WHERE MSGID='" + msgid + "'";
  1193. JObject joSqlstr = new JObject();
  1194. joSqlstr.Add("sqlStr", sqlStr);
  1195. JObject joRtn = mIS.QueryTransactionLog(joSqlstr);
  1196. if (joRtn["result"]["data"].ToString() == "[]")
  1197. {
  1198. MessageBox.Show("查询结果为空!");
  1199. return;
  1200. }
  1201. //DataTable dtlog = (DataTable)joRtn["result"]["data"][0].ToObject(typeof(DataTable));
  1202. JObject Outlog = JObject.Parse(joRtn["result"]["data"][0]["OutparamPlain"].ToString());
  1203. dynamic setlinfo = new JObject();//结算信息节点
  1204. setlinfo.setl_id = Outlog["output"]["setlinfo"]["setl_id"];//结算ID
  1205. setlinfo.init_setl_id = "";//原结算ID
  1206. setlinfo.setl_time = Outlog["output"]["setlinfo"]["setl_time"];//结算退费时间
  1207. setlinfo.mdtrt_id = Outlog["output"]["setlinfo"]["mdtrt_id"];//就诊ID
  1208. setlinfo.psn_no = Outlog["output"]["setlinfo"]["psn_no"];//人员编号
  1209. setlinfo.exp_content = "";
  1210. string mdtrt_id = Outlog["output"]["setlinfo"]["mdtrt_id"].ToString();
  1211. sqlStr = "SELECT * FROM BS_MedInsuSettlement WHERE billType = 1 ";
  1212. sqlStr = sqlStr + " AND Hospital_Dr=" + Global.inf.hospitalDr + " AND Interface_Dr=" + Global.inf.interfaceDr;
  1213. sqlStr = sqlStr + " AND MdtrtID ='" + mdtrt_id + "'";
  1214. JObject joSql = new JObject();
  1215. joSql.Add("sqlStr", sqlStr);
  1216. JObject joSettlInfo = mIS.QuerySettlementInfo(joSql);
  1217. //查询结算信息
  1218. JObject Outpam = JObject.Parse(joSettlInfo["result"]["data"][0].ToString());
  1219. setlinfo.init_setl_id = Outpam["SettlementID"];//ADMID
  1220. setlinfo.psn_no = Outpam["PersonnelNO"];
  1221. JObject joParam992002 = new JObject();
  1222. joParam992002.Add("data", setlinfo);//结算信息节点
  1223. JObject OutJo = invoker.invokeCenterServiceJXC("992002", JObject.Parse(JsonHelper.setCenterInpar("992002", joParam992002)));
  1224. MessageBox.Show("上传成功+"+ OutJo.ToString());
  1225. }
  1226. catch (Exception ex)
  1227. {
  1228. MessageBox.Show(ex.Message);
  1229. return;
  1230. }
  1231. }
  1232. private void FYMXToolStripMenuItem_Click(object sender, EventArgs e)
  1233. {
  1234. if (dgvSettlRecord.RowCount <= 0)
  1235. {
  1236. MessageBox.Show("请先查询结算数据!");
  1237. return;
  1238. }
  1239. string sqlStr;
  1240. try
  1241. {
  1242. int m = dgvSettlRecord.CurrentRow.Index;
  1243. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  1244. string msgid = dt.Rows[m]["msgid"].ToString();
  1245. string SettlementID = dt.Rows[m]["SettlementID"].ToString();
  1246. string ValidFlag = dt.Rows[m]["ValidFlag"].ToString();
  1247. string MdtrtID = dt.Rows[m]["MdtrtID"].ToString();
  1248. string BillType = dt.Rows[m]["BillType"].ToString();
  1249. string AdmID = dt.Rows[m]["AdmID"].ToString();
  1250. string billID = dt.Rows[m]["billID"].ToString();
  1251. string recordID = dt.Rows[m]["recordID"].ToString();
  1252. Global.pat.adm_Dr = int.Parse(AdmID);
  1253. Global.pat.billID = billID;
  1254. Global.pat.recordID = recordID;
  1255. //if (BillType == "-1")
  1256. //{
  1257. // MessageBox.Show("请选择结算正记录!该记录为退费记录");
  1258. //}
  1259. sqlStr = "SELECT * FROM BS_MedInsuTransactionLog WHERE MSGID='" + msgid + "'";
  1260. JObject joSqlstr = new JObject();
  1261. joSqlstr.Add("sqlStr", sqlStr);
  1262. JObject joRtn = mIS.QueryTransactionLog(joSqlstr);
  1263. if (joRtn["result"]["data"].ToString() == "[]")
  1264. {
  1265. MessageBox.Show("查询结果为空!");
  1266. return;
  1267. }
  1268. //DataTable dtlog = (DataTable)joRtn["result"]["data"][0].ToObject(typeof(DataTable));
  1269. JObject Outlog = JObject.Parse(joRtn["result"]["data"][0]["OutparamPlain"].ToString());
  1270. dynamic setlinfo = new JObject();//结算信息节点
  1271. setlinfo.setl_id = Outlog["output"]["setlinfo"]["setl_id"];//结算ID
  1272. //setlinfo.mdtrt_id = Outlog["output"]["setlinfo"]["mdtrt_id"];//就诊ID
  1273. //setlinfo.psn_no = Outlog["output"]["setlinfo"]["psn_no"];//人员编号
  1274. //setlinfo.psn_name = Outlog["output"]["setlinfo"]["psn_name"];//人员姓名
  1275. //setlinfo.psn_cert_type = Outlog["output"]["setlinfo"]["psn_cert_type"];//凭证类型
  1276. //setlinfo.certno = Outlog["output"]["setlinfo"]["certno"];//证件号码
  1277. //setlinfo.gend = Outlog["output"]["setlinfo"]["gend"];//性别
  1278. //setlinfo.naty = Outlog["output"]["setlinfo"]["naty"];//民族
  1279. //setlinfo.brdy = Outlog["output"]["setlinfo"]["brdy"];//出生日期
  1280. //setlinfo.age = Outlog["output"]["setlinfo"]["age"];//年龄
  1281. //setlinfo.insutype = Outlog["output"]["setlinfo"]["insutype"];//险种类型
  1282. //setlinfo.psn_type = Outlog["output"]["setlinfo"]["psn_type"];//人员类别
  1283. //setlinfo.cvlserv_flag = Outlog["output"]["setlinfo"]["cvlserv_flag"];//公务员标志
  1284. setlinfo.setl_time = Outlog["output"]["setlinfo"]["setl_time"];//结算时间
  1285. //setlinfo.mdtrt_cert_type = Outlog["output"]["setlinfo"]["mdtrt_cert_type"];//就诊凭证类型
  1286. //setlinfo.med_type = Outlog["output"]["setlinfo"]["med_type"];//医疗类别
  1287. //setlinfo.medfee_sumamt = Outlog["output"]["setlinfo"]["medfee_sumamt"];//医疗费总额
  1288. //setlinfo.fulamt_ownpay_amt = Outlog["output"]["setlinfo"]["fulamt_ownpay_amt"];//全自费金额
  1289. //setlinfo.overlmt_selfpay = Outlog["output"]["setlinfo"]["overlmt_selfpay"];//超限价自费费用
  1290. //setlinfo.preselfpay_amt = Outlog["output"]["setlinfo"]["preselfpay_amt"];//先行自付金额
  1291. //setlinfo.inscp_scp_amt = Outlog["output"]["setlinfo"]["inscp_scp_amt"];//符合政策范围金额
  1292. //setlinfo.act_pay_dedc = Outlog["output"]["setlinfo"]["act_pay_dedc"];//实际支付起付线
  1293. //setlinfo.hifp_pay = Outlog["output"]["setlinfo"]["hifp_pay"];//基本医疗保险统筹基金支出
  1294. //setlinfo.pool_prop_selfpay = Outlog["output"]["setlinfo"]["pool_prop_selfpay"];//基本医疗保险统筹基金支付比例
  1295. //setlinfo.cvlserv_pay = Outlog["output"]["setlinfo"]["cvlserv_pay"];//公务员医疗补助资金支出
  1296. //setlinfo.hifes_pay = Outlog["output"]["setlinfo"]["hifes_pay"];//企业补充医疗保险基金支出
  1297. //setlinfo.hifmi_pay = Outlog["output"]["setlinfo"]["hifmi_pay"];//居民大病保险资金支出
  1298. //setlinfo.hifob_pay = Outlog["output"]["setlinfo"]["hifob_pay"];//职工大额医疗费用补助基金支出
  1299. //setlinfo.maf_pay = Outlog["output"]["setlinfo"]["maf_pay"];//医疗救助基金支出
  1300. //setlinfo.oth_pay = Outlog["output"]["setlinfo"]["oth_pay"];//结算ID
  1301. //setlinfo.fund_pay_sumamt = Outlog["output"]["setlinfo"]["fund_pay_sumamt"];//基金支付总额
  1302. //setlinfo.psn_part_amt = Outlog["output"]["setlinfo"]["psn_part_amt"];//个人负担总金额
  1303. //setlinfo.acct_pay = Outlog["output"]["setlinfo"]["acct_pay"];//个人账户支出
  1304. //setlinfo.psn_cash_pay = Outlog["output"]["setlinfo"]["psn_cash_pay"];//个人现金支出
  1305. //setlinfo.balc = Outlog["output"]["setlinfo"]["balc"];//余额
  1306. //setlinfo.acct_mulaid_pay = Outlog["output"]["setlinfo"]["acct_mulaid_pay"];//个人账户共济支付金额
  1307. //setlinfo.medins_setl_id = Outlog["output"]["setlinfo"]["medins_setl_id"];//医药机构结算结算ID
  1308. //setlinfo.clr_optins = Outlog["output"]["setlinfo"]["clr_optins"];//clr_optins
  1309. //setlinfo.clr_way = Outlog["output"]["setlinfo"]["clr_way"];//clr_way
  1310. //setlinfo.clr_type = Outlog["output"]["setlinfo"]["clr_type"];//clr_type
  1311. //// setlinfo.exp_content = Outlog["output"]["setlinfo"]["exp_content"];//exp_content
  1312. //setlinfo.exp_content = "";//exp_content
  1313. //setlinfo.hosp_part_amt = Outlog["output"]["setlinfo"]["hosp_part_amt"];//医院负担金额
  1314. //setlinfo.hifdm_pay = 0;//伤残人员医疗保障基金支出
  1315. string outParam = "";
  1316. //获取IS费用
  1317. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  1318. {
  1319. MessageBox.Show("获取HIS费用失败");
  1320. }
  1321. //调用医保平台转换HIS费用(转换医保编码等)
  1322. JObject joHisFee = JObject.Parse(outParam);
  1323. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  1324. {
  1325. MessageBox.Show("获取HIS费用医保对照关系失败");
  1326. }
  1327. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  1328. JArray jaFeeDetail1 = new JArray();
  1329. ; JObject jaFeeOne = new JObject();
  1330. for (int k = 0; k < jaFeeDetail.Count; k++)
  1331. { if (!(jaFeeDetail[k]["med_list_codg"].ToString().Substring(0, 1) == "X" || jaFeeDetail[k]["med_list_codg"].ToString().Substring(0, 1) == "Z")) continue;
  1332. jaFeeOne.Add("feedetl_sn", jaFeeDetail[k]["feedetl_sn"]);//费用明细流水号
  1333. jaFeeOne.Add("rxno", "");//处方号
  1334. if (string.IsNullOrEmpty(jaFeeDetail[k]["rx_circ_flag"].ToString()))
  1335. {
  1336. jaFeeOne.Add("rx_circ_flag", "0");//外购处方标志
  1337. }
  1338. else
  1339. {
  1340. jaFeeOne.Add("rx_circ_flag", jaFeeDetail[k]["rx_circ_flag"].ToString());//外购处方标志
  1341. }
  1342. if (BillType == "-1")
  1343. {
  1344. jaFeeOne.Add("fee_ocur_time", setlinfo.setl_time);
  1345. }
  1346. else{
  1347. jaFeeOne.Add("fee_ocur_time", jaFeeDetail[k]["fee_ocur_time"]);
  1348. }
  1349. jaFeeOne.Add("med_list_codg", jaFeeDetail[k]["med_list_codg"]);
  1350. jaFeeOne.Add("medins_list_codg", jaFeeDetail[k]["medins_list_codg"]);
  1351. jaFeeOne.Add("medins_list_name", jaFeeDetail[k]["medins_list_desc"]);
  1352. jaFeeOne.Add("prodname", jaFeeDetail[k]["medins_list_desc"]);
  1353. if (string.IsNullOrEmpty(jaFeeDetail[k]["spec"].ToString()))
  1354. {
  1355. jaFeeOne.Add("spec", "");
  1356. }
  1357. else
  1358. {
  1359. jaFeeOne.Add("spec", jaFeeDetail[k]["spec"]);
  1360. }
  1361. if (string.IsNullOrEmpty(jaFeeDetail[k]["doseForm"].ToString()))
  1362. {
  1363. jaFeeOne.Add("dosform_name", "");
  1364. }
  1365. else
  1366. {
  1367. jaFeeOne.Add("dosform_name", jaFeeDetail[k]["doseForm"]);
  1368. }
  1369. jaFeeOne.Add("det_item_fee_sumamt", decimal.Parse(jaFeeDetail[k]["det_item_fee_sumamt"].ToString()));
  1370. jaFeeOne.Add("cnt", decimal.Parse(jaFeeDetail[k]["cnt"].ToString()));
  1371. jaFeeOne.Add("pric", decimal.Parse(jaFeeDetail[k]["pric"].ToString()));
  1372. if (string.IsNullOrEmpty(jaFeeDetail[k]["sin_dos_dscr"].ToString()))
  1373. {
  1374. jaFeeOne.Add("sin_dos_dscr", "");
  1375. }
  1376. else
  1377. {
  1378. jaFeeOne.Add("sin_dos_dscr", jaFeeDetail[k]["sin_dos_dscr"]);
  1379. }
  1380. if (string.IsNullOrEmpty(jaFeeDetail[k]["used_frqu_dscr"].ToString()))
  1381. {
  1382. jaFeeOne.Add("used_frqu_dscr", "");
  1383. }
  1384. else
  1385. {
  1386. jaFeeOne.Add("used_frqu_dscr", jaFeeDetail[k]["used_frqu_dscr"]);
  1387. }
  1388. if (string.IsNullOrEmpty(jaFeeDetail[k]["prd_days"].ToString()))
  1389. {
  1390. jaFeeOne.Add("prd_days", 1);
  1391. }
  1392. else
  1393. {
  1394. jaFeeOne.Add("prd_days", decimal.Parse(jaFeeDetail[k]["prd_days"].ToString()));
  1395. }
  1396. MessageBox.Show("555");
  1397. if (string.IsNullOrEmpty(jaFeeDetail[k]["medc_way_dscr"].ToString()))
  1398. {
  1399. jaFeeOne.Add("medc_way_dscr", "");
  1400. }
  1401. else
  1402. {
  1403. jaFeeOne.Add("medc_way_dscr", jaFeeDetail[k]["medc_way_dscr"]);
  1404. }
  1405. if (string.IsNullOrEmpty(jaFeeDetail[k]["bilg_dr_codg"].ToString()))
  1406. {
  1407. jaFeeOne.Add("bilg_dr_codg", "");
  1408. }
  1409. else
  1410. {
  1411. jaFeeOne.Add("bilg_dr_codg", jaFeeDetail[k]["bilg_dr_codg"]);
  1412. }
  1413. if (string.IsNullOrEmpty(jaFeeDetail[k]["bilg_dr_name"].ToString()))
  1414. {
  1415. jaFeeOne.Add("bilg_dr_name", "");
  1416. }
  1417. else
  1418. {
  1419. jaFeeOne.Add("bilg_dr_name", jaFeeDetail[k]["bilg_dr_name"]);
  1420. }
  1421. MessageBox.Show("666");
  1422. jaFeeOne.Add("phar_name", "");
  1423. jaFeeOne.Add("phar_prac_cert_no", "");
  1424. jaFeeOne.Add("tcmdrug_used_way", "1"); //中药使用方式 1复方 2单方 必填
  1425. jaFeeOne.Add("trdn_flag", joHisFee["result"][k]["outApartFlag"].ToString());//拆零标志 必填 0否 1是
  1426. jaFeeDetail1.Add(jaFeeOne);
  1427. jaFeeOne = new JObject();
  1428. MessageBox.Show("777");
  1429. }
  1430. JObject Jo992004 = new JObject();
  1431. // JObject Jo992001 = new JObject();
  1432. //Jo992001.Add("setlinfo",JObject.Parse(setlinfo));//结算信息节点
  1433. Jo992004.Add("setlinfo", setlinfo);
  1434. Jo992004.Add("drugdetail", jaFeeDetail1);//结算信息节点
  1435. //Jo992001.Add("drugdetail", jaFeeDetail);//购药明细节点
  1436. MessageBox.Show("上传开始:" + Jo992004.ToString());
  1437. JObject OutJo = invoker.invokeCenterServiceJXC("9920004", JObject.Parse(JsonHelper.setCenterInpar("992004", Jo992004)));
  1438. MessageBox.Show("上传返回:" + OutJo.ToString());
  1439. }
  1440. catch (Exception ex)
  1441. {
  1442. MessageBox.Show(ex.Message);
  1443. return;
  1444. }
  1445. }
  1446. private void cityDesignToolStripMenuItem_Click(object sender, EventArgs e)
  1447. {
  1448. //try
  1449. //{
  1450. // Thread thread = new Thread(new ThreadStart(design));
  1451. // thread.SetApartmentState(ApartmentState.STA); //重点
  1452. // thread.Start();
  1453. // thread.Join();
  1454. //}
  1455. //catch (Exception ex)
  1456. //{
  1457. // Global.writeLog("结算单设计预览异常:" + ex.Message);
  1458. // MessageBox.Show("设计预览异常:" + ex.Message);
  1459. //}
  1460. if (dgvSettlRecord.RowCount <= 0)
  1461. {
  1462. MessageBox.Show("请先查询结算数据!");
  1463. return;
  1464. }
  1465. try
  1466. {
  1467. int i = dgvSettlRecord.CurrentRow.Index;
  1468. DataTable dt = (DataTable)dgvSettlRecord.DataSource;
  1469. Global.pat.admType = int.Parse(dgvSettlRecord.Rows[i].Cells["admType"].Value.ToString());
  1470. string AdmID = dt.Rows[i]["AdmID"].ToString();
  1471. string SettlementID = dt.Rows[i]["SettlementID"].ToString();
  1472. string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
  1473. string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
  1474. string BillType = dt.Rows[i]["BillType"].ToString();
  1475. JObject pJoInparm= new JObject();
  1476. pJoInparm.Add("MdtrtCertType", dt.Rows[i]["MdtrtCertType"].ToString());
  1477. JObject joRtn = cityGetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag, BillType, pJoInparm);
  1478. if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
  1479. {
  1480. MessageBox.Show("获取FastReport入参失败:" + errMsg);
  1481. return;
  1482. }
  1483. string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
  1484. if (FastReportPrint(sFastReportParam, out errMsg) != 0)
  1485. {
  1486. MessageBox.Show("调用FastReport设计失败!" + errMsg);
  1487. return;
  1488. }
  1489. }
  1490. catch (Exception ex)
  1491. {
  1492. MessageBox.Show(ex.Message);
  1493. return;
  1494. }
  1495. }
  1496. private void cityToolStripMenuItem_Click(object sender, EventArgs e)
  1497. {
  1498. string errorMsg;
  1499. int iHis = dgvSettlRecord.CurrentRow.Index;
  1500. String BType = dgvSettlRecord.Rows[iHis].Cells["BillType"].Value.ToString();
  1501. Global.pat.admType = int.Parse(dgvSettlRecord.Rows[iHis].Cells["admType"].Value.ToString());
  1502. JObject joData = new JObject();
  1503. joData.Add("mdtrt_id", dgvSettlRecord.Rows[iHis].Cells["MdtrtID"].Value.ToString());
  1504. joData.Add("setl_id", dgvSettlRecord.Rows[iHis].Cells["SettlementID"].Value.ToString());
  1505. joData.Add("psn_no", dgvSettlRecord.Rows[iHis].Cells["PersonnelNO"].Value.ToString());
  1506. joData.Add("med_type", dgvSettlRecord.Rows[iHis].Cells["MedicalType"].Value.ToString());
  1507. JObject joInput = new JObject();
  1508. joInput.Add("data", joData);
  1509. Global.pat.insuplc_admdvs = dgvSettlRecord.Rows[iHis].Cells["insuplc_admdvs"].Value.ToString();//更新参保地
  1510. #region【调用FastRepor打印】
  1511. try
  1512. {
  1513. //Thread thread = new Thread(new ThreadStart(print));
  1514. //thread.SetApartmentState(ApartmentState.STA); //重点
  1515. //thread.Start();
  1516. //thread.Join();
  1517. cityPrint();
  1518. }
  1519. catch (Exception ex)
  1520. {
  1521. Global.writeLog("结算单打印异常:" + ex.Message);
  1522. MessageBox.Show("打印异常:" + ex.Message);
  1523. }
  1524. #endregion
  1525. }
  1526. }
  1527. // Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
  1528. public class Classification
  1529. {
  1530. public string cwfSummat { get; set; }
  1531. public string cwfInScope { get; set; }
  1532. public string cwfPreSelfPay { get; set; }
  1533. public string cwfOverLimit { get; set; }
  1534. public string cwfFullOwnPay { get; set; }
  1535. public string zcfSummat { get; set; }
  1536. public string zcfInScope { get; set; }
  1537. public string zcfPreSelfPay { get; set; }
  1538. public string zcfOverLimit { get; set; }
  1539. public string zcfFullOwnPay { get; set; }
  1540. public string jcfSummat { get; set; }
  1541. public string jcfInScope { get; set; }
  1542. public string jcfPreSelfPay { get; set; }
  1543. public string jcfOverLimit { get; set; }
  1544. public string jcfFullOwnPay { get; set; }
  1545. public string hyfSummat { get; set; }
  1546. public string hyfInScope { get; set; }
  1547. public string hyfPreSelfPay { get; set; }
  1548. public string hyfOverLimit { get; set; }
  1549. public string hyfFullOwnPay { get; set; }
  1550. public string zlfSummat { get; set; }
  1551. public string zlfInScope { get; set; }
  1552. public string zlfPreSelfPay { get; set; }
  1553. public string zlfOverLimit { get; set; }
  1554. public string zlfFullOwnPay { get; set; }
  1555. public string ssfSummat { get; set; }
  1556. public string ssfInScope { get; set; }
  1557. public string ssfPreSelfPay { get; set; }
  1558. public string ssfOverLimit { get; set; }
  1559. public string ssfFullOwnPay { get; set; }
  1560. public string hlfSummat { get; set; }
  1561. public string hlfInScope { get; set; }
  1562. public string hlfPreSelfPay { get; set; }
  1563. public string hlfOverLimit { get; set; }
  1564. public string hlfFullOwnPay { get; set; }
  1565. public string wsclfSummat { get; set; }
  1566. public string wsclfInScope { get; set; }
  1567. public string wsclfPreSelfPay { get; set; }
  1568. public string wsclfOverLimit { get; set; }
  1569. public string wsclfFullOwnPay { get; set; }
  1570. public string xyfSummat { get; set; }
  1571. public string xyfInScope { get; set; }
  1572. public string xyfPreSelfPay { get; set; }
  1573. public string xyfOverLimit { get; set; }
  1574. public string xyfFullOwnPay { get; set; }
  1575. public string zyypfSummat { get; set; }
  1576. public string zyypfInScope { get; set; }
  1577. public string zyypfPreSelfPay { get; set; }
  1578. public string zyypfOverLimit { get; set; }
  1579. public string zyypfFullOwnPay { get; set; }
  1580. public string zcyfSummat { get; set; }
  1581. public string zcyfInScope { get; set; }
  1582. public string zcyfPreSelfPay { get; set; }
  1583. public string zcyfOverLimit { get; set; }
  1584. public string zcyfFullOwnPay { get; set; }
  1585. public string ybzlfSummat { get; set; }
  1586. public string ybzlfInScope { get; set; }
  1587. public string ybzlfPreSelfPay { get; set; }
  1588. public string ybzlfOverLimit { get; set; }
  1589. public string ybzlfFullOwnPay { get; set; }
  1590. public string ghfSummat { get; set; }
  1591. public string ghfInScope { get; set; }
  1592. public string ghfPreSelfPay { get; set; }
  1593. public string ghfOverLimit { get; set; }
  1594. public string ghfFullOwnPay { get; set; }
  1595. public string qtSummat { get; set; }
  1596. public string qtInScope { get; set; }
  1597. public string qtPreSelfPay { get; set; }
  1598. public string qtOverLimit { get; set; }
  1599. public string qtFullOwnPay { get; set; }
  1600. public string totalSummat { get; set; }
  1601. public string totalInScope { get; set; }
  1602. public string totalPreSelfPay { get; set; }
  1603. public string totalOverLimit { get; set; }
  1604. public string totalFullOwnPay { get; set; }
  1605. }
  1606. public class Data
  1607. {
  1608. public List<Classification> classification { get; set; }
  1609. public List<Settlement> settlement { get; set; }
  1610. public List<Reginfo> reginfo { get; set; }
  1611. public List<Patinsuinfo> patinsuinfo { get; set; }
  1612. }
  1613. public class Patinsuinfo
  1614. {
  1615. public string PsnCertType { get; set; }
  1616. public string PsnCertNO { get; set; }
  1617. public string Gend { get; set; }
  1618. public string Naty { get; set; }
  1619. public string Brdy { get; set; }
  1620. public string Age { get; set; }
  1621. public string Balc { get; set; }
  1622. public string PsnType { get; set; }
  1623. public string Cvlservflag { get; set; }
  1624. public string insuplcAdmdvs { get; set; }
  1625. public string EmpName { get; set; }
  1626. public string PsnIdettype { get; set; }
  1627. public string PsnTypeLv { get; set; }
  1628. }
  1629. public class Reginfo
  1630. {
  1631. public string AttendDoctorNO { get; set; }
  1632. public string ChiefPhyDocName { get; set; }
  1633. public string AdmitDepartmentCode { get; set; }
  1634. public string AdmitDepartmentName { get; set; }
  1635. public string AdmBed { get; set; }
  1636. public string MainDiagCode { get; set; }
  1637. public string MainDiagName { get; set; }
  1638. public string RegDate { get; set; }
  1639. public string ConerName { get; set; }
  1640. public string Tel { get; set; }
  1641. }
  1642. public class Result
  1643. {
  1644. public Data data { get; set; }
  1645. }
  1646. public class Root
  1647. {
  1648. public Result result { get; set; }
  1649. public int errorCode { get; set; }
  1650. public string errorMessage { get; set; }
  1651. }
  1652. public class Settlement
  1653. {
  1654. public string AdmID { get; set; }
  1655. public string MdtrtID { get; set; }
  1656. public string SettlementID { get; set; }
  1657. public string PersonnelNO { get; set; }
  1658. public string PatientName { get; set; }
  1659. public string birth { get; set; }
  1660. public string CertificateNO { get; set; }
  1661. public string Gender { get; set; }
  1662. public string InsuranceType { get; set; }
  1663. public string PersonType { get; set; }
  1664. public string CivilserviceFlag { get; set; }
  1665. public string SettlementTime { get; set; }
  1666. public string MedicalType { get; set; }
  1667. public string Sumamt { get; set; }
  1668. public string OwnPayAmount { get; set; }
  1669. public string OverLimitAmount { get; set; }
  1670. public string PreSelfPayAmount { get; set; }
  1671. public string InPolicyRangeAmount { get; set; }
  1672. public double ActualPayDeductible { get; set; }
  1673. public string HealthInsurancePay { get; set; }
  1674. public string HealthInsuranceRatio { get; set; }
  1675. public double CivilserviceAllowancePay { get; set; }
  1676. public string EnterpriseSupplementPay { get; set; }
  1677. public string SeriousIllnessPay { get; set; }
  1678. public string LargeExpensesSupplementPay { get; set; }
  1679. public string MedicalAssistPay { get; set; }
  1680. public string HospitalPartAmount { get; set; }
  1681. public string OtherPay { get; set; }
  1682. public string FundPaySumamt { get; set; }
  1683. public string PersonPaySumamt { get; set; }
  1684. public string AccountPaySumamt { get; set; }
  1685. public string PersonCashPay { get; set; }
  1686. public string Balance { get; set; }
  1687. public string AccountMutualAidAmount { get; set; }
  1688. public string OrganSettlementID { get; set; }
  1689. public string ClearingOrgan { get; set; }
  1690. public string ClearingWay { get; set; }
  1691. public string ClearingType { get; set; }
  1692. public string ValidFlag { get; set; }
  1693. public string msgid { get; set; }
  1694. public string HospitalizationsTimes { get; set; }
  1695. public string HospitalizationsDays { get; set; }
  1696. public string HISAdmTime { get; set; }
  1697. public string HISDischargeTime { get; set; }
  1698. public int BillType { get; set; }
  1699. public string BillID { get; set; }
  1700. public string admType { get; set; }
  1701. public string RecordID { get; set; }
  1702. public string insuplc_admdvs { get; set; }
  1703. }
  1704. }