using Hotline.Settings;
using Hotline.Share.Dtos.CallCenter;
using Hotline.Share.Dtos.Settings;
using Hotline.Share.Enums.Order;
using Hotline.Share.Requests;
using Microsoft.VisualBasic;
using System.Data;
using XF.Utility.EnumExtensions;

namespace Hotline.Share.Dtos.Order
{
    public class OrderBiOrgDataListVo
    {
        public string OrgName { get; set; }

        public string OrgId { get; set; }

        /// <summary>
        /// 业务已办超期
        /// </summary>
        public int HandlerExtendedNum { get; set; }

        /// <summary>
        /// 会签已办超期
        /// </summary>
        public int CounterHandlerExtendedNum { get; set; }
        /// <summary>
        /// 业务待办超期
        /// </summary>
        public int NoHandlerExtendedNum { get; set; }
        /// <summary>
        /// 会签待办超期
        /// </summary>
        public int CounterNoHandlerExtendedNum { get; set; }

        public int Subtotal => HandlerExtendedNum + CounterHandlerExtendedNum + NoHandlerExtendedNum + CounterNoHandlerExtendedNum;

        //public int Subtotal { get; set; }

    }

    public class OrderBiCentreDataListVo
    {
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 中心归档件
        /// </summary>
        public int CentreArchive { get; set; }

        /// <summary>
        /// 转办信件
        /// </summary>
        public int CentreCareOf { get; set; }

        /// <summary>
        /// 待转办
        /// </summary>
        public int NoCentreCareOf { get; set; }
        /// <summary>
        /// 无效件
        /// </summary>
        public int Invalid { get; set; }
        /// <summary>
        /// 重复件
        /// </summary>
        public int Repeat { get; set; }

        /// <summary>
        /// 所有信件
        /// </summary>
        //public int Subtotal => CentreArchive + CentreCareOf + NoCentreCareOf + Invalid + Repeat;
        public int Subtotal { get; set; }
    }

    public class OrderVolumeDataListVo
    {

        /// <summary>
        /// 用户ID
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 中心归档量
        /// </summary>
        public int VisitCenter { get; set; }

        /// <summary>
        /// 部门归档量
        /// </summary>
        public int VisitOrg { get; set; }

        /// <summary>
        /// 中心归档发布量
        /// </summary>
        public int PublishCenter { get; set; }

        /// <summary>
        /// 部门归档发布量
        /// </summary>
        public int PublishOrg { get; set; }

        /// <summary>
        /// 公开发布量
        /// </summary>
        public int PublishOpen { get; set; }

        /// <summary>
        /// 中心派单量
        /// </summary>
        public int DispatchCenter { get; set; }

        /// <summary>
        /// 部门派单量
        /// </summary>
        public int DispatchOrg { get; set; }

        /// <summary>
        /// 重办信件量
        /// </summary>
        public int ReTransact { get; set; }

        /// <summary>
        /// 总量
        /// </summary>
        public int Subtotal { get; set; }
    }

    public class OrderBiSpecialListVo
    {
        public string Cause { get; set; }

        public int OrderNum { get; set; }

        public DateTime MaxSpecialTime { get; set; }
    }

    public class HotspotDataLsitVo
    {
        public string Name { get; set; }

        public string Id { get; set; }

        public int Num { get; set; }
        public bool Sublevel { get; set; }

        public List<HotspotDataLsitVo> Children { get; set; }

        public int ChainNum { get; set; }

        public string ChainRate { get; set; }

    }


    public class AcceptTypeTop10Volod
    {
        /// <summary>
        /// 热点名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 受理类型ID
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 受理类型名称
        /// </summary>
        public string AcceptName { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int Num { get; set; }
    }

    public class AcceptTypeTop10Vo
    {
        /// <summary>
        /// 热点名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 有效受理
        /// </summary>
        public int ValidAccept { get; set; }

        /// <summary>
        /// 咨询
        /// </summary>
        public int Consult { get; set; }

        /// <summary>
        /// 举报
        /// </summary>

        public int Report { get; set; }

        /// <summary>
        /// 投诉
        /// </summary>
        public int Complaint { get; set; }

        /// <summary>
        /// 求助
        /// </summary>
        public int SeekHelp { get; set; }

        /// <summary>
        /// 建议
        /// </summary>
        public int Suggest { get; set; }

        /// <summary>
        /// 意见
        /// </summary>
        public int Opinion { get; set; }

        /// <summary>
        /// 其他
        /// </summary>
        public int Rests { get; set; }

        /// <summary>
        /// 惠民帮助
        /// </summary>
        public int BenefitThePeople { get; set; }

        /// <summary>
        /// 表扬
        /// </summary>
        public int Praise { get; set; }
    }

    public class BiOrderDelayDataDto
    {
        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrgName { get; set; }
        /// <summary>
        /// 部门code
        /// </summary>
        public string OrgCode { get; set; }
        /// <summary>
        /// 小计
        /// </summary>
        public int AllTotal => PassTotal + NoPassTotal + ExaminingTotal + WithdrawTotal;
        /// <summary>
        /// 已同意次数
        /// </summary>
        public int PassTotal { get; set; }
        /// <summary>
        /// 未同意次数
        /// </summary>
        public int NoPassTotal { get; set; }
        /// <summary>
        /// 审批中次数
        /// </summary>
        public int ExaminingTotal { get; set; }

