|
|
@@ -95,6 +95,7 @@ export default function calcPageTemplate() {
|
|
|
const [filterConf, set_filterConf] = useState<any[]>([]);
|
|
|
const [scrollX, set_scrollX] = useState(500);
|
|
|
const [ifShowCalcBtn, set_ifShowCalcBtn] = useState(true);
|
|
|
+ const [ifShowExportBtn, set_ifShowExportBtn] = useState(false);
|
|
|
const [totalCount, set_totalCount] = useState<undefined | number>(undefined);
|
|
|
const [inputValues, setInputValues] = useState<{ [key: string]: any }>({});
|
|
|
const [pagePermissions, set_pagePermissions] = useState<Set<string>>(new Set());
|
|
|
@@ -108,6 +109,7 @@ export default function calcPageTemplate() {
|
|
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
|
const [openProcessModal, set_openProcessModal] = useState(false);
|
|
|
const [allParentsKeys, set_allParentsKeys] = useState<any[]>([]);
|
|
|
+ const [hospitalServiceProjectExpandedKeys, set_hospitalServiceProjectExpandedKeys] = useState<any[]>([]);
|
|
|
const [dataSource, set_dataSource] = useState<any[]>([]);
|
|
|
const exporter = useRef(createPagedExporter<{ [k: string]: any }>({
|
|
|
pageSize: 100,
|
|
|
@@ -155,26 +157,32 @@ export default function calcPageTemplate() {
|
|
|
const { departmentName, ...rest } = reqParams;
|
|
|
reqParams = rest;
|
|
|
}
|
|
|
- if (params.calcPageKey === 'deptCostAllocationSummary' && 'departmentName' in reqParams) {
|
|
|
- // deptCostAllocationSummary 仅前端检索
|
|
|
+ if (params.calcPageKey === 'hospitalDeptVisitCost' && 'departmentName' in reqParams) {
|
|
|
+ // hospitalDeptVisitCost 仅前端检索
|
|
|
const { departmentName, ...rest } = reqParams;
|
|
|
reqParams = rest;
|
|
|
}
|
|
|
- if (params.calcPageKey === 'diseaseCostDetail' && 'itemName' in reqParams) {
|
|
|
- // diseaseCostDetail 病种名称仅前端检索:不将 itemName 传给后端
|
|
|
- const { itemName, ...rest } = reqParams;
|
|
|
+ if (params.calcPageKey === 'deptCostAllocationSummary' && 'departmentName' in reqParams) {
|
|
|
+ // deptCostAllocationSummary 仅前端检索
|
|
|
+ const { departmentName, ...rest } = reqParams;
|
|
|
reqParams = rest;
|
|
|
}
|
|
|
- if (params.calcPageKey === 'diseaseCostCompositionDetail' && 'itemName' in reqParams) {
|
|
|
- // diseaseCostCompositionDetail 病种名称仅前端检索
|
|
|
- const { itemName, ...rest } = reqParams;
|
|
|
+ if (params.calcPageKey === 'hospitalDeptBedDayCost' && 'departmentName' in reqParams) {
|
|
|
+ // hospitalDeptBedDayCost 仅前端检索
|
|
|
+ const { departmentName, ...rest } = reqParams;
|
|
|
reqParams = rest;
|
|
|
}
|
|
|
+ // diseaseCostDetail 和 diseaseCostCompositionDetail 已改为后端分页+检索,diseaseFilter 参数传给后端
|
|
|
if (params.calcPageKey === 'deptDiseaseCostCompositionDetail' && 'itemName' in reqParams) {
|
|
|
// 服务单元病种成本构成明细表:病种名称仅前端检索
|
|
|
const { itemName, ...rest } = reqParams;
|
|
|
reqParams = rest;
|
|
|
}
|
|
|
+ if (params.calcPageKey === 'medicalServiceCostDetail' && 'itemFilter' in reqParams) {
|
|
|
+ // medicalServiceCostDetail 仅前端检索:项目代码/名称
|
|
|
+ const { itemFilter, ...rest } = reqParams as any;
|
|
|
+ reqParams = rest;
|
|
|
+ }
|
|
|
|
|
|
const resp = await getCalcPageTableData({ ...reqParams });
|
|
|
if (resp) {
|
|
|
@@ -317,9 +325,9 @@ export default function calcPageTemplate() {
|
|
|
totalPage: 1,
|
|
|
};
|
|
|
}
|
|
|
- // 新增:服务单元病种成本构成明细表(动态多级表头+数据)
|
|
|
+ // 新增:服务单元病种成本构成明细表(动态多级表头+数据,后端分页+检索)
|
|
|
if (params.calcPageKey === 'deptDiseaseCostCompositionDetail') {
|
|
|
- const { title = [], data: rowList = [] } = resp || {};
|
|
|
+ const { title = [], data: rowList = [], totalCount, pageSize, totalPage } = resp || {};
|
|
|
|
|
|
// 递归生成多级列(透传 dataType/decimalPlace/isFixed/permil,并挂载统一 renderText 与 __meta)
|
|
|
const buildColumns = (nodes: any[]): ProColumns[] => {
|
|
|
@@ -359,7 +367,7 @@ export default function calcPageTemplate() {
|
|
|
const dynamicCols: ProColumns[] = [
|
|
|
{ title: '病种编码', dataIndex: 'reportCode', key: 'reportCode', width: 140, fixed: 'left' as any },
|
|
|
{ title: '病种名称', dataIndex: 'reportName', key: 'reportName', width: 220, fixed: 'left' as any },
|
|
|
- { title: '病种成本', dataIndex: 'totalValue', key: 'totalValue', width: 150, align: 'right', renderText: (num: any) => formatMoneyNumber(num, { decimalPlaces: 2, useThousandSeparator: true }) } as any,
|
|
|
+ { title: '病种成本', dataIndex: 'totalValue', key: 'totalValue', width: 150, align: 'right', /* 该列也 fixed 左侧,三列一起固定 */ fixed: 'left' as any, renderText: (num: any) => formatMoneyNumber(num, { decimalPlaces: 2, useThousandSeparator: true }) } as any,
|
|
|
...buildColumns(title)
|
|
|
];
|
|
|
set_columns(dynamicCols);
|
|
|
@@ -382,7 +390,8 @@ export default function calcPageTemplate() {
|
|
|
const dynamicScrollX = sumLeafWidths(dynamicCols.slice(3) as any[]) + baseWidth + 80;
|
|
|
set_scrollX(dynamicScrollX);
|
|
|
|
|
|
- const data = (rowList || []).map((row: any, idx: number) => {
|
|
|
+ const rows = Array.isArray(rowList) ? rowList : [];
|
|
|
+ const data = rows.map((row: any, idx: number) => {
|
|
|
const rowData: any = { reportCode: row.reportCode, reportName: row.reportName, totalValue: row.totalValue };
|
|
|
((row?.data || []) as any[]).forEach((cell: any) => {
|
|
|
rowData[String(cell.code)] = cell.value;
|
|
|
@@ -393,15 +402,24 @@ export default function calcPageTemplate() {
|
|
|
return {
|
|
|
data,
|
|
|
success: true,
|
|
|
- total: Array.isArray(data) ? data.length : 0,
|
|
|
- pageSize: Array.isArray(data) ? data.length : 0,
|
|
|
- totalPage: 1,
|
|
|
+ total: (typeof totalCount === 'number' ? totalCount : (Array.isArray(data) ? data.length : 0)),
|
|
|
+ pageSize: (typeof pageSize === 'number' ? pageSize : (Array.isArray(data) ? data.length : 0)),
|
|
|
+ totalPage: (typeof totalPage === 'number' ? totalPage : 1),
|
|
|
};
|
|
|
}
|
|
|
// 新增:医院服务单元DRG成本构成明细表(动态多级表头+数据)
|
|
|
if (params.calcPageKey === 'deptDrgCostCompositionDetail') {
|
|
|
const { title = [], data: rowList = [] } = resp || {};
|
|
|
|
|
|
+ // 本地检索:按 DRG 名称(reportName)过滤
|
|
|
+ let filteredRows = Array.isArray(rowList) ? rowList : [];
|
|
|
+ try {
|
|
|
+ const kw = String((params as any).itemName || '').trim();
|
|
|
+ if (kw) {
|
|
|
+ filteredRows = filteredRows.filter((row: any) => String(row?.reportName || '').includes(kw));
|
|
|
+ }
|
|
|
+ } catch { }
|
|
|
+
|
|
|
const buildColumns = (nodes: any[]): ProColumns[] => {
|
|
|
return (nodes || []).map((node: any) => {
|
|
|
const hasChildren = Array.isArray(node.child) && node.child.length > 0;
|
|
|
@@ -438,7 +456,7 @@ export default function calcPageTemplate() {
|
|
|
const dynamicCols: ProColumns[] = [
|
|
|
{ title: 'DRG编码', dataIndex: 'reportCode', key: 'reportCode', width: 140, fixed: 'left' as any },
|
|
|
{ title: 'DRG名称', dataIndex: 'reportName', key: 'reportName', width: 320, fixed: 'left' as any },
|
|
|
- { title: '病种成本', dataIndex: 'totalValue', key: 'totalValue', width: 150, align: 'right', renderText: (num: any) => formatMoneyNumber(num, { decimalPlaces: 2, useThousandSeparator: true }) } as any,
|
|
|
+ { title: 'DRG成本', dataIndex: 'totalValue', key: 'totalValue', width: 150, align: 'right', renderText: (num: any) => formatMoneyNumber(num, { decimalPlaces: 2, useThousandSeparator: true }) } as any,
|
|
|
...buildColumns(title)
|
|
|
];
|
|
|
set_columns(dynamicCols);
|
|
|
@@ -461,7 +479,7 @@ export default function calcPageTemplate() {
|
|
|
const dynamicScrollX = sumLeafWidths(dynamicCols.slice(3) as any[]) + baseWidth + 80;
|
|
|
set_scrollX(dynamicScrollX);
|
|
|
|
|
|
- const data = (rowList || []).map((row: any, idx: number) => {
|
|
|
+ const data = (filteredRows || []).map((row: any, idx: number) => {
|
|
|
const rowData: any = { reportCode: row.reportCode, reportName: row.reportName, totalValue: row.totalValue };
|
|
|
((row?.data || []) as any[]).forEach((cell: any) => {
|
|
|
rowData[String(cell.code)] = cell.value;
|
|
|
@@ -494,7 +512,7 @@ export default function calcPageTemplate() {
|
|
|
if (params.calcPageKey === 'deptDirectMedicalCost' || params.calcPageKey === 'deptCostAllocationSummary') {
|
|
|
const totalIdx = Array.isArray(data) ? data.findIndex((row: any) => String(row?.responsibilityName || '').includes('总计')) : -1;
|
|
|
if (totalIdx > -1) {
|
|
|
- try { set_bottomSummaryRow(data[totalIdx]); } catch {}
|
|
|
+ try { set_bottomSummaryRow(data[totalIdx]); } catch { }
|
|
|
data = [...data.slice(0, totalIdx), ...data.slice(totalIdx + 1)];
|
|
|
} else {
|
|
|
set_bottomSummaryRow(null);
|
|
|
@@ -542,13 +560,19 @@ export default function calcPageTemplate() {
|
|
|
data = data.filter((row: any) => String(row.responsibilityName || '').includes(kw));
|
|
|
}
|
|
|
}
|
|
|
- // 前端检索:diseaseCostDetail 按病种名称本地过滤
|
|
|
- if (params.calcPageKey === 'diseaseCostDetail' && params.itemName) {
|
|
|
- const kw = String(params.itemName || '').trim();
|
|
|
+ if (params.calcPageKey === 'hospitalDeptVisitCost' && params.departmentName) {
|
|
|
+ const kw = String(params.departmentName || '').trim();
|
|
|
if (kw) {
|
|
|
- data = data.filter((row: any) => String(row.itemName || '').includes(kw));
|
|
|
+ data = data.filter((row: any) => String(row.responsibilityName || '').includes(kw));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (params.calcPageKey === 'hospitalDeptBedDayCost' && params.departmentName) {
|
|
|
+ const kw = String(params.departmentName || '').trim();
|
|
|
+ if (kw) {
|
|
|
+ data = data.filter((row: any) => String(row.responsibilityName || '').includes(kw));
|
|
|
}
|
|
|
}
|
|
|
+ // diseaseCostDetail 和 diseaseCostCompositionDetail 已改为后端检索,不再前端过滤
|
|
|
// 前端检索:drgCostDetail / drgCostCompositionDetail / deptDrgCostCompositionDetail 按 DRG 名称本地过滤
|
|
|
if ((params.calcPageKey === 'drgCostDetail' || params.calcPageKey === 'drgCostCompositionDetail' || params.calcPageKey === 'deptDrgCostCompositionDetail') && params.itemName) {
|
|
|
const kw = String(params.itemName || '').trim();
|
|
|
@@ -563,11 +587,64 @@ export default function calcPageTemplate() {
|
|
|
data = data.filter((row: any) => String(row.reportName || '').includes(kw));
|
|
|
}
|
|
|
}
|
|
|
- // 前端检索:diseaseCostCompositionDetail 按病种名称本地过滤
|
|
|
- if (params.calcPageKey === 'diseaseCostCompositionDetail' && params.itemName) {
|
|
|
+ // 前端检索:hospitalServiceProjectCost 按项目名称本地过滤(树结构兼容)
|
|
|
+ if (params.calcPageKey === 'hospitalServiceProjectCost' && params.itemName) {
|
|
|
const kw = String(params.itemName || '').trim();
|
|
|
if (kw) {
|
|
|
- data = data.filter((row: any) => String(row.itemName || '').includes(kw));
|
|
|
+ const filterTreeByItemName = (nodes: any[]): any[] => {
|
|
|
+ if (!Array.isArray(nodes)) return [];
|
|
|
+ const results: any[] = [];
|
|
|
+ for (const node of nodes) {
|
|
|
+ const name = String(node?.itemName || '');
|
|
|
+ const rawChildren = (Array.isArray(node?.children) ? node.children : (Array.isArray(node?.child) ? node.child : [])) as any[];
|
|
|
+ const filteredChildren = filterTreeByItemName(rawChildren);
|
|
|
+ const selfMatch = name.includes(kw);
|
|
|
+ if (selfMatch || filteredChildren.length > 0) {
|
|
|
+ const copy: any = { ...node };
|
|
|
+ if (Array.isArray(node?.children)) copy.children = filteredChildren;
|
|
|
+ else if (Array.isArray(node?.child)) copy.child = filteredChildren;
|
|
|
+ else if (filteredChildren.length > 0) copy.children = filteredChildren;
|
|
|
+ results.push(copy);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return results;
|
|
|
+ };
|
|
|
+ data = filterTreeByItemName(data);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 规范化 hospitalServiceProjectCost 的树数据:统一 children,并生成稳定唯一的 id,避免展开联动
|
|
|
+ if (params.calcPageKey === 'hospitalServiceProjectCost') {
|
|
|
+ const normalizeTree = (nodes: any[], parentKey: string = ''): any[] => {
|
|
|
+ if (!Array.isArray(nodes)) return [];
|
|
|
+ return nodes.map((node: any, idx: number) => {
|
|
|
+ const copy: any = { ...node };
|
|
|
+ const rawChildren = Array.isArray(copy.children)
|
|
|
+ ? copy.children
|
|
|
+ : (Array.isArray(copy.child) ? copy.child : []);
|
|
|
+ const id = `${parentKey}${parentKey ? '-' : ''}${idx}`;
|
|
|
+ copy.id = id;
|
|
|
+ if (rawChildren && rawChildren.length > 0) {
|
|
|
+ copy.children = normalizeTree(rawChildren, id);
|
|
|
+ } else {
|
|
|
+ // 无子节点时去除空 children,避免渲染干扰
|
|
|
+ if (copy.children && Array.isArray(copy.children) && copy.children.length === 0) {
|
|
|
+ delete copy.children;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 统一去掉 child
|
|
|
+ if (copy.child) delete copy.child;
|
|
|
+ return copy;
|
|
|
+ });
|
|
|
+ };
|
|
|
+ data = normalizeTree(data);
|
|
|
+ }
|
|
|
+ // 前端检索:medicalServiceCostDetail 按项目代码或名称本地过滤
|
|
|
+ if (params.calcPageKey === 'medicalServiceCostDetail' && params.itemFilter) {
|
|
|
+ const kw = String(params.itemFilter || '').trim();
|
|
|
+ if (kw) {
|
|
|
+ const includesKw = (v: any) => String(v || '').includes(kw);
|
|
|
+ data = data.filter((row: any) => includesKw(row.itemCode) || includesKw(row.itemName));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -625,7 +702,7 @@ export default function calcPageTemplate() {
|
|
|
return false;
|
|
|
}
|
|
|
if (params.calcPageKey == 'wholeHospCostCalculate') {
|
|
|
- const resp = await calculateReq(computeDate,params.calcPageKey, currentTabKey);
|
|
|
+ const resp = await calculateReq(computeDate, params.calcPageKey, currentTabKey);
|
|
|
if (resp) {
|
|
|
set_loading(false);
|
|
|
message.success('操作成功!');
|
|
|
@@ -887,23 +964,27 @@ export default function calcPageTemplate() {
|
|
|
|
|
|
// 优先尝试通过策略注册表处理(最小接入,不影响原有分支作为兜底)
|
|
|
const strategy = getCalcPageStrategy(calcPageKey);
|
|
|
- // 计算页面权限集合
|
|
|
+ // 计算页面权限集合(同步计算,直接使用 perms 避免 state 异步问题)
|
|
|
+ let perms = new Set<string>();
|
|
|
try {
|
|
|
- const perms = getPagePermissions(access, location.pathname.replace('/CostAccountingSys', ''));
|
|
|
+ perms = getPagePermissions(access, location.pathname.replace('/CostAccountingSys', ''));
|
|
|
set_pagePermissions(perms);
|
|
|
- } catch {}
|
|
|
+ } catch { }
|
|
|
if (strategy) {
|
|
|
const baseColumns = strategy.buildColumns();
|
|
|
const enhanced = strategy.enhanceColumns ? strategy.enhanceColumns(baseColumns as any, { onIncomeAction: optionBtnGroupshandle, onShareAction: optionBtnGroupshandle, Popconfirm, downloadTemplateReq }) : baseColumns;
|
|
|
set_columns(enhanced as any);
|
|
|
set_filterConf(strategy.filterConf);
|
|
|
- // 结合策略按钮解析
|
|
|
+ // 结合策略按钮解析(直接使用刚计算的 perms,而不是 state)
|
|
|
let showCalc = strategy.showCalcButton;
|
|
|
+ let showExport = false;
|
|
|
if (typeof strategy.resolveButtons === 'function') {
|
|
|
- const btns = strategy.resolveButtons({ pagePermissions });
|
|
|
+ const btns = strategy.resolveButtons({ pagePermissions: perms });
|
|
|
if (typeof btns?.calculate === 'boolean') showCalc = btns.calculate;
|
|
|
+ if (typeof btns?.export === 'boolean') showExport = btns.export;
|
|
|
}
|
|
|
set_ifShowCalcBtn(showCalc);
|
|
|
+ set_ifShowExportBtn(showExport);
|
|
|
set_scrollX(strategy.scrollX);
|
|
|
// 让策略在装载期可调整列等
|
|
|
if (typeof strategy.onMount === 'function') {
|
|
|
@@ -911,7 +992,7 @@ export default function calcPageTemplate() {
|
|
|
}
|
|
|
// 让策略可配置表格额外属性(如禁用分页等)
|
|
|
try {
|
|
|
- const extra = typeof strategy.tablePropsBuilder === 'function' ? strategy.tablePropsBuilder({ pagePermissions }) : undefined;
|
|
|
+ const extra = typeof strategy.tablePropsBuilder === 'function' ? strategy.tablePropsBuilder({ pagePermissions: perms }) : undefined;
|
|
|
set_tableExtraProps(extra || {});
|
|
|
} catch {
|
|
|
set_tableExtraProps({});
|
|
|
@@ -927,15 +1008,16 @@ export default function calcPageTemplate() {
|
|
|
'incomeCollection', 'costShare', 'projectCostCalc'
|
|
|
]);
|
|
|
if (strategy && simpleKeys.has((calcPageKey as any))) {
|
|
|
- set_tableDataFilterParams((prev: any) => ({ ...prev, computeDate, calcPageKey, reportType: prev.reportType }));
|
|
|
+ // 切换页面时重置筛选参数,避免携带上个页面的残留检索项
|
|
|
+ set_tableDataFilterParams({ computeDate, calcPageKey });
|
|
|
return;
|
|
|
}
|
|
|
// 其他场景均已由策略处理,无需在此分支初始化
|
|
|
|
|
|
if (currentTabKey && params.calcPageKey == 'wholeHospCostCalculate') {
|
|
|
- set_tableDataFilterParams((prev: any) => ({ ...prev, reportType: currentTabKey }))
|
|
|
+ set_tableDataFilterParams({ computeDate, calcPageKey, reportType: currentTabKey } as any);
|
|
|
} else {
|
|
|
- set_tableDataFilterParams((prev: any) => ({ ...prev, computeDate, calcPageKey, reportType: prev.reportType }));
|
|
|
+ set_tableDataFilterParams({ computeDate, calcPageKey } as any);
|
|
|
}
|
|
|
|
|
|
}, [params, currentTabKey]);
|
|
|
@@ -999,8 +1081,8 @@ export default function calcPageTemplate() {
|
|
|
<span className='btn' style={{ marginRight: 16 }} onClick={() => handleExpandNext()}>展开下一层</span>
|
|
|
</>
|
|
|
)}
|
|
|
- {(((params.calcPageKey == 'deptDirectMedicalCost' || params.calcPageKey == 'deptFullDirectCost' || params.calcPageKey == 'clinicalDeptMedicalCost' || params.calcPageKey == 'clinicalDeptFullCost' || params.calcPageKey == 'clinicalDeptFullCostAnalysis' || params.calcPageKey == 'deptCostAllocationSummary' || params.calcPageKey == 'hospitalVisitCostComposition' || params.calcPageKey == 'hospitalDeptVisitCost' || params.calcPageKey == 'hospitalBedDayCostComposition' || params.calcPageKey == 'hospitalDeptBedDayCost' || params.calcPageKey == 'hospitalServiceProjectCost' || params.calcPageKey == 'medicalServiceCostDetail' || params.calcPageKey == 'diseaseCostDetail' || params.calcPageKey == 'diseaseCostCompositionDetail' || params.calcPageKey == 'deptDiseaseCostCompositionDetail' || params.calcPageKey == 'drgCostDetail' || params.calcPageKey == 'drgCostCompositionDetail' || params.calcPageKey == 'deptDrgCostCompositionDetail') || ((params.calcPageKey == 'projectCostCalc' || params.calcPageKey == 'wholeHospCostCalculate') && pagePermissions.has('export')))) && <a className='export' onClick={() => set_openProcessModal(true)}>导出</a>}
|
|
|
- {(ifShowCalcBtn && ((params.calcPageKey == 'wholeHospCostCalculate' || params.calcPageKey == 'projectCostCalc') ? pagePermissions.has('calculate') : true)) && <a className='calc' onClick={() => calcFunc()}>计算</a>}
|
|
|
+ {(((params.calcPageKey == 'deptDirectMedicalCost' || params.calcPageKey == 'deptFullDirectCost' || params.calcPageKey == 'clinicalDeptMedicalCost' || params.calcPageKey == 'clinicalDeptFullCost' || params.calcPageKey == 'clinicalDeptFullCostAnalysis' || params.calcPageKey == 'deptCostAllocationSummary' || params.calcPageKey == 'hospitalVisitCostComposition' || params.calcPageKey == 'hospitalDeptVisitCost' || params.calcPageKey == 'hospitalBedDayCostComposition' || params.calcPageKey == 'hospitalDeptBedDayCost' || params.calcPageKey == 'hospitalServiceProjectCost' || params.calcPageKey == 'medicalServiceCostDetail' || params.calcPageKey == 'diseaseCostDetail' || params.calcPageKey == 'diseaseCostCompositionDetail' || params.calcPageKey == 'deptDiseaseCostCompositionDetail' || params.calcPageKey == 'drgCostDetail' || params.calcPageKey == 'drgCostCompositionDetail' || params.calcPageKey == 'deptDrgCostCompositionDetail') || (params.calcPageKey == 'projectCostCalc' && ifShowExportBtn) || (params.calcPageKey == 'wholeHospCostCalculate' && pagePermissions.has('export')))) && <a className='export' onClick={() => set_openProcessModal(true)}>导出</a>}
|
|
|
+ {((params.calcPageKey == 'wholeHospCostCalculate') || ifShowCalcBtn) && <a className='calc' onClick={() => calcFunc()}>计算</a>}
|
|
|
{(params.calcPageKey == 'afterCostShareSearch' || params.calcPageKey == 'afterCollectionSearch') && (<Button loading={loading} size='small' className='reportDataBtn' onClick={() => openDataTable()}>报表数据</Button>)}
|
|
|
{(params.calcPageKey == 'departmentOperatingReport' || params.calcPageKey == 'wholeHospOperatingReport') && (<span className='reportDataBtn' onClick={() => generateReport()}>生成报表</span>)}
|
|
|
</div>
|
|
|
@@ -1013,131 +1095,146 @@ export default function calcPageTemplate() {
|
|
|
const { scroll: _omitScroll, ...restTableProps } = (tableExtraProps || {}) as any;
|
|
|
const mergedY = extraScroll?.y ?? (params.calcPageKey == 'afterCostShareSearch' ? `calc(100vh - 270px)` : `calc(100vh - 233px)`);
|
|
|
|
|
|
- // 仅在 deptDiseaseCostCompositionDetail 页面启用行虚拟化
|
|
|
- const enableVirtual = params.calcPageKey === 'deptDiseaseCostCompositionDetail'
|
|
|
+ // 在大表启用行虚拟化(不分页):deptDiseaseCostCompositionDetail
|
|
|
+ // diseaseCostDetail 和 diseaseCostCompositionDetail 已改为后端分页,不再使用行虚拟化
|
|
|
+ const enableVirtual = (params.calcPageKey === 'deptDiseaseCostCompositionDetail')
|
|
|
&& typeof scrollX === 'number'
|
|
|
&& typeof mergedY === 'number'
|
|
|
- && Array.isArray(columns) && columns.length > 0;
|
|
|
+ && Array.isArray(columns) && columns.length > 0
|
|
|
+ // 若存在固定列,则关闭行虚拟化以保留 fixed 效果
|
|
|
+ && !(columns as any[])?.some?.((c: any) => Boolean(c?.fixed));
|
|
|
|
|
|
const virtualComponents = enableVirtual ? {
|
|
|
body: buildVirtualBody({ columns: columns as any, height: mergedY as number, width: scrollX as number, rowHeight: 44 })
|
|
|
} : undefined;
|
|
|
const renderColumns = enableVirtual ? (columns as any[]).map((c) => ({ ...c, fixed: undefined })) : columns;
|
|
|
return (
|
|
|
- <KCIMTable
|
|
|
- columns={renderColumns}
|
|
|
- actionRef={tableRef}
|
|
|
- rowKey="id"
|
|
|
- components={virtualComponents as any}
|
|
|
- expandable={params.calcPageKey == 'wholeHospCostCalculate' ? {
|
|
|
- defaultExpandAllRows: true, expandedRowKeys: allParentsKeys,
|
|
|
- onExpand(expanded, record) {
|
|
|
- const { id } = record;
|
|
|
- if (!expanded) {
|
|
|
- const expandedKeys = allParentsKeys.filter(a => a != id);
|
|
|
- set_allParentsKeys([...expandedKeys]);
|
|
|
- } else {
|
|
|
- set_allParentsKeys([...allParentsKeys, id]);
|
|
|
- }
|
|
|
- },
|
|
|
- } : undefined}
|
|
|
- rowClassName={(record) => {
|
|
|
- // 全院损益树表的行 class
|
|
|
- if (params.calcPageKey == 'wholeHospCostCalculate') {
|
|
|
- return record.children ? 'has-children hover-row' : 'hover-row';
|
|
|
- }
|
|
|
- // 医院科室直接成本表/成本分摊汇总表:小计行高亮
|
|
|
- if (params.calcPageKey == 'deptDirectMedicalCost' || params.calcPageKey == 'deptCostAllocationSummary') {
|
|
|
- const name = String(record.responsibilityName || '');
|
|
|
- return name.includes('小计') ? 'subtotal-row' : '';
|
|
|
- }
|
|
|
- return '';
|
|
|
- }}
|
|
|
- scroll={{ x: scrollX, y: mergedY }}
|
|
|
- params={tableDataFilterParams}
|
|
|
- request={(params) => getTableData(params)}
|
|
|
- pagination={params.calcPageKey == 'wholeHospCostCalculate' ? false : (params.calcPageKey == 'deptDirectMedicalCost' ? false : undefined)}
|
|
|
- {...restTableProps}
|
|
|
- summary={(pageData: any[]) => {
|
|
|
- // 仅对 deptDirectMedicalCost / deptCostAllocationSummary 固定底部合计
|
|
|
- if (params.calcPageKey !== 'deptDirectMedicalCost' && params.calcPageKey !== 'deptCostAllocationSummary') return undefined;
|
|
|
- // 由于该页不分页,这里的合计为当前渲染数据的总计
|
|
|
- try {
|
|
|
- // 如果接口有“总计”行,优先用它并固定到底部
|
|
|
- if (bottomSummaryRow) {
|
|
|
- return (
|
|
|
- <Table.Summary fixed>
|
|
|
- <Table.Summary.Row className="total-summary-row">
|
|
|
- <Table.Summary.Cell index={0}>总计</Table.Summary.Cell>
|
|
|
- {params.calcPageKey === 'deptDirectMedicalCost' ? (
|
|
|
- <>
|
|
|
- <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(bottomSummaryRow.personnelExpense, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(bottomSummaryRow.healthMaterialFee, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(bottomSummaryRow.drugFee, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(bottomSummaryRow.fixedAssetDepreciation, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(bottomSummaryRow.intangibleAssetAmortization, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(bottomSummaryRow.medicalRiskFundExtraction, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={7} align="right">{formatMoneyNumber(bottomSummaryRow.otherMedicalExpenses, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={8} align="right">{formatMoneyNumber(bottomSummaryRow.total, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- <>
|
|
|
- <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(bottomSummaryRow.medicalCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(bottomSummaryRow.directCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(bottomSummaryRow.subtotal, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(bottomSummaryRow.allocatedAdminCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(bottomSummaryRow.allocatedSupportCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(bottomSummaryRow.allocatedTechCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- </>
|
|
|
- )}
|
|
|
- </Table.Summary.Row>
|
|
|
- </Table.Summary>
|
|
|
- );
|
|
|
- }
|
|
|
- // 数值列 key 列表
|
|
|
- const amountKeys = params.calcPageKey === 'deptDirectMedicalCost'
|
|
|
- ? ['personnelExpense','healthMaterialFee','drugFee','fixedAssetDepreciation','intangibleAssetAmortization','medicalRiskFundExtraction','otherMedicalExpenses','total']
|
|
|
- : ['medicalCost','directCost','subtotal','allocatedAdminCost','allocatedSupportCost','allocatedTechCost'];
|
|
|
- const sums: Record<string, number> = {};
|
|
|
- (Array.isArray(pageData) ? pageData : [])?.forEach?.((row: any) => {
|
|
|
- amountKeys.forEach(k => {
|
|
|
- const v = Number(row?.[k] ?? 0);
|
|
|
- sums[k] = (sums[k] || 0) + (isNaN(v) ? 0 : v);
|
|
|
- })
|
|
|
- });
|
|
|
- return (
|
|
|
- <Table.Summary fixed>
|
|
|
- <Table.Summary.Row className="total-summary-row">
|
|
|
- <Table.Summary.Cell index={0}>合计</Table.Summary.Cell>
|
|
|
- {params.calcPageKey === 'deptDirectMedicalCost' ? (
|
|
|
- <>
|
|
|
- <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(sums.personnelExpense, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(sums.healthMaterialFee, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(sums.drugFee, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(sums.fixedAssetDepreciation, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(sums.intangibleAssetAmortization, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(sums.medicalRiskFundExtraction, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={7} align="right">{formatMoneyNumber(sums.otherMedicalExpenses, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={8} align="right">{formatMoneyNumber(sums.total, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- <>
|
|
|
- <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(sums.medicalCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(sums.directCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(sums.subtotal, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(sums.allocatedAdminCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(sums.allocatedSupportCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(sums.allocatedTechCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
- </>
|
|
|
- )}
|
|
|
- </Table.Summary.Row>
|
|
|
- </Table.Summary>
|
|
|
- );
|
|
|
- } catch {
|
|
|
- return undefined;
|
|
|
- }
|
|
|
- }}
|
|
|
- />)})()}
|
|
|
+ <KCIMTable
|
|
|
+ columns={renderColumns}
|
|
|
+ actionRef={tableRef}
|
|
|
+ rowKey="id"
|
|
|
+ components={virtualComponents as any}
|
|
|
+ expandable={params.calcPageKey == 'wholeHospCostCalculate' ? {
|
|
|
+ defaultExpandAllRows: true, expandedRowKeys: allParentsKeys,
|
|
|
+ onExpand(expanded, record) {
|
|
|
+ const { id } = record;
|
|
|
+ if (!expanded) {
|
|
|
+ const expandedKeys = allParentsKeys.filter(a => a != id);
|
|
|
+ set_allParentsKeys([...expandedKeys]);
|
|
|
+ } else {
|
|
|
+ set_allParentsKeys([...allParentsKeys, id]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ } : (params.calcPageKey == 'hospitalServiceProjectCost' ? {
|
|
|
+ expandedRowKeys: hospitalServiceProjectExpandedKeys,
|
|
|
+ onExpand(expanded, record) {
|
|
|
+ const { id } = record;
|
|
|
+ if (!expanded) {
|
|
|
+ const expandedKeys = hospitalServiceProjectExpandedKeys.filter(a => a != id);
|
|
|
+ set_hospitalServiceProjectExpandedKeys([...expandedKeys]);
|
|
|
+ } else {
|
|
|
+ set_hospitalServiceProjectExpandedKeys([...hospitalServiceProjectExpandedKeys, id]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ } : undefined)}
|
|
|
+ rowClassName={(record) => {
|
|
|
+ // 全院损益树表的行 class
|
|
|
+ if (params.calcPageKey == 'wholeHospCostCalculate') {
|
|
|
+ return record.children ? 'has-children hover-row' : 'hover-row';
|
|
|
+ }
|
|
|
+ // 医院科室直接成本表/成本分摊汇总表:小计行高亮
|
|
|
+ if (params.calcPageKey == 'deptDirectMedicalCost' || params.calcPageKey == 'deptCostAllocationSummary') {
|
|
|
+ const name = String(record.responsibilityName || '');
|
|
|
+ return name.includes('小计') ? 'subtotal-row' : '';
|
|
|
+ }
|
|
|
+ return '';
|
|
|
+ }}
|
|
|
+ scroll={{ x: scrollX, y: mergedY }}
|
|
|
+ params={tableDataFilterParams}
|
|
|
+ request={(params) => getTableData(params)}
|
|
|
+ pagination={params.calcPageKey == 'wholeHospCostCalculate' ? false : (params.calcPageKey == 'deptDirectMedicalCost' ? false : undefined)}
|
|
|
+ {...restTableProps}
|
|
|
+ summary={(pageData: any[]) => {
|
|
|
+ // 仅对 deptDirectMedicalCost / deptCostAllocationSummary 固定底部合计
|
|
|
+ if (params.calcPageKey !== 'deptDirectMedicalCost' && params.calcPageKey !== 'deptCostAllocationSummary') return undefined;
|
|
|
+ // 由于该页不分页,这里的合计为当前渲染数据的总计
|
|
|
+ try {
|
|
|
+ // 如果接口有“总计”行,优先用它并固定到底部
|
|
|
+ if (bottomSummaryRow) {
|
|
|
+ return (
|
|
|
+ <Table.Summary fixed>
|
|
|
+ <Table.Summary.Row className="total-summary-row">
|
|
|
+ <Table.Summary.Cell index={0}>总计</Table.Summary.Cell>
|
|
|
+ {params.calcPageKey === 'deptDirectMedicalCost' ? (
|
|
|
+ <>
|
|
|
+ <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(bottomSummaryRow.personnelExpense, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(bottomSummaryRow.healthMaterialFee, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(bottomSummaryRow.drugFee, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(bottomSummaryRow.fixedAssetDepreciation, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(bottomSummaryRow.intangibleAssetAmortization, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(bottomSummaryRow.medicalRiskFundExtraction, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={7} align="right">{formatMoneyNumber(bottomSummaryRow.otherMedicalExpenses, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={8} align="right">{formatMoneyNumber(bottomSummaryRow.total, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: bottomSummaryRow?.permil === 1 || bottomSummaryRow?.permil === true })}</Table.Summary.Cell>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <>
|
|
|
+ <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(bottomSummaryRow.medicalCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(bottomSummaryRow.directCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(bottomSummaryRow.subtotal, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(bottomSummaryRow.allocatedAdminCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(bottomSummaryRow.allocatedSupportCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(bottomSummaryRow.allocatedTechCost, { decimalPlaces: (typeof bottomSummaryRow?.decimalPlace === 'number') ? bottomSummaryRow.decimalPlace : 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Table.Summary.Row>
|
|
|
+ </Table.Summary>
|
|
|
+ );
|
|
|
+ }
|
|
|
+ // 数值列 key 列表
|
|
|
+ const amountKeys = params.calcPageKey === 'deptDirectMedicalCost'
|
|
|
+ ? ['personnelExpense', 'healthMaterialFee', 'drugFee', 'fixedAssetDepreciation', 'intangibleAssetAmortization', 'medicalRiskFundExtraction', 'otherMedicalExpenses', 'total']
|
|
|
+ : ['medicalCost', 'directCost', 'subtotal', 'allocatedAdminCost', 'allocatedSupportCost', 'allocatedTechCost'];
|
|
|
+ const sums: Record<string, number> = {};
|
|
|
+ (Array.isArray(pageData) ? pageData : [])?.forEach?.((row: any) => {
|
|
|
+ amountKeys.forEach(k => {
|
|
|
+ const v = Number(row?.[k] ?? 0);
|
|
|
+ sums[k] = (sums[k] || 0) + (isNaN(v) ? 0 : v);
|
|
|
+ })
|
|
|
+ });
|
|
|
+ return (
|
|
|
+ <Table.Summary fixed>
|
|
|
+ <Table.Summary.Row className="total-summary-row">
|
|
|
+ <Table.Summary.Cell index={0}>合计</Table.Summary.Cell>
|
|
|
+ {params.calcPageKey === 'deptDirectMedicalCost' ? (
|
|
|
+ <>
|
|
|
+ <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(sums.personnelExpense, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(sums.healthMaterialFee, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(sums.drugFee, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(sums.fixedAssetDepreciation, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(sums.intangibleAssetAmortization, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(sums.medicalRiskFundExtraction, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={7} align="right">{formatMoneyNumber(sums.otherMedicalExpenses, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={8} align="right">{formatMoneyNumber(sums.total, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <>
|
|
|
+ <Table.Summary.Cell index={1} align="right">{formatMoneyNumber(sums.medicalCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={2} align="right">{formatMoneyNumber(sums.directCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={3} align="right">{formatMoneyNumber(sums.subtotal, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={4} align="right">{formatMoneyNumber(sums.allocatedAdminCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={5} align="right">{formatMoneyNumber(sums.allocatedSupportCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ <Table.Summary.Cell index={6} align="right">{formatMoneyNumber(sums.allocatedTechCost, { decimalPlaces: 2, useThousandSeparator: true })}</Table.Summary.Cell>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </Table.Summary.Row>
|
|
|
+ </Table.Summary>
|
|
|
+ );
|
|
|
+ } catch {
|
|
|
+ return undefined;
|
|
|
+ }
|
|
|
+ }}
|
|
|
+ />)
|
|
|
+ })()}
|
|
|
{
|
|
|
totalCount != undefined && <a style={{ marginTop: 16, display: 'inline-block' }}>{`合计:${formatMoneyNumber(totalCount)}`}</a>
|
|
|
}
|