InpatientRegistration.cs 15 KB

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