BasicData.cs 69 KB

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