import { tableColumnsWidObj } from "@/constant";
import { formatMoneyNumber, formatToPercentage } from "@/utils/format";
import { createFromIconfontCN } from "@ant-design/icons";
import { ProColumns } from "@ant-design/pro-components";
import { Popover } from 'antd'
import React from "react";

const IconFont = createFromIconfontCN({
    scriptUrl: '',
});


export const unitPersonnelCostCalc: ProColumns[] = [
    {
        title: '人事分类名称',
        dataIndex: 'name',
    },
    {
        title: '实际编制人数',
        dataIndex: 'empNum',
    },
    {
        title: '实际总工时',
        dataIndex: 'actualHour',
    },
    {
        title: '预计总工时',
        dataIndex: 'expectHour',
    },
    {
        title: '总成本',
        dataIndex: 'totalCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '人均成本',
        dataIndex: 'avgCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '每分钟成本',
        dataIndex: 'minuteCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
];


export const chargeItemCostCalc: ProColumns[] = [
    {
        title: '收费项目编码',
        dataIndex: 'code',
    },
    {
        title: '收费项目名称',
        dataIndex: 'name',
        width: '20%'
    },
    {
        title: '项目类别',
        dataIndex: 'itemType',
    },
    {
        title: '药品收入',
        dataIndex: 'drugIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料收入',
        dataIndex: 'materialIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目收入',
        dataIndex: 'itemIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品成本',
        dataIndex: 'drugCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料成本',
        dataIndex: 'materialCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目成本',
        dataIndex: 'itemCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '人力成本',
        dataIndex: 'empCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '设备成本',
        dataIndex: 'equipmentCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '空间成本',
        dataIndex: 'spaceCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
];


export const patientCostCalc: ProColumns[] = [
    {
        title: '住院号/门诊号',
        dataIndex: 'visitNo',
    },
    {
        title: '病人ID',
        dataIndex: 'patientNo',
    },
    {
        title: '患者姓名',
        dataIndex: 'name',
    },
    {
        title: '科室代码',
        dataIndex: 'departmentCode',
    },
    {
        title: '科室名称',
        dataIndex: 'departmentName',
    },
    {
        title: '人力成本',
        dataIndex: 'empCost',
        align:'right',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '设备成本',
        align:'right',
        dataIndex: 'equipmentCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '空间成本',
        align:'right',
        dataIndex: 'spaceCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目成本',
        align:'right',
        dataIndex: 'itemCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品成本',
        align:'right',
        dataIndex: 'drugCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料成本',
        align:'right',
        dataIndex: 'materialCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目收入',
        align:'right',
        dataIndex: 'itemIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品收入',
        align:'right',
        dataIndex: 'drugIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料收入',
        align:'right',
        dataIndex: 'materialIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },

    },
];


export const diseaseCostCalculation: ProColumns[] = [
    {
        title: '病种代码',
        dataIndex: 'code',
    },
    {
        title: '病种名称',
        dataIndex: 'name',
    },
    {
        title: '科室代码',
        dataIndex: 'departmentCode',
    },
    {
        title: '科室名称',
        dataIndex: 'departmentName',
    },
    {
        title: '人力成本',
        dataIndex: 'empCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '设备成本',
        dataIndex: 'equipmentCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '空间成本',
        dataIndex: 'spaceCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目成本',
        dataIndex: 'itemCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品成本',
        dataIndex: 'drugCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料成本',
        dataIndex: 'materialCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目收入',
        dataIndex: 'itemIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品收入',
        dataIndex: 'drugIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料收入',
        dataIndex: 'materialIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    }
];

export const DRG_DIPCostCalc: ProColumns[] = [
    {
        title: '分组代码',
        dataIndex: 'code',
    },
    {
        title: '分组名称',
        width: '18%',
        dataIndex: 'name',
    },
    {
        title: '科室代码',
        dataIndex: 'departmentCode',
    },
    {
        title: '科室名称',
        dataIndex: 'departmentName',
    },
    {
        title: '人力成本',
        dataIndex: 'empCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '设备成本',
        dataIndex: 'equipmentCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '空间成本',
        dataIndex: 'spaceCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目成本',
        dataIndex: 'itemCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品成本',
        dataIndex: 'drugCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料成本',
        dataIndex: 'materialCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目收入',
        dataIndex: 'itemIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品收入',
        dataIndex: 'drugIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料收入',
        dataIndex: 'materialIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    }
];
export const clinicalPathway: ProColumns[] = [
    {
        title: '路径代码',
        dataIndex: 'code',
    },
    {
        title: '路径名称',
        width: '20%',
        dataIndex: 'name',
    },
    {
        title: '科室代码',
        dataIndex: 'departmentCode',
    },
    {
        title: '科室名称',
        dataIndex: 'departmentName',
    },
    {
        title: '人力成本',
        dataIndex: 'empCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '设备成本',
        dataIndex: 'equipmentCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '空间成本',
        dataIndex: 'spaceCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目成本',
        dataIndex: 'itemCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品成本',
        dataIndex: 'drugCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料成本',
        dataIndex: 'materialCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目收入',
        dataIndex: 'itemIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品收入',
        dataIndex: 'drugIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料收入',
        dataIndex: 'materialIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    }
];

export const medicalOrderItem: ProColumns[] = [
    {
        title: '医嘱项目编码',
        dataIndex: 'code',
    },
    {
        title: '医嘱项目名称',
        dataIndex: 'name',
        width: '18%'
    },
    {
        title: '科室代码',
        dataIndex: 'departmentCode',
    },
    {
        title: '科室名称',
        dataIndex: 'departmentName',
    },

    {
        title: '项目成本',
        dataIndex: 'itemCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品成本',
        dataIndex: 'drugCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料成本',
        dataIndex: 'materialCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '项目收入',
        dataIndex: 'itemIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品收入',
        dataIndex: 'drugIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料收入',
        dataIndex: 'materialIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '人力成本',
        dataIndex: 'empCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '设备成本',
        dataIndex: 'equipmentCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '空间成本',
        dataIndex: 'spaceCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
];

export const medicalMaterialCostCalc: ProColumns[] = [
    {
        title: '责任中心代码',
        dataIndex: 'responsibilityCode',
    },
    {
        title: '责任中心名称',
        dataIndex: 'responsibilityName',
        width: '10%'
    },
    {
        title: '收费项目编码',
        dataIndex: 'code',
    },
    {
        title: '收费项目名称',
        dataIndex: 'name',
        width: '30%'
    },

    {
        title: '项目类别',
        dataIndex: 'itemType',
    },
    {
        title: '药品收入',
        align:'right',
        dataIndex: 'drugIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料收入',
        align:'right',
        dataIndex: 'materialIncome',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '药品成本',
        dataIndex: 'drugCost',
        align:'right',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '材料成本',
        align:'right',
        dataIndex: 'materialCost',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },

];
export const beforeCollectionSearch: ProColumns[] = [
    {
        title: '收入项目',
        dataIndex: 'productCodeName',
    },
    {
        title: '会计科目',
        dataIndex: 'accountCodeName',
    },
    {
        title: '金额(元)',
        dataIndex: 'amount',
        width: 130,
        align:'center',
        renderText(num, record, index, action) {
            return <div style={{paddingRight:30,textAlign:'right'}}>{formatMoneyNumber(num)}</div>
        }
    },
    {
        title: '开单科室',
        dataIndex: 'openDepartmentCodeName',

    },
    {
        title: '开单责任中心',
        dataIndex: 'openResponsibilityCodeName',
    },

    {
        title: '执行科室',
        dataIndex: 'startDepartmentCodeName',
    },
    {
        title: '执行责任中心',
        dataIndex: 'startResponsibilityCodeName',
    },
];

export const incomeCollection: ProColumns[] = [
    {
        title: '年份',
        dataIndex: 'year',
    },
    {
        title: '月份',
        dataIndex: 'month',
    },
    {
        title: '金额',
        dataIndex: 'amount',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },

];
export const afterCollectionSearch: ProColumns[] = [
    {
        title: '年份',
        dataIndex: 'year',
        width: tableColumnsWidObj.year
    },
    {
        title: '月份',
        dataIndex: 'month',
        width: tableColumnsWidObj.month
    },
    {
        title: '科室编码',
        dataIndex: 'departmentCode',
    },
    {
        title: '科室名称',
        width: tableColumnsWidObj.departmentName,
        dataIndex: 'departmentName',
    },
    {
        title: '责任中心编码',
        width: tableColumnsWidObj.responsibilityCenterCode,
        dataIndex: 'responsibilityCode',
    },
    {
        title: '责任中心名称',
        width: tableColumnsWidObj.responsibilityCenter,
        dataIndex: 'responsibilityName',
    },
    {
        title: '会计科目编码',
        dataIndex: 'accountingCode',
    },
    {
        title: '会计科目名',
        dataIndex: 'accountingName',
    },
    {
        title: '成本项目编码',
        dataIndex: 'productCode',
    },
    {
        title: '成本项目名',
        dataIndex: 'productName',
    },
    {
        title: '金额',
        dataIndex: 'amount',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },

];

export const beforeCostShareSearch: ProColumns[] = [
    {
        title: '成本项目',
        width: '20%',
        dataIndex: 'productName',
        renderText(num, record, index, action) {
            const { productCode, productName } = record;
            return `[${productCode}]${productName}`
        },
    },
    {
        title: '会计科目',
        width: '20%',
        dataIndex: 'accountName',
        renderText(num, record, index, action) {
            const { accountCode, accountName } = record;
            return `[${accountCode}]${accountName}`
        },
    },
    {
        title: '金额(元)',
        width: '20%',
        align:'center',
        dataIndex: 'amount',
        renderText(num, record, index, action) {
            return <div style={{textAlign:'right',paddingRight:'30%'}}>{formatMoneyNumber(num)}</div>
        },
    },
    {
        title: '科室名称',
        width: '20%',
        dataIndex: 'departName',
        renderText(num, record, index, action) {
            const { departCode, departName } = record;
            return `[${departCode}]${departName}`
        },
    },
    {
        title: '责任中心名',
        dataIndex: 'responsibilityName',
        width: '20%',
        renderText(num, record, index, action) {
            const { responsibilityCode, responsibilityName } = record;
            return `[${responsibilityCode}]${responsibilityName}`
        },
    },
];

export const costShare: ProColumns[] = [
    {
        title: '年份',
        align:'left',
        dataIndex: 'year',
    },
    {
        title: '月份',
        align:'center',
        dataIndex: 'month',
    },
    {
        title: '金额',
        align:'right',
        dataIndex: 'amount',
        renderText(num, record, index, action) {
            return <div style={{textAlign:'right'}}>{formatMoneyNumber(num)}</div>
        },
    },
    {
        title: '是否分摊',
        align:'right',
        dataIndex: 'isAllocation',
        render: bool => bool ? '已分摊' : '未分摊'
    },

];

export const afterCostShareSearch: ProColumns[] = [
    // {
    //     title: '年份',
    //     dataIndex: 'dateYear',
    //     width: tableColumnsWidObj.year
    // },
    // {
    //     title: '月份',
    //     dataIndex: 'dateMonth',
    //     width: tableColumnsWidObj.month
    // },
    {
        width:90,
        title: '分摊层级',
        dataIndex: 'levelSort',
    },
    {
        title: '分摊层级名',
        dataIndex: 'levelName',
    },
    {
        title: '责任中心编码',
        width: tableColumnsWidObj.responsibilityCenterCode,
        dataIndex: 'responsibilityCode',
    },
    {
        title: '责任中心名',
        width: tableColumnsWidObj.responsibilityCenter,
        dataIndex: 'responsibilityName',
    },
    {
        title: '会计科目编码',
        dataIndex: 'accountingCode',
    },
    {
        title: '会计科目名',
        width:220,
        dataIndex: 'accountingName',
    },
    {
        title: '金额',
        dataIndex: 'amount',
        align:'right',
        renderText(num, record, index, action) {
            const { decimalPlace, permil } = record;
            const shouldUseThousandSeparator = permil === 1;
            return formatMoneyNumber(num, { decimalPlaces: decimalPlace, useThousandSeparator: shouldUseThousandSeparator });
        },
    },

];

export const departmentCostCalculate: ProColumns[] = [
    {
        title: '责任中心',
        dataIndex: 'responsibilityCode',

    },
    {
        title: '年份',
        dataIndex: 'year',

    },
    {
        title: '月份',
        dataIndex: 'month',

    },
    {
        title: '报表项目编码',
        width: '10%',
        dataIndex: 'reportNum',
    },
    {
        title: '报表项目名',
        dataIndex: 'reportName',
    },
    {
        title: '责任中心名',
        dataIndex: 'responsibilityName',
    },
    {
        title: '责任中心编码',
        dataIndex: 'responsibilityCode',

    },
    {
        title: '金额',
        width: '10%',
        dataIndex: 'amount',
        renderText(num, record, index, action) {
            return formatMoneyNumber(num);
        },
    },
    {
        title: '占比',
        dataIndex: 'percentName',
    },

];
export const wholeHospCostCalculate: ProColumns[] = [
    {
        title: '报表项目',
        dataIndex: 'reportName',
        renderText(text, record, index, action) {
            const { description } = record;
            return description ? <Popover content={()=><div dangerouslySetInnerHTML={{__html:description}} />}><span style={{ cursor: 'pointer' }}>{text}</span><IconFont className="hover-icon" style={{ fontSize: 16, color: '#17181a', paddingLeft: 4, position: 'relative', top: 1 }} type={'iconshuoming'} /></Popover> : text
        },
    },
    {
        title: '金额',
        width:200,
        align:'right',
        dataIndex: 'amount',
        renderText(num, record, index, action) {
            const { decimalPlace, permil, dataType, children, calcType } = record;
            // 有 children 且 calcType 为 0 时返回空
            if (children && children.length > 0 && calcType === '0') {
                return <React.Fragment></React.Fragment>;
            }
            
            // 根据 dataType 处理数据
            if (dataType === 2) {
                // 百分比类型
                if (typeof num === 'number' && !isNaN(num)) {
                    return `${(num * 100).toFixed(decimalPlace || 2)}%`;
                }
                return num;
            } else {
                // 数值类型
                const formatOptions = {
                    decimalPlaces: decimalPlace !== undefined ? decimalPlace : 2,
                    useThousandSeparator: permil === 1
                };
                return formatMoneyNumber(num, formatOptions);
            }
        },
    },
    {
        title: '占比',
        width:100,
        align:'right',
        dataIndex: 'percent',
        renderText(num, record) {
            const { children, calcType } = record;
            // 有 children 时返回 null，否则格式化百分比
            return (children && children.length > 0 && calcType == '0') ? <React.Fragment></React.Fragment> : formatToPercentage(num);
        },
    },

    // {
    //     title: '说明',
    //     dataIndex: 'description',
    //     renderText(text,record) {
    //         const {children} = record;
    //         return (children&&children.length>0)?<React.Fragment></React.Fragment>:text;
    //     },
    // },

];

export const costShareReportTable: ProColumns[] = [
    {
        title: '年份',
        dataIndex: 'year',
    },
    {
        title: '月份',
        dataIndex: 'month',
    },
    {
        title: '分摊报表名称',
        dataIndex: 'shareReportName',
    },
    {
        title: '分摊层级',
        dataIndex: 'shareLevel',
    },
    {
        title: '分摊时间',
        dataIndex: 'shareTime',
    },
];

// 医院科室直接成本表（医疗成本）
export const deptDirectMedicalCost: ProColumns[] = [
    {
        title: '科室名称',
        dataIndex: 'responsibilityName',
        width: 180,
        fixed: 'left' as any,
    },
    {
        title: '人员经费(1)',
        dataIndex: 'personnelExpense',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '卫生材料费(2)',
        dataIndex: 'healthMaterialFee',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '药品费(3)',
        dataIndex: 'drugFee',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '固定资产折旧费(4)',
        dataIndex: 'fixedAssetDepreciation',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '无形资产摊销费(5)',
        dataIndex: 'intangibleAssetAmortization',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '提取医疗风险基金(6)',
        dataIndex: 'medicalRiskFundExtraction',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '其他医疗费用(7)',
        dataIndex: 'otherMedicalExpenses',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '合计(8)=(1)+(2)+(3)+(4)+(5)+(6)+(7)',
        dataIndex: 'total',
        width: 220,
        fixed: 'right' as any,
        align: 'right',
        renderText(num, record) {
            const { decimalPlace, permil } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true });
        },
    },
];

// 医院科室直接成本表（全成本）
export const deptFullDirectCost: ProColumns[] = [
    {
        title: '科室名称',
        dataIndex: 'responsibilityName',
        width: 180,
        fixed: 'left' as any,
    },
    {
        title: '医疗成本合计(1)',
        dataIndex: 'medicalCostTotal',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '财政项目拨款经费形成的各项费用(2)',
        dataIndex: 'financialProjectFunds',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '非同级财政拨款项目经费形成的各项费用(3)',
        dataIndex: 'nonPeerFinancialFunds',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '医疗全成本合计(4)=(1)+(2)+(3)',
        dataIndex: 'medicalTotalCost',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '科教经费形成的各项费用(5)',
        dataIndex: 'educationalExpenses',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '资产处置费用、上缴上级费用、对附属单位补助费用、其他费用等(6)',
        dataIndex: 'assetDisposalFees',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '医院全成本(7)=(4)+(5)+(6)',
        dataIndex: 'hospitalTotalCost',
        width: 240,
        fixed: 'right' as any,
        align: 'right',
        renderText(num, record) {
            const { decimalPlace, permil } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true });
        },
    },
];

// 医院科室成本分摊汇总表
export const deptCostAllocationSummary: ProColumns[] = [
    {
        title: '科室名称',
        dataIndex: 'responsibilityName',
        width: 180,
        fixed: 'left' as any,
    },
    {
        title: '医疗成本(1)=(2)+(3)',
        dataIndex: 'medicalCost',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '直接成本(2)',
        dataIndex: 'directCost',
        align: 'right',
        renderText(num, record) {
            const { decimalPlace } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: true });
        },
    },
    {
        title: '间接成本',
        children: [
            { title: '小计(3)=(4)+(5)+(6)', dataIndex: 'subtotal', align: 'right', renderText: (n: any, r: any) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '行政后勤分摊(4)', dataIndex: 'allocatedAdminCost', align: 'right', renderText: (n: any, r: any) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '医疗辅助分摊(5)', dataIndex: 'allocatedSupportCost', align: 'right', renderText: (n: any, r: any) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '医疗技术分摊(6)', dataIndex: 'allocatedTechCost', align: 'right', renderText: (n: any, r: any) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
];

// 医院诊次成本构成表
export const hospitalVisitCostComposition: ProColumns[] = [
    {
        title: '成本项目',
        dataIndex: 'costItem',
        width: 220,
        fixed: 'left' as any,
    },
    {
        title: '每诊次成本',
        children: [
            {
                title: '医疗成本',
                dataIndex: 'medicalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医疗全成本',
                dataIndex: 'medicalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医院全成本',
                dataIndex: 'hospitalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
];

// 医院科室诊次成本表
export const hospitalDeptVisitCost: ProColumns[] = [
    {
        title: '科室编码',
        dataIndex: 'responsibilityCode',
        width: 140,
        fixed: 'left' as any,
    },
    {
        title: '科室名称',
        dataIndex: 'responsibilityName',
        width: 180,
        fixed: 'left' as any,
    },
    {
        title: '每诊次成本',
        children: [
            {
                title: '服务量',
                dataIndex: 'serviceCount',
                align: 'right',
            },
            {
                title: '医疗成本',
                dataIndex: 'medicalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医疗全成本',
                dataIndex: 'medicalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医院全成本',
                dataIndex: 'hospitalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
];

// 医院床日成本构成表
export const hospitalBedDayCostComposition: ProColumns[] = [
    {
        title: '成本项目',
        dataIndex: 'costItem',
        width: 220,
        fixed: 'left' as any,
    },
    {
        title: '每床日成本',
        children: [
            {
                title: '医疗成本',
                dataIndex: 'medicalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医疗全成本',
                dataIndex: 'medicalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医院全成本',
                dataIndex: 'hospitalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
];

// 医院医疗服务项目成本汇总表
export const hospitalServiceProjectCost: ProColumns[] = [
    {
        title: '成本项目',
        dataIndex: 'itemName',
        width: 260,
        fixed: 'left' as any,
        renderText: (_: any, record: any) => {
            const { itemCode, itemName } = record || {};
            return itemCode ? `[${itemCode}]${itemName || ''}` : (itemName || '');
        },
    },
    {
        title: '医疗成本',
        dataIndex: 'medicalCost',
        align: 'right',
        renderText(num: any, record: any) {
            const { decimalPlace, permil } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
        },
    },
    {
        title: '医疗全成本',
        dataIndex: 'medicalFullCost',
        align: 'right',
        renderText(num: any, record: any) {
            const { decimalPlace, permil } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
        },
    },
    {
        title: '医院全成本',
        dataIndex: 'hospitalFullCost',
        align: 'right',
        renderText(num: any, record: any) {
            const { decimalPlace, permil } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
        },
    },
];

// 医院医疗服务项目成本明细表
export const medicalServiceCostDetail: ProColumns[] = [
    {
        title: '项目编码',
        dataIndex: 'itemCode',
        width: 140,
        fixed: 'left' as any,
    },
    {
        title: '项目名称',
        dataIndex: 'itemName',
        width: 220,
        fixed: 'left' as any,
    },
    {
        title: '服务量',
        dataIndex: 'serviceVolume',
        align: 'right',
    },
    {
        title: '每项目成本',
        children: [
            {
                title: '医疗成本',
                dataIndex: 'medicalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医疗全成本',
                dataIndex: 'medicalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医院全成本',
                dataIndex: 'hospitalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
];

// 医院病种成本构成明细表
export const diseaseCostCompositionDetail: ProColumns[] = [
    {
        title: '病种编码',
        dataIndex: 'itemCode',
        width: 140,
        fixed: 'left' as any,
    },
    {
        title: '病种名称',
        dataIndex: 'itemName',
        width: 220,
        fixed: 'left' as any,
    },
    {
        title: '病种成本',
        children: [
            {
                title: '金额',
                dataIndex: 'totalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
    {
        title: '人员经费',
        children: [
            {
                title: '金额',
                dataIndex: 'personnelExpense',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'personnelExpenseRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '卫生材料费',
        children: [
            {
                title: '金额',
                dataIndex: 'medicalMaterialExpense',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'medicalMaterialExpenseRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '药品费',
        children: [
            {
                title: '金额',
                dataIndex: 'drugExpense',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'drugExpenseRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '固定资产折旧费',
        children: [
            {
                title: '金额',
                dataIndex: 'fixedAssetDepreciation',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'fixedAssetDepreciationRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '无形资产摊销费',
        children: [
            {
                title: '金额',
                dataIndex: 'intangibleAssetAmortization',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'intangibleAssetAmortizationRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '提取医疗风险基金',
        children: [
            {
                title: '金额',
                dataIndex: 'medicalRiskFund',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'medicalRiskFundRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '其他医疗费用',
        children: [
            {
                title: '金额',
                dataIndex: 'otherMedicalExpenses',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'otherMedicalExpensesRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
];

// 医院病种成本明细表
export const diseaseCostDetail: ProColumns[] = [
    {
        title: '病种编码',
        dataIndex: 'itemCode',
        width: 140,
        fixed: 'left' as any,
    },
    {
        title: '病种名称',
        dataIndex: 'itemName',
        width: 220,
        fixed: 'left' as any,
    },
    {
        title: '服务量',
        dataIndex: 'serviceVolume',
        align: 'right',
    },
    {
        title: '每病种成本',
        children: [
            {
                title: '医疗成本',
                dataIndex: 'medicalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医疗全成本',
                dataIndex: 'medicalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医院全成本',
                dataIndex: 'hospitalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
];

// 医院DRG成本明细表
export const drgCostDetail: ProColumns[] = [
    {
        title: 'DRG编码',
        dataIndex: 'itemCode',
        width: 140,
        fixed: 'left' as any,
    },
    {
        title: 'DRG名称',
        dataIndex: 'itemName',
        width: 320,
        fixed: 'left' as any,
    },
    {
        title: '服务量',
        dataIndex: 'serviceVolume',
        align: 'right',
    },
    {
        title: '每DRG成本',
        children: [
            {
                title: '医疗成本',
                dataIndex: 'medicalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医疗全成本',
                dataIndex: 'medicalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医院全成本',
                dataIndex: 'hospitalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
];

// 医院DRG成本构成明细表
export const drgCostCompositionDetail: ProColumns[] = [
    {
        title: 'DRG编码',
        dataIndex: 'itemCode',
        width: 140,
        fixed: 'left' as any,
    },
    {
        title: 'DRG名称',
        dataIndex: 'itemName',
        width: 320,
        fixed: 'left' as any,
    },
    {
        title: '病种成本',
        dataIndex: 'totalCost',
        align: 'right',
        renderText(num: any, record: any) {
            const { decimalPlace, permil } = record || {};
            return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
        },
    },
    {
        title: '人员经费',
        children: [
            {
                title: '金额',
                dataIndex: 'personnelExpense',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'personnelExpenseRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '卫生材料费',
        children: [
            {
                title: '金额',
                dataIndex: 'medicalMaterialExpense',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'medicalMaterialExpenseRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '药品费',
        children: [
            {
                title: '金额',
                dataIndex: 'drugExpense',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'drugExpenseRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '固定资产折旧费',
        children: [
            {
                title: '金额',
                dataIndex: 'fixedAssetDepreciation',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'fixedAssetDepreciationRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '无形资产摊销费',
        children: [
            {
                title: '金额',
                dataIndex: 'intangibleAssetAmortization',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'intangibleAssetAmortizationRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '提取医疗风险基金',
        children: [
            {
                title: '金额',
                dataIndex: 'medicalRiskFund',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'medicalRiskFundRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
    {
        title: '其他医疗费用',
        children: [
            {
                title: '金额',
                dataIndex: 'otherMedicalExpenses',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '占比',
                dataIndex: 'otherMedicalExpensesRatio',
                align: 'right',
                renderText: (n: any) => formatToPercentage(n),
            },
        ] as any,
    },
];

// 医院科室床日成本表
export const hospitalDeptBedDayCost: ProColumns[] = [
    {
        title: '科室编码',
        dataIndex: 'responsibilityCode',
        width: 140,
        fixed: 'left' as any,
    },
    {
        title: '科室名称',
        dataIndex: 'responsibilityName',
        width: 180,
        fixed: 'left' as any,
    },
    {
        title: '服务量',
        dataIndex: 'serviceCount',
        align: 'right',
    },
    {
        title: '每床日成本',
        children: [
            {
                title: '医疗成本',
                dataIndex: 'medicalCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医疗全成本',
                dataIndex: 'medicalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
            {
                title: '医院全成本',
                dataIndex: 'hospitalFullCost',
                align: 'right',
                renderText(num: any, record: any) {
                    const { decimalPlace, permil } = record || {};
                    return formatMoneyNumber(num, { decimalPlaces: (typeof decimalPlace === 'number') ? decimalPlace : 2, useThousandSeparator: permil === 1 || permil === true || true });
                },
            },
        ] as any,
    },
];

// 临床服务类科室全成本（医疗成本）
export const clinicalDeptMedicalCost: ProColumns[] = [
    {
        title: '科室名称',
        dataIndex: 'responsibilityName',
        width: 180,
        fixed: 'left' as any,
    },
    {
        title: '人员经费(1)',
        children: [
            { title: '直接成本', dataIndex: 'personnelDirectCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'personnelIndirectCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'personnelTotalCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '卫生材料费(2)',
        children: [
            { title: '直接成本', dataIndex: 'healthMaterialDirectCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'healthMaterialIndirectCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'healthMaterialTotalCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '药品费(3)',
        children: [
            { title: '直接成本', dataIndex: 'medicineDirectCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'medicineIndirectCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'medicineTotalCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '固定资产折旧费(4)',
        children: [
            { title: '直接成本', dataIndex: 'fixedAssetDepreciationDirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'fixedAssetDepreciationIndirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'fixedAssetDepreciationTotal', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '无形资产摊销费(5)',
        children: [
            { title: '直接成本', dataIndex: 'intangibleAssetAmortizationDirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'intangibleAssetAmortizationIndirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'intangibleAssetAmortizationTotal', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '提取医疗风险基金(6)',
        children: [
            { title: '直接成本', dataIndex: 'medicalRiskReserveDirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'medicalRiskReserveIndirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'medicalRiskReserveTotalCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '其他医疗费用(7)',
        children: [
            { title: '直接成本', dataIndex: 'otherMedicalExpensesDirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'otherMedicalExpensesIndirect', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'otherMedicalExpensesTotalCost', align: 'right', renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '合计(8)=(1)+(2)+(3)+(4)+(5)+(6)+(7)',
        children: [
            { title: '直接成本', dataIndex: 'totalDirectCost', align: 'right', width: 130, fixed: 'right' as any, renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'totalIndirectCost', align: 'right', width: 130, fixed: 'right' as any, renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'totalCost', align: 'right', width: 150, fixed: 'right' as any, renderText: (n: string | number | null | undefined, r: { decimalPlace: number | undefined; }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
];

// 临床服务类科室全成本（全成本）
export const clinicalDeptFullCost: ProColumns[] = [
    {
        title: '科室名称',
        dataIndex: 'responsibilityName',
        width: 180,
        fixed: 'left' as any,
    },
    {
        title: '医疗成本合计(1)',
        children: [
            { title: '直接成本', dataIndex: 'medicalCostTotalDirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'medicalCostTotalIndirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'medicalCostTotal', align: 'right', width: 150, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '财政项目拨款经费形成的各项费用(2)',
        children: [
            { title: '直接成本', dataIndex: 'financialProjectFundsDirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'financialProjectFundsIndirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'financialProjectFunds', align: 'right', width: 150, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '费统计财政拨款项目经费形成的各项费用(3)',
        children: [
            { title: '直接成本', dataIndex: 'nonPeerFinancialFundsDirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'nonPeerFinancialFundsIndirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'nonPeerFinancialFunds', align: 'right', width: 150, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '医疗全成本合计(4)=(1)+(2)+(3)',
        children: [
            { title: '直接成本', dataIndex: 'medicalTotalCostDirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'medicalTotalCostIndirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'medicalTotalCost', align: 'right', width: 150, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '科教经费形成的各项费用(5)',
        children: [
            { title: '直接成本', dataIndex: 'educationalExpensesDirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'educationalExpensesIndirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'educationalExpenses', align: 'right', width: 150, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '资产处置费、上缴上级费用、对附属单位补助费用、其他费用等(6)',
        children: [
            { title: '直接成本', dataIndex: 'assetDisposalFeesDirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'assetDisposalFeesIndirect', align: 'right', width: 130, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'assetDisposalFees', align: 'right', width: 150, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
    {
        title: '医院全成本(7)=(4)+(5)+(6)',
        children: [
            { title: '直接成本', dataIndex: 'hospitalTotalCostDirect', align: 'right', width: 130, fixed: 'right' as any, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '间接成本', dataIndex: 'hospitalTotalCostIndirect', align: 'right', width: 130, fixed: 'right' as any, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
            { title: '全成本', dataIndex: 'hospitalTotalCost', align: 'right', width: 160, fixed: 'right' as any, renderText: (n: string | number | null | undefined, r: { decimalPlace?: number }) => formatMoneyNumber(n, { decimalPlaces: (typeof r?.decimalPlace === 'number') ? r.decimalPlace : 2, useThousandSeparator: true }) },
        ] as any,
    },
];

export const departmentOperatingReport: ProColumns[] = [
    {
        title: '年份',
        width: 100,
        dataIndex: 'dateYear',
    },
    {
        title: '月份',
        width: 100,
        dataIndex: 'dateMonth',
    },
    {
        title: '报表类型',
        width: 100,
        dataIndex: 'fileType',
    },
    {
        title: '报表名称',
        dataIndex: 'fileName',
    },
    {
        title: '更新时间',
        width: 180,
        dataIndex: 'updateTime',
    },
];
export const wholeHospOperatingReport: ProColumns[] = [
    {
        title: '年份',
        width: 100,
        dataIndex: 'dateYear',
    },
    {
        title: '月份',
        width: 100,
        dataIndex: 'dateMonth',
    },
    {
        title: '报表类型',
        width: 120,
        dataIndex: 'fileType',
    },
    {
        title: '报表名称',
        dataIndex: 'fileName',
    }
];

export const projectShareParamsCalc: ProColumns[] = [];
// export const projectCostCalc: ProColumns[] = [
//     {
//         title: '责任中心编码',
//         dataIndex: 'responsibilityCode',
//         width:tableColumnsWidObj.responsibilityCenterCode
//     },
//     {
//         title: '责任中心名称',
//         dataIndex: 'responsibilityName',
//         width:tableColumnsWidObj.responsibilityCenter
//     },
//     {
//         title: '收费项目编码',
//         dataIndex: 'code',
//     },
//     {
//         title: '收费项目名称',
//         dataIndex: 'name',
//     },
//     {
//         title: '项目分类',
//         dataIndex: 'itemTypeName',
//     },
//     {
//         title: '项目成本',
//         dataIndex: 'itemCost',
//     },
//     {
//         title: '人事成本',
//         dataIndex: 'empCost',
//     },
//     {
//         title: '设备成本',
//         dataIndex: 'equipmentCost',
//     },
//     {
//         title: '空间成本',
//         dataIndex: 'spaceCost',
//     },
//     {
//         title: '公共费用分摊',
//         dataIndex: 'publicShareCost',
//     },
//     {
//         title: '管理费用分摊',
//         dataIndex: 'managerShareCost',
//     }
// ];