/// <summary>
        /// 医保信息回写至基层系统
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>



        public UserInfoDto GetUserBaseInfo(string param)
        {
            var data = _systemManageRepository.QueryHospitalOperator(new QueryHospitalOperatorParam()
            {
                UserId = param
            });

            if (string.IsNullOrWhiteSpace(data.HisUserAccount))
            {
                throw new Exception("当前用户未授权,基层账户信息,请重新授权!!!");
            }
            else
            {
                var inputParam = new UserInfoParam()
                {
                    UserName           = data.HisUserAccount,
                    Pwd                = data.HisUserPwd,
                    ManufacturerNumber = data.ManufacturerNumber,
                };
                string inputParamJson   = JsonConvert.SerializeObject(inputParam, Formatting.Indented);
                var    verificationCode = GetVerificationCode("01", inputParamJson);

                return(verificationCode);
            }
        }
        /// <summary>
        /// 职工住院预结算
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public WorkerHospitalizationPreSettlementDto WorkerHospitalizationPreSettlement(UiBaseDataParam param)
        {
            //获取操作人员信息
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var queryResidentParam = new QueryMedicalInsuranceResidentInfoParam()
            {
                BusinessId       = param.BusinessId,
                OrganizationCode = userBase.OrganizationCode
            };
            var infoData = new GetInpatientInfoParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            };
            //获取his预结算
            var hisPreSettlementData = _serviceBasicService.GetHisHospitalizationPreSettlement(infoData);
            var preSettlementData    = hisPreSettlementData.PreSettlementData.FirstOrDefault();
            //获取医保病人信息
            var residentData = _medicalInsuranceSqlRepository.QueryMedicalInsuranceResidentInfo(queryResidentParam);
            //获取医院等级
            var gradeData = _systemManageRepository.QueryHospitalOrganizationGrade(userBase.OrganizationCode);

            if (string.IsNullOrWhiteSpace(preSettlementData.EndDate))
            {
                throw new Exception("当前病人在基层中未办理出院,不能办理医保预结算!!!");
            }
            //获取医保账号
            var userData = _systemManageRepository.QueryHospitalOperator(
                new QueryHospitalOperatorParam()
            {
                UserId = param.UserId
            });
            var preSettlement = new WorkerHospitalizationPreSettlementParam()
            {
                User       = userBase,
                Id         = residentData.Id,
                BusinessId = param.BusinessId,
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceHospitalizationNo,
                LeaveHospitalDate          = Convert.ToDateTime(preSettlementData.EndDate).ToString("yyyyMMdd"),
                AdministrativeArea         = gradeData.AdministrativeArea,
                Operators                  = preSettlementData.Operator,
                IsHospitalizationFrequency = "0",
                OrganizationCode           = gradeData.MedicalInsuranceAccount,
            };
            //医保结算
            var resultData = _workerMedicalInsuranceRepository.WorkerHospitalizationPreSettlement(preSettlement);

            //报销金额 =统筹支付+补充医疗保险支付金额+专项基金支付金额+
            //公务员补贴+公务员补助+其它支付金额
            decimal reimbursementExpenses = resultData.BasicOverallPay + resultData.SupplementPayAmount + resultData.SpecialFundPayAmount
                                            + resultData.CivilServantsSubsidies + resultData.CivilServantsSubsidy + resultData.OtherPaymentAmount;
            var updateParam = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                ReimbursementExpensesAmount = CommonHelp.ValueToDouble(reimbursementExpenses),
                SelfPayFeeAmount            = resultData.CashPayment,
                OtherInfo    = JsonConvert.SerializeObject(resultData),
                Id           = residentData.Id,
                UserId       = userBase.UserId,
                SettlementNo = resultData.DocumentNo,
                MedicalInsuranceAllAmount  = resultData.TotalAmount,
                PreSettlementTransactionId = userBase.TransKey,
                MedicalInsuranceState      = MedicalInsuranceState.MedicalInsurancePreSettlement
            };

            //存入中间库
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParam);
            var logParam = new AddHospitalLogParam()
            {
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(resultData),
                User            = userBase,
                Remark          = "职工住院病人预结算"
            };

            _systemManageRepository.AddHospitalLog(logParam);

            return(resultData);
        }