        /// <summary>
        /// 撤销次数
        /// </summary>
        public int WithdrawTotal { get; set; }

    }



    public class VisitMeasureStatisticsDto
    {


        /// <summary>
        /// 智能回访量
        /// </summary>
        public int AiVisitCount { get; set; }

        /// <summary>
        /// 智能回访满意量
        /// </summary>
        public int AiVisitSatisfiedCount { get; set; }

        /// <summary>
        /// 智能回访不满意量
        /// </summary>
        public int AiVisitNoSatisfiedCount { get; set; }

        /// <summary>
        /// 智能回访失败量
        /// </summary>
        public int AIVisitFailCount { get; set; }

        public List<VisitMeasureStatisticsModelDto> VisitMeasureStatisticsModelList { get; set; }

    }

    public class VisitMeasureStatisticsModelDto
    {
        /// <summary>
        /// 回访员
        /// </summary>
        public string VisitName { get; set; }

        /// <summary>
        /// 电话回访
        /// </summary>
        public int CallVisitCount { get; set; }
        /// <summary>
        /// 人工回访
        /// </summary>
        public int ArtificialVisitCount { get; set; }
        /// <summary>
        /// 总回访量
        /// </summary>
        public int SumCount { get; set; }
    }

    /// <summary>
    /// 坐席满意度明细表
    /// </summary>
    public class SeatSatisfactionStatisticsListDetailDto
    {
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// id
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 默认满意
        /// </summary>
        public int DefaultSatisfied { get; set; }
        public int DefaultSatisfiedKey { get; set; } = 0;
        public string DefaultSatisfiedRate => CalcRate(DefaultSatisfied);

        /// <summary>
        /// 非常不满意
        /// </summary>
        public int VeryNoSatisfied { get; set; }
        public int VeryNoSatisfiedKey { get; set; } = 1;
        public string VeryNoSatisfiedRate => CalcRate(VeryNoSatisfied);

        /// <summary>
        /// 不满意
        /// </summary>
        public int NoSatisfied { get; set; }
        public int NoSatisfiedKey { get; set; } = 2;
        public string NoSatisfiedRate => CalcRate(NoSatisfied);

        /// <summary>
        /// 一般
        /// </summary>
        public int Normal { get; set; }
        public int NormalKey { get; set; } = 3;
        public string NormalRate => CalcRate(Normal);

        /// <summary>
        /// 满意
        /// </summary>
        public int Satisfied { get; set; }
        public int SatisfiedKey { get; set; } = 4;
        public string SatisfiedRate => CalcRate(Satisfied);

        /// <summary>
        /// 非常满意
        /// </summary>
        public int VerySatisfied { get; set; }
        public int VerySatisfiedKey { get; set; } = 5;
        public string VerySatisfiedRate => CalcRate(VerySatisfied);

        /// <summary>
        /// 未接通
        /// </summary>
        public int NoConnect { get; set; }
        public int NoConnectKey { get; set; } = 6;
        public string NoConnectRate => CalcRate(NoConnect);

        /// <summary>
        /// 未做评价
        /// </summary>
        public int NoEvaluate { get; set; }
        public int NoEvaluateKey { get; set; } = 7;
        public string NoEvaluateRate => CalcRate(NoEvaluate);

        /// <summary>
        /// 小计
        /// </summary>
        public int Count => DefaultSatisfied + NoSatisfied + Satisfied + VerySatisfied + NoConnect + NoEvaluate;

        /// <summary>
        /// 总满意率
        /// </summary>
        public string CountRate => CalcRate(DefaultSatisfied + Satisfied + VerySatisfied + NoConnect + NoEvaluate);

        public string CalcRate(int num)
        {
            int counNum = DefaultSatisfied + NoSatisfied + Satisfied + VerySatisfied + NoConnect + NoEvaluate;
            if (num == 0 || counNum == 0)
            {
                return "0.000%";
            }
            return Math.Round((num / (double)counNum) * 100, 2) + "%";
        }
    }
    /// <summary>
    /// 坐席满意度
    /// </summary>
    public class SeatSatisfactionStatisticsDto
    {
        public ESeatEvaluate? SeatEvaluate { get; set; }

        public string? SeatSatisfactionName => SeatEvaluate?.GetDescription();

        /// <summary>
        /// 数量
        /// </summary>
        public int Count { get; set; }

    }

    /// <summary>
    /// 满意度
    /// </summary>
    public class SeatSatisfactionStatisticsEvaluateDto
    {
        /// <summary>
        /// 满意
        /// </summary>
        public int Satisfied { get; set; }

        /// <summary>
        /// 不满意
        /// </summary>
        public int NoSatisfied { get; set; }

        /// <summary>
        /// 满意率
        /// </summary>
        public double SatisfactionRate => CalcVerySatisfiedRate();

