ChooseCard.cs 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.SqlTypes;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using PTMedicalInsurance.Common;
  12. using PTMedicalInsurance.Helper;
  13. using Newtonsoft.Json.Linq;
  14. using PTMedicalInsurance.Forms;
  15. using PTMedicalInsurance.Variables;
  16. using System.Xml.Linq;
  17. namespace PTMedicalInsurance.Forms
  18. {
  19. public partial class ChooseCard : Form
  20. {
  21. public string sP_CertType, sP_CertNO, sP_CardSN, sP_IDType, sP_IDNO, sL_CertCodeType, sL_EcCertDecodeTradeNO;
  22. public string businessType, EcCertDecodeType;
  23. public string ID, PatName;
  24. public Boolean bOtherProvLocal = false;
  25. public int sL_CardType;
  26. //设置业务实例
  27. InvokeHelper invoker = new InvokeHelper();
  28. private void rbgOtherProv_ValueChanged(object sender, int index, string text)
  29. {
  30. }
  31. public ChooseCard()
  32. {
  33. InitializeComponent();
  34. this.StartPosition = FormStartPosition.CenterParent;
  35. }
  36. private void btOk_Click(object sender, EventArgs e)
  37. {
  38. if (rbgOtherProv.SelectedIndex == 0)
  39. {
  40. bOtherProvLocal = false; //本地
  41. //Global.curEvt.token = invoker.GetToken("http://ddjk.jlhs.gov.cn:20215", 1);//获取TOKEN地址
  42. }
  43. else
  44. {
  45. bOtherProvLocal = true; //异地
  46. //Global.curEvt.token = invoker.GetToken("http://ddjk.jlhs.gov.cn:20215", 2);//获取TOKEN地址异地
  47. }
  48. //MessageBox.Show("获取TOKEN--" + Global.curEvt.token);
  49. if ((tbPZLP.Text != "") && (tbZJHM.Text == ""))
  50. tbZJHM.Text = tbPZLP.Text;
  51. sP_CertType = "0" + (rbgMdtrtCertType.SelectedIndex + 1).ToString(); //就诊凭证类型
  52. sP_CertNO = tbPZLP.Text; //凭证令牌
  53. sP_IDNO = tbZJHM.Text; //证件号码
  54. sP_CardSN = tbCardSN.Text; //卡识别码
  55. sP_IDType = cbDocumentType.Text.Trim().Substring(0, 6); //证件类型
  56. PatName = tbName.Text; //姓名
  57. //电子凭证
  58. if (rbgMdtrtCertType.SelectedIndex == 0)
  59. {
  60. sL_CertCodeType = "01" + cbYMYWLX.Text.Trim().Substring(0, 3); //用码业务类型
  61. if (rbgEcCertDecodeType.SelectedIndex == 0)
  62. {
  63. sL_EcCertDecodeTradeNO = "ec.query";
  64. EcCertDecodeType = "0";
  65. }
  66. else if (rbgEcCertDecodeType.SelectedIndex == 1)
  67. {
  68. sL_EcCertDecodeTradeNO = "cn.nhsa.qrcode.get";
  69. EcCertDecodeType = "1";
  70. }
  71. else if (rbgEcCertDecodeType.SelectedIndex == 2)
  72. {
  73. sL_EcCertDecodeTradeNO = "cn.nhsa.auth.check";
  74. EcCertDecodeType = "2";
  75. }
  76. }
  77. //身份证
  78. if (rbgMdtrtCertType.SelectedIndex == 1)
  79. {
  80. if (tbZJHM.Text == "")
  81. {
  82. //MessageBox.Show("使用身份证读卡时,证件号码不能为空!");
  83. //return;
  84. }
  85. else
  86. {
  87. tbPZLP.Text = tbZJHM.Text;
  88. sP_CertNO = sP_IDNO;
  89. }
  90. //if (tbName.Text == "")
  91. //{
  92. // MessageBox.Show("参保人姓名不能为空!");
  93. // return;
  94. //}
  95. }
  96. //社保卡
  97. if (rbgMdtrtCertType.SelectedIndex == 2)
  98. {
  99. if (cbCardType.Text == "")
  100. {
  101. MessageBox.Show("读社保卡时需要选择卡类型!");
  102. return;
  103. }
  104. sL_CardType = int.Parse(cbCardType.Text.Trim().Substring(0, 1)); //卡类型
  105. }
  106. //if (((bOtherProvLocal)&&(cbCBD.Text==""))&&(rbgMdtrtCertType.SelectedIndex!=0))
  107. //{
  108. // MessageBox.Show("异地读卡,请选择统筹区!");
  109. // return;
  110. //}
  111. Global.pat.creditFlag = ckbCredit.Checked ? "1" : "0";
  112. DialogResult = DialogResult.OK;
  113. }
  114. private void ChooseCard_Load(object sender, EventArgs e)
  115. {
  116. rbgMdtrtCertType.SelectedIndex = 2; //身份证
  117. cbYMYWLX.SelectedIndex = 0; //用码业务类型
  118. rbgOtherProv.SelectedIndex = 0; //本地
  119. cbDocumentType.SelectedIndex = 0; //证件类型
  120. ckbCredit.Checked = true;
  121. }
  122. private void rbgMdtrtCertType_ValueChanged(object sender, int index, string text)
  123. {
  124. if (rbgMdtrtCertType.SelectedIndex == 0)
  125. {
  126. rbgEcCertDecodeType.SelectedIndex = 0;
  127. uiLabel4.Text = "凭证令牌";
  128. rbgEcCertDecodeType.Enabled = true;
  129. cbYMYWLX.Enabled = true;
  130. uiLabel3.Visible = true;
  131. cbYMYWLX.Visible = true;
  132. }
  133. else if (rbgMdtrtCertType.SelectedIndex == 1)
  134. {
  135. uiLabel4.Text = "身份证号";
  136. rbgEcCertDecodeType.Enabled = false;
  137. cbYMYWLX.Enabled = false;
  138. uiLabel3.Visible = false;
  139. cbYMYWLX.Visible = false;
  140. }
  141. else if (rbgMdtrtCertType.SelectedIndex == 2)
  142. {
  143. uiLabel4.Text = "社保卡号";
  144. cbCardType.SelectedIndex = 0;
  145. rbgEcCertDecodeType.Enabled = false;
  146. cbYMYWLX.Enabled = false;
  147. uiLabel3.Visible = false;
  148. cbYMYWLX.Visible = false;
  149. }
  150. }
  151. private void btCancle_Click(object sender, EventArgs e)
  152. {
  153. DialogResult = DialogResult.Cancel;
  154. }
  155. private void uiButton1_Click(object sender, EventArgs e)
  156. {
  157. string sInput = "", errorMsg = "";
  158. JObject joData = new JObject();
  159. joData.Add("", "");
  160. JObject joInput = new JObject();
  161. joInput.Add("data", joData);
  162. InvokeHelper invoker = new InvokeHelper();
  163. sInput = JsonHelper.setCenterInpar("1193", "");
  164. JObject joRtn = invoker.invokeCenterService("1193", sInput);
  165. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  166. {
  167. MessageBox.Show("修改卡密码失败:" + errorMsg);
  168. }
  169. else
  170. {
  171. MessageBox.Show("修改卡密码成功!");
  172. }
  173. }
  174. private void SearchAdmdvs()
  175. {
  176. JObject joAdmdvsInfo = new JObject();
  177. SearchAdmdvs Adm = new SearchAdmdvs();
  178. try
  179. {
  180. Global.pat.card.SearchAdmKey = cbCBD.Text;
  181. Adm.StartPosition = FormStartPosition.CenterParent;
  182. if (Adm.ShowDialog() == DialogResult.OK)
  183. {
  184. cbCBD.Text = Global.pat.card.SearchAdmName;
  185. }
  186. }
  187. catch (Exception ex)
  188. {
  189. MessageBox.Show("异常:" + ex.Message);
  190. return;
  191. }
  192. }
  193. private void cbCBD_DoEnter(object sender, EventArgs e)
  194. {
  195. SearchAdmdvs();
  196. }
  197. }
  198. }