BasicData.cs 76 KB

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