AuxFun.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Business;
  3. using PTMedicalInsurance.Helper;
  4. using PTMedicalInsurance.Variables;
  5. using Sunny.UI;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Data;
  10. using System.Drawing;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows.Forms;
  15. namespace HaErBinMIMI.Forms
  16. {
  17. public partial class AuxFun : Form
  18. {
  19. HisMainBusiness hBus = new HisMainBusiness();
  20. public AuxFun()
  21. {
  22. InitializeComponent();
  23. }
  24. private void tabPage1_Click(object sender, EventArgs e)
  25. {
  26. }
  27. private void uiLabel7_Click(object sender, EventArgs e)
  28. {
  29. }
  30. private void uiTextBox4_KeyPress(object sender, KeyPressEventArgs e)
  31. {
  32. if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
  33. {
  34. // 如果按键不是数字并且不是控制键,则不允许输入
  35. e.Handled = true;
  36. MessageBox.Show("密码只能是6位数字");
  37. }
  38. }
  39. private void uiTextBox5_KeyPress(object sender, KeyPressEventArgs e)
  40. {
  41. if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar))
  42. {
  43. // 如果按键不是数字并且不是控制键,则不允许输入
  44. e.Handled = true;
  45. MessageBox.Show("密码只能是6位数字");
  46. }
  47. }
  48. private void uiButton1_Click(object sender, EventArgs e)
  49. {
  50. string outParam = "";
  51. if (hBus.readCard(out outParam) != 0)
  52. {
  53. MessageBox.Show("读卡失败!" + outParam);
  54. }
  55. else
  56. {
  57. if ((Global.pat.insuplc_admdvs.Substring(0, 4) == "2301") && (Global.inf.areaCode == "239900"))
  58. {
  59. MessageBox.Show("该患者为市医保患者,请用市医保!" + outParam);
  60. }
  61. //展示患者信息界面
  62. if (hBus.showPatInfo(outParam, out outParam) != 0)
  63. {
  64. MessageBox.Show(outParam);
  65. }
  66. else
  67. {
  68. uiTextBox1.Text = Global.pat.mdtrtcertType;
  69. uiTextBox2.Text = Global.pat.certNO;
  70. uiTextBox3.Text = Global.pat.name;
  71. }
  72. }
  73. }
  74. private void uiButton2_Click(object sender, EventArgs e)
  75. {
  76. string malx = "";//密码修改类型
  77. string errorMsg = "";
  78. if (!(uiTextBox1.Text == "01" || uiTextBox1.Text == "02" || uiTextBox1.Text == "03"))
  79. {
  80. MessageBox.Show("就诊凭证只能是01或02或03,其中01电子凭证,02身份证,03医保卡!");
  81. return;
  82. }
  83. if (uiTextBox2.Text == "")
  84. {
  85. MessageBox.Show("请输入身份证号或者点击医保读卡获取身份证号");
  86. return;
  87. }
  88. if (uiTextBox2.Text == "")
  89. {
  90. MessageBox.Show("请输入姓名或者点击医保读卡获取姓名");
  91. return;
  92. }
  93. if (uiComboBox1.SelectedIndex == 0)
  94. {
  95. malx = "01";
  96. }
  97. else if (uiComboBox1.SelectedIndex == 1)
  98. {
  99. malx = "02";
  100. }
  101. //调用1161密码修改
  102. JObject joData = new JObject();
  103. joData.Add("mdtrt_cert_type", uiTextBox1.Text);
  104. joData.Add("certno", uiTextBox2.Text);
  105. joData.Add("psn_name", uiTextBox3.Text);
  106. joData.Add("opt_type", malx);
  107. joData.Add("card_pwd_old", uiTextBox4.Text);
  108. joData.Add("card_pwd_new", uiTextBox5.Text);
  109. JObject joInput = new JObject();
  110. joInput.Add("data", joData);
  111. InvokeHelper invoker = new InvokeHelper();
  112. JObject joRtn = invoker.invokeCenterService("1161", joInput);
  113. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  114. {
  115. MessageBox.Show("密码修改调用失败,请重试:" + errorMsg);
  116. }
  117. else
  118. {
  119. string ts= JsonHelper.getDestValue(joRtn, "output.returninfo.msg_code");
  120. //MessageBox.Show("返回值" + ts);
  121. string xx = JsonHelper.getDestValue(joRtn, "output.returninfo.msg_info");
  122. if (ts == "01")
  123. {
  124. MessageBox.Show("修改成功!!!");
  125. }else if (ts == "02")
  126. {
  127. MessageBox.Show("修改保存失败"+ xx);
  128. }
  129. else if (ts == "03")
  130. {
  131. MessageBox.Show("密码不存在"+ xx);
  132. }
  133. else if (ts == "04")
  134. {
  135. MessageBox.Show("密码错误"+ xx);
  136. }
  137. }
  138. }
  139. private void uiComboBox1_SelectedIndexChanged(object sender, EventArgs e)
  140. {
  141. if (uiComboBox1.SelectedIndex == 0)
  142. {
  143. uiTextBox4.Text = "";
  144. uiTextBox4.Visible = false;
  145. uiLabel5.Visible = false;
  146. }
  147. else if (uiComboBox1.SelectedIndex == 1)
  148. {
  149. uiTextBox4.Visible = true;
  150. uiLabel5.Visible = true;
  151. }
  152. }
  153. }
  154. }