BasicData.cs 66 KB

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