        public double CalcVerySatisfiedRate()
        {
            if (Satisfied == 0 || (Satisfied + NoSatisfied) == 0)
            {
                return 0.000;
            }
            return Math.Round((Satisfied / (double)(Satisfied + NoSatisfied)) * 100, 2);
        }

    }

    public class VisitAndOrgSatisfactionStatisticsResultDto
    {
        public List<VisitAndOrgSatisfactionStatisticsDto> DataList { get; set; }

        public VisitAndOrgSatisfactionStatisticsDto CountySumModel { get; set; }

        public VisitAndOrgSatisfactionStatisticsDto CitySumModel { get; set; }

        public VisitAndOrgSatisfactionStatisticsDto SumModel { get; set; }
    }


    public class OrgVisitDetailListResp
    {
        /// <summary>
        /// 回访子ID
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 工单ID
        /// </summary>
        public string OrderId { get; set; }

        /// <summary>
        /// 回访ID
        /// </summary>
        public string VisitId { get; set; }
        /// <summary>
        /// 工单编号
        /// </summary>
        public string No { get; set; }

        /// <summary>
        /// 重办次数
        /// </summary>
        public int? ReTransactNum { get; set; }

        /// <summary>
        /// 甄别状态
        /// </summary>
        public EScreenStatus? OrderScreenStatus { get; set; }
        public string? OrderScreenStatusText => OrderScreenStatus.HasValue && OrderScreenStatus != null ? OrderScreenStatus?.GetDescription() : "未甄别";

        /// <summary>
        /// 回访内容
        /// </summary>
        public string VisitContent { get; set; }

        /// <summary>
        /// 热点全称
        /// </summary>
        public string HotspotSpliceName { get; set; }

        /// <summary>
        /// 一级部门
        /// </summary>
        public string OrgLevelOneName { get; set; }

        /// <summary>
        /// 办结部门
        /// </summary>
        public string CurrentHandleOrgName { get; set; }

        /// <summary>
        /// 受理时间
        /// </summary>
        public DateTime CreationTime { get; set; }

        /// <summary>
        /// 工单标题
        /// </summary>
        public string Title { get; set; }

        /// <summary>
        /// 回访人
        /// </summary>
        public string VisitUser { get; set; }

        /// <summary>
        /// 回访部门
        /// </summary>
        public string VisitOrgName { get; set; }

        /// <summary>
        /// 回访方式
        /// </summary>
        public EVisitType? VisitType { get; set; }

        public string? VisitTypeText => VisitType?.GetDescription();

        /// <summary>
        /// 回访时间
        /// </summary>
        public DateTime? VisitTime { get; set; }

        /// <summary>
        /// 满意度
        /// 如果入参 EAttitudeType = 1 是 办件结果
        /// 如果入参 EAttitudeType = 2 是 办事态度
        /// </summary>
        public string OrgProcessingResults { get; set; }

        /// <summary>
        /// 受理内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 承办意见
        /// </summary>
        public string FileOpinion { get; set; }

        /// <summary>
        /// 办结时间
        /// </summary>
        public DateTime? FiledTime { get; set; }

        /// <summary>
        /// 接办部门
        /// </summary>
        public string ActualHandleOrgName { get; set; }

        /// <summary>
        /// 是否省工单（空为全部  true为省工单 false为市工单）
        /// </summary>
        public bool IsProvinceOrder { get; set; }

        public string IsProvinceText => IsProvinceOrder ? "省工单" : "市工单";

        /// <summary>
        /// 工单标签（自贡）
        /// </summary>
        public string? OrderTag { get; set; }

        /// <summary>
        /// 来源渠道
        /// </summary>
        public string? SourceChannel { get; set; }

        /// <summary>
        /// 受理类型
        /// </summary>
        public string? AcceptType { get; set; }

        /// <summary>
        /// 不满意原因
        /// </summary>
        public string OrgNoSatisfiedReasonText { get; set; }

        /// <summary>
        /// 不满意原因字符串
        /// </summary>
        //public string OrgNoSatisfiedReasonText => OrgNoSatisfiedReason != null ? string.Join(',', OrgNoSatisfiedReason.Select(d => d.Value)) : "";

        /// <summary>
        /// 市
        /// </summary>
        public string? City { get; set; }

        /// <summary>
        /// 区/县
        /// </summary>
        public string? County { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string? Area => string.IsNullOrEmpty(County) == false ? County : City;
    }



    public class VisitAndOrgSatisfactionStatisticsDto
    {
        public string OrgName { get; set; }

        public string OrgCode { get; set; }

        public EOrgType? OrgType { get; set; }

        public string OrgTypeText => OrgType?.GetDescription();

        /// <summary>
        /// 总数
        /// </summary>
        public int TotalSumCount { get; set; }

        /// <summary>
        /// 总满意度
        /// </summary>
        //public double TotalSumRate => Math.Round(VerySatisfiedRate + SatisfiedRate + RegardedAsSatisfiedRate+ DefaultSatisfiedRate, 2) ;
        public double TotalSumRate => CalcTotalSumRate();

