BasicData.cs 82 KB

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