ChooseCard.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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.ec.auth"; //终端-刷脸授权获取医保身份接口
  63. //sL_EcCertDecodeTradeNO = "cn.nhsa.auth.check"; //终端-刷脸授权获取医保身份接口
  64. EcCertDecodeType = "2";
  65. }
  66. }
  67. //身份证
  68. if (rbgMdtrtCertType.SelectedIndex == 1)
  69. {
  70. if (tbZJHM.Text == "")
  71. {
  72. MessageBox.Show("使用身份证读卡时,证件号码不能为空!");
  73. return;
  74. }
  75. else
  76. {
  77. tbPZLP.Text = tbZJHM.Text;
  78. sP_CertNO = sP_IDNO;
  79. }
  80. //if (tbName.Text == "")
  81. //{
  82. // MessageBox.Show("参保人姓名不能为空!");
  83. // return;
  84. //}
  85. }
  86. //社保卡
  87. if (rbgMdtrtCertType.SelectedIndex == 2)
  88. {
  89. if (cbCardType.Text == "")
  90. {
  91. MessageBox.Show("读社保卡时需要选择卡类型!");
  92. return;
  93. }
  94. sL_CardType = int.Parse(cbCardType.Text.Trim().Substring(0, 1)); //卡类型
  95. }
  96. //if (((bOtherProvLocal)&&(cbCBD.Text==""))&&(rbgMdtrtCertType.SelectedIndex!=0))
  97. //{
  98. // MessageBox.Show("异地读卡,请选择统筹区!");
  99. // return;
  100. //}
  101. DialogResult = DialogResult.OK;
  102. }
  103. private void ChooseCard_Load(object sender, EventArgs e)
  104. {
  105. rbgMdtrtCertType.SelectedIndex = 1; //身份证
  106. cbYMYWLX.SelectedIndex = 0; //用码业务类型
  107. rbgOtherProv.SelectedIndex = 0; //本地
  108. cbDocumentType.SelectedIndex = 0; //证件类型
  109. }
  110. private void rbgMdtrtCertType_ValueChanged(object sender, int index, string text)
  111. {
  112. if (rbgMdtrtCertType.SelectedIndex == 0)
  113. {
  114. rbgEcCertDecodeType.SelectedIndex = 0;
  115. uiLabel4.Text = "凭证令牌";
  116. rbgEcCertDecodeType.Enabled = true;
  117. cbYMYWLX.Enabled = true;
  118. uiLabel3.Visible = true;
  119. cbYMYWLX.Visible = true;
  120. }
  121. else if (rbgMdtrtCertType.SelectedIndex == 1)
  122. {
  123. uiLabel4.Text = "身份证号";
  124. rbgEcCertDecodeType.Enabled = false;
  125. cbYMYWLX.Enabled = false;
  126. uiLabel3.Visible = false;
  127. cbYMYWLX.Visible = false;
  128. }
  129. else if (rbgMdtrtCertType.SelectedIndex == 2)
  130. {
  131. uiLabel4.Text = "社保卡号";
  132. cbCardType.SelectedIndex = 0;
  133. rbgEcCertDecodeType.Enabled = false;
  134. cbYMYWLX.Enabled = false;
  135. uiLabel3.Visible = false;
  136. cbYMYWLX.Visible = false;
  137. }
  138. }
  139. private void btCancle_Click(object sender, EventArgs e)
  140. {
  141. DialogResult = DialogResult.Cancel;
  142. }
  143. private void uiButton1_Click(object sender, EventArgs e)
  144. {
  145. string sInput = "", errorMsg="";
  146. JObject joData = new JObject();
  147. joData.Add("", "");
  148. JObject joInput = new JObject();
  149. joInput.Add("data", joData);
  150. InvokeHelper invoker = new InvokeHelper();
  151. sInput = JsonHelper.setCenterInpar("1193", "");
  152. JObject joRtn =invoker.invokeCenterService("1193", sInput);
  153. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  154. {
  155. MessageBox.Show("修改卡密码失败:" + errorMsg);
  156. }
  157. else
  158. {
  159. MessageBox.Show("修改卡密码成功!");
  160. }
  161. }
  162. private void SearchAdmdvs()
  163. {
  164. JObject joAdmdvsInfo = new JObject();
  165. SearchAdmdvs Adm = new SearchAdmdvs();
  166. try
  167. {
  168. Global.pat.card.SearchAdmKey = cbCBD.Text;
  169. Adm.StartPosition = FormStartPosition.CenterParent;
  170. if (Adm.ShowDialog() == DialogResult.OK)
  171. {
  172. cbCBD.Text = Global.pat.card.SearchAdmName;
  173. }
  174. }
  175. catch (Exception ex)
  176. {
  177. MessageBox.Show("异常:" + ex.Message);
  178. return;
  179. }
  180. }
  181. private void cbCBD_DoEnter(object sender, EventArgs e)
  182. {
  183. SearchAdmdvs();
  184. }
  185. }
  186. }