        public double CalcTotalSumRate()
        {
            //if ((VerySatisfiedCount + SatisfiedCount + RegardedAsSatisfiedCount + DefaultSatisfiedCount + NoSatisfiedCount) == 0)
            //	return 0;
            //        return Math.Round(((double)VerySatisfiedCount + SatisfiedCount + RegardedAsSatisfiedCount + DefaultSatisfiedCount) / (VerySatisfiedCount + SatisfiedCount + RegardedAsSatisfiedCount + DefaultSatisfiedCount + NoSatisfiedCount) * 100, 2);
            if (TotalSumCount - NoSatisfiedCount <= 0)
                return 0;
            return Math.Round((((double)TotalSumCount - NoSatisfiedCount) / TotalSumCount) * 100, 2);
        }



        public string TotalSumRateText => TotalSumRate + "%";
        /// <summary>
        /// 非常满意数
        /// </summary>
        public int VerySatisfiedCount { get; set; }

        /// <summary>
        /// 非常满意Key
        /// </summary>
        public string VerySatisfiedKey => "5";

        /// <summary>
        /// 非常满意率
        /// </summary>
        public double VerySatisfiedRate => CalcVerySatisfiedRate();

        public double CalcVerySatisfiedRate()
        {
            if (VerySatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((VerySatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string VerySatisfiedRateText => VerySatisfiedRate + "%";

        /// <summary>
        /// 满意数
        /// </summary>
        public int SatisfiedCount { get; set; }

        /// <summary>
        /// 满意Key
        /// </summary>
        public string SatisfiedKey => "4";

        /// <summary>
        /// 满意率
        /// </summary>
        public double SatisfiedRate => CalcSatisfiedRate();


        public double CalcSatisfiedRate()
        {
            if (SatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((SatisfiedCount / (double)TotalSumCount) * 100, 2);
        }

        public string SatisfiedRateText => SatisfiedRate + "%";
        /// <summary>
        /// 视为满意数
        /// </summary>
        public int RegardedAsSatisfiedCount { get; set; }

        /// <summary>
        /// 视为满意Key
        /// </summary>
        public string RegardedAsSatisfiedKey => "-1";

        /// <summary>
        /// 视为满意率
        /// </summary>
        public double RegardedAsSatisfiedRate => CalcRegardedAsSatisfiedRate();

        public double CalcRegardedAsSatisfiedRate()
        {
            if (RegardedAsSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((RegardedAsSatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string RegardedAsSatisfiedRateText => RegardedAsSatisfiedRate + "%";
        /// <summary>
        /// 默认满意数
        /// </summary>
        public int DefaultSatisfiedCount { get; set; }

        /// <summary>
        /// 默认满意Key
        /// </summary>
        public string DefaultSatisfiedKey => "0";

        /// <summary>
        /// 默认满意率
        /// </summary>
        public double DefaultSatisfiedRate => CalcDefaultSatisfiedRate();

        public double CalcDefaultSatisfiedRate()
        {
            if (DefaultSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((DefaultSatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string DefaultSatisfiedRateText => DefaultSatisfiedRate + "%";

        /// <summary>
        /// 不满意数
        /// </summary>
        public int NoSatisfiedCount { get; set; }

        /// <summary>
        /// 不满意Key
        /// </summary>
        public string NoSatisfiedKey => "2";

        /// <summary>
        /// 不满意率
        /// </summary>
        public double NoSatisfiedRate => CalcNoSatisfiedRate();


        public double CalcNoSatisfiedRate()
        {
            if (NoSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((NoSatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string NoSatisfiedRateText => NoSatisfiedRate + "%";


        /// <summary>
        /// 未做评价数
        /// </summary>
        public int NoEvaluateCount { get; set; }

        /// <summary>
        /// 未做评价Key
        /// </summary>
        public string NoEvaluateKey => "7";

        /// <summary>
        /// 未做评价率
        /// </summary>
        public double NoEvaluateRate => CalcNoEvaluateRate();


        public double CalcNoEvaluateRate()
        {
            if (NoEvaluateCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((NoEvaluateCount / (double)TotalSumCount) * 100, 2);
        }

        public string NoEvaluateRateText => NoEvaluateRate + "%";

        /// <summary>
        /// 未接通数
        /// </summary>
        public int NoPutThroughCount { get; set; }

        /// <summary>
        /// 未接通Key
        /// </summary>
        public string NoPutThroughKey => "6";

        /// <summary>
        /// 未接通率
        /// </summary>
        public double NoPutThroughRate => CalcNoPutThroughRate();


        public double CalcNoPutThroughRate()
        {
            if (NoPutThroughCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((NoPutThroughCount / (double)TotalSumCount) * 100, 2);
        }
        public string NoPutThroughRateText => NoPutThroughRate + "%";

        /// <summary>
        /// 一般数
        /// </summary>
        public int NormalCount { get; set; }

        /// <summary>
        /// 一般Key
        /// </summary>
        public string NormalKey => "3";

        /// <summary>
        /// 一般率
        /// </summary>
        public double NormalRate => CalcNormalRate();

        public double CalcNormalRate()
        {
            if (NormalCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((NormalCount / (double)TotalSumCount) * 100, 3);
        }

        public string NormalRateText => NormalRate + "%";

        /// <summary>
        /// 非常不满意数
        /// </summary>
        public int VeryNoSatisfiedCount { get; set; }

        /// <summary>
        /// 非常不满意数Key
        /// </summary>
        public string VeryNoSatisfiedKey => "1";

        /// <summary>
        /// 非常不满意率
        /// </summary>
        public double VeryNoSatisfiedRate => CalcVeryNoSatisfiedRate();

        public double CalcVeryNoSatisfiedRate()
        {
            if (VeryNoSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((VeryNoSatisfiedCount / (double)TotalSumCount) * 100, 3);
        }

        public string VeryNoSatisfiedRateText => VeryNoSatisfiedRate + "%";
    }

    public class BiOrderSendVo
    {
        public string UserId { get; set; }
        public string UserName { get; set; }

        public string StepName { get; set; }

        /// <summary>
        /// 派单量
        /// </summary>
        public int SendOrderNum { get; set; }

        /// <summary>
        /// 待派单量
        /// </summary>
        public int NoSendOrderNum { get; set; }

        /// <summary>
        /// 重办量
        /// </summary>
        public int ReSendOrderNum { get; set; }

        //public string AccuracyRate { get; set; }

        public string AccuracyRate => GetAccuracyRateRate();

        public string GetAccuracyRateRate()
        {
            if (ReSendOrderNum == 0)
            {
                return "100%";
            }
            if (SendOrderNum > 0 && ReSendOrderNum > 0)
            {
                return Math.Round(((SendOrderNum - ReSendOrderNum) / (double)SendOrderNum) * 100, 2).ToString() + "%";
            }
            return "0%";
        }
    }

    public class OrderReTransactVo
    {
        /// <summary>
        /// 时间
        /// </summary>
        public string Time { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrgName { get; set; }

        /// <summary>
        /// 部门id
        /// </summary>
        public string OrgId { get; set; }

        /// <summary>
        /// 次数
        /// </summary>
        public int Num { get; set; }
    }

    public class SecondaryHandlingVo
    {
        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrgName { get; set; }


        /// <summary>
        /// 部门id
        /// </summary>
        public string OrgId { get; set; }

        /// <summary>
        /// 次数
        /// </summary>
        public int Num { get; set; }
    }

    public class SecondaryHandlingSatisfactionVo
    {
        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrgName { get; set; }


        /// <summary>
        /// 部门id
        /// </summary>
        public string OrgId { get; set; }

        /// <summary>
        /// 部门类型
        /// </summary>
        public EOrgType OrgType { get; set; }

        public string OrgTypeText => OrgType.GetDescription();

        /// <summary>
        /// 总数
        /// </summary>
        public int TotalSumCount { get; set; }

        /// <summary>
        /// 总满意度
        /// </summary>
        public double TotalSumRate => Math.Round(VerySatisfiedRate + SatisfiedRate + RegardedAsSatisfiedRate + DefaultSatisfiedRate, 2);

        public string TotalSumRateText => TotalSumRate + "%";

        /// <summary>
        /// 非常满意数
        /// </summary>
        public int VerySatisfiedCount { get; set; }

        /// <summary>
        /// 非常满意率
        /// </summary>
        public double VerySatisfiedRate => CalcVerySatisfiedRate();

        public double CalcVerySatisfiedRate()
        {
            if (VerySatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((VerySatisfiedCount / (double)TotalSumCount) * 100, 2);
        }

        public string VerySatisfiedRateText => VerySatisfiedRate + "%";

        /// <summary>
        /// 满意数
        /// </summary>
        public int SatisfiedCount { get; set; }

        /// <summary>
        /// 满意率
        /// </summary>
        public double SatisfiedRate => CalcSatisfiedRate();


        public double CalcSatisfiedRate()
        {
            if (SatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((SatisfiedCount / (double)TotalSumCount) * 100, 3);
        }
        public string SatisfiedRateText => SatisfiedRate + "%";

        /// <summary>
        /// 视为满意数
        /// </summary>
        public int RegardedAsSatisfiedCount { get; set; }


        /// <summary>
        /// 视为满意率
        /// </summary>
        public double RegardedAsSatisfiedRate => CalcRegardedAsSatisfiedRate();

        public double CalcRegardedAsSatisfiedRate()
        {
            if (RegardedAsSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((RegardedAsSatisfiedCount / (double)TotalSumCount) * 100, 3);
        }
        public string RegardedAsSatisfiedRateText => RegardedAsSatisfiedRate + "%";

        /// <summary>
        /// 默认满意数
        /// </summary>
        public int DefaultSatisfiedCount { get; set; }

        /// <summary>
        /// 默认满意率
        /// </summary>
        public double DefaultSatisfiedRate => CalcDefaultSatisfiedRate();

        public double CalcDefaultSatisfiedRate()
        {
            if (DefaultSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((DefaultSatisfiedCount / (double)TotalSumCount) * 100, 3);
        }

        public string DefaultSatisfiedRateText => DefaultSatisfiedRate + "%";

        /// <summary>
        /// 不满意数
        /// </summary>
        public int NoSatisfiedCount { get; set; }
        /// <summary>
        /// 不满意率
        /// </summary>
        public double NoSatisfiedRate => CalcNoSatisfiedRate();


        public double CalcNoSatisfiedRate()
        {
            if (NoSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((NoSatisfiedCount / (double)TotalSumCount) * 100, 3);
        }

        public string NoSatisfiedRateText => NoSatisfiedRate + "%";



        /// <summary>
        /// 未做评价数
        /// </summary>
        public int NoEvaluateCount { get; set; }

        /// <summary>
        /// 未做评价率
        /// </summary>
        public double NoEvaluateRate => CalcNoEvaluateRate();


        public double CalcNoEvaluateRate()
        {
            if (NoEvaluateCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((NoEvaluateCount / (double)TotalSumCount) * 100, 3);
        }
        public string NoEvaluateRateText => NoEvaluateRate + "%";


        /// <summary>
        /// 未接通数
        /// </summary>
        public int NoPutThroughCount { get; set; }

        /// <summary>
        /// 未接通率
        /// </summary>
        public double NoPutThroughRate => CalcNoPutThroughRate();

        public double CalcNoPutThroughRate()
        {
            if (NoPutThroughCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((NoPutThroughCount / (double)TotalSumCount) * 100, 3);
        }

        public string NoPutThroughRateText => NoPutThroughRate + "%";

        /// <summary>
        /// 一般数
        /// </summary>
        public int NormalCount { get; set; }

        /// <summary>
        /// 一般率
        /// </summary>
        public double NormalRate => CalcNormalRate();

        public double CalcNormalRate()
        {
            if (NormalCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((NormalCount / (double)TotalSumCount) * 100, 3);
        }

        public string NormalRateText => NormalRate + "%";

        /// <summary>
        /// 非常不满意数
        /// </summary>
        public int VeryNoSatisfiedCount { get; set; }

        /// <summary>
        /// 非常不满意率
        /// </summary>
        public double VeryNoSatisfiedRate => CalcVeryNoSatisfiedRate();

        public double CalcVeryNoSatisfiedRate()
        {
            if (VeryNoSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((VeryNoSatisfiedCount / (double)TotalSumCount) * 100, 3);
        }

        public string VeryNoSatisfiedRateText => VeryNoSatisfiedRate + "%";
    }

    public class OrderSourceVo
    {

        /// <summary>
        /// 信件来源
        /// </summary>
        public string Source { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int Num { get; set; }

        /// <summary>
        /// 总数
        /// </summary>
        public int TotalSumCount { get; set; }

        /// <summary>
        /// 占比
        /// </summary>
        public double Rate => GetRate();

        public double GetRate()
        {
            if (Num == 0 || TotalSumCount == 0)
            {
                return 0.000;
            }
            return Math.Round((Num / (double)TotalSumCount) * 100, 2);
        }

        public string RateText => GetRate() + "%";
    }
    public class VisitAndHotspotSatisfactionStatisticsDto
    {
        public string HotspotId { get; set; }

        public string HotspotName { get; set; }

        /// <summary>
        /// 总数
        /// </summary>
        public int TotalSumCount { get; set; }

        /// <summary>
        /// 总满意度
        /// </summary>
        public double TotalSumRate => Math.Round(VerySatisfiedRate + SatisfiedRate + RegardedAsSatisfiedRate + DefaultSatisfiedRate, 2);

        public string TotalSumRateText => TotalSumRate + "%";
        /// <summary>
        /// 非常满意数
        /// </summary>
        public int VerySatisfiedCount { get; set; }

        /// <summary>
        /// 非常满意Key
        /// </summary>
        public string VerySatisfiedKey => "5";

        /// <summary>
        /// 非常满意率
        /// </summary>
        public double VerySatisfiedRate => CalcVerySatisfiedRate();

        public double CalcVerySatisfiedRate()
        {
            if (VerySatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((VerySatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string VerySatisfiedRateText => VerySatisfiedRate + "%";

        /// <summary>
        /// 满意数
        /// </summary>
        public int SatisfiedCount { get; set; }

        /// <summary>
        /// 满意Key
        /// </summary>
        public string SatisfiedKey => "4";

        /// <summary>
        /// 满意率
        /// </summary>
        public double SatisfiedRate => CalcSatisfiedRate();


        public double CalcSatisfiedRate()
        {
            if (SatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((SatisfiedCount / (double)TotalSumCount) * 100, 2);
        }

        public string SatisfiedRateText => SatisfiedRate + "%";
        /// <summary>
        /// 视为满意数
        /// </summary>
        public int RegardedAsSatisfiedCount { get; set; }

        /// <summary>
        /// 视为满意Key
        /// </summary>
        public string RegardedAsSatisfiedKey => "-1";

        /// <summary>
        /// 视为满意率
        /// </summary>
        public double RegardedAsSatisfiedRate => CalcRegardedAsSatisfiedRate();

        public double CalcRegardedAsSatisfiedRate()
        {
            if (RegardedAsSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((RegardedAsSatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string RegardedAsSatisfiedRateText => RegardedAsSatisfiedRate + "%";
        /// <summary>
        /// 默认满意数
        /// </summary>
        public int DefaultSatisfiedCount { get; set; }

        /// <summary>
        /// 默认满意Key
        /// </summary>
        public string DefaultSatisfiedKey => "0";

        /// <summary>
        /// 默认满意率
        /// </summary>
        public double DefaultSatisfiedRate => CalcDefaultSatisfiedRate();

        public double CalcDefaultSatisfiedRate()
        {
            if (DefaultSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((DefaultSatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string DefaultSatisfiedRateText => DefaultSatisfiedRate + "%";

        /// <summary>
        /// 不满意数
        /// </summary>
        public int NoSatisfiedCount { get; set; }

        /// <summary>
        /// 不满意Key
        /// </summary>
        public string NoSatisfiedKey => "2";

        /// <summary>
        /// 不满意率
        /// </summary>
        public double NoSatisfiedRate => CalcNoSatisfiedRate();


        public double CalcNoSatisfiedRate()
        {
            if (NoSatisfiedCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((NoSatisfiedCount / (double)TotalSumCount) * 100, 2);
        }
        public string NoSatisfiedRateText => NoSatisfiedRate + "%";


        /// <summary>
        /// 未做评价数
        /// </summary>
        public int NoEvaluateCount { get; set; }

        /// <summary>
        /// 未做评价Key
        /// </summary>
        public string NoEvaluateKey => "7";

        /// <summary>
        /// 未做评价率
        /// </summary>
        public double NoEvaluateRate => CalcNoEvaluateRate();


        public double CalcNoEvaluateRate()
        {
            if (NoEvaluateCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((NoEvaluateCount / (double)TotalSumCount) * 100, 2);
        }

        public string NoEvaluateRateText => NoEvaluateRate + "%";

        /// <summary>
        /// 未接通数
        /// </summary>
        public int NoPutThroughCount { get; set; }

        /// <summary>
        /// 未接通Key
        /// </summary>
        public string NoPutThroughKey => "6";

        /// <summary>
        /// 未接通率
        /// </summary>
        public double NoPutThroughRate => CalcNoPutThroughRate();


        public double CalcNoPutThroughRate()
        {
            if (NoPutThroughCount == 0 || TotalSumCount == 0)
            {
                return 0;
            }
            return Math.Round((NoPutThroughCount / (double)TotalSumCount) * 100, 2);
        }
        public string NoPutThroughRateText => NoPutThroughRate + "%";
    }
    public class OrderSourceHeaderVo
    {
        /// <summary>
        /// 日期
        /// </summary>
        public string? Time { get; set; }

        /// <summary>
        /// 日期(不显示)
        /// </summary>
        public string? TimeSort { get; set; }

        /// <summary>
        /// 小计
        /// </summary>
        public int? Subtotal => Phone + Web + Rests + Created + WeChat + App + WisdomYB + Platform + Platform12328 + MayorAndNetizens + MediaYB + Platform12345 + Interaction + ServiceYB + CityTransfer + Platform110 + NoService + Iyb;

        /// <summary>
        /// 电话
        /// </summary>
        public int? Phone { get; set; }

        /// <summary>
        /// 因特网
        /// </summary>
        public int? Web { get; set; }

        /// <summary>
        /// 其他
        /// </summary>
        public int? Rests { get; set; }

        /// <summary>
        /// 自建
        /// </summary>
        public int? Created { get; set; }

        /// <summary>
        /// 微信
        /// </summary>
        public int? WeChat { get; set; }

        /// <summary>
        /// APP
        /// </summary>
        public int? App { get; set; }

        /// <summary>
        /// 智慧宜宾
        /// </summary>
        public int? WisdomYB { get; set; }

        /// <summary>
        /// 综治平台
        /// </summary>
        public int? Platform { get; set; }

        /// <summary>
        /// 省12328平台
        /// </summary>
        public int? Platform12328 { get; set; }

        /// <summary>
        /// 市长和网民
        /// </summary>
        public int? MayorAndNetizens { get; set; }

        /// <summary>
        /// 宜宾融媒体
        /// </summary>
        public int? MediaYB { get; set; }

        /// <summary>
        /// 省12345平台
        /// </summary>
        public int? Platform12345 { get; set; }

        /// <summary>
        /// 省政民互动
        /// </summary>
        public int? Interaction { get; set; }

        /// <summary>
        /// 宜办事
        /// </summary>
        public int? ServiceYB { get; set; }

        /// <summary>
        /// 市州互转
        /// </summary>
        public int? CityTransfer { get; set; }

        /// <summary>
        /// 宜宾110平台
        /// </summary>
        public int? Platform110 { get; set; }

        /// <summary>
        /// 办不成事反映窗口
        /// </summary>
        public int? NoService { get; set; }

        // <summary>
        /// i宜宾
        /// </summary>
        public int? Iyb { get; set; }
    }


    public class OrderScreenApplyVo
    {
        /// <summary>
        /// 提起时间
        /// </summary>
        public string ApplyTime { get; set; }

        /// <summary>
        /// 提起人
        /// </summary>
        public string ApplyUserName { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        public string ApplyOrgName { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int ApplyNum { get; set; }
    }

    public class OrderScreenAuditVo
    {

        /// <summary>
        /// 审批人
        /// </summary>
        public string AuditName { get; set; }

        /// <summary>
        /// 节点名称
        /// </summary>
        public string StepName { get; set; }

        /// <summary>
        /// 审批数量
        /// </summary>
        public int AuditNum { get; set; }

        /// <summary>
        /// 审批不同意数量
        /// </summary>
        public int AuditNoNum { get; set; }

        /// <summary>
        /// 退回数量
        /// </summary>
        public int AuditBackNum { get; set; }

        /// <summary>
        /// 小计
        /// </summary>
        public int Total => AuditNum + AuditNoNum + AuditBackNum;
    }

    public class OrderCenterAcceptVo : OrderCenterBaseVo
    {
        /// <summary>
        /// 日期
        /// </summary>
        public string Time { get; set; }
    }

    public class OrderCenterAcceptUserVo : OrderCenterBaseVo
    {
        /// <summary>
        /// 值班坐席
        /// </summary>
        public string AcceptUserName { get; set; }
    }

    public class OrderCenterAcceptHourVo : OrderCenterBaseVo
    {
        /// <summary>
        /// 时间段
        /// </summary>
        public string Hour { get; set; }
    }

    public class OrderCenterBaseVo
    {
        /// <summary>
        /// 受理总件
        /// </summary>
        public int AcceptNum { get; set; }

        /// <summary>
        /// 有效件
        /// </summary>
        public int ValidNum { get; set; }

        /// <summary>
        /// 重复件
        /// </summary>
        public int RepetitionNum { get; set; }

        /// <summary>
        /// 无效件
        /// </summary>
        public int InvalidNum { get; set; }

        /// <summary>
        /// 已办件
        /// </summary>
        public int HandleNum { get; set; }

        /// <summary>
        /// 待办件
        /// </summary>
        public int NoHandleNum { get; set; }

        /// <summary>
        /// 退回件
        /// </summary>
        public int BackNum { get; set; }

        /// <summary>
        /// 值班坐席
        /// </summary>
        public int DutyDeskNum { get; set; }
    }

    public class ExtendedSendBackVo
    {

        /// <summary>
        /// 部门Id
        /// </summary>
        public string OrgId { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        public string OrgName { get; set; }

        /// <summary>
        /// 总量
        /// </summary>
        public int TotalNum { get; set; }

        /// <summary>
        /// 通过量
        /// </summary>
        public int PassNum { get; set; }


        /// <summary>
        /// 不通过量
        /// </summary>
        public int NoPassNum { get; set; }

        /// <summary>
        /// 不通过量
        /// </summary>
        public int AuditNum { get; set; }
    }

    public class OnlineMassLineReportRes
    {

        /// <summary>
        /// 受理渠道
        /// </summary>
        public string SourceChannel { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int SumCount { get; set; }

        /// <summary>
        /// 上期数量
        /// </summary>
        public int PreviousCount { get; set; }

        /// <summary>
        /// 环比
        /// </summary>
        public double Chain => PreviousCount == 0 ? 0 : Math.Round((SumCount / (double)PreviousCount) * 100, 2);
    }

    public class AreaSubordinateReportRes
    {
        /// <summary>
        /// 区域名称
        /// </summary>
        public string AreaName { get; set; }

        /// <summary>
        /// 分类统计
        /// </summary>
        public int SumCount { get; set; }
    }

    public class OrgSendBackAuditListVo
    {
        public string OrgId { get; set; }

        public string OrgName { get; set; }

        public int Num { get; set; }
    }

    public class SeatSendBackStatisticsVo
    {
        /// <summary>
        /// 用户Id
        /// </summary>
        public string UserId { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 派单件总量件数
        /// </summary>
        public int SendOrderNum { get; set; }

        /// <summary>
        /// 派单件退办总量件数
        /// </summary>
        public int SendOrderBackNum { get; set; }

        public string SendOrderBackRate => GetSendOrderBackRate();
        public string GetSendOrderBackRate()
        {
            if (SendOrderNum == 0 || SendOrderBackNum == 0)
            {
                return "0.000%";
            }
            return Math.Round((SendOrderBackNum / (double)SendOrderNum) * 100, 2) + "%";
        }
        /// <summary>
        /// 派单件退办总量次数
        /// </summary>
        public int SendOrderBackNumber { get; set; }

        /// <summary>
        /// 中心归档件总量
        /// </summary>
        public int CentreFileNum { get; set; }

        /// <summary>
        /// 中心归档件退回件数
        /// </summary>
        public int CentreFileBackNum { get; set; }

        public string CentreFileBackRate => GetCentreFileBackRate();
        public string GetCentreFileBackRate()
        {
            if (CentreFileNum == 0 || CentreFileBackNum == 0)
            {
                return "0.000%";
            }
            return Math.Round((CentreFileBackNum / (double)CentreFileNum) * 100, 2) + "%";
        }
        /// <summary>
        /// 中心归档件退回次数
        /// </summary>
        public int CentreFileBackNumber { get; set; }
    }
}
