BasicData.cs 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900
  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 int queryMapeDirectory(int currentPage, int pageSize, out string errMsg)
  488. {
  489. errMsg = "";
  490. string directoryType = string.Empty;
  491. switch (rbgDirecType_C.SelectedIndex)
  492. {
  493. case 0:
  494. {
  495. directoryType = "drugs";
  496. break;
  497. }
  498. case 1:
  499. {
  500. directoryType = "diagnosi";
  501. break;
  502. }
  503. case 2:
  504. {
  505. directoryType = "consumables";
  506. break;
  507. }
  508. }
  509. JObject joHISRtn = new JObject();
  510. JObject joRtn = new JObject();
  511. InvokeHelper invoker = new InvokeHelper();
  512. string flag = "";
  513. JArray jaPagination = new JArray();
  514. JArray jaParams = new JArray();
  515. flag = "Maped";
  516. dynamic joParam = new JObject();
  517. joParam.alias = tbHISDirectoryFilter.Text;
  518. joParam.HospitalDr = Global.inf.hospitalDr;
  519. joParam.InterfaceDr = Global.inf.interfaceDr;
  520. joParam.hisType = directoryType;
  521. jaParams.Add(joParam);
  522. dynamic joPagination = new JObject();
  523. joPagination.pageSize = 3000;
  524. joPagination.currentPage = 1;
  525. joPagination.sortColumn = "HisCode";
  526. joPagination.sortOrder = "asc";
  527. jaPagination.Add(joPagination);
  528. JObject joMIRtn = mIS.GetMappedHISDir(jaPagination, jaParams);
  529. if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
  530. {
  531. return -1;
  532. }
  533. //传给HIS,进行匹配
  534. joParam = new JObject();
  535. joParam.TotalCount = joMIRtn["result"]["TotalCount"];
  536. joParam.type = directoryType;
  537. joParam.flag = flag;
  538. joParam.hospID = Global.inf.hisHospitalDr;
  539. joParam.interfaceDr = Global.inf.interfaceDr;
  540. joParam.alias = tbHISDirectoryFilter.Text;
  541. joParam.include = "Hosp";
  542. joParam.groupID = "324";
  543. joParam.compareArr = joMIRtn["result"]["Data"];
  544. jaParams = new JArray();
  545. jaParams.Add(joParam);
  546. if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
  547. {
  548. return -1;
  549. }
  550. dtExport = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  551. //if (rbNoMaped.Checked)
  552. // pgHISDirect.PageSize = pageSize;
  553. //else
  554. // pgHISDirect.PageSize = 50;
  555. return 0;
  556. }
  557. private int queryNoMappDirectory(int currentPage, int pageSize, out string errMsg)
  558. {
  559. errMsg = "";
  560. string directoryType = string.Empty;
  561. switch (rbgDirecType_C.SelectedIndex)
  562. {
  563. case 0:
  564. {
  565. directoryType = "drugs";
  566. break;
  567. }
  568. case 1:
  569. {
  570. directoryType = "diagnosi";
  571. break;
  572. }
  573. case 2:
  574. {
  575. directoryType = "consumables";
  576. break;
  577. }
  578. }
  579. JObject joHISRtn = new JObject();
  580. JObject joRtn = new JObject();
  581. InvokeHelper invoker = new InvokeHelper();
  582. string flag = "";
  583. JArray jaPagination = new JArray();
  584. JArray jaParams = new JArray();
  585. flag = "All";
  586. dynamic joParam = new JObject();
  587. joParam.code = "";
  588. joParam.descripts = "";
  589. joParam.FindType = new JArray();
  590. joParam.TypeID = "";
  591. joParam.alias = tbHISDirectoryFilter.Text;
  592. joParam.include = "Hosp";
  593. joParam.groupID = "324";
  594. joParam.hospID = Global.inf.hisHospitalDr;
  595. joParam.interfaceDr = Global.inf.interfaceDr;
  596. joParam.type = directoryType;
  597. joParam.flag = flag;
  598. joParam.specInput = "";
  599. jaParams.Add(joParam);
  600. dynamic joPagination = new JObject();
  601. joPagination.pageSize = pageSize;
  602. //joPagination.pageSize = 2;
  603. joPagination.currentPage = currentPage;
  604. joPagination.sortColumn = "Code";
  605. joPagination.sortOrder = "asc";
  606. jaPagination.Add(joPagination);
  607. //1.获取全部HIS目录
  608. if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
  609. {
  610. return -1;
  611. }
  612. joRtn = mIS.GetNoMappHISDir(joHISRtn);
  613. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  614. {
  615. return -1;
  616. }
  617. dtExport = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  618. //if (rbNoMaped.Checked)
  619. // pgHISDirect.PageSize = pageSize;
  620. //else
  621. // pgHISDirect.PageSize = 50;
  622. return 0;
  623. }
  624. private void queryCenterDirectory_09010012(int currentPage, int pageSize)
  625. {
  626. string directoryType = string.Empty;
  627. switch (rbgDirecType_C.SelectedIndex)
  628. {
  629. case 0:
  630. {
  631. directoryType = "drugs";
  632. break;
  633. }
  634. case 1:
  635. {
  636. directoryType = "diagnosi";
  637. break;
  638. }
  639. case 2:
  640. {
  641. directoryType = "consumables";
  642. break;
  643. }
  644. }
  645. dynamic joInParams = new JObject();
  646. joInParams.pagination = new JArray() as dynamic;
  647. joInParams.session = new JArray() as dynamic;
  648. JArray jaParams = new JArray();
  649. dynamic joParams = new JObject();
  650. joParams.code = "";
  651. joParams.descripts = "";
  652. joParams.FindType = new JArray();
  653. joParams.TypeID = "";
  654. joParams.alias = "";
  655. joParams.include = "Hosp";
  656. joParams.groupID = "324";
  657. joParams.hospID = "25";
  658. joParams.type = directoryType;
  659. joParams.specInput = "";
  660. jaParams.Add(joParams);
  661. joInParams.Add("params", JArray.FromObject(jaParams));
  662. dynamic joSession = new JObject();
  663. joSession.userID = "";
  664. joSession.locID = "";
  665. joSession.groupID = "";
  666. joSession.hospID = "";
  667. joSession.sessionID = "";
  668. joSession.hospCode = "";
  669. joSession.language = "";
  670. joSession.hostName = "";
  671. joSession.ipv4 = "";
  672. joSession.ipv6 = "";
  673. joSession.mac = "";
  674. joInParams.session.Add(joSession);
  675. dynamic joPagination = new JObject();
  676. joPagination.pageSize = pageSize;
  677. joPagination.currentPage = currentPage;
  678. joPagination.sortColumn = "Code";
  679. joPagination.sortOrder = "asc";
  680. joInParams.pagination.Add(joPagination);
  681. joInParams.code = "09010012";
  682. string sInput = joInParams.ToString();
  683. string sRtn = invoker.invokeInsuService(joInParams, "");
  684. JObject jsonRtn = JObject.Parse(sRtn);
  685. if (jsonRtn["result"]["Data"] == null)
  686. {
  687. MessageBox.Show("该节点不存在");
  688. return;
  689. }
  690. JObject joRtn = JObject.Parse(sRtn);
  691. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  692. int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
  693. pgCenterDirect.TotalCount = totalCount;
  694. pgCenterDirect.PageSize = 50;
  695. dgvCenterDirectory.DataSource = dt;
  696. }
  697. private void Mapping()
  698. {
  699. int iHis = dgvHISDirectory.CurrentRow.Index;
  700. if (dgvCenterDirectory.CurrentRow == null)
  701. {
  702. MessageBox.Show("请查询中心目录");
  703. return;
  704. }
  705. int iCenter = dgvCenterDirectory.CurrentRow.Index;
  706. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  707. DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
  708. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Code"].Value.ToString();
  709. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Name"].Value.ToString();
  710. int hisType = rbgDirecType_C.SelectedIndex + 1;
  711. string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString(); ;
  712. JArray jaParams = new JArray();
  713. dynamic jsonTemp = new JObject();
  714. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  715. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  716. jsonTemp.updateUserID = Global.user.ID;
  717. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  718. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  719. jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["itemDesc"].Value;
  720. jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
  721. jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
  722. //1.已对照 2.已对照但未上传 3 已对照且已上传
  723. jsonTemp.State = 1;
  724. jsonTemp.HisType = hisType;
  725. jsonTemp.HisTypeName = hisTypeName;
  726. jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Code"].Value;
  727. jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
  728. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  729. jaParams.Add(jsonTemp);
  730. JObject joIn = new JObject();
  731. joIn.Add(new JProperty("params", jaParams));
  732. joIn.Add("code", "09010040");
  733. InvokeHelper invoker = new InvokeHelper();
  734. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
  735. //JObject joRtn = JObject.Parse(irisRtn);
  736. if ((int)joRtn["errorCode"] == 0)
  737. {
  738. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
  739. }
  740. else
  741. {
  742. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
  743. }
  744. }
  745. private void CancleMapping()
  746. {
  747. int iHis = dgvHISDirectory.CurrentRow.Index;
  748. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  749. JArray jaParams = new JArray();
  750. dynamic jsonTemp = new JObject();
  751. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  752. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  753. jsonTemp.updateUserID = Global.user.ID;
  754. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  755. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  756. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  757. jaParams.Add(jsonTemp);
  758. JObject joIn = new JObject();
  759. joIn.Add(new JProperty("params", jaParams));
  760. joIn.Add("code", "09010041");
  761. InvokeHelper invoker = new InvokeHelper();
  762. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
  763. if ((int)joRtn["errorCode"] == 0)
  764. {
  765. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
  766. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
  767. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "";
  768. }
  769. else
  770. {
  771. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
  772. }
  773. }
  774. public void loadTextDebug()
  775. {
  776. DataImoport bus = new DataImoport();
  777. string txtPath = @"E:\insu\Demo\bin\Debug\20230101535395327567680436.txt";
  778. JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, 2, uiProcessBar1);
  779. }
  780. /// <summary>
  781. /// 医保目录单个版本号的下载
  782. /// </summary>
  783. /// <param name="ver"></param>
  784. /// <param name="directoryType"></param>
  785. /// <param name="uiProcessBar"></param>
  786. /// <param name="errorMessage"></param>
  787. /// <returns></returns>
  788. public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, string dictCode,out string errorMessage)
  789. {
  790. errorMessage = "";
  791. int iResult = -1;
  792. try
  793. {
  794. JObject joRtn = cBus.DownDictionay(joData);
  795. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  796. {
  797. DataImoport DI = new DataImoport();
  798. JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.list"));
  799. JObject joImportRtn = DI.importDictionary(uiProcessBar, jaList, dictCode);
  800. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  801. {
  802. iResult = 0;
  803. }
  804. else
  805. {
  806. errorMessage = "导入数据出现错误,请查看日志!" + errorMessage;
  807. }
  808. }
  809. return iResult;
  810. }
  811. catch (Exception ex)
  812. {
  813. errorMessage = "downloadDicionary提示:" + ex.Message;
  814. return -1;
  815. }
  816. }
  817. #endregion
  818. private void Form1_Load(object sender, EventArgs e)
  819. {
  820. this.WindowState = FormWindowState.Maximized;
  821. rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
  822. LabExplain.Visible = false;
  823. }
  824. private void btnDownload_Click(object sender, EventArgs e)
  825. {
  826. string errorMessage = string.Empty;
  827. string ver = tbVer.Text;
  828. JObject input = new JObject();
  829. input["ver"] = ver;
  830. input["ypbz"] = tbDircetoryName.Text.Trim();
  831. input["code"] = tbDirectoryCode.Text.Trim();
  832. input["date"] = TexDate.Text.Trim();
  833. LocalMedDirDownloadProcess download = new LocalMedDirDownloadProcess();
  834. // 目录查询
  835. if (rbgDirecType.SelectedIndex == 15)
  836. {
  837. CallResult cr = download.QueryDepartment();
  838. if (cr.Success)
  839. {
  840. Global.writeLog(cr.Data);
  841. }
  842. }
  843. // 医保字典数据下载
  844. else if (rbgDirecType.SelectedIndex == 8)
  845. {
  846. if (tbDicDate.Text == "")
  847. {
  848. MessageBox.Show("请输入查询日期!");
  849. return;
  850. }
  851. // 支持批量
  852. string[] dictText = tbDicType.Text.Trim().Split(",".ToCharArray());
  853. dictText.ToList().ForEach((dict) =>
  854. {
  855. this.downloadDict(dict);
  856. });
  857. }
  858. // 诊断
  859. else if (rbgDirecType.SelectedIndex == 3)
  860. {
  861. download.DownloadDiagnosis(input);
  862. }
  863. // 自付比例
  864. else if (rbgDirecType.SelectedIndex == 19)
  865. {
  866. download.DownloadSelfpay(input);
  867. return;
  868. }
  869. else if (rbgDirecType.SelectedIndex <= 10)
  870. {
  871. //MedDirDownloadProcess mp = new MedDirDownloadProcess();
  872. //if (rbSingleDown.Checked)
  873. //{
  874. // if (mp.SingleDownload(ver, rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  875. // {
  876. // MessageBox.Show("医保目录下载失败:" + errorMessage);
  877. // return;
  878. // }
  879. //}
  880. //if (rbAutoDown.Checked)
  881. //{
  882. // if (mp.AutoDownload(rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  883. // {
  884. // MessageBox.Show("医保目录下载失败:" + errorMessage);
  885. // return;
  886. // }
  887. //}
  888. download.Process(input);
  889. }
  890. btnQuery_Click(sender, e);
  891. }
  892. private void downloadDict(string dictCode)
  893. {
  894. try
  895. {
  896. string errorMessage = "";
  897. dynamic joData = new JObject();
  898. joData.type = dictCode; //字典类型
  899. joData.parentValue = ""; //父字典键值
  900. joData.admdvs = Global.inf.areaCode; //行政区划 就医地
  901. joData.date = tbDicDate.Text; //查询日期
  902. joData.vali_flag = "1"; //有效标志
  903. if (downloadDicionary(joData, uiProcessBar1,dictCode, out errorMessage) != 0)
  904. {
  905. MessageBox.Show("医保字典下载失败:" + errorMessage);
  906. }
  907. }
  908. catch (Exception e)
  909. {
  910. }
  911. }
  912. private void btnQuery_Click(object sender, EventArgs e)
  913. {
  914. #region 校验查询条件
  915. if ((rbgDirecType.SelectedIndex < 0) || (rbgDirecType.SelectedIndex > 20))
  916. {
  917. MessageBox.Show("请先选择查询类型!");
  918. return;
  919. }
  920. if (rbgDirecType.SelectedIndex > 13)
  921. {
  922. if (rbgDirecType.SelectedIndex != 20)
  923. {
  924. if ((TexDate.Text == "") || (TexDate.Text == "输入日期 2021-01-01"))
  925. {
  926. MessageBox.Show("查询条件-请输入查询日期!");
  927. return;
  928. }
  929. if ((TexDQYS.Text == "") || (TexDQYS.Text == "当前页数"))
  930. {
  931. MessageBox.Show("查询条件-请输入当前页数!");
  932. return;
  933. }
  934. if ((TexBYSJL.Text == "") || (TexBYSJL.Text == "本页数据量"))
  935. {
  936. MessageBox.Show("查询条件-请输入本页数据量!");
  937. return;
  938. }
  939. }
  940. else
  941. {
  942. if ((TexYYMC.Text == "") || (TexYYMC.Text == "输入医院名称模糊查找"))
  943. {
  944. MessageBox.Show("查询条件-请输入医院名称模糊查找!");
  945. return;
  946. }
  947. }
  948. }
  949. #endregion
  950. queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy, Global.inf.interfaceDr);
  951. }
  952. private void btnQueryHISDirectory_Click(object sender, EventArgs e)
  953. {
  954. int iCount = 50;
  955. if (rbNoMaped.Checked)
  956. {
  957. try
  958. {
  959. if (Int32.Parse(numPage.Text) > currentPageIndex && pgHISDirect.TotalCount > 0)
  960. {
  961. currentPageIndex = Int32.Parse(numPage.Text);
  962. }
  963. }
  964. catch (Exception ex)
  965. {
  966. MessageBox.Show(ex.Message);
  967. return;
  968. }
  969. iCount = 300;
  970. }
  971. string errMsg;
  972. if (queryHISDirectory(currentPageIndex, iCount, out errMsg) != 0)
  973. {
  974. MessageBox.Show(errMsg);
  975. return;
  976. }
  977. }
  978. private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
  979. {
  980. if ((tbCenterDirectoryFilter.Text == "") && (tbInsuCode.Text == "") && (tbApprovalNO.Text == "") &&
  981. (tbManufacturer.Text == "") && (tbSpecifications.Text == "") && (tbDosageForm.Text == ""))
  982. {
  983. return;
  984. }
  985. //查询区域通用目录
  986. JObject joRtn = mIS.getInterface_TY(Global.inf.interfaceDr.ToString(),"");
  987. string InsuCurrencyCataLogue = JsonHelper.getDestValue(joRtn, "InsuCurrencyCataLogue"); //通用目录编码 6
  988. string InterfaceName_TY = JsonHelper.getDestValue(joRtn, "InterfaceName_TY"); //通用目录名称
  989. string HospName_TY = JsonHelper.getDestValue(joRtn, "HospitalName"); //目录名称
  990. string HospitalDr_TY = JsonHelper.getDestValue(joRtn, "HospitalDr_TY"); //区域通用目录医院ID
  991. if (InsuCurrencyCataLogue != "")
  992. {
  993. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, int.Parse(InsuCurrencyCataLogue));
  994. LabExplain.Visible = true;
  995. LabExplain.Text = "当前接口已设置区域通用目录,数据源:" + HospName_TY + " ,如果确认没有所查目录请联系数据源医院新增维护!";
  996. }
  997. else
  998. {
  999. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
  1000. LabExplain.Visible = true;
  1001. LabExplain.Text = "当前接口未设置区域通用目录,数据源:" + HospName_TY;
  1002. }
  1003. }
  1004. private void pgDownload_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1005. {
  1006. queryHISInsuDirectory(rbgDirecType.SelectedIndex, pageIndex, count, dgvDirectoy, Global.inf.interfaceDr);
  1007. }
  1008. private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1009. {
  1010. string errMsg;
  1011. int iCount = 50;
  1012. if (rbNoMaped.Checked) iCount = 300;
  1013. if (queryHISDirectory(pageIndex, iCount, out errMsg) != 0)
  1014. {
  1015. MessageBox.Show(errMsg);
  1016. return;
  1017. }
  1018. }
  1019. private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1020. {
  1021. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, pageIndex, count, dgvCenterDirectory, Global.inf.interfaceDr);
  1022. }
  1023. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  1024. {
  1025. //选定项不同调用的接口也不相同,Index值大于
  1026. if (rbgDirecType.SelectedIndex > 13)
  1027. {
  1028. uiGroupBox1.Visible = false;
  1029. uiGroupBox5.Visible = false;
  1030. uiGroupBox2.Visible = true;
  1031. //uiGroupBox3.Visible = true;
  1032. uiProcessBar1.Visible = false;
  1033. uiGroupBox2.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1034. uiGroupBox3.Left = uiGroupBox2.Width+rbgDirecType.Width + rbgDirecType.Left + 10;
  1035. dgvDirectoy.DataSource = null;
  1036. }
  1037. else
  1038. {
  1039. uiGroupBox1.Visible = true;
  1040. uiGroupBox5.Visible = true;
  1041. uiGroupBox2.Visible = true;
  1042. //uiGroupBox3.Visible = false;
  1043. uiProcessBar1.Visible = true;
  1044. uiGroupBox1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1045. uiGroupBox5.Left = uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 10;
  1046. uiGroupBox2.Left = uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 15;
  1047. uiGroupBox3.Left = uiGroupBox2.Width + uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 20;
  1048. uiProcessBar1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1049. uiProcessBar1.Width = uiGroupBox1.Width + uiGroupBox5.Width + uiGroupBox2.Width + 10;
  1050. }
  1051. setHeaderTxt(rbgDirecType.SelectedIndex, dgvDirectoy);
  1052. }
  1053. private void toolStripMenuItem2_Click(object sender, EventArgs e)
  1054. {
  1055. CancleMapping();
  1056. }
  1057. private void tsmiMapping_Click(object sender, EventArgs e)
  1058. {
  1059. Mapping();
  1060. }
  1061. private void dgvHISDirectory_DoubleClick(object sender, EventArgs e)
  1062. {
  1063. int currentPage = pgHISDirect.ActivePage;
  1064. string flag = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["flag"].Value.ToString();
  1065. if (flag == "未对照")
  1066. {
  1067. Mapping();
  1068. }
  1069. else
  1070. if (flag == "已对照")
  1071. {
  1072. CancleMapping();
  1073. }
  1074. if (rbAll.Checked)
  1075. {
  1076. string errMsg;
  1077. if (queryHISDirectory(1, 50, out errMsg) != 0)
  1078. {
  1079. MessageBox.Show(errMsg);
  1080. return;
  1081. }
  1082. }
  1083. }
  1084. private void dgvDirectoy_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1085. {
  1086. }
  1087. private void dgvDirectoy_CellContentClick(object sender, DataGridViewCellEventArgs e)
  1088. {
  1089. }
  1090. private void uiRadioButton1_CheckedChanged(object sender, EventArgs e)
  1091. {
  1092. }
  1093. private void dgvDirectoy_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1094. {
  1095. //自动编号,与数据无关
  1096. Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
  1097. e.RowBounds.Location.Y,
  1098. dgvDirectoy.RowHeadersWidth - 4,
  1099. e.RowBounds.Height);
  1100. TextRenderer.DrawText(e.Graphics,
  1101. (e.RowIndex + 1).ToString(),
  1102. dgvDirectoy.RowHeadersDefaultCellStyle.Font,
  1103. rectangle,
  1104. dgvDirectoy.RowHeadersDefaultCellStyle.ForeColor,
  1105. TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
  1106. }
  1107. private void rbAll_ValueChanged(object sender, bool value)
  1108. {
  1109. //if (rbAll.Checked)
  1110. //{
  1111. // btnQueryHISDirectory_Click(null, new EventArgs());
  1112. //}
  1113. }
  1114. private void rbMaped_CheckedChanged(object sender, EventArgs e)
  1115. {
  1116. //if (rbMaped.Checked)
  1117. //{
  1118. // string errMsg;
  1119. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  1120. // {
  1121. // MessageBox.Show(errMsg);
  1122. // return;
  1123. // }
  1124. //}
  1125. }
  1126. private void btAddDir_Click(object sender, EventArgs e)
  1127. {
  1128. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex);
  1129. if (addDirectory.ShowDialog() == DialogResult.OK)
  1130. {
  1131. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1132. string error = "";
  1133. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1134. {
  1135. MessageBox.Show("新增失败:" + error);
  1136. }
  1137. else
  1138. {
  1139. MessageBox.Show("新增成功");
  1140. }
  1141. }
  1142. }
  1143. private void btEditDir_Click(object sender, EventArgs e)
  1144. {
  1145. DataTable dt = (DataTable)dgvDirectoy.DataSource;
  1146. if ((dt == null) || (dt.Rows.Count < 1))
  1147. {
  1148. MessageBox.Show("表中无数据,请检查!");
  1149. return;
  1150. }
  1151. DataRow dr = dt.Rows[dgvDirectoy.CurrentRow.Index];
  1152. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex, dr);
  1153. if (addDirectory.ShowDialog() == DialogResult.OK)
  1154. {
  1155. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1156. string error = "";
  1157. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1158. {
  1159. MessageBox.Show("修改失败:" + error);
  1160. }
  1161. else
  1162. {
  1163. if (tbDirectoryCode.Text != "")
  1164. {
  1165. btnQuery.PerformClick();
  1166. }
  1167. MessageBox.Show("修改成功");
  1168. }
  1169. }
  1170. }
  1171. private void btnExit_Click(object sender, EventArgs e)
  1172. {
  1173. Close();
  1174. }
  1175. /// <summary>
  1176. /// 几个医保查询的交易组织入参
  1177. /// </summary>
  1178. /// <param name="Index"></param>
  1179. /// <param name="funNo"></param>
  1180. /// <returns></returns>
  1181. private JObject GetInput(int Index, out TradeEnum trade)
  1182. {
  1183. trade = TradeEnum.MedicalServiceDirectory;
  1184. dynamic joData = new JObject();
  1185. switch (Index)
  1186. {
  1187. case 14://民族药品目
  1188. {
  1189. trade = TradeEnum.NationalityDrug;
  1190. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1191. joData.genname_codg = ""; //通用名编号
  1192. joData.drug_genname = ""; //药品通用名
  1193. joData.drug_prodname = tbDircetoryName.Text; //药品商品名
  1194. joData.reg_name = ""; //注册名称
  1195. joData.tcmherb_name = ""; //中草药名称
  1196. joData.mlms_name = ""; //药材名称
  1197. joData.vali_flag = ""; //有效标志
  1198. joData.rid = ""; //唯一记录号
  1199. joData.ver = ""; //版本号
  1200. joData.ver_name = ""; //版本名称
  1201. joData.opt_begn_time = ""; //经办开始时间
  1202. joData.opt_end_time = ""; //经办结束时间
  1203. joData.updt_time = TexDate.Text; //更新时间
  1204. joData.page_num = TexDQYS.Text; //当前页数
  1205. joData.page_size = TexBYSJL.Text; //本页数据量
  1206. break;
  1207. }
  1208. case 15://目录信息查询
  1209. {
  1210. trade = TradeEnum.InsuDirectory;
  1211. joData.query_date = ""; //查询时间点
  1212. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1213. joData.insu_admdvs = ""; //参保机构医保区划
  1214. joData.begndate = ""; //开始日期
  1215. joData.hilist_name = tbDircetoryName.Text; //医保目录名称
  1216. joData.wubi = ""; //五笔助记码
  1217. joData.pinyin = ""; //拼音助记码
  1218. joData.med_chrgitm_type = ""; //医疗收费项目类别
  1219. joData.chrgitm_lv = ""; //收费项目等级
  1220. joData.lmt_used_flag = ""; //限制使用标志
  1221. joData.list_type = ""; //目录类别
  1222. joData.med_use_flag = ""; //医疗使用标志
  1223. joData.matn_used_flag = ""; //生育使用标志
  1224. joData.hilist_use_type = ""; //医保目录使用类别
  1225. joData.lmt_cpnd_type = ""; //限复方使用类型
  1226. joData.vali_flag = ""; //有效标志
  1227. joData.updt_time = TexDate.Text; //更新时间
  1228. joData.page_num = TexDQYS.Text; //当前页数
  1229. joData.page_size = TexBYSJL.Text; //本页数据量
  1230. break;
  1231. }
  1232. case 16://医疗与医保目录匹配
  1233. {
  1234. trade = TradeEnum.MedicalAndInsuDirectory;
  1235. joData.query_date = ""; //查询时间点
  1236. joData.medins_list_codg = ""; //定点医药机构目录编号
  1237. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1238. joData.list_type = ""; //目录类别
  1239. joData.insu_admdvs = ""; //参保机构医保区划
  1240. joData.begndate = ""; //开始日期
  1241. joData.vali_flag = ""; //有效标志
  1242. joData.updt_time = TexDate.Text; //更新时间
  1243. joData.page_num = TexDQYS.Text; //当前页数
  1244. joData.page_size = TexBYSJL.Text; //本页数据量
  1245. break;
  1246. }
  1247. case 17://医药机构目录匹配
  1248. {
  1249. trade = TradeEnum.MedcineOrgDirectory;
  1250. joData.query_date = ""; //查询时间点
  1251. joData.fixmedins_code = ""; //定点医药机构编号
  1252. joData.medins_list_codg = ""; //定点医药机构目录编号
  1253. joData.medins_list_name = ""; //定点医药机构目录名称
  1254. joData.insu_admdvs = ""; //参保机构医保区划
  1255. joData.list_type = ""; //目录类别
  1256. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1257. joData.begndate = ""; //开始日期
  1258. joData.vali_flag = ""; //有效标志
  1259. joData.updt_time = TexDate.Text; //更新时间
  1260. joData.page_num = TexDQYS.Text; //当前页数
  1261. joData.page_size = TexBYSJL.Text; //本页数据量
  1262. break;
  1263. }
  1264. case 18://医保目录限价
  1265. {
  1266. trade = TradeEnum.InsuPriceLimitDirectory;
  1267. joData.query_date = ""; //查询时间点
  1268. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1269. joData.hilist_lmtpric_type = ""; //医保目录限价类型
  1270. joData.overlmt_dspo_way = ""; //医保目录超限处理方式
  1271. joData.insu_admdvs = ""; //参保机构医保区划
  1272. joData.begndate = ""; //开始日期
  1273. joData.enddate = ""; //结束日期
  1274. joData.vali_flag = ""; //有效标志
  1275. joData.rid = ""; //唯一记录号
  1276. joData.tabname = ""; //表名
  1277. joData.poolarea_no = ""; //统筹区
  1278. joData.updt_time = TexDate.Text; //更新时间
  1279. joData.page_num = TexDQYS.Text; //当前页数
  1280. joData.page_size = TexBYSJL.Text; //本页数据量
  1281. break;
  1282. }
  1283. case 19://医保目录先自付比例
  1284. {
  1285. trade = TradeEnum.PrepayPercentDirectory;
  1286. joData.query_date = ""; //查询时间点
  1287. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1288. joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
  1289. joData.selfpay_prop_type = ""; //目录自付比例类别
  1290. joData.insu_admdvs = ""; //参保机构医保区划
  1291. joData.begndate = ""; //开始日期
  1292. joData.enddate = ""; //结束日期
  1293. joData.vali_flag = ""; //有效标志
  1294. joData.rid = ""; //唯一记录号
  1295. joData.tabname = ""; //表名
  1296. joData.poolarea_no = ""; //统筹区
  1297. joData.updt_time = TexDate.Text; //更新时间
  1298. joData.page_num = TexDQYS.Text; //当前页数
  1299. joData.page_size = TexBYSJL.Text; //本页数据量
  1300. break;
  1301. }
  1302. case 20://医药机构信息
  1303. {
  1304. trade = TradeEnum.MedicalOrgination;
  1305. joData.fixmedins_type = "1"; //定点医疗服务机构类型 1定点医疗机构,2定点零售药店,3工伤定点康复机构,4辅助器具配置机构,5计划生育服务机构
  1306. joData.fixmedins_name = TexYYMC.Text; //定点医药机构名称
  1307. joData.fixmedins_code = ""; //定点医药机构编号
  1308. break;
  1309. }
  1310. }
  1311. return joData;
  1312. }
  1313. private void chek_UporCancel_CheckedChanged(object sender, EventArgs e)
  1314. {
  1315. }
  1316. private void uiButton1_Click(object sender, EventArgs e)
  1317. {
  1318. Close();
  1319. }
  1320. private void btnUpShip_Click(object sender, EventArgs e)
  1321. {
  1322. AllUpLoad();
  1323. }
  1324. private void btnCancelUpShip_Click(object sender, EventArgs e)
  1325. {
  1326. AllCancelUpload();
  1327. }
  1328. /// <summary>
  1329. /// 单条上传目录对照关系
  1330. /// </summary>
  1331. private void SingleUpload()
  1332. {
  1333. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1334. {
  1335. MessageBox.Show("请查询HIS目录对照关系");
  1336. return;
  1337. }
  1338. string errorMsg = "", sMLLX = "";
  1339. //单条目录对照关系上传
  1340. int iHis = dgvHISDirectory.CurrentRow.Index;
  1341. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1342. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1343. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1344. if (hisType == 1)
  1345. {
  1346. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1347. }
  1348. else if (hisType == 2)
  1349. {
  1350. sMLLX = "201";
  1351. }
  1352. else if (hisType == 3)
  1353. {
  1354. sMLLX = "301";
  1355. }
  1356. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1357. string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
  1358. string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
  1359. string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
  1360. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1361. //调用3301目录对照上传
  1362. JObject joData = new JObject();
  1363. joData.Add("fixmedins_hilist_id", HisCode);
  1364. joData.Add("fixmedins_hilist_name", HisName);
  1365. joData.Add("list_type", sMLLX); //目录类别
  1366. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1367. joData.Add("begndate", "2022-10-01"); //开始日期
  1368. joData.Add("enddate", UpdateDate); //结束日期
  1369. joData.Add("aprvno", "");
  1370. joData.Add("dosform", "");
  1371. joData.Add("exct_cont", "");
  1372. joData.Add("item_cont", "");
  1373. joData.Add("prcunt", "");
  1374. joData.Add("spec", "");
  1375. joData.Add("pacspec", "");
  1376. joData.Add("memo", "");
  1377. JObject joInput = new JObject();
  1378. joInput.Add("data", joData);
  1379. InvokeHelper invoker = new InvokeHelper();
  1380. JObject joRtn = invoker.invokeCenterService(TradeEnum.PreAnalysis, joInput);
  1381. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1382. {
  1383. MessageBox.Show("目录对照关系上传失败:" + errorMsg);
  1384. }
  1385. else
  1386. {
  1387. MessageBox.Show("目录对照关系上传成功!");
  1388. }
  1389. }
  1390. /// <summary>
  1391. /// 单条撤销目录对照关系上传
  1392. /// </summary>
  1393. private void SingleCancelUpload()
  1394. {
  1395. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1396. {
  1397. MessageBox.Show("请查询HIS目录对照关系");
  1398. return;
  1399. }
  1400. string errorMsg = "", sMLLX = "";
  1401. //撤销目录对照关系
  1402. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1403. int iHis = dgvHISDirectory.CurrentRow.Index;
  1404. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1405. string HisCode = dtHis.Rows[iHis]["HisCode"].ToString();
  1406. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1407. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1408. if (hisType == 1)
  1409. {
  1410. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1411. }
  1412. else if (hisType == 2)
  1413. {
  1414. sMLLX = "201";
  1415. }
  1416. else if (hisType == 3)
  1417. {
  1418. sMLLX = "301";
  1419. }
  1420. //调用3302目录对照撤销
  1421. JObject joData = new JObject();
  1422. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1423. joData.Add("fixmedins_hilist_id", HisCode);
  1424. joData.Add("list_type", sMLLX); //目录类别
  1425. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1426. JObject joInput = new JObject();
  1427. joInput.Add("data", joData);
  1428. InvokeHelper invoker = new InvokeHelper();
  1429. JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastCancel, joInput);
  1430. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1431. {
  1432. MessageBox.Show("目录对照撤销失败:" + errorMsg);
  1433. }
  1434. else
  1435. {
  1436. MessageBox.Show("目录对照撤销成功!");
  1437. }
  1438. }
  1439. /// <summary>
  1440. /// 全部上传目录对照关系
  1441. /// </summary>
  1442. private void AllUpLoad()
  1443. {
  1444. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1445. {
  1446. MessageBox.Show("请查询HIS目录对照关系");
  1447. return;
  1448. }
  1449. string sInputStr = "", sMLLX = "", errorMsg = "", Msg = "";
  1450. Boolean bOk = true;
  1451. JObject InputjoRtn = new JObject();
  1452. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1453. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1454. if (hisType == 1)
  1455. {
  1456. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1457. }
  1458. else if (hisType == 2)
  1459. {
  1460. sMLLX = "201";
  1461. }
  1462. else if (hisType == 3)
  1463. {
  1464. sMLLX = "301";
  1465. }
  1466. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1467. for (int i = 0; i < dtHis.Rows.Count; i++)
  1468. {
  1469. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString(); //医保目录编码
  1470. string InsuName = dtHis.Rows[i]["InsuName"].ToString(); //医保目录名称
  1471. string HisCode = dtHis.Rows[i]["itemCode"].ToString(); //HIS目录编码
  1472. string HisName = dtHis.Rows[i]["itemDesc"].ToString(); //HIS目录名称
  1473. //调用3301目录对照上传
  1474. JObject joData = new JObject();
  1475. joData.Add("fixmedins_hilist_id", HisCode);
  1476. joData.Add("fixmedins_hilist_name", HisName);
  1477. joData.Add("list_type", sMLLX); //目录类别
  1478. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1479. joData.Add("begndate", "2022-10-01"); //开始日期
  1480. joData.Add("enddate", UpdateDate); //结束日期
  1481. joData.Add("aprvno", "");
  1482. joData.Add("dosform", "");
  1483. joData.Add("exct_cont", "");
  1484. joData.Add("item_cont", "");
  1485. joData.Add("prcunt", "");
  1486. joData.Add("spec", "");
  1487. joData.Add("pacspec", "");
  1488. joData.Add("memo", "");
  1489. JObject joInput = new JObject();
  1490. joInput.Add("data", joData);
  1491. InvokeHelper invoker = new InvokeHelper();
  1492. JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastUpload, joInput);
  1493. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1494. {
  1495. bOk = false;
  1496. Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
  1497. }
  1498. }
  1499. if (bOk == false)
  1500. {
  1501. MessageBox.Show("全部目录对照关系上传成功,部分上传异常:" + Msg);
  1502. }
  1503. else
  1504. {
  1505. MessageBox.Show("全部目录对照关系上传成功!");
  1506. }
  1507. }
  1508. /// <summary>
  1509. /// 全部撤销目录对照关系上传
  1510. /// </summary>
  1511. private void AllCancelUpload()
  1512. {
  1513. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1514. {
  1515. MessageBox.Show("请查询HIS目录对照关系");
  1516. return;
  1517. }
  1518. string sMLLX = "", errorMsg = "", Msg = "";
  1519. Boolean bOk = true;
  1520. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1521. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1522. if (hisType == 1)
  1523. {
  1524. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1525. }
  1526. else if (hisType == 2)
  1527. {
  1528. sMLLX = "201";
  1529. }
  1530. else if (hisType == 3)
  1531. {
  1532. sMLLX = "301";
  1533. }
  1534. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1535. for (int i = 0; i < dtHis.Rows.Count; i++)
  1536. {
  1537. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();
  1538. string HisCode = dtHis.Rows[i]["HisCode"].ToString();
  1539. //调用3302目录对照撤销
  1540. JObject joData = new JObject();
  1541. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1542. joData.Add("fixmedins_hilist_id", HisCode);
  1543. joData.Add("list_type", sMLLX); //目录类别
  1544. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1545. JObject joInput = new JObject();
  1546. joInput.Add("data", joData);
  1547. InvokeHelper invoker = new InvokeHelper();
  1548. JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastCancel, joInput);
  1549. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1550. {
  1551. bOk = false;
  1552. Msg = Msg + "<" + joInput.ToString()+":" + errorMsg + ">";
  1553. }
  1554. }
  1555. if (bOk == false)
  1556. {
  1557. MessageBox.Show("全部撤销目录对照关系上传成功,部分撤销异常:" + Msg);
  1558. }
  1559. else
  1560. {
  1561. MessageBox.Show("全部撤销目录对照关系上传成功!");
  1562. }
  1563. }
  1564. private void ToolStripMenuItem_Upload_Click(object sender, EventArgs e)
  1565. {
  1566. SingleUpload();
  1567. }
  1568. private void ToolStripMenuItem_CancelUpload_Click(object sender, EventArgs e)
  1569. {
  1570. SingleCancelUpload();
  1571. }
  1572. private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
  1573. {
  1574. tbHISDirectoryFilter.Text = "";
  1575. uiTextBox1.Text = "";
  1576. rbAll.Checked = true;
  1577. rbMaped.Checked = false;
  1578. rbNoMaped.Checked = false;
  1579. tbCenterDirectoryFilter.Text = "";
  1580. tbInsuCode.Text = "";
  1581. tbApprovalNO.Text = "";
  1582. dgvCenterDirectory.DataSource = null;
  1583. btnQueryHISDirectory_Click(null, new EventArgs());
  1584. }
  1585. private void rbNoMaped_CheckedChanged(object sender, EventArgs e)
  1586. {
  1587. //if (rbNoMaped.Checked)
  1588. //{
  1589. // string errMsg;
  1590. // if (queryHISDirectory(1, 300, out errMsg) != 0)
  1591. // {
  1592. // MessageBox.Show(errMsg);
  1593. // return;
  1594. // }
  1595. //}
  1596. }
  1597. private void dgvHISDirectory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
  1598. {
  1599. e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1);
  1600. }
  1601. private void dgvCenterDirectory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
  1602. {
  1603. e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1);
  1604. }
  1605. private void limitPriceUpdate_Click(object sender, EventArgs e)
  1606. {
  1607. SelfpayPercentForm selfpay = new SelfpayPercentForm();
  1608. selfpay.CenterCode = dgvDirectoy.Rows[dgvDirectoy.SelectedIndex].Cells["Code"].Value + "";
  1609. selfpay.ShowDialog();
  1610. }
  1611. private void tsmUploadAllMappedData_Click(object sender, EventArgs e)
  1612. {
  1613. AllUpLoad();
  1614. }
  1615. private void tsmCancelAllUploadedData_Click(object sender, EventArgs e)
  1616. {
  1617. AllCancelUpload();
  1618. }
  1619. private void tsmExportMappedDataByLeft_Click(object sender, EventArgs e)
  1620. {
  1621. if (queryMapeDirectory(1, 3000, out string errMsg) != 0)
  1622. {
  1623. MessageBox.Show(errMsg);
  1624. return;
  1625. }
  1626. if (dtExport.Rows.Count > 0)
  1627. {
  1628. string directoryType = string.Empty;
  1629. switch (rbgDirecType_C.SelectedIndex)
  1630. {
  1631. case 0:
  1632. {
  1633. directoryType = "药品";
  1634. break;
  1635. }
  1636. case 1:
  1637. {
  1638. directoryType = "诊疗";
  1639. break;
  1640. }
  1641. case 2:
  1642. {
  1643. directoryType = "材料";
  1644. break;
  1645. }
  1646. }
  1647. string LSH = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("MMddHHmmssffff");
  1648. string sFliePathName = @"D:\" + LSH + "(" + directoryType + ")医保目录已对照信息.xls";
  1649. string ReturnFileName = ExportToExcel.DataTabletoExcel(dtExport, sFliePathName);
  1650. if (!string.IsNullOrEmpty(ReturnFileName))
  1651. {
  1652. MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  1653. System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  1654. }
  1655. else
  1656. MessageBox.Show("导出失败!");
  1657. }
  1658. }
  1659. private void tsmExportNoMappDataByLeft_Click(object sender, EventArgs e)
  1660. {
  1661. if (queryNoMappDirectory(1, 3000, out string errMsg) != 0)
  1662. {
  1663. MessageBox.Show(errMsg);
  1664. return;
  1665. }
  1666. if (dtExport.Rows.Count > 0)
  1667. {
  1668. string directoryType = string.Empty;
  1669. switch (rbgDirecType_C.SelectedIndex)
  1670. {
  1671. case 0:
  1672. {
  1673. directoryType = "药品";
  1674. break;
  1675. }
  1676. case 1:
  1677. {
  1678. directoryType = "诊疗";
  1679. break;
  1680. }
  1681. case 2:
  1682. {
  1683. directoryType = "材料";
  1684. break;
  1685. }
  1686. }
  1687. string LSH = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("MMddHHmmssffff");
  1688. string sFliePathName = @"D:\" + LSH + "(" + directoryType + ")医保目录未对照信息.xls";
  1689. string ReturnFileName = ExportToExcel.DataTabletoExcel(dtExport, sFliePathName);
  1690. if (!string.IsNullOrEmpty(ReturnFileName))
  1691. {
  1692. MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  1693. System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  1694. }
  1695. else
  1696. MessageBox.Show("导出失败!");
  1697. }
  1698. }
  1699. }
  1700. }