ShowDischargeAuditForm.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Business.Core.Forms.DischargeAudit;
  3. using PTMedicalInsurance.Helper;
  4. using PTMedicalInsurance.Variables;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace PTMedicalInsurance.Business.Core.SelfServiceMachine.Process.InPat
  13. {
  14. class ShowDischargeAuditForm : AbstractProcess
  15. {
  16. AuditForm auditFrm = new AuditForm();
  17. private PTMedicalInsurance.Forms.PatientInsuInfo frmPatientInfo;
  18. private PTMedicalInsurance.Business.Core.Forms.DischargeAudit.AdmissionRegistration admRegForm;
  19. private PTMedicalInsurance.Business.Core.Forms.DischargeAudit.DischargeRegistration disRegForm;
  20. private PTMedicalInsurance.Business.Core.Forms.DischargeAudit.OutpatRegistration outpatRegForm;
  21. private PTMedicalInsurance.Business.Core.Forms.DischargeAudit.GridViewSetter grdSetter = new GridViewSetter();
  22. private DataTable dtDisease;
  23. private DataTable dtDiseaseType;
  24. private DataTable dtInsuranceType;
  25. private DataTable dtMedicalType;
  26. private DataTable dtOperation;
  27. private DataTable dtSettelmentWay;
  28. JObject joAuditInfo;
  29. private JArray jaFinalDiagnoses;
  30. private JArray jaAdmRegAuditDetail;
  31. private JArray jaDisRegAuditDetail;
  32. private JArray jaOutpatRegAuditDetail;
  33. int admRegAuditDetailCount = 0;
  34. int disRegAuditDetailCount = 0;
  35. int outpatRegAuditDetailCount = 0;
  36. private JObject joHisDiagnoseInfo;
  37. public override CallResult Process(JObject input)
  38. {
  39. auditFrm.tcAudit.TabPages.Remove(auditFrm.tpOutpatRegistration);
  40. if (InitPatienInfoForm(out errMsg) != 0)
  41. {
  42. return Exception(errMsg);
  43. }
  44. GetDBLKComBoxDatasource();
  45. if (GetDiagnoses(out errMsg) !=0)
  46. {
  47. return Exception(errMsg);
  48. }
  49. if (GetDischargeAuditInfo(out errMsg) != 0)
  50. {
  51. return Exception(errMsg);
  52. }
  53. if (InitAdmissionRegistrationForm(out errMsg) !=0)
  54. {
  55. return Exception(errMsg);
  56. }
  57. if (InitDischargeRegistrationForm(out errMsg) !=0)
  58. {
  59. return Exception(errMsg);
  60. }
  61. auditFrm.ConfirmClicked += (sender, e) => { ConfirmClicked(sender, e); };
  62. auditFrm.ShowDialog();
  63. var jo = new { auditStatus = auditFrm.auditStatus ,memo= auditFrm.memo};
  64. outParam = JObject.FromObject(jo).ToString();
  65. if (auditFrm.auditStatus == 1)
  66. {
  67. return Success("审核通过");
  68. }
  69. else if (auditFrm.auditStatus == 0)
  70. {
  71. return Success("暂未审核");
  72. }
  73. else
  74. {
  75. return Success("审核被拒");
  76. }
  77. }
  78. #region 获取数据源
  79. //获取登记界面Combox的数据源
  80. private void GetDBLKComBoxDatasource()
  81. {
  82. //获取通用目录
  83. string sTYML = mIS.GetCommonInterface_Dr(Global.inf.interfaceDr.ToString(), "");
  84. if (sTYML == "")
  85. Global.inf.interfaceDr_TY = Global.inf.interfaceDr;
  86. else
  87. Global.inf.interfaceDr_TY = int.Parse(sTYML);
  88. string sqlCondition = " and A.Interface_Dr = '" + Global.inf.interfaceDr_TY.ToString() + "'";
  89. 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;
  90. dtInsuranceType = grdSetter.GetDBLKComboxTable(sqlStr);
  91. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=7" + sqlCondition;
  92. dtDisease = grdSetter.GetDBLKComboxTable(sqlStr);
  93. sqlStr = "select A.Code, A.Name FROM HB_MedInsuDirectory A where A.UseFlag='1' And A.HisType=8" + sqlCondition;
  94. dtOperation = grdSetter.GetDBLKComboxTable(sqlStr);
  95. 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;
  96. dtSettelmentWay = grdSetter.GetDBLKComboxTable(sqlStr);
  97. 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;
  98. dtMedicalType = grdSetter.GetDBLKComboxTable(sqlStr);
  99. }
  100. /// <summary>
  101. /// 获取审核信息,并赋值给全局变量,供其它方法公用
  102. /// </summary>
  103. /// <param name="err"></param>
  104. /// <returns></returns>
  105. private int GetDischargeAuditInfo(out string err)
  106. {
  107. //查询费用核查信息 regType -1表示查询全部明细
  108. if (mIS.queryDischargeAuditInfo(out err) != 0)
  109. {
  110. return -1;
  111. }
  112. else
  113. {
  114. JObject joRtn = JObject.Parse(err);
  115. joAuditInfo = JObject.Parse(JsonHelper.getDestValue(joRtn, "result.AuditInfo"));
  116. jaAdmRegAuditDetail = JArray.Parse(JsonHelper.getDestValue(joRtn, "result.AdmReg"));
  117. jaDisRegAuditDetail = JArray.Parse(JsonHelper.getDestValue(joRtn, "result.DisReg"));
  118. jaOutpatRegAuditDetail = JArray.Parse(JsonHelper.getDestValue(joRtn, "result.OutpatReg"));
  119. admRegAuditDetailCount = int.Parse(JsonHelper.getDestValue(joRtn, "result.AdmRegCount"));
  120. disRegAuditDetailCount = int.Parse(JsonHelper.getDestValue(joRtn, "result.DisRegCount"));
  121. outpatRegAuditDetailCount = int.Parse(JsonHelper.getDestValue(joRtn, "result.OutpatRegCount"));
  122. return 0;
  123. }
  124. }
  125. /// <summary>
  126. /// 获取His的诊断数据,并进行过滤筛选
  127. /// </summary>
  128. /// <param name="err"></param>
  129. /// <returns></returns>
  130. private int GetDiagnoses(out string err)
  131. {
  132. err = "";
  133. //调用服务获取门诊诊断信息
  134. if (hIS.getPatDiagnoses(Global.pat, out err) != 0)
  135. {
  136. return -1;
  137. }
  138. JObject joHisRtnInfo = JObject.Parse(err);
  139. //组织登记入参
  140. JObject joReg = new JObject();
  141. JArray jaDiagnoses = JArray.Parse(JsonHelper.getDestValue(joHisRtnInfo, "diseinfo"));
  142. // 对诊断数组进行转换 转换下主要诊断
  143. JArray jaConvertedDiagnoses = new JArray();
  144. JArray jaInPatDiagnoses = new JArray();
  145. JArray jaOutPatDiagnoses = new JArray();
  146. for (int i = 0; i < jaDiagnoses.Count; i++)
  147. {
  148. string diag_type = JsonHelper.getDestValue((JObject)jaDiagnoses[i], "diag_type");
  149. switch (diag_type)
  150. {
  151. case "1":
  152. {
  153. jaDiagnoses[i]["diag_type_name"] = new JObject();
  154. jaDiagnoses[i]["diag_type_name"] = "西医主要诊断";
  155. break;
  156. }
  157. case "2":
  158. {
  159. jaDiagnoses[i]["diag_type_name"] = new JObject();
  160. jaDiagnoses[i]["diag_type_name"] = "西医其他诊断";
  161. break;
  162. }
  163. case "3":
  164. {
  165. jaDiagnoses[i]["diag_type_name"] = new JObject();
  166. jaDiagnoses[i]["diag_type_name"] = "中医主病诊断";
  167. break;
  168. }
  169. case "4":
  170. {
  171. jaDiagnoses[i]["diag_type_name"] = new JObject();
  172. jaDiagnoses[i]["diag_type_name"] = "中医主证诊断";
  173. break;
  174. }
  175. }
  176. if (jaDiagnoses[i]["diaTypeCode"].ToString() == "ADD") //ADD 入院 OPD 门诊
  177. {
  178. jaInPatDiagnoses.Add(jaDiagnoses[i]);
  179. }
  180. if (jaDiagnoses[i]["diaTypeCode"].ToString() == "OPD") //ADD 入院 OPD 门诊
  181. {
  182. jaOutPatDiagnoses.Add(jaDiagnoses[i]);
  183. }
  184. }
  185. if (jaInPatDiagnoses.Count > 0)
  186. {
  187. jaConvertedDiagnoses = (JArray)jaInPatDiagnoses.DeepClone();
  188. }
  189. else
  190. {
  191. jaConvertedDiagnoses = (JArray)jaOutPatDiagnoses.DeepClone();
  192. }
  193. for (int i = 0; i < jaConvertedDiagnoses.Count; i++)
  194. {
  195. jaConvertedDiagnoses[i]["diag_srt_no"] = i + 1;
  196. }
  197. jaFinalDiagnoses = (JArray)jaConvertedDiagnoses.DeepClone();
  198. joHisDiagnoseInfo = (JObject)joHisRtnInfo.DeepClone();
  199. return 0;
  200. }
  201. /// <summary>
  202. /// 获取当前界面的审核明细
  203. /// </summary>
  204. /// <param name="regType"></param>
  205. /// <returns></returns>
  206. private JArray GetAuditDetail(dynamic frm, int regType)
  207. {
  208. var details = new List<object>();
  209. // 添加所有需要的节点
  210. details.Add(new
  211. {
  212. AdmID = Global.pat.adm_Dr,
  213. DetailCode = "insutype",
  214. DetailName = "险种类型",
  215. Value = frm.insuType,
  216. ValueDesc = "",
  217. RegType = regType
  218. });
  219. details.Add(new
  220. {
  221. AdmID = Global.pat.adm_Dr,
  222. DetailCode = "med_type",
  223. DetailName = "医疗类别",
  224. Value = frm.med_type,
  225. ValueDesc = "",
  226. RegType = regType
  227. });
  228. details.Add(new
  229. {
  230. AdmID = Global.pat.adm_Dr,
  231. DetailCode = "dise_codg",
  232. DetailName = "病种编码",
  233. Value = frm.diseCodg,
  234. ValueDesc = "",
  235. RegType = regType
  236. });
  237. details.Add(new
  238. {
  239. AdmID = Global.pat.adm_Dr,
  240. DetailCode = "dise_name",
  241. DetailName = "病种名称",
  242. Value = frm.diseName,
  243. ValueDesc = "",
  244. RegType = regType
  245. });
  246. details.Add(new
  247. {
  248. AdmID = Global.pat.adm_Dr,
  249. DetailCode = "oprn_oprt_code",
  250. DetailName = "手术操作代码",
  251. Value = frm.oprn_oprt_code,
  252. ValueDesc = "",
  253. RegType = regType
  254. });
  255. details.Add(new
  256. {
  257. AdmID = Global.pat.adm_Dr,
  258. DetailCode = "oprn_oprt_name",
  259. DetailName = "手术操作名称",
  260. Value = frm.oprn_oprt_name,
  261. ValueDesc = "",
  262. RegType = regType
  263. });
  264. details.Add(new
  265. {
  266. AdmID = Global.pat.adm_Dr,
  267. DetailCode = "dise_type_code",
  268. DetailName = "病种类型",
  269. Value = frm.dise_type_code,
  270. ValueDesc = "",
  271. RegType = regType
  272. });
  273. details.Add(new
  274. {
  275. AdmID = Global.pat.adm_Dr,
  276. DetailCode = "exp_content",
  277. DetailName = "字段扩展",
  278. Value = frm.dise_type_name,
  279. ValueDesc = "",
  280. RegType = regType
  281. });
  282. details.Add(new
  283. {
  284. AdmID = Global.pat.adm_Dr,
  285. DetailCode = "psn_setlway",
  286. DetailName = "个人结算方式",
  287. Value = frm.psn_setlway,
  288. ValueDesc = "",
  289. RegType = regType
  290. });
  291. // 根据regType决定是否添加最后两个节点
  292. if (regType == 3)
  293. {
  294. details.Add(new
  295. {
  296. AdmID = Global.pat.adm_Dr,
  297. DetailCode = "acct_used_flag",
  298. DetailName = "个人账户使用标志",
  299. Value = frm.personAccountUsedFlag ?? "",
  300. ValueDesc = "",
  301. RegType = regType
  302. });
  303. details.Add(new
  304. {
  305. AdmID = Global.pat.adm_Dr,
  306. DetailCode = "mid_setl_flag",
  307. DetailName = "中途结算标志",
  308. Value = frm.halfwaySettlementFlag,
  309. ValueDesc = "",
  310. RegType = regType
  311. });
  312. }
  313. // 将列表转换为JArray并返回
  314. return JArray.FromObject(details);
  315. }
  316. #endregion
  317. #region 初始化界面
  318. /// <summary>
  319. /// 初始化患者信息界面
  320. /// </summary>
  321. /// <param name="err"></param>
  322. /// <returns></returns>
  323. private int InitPatienInfoForm(out string err)
  324. {
  325. //获取全量表数据
  326. string sqlStr = $" SELECT * FROM BS_MIPatFullInsuInfo WHERE AdmID = {Global.pat.adm_Dr}";
  327. JObject joRtn = mIS.DynamicQuery(sqlStr, "查询全量信息表");
  328. if (JsonHelper.parseIrisRtnValue(joRtn, out err) != 0)
  329. {
  330. return -1;
  331. }
  332. if (JsonHelper.getDestValue(joRtn, "result.total") == "0")
  333. {
  334. err = "全量信息表为空";
  335. return -1;
  336. }
  337. //转换患者信息
  338. JObject joOutparam = JObject.Parse(JsonHelper.getDestValue(joRtn, "result.data[0].FullInfo"));
  339. JObject joOutput = JObject.Parse(JsonHelper.getDestValue(joOutparam, "output"));
  340. //编码转换
  341. JArray jaConvertCode = new JArray();
  342. JObject joConvertCodeParam = new JObject();
  343. joConvertCodeParam.Add("hospitalDr", Global.inf.hospitalDr);
  344. joConvertCodeParam.Add("interfaceDr", Global.inf.interfaceDr);
  345. joConvertCodeParam.Add("output", joOutput);
  346. jaConvertCode.Add(joConvertCodeParam);
  347. JObject joConvertCode = new JObject();
  348. joConvertCode.Add("code", "09010054");
  349. joConvertCode.Add("params", jaConvertCode);
  350. InvokeHelper invoker = new InvokeHelper();
  351. JObject joConvertCodeRtn = invoker.invokeInsuService(joConvertCode.ToString(), "患者信息编码转换");
  352. frmPatientInfo = new PTMedicalInsurance.Forms.PatientInsuInfo(joConvertCodeRtn, auditFrm);
  353. frmPatientInfo.pnlBottom.Visible = false;
  354. auditFrm.AddForm(auditFrm.tpPatientInfo, frmPatientInfo);
  355. return 0;
  356. }
  357. /// <summary>
  358. /// 初始化入院登记
  359. /// </summary>
  360. /// <param name="err"></param>
  361. /// <returns></returns>
  362. private int InitAdmissionRegistrationForm(out string err)
  363. {
  364. admRegForm = new Forms.DischargeAudit.AdmissionRegistration(auditFrm);
  365. return InitRegistrationForm(2, out err);
  366. }
  367. /// <summary>
  368. /// 初始化出院登记界面
  369. /// </summary>
  370. /// <param name="err"></param>
  371. /// <returns></returns>
  372. private int InitDischargeRegistrationForm(out string err)
  373. {
  374. disRegForm = new Forms.DischargeAudit.DischargeRegistration(auditFrm);
  375. return InitRegistrationForm(3, out err);
  376. }
  377. #endregion
  378. #region 初始化界面的细节方法封装
  379. private void DynamicInit(int regType,out int count, out dynamic frm, out dynamic ja)
  380. {
  381. int countTmp;
  382. dynamic jaTmp;
  383. switch (regType)
  384. {
  385. case 1: //门诊登记
  386. frm = outpatRegForm;
  387. ja = jaOutpatRegAuditDetail;
  388. count = outpatRegAuditDetailCount;
  389. break;
  390. case 0://通用
  391. case 2://入院登记
  392. default:
  393. frm = admRegForm;
  394. jaTmp =ja = jaAdmRegAuditDetail;
  395. count = countTmp = admRegAuditDetailCount;
  396. admRegForm.SaveClicked += (sender, e) => HandleSaveClicked(countTmp, jaTmp, admRegForm, regType);
  397. auditFrm.AddForm(auditFrm.tpAdmissionRegistration, admRegForm);
  398. break;
  399. case 3://出院登记
  400. frm = disRegForm;
  401. jaTmp =ja = jaDisRegAuditDetail;
  402. countTmp =count = disRegAuditDetailCount;
  403. disRegForm.SaveClicked += (sender, e) => HandleSaveClicked(countTmp, jaTmp, disRegForm, regType);
  404. auditFrm.AddForm(auditFrm.tpDischargeRegistration, disRegForm);
  405. break;
  406. }
  407. }
  408. /// <summary>
  409. /// ///初始化登记界面公共方法
  410. /// 事件 场景类型 0.窗口门诊 1.窗口住院 2.自助机门诊 3.自助机住院 4.线上支付门诊 5.线上支付住院
  411. /// 登记类型 0.通用 部分地区门诊出入院都一样 1.门诊登记 2.入院登记 3.出院登记
  412. /// </summary>
  413. /// <param name="regType"></param>
  414. /// <param name="err"></param>
  415. /// <returns></returns>
  416. private int InitRegistrationForm(int regType, out string err)
  417. {
  418. err = "";
  419. dynamic frm;
  420. dynamic ja;
  421. int count = 0;
  422. DynamicInit(regType,out count,out frm,out ja);
  423. frm.DtDisease = dtDisease?.Copy();
  424. frm.DtDiseaseType = dtDiseaseType?.Copy();
  425. frm.DtInsuranceType = dtInsuranceType?.Copy();
  426. frm.DtMedicalType = dtMedicalType?.Copy();
  427. frm.DtOperation = dtOperation?.Copy();
  428. frm.DtSettlementWay = dtSettelmentWay?.Copy();
  429. frm.InitComboxDatasource();
  430. frm.DtDiagnose = (DataTable)jaFinalDiagnoses.ToObject(typeof(DataTable));
  431. return MatchCombox(frm, count, ja, out err);
  432. }
  433. /// <summary>
  434. /// 根据费用核查表返回的数据,加载并匹配到登记界面
  435. /// </summary>
  436. /// <param name="frm"></param>
  437. /// <param name="count"></param>
  438. /// <param name="ja"></param>
  439. /// <param name="err"></param>
  440. /// <returns></returns>
  441. private int MatchCombox(dynamic frm, int count, dynamic ja, out string err)
  442. {
  443. string insuType = "";
  444. string medType = "";
  445. string diseaseCode = "";
  446. string diseaseType = "";
  447. string settlementWay = "";
  448. string operationCode = "";
  449. string acct_used_flag = "-1";
  450. string mid_setl_flag = "-1";
  451. err = "";
  452. //不存在信息则提示
  453. frm.IsHintVisible = count == 0;
  454. //frm.dblkcbxSettelmentWay.Enabled = false;
  455. foreach (JObject jo in ja)
  456. {
  457. if (jo["DetailCode"].ToString() == "insutype")
  458. {
  459. insuType = jo["Value"].ToString();
  460. }
  461. if (jo["DetailCode"].ToString() == "med_type")
  462. {
  463. medType = jo["Value"].ToString();
  464. }
  465. if (jo["DetailCode"].ToString() == "dise_codg")
  466. {
  467. diseaseCode = jo["Value"].ToString();
  468. }
  469. if (jo["DetailCode"].ToString() == "oprn_oprt_code")
  470. {
  471. operationCode = jo["Value"].ToString();
  472. }
  473. if (jo["DetailCode"].ToString() == "dise_type_code")
  474. {
  475. diseaseType = jo["Value"].ToString();
  476. }
  477. if (jo["DetailCode"].ToString() == "mid_setl_flag")
  478. {
  479. mid_setl_flag = jo["Value"].ToString();
  480. }
  481. if (jo["DetailCode"].ToString() == "acct_used_flag")
  482. {
  483. acct_used_flag = jo["Value"].ToString();
  484. }
  485. if (jo["DetailCode"].ToString() == "psn_setlway")
  486. {
  487. settlementWay = jo["Value"].ToString();
  488. }
  489. }
  490. //DataTable dt = (DataTable)frm.dblkcbxInsuranceType.DataSource;
  491. //int selectedIndex = 0;
  492. //for (int i = 0; i < dt.Rows.Count; i++)
  493. //{
  494. // if (dt.Rows[i]["Code"].ToString() == insuType)
  495. // {
  496. // selectedIndex = i;
  497. // frm.dblkcbxInsuranceType.Text = dt.Rows[i]["Name"].ToString();
  498. // frm.insuType = dt.Rows[i]["Code"].ToString();
  499. // }
  500. //}
  501. //DataTable dtMedType = (DataTable)frm.dblkcbxMedicalType.DataSource;
  502. //for (int i = 0; i < dtMedType.Rows.Count; i++)
  503. //{
  504. // if (dtMedType.Rows[i]["Code"].ToString() == medType)
  505. // {
  506. // frm.dblkcbxMedicalType.Text = dtMedType.Rows[i]["Name"].ToString();
  507. // frm.med_type = dtMedType.Rows[i]["Code"].ToString();
  508. // }
  509. //}
  510. MatchCombox(frm, "dblkcbxInsuranceType", "insuType", insuType);
  511. MatchCombox(frm, "dblkcbxMedicalType", "med_type", medType);
  512. MatchCombox(frm, "dblkcbxSettelmentWay", "psn_setlway", settlementWay);
  513. //if (frm is DischargeRegistration)
  514. //{
  515. // DataTable dtPsnSettlWay = (DataTable)frm.dblkcbxSettelmentWay.DataSource;
  516. // for (int i = 0; i < dtPsnSettlWay.Rows.Count; i++)
  517. // {
  518. // if (dtPsnSettlWay.Rows[i]["Code"].ToString() == settlementWay)
  519. // {
  520. // frm.dblkcbxSettelmentWay.Text = dtPsnSettlWay.Rows[i]["Name"].ToString();
  521. // frm.psn_setlway = dtPsnSettlWay.Rows[i]["Code"].ToString();
  522. // }
  523. // }
  524. //}
  525. frm.personAccountUsedFlag = acct_used_flag;
  526. frm.halfwaySettlementFlag = mid_setl_flag;
  527. //审核状态匹配
  528. auditFrm.auditStatus = int.Parse(JsonHelper.getDestValue(joAuditInfo, "AuditStatus"));
  529. auditFrm.memo = JsonHelper.getDestValue(joAuditInfo, "Memo");
  530. return 0;
  531. }
  532. private void MatchCombox(dynamic frm, string comboxName,string propertyName, string value)
  533. {
  534. if (!frm.Controls["panel1"].Controls.ContainsKey(comboxName))
  535. {
  536. return;
  537. }
  538. var cbx = frm.Controls["panel1"].Controls[comboxName];
  539. DataTable dt = (DataTable)cbx.DataSource;
  540. for (int i = 0; i < dt.Rows.Count; i++)
  541. {
  542. if (dt.Rows[i]["Code"].ToString() == value)
  543. {
  544. cbx.Text = dt.Rows[i]["Name"].ToString();
  545. //frm.insuType = dt.Rows[i]["Code"].ToString();
  546. var propertyInfo = frm.GetType().GetProperty(propertyName);
  547. if (propertyInfo != null && propertyInfo.CanWrite)
  548. {
  549. propertyInfo.SetValue(frm, Convert.ChangeType(value, propertyInfo.PropertyType));
  550. }
  551. else
  552. {
  553. throw new ArgumentException($"无法设置属性 '{propertyName}' 或该属性不可写。");
  554. }
  555. }
  556. }
  557. }
  558. #endregion
  559. #region Button事件封装
  560. /// <summary>
  561. /// 登记界面的保存事件委托
  562. /// </summary>
  563. /// <param name="sender"></param>
  564. /// <param name="e"></param>
  565. /// <param name="frm"></param>
  566. /// <param name="regType"></param>
  567. private void HandleSaveClicked(int count, dynamic ja, dynamic frm, int regType)
  568. {
  569. string errMsg;
  570. if (SaveAuditInfo(frm, regType, out errMsg) != 0)
  571. {
  572. MessageBox.Show(errMsg);
  573. }
  574. else
  575. {
  576. GetDischargeAuditInfo(out errMsg);
  577. DynamicInit(regType, out count, out frm, out ja);
  578. MatchCombox(frm, count, ja, out errMsg);
  579. MessageBox.Show("保存成功");
  580. }
  581. }
  582. /// <summary>
  583. /// 保存审核信息
  584. /// </summary>
  585. /// <param name="regType"></param>
  586. /// <param name="err"></param>
  587. /// <returns></returns>
  588. private int SaveAuditInfo(dynamic frm, int regType, out string err)
  589. {
  590. err = "";
  591. //组织入参
  592. JObject joAudit = new JObject();
  593. joAudit.Add("HospitalDr", Global.inf.hospitalDr);
  594. joAudit.Add("InterfaceDr", Global.inf.interfaceDr);
  595. joAudit.Add("AdmID", Global.pat.adm_Dr);
  596. joAudit.Add("BillID", Global.pat.billID);
  597. joAudit.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  598. //joAudit.Add("Scene", scene);
  599. joAudit.Add("AuditStatus", auditFrm.auditStatus);
  600. joAudit.Add("Memo", auditFrm.rtbMemo.Text);
  601. joAudit.Add("ValidFlag", 1);
  602. joAudit.Add("RegType", regType);
  603. JArray jaAuditDetail = GetAuditDetail(frm, regType);
  604. joAudit.Add("AuditDetail", jaAuditDetail);
  605. return mIS.saveDischargeAudit(joAudit, out err);
  606. //保存
  607. }
  608. private void ConfirmClicked(object sender, EventArgs e)
  609. {
  610. if ((auditFrm.auditStatus == -1) && (string.IsNullOrEmpty(auditFrm.memo)))
  611. {
  612. MessageBox.Show("审核被拒时审核意见不能为空!");
  613. return;
  614. }
  615. //再次查询审核信息,如果出院意见未有则提示
  616. if (auditFrm.auditStatus == 1)
  617. {
  618. GetDischargeAuditInfo(out errMsg);
  619. if (jaDisRegAuditDetail.Count == 0)
  620. {
  621. MessageBox.Show("检测到出院登记信息未正确保存,请点击保存或联系关联员!");
  622. return;
  623. }
  624. }
  625. //更新费用明细审核表主表
  626. JObject joAudit = new JObject();
  627. joAudit.Add("HospitalDr", Global.inf.hospitalDr);
  628. joAudit.Add("InterfaceDr", Global.inf.interfaceDr);
  629. joAudit.Add("AdmID", Global.pat.adm_Dr);
  630. joAudit.Add("BillID", Global.pat.billID);
  631. joAudit.Add("OccurTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
  632. joAudit.Add("AuditStatus", auditFrm.auditStatus);
  633. joAudit.Add("Memo", auditFrm.memo);
  634. joAudit.Add("ValidFlag", 1);
  635. if (mIS.saveDischargeAuditMaintable(joAudit, out outParam) != 0)
  636. {
  637. MessageBox.Show("出院审核表更新失败!");
  638. return;
  639. }
  640. auditFrm.DialogResult = DialogResult.OK;
  641. }
  642. #endregion
  643. /// <summary>
  644. /// 本来想用封包处理,但懒得麻烦,直接将属性改为Public
  645. /// </summary>
  646. private void AddPage()
  647. {
  648. auditFrm.tcAudit.TabPages.Clear();
  649. // 新增一个 TabPage
  650. TabPage newTabPage = new TabPage();
  651. //Panel pnl = new Panel();
  652. //pnl.Dock = DockStyle.Fill;
  653. //pnl.Controls.Add(frmPatientInfo);
  654. //frmPatientInfo.Show();
  655. //pnl.AutoScroll = true;
  656. // 改变标签标题
  657. newTabPage.Text = "患者信息";
  658. // 将新的 TabPage 添加到 TabControl
  659. auditFrm.tcAudit.TabPages.Add(newTabPage);
  660. auditFrm.AddForm(newTabPage, frmPatientInfo);
  661. newTabPage.AutoScroll = true;
  662. //展示登记信息
  663. TabPage inRegPage = new TabPage();
  664. inRegPage.Text = "登记信息";
  665. auditFrm.tcAudit.TabPages.Add(inRegPage);
  666. inRegPage.AutoScroll = true;
  667. auditFrm.AddForm(inRegPage, new OutpatRegistration(auditFrm));
  668. }
  669. }
  670. }