BasicData.cs 66 KB

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