ChooseCard.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. DialogResult = DialogResult.OK;
  112. }
  113. private void ChooseCard_Load(object sender, EventArgs e)
  114. {
  115. rbgMdtrtCertType.SelectedIndex = 1; //身份证
  116. cbYMYWLX.SelectedIndex = 0; //用码业务类型
  117. rbgOtherProv.SelectedIndex = 0; //本地
  118. cbDocumentType.SelectedIndex = 0; //证件类型
  119. }
  120. private void rbgMdtrtCertType_ValueChanged(object sender, int index, string text)
  121. {
  122. if (rbgMdtrtCertType.SelectedIndex == 0)
  123. {
  124. rbgEcCertDecodeType.SelectedIndex = 0;
  125. uiLabel4.Text = "凭证令牌";
  126. rbgEcCertDecodeType.Enabled = false;
  127. cbYMYWLX.Enabled = true;
  128. uiLabel3.Visible = true;
  129. cbYMYWLX.Visible = true;
  130. }
  131. else if (rbgMdtrtCertType.SelectedIndex == 1)
  132. {
  133. uiLabel4.Text = "身份证号";
  134. rbgEcCertDecodeType.Enabled = false;
  135. cbYMYWLX.Enabled = false;
  136. uiLabel3.Visible = false;
  137. cbYMYWLX.Visible = false;
  138. }
  139. else if (rbgMdtrtCertType.SelectedIndex == 2)
  140. {
  141. uiLabel4.Text = "社保卡号";
  142. cbCardType.SelectedIndex = 0;
  143. rbgEcCertDecodeType.Enabled = false;
  144. cbYMYWLX.Enabled = false;
  145. uiLabel3.Visible = false;
  146. cbYMYWLX.Visible = false;
  147. }
  148. }
  149. private void btCancle_Click(object sender, EventArgs e)
  150. {
  151. DialogResult = DialogResult.Cancel;
  152. }
  153. private void uiButton1_Click(object sender, EventArgs e)
  154. {
  155. string sInput = "", errorMsg = "";
  156. JObject joData = new JObject();
  157. joData.Add("", "");
  158. JObject joInput = new JObject();
  159. joInput.Add("data", joData);
  160. InvokeHelper invoker = new InvokeHelper();
  161. sInput = JsonHelper.setCenterInpar("1193", "");
  162. JObject joRtn = invoker.invokeCenterService("1193", sInput);
  163. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  164. {
  165. MessageBox.Show("修改卡密码失败:" + errorMsg);
  166. }
  167. else
  168. {
  169. MessageBox.Show("修改卡密码成功!");
  170. }
  171. }
  172. private void SearchAdmdvs()
  173. {
  174. JObject joAdmdvsInfo = new JObject();
  175. SearchAdmdvs Adm = new SearchAdmdvs();
  176. try
  177. {
  178. Global.pat.card.SearchAdmKey = cbCBD.Text;
  179. Adm.StartPosition = FormStartPosition.CenterParent;
  180. if (Adm.ShowDialog() == DialogResult.OK)
  181. {
  182. cbCBD.Text = Global.pat.card.SearchAdmName;
  183. }
  184. }
  185. catch (Exception ex)
  186. {
  187. MessageBox.Show("异常:" + ex.Message);
  188. return;
  189. }
  190. }
  191. private void cbCBD_DoEnter(object sender, EventArgs e)
  192. {
  193. SearchAdmdvs();
  194. }
  195. }
  196. }