OutpatientRegistration.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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 void initBaseInfo(JObject jObject)
  20. {
  21. JObject jo = JObject.Parse(jObject["output"].ToString());
  22. DataTable dtInsuInfo = (DataTable)jo["insuinfo"].ToObject(typeof(DataTable));
  23. JObject joBaseInfo = JObject.FromObject(jo["baseinfo"]);
  24. this.txtName.Text = joBaseInfo["psn_name"].Text();
  25. this.txtPsnNO.Text = joBaseInfo["psn_no"].Text();
  26. this.txtGend.Text = joBaseInfo["gend"].Text();
  27. this.txtBirthDay.Text = joBaseInfo["brdy"].Text();
  28. this.txtCertType.Text = joBaseInfo["psn_cert_type"].Text();
  29. this.txtCertNO.Text = joBaseInfo["certno"].Text();
  30. this.txtAge.Text = joBaseInfo["age"].Text();
  31. if (dtInsuInfo?.Rows.Count > 0)
  32. {
  33. this.txtCorp.Text = dtInsuInfo.Rows[0]["emp_name"].ToString();
  34. this.txtBalc.Text = dtInsuInfo.Rows[0]["balc"].ToString();
  35. this.txtAdmvs.Text = dtInsuInfo.Rows[0]["insuplc_admdvs"].ToString();
  36. this.txtPsnType.Text = dtInsuInfo.Rows[0]["psn_type"].ToString();
  37. this.txtInsuType.Text = dtInsuInfo.Rows[0]["insutype"].ToString();
  38. }
  39. }
  40. private void initCombox()
  41. {
  42. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr.ToString() + "'";
  43. string sqlStr = "";
  44. if (Global.pat.RYorCY == "2")
  45. {
  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.insuType + "' and A.InsuCode = 'insutype'" + sqlCondition;
  48. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  49. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
  50. // 如果登记选择了,则直接用登记的病种
  51. if (!string.IsNullOrEmpty(Global.pat.DiseasecCode))
  52. {
  53. sqlStr += " and A.Code='" + Global.pat.DiseasecCode + "' ";
  54. }
  55. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  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 ON A.ID = B.HBDictionary_Dr WHERE A.InsuCode = 'psn_setlway'" + sqlCondition;
  60. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  61. 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 = 'JYLB'" + sqlCondition;
  62. SetDBLKCombox(ref dblkcbxTreatway, sqlStr);
  63. }
  64. else
  65. {
  66. 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;
  67. SetDBLKCombox(ref dblkcbxInsuranceType, sqlStr);
  68. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.ValidFlag='1' And A.HisType=7" + sqlCondition;
  69. SetDBLKCombox(ref dblkcbxDisease, sqlStr);
  70. 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;
  71. SetDBLKCombox(ref dblkcbxSettelmentWay, sqlStr);
  72. 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;
  73. SetDBLKCombox(ref dblkcbxMedicalType, sqlStr);
  74. 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 = 'JYLB'" + sqlCondition;
  75. SetDBLKCombox(ref dblkcbxTreatway, sqlStr);
  76. }
  77. // 治疗方式
  78. 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 = 'ZLFS'" + sqlCondition;
  79. SetDBLKCombox(ref dblkcbxTreatway, sqlStr);
  80. }
  81. public OutpatientRegistration()
  82. {
  83. InitializeComponent();
  84. this.StartPosition = FormStartPosition.CenterParent;
  85. initCombox();
  86. cbxAccountPay.Checked = false;
  87. }
  88. public Boolean b2001 = false;
  89. private DataTable dtDisease;
  90. //private DataTable dtDiseaseType;
  91. //private DataTable dtInsuranceType;
  92. //private DataTable dtMedicalType;
  93. //private DataTable dtOperation;
  94. //private DataTable dtSettelmentType;
  95. //private DataTable dtHospType;
  96. //险种
  97. public string insuType { get; set; }
  98. public string insuTypeName { get; set; }
  99. //医疗类别(人群类别)
  100. public string med_type { get; set; }
  101. public string med_type_name { get; set; }
  102. //诊断
  103. public string diseCodg { get; set; }
  104. public string diseName{ get; set; }
  105. //手术
  106. public string oprn_oprt_code { get; set; }
  107. public string oprn_oprt_name{ get; set; }
  108. //病种
  109. public string dise_type_code { get; set; }
  110. public string dise_type_name { get; set; }
  111. //结算方式
  112. public string psn_setlway { get; set; }
  113. public string psn_setlway_name { get; set; }
  114. public string traumaFlag = "0";
  115. public string relTtpFlag = "0";
  116. public string hospType = "0";
  117. public string otpErReflFlag = "0";
  118. public string mdtrtGrpType;
  119. public string claTrtFlag = "0";
  120. public string unifPayStdType = "";
  121. //住院类型
  122. public string iptTypeCode { get; set; }
  123. public string iptTypeName { get; set; }
  124. public DataTable DtDiagnose { get; set; }
  125. public string personAccountUsedFlag = "0";
  126. private DataTable GetDBLKComboxTable(string sqlStr)
  127. {
  128. InvokeHelper invoker = new InvokeHelper();
  129. dynamic joInparm = new JObject();
  130. dynamic joTmp = new JObject();
  131. joTmp.sqlStr = sqlStr;
  132. JArray jaParams = new JArray();
  133. jaParams.Add(joTmp);
  134. joInparm.Add("params", JArray.FromObject(jaParams));
  135. joInparm.code = "09010014";
  136. string inParam = joInparm.ToString();
  137. JObject joRtn = invoker.invokeInsuService(inParam,"获取下拉框消息");
  138. //dynamic jsonRtn = JsonConvert.DeserializeObject(strRtn);
  139. DataTable dt = (DataTable)joRtn["result"].ToObject(typeof(DataTable));
  140. //dt.Columns[0].ColumnName = "编码";
  141. //dt.Columns[1].ColumnName = "名称";
  142. //dt.Columns[2].ColumnName = "拼音查找码";
  143. return dt;
  144. }
  145. private void SetDBLKCombox(ref PTControl.DBLookupCombox dblcbx, string sqlStr)
  146. {
  147. dblcbx.sDisplayField = "Code,Name,SearchCode";
  148. dblcbx.sDisplayMember = "名称";
  149. dblcbx.sKeyWords = "Code,SearchCode";
  150. DataTable dt = GetDBLKComboxTable(sqlStr);
  151. dblcbx.DataSource = dt;
  152. if (dt?.Rows.Count > 0) {
  153. // default to select first one;
  154. }
  155. dblcbx.RowFilterVisible = true;
  156. dblcbx.TextBox.Width = 400;
  157. dblcbx.DataGridView.Width = 400;
  158. dblcbx.DataGridView.Columns[0].Name = "编码";
  159. dblcbx.DataGridView.Columns[1].Name = "名称";
  160. dblcbx.DataGridView.Columns[2].Name = "查找码";
  161. dblcbx.DataGridView.Columns[0].Width = 100;
  162. dblcbx.DataGridView.Columns[1].Width = 200;
  163. }
  164. private void OutpatientRegistration_Load(object sender, EventArgs e)
  165. {
  166. dgvDiagnose.AutoGenerateColumns = false;
  167. dgvDiagnose.DataSource = DtDiagnose;
  168. //DtDiagnose.AcceptChanges();
  169. dgvDiagnose.ReadOnly = true;
  170. }
  171. private void button1_Click(object sender, EventArgs e)
  172. {
  173. //DealFor2001("");
  174. //外伤标志
  175. if (Chk_TraumaFlag.Checked)
  176. traumaFlag = "1";
  177. else
  178. traumaFlag = "0";
  179. //涉及第三方标志
  180. if (Chk_RelTtpFlag.Checked)
  181. relTtpFlag = "1";
  182. else
  183. relTtpFlag = "0";
  184. //包干标准类型
  185. //if (cbxUnifPayStdType.Text!="")
  186. // unifPayStdType = (cbxUnifPayStdType.SelectedIndex).ToString();
  187. // 选择病种后,必须选择医疗类别
  188. if (string.IsNullOrEmpty(med_type))
  189. {
  190. MessageBox.Show("请选择人群类别!");
  191. return;
  192. }
  193. // 是否使用个人账户金额
  194. if (cbxAccountPay.Checked)
  195. {
  196. personAccountUsedFlag = "1";
  197. }
  198. if (string.IsNullOrEmpty(insuType)) {
  199. MessageBox.Show("请选择险种类型!");
  200. return;
  201. }
  202. Global.pat.insuType = insuType;
  203. this.DialogResult = DialogResult.OK;
  204. }
  205. private void dblkcbxInsuranceType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  206. {
  207. DataGridViewRow row = e.Value as DataGridViewRow;
  208. DataRowView dataRow = row.DataBoundItem as DataRowView;
  209. insuType = dataRow["Code"].ToString().Trim();
  210. insuTypeName = dataRow["Name"].ToString().Trim();
  211. }
  212. private void dblkcbxMedicalType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  213. {
  214. DataGridViewRow row = e.Value as DataGridViewRow;
  215. DataRowView dataRow = row.DataBoundItem as DataRowView;
  216. med_type = dataRow["Code"].ToString().Trim();
  217. med_type_name = dataRow["Name"].ToString().Trim();
  218. }
  219. private void dblkcbxDisease_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  220. {
  221. DataGridViewRow row = e.Value as DataGridViewRow;
  222. DataRowView dataRow = row.DataBoundItem as DataRowView;
  223. diseCodg = dataRow["Code"].ToString().Trim();
  224. diseName = dataRow["Name"].ToString().Trim();
  225. }
  226. private void dblkcbxOperation_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  227. {
  228. DataGridViewRow row = e.Value as DataGridViewRow;
  229. DataRowView dataRow = row.DataBoundItem as DataRowView;
  230. oprn_oprt_code = dataRow["Code"].ToString().Trim();
  231. oprn_oprt_name = dataRow["Name"].ToString().Trim();
  232. }
  233. private void dblkcbxSettelmentWay_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  234. {
  235. DataGridViewRow row = e.Value as DataGridViewRow;
  236. DataRowView dataRow = row.DataBoundItem as DataRowView;
  237. psn_setlway = dataRow["Code"].ToString().Trim();
  238. psn_setlway_name = dataRow["Name"].ToString().Trim();
  239. }
  240. private void dblkcbxDiseaseType_AfterSelector(object sender, PTControl.AfterSelectorEventArgs e)
  241. {
  242. DataGridViewRow row = e.Value as DataGridViewRow;
  243. DataRowView dataRow = row.DataBoundItem as DataRowView;
  244. dise_type_code = dataRow["Code"].ToString().Trim();
  245. dise_type_name = dataRow["Name"].ToString().Trim();
  246. }
  247. private void button2_Click(object sender, EventArgs e)
  248. {
  249. this.DialogResult = DialogResult.Cancel;
  250. }
  251. private void cbxAccountPay_ValueChanged(object sender, bool value)
  252. {
  253. if (cbxAccountPay.Checked)
  254. {
  255. personAccountUsedFlag = "1";
  256. }
  257. else
  258. {
  259. personAccountUsedFlag = "0";
  260. }
  261. }
  262. public int DealFor2001(string funNO, out string OutMsg)
  263. {
  264. //人员待遇享受检查
  265. string errMsg = "";
  266. JObject joData2001 = new JObject();
  267. joData2001.Add("psn_no", Global.pat.psn_no);
  268. joData2001.Add("insutype", insuType);
  269. joData2001.Add("fixmedins_code", Global.inf.hospitalNO);
  270. joData2001.Add("med_type", med_type);
  271. joData2001.Add("begntime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  272. joData2001.Add("endtime", "");
  273. joData2001.Add("dise_codg", diseCodg);
  274. joData2001.Add("dise_name", diseName);
  275. joData2001.Add("oprn_oprt_code", "");
  276. joData2001.Add("oprn_oprt_name", "");
  277. joData2001.Add("matn_type", "");
  278. joData2001.Add("birctrl_type", "");
  279. JObject joInput = new JObject();
  280. joInput.Add("data", joData2001);
  281. InvokeHelper invoker = new InvokeHelper();
  282. JObject joRtn2001 = invoker.invokeCenterService(TradeEnum.BenefitCheck, 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. }
  308. }