| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252 |
-
- using Microsoft.Office.Core;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using PTMedicalInsurance.Business;
- using PTMedicalInsurance.Common;
- using PTMedicalInsurance.Forms.BasicDatas.services;
- using PTMedicalInsurance.FormSetter;
- using PTMedicalInsurance.Helper;
- using PTMedicalInsurance.Variables;
- using Sunny.UI;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using DataTable = System.Data.DataTable;
- using Global = PTMedicalInsurance.Variables.Global;
- namespace PTMedicalInsurance.Forms.BasicDatas
- {
- public partial class DirectoryMap : Form
- {
- private Form mainForm;
- MIIrisServices mIS = new MIIrisServices();
- HisIrisServices hIS = new HisIrisServices();
- InvokeHelper invoker = new InvokeHelper();
- private HisDirectoryCategoryEnum hisDirectoryCategory;
- private MapFlagEnum mapFlag;
- private int pageSize = 50;
- private int currentPage = 1;
- private string sortColumn = "Code";
- private DirectoryMapService directoryMapService = new DirectoryMapService();
- private GridViewSetter gvdSetter = new GridViewSetter();
- private string errMsg;
- private string directoryCategoryDesc; //目录大类中文说明,配合目录导出使用
- private string mapFlagDesc; //对照标志中文说明,配合目录导出使用
- private string cylCode; //柱镜度数编码
- private string cylName;
- private string pdCode; //棱镜度数编码
- private string pdName;
- public DirectoryMap()
- {
- InitializeComponent();
- }
- public DirectoryMap(Form frm)
- {
- InitializeComponent();
- InitForm(frm);
- }
- ///// <summary>
- ///// 标题设置映射字典
- ///// </summary>
- //private Dictionary<HisDirectoryCategoryEnum, string> miDirHeaderTextJsonFileMap = new Dictionary<HisDirectoryCategoryEnum, string>
- //{
- // { HisDirectoryCategoryEnum.none, "Map_MiDir_Default.json" }, //对照界面中心目录药品
- // { HisDirectoryCategoryEnum.drugs, "Map_MiDir_Drug.json" }, //对照界面中心目录药品
- // { HisDirectoryCategoryEnum.diagnosi, "Map_MiDir_MedicalService.json" },//对照界面中心目录诊疗
- // { HisDirectoryCategoryEnum.consumables, "Map_MiDir_Consumables.json" },//对照界面中心目录材料
- // { HisDirectoryCategoryEnum.usedFreq, "Map_MiDir_UsedFreq.json" },//对照界面使用频次
- // { HisDirectoryCategoryEnum.medcWay, "Map_MiDir_MedcWay.json" },//对照界面用法
- //};
- ///// <summary>
- ///// 标题设置映射字典
- ///// </summary>
- //private Dictionary<HisDirectoryCategoryEnum, string> hisDirHeaderTextJsonFileMap = new Dictionary<HisDirectoryCategoryEnum, string>
- //{
- // { HisDirectoryCategoryEnum.none, "Map_HisDir_Default.json" }, //对照界面中心目录药品
- // { HisDirectoryCategoryEnum.drugs, "Map_HisDir_Drug.json" }, //对照界面HIS目录药品
- // { HisDirectoryCategoryEnum.diagnosi, "Map_HisDir_MedicalService.json" },//对照界面HIS目录诊疗
- // { HisDirectoryCategoryEnum.consumables, "Map_HisDir_Consumables.json" },//对照界面HIS目录材料
- // { HisDirectoryCategoryEnum.usedFreq, "Map_HisDir_UsedFreq.json" },//对照界面使用频次
- // { HisDirectoryCategoryEnum.medcWay, "Map_HisDir_MedcWay.json" },//对照界面用法
- //};
- private static Dictionary<HisDirectoryCategoryEnum, string> BuildMap(string prefix)
- {
- // 使用 typeof 获取类型,然后 Cast 回枚举类型
- return Enum.GetValues(typeof(HisDirectoryCategoryEnum))
- .Cast<HisDirectoryCategoryEnum>()
- .ToDictionary(
- e => e,
- e => $"Map_{prefix}_{e}.json"
- );
- }
- // 调用方式不变
- private Dictionary<HisDirectoryCategoryEnum, string> miDirHeaderTextJsonFileMap = BuildMap("MiDir");
- private Dictionary<HisDirectoryCategoryEnum, string> hisDirHeaderTextJsonFileMap = BuildMap("HisDir");
- private void InitForm(Form frm)
- {
- mainForm = frm;
- CheckForIllegalCrossThreadCalls = false;
- // 禁用关闭按钮
- this.FormBorderStyle = FormBorderStyle.None;
- // 隐藏标题栏
- this.ControlBox = false;
- // 其他可能需要的配置
- this.TopLevel = false;
- this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性
- //设置HIS字典晶体编码
- SetHisDictonaryCombox(ref dblkCYL, "CrystalDegree");
- SetHisDictonaryCombox(ref dblkPD, "CylindricalDegree");
- //
- rbgDirecType_C.SelectedIndex = 0;
- rbOnlyName.Checked = rbAll.Checked = true;
- //
- gvdSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
- //
- dgvCenterDirectory.DataError += directoryMapService.dataGridView_DataError;
- }
- #region
- #region 控件设置
-
- private JArray ConvertHisDicToStandardInsuDic(JArray jaHis)
- {
- if (jaHis == null || jaHis.Count == 0)
- return new JArray(); // 或 return null; 根据调用方约定
- var jaInsu = new JArray();
- foreach (JObject joHis in jaHis)
- {
- var joInsu = new JObject
- {
- //["Code"] = joHis["code"]?.ToString(),
- //HIS需要ID
- ["Code"] = joHis["id"]?.ToString(),
- ["Name"] = joHis["descripts"]?.ToString(),
- ["SearchCode"] = joHis["descriptsSPCode"]?.ToString()
- };
- jaInsu.Add(joInsu);
- }
- return jaInsu;
- }
- private void SetHisDictonaryCombox(ref PTControl.DBLookupCombox dblcbx,string dictType)
- {
- ComboxSetter comboxSetter = new ComboxSetter();
- DataTable dt = comboxSetter.GetDBLKComboxTable(ConvertHisDicToStandardInsuDic(hIS.QueryHisDictionary(dictType, "")));
- comboxSetter.SetDBLKCombox(ref dblcbx,dt);
- }
- private void SetHisDirectoryCategory()
- {
-
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- hisDirectoryCategory = HisDirectoryCategoryEnum.drugs;
- directoryCategoryDesc = "药品";
- break;
- case 1:
- hisDirectoryCategory = HisDirectoryCategoryEnum.medicalServices;
- directoryCategoryDesc = "诊疗";
- break;
- case 2:
- hisDirectoryCategory = HisDirectoryCategoryEnum.consumables;
- directoryCategoryDesc = "材料";
-
- break;
- case 3:
- hisDirectoryCategory = HisDirectoryCategoryEnum.Frequence;
- directoryCategoryDesc = "使用频次";
- break;
- case 4:
- hisDirectoryCategory = HisDirectoryCategoryEnum.Usage;
- directoryCategoryDesc = "用药途径(用法)";
- break;
- default:
- hisDirectoryCategory = HisDirectoryCategoryEnum.none;
- break;
- }
- if (hisDirectoryCategory != HisDirectoryCategoryEnum.consumables)
- {
- ckbCryQuery.Enabled = false;
- ckbCryQuery.Checked = false;
- }
- else
- {
- ckbCryQuery.Enabled = true;
- }
- }
- private void SetMapFlag()
- {
- if (rbAll.Checked)
- {
- mapFlag = MapFlagEnum.All;
- mapFlagDesc = "全部";
- sortColumn = "Code";
- }
- else if (rbMaped.Checked)
- {
- mapFlag = MapFlagEnum.Mapped;
- mapFlagDesc = "已对照";
- sortColumn = "HisCode";
- }
- else if (rbNoMaped.Checked)
- {
- mapFlag = MapFlagEnum.NoMapped;
- mapFlagDesc = "未对照";
- sortColumn = "Code";
- }
- else
- {
- mapFlag = MapFlagEnum.None;
- mapFlagDesc = "未知";
- sortColumn = "Code";
- }
- }
- #endregion
- #region 获取入参
- private JObject GetHisDictInput()
- {
- return hIS.GetHisDictInput(hisDirectoryCategory.ToString(),"");
- }
- private JObject GetHisDirInput()
- {
- JArray jaPagination = new JArray();
- JArray jaParams = new JArray();
- string flag = "All";
- dynamic joParam = new JObject();
- joParam.code = "";
- joParam.descripts = "";
- joParam.FindType = new JArray();
- joParam.TypeID = "";
- joParam.alias = tbHISDirectoryFilter.Text;
- joParam.include = "Hosp";
- joParam.groupID = "324";
- joParam.hospID = Global.inf.hisHospitalDr;
- joParam.interfaceDr = Global.inf.interfaceDr;
- //type 增加类型IOL(人工晶状体),params节点增加 CrystalDegree 柱镜度数 CylindricalDegree 棱镜度数,当且仅当type为IOL时才判断这两个入参的值。并返回符合条件的晶体
- //当ytpe为IOL 时,只搜索晶体。1.code 为空,CrystalDegree 为空,CylindricalDegree 为空,返回所有晶体数据 2.code 为空,CrystalDegree 有值a,CylindricalDegree 为空,返回所有柱镜度数为a的晶体 3.code 为空,CrystalDegree 为空,CylindricalDegree 有值,报错,棱镜度数有值,柱镜度数必须有值 4.code 为空,CrystalDegree 有值a,CylindricalDegree 有值b,返回所有柱镜度数为a,棱镜度数为b的晶体
- //5.code有值 a,参考上述逻辑,再返回code为a的所有晶体数据 6.CrystalDegree ,CylindricalDegree 传返回的id
- if ((hisDirectoryCategory == HisDirectoryCategoryEnum.consumables) && ckbCryQuery.Checked)
- {
- joParam.type = "IOL";
- joParam.CrystalDegree = cylCode;
- joParam.CylindricalDegree = pdCode;
- }
- else
- {
- joParam.type = hisDirectoryCategory.ToString();
- }
-
- joParam.flag = mapFlag.ToString();
- joParam.specInput = txtSpecFilter.Text.Trim();
- jaParams.Add(joParam);
- dynamic joPagination = new JObject();
- joPagination.pageSize = pageSize;
- //joPagination.pageSize = 2;
- joPagination.currentPage = currentPage;
- joPagination.sortColumn = sortColumn;
- joPagination.sortOrder = "asc";
- jaPagination.Add(joPagination);
- JObject joRtn = new JObject();
- joRtn.Add("params", jaParams);
- joRtn.Add("pagination",jaPagination);
- return joRtn;
- }
- private JObject GetInsuDirInput()
- {
- JObject joInput = new JObject {
- { "currentPage" , currentPage },
- { "pageSize" , pageSize },
- { "serviceCode" , "09010042" },
- { "directoryType" , (int)hisDirectoryCategory },
- { "directoryCode" , tbInsuCode.Text },
- { "directoryName" , tbCenterDirectoryFilter.Text },
- { "approvalNO" , tbApprovalNO.Text },
- { "dosageForm" , tbDosageForm.Text },
- { "specifications" , tbSpecifications.Text },
- { "manufacturers" , tbManufacturer.Text },
- { "directoryDr" , Global.inf.interfaceDr }
- };
- return joInput;
- }
- private string GetDictTypeCode()
- {
- switch (hisDirectoryCategory)
- {
- case HisDirectoryCategoryEnum.none:
- case HisDirectoryCategoryEnum.drugs:
- case HisDirectoryCategoryEnum.medicalServices:
- case HisDirectoryCategoryEnum.consumables:
-
- return "N/A";
- case HisDirectoryCategoryEnum.Frequence:
- return "USED_FRQU";
- case HisDirectoryCategoryEnum.Usage:
- return "MEDC_WAY";
- default:
- return "N/A";
- }
- }
- private JObject GetInsuDictInput()
- {
- JObject joInput = new JObject {
- { "currentPage" , currentPage },
- { "pageSize" , pageSize },
- { "serviceCode" , "09010043" },
- { "directoryType" , 9 },
- { "directoryCode" , GetDictTypeCode() },
- { "directoryName" , tbCenterDirectoryFilter.Text },
- { "approvalNO" , "" },
- { "dosageForm" , "" },
- { "specifications" , "" },
- { "manufacturers" , "" },
- { "directoryDr" , Global.inf.interfaceDr }
- };
- return joInput;
- }
- /// <summary>
- /// 获取更新医保信息的入参
- /// </summary>
- /// <param name="Index"></param>
- /// <param name="frm"></param>
- /// <param name="trade"></param>
- /// <returns></returns>
- private JObject GetUpdateInsuInfoInput(int Index, UpdateDirecotryCondition frm, out TradeEnum trade)
- {
- trade = TradeEnum.MedicalServiceDirectory;
- dynamic joData = new JObject();
- switch (Index)
- {
- case 14://民族药品目
- {
- trade = TradeEnum.NationalityDrug;
- joData.med_list_codg = frm.Code; //医疗目录编码
- joData.genname_codg = ""; //通用名编号
- joData.drug_genname = ""; //药品通用名
- joData.drug_prodname = frm.Name; //药品商品名
- joData.reg_name = ""; //注册名称
- joData.tcmherb_name = ""; //中草药名称
- joData.mlms_name = ""; //药材名称
- joData.vali_flag = ""; //有效标志
- joData.rid = ""; //唯一记录号
- joData.ver = ""; //版本号
- joData.ver_name = ""; //版本名称
- joData.opt_begn_time = ""; //经办开始时间
- joData.opt_end_time = ""; //经办结束时间
- joData.updt_time = frm.UpdateTime; //更新时间
- joData.page_num = frm.CurrentPage; //当前页数
- joData.page_size = frm.PageSize; //本页数据量
- break;
- }
- case 15://目录信息查询
- {
- trade = TradeEnum.InsuDirectory;
- joData.query_date = ""; //查询时间点
- joData.hilist_code = frm.Code; //医保目录编码
- joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.hilist_name = frm.Name; //医保目录名称
- joData.wubi = ""; //五笔助记码
- joData.pinyin = ""; //拼音助记码
- joData.med_chrgitm_type = ""; //医疗收费项目类别
- joData.chrgitm_lv = ""; //收费项目等级
- joData.lmt_used_flag = ""; //限制使用标志
- joData.list_type = ""; //目录类别
- joData.med_use_flag = ""; //医疗使用标志
- joData.matn_used_flag = ""; //生育使用标志
- joData.hilist_use_type = ""; //医保目录使用类别
- joData.lmt_cpnd_type = ""; //限复方使用类型
- joData.vali_flag = ""; //有效标志
- joData.updt_time = frm.UpdateTime; //更新时间
- joData.page_num = frm.CurrentPage; //当前页数
- joData.page_size = frm.PageSize; //本页数据量
- break;
- }
- case 16://医疗与医保目录匹配
- {
- trade = TradeEnum.MedicalAndInsuDirectory;
- joData.query_date = ""; //查询时间点
- joData.medins_list_codg = ""; //定点医药机构目录编号
- joData.hilist_code = frm.Code; //医保目录编码
- joData.list_type = ""; //目录类别
- joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.vali_flag = ""; //有效标志
- joData.updt_time = frm.UpdateTime; //更新时间
- joData.page_num = frm.CurrentPage; //当前页数
- joData.page_size = frm.PageSize; //本页数据量
- break;
- }
- case 17://医药机构目录匹配
- {
- trade = TradeEnum.MedcineOrgDirectory;
- joData.query_date = ""; //查询时间点
- joData.fixmedins_code = ""; //定点医药机构编号
- joData.medins_list_codg = ""; //定点医药机构目录编号
- joData.medins_list_name = ""; //定点医药机构目录名称
- joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
- joData.list_type = ""; //目录类别
- joData.med_list_codg = frm.Code; //医疗目录编码
- joData.begndate = ""; //开始日期
- joData.vali_flag = ""; //有效标志
- joData.updt_time = frm.UpdateTime; //更新时间
- joData.page_num = frm.CurrentPage; //当前页数
- joData.page_size = frm.PageSize; //本页数据量
- break;
- }
- case 18://医保目录限价
- {
- trade = TradeEnum.InsuPriceLimitDirectory;
- joData.query_date = ""; //查询时间点
- joData.hilist_code = frm.Code; //医保目录编码
- joData.hilist_lmtpric_type = ""; //医保目录限价类型
- joData.overlmt_dspo_way = ""; //医保目录超限处理方式
- joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.enddate = ""; //结束日期
- joData.vali_flag = ""; //有效标志
- joData.rid = ""; //唯一记录号
- joData.tabname = ""; //表名
- joData.poolarea_no = ""; //统筹区
- joData.updt_time = frm.UpdateTime; //更新时间
- joData.page_num = frm.CurrentPage; //当前页数
- joData.page_size = frm.PageSize; //本页数据量
- break;
- }
- case 19://医保目录先自付比例
- {
- trade = TradeEnum.PrepayPercentDirectory;
- joData.query_date = ""; //查询时间点
- joData.hilist_code = frm.Code; //医保目录编码
- joData.selfpay_prop_psn_type = "";//医保目录自付比例人员类别
- joData.selfpay_prop_type = ""; //目录自付比例类别
- joData.insu_admdvs = frm.InsuAdmDvs; //参保机构医保区划
- joData.begndate = ""; //开始日期
- joData.enddate = ""; //结束日期
- joData.vali_flag = ""; //有效标志
- joData.rid = ""; //唯一记录号
- joData.tabname = ""; //表名
- joData.poolarea_no = ""; //统筹区
- joData.updt_time = frm.UpdateTime; //更新时间
- joData.page_num = frm.CurrentPage; //当前页数
- joData.page_size = frm.PageSize; //本页数据量
- break;
- }
- }
- return joData;
- }
- #endregion
- #region 查询
- private void Query()
- {
- dgvHISDirectory.SelectionChanged -= dgvHISDirectory_SelectionChanged;
- try
- {
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- case 1:
- case 2:
- QueryDirectory();
- break;
- case 3:
- case 4://查询HIS的字典数据,暂无分页
- QueryDictionary();
- break;
- default:
- break;
- }
- }
- catch (Exception)
- {
- throw;
- }
- finally
- {
- dgvHISDirectory.SelectionChanged += dgvHISDirectory_SelectionChanged;
- }
- }
- private void QueryDirectory()
- {
- JObject joRtn = new JObject();
- joRtn = directoryMapService.QueryDirectory(GetHisDirInput(), mapFlag);
- if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- }
- else
- {
- DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
- pgHISDirect.TotalCount = totalCount;
- pgHISDirect.PageSize = pageSize;
- dgvHISDirectory.DataSource = dt;
- if (directoryMapService.SetDgvDirectoryHeader(hisDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvHISDirectory, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
-
- dgvHISDirectory.Columns[0].ReadOnly = true;
-
- }
- }
- private void QueryDictionary()
- {
- JObject joRtn = new JObject();
- joRtn = directoryMapService.QueryDictionary(GetHisDictInput(), mapFlag,GetDictTypeCode());
- if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- }
- else
- {
- DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
- pgHISDirect.PageSize = pageSize;
- dgvHISDirectory.DataSource = dt;
- if (directoryMapService.SetDgvDirectoryHeader(hisDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvHISDirectory, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
- dgvHISDirectory.Columns[0].ReadOnly = true;
- }
- }
- private void QueryMi()
- {
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- case 1:
- case 2:
- QueryMiDirectory();
- break;
- case 3:
- case 4://查询HIS的字典数据,暂无分页
- QueryMiDictionary();
- break;
- default:
- break;
- }
- }
- private void QueryMiDirectory()
- {
- JObject joRtn = new JObject();
- joRtn = directoryMapService.QueryMiDirectory(GetInsuDirInput());
- if (joRtn["errorCode"].ToString() != "0")
- {
- MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
- return;
- }
- if (joRtn["result"]["rows"] == null)
- {
- MessageBox.Show("该节点不存在");
- return;
- }
- if (joRtn["result"]["total"].ToString() == "0")
- {
- MessageBox.Show("未查询到数据");
- dgvCenterDirectory.DataSource = null;
- return;
- }
-
- DataTable dt = (DataTable)joRtn["result"]["rows"].ToObject(typeof(DataTable));
- int totalCount = int.Parse(joRtn["result"]["total"].ToString());
- pgCenterDirect.TotalCount = totalCount;
- pgCenterDirect.PageSize = pageSize;
- dgvCenterDirectory.DataSource = dt;
- if (directoryMapService.SetDgvDirectoryHeader(miDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvCenterDirectory, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
- dgvCenterDirectory.Columns[0].ReadOnly = true;
- }
- private void QueryMiDictionary()
- {
- JObject joRtn = new JObject();
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- case 1:
- case 2:
- joRtn = directoryMapService.QueryMiDirectory(GetInsuDirInput());
- break;
- case 3:
- case 4://查询HIS的字典数据,暂无分页
- joRtn = directoryMapService.QueryMiDictionary(GetInsuDictInput());
- break;
- default:
- break;
- }
- if (joRtn["errorCode"].ToString() != "0")
- {
- MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
- return;
- }
- if (joRtn["result"]["rows"] == null)
- {
- MessageBox.Show("该节点不存在");
- return;
- }
- if (joRtn["result"]["total"].ToString() == "0")
- {
- MessageBox.Show("未查询到数据");
- dgvCenterDirectory.DataSource = null;
- return;
- }
- DataTable dt = (DataTable)joRtn["result"]["rows"].ToObject(typeof(DataTable));
- int totalCount = int.Parse(joRtn["result"]["total"].ToString());
- pgCenterDirect.TotalCount = totalCount;
- pgCenterDirect.PageSize = pageSize;
- dgvCenterDirectory.DataSource = dt;
- if (directoryMapService.SetDgvDirectoryHeader(miDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), dgvCenterDirectory, out errMsg) != 0)
- {
- MessageBox.Show(errMsg);
- return;
- }
- dgvCenterDirectory.Columns[0].ReadOnly = true;
- }
- #endregion
- #region 对照
- private void Mapping()
- {
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- case 1:
- case 2:
- DirectoryMapping();
- break;
- case 3:
- case 4://查询HIS的字典数据,暂无分页
- DictionaryMapping();
- break;
- default:
- break;
- }
- }
- private void DictionaryMapping()
- {
- int iHis = dgvHISDirectory.CurrentRow.Index;
- if (dgvCenterDirectory.CurrentRow == null)
- {
- MessageBox.Show("请查询中心目录");
- return;
- }
- int iCenter = dgvCenterDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
- dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["code"].Value.ToString();
- dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["descripts"].Value.ToString();
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["code"].Value;
- jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["descripts"].Value;
- jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["id"];
- jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["dictionaryDataDetailID"];
- //1.已对照 2.已对照但未上传 3 已对照且已上传
- jsonTemp.State = 1;
- jsonTemp.HisType = $"DIC-{GetDictTypeCode()}";
- jsonTemp.HisTypeName = rbgDirecType_C.Items[(int)hisDirectoryCategory - 1].ToString();
- jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["code"].Value;
- jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["descripts"].Value;
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010040");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
- //JObject joRtn = JObject.Parse(irisRtn);
- if ((int)joRtn["errorCode"] == 0)
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
- //dgvHISDirectory.Rows[iHis].Cells["MapID"].Value =joRtn["data"]["mapID"].ToString();
- //dtHis.Rows[iHis]["MapID"] = joRtn["data"]["mapID"].ToString();
- }
- else
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
- }
- }
- private void DirectoryMapping()
- {
- int iHis = dgvHISDirectory.CurrentRow.Index;
- if (dgvCenterDirectory.CurrentRow == null)
- {
- MessageBox.Show("请查询中心目录");
- return;
- }
- int iCenter = dgvCenterDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- DataTable dtCenter = (DataTable)dgvCenterDirectory.DataSource;
- dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Code"].Value.ToString();
- dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = dgvCenterDirectory.Rows[iCenter].Cells["Name"].Value.ToString();
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
- jsonTemp.HISName = dgvHISDirectory.Rows[iHis].Cells["itemDesc"].Value;
- jsonTemp.ChargeItemDr = dtHis.Rows[iHis]["ID"];
- jsonTemp.DiretoryDr = dtCenter.Rows[iCenter]["medInsuDirectoryID"];
- //1.已对照 2.已对照但未上传 3 已对照且已上传
- jsonTemp.State = 1;
- jsonTemp.HisType = (int)hisDirectoryCategory;
- jsonTemp.HisTypeName = rbgDirecType_C.Items[(int)hisDirectoryCategory - 1].ToString();
- jsonTemp.InsuCode = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Code"].Value;
- jsonTemp.InsuName = dgvCenterDirectory.Rows[dgvCenterDirectory.CurrentRow.Index].Cells["Name"].Value;
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010040");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "插入对照信息");
- //JObject joRtn = JObject.Parse(irisRtn);
- if ((int)joRtn["errorCode"] == 0)
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "已对照";
- //dgvHISDirectory.Rows[iHis].Cells["MapID"].Value = joRtn["data"]["mapID"].ToString();
- //dtHis.Rows[iHis]["MapID"] = joRtn["data"]["mapID"].ToString();
- }
- else
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
- }
- }
- private void CancelMapping()
- {
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- case 1:
- case 2:
- CancelDirectoryMapping();
- break;
- case 3:
- case 4://查询HIS的字典数据,暂无分页
- CancelDictionaryMapping();
- break;
- default:
- break;
- }
- }
- private void CancelDirectoryMapping()
- {
- int iHis = dgvHISDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["itemCode"].Value;
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010041");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
- if ((int)joRtn["errorCode"] == 0)
- {
- dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["MapID"].Value = 0;
- }
- else
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
- }
- }
- private void CancelDictionaryMapping()
- {
- int iHis = dgvHISDirectory.CurrentRow.Index;
- DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
- JArray jaParams = new JArray();
- dynamic jsonTemp = new JObject();
- jsonTemp.ID = dtHis.Rows[iHis]["MapID"];
- jsonTemp.HospitalDr = Global.inf.hospitalDr;
- jsonTemp.updateUserID = Global.user.ID;
- jsonTemp.InterfaceDr = Global.inf.interfaceDr;
- jsonTemp.HISCode = dgvHISDirectory.Rows[iHis].Cells["code"].Value;
- jsonTemp.UpdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
- jaParams.Add(jsonTemp);
- JObject joIn = new JObject();
- joIn.Add(new JProperty("params", jaParams));
- joIn.Add("code", "09010041");
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeInsuService(joIn.ToString(), "取消对照");
- if ((int)joRtn["errorCode"] == 0)
- {
- dgvHISDirectory.Rows[iHis].Cells["insuCode"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["insuName"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "";
- dgvHISDirectory.Rows[iHis].Cells["MapID"].Value = 0;
- }
- else
- {
- dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
- }
- }
- #endregion
- #region 导出
- private int queryExportData_CallBack(DataLoaderContext context, out string errMsg)
- {
- errMsg = "";
- return 0;
- }
-
- #endregion
- #region 批量更新
- private void batchUpdateMappedInsuInfo(int index)
- {
- //获取入参条件
- TradeEnum trade;
- JObject joCondition = new JObject();
- UpdateDirecotryCondition updateDirecotryCondition = new UpdateDirecotryCondition();
- if (updateDirecotryCondition.ShowDialog() == DialogResult.Cancel)
- {
- //MessageBox.Show("");
- return;
- }
- else
- {
- joCondition = GetUpdateInsuInfoInput(index,updateDirecotryCondition,out trade);
- joCondition.Add("funno", trade.GetCode());
- }
-
-
- //查表
- string sqlStr = $"select * from HB_MedInsuMapRelation where Interface_Dr='{Global.inf.interfaceDr}' and Hospital_Dr ='{Global.inf.hospitalDr}'";
- JObject joSqlstr = new JObject();
- joSqlstr.Add("sqlStr", sqlStr);
- JObject joRtn = mIS.QueryMappedData(joSqlstr, "查询所有已对照数据");
- JObject joResult = JObject.FromObject(joRtn["result"]);
- joResult.Add("condition", joCondition);
- directoryMapService.batchUpdateMappedInsuInfo(joResult, this);
- }
- #endregion
- #endregion
- private void btTripMenu_Click(object sender, EventArgs e)
- {
- cmsIntegratedMenu.Show(((Sunny.UI.UIButton)sender), new Point(0, btTripMenu.Height));
- }
- private void rbgDirecType_C_ValueChanged(object sender, int index, string text)
- {
- SetHisDirectoryCategory();
- }
- private void rbAll_ValueChanged(object sender, bool value)
- {
- SetMapFlag();
- }
- private void btnQueryHISDirectory_Click(object sender, EventArgs e)
- {
- currentPage = 1;
-
- Query();
- }
- private void tsmExportAllMappedData_Click(object sender, EventArgs e)
- {
- MessageBox.Show("请点击按左侧类别导出!");
- }
- private void tsmExportMappedDataByLeft_Click(object sender, EventArgs e)
- {
- ProgressWrapper _dataLoader;
- _dataLoader = new ProgressWrapper(queryExportData_CallBack, this);
- _dataLoader.SetProgressBar(ProgressBarStyle.Marquee, "正在导出...", 50);
- _dataLoader.Start(new object[] { 0 }, (result, errMsg) =>
- {
- // 在这里处理结果和错误信息
- if (result == 0)
- {
- MessageBox.Show(errMsg);
- }
- else
- {
- MessageBox.Show(errMsg);
- }
- });
- }
- private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
- {
- //当两者均为1说明点击的是查询按钮
- if (!((currentPage == 1) && (pageIndex == 1)))
- {
- currentPage = pageIndex;
- Query();
- }
-
- }
- private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
- {
- currentPage = 1;
- QueryMi();
- }
- private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
- {
- if (!((currentPage == 1) && (pageIndex == 1)))
- {
- currentPage = pageIndex;
- QueryMi();
- }
- }
- private void tsmiMapping_Click(object sender, EventArgs e)
- {
- Mapping();
- }
- private void tsmiCancleMapping_Click(object sender, EventArgs e)
- {
- CancelMapping();
- }
- private void tsmUpdateCellPriceOfAllMapped_Click(object sender, EventArgs e)
- {
- batchUpdateMappedInsuInfo(18);
- }
- private void btSetCenterDirHeaderText_Click(object sender, EventArgs e)
- {
- //获取数据源
- DataGridViewHeaderSetForm frm = new DataGridViewHeaderSetForm(miDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), (DataTable)dgvCenterDirectory.DataSource);
- frm.StartPosition = FormStartPosition.CenterParent;
- if (frm.ShowDialog() == DialogResult.OK)
- {
- }
- }
- private void btSetHisDirHeaderText_Click(object sender, EventArgs e)
- {
- //获取数据源
- DataGridViewHeaderSetForm frm = new DataGridViewHeaderSetForm(hisDirHeaderTextJsonFileMap.GetValue(hisDirectoryCategory), (DataTable)dgvHISDirectory.DataSource);
- frm.StartPosition = FormStartPosition.CenterParent;
- if (frm.ShowDialog() == DialogResult.OK)
- {
- }
- }
- private void dgvHISDirectory_SelectionChanged(object sender, EventArgs e)
- {
- switch (rbgDirecType_C.SelectedIndex)
- {
- case 0:
- case 1:
- case 2:
- dgvHISDirectory_directory_SelectionChanged(sender,e);
- break;
- case 3:
- case 4://查询HIS的字典数据,暂无分页
- dgvHISDirectory_Dict_SelectionChanged(sender, e);
- break;
- default:
- break;
- }
- }
- private void dgvHISDirectory_directory_SelectionChanged(object sender, EventArgs e)
- {
- DataGridViewRow dr = dgvHISDirectory.CurrentRow;
- if (dr == null)
- {
- return; // 防止没有选中行
- }
- if (!dgvHISDirectory.Columns.Contains("InsuCode"))
- {
- Global.writeLog("未找到InsuCode");
- // 可以在这里调试:打印所有列名
- foreach (DataGridViewColumn col in dgvHISDirectory.Columns)
- {
- System.Diagnostics.Debug.WriteLine($"列名: {col.Name}");
- Global.writeLog($"列名: {col.Name},值:{dr.Cells[col.Name].Value}");
-
- }
- return;
- }
- // 先检查列是否存在
- DataGridViewCell cell = dr.Cells["InsuCode"];
- if (cell == null || cell.Value == null || cell.Value == DBNull.Value)
- {
- return;
- }
- if (cell != null)
- {
- if (cell.Value.ToString() != "")
- {
- tbInsuCode.Text = cell.Value.ToString();
- tbCenterDirectoryFilter.Text = "";
- tbApprovalNO.Text = "";
- }
- else
- {
- tbInsuCode.Text = "";
- if (rbOnlyName.Checked)
- {
- tbInsuCode.Text = "";
- tbApprovalNO.Text = "";
- tbCenterDirectoryFilter.Text = "%" + dr.Cells["itemDesc"].Value.ToString() + "%";
- }
- if (rbOnlyApprNO.Checked)
- {
- tbCenterDirectoryFilter.Text = "";
- tbInsuCode.Text = "";
- tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
- }
- if (rbBoth.Checked)
- {
- tbInsuCode.Text = "";
- tbCenterDirectoryFilter.Text = "%" +dr.Cells["itemDesc"].Value.ToString() + "%";
- tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
- }
- }
- }
- }
- private void dgvHISDirectory_Dict_SelectionChanged(object sender, EventArgs e)
- {
- DataGridViewRow dr = dgvHISDirectory.CurrentRow;
- if (dr == null)
- {
- return; // 防止没有选中行
- }
- if (!dgvHISDirectory.Columns.Contains("InsuCode"))
- {
- Global.writeLog("未找到InsuCode");
- // 可以在这里调试:打印所有列名
- foreach (DataGridViewColumn col in dgvHISDirectory.Columns)
- {
- System.Diagnostics.Debug.WriteLine($"列名: {col.Name}");
- Global.writeLog($"列名: {col.Name},值:{dr.Cells[col.Name].Value}");
- }
- return;
- }
- // 先检查列是否存在
- DataGridViewCell cell = dr.Cells["InsuCode"];
- if (cell == null || cell.Value == null || cell.Value == DBNull.Value)
- {
- return;
- }
- if (cell != null)
- {
- if (cell.Value.ToString() != "")
- {
- tbInsuCode.Text = cell.Value.ToString();
- tbCenterDirectoryFilter.Text = "";
- tbApprovalNO.Text = "";
- }
- else
- {
- tbInsuCode.Text = "";
- tbInsuCode.Text = "";
- tbApprovalNO.Text = "";
- //tbCenterDirectoryFilter.Text = "%" + dr.Cells["descripts"].Value.ToString() + "%";
- tbCenterDirectoryFilter.Text = dr.Cells["descripts"].Value.ToString() ;
- //if (rbOnlyName.Checked)
- //{
- // tbInsuCode.Text = "";
- // tbApprovalNO.Text = "";
- // tbCenterDirectoryFilter.Text = "%" + dr.Cells["descripts"].Value.ToString() + "%";
- //}
- //if (rbOnlyApprNO.Checked)
- //{
- // tbCenterDirectoryFilter.Text = "";
- // tbInsuCode.Text = "";
- // tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
- //}
- //if (rbBoth.Checked)
- //{
- // tbInsuCode.Text = "";
- // tbCenterDirectoryFilter.Text = "%" + dr.Cells["itemDesc"].Value.ToString() + "%";
- // tbApprovalNO.Text = "%" + dr.Cells["pprovalNo"].Value.ToString() + "%";
- //}
- }
- }
- }
- private void ckbCryQuery_CheckedChanged(object sender, EventArgs e)
- {
- if (ckbCryQuery.Checked)
- {
- gbCryLocaled.Enabled = true;
- }
- else
- {
- dblkCYL.Text = "";
- dblkPD.Text = "";
- gbCryLocaled.Enabled = false;
- }
- }
- private void dblkCYL_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
- {
- DataGridViewRow row = e.Value as DataGridViewRow;
- DataRowView dataRow = row.DataBoundItem as DataRowView;
- cylCode = dataRow["Code"].ToString().Trim();
- cylName = dataRow["Name"].ToString().Trim();
- }
- private void dblkPD_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
- {
- DataGridViewRow row = e.Value as DataGridViewRow;
- DataRowView dataRow = row.DataBoundItem as DataRowView;
- pdCode = dataRow["Code"].ToString().Trim();
- pdName = dataRow["Name"].ToString().Trim();
- }
-
- }
- }
|