ShowDischargeAuditForm.cs 30 KB

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