OutpatientRegistration.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  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.mainInterfaceDr.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. }
  42. else
  43. {
  44. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.mainInterfaceDr.ToString() + "'";
  45. 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;
  46. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  47. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
  48. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  49. 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;
  50. SetDBLKCombox(ref dblkcbxSettelmentWay, 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 = 'med_type'" + sqlCondition;
  52. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  53. }
  54. cbxAccountPay.Checked = true;
  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. //外伤标志
  138. if (Chk_TraumaFlag.Checked)
  139. traumaFlag = "1";
  140. else
  141. traumaFlag = "0";
  142. //涉及第三方标志
  143. if (Chk_RelTtpFlag.Checked)
  144. relTtpFlag = "1";
  145. else
  146. relTtpFlag = "0";
  147. //分级诊疗标志
  148. if (chk_claTrtFlag.Checked)
  149. claTrtFlag = "1";
  150. else
  151. claTrtFlag = "0";
  152. // 选择病种后,必须选择医疗类别
  153. if (!string.IsNullOrEmpty(diseCodg) && string.IsNullOrEmpty(med_type))
  154. {
  155. MessageBox.Show("请选择医疗类别!");
  156. return;
  157. }
  158. // 是否使用个人账户金额
  159. if (cbxAccountPay.Checked)
  160. {
  161. personAccountUsedFlag = "1";
  162. }
  163. this.DialogResult = DialogResult.OK;
  164. }
  165. private void dblkcbxInsuranceType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  166. {
  167. DataGridViewRow row = e.Value as DataGridViewRow;
  168. DataRowView dataRow = row.DataBoundItem as DataRowView;
  169. insuType = dataRow["Code"].ToString().Trim();
  170. insuTypeName = dataRow["Name"].ToString().Trim();
  171. }
  172. private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  173. {
  174. DataGridViewRow row = e.Value as DataGridViewRow;
  175. DataRowView dataRow = row.DataBoundItem as DataRowView;
  176. med_type = dataRow["Code"].ToString().Trim();
  177. med_type_name = dataRow["Name"].ToString().Trim();
  178. }
  179. private void dblkcbxDisease_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  180. {
  181. DataGridViewRow row = e.Value as DataGridViewRow;
  182. DataRowView dataRow = row.DataBoundItem as DataRowView;
  183. diseCodg = dataRow["Code"].ToString().Trim();
  184. diseName = dataRow["Name"].ToString().Trim();
  185. }
  186. private void dblkcbxOperation_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  187. {
  188. DataGridViewRow row = e.Value as DataGridViewRow;
  189. DataRowView dataRow = row.DataBoundItem as DataRowView;
  190. oprn_oprt_code = dataRow["Code"].ToString().Trim();
  191. oprn_oprt_name = dataRow["Name"].ToString().Trim();
  192. }
  193. private void dblkcbxSettelmentWay_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  194. {
  195. DataGridViewRow row = e.Value as DataGridViewRow;
  196. DataRowView dataRow = row.DataBoundItem as DataRowView;
  197. psn_setlway = dataRow["Code"].ToString().Trim();
  198. psn_setlway_name = dataRow["Name"].ToString().Trim();
  199. }
  200. private void dblkcbxDiseaseType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  201. {
  202. DataGridViewRow row = e.Value as DataGridViewRow;
  203. DataRowView dataRow = row.DataBoundItem as DataRowView;
  204. dise_type_code = dataRow["Code"].ToString().Trim();
  205. dise_type_name = dataRow["Name"].ToString().Trim();
  206. }
  207. private void button2_Click(object sender, EventArgs e)
  208. {
  209. this.DialogResult = DialogResult.Cancel;
  210. }
  211. private void cbxAccountPay_ValueChanged(object sender, bool value)
  212. {
  213. if (cbxAccountPay.Checked)
  214. {
  215. personAccountUsedFlag = "1";
  216. }
  217. else
  218. {
  219. personAccountUsedFlag = "0";
  220. }
  221. }
  222. public int DealFor2001(string funNO, out string OutMsg)
  223. {
  224. //人员待遇享受检查
  225. string errMsg = "";
  226. JObject joData2001 = new JObject();
  227. joData2001.Add("psn_no", Global.pat.psn_no);
  228. joData2001.Add("insutype", insuType);
  229. joData2001.Add("fixmedins_code", Global.inf.hospitalNO);
  230. joData2001.Add("med_type", med_type);
  231. joData2001.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  232. joData2001.Add("endtime", "");
  233. joData2001.Add("dise_codg", diseCodg);
  234. joData2001.Add("dise_name", diseName);
  235. joData2001.Add("oprn_oprt_code", "");
  236. joData2001.Add("oprn_oprt_name", "");
  237. joData2001.Add("matn_type", "");
  238. joData2001.Add("birctrl_type", "");
  239. JObject joInput = new JObject();
  240. joInput.Add("data", joData2001);
  241. InvokeHelper invoker = new InvokeHelper();
  242. JObject joRtn2001 = invoker.invokeCenterService("2001", JsonHelper.setCenterInpar("2001", joInput));
  243. if (JsonHelper.parseCenterRtnValue(joRtn2001, out errMsg) != 0)
  244. {
  245. OutMsg = "人员待遇享受检查调用失败,中心返回错误信息:" + errMsg;
  246. return -1;
  247. }
  248. else
  249. {
  250. OutMsg = "人员待遇享受检查调用成功:" + joRtn2001.ToString();
  251. return 0;
  252. }
  253. }
  254. private void uiButton1_Click(object sender, EventArgs e)
  255. {
  256. string OutMsg = "";
  257. DealFor2001("", out OutMsg);
  258. MessageBox.Show(OutMsg);
  259. }
  260. private void dblkcbxHospType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  261. {
  262. DataGridViewRow row = e.Value as DataGridViewRow;
  263. DataRowView dataRow = row.DataBoundItem as DataRowView;
  264. iptTypeCode = dataRow["Code"].ToString().Trim();
  265. iptTypeName = dataRow["Name"].ToString().Trim();
  266. }
  267. }
  268. }