BasicData.cs 68 KB

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