InpatientRegistration.cs 13 KB

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