OutpatientRegistration.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. using Newtonsoft.Json;
  2. using Newtonsoft.Json.Linq;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. using PTMedicalInsurance.Common;
  13. using PTMedicalInsurance.Helper;
  14. using PTMedicalInsurance.Variables;
  15. namespace PTMedicalInsurance.Forms
  16. {
  17. public partial class OutpatientRegistration : Form
  18. {
  19. public void initBaseInfo(JObject jObject)
  20. {
  21. JObject jo = JObject.Parse(jObject["output"].ToString());
  22. JObject insuInfo = JObject.Parse(jObject["selectedInsuInfo"].Text());
  23. JObject joBaseInfo = JObject.FromObject(jo["baseinfo"]);
  24. this.txtName.Text = joBaseInfo["psn_name"].Text();
  25. this.txtPsnNO.Text = joBaseInfo["psn_no"].Text();
  26. this.txtGend.Text = joBaseInfo["gend"].Text();
  27. this.txtBirthDay.Text = joBaseInfo["brdy"].Text();
  28. this.txtCertType.Text = joBaseInfo["psn_cert_type"].Text();
  29. this.txtCertNO.Text = joBaseInfo["certno"].Text();
  30. this.txtAge.Text = joBaseInfo["age"].Text();
  31. if (insuInfo != null)
  32. {
  33. this.txtCorp.Text = insuInfo["emp_name"].ToString();
  34. this.txtBalc.Text = insuInfo["balc"].ToString();
  35. this.txtAdmvs.Text = insuInfo["insuplc_admdvs"].ToString();
  36. this.txtPsnType.Text = insuInfo["psn_type"].ToString();
  37. this.txtInsuType.Text = insuInfo["insutype"].ToString();
  38. }
  39. }
  40. private void initCombox()
  41. {
  42. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.InsuCurrencyCataLogue.ToString() + "'";
  43. string sqlStr = "";
  44. sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'insutype'" + sqlCondition;
  45. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  46. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=6" + sqlCondition;
  47. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  48. sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'psn_setlway'" + sqlCondition;
  49. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  50. sqlStr = "SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'med_type'" + sqlCondition;
  51. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  52. }
  53. public OutpatientRegistration()
  54. {
  55. InitializeComponent();
  56. this.StartPosition = FormStartPosition.CenterParent;
  57. initCombox();
  58. }
  59. public Boolean b2001 = false;
  60. private DataTable dtDisease;
  61. //private DataTable dtDiseaseType;
  62. //private DataTable dtInsuranceType;
  63. //private DataTable dtMedicalType;
  64. //private DataTable dtOperation;
  65. //private DataTable dtSettelmentType;
  66. //private DataTable dtHospType;
  67. //险种
  68. public string insuType { get; set; }
  69. public string insuTypeName { get; set; }
  70. //医疗类别(人群类别)
  71. public string med_type { get; set; }
  72. public string med_type_name { get; set; }
  73. //诊断
  74. public string diseCodg { get; set; }
  75. public string diseName{ get; set; }
  76. //手术
  77. public string oprn_oprt_code { get; set; }
  78. public string oprn_oprt_name{ get; set; }
  79. //病种
  80. public string dise_type_code { get; set; }
  81. public string dise_type_name { get; set; }
  82. //结算方式
  83. public string psn_setlway { get; set; }
  84. public string psn_setlway_name { get; set; }
  85. public string traumaFlag = "0";
  86. public string relTtpFlag = "0";
  87. public string hospType = "0";
  88. public string otpErReflFlag = "0";
  89. public string mdtrtGrpType;
  90. public string claTrtFlag = "0";
  91. public string unifPayStdType = "";
  92. //住院类型
  93. public string iptTypeCode { get; set; }
  94. public string iptTypeName { get; set; }
  95. public DataTable DtDiagnose { get; set; }
  96. public string personAccountUsedFlag = "0";
  97. private DataTable GetDBLKComboxTable(string sqlStr)
  98. {
  99. InvokeHelper invoker = new InvokeHelper();
  100. dynamic joInparm = new JObject();
  101. dynamic joTmp = new JObject();
  102. joTmp.sqlStr = sqlStr;
  103. JArray jaParams = new JArray();
  104. jaParams.Add(joTmp);
  105. joInparm.Add("params", JArray.FromObject(jaParams));
  106. joInparm.code = "09010014";
  107. string inParam = joInparm.ToString();
  108. JObject joRtn = invoker.invokeInsuService(inParam,"获取下拉框消息");
  109. //dynamic jsonRtn = JsonConvert.DeserializeObject(strRtn);
  110. DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  111. //dt.Columns[0].ColumnName = "编码";
  112. //dt.Columns[1].ColumnName = "名称";
  113. //dt.Columns[2].ColumnName = "拼音查找码";
  114. return dt;
  115. }
  116. private void SetDBLKCombox(ref PTControl.DBLookupCombox dblcbx, string sqlStr)
  117. {
  118. dblcbx.sDisplayField = "Code,Name,SearchCode";
  119. dblcbx.sDisplayMember = "名称";
  120. dblcbx.sKeyWords = "Code,SearchCode";
  121. DataTable dt = GetDBLKComboxTable(sqlStr);
  122. dblcbx.DataSource = dt;
  123. if (dt?.Rows.Count > 0) {
  124. // default to select first one;
  125. }
  126. dblcbx.RowFilterVisible = true;
  127. dblcbx.TextBox.Width = 400;
  128. dblcbx.DataGridView.Width = 400;
  129. dblcbx.DataGridView.Columns[0].Name = "编码";
  130. dblcbx.DataGridView.Columns[1].Name = "名称";
  131. dblcbx.DataGridView.Columns[2].Name = "查找码";
  132. dblcbx.DataGridView.Columns[0].Width = 100;
  133. dblcbx.DataGridView.Columns[1].Width = 200;
  134. }
  135. private void OutpatientRegistration_Load(object sender, EventArgs e)
  136. {
  137. dgvDiagnose.AutoGenerateColumns = false;
  138. dgvDiagnose.DataSource = DtDiagnose;
  139. //DtDiagnose.AcceptChanges();
  140. dgvDiagnose.ReadOnly = true;
  141. }
  142. private void button1_Click(object sender, EventArgs e)
  143. {
  144. //DealFor2001("");
  145. //外伤标志
  146. if (Chk_TraumaFlag.Checked)
  147. traumaFlag = "1";
  148. else
  149. traumaFlag = "0";
  150. //涉及第三方标志
  151. if (Chk_RelTtpFlag.Checked)
  152. relTtpFlag = "1";
  153. else
  154. relTtpFlag = "0";
  155. //包干标准类型
  156. //if (cbxUnifPayStdType.Text!="")
  157. // unifPayStdType = (cbxUnifPayStdType.SelectedIndex).ToString();
  158. // 选择病种后,必须选择医疗类别
  159. //if (string.IsNullOrEmpty(med_type))
  160. //{
  161. // MessageBox.Show("请选择人群类别!");
  162. // return;
  163. //}
  164. // 是否使用个人账户金额
  165. if (cbxAccountPay.Checked)
  166. {
  167. personAccountUsedFlag = "1";
  168. }
  169. //if (string.IsNullOrEmpty(insuType)) {
  170. // MessageBox.Show("请选择险种类型!");
  171. // return;
  172. //}
  173. Global.pat.insuType = insuType;
  174. this.DialogResult = DialogResult.OK;
  175. }
  176. private void dblkcbxInsuranceType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  177. {
  178. DataGridViewRow row = e.Value as DataGridViewRow;
  179. DataRowView dataRow = row.DataBoundItem as DataRowView;
  180. insuType = dataRow["Code"].ToString().Trim();
  181. insuTypeName = dataRow["Name"].ToString().Trim();
  182. }
  183. private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  184. {
  185. DataGridViewRow row = e.Value as DataGridViewRow;
  186. DataRowView dataRow = row.DataBoundItem as DataRowView;
  187. med_type = dataRow["Code"].ToString().Trim();
  188. med_type_name = dataRow["Name"].ToString().Trim();
  189. }
  190. private void dblkcbxDisease_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  191. {
  192. DataGridViewRow row = e.Value as DataGridViewRow;
  193. DataRowView dataRow = row.DataBoundItem as DataRowView;
  194. diseCodg = dataRow["Code"].ToString().Trim();
  195. diseName = dataRow["Name"].ToString().Trim();
  196. }
  197. private void dblkcbxOperation_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  198. {
  199. DataGridViewRow row = e.Value as DataGridViewRow;
  200. DataRowView dataRow = row.DataBoundItem as DataRowView;
  201. oprn_oprt_code = dataRow["Code"].ToString().Trim();
  202. oprn_oprt_name = dataRow["Name"].ToString().Trim();
  203. }
  204. private void dblkcbxSettelmentWay_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  205. {
  206. DataGridViewRow row = e.Value as DataGridViewRow;
  207. DataRowView dataRow = row.DataBoundItem as DataRowView;
  208. psn_setlway = dataRow["Code"].ToString().Trim();
  209. psn_setlway_name = dataRow["Name"].ToString().Trim();
  210. }
  211. private void dblkcbxDiseaseType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  212. {
  213. DataGridViewRow row = e.Value as DataGridViewRow;
  214. DataRowView dataRow = row.DataBoundItem as DataRowView;
  215. dise_type_code = dataRow["Code"].ToString().Trim();
  216. dise_type_name = dataRow["Name"].ToString().Trim();
  217. }
  218. private void button2_Click(object sender, EventArgs e)
  219. {
  220. this.DialogResult = DialogResult.Cancel;
  221. }
  222. private void cbxAccountPay_ValueChanged(object sender, bool value)
  223. {
  224. if (cbxAccountPay.Checked)
  225. {
  226. personAccountUsedFlag = "1";
  227. }
  228. else
  229. {
  230. personAccountUsedFlag = "0";
  231. }
  232. }
  233. public int DealFor2001(string funNO)
  234. {
  235. //人员待遇享受检查
  236. string errMsg = "";
  237. JObject joData2001 = new JObject();
  238. joData2001.Add("psn_no", Global.pat.psn_no);
  239. joData2001.Add("insutype", insuType);
  240. joData2001.Add("fixmedins_code", Global.inf.hospitalNO);
  241. joData2001.Add("med_type", med_type);
  242. joData2001.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  243. joData2001.Add("endtime", "");
  244. joData2001.Add("dise_codg", diseCodg);
  245. joData2001.Add("dise_name", diseName);
  246. joData2001.Add("oprn_oprt_code", "");
  247. joData2001.Add("oprn_oprt_name", "");
  248. joData2001.Add("matn_type", "");
  249. joData2001.Add("birctrl_type", "");
  250. JObject joInput = new JObject();
  251. joInput.Add("data", joData2001);
  252. InvokeHelper invoker = new InvokeHelper();
  253. JObject joRtn2001 = invoker.invokeCenterService(TradeEnum.BenefitCheck, joInput);
  254. if (JsonHelper.parseCenterRtnValue(joRtn2001, out errMsg) != 0)
  255. {
  256. MessageBox.Show("人员待遇享受检查调用失败,中心返回错误信息:" + errMsg);
  257. return -1;
  258. }
  259. else
  260. {
  261. string treatInfo = JsonHelper.getDestValue(joRtn2001, "output.trtinfo");
  262. if (!string.IsNullOrEmpty(treatInfo))
  263. {
  264. JArray jarray = JArray.Parse(treatInfo);
  265. StringBuilder sb = new StringBuilder();
  266. foreach (JObject obj in jarray)
  267. {
  268. string flag = JsonHelper.getDestValue(obj, "trt_enjymnt_flag");
  269. if ("0".Equals(flag))
  270. {
  271. string fundType = JsonHelper.getDestValue(obj, "fund_pay_type");
  272. string msg = JsonHelper.getDestValue(obj, "trt_chk_rslt");
  273. sb.Append("基金类型:【" + fundType + "】" + msg);
  274. }
  275. }
  276. if (sb.Length > 0)
  277. {
  278. MessageBox.Show("人员待遇享受检查结果:" + sb.ToString());
  279. return -1;
  280. }
  281. }
  282. MessageBox.Show("人员待遇享受检查结果:【正常】!");
  283. }
  284. return 0;
  285. }
  286. private void uiButton1_Click(object sender, EventArgs e)
  287. {
  288. DealFor2001("");
  289. }
  290. private void dblkcbxHospType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  291. {
  292. DataGridViewRow row = e.Value as DataGridViewRow;
  293. DataRowView dataRow = row.DataBoundItem as DataRowView;
  294. iptTypeCode = dataRow["Code"].ToString().Trim();
  295. iptTypeName = dataRow["Name"].ToString().Trim();
  296. }
  297. }
  298. }