BasicData.cs 67 KB

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