BasicData.cs 83 KB

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