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; using Newtonsoft.Json.Linq; using PTMedicalInsurance.Variables; namespace PTMedicalInsurance.Forms { public partial class PatientInsuInfo : Form { public DataTable dtDiseInfo; public DataTable dtTypeInfo; public JObject joSelectedInsuInfo; public DataTable dtPsnType; public PatientInsuInfo() { InitializeComponent(); } public PatientInsuInfo(JObject jo) { InitializeComponent(); if (jo["prm_ykc010"].HasValues) { if (jo["prm_ykc010"]["row"].Type == JTokenType.Array) { dtDiseInfo = (DataTable)jo["prm_ykc010"]["row"].ToObject(typeof(DataTable)); } else { JArray jaYkc010 = new JArray(); jaYkc010.Add(jo["prm_ykc010"]["row"]); dtDiseInfo = (DataTable)jaYkc010.ToObject(typeof(DataTable)); } } else { JArray ja = new JArray(); dtDiseInfo = (DataTable)ja.ToObject(typeof(DataTable)); } if (jo["prm_ykc296"].HasValues) { if (jo["prm_ykc296"]["row"].Type == JTokenType.Array) { dtPsnType = (DataTable)jo["prm_ykc296"]["row"].ToObject(typeof(DataTable)); } else { JArray jaYkc296 = new JArray(); jaYkc296.Add(jo["prm_ykc296"]["row"]); dtPsnType = (DataTable)jaYkc296.ToObject(typeof(DataTable)); } } else { JArray ja = new JArray(); dtPsnType = (DataTable)ja.ToObject(typeof(DataTable)); } //dtDiseInfo = (DataTable)jo["prm_ykc010"]["row"].ToObject(typeof(DataTable)); //dtTypeInfo = (DataTable)jo["prm_ykc296>"]["row"].ToObject(typeof(DataTable)); this.tbName.Text = jo["prm_aac003"].ToString(); this.tbPsnNO.Text = jo["prm_aac001"].ToString(); this.tbGend.Text = jo["prm_aac004"].ToString(); this.tbBirthDay.Text = jo["prm_aac006"].ToString(); //this.tbNaty.Text = jo["naty"].ToString(); //this.tbCertType.Text = jo["psn_cert_type"].ToString(); this.tbCertNO.Text = jo["prm_aac002"].ToString(); this.tbAge.Text = jo["prm_akc023"].ToString(); this.tbOrganizationNO.Text = jo["prm_aab001"].ToString(); this.tbOrganizationName.Text = jo["prm_aab004"].ToString(); this.tbInsuStatus.Text = jo["prm_aac031"].ToString(); this.tbBalc.Text = jo["prm_akc087"].ToString(); this.tbSubCenter.Text = jo["prm_yab003"].ToString(); this.tbPMedType.Text = jo["prm_ykc280"].ToString(); this.tbMedPsnType.Text = jo["prm_ykc281"].ToString(); this.tbDuty.Text = jo["prm_aac020"].ToString(); this.tbInHospState.Text = jo["prm_ykc023"].ToString(); this.tbBusType.Text = jo["prm_ykc305"].ToString(); this.tbPhone.Text = jo["prm_aae005"].ToString(); this.tbAdress.Text = jo["prm_aae006"].ToString(); this.tbMedCardNO.Text = jo["prm_yac005"].ToString(); this.tbSpecDiseFlag.Text = jo["prm_symbol"].ToString(); this.tbIsInWait.Text = jo["prm_ykc101"].ToString(); //工伤无共济信息 this.tbOutLimitPay.Text = jo["prm_yka128"].ToString(); if (jo["prm_auther_no"] != null) this.tbMutualAiderNO.Text = jo["prm_auther_no"].ToString(); if (jo["prm_auther_certno"] != null) this.tbMutualAiderCertNO.Text = jo["prm_auther_certno"].ToString(); if (jo["prm_auther_name"] != null) this.tbMutualAiderName.Text = jo["prm_auther_name"].ToString(); if (jo["prm_auther_insu_admdvs"] != null) this.tbMutualAiderDivision.Text = jo["prm_auther_insu_admdvs"].ToString(); setDgvPsnType(); setDgvDiseInfo(); dgvDiseInfo.DataSource = dtDiseInfo; dgvPsnTypeInfo.DataSource = dtPsnType; } private void AddDGVColumn(DataGridView dgv, string headerText, string dataPropertyName, int width = 120) { DataGridViewColumn newColumn = new DataGridViewTextBoxColumn(); newColumn.HeaderText = headerText; newColumn.Width = width; newColumn.DataPropertyName = dataPropertyName; newColumn.Name = dataPropertyName; dgv.Columns.Add(newColumn); } private void setDgvPsnType() { AddDGVColumn(dgvPsnTypeInfo, "城乡居民类别", "ykc296", 80); AddDGVColumn(dgvPsnTypeInfo, "城乡居民类别名称", "YKC297", 200); AddDGVColumn(dgvPsnTypeInfo, "开始时间", "AAE030"); AddDGVColumn(dgvPsnTypeInfo, "结束时间", "AAE031"); dgvPsnTypeInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold); dgvPsnTypeInfo.ColumnHeadersHeight = 40; } private void setDgvDiseInfo() { AddDGVColumn(dgvDiseInfo, "医院编码", "akb020", 80); AddDGVColumn(dgvDiseInfo, "分中心", "YAB003", 200); AddDGVColumn(dgvDiseInfo, "疾病编码", "YKA026"); AddDGVColumn(dgvDiseInfo, "病种名称", "YKA027"); AddDGVColumn(dgvDiseInfo, "开始时间", "AAE030"); AddDGVColumn(dgvDiseInfo, "结束时间", "AAE031"); AddDGVColumn(dgvDiseInfo, "拼音助记码", "YKA260", 60); AddDGVColumn(dgvDiseInfo, "病种标志名称", "YKD112"); AddDGVColumn(dgvDiseInfo, ">补助标准", "YKA068", 300); AddDGVColumn(dgvDiseInfo, ">病种标志编码", "YKD111", 300); dgvDiseInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold); dgvDiseInfo.ColumnHeadersHeight = 40; } private void uiButton1_Click(object sender, EventArgs e) { joSelectedInsuInfo["prm_ykc296"] = ""; if (dtPsnType.Rows.Count != 0) { Global.pat.patExtend.ykc296 = dtPsnType.Rows[dgvPsnTypeInfo.CurrentRow.Index]["ykc296"].ToString(); joSelectedInsuInfo["prm_ykc296"] = Global.pat.patExtend.ykc296; } DialogResult = DialogResult.OK; } private void uiButton2_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; } } }