OutpatientRegistration.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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 OutpatientRegistration()
  20. {
  21. InitializeComponent();
  22. this.StartPosition = FormStartPosition.CenterParent;
  23. if (Global.pat.RYorCY == "2")
  24. {
  25. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
  26. string sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr "
  27. + " WHERE B.Code='" + Global.pat.insuType + "' and A.InsuCode = 'insutype'" + sqlCondition;
  28. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  29. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.Code='" + Global.pat.DiseasecCode + "' and A.ValidFlag='1' And A.HisType=7" + sqlCondition;
  30. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  31. sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr"
  32. + " WHERE B.Code='" + Global.pat.medType + "' and A.InsuCode = 'med_type'" + sqlCondition;
  33. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  34. 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;
  35. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  36. 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 = 'IPT_TYPE'" + sqlCondition;
  37. SetDBLKCombox(ref dblkcbxHospType, sqlStr);
  38. }
  39. else
  40. {
  41. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
  42. string 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;
  43. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  44. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
  45. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  46. 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;
  47. SetDBLKCombox(ref dblkcbxSettelmentWay, 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 = 'med_type'" + sqlCondition;
  49. SetDBLKCombox(ref dblkcbxMedicalType, 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 = 'IPT_TYPE'" + sqlCondition;
  51. SetDBLKCombox(ref dblkcbxHospType, sqlStr);
  52. }
  53. cbxAccountPay.Checked = true;
  54. personAccountUsedFlag = "1";
  55. }
  56. public Boolean b2001 = false;
  57. private DataTable dtDisease;
  58. //private DataTable dtDiseaseType;
  59. //private DataTable dtInsuranceType;
  60. //private DataTable dtMedicalType;
  61. //private DataTable dtOperation;
  62. //private DataTable dtSettelmentType;
  63. //private DataTable dtHospType;
  64. //险种
  65. public string insuType { get; set; }
  66. public string insuTypeName { get; set; }
  67. //医疗类别
  68. public string med_type { get; set; }
  69. public string med_type_name { get; set; }
  70. //诊断
  71. public string diseCodg { get; set; }
  72. public string diseName{ get; set; }
  73. //手术
  74. public string oprn_oprt_code { get; set; }
  75. public string oprn_oprt_name{ get; set; }
  76. //病种
  77. public string dise_type_code { get; set; }
  78. public string dise_type_name { get; set; }
  79. //结算方式
  80. public string psn_setlway { get; set; }
  81. public string psn_setlway_name { get; set; }
  82. public string traumaFlag = "0";
  83. public string relTtpFlag = "0";
  84. public string hospType = "0";
  85. public string otpErReflFlag = "0";
  86. public string mdtrtGrpType;
  87. public string claTrtFlag = "0";
  88. public string unifPayStdType = "";
  89. //住院类型
  90. public string iptTypeCode { get; set; }
  91. public string iptTypeName { get; set; }
  92. public DataTable DtDiagnose { get; set; }
  93. public string personAccountUsedFlag = "0";
  94. private DataTable GetDBLKComboxTable(string sqlStr)
  95. {
  96. InvokeHelper invoker = new InvokeHelper();
  97. dynamic joInparm = new JObject();
  98. dynamic joTmp = new JObject();
  99. joTmp.sqlStr = sqlStr;
  100. JArray jaParams = new JArray();
  101. jaParams.Add(joTmp);
  102. joInparm.Add("params", JArray.FromObject(jaParams));
  103. joInparm.code = "09010014";
  104. string inParam = joInparm.ToString();
  105. JObject joRtn = invoker.invokeInsuService(inParam,"获取下拉框消息");
  106. //dynamic jsonRtn = JsonConvert.DeserializeObject(strRtn);
  107. DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  108. //dt.Columns[0].ColumnName = "编码";
  109. //dt.Columns[1].ColumnName = "名称";
  110. //dt.Columns[2].ColumnName = "拼音查找码";
  111. return dt;
  112. }
  113. private void SetDBLKCombox(ref PTControl.DBLookupCombox dblcbx, string sqlStr)
  114. {
  115. dblcbx.sDisplayField = "Code,Name,SearchCode";
  116. dblcbx.sDisplayMember = "名称";
  117. dblcbx.sKeyWords = "Code,SearchCode";
  118. dblcbx.DataSource = GetDBLKComboxTable(sqlStr);
  119. dblcbx.RowFilterVisible = true;
  120. dblcbx.TextBox.Width = 400;
  121. dblcbx.DataGridView.Width = 400;
  122. dblcbx.DataGridView.Columns[0].Name = "编码";
  123. dblcbx.DataGridView.Columns[1].Name = "名称";
  124. dblcbx.DataGridView.Columns[2].Name = "查找码";
  125. dblcbx.DataGridView.Columns[0].Width = 100;
  126. dblcbx.DataGridView.Columns[1].Width = 200;
  127. }
  128. private void OutpatientRegistration_Load(object sender, EventArgs e)
  129. {
  130. dgvDiagnose.AutoGenerateColumns = false;
  131. dgvDiagnose.DataSource = DtDiagnose;
  132. //DtDiagnose.AcceptChanges();
  133. dgvDiagnose.ReadOnly = true;
  134. }
  135. private void button1_Click(object sender, EventArgs e)
  136. {
  137. //DealFor2001("");
  138. if (cbxMdtrtGrpType.Text != "")
  139. mdtrtGrpType = (cbxMdtrtGrpType.SelectedIndex + 1).ToString();
  140. //外伤标志
  141. if (Chk_TraumaFlag.Checked)
  142. traumaFlag = "1";
  143. else
  144. traumaFlag = "0";
  145. //涉及第三方标志
  146. if (Chk_RelTtpFlag.Checked)
  147. relTtpFlag = "1";
  148. else
  149. relTtpFlag = "0";
  150. //分级诊疗标志
  151. if (chk_claTrtFlag.Checked)
  152. claTrtFlag = "1";
  153. else
  154. claTrtFlag = "0";
  155. //包干标准类型
  156. if (cbxUnifPayStdType.Text!="")
  157. unifPayStdType = (cbxUnifPayStdType.SelectedIndex).ToString();
  158. this.DialogResult = DialogResult.OK;
  159. }
  160. private void dblkcbxInsuranceType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  161. {
  162. DataGridViewRow row = e.Value as DataGridViewRow;
  163. DataRowView dataRow = row.DataBoundItem as DataRowView;
  164. insuType = dataRow["Code"].ToString().Trim();
  165. insuTypeName = dataRow["Name"].ToString().Trim();
  166. }
  167. private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  168. {
  169. DataGridViewRow row = e.Value as DataGridViewRow;
  170. DataRowView dataRow = row.DataBoundItem as DataRowView;
  171. med_type = dataRow["Code"].ToString().Trim();
  172. med_type_name = dataRow["Name"].ToString().Trim();
  173. }
  174. private void dblkcbxDisease_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  175. {
  176. DataGridViewRow row = e.Value as DataGridViewRow;
  177. DataRowView dataRow = row.DataBoundItem as DataRowView;
  178. diseCodg = dataRow["Code"].ToString().Trim();
  179. diseName = dataRow["Name"].ToString().Trim();
  180. }
  181. private void dblkcbxOperation_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  182. {
  183. DataGridViewRow row = e.Value as DataGridViewRow;
  184. DataRowView dataRow = row.DataBoundItem as DataRowView;
  185. oprn_oprt_code = dataRow["Code"].ToString().Trim();
  186. oprn_oprt_name = dataRow["Name"].ToString().Trim();
  187. }
  188. private void dblkcbxSettelmentWay_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  189. {
  190. DataGridViewRow row = e.Value as DataGridViewRow;
  191. DataRowView dataRow = row.DataBoundItem as DataRowView;
  192. psn_setlway = dataRow["Code"].ToString().Trim();
  193. psn_setlway_name = dataRow["Name"].ToString().Trim();
  194. }
  195. private void dblkcbxDiseaseType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  196. {
  197. DataGridViewRow row = e.Value as DataGridViewRow;
  198. DataRowView dataRow = row.DataBoundItem as DataRowView;
  199. dise_type_code = dataRow["Code"].ToString().Trim();
  200. dise_type_name = dataRow["Name"].ToString().Trim();
  201. }
  202. private void button2_Click(object sender, EventArgs e)
  203. {
  204. this.DialogResult = DialogResult.Cancel;
  205. }
  206. private void cbxAccountPay_ValueChanged(object sender, bool value)
  207. {
  208. if (cbxAccountPay.Checked)
  209. {
  210. personAccountUsedFlag = "1";
  211. }
  212. else
  213. {
  214. personAccountUsedFlag = "0";
  215. }
  216. }
  217. public int DealFor2001(string funNO, out string OutMsg)
  218. {
  219. //人员待遇享受检查
  220. string errMsg = "";
  221. JObject joData2001 = new JObject();
  222. joData2001.Add("psn_no", Global.pat.psn_no);
  223. joData2001.Add("insutype", insuType);
  224. joData2001.Add("fixmedins_code", Global.inf.hospitalNO);
  225. joData2001.Add("med_type", med_type);
  226. joData2001.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  227. joData2001.Add("endtime", "");
  228. joData2001.Add("dise_codg", diseCodg);
  229. joData2001.Add("dise_name", diseName);
  230. joData2001.Add("oprn_oprt_code", "");
  231. joData2001.Add("oprn_oprt_name", "");
  232. joData2001.Add("matn_type", "");
  233. joData2001.Add("birctrl_type", "");
  234. JObject joInput = new JObject();
  235. joInput.Add("data", joData2001);
  236. InvokeHelper invoker = new InvokeHelper();
  237. JObject joRtn2001 = invoker.invokeCenterService("2001", JsonHelper.setCenterInpar("2001", joInput));
  238. if (JsonHelper.parseCenterRtnValue(joRtn2001, out errMsg) != 0)
  239. {
  240. OutMsg = "人员待遇享受检查调用失败,中心返回错误信息:" + errMsg;
  241. return -1;
  242. }
  243. else
  244. {
  245. OutMsg = "人员待遇享受检查调用成功:" + joRtn2001.ToString();
  246. return 0;
  247. }
  248. }
  249. private void uiButton1_Click(object sender, EventArgs e)
  250. {
  251. string OutMsg = "";
  252. DealFor2001("", out OutMsg);
  253. MessageBox.Show(OutMsg);
  254. }
  255. private void dblkcbxHospType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  256. {
  257. DataGridViewRow row = e.Value as DataGridViewRow;
  258. DataRowView dataRow = row.DataBoundItem as DataRowView;
  259. iptTypeCode = dataRow["Code"].ToString().Trim();
  260. iptTypeName = dataRow["Name"].ToString().Trim();
  261. }
  262. }
  263. }