ChooseCard.cs 7.1 KB

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