BasicData.cs 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Linq;
  3. using PTMedicalInsurance.Business;
  4. using PTMedicalInsurance.Helper;
  5. using PTMedicalInsurance.Variables;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.IO;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows.Forms;
  16. using PTMedicalInsurance.FormSetter;
  17. using PTMedicalInsurance.Common;
  18. namespace PTMedicalInsurance.Forms
  19. {
  20. public partial class BasicData : Form
  21. {
  22. //设置实例
  23. CenterBusiness cBus = new CenterBusiness();
  24. HisMainBusiness hBus = new HisMainBusiness();
  25. HisIrisServices hIS = new HisIrisServices();
  26. MIIrisServices mIS = new MIIrisServices();
  27. InvokeHelper invoker = new InvokeHelper();
  28. InsuServices Iis = new InsuServices();
  29. //1.声明自适应类实例
  30. AutoResizeForm asc = new AutoResizeForm();
  31. public JObject joSelectedInsuInfo;
  32. public int insuInfoIndex = 0;
  33. public int idInfoIndex = 0;
  34. DataTable dtExport;
  35. public BasicData()
  36. {
  37. InitializeComponent();
  38. rbgDirecType.SelectedIndex = 0;
  39. rbgDirecType_C.SelectedIndex = 0;
  40. rbSingleDown.Checked = true;
  41. this.rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(this.rbgDirecType_ValueChanged);
  42. this.pgDownload.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgDownload_PageChanged);
  43. this.pgCenterDirect.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgCenterDirect_PageChanged);
  44. Font rowFont = new Font("UTF-8", 8);
  45. Font columnFont = new Font("UTF-8", 9);
  46. rbgDirecType.SelectedIndex = 8;
  47. rbAll.Checked = true;
  48. //tabControl1.SelectedIndex = 1;
  49. //this.StartPosition = FormStartPosition.CenterParent;
  50. asc.controllInitializeSize(this);
  51. asc.controlAutoSize(this);
  52. }
  53. #region 函数封装
  54. private void queryInsuDirectory(int currentPage, int pageSize, int directoryType, int interfaceDr, string code)
  55. {
  56. try
  57. {
  58. string dirCode = "";
  59. string dirName = "";
  60. string approvalNO = "";
  61. string manufacturer = "";
  62. Sunny.UI.UIDataGridView dgv;
  63. Sunny.UI.UIPagination pg;
  64. if (tabControl1.SelectedIndex == 0)
  65. {
  66. dirCode = tbDirectoryCode.Text;
  67. dirName = tbDircetoryName.Text;
  68. approvalNO = "";
  69. dgv = dgvDirectoy;
  70. pg = pgDownload;
  71. }
  72. else
  73. {
  74. dirName = tbCenterDirectoryFilter.Text;
  75. dirCode = tbInsuCode.Text;
  76. dgv = dgvCenterDirectory;
  77. approvalNO = tbApprovalNO.Text;
  78. pg = pgCenterDirect;
  79. manufacturer = tbManufacturer.Text;
  80. }
  81. JObject joInput = new JObject {
  82. { "currentPage" , currentPage },
  83. { "pageSize" , pageSize },
  84. { "serviceCode" , code },
  85. { "directoryType" , directoryType },
  86. { "directoryCode" , dirCode },
  87. { "directoryName" , dirName },
  88. { "approvalNO" , approvalNO },
  89. { "manufacturer" , manufacturer },
  90. { "directoryDr" , interfaceDr }
  91. };
  92. JObject joRtn = mIS.getMIDirectoryByPagination(joInput);
  93. if (joRtn["errorCode"].ToString() != "0")
  94. {
  95. MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
  96. return;
  97. }
  98. if (joRtn["result"]["rows"] == null)
  99. {
  100. MessageBox.Show("该节点不存在");
  101. return;
  102. }
  103. if (joRtn["result"]["total"].ToString() == "0")
  104. {
  105. MessageBox.Show("未查询到数据");
  106. dgv.DataSource = null;
  107. return;
  108. }
  109. DataTable dt = (DataTable)joRtn["result"]["rows"].ToObject(typeof(DataTable));
  110. int totalCount = int.Parse(joRtn["result"]["total"].ToString());
  111. pg.TotalCount = totalCount;
  112. pg.PageSize = pageSize;
  113. dgv.DataSource = dt;
  114. dgv.Columns[0].ReadOnly = true;
  115. }
  116. catch (Exception ex)
  117. {
  118. MessageBox.Show("查询异常:" + ex.Message);
  119. }
  120. }
  121. private void setHeaderTxt(int directoryType, Sunny.UI.UIDataGridView dgv)
  122. {
  123. GridViewSetter gvdSetter = new GridViewSetter();
  124. switch (directoryType)
  125. {
  126. case 0://药品
  127. {
  128. gvdSetter.SetHeaderTextOfDrug(dgv);
  129. break;
  130. }
  131. case 1://诊疗
  132. {
  133. gvdSetter.SetHeaderTextOfMedicalService(dgv);
  134. break;
  135. }
  136. case 2://材料
  137. {
  138. gvdSetter.SetHeaderTextOfMaterials(dgv);
  139. break;
  140. }
  141. case 3://疾病诊断
  142. {
  143. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  144. break;
  145. }
  146. case 4://手术
  147. {
  148. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  149. break;
  150. }
  151. case 5://慢性病
  152. {
  153. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  154. break;
  155. }
  156. case 6://DRGs
  157. {
  158. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  159. break; ;
  160. }
  161. case 7://日间手术
  162. {
  163. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  164. break; ;
  165. }
  166. case 8://字典表
  167. {
  168. gvdSetter.SetHeaderTextOfDictionary(dgv);
  169. break;
  170. }
  171. case 9://中药饮片下载
  172. {
  173. gvdSetter.SetHeaderTextOfChineseMedicine(dgv);
  174. break;
  175. }
  176. case 10://医药机构制剂目录下载
  177. {
  178. gvdSetter.SetHeaderTextOfPreparation(dgv);
  179. break;
  180. }
  181. case 11://肿瘤形态学下载
  182. {
  183. gvdSetter.SetHeaderTextOfTumorMorphology(dgv);
  184. break;
  185. }
  186. case 12://中医疾病下载
  187. {
  188. gvdSetter.GetChineseDiagnoseJsonByTxt(dgv);
  189. break;
  190. }
  191. case 13://中医证候下载
  192. {
  193. gvdSetter.GetTCMSyndromeJsonByTxt(dgv);
  194. break;
  195. }
  196. case 14://民族药品
  197. {
  198. gvdSetter.GetEthnicMedicineJsonByTxt(dgv);
  199. break;
  200. }
  201. case 15://目录信息查询
  202. {
  203. gvdSetter.GetMedInsuCatalogJsonByTxt(dgv);
  204. break;
  205. }
  206. case 16://医疗与医保目录匹配关系查询
  207. {
  208. gvdSetter.GetMedInsuCorrespondencJsonByTxt(dgv);
  209. break;
  210. }
  211. case 17://医药机构目录匹配查询
  212. {
  213. gvdSetter.GetMedInstCorrespondencJsonByTxt(dgv);
  214. break;
  215. }
  216. case 18://医保目录限价查询
  217. {
  218. gvdSetter.GetMedInsuFixedPriceJsonByTxt(dgv);
  219. break;
  220. }
  221. case 19://医保目录先自付比例下载
  222. {
  223. gvdSetter.GetMedInsuFirstPayProportionJsonByTxt(dgv);
  224. break;
  225. }
  226. case 20://医药机构信息
  227. {
  228. gvdSetter.GetMedicalInstitutionJsonByTxt(dgv);
  229. break;
  230. }
  231. }
  232. gvdSetter.DatagridviewColumnWidthAdaptation(dgv);
  233. }
  234. private void queryHISInsuDirectory(int directoryType, int pageIndex, int count, Sunny.UI.UIDataGridView dgv, int interfaceDr)
  235. {
  236. string code = "09010042";
  237. //目录下载页面
  238. if (tabControl1.SelectedIndex == 0)
  239. {
  240. if (rbgDirecType.SelectedIndex == 20)
  241. {
  242. code = "090100XX";
  243. }
  244. else if (rbgDirecType.SelectedIndex == 8)
  245. {
  246. code = "09010043";
  247. }
  248. else
  249. {
  250. code = "09010042";
  251. }
  252. if (rbgDirecType.SelectedIndex <= 13)
  253. {
  254. queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
  255. setHeaderTxt(directoryType, dgv);
  256. }
  257. else //几个医保查询该部分数据不存数据库只是临时查询(除医疗机构信息查询外)
  258. {
  259. //生成DataView列
  260. //setHeaderTxt(directoryType, dgv);
  261. string pages, recordCounts, errorMessage, sOutpar;
  262. dynamic joData = GetInput(rbgDirecType.SelectedIndex, out string funNo);
  263. JObject joRtn = cBus.InvokeMedicalInsuranceInquiry(funNo, joData);
  264. if (joRtn["infcode"].ToString() == "0")
  265. {
  266. try
  267. {
  268. Sunny.UI.UIPagination pg;
  269. dgv = dgvDirectoy;
  270. pg = pgDownload;
  271. DataTable dt;
  272. if (rbgDirecType.SelectedIndex == 20)
  273. {
  274. dt = (DataTable)joRtn["output"]["medinsinfo"].ToObject(typeof(DataTable));
  275. if (joRtn["output"]["medinsinfo"].ToString() == "")
  276. {
  277. MessageBox.Show("查询成功,但返回结果集为空!");
  278. //return;
  279. }
  280. pg.TotalCount = 50;
  281. pg.PageSize = 50;
  282. }
  283. else
  284. {
  285. pages = joRtn["output"]["pages"].ToString(); //页数
  286. recordCounts = joRtn["output"]["recordCounts"].ToString(); //总记录条数
  287. dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
  288. if (recordCounts == "0")
  289. {
  290. MessageBox.Show("查询成功,但返回结果集为空!");
  291. //return;
  292. }
  293. pg.TotalCount = int.Parse(recordCounts);
  294. pg.PageSize = int.Parse(TexBYSJL.Text); //int.Parse(pages);
  295. }
  296. dgv.DataSource = dt;
  297. dgv.Columns[0].ReadOnly = true;
  298. }
  299. catch (Exception ex)
  300. {
  301. MessageBox.Show("查询异常:" + ex.Message);
  302. }
  303. }
  304. else
  305. {
  306. errorMessage = "调用交易" + funNo + "出现错误,请查看日志!"; //joImportRtn["errorMessage"].ToString();
  307. MessageBox.Show(errorMessage);
  308. return;
  309. }
  310. }
  311. }
  312. else //目录对照页面
  313. {
  314. queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
  315. setHeaderTxt(directoryType, dgv);
  316. }
  317. }
  318. private int queryHISDirectory(int currentPage, int pageSize, out string errMsg)
  319. {
  320. errMsg = "";
  321. string directoryType = string.Empty;
  322. switch (rbgDirecType_C.SelectedIndex)
  323. {
  324. case 0:
  325. {
  326. directoryType = "drugs";
  327. break;
  328. }
  329. case 1:
  330. {
  331. directoryType = "diagnosi";
  332. break;
  333. }
  334. case 2:
  335. {
  336. directoryType = "consumables";
  337. break;
  338. }
  339. }
  340. JObject joHISRtn = new JObject();
  341. JObject joRtn = new JObject();
  342. InvokeHelper invoker = new InvokeHelper();
  343. string flag = "";
  344. //全部是先调HIS,然后再匹配医保平台的对照关系
  345. if (rbAll.Checked)
  346. {
  347. JArray jaPagination = new JArray();
  348. JArray jaParams = new JArray();
  349. flag = "All";
  350. dynamic joParam = new JObject();
  351. joParam.code = "";
  352. joParam.descripts = "";
  353. joParam.FindType = new JArray();
  354. joParam.TypeID = "";
  355. joParam.alias = tbHISDirectoryFilter.Text;
  356. joParam.include = "Hosp";
  357. joParam.groupID = "324";
  358. joParam.hospID = Global.inf.hisHospitalDr;
  359. joParam.interfaceDr = Global.inf.interfaceDr;
  360. joParam.type = directoryType;
  361. joParam.flag = flag;
  362. joParam.specInput = "";
  363. jaParams.Add(joParam);
  364. dynamic joPagination = new JObject();
  365. joPagination.pageSize = pageSize;
  366. //joPagination.pageSize = 2;
  367. joPagination.currentPage = currentPage;
  368. joPagination.sortColumn = "Code";
  369. joPagination.sortOrder = "asc";
  370. jaPagination.Add(joPagination);
  371. //该服务需要改写,需要跟(CloudMedicalInsurancePlatform.Tables.MapRelation)进行关联
  372. //joInParams.code = "09010038";
  373. if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
  374. {
  375. return -1;
  376. }
  377. joRtn = mIS.ConvertHISDir(joHISRtn);
  378. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  379. {
  380. return -1;
  381. }
  382. }
  383. //已对照是先调云医保,然后再匹配HIS
  384. if (rbMaped.Checked)
  385. {
  386. JArray jaPagination = new JArray();
  387. JArray jaParams = new JArray();
  388. flag = "Maped";
  389. dynamic joParam = new JObject();
  390. joParam.alias = tbHISDirectoryFilter.Text;
  391. joParam.HospitalDr = Global.inf.hospitalDr;
  392. joParam.InterfaceDr = Global.inf.interfaceDr;
  393. joParam.hisType = directoryType;
  394. jaParams.Add(joParam);
  395. dynamic joPagination = new JObject();
  396. joPagination.pageSize = pageSize;
  397. joPagination.currentPage = currentPage;
  398. joPagination.sortColumn = "HisCode";
  399. joPagination.sortOrder = "asc";
  400. jaPagination.Add(joPagination);
  401. JObject joMIRtn = mIS.GetMappedHISDir(jaPagination, jaParams);
  402. if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
  403. {
  404. return -1;
  405. }
  406. //传给HIS,进行匹配
  407. joParam = new JObject();
  408. joParam.TotalCount = joMIRtn["result"]["TotalCount"];
  409. joParam.type = directoryType;
  410. joParam.flag = flag;
  411. joParam.hospID = Global.inf.hisHospitalDr;
  412. joParam.interfaceDr = Global.inf.interfaceDr;
  413. joParam.alias = tbHISDirectoryFilter.Text;
  414. joParam.include = "Hosp";
  415. joParam.groupID = "324";
  416. joParam.compareArr = joMIRtn["result"]["Data"];
  417. jaParams = new JArray();
  418. jaParams.Add(joParam);
  419. if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
  420. {
  421. return -1;
  422. }
  423. }
  424. //if (rbNoMaped.Checked) { flag = "NoMaped"; }
  425. if (rbNoMaped.Checked)
  426. {
  427. JArray jaPagination = new JArray();
  428. JArray jaParams = new JArray();
  429. flag = "All";
  430. dynamic joParam = new JObject();
  431. joParam.code = "";
  432. joParam.descripts = "";
  433. joParam.FindType = new JArray();
  434. joParam.TypeID = "";
  435. joParam.alias = tbHISDirectoryFilter.Text;
  436. joParam.include = "Hosp";
  437. joParam.groupID = "324";
  438. joParam.hospID = Global.inf.hisHospitalDr;
  439. joParam.interfaceDr = Global.inf.interfaceDr;
  440. joParam.type = directoryType;
  441. joParam.flag = flag;
  442. joParam.specInput = "";
  443. jaParams.Add(joParam);
  444. dynamic joPagination = new JObject();
  445. joPagination.pageSize = pageSize; //pageSize;
  446. //joPagination.pageSize = 2;
  447. joPagination.currentPage = currentPage;
  448. joPagination.sortColumn = "Code";
  449. joPagination.sortOrder = "asc";
  450. jaPagination.Add(joPagination);
  451. //1.获取全部HIS目录
  452. if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
  453. {
  454. return -1;
  455. }
  456. joRtn = mIS.GetNoMappHISDir(joHISRtn);
  457. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  458. {
  459. return -1;
  460. }
  461. }
  462. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  463. dtExport = dt;
  464. int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
  465. pgHISDirect.TotalCount = totalCount;
  466. if (rbNoMaped.Checked)
  467. pgHISDirect.PageSize = pageSize;
  468. else
  469. pgHISDirect.PageSize = 50;
  470. dgvHISDirectory.DataSource = null;
  471. dgvHISDirectory.DataSource = dt;
  472. dgvHISDirectory.Columns[0].ReadOnly = true;
  473. GridViewSetter gridSetter = new GridViewSetter();
  474. gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
  475. gridSetter.DatagridviewColumnWidthAdaptation(dgvHISDirectory);
  476. return 0;
  477. }
  478. private void queryCenterDirectory_09010012(int currentPage, int pageSize)
  479. {
  480. string directoryType = string.Empty;
  481. switch (rbgDirecType_C.SelectedIndex)
  482. {
  483. case 0:
  484. {
  485. directoryType = "drugs";
  486. break;
  487. }
  488. case 1:
  489. {
  490. directoryType = "diagnosi";
  491. break;
  492. }
  493. case 2:
  494. {
  495. directoryType = "consumables";
  496. break;
  497. }
  498. }
  499. dynamic joInParams = new JObject();
  500. joInParams.pagination = new JArray() as dynamic;
  501. joInParams.session = new JArray() as dynamic;
  502. JArray jaParams = new JArray();
  503. dynamic joParams = new JObject();
  504. joParams.code = "";
  505. joParams.descripts = "";
  506. joParams.FindType = new JArray();
  507. joParams.TypeID = "";
  508. joParams.alias = "";
  509. joParams.include = "Hosp";
  510. joParams.groupID = "324";
  511. joParams.hospID = "25";
  512. joParams.type = directoryType;
  513. joParams.specInput = "";
  514. jaParams.Add(joParams);
  515. joInParams.Add("params", JArray.FromObject(jaParams));
  516. dynamic joSession = new JObject();
  517. joSession.userID = "";
  518. joSession.locID = "";
  519. joSession.groupID = "";
  520. joSession.hospID = "";
  521. joSession.sessionID = "";
  522. joSession.hospCode = "";
  523. joSession.language = "";
  524. joSession.hostName = "";
  525. joSession.ipv4 = "";
  526. joSession.ipv6 = "";
  527. joSession.mac = "";
  528. joInParams.session.Add(joSession);
  529. dynamic joPagination = new JObject();
  530. joPagination.pageSize = pageSize;
  531. joPagination.currentPage = currentPage;
  532. joPagination.sortColumn = "Code";
  533. joPagination.sortOrder = "asc";
  534. joInParams.pagination.Add(joPagination);
  535. joInParams.code = "09010012";
  536. string sInput = joInParams.ToString();
  537. string sRtn = invoker.invokeInsuService(joInParams, "");
  538. JObject jsonRtn = JObject.Parse(sRtn);
  539. if (jsonRtn["result"]["Data"] == null)
  540. {
  541. MessageBox.Show("该节点不存在");
  542. return;
  543. }
  544. JObject joRtn = JObject.Parse(sRtn);
  545. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  546. int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
  547. pgCenterDirect.TotalCount = totalCount;
  548. pgCenterDirect.PageSize = 50;
  549. dgvCenterDirectory.DataSource = dt;
  550. }
  551. private void Mapping()
  552. {
  553. int iHis = dgvHISDirectory.CurrentRow.Index;
  554. if (dgvCenterDirectory.CurrentRow == null)
  555. {
  556. MessageBox.Show("请查询中心目录");
  557. return;
  558. }
  559. int iCenter = dgvCenterDirectory.CurrentRow.Index;
  560. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  561. DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
  562. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Code"].Value.ToString();
  563. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Name"].Value.ToString();
  564. int hisType = rbgDirecType_C.SelectedIndex + 1;
  565. string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString(); ;
  566. JArray jaParams = new JArray();
  567. dynamic jsonTemp = new JObject();
  568. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  569. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  570. jsonTemp.updateUserID = Global.user.ID;
  571. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  572. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  573. jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["itemDesc"].Value;
  574. jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
  575. jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
  576. //1.已对照 2.已对照但未上传 3 已对照且已上传
  577. jsonTemp.State = 1;
  578. jsonTemp.HisType = hisType;
  579. jsonTemp.HisTypeName = hisTypeName;
  580. jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Code"].Value;
  581. jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
  582. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  583. jaParams.Add(jsonTemp);
  584. JObject joIn = new JObject();
  585. joIn.Add(new JProperty("params", jaParams));
  586. joIn.Add("code", "09010040");
  587. InvokeHelper invoker = new InvokeHelper();
  588. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
  589. //JObject joRtn = JObject.Parse(irisRtn);
  590. if ((int)joRtn["errorCode"] == 0)
  591. {
  592. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
  593. }
  594. else
  595. {
  596. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
  597. }
  598. }
  599. private void CancleMapping()
  600. {
  601. int iHis = dgvHISDirectory.CurrentRow.Index;
  602. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  603. JArray jaParams = new JArray();
  604. dynamic jsonTemp = new JObject();
  605. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  606. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  607. jsonTemp.updateUserID = Global.user.ID;
  608. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  609. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  610. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  611. jaParams.Add(jsonTemp);
  612. JObject joIn = new JObject();
  613. joIn.Add(new JProperty("params", jaParams));
  614. joIn.Add("code", "09010041");
  615. InvokeHelper invoker = new InvokeHelper();
  616. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
  617. if ((int)joRtn["errorCode"] == 0)
  618. {
  619. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
  620. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
  621. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "";
  622. }
  623. else
  624. {
  625. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
  626. }
  627. }
  628. /// <summary>
  629. /// 医保目录单个版本号的下载
  630. /// </summary>
  631. /// <param name="ver"></param>
  632. /// <param name="directoryType"></param>
  633. /// <param name="uiProcessBar"></param>
  634. /// <param name="errorMessage"></param>
  635. /// <returns></returns>
  636. public int SingleDownload(string ver, int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
  637. {
  638. string txtPath = string.Empty;
  639. errorMessage = "";
  640. int iResult = -1;
  641. string funNo = "";
  642. switch (directoryType)
  643. {
  644. case 0://药品
  645. {
  646. funNo = "1301"; //"1301";
  647. break;
  648. }
  649. case 1://诊疗
  650. {
  651. funNo = "1305";
  652. break;
  653. }
  654. case 2://材料
  655. {
  656. funNo = "1306";
  657. break;
  658. }
  659. case 3://疾病诊断
  660. {
  661. funNo = "1307";
  662. break;
  663. }
  664. case 4://手术
  665. {
  666. funNo = "1308";
  667. break;
  668. }
  669. case 5://慢性病
  670. {
  671. funNo = "1309";
  672. break;
  673. }
  674. case 6://DRGs
  675. {
  676. funNo = "1310";
  677. break; ;
  678. }
  679. case 7://日间手术
  680. {
  681. funNo = "1311";
  682. break;
  683. }
  684. case 8://字典表
  685. {
  686. break;
  687. }
  688. case 9://中药饮片
  689. {
  690. funNo = "1302";
  691. break;
  692. }
  693. case 10://医药机构制剂
  694. {
  695. funNo = "1303";
  696. break;
  697. }
  698. }
  699. try
  700. {
  701. JObject joRtn = hBus.DownloadDirectory(funNo, ver);
  702. //MessageBox.Show("往IRIS插入数据准备:" + joRtn.ToString());
  703. //if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  704. if (JsonHelper.parseIrisRtnValue(joRtn, out errorMessage) == 0)
  705. {
  706. txtPath = joRtn["filePath"].ToString();
  707. //MessageBox.Show("获取txt数据往IRIS插入文件路径:"+ txtPath);
  708. DataImoport bus = new DataImoport();
  709. JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, directoryType + 1, uiProcessBar);
  710. //MessageBox.Show("往IRIS插入数据:" + joImportRtn.ToString());
  711. //if (JsonHelper.parseCenterRtnValue(joImportRtn, out errorMessage) == 0)
  712. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  713. {
  714. iResult = 0;
  715. }
  716. else
  717. {
  718. Global.writeLog(joImportRtn.ToString());
  719. errorMessage = "导入数据出现错误,请查看日志!";//joImportRtn["errorMessage"].ToString();
  720. }
  721. }
  722. return iResult;
  723. }
  724. catch (Exception ex)
  725. {
  726. errorMessage = "SingleDownload提示:" + ex.Message;
  727. return -1;
  728. }
  729. }
  730. /// <summary>
  731. /// 医保目录单个版本号的下载
  732. /// </summary>
  733. /// <param name="ver"></param>
  734. /// <param name="directoryType"></param>
  735. /// <param name="uiProcessBar"></param>
  736. /// <param name="errorMessage"></param>
  737. /// <returns></returns>
  738. public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
  739. {
  740. errorMessage = "";
  741. int iResult = -1;
  742. try
  743. {
  744. JObject joRtn = cBus.DownDictionay(joData);
  745. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  746. {
  747. DataImoport DI = new DataImoport();
  748. JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.list"));
  749. JObject joImportRtn = DI.importDictionary(uiProcessBar, jaList, tbDicType.Text);
  750. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  751. {
  752. iResult = 0;
  753. }
  754. else
  755. {
  756. errorMessage = "导入数据出现错误,请查看日志!" + errorMessage;
  757. }
  758. }
  759. return iResult;
  760. }
  761. catch (Exception ex)
  762. {
  763. errorMessage = "downloadDicionary提示:" + ex.Message;
  764. return -1;
  765. }
  766. }
  767. /// <summary>
  768. /// 自动下载医保目录,直到最新版本(返回报错)
  769. /// </summary>
  770. /// <param name="directoryType"></param>
  771. /// <param name="uiProcessBar"></param>
  772. /// <param name="errorMessage"></param>
  773. /// <returns></returns>
  774. public int AutoDownload(int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
  775. {
  776. int iResult = 0;
  777. errorMessage = "";
  778. try
  779. {
  780. while (iResult == 0)
  781. {
  782. JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(directoryType);
  783. string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
  784. iResult = JsonHelper.parseIrisRtnValue(joMaxVerNO, out errorMessage);
  785. iResult = SingleDownload(ver, directoryType, uiProcessBar, out errorMessage);
  786. }
  787. return iResult;
  788. }
  789. catch (Exception ex)
  790. {
  791. errorMessage = ex.Message;
  792. return -1;
  793. }
  794. }
  795. #endregion
  796. private void Form1_Load(object sender, EventArgs e)
  797. {
  798. this.WindowState = FormWindowState.Maximized;
  799. rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
  800. LabExplain.Visible = false;
  801. }
  802. private void btnDownload_Click(object sender, EventArgs e)
  803. {
  804. string errorMessage = string.Empty;
  805. //医保字典数据下载
  806. if (rbgDirecType.SelectedIndex == 8)
  807. {
  808. if (tbDicDate.Text == "")
  809. {
  810. MessageBox.Show("请输入查询日期!");
  811. return;
  812. }
  813. dynamic joData = new JObject();
  814. joData.type = tbDicType.Text; //字典类型
  815. joData.parentValue = ""; //父字典键值
  816. joData.admdvs = Global.inf.areaCode; //行政区划 就医地
  817. joData.date = tbDicDate.Text; //查询日期
  818. joData.vali_flag = "1"; //有效标志
  819. if (downloadDicionary(joData, uiProcessBar1, out errorMessage) != 0)
  820. {
  821. MessageBox.Show("医保字典下载失败:" + errorMessage);
  822. return;
  823. }
  824. }
  825. else if (rbgDirecType.SelectedIndex <=10)
  826. {
  827. if (rbSingleDown.Checked)
  828. {
  829. string ver = tbVer.Text;
  830. if (tbVer.Text != "")
  831. {
  832. ver = tbVer.Text;
  833. }
  834. if (SingleDownload(ver, rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  835. {
  836. MessageBox.Show("医保目录下载失败:" + errorMessage);
  837. return;
  838. }
  839. }
  840. if (rbAutoDown.Checked)
  841. {
  842. if (AutoDownload(rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  843. {
  844. MessageBox.Show("医保目录下载失败:" + errorMessage);
  845. return;
  846. }
  847. }
  848. }
  849. btnQuery_Click(sender, e);
  850. }
  851. private void btnQuery_Click(object sender, EventArgs e)
  852. {
  853. #region 校验查询条件
  854. if ((rbgDirecType.SelectedIndex < 0) || (rbgDirecType.SelectedIndex > 20))
  855. {
  856. MessageBox.Show("请先选择查询类型!");
  857. return;
  858. }
  859. if (rbgDirecType.SelectedIndex > 13)
  860. {
  861. if (rbgDirecType.SelectedIndex != 20)
  862. {
  863. if ((TexDate.Text == "") || (TexDate.Text == "输入日期 2021-01-01"))
  864. {
  865. MessageBox.Show("查询条件-请输入查询日期!");
  866. return;
  867. }
  868. if ((TexDQYS.Text == "") || (TexDQYS.Text == "当前页数"))
  869. {
  870. MessageBox.Show("查询条件-请输入当前页数!");
  871. return;
  872. }
  873. if ((TexBYSJL.Text == "") || (TexBYSJL.Text == "本页数据量"))
  874. {
  875. MessageBox.Show("查询条件-请输入本页数据量!");
  876. return;
  877. }
  878. }
  879. else
  880. {
  881. if ((TexYYMC.Text == "") || (TexYYMC.Text == "输入医院名称模糊查找"))
  882. {
  883. MessageBox.Show("查询条件-请输入医院名称模糊查找!");
  884. return;
  885. }
  886. }
  887. }
  888. #endregion
  889. queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy, Global.inf.interfaceDr);
  890. }
  891. private void btnQueryHISDirectory_Click(object sender, EventArgs e)
  892. {
  893. string errMsg;
  894. int iCount = 50;
  895. if (rbNoMaped.Checked) iCount = 300;
  896. if (queryHISDirectory(1, iCount, out errMsg) != 0)
  897. {
  898. MessageBox.Show(errMsg);
  899. return;
  900. }
  901. }
  902. private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
  903. {
  904. if ((tbCenterDirectoryFilter.Text == "") && (tbInsuCode.Text == "") && (tbApprovalNO.Text == "") && (tbManufacturer.Text == ""))
  905. {
  906. return;
  907. }
  908. //查询区域通用目录
  909. JObject joRtn = mIS.getInterface_TY(Global.inf.interfaceDr.ToString(),"");
  910. string InsuCurrencyCataLogue = JsonHelper.getDestValue(joRtn, "InsuCurrencyCataLogue"); //通用目录编码 6
  911. string InterfaceName_TY = JsonHelper.getDestValue(joRtn, "InterfaceName_TY"); //通用目录名称
  912. string HospName = JsonHelper.getDestValue(joRtn, "HospitalName"); //目录名称
  913. if (InsuCurrencyCataLogue != "")
  914. {
  915. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, int.Parse(InsuCurrencyCataLogue));
  916. LabExplain.Visible = true;
  917. LabExplain.Text = "当前接口已设置区域通用目录,数据源:" + InterfaceName_TY+" ,如果没有所查目录请联系数据源医院新增维护!";
  918. }
  919. else
  920. {
  921. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
  922. LabExplain.Visible = true;
  923. LabExplain.Text = "当前接口未设置区域通用目录,数据源:" + HospName;
  924. }
  925. GridViewSetter gridSetter = new GridViewSetter();
  926. gridSetter.DatagridviewColumnWidthAdaptation(dgvCenterDirectory);
  927. }
  928. private void pgDownload_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  929. {
  930. queryHISInsuDirectory(rbgDirecType.SelectedIndex, pageIndex, count, dgvDirectoy, Global.inf.interfaceDr);
  931. }
  932. private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  933. {
  934. string errMsg;
  935. int iCount = 50;
  936. if (rbNoMaped.Checked) iCount = 300;
  937. if (queryHISDirectory(pageIndex, iCount, out errMsg) != 0)
  938. {
  939. MessageBox.Show(errMsg);
  940. return;
  941. }
  942. }
  943. private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  944. {
  945. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, pageIndex, count, dgvCenterDirectory, Global.inf.interfaceDr);
  946. }
  947. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  948. {
  949. //选定项不同调用的接口也不相同,Index值大于
  950. if (rbgDirecType.SelectedIndex > 13)
  951. {
  952. uiGroupBox1.Visible = false;
  953. uiGroupBox5.Visible = false;
  954. uiGroupBox2.Visible = true;
  955. //uiGroupBox3.Visible = true;
  956. uiProcessBar1.Visible = false;
  957. uiGroupBox2.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  958. uiGroupBox3.Left = uiGroupBox2.Width+rbgDirecType.Width + rbgDirecType.Left + 10;
  959. dgvDirectoy.DataSource = null;
  960. }
  961. else
  962. {
  963. uiGroupBox1.Visible = true;
  964. uiGroupBox5.Visible = true;
  965. uiGroupBox2.Visible = true;
  966. //uiGroupBox3.Visible = false;
  967. uiProcessBar1.Visible = true;
  968. uiGroupBox1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  969. uiGroupBox5.Left = uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 10;
  970. uiGroupBox2.Left = uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 15;
  971. uiGroupBox3.Left = uiGroupBox2.Width + uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 20;
  972. uiProcessBar1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  973. uiProcessBar1.Width = uiGroupBox1.Width + uiGroupBox5.Width + uiGroupBox2.Width + 10;
  974. }
  975. setHeaderTxt(rbgDirecType.SelectedIndex, dgvDirectoy);
  976. }
  977. private void toolStripMenuItem2_Click(object sender, EventArgs e)
  978. {
  979. CancleMapping();
  980. }
  981. private void tsmiMapping_Click(object sender, EventArgs e)
  982. {
  983. Mapping();
  984. }
  985. private void dgvHISDirectory_DoubleClick(object sender, EventArgs e)
  986. {
  987. int currentPage = pgHISDirect.ActivePage;
  988. string flag = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["flag"].Value.ToString();
  989. if (flag == "未对照")
  990. {
  991. Mapping();
  992. }
  993. else
  994. if (flag == "已对照")
  995. {
  996. CancleMapping();
  997. }
  998. if (rbAll.Checked)
  999. {
  1000. string errMsg;
  1001. if (queryHISDirectory(1, 50, out errMsg) != 0)
  1002. {
  1003. MessageBox.Show(errMsg);
  1004. return;
  1005. }
  1006. }
  1007. }
  1008. private void dgvDirectoy_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1009. {
  1010. }
  1011. private void dgvDirectoy_CellContentClick(object sender, DataGridViewCellEventArgs e)
  1012. {
  1013. }
  1014. private void uiRadioButton1_CheckedChanged(object sender, EventArgs e)
  1015. {
  1016. }
  1017. private void dgvDirectoy_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1018. {
  1019. //自动编号,与数据无关
  1020. Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
  1021. e.RowBounds.Location.Y,
  1022. dgvDirectoy.RowHeadersWidth - 4,
  1023. e.RowBounds.Height);
  1024. TextRenderer.DrawText(e.Graphics,
  1025. (e.RowIndex + 1).ToString(),
  1026. dgvDirectoy.RowHeadersDefaultCellStyle.Font,
  1027. rectangle,
  1028. dgvDirectoy.RowHeadersDefaultCellStyle.ForeColor,
  1029. TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
  1030. }
  1031. private void rbAll_ValueChanged(object sender, bool value)
  1032. {
  1033. //if (rbAll.Checked)
  1034. //{
  1035. // btnExport.Visible = false;
  1036. // btnQueryHISDirectory_Click(null, new EventArgs());
  1037. //}
  1038. if (rbAll.Checked) btnExport.Visible = true;
  1039. }
  1040. private void rbMaped_CheckedChanged(object sender, EventArgs e)
  1041. {
  1042. //if (rbMaped.Checked)
  1043. //{
  1044. // string errMsg;
  1045. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  1046. // {
  1047. // MessageBox.Show(errMsg);
  1048. // return;
  1049. // }
  1050. //}
  1051. if (rbMaped.Checked) btnExport.Visible = true;
  1052. }
  1053. private void btAddDir_Click(object sender, EventArgs e)
  1054. {
  1055. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex);
  1056. if (addDirectory.ShowDialog() == DialogResult.OK)
  1057. {
  1058. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1059. string error = "";
  1060. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1061. {
  1062. MessageBox.Show("新增失败:" + error);
  1063. }
  1064. else
  1065. {
  1066. MessageBox.Show("新增成功");
  1067. }
  1068. }
  1069. }
  1070. private void btEditDir_Click(object sender, EventArgs e)
  1071. {
  1072. DataTable dt = (DataTable)dgvDirectoy.DataSource;
  1073. if ((dt == null) || (dt.Rows.Count < 1))
  1074. {
  1075. MessageBox.Show("表中无数据,请检查!");
  1076. return;
  1077. }
  1078. DataRow dr = dt.Rows[dgvDirectoy.CurrentRow.Index];
  1079. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex, dr);
  1080. if (addDirectory.ShowDialog() == DialogResult.OK)
  1081. {
  1082. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1083. string error = "";
  1084. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1085. {
  1086. MessageBox.Show("修改失败:" + error);
  1087. }
  1088. else
  1089. {
  1090. MessageBox.Show("修改成功");
  1091. }
  1092. }
  1093. }
  1094. private void btnExit_Click(object sender, EventArgs e)
  1095. {
  1096. Close();
  1097. }
  1098. /// <summary>
  1099. /// 几个医保查询的交易组织入参
  1100. /// </summary>
  1101. /// <param name="Index"></param>
  1102. /// <param name="funNo"></param>
  1103. /// <returns></returns>
  1104. private JObject GetInput(int Index, out string funNo)
  1105. {
  1106. funNo = "";
  1107. dynamic joData = new JObject();
  1108. switch (Index)
  1109. {
  1110. case 14://民族药品目
  1111. {
  1112. funNo = "1304";
  1113. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1114. joData.genname_codg = ""; //通用名编号
  1115. joData.drug_genname = ""; //药品通用名
  1116. joData.drug_prodname = tbDircetoryName.Text; //药品商品名
  1117. joData.reg_name = ""; //注册名称
  1118. joData.tcmherb_name = ""; //中草药名称
  1119. joData.mlms_name = ""; //药材名称
  1120. joData.vali_flag = ""; //有效标志
  1121. joData.rid = ""; //唯一记录号
  1122. joData.ver = ""; //版本号
  1123. joData.ver_name = ""; //版本名称
  1124. joData.opt_begn_time = ""; //经办开始时间
  1125. joData.opt_end_time = ""; //经办结束时间
  1126. joData.updt_time = TexDate.Text; //更新时间
  1127. joData.page_num = TexDQYS.Text; //当前页数
  1128. joData.page_size = TexBYSJL.Text; //本页数据量
  1129. break;
  1130. }
  1131. case 15://目录信息查询
  1132. {
  1133. funNo = "1312";
  1134. joData.query_date = ""; //查询时间点
  1135. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1136. joData.insu_admdvs = ""; //参保机构医保区划
  1137. joData.begndate = ""; //开始日期
  1138. joData.hilist_name = tbDircetoryName.Text; //医保目录名称
  1139. joData.wubi = ""; //五笔助记码
  1140. joData.pinyin = ""; //拼音助记码
  1141. joData.med_chrgitm_type = ""; //医疗收费项目类别
  1142. joData.chrgitm_lv = ""; //收费项目等级
  1143. joData.lmt_used_flag = ""; //限制使用标志
  1144. joData.list_type = ""; //目录类别
  1145. joData.med_use_flag = ""; //医疗使用标志
  1146. joData.matn_used_flag = ""; //生育使用标志
  1147. joData.hilist_use_type = ""; //医保目录使用类别
  1148. joData.lmt_cpnd_type = ""; //限复方使用类型
  1149. joData.vali_flag = ""; //有效标志
  1150. joData.updt_time = TexDate.Text; //更新时间
  1151. joData.page_num = TexDQYS.Text; //当前页数
  1152. joData.page_size = TexBYSJL.Text; //本页数据量
  1153. break;
  1154. }
  1155. case 16://医疗与医保目录匹配
  1156. {
  1157. funNo = "1316";
  1158. joData.query_date = ""; //查询时间点
  1159. joData.medins_list_codg = ""; //定点医药机构目录编号
  1160. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1161. joData.list_type = ""; //目录类别
  1162. joData.insu_admdvs = ""; //参保机构医保区划
  1163. joData.begndate = ""; //开始日期
  1164. joData.vali_flag = ""; //有效标志
  1165. joData.updt_time = TexDate.Text; //更新时间
  1166. joData.page_num = TexDQYS.Text; //当前页数
  1167. joData.page_size = TexBYSJL.Text; //本页数据量
  1168. break;
  1169. }
  1170. case 17://医药机构目录匹配
  1171. {
  1172. funNo = "1317";
  1173. joData.query_date = ""; //查询时间点
  1174. joData.fixmedins_code = ""; //定点医药机构编号
  1175. joData.medins_list_codg = ""; //定点医药机构目录编号
  1176. joData.medins_list_name = ""; //定点医药机构目录名称
  1177. joData.insu_admdvs = ""; //参保机构医保区划
  1178. joData.list_type = ""; //目录类别
  1179. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1180. joData.begndate = ""; //开始日期
  1181. joData.vali_flag = ""; //有效标志
  1182. joData.updt_time = TexDate.Text; //更新时间
  1183. joData.page_num = TexDQYS.Text; //当前页数
  1184. joData.page_size = TexBYSJL.Text; //本页数据量
  1185. break;
  1186. }
  1187. case 18://医保目录限价
  1188. {
  1189. funNo = "1318";
  1190. joData.query_date = ""; //查询时间点
  1191. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1192. joData.hilist_lmtpric_type = ""; //医保目录限价类型
  1193. joData.overlmt_dspo_way = ""; //医保目录超限处理方式
  1194. joData.insu_admdvs = ""; //参保机构医保区划
  1195. joData.begndate = ""; //开始日期
  1196. joData.enddate = ""; //结束日期
  1197. joData.vali_flag = ""; //有效标志
  1198. joData.rid = ""; //唯一记录号
  1199. joData.tabname = ""; //表名
  1200. joData.poolarea_no = ""; //统筹区
  1201. joData.updt_time = TexDate.Text; //更新时间
  1202. joData.page_num = TexDQYS.Text; //当前页数
  1203. joData.page_size = TexBYSJL.Text; //本页数据量
  1204. break;
  1205. }
  1206. case 19://医保目录先自付比例
  1207. {
  1208. funNo = "1319";
  1209. joData.query_date = ""; //查询时间点
  1210. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1211. joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
  1212. joData.selfpay_prop_type = ""; //目录自付比例类别
  1213. joData.insu_admdvs = ""; //参保机构医保区划
  1214. joData.begndate = ""; //开始日期
  1215. joData.enddate = ""; //结束日期
  1216. joData.vali_flag = ""; //有效标志
  1217. joData.rid = ""; //唯一记录号
  1218. joData.tabname = ""; //表名
  1219. joData.poolarea_no = ""; //统筹区
  1220. joData.updt_time = TexDate.Text; //更新时间
  1221. joData.page_num = TexDQYS.Text; //当前页数
  1222. joData.page_size = TexBYSJL.Text; //本页数据量
  1223. break;
  1224. }
  1225. case 20://医药机构信息
  1226. {
  1227. funNo = "1201";
  1228. joData.fixmedins_type = "1"; //定点医疗服务机构类型 1定点医疗机构,2定点零售药店,3工伤定点康复机构,4辅助器具配置机构,5计划生育服务机构
  1229. joData.fixmedins_name = TexYYMC.Text; //定点医药机构名称
  1230. joData.fixmedins_code = ""; //定点医药机构编号
  1231. break;
  1232. }
  1233. }
  1234. return joData;
  1235. }
  1236. private void chek_UporCancel_CheckedChanged(object sender, EventArgs e)
  1237. {
  1238. }
  1239. private void uiButton1_Click(object sender, EventArgs e)
  1240. {
  1241. Close();
  1242. }
  1243. private void btnUpShip_Click(object sender, EventArgs e)
  1244. {
  1245. AllUpLoad();
  1246. }
  1247. private void btnCancelUpShip_Click(object sender, EventArgs e)
  1248. {
  1249. AllCancelUpload();
  1250. }
  1251. /// <summary>
  1252. /// 单条上传目录对照关系
  1253. /// </summary>
  1254. private void SingleUpload()
  1255. {
  1256. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1257. {
  1258. MessageBox.Show("请查询HIS目录对照关系");
  1259. return;
  1260. }
  1261. string errorMsg = "", sMLLX = "";
  1262. //单条目录对照关系上传
  1263. int iHis = dgvHISDirectory.CurrentRow.Index;
  1264. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1265. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1266. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1267. if (hisType == 1)
  1268. {
  1269. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1270. }
  1271. else if (hisType == 2)
  1272. {
  1273. sMLLX = "201";
  1274. }
  1275. else if (hisType == 3)
  1276. {
  1277. sMLLX = "301";
  1278. }
  1279. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1280. string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
  1281. string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
  1282. string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
  1283. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1284. //调用3301目录对照上传
  1285. JObject joData = new JObject();
  1286. joData.Add("fixmedins_hilist_id", HisCode);
  1287. joData.Add("fixmedins_hilist_name", HisName);
  1288. joData.Add("list_type", sMLLX); //目录类别
  1289. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1290. joData.Add("begndate", "2022-10-01"); //开始日期
  1291. joData.Add("enddate", UpdateDate); //结束日期
  1292. joData.Add("aprvno", "");
  1293. joData.Add("dosform", "");
  1294. joData.Add("exct_cont", "");
  1295. joData.Add("item_cont", "");
  1296. joData.Add("prcunt", "");
  1297. joData.Add("spec", "");
  1298. joData.Add("pacspec", "");
  1299. joData.Add("memo", "");
  1300. JObject joInput = new JObject();
  1301. joInput.Add("data", joData);
  1302. InvokeHelper invoker = new InvokeHelper();
  1303. JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
  1304. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1305. {
  1306. MessageBox.Show("目录对照关系上传失败:" + errorMsg);
  1307. }
  1308. else
  1309. {
  1310. MessageBox.Show("目录对照关系上传成功!");
  1311. }
  1312. }
  1313. /// <summary>
  1314. /// 单条撤销目录对照关系上传
  1315. /// </summary>
  1316. private void SingleCancelUpload()
  1317. {
  1318. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1319. {
  1320. MessageBox.Show("请查询HIS目录对照关系");
  1321. return;
  1322. }
  1323. string errorMsg = "", sMLLX = "";
  1324. //撤销目录对照关系
  1325. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1326. int iHis = dgvHISDirectory.CurrentRow.Index;
  1327. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1328. string HisCode = dtHis.Rows[iHis]["HisCode"].ToString();
  1329. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1330. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1331. if (hisType == 1)
  1332. {
  1333. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1334. }
  1335. else if (hisType == 2)
  1336. {
  1337. sMLLX = "201";
  1338. }
  1339. else if (hisType == 3)
  1340. {
  1341. sMLLX = "301";
  1342. }
  1343. //调用3302目录对照撤销
  1344. JObject joData = new JObject();
  1345. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1346. joData.Add("fixmedins_hilist_id", HisCode);
  1347. joData.Add("list_type", sMLLX); //目录类别
  1348. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1349. JObject joInput = new JObject();
  1350. joInput.Add("data", joData);
  1351. InvokeHelper invoker = new InvokeHelper();
  1352. JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
  1353. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1354. {
  1355. MessageBox.Show("目录对照撤销失败:" + errorMsg);
  1356. }
  1357. else
  1358. {
  1359. MessageBox.Show("目录对照撤销成功!");
  1360. }
  1361. }
  1362. /// <summary>
  1363. /// 全部上传目录对照关系
  1364. /// </summary>
  1365. private void AllUpLoad()
  1366. {
  1367. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1368. {
  1369. MessageBox.Show("请查询HIS目录对照关系");
  1370. return;
  1371. }
  1372. string sInputStr = "", sMLLX = "", errorMsg = "", Msg = "";
  1373. Boolean bOk = true;
  1374. JObject InputjoRtn = new JObject();
  1375. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1376. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1377. if (hisType == 1)
  1378. {
  1379. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1380. }
  1381. else if (hisType == 2)
  1382. {
  1383. sMLLX = "201";
  1384. }
  1385. else if (hisType == 3)
  1386. {
  1387. sMLLX = "301";
  1388. }
  1389. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1390. for (int i = 0; i < dtHis.Rows.Count; i++)
  1391. {
  1392. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString(); //医保目录编码
  1393. string InsuName = dtHis.Rows[i]["InsuName"].ToString(); //医保目录名称
  1394. string HisCode = dtHis.Rows[i]["itemCode"].ToString(); //HIS目录编码
  1395. string HisName = dtHis.Rows[i]["itemDesc"].ToString(); //HIS目录名称
  1396. //调用3301目录对照上传
  1397. JObject joData = new JObject();
  1398. joData.Add("fixmedins_hilist_id", HisCode);
  1399. joData.Add("fixmedins_hilist_name", HisName);
  1400. joData.Add("list_type", sMLLX); //目录类别
  1401. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1402. joData.Add("begndate", "2022-10-01"); //开始日期
  1403. joData.Add("enddate", UpdateDate); //结束日期
  1404. joData.Add("aprvno", "");
  1405. joData.Add("dosform", "");
  1406. joData.Add("exct_cont", "");
  1407. joData.Add("item_cont", "");
  1408. joData.Add("prcunt", "");
  1409. joData.Add("spec", "");
  1410. joData.Add("pacspec", "");
  1411. joData.Add("memo", "");
  1412. JObject joInput = new JObject();
  1413. joInput.Add("data", joData);
  1414. InvokeHelper invoker = new InvokeHelper();
  1415. JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
  1416. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1417. {
  1418. bOk = false;
  1419. Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
  1420. }
  1421. }
  1422. if (bOk == false)
  1423. {
  1424. MessageBox.Show("全部目录对照关系上传成功,部分上传异常:" + Msg);
  1425. }
  1426. else
  1427. {
  1428. MessageBox.Show("全部目录对照关系上传成功!");
  1429. }
  1430. }
  1431. /// <summary>
  1432. /// 全部撤销目录对照关系上传
  1433. /// </summary>
  1434. private void AllCancelUpload()
  1435. {
  1436. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1437. {
  1438. MessageBox.Show("请查询HIS目录对照关系");
  1439. return;
  1440. }
  1441. string sMLLX = "", errorMsg = "", Msg = "";
  1442. Boolean bOk = true;
  1443. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1444. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1445. if (hisType == 1)
  1446. {
  1447. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1448. }
  1449. else if (hisType == 2)
  1450. {
  1451. sMLLX = "201";
  1452. }
  1453. else if (hisType == 3)
  1454. {
  1455. sMLLX = "301";
  1456. }
  1457. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1458. for (int i = 0; i < dtHis.Rows.Count; i++)
  1459. {
  1460. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();
  1461. string HisCode = dtHis.Rows[i]["HisCode"].ToString();
  1462. //调用3302目录对照撤销
  1463. JObject joData = new JObject();
  1464. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1465. joData.Add("fixmedins_hilist_id", HisCode);
  1466. joData.Add("list_type", sMLLX); //目录类别
  1467. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1468. JObject joInput = new JObject();
  1469. joInput.Add("data", joData);
  1470. InvokeHelper invoker = new InvokeHelper();
  1471. JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
  1472. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1473. {
  1474. bOk = false;
  1475. Msg = Msg + "<" + joInput.ToString()+":" + errorMsg + ">";
  1476. }
  1477. }
  1478. if (bOk == false)
  1479. {
  1480. MessageBox.Show("全部撤销目录对照关系上传成功,部分撤销异常:" + Msg);
  1481. }
  1482. else
  1483. {
  1484. MessageBox.Show("全部撤销目录对照关系上传成功!");
  1485. }
  1486. }
  1487. private void ToolStripMenuItem_Upload_Click(object sender, EventArgs e)
  1488. {
  1489. SingleUpload();
  1490. }
  1491. private void ToolStripMenuItem_CancelUpload_Click(object sender, EventArgs e)
  1492. {
  1493. SingleCancelUpload();
  1494. }
  1495. private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
  1496. {
  1497. tbHISDirectoryFilter.Text = "";
  1498. uiTextBox1.Text = "";
  1499. rbAll.Checked = true;
  1500. rbMaped.Checked = false;
  1501. rbNoMaped.Checked = false;
  1502. tbCenterDirectoryFilter.Text = "";
  1503. tbInsuCode.Text = "";
  1504. tbApprovalNO.Text = "";
  1505. dgvCenterDirectory.DataSource = null;
  1506. btnQueryHISDirectory_Click(null, new EventArgs());
  1507. }
  1508. private void btnExport_Click(object sender, EventArgs e)
  1509. {
  1510. //if (rbAll.Checked) return;
  1511. if (queryHISDirectory(1, 5000, out string errMsg) != 0)
  1512. {
  1513. MessageBox.Show(errMsg);
  1514. return;
  1515. }
  1516. if (dtExport.Rows.Count > 0)
  1517. {
  1518. string Maped = "";
  1519. if (rbAll.Checked) Maped = "全部";
  1520. if (rbMaped.Checked) Maped = "已对照";
  1521. if (rbNoMaped.Checked) Maped = "未对照";
  1522. string directoryType = string.Empty;
  1523. switch (rbgDirecType_C.SelectedIndex)
  1524. {
  1525. case 0:
  1526. {
  1527. directoryType = "药品";
  1528. break;
  1529. }
  1530. case 1:
  1531. {
  1532. directoryType = "诊疗";
  1533. break;
  1534. }
  1535. case 2:
  1536. {
  1537. directoryType = "材料";
  1538. break;
  1539. }
  1540. }
  1541. string LSH = DateTime.Now.ToString("yyyyMMddHHMMss"); //DateTime.Now.ToString("MMddHHmmssffff");
  1542. string sFliePathName = @"D:\" + LSH +"【"+ directoryType + "】医保目录【"+ Maped + "】信息.xls";
  1543. string ReturnFileName = ExportToExcel.DataTabletoExcel(dtExport, sFliePathName);
  1544. if (ReturnFileName != "")
  1545. {
  1546. MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  1547. System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  1548. }
  1549. else
  1550. {
  1551. MessageBox.Show("导出失败!");
  1552. }
  1553. }
  1554. }
  1555. private void dgvCenterDirectory_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1556. {
  1557. Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
  1558. e.RowBounds.Location.Y,
  1559. dgvCenterDirectory.RowHeadersWidth - 4,
  1560. e.RowBounds.Height);
  1561. TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
  1562. dgvCenterDirectory.RowHeadersDefaultCellStyle.Font,
  1563. rectangle,
  1564. dgvCenterDirectory.RowHeadersDefaultCellStyle.ForeColor,
  1565. TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
  1566. }
  1567. private void rbNoMaped_CheckedChanged(object sender, EventArgs e)
  1568. {
  1569. //if (rbNoMaped.Checked)
  1570. //{
  1571. // string errMsg;
  1572. // if (queryHISDirectory(1, 300, out errMsg) != 0)
  1573. // {
  1574. // MessageBox.Show(errMsg);
  1575. // return;
  1576. // }
  1577. //}
  1578. if (rbNoMaped.Checked) btnExport.Visible = true;
  1579. }
  1580. }
  1581. }