ChooseCard.cs 8.0 KB

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