LocalPayFundSplitService.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. using Newtonsoft.Json.Linq;
  2. using PTMedicalInsurance.Common;
  3. using PTMedicalInsurance.Helper;
  4. using PTMedicalInsurance.Variables;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. /**
  11. *
  12. *
  13. * 310100 职工基本医疗保险统筹基金 501000 一至六级残疾军人医疗补助基金
  14. * 310200 职工基本医疗保险个人账户基金 370100 企业补充医疗保险基金
  15. * 320100 公务员医疗补助基金 390100 城乡居民基本医疗保险基金
  16. * 330100 职工大额医疗费用补助基金 610100 医疗救助基金
  17. * 340100 离休人员医疗保障基金 999999 其他基金
  18. * 391100 城乡居民大病医疗保险资
  19. */
  20. namespace PTMedicalInsurance.Business
  21. {
  22. class LocalPayFundSplitService
  23. {
  24. /// <summary>
  25. /// 根据返回的金额进行拆分基金分类
  26. /// </summary>
  27. /// <param name="joSettle">结算返回值</param>
  28. /// <returns></returns>
  29. public JArray Split(JObject joSettle)
  30. {
  31. JArray joRtn = new JArray();
  32. try
  33. {
  34. Dictionary<string, string> medTypeDict = new Dictionary<string, string>()
  35. {
  36. { "A","310100"}, //职工
  37. { "B","390100"} //居民
  38. };
  39. Dictionary<string, Dictionary<string, string>> fundDict = new Dictionary<string, Dictionary<string, string>>()
  40. {
  41. ["hifp_pay"] = new Dictionary<string, string>() {
  42. { "310100", "职工基本医疗保险统筹基金" },
  43. { "390100","城乡居民基本医疗保险基金"} },
  44. ["acct_pay"] = CreateKeyPair("310200", "职工基本医疗保险个人账户基金"),
  45. ["hifob_pay"] = CreateKeyPair("330100", "职工大额医疗费用补助基金"),
  46. ["hifes_pay"] = CreateKeyPair("370100", "企业补充医疗保险基金"),
  47. ["hifmi_pay"] = CreateKeyPair("391100", "城乡居民大病医疗保险资"),
  48. ["maf_pay"] = CreateKeyPair("610100", "医疗救助基金"),
  49. ["cvlserv_pay"] = CreateKeyPair("320100", "公务员医疗补助基金"),
  50. };
  51. string inscopeAmt = joSettle["inscp_scp_amt"].Text();
  52. string medType = Global.pat.medType ?? "A"; //默认职工
  53. string medFundCode = medTypeDict.ToList().FirstOrDefault(s => s.Key == medType).Value;
  54. foreach (var k in fundDict.Keys)
  55. {
  56. if (!string.IsNullOrEmpty(joSettle[k].Text()))
  57. {
  58. dynamic fund = new JObject();
  59. fund.fund_payamt = decimal.Parse(joSettle[k].Text());
  60. if (fund.fund_payamt <= 0.0D) continue;
  61. fund.inscp_scp_amt = inscopeAmt;
  62. if (fundDict[k].Count > 1)
  63. {
  64. fund.fund_pay_type = medFundCode;
  65. fund.fund_pay_type_name = fundDict[k].ToList().FirstOrDefault(s => s.Key == medFundCode).Value;
  66. }
  67. else
  68. {
  69. fund.fund_pay_type = fundDict[k].First().Key;
  70. fund.fund_pay_type_name = fundDict[k].First().Value;
  71. }
  72. joRtn.Add(fund);
  73. }
  74. }
  75. }
  76. catch (Exception e)
  77. {
  78. Global.writeLog("基金分类转换错误:"+e.Message);
  79. }
  80. return joRtn;
  81. }
  82. private Dictionary<string, string> CreateKeyPair(string key, string value)
  83. {
  84. return new Dictionary<string, string>() { { key, value } };
  85. }
  86. }
  87. }