BasicData.cs 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790
  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. public void loadTextDebug()
  739. {
  740. DataImoport bus = new DataImoport();
  741. string txtPath = @"E:\insu\Demo\bin\Debug\20230101535395327567680436.txt";
  742. JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, 2, uiProcessBar1);
  743. }
  744. /// <summary>
  745. /// 医保目录单个版本号的下载
  746. /// </summary>
  747. /// <param name="ver"></param>
  748. /// <param name="directoryType"></param>
  749. /// <param name="uiProcessBar"></param>
  750. /// <param name="errorMessage"></param>
  751. /// <returns></returns>
  752. public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, string dictCode,out string errorMessage)
  753. {
  754. errorMessage = "";
  755. int iResult = -1;
  756. try
  757. {
  758. JObject joRtn = cBus.DownDictionay(joData);
  759. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  760. {
  761. DataImoport DI = new DataImoport();
  762. JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.list"));
  763. JObject joImportRtn = DI.importDictionary(uiProcessBar, jaList, dictCode);
  764. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  765. {
  766. iResult = 0;
  767. }
  768. else
  769. {
  770. errorMessage = "导入数据出现错误,请查看日志!" + errorMessage;
  771. }
  772. }
  773. return iResult;
  774. }
  775. catch (Exception ex)
  776. {
  777. errorMessage = "downloadDicionary提示:" + ex.Message;
  778. return -1;
  779. }
  780. }
  781. /// <summary>
  782. /// 自动下载医保目录,直到最新版本(返回报错)
  783. /// </summary>
  784. /// <param name="directoryType"></param>
  785. /// <param name="uiProcessBar"></param>
  786. /// <param name="errorMessage"></param>
  787. /// <returns></returns>
  788. public int AutoDownload(int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
  789. {
  790. int iResult = 0;
  791. errorMessage = "";
  792. try
  793. {
  794. while (iResult == 0)
  795. {
  796. JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(directoryType);
  797. string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
  798. tbVer.Text = ver;
  799. iResult = JsonHelper.parseIrisRtnValue(joMaxVerNO, out errorMessage);
  800. iResult = SingleDownload(ver, directoryType, uiProcessBar, out errorMessage);
  801. }
  802. return iResult;
  803. }
  804. catch (Exception ex)
  805. {
  806. errorMessage = ex.Message;
  807. return -1;
  808. }
  809. }
  810. #endregion
  811. private void Form1_Load(object sender, EventArgs e)
  812. {
  813. this.WindowState = FormWindowState.Maximized;
  814. rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
  815. LabExplain.Visible = false;
  816. }
  817. private void btnDownload_Click(object sender, EventArgs e)
  818. {
  819. string errorMessage = string.Empty;
  820. //医保字典数据下载
  821. if (rbgDirecType.SelectedIndex == 8)
  822. {
  823. if (tbDicDate.Text == "")
  824. {
  825. MessageBox.Show("请输入查询日期!");
  826. return;
  827. }
  828. // 支持批量
  829. string[] dictText = tbDicType.Text.Trim().Split(",".ToCharArray());
  830. dictText.ToList().ForEach((dict) =>
  831. {
  832. this.downloadDict(dict);
  833. });
  834. }
  835. else if (rbgDirecType.SelectedIndex <=10)
  836. {
  837. if (rbSingleDown.Checked)
  838. {
  839. string ver = tbVer.Text;
  840. if (tbVer.Text != "")
  841. {
  842. ver = tbVer.Text;
  843. }
  844. if (SingleDownload(ver, rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  845. {
  846. MessageBox.Show("医保目录下载失败:" + errorMessage);
  847. return;
  848. }
  849. }
  850. if (rbAutoDown.Checked)
  851. {
  852. if (AutoDownload(rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  853. {
  854. MessageBox.Show("医保目录下载失败:" + errorMessage);
  855. return;
  856. }
  857. }
  858. }
  859. btnQuery_Click(sender, e);
  860. }
  861. private void downloadDict(string dictCode)
  862. {
  863. try
  864. {
  865. string errorMessage = "";
  866. dynamic joData = new JObject();
  867. joData.type = dictCode; //字典类型
  868. joData.parentValue = ""; //父字典键值
  869. joData.admdvs = Global.inf.areaCode; //行政区划 就医地
  870. joData.date = tbDicDate.Text; //查询日期
  871. joData.vali_flag = "1"; //有效标志
  872. if (downloadDicionary(joData, uiProcessBar1,dictCode, out errorMessage) != 0)
  873. {
  874. MessageBox.Show("医保字典下载失败:" + errorMessage);
  875. }
  876. }
  877. catch (Exception e)
  878. {
  879. }
  880. }
  881. private void btnQuery_Click(object sender, EventArgs e)
  882. {
  883. #region 校验查询条件
  884. if ((rbgDirecType.SelectedIndex < 0) || (rbgDirecType.SelectedIndex > 20))
  885. {
  886. MessageBox.Show("请先选择查询类型!");
  887. return;
  888. }
  889. if (rbgDirecType.SelectedIndex > 13)
  890. {
  891. if (rbgDirecType.SelectedIndex != 20)
  892. {
  893. if ((TexDate.Text == "") || (TexDate.Text == "输入日期 2021-01-01"))
  894. {
  895. MessageBox.Show("查询条件-请输入查询日期!");
  896. return;
  897. }
  898. if ((TexDQYS.Text == "") || (TexDQYS.Text == "当前页数"))
  899. {
  900. MessageBox.Show("查询条件-请输入当前页数!");
  901. return;
  902. }
  903. if ((TexBYSJL.Text == "") || (TexBYSJL.Text == "本页数据量"))
  904. {
  905. MessageBox.Show("查询条件-请输入本页数据量!");
  906. return;
  907. }
  908. }
  909. else
  910. {
  911. if ((TexYYMC.Text == "") || (TexYYMC.Text == "输入医院名称模糊查找"))
  912. {
  913. MessageBox.Show("查询条件-请输入医院名称模糊查找!");
  914. return;
  915. }
  916. }
  917. }
  918. #endregion
  919. queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy, Global.inf.interfaceDr);
  920. }
  921. private void btnQueryHISDirectory_Click(object sender, EventArgs e)
  922. {
  923. int iCount = 50;
  924. if (rbNoMaped.Checked) iCount = 300;
  925. string errMsg;
  926. if (queryHISDirectory(1, iCount, out errMsg) != 0)
  927. {
  928. MessageBox.Show(errMsg);
  929. return;
  930. }
  931. }
  932. private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
  933. {
  934. if ((tbCenterDirectoryFilter.Text == "") && (tbInsuCode.Text == "") && (tbApprovalNO.Text == "") &&
  935. (tbManufacturer.Text == "") && (tbSpecifications.Text == "") && (tbDosageForm.Text == ""))
  936. {
  937. return;
  938. }
  939. //查询区域通用目录
  940. JObject joRtn = mIS.getInterface_TY(Global.inf.interfaceDr.ToString(),"");
  941. string InsuCurrencyCataLogue = JsonHelper.getDestValue(joRtn, "InsuCurrencyCataLogue"); //通用目录编码 6
  942. string InterfaceName_TY = JsonHelper.getDestValue(joRtn, "InterfaceName_TY"); //通用目录名称
  943. string HospName_TY = JsonHelper.getDestValue(joRtn, "HospitalName"); //目录名称
  944. string HospitalDr_TY = JsonHelper.getDestValue(joRtn, "HospitalDr_TY"); //区域通用目录医院ID
  945. if (InsuCurrencyCataLogue != "")
  946. {
  947. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, int.Parse(InsuCurrencyCataLogue));
  948. LabExplain.Visible = true;
  949. LabExplain.Text = "当前接口已设置区域通用目录,数据源:" + HospName_TY + " ,如果确认没有所查目录请联系数据源医院新增维护!";
  950. }
  951. else
  952. {
  953. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
  954. LabExplain.Visible = true;
  955. LabExplain.Text = "当前接口未设置区域通用目录,数据源:" + HospName_TY;
  956. }
  957. }
  958. private void pgDownload_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  959. {
  960. queryHISInsuDirectory(rbgDirecType.SelectedIndex, pageIndex, count, dgvDirectoy, Global.inf.interfaceDr);
  961. }
  962. private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  963. {
  964. string errMsg;
  965. int iCount = 50;
  966. if (rbNoMaped.Checked) iCount = 300;
  967. if (queryHISDirectory(pageIndex, iCount, out errMsg) != 0)
  968. {
  969. MessageBox.Show(errMsg);
  970. return;
  971. }
  972. }
  973. private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  974. {
  975. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, pageIndex, count, dgvCenterDirectory, Global.inf.interfaceDr);
  976. }
  977. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  978. {
  979. //选定项不同调用的接口也不相同,Index值大于
  980. if (rbgDirecType.SelectedIndex > 13)
  981. {
  982. uiGroupBox1.Visible = false;
  983. uiGroupBox5.Visible = false;
  984. uiGroupBox2.Visible = true;
  985. //uiGroupBox3.Visible = true;
  986. uiProcessBar1.Visible = false;
  987. uiGroupBox2.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  988. uiGroupBox3.Left = uiGroupBox2.Width+rbgDirecType.Width + rbgDirecType.Left + 10;
  989. dgvDirectoy.DataSource = null;
  990. }
  991. else
  992. {
  993. uiGroupBox1.Visible = true;
  994. uiGroupBox5.Visible = true;
  995. uiGroupBox2.Visible = true;
  996. //uiGroupBox3.Visible = false;
  997. uiProcessBar1.Visible = true;
  998. uiGroupBox1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  999. uiGroupBox5.Left = uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 10;
  1000. uiGroupBox2.Left = uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 15;
  1001. uiGroupBox3.Left = uiGroupBox2.Width + uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 20;
  1002. uiProcessBar1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1003. uiProcessBar1.Width = uiGroupBox1.Width + uiGroupBox5.Width + uiGroupBox2.Width + 10;
  1004. }
  1005. setHeaderTxt(rbgDirecType.SelectedIndex, dgvDirectoy);
  1006. }
  1007. private void toolStripMenuItem2_Click(object sender, EventArgs e)
  1008. {
  1009. CancleMapping();
  1010. }
  1011. private void tsmiMapping_Click(object sender, EventArgs e)
  1012. {
  1013. Mapping();
  1014. }
  1015. private void dgvHISDirectory_DoubleClick(object sender, EventArgs e)
  1016. {
  1017. int currentPage = pgHISDirect.ActivePage;
  1018. string flag = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["flag"].Value.ToString();
  1019. if (flag == "未对照")
  1020. {
  1021. Mapping();
  1022. }
  1023. else
  1024. if (flag == "已对照")
  1025. {
  1026. CancleMapping();
  1027. }
  1028. if (rbAll.Checked)
  1029. {
  1030. string errMsg;
  1031. if (queryHISDirectory(1, 50, out errMsg) != 0)
  1032. {
  1033. MessageBox.Show(errMsg);
  1034. return;
  1035. }
  1036. }
  1037. }
  1038. private void dgvDirectoy_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1039. {
  1040. }
  1041. private void dgvDirectoy_CellContentClick(object sender, DataGridViewCellEventArgs e)
  1042. {
  1043. }
  1044. private void uiRadioButton1_CheckedChanged(object sender, EventArgs e)
  1045. {
  1046. }
  1047. private void dgvDirectoy_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1048. {
  1049. //自动编号,与数据无关
  1050. Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
  1051. e.RowBounds.Location.Y,
  1052. dgvDirectoy.RowHeadersWidth - 4,
  1053. e.RowBounds.Height);
  1054. TextRenderer.DrawText(e.Graphics,
  1055. (e.RowIndex + 1).ToString(),
  1056. dgvDirectoy.RowHeadersDefaultCellStyle.Font,
  1057. rectangle,
  1058. dgvDirectoy.RowHeadersDefaultCellStyle.ForeColor,
  1059. TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
  1060. }
  1061. private void rbAll_ValueChanged(object sender, bool value)
  1062. {
  1063. //if (rbAll.Checked)
  1064. //{
  1065. // btnQueryHISDirectory_Click(null, new EventArgs());
  1066. //}
  1067. }
  1068. private void rbMaped_CheckedChanged(object sender, EventArgs e)
  1069. {
  1070. //if (rbMaped.Checked)
  1071. //{
  1072. // string errMsg;
  1073. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  1074. // {
  1075. // MessageBox.Show(errMsg);
  1076. // return;
  1077. // }
  1078. //}
  1079. }
  1080. private void btAddDir_Click(object sender, EventArgs e)
  1081. {
  1082. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex);
  1083. if (addDirectory.ShowDialog() == DialogResult.OK)
  1084. {
  1085. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1086. string error = "";
  1087. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1088. {
  1089. MessageBox.Show("新增失败:" + error);
  1090. }
  1091. else
  1092. {
  1093. MessageBox.Show("新增成功");
  1094. }
  1095. }
  1096. }
  1097. private void btEditDir_Click(object sender, EventArgs e)
  1098. {
  1099. DataTable dt = (DataTable)dgvDirectoy.DataSource;
  1100. if ((dt == null) || (dt.Rows.Count < 1))
  1101. {
  1102. MessageBox.Show("表中无数据,请检查!");
  1103. return;
  1104. }
  1105. DataRow dr = dt.Rows[dgvDirectoy.CurrentRow.Index];
  1106. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex, dr);
  1107. if (addDirectory.ShowDialog() == DialogResult.OK)
  1108. {
  1109. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1110. string error = "";
  1111. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1112. {
  1113. MessageBox.Show("修改失败:" + error);
  1114. }
  1115. else
  1116. {
  1117. MessageBox.Show("修改成功");
  1118. }
  1119. }
  1120. }
  1121. private void btnExit_Click(object sender, EventArgs e)
  1122. {
  1123. Close();
  1124. }
  1125. /// <summary>
  1126. /// 几个医保查询的交易组织入参
  1127. /// </summary>
  1128. /// <param name="Index"></param>
  1129. /// <param name="funNo"></param>
  1130. /// <returns></returns>
  1131. private JObject GetInput(int Index, out string funNo)
  1132. {
  1133. funNo = "";
  1134. dynamic joData = new JObject();
  1135. switch (Index)
  1136. {
  1137. case 14://民族药品目
  1138. {
  1139. funNo = "1304";
  1140. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1141. joData.genname_codg = ""; //通用名编号
  1142. joData.drug_genname = ""; //药品通用名
  1143. joData.drug_prodname = tbDircetoryName.Text; //药品商品名
  1144. joData.reg_name = ""; //注册名称
  1145. joData.tcmherb_name = ""; //中草药名称
  1146. joData.mlms_name = ""; //药材名称
  1147. joData.vali_flag = ""; //有效标志
  1148. joData.rid = ""; //唯一记录号
  1149. joData.ver = ""; //版本号
  1150. joData.ver_name = ""; //版本名称
  1151. joData.opt_begn_time = ""; //经办开始时间
  1152. joData.opt_end_time = ""; //经办结束时间
  1153. joData.updt_time = TexDate.Text; //更新时间
  1154. joData.page_num = TexDQYS.Text; //当前页数
  1155. joData.page_size = TexBYSJL.Text; //本页数据量
  1156. break;
  1157. }
  1158. case 15://目录信息查询
  1159. {
  1160. funNo = "1312";
  1161. joData.query_date = ""; //查询时间点
  1162. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1163. joData.insu_admdvs = ""; //参保机构医保区划
  1164. joData.begndate = ""; //开始日期
  1165. joData.hilist_name = tbDircetoryName.Text; //医保目录名称
  1166. joData.wubi = ""; //五笔助记码
  1167. joData.pinyin = ""; //拼音助记码
  1168. joData.med_chrgitm_type = ""; //医疗收费项目类别
  1169. joData.chrgitm_lv = ""; //收费项目等级
  1170. joData.lmt_used_flag = ""; //限制使用标志
  1171. joData.list_type = ""; //目录类别
  1172. joData.med_use_flag = ""; //医疗使用标志
  1173. joData.matn_used_flag = ""; //生育使用标志
  1174. joData.hilist_use_type = ""; //医保目录使用类别
  1175. joData.lmt_cpnd_type = ""; //限复方使用类型
  1176. joData.vali_flag = ""; //有效标志
  1177. joData.updt_time = TexDate.Text; //更新时间
  1178. joData.page_num = TexDQYS.Text; //当前页数
  1179. joData.page_size = TexBYSJL.Text; //本页数据量
  1180. break;
  1181. }
  1182. case 16://医疗与医保目录匹配
  1183. {
  1184. funNo = "1316";
  1185. joData.query_date = ""; //查询时间点
  1186. joData.medins_list_codg = ""; //定点医药机构目录编号
  1187. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1188. joData.list_type = ""; //目录类别
  1189. joData.insu_admdvs = ""; //参保机构医保区划
  1190. joData.begndate = ""; //开始日期
  1191. joData.vali_flag = ""; //有效标志
  1192. joData.updt_time = TexDate.Text; //更新时间
  1193. joData.page_num = TexDQYS.Text; //当前页数
  1194. joData.page_size = TexBYSJL.Text; //本页数据量
  1195. break;
  1196. }
  1197. case 17://医药机构目录匹配
  1198. {
  1199. funNo = "1317";
  1200. joData.query_date = ""; //查询时间点
  1201. joData.fixmedins_code = ""; //定点医药机构编号
  1202. joData.medins_list_codg = ""; //定点医药机构目录编号
  1203. joData.medins_list_name = ""; //定点医药机构目录名称
  1204. joData.insu_admdvs = ""; //参保机构医保区划
  1205. joData.list_type = ""; //目录类别
  1206. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1207. joData.begndate = ""; //开始日期
  1208. joData.vali_flag = ""; //有效标志
  1209. joData.updt_time = TexDate.Text; //更新时间
  1210. joData.page_num = TexDQYS.Text; //当前页数
  1211. joData.page_size = TexBYSJL.Text; //本页数据量
  1212. break;
  1213. }
  1214. case 18://医保目录限价
  1215. {
  1216. funNo = "1318";
  1217. joData.query_date = ""; //查询时间点
  1218. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1219. joData.hilist_lmtpric_type = ""; //医保目录限价类型
  1220. joData.overlmt_dspo_way = ""; //医保目录超限处理方式
  1221. joData.insu_admdvs = ""; //参保机构医保区划
  1222. joData.begndate = ""; //开始日期
  1223. joData.enddate = ""; //结束日期
  1224. joData.vali_flag = ""; //有效标志
  1225. joData.rid = ""; //唯一记录号
  1226. joData.tabname = ""; //表名
  1227. joData.poolarea_no = ""; //统筹区
  1228. joData.updt_time = TexDate.Text; //更新时间
  1229. joData.page_num = TexDQYS.Text; //当前页数
  1230. joData.page_size = TexBYSJL.Text; //本页数据量
  1231. break;
  1232. }
  1233. case 19://医保目录先自付比例
  1234. {
  1235. funNo = "1319";
  1236. joData.query_date = ""; //查询时间点
  1237. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1238. joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
  1239. joData.selfpay_prop_type = ""; //目录自付比例类别
  1240. joData.insu_admdvs = ""; //参保机构医保区划
  1241. joData.begndate = ""; //开始日期
  1242. joData.enddate = ""; //结束日期
  1243. joData.vali_flag = ""; //有效标志
  1244. joData.rid = ""; //唯一记录号
  1245. joData.tabname = ""; //表名
  1246. joData.poolarea_no = ""; //统筹区
  1247. joData.updt_time = TexDate.Text; //更新时间
  1248. joData.page_num = TexDQYS.Text; //当前页数
  1249. joData.page_size = TexBYSJL.Text; //本页数据量
  1250. break;
  1251. }
  1252. case 20://医药机构信息
  1253. {
  1254. funNo = "1201";
  1255. joData.fixmedins_type = "1"; //定点医疗服务机构类型 1定点医疗机构,2定点零售药店,3工伤定点康复机构,4辅助器具配置机构,5计划生育服务机构
  1256. joData.fixmedins_name = TexYYMC.Text; //定点医药机构名称
  1257. joData.fixmedins_code = ""; //定点医药机构编号
  1258. break;
  1259. }
  1260. }
  1261. return joData;
  1262. }
  1263. private void chek_UporCancel_CheckedChanged(object sender, EventArgs e)
  1264. {
  1265. }
  1266. private void uiButton1_Click(object sender, EventArgs e)
  1267. {
  1268. Close();
  1269. }
  1270. private void btnUpShip_Click(object sender, EventArgs e)
  1271. {
  1272. AllUpLoad();
  1273. }
  1274. private void btnCancelUpShip_Click(object sender, EventArgs e)
  1275. {
  1276. AllCancelUpload();
  1277. }
  1278. /// <summary>
  1279. /// 单条上传目录对照关系
  1280. /// </summary>
  1281. private void SingleUpload()
  1282. {
  1283. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1284. {
  1285. MessageBox.Show("请查询HIS目录对照关系");
  1286. return;
  1287. }
  1288. string errorMsg = "", sMLLX = "";
  1289. //单条目录对照关系上传
  1290. int iHis = dgvHISDirectory.CurrentRow.Index;
  1291. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1292. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1293. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1294. if (hisType == 1)
  1295. {
  1296. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1297. }
  1298. else if (hisType == 2)
  1299. {
  1300. sMLLX = "201";
  1301. }
  1302. else if (hisType == 3)
  1303. {
  1304. sMLLX = "301";
  1305. }
  1306. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1307. string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
  1308. string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
  1309. string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
  1310. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1311. //调用3301目录对照上传
  1312. JObject joData = new JObject();
  1313. joData.Add("fixmedins_hilist_id", HisCode);
  1314. joData.Add("fixmedins_hilist_name", HisName);
  1315. joData.Add("list_type", sMLLX); //目录类别
  1316. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1317. joData.Add("begndate", "2022-10-01"); //开始日期
  1318. joData.Add("enddate", UpdateDate); //结束日期
  1319. joData.Add("aprvno", "");
  1320. joData.Add("dosform", "");
  1321. joData.Add("exct_cont", "");
  1322. joData.Add("item_cont", "");
  1323. joData.Add("prcunt", "");
  1324. joData.Add("spec", "");
  1325. joData.Add("pacspec", "");
  1326. joData.Add("memo", "");
  1327. JObject joInput = new JObject();
  1328. joInput.Add("data", joData);
  1329. InvokeHelper invoker = new InvokeHelper();
  1330. JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
  1331. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1332. {
  1333. MessageBox.Show("目录对照关系上传失败:" + errorMsg);
  1334. }
  1335. else
  1336. {
  1337. MessageBox.Show("目录对照关系上传成功!");
  1338. }
  1339. }
  1340. /// <summary>
  1341. /// 单条撤销目录对照关系上传
  1342. /// </summary>
  1343. private void SingleCancelUpload()
  1344. {
  1345. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1346. {
  1347. MessageBox.Show("请查询HIS目录对照关系");
  1348. return;
  1349. }
  1350. string errorMsg = "", sMLLX = "";
  1351. //撤销目录对照关系
  1352. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1353. int iHis = dgvHISDirectory.CurrentRow.Index;
  1354. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1355. string HisCode = dtHis.Rows[iHis]["HisCode"].ToString();
  1356. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1357. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1358. if (hisType == 1)
  1359. {
  1360. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1361. }
  1362. else if (hisType == 2)
  1363. {
  1364. sMLLX = "201";
  1365. }
  1366. else if (hisType == 3)
  1367. {
  1368. sMLLX = "301";
  1369. }
  1370. //调用3302目录对照撤销
  1371. JObject joData = new JObject();
  1372. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1373. joData.Add("fixmedins_hilist_id", HisCode);
  1374. joData.Add("list_type", sMLLX); //目录类别
  1375. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1376. JObject joInput = new JObject();
  1377. joInput.Add("data", joData);
  1378. InvokeHelper invoker = new InvokeHelper();
  1379. JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
  1380. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1381. {
  1382. MessageBox.Show("目录对照撤销失败:" + errorMsg);
  1383. }
  1384. else
  1385. {
  1386. MessageBox.Show("目录对照撤销成功!");
  1387. }
  1388. }
  1389. /// <summary>
  1390. /// 全部上传目录对照关系
  1391. /// </summary>
  1392. private void AllUpLoad()
  1393. {
  1394. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1395. {
  1396. MessageBox.Show("请查询HIS目录对照关系");
  1397. return;
  1398. }
  1399. string sInputStr = "", sMLLX = "", errorMsg = "", Msg = "";
  1400. Boolean bOk = true;
  1401. JObject InputjoRtn = new JObject();
  1402. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1403. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1404. if (hisType == 1)
  1405. {
  1406. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1407. }
  1408. else if (hisType == 2)
  1409. {
  1410. sMLLX = "201";
  1411. }
  1412. else if (hisType == 3)
  1413. {
  1414. sMLLX = "301";
  1415. }
  1416. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1417. for (int i = 0; i < dtHis.Rows.Count; i++)
  1418. {
  1419. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString(); //医保目录编码
  1420. string InsuName = dtHis.Rows[i]["InsuName"].ToString(); //医保目录名称
  1421. string HisCode = dtHis.Rows[i]["itemCode"].ToString(); //HIS目录编码
  1422. string HisName = dtHis.Rows[i]["itemDesc"].ToString(); //HIS目录名称
  1423. //调用3301目录对照上传
  1424. JObject joData = new JObject();
  1425. joData.Add("fixmedins_hilist_id", HisCode);
  1426. joData.Add("fixmedins_hilist_name", HisName);
  1427. joData.Add("list_type", sMLLX); //目录类别
  1428. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1429. joData.Add("begndate", "2022-10-01"); //开始日期
  1430. joData.Add("enddate", UpdateDate); //结束日期
  1431. joData.Add("aprvno", "");
  1432. joData.Add("dosform", "");
  1433. joData.Add("exct_cont", "");
  1434. joData.Add("item_cont", "");
  1435. joData.Add("prcunt", "");
  1436. joData.Add("spec", "");
  1437. joData.Add("pacspec", "");
  1438. joData.Add("memo", "");
  1439. JObject joInput = new JObject();
  1440. joInput.Add("data", joData);
  1441. InvokeHelper invoker = new InvokeHelper();
  1442. JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
  1443. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1444. {
  1445. bOk = false;
  1446. Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
  1447. }
  1448. }
  1449. if (bOk == false)
  1450. {
  1451. MessageBox.Show("全部目录对照关系上传成功,部分上传异常:" + Msg);
  1452. }
  1453. else
  1454. {
  1455. MessageBox.Show("全部目录对照关系上传成功!");
  1456. }
  1457. }
  1458. /// <summary>
  1459. /// 全部撤销目录对照关系上传
  1460. /// </summary>
  1461. private void AllCancelUpload()
  1462. {
  1463. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1464. {
  1465. MessageBox.Show("请查询HIS目录对照关系");
  1466. return;
  1467. }
  1468. string sMLLX = "", errorMsg = "", Msg = "";
  1469. Boolean bOk = true;
  1470. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1471. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1472. if (hisType == 1)
  1473. {
  1474. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1475. }
  1476. else if (hisType == 2)
  1477. {
  1478. sMLLX = "201";
  1479. }
  1480. else if (hisType == 3)
  1481. {
  1482. sMLLX = "301";
  1483. }
  1484. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1485. for (int i = 0; i < dtHis.Rows.Count; i++)
  1486. {
  1487. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();
  1488. string HisCode = dtHis.Rows[i]["HisCode"].ToString();
  1489. //调用3302目录对照撤销
  1490. JObject joData = new JObject();
  1491. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1492. joData.Add("fixmedins_hilist_id", HisCode);
  1493. joData.Add("list_type", sMLLX); //目录类别
  1494. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1495. JObject joInput = new JObject();
  1496. joInput.Add("data", joData);
  1497. InvokeHelper invoker = new InvokeHelper();
  1498. JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
  1499. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1500. {
  1501. bOk = false;
  1502. Msg = Msg + "<" + joInput.ToString()+":" + errorMsg + ">";
  1503. }
  1504. }
  1505. if (bOk == false)
  1506. {
  1507. MessageBox.Show("全部撤销目录对照关系上传成功,部分撤销异常:" + Msg);
  1508. }
  1509. else
  1510. {
  1511. MessageBox.Show("全部撤销目录对照关系上传成功!");
  1512. }
  1513. }
  1514. private void ToolStripMenuItem_Upload_Click(object sender, EventArgs e)
  1515. {
  1516. SingleUpload();
  1517. }
  1518. private void ToolStripMenuItem_CancelUpload_Click(object sender, EventArgs e)
  1519. {
  1520. SingleCancelUpload();
  1521. }
  1522. private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
  1523. {
  1524. tbHISDirectoryFilter.Text = "";
  1525. uiTextBox1.Text = "";
  1526. rbAll.Checked = true;
  1527. rbMaped.Checked = false;
  1528. rbNoMaped.Checked = false;
  1529. tbCenterDirectoryFilter.Text = "";
  1530. tbInsuCode.Text = "";
  1531. tbApprovalNO.Text = "";
  1532. dgvCenterDirectory.DataSource = null;
  1533. btnQueryHISDirectory_Click(null, new EventArgs());
  1534. }
  1535. private void rbNoMaped_CheckedChanged(object sender, EventArgs e)
  1536. {
  1537. //if (rbNoMaped.Checked)
  1538. //{
  1539. // string errMsg;
  1540. // if (queryHISDirectory(1, 300, out errMsg) != 0)
  1541. // {
  1542. // MessageBox.Show(errMsg);
  1543. // return;
  1544. // }
  1545. //}
  1546. }
  1547. private void dgvHISDirectory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
  1548. {
  1549. e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1);
  1550. }
  1551. private void dgvCenterDirectory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
  1552. {
  1553. e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1);
  1554. }
  1555. private void btnExport_Click(object sender, EventArgs e)
  1556. {
  1557. if (queryHISDirectory(1, 1000, out string errMsg) != 0)
  1558. {
  1559. MessageBox.Show(errMsg);
  1560. return;
  1561. }
  1562. if (dtExport.Rows.Count > 0)
  1563. {
  1564. string directoryType = string.Empty;
  1565. string sBZ = "";
  1566. switch (rbgDirecType_C.SelectedIndex)
  1567. {
  1568. case 0:
  1569. {
  1570. directoryType = "药品";
  1571. break;
  1572. }
  1573. case 1:
  1574. {
  1575. directoryType = "诊疗";
  1576. break;
  1577. }
  1578. case 2:
  1579. {
  1580. directoryType = "材料";
  1581. break;
  1582. }
  1583. }
  1584. if (rbAll.Checked) sBZ = "全部";
  1585. else
  1586. if (rbMaped.Checked) sBZ = "已对照";
  1587. else
  1588. if (rbNoMaped.Checked) sBZ = "未对照";
  1589. string LSH = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("MMddHHmmssffff");
  1590. string sFliePathName = @"D:\" + LSH + "(" + directoryType + ")医保目录"+ sBZ + "信息.xls";
  1591. string ReturnFileName = ExportToExcel.DataTabletoExcel(dtExport, sFliePathName);
  1592. if (ReturnFileName != "")
  1593. {
  1594. MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  1595. System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  1596. }
  1597. else
  1598. {
  1599. MessageBox.Show("导出失败!");
  1600. }
  1601. }
  1602. }
  1603. }
  1604. }