| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 | 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.Helper;using PTMedicalInsurance.Variables;using PTMedicalInsurance.Business;namespace PTMedicalInsurance.Forms{    public partial class PatientInsuInfo : Form    {        public DataTable dtInsuInfo;        public DataTable dtIDInfo;        public JObject joSelectedInsuInfo;        public int insuInfoIndex = 0;        public int idInfoIndex = 0;        //1.声明自适应类实例        AutoResizeForm asc = new AutoResizeForm();        public PatientInsuInfo()        {            InitializeComponent();            this.StartPosition = FormStartPosition.CenterParent;            asc.controllInitializeSize(this);            asc.controlAutoSize(this);        }        public PatientInsuInfo(JObject jo)        {            InitializeComponent();            dtInsuInfo = (DataTable)jo["insuinfo"].ToObject(typeof(DataTable));            dtIDInfo   = (DataTable)jo["idetinfo"].ToObject(typeof(DataTable));            JObject joBaseInfo = JObject.FromObject(jo["baseinfo"]);            this.tbName.Text = joBaseInfo["psn_name"].ToString();            this.tbPsnNO.Text = joBaseInfo["psn_no"].ToString();            this.tbGend.Text = joBaseInfo["gend"].ToString();            this.tbBirthDay.Text = joBaseInfo["brdy"].ToString();            this.tbNaty.Text = joBaseInfo["naty"].ToString();            this.tbCertType.Text = joBaseInfo["psn_cert_type"].ToString();            this.tbCertNO.Text = joBaseInfo["certno"]+"";            this.tbAge.Text = joBaseInfo["age"] + "";            //JObject joInsuInfo = JObject.FromObject(jo["insuinfo"]);            //Global.pat.insuType= joInsuInfo["insutypeNo"].ToString();            setDgvIDInfo();            setDgvInsuInfo();            dgvInsuInfo.DataSource = dtInsuInfo;            dgvIDInfo.DataSource = dtIDInfo;        }        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 setDgvInsuInfo()        {            AddDGVColumn(dgvInsuInfo, "余额", "balc", 80);            AddDGVColumn(dgvInsuInfo, "险种类型", "insutype",200);            AddDGVColumn(dgvInsuInfo, "人员类别", "psn_type",100);            AddDGVColumn(dgvInsuInfo, "人员参保状态", "psn_insu_stas");            AddDGVColumn(dgvInsuInfo, "个人参保日期", "psn_insu_date");            AddDGVColumn(dgvInsuInfo, "暂停参保日期", "paus_insu_date");            AddDGVColumn(dgvInsuInfo, "公务员标志", "cvlserv_flag",80);            AddDGVColumn(dgvInsuInfo, "参保地医保区划", "insuplc_admdvs");            AddDGVColumn(dgvInsuInfo, "单位名称", "emp_name",300);            AddDGVColumn(dgvInsuInfo, "险种类型编码", "insutypeNo", 150);            dgvInsuInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);            dgvInsuInfo.ColumnHeadersHeight = 40;        }        private void setDgvIDInfo()        {            AddDGVColumn(dgvIDInfo, "人员身份类别", "psn_idet_type", 140);            AddDGVColumn(dgvIDInfo, "人员类别等级", "psn_type_lv", 140);            AddDGVColumn(dgvIDInfo, "开始时间", "begntime", 200);            AddDGVColumn(dgvIDInfo, "结束时间", "endtime", 200);            AddDGVColumn(dgvIDInfo, "备注", "memo", 150);            dgvIDInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);            dgvIDInfo.ColumnHeadersHeight = 40;        }        private void uiButton1_Click(object sender, EventArgs e)        {                        insuInfoIndex = dgvInsuInfo.CurrentRow.Index;            if (dtIDInfo.Rows.Count != 0 )                idInfoIndex = dgvIDInfo.CurrentRow.Index;            joSelectedInsuInfo = new JObject();            for (int i = 0; i < dtInsuInfo.Columns.Count; i++)            {                string key = dtInsuInfo.Columns[i].ColumnName;                string value = dgvInsuInfo.CurrentRow.Cells[key].Value.ToString();                joSelectedInsuInfo.Add(key, value);            }            DialogResult = DialogResult.OK;        }        private void uiButton2_Click(object sender, EventArgs e)        {            DialogResult = DialogResult.Cancel;        }        private void btnRYDY2001_Click(object sender, EventArgs e)        {            string sInput = "", errorMsg = "";            int iHis = dgvInsuInfo.CurrentRow.Index;            if (dgvInsuInfo.CurrentRow == null)            {                MessageBox.Show("请选择参保信息再查询!");                return;            }            string insutype = dgvInsuInfo.Rows[iHis].Cells["insutypeNo"].Value.ToString();            string beginDate = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd HH:mm:ss");            JObject joData = new JObject();            joData.Add("psn_no", this.tbPsnNO.Text);            joData.Add("insutype", insutype);             joData.Add("fixmedins_code", Global.inf.hospitalNO);            joData.Add("med_type", "11");            joData.Add("begntime", beginDate);            joData.Add("endtime", "");            joData.Add("dise_codg", "");            joData.Add("dise_name", "");            joData.Add("oprn_oprt_code", "");            joData.Add("oprn_oprt_name", "");            joData.Add("matn_type", "");            joData.Add("birctrl_type", "");            JObject joInput = new JObject();            joInput.Add("data", joData);            InvokeHelper invoker = new InvokeHelper();            JObject joRtn = invoker.invokeCenterService(TradeEnum.BenefitCheck, joInput);            if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)            {                MessageBox.Show("人员待遇享受检查失败:" + errorMsg);            }            else            {                string treatInfo = JsonHelper.getDestValue(joRtn, "output.trtinfo");                if (!string.IsNullOrEmpty(treatInfo))                {                    JArray jarray = JArray.Parse(treatInfo);                    StringBuilder sb = new StringBuilder();                    foreach (JObject obj in jarray)                    {                        string flag = JsonHelper.getDestValue(obj, "trt_enjymnt_flag");                        if ("0".Equals(flag))                        {                            string fundType = JsonHelper.getDestValue(obj, "fund_pay_type");                            string msg = JsonHelper.getDestValue(obj, "trt_chk_rslt");                            sb.Append("基金类型:【" + fundType + "】" + msg);                        }                    }                    if (sb.Length > 0)                    {                        MessageBox.Show("人员待遇享受检查结果:" + sb.ToString());                        return;                    }                }                MessageBox.Show("人员待遇享受检查结果:【正常】!");            }        }    }}
 |