OutpatientRegistration.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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. private MIIrisServices mIS = new MIIrisServices();
  21. public OutpatientRegistration()
  22. {
  23. InitializeComponent();
  24. this.StartPosition = FormStartPosition.CenterParent;
  25. //获取通用目录
  26. string sTYML = mIS.GetCommonInterface_Dr(Global.inf.interfaceDr.ToString(), "");
  27. if (sTYML == "")
  28. Global.inf.interfaceDr_TY = Global.inf.interfaceDr;
  29. else
  30. Global.inf.interfaceDr_TY = int.Parse(sTYML);
  31. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr_TY.ToString() + "'";
  32. if (Global.pat.RYorCY == "2")
  33. {
  34. string sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr "
  35. + " WHERE B.Code='" + Global.pat.insuType + "' and A.InsuCode = 'insutype'" + sqlCondition;
  36. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  37. 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;
  38. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  39. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=8" + sqlCondition;
  40. SetDBLKCombox(ref dblkcbxOperation, sqlStr);
  41. 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.medType + "' and A.InsuCode = 'med_type'" + sqlCondition;
  43. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  44. 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;
  45. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  46. }
  47. else
  48. {
  49. 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;
  50. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  51. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=7" + sqlCondition;
  52. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  53. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=8" + sqlCondition;
  54. SetDBLKCombox(ref dblkcbxOperation, 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. }
  60. cbxAccountPay.Checked = true;
  61. personAccountUsedFlag = "1";
  62. }
  63. public Boolean b2001 = false;
  64. private DataTable dtDisease;
  65. private DataTable dtDiseaseType;
  66. private DataTable dtInsuranceType;
  67. private DataTable dtMedicalType;
  68. private DataTable dtOperation;
  69. private DataTable dtSettelmentType;
  70. //险种
  71. public string insuType { get; set; }
  72. public string insuTypeName { get; set; }
  73. //医疗类别
  74. public string med_type { get; set; }
  75. public string med_type_name { get; set; }
  76. //诊断
  77. public string diseCodg { get; set; }
  78. public string diseName{ get; set; }
  79. //手术
  80. public string oprn_oprt_code { get; set; }
  81. public string oprn_oprt_name{ get; set; }
  82. //病种
  83. public string dise_type_code { get; set; }
  84. public string dise_type_name { get; set; }
  85. //结算方式
  86. public string psn_setlway { get; set; }
  87. public string psn_setlway_name { get; set; }
  88. public DataTable DtDiagnose { get; set; }
  89. public string personAccountUsedFlag = "0";
  90. private DataTable GetDBLKComboxTable(string sqlStr)
  91. {
  92. InvokeHelper invoker = new InvokeHelper();
  93. dynamic joInparm = new JObject();
  94. dynamic joTmp = new JObject();
  95. joTmp.sqlStr = sqlStr;
  96. JArray jaParams = new JArray();
  97. jaParams.Add(joTmp);
  98. joInparm.Add("params", JArray.FromObject(jaParams));
  99. joInparm.code = "09010014";
  100. string inParam = joInparm.ToString();
  101. JObject joRtn = invoker.invokeInsuService(inParam,"获取下拉框消息");
  102. //dynamic jsonRtn = JsonConvert.DeserializeObject(strRtn);
  103. DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  104. //dt.Columns[0].ColumnName = "编码";
  105. //dt.Columns[1].ColumnName = "名称";
  106. //dt.Columns[2].ColumnName = "拼音查找码";
  107. return dt;
  108. }
  109. private void SetDBLKCombox(ref PTControl.DBLookupCombox dblcbx, string sqlStr)
  110. {
  111. dblcbx.sDisplayField = "Code,Name,SearchCode";
  112. dblcbx.sDisplayMember = "名称";
  113. dblcbx.sKeyWords = "Code,SearchCode";
  114. dblcbx.DataSource = GetDBLKComboxTable(sqlStr);
  115. dblcbx.RowFilterVisible = true;
  116. dblcbx.TextBox.Width = 400;
  117. dblcbx.DataGridView.Width = 400;
  118. dblcbx.DataGridView.Columns[0].Name = "编码";
  119. dblcbx.DataGridView.Columns[1].Name = "名称";
  120. dblcbx.DataGridView.Columns[2].Name = "查找码";
  121. dblcbx.DataGridView.Columns[0].Width = 100;
  122. dblcbx.DataGridView.Columns[1].Width = 200;
  123. }
  124. private void OutpatientRegistration_Load(object sender, EventArgs e)
  125. {
  126. dgvDiagnose.AutoGenerateColumns = false;
  127. dgvDiagnose.DataSource = DtDiagnose;
  128. //DtDiagnose.AcceptChanges();
  129. dgvDiagnose.ReadOnly = true;
  130. }
  131. private void button1_Click(object sender, EventArgs e)
  132. {
  133. //DealFor2001("");
  134. this.DialogResult = DialogResult.OK;
  135. }
  136. private void dblkcbxInsuranceType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  137. {
  138. DataGridViewRow row = e.Value as DataGridViewRow;
  139. DataRowView dataRow = row.DataBoundItem as DataRowView;
  140. insuType = dataRow["Code"].ToString().Trim();
  141. insuTypeName = dataRow["Name"].ToString().Trim();
  142. }
  143. private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  144. {
  145. DataGridViewRow row = e.Value as DataGridViewRow;
  146. DataRowView dataRow = row.DataBoundItem as DataRowView;
  147. med_type = dataRow["Code"].ToString().Trim();
  148. med_type_name = dataRow["Name"].ToString().Trim();
  149. Global.pat.medType = med_type;
  150. }
  151. private void dblkcbxDisease_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  152. {
  153. DataGridViewRow row = e.Value as DataGridViewRow;
  154. DataRowView dataRow = row.DataBoundItem as DataRowView;
  155. diseCodg = dataRow["Code"].ToString().Trim();
  156. diseName = dataRow["Name"].ToString().Trim();
  157. }
  158. private void dblkcbxOperation_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  159. {
  160. DataGridViewRow row = e.Value as DataGridViewRow;
  161. DataRowView dataRow = row.DataBoundItem as DataRowView;
  162. oprn_oprt_code = dataRow["Code"].ToString().Trim();
  163. oprn_oprt_name = dataRow["Name"].ToString().Trim();
  164. }
  165. private void dblkcbxSettelmentWay_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  166. {
  167. DataGridViewRow row = e.Value as DataGridViewRow;
  168. DataRowView dataRow = row.DataBoundItem as DataRowView;
  169. psn_setlway = dataRow["Code"].ToString().Trim();
  170. psn_setlway_name = dataRow["Name"].ToString().Trim();
  171. }
  172. private void dblkcbxDiseaseType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  173. {
  174. DataGridViewRow row = e.Value as DataGridViewRow;
  175. DataRowView dataRow = row.DataBoundItem as DataRowView;
  176. dise_type_code = dataRow["Code"].ToString().Trim();
  177. dise_type_name = dataRow["Name"].ToString().Trim();
  178. }
  179. private void button2_Click(object sender, EventArgs e)
  180. {
  181. this.DialogResult = DialogResult.Cancel;
  182. }
  183. private void cbxAccountPay_ValueChanged(object sender, bool value)
  184. {
  185. if (cbxAccountPay.Checked)
  186. {
  187. personAccountUsedFlag = "1";
  188. }
  189. else
  190. {
  191. personAccountUsedFlag = "0";
  192. }
  193. }
  194. public int DealFor2001(string funNO, out string OutMsg)
  195. {
  196. //人员待遇享受检查
  197. string errMsg = "";
  198. JObject joData2001 = new JObject();
  199. joData2001.Add("psn_no", Global.pat.psn_no);
  200. joData2001.Add("insutype", insuType);
  201. joData2001.Add("fixmedins_code", Global.inf.hospitalNO);
  202. joData2001.Add("med_type", med_type);
  203. joData2001.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  204. joData2001.Add("endtime", "");
  205. joData2001.Add("dise_codg", diseCodg);
  206. joData2001.Add("dise_name", diseName);
  207. joData2001.Add("oprn_oprt_code", "");
  208. joData2001.Add("oprn_oprt_name", "");
  209. joData2001.Add("matn_type", "");
  210. joData2001.Add("birctrl_type", "");
  211. JObject joInput = new JObject();
  212. joInput.Add("data", joData2001);
  213. InvokeHelper invoker = new InvokeHelper();
  214. JObject joRtn2001 = invoker.invokeCenterService("2001", JsonHelper.setCenterInpar("2001", joInput));
  215. if (JsonHelper.parseCenterRtnValue(joRtn2001, out errMsg) != 0)
  216. {
  217. OutMsg = "人员待遇享受检查调用失败,中心返回错误信息:" + errMsg;
  218. return -1;
  219. }
  220. else
  221. {
  222. OutMsg = "人员待遇享受检查调用成功:" + joRtn2001.ToString();
  223. return 0;
  224. }
  225. }
  226. private void uiButton1_Click(object sender, EventArgs e)
  227. {
  228. string OutMsg = "";
  229. DealFor2001("", out OutMsg);
  230. MessageBox.Show(OutMsg);
  231. }
  232. }
  233. }