BasicData.cs 82 KB

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