LocalMobilePayProcess.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. namespace PTMedicalInsurance.Business
  11. {
  12. class LocalMobilePayProcess : AbstractProcess
  13. {
  14. public override CallResult Process(JObject input)
  15. {
  16. //调用HIS费用查询信息
  17. if (hIS.getHisFee(Global.pat, out outParam) != 0)
  18. {
  19. return Exception("获取HIS费用", outParam);
  20. }
  21. //调用医保平台转换
  22. JObject joHisFee = JObject.Parse(outParam);
  23. if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0)
  24. {
  25. return Exception("转换HIS费用", outParam);
  26. }
  27. JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data"));
  28. jaFeeDetail.ToList().ForEach((fee) =>
  29. {
  30. fee["chrg_bchno"] = Global.pat.adm_Dr.ToString();
  31. fee["med_type"] = Global.pat.medType;
  32. });
  33. JObject joSettlement = (JObject)input["settlement"];
  34. joSettlement["medfee_sumamt"] = joHisFee["total"];
  35. //合并参数
  36. JObject joInput = new JObject();
  37. joInput.Add("feedetail", jaFeeDetail);
  38. joInput = mergeJson(joInput, (JObject)input["patInfo"]);
  39. joInput = mergeJson(joInput, (JObject)input["data"]);
  40. joInput = mergeJson(joInput, (JObject)input["mdtrtinfo"]);
  41. joInput = mergeJson(joInput, joSettlement);
  42. joInput.Add("diseinfo_list",input["diseinfo"]);
  43. joInput.Add("feedetail_list", jaFeeDetail);
  44. outParam = JsonHelper.toJsonString(joInput);
  45. return Success();
  46. }
  47. private JObject mergeJson(JObject source,JObject target)
  48. {
  49. source.Merge(target, new JsonMergeSettings
  50. {
  51. MergeArrayHandling = MergeArrayHandling.Union
  52. });
  53. return source;
  54. }
  55. }
  56. }