OutpatientRegistration.cs 15 KB

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