using Newtonsoft.Json.Linq; using PTMedicalInsurance.Helper; using PTMedicalInsurance.Variables; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PTMedicalInsurance.Forms.SettlementWithNopwdApplys { public partial class SettlementWithNopwdApply : Form { private Form mainForm; private NopwdBusiness nopwdBus = new NopwdBusiness(); private string err; private GridViewSetter grdSetter =new GridViewSetter(); public SettlementWithNopwdApply() { InitializeComponent(); InitForm(this); } public SettlementWithNopwdApply(Form frm) { InitializeComponent(); InitForm(frm); } private void InitForm(Form frm) { mainForm = frm; CheckForIllegalCrossThreadCalls = false; // 禁用关闭按钮 this.FormBorderStyle = FormBorderStyle.None; // 隐藏标题栏 this.ControlBox = false; // 其他可能需要的配置 if (mainForm != this) { this.TopLevel = false; this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性 } else { this.WindowState = FormWindowState.Maximized; } // dpST.Text = DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); dpED.Text = DateTime.Now.ToString("yyyy-MM-dd 23:59:59"); // grdSetter.setHisRegInfo(dgvHisRegInfo); grdSetter.setCenterApplyInfo(dgvCenterApplyInfo); } private void btnQueryRegInfo_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tbName.Text)) { MessageBox.Show("请输入患者姓名!"); return; } dynamic joIn = new JObject(); joIn.PatientName = tbName.Text; joIn.BeginDate = dpST.Text; joIn.EndDate = dpED.Text; joIn.InsuRegID = tbInsuRegID.Text; if (nopwdBus.QueryRegInfo(joIn, out err) != 0) { MessageBox.Show(err); } else { JObject joRtn = JObject.Parse(err); DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable)); dgvHisRegInfo.DataSource = dt; } } private void tsmApply_Click(object sender, EventArgs e) { ApplyReason frm = new ApplyReason(); if (frm.ShowDialog() != DialogResult.OK) { return; } DataTable dt = (DataTable)dgvHisRegInfo.DataSource; int i = dgvHisRegInfo.CurrentRow.Index; dynamic joApply = new JObject(); joApply.prm_yabtch = dt.Rows[i]["InsuranceAreaCode"].ToString(); joApply.prm_yab003 = dt.Rows[i]["InsuranceAreaCode"].ToString(); joApply.prm_akb020 = Global.inf.hospitalNO; joApply.prm_aae011 = Global.user.ID; joApply.prm_ykc141 = Global.user.name; joApply.prm_aae036 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); dynamic joApplyDetail = new JObject(); joApplyDetail.prm_akc190 = dt.Rows[i]["InsuRegID"].ToString(); joApplyDetail.prm_aka130 = dt.Rows[i]["MedicalType"].ToString(); joApplyDetail.prm_aac001 = dt.Rows[i]["PersonalNO"].ToString(); joApplyDetail.prm_aac003 = dt.Rows[i]["PatientName"].ToString(); joApplyDetail.prm_aac002 = dt.Rows[i]["CertificateNO"].ToString(); joApplyDetail.prm_ykb065 = dt.Rows[i]["InsuType"].ToString(); joApplyDetail.prm_aab001 = ""; joApplyDetail.prm_aab004 = ""; joApplyDetail.prm_aae013 = frm.reason; joApplyDetail.prm_flag = 1; JObject joRow = new JObject(); joRow.Add("row", joApplyDetail); joApply.Add("dataset", joRow); if (nopwdBus.Apply(joApply, out err) != 0) { MessageBox.Show(err); } else { MessageBox.Show("申请成功"); } } private void tsmCancel_Click(object sender, EventArgs e) { if (dgvCenterApplyInfo.Rows.Count == 0) { MessageBox.Show("请先点击查询中心申请信息按钮,确保中心存在申请数据!"); return; } DataTable dtCenterInfo = (DataTable)dgvCenterApplyInfo.DataSource; string centerRegID = dtCenterInfo.Rows[0]["str_akc190"].ToString(); DataTable dt = (DataTable)dgvHisRegInfo.DataSource; int i = dgvHisRegInfo.CurrentRow.Index; if (centerRegID != dt.Rows[i]["InsuRegID"].ToString()) { MessageBox.Show("检测到要撤销的数据与下方查询数据医保就诊号不一致,请检查!"); return; } ApplyReason frm = new ApplyReason(); if (frm.ShowDialog() != DialogResult.OK) { return; } dynamic joApply = new JObject(); joApply.prm_yabtch = dt.Rows[i]["InsuranceAreaCode"].ToString(); joApply.prm_yab003 = dt.Rows[i]["InsuranceAreaCode"].ToString(); joApply.prm_akb020 = Global.inf.hospitalNO; joApply.prm_aae011 = Global.user.ID; joApply.prm_ykc141 = Global.user.name; joApply.prm_aae036 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); dynamic joApplyDetail = new JObject(); joApplyDetail.prm_akc190 = dt.Rows[i]["InsuRegID"].ToString(); joApplyDetail.prm_aka130 = dt.Rows[i]["MedicalType"].ToString(); joApplyDetail.prm_aac001 = dt.Rows[i]["PersonalNO"].ToString(); joApplyDetail.prm_aac003 = dt.Rows[i]["PatientName"].ToString(); joApplyDetail.prm_aac002 = dt.Rows[i]["CertificateNO"].ToString(); joApplyDetail.prm_ykb065 = dt.Rows[i]["InsuType"].ToString(); joApplyDetail.prm_aab001 = ""; joApplyDetail.prm_aab004 = ""; joApplyDetail.prm_aae013 = frm.reason; joApplyDetail.prm_flag = 0; JObject joRow = new JObject(); joRow.Add("row", joApplyDetail); joApply.Add("dataset", joRow); if (nopwdBus.Apply(joApply, out err) != 0) { MessageBox.Show(err); } else { dgvCenterApplyInfo.DataSource = null; MessageBox.Show("撤销成功"); } } private void btnClose_Click(object sender, EventArgs e) { mainForm.Close(); } private void tsmQueryCenterInfo_Click(object sender, EventArgs e) { DataTable dt = (DataTable)dgvHisRegInfo.DataSource; int i = dgvHisRegInfo.CurrentRow.Index; dynamic joQuery = new JObject(); joQuery.prm_yabtch = dt.Rows[i]["InsuranceAreaCode"].ToString(); joQuery.prm_yab003 = dt.Rows[i]["InsuranceAreaCode"].ToString(); joQuery.prm_akb020 = Global.inf.hospitalNO; joQuery.prm_akc190 = dt.Rows[i]["InsuRegID"].ToString(); joQuery.prm_aac003 = dt.Rows[i]["PatientName"].ToString(); if (nopwdBus.QueryCenterApplyedInfo(joQuery, out err) != 0) { MessageBox.Show(err); } else { JObject joRtn = JObject.Parse(err); DataTable dtTmp = (DataTable)joRtn["output"]["sqldata"]["row"].ToObject(typeof(DataTable)); dgvCenterApplyInfo.DataSource = dtTmp; } } } }