123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- 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 IPSettlementProcess : AbstractProcess
- {
- public IPSettlementProcess()
- {
- }
- public IPSettlementProcess(JObject orginal)
- {
- this.OrginalInput = orginal;
- }
- public override CallResult Process(JObject input)
- {
- string errMsg = "";
- #region 正式出院结算
- //沈阳预结算不需要转换mdtrtCertNo,但结算需要
- //在正式结算前读一次卡
- #region 结算前统一读卡核验身份
- CallResult card = new ReadCardProcess().Process(input);
- if (card.Code != 0)
- {
- return Exception(-1, "读卡失败,请确认是否社保卡是否正常!", card.Data);
- }
- #endregion
- //if ("03".Equals(Global.pat.mdtrtcertType)) {
- // CardReader reader = new CardReader();
- // int rtnCode = reader.ReadCardBas(out outParam);
- // if (rtnCode != 0)
- // {
- // return Exception(-1, "读卡失败,请确认是否社保卡是否正常!", outParam);
- // }
- //}
- //读完卡后用新卡串
- Global.pat.mdtrtcertNO = "";
- input["Settlement"]["mdtrt_cert_no"] = Utils.ConvertMdtrtcertNo();
- JObject joSettlement = joSettlement = JObject.Parse(JsonHelper.getDestValue(input, "Settlement"));
- //基线版扩展
- JObject joDataExp = (JObject)joSettlement["exp_content"] ?? new JObject();
- //joDataExp.Add("cardtoken", Global.pat.card.Cardtoken);
- joDataExp.Add("elec_bill_code", "");
- joDataExp.Add("elec_billno_code", "");
- joDataExp.Add("elec_bill_chkcode", "");
- joSettlement["exp_content"] = joDataExp;
- joSettlement.Add("data", joSettlement);
- JObject jo2304Rtn = invoker.invokeCenterService(TradeEnum.InpatientSettlement, joSettlement);
- if (JsonHelper.parseCenterRtnValue(jo2304Rtn, out errMsg) != 0)
- {
- //取消出院
- new InpatientExitCancelProcess().Process(input);
- return Exception(-1, "结算失败", errMsg);
- }
- else
- {
- JObject joSetlinfo = JObject.Parse(JsonHelper.getDestValue(jo2304Rtn, "output.setlinfo"));
- //济南未返回基金分项,手工拆分
- //JArray fundArray = new LocalPayFundSplitService().Split(joSetlinfo);
- //if (fundArray?.Count > 0)
- //{
- // jo2304Rtn["output"]["setldetail"] = fundArray;
- //}
- Global.pat.admType = 2;
- //返回给云医保平台结算信息
- if (mIS.saveSettlement(jo2304Rtn, out errMsg) != 0)
- {
- return Exception(-1, "结算成功,但云医保平台保存失败", errMsg);
- }
- //返回给云医保平台结算明细信息
- if (mIS.saveSettlementDetail(jo2304Rtn, out errMsg) != 0)
- {
- return Exception(-1, "云医保平台保存结算明细失败", errMsg);
- }
- //返回给HIS
- if (hIS.returnInpatSettlementInfo(OrginalInput, joSetlinfo, out outParam) != 0)
- {
- return Exception(-1, "返回结算信息给HIS", outParam);
- }
- else
- {
- //返回给前端
- JObject joHisServieRtn = JObject.Parse(outParam);
- hBus.returnToFrontEndAfterSettlement(jo2304Rtn, joHisServieRtn, out outParam);
- return IrisReturn("结算成功", JObject.Parse(outParam));
- }
- }
- #endregion
- }
- }
- }
|