using PTMedicalInsurance.Business.Core.SelfServiceMachine.Process.OutPat;
using PTMedicalInsurance.Business.Core.SelfServiceMachine.Process.ReadCard;
using PTMedicalInsurance.Variables;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PTMedicalInsurance.Business.Core.SelfServiceMachine.ProcessScheduler
{
    class OPRegService
    {
        public OPRegService()
        {
            Global.pat.admType = 1;
            Global.pat.medType = "12";
            Global.businessType = "01101";
            Global.pat.ecBusinessType = "01101";
            //后台需要标志表明是否自助机，以及结算机器编号
        }

        /// <summary>
        /// 收费业务
        /// </summary>
        public string Charge(string operationType, Newtonsoft.Json.Linq.JObject joInput)
        {
            Global.operationType = operationType;
            //joInput 包括( data、mdtrtinfo、diseinfo、settlement)
            ProcessManager pManager = new ProcessManager()
            ////重定向
            //.Add(new RedirectProcess())
            //物理读卡 + 1101
            .Add(new ReadCardProcess())
            // 根据返回的信息过滤无效信息，保留有效信息
            .Add(new FilterPatInfo())
            ////展示患者信息界面
            //.Add(new ShowPatInfo())
            // 设置患者信息全局变量
            .Add(new SetGlobalVariablesAfaterShowPatInfo())
            ////展示登记界面
            //.Add(new ShowOutPatRegisterForm())
            //自助机自动组织参数
            .Add(new OrganizePatientRegistrationInfo())
            // 挂号[2201A] 
            .Add(new Register())
            // 就诊信息上传[2203]
            .Add(new UploadAdmInfo())
            // 事前业务
            .Add(new PreWarning())
            // 费用上传[2204] 
            .Add(new UploadFee())
            // 事中业务
            .Add(new InProcessHandler())
            // 门诊预结算[2206]
            .Add(new PreSettlement())
            // 正式结算[2207]
            .Add(new Settlement());
            // 执行
            return pManager.Run(joInput);

        }
    }
}
