PatientInsuInfo.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Newtonsoft.Json.Linq;
  11. using PTMedicalInsurance.Helper;
  12. using PTMedicalInsurance.Variables;
  13. using PTMedicalInsurance.Business;
  14. namespace PTMedicalInsurance.Forms
  15. {
  16. public partial class PatientInsuInfo : Form
  17. {
  18. public DataTable dtInsuInfo;
  19. public DataTable dtIDInfo;
  20. public JObject joSelectedInsuInfo;
  21. public int insuInfoIndex = 0;
  22. public int idInfoIndex = 0;
  23. InvokeHelper invoker = new InvokeHelper();
  24. //1.声明自适应类实例
  25. AutoResizeForm asc = new AutoResizeForm();
  26. public PatientInsuInfo()
  27. {
  28. InitializeComponent();
  29. this.StartPosition = FormStartPosition.CenterParent;
  30. asc.controllInitializeSize(this);
  31. asc.controlAutoSize(this);
  32. }
  33. public PatientInsuInfo(JObject jo)
  34. {
  35. InitializeComponent();
  36. dtInsuInfo = (DataTable)jo["insuinfo"].ToObject(typeof(DataTable));
  37. dtIDInfo = (DataTable)jo["idetinfo"].ToObject(typeof(DataTable));
  38. JObject joBaseInfo = JObject.FromObject(jo["baseinfo"]);
  39. this.tbName.Text = joBaseInfo["psn_name"].ToString();
  40. this.tbPsnNO.Text = joBaseInfo["psn_no"].ToString();
  41. this.tbGend.Text = joBaseInfo["gend"].ToString();
  42. this.tbBirthDay.Text = joBaseInfo["brdy"].ToString();
  43. this.tbNaty.Text = joBaseInfo["naty"].ToString();
  44. this.tbCertType.Text = joBaseInfo["psn_cert_type"].ToString();
  45. this.tbCertNO.Text = joBaseInfo["certno"].ToString();
  46. this.tbAge.Text = joBaseInfo["age"].ToString();
  47. //JObject joInsuInfo = JObject.FromObject(jo["insuinfo"]);
  48. //Global.pat.insuType= joInsuInfo["insutypeNo"].ToString();
  49. setDgvIDInfo();
  50. setDgvInsuInfo();
  51. dgvInsuInfo.DataSource = dtInsuInfo;
  52. dgvIDInfo.DataSource = dtIDInfo;
  53. JObject joRtn = QuerySpecialDrugDetailInfo();
  54. string err;
  55. if (JsonHelper.parseCenterRtnValue(joRtn, out err) == 0)
  56. {
  57. if ((joRtn["output"]["feedetail"].ToString() == "[]") || (string.IsNullOrEmpty(joRtn["output"]["feedetail"].ToString())))
  58. {
  59. tabControl1.SelectedIndex = 0;
  60. }
  61. else
  62. {
  63. setDgvSpecialDrugInfo();
  64. tabControl1.SelectedIndex = 1;
  65. dgv5301.DataSource = (DataTable)joRtn["output"]["feedetail"].ToObject(typeof(DataTable));
  66. }
  67. }
  68. }
  69. private void AddDGVColumn(DataGridView dgv, string headerText, string dataPropertyName, int width = 120)
  70. {
  71. DataGridViewColumn newColumn = new DataGridViewTextBoxColumn();
  72. newColumn.HeaderText = headerText;
  73. newColumn.Width = width;
  74. newColumn.DataPropertyName = dataPropertyName;
  75. newColumn.Name = dataPropertyName;
  76. dgv.Columns.Add(newColumn);
  77. }
  78. private void setDgvInsuInfo()
  79. {
  80. AddDGVColumn(dgvInsuInfo, "余额", "balc", 80);
  81. AddDGVColumn(dgvInsuInfo, "险种类型", "insutype", 200);
  82. AddDGVColumn(dgvInsuInfo, "人员类别", "psn_type", 100);
  83. AddDGVColumn(dgvInsuInfo, "人员参保状态", "psn_insu_stas");
  84. AddDGVColumn(dgvInsuInfo, "个人参保日期", "psn_insu_date");
  85. AddDGVColumn(dgvInsuInfo, "暂停参保日期", "paus_insu_date");
  86. AddDGVColumn(dgvInsuInfo, "公务员标志", "cvlserv_flag", 80);
  87. AddDGVColumn(dgvInsuInfo, "参保地医保区划", "insuplc_admdvs");
  88. AddDGVColumn(dgvInsuInfo, "单位名称", "emp_name", 300);
  89. AddDGVColumn(dgvInsuInfo, "险种类型编码", "insutypeNo", 150);
  90. dgvInsuInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
  91. dgvInsuInfo.ColumnHeadersHeight = 40;
  92. }
  93. private void setDgvIDInfo()
  94. {
  95. AddDGVColumn(dgvIDInfo, "人员身份类别", "psn_idet_type", 140);
  96. AddDGVColumn(dgvIDInfo, "人员类别等级", "psn_type_lv", 140);
  97. AddDGVColumn(dgvIDInfo, "备注", "memo", 150);
  98. AddDGVColumn(dgvIDInfo, "开始时间", "begntime", 200);
  99. AddDGVColumn(dgvIDInfo, "结束时间", "endtime", 200);
  100. dgvIDInfo.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
  101. dgvIDInfo.ColumnHeadersHeight = 40;
  102. }
  103. private void setDgvSpecialDrugInfo()
  104. {
  105. AddDGVColumn(dgvIDInfo, "门慢门特病种目录代码 ", "opsp_dise_code", 200);
  106. AddDGVColumn(dgvIDInfo, "门慢门特病种名称", "opsp_dise_name", 200);
  107. AddDGVColumn(dgvIDInfo, "开始时间", "begndate", 200);
  108. AddDGVColumn(dgvIDInfo, "结束时间", "enddate", 200);
  109. dgv5301.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
  110. dgv5301.ColumnHeadersHeight = 40;
  111. }
  112. private void setDgvTrtInfo()
  113. {
  114. AddDGVColumn(dgvIDInfo, "人员编号", "psn_no", 200);
  115. AddDGVColumn(dgvIDInfo, "待遇检查类型", "trt_chk_type", 200);
  116. AddDGVColumn(dgvIDInfo, "基金支付类型 ", "fund_pay_type", 200);
  117. AddDGVColumn(dgvIDInfo, "基金款项待遇享受标志", "trt_enjymnt_flag", 200);
  118. AddDGVColumn(dgvIDInfo, "开始日期", "begndate", 200);
  119. AddDGVColumn(dgvIDInfo, "结束日期", "enddate", 200);
  120. AddDGVColumn(dgvIDInfo, "待遇检查结果", "trt_chk_rslt", 200);
  121. dgv2001.ColumnHeadersDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Bold);
  122. dgv2001.ColumnHeadersHeight = 40;
  123. }
  124. private JObject QuerySpecialDrugDetailInfo()
  125. {
  126. JObject joData = new JObject();
  127. joData.Add("psn_no", this.tbPsnNO.Text);
  128. JObject joInput = new JObject();
  129. joInput.Add("data", joData);
  130. string sInput = JsonHelper.setCenterInpar("5301", joInput);
  131. return invoker.invokeCenterService("5301", sInput);
  132. }
  133. private void uiButton1_Click(object sender, EventArgs e)
  134. {
  135. insuInfoIndex = dgvInsuInfo.CurrentRow.Index;
  136. if (dtIDInfo.Rows.Count != 0 )
  137. idInfoIndex = dgvIDInfo.CurrentRow.Index;
  138. joSelectedInsuInfo = new JObject();
  139. for (int i = 0; i < dtInsuInfo.Columns.Count; i++)
  140. {
  141. string key = dtInsuInfo.Columns[i].ColumnName;
  142. string value = dgvInsuInfo.CurrentRow.Cells[key].Value.ToString();
  143. joSelectedInsuInfo.Add(key, value);
  144. }
  145. DialogResult = DialogResult.OK;
  146. }
  147. private void uiButton2_Click(object sender, EventArgs e)
  148. {
  149. DialogResult = DialogResult.Cancel;
  150. }
  151. private void btnRYDY2001_Click(object sender, EventArgs e)
  152. {
  153. string sInput = "", errorMsg = "";
  154. int iHis = dgvInsuInfo.CurrentRow.Index;
  155. if (dgvInsuInfo.CurrentRow == null)
  156. {
  157. MessageBox.Show("请选择参保信息再查询!");
  158. return;
  159. }
  160. string insutype = dgvInsuInfo.Rows[iHis].Cells["insutypeNo"].Value.ToString();
  161. JObject joData = new JObject();
  162. joData.Add("psn_no", this.tbPsnNO.Text);
  163. joData.Add("insutype", insutype);
  164. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  165. joData.Add("med_type", "11");
  166. joData.Add("begntime", "2010-01-01 00:00:00");
  167. joData.Add("endtime", "");
  168. joData.Add("dise_codg", "");
  169. joData.Add("dise_name", "");
  170. joData.Add("oprn_oprt_code", "");
  171. joData.Add("oprn_oprt_name", "");
  172. joData.Add("matn_type", "");
  173. joData.Add("birctrl_type", "");
  174. JObject joInput = new JObject();
  175. joInput.Add("data", joData);
  176. sInput = JsonHelper.setCenterInpar("2001", joInput);
  177. JObject joRtn = invoker.invokeCenterService("2001", sInput);
  178. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  179. {
  180. tabControl1.SelectedIndex = 0;
  181. MessageBox.Show("人员待遇享受检查失败:" + errorMsg);
  182. }
  183. else
  184. {
  185. if ((joRtn["output"]["trtinfo"].ToString() == "[]") || (string.IsNullOrEmpty(joRtn["output"]["trtinfo"].ToString())))
  186. {
  187. tabControl1.SelectedIndex = 0;
  188. }
  189. else
  190. {
  191. setDgvTrtInfo();
  192. tabControl1.SelectedIndex = 2;
  193. dgv5301.DataSource = (DataTable)joRtn["output"]["trtinfo"].ToObject(typeof(DataTable));
  194. }
  195. }
  196. }
  197. }
  198. }