OutpatientRegistration.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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 FastReport.Utils;
  16. using Sunny.UI.Win32;
  17. using AnHuiMI.Common;
  18. namespace PTMedicalInsurance.Forms
  19. {
  20. public partial class OutpatientRegistration : Form
  21. {
  22. private InvokeHelper invoker =new InvokeHelper();
  23. public OutpatientRegistration()
  24. {
  25. InitializeComponent();
  26. this.StartPosition = FormStartPosition.CenterParent;
  27. if (Global.pat.RYorCY == "2")
  28. {
  29. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
  30. string sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr "
  31. + " WHERE B.Code='" + Global.pat.insuType + "' and A.InsuCode = 'insutype'" + sqlCondition;
  32. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  33. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.Code='" + Global.pat.DiseasecCode + "' and A.ValidFlag='1' And A.HisType=7" + sqlCondition;
  34. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  35. sqlStr = " SELECT B.Code,B.Descripts AS Name FROM HB_Dictionary A JOIN HB_DictionaryDataDetail B ON A.ID = B.HBDictionary_Dr"
  36. + " WHERE B.Code='" + Global.pat.medType + "' and A.InsuCode = 'med_type'" + sqlCondition;
  37. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  38. 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;
  39. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  40. //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 = 'IPT_TYPE'" + sqlCondition;
  41. //SetDBLKCombox(ref dblkcbxHospType, sqlStr);
  42. }
  43. else
  44. {
  45. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
  46. 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;
  47. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  48. //sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
  49. //SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  50. 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;
  51. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  52. 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;
  53. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  54. //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 = 'IPT_TYPE'" + sqlCondition;
  55. //SetDBLKCombox(ref dblkcbxHospType, sqlStr);
  56. sqlStr = " SELECT Code, Name,'' as SearchCode FROM HB_MedInsuDirectory A where A.ValidFlag='1' AND A.HisType=6" + sqlCondition;
  57. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  58. }
  59. }
  60. public Boolean b2001 = false;
  61. private DataTable dtDisease;
  62. //private DataTable dtDiseaseType;
  63. //private DataTable dtInsuranceType;
  64. //private DataTable dtMedicalType;
  65. //private DataTable dtOperation;
  66. //private DataTable dtSettelmentType;
  67. //private DataTable dtHospType;
  68. //险种
  69. public string insuType { get; set; }
  70. public string insuTypeName { get; set; }
  71. //医疗类别
  72. public string med_type { get; set; }
  73. public string med_type_name { get; set; }
  74. //诊断
  75. public string diseCodg { get; set; }
  76. public string diseName{ get; set; }
  77. //手术
  78. public string oprn_oprt_code { get; set; }
  79. public string oprn_oprt_name{ get; set; }
  80. //病种
  81. public string dise_type_code { get; set; }
  82. public string dise_type_name { get; set; }
  83. //结算方式
  84. public string psn_setlway { get; set; }
  85. public string psn_setlway_name { get; set; }
  86. public string traumaFlag = "0";
  87. public string relTtpFlag = "0";
  88. public string hospType = "0";
  89. public string otpErReflFlag = "0";
  90. public string mdtrtGrpType="0";
  91. public string claTrtFlag = "0";
  92. public string unifPayStdType = "0";
  93. public string ouOrEmrefFlag = "0";
  94. //住院类型
  95. public string iptTypeCode { get; set; }
  96. public string iptTypeName { get; set; }
  97. public DataTable DtDiagnose { get; set; }
  98. public string personAccountUsedFlag = "0";
  99. private DataTable GetDBLKComboxTable(string sqlStr)
  100. {
  101. InvokeHelper invoker = new InvokeHelper();
  102. dynamic joInparm = new JObject();
  103. dynamic joTmp = new JObject();
  104. joTmp.sqlStr = sqlStr;
  105. JArray jaParams = new JArray();
  106. jaParams.Add(joTmp);
  107. joInparm.Add("params", JArray.FromObject(jaParams));
  108. joInparm.code = "09010014";
  109. string inParam = joInparm.ToString();
  110. JObject joRtn = invoker.invokeInsuService(inParam,"获取下拉框消息");
  111. //dynamic jsonRtn = JsonConvert.DeserializeObject(strRtn);
  112. DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  113. //dt.Columns[0].ColumnName = "编码";
  114. //dt.Columns[1].ColumnName = "名称";
  115. //dt.Columns[2].ColumnName = "拼音查找码";
  116. return dt;
  117. }
  118. private void SetDBLKCombox(ref PTControl.DBLookupCombox dblcbx, string sqlStr)
  119. {
  120. dblcbx.sDisplayField = "Code,Name,SearchCode";
  121. dblcbx.sDisplayMember = "名称";
  122. dblcbx.sKeyWords = "Code,SearchCode";
  123. dblcbx.DataSource = GetDBLKComboxTable(sqlStr);
  124. dblcbx.RowFilterVisible = true;
  125. dblcbx.TextBox.Width = 400;
  126. dblcbx.DataGridView.Width = 400;
  127. dblcbx.DataGridView.Columns[0].Name = "编码";
  128. dblcbx.DataGridView.Columns[1].Name = "名称";
  129. dblcbx.DataGridView.Columns[2].Name = "查找码";
  130. dblcbx.DataGridView.Columns[0].Width = 100;
  131. dblcbx.DataGridView.Columns[1].Width = 200;
  132. }
  133. private void OutpatientRegistration_Load(object sender, EventArgs e)
  134. {
  135. dgvDiagnose.AutoGenerateColumns = false;
  136. dgvDiagnose.DataSource = DtDiagnose;
  137. //DtDiagnose.AcceptChanges();
  138. dgvDiagnose.ReadOnly = true;
  139. cbxAccountPay.Checked = true;
  140. }
  141. private void button1_Click(object sender, EventArgs e)
  142. {
  143. //DealFor2001("");
  144. if (cbxMdtrtGrpType.Text != "")
  145. mdtrtGrpType = (cbxMdtrtGrpType.SelectedIndex).ToString();
  146. if (dblkcbxOuOrEmref.Text != "")
  147. ouOrEmrefFlag = (dblkcbxOuOrEmref.SelectedIndex).ToString();
  148. //外伤标志
  149. if (Chk_TraumaFlag.Checked)
  150. traumaFlag = "1";
  151. else
  152. traumaFlag = "0";
  153. //涉及第三方标志
  154. if (Chk_RelTtpFlag.Checked)
  155. relTtpFlag = "1";
  156. else
  157. relTtpFlag = "0";
  158. //分级诊疗标志
  159. if (chk_claTrtFlag.Checked)
  160. claTrtFlag = "1";
  161. else
  162. claTrtFlag = "0";
  163. //包干标准类型
  164. if (cbxUnifPayStdType.Text!="")
  165. unifPayStdType = (cbxUnifPayStdType.SelectedIndex).ToString();
  166. if (cbxAccountPay.Checked)
  167. {
  168. personAccountUsedFlag = "1";
  169. }
  170. else
  171. {
  172. personAccountUsedFlag = "0";
  173. }
  174. hospType = "1";//默认普通住院
  175. if (dblkcbxHospType.Text != "")
  176. {
  177. hospType = (dblkcbxHospType.SelectedIndex).ToString();
  178. }
  179. this.DialogResult = DialogResult.OK;
  180. }
  181. private void dblkcbxInsuranceType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  182. {
  183. DataGridViewRow row = e.Value as DataGridViewRow;
  184. DataRowView dataRow = row.DataBoundItem as DataRowView;
  185. insuType = dataRow["Code"].ToString().Trim();
  186. insuTypeName = dataRow["Name"].ToString().Trim();
  187. }
  188. private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  189. {
  190. DataGridViewRow row = e.Value as DataGridViewRow;
  191. DataRowView dataRow = row.DataBoundItem as DataRowView;
  192. med_type = dataRow["Code"].ToString().Trim();
  193. med_type_name = dataRow["Name"].ToString().Trim();
  194. if (med_type == "14")
  195. {
  196. JObject Jo5301 = new JObject();
  197. Jo5301.Add("psn_no", Global.pat.psn_no);
  198. JObject data5301 = new JObject();
  199. data5301.Add("data", Jo5301);
  200. JObject Out5301 = new JObject();
  201. Out5301 = invoker.invokeCenterService("5301", JObject.Parse(JsonHelper.setCenterInpar("5301", data5301)));
  202. JArray joMbxx = JArray.Parse(JsonHelper.getDestValue(Out5301, "output.feedetail"));
  203. if (joMbxx.Count > 0)
  204. {
  205. for (int i = 0; i < joMbxx.Count; i++)
  206. {
  207. Utils.convertTimestamp((JObject)joMbxx[i], "begndate");
  208. Utils.convertTimestamp((JObject)joMbxx[i], "enddate");
  209. }
  210. MessageBox.Show("人员慢病信息查询结果:" + joMbxx.ToString());
  211. }
  212. else
  213. {
  214. MessageBox.Show("人员慢病信息查询结果:" + Out5301.ToString());
  215. }
  216. }
  217. }
  218. private void dblkcbxDisease_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  219. {
  220. DataGridViewRow row = e.Value as DataGridViewRow;
  221. DataRowView dataRow = row.DataBoundItem as DataRowView;
  222. diseCodg = dataRow["Code"].ToString().Trim();
  223. diseName = dataRow["Name"].ToString().Trim();
  224. }
  225. private void dblkcbxOperation_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  226. {
  227. DataGridViewRow row = e.Value as DataGridViewRow;
  228. DataRowView dataRow = row.DataBoundItem as DataRowView;
  229. oprn_oprt_code = dataRow["Code"].ToString().Trim();
  230. oprn_oprt_name = dataRow["Name"].ToString().Trim();
  231. }
  232. private void dblkcbxSettelmentWay_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  233. {
  234. DataGridViewRow row = e.Value as DataGridViewRow;
  235. DataRowView dataRow = row.DataBoundItem as DataRowView;
  236. psn_setlway = dataRow["Code"].ToString().Trim();
  237. psn_setlway_name = dataRow["Name"].ToString().Trim();
  238. }
  239. private void dblkcbxDiseaseType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  240. {
  241. DataGridViewRow row = e.Value as DataGridViewRow;
  242. DataRowView dataRow = row.DataBoundItem as DataRowView;
  243. dise_type_code = dataRow["Code"].ToString().Trim();
  244. dise_type_name = dataRow["Name"].ToString().Trim();
  245. }
  246. private void button2_Click(object sender, EventArgs e)
  247. {
  248. this.DialogResult = DialogResult.Cancel;
  249. }
  250. private void cbxAccountPay_ValueChanged(object sender, bool value)
  251. {
  252. if (cbxAccountPay.Checked)
  253. {
  254. personAccountUsedFlag = "1";
  255. }
  256. else
  257. {
  258. personAccountUsedFlag = "0";
  259. }
  260. }
  261. public int DealFor2001(string funNO, out string OutMsg)
  262. {
  263. //人员待遇享受检查
  264. string errMsg = "";
  265. JObject joData2001 = new JObject();
  266. joData2001.Add("psn_no", Global.pat.psn_no);
  267. joData2001.Add("insutype", insuType);
  268. joData2001.Add("fixmedins_code", Global.inf.hospitalNO);
  269. joData2001.Add("med_type", med_type);
  270. joData2001.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  271. joData2001.Add("endtime", DateTime.Now.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss"));
  272. joData2001.Add("dise_codg", diseCodg);
  273. joData2001.Add("dise_name", diseName);
  274. joData2001.Add("oprn_oprt_code", "");
  275. joData2001.Add("oprn_oprt_name", "");
  276. joData2001.Add("matn_type", "");
  277. joData2001.Add("birctrl_type", "");
  278. joData2001.Add("exp_content", "");
  279. JObject joInput = new JObject();
  280. joInput.Add("data", joData2001);
  281. InvokeHelper invoker = new InvokeHelper();
  282. JObject joRtn2001 = invoker.invokeCenterService("2001", JsonHelper.setCenterInpar("2001", joInput));
  283. if (JsonHelper.parseCenterRtnValue(joRtn2001, out errMsg) != 0)
  284. {
  285. OutMsg = "人员待遇享受检查调用失败,中心返回错误信息:" + errMsg;
  286. return -1;
  287. }
  288. else
  289. {
  290. OutMsg = "人员待遇享受检查调用成功:" + joRtn2001.ToString();
  291. return 0;
  292. }
  293. }
  294. private void uiButton1_Click(object sender, EventArgs e)
  295. {
  296. string OutMsg = "";
  297. DealFor2001("", out OutMsg);
  298. MessageBox.Show(OutMsg);
  299. }
  300. //private void dblkcbxHospType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  301. //{
  302. // DataGridViewRow row = e.Value as DataGridViewRow;
  303. // DataRowView dataRow = row.DataBoundItem as DataRowView;
  304. // iptTypeCode = dataRow["Code"].ToString().Trim();
  305. // iptTypeName = dataRow["Name"].ToString().Trim();
  306. //}
  307. private void dblkcbxDisease_SelectedIndexChanged(object sender, EventArgs e)
  308. {
  309. }
  310. private void dblkcbxMedicalType_SelectedIndexChanged(object sender, EventArgs e)
  311. {
  312. }
  313. private void label10_Click(object sender, EventArgs e)
  314. {
  315. }
  316. }
  317. }