PatientInsuInfo.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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. using PTMedicalInsurance.Common;
  15. using PTMedicalInsurance.Forms.Setters.PatientInsuInfos;
  16. using PTMedicalInsurance.Entity.Base.Settlement.Record;
  17. using Newtonsoft.Json;
  18. namespace PTMedicalInsurance.Forms
  19. {
  20. public partial class PatientInsuInfo : Form
  21. {
  22. public DataTable dtInsuInfo;
  23. public DataTable dtIDInfo;
  24. public JObject joSelectedInsuInfo;
  25. public int insuInfoIndex = 0;
  26. public int idInfoIndex = 0;
  27. InvokeHelper invoker = new InvokeHelper();
  28. //1.声明自适应类实例
  29. AutoResizeForm asc = new AutoResizeForm();
  30. public PatientInsuInfo()
  31. {
  32. InitializeComponent();
  33. this.StartPosition = FormStartPosition.CenterParent;
  34. asc.controllInitializeSize(this);
  35. asc.controlAutoSize(this);
  36. }
  37. public PatientInsuInfo(JObject jo)
  38. {
  39. InitializeComponent();
  40. dtInsuInfo = (DataTable)jo["insuinfo"].ToObject(typeof(DataTable));
  41. dtIDInfo = (DataTable)jo["idetinfo"].ToObject(typeof(DataTable));
  42. JObject joBaseInfo = JObject.FromObject(jo["baseinfo"]);
  43. this.tbName.Text = joBaseInfo["psn_name"].ToString();
  44. this.tbPsnNO.Text = joBaseInfo["psn_no"].ToString();
  45. this.tbGend.Text = joBaseInfo["gend"].ToString();
  46. this.tbBirthDay.Text = joBaseInfo["brdy"].ToString();
  47. this.tbNaty.Text = joBaseInfo["naty"].ToString();
  48. this.tbCertType.Text = joBaseInfo["psn_cert_type"].ToString();
  49. this.tbCertNO.Text = joBaseInfo["certno"]+"";
  50. this.tbAge.Text = joBaseInfo["age"] + "";
  51. //JObject joInsuInfo = JObject.FromObject(jo["insuinfo"]);
  52. //Global.pat.insuType= joInsuInfo["insutypeNo"].ToString();
  53. GridViewSetter grdSetter = new GridViewSetter();
  54. grdSetter.setDgvIDInfo(dgvIDInfo);
  55. grdSetter.setDgvInsuInfo(dgvInsuInfo);
  56. grdSetter.setDgvAccumutual(dgvAccumulativeInfo);
  57. grdSetter.setDgvPaymentDetail(dgvPaymentDetail);
  58. grdSetter.setDgvTreatement(dgvTreatment);
  59. //grdSetter.setDgvTurnToOtherHosp(dgvTurnToOtherHospInfo);
  60. dgvInsuInfo.DataSource = dtInsuInfo;
  61. dgvIDInfo.DataSource = dtIDInfo;
  62. JObject joRtn = QueryPaymentDetail();
  63. string err;
  64. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  65. {
  66. MessageBox.Show($"缴费明细查询失败{err}");
  67. }
  68. else
  69. {
  70. dgvPaymentDetail.DataSource = (DataTable)joRtn["output"].ToObject(typeof(DataTable));
  71. }
  72. }
  73. private void AddDGVColumn(DataGridView dgv, string headerText, string dataPropertyName, int width = 120)
  74. {
  75. DataGridViewColumn newColumn = new DataGridViewTextBoxColumn();
  76. newColumn.HeaderText = headerText;
  77. newColumn.Width = width;
  78. newColumn.DataPropertyName = dataPropertyName;
  79. newColumn.Name = dataPropertyName;
  80. dgv.Columns.Add(newColumn);
  81. }
  82. private void uiButton1_Click(object sender, EventArgs e)
  83. {
  84. insuInfoIndex = dgvInsuInfo.CurrentRow.Index;
  85. if (dtIDInfo.Rows.Count != 0 )
  86. idInfoIndex = dgvIDInfo.CurrentRow.Index;
  87. joSelectedInsuInfo = new JObject();
  88. for (int i = 0; i < dtInsuInfo.Columns.Count; i++)
  89. {
  90. string key = dtInsuInfo.Columns[i].ColumnName;
  91. string value = dgvInsuInfo.CurrentRow.Cells[key].Value.ToString();
  92. joSelectedInsuInfo.Add(key, value);
  93. }
  94. DialogResult = DialogResult.OK;
  95. }
  96. private void uiButton2_Click(object sender, EventArgs e)
  97. {
  98. DialogResult = DialogResult.Cancel;
  99. }
  100. private JObject QueryPaymentDetail()
  101. {
  102. var joData = new { data = new { psn_no = this.tbPsnNO.Text } };
  103. return invoker.invokeCenterService(TradeEnum.QueryPaymentDetail,JObject.FromObject(joData));
  104. }
  105. private void btnRYDY2001_Click(object sender, EventArgs e)
  106. {
  107. string sInput = "", errorMsg = "";
  108. int iHis = dgvInsuInfo.CurrentRow.Index;
  109. if (dgvInsuInfo.CurrentRow == null)
  110. {
  111. MessageBox.Show("请选择参保信息再查询!");
  112. return;
  113. }
  114. string insutype = dgvInsuInfo.Rows[iHis].Cells["insutypeNo"].Value.ToString();
  115. string beginDate = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd HH:mm:ss");
  116. JObject joData = new JObject();
  117. joData.Add("psn_no", this.tbPsnNO.Text);
  118. joData.Add("insutype", insutype);
  119. joData.Add("fixmedins_code", Global.inf.hospitalNO);
  120. joData.Add("med_type", "11");
  121. joData.Add("begntime", beginDate);
  122. joData.Add("endtime", "");
  123. joData.Add("dise_codg", "");
  124. joData.Add("dise_name", "");
  125. joData.Add("oprn_oprt_code", "");
  126. joData.Add("oprn_oprt_name", "");
  127. joData.Add("matn_type", "");
  128. joData.Add("birctrl_type", "");
  129. JObject joInput = new JObject();
  130. joInput.Add("data", joData);
  131. JObject joRtn = invoker.invokeCenterService(TradeEnum.BenefitCheck, joInput);
  132. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  133. {
  134. MessageBox.Show("人员待遇享受检查失败:" + errorMsg);
  135. }
  136. else
  137. {
  138. string treatInfo = JsonHelper.getDestValue(joRtn, "output.trtinfo");
  139. if (!string.IsNullOrEmpty(treatInfo))
  140. {
  141. JArray jarray = JArray.Parse(treatInfo);
  142. StringBuilder sb = new StringBuilder();
  143. foreach (JObject obj in jarray)
  144. {
  145. string flag = JsonHelper.getDestValue(obj, "trt_enjymnt_flag");
  146. if ("0".Equals(flag))
  147. {
  148. string fundType = JsonHelper.getDestValue(obj, "fund_pay_type");
  149. string msg = JsonHelper.getDestValue(obj, "trt_chk_rslt");
  150. sb.Append("基金类型:【" + fundType + "】" + msg);
  151. }
  152. }
  153. if (sb.Length > 0)
  154. {
  155. MessageBox.Show("人员待遇享受检查结果:" + sb.ToString());
  156. return;
  157. }
  158. }
  159. MessageBox.Show("人员待遇享受检查结果:【正常】!");
  160. }
  161. }
  162. private void dgvInsuInfo_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  163. {
  164. uiButton1_Click(sender,e);
  165. }
  166. private JObject QueryAccumutualInfo()
  167. {
  168. var joData = new { data = new { psn_no = this.tbPsnNO.Text , year = tbYear_PaymentDetail.Text} };
  169. return invoker.invokeCenterService(TradeEnum.QueryAccumutualInfoLocal, JObject.FromObject(joData));
  170. }
  171. private void btAccumulate_Click(object sender, EventArgs e)
  172. {
  173. JObject joRtn = QueryAccumutualInfo();
  174. string err;
  175. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  176. {
  177. MessageBox.Show(err);
  178. return;
  179. }
  180. dgvAccumulativeInfo.DataSource = (DataTable)joRtn["output"]["result"]["mutualAidSetlInfoDTOS"].ToObject(typeof(DataTable));
  181. }
  182. private JObject QueryTurnToOtherHospInfo()
  183. {
  184. var joData = new { data = new { psn_no = this.tbPsnNO.Text, refl_fil_type = tools.getDestPosStrBySpliter(cbTurnType.Text,1,".") , begntime = tbBeginDate.Text,endtime = tbEndDate.Text} };
  185. return invoker.invokeCenterService(TradeEnum.QueryTransferInfo, JObject.FromObject(joData));
  186. }
  187. private void btTurnToOtherHosp_Click(object sender, EventArgs e)
  188. {
  189. JObject joRtn = QueryTurnToOtherHospInfo();
  190. string err;
  191. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  192. {
  193. MessageBox.Show(err);
  194. return;
  195. }
  196. dgvTurnToOtherHospInfo.DataSource = (DataTable)joRtn["output"]["result"].ToObject(typeof(DataTable));
  197. }
  198. private JObject QueryTreamentInfo()
  199. {
  200. int i = dgvInsuInfo.SelectedIndex;
  201. string insutype = dgvInsuInfo.Rows[i].Cells["insutypeNo"].Value.ToString() ;
  202. var joData = new { data = new { psn_no = this.tbPsnNO.Text, insutype =insutype, med_type = tools.getDestPosStrBySpliter(cbxMedicalType.Text, 1, "."), begntime = tbBeginDate_treatment.Text, endtime = tbEndDate_treatment.Text, fixmedins_code = Global.inf.hospitalNO} };
  203. return invoker.invokeCenterService(TradeEnum.BenefitCheck, JObject.FromObject(joData));
  204. }
  205. private void btTreatment_Click(object sender, EventArgs e)
  206. {
  207. JObject joRtn = QueryTreamentInfo();
  208. string err;
  209. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  210. {
  211. MessageBox.Show(err);
  212. return;
  213. }
  214. dgvTreatment.DataSource = (DataTable)joRtn["output"]["result"]["mutualAidSetlInfoDTOS"].ToObject(typeof(DataTable));
  215. }
  216. private void btChronicDiseases_Click(object sender, EventArgs e)
  217. {
  218. JObject joTmp = new JObject();
  219. joTmp.Add("psn_no", Global.pat.psn_no);
  220. JObject joData = new JObject();
  221. joData.Add("data", joTmp);
  222. //5301 也可以
  223. JObject joRtn = invoker.invokeCenterService(TradeEnum.QueryChronicDiseaseRecordLocal, joData);
  224. string err;
  225. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  226. {
  227. MessageBox.Show(err);
  228. }
  229. else
  230. {
  231. List<QueryChronicDiseaseRecord> lst = JsonConvert.DeserializeObject<List<QueryChronicDiseaseRecord>>(JsonHelper.getDestValue(joRtn, "output.result"));
  232. DataTable dt = (DataTable)joRtn["output"]["result"].ToObject(typeof(DataTable));
  233. QueryChronicDiseaseRecord qcd = new QueryChronicDiseaseRecord();
  234. qcd.SetHeaderText(dgvChronicDiseases, new Font("Arial", 9));
  235. dgvChronicDiseases.DataSource = lst;
  236. }
  237. }
  238. private void btFamilyDoctor_Click(object sender, EventArgs e)
  239. {
  240. JObject joTmp = new JObject();
  241. joTmp.Add("psn_no", Global.pat.psn_no);
  242. JObject joData = new JObject();
  243. joData.Add("data", joTmp);
  244. //5301 也可以
  245. JObject joRtn = invoker.invokeCenterService(TradeEnum.QueryFamilyDoctor, joData);
  246. string err;
  247. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  248. {
  249. MessageBox.Show(err);
  250. }
  251. else
  252. {
  253. List<QueryFamilyDoctorRecord> lst = JsonConvert.DeserializeObject<List<QueryFamilyDoctorRecord>>(JsonHelper.getDestValue(joRtn, "output.result"));
  254. DataTable dt = (DataTable)joRtn["output"]["result"].ToObject(typeof(DataTable));
  255. QueryFamilyDoctorRecord qcd = new QueryFamilyDoctorRecord();
  256. qcd.SetHeaderText(dgvFamilyDoctor, new Font("Arial", 9));
  257. dgvFamilyDoctor.DataSource = lst;
  258. }
  259. }
  260. }
  261. }