BasicData.cs 69 KB

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