BasicData.cs 67 KB

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