BasicData.cs 65 KB

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