ChooseCard.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. private void tbName_DoubleClick(object sender, EventArgs e)
  28. {
  29. }
  30. public ChooseCard()
  31. {
  32. InitializeComponent();
  33. this.StartPosition = FormStartPosition.CenterParent;
  34. }
  35. private void btOk_Click(object sender, EventArgs e)
  36. {
  37. if (rbgOtherProv.SelectedIndex == 0)
  38. bOtherProvLocal = false; //本地
  39. else
  40. bOtherProvLocal = true; //异地
  41. if ((tbPZLP.Text != "") && (tbZJHM.Text == ""))
  42. tbZJHM.Text = tbPZLP.Text;
  43. sP_CertType = "0" + (rbgMdtrtCertType.SelectedIndex +1).ToString(); //就诊凭证类型
  44. sP_CertNO = tbPZLP.Text; //凭证令牌
  45. sP_IDNO = tbZJHM.Text; //证件号码
  46. sP_CardSN = tbCardSN.Text; //卡识别码
  47. sP_IDType = cbDocumentType.Text.Trim().Substring(0, 6); //证件类型
  48. PatName = tbName.Text; //姓名
  49. //电子凭证
  50. if (rbgMdtrtCertType.SelectedIndex == 0)
  51. {
  52. sL_CertCodeType= "01" + cbYMYWLX.Text.Trim().Substring(0,3); //用码业务类型
  53. if (tbName.Text == "")
  54. {
  55. MessageBox.Show("电子凭证需要输入姓名!");
  56. return;
  57. }
  58. sL_CertCodeType= "01" + cbYMYWLX.Text.Trim().Substring(0,3); //用码业务类型
  59. if (rbgEcCertDecodeType.SelectedIndex == 0)
  60. {
  61. sL_EcCertDecodeTradeNO = "ec.query";
  62. EcCertDecodeType = "0";
  63. }
  64. else if (rbgEcCertDecodeType.SelectedIndex == 1)
  65. {
  66. sL_EcCertDecodeTradeNO = "cn.nhsa.qrcode.get";
  67. EcCertDecodeType = "1";
  68. }
  69. else if (rbgEcCertDecodeType.SelectedIndex == 2)
  70. {
  71. sL_EcCertDecodeTradeNO = "cn.nhsa.auth.check";
  72. EcCertDecodeType = "2";
  73. }
  74. }
  75. //身份证
  76. if (rbgMdtrtCertType.SelectedIndex == 1)
  77. {
  78. if (tbZJHM.Text == "")
  79. {
  80. MessageBox.Show("使用身份证读卡时,证件号码不能为空!");
  81. return;
  82. }
  83. else
  84. {
  85. tbPZLP.Text = tbZJHM.Text;
  86. sP_CertNO = sP_IDNO;
  87. }
  88. }
  89. //社保卡
  90. if (rbgMdtrtCertType.SelectedIndex == 2)
  91. {
  92. if (cbCardType.Text == "")
  93. {
  94. MessageBox.Show("读社保卡时需要选择卡类型!");
  95. return;
  96. }
  97. sL_CardType = int.Parse(cbCardType.Text.Trim().Substring(0, 1)); //卡类型
  98. }
  99. DialogResult = DialogResult.OK;
  100. }
  101. private void ChooseCard_Load(object sender, EventArgs e)
  102. {
  103. rbgMdtrtCertType.SelectedIndex = 2; //身份证
  104. cbYMYWLX.SelectedIndex = 0; //用码业务类型
  105. rbgOtherProv.SelectedIndex = 0; //本地
  106. cbDocumentType.SelectedIndex = 0; //证件类型
  107. }
  108. private void rbgMdtrtCertType_ValueChanged(object sender, int index, string text)
  109. {
  110. if (rbgMdtrtCertType.SelectedIndex == 0)
  111. {
  112. rbgEcCertDecodeType.SelectedIndex = 0;
  113. uiLabel4.Text = "凭证令牌";
  114. rbgEcCertDecodeType.Enabled = false;
  115. cbYMYWLX.Enabled = true;
  116. uiLabel3.Visible = true;
  117. cbYMYWLX.Visible = true;
  118. }
  119. else if (rbgMdtrtCertType.SelectedIndex == 1)
  120. {
  121. uiLabel4.Text = "身份证号";
  122. rbgEcCertDecodeType.Enabled = false;
  123. cbYMYWLX.Enabled = false;
  124. uiLabel3.Visible = false;
  125. cbYMYWLX.Visible = false;
  126. tbPZLP.Text = Global.pat.certNO;
  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. }