using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PTMedicalInsurance.Business;
using PTMedicalInsurance.Helper;
using PTMedicalInsurance.Variables;
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 PTMedicalInsurance.FormSetter;
using PTMedicalInsurance.Common;
namespace PTMedicalInsurance.Forms
{
public partial class BasicData : Form
{
//设置实例
CenterBusiness cBus = new CenterBusiness();
HisMainBusiness hBus = new HisMainBusiness();
HisIrisServices hIS = new HisIrisServices();
MIIrisServices mIS = new MIIrisServices();
InvokeHelper invoker = new InvokeHelper();
public BasicData()
{
InitializeComponent();
rbgDirecType.SelectedIndex = 0;
rbgDirecType_C.SelectedIndex = 0;
rbgInsuDirecType_C.SelectedIndex = 0;
rbSingleDown.Checked = true;
//this.rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(this.rbgDirecType_ValueChanged);
this.pgDownload.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgDownload_PageChanged);
this.pgCenterDirect.PageChanged += new Sunny.UI.UIPagination.OnPageChangeEventHandler(this.pgCenterDirect_PageChanged);
Font rowFont = new Font("UTF-8", 8);
Font columnFont = new Font("UTF-8", 9);
rbgDirecType.SelectedIndex = 8;
rbAll.Checked = true;
GridViewSetter gvs = new GridViewSetter();
gvs.SetHeaderTextOfInsuDir(dgvInsuDirInfo);
}
#region 函数封装
private void queryInsuDirectory(int currentPage, int pageSize, int directoryType,int interfaceDr,string code)
{
try
{
string dirCode = "";
string dirName = "";
string approvalNO = "";
Sunny.UI.UIDataGridView dgv;
Sunny.UI.UIPagination pg;
if (tcBasicData.SelectedIndex == 1)
{
dirCode = tbDirectoryCode.Text;
dirName = tbDircetoryName.Text;
approvalNO = "";
dgv = dgvDirectoy;
pg = pgDownload;
}
else
{
dirName = tbCenterDirectoryFilter.Text;
dirCode = tbInsuCode.Text;
dgv = dgvCenterDirectory;
approvalNO = tbApprovalNO.Text;
pg = pgCenterDirect;
}
JObject joInput = new JObject {
{ "currentPage" , currentPage },
{ "pageSize" , pageSize },
{ "serviceCode" , code },
{ "directoryType" , directoryType },
{ "directoryCode" , dirCode },
{ "directoryName" , dirName },
{ "approvalNO" , approvalNO },
{ "directoryDr" , interfaceDr }
};
JObject joRtn = mIS.getMIDirectoryByPagination(joInput);
if (joRtn["errorCode"].ToString() != "0")
{
MessageBox.Show("IRIS数据返回错误:" + joRtn["errorMessage"].ToString());
return;
}
if (joRtn["result"]["Data"] == null)
{
MessageBox.Show("该节点不存在");
return;
}
if (joRtn["result"]["TotalCount"].ToString() == "0")
{
MessageBox.Show("未查询到数据");
dgv.DataSource = null;
return;
}
DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
pg.TotalCount = totalCount;
pg.PageSize = pageSize;
dgv.DataSource = dt;
dgv.Columns[0].ReadOnly = true;
}
catch (Exception ex)
{
MessageBox.Show("查询异常:" + ex.Message);
}
}
private void setHeaderTxt(int directoryType, Sunny.UI.UIDataGridView dgv)
{
GridViewSetter gvdSetter = new GridViewSetter();
switch (directoryType)
{
case 0://药品
{
gvdSetter.SetHeaderTextOfDrug(dgv);
break;
}
case 1://诊疗
{
gvdSetter.SetHeaderTextOfMedicalService(dgv);
break;
}
case 2://材料
{
gvdSetter.SetHeaderTextOfMaterials(dgv);
break;
}
case 3://疾病诊断
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 4://手术
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 5://慢性病
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 6://DRGs
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break; ;
}
case 7://日间手术
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break; ;
}
case 8://字典表
{
gvdSetter.SetHeaderTextOfDictionary(dgv);
break;
}
case 9://中药饮片
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 10://医疗机构制剂
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 11://民族药品
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 12://肿瘤形态学
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 13://中医疾病目录
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
case 14://中医证候目录
{
gvdSetter.SetHeaderTextOfDiagnose(dgv);
break;
}
}
}
private void queryHISInsuDirectory(int directoryType, int pageIndex, int count, Sunny.UI.UIDataGridView dgv, int interfaceDr)
{
string code = "09010042";
if (tcBasicData.SelectedIndex == 1)
{
if (rbgDirecType.SelectedIndex == 8)
{ code = "09010043"; }
}
queryInsuDirectory(pageIndex, count, directoryType + 1, interfaceDr, code);
setHeaderTxt(directoryType, dgv);
}
private int queryHISDirectory(int currentPage, int pageSize,out string errMsg)
{
errMsg = "";
string directoryType = string.Empty;
switch (rbgDirecType_C.SelectedIndex)
{
case 0:
{
directoryType = "drugs";
break;
}
case 1:
{
directoryType = "diagnosi";
break;
}
case 2:
{
directoryType = "consumables";
break;
}
}
JObject joHISRtn = new JObject();
JObject joRtn = new JObject();
InvokeHelper invoker = new InvokeHelper();
string flag = "";
//全部是先调HIS,然后再匹配医保平台的对照关系
if (rbAll.Checked) {
JArray jaPagination = new JArray();
JArray jaParams = new JArray();
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.hospitalDr;
joParam.interfaceDr = Global.inf.interfaceDr;
joParam.type = directoryType;
joParam.flag = flag;
joParam.specInput = "";
jaParams.Add(joParam);
dynamic joPagination = new JObject();
joPagination.pageSize = pageSize;
//joPagination.pageSize = 2;
joPagination.currentPage = currentPage;
joPagination.sortColumn = "Code";
joPagination.sortOrder = "asc";
jaPagination.Add(joPagination);
//该服务需要改写,需要跟(CloudMedicalInsurancePlatform.Tables.MapRelation)进行关联
//joInParams.code = "09010038";
if (hIS.getHISDir(jaPagination, jaParams,out joHISRtn, out errMsg) != 0)
{
return -1;
}
joRtn = mIS.ConvertHISDir(joHISRtn);
if (JsonHelper.parseIrisRtnValue(joRtn,out errMsg) != 0)
{
return -1;
}
}
//已对照是先调云医保,然后再匹配HIS
if (rbMaped.Checked) {
JArray jaPagination = new JArray();
JArray jaParams = new JArray();
flag = "Maped";
dynamic joParam = new JObject();
joParam.alias = tbHISDirectoryFilter.Text;
joParam.HospitalDr = Global.inf.hospitalDr;
joParam.InterfaceDr = Global.inf.interfaceDr;
joParam.hisType = directoryType;
jaParams.Add(joParam);
dynamic joPagination = new JObject();
joPagination.pageSize = pageSize;
joPagination.currentPage = currentPage;
joPagination.sortColumn = "HisCode";
joPagination.sortOrder = "asc";
jaPagination.Add(joPagination);
JObject joMIRtn = mIS.GetMappedHISDir(jaPagination,jaParams);
if (JsonHelper.parseIrisRtnValue(joMIRtn, out errMsg) != 0)
{
return -1;
}
//传给HIS,进行匹配
joParam = new JObject();
joParam.TotalCount = joMIRtn["result"]["TotalCount"];
joParam.type = directoryType;
joParam.flag = flag;
joParam.hospID = Global.inf.hospitalDr;
joParam.interfaceDr = Global.inf.interfaceDr;
joParam.alias = tbHISDirectoryFilter.Text;
joParam.include = "Hosp";
joParam.groupID = "324";
joParam.compareArr = joMIRtn["result"]["Data"];
jaParams = new JArray();
jaParams.Add(joParam);
if (hIS.getHISDir(jaPagination, jaParams, out joRtn, out errMsg) != 0)
{
return -1;
}
else
{
JArray jaData = JArray.Parse(JsonHelper.getDestValue(joRtn,"result.Data"));
for (int i = 0; i < jaData.Count; i++)
{
jaData[i]["flag"] = new JObject();
jaData[i]["flag"] = "已对照";
}
joRtn["result"]["Data"] = jaData;
Global.writeLog(joRtn.ToString());
}
}
if (rbNoMaped.Checked) { flag = "NoMaped"; }
DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
//MessageBox.Show(dt.Rows[1]["pcCode"].ToString());
int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
pgHISDirect.TotalCount = totalCount;
pgHISDirect.PageSize = 50;
dgvHISDirectory.DataSource = null;
dgvHISDirectory.DataSource = dt;
dgvHISDirectory.Columns[0].ReadOnly = true;
return 0;
}
private void queryCenterDirectory_09010012(int currentPage, int pageSize)
{
string directoryType = string.Empty;
switch (rbgDirecType_C.SelectedIndex)
{
case 0:
{
directoryType = "drugs";
break;
}
case 1:
{
directoryType = "diagnosi";
break;
}
case 2:
{
directoryType = "consumables";
break;
}
}
dynamic joInParams = new JObject();
joInParams.pagination = new JArray() as dynamic;
joInParams.session = new JArray() as dynamic;
JArray jaParams = new JArray();
dynamic joParams = new JObject();
joParams.code = "";
joParams.descripts = "";
joParams.FindType = new JArray();
joParams.TypeID = "";
joParams.alias = "";
joParams.include = "Hosp";
joParams.groupID = "324";
joParams.hospID = "25";
joParams.type = directoryType;
joParams.specInput = "";
jaParams.Add(joParams);
joInParams.Add("params", JArray.FromObject(jaParams));
dynamic joSession = new JObject();
joSession.userID = "";
joSession.locID = "";
joSession.groupID = "";
joSession.hospID = "";
joSession.sessionID = "";
joSession.hospCode = "";
joSession.language = "";
joSession.hostName = "";
joSession.ipv4 = "";
joSession.ipv6 = "";
joSession.mac = "";
joInParams.session.Add(joSession);
dynamic joPagination = new JObject();
joPagination.pageSize = pageSize;
joPagination.currentPage = currentPage;
joPagination.sortColumn = "Code";
joPagination.sortOrder = "asc";
joInParams.pagination.Add(joPagination);
joInParams.code = "09010012";
string sInput = joInParams.ToString();
string sRtn = invoker.invokeInsuService(joInParams,"");
JObject jsonRtn = JObject.Parse(sRtn);
if (jsonRtn["result"]["Data"] == null)
{
MessageBox.Show("该节点不存在");
return;
}
JObject joRtn = JObject.Parse(sRtn);
DataTable dt = (DataTable)joRtn["result"]["Data"].ToObject(typeof(DataTable));
int totalCount = int.Parse(joRtn["result"]["TotalCount"].ToString());
pgCenterDirect.TotalCount = totalCount;
pgCenterDirect.PageSize = 50;
dgvCenterDirectory.DataSource = dt;
}
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();
int hisType = rbgDirecType_C.SelectedIndex + 1;
string hisTypeName = rbgDirecType_C.Items[hisType-1].ToString(); ;
JArray jaParams = new JArray();
dynamic jsonTemp = new JObject();
if (dtHis.Rows[iHis]["MapID"].ToString() == "0")
{
jsonTemp.ID = "";
}
else
{
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]["ID"];
//1.已对照 2.已对照但未上传 3 已对照且已上传
jsonTemp.State = 1;
jsonTemp.HisType = hisType;
jsonTemp.HisTypeName = hisTypeName;
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 = "已对照";
}
else
{
dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "对照失败";
}
}
private void CancleMapping()
{
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 = "未对照";
dtHis.Rows[iHis]["MapID"] = 0;
}
else
{
dgvHISDirectory.Rows[iHis].Cells["flag"].Value = "取消失败";
}
}
///
/// 医保目录单个版本号的下载
///
///
///
///
///
///
public int SingleDownload(string ver, int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
{
string txtPath = string.Empty;
errorMessage = "";
int iResult = -1;
string funNo = "";
switch (directoryType)
{
case 0://药品
{
funNo = "1301"; //"1301";
break;
}
case 1://诊疗
{
funNo = "1305";
break;
}
case 2://材料
{
funNo = "1306";
break;
}
case 3://疾病诊断
{
funNo = "1307";
break;
}
case 4://手术
{
funNo = "1308";
break;
}
case 5://慢性病
{
funNo = "1309";
break;
}
case 6://DRGs
{
funNo = "1310";
break; ;
}
case 7://日间手术
{
funNo = "1311";
break;
}
case 8://字典表
{
break;
}
case 9://中药饮片
{
funNo = "1302";
break;
}
case 10://医疗机构制剂
{
funNo = "1303";
break;
}
case 11://民族药品
{
funNo = "1304";
break;
}
case 12://肿瘤形态学
{
funNo = "1313";
break;
}
case 13://中医疾病目录
{
funNo = "1314";
break;
}
case 14://中医证候目录
{
funNo = "1315";
break;
}
}
try
{
JObject joRtn = hBus.DownloadDirectory(funNo, ver);
if (JsonHelper.parseIrisRtnValue(joRtn, out errorMessage) == 0)
{
txtPath = joRtn["filePath"].ToString();
DataImoport bus = new DataImoport();
JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, directoryType + 1, uiProcessBar);
if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
{
iResult = 0;
}
else
{
errorMessage = "导入数据出现错误,请查看日志!";//joImportRtn["errorMessage"].ToString();
}
}
return iResult;
}
catch (Exception ex)
{
errorMessage = "SingleDownload提示:" + ex.Message;
return -1;
}
}
///
/// 医保目录单个版本号的下载
///
///
///
///
///
///
public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
{
errorMessage = "";
int iResult = -1;
try
{
JObject joRtn = cBus.DownDictionay(joData);
if (JsonHelper.parseCenterRtnValue(joRtn, out errorMessage) == 0)
{
DataImoport DI = new DataImoport();
JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "output.list"));
JObject joImportRtn = DI.importDictionary(uiProcessBar, jaList, tbDicType.Text);
if (JsonHelper.parseIrisRtnValue(joImportRtn, out errorMessage) == 0)
{
iResult = 0;
}
else
{
errorMessage = "导入数据出现错误,请查看日志!" + errorMessage;
}
}
return iResult;
}
catch (Exception ex)
{
errorMessage = "downloadDicionary提示:" + ex.Message;
return -1;
}
}
///
/// 自动下载医保目录,直到最新版本(返回报错)
///
///
///
///
///
public int AutoDownload(int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
{
int iResult = 0;
errorMessage = "";
try
{
while (iResult == 0)
{
JObject joMaxVerNO = mIS.getDirectoryMaxVersionNO(directoryType);
string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
iResult = JsonHelper.parseIrisRtnValue(joMaxVerNO, out errorMessage);
iResult = SingleDownload(ver, directoryType, uiProcessBar, out errorMessage);
}
return iResult;
}
catch (Exception ex)
{
errorMessage = ex.Message;
return -1;
}
}
#endregion
#region 接口维护
private void queryInterfaceBasicInfo(int index)
{
string errorMsg = "";
switch (index)
{
case 0:
{
JObject joRtn = mIS.getHospital();
if (JsonHelper.parseIrisRtnValue(joRtn, out errorMsg) != 0)
{
MessageBox.Show(errorMsg);
return;
}
//JArray jaParams = JArray.FromObject(joRtn["result"]["data"]);
JArray jaParams = JArray.Parse(JsonHelper.getDestValue(joRtn, "result.data"));
if (jaParams.Count == 0)
{
MessageBox.Show("未查询到数据");
return;
}
DataTable dt = new DataTable();
dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
GridViewSetter intefaceGrid = new GridViewSetter();
intefaceGrid.SetHeaderTextOfInterfaceMaintain(dt, dgvInterface);
joRtn = mIS.getInterface();
jaParams = new JArray();
jaParams = JArray.FromObject(joRtn["result"]["data"]);
if (jaParams.Count == 0)
{
DataTableSetter dts = new DataTableSetter();
dt = dts.setDgvInterfaceDataTable();
}
else
{
dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
}
dt.AcceptChanges();
dgvInterface.DataSource = dt;
dgvInterface.ReadOnly = true;
break;
}
}
}
#endregion
private void Form1_Load(object sender, EventArgs e)
{
//rbgDirecType.ValueChanged += new Sunny.UI.UIRadioButtonGroup.OnValueChanged(rbgDirecType_ValueChanged);
this.WindowState = FormWindowState.Maximized;
rbgInterface.SelectedIndex = 0;
}
private void btnDownload_Click(object sender, EventArgs e)
{
string errorMessage = string.Empty;
if (rbgDirecType.SelectedIndex == 8)
{
Global.pat.insuplc_admdvs = "";
dynamic joData = new JObject();
joData.type = tbDicType.Text; //字典类型
joData.parentValue = ""; //父字典键值
joData.admdvs = Global.inf.areaCode; //行政区划 就医地
joData.date = tbDicDate.Text; //查询日期
joData.vali_flag = "1"; //有效标志
JObject joTmp = new JObject();
joTmp.Add("data",joData);
if (downloadDicionary(joTmp, uiProcessBar1, out errorMessage) != 0)
{
MessageBox.Show("医保字典下载失败:" + errorMessage);
return;
}
}
else
{
if (rbSingleDown.Checked)
{
string ver = tbVer.Text;
if (tbVer.Text != "")
{
ver = tbVer.Text;
}
if (SingleDownload(ver, rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
{
MessageBox.Show(errorMessage);
return;
}
}
if (rbAutoDown.Checked)
{
if (AutoDownload(rbgDirecType.SelectedIndex, uiProcessBar1, out errorMessage) != 0)
{
MessageBox.Show(errorMessage);
return;
}
}
}
btnQuery_Click(sender, e);
}
private void btnQuery_Click(object sender, EventArgs e)
{
queryHISInsuDirectory(rbgDirecType.SelectedIndex, 1, 20, dgvDirectoy,Global.inf.interfaceDr);
}
private void btnQueryHISDirectory_Click(object sender, EventArgs e)
{
string errMsg;
if (queryHISDirectory(1, 50, out errMsg) != 0)
{
MessageBox.Show(errMsg);
return;
}
GridViewSetter gridSetter = new GridViewSetter();
gridSetter.SetHeaderTextOfMapping_HisDirectory(dgvHISDirectory);
}
private void btnQueryCenterDirectory_Click(object sender, EventArgs e)
{
queryHISInsuDirectory(rbgInsuDirecType_C.SelectedIndex, 1, 50, dgvCenterDirectory, Global.inf.interfaceDr);
}
private void pgDownload_PageChanged(object sender, object pagingSource, int pageIndex, int count)
{
queryHISInsuDirectory(rbgDirecType.SelectedIndex, pageIndex, count,dgvDirectoy, Global.inf.interfaceDr);
}
private void pgHISDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
{
string errMsg;
if (queryHISDirectory(pageIndex, 50, out errMsg) != 0)
{
MessageBox.Show(errMsg);
return;
}
}
private void pgCenterDirect_PageChanged(object sender, object pagingSource, int pageIndex, int count)
{
queryHISInsuDirectory(rbgDirecType_C.SelectedIndex, pageIndex, count, dgvCenterDirectory, Global.inf.interfaceDr);
}
private void rbgDirecType_ValueChanged(object sender, int index, string text)
{
btnQuery_Click(null, new EventArgs());
}
private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
CancleMapping();
}
private void tsmiMapping_Click(object sender, EventArgs e)
{
Mapping();
}
private void dgvHISDirectory_DoubleClick(object sender, EventArgs e)
{
int currentPage = pgHISDirect.ActivePage;
string flag = dgvHISDirectory.Rows[dgvHISDirectory.CurrentRow.Index].Cells["flag"].Value.ToString();
if (flag == "未对照")
{
Mapping();
}
else
if (flag == "已对照")
{
CancleMapping();
}
if (rbAll.Checked)
{
string errMsg;
if (queryHISDirectory(1, 50, out errMsg) != 0)
{
MessageBox.Show(errMsg);
return;
}
}
}
private void dgvDirectoy_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
//自动编号,与数据无关
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dgvDirectoy.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics,
(e.RowIndex + 1).ToString(),
dgvDirectoy.RowHeadersDefaultCellStyle.Font,
rectangle,
dgvDirectoy.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
private void rbAll_ValueChanged(object sender, bool value)
{
if (rbAll.Checked)
{
btnQueryHISDirectory_Click(null, new EventArgs());
}
}
private void rbMaped_CheckedChanged(object sender, EventArgs e)
{
if (rbMaped.Checked)
{
string errMsg;
if (queryHISDirectory(1, 50, out errMsg) != 0)
{
MessageBox.Show(errMsg);
return;
}
}
}
private void btAddDir_Click(object sender, EventArgs e)
{
AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex);
if (addDirectory.ShowDialog() == DialogResult.OK)
{
JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
string error = "";
if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
{
MessageBox.Show("新增失败:" + error);
}
else
{
MessageBox.Show("新增成功");
}
}
}
private void btEditDir_Click(object sender, EventArgs e)
{
DataTable dt = (DataTable)dgvDirectoy.DataSource;
if ((dt == null) || (dt.Rows.Count < 1))
{
MessageBox.Show("表中无数据,请检查!");
return;
}
DataRow dr = dt.Rows[dgvDirectoy.CurrentRow.Index];
AddSingleDirectory addDirectory = new AddSingleDirectory(rbgDirecType.SelectedIndex, dr);
if (addDirectory.ShowDialog() == DialogResult.OK)
{
JObject joRtn = mIS.UpdateDirectoryBySelf(addDirectory.joPamam);
string error = "";
if (JsonHelper.parseIrisRtnValue(joRtn, out error) != 0)
{
MessageBox.Show("修改失败:" + error);
}
else
{
MessageBox.Show("修改成功");
}
}
}
private void tsmUpdateDir_Click(object sender, EventArgs e)
{
JObject joData = new JObject();
string outPar = "";
string errMsg = "";
try
{
int dirIndex = dgvDirectoy.CurrentRow.Index;
joData.Add("type",rbgDirecType.SelectedIndex + 1);
joData.Add("med_list_codg",dgvDirectoy.Rows[dirIndex].Cells["Code"].Value.ToString());
joData.Add("fee_ocur_time", DateTime.Now.ToString("yyyy-MM-dd"));
if (cBus.UpdateDirectory(joData, out outPar) != 0)
{
MessageBox.Show(outPar);
}
else
{
JObject joRtn = mIS.UpdateDirectory(JObject.Parse(outPar));
if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
{
MessageBox.Show("Fail:" + errMsg);
}
else
{
MessageBox.Show("Success!");
}
}
}
catch (Exception ex)
{
}
}
private void rbgDownType_3_ValueChanged(object sender, int index, string text)
{
DataGridView dgs = new DataGridView();
GridViewSetter gvs = new GridViewSetter();
//gvs.SetHeaderTextOfMoreInfo()
}
private void btLimitPriceQuery_4_Click(object sender, EventArgs e)
{
dynamic joData = new JObject();
joData.query_date = tbQueryDate_Limit.Text; //查询时间点
joData.hilist_code = tbInsuDir_Limit.Text; //医保目录编码
joData.hilist_lmtpric_type = tbDirLimitType_Limit.Text; //医保目录限价类型
joData.overlmt_dspo_way = tbDirWay_Limit.Text; //医保目录超限处理方式
joData.insu_admdvs = tbInsuPlc_Limit.Text; //参保机构医保区划
joData.begndate = tbBeginDate_Limit.Text; //开始日期
joData.enddate = tbEndDate_Limit.Text; //结束日期
joData.vali_flag = tbValidFlag_Limit.Text; //有效标志
joData.rid = tbOnlyRecordNO_Limit.Text; //唯一记录号
joData.tabname = tbTableName_Limit.Text; //表名
joData.poolarea_no = tbAdmPlc_Limit.Text; //统筹区
joData.updt_time = tbUpdateDate_Limit.Text; //更新时间
joData.page_num = tbCurrentPage_Limit.Text; //当前页数
joData.page_size = tbCurrentCount_Limit.Text; //本页数据量
JObject joTmp = new JObject();
joTmp.Add("data",joData);
JObject joRtn = invoker.invokeCenterService("1318", JsonHelper.setCenterInpar("1318",joTmp));
DataTable dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
dgvLimitPrice.DataSource = dt;
GridViewSetter gvdSetter = new GridViewSetter();
gvdSetter.SetHeaderTextOfSettlListLimitPrice(dgvLimitPrice);
}
private void btSelfRitoQuery_3_Click(object sender, EventArgs e)
{
dynamic joData = new JObject();
joData.query_date = tbSelf_QueryDate.Text; //查询时间点
joData.hilist_code = tbSelf_InsuDir.Text; //医保目录编码
joData.selfpay_prop_psn_type = tbSelf_PsnType.Text;//医保目录自付比例人员类别
joData.selfpay_prop_type = tbSelf_RiotType.Text; //目录自付比例类别
joData.insu_admdvs = tbSelf_InsuPlc.Text; //参保机构医保区划
joData.begndate = tbSelf_BeginDate.Text; //开始日期
joData.enddate = tbSelf_EndDate.Text; //结束日期
joData.vali_flag = tbSelf_ValidFlag.Text; //有效标志
joData.rid = tbSelf_OnlyRecordNO.Text; //唯一记录号
joData.tabname = tbSelf_TableName.Text; //表名
joData.poolarea_no = tbSelf_InsuPlc.Text; //统筹区
joData.updt_time = tbSelf_UpdateTime.Text; //更新时间
joData.page_num = tbSelf_CurrentPage.Text; //当前页数
joData.page_size = tbSelf_CurrentCount.Text; //本页数据量
JObject joTmp = new JObject();
joTmp.Add("data", joData);
JObject joRtn = invoker.invokeCenterService("1319", JsonHelper.setCenterInpar("1319",joTmp));
DataTable dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
dgvSelfRiot.DataSource = dt;
GridViewSetter gvdSetter = new GridViewSetter();
gvdSetter.SetHeaderTextOfSelfRiot(dgvSelfRiot);
}
private void btInsuDirQuery_3_Click(object sender, EventArgs e)
{
dynamic joData = new JObject();
joData.query_date = tbInsuDir_QueryDate.Text; //查询时间点
joData.hilist_code = tbInsuDir_InsuDir.Text; //医保目录编码
joData.insu_admdvs = tbInsuDir_InsuPlc.Text; //参保机构医保区划
joData.begndate = tbInsuDir_BeginDate.Text; //开始日期
joData.hilist_name = tbInsuDir_InsuDirName.Text; //医保目录名称
joData.wubi = tbInsuDir_WuBi.Text; //五笔助记码
joData.pinyin = tbInsuDir_PinYin.Text; //拼音助记码
joData.med_chrgitm_type =tbInsuDir_ItemType.Text; //医疗收费项目类别
joData.chrgitm_lv = tbInsuDir_ItemLevel.Text; //收费项目等级
joData.lmt_used_flag = tbInsuDir_LimitFlag.Text; //限制使用标志
joData.list_type = tbInsuDir_DirType.Text; //目录类别
joData.med_use_flag = tbInsuDir_MedUseFlag.Text; //医疗使用标志
joData.matn_used_flag = tbInsuDir_MateUseFlag.Text; //生育使用标志
joData.hilist_use_type = tbInsuDir_DirUseType.Text; //医保目录使用类别
joData.lmt_cpnd_type = tbInsuDir_LmtCpndType.Text; //限复方使用类型
joData.vali_flag = tbInsuDir_ValidFlag.Text; //有效标志
joData.updt_time = tbInsuDir_UpdateDate.Text; //更新时间
joData.page_num = tbInsuMatch_CurrentPage.Text; //当前页数
joData.page_size = tbInsuMatch_CurrentCount.Text; //本页数据量
JObject joTmp = new JObject();
joTmp.Add("data", joData);
JObject joRtn = invoker.invokeCenterService("1312", JsonHelper.setCenterInpar("1312", joTmp));
DataTable dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
dgvQueryInsuDir.DataSource = dt;
GridViewSetter gvdSetter = new GridViewSetter();
gvdSetter.SetHeaderTextOfQueryInsuDir(dgvQueryInsuDir);
}
private void btQuery_InsuMatchHIS_Click(object sender, EventArgs e)
{
dynamic joData = new JObject();
joData.query_date = tbInsuMatch_QueryDate.Text; //查询时间点
joData.medins_list_codg = tbInsuMatch_HisCode.Text; //定点医药机构目录编号
joData.hilist_code = tbInsuMatch_InsuCode.Text; //医保目录编码
joData.list_type = tbInsuMatch_DirType.Text; //目录类别
joData.insu_admdvs = tbInsuMatch_InsuPlc.Text; //参保机构医保区划
joData.begndate = tbInsuMatch_BeginDate.Text; //开始日期
joData.vali_flag = tbInsuDir_ValidFlag.Text; //有效标志
joData.updt_time = tbInsuMatch_UpdateDate.Text; //更新时间
joData.page_num = tbInsuMatch_CurrentPage.Text; //当前页数
joData.page_size = tbInsuMatch_CurrentCount.Text; //本页数据量
JObject joTmp = new JObject();
joTmp.Add("data", joData);
JObject joRtn = invoker.invokeCenterService("1316", JsonHelper.setCenterInpar("1316", joTmp));
DataTable dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
dgvHisMatchInsu.DataSource = dt;
GridViewSetter gvdSetter = new GridViewSetter();
gvdSetter.SetHeaderTextOfInsuMatch(dgvHisMatchInsu);
}
private void btQuery_HisMatch_Click(object sender, EventArgs e)
{
dynamic joData = new JObject();
joData.query_date = tbHisMatch_QueryDate.Text; //查询时间点
joData.fixmedins_code = tbHisMatch_HospNO.Text; //定点医药机构编号
joData.medins_list_codg = tbHisMatch_HisCode.Text; //定点医药机构目录编号
joData.medins_list_name = tbHisMatch_HisName.Text; //定点医药机构目录名称
joData.insu_admdvs = tbHisMatch_InsuPlc.Text; //参保机构医保区划
joData.list_type = tbHisMatch_DirType.Text; //目录类别
joData.med_list_codg = tbHisMatch_InsuCode.Text; //医疗目录编码
joData.begndate = tbHisMatch_BeginDate.Text; //开始日期
joData.vali_flag = tbHisMatch_ValidFlag.Text; //有效标志
joData.updt_time = tbHisMatch_UpdateDate.Text; //更新时间
joData.page_num = tbHisMatch_CurrentPage.Text; //当前页数
joData.page_size = tbHisMatch_CurrentCount.Text; //本页数据量
JObject joTmp = new JObject();
joTmp.Add("data", joData);
JObject joRtn = invoker.invokeCenterService("1317", JsonHelper.setCenterInpar("1317", joTmp));
DataTable dt = (DataTable)joRtn["output"]["data"].ToObject(typeof(DataTable));
dgvHisMatchInfo.DataSource = dt;
GridViewSetter gvdSetter = new GridViewSetter();
gvdSetter.SetHeaderTextOfHisMatch(dgvHisMatchInfo);
}
#region
///
/// 单条上传目录对照关系
///
private void SingleUpload()
{
if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
{
MessageBox.Show("请查询HIS目录对照关系");
return;
}
string errorMsg = "", sMLLX = "";
//单条目录对照关系上传
int iHis = dgvHISDirectory.CurrentRow.Index;
DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
//string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
if (hisType == 1)
{
sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
}
else if (hisType == 2)
{
sMLLX = "201";
}
else if (hisType == 3)
{
sMLLX = "301";
}
string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
//调用3301目录对照上传
JObject joData = new JObject();
joData.Add("fixmedins_hilist_id", HisCode);
joData.Add("fixmedins_hilist_name", HisName);
joData.Add("list_type", sMLLX); //目录类别
joData.Add("med_list_codg", InsuCode); //医疗目录编码
joData.Add("begndate", "2022-10-01"); //开始日期
joData.Add("enddate", UpdateDate); //结束日期
joData.Add("drugadm_strdcod", "");
joData.Add("genname_no", "");
joData.Add("aprvno", "");
joData.Add("dosform", "");
joData.Add("exct_cont", "");
joData.Add("item_cont", "");
joData.Add("prcunt", "");
joData.Add("spec", "");
joData.Add("pacspec", "");
joData.Add("pric", "");
joData.Add("memo", "");
JArray jaData = new JArray();
jaData.Add(joData);
JObject joInput = new JObject();
joInput.Add("catalogcompin", jaData);
InvokeHelper invoker = new InvokeHelper();
JObject joRtn = invoker.invokeCenterService("3301", joInput);
if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
{
MessageBox.Show("目录对照关系上传失败:" + errorMsg);
}
else
{
MessageBox.Show("目录对照关系上传成功!");
}
}
///
/// 单条撤销目录对照关系上传
///
private void SingleCancelUpload()
{
if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
{
MessageBox.Show("请查询HIS目录对照关系");
return;
}
string errorMsg = "", sMLLX = "";
//撤销目录对照关系
DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
int iHis = dgvHISDirectory.CurrentRow.Index;
string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
string HisCode = dtHis.Rows[iHis]["HisCode"].ToString();
int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
//string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
if (hisType == 1)
{
sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
}
else if (hisType == 2)
{
sMLLX = "201";
}
else if (hisType == 3)
{
sMLLX = "301";
}
//调用3302目录对照撤销
JObject joData = new JObject();
joData.Add("fixmedins_code", Global.inf.hospitalNO);
joData.Add("fixmedins_hilist_id", HisCode);
joData.Add("list_type", sMLLX); //目录类别
joData.Add("med_list_codg", InsuCode); //医疗目录编码
JObject joInput = new JObject();
joInput.Add("catalog", joData);
InvokeHelper invoker = new InvokeHelper();
JObject joRtn = invoker.invokeCenterService("3302", joInput);
if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
{
MessageBox.Show("目录对照撤销失败:" + errorMsg);
}
else
{
MessageBox.Show("目录对照撤销成功!");
}
}
///
/// 全部上传目录对照关系
///
private void AllUpLoad()
{
if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
{
MessageBox.Show("请查询HIS目录对照关系");
return;
}
string sInputStr = "", sMLLX = "", errorMsg = "", Msg = "";
Boolean bOk = true;
JObject InputjoRtn = new JObject();
string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
if (hisType == 1)
{
sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
}
else if (hisType == 2)
{
sMLLX = "201";
}
else if (hisType == 3)
{
sMLLX = "301";
}
DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
for (int i = 0; i < dtHis.Rows.Count; i++)
{
string InsuCode = dtHis.Rows[i]["InsuCode"].ToString(); //医保目录编码
string InsuName = dtHis.Rows[i]["InsuName"].ToString(); //医保目录名称
string HisCode = dtHis.Rows[i]["itemCode"].ToString(); //HIS目录编码
string HisName = dtHis.Rows[i]["itemDesc"].ToString(); //HIS目录名称
//调用3301目录对照上传
JObject joData = new JObject();
joData.Add("fixmedins_hilist_id", HisCode);
joData.Add("fixmedins_hilist_name", HisName);
joData.Add("list_type", sMLLX); //目录类别
joData.Add("med_list_codg", InsuCode); //医疗目录编码
joData.Add("begndate", "2022-10-01"); //开始日期
joData.Add("enddate", UpdateDate); //结束日期
joData.Add("aprvno", "");
joData.Add("dosform", "");
joData.Add("exct_cont", "");
joData.Add("item_cont", "");
joData.Add("prcunt", "");
joData.Add("spec", "");
joData.Add("pacspec", "");
joData.Add("memo", "");
JObject joInput = new JObject();
joInput.Add("data", joData);
InvokeHelper invoker = new InvokeHelper();
JObject joRtn = invoker.invokeCenterService("3301", JsonHelper.setCenterInpar("3301", joInput));
if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
{
bOk = false;
Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
}
}
if (bOk == false)
{
MessageBox.Show("全部目录对照关系上传成功,部分上传异常:" + Msg);
}
else
{
MessageBox.Show("全部目录对照关系上传成功!");
}
}
///
/// 全部撤销目录对照关系上传
///
private void AllCancelUpload()
{
if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
{
MessageBox.Show("请查询HIS目录对照关系");
return;
}
string sMLLX = "", errorMsg = "", Msg = "";
Boolean bOk = true;
string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
if (hisType == 1)
{
sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
}
else if (hisType == 2)
{
sMLLX = "201";
}
else if (hisType == 3)
{
sMLLX = "301";
}
DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
for (int i = 0; i < dtHis.Rows.Count; i++)
{
string InsuCode = dtHis.Rows[i]["InsuCode"].ToString();
string HisCode = dtHis.Rows[i]["HisCode"].ToString();
//调用3302目录对照撤销
JObject joData = new JObject();
joData.Add("fixmedins_code", Global.inf.hospitalNO);
joData.Add("fixmedins_hilist_id", HisCode);
joData.Add("list_type", sMLLX); //目录类别
joData.Add("med_list_codg", InsuCode); //医疗目录编码
JObject joInput = new JObject();
joInput.Add("data", joData);
InvokeHelper invoker = new InvokeHelper();
JObject joRtn = invoker.invokeCenterService("3302", JsonHelper.setCenterInpar("3302", joInput));
if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
{
bOk = false;
Msg = Msg + "<" + joInput.ToString() + ":" + errorMsg + ">";
}
}
if (bOk == false)
{
MessageBox.Show("全部撤销目录对照关系上传成功,部分撤销异常:" + Msg);
}
else
{
MessageBox.Show("全部撤销目录对照关系上传成功!");
}
}
///
/// 查询中心对照关系
///
private void QueryCenterDirMap()
{
string errorMsg = "", sMLLX = "";
//单条目录对照关系上传
int iHis = dgvHISDirectory.CurrentRow.Index;
DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
//string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
if (hisType == 1)
{
sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
}
else if (hisType == 2)
{
sMLLX = "201";
}
else if (hisType == 3)
{
sMLLX = "301";
}
string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
//调用3360
JObject joData = new JObject();
joData.Add("fixmedins_hilist_id", HisCode);
joData.Add("fixmedins_hilist_name", HisName);
joData.Add("list_type", sMLLX); //目录类别
//joData.Add("med_list_codg", InsuCode); //医疗目录编码
joData.Add("med_list_codg", ""); //医疗目录编码
joData.Add("chk_stas", ""); //审核状态
joData.Add("begnrow", 1); //开始行数
JObject joInput = new JObject();
joInput.Add("catalog", joData);
InvokeHelper invoker = new InvokeHelper();
JObject joRtn = invoker.invokeCenterService("5163", joInput);
if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
{
MessageBox.Show("查询中心对照关系废失败:" + errorMsg);
}
else
{
MessageBox.Show("查询中心对照关系成功!");
}
}
///
/// 作废对照关系
///
private void AbolishUpload()
{
if ((dgvHISDirectory.CurrentRow == null) || (rbMaped.Checked != true))
{
MessageBox.Show("请查询HIS目录对照关系");
return;
}
string errorMsg = "", sMLLX = "";
//单条目录对照关系上传
int iHis = dgvHISDirectory.CurrentRow.Index;
DataTable dtHis = (DataTable)dgvHISDirectory.DataSource;
int hisType = rbgDirecType_C.SelectedIndex + 1; //1药品 2诊疗 3材料
//string hisTypeName = rbgDirecType_C.Items[hisType - 1].ToString();
if (hisType == 1)
{
sMLLX = "101"; //101西药中成药 102中药饮片 103自制剂 104民族药 201医疗服务项目 301医用耗材 501长护服务项目 105其他
}
else if (hisType == 2)
{
sMLLX = "201";
}
else if (hisType == 3)
{
sMLLX = "301";
}
string InsuCode = dtHis.Rows[iHis]["InsuCode"].ToString();
string InsuName = dtHis.Rows[iHis]["InsuName"].ToString();
string HisCode = dtHis.Rows[iHis]["itemCode"].ToString();
string HisName = dtHis.Rows[iHis]["itemDesc"].ToString();
string UpdateDate = DateTime.Now.ToString("yyyy-MM-dd");
//调用3360
JObject joData = new JObject();
joData.Add("fixmedins_hilist_id", HisCode);
joData.Add("fixmedins_hilist_name", HisName);
joData.Add("list_type", sMLLX); //目录类别
joData.Add("med_list_codg", InsuCode); //医疗目录编码
joData.Add("begndate", "2022-10-01"); //开始日期
joData.Add("enddate", UpdateDate); //结束日期
JObject joInput = new JObject();
joInput.Add("catalog", joData);
InvokeHelper invoker = new InvokeHelper();
JObject joRtn = invoker.invokeCenterService("3360", joInput);
if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
{
MessageBox.Show("目录对照关系作废失败:" + errorMsg);
}
else
{
MessageBox.Show("目录对照关系作废成功!");
}
}
#endregion
private void tsmUploadMapedDir_Click(object sender, EventArgs e)
{
SingleUpload();
}
private void tsmCanleUploadedMapedDir_Click(object sender, EventArgs e)
{
SingleCancelUpload();
}
private void tsmCAbolishUploadedMapedDir_Click(object sender, EventArgs e)
{
AbolishUpload();
}
private void tspQueryCenterDirMap_Click(object sender, EventArgs e)
{
QueryCenterDirMap();
}
private void btnIntefaceQuery_Click(object sender, EventArgs e)
{
queryInterfaceBasicInfo(rbgInterface.SelectedIndex);
}
private void uiButton1_Click(object sender, EventArgs e)
{
dgvInterface.ReadOnly = false;
}
private void btnInterfaceAdd_Click(object sender, EventArgs e)
{
dgvInterface.ReadOnly = false;
DataTable dt = (DataTable)dgvInterface.DataSource;
DataRow dtr = dt.NewRow();
dtr["UseFlag"] = "True";
dtr["InsuRegionDr"] = "0";
dtr["InsuRegionFlag"] = "0";
dtr["InsuCurrencyCataLogue"] = "0";
dt.Rows.Add(dtr);
}
private void btnInterfaceDelete_Click(object sender, EventArgs e)
{
dgvInterface.ReadOnly = true;
DataTable dt = (DataTable)dgvInterface.DataSource;
int index = dgvInterface.CurrentRow.Index;
string ID = dt.Rows[index]["ID"].ToString();
string interfaceID = dgvInterface.CurrentRow.Cells["InterfaceNO"].Value.ToString();
DataRow[] drs = dt.Select("ID = " + ID + " AND InterfaceNO='" + interfaceID + "'");
drs[0].Delete();
dgvInterface.ReadOnly = false;
}
private void btnInterfceSave_Click(object sender, EventArgs e)
{
DataTable dt = (DataTable)dgvInterface.DataSource;
dynamic jsonInsert = new JObject();
dynamic jsonUpdate = new JObject();
dynamic jsonDelete = new JObject();
JArray jsonArry_I = new JArray();
JArray jsonArry_U = new JArray();
JArray jsonArry_D = new JArray();
for (int i = 0; i < dt.Rows.Count; i++)
{
//MessageBox.Show(dt.Rows[i].RowState.ToString() + ':' + dt.Rows[i][0].ToString());
dynamic jsonTemp = new JObject();
if (dt.Rows[i].RowState.ToString() == "Added")
{
for (int j = 0; j < dt.Columns.Count; j++)
{
//MessageBox.Show(dt.Columns[j].ColumnName);
if (dt.Columns[j].ColumnName == "HospitalDr")
{
jsonTemp.Add(new JProperty("HospitalDr", Global.inf.hospitalDr));
}
else
{
jsonTemp.Add(new JProperty(dt.Columns[j].ColumnName, dt.Rows[i][j].ToString()));
}
}
jsonTemp.updateUserID = Global.user.ID;
jsonArry_I.Add(jsonTemp);
}
if (dt.Rows[i].RowState.ToString() == "Deleted")
{
for (int j = 0; j < dt.Columns.Count; j++)
{
string CloumnName = dt.Columns[j].ColumnName;
jsonTemp.Add(new JProperty(CloumnName, dt.Rows[i][CloumnName, DataRowVersion.Original].ToString()));
}
jsonTemp.updateUserID = Global.user.ID;
jsonArry_D.Add(jsonTemp);
}
if (dt.Rows[i].RowState.ToString() == "Modified")
{
for (int j = 0; j < dt.Columns.Count; j++)
{
//MessageBox.Show(dt.Columns[j].ColumnName);
jsonTemp.Add(new JProperty(dt.Columns[j].ColumnName, dt.Rows[i][j].ToString()));
}
jsonTemp.updateUserID = Global.user.ID;
jsonArry_U.Add(jsonTemp);
}
}
jsonInsert.Add(new JProperty("params", jsonArry_I));
jsonInsert.code = "09010005";
jsonUpdate.Add(new JProperty("params", jsonArry_U));
jsonUpdate.code = "09010005";
jsonDelete.Add(new JProperty("params", jsonArry_D));
jsonDelete.code = "09010006";
InvokeHelper invoker = new InvokeHelper();
JObject joRtn = new JObject();
if (jsonArry_I.Count != 0)
{
joRtn = invoker.invokeInsuService(jsonInsert.ToString(), "插入");
}
if (jsonArry_U.Count != 0)
{
joRtn = invoker.invokeInsuService(jsonUpdate.ToString(), "更新");
}
if (jsonArry_D.Count != 0)
{
joRtn = invoker.invokeInsuService(jsonDelete.ToString(), "删除");
}
string errorMessage = "";
if (JsonHelper.parseIrisRtnValue(joRtn, out errorMessage) != 0)
{
MessageBox.Show("保存失败:" + errorMessage);
}
dgvInterface.ReadOnly = true;
}
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
}
private void tsmiSingleUpdateAuxInfo_Click(object sender, EventArgs e)
{
}
}
}