| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- 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;
- using PTMedicalInsurance.Common;
- using PTMedicalInsurance.Forms.Setters.PatientInsuInfos;
- 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;
- public string MedType = "";
- InvokeHelper invoker = new InvokeHelper();
- private MIIrisServices mIS = new MIIrisServices();
- private DataTable dtFundPayType;
- private Form mainForm;
- //1.声明自适应类实例
- AutoResizeForm asc = new AutoResizeForm();
- public PatientInsuInfo()
- {
- InitializeComponent();
- this.StartPosition = FormStartPosition.CenterParent;
- asc.controllInitializeSize(this);
- asc.controlAutoSize(this);
- //获取通用目录
- string sTYML = mIS.GetCommonInterface_Dr(Global.inf.interfaceDr.ToString(), "");
- if (sTYML == "")
- Global.inf.InsuCurrencyCataLogue = Global.inf.interfaceDr;
- else
- Global.inf.InsuCurrencyCataLogue = int.Parse(sTYML);
- }
- public PatientInsuInfo(JObject jo, Form frm)
- {
- InitializeComponent();
- InitForm(jo, frm);
- }
- private void InitForm(JObject jo)
- {
- 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"].ToString();
- this.tbAge.Text = joBaseInfo["age"].ToString();
- string expContent = joBaseInfo["exp_content"].ToString(); //字段扩展 只有居民返回
- setDgvIDInfo();
- setDgvInsuInfo();
- setDgvChronicDiseaseRecordInfo();
- setDgvTreatement(dgvTreatment);
- dgvInsuInfo.DataSource = dtInsuInfo;
- dgvIDInfo.DataSource = dtIDInfo;
- }
- private void InitForm(JObject jo, Form frm)
- {
- InitForm(jo);
- 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;
- }
- }
- 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"] + "";
- GridViewSetter grdSetter = new GridViewSetter();
- grdSetter.setDgvIDInfo(dgvIDInfo);
- grdSetter.setDgvInsuInfo(dgvInsuInfo);
- grdSetter.setDgvTreatement(dgvTreatment);
- grdSetter.setDgvChronicDiseaseRecordInfo(dgvChronicDiseaseRecordInfo);
-
- dgvInsuInfo.DataSource = dtInsuInfo;
- dgvIDInfo.DataSource = dtIDInfo;
- //提示参保地本地或异地
- if (!string.IsNullOrEmpty(Global.pat.insuplc_admdvs))
- {
- if (Global.pat.insuplc_admdvs.Substring(0, 4) != Global.pat.mdtrtarea_admvs.Substring(0, 4))
- {
- lb_Locate.Visible = true;
- lb_Locate.Text = "异地";
- lb_Locate.ForeColor = Color.Red;
- lb_Locate.Font = new Font(lb_Locate.Font.Name, 20, FontStyle.Bold); // 设置字体大小和样式
- lb_Locate.ForeColor = Color.Red; // 设置字体颜色为红色
- }
- else
- lb_Locate.Visible = false;
- }
- //【5301】人员慢特病备案查询
- if (trade5301(Global.pat.psn_no, out string Msg) == 0) //查询返回门诊慢特病信息
- {
- dgvChronicDiseaseRecordInfo.CellFormatting
- += new DataGridViewCellFormattingEventHandler(dgvChronicDiseaseRecordInfo_CellFormatting);
- JObject joRtn = JObject.Parse(Msg);
- DataTable dt = (DataTable)joRtn["output"]["feedetail"].ToObject(typeof(DataTable));
- dgvChronicDiseaseRecordInfo.DataSource = dt;
- }
- //获取通用目录
- string sTYML = mIS.GetCommonInterface_Dr(Global.inf.interfaceDr.ToString(), "");
- if (sTYML == "")
- Global.inf.InsuCurrencyCataLogue = Global.inf.interfaceDr;
- else
- Global.inf.InsuCurrencyCataLogue = int.Parse(sTYML);
- string sqlStr = "";
- string sqlCondition = " and A.Interface_Dr = '" + Global.inf.InsuCurrencyCataLogue.ToString() + "'";
- sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'fund_pay_type'" + sqlCondition;
- dtFundPayType = GetDBLKComboxTable(sqlStr);
- sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'med_type'" + sqlCondition;
- SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
- if (Global.inf.hospitalDr == 85)
- tabControl1.SelectedIndex = 0;
- else
- tabControl1.SelectedIndex = 3;
- }
- 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 DataTable GetDBLKComboxTable(string sqlStr)
- {
- InvokeHelper invoker = new InvokeHelper();
- dynamic joInparm = new JObject();
- dynamic joTmp = new JObject();
- joTmp.sqlStr = sqlStr;
- JArray jaParams = new JArray();
- jaParams.Add(joTmp);
- joInparm.Add("params", JArray.FromObject(jaParams));
- joInparm.code = "09010014";
- string inParam = joInparm.ToString();
- JObject joRtn = invoker.invokeInsuService(inParam, "获取下拉框消息");
- DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
- return dt;
- }
- private void SetDBLKCombox(ref PTControl.DBLookupCombox dblcbx, string sqlStr)
- {
- dblcbx.sDisplayField = "Code,Name,SearchCode";
- dblcbx.sDisplayMember = "名称";
- dblcbx.sKeyWords = "Code,SearchCode";
- DataTable dt = GetDBLKComboxTable(sqlStr);
- dblcbx.DataSource = dt;
- if (dt?.Rows.Count > 0)
- {
- // default to select first one;
- }
- dblcbx.RowFilterVisible = true;
- dblcbx.TextBox.Width = 400;
- dblcbx.DataGridView.Width = 400;
- dblcbx.DataGridView.Columns[0].Name = "编码";
- dblcbx.DataGridView.Columns[1].Name = "名称";
- dblcbx.DataGridView.Columns[2].Name = "查找码";
- dblcbx.DataGridView.Columns[0].Width = 100;
- dblcbx.DataGridView.Columns[1].Width = 200;
- }
- public void setDgvTreatement(DataGridView dgv)
- {
- dgv.AutoGenerateColumns = false;
- dgv.Columns.Clear();
- AddDGVColumn(dgv, "人员编号", "psn_no", 350);
- AddDGVColumn(dgv, "待遇检查类型", "trt_chk_type", 130);
- AddDGVColumn(dgv, "基金支付类型", "fund_pay_type", 300);
- AddDGVColumn(dgv, "基金款项待遇享受标志", "trt_enjymnt_flag", 150);
- AddDGVColumn(dgv, "开始日期", "begndate", 220);
- AddDGVColumn(dgv, "结束日期", "enddate", 220);
- AddDGVColumn(dgv, "待遇检查结果", "trt_chk_rslt", 130);
- AddDGVColumn(dgv, "字段扩展", "exp_content", 120);
- dgv.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
- dgv.ColumnHeadersHeight = 30;
- }
- private void setDgvInsuInfo()
- {
- AddDGVColumn(dgvInsuInfo, "余额", "balc", 70);
- AddDGVColumn(dgvInsuInfo, "险种类型", "insutype", 170);
- AddDGVColumn(dgvInsuInfo, "人员类别", "psn_type",100);
- AddDGVColumn(dgvInsuInfo, "人员参保状态", "psn_insu_stas",100);
- AddDGVColumn(dgvInsuInfo, "个人参保日期", "psn_insu_date", 150);
- AddDGVColumn(dgvInsuInfo, "暂停参保日期", "paus_insu_date", 150);
- AddDGVColumn(dgvInsuInfo, "公务员标志", "cvlserv_flag", 120);
- AddDGVColumn(dgvInsuInfo, "参保区划", "insuplc_admdvs", 85);
- AddDGVColumn(dgvInsuInfo, "单位名称", "emp_name", 280);
- AddDGVColumn(dgvInsuInfo, "险种类型编码", "insutypeNo",100);
- dgvInsuInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
- dgvInsuInfo.ColumnHeadersHeight = 40; //341124199210252617
- }
- private void setDgvIDInfo()
- {
- AddDGVColumn(dgvIDInfo, "人员身份类别", "psn_idet_type", 140);
- AddDGVColumn(dgvIDInfo, "人员类别等级", "psn_type_lv", 140);
- AddDGVColumn(dgvIDInfo, "备注", "memo", 150);
- AddDGVColumn(dgvIDInfo, "开始时间", "begntime", 200);
- AddDGVColumn(dgvIDInfo, "结束时间", "endtime", 200);
- dgvIDInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
- dgvIDInfo.ColumnHeadersHeight = 40;
- }
- private void setDgvChronicDiseaseRecordInfo()
- {
- AddDGVColumn(dgvChronicDiseaseRecordInfo, "门慢门特病种目录代码", "opsp_dise_code", 200);
- AddDGVColumn(dgvChronicDiseaseRecordInfo, "门慢门特病种名称", "opsp_dise_name", 200);
- AddDGVColumn(dgvChronicDiseaseRecordInfo, "开始时间", "begndate", 200);
- AddDGVColumn(dgvChronicDiseaseRecordInfo, "结束时间", "enddate", 200);
- dgvChronicDiseaseRecordInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
- dgvChronicDiseaseRecordInfo.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 JObject QueryPaymentDetail()
- {
- var joData = new { data = new { psn_no = this.tbPsnNO.Text } };
- return invoker.invokeCenterService(TradeEnum.QueryPaymentDetail,JObject.FromObject(joData));
- }
- 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);
- 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("人员待遇享受检查结果:【正常】!");
- }
- }
- private void dgvInsuInfo_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- uiButton1_Click(sender,e);
- }
- private JObject QueryTurnToOtherHospInfo()
- {
- var joData = new { data = new { psn_no = this.tbPsnNO.Text, refl_fil_type = tools.getDestPosStrBySpliter(cbTurnType.Text,1,".") , begntime = tbBeginDate.Text,endtime = tbEndDate.Text} };
- return invoker.invokeCenterService(TradeEnum.QueryTransferInfo, JObject.FromObject(joData));
- }
- private void btTurnToOtherHosp_Click(object sender, EventArgs e)
- {
- JObject joRtn = QueryTurnToOtherHospInfo();
- string err;
- if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
- {
- MessageBox.Show(err);
- return;
- }
- dgvTurnToOtherHospInfo.DataSource = (DataTable)joRtn["output"]["result"].ToObject(typeof(DataTable));
- }
- private JObject QueryTreamentInfo()
- {
- int i = dgvInsuInfo.SelectedIndex;
- string insutype = dgvInsuInfo.Rows[i].Cells["insutypeNo"].Value.ToString() ;
- //var joData = new { data = new { psn_no = this.tbPsnNO.Text, insutype =insutype, med_type = tools.getDestPosStrBySpliter(cbxMedicalType.Text, 1, "."), begntime = tbBeginDate_treatment.Text, endtime = tbEndDate_treatment.Text, fixmedins_code = Global.inf.hospitalNO} };
- var joData = new { data = new { psn_no = this.tbPsnNO.Text, insutype =insutype, med_type = MedType, begntime = tbBeginDate_treatment.Text, endtime = tbEndDate_treatment.Text, fixmedins_code = Global.inf.hospitalNO} };
- return invoker.invokeCenterService(TradeEnum.BenefitCheck, JObject.FromObject(joData));
- }
- private void btTreatment_Click(object sender, EventArgs e)
- {
- if (dblkcbxMedicalType.Text == "")
- {
- MessageBox.Show("请先选择医疗类别再查询");
- return;
- }
- JObject joRtn = QueryTreamentInfo();
- string err;
- if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
- {
- MessageBox.Show(err);
- return;
- }
- else
- {
- dgvTreatment.DataSource = (DataTable)joRtn["output"]["trtinfo"].ToObject(typeof(DataTable));
- DataTable dt = (DataTable)joRtn["output"]["trtinfo"].ToObject(typeof(DataTable));
- if (dt.Rows.Count == 0)
- MessageBox.Show("查询完成");
- }
- }
- private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
- {
- DataGridViewRow row = e.Value as DataGridViewRow;
- DataRowView dataRow = row.DataBoundItem as DataRowView;
- MedType = dataRow["Code"].ToString().Trim();
- }
- public int trade5301(string PsnNo, out string outParam)
- {
- outParam = "";
- string errorMsg = "";
- JObject joInput = new JObject();
- JObject joData = new JObject();
- joData.Add("psn_no", PsnNo);
- joInput.Add("data", joData);
- InvokeHelper invoker = new InvokeHelper();
- JObject joRtn = invoker.invokeCenterService(TradeEnum.QueryChronicDiseaseRecordInfo, joInput);
- if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
- {
- outParam = "人员慢特病备案信息查询失败:" + errorMsg;
- return -1;
- }
- else
- {
- if (JArray.Parse(JsonHelper.getDestValue(joRtn, "output.feedetail")).Count == 0)
- return -1;
- outParam = joRtn.ToString();
- return 0;
- }
- }
- private void dgvChronicDiseaseRecordInfo_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- if ((DataTable)dgvChronicDiseaseRecordInfo.DataSource != null)
- {
- Global.pat.DiseasecCode =
- dgvChronicDiseaseRecordInfo.Rows[dgvChronicDiseaseRecordInfo.CurrentRow.Index].Cells["opsp_dise_code"].Value.ToString();
- Global.pat.DiseasecName =
- dgvChronicDiseaseRecordInfo.Rows[dgvChronicDiseaseRecordInfo.CurrentRow.Index].Cells["opsp_dise_name"].Value.ToString();
- Global.pat.iRes_Chronic = 0;
- uiButton1_Click(sender, e);
- }
- }
- private void dgvChronicDiseaseRecordInfo_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
- {
- if (e.RowIndex == dgvChronicDiseaseRecordInfo.CurrentRow.Index) // 如果是当前行
- e.CellStyle.BackColor = Color.Red; // 设置背景色
- }
- }
- }
|