BasicData.cs 100 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580
  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 = pageSize;
  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. string Code = "";
  732. string standardCode = dgvHISDirectory.Rows[iHis].Cells["standardCode"].ToString();
  733. string NationCode = dgvHISDirectory.Rows[iHis].Cells["NationCode"].ToString();
  734. if ((string.IsNullOrEmpty(NationCode)) && (string.IsNullOrEmpty(standardCode) == false))
  735. Code = standardCode;
  736. else
  737. if ((string.IsNullOrEmpty(NationCode) == false) && (string.IsNullOrEmpty(standardCode)))
  738. Code = NationCode;
  739. JArray jaParams = new JArray();
  740. dynamic jsonTemp = new JObject();
  741. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  742. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  743. jsonTemp.updateUserID = Global.user.ID;
  744. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  745. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  746. jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["itemDesc"].Value;
  747. jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
  748. jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
  749. //1.已对照 2.已对照但未上传 3 已对照且已上传
  750. jsonTemp.State = 1;
  751. jsonTemp.HisType = hisType;
  752. jsonTemp.HisTypeName = hisTypeName;
  753. jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Code"].Value;
  754. jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
  755. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  756. jsonTemp.NationCode = Code;
  757. jsonTemp.NationName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
  758. jaParams.Add(jsonTemp);
  759. JObject joIn = new JObject();
  760. joIn.Add(new JProperty("params", jaParams));
  761. joIn.Add("code", "09010040");
  762. InvokeHelper invoker = new InvokeHelper();
  763. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
  764. //JObject joRtn = JObject.Parse(irisRtn);
  765. if ((int)joRtn["errorCode"] == 0)
  766. {
  767. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
  768. }
  769. else
  770. {
  771. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
  772. }
  773. }
  774. private void CancleMapping()
  775. {
  776. int iHis = dgvHISDirectory.CurrentRow.Index;
  777. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  778. JArray jaParams = new JArray();
  779. dynamic jsonTemp = new JObject();
  780. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  781. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  782. jsonTemp.updateUserID = Global.user.ID;
  783. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  784. jsonTemp.State = 0;
  785. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  786. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  787. jaParams.Add(jsonTemp);
  788. JObject joIn = new JObject();
  789. joIn.Add(new JProperty("params", jaParams));
  790. joIn.Add("code", "09010041");
  791. InvokeHelper invoker = new InvokeHelper();
  792. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
  793. if ((int)joRtn["errorCode"] == 0)
  794. {
  795. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
  796. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
  797. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "未对照";
  798. }
  799. else
  800. {
  801. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
  802. }
  803. }
  804. /// <summary>
  805. /// 医保目录单个版本号的下载
  806. /// </summary>
  807. /// <param name="ver"></param>
  808. /// <param name="directoryType"></param>
  809. /// <param name="uiProcessBar"></param>
  810. /// <param name="errorMessage"></param>
  811. /// <returns></returns>
  812. public int SingleDownload(string ver, int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
  813. {
  814. string txtPath = string.Empty;
  815. errorMessage = "";
  816. int iResult = -1;
  817. string funNo = "";
  818. switch (directoryType)
  819. {
  820. case 0://药品
  821. {
  822. funNo = "1301"; //"1301";
  823. break;
  824. }
  825. case 1://诊疗
  826. {
  827. funNo = "1305";
  828. break;
  829. }
  830. case 2://材料
  831. {
  832. funNo = "1306";
  833. break;
  834. }
  835. case 3://疾病诊断
  836. {
  837. funNo = "1307";
  838. break;
  839. }
  840. case 4://手术
  841. {
  842. funNo = "1308";
  843. break;
  844. }
  845. case 5://慢性病
  846. {
  847. funNo = "1309";
  848. break;
  849. }
  850. case 6://DRGs
  851. {
  852. funNo = "1310";
  853. break; ;
  854. }
  855. case 7://日间手术
  856. {
  857. funNo = "1311";
  858. break;
  859. }
  860. case 8://字典表
  861. {
  862. break;
  863. }
  864. case 9://中药饮片
  865. {
  866. funNo = "1302";
  867. break;
  868. }
  869. case 10://医药机构制剂
  870. {
  871. funNo = "1303";
  872. break;
  873. }
  874. }
  875. try
  876. {
  877. JObject joRtn = hBus.DownloadDirectory(funNo, ver);
  878. //MessageBox.Show("往IRIS插入数据准备:" + joRtn.ToString());
  879. //if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  880. if (JsonHelper.parseIrisRtnValue(joRtn, out errorMessage) == 0)
  881. {
  882. txtPath = joRtn["filePath"].ToString();
  883. //MessageBox.Show("获取txt数据往IRIS插入文件路径:"+ txtPath);
  884. DataImoport bus = new DataImoport();
  885. JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, directoryType + 1, uiProcessBar);
  886. //MessageBox.Show("往IRIS插入数据:" + joImportRtn.ToString());
  887. //if (JsonHelper.parseCenterRtnValue(joImportRtn, out errorMessage) == 0)
  888. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  889. {
  890. iResult = 0;
  891. }
  892. else
  893. {
  894. Global.writeLog(joImportRtn.ToString());
  895. errorMessage = "导入数据出现错误,请查看日志!";//joImportRtn["errorMessage"].ToString();
  896. }
  897. }
  898. return iResult;
  899. }
  900. catch (Exception ex)
  901. {
  902. errorMessage = "SingleDownload提示:" + ex.Message;
  903. return -1;
  904. }
  905. }
  906. /// <summary>
  907. /// 医保目录单个版本号的下载
  908. /// </summary>
  909. /// <param name="ver"></param>
  910. /// <param name="directoryType"></param>
  911. /// <param name="uiProcessBar"></param>
  912. /// <param name="errorMessage"></param>
  913. /// <returns></returns>
  914. public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
  915. {
  916. errorMessage = "";
  917. int iResult = -1;
  918. try
  919. {
  920. JObject joRtn = cBus.DownDictionay(joData);
  921. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
  922. {
  923. DataImoport DI = new DataImoport();
  924. JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.list"));
  925. JObject joImportRtn = DI.importDictionary(uiProcessBar, jaList, tbDicType.Text);
  926. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
  927. {
  928. iResult = 0;
  929. }
  930. else
  931. {
  932. errorMessage = "导入数据出现错误,请查看日志!" + errorMessage;
  933. }
  934. }
  935. return iResult;
  936. }
  937. catch (Exception ex)
  938. {
  939. errorMessage = "downloadDicionary提示:" + ex.Message;
  940. return -1;
  941. }
  942. }
  943. /// <summary>
  944. /// 自动下载医保目录,直到最新版本(返回报错)
  945. /// </summary>
  946. /// <param name="directoryType"></param>
  947. /// <param name="uiProcessBar"></param>
  948. /// <param name="errorMessage"></param>
  949. /// <returns></returns>
  950. public int AutoDownload(int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
  951. {
  952. int iResult = 0;
  953. errorMessage = "";
  954. try
  955. {
  956. while (iResult == 0)
  957. {
  958. JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(directoryType);
  959. string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
  960. iResult = JsonHelper.parseIrisRtnValue(joMaxVerNO, out errorMessage);
  961. iResult = SingleDownload(ver, directoryType, uiProcessBar, out errorMessage);
  962. }
  963. return iResult;
  964. }
  965. catch (Exception ex)
  966. {
  967. errorMessage = ex.Message;
  968. return -1;
  969. }
  970. }
  971. #endregion
  972. private void btnDownload_Click(object sender, EventArgs e)
  973. {
  974. string errorMessage = string.Empty;
  975. //医保字典数据下载
  976. if (rbgDirecType.SelectedIndex == 8)
  977. {
  978. if (tbDicDate.Text == "")
  979. {
  980. MessageBox.Show("请输入查询日期!");
  981. return;
  982. }
  983. dynamic joData = new JObject();
  984. joData.type = tbDicType.Text; //字典类型
  985. joData.parentValue = ""; //父字典键值
  986. joData.admdvs = Global.inf.areaCode; //行政区划 就医地
  987. joData.date = tbDicDate.Text; //查询日期
  988. joData.vali_flag = "1"; //有效标志
  989. if (downloadDicionary(joData, uiProcessBar1, out errorMessage) != 0)
  990. {
  991. MessageBox.Show("医保字典下载失败:" + errorMessage);
  992. return;
  993. }
  994. }
  995. else if (rbgDirecType.SelectedIndex <=10)
  996. {
  997. if (rbSingleDown.Checked)
  998. {
  999. string ver = tbVer.Text;
  1000. if (tbVer.Text != "")
  1001. {
  1002. ver = tbVer.Text;
  1003. }
  1004. if (SingleDownload(ver, rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  1005. {
  1006. MessageBox.Show("医保目录下载失败:" + errorMessage);
  1007. return;
  1008. }
  1009. }
  1010. if (rbAutoDown.Checked)
  1011. {
  1012. if (AutoDownload(rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
  1013. {
  1014. MessageBox.Show("医保目录下载失败:" + errorMessage);
  1015. return;
  1016. }
  1017. }
  1018. }
  1019. btnQuery_Click(sender, e);
  1020. }
  1021. private void btnQuery_Click(object sender, EventArgs e)
  1022. {
  1023. #region 校验查询条件
  1024. if ((rbgDirecType.SelectedIndex < 0) || (rbgDirecType.SelectedIndex > 20))
  1025. {
  1026. MessageBox.Show("请先选择查询类型!");
  1027. return;
  1028. }
  1029. if (rbgDirecType.SelectedIndex > 13)
  1030. {
  1031. if (rbgDirecType.SelectedIndex != 20)
  1032. {
  1033. if ((TexDate.Text == "") || (TexDate.Text == "输入日期 2021-01-01"))
  1034. {
  1035. MessageBox.Show("查询条件-请输入查询日期!");
  1036. return;
  1037. }
  1038. if ((TexDQYS.Text == "") || (TexDQYS.Text == "当前页数"))
  1039. {
  1040. MessageBox.Show("查询条件-请输入当前页数!");
  1041. return;
  1042. }
  1043. if ((TexBYSJL.Text == "") || (TexBYSJL.Text == "本页数据量"))
  1044. {
  1045. MessageBox.Show("查询条件-请输入本页数据量!");
  1046. return;
  1047. }
  1048. }
  1049. else
  1050. {
  1051. if ((TexYYMC.Text == "") || (TexYYMC.Text == "输入医院名称模糊查找"))
  1052. {
  1053. MessageBox.Show("查询条件-请输入医院名称模糊查找!");
  1054. return;
  1055. }
  1056. }
  1057. }
  1058. #endregion
  1059. queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy, Global.inf.interfaceDr);
  1060. }
  1061. private void btnQueryHISDirectory_Click(object sender, EventArgs e)
  1062. {
  1063. int iCount = 50;
  1064. if (rbNoMaped.Checked) iCount = 10000;
  1065. if (queryHISDirectory(1, iCount, out string errMsg) != 0)
  1066. {
  1067. MessageBox.Show(errMsg);
  1068. return;
  1069. }
  1070. //GridViewSetter gridSetter = new GridViewSetter();
  1071. //gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
  1072. }
  1073. private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
  1074. {
  1075. if ((tbCenterDirectoryFilter.Text == "") && (tbInsuCode.Text == "") && (tbApprovalNO.Text == "") && (tbManufacturer.Text == ""))
  1076. {
  1077. return;
  1078. }
  1079. //查询区域通用目录
  1080. JObject joRtn = mIS.getInterface_TY(Global.inf.interfaceDr.ToString(),"");
  1081. string InsuCurrencyCataLogue = JsonHelper.getDestValue(joRtn, "InsuCurrencyCataLogue"); //通用目录编码 6
  1082. string InterfaceName_TY = JsonHelper.getDestValue(joRtn, "InterfaceName_TY"); //通用目录名称
  1083. string HospName = JsonHelper.getDestValue(joRtn, "HospitalName"); //目录名称
  1084. if (InsuCurrencyCataLogue != "")
  1085. {
  1086. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, int.Parse(InsuCurrencyCataLogue));
  1087. LabExplain.Visible = true;
  1088. LabExplain.Text = "当前接口已设置区域通用目录,数据源:" + InterfaceName_TY+" ,如果确认没有所查目录请联系数据源医院新增维护!";
  1089. }
  1090. else
  1091. {
  1092. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
  1093. LabExplain.Visible = true;
  1094. LabExplain.Text = "当前接口未设置区域通用目录,数据源:" + HospName;
  1095. }
  1096. }
  1097. private void BasicData_Load(object sender, EventArgs e)
  1098. {
  1099. this.WindowState = FormWindowState.Maximized;
  1100. rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
  1101. LabExplain.Visible = false;
  1102. tabControl1.SelectedIndex = 1;
  1103. GridViewSetter gridSetter = new GridViewSetter();
  1104. gridSetter.SetHeaderTextOfRelationShipDr(dgv_RelationShipDr);
  1105. gridSetter.SetHeaderTextOfMedInsuDr(dgv_InsuDr);
  1106. //gridSetter.DatagridviewColumnWidthAdaptation(dgv_HISDr);
  1107. //gridSetter.DatagridviewColumnWidthAdaptation(dgv_InsuDr);
  1108. gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
  1109. rbg_MedDrType.SelectedIndex = 0;
  1110. }
  1111. private void pgDownload_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1112. {
  1113. queryHISInsuDirectory(rbgDirecType.SelectedIndex, pageIndex, count, dgvDirectoy, Global.inf.interfaceDr);
  1114. }
  1115. private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1116. {
  1117. string errMsg;
  1118. if (rbNoMaped.Checked == false)
  1119. {
  1120. if (queryHISDirectory(pageIndex, 50, out errMsg) != 0)
  1121. {
  1122. MessageBox.Show(errMsg);
  1123. return;
  1124. }
  1125. }
  1126. }
  1127. private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  1128. {
  1129. queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, pageIndex, count, dgvCenterDirectory, Global.inf.interfaceDr);
  1130. }
  1131. private void rbgDirecType_ValueChanged(object sender, int index, string text)
  1132. {
  1133. //选定项不同调用的接口也不相同,Index值大于
  1134. if (rbgDirecType.SelectedIndex > 13)
  1135. {
  1136. uiGroupBox1.Visible = false;
  1137. uiGroupBox5.Visible = false;
  1138. uiGroupBox2.Visible = true;
  1139. //uiGroupBox3.Visible = true;
  1140. uiProcessBar1.Visible = false;
  1141. uiGroupBox2.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1142. uiGroupBox3.Left = uiGroupBox2.Width+rbgDirecType.Width + rbgDirecType.Left + 10;
  1143. dgvDirectoy.DataSource = null;
  1144. }
  1145. else
  1146. {
  1147. uiGroupBox1.Visible = true;
  1148. uiGroupBox5.Visible = true;
  1149. uiGroupBox2.Visible = true;
  1150. //uiGroupBox3.Visible = false;
  1151. uiProcessBar1.Visible = true;
  1152. uiGroupBox1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1153. uiGroupBox5.Left = uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 10;
  1154. uiGroupBox2.Left = uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 15;
  1155. uiGroupBox3.Left = uiGroupBox2.Width + uiGroupBox5.Width + uiGroupBox1.Width + rbgDirecType.Width + rbgDirecType.Left + 20;
  1156. uiProcessBar1.Left = rbgDirecType.Width + rbgDirecType.Left + 5;
  1157. uiProcessBar1.Width = uiGroupBox1.Width + uiGroupBox5.Width + uiGroupBox2.Width + 10;
  1158. }
  1159. setHeaderTxt(rbgDirecType.SelectedIndex, dgvDirectoy);
  1160. }
  1161. private void toolStripMenuItem2_Click(object sender, EventArgs e)
  1162. {
  1163. CancleMapping();
  1164. }
  1165. private void tsmiMapping_Click(object sender, EventArgs e)
  1166. {
  1167. Mapping();
  1168. }
  1169. private void dgvHISDirectory_CellClick(object sender, DataGridViewCellEventArgs e)
  1170. {
  1171. tbInsuCode.Text = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["InsuCode"].Value.ToString();
  1172. }
  1173. private void dgvHISDirectory_DoubleClick(object sender, EventArgs e)
  1174. {
  1175. //int currentPage = pgHISDirect.ActivePage;
  1176. //string flag = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["flag"].Value.ToString();
  1177. //if (flag == "未对照")
  1178. //{
  1179. // Mapping();
  1180. //}
  1181. //else if (flag == "已对照")
  1182. //{
  1183. // CancleMapping();
  1184. //}
  1185. //if (rbAll.Checked)
  1186. //{
  1187. // string errMsg;
  1188. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  1189. // {
  1190. // MessageBox.Show(errMsg);
  1191. // return;
  1192. // }
  1193. //}
  1194. }
  1195. private void dgvDirectoy_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  1196. {
  1197. }
  1198. private void dgvDirectoy_CellContentClick(object sender, DataGridViewCellEventArgs e)
  1199. {
  1200. }
  1201. private void uiRadioButton1_CheckedChanged(object sender, EventArgs e)
  1202. {
  1203. }
  1204. private void dgvDirectoy_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
  1205. {
  1206. //自动编号,与数据无关
  1207. Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
  1208. e.RowBounds.Location.Y,
  1209. dgvDirectoy.RowHeadersWidth - 4,
  1210. e.RowBounds.Height);
  1211. TextRenderer.DrawText(e.Graphics,
  1212. (e.RowIndex + 1).ToString(),
  1213. dgvDirectoy.RowHeadersDefaultCellStyle.Font,
  1214. rectangle,
  1215. dgvDirectoy.RowHeadersDefaultCellStyle.ForeColor,
  1216. TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
  1217. }
  1218. private void rbAll_ValueChanged(object sender, bool value)
  1219. {
  1220. }
  1221. private void rbMaped_CheckedChanged(object sender, EventArgs e)
  1222. {
  1223. //if (rbMaped.Checked)
  1224. //{
  1225. // string errMsg;
  1226. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  1227. // {
  1228. // MessageBox.Show(errMsg);
  1229. // return;
  1230. // }
  1231. //}
  1232. }
  1233. private void btAddDir_Click(object sender, EventArgs e)
  1234. {
  1235. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex);
  1236. if (addDirectory.ShowDialog() == DialogResult.OK)
  1237. {
  1238. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1239. string error = "";
  1240. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1241. {
  1242. MessageBox.Show("新增失败:" + error);
  1243. }
  1244. else
  1245. {
  1246. MessageBox.Show("新增成功");
  1247. }
  1248. }
  1249. }
  1250. private void btEditDir_Click(object sender, EventArgs e)
  1251. {
  1252. DataTable dt = (DataTable)dgvDirectoy.DataSource;
  1253. if ((dt == null) || (dt.Rows.Count < 1))
  1254. {
  1255. MessageBox.Show("表中无数据,请检查!");
  1256. return;
  1257. }
  1258. DataRow dr = dt.Rows[dgvDirectoy.CurrentRow.Index];
  1259. AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex, dr);
  1260. if (addDirectory.ShowDialog() == DialogResult.OK)
  1261. {
  1262. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1263. string error = "";
  1264. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1265. {
  1266. MessageBox.Show("修改失败:" + error);
  1267. }
  1268. else
  1269. {
  1270. MessageBox.Show("修改成功");
  1271. }
  1272. }
  1273. }
  1274. private void btnExit_Click(object sender, EventArgs e)
  1275. {
  1276. Close();
  1277. }
  1278. /// <summary>
  1279. /// 几个医保查询的交易组织入参
  1280. /// </summary>
  1281. /// <param name="Index"></param>
  1282. /// <param name="funNo"></param>
  1283. /// <returns></returns>
  1284. private JObject GetInput(int Index, out string funNo)
  1285. {
  1286. funNo = "";
  1287. dynamic joData = new JObject();
  1288. switch (Index)
  1289. {
  1290. case 14://民族药品目
  1291. {
  1292. funNo = "1304";
  1293. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1294. joData.genname_codg = ""; //通用名编号
  1295. joData.drug_genname = ""; //药品通用名
  1296. joData.drug_prodname = tbDircetoryName.Text; //药品商品名
  1297. joData.reg_name = ""; //注册名称
  1298. joData.tcmherb_name = ""; //中草药名称
  1299. joData.mlms_name = ""; //药材名称
  1300. joData.vali_flag = ""; //有效标志
  1301. joData.rid = ""; //唯一记录号
  1302. joData.ver = ""; //版本号
  1303. joData.ver_name = ""; //版本名称
  1304. joData.opt_begn_time = ""; //经办开始时间
  1305. joData.opt_end_time = ""; //经办结束时间
  1306. joData.updt_time = TexDate.Text; //更新时间
  1307. joData.page_num = TexDQYS.Text; //当前页数
  1308. joData.page_size = TexBYSJL.Text; //本页数据量
  1309. break;
  1310. }
  1311. case 15://目录信息查询
  1312. {
  1313. funNo = "1312";
  1314. joData.query_date = ""; //查询时间点
  1315. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1316. joData.insu_admdvs = ""; //参保机构医保区划
  1317. joData.begndate = ""; //开始日期
  1318. joData.hilist_name = tbDircetoryName.Text; //医保目录名称
  1319. joData.wubi = ""; //五笔助记码
  1320. joData.pinyin = ""; //拼音助记码
  1321. joData.med_chrgitm_type = ""; //医疗收费项目类别
  1322. joData.chrgitm_lv = ""; //收费项目等级
  1323. joData.lmt_used_flag = ""; //限制使用标志
  1324. joData.list_type = ""; //目录类别
  1325. joData.med_use_flag = ""; //医疗使用标志
  1326. joData.matn_used_flag = ""; //生育使用标志
  1327. joData.hilist_use_type = ""; //医保目录使用类别
  1328. joData.lmt_cpnd_type = ""; //限复方使用类型
  1329. joData.vali_flag = ""; //有效标志
  1330. joData.updt_time = TexDate.Text; //更新时间
  1331. joData.page_num = TexDQYS.Text; //当前页数
  1332. joData.page_size = TexBYSJL.Text; //本页数据量
  1333. break;
  1334. }
  1335. case 16://医疗与医保目录匹配
  1336. {
  1337. funNo = "1316";
  1338. joData.query_date = ""; //查询时间点
  1339. joData.medins_list_codg = ""; //定点医药机构目录编号
  1340. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1341. joData.list_type = ""; //目录类别
  1342. joData.insu_admdvs = ""; //参保机构医保区划
  1343. joData.begndate = ""; //开始日期
  1344. joData.vali_flag = ""; //有效标志
  1345. joData.updt_time = TexDate.Text; //更新时间
  1346. joData.page_num = TexDQYS.Text; //当前页数
  1347. joData.page_size = TexBYSJL.Text; //本页数据量
  1348. break;
  1349. }
  1350. case 17://医药机构目录匹配
  1351. {
  1352. funNo = "1317";
  1353. joData.query_date = ""; //查询时间点
  1354. joData.fixmedins_code = ""; //定点医药机构编号
  1355. joData.medins_list_codg = ""; //定点医药机构目录编号
  1356. joData.medins_list_name = ""; //定点医药机构目录名称
  1357. joData.insu_admdvs = ""; //参保机构医保区划
  1358. joData.list_type = ""; //目录类别
  1359. joData.med_list_codg = tbDirectoryCode.Text; //医疗目录编码
  1360. joData.begndate = ""; //开始日期
  1361. joData.vali_flag = ""; //有效标志
  1362. joData.updt_time = TexDate.Text; //更新时间
  1363. joData.page_num = TexDQYS.Text; //当前页数
  1364. joData.page_size = TexBYSJL.Text; //本页数据量
  1365. break;
  1366. }
  1367. case 18://医保目录限价
  1368. {
  1369. funNo = "1318";
  1370. joData.query_date = ""; //查询时间点
  1371. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1372. joData.hilist_lmtpric_type = ""; //医保目录限价类型
  1373. joData.overlmt_dspo_way = ""; //医保目录超限处理方式
  1374. joData.insu_admdvs = ""; //参保机构医保区划
  1375. joData.begndate = ""; //开始日期
  1376. joData.enddate = ""; //结束日期
  1377. joData.vali_flag = ""; //有效标志
  1378. joData.rid = ""; //唯一记录号
  1379. joData.tabname = ""; //表名
  1380. joData.poolarea_no = ""; //统筹区
  1381. joData.updt_time = TexDate.Text; //更新时间
  1382. joData.page_num = TexDQYS.Text; //当前页数
  1383. joData.page_size = TexBYSJL.Text; //本页数据量
  1384. break;
  1385. }
  1386. case 19://医保目录先自付比例
  1387. {
  1388. funNo = "1319";
  1389. joData.query_date = ""; //查询时间点
  1390. joData.hilist_code = tbDirectoryCode.Text; //医保目录编码
  1391. joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
  1392. joData.selfpay_prop_type = ""; //目录自付比例类别
  1393. joData.insu_admdvs = ""; //参保机构医保区划
  1394. joData.begndate = ""; //开始日期
  1395. joData.enddate = ""; //结束日期
  1396. joData.vali_flag = ""; //有效标志
  1397. joData.rid = ""; //唯一记录号
  1398. joData.tabname = ""; //表名
  1399. joData.poolarea_no = ""; //统筹区
  1400. joData.updt_time = TexDate.Text; //更新时间
  1401. joData.page_num = TexDQYS.Text; //当前页数
  1402. joData.page_size = TexBYSJL.Text; //本页数据量
  1403. break;
  1404. }
  1405. case 20://医药机构信息
  1406. {
  1407. funNo = "1201";
  1408. joData.fixmedins_type = "1"; //定点医疗服务机构类型 1定点医疗机构,2定点零售药店,3工伤定点康复机构,4辅助器具配置机构,5计划生育服务机构
  1409. joData.fixmedins_name = TexYYMC.Text; //定点医药机构名称
  1410. joData.fixmedins_code = ""; //定点医药机构编号
  1411. break;
  1412. }
  1413. }
  1414. return joData;
  1415. }
  1416. private void chek_UporCancel_CheckedChanged(object sender, EventArgs e)
  1417. {
  1418. }
  1419. private void uiButton1_Click(object sender, EventArgs e)
  1420. {
  1421. Close();
  1422. }
  1423. /// <summary>
  1424. /// 单条上传目录对照关系
  1425. /// </summary>
  1426. private void SingleUpload()
  1427. {
  1428. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1429. {
  1430. MessageBox.Show("请查询HIS目录对照关系");
  1431. return;
  1432. }
  1433. string errorMsg = "", sMLLX = "";
  1434. //单条目录对照关系上传
  1435. int iHis = dgvHISDirectory.CurrentRow.Index;
  1436. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1437. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1438. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1439. if (hisType == 1)
  1440. {
  1441. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1442. }
  1443. else if (hisType == 2)
  1444. {
  1445. sMLLX = "201";
  1446. }
  1447. else if (hisType == 3)
  1448. {
  1449. sMLLX = "301";
  1450. }
  1451. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1452. string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
  1453. string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
  1454. string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
  1455. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1456. //调用3301目录对照上传
  1457. JObject joData = new JObject();
  1458. joData.Add("fixmedins_hilist_id", HisCode);
  1459. joData.Add("fixmedins_hilist_name", HisName);
  1460. joData.Add("list_type", sMLLX); //目录类别
  1461. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1462. joData.Add("begndate", "2022-10-01"); //开始日期
  1463. joData.Add("enddate", UpdateDate); //结束日期
  1464. joData.Add("aprvno", "");
  1465. joData.Add("dosform", "");
  1466. joData.Add("exct_cont", "");
  1467. joData.Add("item_cont", "");
  1468. joData.Add("prcunt", "");
  1469. joData.Add("spec", "");
  1470. joData.Add("pacspec", "");
  1471. joData.Add("memo", "");
  1472. JObject joInput = new JObject();
  1473. joInput.Add("data", joData);
  1474. InvokeHelper invoker = new InvokeHelper();
  1475. JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
  1476. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1477. {
  1478. MessageBox.Show("目录对照关系上传失败:" + errorMsg);
  1479. }
  1480. else
  1481. {
  1482. MessageBox.Show("目录对照关系上传成功!");
  1483. }
  1484. }
  1485. /// <summary>
  1486. /// 单条撤销目录对照关系上传
  1487. /// </summary>
  1488. private void SingleCancelUpload()
  1489. {
  1490. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1491. {
  1492. MessageBox.Show("请查询HIS目录对照关系");
  1493. return;
  1494. }
  1495. string errorMsg = "", sMLLX = "";
  1496. //撤销目录对照关系
  1497. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1498. int iHis = dgvHISDirectory.CurrentRow.Index;
  1499. string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
  1500. string HisCode = dtHis.Rows[iHis]["HisCode"].ToString();
  1501. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1502. //string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
  1503. if (hisType == 1)
  1504. {
  1505. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1506. }
  1507. else if (hisType == 2)
  1508. {
  1509. sMLLX = "201";
  1510. }
  1511. else if (hisType == 3)
  1512. {
  1513. sMLLX = "301";
  1514. }
  1515. //调用3302目录对照撤销
  1516. JObject joData = new JObject();
  1517. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1518. joData.Add("fixmedins_hilist_id", HisCode);
  1519. joData.Add("list_type", sMLLX); //目录类别
  1520. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1521. JObject joInput = new JObject();
  1522. joInput.Add("data", joData);
  1523. InvokeHelper invoker = new InvokeHelper();
  1524. JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
  1525. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1526. {
  1527. MessageBox.Show("目录对照撤销失败:" + errorMsg);
  1528. }
  1529. else
  1530. {
  1531. MessageBox.Show("目录对照撤销成功!");
  1532. }
  1533. }
  1534. /// <summary>
  1535. /// 全部上传目录对照关系
  1536. /// </summary>
  1537. private void AllUpLoad()
  1538. {
  1539. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1540. {
  1541. MessageBox.Show("请查询HIS目录对照关系");
  1542. return;
  1543. }
  1544. string sMLLX = "", errorMsg = "", Msg = "";
  1545. Boolean bOk = true;
  1546. JObject InputjoRtn = new JObject();
  1547. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1548. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1549. if (hisType == 1)
  1550. {
  1551. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1552. }
  1553. else if (hisType == 2)
  1554. {
  1555. sMLLX = "201";
  1556. }
  1557. else if (hisType == 3)
  1558. {
  1559. sMLLX = "301";
  1560. }
  1561. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1562. for (int i = 0; i < dtHis.Rows.Count; i++)
  1563. {
  1564. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString(); //医保目录编码
  1565. string InsuName = dtHis.Rows[i]["InsuName"].ToString(); //医保目录名称
  1566. string HisCode = dtHis.Rows[i]["itemCode"].ToString(); //HIS目录编码
  1567. string HisName = dtHis.Rows[i]["itemDesc"].ToString(); //HIS目录名称
  1568. //调用3301目录对照上传
  1569. JObject joData = new JObject();
  1570. joData.Add("fixmedins_hilist_id", HisCode);
  1571. joData.Add("fixmedins_hilist_name", HisName);
  1572. joData.Add("list_type", sMLLX); //目录类别
  1573. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1574. joData.Add("begndate", "2022-10-01"); //开始日期
  1575. joData.Add("enddate", UpdateDate); //结束日期
  1576. joData.Add("aprvno", "");
  1577. joData.Add("dosform", "");
  1578. joData.Add("exct_cont", "");
  1579. joData.Add("item_cont", "");
  1580. joData.Add("prcunt", "");
  1581. joData.Add("spec", "");
  1582. joData.Add("pacspec", "");
  1583. joData.Add("memo", "");
  1584. JObject joInput = new JObject();
  1585. joInput.Add("data", joData);
  1586. InvokeHelper invoker = new InvokeHelper();
  1587. JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
  1588. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1589. {
  1590. bOk = false;
  1591. Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
  1592. }
  1593. }
  1594. if (bOk == false)
  1595. {
  1596. MessageBox.Show("全部目录对照关系上传成功,部分上传异常:" + Msg);
  1597. }
  1598. else
  1599. {
  1600. MessageBox.Show("全部目录对照关系上传成功!");
  1601. }
  1602. }
  1603. /// <summary>
  1604. /// 全部撤销目录对照关系上传
  1605. /// </summary>
  1606. private void AllCancelUpload()
  1607. {
  1608. if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
  1609. {
  1610. MessageBox.Show("请查询HIS目录对照关系");
  1611. return;
  1612. }
  1613. string sMLLX = "", errorMsg = "", Msg = "";
  1614. Boolean bOk = true;
  1615. string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
  1616. int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
  1617. if (hisType == 1)
  1618. {
  1619. sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
  1620. }
  1621. else if (hisType == 2)
  1622. {
  1623. sMLLX = "201";
  1624. }
  1625. else if (hisType == 3)
  1626. {
  1627. sMLLX = "301";
  1628. }
  1629. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  1630. for (int i = 0; i < dtHis.Rows.Count; i++)
  1631. {
  1632. string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();
  1633. string HisCode = dtHis.Rows[i]["HisCode"].ToString();
  1634. //调用3302目录对照撤销
  1635. JObject joData = new JObject();
  1636. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  1637. joData.Add("fixmedins_hilist_id", HisCode);
  1638. joData.Add("list_type", sMLLX); //目录类别
  1639. joData.Add("med_list_codg", InsuCode); //医疗目录编码
  1640. JObject joInput = new JObject();
  1641. joInput.Add("data", joData);
  1642. InvokeHelper invoker = new InvokeHelper();
  1643. JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
  1644. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  1645. {
  1646. bOk = false;
  1647. Msg = Msg + "<" + joInput.ToString()+":" + errorMsg + ">";
  1648. }
  1649. }
  1650. if (bOk == false)
  1651. {
  1652. MessageBox.Show("全部撤销目录对照关系上传成功,部分撤销异常:" + Msg);
  1653. }
  1654. else
  1655. {
  1656. MessageBox.Show("全部撤销目录对照关系上传成功!");
  1657. }
  1658. }
  1659. private void ToolStripMenuItem_Upload_Click(object sender, EventArgs e)
  1660. {
  1661. SingleUpload();
  1662. }
  1663. private void ToolStripMenuItem_CancelUpload_Click(object sender, EventArgs e)
  1664. {
  1665. SingleCancelUpload();
  1666. }
  1667. private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
  1668. {
  1669. tbHISDirectoryFilter.Text = "";
  1670. uiTextBox1.Text = "";
  1671. rbMaped.Checked = false;
  1672. rbNoMaped.Checked = false;
  1673. rbAll.Checked = true;
  1674. tbCenterDirectoryFilter.Text = "";
  1675. tbInsuCode.Text = "";
  1676. tbApprovalNO.Text = "";
  1677. switch (rbgDirecType_C.SelectedIndex)
  1678. {
  1679. case 0:
  1680. {
  1681. btnExport.Text = "导出药品yp.in文件";
  1682. btnImport.Text = "导入药品yp.out文件";
  1683. break;
  1684. }
  1685. case 1:
  1686. {
  1687. btnExport.Text = "导出诊疗sfxm.in文件";
  1688. btnImport.Text = "导入诊疗sfxm.out文件";
  1689. break;
  1690. }
  1691. case 2:
  1692. {
  1693. btnExport.Text = "导出材料hc.in文件";
  1694. btnImport.Text = "导入材料hc.out文件";
  1695. break;
  1696. }
  1697. }
  1698. if (queryHISDirectory(1, 50, out string errMsg) != 0)
  1699. {
  1700. MessageBox.Show(errMsg);
  1701. return;
  1702. }
  1703. //btnQueryHISDirectory_Click(null, new EventArgs());
  1704. }
  1705. private void btnExport_Click(object sender, EventArgs e)
  1706. {
  1707. //if (rbMaped.Checked)
  1708. //{
  1709. // MessageBox.Show("请先切换‘全部’查询HIS目录!");
  1710. // return;
  1711. //}
  1712. //当前数据表行数
  1713. //MessageBox.Show(iRecordCount.ToString());
  1714. rbNoMaped.Checked = true;
  1715. if (queryHISDirectory(1, 10000, out string errMsg) != 0)
  1716. {
  1717. MessageBox.Show(errMsg);
  1718. return;
  1719. }
  1720. ExportToFile();
  1721. }
  1722. private void ExportToFile()
  1723. {
  1724. //if (queryHISDirectory(1, 10000, out string errMsg) != 0)
  1725. //{
  1726. // MessageBox.Show(errMsg);
  1727. // return;
  1728. //}
  1729. //if (queryHISDirectoryOfExport(out string errorMessage) != 0)
  1730. //{
  1731. // MessageBox.Show("查询医保目录信息出现错误,请查看日志!" + errorMessage);
  1732. // return;
  1733. //}
  1734. if (dtExport.Rows.Count > 0)
  1735. {
  1736. string Maped = "";
  1737. if (rbAll.Checked) Maped = "全部";
  1738. if (rbMaped.Checked) Maped = "已对照";
  1739. if (rbNoMaped.Checked) Maped = "未对照";
  1740. string directoryType = string.Empty;
  1741. string directoryName = string.Empty;
  1742. switch (rbgDirecType_C.SelectedIndex)
  1743. {
  1744. case 0:
  1745. {
  1746. directoryType = "yp";
  1747. directoryName = "药品";
  1748. break;
  1749. }
  1750. case 1:
  1751. {
  1752. directoryType = "sfxm";
  1753. directoryName = "诊疗";
  1754. break;
  1755. }
  1756. case 2:
  1757. {
  1758. directoryType = "hc";
  1759. directoryName = "耗材";
  1760. break;
  1761. }
  1762. }
  1763. string Msg = "【" + directoryName + "】医保目录【" + Maped + "】信息";
  1764. if (WriteInParam(dtExport, directoryType) != 0)
  1765. {
  1766. MessageBox.Show("导出失败!");
  1767. return;
  1768. }
  1769. MessageBox.Show(Msg + "导出成功");
  1770. }
  1771. else
  1772. {
  1773. MessageBox.Show("请先查询HIS目录信息!");
  1774. return;
  1775. }
  1776. }
  1777. /// <summary>
  1778. /// 循环DataTable写入in文件
  1779. /// </summary>
  1780. /// <param name="Dt"></param>
  1781. /// <param name="Type">yp;sfxm;hc</param>
  1782. private int WriteInParam(DataTable Dt, string Type)
  1783. {
  1784. if (Dt.Rows.Count == 0)
  1785. return -1;
  1786. ProcessBar.Maximum = Dt.Rows.Count;
  1787. try
  1788. {
  1789. //已存在的文件先删除
  1790. //string logDir = Global.curEvt.path + "\\MLDR";
  1791. string logDir = @"D:\MLDR";
  1792. string logName = Type.Trim() + ".in";
  1793. Log log = new Log(logDir, logName.Trim());
  1794. log.DeleteFile(logDir + "\\" + logName);
  1795. for (int i = 0; i < Dt.Rows.Count; i++)
  1796. {
  1797. ProcessBar.Value = i + 1;
  1798. Application.DoEvents();
  1799. String sText = string.Empty;
  1800. string HISCode = string.Empty, HISName = string.Empty, InsuCode = string.Empty;
  1801. string spec = string.Empty, Unit = string.Empty, Price = string.Empty, standardCode = string.Empty;
  1802. HISCode = Dt.Rows[i]["itemCode"].ToString(); //HIS药品编码
  1803. HISName = Dt.Rows[i]["itemDesc"].ToString(); //HIS药品名称
  1804. if (chk_Import.Checked)
  1805. {
  1806. InsuCode = Dt.Rows[i]["insuCode"].ToString(); //对照的药品编码
  1807. //InsuName = Dt.Rows[i]["insuName"].ToString(); //对照的药品名称
  1808. }
  1809. spec = Dt.Rows[i]["spec"].ToString(); //规格
  1810. Unit = Dt.Rows[i]["itemUnitDesc"].ToString(); //计量单位
  1811. Price = Dt.Rows[i]["itemPrice"].ToString(); //单价
  1812. if (Price == "")
  1813. Price = "0.00";
  1814. standardCode= Dt.Rows[i]["standardCode"].ToString(); //贯标码
  1815. if (Type == "yp")
  1816. {
  1817. //药品导入文件格式:HIS药品编码|HIS药品名称|对照的药品编码|规格|计量单位|单价|
  1818. sText = comp.SetParamsAHS(HISCode, 1) +
  1819. comp.SetParamsAHS(HISName, 1) +
  1820. comp.SetParamsAHS(InsuCode, 1) +
  1821. comp.SetParamsAHS(spec, 1) +
  1822. comp.SetParamsAHS(Unit, 1) +
  1823. decimal.Parse(Price).ToString("0.00");
  1824. }
  1825. else if (Type == "sfxm")
  1826. {
  1827. //收费项目导入文件格式:HIS药品编码|HIS药品名称|对照的项目编码|计量单位|单价|
  1828. sText = comp.SetParamsAHS(HISCode, 1) +
  1829. comp.SetParamsAHS(HISName, 1) +
  1830. comp.SetParamsAHS(InsuCode, 1) +
  1831. comp.SetParamsAHS(Unit, 1) +
  1832. decimal.Parse(Price).ToString("0.00");
  1833. }
  1834. else if (Type == "hc")
  1835. {
  1836. //耗材导入文件格式:HIS药品编码|HIS药品名称|对照的国家医保编码|计量单位|单价|规格|
  1837. sText = comp.SetParamsAHS(HISCode, 1) +
  1838. comp.SetParamsAHS(HISName, 1) +
  1839. comp.SetParamsAHS(standardCode, 1) + //贯标编码
  1840. comp.SetParamsAHS(Unit, 1) +
  1841. comp.SetParamsAHS(decimal.Parse(Price).ToString("0.00"), 1) +
  1842. spec;
  1843. }
  1844. //写入文件内容
  1845. Global.writeInFileOfExport(Type, sText);
  1846. }
  1847. }
  1848. catch (Exception ex)
  1849. {
  1850. MessageBox.Show("循环DataTable写入in文件发生异常:" + ex.Message);
  1851. return -1;
  1852. }
  1853. return 0;
  1854. }
  1855. private void btnImport_Click(object sender, EventArgs e)
  1856. {
  1857. string errorMessage;
  1858. string filePath = string.Empty;
  1859. string hisTypeName = rbgDirecType_C.Items[rbgDirecType_C.SelectedIndex].ToString();
  1860. if (rbMaped.Checked)
  1861. {
  1862. MessageBox.Show("请先切换‘全部’查询HIS目录!");
  1863. return;
  1864. }
  1865. switch (rbgDirecType_C.SelectedIndex)
  1866. {
  1867. case 0:
  1868. {
  1869. filePath = Global.curEvt.path + @"\MLDR\yp.out";
  1870. filePath = @"D:\MLDR\yp.out";
  1871. break;
  1872. }
  1873. case 1:
  1874. {
  1875. filePath = Global.curEvt.path + @"\MLDR\sfxm.out";
  1876. filePath = @"D:\MLDR\sfxm.out";
  1877. break;
  1878. }
  1879. case 2:
  1880. {
  1881. filePath = Global.curEvt.path + @"\MLDR\hc.out";
  1882. filePath = @"D:\MLDR\hc.out";
  1883. break;
  1884. }
  1885. }
  1886. if (File.Exists(filePath) != true)
  1887. {
  1888. MessageBox.Show("路径【" + filePath + "】文件不存在!");
  1889. return;
  1890. }
  1891. #region【1.取out文件内容插入医保目录表】
  1892. JObject joImportRtn = bus.ImportToDirectory(filePath, rbgDirecType_C.SelectedIndex, 50, ProcessBar);
  1893. //MessageBox.Show("往IRIS插入数据:" + joImportRtn.ToString());
  1894. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) != 0)
  1895. {
  1896. Global.writeLog(joImportRtn.ToString());
  1897. MessageBox.Show("插入医保目录表ImportToDirectory出现错误,请查看日志!" + errorMessage);
  1898. return;
  1899. }
  1900. //2.插入目录表成功后一定要执行查询HIS目录信息
  1901. if (queryHISDirectory(1, 3000, out errorMessage) != 0)
  1902. {
  1903. MessageBox.Show("查询插入的医保目录信息出现错误,请查看日志!" + errorMessage);
  1904. return;
  1905. }
  1906. #endregion
  1907. #region【3.取out文件内容插入医保对照表】
  1908. DataTable dtHis = dtImport; //(DataTable)dgvHISDirectory.DataSource;
  1909. if (dtHis.Rows.Count <= 0)
  1910. return;
  1911. JObject joImportMapRalation = bus.ImportToMapRelationFromTxt(filePath, rbgDirecType_C.SelectedIndex, dtHis, ProcessBar);
  1912. if (JsonHelper.parseIrisRtnValue(joImportMapRalation, out errorMessage) != 0)
  1913. {
  1914. Global.writeLog(joImportMapRalation.ToString());
  1915. MessageBox.Show("插入医保对照表ImportToMapRelation出现错误,请查看日志!" + errorMessage);
  1916. }
  1917. //4.插入目录表成功后一定要执行查询HIS目录信息
  1918. btnQueryHISDirectory_Click(sender, e);
  1919. #endregion
  1920. MessageBox.Show("导入【" + hisTypeName + "】" + filePath + "文件成功!");
  1921. }
  1922. private void btnImportDC_Click(object sender, EventArgs e)
  1923. {
  1924. string errorMessage;
  1925. string filePath = string.Empty;
  1926. filePath = Global.curEvt.path + @"\MLDR\zddc.out";
  1927. filePath = @"D:\MLDR\zddc.out";
  1928. if (File.Exists(filePath) != true)
  1929. {
  1930. MessageBox.Show("路径【" + filePath + "】,文件不存在!");
  1931. return;
  1932. }
  1933. JObject joImportRtn = bus.ImportToDictionaryDataDetail(filePath, ProcessBar);
  1934. //MessageBox.Show("往IRIS插入数据:" + joImportRtn.ToString());
  1935. if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) != 0)
  1936. {
  1937. Global.writeLog(joImportRtn.ToString());
  1938. MessageBox.Show("插入医保字典明细表ImportToDictionaryDataDetail出现错误,请查看日志!" + errorMessage);
  1939. return;
  1940. }
  1941. else
  1942. {
  1943. MessageBox.Show("导入医保字典out文件成功!");
  1944. }
  1945. }
  1946. private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
  1947. {
  1948. if (tabControl1.SelectedIndex == 0)
  1949. {
  1950. MessageBox.Show("北京首信医保不提供医保目录和医保字典下载功能,该菜单作废!");
  1951. tabControl1.SelectedIndex = 1;
  1952. return;
  1953. }
  1954. }
  1955. private void btnUpdate_Click(object sender, EventArgs e)
  1956. {
  1957. if (tbInsuCode.Text == "")
  1958. {
  1959. MessageBox.Show("请先输入准确医保编码,再执行更新医保目录信息!");
  1960. return;
  1961. }
  1962. btnQueryCenterDirectory_Click(sender, e);
  1963. DataTable dt = (DataTable)dgvCenterDirectory.DataSource;
  1964. if ((dt == null) || (dt.Rows.Count < 1))
  1965. {
  1966. MessageBox.Show("未检索到医保目录数据,请检查!");
  1967. return;
  1968. }
  1969. DataRow dr = dt.Rows[dgvCenterDirectory.CurrentRow.Index];
  1970. AddMedInsuDirectory addDirectory = new AddMedInsuDirectory(rbgDirecType_C.SelectedIndex, dr);
  1971. if (addDirectory.ShowDialog() == DialogResult.OK)
  1972. {
  1973. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1974. string error = "";
  1975. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1976. {
  1977. MessageBox.Show("修改失败:" + error);
  1978. }
  1979. else
  1980. {
  1981. MessageBox.Show("修改成功");
  1982. }
  1983. }
  1984. }
  1985. private void btnAdd_Click(object sender, EventArgs e)
  1986. {
  1987. AddMedInsuDirectory addDirectory = new AddMedInsuDirectory(rbgDirecType_C.SelectedIndex);
  1988. if (addDirectory.ShowDialog() == DialogResult.OK)
  1989. {
  1990. JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
  1991. string error = "";
  1992. if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
  1993. {
  1994. MessageBox.Show("新增失败:" + error);
  1995. }
  1996. else
  1997. {
  1998. MessageBox.Show("新增成功");
  1999. }
  2000. }
  2001. }
  2002. public int queryHISDr(out string outparam)
  2003. {
  2004. outparam = "";
  2005. string OutMsg = "";
  2006. if (hIS.GetHISDir(out OutMsg) != 0)
  2007. {
  2008. outparam = OutMsg;
  2009. return -1;
  2010. }
  2011. outparam = OutMsg;
  2012. return 0;
  2013. }
  2014. public int queryMedInsuDr(string type, string searchstr, out string outparam)
  2015. {
  2016. outparam = "";
  2017. string OutMsg = "";
  2018. if (hIS.GetMedInsuDir(type, searchstr, out OutMsg) != 0)
  2019. {
  2020. outparam = OutMsg;
  2021. return -1;
  2022. }
  2023. outparam = OutMsg;
  2024. return 0;
  2025. }
  2026. public int queryRelationShipDr(int type, string searchstr, out string outparam)
  2027. {
  2028. outparam = "";
  2029. string OutMsg = "";
  2030. if (hIS.GetRelationShipDir(type, searchstr, "", out OutMsg) != 0)
  2031. {
  2032. outparam = OutMsg;
  2033. return -1;
  2034. }
  2035. outparam = OutMsg;
  2036. return 0;
  2037. }
  2038. /// <summary>
  2039. /// 插入未对照字典数据
  2040. /// </summary>
  2041. /// <param name="type">HIS字典类型:tarSubData收费类型,dosageFormData剂型,frequenceData用法</param>
  2042. /// <param name="HisType">HIS医保对照类型:63收费类型 70剂型 229用法</param>
  2043. /// <param name="ProcessBar">进度条</param>
  2044. /// <param name="outparam"></param>
  2045. /// <returns></returns>
  2046. public int InsertRelationShip(string type, int HisType, Sunny.UI.UIProcessBar ProcessBar, out string outparam)
  2047. {
  2048. outparam = "";
  2049. if (queryHISDr(out outparam) != 0)
  2050. {
  2051. outparam = "查询HIS字典数据失败" + outparam;
  2052. return -1;
  2053. }
  2054. JObject joRtn = new JObject(JObject.Parse(outparam));
  2055. DataTable dt = (DataTable)joRtn["result"][type].ToObject(typeof(DataTable));
  2056. JObject joImportMapRalation = bus.ImportToMapRelationFromDT(HisType, dt, dgv_RelationShipDr, ProcessBar);
  2057. if (JsonHelper.parseIrisRtnValue(joImportMapRalation, out outparam) != 0)
  2058. {
  2059. outparam = "插入医保对照表ImportToMapRelationFromDT出现错误,请查看日志!" + outparam;
  2060. return -1;
  2061. }
  2062. return 0;
  2063. }
  2064. private void MappingDr(int type)
  2065. {
  2066. if ((dgv_RelationShipDr.CurrentRow == null) || (dgv_InsuDr.CurrentRow == null))
  2067. {
  2068. MessageBox.Show("请先查询HIS对照信息和医保字典信息");
  2069. return;
  2070. }
  2071. int iHis = dgv_RelationShipDr.CurrentRow.Index;
  2072. int iCenter = dgv_InsuDr.CurrentRow.Index;
  2073. DataTable dtHis = (DataTable)dgv_RelationShipDr.DataSource;
  2074. DataTable dtCenter = (DataTable)dgv_InsuDr.DataSource;
  2075. //dgv_RelationShipDr.Rows[iHis].Cells["InsuCode"].Value = dgv_InsuDr.Rows[iCenter].Cells["Code"].Value.ToString();
  2076. //dgv_RelationShipDr.Rows[iHis].Cells["InsuName"].Value = dgv_InsuDr.Rows[iCenter].Cells["Name"].Value.ToString();
  2077. JArray jaParams = new JArray();
  2078. dynamic jsonTemp = new JObject();
  2079. jsonTemp.ID = dtHis.Rows[iHis]["ID"];
  2080. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  2081. jsonTemp.updateUserID = Global.user.ID;
  2082. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  2083. jsonTemp.HISCode = dtHis.Rows[iHis]["HISCode"];
  2084. jsonTemp.HISName = dtHis.Rows[iHis]["HISName"];
  2085. //jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
  2086. //jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
  2087. jsonTemp.State = 1; //1.已对照 2.已对照但未上传 3 已对照且已上传
  2088. jsonTemp.HisType = type;
  2089. jsonTemp.InsuCode = dtCenter.Rows[iCenter]["Code"];
  2090. jsonTemp.InsuName = dtCenter.Rows[iCenter]["Name"];
  2091. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2092. jaParams.Add(jsonTemp);
  2093. JObject joIn = new JObject();
  2094. joIn.Add(new JProperty("params", jaParams));
  2095. joIn.Add("code", "09010040");
  2096. InvokeHelper invoker = new InvokeHelper();
  2097. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入医保字典对照信息");
  2098. if ((int)joRtn["errorCode"] == 0)
  2099. {
  2100. dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "已对照";
  2101. dgv_RelationShipDr.Rows[iHis].Cells["State"].Value = "1";
  2102. dgv_RelationShipDr.Rows[iHis].Cells["InsuCode"].Value = dgv_InsuDr.Rows[iCenter].Cells["Code"].Value.ToString();
  2103. dgv_RelationShipDr.Rows[iHis].Cells["InsuName"].Value = dgv_InsuDr.Rows[iCenter].Cells["Name"].Value.ToString();
  2104. }
  2105. else
  2106. {
  2107. dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "对照失败";
  2108. }
  2109. }
  2110. private void CancleMapDr(int type)
  2111. {
  2112. if (dgv_RelationShipDr.CurrentRow == null)
  2113. {
  2114. MessageBox.Show("请先查询HIS医保字典对照信息");
  2115. return;
  2116. }
  2117. int iHis = dgv_RelationShipDr.CurrentRow.Index;
  2118. DataTable dtHis = (DataTable)dgv_RelationShipDr.DataSource;
  2119. JArray jaParams = new JArray();
  2120. dynamic jsonTemp = new JObject();
  2121. jsonTemp.ID = dtHis.Rows[iHis]["ID"];
  2122. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  2123. jsonTemp.updateUserID = Global.user.ID;
  2124. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  2125. jsonTemp.State = 0;
  2126. jsonTemp.HisType = type;
  2127. jsonTemp.HISCode = dtHis.Rows[iHis]["HISCode"];
  2128. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  2129. jaParams.Add(jsonTemp);
  2130. JObject joIn = new JObject();
  2131. joIn.Add(new JProperty("params", jaParams));
  2132. joIn.Add("code", "09010041");
  2133. InvokeHelper invoker = new InvokeHelper();
  2134. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消医保字典对照");
  2135. if ((int)joRtn["errorCode"] == 0)
  2136. {
  2137. dgv_RelationShipDr.Rows[iHis].Cells["InsuCode"].Value = "";
  2138. dgv_RelationShipDr.Rows[iHis].Cells["InsuName"].Value = "";
  2139. dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "未对照";
  2140. dgv_RelationShipDr.Rows[iHis].Cells["State"].Value = "0";
  2141. }
  2142. else
  2143. {
  2144. dgv_RelationShipDr.Rows[iHis].Cells["Flag"].Value = "取消失败";
  2145. }
  2146. }
  2147. private void rbg_MedDrType_ValueChanged(object sender, int index, string text)
  2148. {
  2149. if (index == 0)
  2150. {
  2151. Type = "tarSubData";
  2152. MedInsuType = "AKA063";
  2153. HisType = 63;
  2154. }
  2155. else if (index == 1)
  2156. {
  2157. Type = "dosageFormData";
  2158. MedInsuType = "AKA070";
  2159. HisType = 70;
  2160. }
  2161. else if (index == 2)
  2162. {
  2163. Type = "frequenceData";
  2164. MedInsuType = "BKC229";
  2165. HisType = 229;
  2166. }
  2167. btnRelationShipDr_Click(sender, null);
  2168. }
  2169. private void btn_InsertDr_Click(object sender, EventArgs e)
  2170. {
  2171. if (InsertRelationShip(Type, HisType, ProcessBarDr, out string outParam) != 0)
  2172. {
  2173. MessageBox.Show("插入医保字典对照数据失败" + outParam);
  2174. return;
  2175. }
  2176. btnRelationShipDr_Click(sender, e);
  2177. //MessageBox.Show("插入完成!");
  2178. }
  2179. private void btnRelationShipDr_Click(object sender, EventArgs e)
  2180. {
  2181. if (queryRelationShipDr(HisType, tbYYMC.Text, out string outParam) != 0)
  2182. {
  2183. dgv_RelationShipDr.DataSource = "";
  2184. MessageBox.Show("查询医保字典对照关系" + outParam);
  2185. return;
  2186. }
  2187. JObject joRtn = new JObject(JObject.Parse(outParam));
  2188. dgv_RelationShipDr.DataSource = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
  2189. }
  2190. private void btnMap_Click(object sender, EventArgs e)
  2191. {
  2192. if (dgv_RelationShipDr.CurrentRow == null)
  2193. {
  2194. //MessageBox.Show("请先查询患者结算信息");
  2195. return;
  2196. }
  2197. //string flag = dgv_RelationShipDr.Rows[dgv_RelationShipDr.CurrentRow.Index].Cells["Flag"].Value.ToString();
  2198. //if (flag == "未对照")
  2199. //{
  2200. // MappingDr(HisType);
  2201. //}
  2202. MappingDr(HisType);
  2203. }
  2204. private void btnCancelMap_Click(object sender, EventArgs e)
  2205. {
  2206. if (dgv_RelationShipDr.CurrentRow == null)
  2207. {
  2208. //MessageBox.Show("请先查询患者结算信息");
  2209. return;
  2210. }
  2211. string flag = dgv_RelationShipDr.Rows[dgv_RelationShipDr.CurrentRow.Index].Cells["Flag"].Value.ToString();
  2212. if (flag == "已对照")
  2213. {
  2214. CancleMapDr(HisType);
  2215. }
  2216. }
  2217. private void dgv_RelationShipDr_DoubleClick(object sender, EventArgs e)
  2218. {
  2219. string flag = dgv_RelationShipDr.Rows[dgv_RelationShipDr.CurrentRow.Index].Cells["Flag"].Value.ToString();
  2220. if (flag == "未对照")
  2221. {
  2222. MappingDr(HisType);
  2223. }
  2224. }
  2225. private void rbAll_CheckedChanged(object sender, EventArgs e)
  2226. {
  2227. //if (rbAll.Checked)
  2228. //{
  2229. // btnQueryHISDirectory_Click(null, new EventArgs());
  2230. //}
  2231. }
  2232. private void rbNoMaped_CheckedChanged(object sender, EventArgs e)
  2233. {
  2234. //if (rbNoMaped.Checked)
  2235. //{
  2236. // string errMsg;
  2237. // if (queryHISDirectory(1, 50, out errMsg) != 0)
  2238. // {
  2239. // MessageBox.Show(errMsg);
  2240. // return;
  2241. // }
  2242. //}
  2243. }
  2244. private void btn_UpdateNationInfo_Click(object sender, EventArgs e)
  2245. {
  2246. string OutMsg = string.Empty;
  2247. int iHis = dgvHISDirectory.CurrentRow.Index;
  2248. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  2249. string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
  2250. string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
  2251. string StandardCode = dtHis.Rows[iHis]["standardCode"].ToString();
  2252. ContrastBrief InsuCB = new ContrastBrief(HisCode, StandardCode, HisName);
  2253. if (InsuCB.ShowDialog() == DialogResult.OK)
  2254. {
  2255. JObject jo = new JObject();
  2256. jo.Add("HISCode", InsuCB.HisCode);
  2257. jo.Add("standardCode", InsuCB.StandardCode);
  2258. int iRtn = hIS.updateContrastBrief(jo, out OutMsg);
  2259. if (iRtn != 0)
  2260. {
  2261. MessageBox.Show("失败:" + OutMsg);
  2262. return;
  2263. }
  2264. this.btnQueryHISDirectory_Click(btnQueryHISDirectory, e);
  2265. MessageBox.Show("更新成功");
  2266. }
  2267. }
  2268. private void btnMedInsuDr_Click(object sender, EventArgs e)
  2269. {
  2270. if (queryMedInsuDr(MedInsuType, tbYBMC.Text, out string outParam) != 0)
  2271. {
  2272. MessageBox.Show("查询医保字典数据失败" + outParam);
  2273. return;
  2274. }
  2275. JObject joRtn = new JObject(JObject.Parse(outParam));
  2276. dgv_InsuDr.DataSource = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  2277. }
  2278. }
  2279. }