123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- 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; }
- /// <summary>
- /// 使用原始参数
- /// </summary>
- public bool UseOrginal {
- get;set;
- }
- /// <summary>
- /// 返回成功信息
- /// </summary>
- /// <returns></returns>
- protected CallResult Success()
- {
- return Success("成功");
- }
- protected CallResult Success(string msg)
- {
- return new CallResult(0, msg, outParam);
- }
- /// <summary>
- /// 返回失败信息
- /// </summary>
- /// <param name="code"></param>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- 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);
- }
- /// <summary>
- /// 返回失败信息
- /// </summary>
- /// <param name="errMsg"></param>
- /// <returns></returns>
- protected CallResult Error(string errMsg)
- {
- return new CallResult(-1, errMsg, outParam);
- }
- /// <summary>
- /// 业务过程
- /// </summary>
- /// <param name="input"></param>
- /// <returns></returns>
- public abstract CallResult Process(JObject input);
- /// <summary>
- /// 根据是否需要使用共济支付重新计算结算数据
- /// </summary>
- /// <param name="setlInfo"></param>
- /// <returns></returns>
- 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;
- }
- }
- }
|