BasicData.cs 98 KB

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