BasicData.cs 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459
  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. rbOnlyName.Checked = true;
  43. this.rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(this.rbgDirecType_ValueChanged);
  44. this.pgDownload.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgDownload_PageChanged);
  45. this.pgCenterDirect.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgCenterDirect_PageChanged);
  46. Font rowFont = new Font("UTF-8", 8);
  47. Font columnFont = new Font("UTF-8", 9);
  48. rbgDirecType.SelectedIndex = 8;
  49. rbAll.Checked = true;
  50. //tabControl1.SelectedIndex = 1;
  51. //this.StartPosition = FormStartPosition.CenterParent;
  52. asc.controllInitializeSize(this);
  53. asc.controlAutoSize(this);
  54. TextCbd.Text = Global.inf.areaCode;
  55. }
  56. #region 函数封装
  57. private void queryInsuDirectory(int currentPage, int pageSize, int directoryType, int interfaceDr, string code)
  58. {
  59. try
  60. {
  61. string dirCode = "";
  62. string dirName = "";
  63. string approvalNO = "";
  64. string DosageForm = "";
  65. string Specifications = "";
  66. string manufacturers = "";
  67. Sunny.UI.UIDataGridView dgv;
  68. Sunny.UI.UIPagination pg;
  69. if (tabControl1.SelectedIndex == 0)
  70. {
  71. dirCode = tbDirectoryCode.Text;
  72. dirName = tbDircetoryName.Text;
  73. approvalNO = "";
  74. dgv = dgvDirectoy;
  75. pg = pgDownload;
  76. }
  77. else
  78. {
  79. dirName = tbCenterDirectoryFilter.Text;
  80. dirCode = tbInsuCode.Text;
  81. dgv = dgvCenterDirectory;
  82. approvalNO = tbApprovalNO.Text;
  83. pg = pgCenterDirect;
  84. manufacturers = tbManufacturer.Text;
  85. DosageForm = tbDosageForm.Text;
  86. Specifications = tbSpecifications.Text;
  87. }
  88. JObject joInput = new JObject {
  89. { "currentPage" , currentPage },
  90. { "pageSize" , pageSize },
  91. { "serviceCode" , code },
  92. { "directoryType" , directoryType },
  93. { "directoryCode" , dirCode },
  94. { "directoryName" , dirName },
  95. { "approvalNO" , approvalNO },
  96. { "dosageForm" , DosageForm },
  97. { "specifications" , Specifications },
  98. { "manufacturers" , manufacturers },
  99. { "directoryDr" , interfaceDr }
  100. };
  101. JObject joRtn = mIS.getMIDirectoryByPagination(joInput);
  102. if (joRtn["errorCode"].ToString() != "0")
  103. {
  104. MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
  105. return;
  106. }
  107. if (joRtn["result"]["rows"] == null)
  108. {
  109. MessageBox.Show("该节点不存在");
  110. return;
  111. }
  112. if (joRtn["result"]["total"].ToString() == "0")
  113. {
  114. MessageBox.Show("未查询到数据");
  115. dgv.DataSource = null;
  116. return;
  117. }
  118. DataTable dt = (DataTable)joRtn["result"]["rows"].ToObject(typeof(DataTable));
  119. int totalCount = int.Parse(joRtn["result"]["total"].ToString());
  120. pg.TotalCount = totalCount;
  121. pg.PageSize = pageSize;
  122. dgv.DataSource = dt;
  123. dgv.Columns[0].ReadOnly = true;
  124. }
  125. catch (Exception ex)
  126. {
  127. MessageBox.Show("查询异常:" + ex.Message);
  128. }
  129. }
  130. private void setHeaderTxt(int directoryType, Sunny.UI.UIDataGridView dgv)
  131. {
  132. GridViewSetter gvdSetter = new GridViewSetter();
  133. switch (directoryType)
  134. {
  135. case 0://药品
  136. {
  137. gvdSetter.SetHeaderTextOfDrug(dgv);
  138. break;
  139. }
  140. case 1://诊疗
  141. {
  142. gvdSetter.SetHeaderTextOfMedicalService(dgv);
  143. break;
  144. }
  145. case 2://材料
  146. {
  147. gvdSetter.SetHeaderTextOfMaterials(dgv);
  148. break;
  149. }
  150. case 3://疾病诊断
  151. {
  152. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  153. break;
  154. }
  155. case 4://手术
  156. {
  157. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  158. break;
  159. }
  160. case 5://慢性病
  161. {
  162. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  163. break;
  164. }
  165. case 6://DRGs
  166. {
  167. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  168. break; ;
  169. }
  170. case 7://日间手术
  171. {
  172. gvdSetter.SetHeaderTextOfDiagnose(dgv);
  173. break; ;
  174. }
  175. case 8://字典表
  176. {
  177. gvdSetter.SetHeaderTextOfDictionary(dgv);
  178. break;
  179. }
  180. case 9://中药饮片下载
  181. {
  182. gvdSetter.SetHeaderTextOfChineseMedicine(dgv);
  183. break;
  184. }
  185. case 10://医药机构制剂目录下载
  186. {
  187. gvdSetter.SetHeaderTextOfPreparation(dgv);
  188. break;
  189. }
  190. case 11://肿瘤形态学下载
  191. {
  192. gvdSetter.SetHeaderTextOfTumorMorphology(dgv);
  193. break;
  194. }
  195. case 12:
  196. {
  197. //中医疾病下载
  198. gvdSetter.GetChineseDiagnoseJsonByTxt(dgv);
  199. // ICPC3
  200. //gvdSetter.SetICPCAdmReasonHeader(dgv);
  201. break;
  202. }
  203. case 13:
  204. {
  205. //中医证候下载
  206. gvdSetter.GetTCMSyndromeJsonByTxt(dgv);
  207. // ICPC3
  208. //gvdSetter.SetICPCTreatmentHeader(dgv);
  209. break;
  210. }
  211. case 14://民族药品
  212. {
  213. gvdSetter.GetEthnicMedicineJsonByTxt(dgv);
  214. break;
  215. }
  216. case 15://目录信息查询
  217. {
  218. gvdSetter.GetMedInsuCatalogJsonByTxt(dgv);
  219. break;
  220. }
  221. case 16://医疗与医保目录匹配关系查询
  222. {
  223. gvdSetter.GetMedInsuCorrespondencJsonByTxt(dgv);
  224. break;
  225. }
  226. case 17://医药机构目录匹配查询
  227. {
  228. gvdSetter.GetMedInstCorrespondencJsonByTxt(dgv);
  229. break;
  230. }
  231. case 18://医保目录限价查询
  232. {
  233. gvdSetter.GetMedInsuFixedPriceJsonByTxt(dgv);
  234. break;
  235. }
  236. case 19://医保目录先自付比例下载
  237. {
  238. gvdSetter.GetMedInsuFirstPayProportionJsonByTxt(dgv);
  239. break;
  240. }
  241. case 20://医药机构信息
  242. {
  243. gvdSetter.GetMedicalInstitutionJsonByTxt(dgv);
  244. break;
  245. }
  246. }
  247. gvdSetter.DatagridviewColumnWidthAdaptation(dgv);
  248. }
  249. private void queryHISInsuDirectory(int directoryType, int pageIndex, int count, Sunny.UI.UIDataGridView dgv, int interfaceDr)
  250. {
  251. string code = "09010042";
  252. if (tabControl1.SelectedIndex == 0)
  253. {
  254. if (rbgDirecType.SelectedIndex == 20)
  255. {
  256. code = "090100XX";
  257. }
  258. else if (rbgDirecType.SelectedIndex == 8)
  259. {
  260. code = "09010043";
  261. }
  262. else
  263. {
  264. code = "09010042";
  265. }
  266. if (rbgDirecType.SelectedIndex <= 13)
  267. {
  268. queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
  269. setHeaderTxt(directoryType, dgv);
  270. }
  271. else //几个医保查询该部分数据不存数据库只是临时查询(除医疗机构信息查询外)
  272. {
  273. //生成DataView列
  274. //setHeaderTxt(directoryType, dgv);
  275. string pages, recordCounts, errorMessage, sOutpar;
  276. dynamic joData = GetInput(rbgDirecType.SelectedIndex, out TradeEnum trade);
  277. JObject joRtn = cBus.InvokeMedicalInsuranceInquiry(trade, joData);
  278. if (joRtn["infcode"].ToString() == "0")
  279. {
  280. try
  281. {
  282. Sunny.UI.UIPagination pg;
  283. dgv = dgvDirectoy;
  284. pg = pgDownload;
  285. DataTable dt;
  286. if (rbgDirecType.SelectedIndex == 20)
  287. {
  288. dt = (DataTable)joRtn["output"]["medinsinfo"].ToObject(typeof(DataTable));
  289. if (joRtn["output"]["medinsinfo"].ToString() == "")
  290. {
  291. MessageBox.Show("查询成功,但返回结果集为空!");
  292. //return;
  293. }
  294. pg.TotalCount = 50;
  295. pg.PageSize = 50;
  296. }
  297. else
  298. {
  299. pages = joRtn["output"]["pages"].ToString(); //页数
  300. recordCounts = joRtn["output"]["recordCounts"].ToString(); //总记录条数
  301. dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
  302. if (recordCounts == "0")
  303. {
  304. MessageBox.Show("查询成功,但返回结果集为空!");
  305. //return;
  306. }
  307. pg.TotalCount = int.Parse(recordCounts);
  308. pg.PageSize = int.Parse(TexBYSJL.Text); //int.Parse(pages);
  309. }
  310. dgv.DataSource = dt;
  311. dgv.Columns[0].ReadOnly = true;
  312. }
  313. catch (Exception ex)
  314. {
  315. MessageBox.Show("查询异常:" + ex.Message);
  316. }
  317. }
  318. else
  319. {
  320. errorMessage = "调用交易" + trade.GetCode() + "出现错误,请查看日志!"; //joImportRtn["errorMessage"].ToString();
  321. MessageBox.Show(errorMessage);
  322. return;
  323. }
  324. }
  325. }
  326. else
  327. {
  328. queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
  329. setHeaderTxt(directoryType, dgv);
  330. }
  331. GridViewSetter gridSetter = new GridViewSetter();
  332. gridSetter.DatagridviewColumnWidthAdaptation(dgvCenterDirectory);
  333. }
  334. private int queryHISDirectory(int currentPage, int pageSize, out string errMsg)
  335. {
  336. errMsg = "";
  337. string directoryType = string.Empty;
  338. switch (rbgDirecType_C.SelectedIndex)
  339. {
  340. case 0:
  341. {
  342. directoryType = "drugs";
  343. break;
  344. }
  345. case 1:
  346. {
  347. directoryType = "diagnosi";
  348. break;
  349. }
  350. case 2:
  351. {
  352. directoryType = "consumables";
  353. break;
  354. }
  355. }
  356. JObject joHISRtn = new JObject();
  357. JObject joRtn = new JObject();
  358. InvokeHelper invoker = new InvokeHelper();
  359. string flag = "";
  360. //全部是先调HIS,然后再匹配医保平台的对照关系
  361. if (rbAll.Checked)
  362. {
  363. JArray jaPagination = new JArray();
  364. JArray jaParams = new JArray();
  365. flag = "All";
  366. dynamic joParam = new JObject();
  367. joParam.code = "";
  368. joParam.descripts = "";
  369. joParam.FindType = new JArray();
  370. joParam.TypeID = "";
  371. joParam.alias = tbHISDirectoryFilter.Text;
  372. joParam.include = "Hosp";
  373. joParam.groupID = "324";
  374. joParam.hospID = Global.inf.hisHospitalDr;
  375. joParam.interfaceDr = Global.inf.interfaceDr;
  376. joParam.type = directoryType;
  377. joParam.flag = flag;
  378. joParam.specInput = txtSpecFilter.Text.Trim();
  379. jaParams.Add(joParam);
  380. dynamic joPagination = new JObject();
  381. joPagination.pageSize = pageSize;
  382. //joPagination.pageSize = 2;
  383. joPagination.currentPage = currentPage;
  384. joPagination.sortColumn = "Code";
  385. joPagination.sortOrder = "asc";
  386. jaPagination.Add(joPagination);
  387. //该服务需要改写,需要跟(CloudMedicalInsurancePlatform.Tables.MapRelation)进行关联
  388. //joInParams.code = "09010038";
  389. if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
  390. {
  391. return -1;
  392. }
  393. joRtn = mIS.ConvertHISDir(joHISRtn);
  394. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  395. {
  396. return -1;
  397. }
  398. }
  399. //已对照是先调云医保,然后再匹配HIS
  400. if (rbMaped.Checked)
  401. {
  402. JArray jaPagination = new JArray();
  403. JArray jaParams = new JArray();
  404. flag = "Maped";
  405. dynamic joParam = new JObject();
  406. joParam.alias = tbHISDirectoryFilter.Text;
  407. joParam.HospitalDr = Global.inf.hospitalDr;
  408. joParam.InterfaceDr = Global.inf.interfaceDr;
  409. joParam.hisType = directoryType;
  410. jaParams.Add(joParam);
  411. dynamic joPagination = new JObject();
  412. joPagination.pageSize = pageSize;
  413. joPagination.currentPage = currentPage;
  414. joPagination.sortColumn = "HisCode";
  415. joPagination.sortOrder = "asc";
  416. jaPagination.Add(joPagination);
  417. JObject joMIRtn = mIS.GetMappedHISDir(jaPagination, jaParams);
  418. if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
  419. {
  420. return -1;
  421. }
  422. //传给HIS,进行匹配
  423. joParam = new JObject();
  424. joParam.TotalCount = joMIRtn["result"]["TotalCount"];
  425. joParam.type = directoryType;
  426. joParam.flag = flag;
  427. joParam.hospID = Global.inf.hisHospitalDr;
  428. joParam.interfaceDr = Global.inf.interfaceDr;
  429. joParam.alias = tbHISDirectoryFilter.Text;
  430. joParam.include = "Hosp";
  431. joParam.groupID = "324";
  432. joParam.compareArr = joMIRtn["result"]["Data"];
  433. jaParams = new JArray();
  434. jaParams.Add(joParam);
  435. if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
  436. {
  437. return -1;
  438. }
  439. }
  440. //if (rbNoMaped.Checked) { flag = "NoMaped"; }
  441. if (rbNoMaped.Checked)
  442. {
  443. JArray jaPagination = new JArray();
  444. JArray jaParams = new JArray();
  445. flag = "All";
  446. dynamic joParam = new JObject();
  447. joParam.code = "";
  448. joParam.descripts = "";
  449. joParam.FindType = new JArray();
  450. joParam.TypeID = "";
  451. joParam.alias = tbHISDirectoryFilter.Text;
  452. joParam.include = "Hosp";
  453. joParam.groupID = "324";
  454. joParam.hospID = Global.inf.hisHospitalDr;
  455. joParam.interfaceDr = Global.inf.interfaceDr;
  456. joParam.type = directoryType;
  457. joParam.flag = flag;
  458. joParam.specInput = "";
  459. jaParams.Add(joParam);
  460. dynamic joPagination = new JObject();
  461. joPagination.pageSize = pageSize;
  462. //joPagination.pageSize = 2;
  463. joPagination.currentPage = currentPage;
  464. joPagination.sortColumn = "Code";
  465. joPagination.sortOrder = "asc";
  466. jaPagination.Add(joPagination);
  467. //1.获取全部HIS目录
  468. if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
  469. {
  470. return -1;
  471. }
  472. joRtn = mIS.GetNoMappHISDir(joHISRtn);
  473. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  474. {
  475. return -1;
  476. }
  477. }
  478. // 获取Data数组
  479. JArray dataArray = (JArray)joRtn["result"]["Data"];
  480. // 过滤掉itemHospID为空的对象
  481. var filteredData = dataArray
  482. .Where(item => !string.IsNullOrEmpty(item["itemHospID"]?.ToString()))
  483. .ToList();
  484. // 更新Data数组
  485. joRtn["result"]["Data"] = new JArray(filteredData);
  486. // 更新TotalCount
  487. //joRtn["result"]["TotalCount"] = filteredData.Count;
  488. //输出结果
  489. //string resultJson = joRtn.ToString(Formatting.Indented);
  490. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  491. dtExport = dt;
  492. int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
  493. pgHISDirect.TotalCount = totalCount;
  494. //if (rbNoMaped.Checked)
  495. // pgHISDirect.PageSize = pageSize;
  496. //else
  497. // pgHISDirect.PageSize = 50;
  498. pgHISDirect.PageSize = pageSize;
  499. dgvHISDirectory.DataSource = null;
  500. dgvHISDirectory.DataSource = dt;
  501. dgvHISDirectory.Columns[0].ReadOnly = true;
  502. GridViewSetter gridSetter = new GridViewSetter();
  503. gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
  504. gridSetter.DatagridviewColumnWidthAdaptation(dgvHISDirectory);
  505. return 0;
  506. }
  507. private int queryMapeDirectory(int currentPage, int pageSize, out string errMsg)
  508. {
  509. errMsg = "";
  510. string directoryType = string.Empty;
  511. switch (rbgDirecType_C.SelectedIndex)
  512. {
  513. case 0:
  514. {
  515. directoryType = "drugs";
  516. break;
  517. }
  518. case 1:
  519. {
  520. directoryType = "diagnosi";
  521. break;
  522. }
  523. case 2:
  524. {
  525. directoryType = "consumables";
  526. break;
  527. }
  528. }
  529. JObject joHISRtn = new JObject();
  530. JObject joRtn = new JObject();
  531. InvokeHelper invoker = new InvokeHelper();
  532. string flag = "";
  533. JArray jaPagination = new JArray();
  534. JArray jaParams = new JArray();
  535. flag = "Maped";
  536. dynamic joParam = new JObject();
  537. joParam.alias = tbHISDirectoryFilter.Text;
  538. joParam.HospitalDr = Global.inf.hospitalDr;
  539. joParam.InterfaceDr = Global.inf.interfaceDr;
  540. joParam.hisType = directoryType;
  541. jaParams.Add(joParam);
  542. dynamic joPagination = new JObject();
  543. joPagination.pageSize = 3000;
  544. joPagination.currentPage = 1;
  545. joPagination.sortColumn = "HisCode";
  546. joPagination.sortOrder = "asc";
  547. jaPagination.Add(joPagination);
  548. JObject joMIRtn = mIS.GetMappedHISDir(jaPagination, jaParams);
  549. if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
  550. {
  551. return -1;
  552. }
  553. //传给HIS,进行匹配
  554. joParam = new JObject();
  555. joParam.TotalCount = joMIRtn["result"]["TotalCount"];
  556. joParam.type = directoryType;
  557. joParam.flag = flag;
  558. joParam.hospID = Global.inf.hisHospitalDr;
  559. joParam.interfaceDr = Global.inf.interfaceDr;
  560. joParam.alias = tbHISDirectoryFilter.Text;
  561. joParam.include = "Hosp";
  562. joParam.groupID = "324";
  563. joParam.compareArr = joMIRtn["result"]["Data"];
  564. jaParams = new JArray();
  565. jaParams.Add(joParam);
  566. if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
  567. {
  568. return -1;
  569. }
  570. dtExport = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  571. //if (rbNoMaped.Checked)
  572. // pgHISDirect.PageSize = pageSize;
  573. //else
  574. // pgHISDirect.PageSize = 50;
  575. return 0;
  576. }
  577. private int queryNoMappDirectory(int currentPage, int pageSize, out string errMsg)
  578. {
  579. errMsg = "";
  580. string directoryType = string.Empty;
  581. switch (rbgDirecType_C.SelectedIndex)
  582. {
  583. case 0:
  584. {
  585. directoryType = "drugs";
  586. break;
  587. }
  588. case 1:
  589. {
  590. directoryType = "diagnosi";
  591. break;
  592. }
  593. case 2:
  594. {
  595. directoryType = "consumables";
  596. break;
  597. }
  598. }
  599. JObject joHISRtn = new JObject();
  600. JObject joRtn = new JObject();
  601. InvokeHelper invoker = new InvokeHelper();
  602. string flag = "";
  603. JArray jaPagination = new JArray();
  604. JArray jaParams = new JArray();
  605. flag = "All";
  606. dynamic joParam = new JObject();
  607. joParam.code = "";
  608. joParam.descripts = "";
  609. joParam.FindType = new JArray();
  610. joParam.TypeID = "";
  611. joParam.alias = tbHISDirectoryFilter.Text;
  612. joParam.include = "Hosp";
  613. joParam.groupID = "324";
  614. joParam.hospID = Global.inf.hisHospitalDr;
  615. joParam.interfaceDr = Global.inf.interfaceDr;
  616. joParam.type = directoryType;
  617. joParam.flag = flag;
  618. joParam.specInput = "";
  619. jaParams.Add(joParam);
  620. dynamic joPagination = new JObject();
  621. joPagination.pageSize = pageSize;
  622. //joPagination.pageSize = 2;
  623. joPagination.currentPage = currentPage;
  624. joPagination.sortColumn = "Code";
  625. joPagination.sortOrder = "asc";
  626. jaPagination.Add(joPagination);
  627. //1.获取全部HIS目录
  628. if (hIS.getHISDir(jaPagination, jaParams, out joHISRtn, out errMsg) != 0)
  629. {
  630. return -1;
  631. }
  632. // 提取Data数组
  633. JArray dataArray = (JArray)joHISRtn["result"]["Data"];
  634. // 创建新的数组,只包含HISCode
  635. JArray filteredArray = new JArray();
  636. foreach (JObject item in dataArray)
  637. {
  638. JObject newItem = new JObject();
  639. newItem["HISCode"] = item["HISCode"];
  640. newItem["itemDesc"] = item["itemDesc"];
  641. newItem["itemCode"] = item["itemCode"];
  642. newItem["itemPrice"] = item["itemPrice"];
  643. newItem["pprovalNo"] = item["pprovalNo"];
  644. newItem["manfDesc"] = item["manfDesc"];
  645. filteredArray.Add(newItem);
  646. }
  647. // 替换原数组--原数据太大导致报错提示入参太长,这里重新组织入参只取部分必要入参
  648. joHISRtn["result"]["Data"] = filteredArray;
  649. joRtn = mIS.GetNoMappHISDir(joHISRtn);
  650. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  651. {
  652. return -1;
  653. }
  654. dtExport = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  655. //if (rbNoMaped.Checked)
  656. // pgHISDirect.PageSize = pageSize;
  657. //else
  658. // pgHISDirect.PageSize = 50;
  659. return 0;
  660. }
  661. private void queryCenterDirectory_09010012(int currentPage, int pageSize)
  662. {
  663. string directoryType = string.Empty;
  664. switch (rbgDirecType_C.SelectedIndex)
  665. {
  666. case 0:
  667. {
  668. directoryType = "drugs";
  669. break;
  670. }
  671. case 1:
  672. {
  673. directoryType = "diagnosi";
  674. break;
  675. }
  676. case 2:
  677. {
  678. directoryType = "consumables";
  679. break;
  680. }
  681. }
  682. dynamic joInParams = new JObject();
  683. joInParams.pagination = new JArray() as dynamic;
  684. joInParams.session = new JArray() as dynamic;
  685. JArray jaParams = new JArray();
  686. dynamic joParams = new JObject();
  687. joParams.code = "";
  688. joParams.descripts = "";
  689. joParams.FindType = new JArray();
  690. joParams.TypeID = "";
  691. joParams.alias = "";
  692. joParams.include = "Hosp";
  693. joParams.groupID = "324";
  694. joParams.hospID = "25";
  695. joParams.type = directoryType;
  696. joParams.specInput = "";
  697. jaParams.Add(joParams);
  698. joInParams.Add("params", JArray.FromObject(jaParams));
  699. dynamic joSession = new JObject();
  700. joSession.userID = "";
  701. joSession.locID = "";
  702. joSession.groupID = "";
  703. joSession.hospID = "";
  704. joSession.sessionID = "";
  705. joSession.hospCode = "";
  706. joSession.language = "";
  707. joSession.hostName = "";
  708. joSession.ipv4 = "";
  709. joSession.ipv6 = "";
  710. joSession.mac = "";
  711. joInParams.session.Add(joSession);
  712. dynamic joPagination = new JObject();
  713. joPagination.pageSize = pageSize;
  714. joPagination.currentPage = currentPage;
  715. joPagination.sortColumn = "Code";
  716. joPagination.sortOrder = "asc";
  717. joInParams.pagination.Add(joPagination);
  718. joInParams.code = "09010012";
  719. string sInput = joInParams.ToString();
  720. string sRtn = invoker.invokeInsuService(joInParams, "");
  721. JObject jsonRtn = JObject.Parse(sRtn);
  722. if (jsonRtn["result"]["Data"] == null)
  723. {
  724. MessageBox.Show("该节点不存在");
  725. return;
  726. }
  727. JObject joRtn = JObject.Parse(sRtn);
  728. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  729. int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
  730. pgCenterDirect.TotalCount = totalCount;
  731. pgCenterDirect.PageSize = 50;
  732. dgvCenterDirectory.DataSource = dt;
  733. }
  734. private void Mapping()
  735. {
  736. int iHis = dgvHISDirectory.CurrentRow.Index;
  737. if (dgvCenterDirectory.CurrentRow == null)
  738. {
  739. MessageBox.Show("请查询中心目录");
  740. return;
  741. }
  742. int iCenter = dgvCenterDirectory.CurrentRow.Index;
  743. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  744. DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
  745. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Code"].Value.ToString();
  746. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Name"].Value.ToString();
  747. int hisType = rbgDirecType_C.SelectedIndex + 1;
  748. string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString(); ;
  749. JArray jaParams = new JArray();
  750. dynamic jsonTemp = new JObject();
  751. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  752. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  753. jsonTemp.updateUserID = Global.user.ID;
  754. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  755. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  756. jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["itemDesc"].Value;
  757. jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
  758. jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
  759. //1.已对照 2.已对照但未上传 3 已对照且已上传
  760. jsonTemp.State = 1;
  761. jsonTemp.HisType = hisType;
  762. jsonTemp.HisTypeName = hisTypeName;
  763. jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Code"].Value;
  764. jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
  765. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  766. jaParams.Add(jsonTemp);
  767. JObject joIn = new JObject();
  768. joIn.Add(new JProperty("params", jaParams));
  769. joIn.Add("code", "09010040");
  770. InvokeHelper invoker = new InvokeHelper();
  771. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
  772. //JObject joRtn = JObject.Parse(irisRtn);
  773. if ((int)joRtn["errorCode"] == 0)
  774. {
  775. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
  776. }
  777. else
  778. {
  779. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
  780. }
  781. }
  782. private void CancleMapping()
  783. {
  784. int iHis = dgvHISDirectory.CurrentRow.Index;
  785. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  786. JArray jaParams = new JArray();
  787. dynamic jsonTemp = new JObject();
  788. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  789. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  790. jsonTemp.updateUserID = Global.user.ID;
  791. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  792. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  793. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  794. jaParams.Add(jsonTemp);
  795. JObject joIn = new JObject();
  796. joIn.Add(new JProperty("params", jaParams));
  797. joIn.Add("code", "09010041");
  798. InvokeHelper invoker = new InvokeHelper();
  799. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
  800. if ((int)joRtn["errorCode"] == 0)
  801. {
  802. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
  803. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
  804. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "";
  805. }
  806. else
  807. {
  808. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
  809. }
  810. }
  811. public void loadTextDebug()
  812. {
  813. DataImoport bus = new DataImoport();
  814. string txtPath = @"E:\insu\Demo\bin\Debug\20230101535395327567680436.txt";
  815. JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, 2, uiProcessBar1);
  816. }
  817. /// <summary>
  818. /// 医保目录单个版本号的下载
  819. /// </summary>
  820. /// <param name="ver"></param>
  821. /// <param name="directoryType"></param>
  822. /// <param name="uiProcessBar"></param>
  823. /// <param name="errorMessage"></param>
  824. /// <returns></returns>
  825. public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, string dictCode, out string errorMessage)
  826. {
  827. errorMessage = "";
  828. int iResult = -1;
  829. try
  830. {
  831. JObject joRtn = cBus.DownDictionay(joData);
  832. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  833. {
  834. DataImoport DI = new DataImoport();
  835. JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.list"));
  836. JObject joImportRtn = DI.importDictionary(uiProcessBar, jaList, dictCode);
  837. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  838. {
  839. iResult = 0;
  840. }
  841. else
  842. {
  843. errorMessage = "导入数据出现错误,请查看日志!" + errorMessage;
  844. }
  845. }
  846. return iResult;
  847. }
  848. catch (Exception ex)
  849. {
  850. errorMessage = "downloadDicionary提示:" + ex.Message;
  851. return -1;
  852. }
  853. }
  854. #endregion
  855. private void Form1_Load(object sender, EventArgs e)
  856. {
  857. this.WindowState = FormWindowState.Maximized;
  858. rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
  859. LabExplain.Visible = false;
  860. }
  861. private void btnDownload_Click(object sender, EventArgs e)
  862. {
  863. string errorMessage = string.Empty;
  864. string ver = tbVer.Text;
  865. JObject input = new JObject();
  866. input["ver"] = ver;
  867. // 目录查询
  868. switch (rbgDirecType.SelectedIndex)
  869. {
  870. case 15:
  871. break;
  872. case 8: //字典
  873. {
  874. if (tbDicDate.Text == "")
  875. {
  876. MessageBox.Show("请输入查询日期!");
  877. return;
  878. }
  879. // 支持批量
  880. string[] dictText = tbDicType.Text.Trim().Split(",".ToCharArray());
  881. dictText.ToList().ForEach((dict) =>
  882. {
  883. this.downloadDict(dict);
  884. });
  885. break;
  886. }
  887. //case 12:
  888. // {
  889. // downloadMedData(TradeEnum.ICPC3AdmReason, ver, uiProcessBar1);
  890. // break;
  891. // }
  892. //case 13:
  893. // {
  894. // downloadMedData(TradeEnum.ICPC3Treatment, ver, uiProcessBar1);
  895. // break;
  896. // }
  897. default:
  898. {
  899. MedDirDownloadProcess mp = new MedDirDownloadProcess();
  900. if (rbSingleDown.Checked)
  901. {
  902. if (mp.SingleDownload(ver, rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  903. {
  904. MessageBox.Show("医保目录下载失败:" + errorMessage);
  905. return;
  906. }
  907. }
  908. if (rbAutoDown.Checked)
  909. {
  910. mp.VerChangeEvent += Mp_VerChangeEvent;
  911. if (mp.AutoDownload(rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  912. {
  913. MessageBox.Show("医保目录下载失败:" + errorMessage);
  914. return;
  915. }
  916. }
  917. break;
  918. }
  919. }
  920. btnQuery_Click(sender, e);
  921. }
  922. private void Mp_VerChangeEvent(object sender, string ver)
  923. {
  924. tbVer.Text = ver;
  925. }
  926. private void downloadDict(string dictCode)
  927. {
  928. try
  929. {
  930. string errorMessage = "";
  931. dynamic joData = new JObject();
  932. joData.type = dictCode; //字典类型
  933. joData.parentValue = ""; //父字典键值
  934. joData.admdvs = Global.inf.areaCode; //行政区划 就医地
  935. joData.date = tbDicDate.Text; //查询日期
  936. joData.vali_flag = "1"; //有效标志
  937. if (downloadDicionary(joData, uiProcessBar1, dictCode, out errorMessage) != 0)
  938. {
  939. MessageBox.Show("医保字典下载失败:" + errorMessage);
  940. }
  941. }
  942. catch (Exception e)
  943. {
  944. }
  945. }
  946. private int downloadMedData(TradeEnum trade, string version, Sunny.UI.UIProcessBar uiProcessBar)
  947. {
  948. string errorMessage = "";
  949. if (rbAutoDown.Checked)
  950. {
  951. JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(rbgDirecType.SelectedIndex);
  952. string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
  953. if (!string.IsNullOrEmpty(ver))
  954. {
  955. version = ver;
  956. tbVer.Text = ver;
  957. }
  958. }
  959. JObject joRtn = cBus.DownDirecotry(trade, version);
  960. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  961. {
  962. //解析
  963. DataImoport DI = new DataImoport();
  964. JObject joImportRtn = DI.importMedDataToIris(trade, joRtn, uiProcessBar);
  965. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  966. {
  967. //递归调用
  968. if (rbAutoDown.Checked)
  969. {
  970. downloadMedData(trade, version, uiProcessBar);
  971. }
  972. }
  973. return 0;
  974. }
  975. MessageBox.Show(errorMessage);
  976. return -1;
  977. }
  978. private void btnQuery_Click(object sender, EventArgs e)
  979. {
  980. #region 校验查询条件
  981. if ((rbgDirecType.SelectedIndex < 0) || (rbgDirecType.SelectedIndex > 20))
  982. {
  983. MessageBox.Show("请先选择查询类型!");
  984. return;
  985. }
  986. if (rbgDirecType.SelectedIndex > 13)
  987. {
  988. if (rbgDirecType.SelectedIndex != 20)
  989. {
  990. if ((TexDate.Text == "") || (TexDate.Text == "输入日期 2021-01-01"))
  991. {
  992. MessageBox.Show("查询条件-请输入查询日期!");
  993. return;
  994. }
  995. if ((TexDQYS.Text == "") || (TexDQYS.Text == "当前页数"))
  996. {
  997. MessageBox.Show("查询条件-请输入当前页数!");
  998. return;
  999. }
  1000. if ((TexBYSJL.Text == "") || (TexBYSJL.Text == "本页数据量"))
  1001. {
  1002. MessageBox.Show("查询条件-请输入本页数据量!");
  1003. return;
  1004. }
  1005. }
  1006. else
  1007. {
  1008. if ((TexYYMC.Text == "") || (TexYYMC.Text == "输入医院名称模糊查找"))
  1009. {
  1010. MessageBox.Show("查询条件-请输入医院名称模糊查找!");
  1011. return;
  1012. }
  1013. }
  1014. }
  1015. #endregion
  1016. queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy, Global.inf.interfaceDr);
  1017. }
  1018. private void btnQueryHISDirectory_Click(object sender, EventArgs e)
  1019. {
  1020. //this.dgvHISDirectory.SelectionChanged -= this.dgvHISDirectory_SelectionChanged;
  1021. int iCount = 50;
  1022. if (rbNoMaped.Checked)
  1023. {
  1024. iCount = 300;
  1025. }
  1026. string errMsg;
  1027. if (queryHISDirectory(1, iCount, out errMsg) != 0)
  1028. {
  1029. MessageBox.Show(errMsg);
  1030. return;
  1031. }
  1032. //注释前 切换页码会出现 创建字段不存在的报错
  1033. // this.dgvHISDirectory.SelectionChanged += this.dgvHISDirectory_SelectionChanged;
  1034. }
  1035. private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
  1036. {
  1037. if ((tbCenterDirectoryFilter.Text == "") && (tbInsuCode.Text == "") && (tbApprovalNO.Text == "") &&
  1038. (tbManufacturer.Text == "") && (tbSpecifications.Text == "") && (tbDosageForm.Text == ""))
  1039. {
  1040. return;
  1041. }
  1042. //查询区域通用目录
  1043. JObject joRtn = mIS.getInterface_TY(Global.inf.interfaceDr.ToString(), "");
  1044. string InsuCurrencyCataLogue = JsonHelper.getDestValue(joRtn, "InsuCurrencyCataLogue"); //通用目录编码 6
  1045. string InterfaceName_TY = JsonHelper.getDestValue(joRtn, "InterfaceName_TY"); //通用目录名称
  1046. string HospName = JsonHelper.getDestValue(joRtn, "HospitalName"); //目录名称
  1047. if (InsuCurrencyCataLogue != "")
  1048. {
  1049. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, int.Parse(InsuCurrencyCataLogue));
  1050. LabExplain.Visible = true;
  1051. LabExplain.Text = "当前接口已设置区域通用目录,数据源:" + InterfaceName_TY + " ,如果没有所查目录请联系数据源医院新增维护!";
  1052. }
  1053. else
  1054. {
  1055. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
  1056. LabExplain.Visible = true;
  1057. LabExplain.Text = "当前接口未设置区域通用目录,数据源:" + HospName;
  1058. }
  1059. GridViewSetter gridSetter = new GridViewSetter();
  1060. gridSetter.DatagridviewColumnWidthAdaptation(dgvCenterDirectory);
  1061. }
  1062. private void pgDownload_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1063. {
  1064. queryHISInsuDirectory(rbgDirecType.SelectedIndex, pageIndex, count, dgvDirectoy, Global.inf.interfaceDr);
  1065. }
  1066. private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1067. {
  1068. string errMsg;
  1069. int iCount = 50;
  1070. if (rbNoMaped.Checked) iCount = 300;
  1071. if (queryHISDirectory(pageIndex, iCount, out errMsg) != 0)
  1072. {
  1073. MessageBox.Show(errMsg);
  1074. return;
  1075. }
  1076. }
  1077. private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1078. {
  1079. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, pageIndex, count, dgvCenterDirectory, Global.inf.interfaceDr);
  1080. }
  1081. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  1082. {
  1083. //选定项不同调用的接口也不相同,Index值大于
  1084. if (rbgDirecType.SelectedIndex > 13)
  1085. {
  1086. uiGroupBox1.Visible = false;
  1087. uiGroupBox5.Visible = false;
  1088. uiGroupBox2.Visible = true;
  1089. //uiGroupBox3.Visible = true;
  1090. uiProcessBar1.Visible = false;
  1091. uiGroupBox2.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1092. uiGroupBox3.Left = uiGroupBox2.Width + rbgDirecType.Width + rbgDirecType.Left + 10;
  1093. dgvDirectoy.DataSource = null;
  1094. }
  1095. else
  1096. {
  1097. uiGroupBox1.Visible = true;
  1098. uiGroupBox5.Visible = true;
  1099. uiGroupBox2.Visible = true;
  1100. //uiGroupBox3.Visible = false;
  1101. uiProcessBar1.Visible = true;
  1102. uiGroupBox1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1103. uiGroupBox5.Left = uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 10;
  1104. uiGroupBox2.Left = uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 15;
  1105. uiGroupBox3.Left = uiGroupBox2.Width + uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 20;
  1106. uiProcessBar1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1107. uiProcessBar1.Width = uiGroupBox1.Width + uiGroupBox5.Width + uiGroupBox2.Width + 10;
  1108. }
  1109. setHeaderTxt(rbgDirecType.SelectedIndex, dgvDirectoy);
  1110. }
  1111. private void toolStripMenuItem2_Click(object sender, EventArgs e)
  1112. {
  1113. CancleMapping();
  1114. }
  1115. private void tsmiMapping_Click(object sender, EventArgs e)
  1116. {
  1117. Mapping();
  1118. }
  1119. private void dgvHISDirectory_DoubleClick(object sender, EventArgs e)
  1120. {
  1121. //int currentPage = pgHISDirect.ActivePage;
  1122. //string flag = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["flag"].Value.ToString();
  1123. //if (flag == "未对照")
  1124. //{
  1125. // Mapping();
  1126. //}
  1127. //else
  1128. //if (flag == "已对照")
  1129. //{
  1130. // CancleMapping();
  1131. //}
  1132. //if (rbAll.Checked)
  1133. //{
  1134. // string errMsg;
  1135. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  1136. // {
  1137. // MessageBox.Show(errMsg);
  1138. // return;
  1139. // }
  1140. //}
  1141. }
  1142. private void dgvDirectoy_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1143. {
  1144. }
  1145. private void dgvDirectoy_CellContentClick(object sender, DataGridViewCellEventArgs e)
  1146. {
  1147. }
  1148. private void uiRadioButton1_CheckedChanged(object sender, EventArgs e)
  1149. {
  1150. }
  1151. private void dgvDirectoy_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1152. {
  1153. //自动编号,与数据无关
  1154. Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
  1155. e.RowBounds.Location.Y,
  1156. dgvDirectoy.RowHeadersWidth - 4,
  1157. e.RowBounds.Height);
  1158. TextRenderer.DrawText(e.Graphics,
  1159. (e.RowIndex + 1).ToString(),
  1160. dgvDirectoy.RowHeadersDefaultCellStyle.Font,
  1161. rectangle,
  1162. dgvDirectoy.RowHeadersDefaultCellStyle.ForeColor,
  1163. TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
  1164. }
  1165. private void rbAll_ValueChanged(object sender, bool value)
  1166. {
  1167. //if (rbAll.Checked)
  1168. //{
  1169. // btnQueryHISDirectory_Click(null, new EventArgs());
  1170. //}
  1171. }
  1172. private void rbMaped_CheckedChanged(object sender, EventArgs e)
  1173. {
  1174. //if (rbMaped.Checked)
  1175. //{
  1176. // string errMsg;
  1177. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  1178. // {
  1179. // MessageBox.Show(errMsg);
  1180. // return;
  1181. // }
  1182. //}
  1183. }
  1184. private void btAddDir_Click(object sender, EventArgs e)
  1185. {
  1186. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex);
  1187. if (addDirectory.ShowDialog() == DialogResult.OK)
  1188. {
  1189. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1190. string error = "";
  1191. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1192. {
  1193. MessageBox.Show("新增失败:" + error);
  1194. }
  1195. else
  1196. {
  1197. MessageBox.Show("新增成功");
  1198. }
  1199. }
  1200. }
  1201. private void btEditDir_Click(object sender, EventArgs e)
  1202. {
  1203. DataTable dt = (DataTable)dgvDirectoy.DataSource;
  1204. if ((dt == null) || (dt.Rows.Count < 1))
  1205. {
  1206. MessageBox.Show("表中无数据,请检查!");
  1207. return;
  1208. }
  1209. DataRow dr = dt.Rows[dgvDirectoy.CurrentRow.Index];
  1210. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex, dr);
  1211. if (addDirectory.ShowDialog() == DialogResult.OK)
  1212. {
  1213. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1214. string error = "";
  1215. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1216. {
  1217. MessageBox.Show("修改失败:" + error);
  1218. }
  1219. else
  1220. {
  1221. MessageBox.Show("修改成功");
  1222. }
  1223. }
  1224. }
  1225. private void btnExit_Click(object sender, EventArgs e)
  1226. {
  1227. Close();
  1228. }
  1229. /// <summary>
  1230. /// 几个医保查询的交易组织入参
  1231. /// </summary>
  1232. /// <param name="Index"></param>
  1233. /// <param name="funNo"></param>
  1234. /// <returns></returns>
  1235. private JObject GetInput(int Index, out TradeEnum trade)
  1236. {
  1237. trade = TradeEnum.MedicalServiceDirectory;
  1238. dynamic joData = new JObject();
  1239. switch (Index)
  1240. {
  1241. case 14://民族药品目
  1242. {
  1243. trade = TradeEnum.NationalityDrug;
  1244. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1245. joData.genname_codg = ""; //通用名编号
  1246. joData.drug_genname = ""; //药品通用名
  1247. joData.drug_prodname = tbDircetoryName.Text; //药品商品名
  1248. joData.reg_name = ""; //注册名称
  1249. joData.tcmherb_name = ""; //中草药名称
  1250. joData.mlms_name = ""; //药材名称
  1251. joData.vali_flag = ""; //有效标志
  1252. joData.rid = ""; //唯一记录号
  1253. joData.ver = ""; //版本号
  1254. joData.ver_name = ""; //版本名称
  1255. joData.opt_begn_time = ""; //经办开始时间
  1256. joData.opt_end_time = ""; //经办结束时间
  1257. joData.updt_time = TexDate.Text; //更新时间
  1258. joData.page_num = TexDQYS.Text; //当前页数
  1259. joData.page_size = TexBYSJL.Text; //本页数据量
  1260. break;
  1261. }
  1262. case 15://目录信息查询
  1263. {
  1264. trade = TradeEnum.InsuDirectory;
  1265. joData.query_date = ""; //查询时间点
  1266. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1267. joData.insu_admdvs = TextCbd.Text; //参保机构医保区划
  1268. joData.begndate = ""; //开始日期
  1269. joData.hilist_name = tbDircetoryName.Text; //医保目录名称
  1270. joData.wubi = ""; //五笔助记码
  1271. joData.pinyin = ""; //拼音助记码
  1272. joData.med_chrgitm_type = ""; //医疗收费项目类别
  1273. joData.chrgitm_lv = ""; //收费项目等级
  1274. joData.lmt_used_flag = ""; //限制使用标志
  1275. joData.list_type = ""; //目录类别
  1276. joData.med_use_flag = ""; //医疗使用标志
  1277. joData.matn_used_flag = ""; //生育使用标志
  1278. joData.hilist_use_type = ""; //医保目录使用类别
  1279. joData.lmt_cpnd_type = ""; //限复方使用类型
  1280. joData.vali_flag = ""; //有效标志
  1281. joData.updt_time = TexDate.Text; //更新时间
  1282. joData.page_num = TexDQYS.Text; //当前页数
  1283. joData.page_size = TexBYSJL.Text; //本页数据量
  1284. break;
  1285. }
  1286. case 16://医疗与医保目录匹配
  1287. {
  1288. trade = TradeEnum.MedicalAndInsuDirectory;
  1289. joData.query_date = ""; //查询时间点
  1290. joData.medins_list_codg = ""; //定点医药机构目录编号
  1291. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1292. joData.list_type = ""; //目录类别
  1293. joData.insu_admdvs = TextCbd.Text; //参保机构医保区划
  1294. joData.begndate = ""; //开始日期
  1295. joData.vali_flag = ""; //有效标志
  1296. joData.updt_time = TexDate.Text; //更新时间
  1297. joData.page_num = TexDQYS.Text; //当前页数
  1298. joData.page_size = TexBYSJL.Text; //本页数据量
  1299. break;
  1300. }
  1301. case 17://医药机构目录匹配
  1302. {
  1303. trade = TradeEnum.MedcineOrgDirectory;
  1304. joData.query_date = ""; //查询时间点
  1305. joData.fixmedins_code = ""; //定点医药机构编号
  1306. joData.medins_list_codg = ""; //定点医药机构目录编号
  1307. joData.medins_list_name = ""; //定点医药机构目录名称
  1308. joData.insu_admdvs = TextCbd.Text; //参保机构医保区划
  1309. joData.list_type = ""; //目录类别
  1310. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1311. joData.begndate = ""; //开始日期
  1312. joData.vali_flag = ""; //有效标志
  1313. joData.updt_time = TexDate.Text; //更新时间
  1314. joData.page_num = TexDQYS.Text; //当前页数
  1315. joData.page_size = TexBYSJL.Text; //本页数据量
  1316. break;
  1317. }
  1318. case 18://医保目录限价
  1319. {
  1320. trade = TradeEnum.InsuPriceLimitDirectory;
  1321. joData.query_date = ""; //查询时间点
  1322. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1323. joData.hilist_lmtpric_type = ""; //医保目录限价类型
  1324. joData.overlmt_dspo_way = ""; //医保目录超限处理方式
  1325. joData.insu_admdvs = TextCbd.Text; //参保机构医保区划
  1326. joData.begndate = ""; //开始日期
  1327. joData.enddate = ""; //结束日期
  1328. joData.vali_flag = ""; //有效标志
  1329. joData.rid = ""; //唯一记录号
  1330. joData.tabname = ""; //表名
  1331. joData.poolarea_no = ""; //统筹区
  1332. joData.updt_time = TexDate.Text; //更新时间
  1333. joData.page_num = TexDQYS.Text; //当前页数
  1334. joData.page_size = TexBYSJL.Text; //本页数据量
  1335. break;
  1336. }
  1337. case 19://医保目录先自付比例
  1338. {
  1339. trade = TradeEnum.PrepayPercentDirectory;
  1340. joData.query_date = ""; //查询时间点
  1341. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1342. joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
  1343. joData.selfpay_prop_type = ""; //目录自付比例类别
  1344. joData.insu_admdvs = TextCbd.Text; //参保机构医保区划
  1345. joData.begndate = ""; //开始日期
  1346. joData.enddate = ""; //结束日期
  1347. joData.vali_flag = ""; //有效标志
  1348. joData.rid = ""; //唯一记录号
  1349. joData.tabname = ""; //表名
  1350. joData.poolarea_no = ""; //统筹区
  1351. joData.updt_time = TexDate.Text; //更新时间
  1352. joData.page_num = TexDQYS.Text; //当前页数
  1353. joData.page_size = TexBYSJL.Text; //本页数据量
  1354. break;
  1355. }
  1356. case 20://医药机构信息
  1357. {
  1358. trade = TradeEnum.MedicalOrgination;
  1359. joData.fixmedins_type = "1"; //定点医疗服务机构类型 1定点医疗机构,2定点零售药店,3工伤定点康复机构,4辅助器具配置机构,5计划生育服务机构
  1360. joData.fixmedins_name = TexYYMC.Text; //定点医药机构名称
  1361. joData.fixmedins_code = ""; //定点医药机构编号
  1362. break;
  1363. }
  1364. }
  1365. return joData;
  1366. }
  1367. private void uiButton1_Click(object sender, EventArgs e)
  1368. {
  1369. Close();
  1370. }
  1371. /// <summary>
  1372. /// 单条上传目录对照关系
  1373. /// </summary>
  1374. private void SingleUpload()
  1375. {
  1376. if ((dgvHISDirectory.CurrentRow == null))
  1377. {
  1378. MessageBox.Show("请查询HIS目录对照关系");
  1379. return;
  1380. }
  1381. string errorMsg = "", sMLLX = "";
  1382. //单条目录对照关系上传
  1383. int iHis = dgvHISDirectory.CurrentRow.Index;
  1384. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1385. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1386. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1387. if (hisType == 1)
  1388. {
  1389. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1390. }
  1391. else if (hisType == 2)
  1392. {
  1393. sMLLX = "201";
  1394. }
  1395. else if (hisType == 3)
  1396. {
  1397. sMLLX = "301";
  1398. }
  1399. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1400. string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
  1401. string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
  1402. string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
  1403. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1404. string MapId = dtHis.Rows[iHis]["MapID"].ToString();
  1405. JArray dataArray = new JArray();
  1406. //调用3301目录对照上传
  1407. JObject joData = new JObject();
  1408. joData.Add("fixmedins_hilist_id", HisCode);
  1409. joData.Add("fixmedins_hilist_name", HisName);
  1410. joData.Add("list_type", sMLLX); //目录类别
  1411. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1412. joData.Add("begndate", "2023-10-01"); //开始日期
  1413. joData.Add("enddate", UpdateDate); //结束日期
  1414. joData.Add("aprvno", "");
  1415. joData.Add("dosform", "");
  1416. joData.Add("exct_cont", "");
  1417. joData.Add("item_cont", "");
  1418. joData.Add("prcunt", "");
  1419. joData.Add("spec", "");
  1420. joData.Add("pacspec", "");
  1421. joData.Add("memo", "");
  1422. dataArray.Add(joData);
  1423. // 单条与多条保持一致
  1424. JObject joInput = new JObject();
  1425. joInput.Add("data", dataArray);
  1426. InvokeHelper invoker = new InvokeHelper();
  1427. Global.pat.insuplc_admdvs = Global.inf.areaCode;
  1428. JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastUpload, joInput);
  1429. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1430. {
  1431. MessageBox.Show("目录对照关系上传失败:" + errorMsg);
  1432. }
  1433. else
  1434. {
  1435. UpdateUploadStatus(MapId, 3);
  1436. MessageBox.Show("目录对照关系上传成功!");
  1437. }
  1438. }
  1439. /// <summary>
  1440. /// 单条撤销目录对照关系上传
  1441. /// </summary>
  1442. private void SingleCancelUpload()
  1443. {
  1444. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1445. {
  1446. MessageBox.Show("请查询HIS目录对照关系");
  1447. return;
  1448. }
  1449. string errorMsg = "", sMLLX = "";
  1450. //撤销目录对照关系
  1451. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1452. int iHis = dgvHISDirectory.CurrentRow.Index;
  1453. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1454. string HisCode = dtHis.Rows[iHis]["HisCode"].ToString();
  1455. string MapId = dtHis.Rows[iHis]["MapID"].ToString();
  1456. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1457. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1458. if (hisType == 1)
  1459. {
  1460. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1461. }
  1462. else if (hisType == 2)
  1463. {
  1464. sMLLX = "201";
  1465. }
  1466. else if (hisType == 3)
  1467. {
  1468. sMLLX = "301";
  1469. }
  1470. //调用3302目录对照撤销
  1471. JObject joData = new JObject();
  1472. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1473. joData.Add("fixmedins_hilist_id", HisCode);
  1474. joData.Add("list_type", sMLLX); //目录类别
  1475. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1476. JObject joInput = new JObject();
  1477. joInput.Add("data", joData);
  1478. InvokeHelper invoker = new InvokeHelper();
  1479. Global.pat.insuplc_admdvs = Global.inf.areaCode;
  1480. JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastCancel, joInput);
  1481. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1482. {
  1483. MessageBox.Show("目录对照撤销失败:" + errorMsg);
  1484. }
  1485. else
  1486. {
  1487. UpdateUploadStatus(MapId, 2);
  1488. MessageBox.Show("目录对照撤销成功!");
  1489. }
  1490. }
  1491. /// <summary>
  1492. /// 全部上传目录对照关系
  1493. /// </summary>
  1494. private void AllUpLoad()
  1495. {
  1496. if ((dgvHISDirectory.CurrentRow == null))
  1497. {
  1498. MessageBox.Show("请查询HIS目录对照关系");
  1499. return;
  1500. }
  1501. string sInputStr = "", sMLLX = "", errorMsg = "", Msg = "";
  1502. Boolean bOk = true;
  1503. JObject InputjoRtn = new JObject();
  1504. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1505. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1506. if (hisType == 1)
  1507. {
  1508. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1509. }
  1510. else if (hisType == 2)
  1511. {
  1512. sMLLX = "201";
  1513. }
  1514. else if (hisType == 3)
  1515. {
  1516. sMLLX = "301";
  1517. }
  1518. List<String> mapIdList = new List<string>();
  1519. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1520. JArray dataArray = new JArray();
  1521. for (int i = 0; i < dtHis.Rows.Count; i++)
  1522. {
  1523. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString(); //医保目录编码
  1524. string InsuName = dtHis.Rows[i]["InsuName"].ToString(); //医保目录名称
  1525. string HisCode = dtHis.Rows[i]["itemCode"].ToString(); //HIS目录编码
  1526. string HisName = dtHis.Rows[i]["itemDesc"].ToString(); //HIS目录名称
  1527. mapIdList.Add(dtHis.Rows[i]["MapID"].ToString()); //ID
  1528. //调用3301目录对照上传
  1529. JObject joData = new JObject();
  1530. joData.Add("fixmedins_hilist_id", HisCode);
  1531. joData.Add("fixmedins_hilist_name", HisName);
  1532. joData.Add("list_type", sMLLX); //目录类别
  1533. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1534. joData.Add("begndate", "2023-10-01"); //开始日期
  1535. joData.Add("enddate", UpdateDate); //结束日期
  1536. joData.Add("aprvno", "");
  1537. joData.Add("dosform", "");
  1538. joData.Add("exct_cont", "");
  1539. joData.Add("item_cont", "");
  1540. joData.Add("prcunt", "");
  1541. joData.Add("spec", "");
  1542. joData.Add("pacspec", "");
  1543. joData.Add("memo", "");
  1544. dataArray.Add(joData);
  1545. }
  1546. JObject joInput = new JObject();
  1547. joInput.Add("data", dataArray);
  1548. Global.pat.insuplc_admdvs = Global.inf.areaCode;
  1549. InvokeHelper invoker = new InvokeHelper();
  1550. JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastUpload, joInput);
  1551. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1552. {
  1553. bOk = false;
  1554. Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
  1555. }
  1556. if (bOk == false)
  1557. {
  1558. MessageBox.Show("全部目录对照关系上传成功,部分上传异常:" + Msg);
  1559. }
  1560. else
  1561. {
  1562. UpdateUploadStatus(string.Join(",", mapIdList.ToArray()), 3);
  1563. MessageBox.Show("全部目录对照关系上传成功!");
  1564. }
  1565. }
  1566. private void UpdateUploadStatus(string ids, int state)
  1567. {
  1568. if (string.IsNullOrEmpty(ids)) return;
  1569. dynamic joInput = new JObject();
  1570. joInput.HospitalDr = Global.inf.hospitalDr;
  1571. joInput.InterfaceDr = Global.inf.interfaceDr;
  1572. joInput.ID = ids;
  1573. joInput.state = state;
  1574. JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010103", joInput).ToString(), "更新上传状态");
  1575. if (joRtn["errorCode"].Text() != "0")
  1576. {
  1577. Global.writeLog("更新状态失败!" + joRtn["errorMessage"].ToString());
  1578. }
  1579. }
  1580. /// <summary>
  1581. /// 全部撤销目录对照关系上传
  1582. /// </summary>
  1583. private void AllCancelUpload()
  1584. {
  1585. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1586. {
  1587. MessageBox.Show("请查询HIS目录对照关系");
  1588. return;
  1589. }
  1590. string sMLLX = "", errorMsg = "", Msg = "";
  1591. Boolean bOk = true;
  1592. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1593. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1594. if (hisType == 1)
  1595. {
  1596. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1597. }
  1598. else if (hisType == 2)
  1599. {
  1600. sMLLX = "201";
  1601. }
  1602. else if (hisType == 3)
  1603. {
  1604. sMLLX = "301";
  1605. }
  1606. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1607. List<String> mapIdList = new List<string>();
  1608. for (int i = 0; i < dtHis.Rows.Count; i++)
  1609. {
  1610. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();
  1611. string HisCode = dtHis.Rows[i]["HisCode"].ToString();
  1612. mapIdList.Add(dtHis.Rows[i]["MapID"].ToString()); //ID
  1613. //调用3302目录对照撤销
  1614. JObject joData = new JObject();
  1615. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1616. joData.Add("fixmedins_hilist_id", HisCode);
  1617. joData.Add("list_type", sMLLX); //目录类别
  1618. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1619. JObject joInput = new JObject();
  1620. joInput.Add("data", joData);
  1621. InvokeHelper invoker = new InvokeHelper();
  1622. JObject joRtn = invoker.invokeCenterService(TradeEnum.DirectoryContrastCancel, joInput);
  1623. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1624. {
  1625. bOk = false;
  1626. Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
  1627. }
  1628. }
  1629. if (bOk == false)
  1630. {
  1631. MessageBox.Show("全部撤销目录对照关系上传成功,部分撤销异常:" + Msg);
  1632. }
  1633. else
  1634. {
  1635. UpdateUploadStatus(string.Join(",", mapIdList.ToArray()), 2);
  1636. MessageBox.Show("全部撤销目录对照关系上传成功!");
  1637. }
  1638. }
  1639. private void ToolStripMenuItem_Upload_Click(object sender, EventArgs e)
  1640. {
  1641. SingleUpload();
  1642. }
  1643. private void ToolStripMenuItem_CancelUpload_Click(object sender, EventArgs e)
  1644. {
  1645. SingleCancelUpload();
  1646. }
  1647. private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
  1648. {
  1649. tbHISDirectoryFilter.Text = "";
  1650. uiTextBox1.Text = "";
  1651. rbAll.Checked = true;
  1652. rbMaped.Checked = false;
  1653. rbNoMaped.Checked = false;
  1654. tbCenterDirectoryFilter.Text = "";
  1655. tbInsuCode.Text = "";
  1656. tbApprovalNO.Text = "";
  1657. dgvCenterDirectory.DataSource = null;
  1658. btnQueryHISDirectory_Click(null, new EventArgs());
  1659. }
  1660. private void rbNoMaped_CheckedChanged(object sender, EventArgs e)
  1661. {
  1662. //if (rbNoMaped.Checked)
  1663. //{
  1664. // string errMsg;
  1665. // if (queryHISDirectory(1, 300, out errMsg) != 0)
  1666. // {
  1667. // MessageBox.Show(errMsg);
  1668. // return;
  1669. // }
  1670. //}
  1671. }
  1672. private void dgvHISDirectory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
  1673. {
  1674. e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1);
  1675. }
  1676. private void dgvCenterDirectory_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
  1677. {
  1678. e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1);
  1679. }
  1680. private void updateLimitPrice()
  1681. {
  1682. SelfpayPercentForm selfpay = new SelfpayPercentForm();
  1683. selfpay.CenterCode = dgvDirectoy.Rows[dgvDirectoy.SelectedIndex].Cells["Code"].Value + "";
  1684. selfpay.ShowDialog();
  1685. }
  1686. private void btSignIn_Click(object sender, EventArgs e)
  1687. {
  1688. string error = "";
  1689. if (mIS.isSigned(ref Global.curEvt.signno) != true)
  1690. {
  1691. JObject joRtn = new JObject();
  1692. CallResult callResult = new SignInProcess().Process(joRtn);
  1693. if (JsonHelper.parseCenterReturnJson(JObject.FromObject(callResult.PureData), out error) != 0)
  1694. MessageBox.Show($"签到失败!{error}");
  1695. else
  1696. MessageBox.Show("签到成功!");
  1697. }
  1698. else
  1699. MessageBox.Show("今日已签到!");
  1700. }
  1701. private void tsmiSingleUpdateAuxInfo_Click(object sender, EventArgs e)
  1702. {
  1703. string error;
  1704. int iDir = dgvDirectoy.CurrentRow.Index;
  1705. if (dgvDirectoy.CurrentRow == null)
  1706. {
  1707. MessageBox.Show("请查询中心目录");
  1708. return;
  1709. }
  1710. JObject jo = new JObject();
  1711. jo.Add("code", dgvDirectoy.Rows[iDir].Cells["code"].Value.ToString());
  1712. jo.Add("HisType", rbgDirecType.SelectedIndex + 1);
  1713. if (updateAuxInfo(jo, out error) != 0)
  1714. {
  1715. MessageBox.Show(error);
  1716. }
  1717. else
  1718. {
  1719. MessageBox.Show(error);
  1720. }
  1721. }
  1722. public string getDataRowValue(DataRow dr, string columnName)
  1723. {
  1724. if (!dr.Table.Columns.Contains(columnName))
  1725. {
  1726. return "";
  1727. }
  1728. else
  1729. {
  1730. return dr[columnName].ToString();
  1731. }
  1732. }
  1733. //更新目录信息(附属信息)
  1734. private int updateAuxInfo(JObject jo, out string err)
  1735. {
  1736. err = "";
  1737. tbDirectoryCode.Text = JsonHelper.getDestValue(jo, "code");
  1738. dynamic joData = GetInput(15, out TradeEnum trade);
  1739. JObject joRtn = cBus.InvokeMedicalInsuranceInquiry(trade, joData);
  1740. if (joRtn["infcode"].ToString() == "0")
  1741. {
  1742. DataTable dtAuxInfo = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
  1743. DateTime dtToday = DateTime.Today;
  1744. string chrgitm_lv = "";
  1745. string begndate = "";
  1746. string enddate = "";
  1747. string list_type = "";
  1748. string med_chrgitm_type = "";
  1749. int iAdpater = 0;
  1750. foreach (DataRow dr in dtAuxInfo.Rows)
  1751. {
  1752. DateTime dtBegin = getDataRowValue(dr, "begndate") == "" ? Convert.ToDateTime("2000-01-01 00:00:00") : Convert.ToDateTime(getDataRowValue(dr, "begndate"));
  1753. DateTime dtEnd = getDataRowValue(dr, "enddate") == "" ? Convert.ToDateTime("2099-01-01 00:00:00") : Convert.ToDateTime(getDataRowValue(dr, "enddate"));
  1754. if ((dtBegin < dtToday) && (dtToday < dtEnd))
  1755. {
  1756. iAdpater++;
  1757. chrgitm_lv = dr["chrgitm_lv"].ToString();
  1758. begndate = dr["begndate"].ToString();
  1759. enddate = dr["enddate"].ToString();
  1760. list_type = dr["list_type"].ToString();
  1761. med_chrgitm_type = dr["med_chrgitm_type"].ToString();
  1762. }
  1763. }
  1764. //有且只能有一条数据符合
  1765. if (iAdpater == 1)
  1766. {
  1767. JObject joPamam = new JObject();
  1768. joPamam.Add("Code", JsonHelper.getDestValue(jo, "code"));
  1769. joPamam.Add("HisType", JsonHelper.getDestValue(jo, "HisType"));
  1770. joPamam.Add("StartDate", begndate);
  1771. joPamam.Add("EndDate", enddate);
  1772. joPamam.Add("ChargeItemLevel", chrgitm_lv);
  1773. joPamam.Add("ListType", list_type);
  1774. joPamam.Add("ChargeItemType", med_chrgitm_type);
  1775. JObject joUpdateRtn = mIS.UpdateDirectoryBySelf(joPamam);
  1776. string error = "";
  1777. if (JsonHelper.parseIrisRtnValue(joUpdateRtn, out error) != 0)
  1778. {
  1779. err = "修改失败:" + error;
  1780. return -1;
  1781. }
  1782. else
  1783. {
  1784. err = "修改成功";
  1785. return 0;
  1786. }
  1787. }
  1788. else
  1789. {
  1790. err = "中心返回符合条数的记录不唯一或者为空,请检查!";
  1791. return -1;
  1792. }
  1793. }
  1794. else
  1795. {
  1796. err = "查询中心数据出错,请检查!";
  1797. return -1;
  1798. }
  1799. }
  1800. //更新目录信息(附属信息)
  1801. private int updateCellingPrice(JObject jo, out string err)
  1802. {
  1803. err = "";
  1804. tbDirectoryCode.Text = JsonHelper.getDestValue(jo, "code");
  1805. dynamic joData = GetInput(18, out TradeEnum trade);
  1806. JObject joRtn = cBus.InvokeMedicalInsuranceInquiry(trade, joData);
  1807. if (joRtn["infcode"].ToString() == "0")
  1808. {
  1809. DataTable dtAuxInfo = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
  1810. DateTime dtToday = DateTime.Today;
  1811. string cellingPrice = "";
  1812. string begndate = "";
  1813. string enddate = "";
  1814. int iAdpater = 0;
  1815. foreach (DataRow dr in dtAuxInfo.Rows)
  1816. {
  1817. DateTime dtBegin = getDataRowValue(dr, "begndate") == "" ? Convert.ToDateTime("2000-01-01 00:00:00") : Convert.ToDateTime(getDataRowValue(dr, "begndate"));
  1818. DateTime dtEnd = getDataRowValue(dr, "enddate") == "" ? Convert.ToDateTime("2099-01-01 00:00:00") : Convert.ToDateTime(getDataRowValue(dr, "enddate"));
  1819. if ((dtBegin < dtToday) && (dtToday < dtEnd))
  1820. {
  1821. iAdpater++;
  1822. cellingPrice = dr["hilist_pric_uplmt_amt"].ToString();
  1823. begndate = dr["begndate"].ToString();
  1824. enddate = dr["enddate"].ToString();
  1825. }
  1826. }
  1827. //有且只能有一条数据符合
  1828. if (iAdpater == 1)
  1829. {
  1830. JObject joPamam = new JObject();
  1831. joPamam.Add("Code", JsonHelper.getDestValue(jo, "code"));
  1832. joPamam.Add("HisType", JsonHelper.getDestValue(jo, "HisType"));
  1833. joPamam.Add("StartDate", begndate);
  1834. joPamam.Add("EndDate", enddate);
  1835. joPamam.Add("CeilingPrice", cellingPrice);
  1836. JObject joUpdateRtn = mIS.UpdateDirectoryBySelf(joPamam);
  1837. string error = "";
  1838. if (JsonHelper.parseIrisRtnValue(joUpdateRtn, out error) != 0)
  1839. {
  1840. err = "修改失败:" + error;
  1841. return -1;
  1842. }
  1843. else
  1844. {
  1845. err = "修改成功";
  1846. return 0;
  1847. }
  1848. }
  1849. else
  1850. {
  1851. err = "中心返回符合条数的记录不唯一或者为空,请检查!";
  1852. return -1;
  1853. }
  1854. }
  1855. else
  1856. {
  1857. err = "查询中心数据出错,请检查!";
  1858. return -1;
  1859. }
  1860. }
  1861. private void tsmiUpdateCellingPrice_Click(object sender, EventArgs e)
  1862. {
  1863. string error;
  1864. int iDir = dgvDirectoy.CurrentRow.Index;
  1865. if (dgvDirectoy.CurrentRow == null)
  1866. {
  1867. MessageBox.Show("请查询中心目录");
  1868. return;
  1869. }
  1870. JObject jo = new JObject();
  1871. jo.Add("code", dgvDirectoy.Rows[iDir].Cells["code"].Value.ToString());
  1872. jo.Add("HisType", rbgDirecType.SelectedIndex + 1);
  1873. if (updateCellingPrice(jo, out error) != 0)
  1874. {
  1875. MessageBox.Show(error);
  1876. }
  1877. else
  1878. {
  1879. MessageBox.Show(error);
  1880. }
  1881. }
  1882. private void btTripMenu_Click(object sender, EventArgs e)
  1883. {
  1884. tsmExportMappedDataByLeft.Text
  1885. = "导出【" + rbgDirecType_C.Items[rbgDirecType_C.SelectedIndex].ToString() + "】已对照数据";
  1886. uiContextMenuStrip1.Show(((Sunny.UI.UIButton)sender), new Point(0, btTripMenu.Height));
  1887. tsmExportNoMappDataByLeft.Text
  1888. = "导出【" + rbgDirecType_C.Items[rbgDirecType_C.SelectedIndex].ToString() + "】未对照数据";
  1889. uiContextMenuStrip1.Show(((Sunny.UI.UIButton)sender), new Point(0, btTripMenu.Height));
  1890. }
  1891. private void tsmExportAllMappedData_Click(object sender, EventArgs e)
  1892. {
  1893. if (queryMapeDirectory(1, 1000, out string errMsg) != 0)
  1894. {
  1895. MessageBox.Show(errMsg);
  1896. return;
  1897. }
  1898. if (dtExport.Rows.Count > 0)
  1899. {
  1900. string directoryType = string.Empty;
  1901. string sBZ = "已对照";
  1902. switch (rbgDirecType_C.SelectedIndex)
  1903. {
  1904. case 0:
  1905. {
  1906. directoryType = "药品";
  1907. break;
  1908. }
  1909. case 1:
  1910. {
  1911. directoryType = "诊疗";
  1912. break;
  1913. }
  1914. case 2:
  1915. {
  1916. directoryType = "材料";
  1917. break;
  1918. }
  1919. }
  1920. MessageBox.Show(dtExport.Rows.Count.ToString());
  1921. string LSH = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("MMddHHmmssffff");
  1922. string sFliePathName = @"D:\" + LSH + "(" + directoryType + ")医保目录" + sBZ + "信息.xls";
  1923. string ReturnFileName = ExportToExcel.DataTabletoCSV(dtExport, sFliePathName);
  1924. if (ReturnFileName != "")
  1925. {
  1926. MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  1927. System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  1928. }
  1929. else
  1930. {
  1931. MessageBox.Show("导出失败!");
  1932. }
  1933. }
  1934. }
  1935. private void tsmUploadAllMappedData_Click(object sender, EventArgs e)
  1936. {
  1937. AllUpLoad();
  1938. }
  1939. private void tsmCancelAllUploadedData_Click(object sender, EventArgs e)
  1940. {
  1941. AllCancelUpload();
  1942. }
  1943. private void tsmUpdateCellPriceOfAllMapped_Click(object sender, EventArgs e)
  1944. {
  1945. updateMappedInsuInfo(updateCellPriceWrapper);
  1946. }
  1947. private void tsmUpdateAllMapped_Click(object sender, EventArgs e)
  1948. {
  1949. updateMappedInsuInfo(updateAuxAndCellPriceWrapper);
  1950. }
  1951. private void updateMappedInsuInfo(Func<JObject, OutParamWrapper, int> action)
  1952. {
  1953. string sqlStr = $"select * from HB_MedInsuMapRelation where Interface_Dr='{Global.inf.interfaceDr}' and Hospital_Dr ='{Global.inf.hospitalDr}'";
  1954. JObject joSqlstr = new JObject();
  1955. joSqlstr.Add("sqlStr", sqlStr);
  1956. JObject joRtn = mIS.QueryMappedData(joSqlstr, "查询所有已对照数据");
  1957. DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  1958. int iFalse = 0;
  1959. int iCount = 0;
  1960. foreach (DataRow dr in dt.Rows)
  1961. {
  1962. JObject jo = new JObject();
  1963. jo.Add("code", dr["InsuCode"].ToString());
  1964. jo.Add("HisType", dr["HisType"].ToString());
  1965. OutParamWrapper outParWarp = new OutParamWrapper();
  1966. if (action(jo, outParWarp) != 0)
  1967. {
  1968. iFalse++;
  1969. Global.writeLog(outParWarp.Value);
  1970. }
  1971. }
  1972. if (iFalse != 0)
  1973. {
  1974. MessageBox.Show($"总共{iCount}条数据更新完成,但有{iFalse}条更新发生错误!");
  1975. }
  1976. else
  1977. {
  1978. MessageBox.Show("全部数据更新完成");
  1979. }
  1980. }
  1981. private int updateAuxAndCellPriceWrapper(JObject jo, OutParamWrapper outParamWrapper)
  1982. {
  1983. string err;
  1984. int iresult = updateAuxAndCellPrice(jo, out err);
  1985. outParamWrapper.Value = err;
  1986. return iresult;
  1987. }
  1988. private int updateCellPriceWrapper(JObject jo, OutParamWrapper outParamWrapper)
  1989. {
  1990. string err;
  1991. int iresult = updateCellingPrice(jo, out err);
  1992. outParamWrapper.Value = err;
  1993. return iresult;
  1994. }
  1995. private int updateAuxInfoWrapper(JObject jo, OutParamWrapper outParamWrapper)
  1996. {
  1997. string err;
  1998. int iresult = updateAuxInfo(jo, out err);
  1999. outParamWrapper.Value = err;
  2000. return iresult;
  2001. }
  2002. private int updateAuxAndCellPrice(JObject jo, out string error)
  2003. {
  2004. string err = "";
  2005. int iResult = 0;
  2006. error = "";
  2007. if (updateAuxInfo(jo, out err) != 0)
  2008. {
  2009. error = $"更新目录信息失败{err}";
  2010. iResult--;
  2011. }
  2012. err = "";
  2013. if (updateCellingPrice(jo, out err) != 0)
  2014. {
  2015. error = $"{error};更新限价信息失败{err}";
  2016. iResult--;
  2017. }
  2018. return iResult;
  2019. }
  2020. private void tsmUpdateLevelTypeOfAllMappedData_Click(object sender, EventArgs e)
  2021. {
  2022. updateMappedInsuInfo(updateAuxInfoWrapper);
  2023. }
  2024. private void tsmSingleUpdateInsuInfo_Click(object sender, EventArgs e)
  2025. {
  2026. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  2027. {
  2028. MessageBox.Show("请查询HIS目录对照关系,注意选择已对照!");
  2029. return;
  2030. }
  2031. int iMapped = dgvHISDirectory.CurrentRow.Index;
  2032. string insuCode = dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString();
  2033. if (string.IsNullOrEmpty(insuCode))
  2034. {
  2035. MessageBox.Show("未检测到对应的医保目录,请检查该目录是否已对照!");
  2036. return;
  2037. }
  2038. JObject jo = new JObject();
  2039. jo.Add("code", dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString());
  2040. jo.Add("HisType", rbgDirecType_C.SelectedIndex + 1);
  2041. string error;
  2042. if (updateAuxAndCellPrice(jo, out error) != 0)
  2043. {
  2044. MessageBox.Show($"更新失败{error}");
  2045. }
  2046. else
  2047. {
  2048. MessageBox.Show("更新成功!");
  2049. }
  2050. }
  2051. private void dgvHISDirectory_SelectionChanged(object sender, EventArgs e)
  2052. {
  2053. int i = dgvHISDirectory.CurrentRow.Index;
  2054. if (dgvHISDirectory.Rows[i].Cells["insuCode"].Value.ToString() != "")
  2055. {
  2056. tbInsuCode.Text = dgvHISDirectory.Rows[i].Cells["insuCode"].Value.ToString();
  2057. tbCenterDirectoryFilter.Text = "";
  2058. tbApprovalNO.Text = "";
  2059. }
  2060. else
  2061. {
  2062. tbInsuCode.Text = "";
  2063. if (rbOnlyName.Checked)
  2064. {
  2065. tbInsuCode.Text = "";
  2066. tbApprovalNO.Text = "";
  2067. tbCenterDirectoryFilter.Text = "%" + dgvHISDirectory.Rows[i].Cells["itemDesc"].Value.ToString() + "%";
  2068. }
  2069. if (rbOnlyApprNO.Checked)
  2070. {
  2071. tbCenterDirectoryFilter.Text = "";
  2072. tbInsuCode.Text = "";
  2073. tbApprovalNO.Text = "%" + dgvHISDirectory.Rows[i].Cells["pprovalNo"].Value.ToString() + "%";
  2074. }
  2075. if (rbBoth.Checked)
  2076. {
  2077. tbInsuCode.Text = "";
  2078. tbCenterDirectoryFilter.Text = "%" + dgvHISDirectory.Rows[i].Cells["itemDesc"].Value.ToString() + "%";
  2079. tbApprovalNO.Text = "%" + dgvHISDirectory.Rows[i].Cells["pprovalNo"].Value.ToString() + "%";
  2080. }
  2081. }
  2082. }
  2083. private void uiButton2_Click(object sender, EventArgs e)
  2084. {
  2085. Close();
  2086. }
  2087. private void tsmExportAllData_Click(object sender, EventArgs e)
  2088. {
  2089. }
  2090. private void dgvHISDirectory_CellClick(object sender, DataGridViewCellEventArgs e)
  2091. {
  2092. }
  2093. private void tsmExportMappedDataByLeft_Click(object sender, EventArgs e)
  2094. {
  2095. if (queryMapeDirectory(1, 3000, out string errMsg) != 0)
  2096. {
  2097. MessageBox.Show(errMsg);
  2098. return;
  2099. }
  2100. if (dtExport.Rows.Count > 0)
  2101. {
  2102. string directoryType = string.Empty;
  2103. switch (rbgDirecType_C.SelectedIndex)
  2104. {
  2105. case 0:
  2106. {
  2107. directoryType = "药品";
  2108. break;
  2109. }
  2110. case 1:
  2111. {
  2112. directoryType = "诊疗";
  2113. break;
  2114. }
  2115. case 2:
  2116. {
  2117. directoryType = "材料";
  2118. break;
  2119. }
  2120. }
  2121. string LSH = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("MMddHHmmssffff");
  2122. string sFliePathName = @"D:\" + LSH + "(" + directoryType + ")医保目录已对照信息.xls";
  2123. string ReturnFileName = ExportToExcel.DataTabletoCSV(dtExport, sFliePathName);
  2124. //if (!string.IsNullOrEmpty(ReturnFileName))
  2125. //{
  2126. // MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  2127. // System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  2128. //}
  2129. //else
  2130. // MessageBox.Show("导出失败!");
  2131. }
  2132. }
  2133. private void tsmExportNoMappDataByLeft_Click(object sender, EventArgs e)
  2134. {
  2135. if (queryNoMappDirectory(1, 3000, out string errMsg) != 0)
  2136. {
  2137. MessageBox.Show(errMsg);
  2138. return;
  2139. }
  2140. if (dtExport.Rows.Count > 0)
  2141. {
  2142. string directoryType = string.Empty;
  2143. switch (rbgDirecType_C.SelectedIndex)
  2144. {
  2145. case 0:
  2146. {
  2147. directoryType = "药品";
  2148. break;
  2149. }
  2150. case 1:
  2151. {
  2152. directoryType = "诊疗";
  2153. break;
  2154. }
  2155. case 2:
  2156. {
  2157. directoryType = "材料";
  2158. break;
  2159. }
  2160. }
  2161. string LSH = DateTime.Now.ToString("yyyy-MM-dd"); //DateTime.Now.ToString("MMddHHmmssffff");
  2162. string sFliePathName = @"D:\" + LSH + "(" + directoryType + ")医保目录未对照信息.xls";
  2163. string ReturnFileName = ExportToExcel.DataTabletoCSV(dtExport, sFliePathName);
  2164. //if (!string.IsNullOrEmpty(ReturnFileName))
  2165. //{
  2166. // MessageBox.Show("导出成功,文件保存路径:【" + ReturnFileName + "】");
  2167. // System.Diagnostics.Process.Start(ReturnFileName); //打开excel文件
  2168. //}
  2169. //else
  2170. // MessageBox.Show("导出失败!");
  2171. }
  2172. }
  2173. public class OutParamWrapper
  2174. {
  2175. public string Value { get; set; }
  2176. }
  2177. }
  2178. }