DirectoryMap.cs 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. 
  2. using Microsoft.Office.Core;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Linq;
  5. using PTMedicalInsurance.Business;
  6. using PTMedicalInsurance.Common;
  7. using PTMedicalInsurance.Forms.BasicDatas.services;
  8. using PTMedicalInsurance.FormSetter;
  9. using PTMedicalInsurance.Helper;
  10. using PTMedicalInsurance.Variables;
  11. using Sunny.UI;
  12. using System;
  13. using System.Collections.Generic;
  14. using System.ComponentModel;
  15. using System.Data;
  16. using System.Drawing;
  17. using System.IO;
  18. using System.Linq;
  19. using System.Text;
  20. using System.Threading.Tasks;
  21. using System.Windows.Forms;
  22. using DataTable = System.Data.DataTable;
  23. using Global = PTMedicalInsurance.Variables.Global;
  24. namespace PTMedicalInsurance.Forms.BasicDatas
  25. {
  26. public partial class DirectoryMap : Form
  27. {
  28. private Form mainForm;
  29. MIIrisServices mIS = new MIIrisServices();
  30. HisIrisServices hIS = new HisIrisServices();
  31. InvokeHelper invoker = new InvokeHelper();
  32. private HisDirectoryCategoryEnum hisDirectoryCategory;
  33. private MapFlagEnum mapFlag;
  34. private int pageSize = 50;
  35. private int currentPage = 1;
  36. private string sortColumn = "Code";
  37. private DirectoryMapService directoryMapService = new DirectoryMapService();
  38. private GridViewSetter gvdSetter = new GridViewSetter();
  39. private string errMsg;
  40. private string directoryCategoryDesc; //目录大类中文说明,配合目录导出使用
  41. private string mapFlagDesc; //对照标志中文说明,配合目录导出使用
  42. private string cylCode; //柱镜度数编码
  43. private string cylName;
  44. private string pdCode; //棱镜度数编码
  45. private string pdName;
  46. public DirectoryMap()
  47. {
  48. InitializeComponent();
  49. }
  50. public DirectoryMap(Form frm)
  51. {
  52. InitializeComponent();
  53. InitForm(frm);
  54. }
  55. ///// <summary>
  56. ///// 标题设置映射字典
  57. ///// </summary>
  58. //private Dictionary<HisDirectoryCategoryEnum, string> miDirHeaderTextJsonFileMap = new Dictionary<HisDirectoryCategoryEnum, string>
  59. //{
  60. // { HisDirectoryCategoryEnum.none, "Map_MiDir_Default.json" }, //对照界面中心目录药品
  61. // { HisDirectoryCategoryEnum.drugs, "Map_MiDir_Drug.json" }, //对照界面中心目录药品
  62. // { HisDirectoryCategoryEnum.diagnosi, "Map_MiDir_MedicalService.json" },//对照界面中心目录诊疗
  63. // { HisDirectoryCategoryEnum.consumables, "Map_MiDir_Consumables.json" },//对照界面中心目录材料
  64. // { HisDirectoryCategoryEnum.usedFreq, "Map_MiDir_UsedFreq.json" },//对照界面使用频次
  65. // { HisDirectoryCategoryEnum.medcWay, "Map_MiDir_MedcWay.json" },//对照界面用法
  66. //};
  67. ///// <summary>
  68. ///// 标题设置映射字典
  69. ///// </summary>
  70. //private Dictionary<HisDirectoryCategoryEnum, string> hisDirHeaderTextJsonFileMap = new Dictionary<HisDirectoryCategoryEnum, string>
  71. //{
  72. // { HisDirectoryCategoryEnum.none, "Map_HisDir_Default.json" }, //对照界面中心目录药品
  73. // { HisDirectoryCategoryEnum.drugs, "Map_HisDir_Drug.json" }, //对照界面HIS目录药品
  74. // { HisDirectoryCategoryEnum.diagnosi, "Map_HisDir_MedicalService.json" },//对照界面HIS目录诊疗
  75. // { HisDirectoryCategoryEnum.consumables, "Map_HisDir_Consumables.json" },//对照界面HIS目录材料
  76. // { HisDirectoryCategoryEnum.usedFreq, "Map_HisDir_UsedFreq.json" },//对照界面使用频次
  77. // { HisDirectoryCategoryEnum.medcWay, "Map_HisDir_MedcWay.json" },//对照界面用法
  78. //};
  79. private static Dictionary<HisDirectoryCategoryEnum, string> BuildMap(string prefix)
  80. {
  81. // 使用 typeof 获取类型,然后 Cast 回枚举类型
  82. return Enum.GetValues(typeof(HisDirectoryCategoryEnum))
  83. .Cast<HisDirectoryCategoryEnum>()
  84. .ToDictionary(
  85. e => e,
  86. e => $"Map_{prefix}_{e}.json"
  87. );
  88. }
  89. // 调用方式不变
  90. private Dictionary<HisDirectoryCategoryEnum, string> miDirHeaderTextJsonFileMap = BuildMap("MiDir");
  91. private Dictionary<HisDirectoryCategoryEnum, string> hisDirHeaderTextJsonFileMap = BuildMap("HisDir");
  92. private void InitForm(Form frm)
  93. {
  94. mainForm = frm;
  95. CheckForIllegalCrossThreadCalls = false;
  96. // 禁用关闭按钮
  97. this.FormBorderStyle = FormBorderStyle.None;
  98. // 隐藏标题栏
  99. this.ControlBox = false;
  100. // 其他可能需要的配置
  101. this.TopLevel = false;
  102. this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性
  103. //设置HIS字典晶体编码
  104. SetHisDictonaryCombox(ref dblkCYL, "CrystalDegree");
  105. SetHisDictonaryCombox(ref dblkPD, "CylindricalDegree");
  106. //
  107. rbgDirecType_C.SelectedIndex = 0;
  108. rbOnlyName.Checked = rbAll.Checked = true;
  109. //
  110. gvdSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
  111. //
  112. dgvCenterDirectory.DataError += directoryMapService.dataGridView_DataError;
  113. }
  114. #region
  115. #region 控件设置
  116. private JArray ConvertHisDicToStandardInsuDic(JArray jaHis)
  117. {
  118. if (jaHis == null || jaHis.Count == 0)
  119. return new JArray(); // 或 return null; 根据调用方约定
  120. var jaInsu = new JArray();
  121. foreach (JObject joHis in jaHis)
  122. {
  123. var joInsu = new JObject
  124. {
  125. //["Code"] = joHis["code"]?.ToString(),
  126. //HIS需要ID
  127. ["Code"] = joHis["id"]?.ToString(),
  128. ["Name"] = joHis["descripts"]?.ToString(),
  129. ["SearchCode"] = joHis["descriptsSPCode"]?.ToString()
  130. };
  131. jaInsu.Add(joInsu);
  132. }
  133. return jaInsu;
  134. }
  135. private void SetHisDictonaryCombox(ref PTControl.DBLookupCombox dblcbx,string dictType)
  136. {
  137. ComboxSetter comboxSetter = new ComboxSetter();
  138. DataTable dt = comboxSetter.GetDBLKComboxTable(ConvertHisDicToStandardInsuDic(hIS.QueryHisDictionary(dictType, "")));
  139. comboxSetter.SetDBLKCombox(ref dblcbx,dt);
  140. }
  141. private void SetHisDirectoryCategory()
  142. {
  143. switch (rbgDirecType_C.SelectedIndex)
  144. {
  145. case 0:
  146. hisDirectoryCategory = HisDirectoryCategoryEnum.drugs;
  147. directoryCategoryDesc = "药品";
  148. break;
  149. case 1:
  150. hisDirectoryCategory = HisDirectoryCategoryEnum.medicalServices;
  151. directoryCategoryDesc = "诊疗";
  152. break;
  153. case 2:
  154. hisDirectoryCategory = HisDirectoryCategoryEnum.consumables;
  155. directoryCategoryDesc = "材料";
  156. break;
  157. case 3:
  158. hisDirectoryCategory = HisDirectoryCategoryEnum.Frequence;
  159. directoryCategoryDesc = "使用频次";
  160. break;
  161. case 4:
  162. hisDirectoryCategory = HisDirectoryCategoryEnum.Usage;
  163. directoryCategoryDesc = "用药途径(用法)";
  164. break;
  165. default:
  166. hisDirectoryCategory = HisDirectoryCategoryEnum.none;
  167. break;
  168. }
  169. if (hisDirectoryCategory != HisDirectoryCategoryEnum.consumables)
  170. {
  171. ckbCryQuery.Enabled = false;
  172. ckbCryQuery.Checked = false;
  173. }
  174. else
  175. {
  176. ckbCryQuery.Enabled = true;
  177. }
  178. }
  179. private void SetMapFlag()
  180. {
  181. if (rbAll.Checked)
  182. {
  183. mapFlag = MapFlagEnum.All;
  184. mapFlagDesc = "全部";
  185. sortColumn = "Code";
  186. }
  187. else if (rbMaped.Checked)
  188. {
  189. mapFlag = MapFlagEnum.Mapped;
  190. mapFlagDesc = "已对照";
  191. sortColumn = "HisCode";
  192. }
  193. else if (rbNoMaped.Checked)
  194. {
  195. mapFlag = MapFlagEnum.NoMapped;
  196. mapFlagDesc = "未对照";
  197. sortColumn = "Code";
  198. }
  199. else
  200. {
  201. mapFlag = MapFlagEnum.None;
  202. mapFlagDesc = "未知";
  203. sortColumn = "Code";
  204. }
  205. }
  206. #endregion
  207. #region 获取入参
  208. private JObject GetHisDictInput()
  209. {
  210. return hIS.GetHisDictInput(hisDirectoryCategory.ToString(),"");
  211. }
  212. private JObject GetHisDirInput()
  213. {
  214. JArray jaPagination = new JArray();
  215. JArray jaParams = new JArray();
  216. string flag = "All";
  217. dynamic joParam = new JObject();
  218. joParam.code = "";
  219. joParam.descripts = "";
  220. joParam.FindType = new JArray();
  221. joParam.TypeID = "";
  222. joParam.alias = tbHISDirectoryFilter.Text;
  223. joParam.include = "Hosp";
  224. joParam.groupID = "324";
  225. joParam.hospID = Global.inf.hisHospitalDr;
  226. joParam.interfaceDr = Global.inf.interfaceDr;
  227. //type 增加类型IOL(人工晶状体),params节点增加 CrystalDegree 柱镜度数 CylindricalDegree 棱镜度数,当且仅当type为IOL时才判断这两个入参的值。并返回符合条件的晶体
  228. //当ytpe为IOL 时,只搜索晶体。1.code 为空,CrystalDegree 为空,CylindricalDegree 为空,返回所有晶体数据 2.code 为空,CrystalDegree 有值a,CylindricalDegree 为空,返回所有柱镜度数为a的晶体 3.code 为空,CrystalDegree 为空,CylindricalDegree 有值,报错,棱镜度数有值,柱镜度数必须有值 4.code 为空,CrystalDegree 有值a,CylindricalDegree 有值b,返回所有柱镜度数为a,棱镜度数为b的晶体
  229. //5.code有值 a,参考上述逻辑,再返回code为a的所有晶体数据 6.CrystalDegree ,CylindricalDegree 传返回的id
  230. if ((hisDirectoryCategory == HisDirectoryCategoryEnum.consumables) && ckbCryQuery.Checked)
  231. {
  232. joParam.type = "IOL";
  233. joParam.CrystalDegree = cylCode;
  234. joParam.CylindricalDegree = pdCode;
  235. }
  236. else
  237. {
  238. joParam.type = hisDirectoryCategory.ToString();
  239. }
  240. joParam.flag = mapFlag.ToString();
  241. joParam.specInput = txtSpecFilter.Text.Trim();
  242. jaParams.Add(joParam);
  243. dynamic joPagination = new JObject();
  244. joPagination.pageSize = pageSize;
  245. //joPagination.pageSize = 2;
  246. joPagination.currentPage = currentPage;
  247. joPagination.sortColumn = sortColumn;
  248. joPagination.sortOrder = "asc";
  249. jaPagination.Add(joPagination);
  250. JObject joRtn = new JObject();
  251. joRtn.Add("params", jaParams);
  252. joRtn.Add("pagination",jaPagination);
  253. return joRtn;
  254. }
  255. private JObject GetInsuDirInput()
  256. {
  257. JObject joInput = new JObject {
  258. { "currentPage" , currentPage },
  259. { "pageSize" , pageSize },
  260. { "serviceCode" , "09010042" },
  261. { "directoryType" , (int)hisDirectoryCategory },
  262. { "directoryCode" , tbInsuCode.Text },
  263. { "directoryName" , tbCenterDirectoryFilter.Text },
  264. { "approvalNO" , tbApprovalNO.Text },
  265. { "dosageForm" , tbDosageForm.Text },
  266. { "specifications" , tbSpecifications.Text },
  267. { "manufacturers" , tbManufacturer.Text },
  268. { "directoryDr" , Global.inf.interfaceDr }
  269. };
  270. return joInput;
  271. }
  272. private string GetDictTypeCode()
  273. {
  274. switch (hisDirectoryCategory)
  275. {
  276. case HisDirectoryCategoryEnum.none:
  277. case HisDirectoryCategoryEnum.drugs:
  278. case HisDirectoryCategoryEnum.medicalServices:
  279. case HisDirectoryCategoryEnum.consumables:
  280. return "N/A";
  281. case HisDirectoryCategoryEnum.Frequence:
  282. return "USED_FRQU";
  283. case HisDirectoryCategoryEnum.Usage:
  284. return "MEDC_WAY";
  285. default:
  286. return "N/A";
  287. }
  288. }
  289. private JObject GetInsuDictInput()
  290. {
  291. JObject joInput = new JObject {
  292. { "currentPage" , currentPage },
  293. { "pageSize" , pageSize },
  294. { "serviceCode" , "09010043" },
  295. { "directoryType" , 9 },
  296. { "directoryCode" , GetDictTypeCode() },
  297. { "directoryName" , tbCenterDirectoryFilter.Text },
  298. { "approvalNO" , "" },
  299. { "dosageForm" , "" },
  300. { "specifications" , "" },
  301. { "manufacturers" , "" },
  302. { "directoryDr" , Global.inf.interfaceDr }
  303. };
  304. return joInput;
  305. }
  306. /// <summary>
  307. /// 获取更新医保信息的入参
  308. /// </summary>
  309. /// <param name="Index"></param>
  310. /// <param name="frm"></param>
  311. /// <param name="trade"></param>
  312. /// <returns></returns>
  313. private JObject GetUpdateInsuInfoInput(int Index, UpdateDirecotryCondition frm, out TradeEnum trade)
  314. {
  315. trade = TradeEnum.MedicalServiceDirectory;
  316. dynamic joData = new JObject();
  317. switch (Index)
  318. {
  319. case 14://民族药品目
  320. {
  321. trade = TradeEnum.NationalityDrug;
  322. joData.med_list_codg = frm.Code; //医疗目录编码
  323. joData.genname_codg = ""; //通用名编号
  324. joData.drug_genname = ""; //药品通用名
  325. joData.drug_prodname = frm.Name; //药品商品名
  326. joData.reg_name = ""; //注册名称
  327. joData.tcmherb_name = ""; //中草药名称
  328. joData.mlms_name = ""; //药材名称
  329. joData.vali_flag = ""; //有效标志
  330. joData.rid = ""; //唯一记录号
  331. joData.ver = ""; //版本号
  332. joData.ver_name = ""; //版本名称
  333. joData.opt_begn_time = ""; //经办开始时间
  334. joData.opt_end_time = ""; //经办结束时间
  335. joData.updt_time = frm.UpdateTime; //更新时间
  336. joData.page_num = frm.CurrentPage; //当前页数
  337. joData.page_size = frm.PageSize; //本页数据量
  338. break;
  339. }
  340. case 15://目录信息查询
  341. {
  342. trade = TradeEnum.InsuDirectory;
  343. joData.query_date = ""; //查询时间点
  344. joData.hilist_code = frm.Code; //医保目录编码
  345. joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
  346. joData.begndate = ""; //开始日期
  347. joData.hilist_name = frm.Name; //医保目录名称
  348. joData.wubi = ""; //五笔助记码
  349. joData.pinyin = ""; //拼音助记码
  350. joData.med_chrgitm_type = ""; //医疗收费项目类别
  351. joData.chrgitm_lv = ""; //收费项目等级
  352. joData.lmt_used_flag = ""; //限制使用标志
  353. joData.list_type = ""; //目录类别
  354. joData.med_use_flag = ""; //医疗使用标志
  355. joData.matn_used_flag = ""; //生育使用标志
  356. joData.hilist_use_type = ""; //医保目录使用类别
  357. joData.lmt_cpnd_type = ""; //限复方使用类型
  358. joData.vali_flag = ""; //有效标志
  359. joData.updt_time = frm.UpdateTime; //更新时间
  360. joData.page_num = frm.CurrentPage; //当前页数
  361. joData.page_size = frm.PageSize; //本页数据量
  362. break;
  363. }
  364. case 16://医疗与医保目录匹配
  365. {
  366. trade = TradeEnum.MedicalAndInsuDirectory;
  367. joData.query_date = ""; //查询时间点
  368. joData.medins_list_codg = ""; //定点医药机构目录编号
  369. joData.hilist_code = frm.Code; //医保目录编码
  370. joData.list_type = ""; //目录类别
  371. joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
  372. joData.begndate = ""; //开始日期
  373. joData.vali_flag = ""; //有效标志
  374. joData.updt_time = frm.UpdateTime; //更新时间
  375. joData.page_num = frm.CurrentPage; //当前页数
  376. joData.page_size = frm.PageSize; //本页数据量
  377. break;
  378. }
  379. case 17://医药机构目录匹配
  380. {
  381. trade = TradeEnum.MedcineOrgDirectory;
  382. joData.query_date = ""; //查询时间点
  383. joData.fixmedins_code = ""; //定点医药机构编号
  384. joData.medins_list_codg = ""; //定点医药机构目录编号
  385. joData.medins_list_name = ""; //定点医药机构目录名称
  386. joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
  387. joData.list_type = ""; //目录类别
  388. joData.med_list_codg = frm.Code; //医疗目录编码
  389. joData.begndate = ""; //开始日期
  390. joData.vali_flag = ""; //有效标志
  391. joData.updt_time = frm.UpdateTime; //更新时间
  392. joData.page_num = frm.CurrentPage; //当前页数
  393. joData.page_size = frm.PageSize; //本页数据量
  394. break;
  395. }
  396. case 18://医保目录限价
  397. {
  398. trade = TradeEnum.InsuPriceLimitDirectory;
  399. joData.query_date = ""; //查询时间点
  400. joData.hilist_code = frm.Code; //医保目录编码
  401. joData.hilist_lmtpric_type = ""; //医保目录限价类型
  402. joData.overlmt_dspo_way = ""; //医保目录超限处理方式
  403. joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
  404. joData.begndate = ""; //开始日期
  405. joData.enddate = ""; //结束日期
  406. joData.vali_flag = ""; //有效标志
  407. joData.rid = ""; //唯一记录号
  408. joData.tabname = ""; //表名
  409. joData.poolarea_no = ""; //统筹区
  410. joData.updt_time = frm.UpdateTime; //更新时间
  411. joData.page_num = frm.CurrentPage; //当前页数
  412. joData.page_size = frm.PageSize; //本页数据量
  413. break;
  414. }
  415. case 19://医保目录先自付比例
  416. {
  417. trade = TradeEnum.PrepayPercentDirectory;
  418. joData.query_date = ""; //查询时间点
  419. joData.hilist_code = frm.Code; //医保目录编码
  420. joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
  421. joData.selfpay_prop_type = ""; //目录自付比例类别
  422. joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
  423. joData.begndate = ""; //开始日期
  424. joData.enddate = ""; //结束日期
  425. joData.vali_flag = ""; //有效标志
  426. joData.rid = ""; //唯一记录号
  427. joData.tabname = ""; //表名
  428. joData.poolarea_no = ""; //统筹区
  429. joData.updt_time = frm.UpdateTime; //更新时间
  430. joData.page_num = frm.CurrentPage; //当前页数
  431. joData.page_size = frm.PageSize; //本页数据量
  432. break;
  433. }
  434. }
  435. return joData;
  436. }
  437. #endregion
  438. #region 查询
  439. private void Query()
  440. {
  441. dgvHISDirectory.SelectionChanged -= dgvHISDirectory_SelectionChanged;
  442. try
  443. {
  444. switch (rbgDirecType_C.SelectedIndex)
  445. {
  446. case 0:
  447. case 1:
  448. case 2:
  449. QueryDirectory();
  450. break;
  451. case 3:
  452. case 4://查询HIS的字典数据,暂无分页
  453. QueryDictionary();
  454. break;
  455. default:
  456. break;
  457. }
  458. }
  459. catch (Exception)
  460. {
  461. throw;
  462. }
  463. finally
  464. {
  465. dgvHISDirectory.SelectionChanged += dgvHISDirectory_SelectionChanged;
  466. }
  467. }
  468. private void QueryDirectory()
  469. {
  470. JObject joRtn = new JObject();
  471. joRtn = directoryMapService.QueryDirectory(GetHisDirInput(), mapFlag);
  472. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  473. {
  474. MessageBox.Show(errMsg);
  475. }
  476. else
  477. {
  478. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  479. int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
  480. pgHISDirect.TotalCount = totalCount;
  481. pgHISDirect.PageSize = pageSize;
  482. dgvHISDirectory.DataSource = dt;
  483. if (directoryMapService.SetDgvDirectoryHeader(hisDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvHISDirectory, out errMsg) != 0)
  484. {
  485. MessageBox.Show(errMsg);
  486. return;
  487. }
  488. dgvHISDirectory.Columns[0].ReadOnly = true;
  489. }
  490. }
  491. private void QueryDictionary()
  492. {
  493. JObject joRtn = new JObject();
  494. joRtn = directoryMapService.QueryDictionary(GetHisDictInput(), mapFlag,GetDictTypeCode());
  495. if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
  496. {
  497. MessageBox.Show(errMsg);
  498. }
  499. else
  500. {
  501. DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
  502. pgHISDirect.PageSize = pageSize;
  503. dgvHISDirectory.DataSource = dt;
  504. if (directoryMapService.SetDgvDirectoryHeader(hisDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvHISDirectory, out errMsg) != 0)
  505. {
  506. MessageBox.Show(errMsg);
  507. return;
  508. }
  509. dgvHISDirectory.Columns[0].ReadOnly = true;
  510. }
  511. }
  512. private void QueryMi()
  513. {
  514. switch (rbgDirecType_C.SelectedIndex)
  515. {
  516. case 0:
  517. case 1:
  518. case 2:
  519. QueryMiDirectory();
  520. break;
  521. case 3:
  522. case 4://查询HIS的字典数据,暂无分页
  523. QueryMiDictionary();
  524. break;
  525. default:
  526. break;
  527. }
  528. }
  529. private void QueryMiDirectory()
  530. {
  531. JObject joRtn = new JObject();
  532. joRtn = directoryMapService.QueryMiDirectory(GetInsuDirInput());
  533. if (joRtn["errorCode"].ToString() != "0")
  534. {
  535. MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
  536. return;
  537. }
  538. if (joRtn["result"]["rows"] == null)
  539. {
  540. MessageBox.Show("该节点不存在");
  541. return;
  542. }
  543. if (joRtn["result"]["total"].ToString() == "0")
  544. {
  545. MessageBox.Show("未查询到数据");
  546. dgvCenterDirectory.DataSource = null;
  547. return;
  548. }
  549. DataTable dt = (DataTable)joRtn["result"]["rows"].ToObject(typeof(DataTable));
  550. int totalCount = int.Parse(joRtn["result"]["total"].ToString());
  551. pgCenterDirect.TotalCount = totalCount;
  552. pgCenterDirect.PageSize = pageSize;
  553. dgvCenterDirectory.DataSource = dt;
  554. if (directoryMapService.SetDgvDirectoryHeader(miDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvCenterDirectory, out errMsg) != 0)
  555. {
  556. MessageBox.Show(errMsg);
  557. return;
  558. }
  559. dgvCenterDirectory.Columns[0].ReadOnly = true;
  560. }
  561. private void QueryMiDictionary()
  562. {
  563. JObject joRtn = new JObject();
  564. switch (rbgDirecType_C.SelectedIndex)
  565. {
  566. case 0:
  567. case 1:
  568. case 2:
  569. joRtn = directoryMapService.QueryMiDirectory(GetInsuDirInput());
  570. break;
  571. case 3:
  572. case 4://查询HIS的字典数据,暂无分页
  573. joRtn = directoryMapService.QueryMiDictionary(GetInsuDictInput());
  574. break;
  575. default:
  576. break;
  577. }
  578. if (joRtn["errorCode"].ToString() != "0")
  579. {
  580. MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
  581. return;
  582. }
  583. if (joRtn["result"]["rows"] == null)
  584. {
  585. MessageBox.Show("该节点不存在");
  586. return;
  587. }
  588. if (joRtn["result"]["total"].ToString() == "0")
  589. {
  590. MessageBox.Show("未查询到数据");
  591. dgvCenterDirectory.DataSource = null;
  592. return;
  593. }
  594. DataTable dt = (DataTable)joRtn["result"]["rows"].ToObject(typeof(DataTable));
  595. int totalCount = int.Parse(joRtn["result"]["total"].ToString());
  596. pgCenterDirect.TotalCount = totalCount;
  597. pgCenterDirect.PageSize = pageSize;
  598. dgvCenterDirectory.DataSource = dt;
  599. if (directoryMapService.SetDgvDirectoryHeader(miDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvCenterDirectory, out errMsg) != 0)
  600. {
  601. MessageBox.Show(errMsg);
  602. return;
  603. }
  604. dgvCenterDirectory.Columns[0].ReadOnly = true;
  605. }
  606. #endregion
  607. #region 对照
  608. private void Mapping()
  609. {
  610. switch (rbgDirecType_C.SelectedIndex)
  611. {
  612. case 0:
  613. case 1:
  614. case 2:
  615. DirectoryMapping();
  616. break;
  617. case 3:
  618. case 4://查询HIS的字典数据,暂无分页
  619. DictionaryMapping();
  620. break;
  621. default:
  622. break;
  623. }
  624. }
  625. private void DictionaryMapping()
  626. {
  627. int iHis = dgvHISDirectory.CurrentRow.Index;
  628. if (dgvCenterDirectory.CurrentRow == null)
  629. {
  630. MessageBox.Show("请查询中心目录");
  631. return;
  632. }
  633. int iCenter = dgvCenterDirectory.CurrentRow.Index;
  634. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  635. DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
  636. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["code"].Value.ToString();
  637. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["descripts"].Value.ToString();
  638. JArray jaParams = new JArray();
  639. dynamic jsonTemp = new JObject();
  640. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  641. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  642. jsonTemp.updateUserID = Global.user.ID;
  643. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  644. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["code"].Value;
  645. jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["descripts"].Value;
  646. jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["id"];
  647. jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["dictionaryDataDetailID"];
  648. //1.已对照 2.已对照但未上传 3 已对照且已上传
  649. jsonTemp.State = 1;
  650. jsonTemp.HisType = $"DIC-{GetDictTypeCode()}";
  651. jsonTemp.HisTypeName = rbgDirecType_C.Items[(int)hisDirectoryCategory - 1].ToString();
  652. jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["code"].Value;
  653. jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["descripts"].Value;
  654. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  655. jaParams.Add(jsonTemp);
  656. JObject joIn = new JObject();
  657. joIn.Add(new JProperty("params", jaParams));
  658. joIn.Add("code", "09010040");
  659. InvokeHelper invoker = new InvokeHelper();
  660. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
  661. //JObject joRtn = JObject.Parse(irisRtn);
  662. if ((int)joRtn["errorCode"] == 0)
  663. {
  664. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
  665. //dgvHISDirectory.Rows[iHis].Cells["MapID"].Value =joRtn["data"]["mapID"].ToString();
  666. //dtHis.Rows[iHis]["MapID"] = joRtn["data"]["mapID"].ToString();
  667. }
  668. else
  669. {
  670. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
  671. }
  672. }
  673. private void DirectoryMapping()
  674. {
  675. int iHis = dgvHISDirectory.CurrentRow.Index;
  676. if (dgvCenterDirectory.CurrentRow == null)
  677. {
  678. MessageBox.Show("请查询中心目录");
  679. return;
  680. }
  681. int iCenter = dgvCenterDirectory.CurrentRow.Index;
  682. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  683. DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
  684. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Code"].Value.ToString();
  685. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Name"].Value.ToString();
  686. JArray jaParams = new JArray();
  687. dynamic jsonTemp = new JObject();
  688. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  689. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  690. jsonTemp.updateUserID = Global.user.ID;
  691. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  692. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  693. jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["itemDesc"].Value;
  694. jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
  695. jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
  696. //1.已对照 2.已对照但未上传 3 已对照且已上传
  697. jsonTemp.State = 1;
  698. jsonTemp.HisType = (int)hisDirectoryCategory;
  699. jsonTemp.HisTypeName = rbgDirecType_C.Items[(int)hisDirectoryCategory - 1].ToString();
  700. jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Code"].Value;
  701. jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
  702. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  703. jaParams.Add(jsonTemp);
  704. JObject joIn = new JObject();
  705. joIn.Add(new JProperty("params", jaParams));
  706. joIn.Add("code", "09010040");
  707. InvokeHelper invoker = new InvokeHelper();
  708. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
  709. //JObject joRtn = JObject.Parse(irisRtn);
  710. if ((int)joRtn["errorCode"] == 0)
  711. {
  712. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
  713. //dgvHISDirectory.Rows[iHis].Cells["MapID"].Value = joRtn["data"]["mapID"].ToString();
  714. //dtHis.Rows[iHis]["MapID"] = joRtn["data"]["mapID"].ToString();
  715. }
  716. else
  717. {
  718. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
  719. }
  720. }
  721. private void CancelMapping()
  722. {
  723. switch (rbgDirecType_C.SelectedIndex)
  724. {
  725. case 0:
  726. case 1:
  727. case 2:
  728. CancelDirectoryMapping();
  729. break;
  730. case 3:
  731. case 4://查询HIS的字典数据,暂无分页
  732. CancelDictionaryMapping();
  733. break;
  734. default:
  735. break;
  736. }
  737. }
  738. private void CancelDirectoryMapping()
  739. {
  740. int iHis = dgvHISDirectory.CurrentRow.Index;
  741. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  742. JArray jaParams = new JArray();
  743. dynamic jsonTemp = new JObject();
  744. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  745. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  746. jsonTemp.updateUserID = Global.user.ID;
  747. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  748. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
  749. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  750. jaParams.Add(jsonTemp);
  751. JObject joIn = new JObject();
  752. joIn.Add(new JProperty("params", jaParams));
  753. joIn.Add("code", "09010041");
  754. InvokeHelper invoker = new InvokeHelper();
  755. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
  756. if ((int)joRtn["errorCode"] == 0)
  757. {
  758. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
  759. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
  760. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "";
  761. dgvHISDirectory.Rows[iHis].Cells["MapID"].Value = 0;
  762. }
  763. else
  764. {
  765. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
  766. }
  767. }
  768. private void CancelDictionaryMapping()
  769. {
  770. int iHis = dgvHISDirectory.CurrentRow.Index;
  771. DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
  772. JArray jaParams = new JArray();
  773. dynamic jsonTemp = new JObject();
  774. jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
  775. jsonTemp.HospitalDr = Global.inf.hospitalDr;
  776. jsonTemp.updateUserID = Global.user.ID;
  777. jsonTemp.InterfaceDr = Global.inf.interfaceDr;
  778. jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["code"].Value;
  779. jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  780. jaParams.Add(jsonTemp);
  781. JObject joIn = new JObject();
  782. joIn.Add(new JProperty("params", jaParams));
  783. joIn.Add("code", "09010041");
  784. InvokeHelper invoker = new InvokeHelper();
  785. JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
  786. if ((int)joRtn["errorCode"] == 0)
  787. {
  788. dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
  789. dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
  790. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "";
  791. dgvHISDirectory.Rows[iHis].Cells["MapID"].Value = 0;
  792. }
  793. else
  794. {
  795. dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
  796. }
  797. }
  798. #endregion
  799. #region 导出
  800. private int queryExportData_CallBack(DataLoaderContext context, out string errMsg)
  801. {
  802. errMsg = "";
  803. return 0;
  804. }
  805. #endregion
  806. #region 批量更新
  807. private void batchUpdateMappedInsuInfo(int index)
  808. {
  809. //获取入参条件
  810. TradeEnum trade;
  811. JObject joCondition = new JObject();
  812. UpdateDirecotryCondition updateDirecotryCondition = new UpdateDirecotryCondition();
  813. if (updateDirecotryCondition.ShowDialog() == DialogResult.Cancel)
  814. {
  815. //MessageBox.Show("");
  816. return;
  817. }
  818. else
  819. {
  820. joCondition = GetUpdateInsuInfoInput(index,updateDirecotryCondition,out trade);
  821. joCondition.Add("funno", trade.GetCode());
  822. }
  823. //查表
  824. string sqlStr = $"select * from HB_MedInsuMapRelation where Interface_Dr='{Global.inf.interfaceDr}' and Hospital_Dr ='{Global.inf.hospitalDr}'";
  825. JObject joSqlstr = new JObject();
  826. joSqlstr.Add("sqlStr", sqlStr);
  827. JObject joRtn = mIS.QueryMappedData(joSqlstr, "查询所有已对照数据");
  828. JObject joResult = JObject.FromObject(joRtn["result"]);
  829. joResult.Add("condition", joCondition);
  830. directoryMapService.batchUpdateMappedInsuInfo(joResult, this);
  831. }
  832. #endregion
  833. #endregion
  834. private void btTripMenu_Click(object sender, EventArgs e)
  835. {
  836. cmsIntegratedMenu.Show(((Sunny.UI.UIButton)sender), new Point(0, btTripMenu.Height));
  837. }
  838. private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
  839. {
  840. SetHisDirectoryCategory();
  841. }
  842. private void rbAll_ValueChanged(object sender, bool value)
  843. {
  844. SetMapFlag();
  845. }
  846. private void btnQueryHISDirectory_Click(object sender, EventArgs e)
  847. {
  848. currentPage = 1;
  849. Query();
  850. }
  851. private void tsmExportAllMappedData_Click(object sender, EventArgs e)
  852. {
  853. MessageBox.Show("请点击按左侧类别导出!");
  854. }
  855. private void tsmExportMappedDataByLeft_Click(object sender, EventArgs e)
  856. {
  857. ProgressWrapper _dataLoader;
  858. _dataLoader = new ProgressWrapper(queryExportData_CallBack, this);
  859. _dataLoader.SetProgressBar(ProgressBarStyle.Marquee, "正在导出...", 50);
  860. _dataLoader.Start(new object[] { 0 }, (result, errMsg) =>
  861. {
  862. // 在这里处理结果和错误信息
  863. if (result == 0)
  864. {
  865. MessageBox.Show(errMsg);
  866. }
  867. else
  868. {
  869. MessageBox.Show(errMsg);
  870. }
  871. });
  872. }
  873. private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  874. {
  875. //当两者均为1说明点击的是查询按钮
  876. if (!((currentPage == 1) && (pageIndex == 1)))
  877. {
  878. currentPage = pageIndex;
  879. Query();
  880. }
  881. }
  882. private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
  883. {
  884. currentPage = 1;
  885. QueryMi();
  886. }
  887. private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
  888. {
  889. if (!((currentPage == 1) && (pageIndex == 1)))
  890. {
  891. currentPage = pageIndex;
  892. QueryMi();
  893. }
  894. }
  895. private void tsmiMapping_Click(object sender, EventArgs e)
  896. {
  897. Mapping();
  898. }
  899. private void tsmiCancleMapping_Click(object sender, EventArgs e)
  900. {
  901. CancelMapping();
  902. }
  903. private void tsmUpdateCellPriceOfAllMapped_Click(object sender, EventArgs e)
  904. {
  905. batchUpdateMappedInsuInfo(18);
  906. }
  907. private void btSetCenterDirHeaderText_Click(object sender, EventArgs e)
  908. {
  909. //获取数据源
  910. DataGridViewHeaderSetForm frm = new DataGridViewHeaderSetForm(miDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), (DataTable)dgvCenterDirectory.DataSource);
  911. frm.StartPosition = FormStartPosition.CenterParent;
  912. if (frm.ShowDialog() == DialogResult.OK)
  913. {
  914. }
  915. }
  916. private void btSetHisDirHeaderText_Click(object sender, EventArgs e)
  917. {
  918. //获取数据源
  919. DataGridViewHeaderSetForm frm = new DataGridViewHeaderSetForm(hisDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), (DataTable)dgvHISDirectory.DataSource);
  920. frm.StartPosition = FormStartPosition.CenterParent;
  921. if (frm.ShowDialog() == DialogResult.OK)
  922. {
  923. }
  924. }
  925. private void dgvHISDirectory_SelectionChanged(object sender, EventArgs e)
  926. {
  927. switch (rbgDirecType_C.SelectedIndex)
  928. {
  929. case 0:
  930. case 1:
  931. case 2:
  932. dgvHISDirectory_directory_SelectionChanged(sender,e);
  933. break;
  934. case 3:
  935. case 4://查询HIS的字典数据,暂无分页
  936. dgvHISDirectory_Dict_SelectionChanged(sender, e);
  937. break;
  938. default:
  939. break;
  940. }
  941. }
  942. private void dgvHISDirectory_directory_SelectionChanged(object sender, EventArgs e)
  943. {
  944. DataGridViewRow dr = dgvHISDirectory.CurrentRow;
  945. if (dr == null)
  946. {
  947. return; // 防止没有选中行
  948. }
  949. if (!dgvHISDirectory.Columns.Contains("InsuCode"))
  950. {
  951. Global.writeLog("未找到InsuCode");
  952. // 可以在这里调试:打印所有列名
  953. foreach (DataGridViewColumn col in dgvHISDirectory.Columns)
  954. {
  955. System.Diagnostics.Debug.WriteLine($"列名: {col.Name}");
  956. Global.writeLog($"列名: {col.Name},值:{dr.Cells[col.Name].Value}");
  957. }
  958. return;
  959. }
  960. // 先检查列是否存在
  961. DataGridViewCell cell = dr.Cells["InsuCode"];
  962. if (cell == null || cell.Value == null || cell.Value == DBNull.Value)
  963. {
  964. return;
  965. }
  966. if (cell != null)
  967. {
  968. if (cell.Value.ToString() != "")
  969. {
  970. tbInsuCode.Text = cell.Value.ToString();
  971. tbCenterDirectoryFilter.Text = "";
  972. tbApprovalNO.Text = "";
  973. }
  974. else
  975. {
  976. tbInsuCode.Text = "";
  977. if (rbOnlyName.Checked)
  978. {
  979. tbInsuCode.Text = "";
  980. tbApprovalNO.Text = "";
  981. tbCenterDirectoryFilter.Text = "%" + dr.Cells["itemDesc"].Value.ToString() + "%";
  982. }
  983. if (rbOnlyApprNO.Checked)
  984. {
  985. tbCenterDirectoryFilter.Text = "";
  986. tbInsuCode.Text = "";
  987. tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
  988. }
  989. if (rbBoth.Checked)
  990. {
  991. tbInsuCode.Text = "";
  992. tbCenterDirectoryFilter.Text = "%" +dr.Cells["itemDesc"].Value.ToString() + "%";
  993. tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
  994. }
  995. }
  996. }
  997. }
  998. private void dgvHISDirectory_Dict_SelectionChanged(object sender, EventArgs e)
  999. {
  1000. DataGridViewRow dr = dgvHISDirectory.CurrentRow;
  1001. if (dr == null)
  1002. {
  1003. return; // 防止没有选中行
  1004. }
  1005. if (!dgvHISDirectory.Columns.Contains("InsuCode"))
  1006. {
  1007. Global.writeLog("未找到InsuCode");
  1008. // 可以在这里调试:打印所有列名
  1009. foreach (DataGridViewColumn col in dgvHISDirectory.Columns)
  1010. {
  1011. System.Diagnostics.Debug.WriteLine($"列名: {col.Name}");
  1012. Global.writeLog($"列名: {col.Name},值:{dr.Cells[col.Name].Value}");
  1013. }
  1014. return;
  1015. }
  1016. // 先检查列是否存在
  1017. DataGridViewCell cell = dr.Cells["InsuCode"];
  1018. if (cell == null || cell.Value == null || cell.Value == DBNull.Value)
  1019. {
  1020. return;
  1021. }
  1022. if (cell != null)
  1023. {
  1024. if (cell.Value.ToString() != "")
  1025. {
  1026. tbInsuCode.Text = cell.Value.ToString();
  1027. tbCenterDirectoryFilter.Text = "";
  1028. tbApprovalNO.Text = "";
  1029. }
  1030. else
  1031. {
  1032. tbInsuCode.Text = "";
  1033. tbInsuCode.Text = "";
  1034. tbApprovalNO.Text = "";
  1035. //tbCenterDirectoryFilter.Text = "%" + dr.Cells["descripts"].Value.ToString() + "%";
  1036. tbCenterDirectoryFilter.Text = dr.Cells["descripts"].Value.ToString() ;
  1037. //if (rbOnlyName.Checked)
  1038. //{
  1039. // tbInsuCode.Text = "";
  1040. // tbApprovalNO.Text = "";
  1041. // tbCenterDirectoryFilter.Text = "%" + dr.Cells["descripts"].Value.ToString() + "%";
  1042. //}
  1043. //if (rbOnlyApprNO.Checked)
  1044. //{
  1045. // tbCenterDirectoryFilter.Text = "";
  1046. // tbInsuCode.Text = "";
  1047. // tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
  1048. //}
  1049. //if (rbBoth.Checked)
  1050. //{
  1051. // tbInsuCode.Text = "";
  1052. // tbCenterDirectoryFilter.Text = "%" + dr.Cells["itemDesc"].Value.ToString() + "%";
  1053. // tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
  1054. //}
  1055. }
  1056. }
  1057. }
  1058. private void ckbCryQuery_CheckedChanged(object sender, EventArgs e)
  1059. {
  1060. if (ckbCryQuery.Checked)
  1061. {
  1062. gbCryLocaled.Enabled = true;
  1063. }
  1064. else
  1065. {
  1066. dblkCYL.Text = "";
  1067. dblkPD.Text = "";
  1068. gbCryLocaled.Enabled = false;
  1069. }
  1070. }
  1071. private void dblkCYL_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  1072. {
  1073. DataGridViewRow row = e.Value as DataGridViewRow;
  1074. DataRowView dataRow = row.DataBoundItem as DataRowView;
  1075. cylCode = dataRow["Code"].ToString().Trim();
  1076. cylName = dataRow["Name"].ToString().Trim();
  1077. }
  1078. private void dblkPD_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  1079. {
  1080. DataGridViewRow row = e.Value as DataGridViewRow;
  1081. DataRowView dataRow = row.DataBoundItem as DataRowView;
  1082. pdCode = dataRow["Code"].ToString().Trim();
  1083. pdName = dataRow["Name"].ToString().Trim();
  1084. }
  1085. }
  1086. }