ShowDischargeAuditForm.cs 30 KB

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