using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.SqlTypes; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using PTMedicalInsurance.Common; using PTMedicalInsurance.Helper; using Newtonsoft.Json.Linq; using PTMedicalInsurance.Forms; using PTMedicalInsurance.Variables; using System.Xml.Linq; namespace PTMedicalInsurance.Forms { public partial class ChooseCard : Form { public string sP_CertType, sP_CertNO, sP_CardSN, sP_IDType, sP_IDNO, sL_CertCodeType, sL_EcCertDecodeTradeNO; public string businessType, EcCertDecodeType; public string ID, PatName; public Boolean bOtherProvLocal = false; public int sL_CardType; //设置业务实例 InvokeHelper invoker = new InvokeHelper(); private void rbgOtherProv_ValueChanged(object sender, int index, string text) { } public ChooseCard() { InitializeComponent(); this.StartPosition = FormStartPosition.CenterParent; } private void btOk_Click(object sender, EventArgs e) { if (rbgOtherProv.SelectedIndex == 0) { bOtherProvLocal = false; //本地 //Global.curEvt.token = invoker.GetToken("http://ddjk.jlhs.gov.cn:20215", 1);//获取TOKEN地址 } else { bOtherProvLocal = true; //异地 //Global.curEvt.token = invoker.GetToken("http://ddjk.jlhs.gov.cn:20215", 2);//获取TOKEN地址异地 } //MessageBox.Show("获取TOKEN--" + Global.curEvt.token); if ((tbPZLP.Text != "") && (tbZJHM.Text == "")) tbZJHM.Text = tbPZLP.Text; sP_CertType = "0" + (rbgMdtrtCertType.SelectedIndex + 1).ToString(); //就诊凭证类型 sP_CertNO = tbPZLP.Text; //凭证令牌 sP_IDNO = tbZJHM.Text; //证件号码 sP_CardSN = tbCardSN.Text; //卡识别码 sP_IDType = cbDocumentType.Text.Trim().Substring(0, 6); //证件类型 PatName = tbName.Text; //姓名 //电子凭证 if (rbgMdtrtCertType.SelectedIndex == 0) { sL_CertCodeType = "01" + cbYMYWLX.Text.Trim().Substring(0, 3); //用码业务类型 if (rbgEcCertDecodeType.SelectedIndex == 0) { sL_EcCertDecodeTradeNO = "ec.query"; EcCertDecodeType = "0"; } else if (rbgEcCertDecodeType.SelectedIndex == 1) { sL_EcCertDecodeTradeNO = "cn.nhsa.qrcode.get"; EcCertDecodeType = "1"; } else if (rbgEcCertDecodeType.SelectedIndex == 2) { sL_EcCertDecodeTradeNO = "cn.nhsa.auth.check"; EcCertDecodeType = "2"; } } //身份证 if (rbgMdtrtCertType.SelectedIndex == 1) { if (tbZJHM.Text == "") { //MessageBox.Show("使用身份证读卡时,证件号码不能为空!"); //return; } else { tbPZLP.Text = tbZJHM.Text; sP_CertNO = sP_IDNO; } //if (tbName.Text == "") //{ // MessageBox.Show("参保人姓名不能为空!"); // return; //} } //社保卡 if (rbgMdtrtCertType.SelectedIndex == 2) { if (cbCardType.Text == "") { MessageBox.Show("读社保卡时需要选择卡类型!"); return; } sL_CardType = int.Parse(cbCardType.Text.Trim().Substring(0, 1)); //卡类型 } //if (((bOtherProvLocal)&&(cbCBD.Text==""))&&(rbgMdtrtCertType.SelectedIndex!=0)) //{ // MessageBox.Show("异地读卡,请选择统筹区!"); // return; //} DialogResult = DialogResult.OK; } private void ChooseCard_Load(object sender, EventArgs e) { rbgMdtrtCertType.SelectedIndex = 1; //身份证 cbYMYWLX.SelectedIndex = 0; //用码业务类型 rbgOtherProv.SelectedIndex = 0; //本地 cbDocumentType.SelectedIndex = 0; //证件类型 } private void rbgMdtrtCertType_ValueChanged(object sender, int index, string text) { if (rbgMdtrtCertType.SelectedIndex == 0) { rbgEcCertDecodeType.SelectedIndex = 0; uiLabel4.Text = "凭证令牌"; rbgEcCertDecodeType.Enabled = false; cbYMYWLX.Enabled = true; uiLabel3.Visible = true; cbYMYWLX.Visible = true; } else if (rbgMdtrtCertType.SelectedIndex == 1) { uiLabel4.Text = "身份证号"; rbgEcCertDecodeType.Enabled = false; cbYMYWLX.Enabled = false; uiLabel3.Visible = false; cbYMYWLX.Visible = false; } else if (rbgMdtrtCertType.SelectedIndex == 2) { uiLabel4.Text = "社保卡号"; cbCardType.SelectedIndex = 0; rbgEcCertDecodeType.Enabled = false; cbYMYWLX.Enabled = false; uiLabel3.Visible = false; cbYMYWLX.Visible = false; } } private void btCancle_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; } private void uiButton1_Click(object sender, EventArgs e) { string sInput = "", errorMsg = ""; JObject joData = new JObject(); joData.Add("", ""); JObject joInput = new JObject(); joInput.Add("data", joData); InvokeHelper invoker = new InvokeHelper(); sInput = JsonHelper.setCenterInpar("1193", ""); JObject joRtn = invoker.invokeCenterService("1193", sInput); if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0) { MessageBox.Show("修改卡密码失败:" + errorMsg); } else { MessageBox.Show("修改卡密码成功!"); } } private void SearchAdmdvs() { JObject joAdmdvsInfo = new JObject(); SearchAdmdvs Adm = new SearchAdmdvs(); try { Global.pat.card.SearchAdmKey = cbCBD.Text; Adm.StartPosition = FormStartPosition.CenterParent; if (Adm.ShowDialog() == DialogResult.OK) { cbCBD.Text = Global.pat.card.SearchAdmName; } } catch (Exception ex) { MessageBox.Show("异常:" + ex.Message); return; } } private void cbCBD_DoEnter(object sender, EventArgs e) { SearchAdmdvs(); } } }