using Newtonsoft.Json.Linq;
using PTMedicalInsurance.Helper;
using PTMedicalInsurance.Variables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PTMedicalInsurance.Business
{
    class OPSettlementService:IChargeService
    {
        /// <summary>
        /// 收费业务
        /// </summary>
        public string Charge(string operationType, JObject joInput)
        {
            //joInput 包括( data、mdtrtinfo、diseinfo、settlement)
            ProcessManager pManager = new ProcessManager()
            .Add(new ReadPatientProcess())
            // 挂号[2201] 
            .Add(new OPRegProcess())
            // 就诊信息上传[2203A]
            .Add(new OPAdmUploadProcess())
            // 费用上传[2204] 
            .Add(new OPFeeUploadProcess())
            // 门诊预结算[2206]
            .Add(new OPPreSettlementProcess())
            // 正式结算[2207]
            .Add(new OPSettlementProcess());
            // 执行
            return pManager.Run(joInput);

        }

       
        /// <summary>
        /// 退费业务
        /// </summary>
        /// <param name="joParam"></param>
        /// <returns></returns>
        public string DisCharge(JObject joParam)
        {
            ProcessManager pManager = new ProcessManager()
                // 查询结算信息
                .Add(new OPQuerySettlementProcess())
                // 门诊结算撤销 [2208]
                .Add(new OPSettlementCancelProcess())
                // 费用明细取消[2205]
                .Add(new OPFeeUploadCancelProcess())
                //  取消挂号[2202]
                .Add(new OPRegCancelProcess())
                // 退HIS结算
                .Add(new OPSettlementCancelHisProcess());

            // 执行
            return pManager.Run(joParam);
        }
    }
}
