using Newtonsoft.Json.Linq;
using PTMedicalInsurance.Business;
using PTMedicalInsurance.Common;
using PTMedicalInsurance.Forms.BasicDatas.services;
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.Reflection;
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();
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; //对照标志中文说明,配合目录导出使用
public DirectoryMap()
{
InitializeComponent();
}
public DirectoryMap(Form frm)
{
InitializeComponent();
InitForm(frm);
}
///
/// 标题设置映射字典
///
private Dictionary miDirHeaderTextJsonFileMap = new Dictionary
{
{ HisDirectoryCategoryEnum.none, "Map_MiDir_Default.json" }, //对照界面中心目录药品
{ HisDirectoryCategoryEnum.drugs, "Map_MiDir_Drug.json" }, //对照界面中心目录药品
{ HisDirectoryCategoryEnum.diagnosi, "Map_MiDir_MedicalService.json" },//对照界面中心目录诊疗
{ HisDirectoryCategoryEnum.consumables, "Map_MiDir_Consumables.json" },//对照界面中心目录材料
};
///
/// 标题设置映射字典
///
private Dictionary hisDirHeaderTextJsonFileMap = new Dictionary
{
{ 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目录材料
};
private void InitForm(Form frm)
{
mainForm = frm;
CheckForIllegalCrossThreadCalls = false;
// 禁用关闭按钮
this.FormBorderStyle = FormBorderStyle.None;
// 隐藏标题栏
this.ControlBox = false;
// 其他可能需要的配置
this.TopLevel = false;
this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性
//
rbgDirecType_C.SelectedIndex = 0;
rbOnlyName.Checked = rbAll.Checked = true;
//
gvdSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
//
dgvCenterDirectory.DataError += directoryMapService.dataGridView_DataError;
}
#region
#region 控件设置
private void SetHisDirectoryCategory()
{
switch (rbgDirecType_C.SelectedIndex)
{
case 0:
hisDirectoryCategory = HisDirectoryCategoryEnum.drugs;
directoryCategoryDesc = "药品";
break;
case 1:
hisDirectoryCategory = HisDirectoryCategoryEnum.diagnosi;
directoryCategoryDesc = "诊疗";
break;
case 2:
hisDirectoryCategory = HisDirectoryCategoryEnum.consumables;
directoryCategoryDesc = "材料";
break;
default:
hisDirectoryCategory = HisDirectoryCategoryEnum.none;
break;
}
}
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 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;
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 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.Desc; //药品商品名
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.Desc; //医保目录名称
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 QueryDirectory()
{
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 QueryMiDirectory()
{
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;
}
#endregion
#region 对照
private void Mapping()
{
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()
{
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 = "取消失败";
}
}
#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();
updateDirecotryCondition.StartPosition = FormStartPosition.CenterParent;
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;
QueryDirectory();
}
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;
QueryDirectory();
}
}
private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
{
currentPage = 1;
QueryMiDirectory();
}
private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
{
if (!((currentPage == 1) && (pageIndex == 1)))
{
currentPage = pageIndex;
QueryMiDirectory();
}
}
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)
{
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 tsmUpdateSelfRatioOfAllMapped_Click(object sender, EventArgs e)
{
batchUpdateMappedInsuInfo(19);
}
private void tsmUpdateLevelTypeOfAllMappedData_Click(object sender, EventArgs e)
{
batchUpdateMappedInsuInfo(15);
}
private void tsmSingleUpdateInsuInfo_Click(object sender, EventArgs e)
{
if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
{
MessageBox.Show("请查询HIS目录对照关系,注意选择已对照!");
return;
}
int iMapped = dgvHISDirectory.CurrentRow.Index;
string insuCode = dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString();
if (string.IsNullOrEmpty(insuCode))
{
MessageBox.Show("未检测到对应的医保目录,请检查该目录是否已对照!");
return;
}
JObject jo = new JObject();
UpdateDirecotryCondition updateDirecotryCondition = new UpdateDirecotryCondition();
updateDirecotryCondition.Code = dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString();
updateDirecotryCondition.StartPosition = FormStartPosition.CenterParent;
if (updateDirecotryCondition.ShowDialog() == DialogResult.Cancel)
{
//MessageBox.Show("");
return;
}
else
{
TradeEnum trade;
jo = GetUpdateInsuInfoInput(15, updateDirecotryCondition, out trade);
jo.Add("code", dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString());
jo.Add("HisType", rbgDirecType_C.SelectedIndex + 1);
jo.Add("funno", trade.GetCode());
}
string error;
if (directoryMapService.updateAuxAndCellPrice(jo, out error) != 0)
{
MessageBox.Show($"更新失败{error}");
}
else
{
MessageBox.Show("更新成功!");
}
}
delegate int UpdateInsuInfoHandler(JObject joData, out string err);
private void SingleUpdateInsuInfo(int index, UpdateInsuInfoHandler handler)
{
if (dgvHISDirectory.CurrentRow == null)
{
MessageBox.Show("请查询HIS目录对照关系!");
return;
}
int iMapped = dgvHISDirectory.CurrentRow.Index;
string insuCode = dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString();
if (string.IsNullOrEmpty(insuCode))
{
MessageBox.Show("未检测到对应的医保目录,请检查该目录是否已对照!");
return;
}
JObject jo = new JObject();
UpdateDirecotryCondition updateDirecotryCondition = new UpdateDirecotryCondition();
updateDirecotryCondition.Code = dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString();
updateDirecotryCondition.StartPosition = FormStartPosition.CenterParent;
if (updateDirecotryCondition.ShowDialog() == DialogResult.Cancel)
{
//MessageBox.Show("");
return;
}
else
{
TradeEnum trade;
jo = GetUpdateInsuInfoInput(index, updateDirecotryCondition, out trade);
jo.Add("code", dgvHISDirectory.Rows[iMapped].Cells["insuCode"].Value.ToString());
jo.Add("HisType", rbgDirecType_C.SelectedIndex + 1);
jo.Add("funno", trade.GetCode());
}
string error;
if (handler(jo, out error) != 0)
{
MessageBox.Show($"更新失败{error}");
}
else
{
MessageBox.Show("更新成功!");
}
}
private void tsmUpdateAllMapped_Click(object sender, EventArgs e)
{
MessageBox.Show("暂未开放!");
}
private void tsmUpdateSelfRatioOfAllMapped_Click_1(object sender, EventArgs e)
{
batchUpdateMappedInsuInfo(19);
}
private void tsmSingleUpdateSelfRatioInfo_Click(object sender, EventArgs e)
{
SingleUpdateInsuInfo(19, directoryMapService.updateSelfRatioInfo);
}
private void tsmSingleUpdateTypeLevelInfo_Click(object sender, EventArgs e)
{
SingleUpdateInsuInfo(15, directoryMapService.updateAuxInfo);
}
private void tsmSingleUpdateCellingPriceInfo_Click(object sender, EventArgs e)
{
SingleUpdateInsuInfo(18, directoryMapService.updateCellingPrice);
}
private void tsmImportMapRelation_Click(object sender, EventArgs e)
{
MessageBox.Show("暂未开放!");
}
}
}