FixedPointRecord.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Linq;
  3. using PTMedicalInsurance.Common;
  4. using PTMedicalInsurance.Entity;
  5. using PTMedicalInsurance.Helper;
  6. using PTMedicalInsurance.Variables;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.ComponentModel;
  10. using System.Data;
  11. using System.Drawing;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15. using System.Windows.Forms;
  16. namespace PTMedicalInsurance.Forms.ToPutOnRecord
  17. {
  18. public partial class FixedPointRecord : Form
  19. {
  20. private ToPutOnRecord mainForm;
  21. private String fixmedinsCode = Global.inf.hospitalNO;
  22. private String fixmedinsName = Global.inf.hospitalName;
  23. private String otherHospAreaCode;
  24. private String otherHospAreaName;
  25. private string diagCode;
  26. private string diagName;
  27. private InvokeHelper invoker = new InvokeHelper();
  28. public FixedPointRecord()
  29. {
  30. InitializeComponent();
  31. }
  32. public FixedPointRecord(Form frm)
  33. {
  34. InitializeComponent();
  35. InitForm(frm);
  36. //
  37. mainForm.SetDBLKCombox(ref dblkcbxInsuranceType_1, mainForm.dtInsuranceType);
  38. //mainForm.SetDBLKCombox(ref dblkcbxDieaseCode_1, mainForm.dtDiagnose == null ? mainForm.AssignComboxDT(out mainForm.dtDiease, mainForm.GetDirectory("4")) : mainForm.dtDiagnose);
  39. }
  40. private void InitForm(Form frm)
  41. {
  42. mainForm = (ToPutOnRecord)frm;
  43. CheckForIllegalCrossThreadCalls = false;
  44. // 禁用关闭按钮
  45. this.FormBorderStyle = FormBorderStyle.None;
  46. // 隐藏标题栏
  47. this.ControlBox = false;
  48. // 其他可能需要的配置
  49. this.TopLevel = false;
  50. this.Dock = DockStyle.Fill; // 根据需要设置 Dock 属性
  51. //
  52. tbFixedHosp.Text = fixmedinsName;
  53. cbApplyType.SelectedIndex = 1;
  54. rbLocal.Checked = true;
  55. cbFixMainFlag.SelectedIndex = 1;
  56. cbFixLocalType.SelectedIndex = 0;
  57. cbFixEvtType.SelectedIndex = 0;
  58. }
  59. private void btReadCard_1_Click(object sender, EventArgs e)
  60. {
  61. string PatInfo = "";
  62. if (mainForm.GetPersonInfo(out PatInfo) != 0)
  63. {
  64. MessageBox.Show("读卡失败:" + PatInfo);
  65. }
  66. tbName_1.Text = Global.pat.name;
  67. tbPsnNO_1.Text = Global.pat.psn_no;
  68. tbPsnNo2_1.Text = tbPsnNO_1.Text = Global.pat.psn_no;
  69. foreach (DataRow row in ((DataTable)dblkcbxInsuranceType_1.DataSource).Rows)
  70. {
  71. if (row["Code"].ToString() == Global.pat.insuType)
  72. {
  73. dblkcbxInsuranceType_1.Text = row["Name"].ToString();
  74. }
  75. }
  76. }
  77. private void btApply_1_Click(object sender, EventArgs e)
  78. {
  79. PersonFixedPointRecordInput input = new PersonFixedPointRecordInput();
  80. input.psn_no = tbPsnNO_1.Text;
  81. input.tel = tbTel_1.Text;
  82. input.addr = tbAddress_1.Text;
  83. input.biz_appy_type = tools.getDestPosStrBySpliter(cbApplyType.Text, 1, ".");
  84. input.begndate = dpStart.Value.ToString("yyyy-MM-dd");
  85. input.enddate = dpEnd.Value.ToString("yyyy-MM-dd");
  86. input.agnter_name = tbAgentName.Text;
  87. input.agnter_cert_type = tools.getDestPosStrBySpliter(cbAgentCertType.Text, 1, ".");
  88. input.agnter_certno = tbAgentCertNO.Text;
  89. input.agnter_tel = tbAgentTel.Text;
  90. input.agnter_addr = tbAgentAddr.Text;
  91. input.agnter_rlts = tools.getDestPosStrBySpliter(cbAgentRelation.Text, 1, ".");
  92. input.fix_srt_no = tbSortNO.Text;
  93. input.fixmedins_code = fixmedinsCode;
  94. input.fixmedins_name = fixmedinsName;
  95. input.memo = tbMemo.Text;
  96. input.fix_local_type = tools.getDestPosStrBySpliter(cbFixLocalType.Text, 1, ".");
  97. input.fix_main_scd_flag = tools.getDestPosStrBySpliter(cbFixMainFlag.Text, 1, ".");
  98. var joData = new { data = JToken.Parse(JsonConvert.SerializeObject(input, Formatting.None)) };
  99. TradeEnum trade = rbLocal.Checked ? TradeEnum.FixedPointRecordOfLocal : TradeEnum.FixedPointRecord; ;
  100. JObject joRtn = invoker.invokeCenterService(trade, JObject.FromObject(joData));
  101. string err;
  102. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  103. {
  104. MessageBox.Show(err);
  105. }
  106. else
  107. {
  108. //存到后台
  109. JObject joDbIn = input.ConvertToDBJson();
  110. string declareNo = JsonHelper.getDestValue(joRtn, "output.result.trt_dcla_detl_sn");
  111. joDbIn.Add("DeclareNo", declareNo);
  112. joDbIn.Add("RecordType", "F");
  113. joDbIn.Add("RecordStatus", "1");
  114. joDbIn.Add("CreateUser", Global.user.ID);
  115. joDbIn.Add("PatientName", Global.pat.name);
  116. joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09030001", joDbIn).ToString(), "插入/更新慢性病表");
  117. if (JsonHelper.parseIrisRtnValue(joRtn, out err) != 0)
  118. {
  119. MessageBox.Show("插入失败");
  120. }
  121. //查询后在下方表格显示
  122. string sqlStr = $"select * from BS_InsuPersonnelRecord where DeclareNo ='{declareNo}'";
  123. dgvApplyResult.DataSource = mainForm.QueryRecord(sqlStr, "查询慢病备案记录");
  124. MessageBox.Show("申请成功");
  125. }
  126. }
  127. private void btClose_1_Click(object sender, EventArgs e)
  128. {
  129. mainForm.Close();
  130. }
  131. private void btAlter_Click(object sender, EventArgs e)
  132. {
  133. PersonFixedPointAlterInput input = new PersonFixedPointAlterInput();
  134. input.psn_no = tbPsnNO_1.Text;
  135. input.begndate = dpStart.Value.ToString("yyyy-MM-dd");
  136. input.enddate = dpEnd.Value.ToString("yyyy-MM-dd");
  137. input.fix_evt_type = tools.getDestPosStrBySpliter(cbFixEvtType.Text, 1, ".");
  138. input.fixmedins_code = fixmedinsCode;
  139. input.memo = tbMemo.Text;
  140. input.fix_local_type = tools.getDestPosStrBySpliter(cbFixLocalType.Text, 1, ".");
  141. input.fix_main_scd_flag = tools.getDestPosStrBySpliter(cbFixMainFlag.Text, 1, ".");
  142. var joData = new { data = JToken.Parse(JsonConvert.SerializeObject(input, Formatting.None)) };
  143. JObject joRtn = invoker.invokeCenterService(TradeEnum.FixedPointAlter, JObject.FromObject(joData));
  144. string err;
  145. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  146. {
  147. MessageBox.Show(err);
  148. }
  149. }
  150. private void btQueryCenterRecord_1_Click(object sender, EventArgs e)
  151. {
  152. JObject joTmp = new JObject();
  153. joTmp.Add("psn_no", tbPsnNo2_1.Text);
  154. joTmp.Add("biz_appy_type", tools.getDestPosStrBySpliter(cbApplyType.Text, 1, "."));
  155. JObject joData = new JObject();
  156. joData.Add("data", joTmp);
  157. JObject joRtn = invoker.invokeCenterService(TradeEnum.QueryFixedPointRecord, joData);
  158. string err;
  159. if (JsonHelper.parseCenterRtnValue(joRtn, out err) != 0)
  160. {
  161. MessageBox.Show(err);
  162. }
  163. else
  164. {
  165. JArray jaPsnfixmedin = JArray.FromObject(joRtn["output"]["result"]["psnfixmedin"]);
  166. dgvApplyResult.DataSource = (DataTable)jaPsnfixmedin.ToObject(typeof(DataTable));
  167. //存到后台
  168. //查询后在下方表格显示
  169. MessageBox.Show("申请成功");
  170. }
  171. }
  172. }
  173. }