using Newtonsoft.Json.Linq; using PTMedicalInsurance.Common; using PTMedicalInsurance.Helper; using PTMedicalInsurance.Variables; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PTMedicalInsurance.Business { class LocalMobilePayProcess : AbstractProcess { public override CallResult Process(JObject input) { //调用HIS费用查询信息 if (hIS.getHisFee(Global.pat, out outParam) != 0) { return Exception("获取HIS费用", outParam); } //调用医保平台转换 JObject joHisFee = JObject.Parse(outParam); if (mIS.convertHisFeeWithInsuCode(joHisFee, out outParam) != 0) { return Exception("转换HIS费用", outParam); } JArray jaFeeDetail = JArray.Parse(JsonHelper.getDestValue(JObject.Parse(outParam), "data")); jaFeeDetail.ToList().ForEach((fee) => { fee["chrg_bchno"] = Global.pat.adm_Dr.ToString(); fee["med_type"] = Global.pat.medType; }); JObject joSettlement = (JObject)input["settlement"]; joSettlement["medfee_sumamt"] = joHisFee["total"]; //合并参数 JObject joInput = new JObject(); joInput.Add("feedetail", jaFeeDetail); joInput = mergeJson(joInput, (JObject)input["patInfo"]); joInput = mergeJson(joInput, (JObject)input["data"]); joInput = mergeJson(joInput, (JObject)input["mdtrtinfo"]); joInput = mergeJson(joInput, joSettlement); joInput.Add("diseinfo_list",input["diseinfo"]); joInput.Add("feedetail_list", jaFeeDetail); outParam = JsonHelper.toJsonString(joInput); return Success(); } private JObject mergeJson(JObject source,JObject target) { source.Merge(target, new JsonMergeSettings { MergeArrayHandling = MergeArrayHandling.Union }); return source; } } }