OutpatientRegistration.cs 13 KB

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