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;

namespace PTMedicalInsurance.Business
{
    class OPQuerySettlementProcess : AbstractProcess
    {
        public override CallResult Process(JObject input)
        {
            //查询HIS医保结算记录表获取该病人的参保地
            string sqlStr = "SELECT * FROM  BS_MedInsuSettlement WHERE billType = 1 and ValidFlag = 1 ";
            sqlStr = sqlStr + " AND Hospital_Dr=" + Global.inf.hospitalDr + " AND Interface_Dr=" + Global.inf.interfaceDr;
            sqlStr = sqlStr + " AND SettlementID ='" + Global.pat.settlID + "'";

            JObject joSql = new JObject();
            joSql.Add("sqlStr", sqlStr);
            JObject joSettlInfo = mIS.QuerySettlementInfo(joSql);
            //if (JsonHelper.parseIrisRtnValue(joSettlInfo, out errMsg) != 0)
            //{
            //    rtnResult = JsonHelper.setExceptionJson(-1, "查询结算信息失败！", errMsg).ToString();
            //    return rtnResult;
            //}
            Global.pat.insuplc_admdvs = JsonHelper.getDestValue(joSettlInfo, "result.data[0].insuplc_admdvs");
            outParam = JsonHelper.toJsonString(joSettlInfo);
            return Success();
        }
    }
}
