OutpatientRegistration.cs 15 KB

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