ChooseCard.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 cardType;
  21. public string businessType;
  22. public string ID,PatName;
  23. public int sL_CardType;
  24. //设置业务实例
  25. InvokeHelper invoker = new InvokeHelper();
  26. public ChooseCard()
  27. {
  28. InitializeComponent();
  29. this.StartPosition = FormStartPosition.CenterParent;
  30. }
  31. private void btOk_Click(object sender, EventArgs e)
  32. {
  33. cardType = "0" + (rbgCardType.SelectedIndex +1).ToString();
  34. businessType = "01"+cbBusinessType.Text.Substring(0,3);
  35. Global.pat.OtherProv = rbgOtherProv.SelectedIndex;
  36. //if (rbgCardType.SelectedIndex == 0)
  37. //{
  38. // if (string.IsNullOrEmpty(tbID.Text.Trim()))
  39. // {
  40. // MessageBox.Show("请先扫电子医保码!");
  41. // tbID.Focus();
  42. // return;
  43. // } else
  44. // {
  45. // Global.pat.ecCardNo = tbID.Text.Trim();
  46. // }
  47. //}
  48. //if ((rbgOtherProv.SelectedIndex == 1)&&(cbCBD.Text==""))
  49. //{
  50. // MessageBox.Show("异地结算,请选择统筹区!");
  51. // return;
  52. //}
  53. // 身份证
  54. if (rbgCardType.SelectedIndex == 1)
  55. {
  56. ID = tbID.Text;
  57. PatName = tbName.Text;
  58. }
  59. //社保卡
  60. if (rbgCardType.SelectedIndex == 2)
  61. {
  62. if (cbCardType.Text == "")
  63. {
  64. MessageBox.Show("读社保卡时需要选择卡类型!");
  65. return;
  66. }
  67. sL_CardType = int.Parse(cbCardType.Text.Trim().Substring(0, 1)); //卡类型
  68. }
  69. DialogResult = DialogResult.OK;
  70. }
  71. private void ChooseCard_Load(object sender, EventArgs e)
  72. {
  73. rbgCardType.SelectedIndex = 2; //身份证
  74. cbBusinessType.SelectedIndex = 0; //社保卡
  75. rbgOtherProv.SelectedIndex = 0; //本地
  76. }
  77. private void rbgCardType_ValueChanged(object sender, int index, string text)
  78. {
  79. if (rbgCardType.SelectedIndex == 0)
  80. {
  81. // 电子凭证
  82. cbBusinessType.Enabled = true;
  83. lblNo.Text = "电子凭证号";
  84. tbID.Focus();
  85. }
  86. else
  87. {
  88. lblNo.Text = "身份证号";
  89. cbBusinessType.Enabled = false;
  90. }
  91. if (rbgCardType.SelectedIndex == 2)
  92. {
  93. cbCardType.SelectedIndex = 0;
  94. cbCardLevel.SelectedIndex = 2;
  95. cbCardType.Enabled = true;
  96. tbPassword.Enabled = true;
  97. //tbPassword.Text = "";
  98. }
  99. else
  100. {
  101. cbCardType.Enabled = false;
  102. tbPassword.Enabled = false;
  103. }
  104. if (rbgCardType.SelectedIndex != 1)
  105. {
  106. tbID.Text = "";
  107. }
  108. }
  109. private void btCancle_Click(object sender, EventArgs e)
  110. {
  111. DialogResult = DialogResult.Cancel;
  112. }
  113. /// <summary>
  114. /// 修改密码
  115. /// </summary>
  116. /// <param name="sender"></param>
  117. /// <param name="e"></param>
  118. private void uiButton1_Click(object sender, EventArgs e)
  119. {
  120. string errorMsg="";
  121. JObject joData = new JObject();
  122. joData.Add("", "");
  123. JObject joInput = new JObject();
  124. joInput.Add("data", joData);
  125. InvokeHelper invoker = new InvokeHelper();
  126. JObject joRtn =invoker.invokeCenterService(TradeEnum.ModifyPassword, joInput);
  127. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  128. {
  129. MessageBox.Show("修改卡密码失败:" + errorMsg);
  130. }
  131. else
  132. {
  133. MessageBox.Show("修改卡密码成功!");
  134. }
  135. }
  136. private void SearchAdmdvs()
  137. {
  138. JObject joAdmdvsInfo = new JObject();
  139. SearchAdmdvs Adm = new SearchAdmdvs();
  140. try
  141. {
  142. Global.pat.card.SearchAdmKey = cbCBD.Text;
  143. Adm.StartPosition = FormStartPosition.CenterParent;
  144. if (Adm.ShowDialog() == DialogResult.OK)
  145. {
  146. if (!string.IsNullOrEmpty(Global.pat.card.SearchAdmCode))
  147. {
  148. //自动选择异地
  149. if (Utils.isOtherCity(Global.pat.card.SearchAdmCode))
  150. {
  151. rbgOtherProv.SelectedIndex = 1;
  152. }
  153. }
  154. cbCBD.Text = Global.pat.card.SearchAdmName;
  155. }
  156. }
  157. catch (Exception ex)
  158. {
  159. MessageBox.Show("异常:" + ex.Message);
  160. return;
  161. }
  162. }
  163. private void cbCBD_DoEnter(object sender, EventArgs e)
  164. {
  165. //初始化
  166. Global.pat.card.SearchAdmCode = "";
  167. SearchAdmdvs();
  168. }
  169. }
  170. }