OutpatientRegistration.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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. /*
  24. string sqlCondition = " and Interface_ID = '" + Global.inf.InterfaceID + "'";
  25. string sqlStr = "select sNO AS Code,Name FROM CloudMedicalInsurancePlatform_Tables.Dictionary where Type = 'insutype'" + sqlCondition;
  26. //SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  27. string sqlStr2 = "select Code,Name FROM CloudMedicalInsurancePlatform_Tables.Dictionary where Type='insutype' and Interface_Dr = '7'and Hosp_Dr ='63'";
  28. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr2);
  29. sqlStr = "select Code,SectionName AS Name FROM CloudMedicalInsurancePlatform_Tables.Diagnose where Type='Diagnose'" + sqlCondition;
  30. SetDBLKCombox(ref dblkcbxDisease, sqlStr2);
  31. sqlStr = "select sNO AS Code,Name FROM CloudMedicalInsurancePlatform_Tables.Dictionary where Type = 'psn_setlway'" + sqlCondition;
  32. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  33. sqlStr = "select sNO AS Code,Name FROM CloudMedicalInsurancePlatform_Tables.Dictionary where Type = 'MED_TYPE'" + sqlCondition;
  34. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  35. sqlStr = "select Code,Name FROM CloudMedicalInsurancePlatform_Tables.Diagnose where Type='Operation'" + sqlCondition;
  36. SetDBLKCombox(ref dblkcbxOperation, sqlStr);
  37. */
  38. if (Global.pat.RYorCY == "2")
  39. {
  40. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
  41. string sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr "
  42. + " WHERE B.Code='" + Global.pat.insuType + "' and A.InsuCode = 'insutype'" + sqlCondition;
  43. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  44. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.Code='" + Global.pat.DiseasecCode + "' and A.UseFlag='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"
  47. + " WHERE B.Code='" + Global.pat.medType + "' and A.InsuCode = 'med_type'" + sqlCondition;
  48. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  49. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=5" + sqlCondition;
  50. SetDBLKCombox(ref dblkcbxOperation, 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. }
  54. else
  55. {
  56. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
  57. 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;
  58. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  59. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=7" + sqlCondition;
  60. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  61. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=5" + sqlCondition;
  62. SetDBLKCombox(ref dblkcbxOperation, 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 = 'psn_setlway'" + sqlCondition;
  64. SetDBLKCombox(ref dblkcbxSettelmentWay, 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 = 'med_type'" + sqlCondition;
  66. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  67. }
  68. //sqlStr = "select Code,Name FROM CloudMedicalInsurancePlatform_Tables.Directory where HisType=5" + sqlCondition;
  69. //SetDBLKCombox(ref dblkcbxOperation, sqlStr);
  70. //dgvDiagnose.DataSource = DtDiagnose;
  71. ////DtDiagnose.AcceptChanges();
  72. //dgvDiagnose.ReadOnly = true;
  73. //MessageBox.Show(DtDiagnose.Rows.Count.ToString());
  74. //MessageBox.Show(DtDiagnose.Rows[0]["diag_name"].ToString());
  75. //DataGridViewColumn column = new PTControl.DataGridViewDBLKBColumn();
  76. //(column as PTControl.DataGridViewDBLKBColumn).SDisplayField = "Code,Name,SearchCode";
  77. //(column as PTControl.DataGridViewDBLKBColumn).SDisplayMember = "Name";
  78. //(column as PTControl.DataGridViewDBLKBColumn).SKeyWords = "SearchCode";
  79. //column.DataGridView.Width = 400;
  80. //column.DataGridView.Columns[0].Name = "编码";
  81. //column.DataGridView.Columns[1].Name = "名称";
  82. //column.DataGridView.Columns[2].Name = "查找码";
  83. //column.DataGridView.Columns[0].Width = 100;
  84. //column.DataGridView.Columns[1].Width = 200;
  85. //sqlStr = "select sNO AS Code,Name FROM CloudMedicalInsurancePlatform_Tables.Dictionary where Type = 'psn_setlway'" + sqlCondition;
  86. //(column as PTControl.DataGridViewDBLKBColumn).DataSource = GetDBLKComboxTable(sqlStr);
  87. //dgvDiagnose.Columns.Add(column);
  88. //dgvDiagnose.Columns[10].Name = "测试";
  89. //dgvDiagnose.Columns[10].DisplayIndex = 0;
  90. //string diseaseTypeParam = string.Empty;
  91. //string diseaseTypeRtn = iris.Invoke(diseaseTypeParam);
  92. //dynamic diseaseTypeRtnRtnJson = JsonConvert.DeserializeObject(diseaseTypeRtn);
  93. //dtDiseaseType = (DataTable)diseaseTypeRtnRtnJson.ToObject(typeof(DataTable));
  94. //string insuranceTypeParam = string.Empty;
  95. //string insuranceTypeRtn = iris.Invoke(insuranceTypeParam);
  96. //dynamic insuranceTypeRtnRtnJson = JsonConvert.DeserializeObject(insuranceTypeRtn);
  97. //dtInsuranceType = (DataTable)insuranceTypeRtnRtnJson.ToObject(typeof(DataTable));
  98. cbxAccountPay.Checked = true;
  99. personAccountUsedFlag = "1";
  100. }
  101. public Boolean b2001 = false;
  102. private DataTable dtDisease;
  103. private DataTable dtDiseaseType;
  104. private DataTable dtInsuranceType;
  105. private DataTable dtMedicalType;
  106. private DataTable dtOperation;
  107. private DataTable dtSettelmentType;
  108. //险种
  109. public string insuType { get; set; }
  110. public string insuTypeName { get; set; }
  111. //医疗类别
  112. public string med_type { get; set; }
  113. public string med_type_name { get; set; }
  114. //诊断
  115. public string diseCodg { get; set; }
  116. public string diseName{ get; set; }
  117. //手术
  118. public string oprn_oprt_code { get; set; }
  119. public string oprn_oprt_name{ get; set; }
  120. //病种
  121. public string dise_type_code { get; set; }
  122. public string dise_type_name { get; set; }
  123. //结算方式
  124. public string traumaFlag ;//外伤标志
  125. public string relTtpFlag ;//涉及第三方标志
  126. public string creditFlag;//信用授权标志
  127. public string psn_setlway { get; set; }
  128. public string psn_setlway_name { get; set; }
  129. public DataTable DtDiagnose { get; set; }
  130. //public DataTable dtCreditInfo { get; set; }
  131. //public string bankCode { get; set; }
  132. //public string payFee { get; set; }
  133. public string personAccountUsedFlag = "0";
  134. private DataTable GetDBLKComboxTable(string sqlStr)
  135. {
  136. InvokeHelper invoker = new InvokeHelper();
  137. dynamic joInparm = new JObject();
  138. dynamic joTmp = new JObject();
  139. joTmp.sqlStr = sqlStr;
  140. JArray jaParams = new JArray();
  141. jaParams.Add(joTmp);
  142. joInparm.Add("params", JArray.FromObject(jaParams));
  143. joInparm.code = "09010014";
  144. string inParam = joInparm.ToString();
  145. JObject joRtn = invoker.invokeInsuService(inParam,"获取下拉框消息");
  146. //dynamic jsonRtn = JsonConvert.DeserializeObject(strRtn);
  147. DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  148. //dt.Columns[0].ColumnName = "编码";
  149. //dt.Columns[1].ColumnName = "名称";
  150. //dt.Columns[2].ColumnName = "拼音查找码";
  151. return dt;
  152. }
  153. private void SetDBLKCombox(ref PTControl.DBLookupCombox dblcbx, string sqlStr)
  154. {
  155. dblcbx.sDisplayField = "Code,Name,SearchCode";
  156. dblcbx.sDisplayMember = "名称";
  157. dblcbx.sKeyWords = "Code,SearchCode";
  158. dblcbx.DataSource = GetDBLKComboxTable(sqlStr);
  159. dblcbx.RowFilterVisible = true;
  160. dblcbx.TextBox.Width = 400;
  161. dblcbx.DataGridView.Width = 400;
  162. dblcbx.DataGridView.Columns[0].Name = "编码";
  163. dblcbx.DataGridView.Columns[1].Name = "名称";
  164. dblcbx.DataGridView.Columns[2].Name = "查找码";
  165. dblcbx.DataGridView.Columns[0].Width = 100;
  166. dblcbx.DataGridView.Columns[1].Width = 200;
  167. }
  168. private void OutpatientRegistration_Load(object sender, EventArgs e)
  169. {
  170. dgvDiagnose.AutoGenerateColumns = false;
  171. dgvDiagnose.DataSource = DtDiagnose;
  172. //DtDiagnose.AcceptChanges();
  173. dgvDiagnose.ReadOnly = true;
  174. //dgvCreditInfo.DataSource = dtCreditInfo;
  175. }
  176. private void button1_Click(object sender, EventArgs e)
  177. {
  178. //DealFor2001("");
  179. //外伤标志
  180. if (Chk_TraumaFlag.Checked)
  181. traumaFlag = "1";
  182. else
  183. traumaFlag = "0";
  184. //涉及第三方标志
  185. if (Chk_RelTtpFlag.Checked)
  186. relTtpFlag = "1";
  187. else
  188. relTtpFlag = "0";
  189. ////涉及第三方标志
  190. //if (Chk_Credit.Checked)
  191. // creditFlag = "1";
  192. //else
  193. // creditFlag = "0";
  194. //if (Chk_Credit.Checked)
  195. //{
  196. // bankCode = dgvCreditInfo.CurrentRow.Cells["bank_code"].Value.ToString();
  197. // payFee = dgvCreditInfo.CurrentRow.Cells["pay_fee"].Value.ToString();
  198. //}
  199. this.DialogResult = DialogResult.OK;
  200. }
  201. private void dblkcbxInsuranceType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  202. {
  203. DataGridViewRow row = e.Value as DataGridViewRow;
  204. DataRowView dataRow = row.DataBoundItem as DataRowView;
  205. insuType = dataRow["Code"].ToString().Trim();
  206. insuTypeName = dataRow["Name"].ToString().Trim();
  207. }
  208. private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  209. {
  210. DataGridViewRow row = e.Value as DataGridViewRow;
  211. DataRowView dataRow = row.DataBoundItem as DataRowView;
  212. med_type = dataRow["Code"].ToString().Trim();
  213. med_type_name = dataRow["Name"].ToString().Trim();
  214. }
  215. private void dblkcbxDisease_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  216. {
  217. DataGridViewRow row = e.Value as DataGridViewRow;
  218. DataRowView dataRow = row.DataBoundItem as DataRowView;
  219. diseCodg = dataRow["Code"].ToString().Trim();
  220. diseName = dataRow["Name"].ToString().Trim();
  221. }
  222. private void dblkcbxOperation_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  223. {
  224. DataGridViewRow row = e.Value as DataGridViewRow;
  225. DataRowView dataRow = row.DataBoundItem as DataRowView;
  226. oprn_oprt_code = dataRow["Code"].ToString().Trim();
  227. oprn_oprt_name = dataRow["Name"].ToString().Trim();
  228. }
  229. private void dblkcbxSettelmentWay_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  230. {
  231. DataGridViewRow row = e.Value as DataGridViewRow;
  232. DataRowView dataRow = row.DataBoundItem as DataRowView;
  233. psn_setlway = dataRow["Code"].ToString().Trim();
  234. psn_setlway_name = dataRow["Name"].ToString().Trim();
  235. }
  236. private void dblkcbxDiseaseType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  237. {
  238. DataGridViewRow row = e.Value as DataGridViewRow;
  239. DataRowView dataRow = row.DataBoundItem as DataRowView;
  240. dise_type_code = dataRow["Code"].ToString().Trim();
  241. dise_type_name = dataRow["Name"].ToString().Trim();
  242. }
  243. private void button2_Click(object sender, EventArgs e)
  244. {
  245. this.DialogResult = DialogResult.Cancel;
  246. }
  247. private void cbxAccountPay_ValueChanged(object sender, bool value)
  248. {
  249. if (cbxAccountPay.Checked)
  250. {
  251. personAccountUsedFlag = "1";
  252. }
  253. else
  254. {
  255. personAccountUsedFlag = "0";
  256. }
  257. }
  258. public int DealFor2001(string funNO, out string OutMsg)
  259. {
  260. //人员待遇享受检查
  261. string errMsg = "";
  262. JObject joData2001 = new JObject();
  263. joData2001.Add("psn_no", Global.pat.psn_no);
  264. joData2001.Add("insutype", insuType);
  265. joData2001.Add("fixmedins_code", Global.inf.hospitalNO);
  266. joData2001.Add("med_type", med_type);
  267. joData2001.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  268. joData2001.Add("endtime", "");
  269. joData2001.Add("dise_codg", diseCodg);
  270. joData2001.Add("dise_name", diseName);
  271. joData2001.Add("oprn_oprt_code", "");
  272. joData2001.Add("oprn_oprt_name", "");
  273. joData2001.Add("matn_type", "");
  274. joData2001.Add("birctrl_type", "");
  275. JObject joInput = new JObject();
  276. joInput.Add("data", joData2001);
  277. InvokeHelper invoker = new InvokeHelper();
  278. JObject joRtn2001 = invoker.invokeCenterService("2001", JsonHelper.setCenterInpar("2001", joInput));
  279. if (JsonHelper.parseCenterRtnValue(joRtn2001, out errMsg) != 0)
  280. {
  281. OutMsg = "人员待遇享受检查调用失败,中心返回错误信息:" + errMsg;
  282. return -1;
  283. }
  284. else
  285. {
  286. OutMsg = "人员待遇享受检查调用成功:" + joRtn2001.ToString();
  287. return 0;
  288. }
  289. }
  290. private void uiButton1_Click(object sender, EventArgs e)
  291. {
  292. string OutMsg = "";
  293. DealFor2001("", out OutMsg);
  294. MessageBox.Show(OutMsg);
  295. }
  296. private void dgvDiagnose_CellContentClick(object sender, DataGridViewCellEventArgs e)
  297. {
  298. }
  299. private void cbxAccountPay_CheckedChanged(object sender, EventArgs e)
  300. {
  301. }
  302. private void dgvCreditInfo_CellContentClick(object sender, DataGridViewCellEventArgs e)
  303. {
  304. }
  305. }
  306. }