using MedicalInsurance.Forms; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PTMedicalInsurance.Helper; using PTMedicalInsurance.Variables; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PTMedicalInsurance.Business { abstract class AbstractProcess { protected CenterBusiness cBus = new CenterBusiness(); protected HisMainBusiness hBus = new HisMainBusiness(); protected HisIrisServices hIS = new HisIrisServices(); protected MIIrisServices mIS = new MIIrisServices(); protected InvokeHelper invoker = new InvokeHelper(); protected string outParam = ""; public JObject OrginalInput { set; get; } /// /// 使用原始参数 /// public bool UseOrginal { get;set; } /// /// 返回成功信息 /// /// protected CallResult Success() { return Success("成功"); } protected CallResult Success(string msg) { return new CallResult(0, msg, outParam); } /// /// 返回失败信息 /// /// /// /// protected CallResult Error(int code, string errMsg) { return Exception(code, errMsg, outParam); } protected CallResult Exception(int code, string errMsg,string param) { outParam = JsonHelper.setExceptionJson(code, errMsg, param).ToString(); return new CallResult(code, errMsg, outParam,param); } protected CallResult Exception(string errMsg, string param) { return Exception(-1, errMsg, param); } protected CallResult IrisReturn(string msg,JObject obj) { outParam = JsonHelper.setIrisReturnValue(0, msg, obj).ToString(); return new CallResult(0, msg, outParam,obj); } /// /// 返回失败信息 /// /// /// protected CallResult Error(string errMsg) { return new CallResult(-1, errMsg, outParam); } /// /// 业务过程 /// /// /// public abstract CallResult Process(JObject input); /// /// 根据是否需要使用共济支付重新计算结算数据 /// /// /// protected JObject MutualAidPay(string setlInfo) { JObject joRtn = JObject.Parse(setlInfo); if (Global.pat.mutualAidFlag) { try { decimal psnCashPay = decimal.Parse(JsonHelper.getDestValue(joRtn, "psn_cash_pay")); if (psnCashPay == 0) { MessageBox.Show("该患者自付金额为0,不需要进行共济支付!"); } else { //开启自付界面,因涉及到多次自付 MutualAid frmMA = new MutualAid(joRtn); if (frmMA.dtSettlInfo.Rows.Count != 0) { frmMA.WindowState = FormWindowState.Maximized; if (frmMA.ShowDialog() == DialogResult.OK) { joRtn = JObject.Parse(frmMA.finalSettlementInfo); } else { MessageBox.Show("开启共济支付失败,原因为收款员取消共济支付!"); } } else { MessageBox.Show("开启共济支付失败,原因为未检测到有效的被共济人的医保结算数据!"); } } } catch (Exception ex) { MessageBox.Show("共济支付失败:" + ex.Message); } } return joRtn; } protected JObject CancelMutualAidPay(JObject joRtn) { DataTable dtSettlInfo = (DataTable)JsonConvert.DeserializeObject(joRtn["result"]["data"].ToString(), (typeof(DataTable))); if (dtSettlInfo.Rows.Count != 1) { Global.writeLog("无共济支付信息!"); return JsonHelper.setExceptionJson(-1, "未查询到相关结算信息!", ""); } int mutualAidFlag = 0; if (!string.IsNullOrEmpty(dtSettlInfo.Rows[0]["MutualAidFlag"].ToString())) { mutualAidFlag = Convert.ToInt32(dtSettlInfo.Rows[0]["MutualAidFlag"].ToString()); } Global.writeLog("共济支付标志:" + mutualAidFlag); if (mutualAidFlag > 0) { //开启自付界面,因涉及到多次自付 MutualAid frmMA = new MutualAid(Global.pat.settlID); if (frmMA.dtSettlInfo.Rows.Count != 0) { frmMA.WindowState = FormWindowState.Maximized; if (frmMA.ShowDialog() == DialogResult.OK) { } else { return JsonHelper.setExceptionJson(-1, "收款员取消共济支付撤销!", null); } } else { return JsonHelper.setExceptionJson(-1, "开启共济支付失败,原因为未检测到有效的被共济人的医保结算数据!", null); } } return joRtn; } } }