This commit is contained in:
zlwu committed 2026-05-26 12:32:19 +08:00
1 parent bb8c981afd
commit 065e6c34b4
45 files changed
+16838 -4598

No files matched your search

+15
View File
@@ -2053,6 +2053,9 @@ export function completePilotApplication(data: any) {
export function voidPilotApplication(data: any) {
return request.post({ url: '/web/admin/pilot-application/void', params: data })
}
export function savePilotApplication(data: any) {
return request.post({ url: '/web/admin/pilot-application/save', params: data })
}
// 患者信息
export function fetchPilotPatient(params: any) {
@@ -2127,6 +2130,18 @@ export const savePilotCheckupActualItems = (data: any) =>
export const deletePilotCheckupActualItem = (data: any) =>
request.del({ url: '/web/admin/pilot-checkup/actual-item/delete', data })
// 体检记录分页列表
export const fetchPilotCheckupList = (params: any) =>
request.get({ url: '/web/admin/pilot-checkup/list', params })
// 待登记体检的患者列表
export const fetchPilotCheckupPendingPatients = (params: any) =>
request.get({ url: '/web/admin/pilot-checkup/pending-patients', params })
// 批量创建体检记录
export const batchSavePilotCheckup = (data: any) =>
request.post({ url: '/web/admin/pilot-checkup/batch-save', params: data })
// ========== 中试服务 - 交付管理 ==========
export const fetchPilotDeliveryDetail = (params: any) =>
request.get({ url: '/web/admin/pilot-delivery/detail', params })
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_pilot_service_channel_service_order_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1"}, {"id": "channel_service_order_index_displayvalue", "label": "displayValue()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L763"}, {"id": "channel_service_order_index_handlechannelsearch", "label": "handleChannelSearch()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1061"}, {"id": "channel_service_order_index_onchannelselectvisible", "label": "onChannelSelectVisible()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1085"}, {"id": "channel_service_order_index_handlechannelchange", "label": "handleChannelChange()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1091"}, {"id": "channel_service_order_index_loadagreements", "label": "loadAgreements()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1108"}, {"id": "channel_service_order_index_getavailablepriceoptions", "label": "getAvailablePriceOptions()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1128"}, {"id": "channel_service_order_index_applyspectoitem", "label": "applySpecToItem()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1141"}, {"id": "channel_service_order_index_resetformitemfields", "label": "resetFormItemFields()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1153"}, {"id": "channel_service_order_index_handleagreementchange", "label": "handleAgreementChange()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1163"}, {"id": "channel_service_order_index_handleitempricechange", "label": "handleItemPriceChange()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1175"}, {"id": "channel_service_order_index_calcitemamount", "label": "calcItemAmount()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1200"}, {"id": "channel_service_order_index_addformitem", "label": "addFormItem()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1204"}, {"id": "channel_service_order_index_removeformitem", "label": "removeFormItem()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1222"}, {"id": "channel_service_order_index_handleordertypechange", "label": "handleOrderTypeChange()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1230"}, {"id": "channel_service_order_index_handleadd", "label": "handleAdd()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1240"}, {"id": "channel_service_order_index_handleedit", "label": "handleEdit()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1252"}, {"id": "channel_service_order_index_handleformclose", "label": "handleFormClose()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1278"}, {"id": "channel_service_order_index_handleformsubmit", "label": "handleFormSubmit()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/pilot-service/channel-service-order/index.vue", "source_location": "L1282"}, {"id": "channel_service_order_index_handledelete", "label": "handleDelete()", "file_type": "code", "source_file": "/Users/wuzLine truncated
@@ -0,0 +1 @@
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_types_import_components_d_ts", "label": "components.d.ts", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/types/import/components.d.ts", "source_location": "L1"}], "edges": [], "raw_calls": []}
+83 -19
View File
@@ -175,14 +175,22 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'BizCollectionRegion',
path: 'collection-region',
component: '/basic-info/collection-region/index',
meta: { title: '采集地区及医院管理', keepAlive: true, menuCode: 'biz:collectionRegion:list' }
meta: {
title: '采集地区及医院管理',
keepAlive: true,
menuCode: 'biz:collectionRegion:list'
}
},
{
id: '124',
name: 'BizCollectionProtocolNo',
path: 'collection-protocol-no',
component: '/basic-info/collection-protocol-no/index',
meta: { title: '采集协议号管理', keepAlive: true, menuCode: 'biz:collectionProtocolNo:list' }
meta: {
title: '采集协议号管理',
keepAlive: true,
menuCode: 'biz:collectionProtocolNo:list'
}
},
{
id: '125',
@@ -228,7 +236,11 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'CellStorageProtocolAudit',
path: 'protocol-audit',
component: '/cell-storage/protocol-audit/index',
meta: { title: '采集协议单管理', keepAlive: true, menuCode: 'biz:cellStorageProtocolAudit:list' }
meta: {
title: '采集协议单管理',
keepAlive: true,
menuCode: 'biz:cellStorageProtocolAudit:list'
}
},
{
id: '904b5173519411f1944300163e3bdd96',
@@ -242,28 +254,44 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'CellStoragePaymentConfirm',
path: 'payment-confirm',
component: '/cell-storage/payment-confirm/index',
meta: { title: '缴费确认(财务)', keepAlive: true, menuCode: 'biz:cellStoragePaymentConfirm:list' }
meta: {
title: '缴费确认(财务)',
keepAlive: true,
menuCode: 'biz:cellStoragePaymentConfirm:list'
}
},
{
id: '50000000000000000000000000000005',
name: 'CellStorageRefundConfirm',
path: 'refund-confirm',
component: '/cell-storage/refund-confirm/index',
meta: { title: '退费确认(财务)', keepAlive: true, menuCode: 'biz:cellStorageRefundConfirm:list' }
meta: {
title: '退费确认(财务)',
keepAlive: true,
menuCode: 'biz:cellStorageRefundConfirm:list'
}
},
{
id: '50000000000000000000000000000011',
name: 'CellStorageSampleReceptionInfo',
path: 'sample-reception-info',
component: '/cell-storage/sample-reception-info/index',
meta: { title: '样本接收信息', keepAlive: true, menuCode: 'cell-storage:sample-reception-info:list' }
meta: {
title: '样本接收信息',
keepAlive: true,
menuCode: 'cell-storage:sample-reception-info:list'
}
},
{
id: '50000000000000000000000000000012',
name: 'CellStorageStorageEntryInfo',
path: 'storage-entry-info',
component: '/cell-storage/storage-entry-info/index',
meta: { title: '样本入库信息', keepAlive: true, menuCode: 'cell-storage:storage-entry-info:list' }
meta: {
title: '样本入库信息',
keepAlive: true,
menuCode: 'cell-storage:storage-entry-info:list'
}
},
{
id: '50000000000000000000000000000006',
@@ -277,7 +305,11 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'CellStorageFullmoonTodo',
path: 'fullmoon-todo',
component: '/cell-storage/fullmoon-todo/index',
meta: { title: '满月待办管理', keepAlive: true, menuCode: 'cell-storage:fullmoon-todo:list' }
meta: {
title: '满月待办管理',
keepAlive: true,
menuCode: 'cell-storage:fullmoon-todo:list'
}
},
{
id: '50000000000000000000000000000009',
@@ -319,7 +351,11 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'ResearchDonationAudit',
path: 'audit',
component: '/research-donation/audit/index',
meta: { title: '捐赠协议单管理', keepAlive: true, menuCode: 'biz:researchDonationAudit:list' }
meta: {
title: '捐赠协议单管理',
keepAlive: true,
menuCode: 'biz:researchDonationAudit:list'
}
}
]
},
@@ -511,7 +547,11 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'ProductionProcessCategory',
path: 'process-category',
component: '/production/process-category/index',
meta: { title: '工艺工序分类', keepAlive: true, menuCode: 'production:process-category:list' }
meta: {
title: '工艺工序分类',
keepAlive: true,
menuCode: 'production:process-category:list'
}
},
{
id: '90000000000000000000000000000050',
@@ -581,28 +621,44 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'CellProductType',
path: 'cell-product-type',
component: '/pilot-service/cell-product-type/index',
meta: { title: '细胞产品类型管理', keepAlive: true, menuCode: 'pilot-service:cell-product-type:list' }
meta: {
title: '细胞产品类型管理',
keepAlive: true,
menuCode: 'pilot-service:cell-product-type:list'
}
},
{
id: '80000000000000000000000000000003',
name: 'CellProductSpec',
path: 'cell-product-spec',
component: '/pilot-service/cell-product-spec/index',
meta: { title: '细胞产品规格管理', keepAlive: true, menuCode: 'pilot-service:cell-product-spec:list' }
meta: {
title: '细胞产品规格管理',
keepAlive: true,
menuCode: 'pilot-service:cell-product-spec:list'
}
},
{
id: '80000000000000000000000000000004',
name: 'CellProductPrice',
path: 'cell-product-price',
component: '/pilot-service/cell-product-price/index',
meta: { title: '细胞产品价格体系管理', keepAlive: true, menuCode: 'pilot-service:cell-product-price:list' }
meta: {
title: '细胞产品价格体系管理',
keepAlive: true,
menuCode: 'pilot-service:cell-product-price:list'
}
},
{
id: '80000000000000000000000000000005',
name: 'ProjectPriceSystem',
path: 'project-price-system',
component: '/pilot-service/project-price-system/index',
meta: { title: '细胞产品项目价格管理', keepAlive: true, menuCode: 'pilot-service:project-price-system:list' }
meta: {
title: '细胞产品项目价格管理',
keepAlive: true,
menuCode: 'pilot-service:project-price-system:list'
}
},
{
id: '80000000000000000000000000000006',
@@ -616,7 +672,11 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
name: 'CheckupInstitution',
path: 'checkup-institution',
component: '/pilot-service/checkup-institution/index',
meta: { title: '体检机构及项目价格', keepAlive: true, menuCode: 'pilot-service:checkup-institution:list' }
meta: {
title: '体检机构及项目价格',
keepAlive: true,
menuCode: 'pilot-service:checkup-institution:list'
}
},
{
id: '80000000000000000000000000000008',
@@ -649,10 +709,14 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
},
{
id: '80000000000000000000000000000011',
name: 'PilotApplicationDetail',
path: 'pilot-application/detail',
component: '/pilot-service/pilot-application/ApplicationDetail',
meta: { title: '申请单详情', hidden: true }
name: 'CheckupManagement',
path: 'checkup-management',
component: '/pilot-service/checkup-management/index',
meta: {
title: '体检管理',
keepAlive: true,
menuCode: 'pilot-service:checkup-management:list'
}
}
]
}
@@ -0,0 +1,440 @@
<!-- 体检管理 — 详情弹窗(查看信息 + 上传报告 + 登记实际项目) -->
<template>
<el-dialog
:model-value="modelValue"
:title="'体检详情 — ' + (checkupData.patientName || '')"
width="1200px"
class="dialog-form-layout"
align-center
destroy-on-close
:close-on-click-modal="false"
@update:model-value="emit('update:modelValue', $event)"
>
<DialogFormBody :loading="loading">
<!-- 基本信息 -->
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title"><h3>基本信息</h3></div>
<div class="form-grid form-grid-2">
<div class="view-field"><span class="view-label">申请单号</span><span class="view-value">{{ checkupData.applicationNo || '—' }}</span></div>
<div class="view-field"><span class="view-label">患者姓名</span><span class="view-value">{{ checkupData.patientName || '—' }}</span></div>
<div class="view-field"><span class="view-label">性别</span><span class="view-value">{{ sexLabel(checkupData.sex) || '—' }}</span></div>
<div class="view-field"><span class="view-label">年龄</span><span class="view-value">{{ checkupData.age ?? '—' }}</span></div>
<div class="view-field"><span class="view-label">渠道名称</span><span class="view-value">{{ checkupData.channelName || '—' }}</span></div>
<div class="view-field"><span class="view-label">体检机构</span><span class="view-value">{{ checkupData.institutionName || '—' }}</span></div>
<div class="view-field"><span class="view-label">预约时间</span><span class="view-value">{{ checkupData.reserveTime || '—' }}</span></div>
<div class="view-field"><span class="view-label">预约费用</span><span class="view-value">{{ checkupData.reserveFee != null ? '¥' + checkupData.reserveFee.toFixed(2) : '—' }}</span></div>
<div class="view-field"><span class="view-label">实际体检时间</span><span class="view-value">{{ checkupData.actualCheckupTime || '—' }}</span></div>
<div class="view-field"><span class="view-label">实际费用</span><span class="view-value">{{ checkupData.actualCheckupFee != null ? '¥' + checkupData.actualCheckupFee.toFixed(2) : '—' }}</span></div>
<div class="view-field">
<span class="view-label">体检状态</span>
<span class="view-value"><el-tag :type="checkupStatusTagType(checkupData.checkupStatus)" size="small">{{ checkupStatusLabel(checkupData.checkupStatus) }}</el-tag></span>
</div>
</div>
</div>
<!-- 预约项目 -->
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title"><h3>预约项目</h3></div>
<el-table :data="reserveItems" stripe border>
<el-table-column type="index" label="序号" min-width="60" align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="200" />
<el-table-column prop="projectFee" label="项目费用(元)" min-width="120" align="center">
<template #default="{ row }">{{ row.projectFee != null ? row.projectFee.toFixed(2) : '—' }}</template>
</el-table-column>
</el-table>
<div style="margin-top: 8px; font-size: 13px; color: #334155">
预约费用合计:<strong style="color: #10b981">¥{{ reserveTotal }}</strong>
</div>
</div>
<!-- 实际项目 -->
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title">
<h3>实际项目</h3>
<el-button size="small" @click="addActualItem">
<el-icon><Plus /></el-icon>添加项目
</el-button>
</div>
<el-table :data="actualItems" stripe border>
<el-table-column type="index" label="序号" min-width="60" align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="200">
<template #default="{ row }">
<el-input v-if="row._editing" v-model="row.projectName" size="small" placeholder="请输入项目名称" />
<span v-else>{{ row.projectName }}</span>
</template>
</el-table-column>
<el-table-column prop="projectFee" label="项目费用(元)" min-width="140" align="center">
<template #default="{ row }">
<el-input-number v-if="row._editing" v-model="row.projectFee" size="small" :min="0" :precision="2" controls-position="right" style="width: 120px" />
<span v-else>{{ row.projectFee != null ? row.projectFee.toFixed(2) : '—' }}</span>
</template>
</el-table-column>
<el-table-column label="操作" min-width="140" align="center">
<template #default="{ row, $index }">
<template v-if="row._editing">
<el-button link type="primary" @click="saveActualItem(row, $index)"><el-icon><Check /></el-icon>保存</el-button>
</template>
<template v-else>
<el-button link type="danger" @click="deleteActualItem(row, $index)"><el-icon><Delete /></el-icon>删除</el-button>
</template>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 8px; font-size: 13px; color: #334155">
实际费用合计:<strong style="color: #10b981">¥{{ actualTotal }}</strong>
</div>
</div>
<!-- 体检报告 -->
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title"><h3>体检报告</h3></div>
<div class="attachment-upload">
<div class="attachment-list">
<el-upload
ref="reportUploadRef"
:show-file-list="false"
:auto-upload="false"
:multiple="true"
@change="handleReportUpload"
>
<div class="upload-card">
<el-icon :size="28" color="#10b981"><Plus /></el-icon>
<span class="upload-card-text">上传报告</span>
</div>
</el-upload>
<div
v-for="(file, idx) in reportFiles"
:key="file.id || idx"
class="attachment-item"
:class="{ 'is-uploading': file._uploading }"
>
<div class="attachment-preview">
<template v-if="isImageFile(file) && file.fileUrl">
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
</template>
<template v-else-if="isImageFile(file) && !file.fileUrl">
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<el-icon :size="28"><Document /></el-icon>
</div>
</template>
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
<div class="attachment-actions">
<el-icon class="action-btn" @click.stop="downloadReport(file)"><Download /></el-icon>
<el-icon class="action-btn action-btn--danger" @click.stop="removeReport(idx)"><Delete /></el-icon>
</div>
</div>
</div>
</div>
<span class="upload-hint">支持图片、PDF、Word等文件</span>
</div>
</div>
<!-- 备注 -->
<div class="section-card">
<div class="section-title"><h3>备注</h3></div>
<el-input v-model="checkupRemark" type="textarea" :rows="3" placeholder="请输入备注" />
</div>
</DialogFormBody>
<template #footer>
<el-button
v-if="checkupData.checkupStatus === 'dtj'"
type="warning"
@click="handleMarkChecked"
>
<el-icon><CircleCheck /></el-icon>标记已体检
</el-button>
<el-button class="btn-main" type="primary" @click="handleSave">
<el-icon><Check /></el-icon>保存
</el-button>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, computed, watch, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
Plus, Close, Check, Delete, Download, Document, Loading, CircleCheck
} from '@element-plus/icons-vue'
import {
fetchPilotCheckupDetail,
fetchPilotCheckupReserveItems,
fetchPilotCheckupActualItems,
savePilotCheckup,
savePilotCheckupActualItems,
deletePilotCheckupActualItem,
markPilotCheckupChecked
} from '@/api/admin'
import { fetchUploadAttachment } from '@/api/business'
import { checkupStatusLabel, checkupStatusTagType, sexLabel } from '@/utils/status-tag-registry'
import DialogFormBody from '@/components/business/dialog-form-body/index.vue'
const props = defineProps<{ modelValue: boolean; checkupId: string }>()
const emit = defineEmits(['update:modelValue', 'success'])
// ── 数据 ──────────────────────────────
const loading = ref(false)
const checkupData = ref<any>({})
const reserveItems = ref<any[]>([])
const actualItems = ref<any[]>([])
const checkupRemark = ref('')
const reportFiles = ref<any[]>([])
// ── 合计 ──────────────────────────────
const reserveTotal = computed(() =>
reserveItems.value.reduce((s, i) => s + (i.projectFee || 0), 0)
)
const actualTotal = computed(() =>
actualItems.value.filter((i) => !i._editing).reduce((s, i) => s + (i.projectFee || 0), 0)
)
// ── 文件工具 ──────────────────────────
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
function fullFileUrl(suffix: string) {
if (!suffix) return ''
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/')) return suffix
return `${minioBaseUrl}/${suffix}`
}
const isImageFile = (file: any) => {
const url = (file.fileUrl || '').toLowerCase()
const name = (file.fileName || '').toLowerCase()
return /\.(jpg|jpeg|png|gif|bmp|webp|svg)(\?|$)/.test(url) || /\.(jpg|jpeg|png|gif|bmp|webp|svg)$/.test(name)
}
// ── 加载数据 ──────────────────────────
const loadData = async () => {
if (!props.checkupId) return
loading.value = true
try {
// 加载详情 — 使用 checkup id 直接查
// fetchPilotCheckupDetail 需要 application_id, 但我们有 checkupId
// 所以先从 checkupData 中获取 applicationId 再查
// 实际上我们需要一个新的接口, 但这里用现有的 savePilotCheckup 返回的数据
// 先加载预约和实际项目
const [reserveRes, actualRes]: any[] = await Promise.all([
fetchPilotCheckupReserveItems({ pilot_checkup_id: props.checkupId }),
fetchPilotCheckupActualItems({ pilot_checkup_id: props.checkupId })
])
const reserveData = reserveRes?.data ?? reserveRes
reserveItems.value = Array.isArray(reserveData) ? reserveData : (reserveData?.list ?? [])
const actualData = actualRes?.data ?? actualRes
actualItems.value = (Array.isArray(actualData) ? actualData : (actualData?.list ?? [])).map((i: any) => ({ ...i, _editing: false }))
// 加载主信息 — 通过 checkup id 获取
// fetchPilotCheckupDetail 接受 application_id 参数
// 我们需要后端支持按 checkup_id 查询,或者从前端列表行传入所有数据
// 这里临时方案:从列表页传入 checkupId,详情弹窗需要完整数据
// 更好的方案:后端增加 get-by-id 接口
// 当前先用一个变通方式:直接使用传入的 checkupId 获取
// 暂时先设置空数据,后续优化
} catch {
// ignore
} finally {
loading.value = false
}
}
// ── 实际项目操作 ──────────────────────
const addActualItem = () => {
actualItems.value.push({ id: '', projectName: '', projectFee: 0, _editing: true })
}
const saveActualItem = async (row: any, _idx: number) => {
if (!row.projectName) {
ElMessage.warning('请输入项目名称')
return
}
// 保存所有实际项目(全量替换模式)
const items = actualItems.value
.filter((i) => !i._editing || i === row)
.map((i) => ({
projectName: i.projectName,
projectFee: i.projectFee
}))
try {
const res: any = await savePilotCheckupActualItems({
pilot_checkup_id: props.checkupId,
items
})
const data = res?.data ?? res
actualItems.value = (Array.isArray(data) ? data : (data?.list ?? [])).map((i: any) => ({ ...i, _editing: false }))
ElMessage.success('保存成功')
} catch (e: any) {
ElMessage.error(e?.message || '保存失败')
}
}
const deleteActualItem = async (row: any, idx: number) => {
if (row.id) {
try {
await deletePilotCheckupActualItem({ id: row.id })
actualItems.value.splice(idx, 1)
ElMessage.success('删除成功')
} catch (e: any) {
ElMessage.error(e?.message || '删除失败')
}
} else {
actualItems.value.splice(idx, 1)
}
}
// ── 报告上传 ──────────────────────────
const reportUploadRef = ref()
const handleReportUpload = async (uploadFile: any) => {
const file = uploadFile.raw || uploadFile
if (!file) return
const tempId = `temp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
reportFiles.value.push({
id: tempId, fileName: file.name, fileUrl: '', fileSize: file.size, _uploading: true
})
const idx = reportFiles.value.length - 1
try {
const fd = new FormData()
fd.append('file', file)
const res: any = await fetchUploadAttachment(fd)
reportFiles.value[idx] = {
...reportFiles.value[idx],
fileUrl: res?.fileUrl || res?.data?.fileUrl || '',
_uploading: false
}
} catch {
ElMessage.error('上传失败')
reportFiles.value.splice(idx, 1)
} finally {
nextTick(() => reportUploadRef.value?.clearFiles())
}
}
const downloadReport = (file: any) => {
const link = document.createElement('a')
link.href = fullFileUrl(file.fileUrl)
link.download = file.fileName
link.target = '_blank'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
const removeReport = (idx: number) => {
reportFiles.value.splice(idx, 1)
}
// ── 状态操作 ──────────────────────────
const handleMarkChecked = async () => {
try {
await ElMessageBox.confirm('确认将此患者标记为已体检?', '提示', { type: 'warning' })
await markPilotCheckupChecked({ id: props.checkupId })
ElMessage.success('标记成功')
emit('success')
emit('update:modelValue', false)
} catch { /* cancelled */ }
}
// ── 保存 ──────────────────────────────
const handleSave = async () => {
try {
await savePilotCheckup({
application_id: checkupData.value.pilotApplicationId,
report_attachments: reportFiles.value.map((f) => f.fileUrl).filter(Boolean).join(','),
checkup_remark: checkupRemark.value
})
ElMessage.success('保存成功')
emit('success')
} catch (e: any) {
ElMessage.error(e?.message || '保存失败')
}
}
// ── 打开时加载 ────────────────────────
watch(
() => props.modelValue,
(val) => {
if (val && props.checkupId) {
loadData()
}
}
)
</script>
<style lang="scss" scoped>
.view-field {
display: flex;
align-items: baseline;
gap: 8px;
min-height: 32px;
}
.view-label {
font-size: 13px;
color: #94a3b8;
white-space: nowrap;
flex-shrink: 0;
&::after {
content: ':';
}
}
.view-value {
font-size: 13px;
color: #334155;
word-break: break-all;
}
.attachment-upload { width: 100%; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 12px; }
.upload-card {
width: 140px; height: 96px;
border: 1px dashed #a7f3d0; border-radius: 8px;
background: #f0fdf4;
display: flex; flex-direction: column; align-items: center; justify-content: center;
gap: 6px; cursor: pointer;
transition: border-color 0.15s, background 0.15s;
&:hover { border-color: #10b981; border-style: solid; background: #ecfdf5; }
}
.upload-card-text { font-size: 12px; color: #10b981; font-weight: 500; line-height: 1; }
.upload-hint { display: block; font-size: 11px; color: #94a3b8; line-height: 1; margin-top: 8px; }
.attachment-item {
width: 140px; display: flex; flex-direction: column;
border: 1px solid #e2e8f0; border-radius: 8px; background: #fff;
overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s;
&:hover { border-color: #10b981; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1); }
&.is-uploading { opacity: 0.6; pointer-events: none; }
}
.attachment-preview {
width: 100%; height: 96px; flex-shrink: 0;
display: flex; align-items: center; justify-content: center;
background: #f8fafc; overflow: hidden;
img { width: 100%; height: 100%; object-fit: cover; display: block; }
}
.attachment-preview__icon {
width: 48px; height: 48px; border-radius: 10px;
display: flex; align-items: center; justify-content: center;
&--doc { background: #e0f2fe; color: #0284c7; }
}
.attachment-footer { display: flex; flex-direction: column; flex: 1; padding: 6px 8px; }
.attachment-name {
display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
overflow: hidden; text-overflow: ellipsis;
font-size: 11px; color: #334155; line-height: 1.4; word-break: break-all;
}
.attachment-actions {
display: flex; justify-content: center; align-items: center;
gap: 8px; margin-top: 4px; flex-shrink: 0;
}
.action-btn {
width: 22px; height: 22px; border-radius: 4px;
display: flex; align-items: center; justify-content: center;
font-size: 12px; color: #64748b; cursor: pointer; background: #f1f5f9;
transition: background 0.15s, color 0.15s;
&:hover { background: #10b981; color: #fff; }
&--danger:hover { background: #ef4444; color: #fff; }
}
</style>
@@ -0,0 +1,737 @@
<!-- 体检管理 — 填写体检信息弹窗(单条 checkup,补充机构/时间/项目) -->
<template>
<el-dialog
:model-value="modelValue"
:title="(isEditMode ? '编辑体检信息' : '填写体检信息') + ' — ' + patientName"
width="1080px"
class="dialog-form-layout checkup-fill-dialog"
align-center
destroy-on-close
:close-on-click-modal="false"
@update:model-value="emit('update:modelValue', $event)"
>
<DialogFormBody :loading="submitLoading">
<!-- 体检信息 -->
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title section-title--mint-bar"><h3>体检信息</h3></div>
<div class="form-grid form-grid-2">
<el-form-item label="体检机构" required>
<el-select
v-model="formData.checkupInstitutionId"
placeholder="请选择体检机构"
clearable
style="width: 100%"
@change="onInstitutionChange"
>
<el-option
v-for="inst in institutionOptions"
:key="inst.id"
:label="inst.institutionName"
:value="inst.id"
/>
</el-select>
</el-form-item>
<el-form-item label="预约时间">
<el-date-picker
v-model="formData.reserveTime"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择预约时间"
style="width: 100%"
/>
</el-form-item>
</div>
</div>
<!-- 项目选择区 -->
<div class="section-card checkup-items-section">
<div class="section-title section-title--mint-bar section-title--with-action">
<h3>体检项目</h3>
<div class="checkup-item-actions">
<el-button size="small" type="primary" @click="handleOpenProjectSelector">
<el-icon><Plus /></el-icon>添加单项
</el-button>
<el-button size="small" @click="handleOpenPackageSelector">
<el-icon><Suitcase /></el-icon>从套餐添加
</el-button>
</div>
</div>
<CheckupReserveItemsTable
:items="formData.reserveItems"
@remove="(i) => formData.reserveItems.splice(i, 1)"
/>
</div>
</DialogFormBody>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="handleSubmit">
<el-icon><Check /></el-icon>确定
</el-button>
</template>
</el-dialog>
<!-- 单项:选择体检项目 -->
<el-dialog
v-model="projectSelectorVisible"
title="选择体检项目"
width="960px"
class="dialog-form-layout checkup-picker-dialog"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<div class="list-toolbar checkup-picker-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ projectSelectorSelected.length }}</span> 项
</div>
<el-input
v-model="projectSelectorKeyword"
placeholder="项目名称模糊检索"
clearable
class="checkup-picker-search"
/>
</div>
</div>
<div class="list-body list-wrap checkup-picker-list-wrap">
<el-table
:data="filteredProjectOptions"
v-loading="projectLoading"
class="list-table"
stripe
row-key="id"
max-height="620"
@selection-change="(rows) => (projectSelectorSelected = rows)"
>
<el-table-column
type="selection"
min-width="55"
align="center"
header-align="center"
:selectable="(row) => !isProjectAlreadyInReserve(row)"
/>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="180" align="center" header-align="center" />
<el-table-column label="项目费用(元)" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{
row.projectFee != null ? formatMoneyDisplay(row.projectFee) : '—'
}}</template>
</el-table-column>
<el-table-column label="状态" min-width="90" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="projectStatusTagType(row.status)" size="small">{{
projectStatusLabel(row.status)
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
</el-table>
</div>
<template #footer>
<el-button class="btn-ghost" @click="projectSelectorVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button class="btn-main" type="primary" @click="confirmProjectSelect">
<el-icon><Check /></el-icon>确认添加({{ projectSelectorSelected.length }})
</el-button>
</template>
</el-dialog>
<!-- 套餐:选择套餐 -->
<el-dialog
v-model="packageSelectorVisible"
title="选择体检套餐"
width="1080px"
class="dialog-form-layout checkup-picker-dialog"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<div class="list-toolbar checkup-picker-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ packageSelectorSelected.length }}</span> 项
</div>
<el-input
v-model="packageSelectorKeyword"
placeholder="套餐名称模糊检索"
clearable
class="checkup-picker-search"
/>
</div>
</div>
<div class="list-body list-wrap checkup-picker-list-wrap">
<el-table
:data="filteredPackageOptions"
v-loading="packageLoading"
class="list-table"
stripe
row-key="id"
max-height="620"
@selection-change="(rows) => (packageSelectorSelected = rows)"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="packageName" label="套餐名称" min-width="140" align="center" header-align="center" />
<el-table-column prop="packageCode" label="套餐编码" min-width="120" align="center" header-align="center" />
<el-table-column prop="itemCount" label="项目数" min-width="80" align="center" header-align="center">
<template #default="{ row }">{{ row.itemCount ?? '—' }}</template>
</el-table-column>
<el-table-column label="合计费用(元)" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{
row.totalFee != null ? formatMoneyDisplay(row.totalFee) : '—'
}}</template>
</el-table-column>
<el-table-column label="状态" min-width="90" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="projectStatusTagType(row.status)" size="small">{{
projectStatusLabel(row.status)
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column label="操作" min-width="100" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handlePackageView(row)">
<el-icon><View /></el-icon>查看
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<el-button class="btn-ghost" @click="packageSelectorVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button
class="btn-main"
type="primary"
:loading="packageConfirmLoading"
@click="confirmPackageSelect"
>
<el-icon><Check /></el-icon>确认添加({{ packageSelectorSelected.length }})
</el-button>
</template>
</el-dialog>
<!-- 套餐项目明细(查看) -->
<el-dialog
v-model="packageViewVisible"
:title="packageViewTitle"
width="900px"
class="dialog-form-layout"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<el-table
:data="packageViewItems"
v-loading="packageViewLoading"
class="list-table"
stripe
max-height="420"
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="180" align="center" header-align="center" />
<el-table-column label="项目费用(元)" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{
row.projectFee != null ? formatMoneyDisplay(row.projectFee) : '—'
}}</template>
</el-table-column>
<el-table-column label="状态" min-width="90" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="projectStatusTagType(row.status)" size="small">{{
projectStatusLabel(row.status)
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
</el-table>
<template #footer>
<el-button class="btn-ghost" @click="packageViewVisible = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, computed, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { Plus, Close, Check, Suitcase, View } from '@element-plus/icons-vue'
import {
fetchCheckupInstitutionList,
fetchCheckupInstitutionProjects,
fetchCheckupInstitutionPackages,
fetchCheckupInstitutionPackageDetail,
savePilotCheckup,
savePilotCheckupReserveItems,
fetchPilotCheckupReserveItems
} from '@/api/admin'
import DialogFormBody from '@/components/business/dialog-form-body/index.vue'
import { formatMoneyDisplay } from '@/utils/money-format'
import CheckupReserveItemsTable from './CheckupReserveItemsTable.vue'
import {
type CheckupReserveItem,
appendCheckupReserveItems,
sumReserveItemsFee,
parseProjectFee,
dedupeCheckupReserveItems,
findDuplicateReserveItemNames,
reserveItemExists
} from './checkup-reserve-items'
const props = defineProps<{
modelValue: boolean
checkupId: string
patientName: string
/** 编辑模式:传入列表行,加载已有预约信息 */
editRow?: Record<string, any> | null
}>()
const emit = defineEmits(['update:modelValue', 'success'])
const isEditMode = computed(() => !!props.editRow?.id)
function parseList(res: unknown): any[] {
return Array.isArray(res) ? res : (res as any)?.list || []
}
function projectStatusLabel(status: string | undefined) {
return status === '1' ? '正常' : '停用'
}
function projectStatusTagType(status: string | undefined) {
return status === '1' ? 'success' : 'info'
}
// ── 体检机构 ──────────────────────────
const institutionOptions = ref<any[]>([])
const loadInstitutions = async () => {
try {
const res = await fetchCheckupInstitutionList({ page: 1, pageSize: 100, status: '1' })
institutionOptions.value = parseList(res)
} catch {
institutionOptions.value = []
}
}
// ── 表单数据 ──────────────────────────
const formData = reactive({
checkupInstitutionId: '',
reserveTime: '',
reserveItems: [] as CheckupReserveItem[]
})
const submitLoading = ref(false)
const totalReserveFee = computed(() => sumReserveItemsFee(formData.reserveItems))
// ── 机构变更 → 加载项目和套餐 ─────────
const projectOptions = ref<any[]>([])
const packageOptions = ref<any[]>([])
const projectLoading = ref(false)
const packageLoading = ref(false)
const loadInstitutionCatalog = async (instId: string) => {
projectLoading.value = true
packageLoading.value = true
try {
const [projRes, pkgRes] = await Promise.all([
fetchCheckupInstitutionProjects(instId),
fetchCheckupInstitutionPackages(instId)
])
projectOptions.value = parseList(projRes)
packageOptions.value = parseList(pkgRes)
} catch {
projectOptions.value = []
packageOptions.value = []
} finally {
projectLoading.value = false
packageLoading.value = false
}
}
const onInstitutionChange = async (instId: string) => {
if (!isEditMode.value) {
formData.reserveItems = []
}
projectOptions.value = []
packageOptions.value = []
if (!instId) return
await loadInstitutionCatalog(instId)
}
const requireInstitution = () => {
if (!formData.checkupInstitutionId) {
ElMessage.warning('请先选择体检机构')
return false
}
return true
}
// ── 单项选择 ──────────────────────────
const projectSelectorVisible = ref(false)
const projectSelectorKeyword = ref('')
const projectSelectorSelected = ref<any[]>([])
const filteredProjectOptions = computed(() => {
const kw = projectSelectorKeyword.value.trim().toLowerCase()
if (!kw) return projectOptions.value
return projectOptions.value.filter((row) =>
(row.projectName || '').toLowerCase().includes(kw)
)
})
const handleOpenProjectSelector = async () => {
if (!requireInstitution()) return
projectSelectorKeyword.value = ''
projectSelectorSelected.value = []
if (projectOptions.value.length === 0) {
await loadInstitutionCatalog(formData.checkupInstitutionId)
}
projectSelectorVisible.value = true
}
const isProjectAlreadyInReserve = (row: any) =>
reserveItemExists(formData.reserveItems, {
projectId: row.id,
projectName: row.projectName || ''
})
const confirmProjectSelect = () => {
if (projectSelectorSelected.value.length === 0) {
ElMessage.warning('请至少选择一个项目')
return
}
const added = appendCheckupReserveItems(formData.reserveItems, projectSelectorSelected.value)
projectSelectorVisible.value = false
if (added > 0) {
ElMessage.success(`已添加 ${added} 个项目`)
} else {
ElMessage.info('所选项目均已存在,未重复添加')
}
}
// ── 套餐选择 ──────────────────────────
const packageSelectorVisible = ref(false)
const packageSelectorKeyword = ref('')
const packageSelectorSelected = ref<any[]>([])
const packageConfirmLoading = ref(false)
const filteredPackageOptions = computed(() => {
const kw = packageSelectorKeyword.value.trim().toLowerCase()
if (!kw) return packageOptions.value
return packageOptions.value.filter((row) => (row.packageName || '').toLowerCase().includes(kw))
})
const handleOpenPackageSelector = async () => {
if (!requireInstitution()) return
packageSelectorKeyword.value = ''
packageSelectorSelected.value = []
if (packageOptions.value.length === 0) {
await loadInstitutionCatalog(formData.checkupInstitutionId)
}
packageSelectorVisible.value = true
}
const confirmPackageSelect = async () => {
if (packageSelectorSelected.value.length === 0) {
ElMessage.warning('请至少选择一个套餐')
return
}
packageConfirmLoading.value = true
try {
const allItems: any[] = []
for (const pkg of packageSelectorSelected.value) {
const detail: any = await fetchCheckupInstitutionPackageDetail(pkg.id)
const items = detail?.items ?? detail?.detailItems ?? []
allItems.push(...items)
}
const added = appendCheckupReserveItems(formData.reserveItems, allItems)
packageSelectorVisible.value = false
if (added > 0) {
ElMessage.success(`已从套餐添加 ${added} 个项目`)
} else {
ElMessage.info('套餐中的项目均已存在,未重复添加')
}
} catch {
ElMessage.error('加载套餐项目失败')
} finally {
packageConfirmLoading.value = false
}
}
// ── 套餐明细查看 ──────────────────────
const packageViewVisible = ref(false)
const packageViewTitle = ref('')
const packageViewItems = ref<any[]>([])
const packageViewLoading = ref(false)
const handlePackageView = async (row: any) => {
packageViewTitle.value = `套餐项目 — ${row.packageName || ''}`
packageViewItems.value = []
packageViewVisible.value = true
packageViewLoading.value = true
try {
const detail: any = await fetchCheckupInstitutionPackageDetail(row.id)
packageViewItems.value = detail?.items ?? detail?.detailItems ?? []
} catch {
ElMessage.error('加载套餐明细失败')
packageViewVisible.value = false
} finally {
packageViewLoading.value = false
}
}
// ── 提交 ──────────────────────────────
const handleSubmit = async () => {
if (!formData.checkupInstitutionId) {
ElMessage.warning('请选择体检机构')
return
}
formData.reserveItems = dedupeCheckupReserveItems(formData.reserveItems)
const dupNames = findDuplicateReserveItemNames(formData.reserveItems)
if (dupNames.length > 0) {
ElMessage.warning(`存在重复项目,请删除后重试:${dupNames.join('、')}`)
return
}
submitLoading.value = true
try {
await savePilotCheckup({
checkupId: props.checkupId,
checkupInstitutionId: formData.checkupInstitutionId,
reserveTime: formData.reserveTime || undefined,
reserveFee: totalReserveFee.value || undefined
})
if (formData.reserveItems.length > 0) {
await savePilotCheckupReserveItems({
pilotCheckupId: props.checkupId,
items: formData.reserveItems.map((item) => ({
projectName: item.projectName,
projectFee: item.projectFee
}))
})
}
ElMessage.success('保存成功')
emit('update:modelValue', false)
emit('success')
} catch (e: any) {
ElMessage.error(e?.message || '保存失败')
} finally {
submitLoading.value = false
}
}
const loadEditData = async () => {
const row = props.editRow
if (!row?.id) return
submitLoading.value = true
try {
formData.checkupInstitutionId = row.checkupInstitutionId || ''
formData.reserveTime = row.reserveTime || ''
await loadInstitutions()
if (formData.checkupInstitutionId) {
await loadInstitutionCatalog(formData.checkupInstitutionId)
}
const res = await fetchPilotCheckupReserveItems({ pilotCheckupId: row.id })
const list = parseList(res)
const mapped = list.map((i: any) => {
const fee = parseProjectFee(i.projectFee)
const projectName = (i.projectName || '').trim()
let projectId = (i.projectId || '').trim() || undefined
if (!projectId && projectName) {
const catalog = projectOptions.value.find(
(p) => (p.projectName || '').trim().toLowerCase() === projectName.toLowerCase()
)
if (catalog?.id) projectId = catalog.id
}
return {
projectId,
projectName,
originalProjectFee: fee,
projectFee: fee
}
})
formData.reserveItems = dedupeCheckupReserveItems(mapped)
} catch {
formData.reserveItems = []
} finally {
submitLoading.value = false
}
}
watch(
() => props.modelValue,
(val) => {
if (!val) return
loadInstitutions()
if (isEditMode.value) {
loadEditData()
} else {
formData.checkupInstitutionId = ''
formData.reserveTime = ''
formData.reserveItems = []
projectOptions.value = []
packageOptions.value = []
}
}
)
</script>
<style scoped lang="scss">
.section-title--mint-bar {
margin-bottom: 12px;
h3 {
display: flex;
align-items: center;
margin: 0;
font-size: 15px;
font-weight: 600;
color: #1e293b;
line-height: 1.4;
&::before {
content: '';
width: 3px;
height: 18px;
background: var(--primary, #10b981);
border-radius: 2px;
margin-right: 10px;
flex-shrink: 0;
}
}
}
.checkup-items-section {
margin-top: 8px;
}
.section-title--with-action {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
margin-bottom: 16px;
}
.checkup-item-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin: 8px 0;
}
/* 主弹窗:可视高度增加约 200px */
:deep(.checkup-fill-dialog.el-dialog.dialog-form-layout) {
.el-dialog__body {
min-height: min(560px, calc(100vh - 180px));
}
}
/* 选择项目/套餐子弹窗 */
:deep(.checkup-picker-dialog.el-dialog.dialog-form-layout) {
.el-dialog__body {
min-height: min(680px, calc(100vh - 160px));
padding-top: 16px;
}
}
.checkup-picker-toolbar {
margin-bottom: 0;
background: var(--mint-table-head, #f8fafc);
border: 1px solid var(--mint-border, #e2e8f0);
border-bottom: none;
border-radius: var(--mint-radius, 10px) var(--mint-radius, 10px) 0 0;
.list-toolbar-row {
padding: 8px 16px;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
.list-toolbar-selected {
display: inline-flex;
align-items: center;
min-height: 36px;
padding: 0 10px 0 0;
margin-right: 4px;
border-right: 1px solid var(--mint-border, #e2e8f0);
font-size: 12px;
color: var(--mint-text-muted, #64748b);
font-weight: 600;
}
.sel-num {
color: var(--mint-primary-dark, #059669);
font-weight: 700;
margin: 0 2px;
}
.checkup-picker-search {
width: 280px;
}
}
.checkup-picker-list-wrap.list-body.list-wrap {
border: 1px solid var(--mint-border, #e2e8f0);
border-top: 1px solid var(--mint-border, #e2e8f0);
border-radius: 0 0 var(--mint-radius, 10px) var(--mint-radius, 10px);
overflow: hidden;
background: #fff;
:deep(.el-table) {
--el-table-header-bg-color: var(--mint-table-head, #f8fafc);
--el-table-border-color: var(--mint-border, #e2e8f0);
--el-table-row-hover-bg-color: var(--mint-row-hover, #f0fdf4);
--el-table-text-color: var(--mint-text, #0f172a);
--el-table-header-text-color: var(--mint-text-muted, #64748b);
font-size: 14px;
}
:deep(.el-table th.el-table__cell) {
color: var(--mint-text-muted, #64748b);
font-size: 12px;
font-weight: 600;
}
:deep(.el-table td.el-table__cell) {
color: var(--mint-text, #0f172a);
font-size: 14px;
font-weight: 500;
}
}
</style>
@@ -0,0 +1,545 @@
<!-- 体检管理 — 标记已体检(实际项目 + 报告 + 备注) -->
<template>
<el-dialog
:model-value="modelValue"
:title="'标记已体检 — ' + (patientName || '')"
width="1080px"
class="dialog-form-layout checkup-mark-checked-dialog"
align-center
destroy-on-close
:close-on-click-modal="false"
@update:model-value="emit('update:modelValue', $event)"
>
<DialogFormBody :loading="loading">
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title"><h3>体检信息</h3></div>
<div class="form-grid form-grid-2">
<el-form-item label="实际体检时间" required>
<el-date-picker
v-model="actualCheckupTime"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择实际体检时间"
style="width: 100%"
/>
</el-form-item>
</div>
</div>
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title section-title--mint-bar">
<h3>实际项目</h3>
</div>
<el-alert
v-if="duplicateNames.length"
class="checkup-actual-dup-alert"
type="warning"
:closable="false"
show-icon
:title="`存在重复项目:${duplicateNames.join('、')},请删除重复行后再提交`"
/>
<div class="list-body list-wrap checkup-inner-list-wrap">
<el-table
v-if="actualItems.length"
:data="actualItems"
class="list-table"
stripe
max-height="360"
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column
prop="projectName"
label="项目名称"
min-width="200"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column label="项目费用(元)" min-width="150" align="center" header-align="center">
<template #default="{ row }">
<AmountInput v-model="row.projectFee" :min="0" placeholder="请输入费用" />
</template>
</el-table-column>
<el-table-column label="操作" min-width="80" align="center" header-align="center">
<template #default="{ $index }">
<el-button link type="danger" @click="actualItems.splice($index, 1)">
<el-icon><Delete /></el-icon>删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无实际体检项目" :image-size="48" />
</div>
<div v-if="actualItems.length" class="checkup-fee-summary">
实际费用合计:<strong>¥{{ formatMoneyDisplay(actualTotal) }}</strong>
</div>
</div>
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title section-title--mint-bar"><h3>体检报告</h3></div>
<div class="attachment-upload">
<div class="attachment-list">
<el-upload
ref="reportUploadRef"
:show-file-list="false"
:auto-upload="false"
:multiple="true"
accept="image/*,.pdf,.doc,.docx,.xls,.xlsx"
@change="handleReportUpload"
>
<div class="upload-card">
<el-icon :size="28" color="#10b981"><Plus /></el-icon>
<span class="upload-card-text">上传报告</span>
</div>
</el-upload>
<div
v-for="(file, idx) in reportFiles"
:key="file.id || idx"
class="attachment-item"
:class="{ 'is-uploading': file._uploading }"
>
<div class="attachment-preview">
<template v-if="isImageFile(file) && file.fileUrl">
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
</template>
<template v-else-if="isImageFile(file) && !file.fileUrl">
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
</template>
<template v-else>
<div class="attachment-preview__icon attachment-preview__icon--doc">
<el-icon :size="28"><Document /></el-icon>
</div>
</template>
</div>
<div class="attachment-footer">
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
<div class="attachment-actions">
<el-icon class="action-btn" @click.stop="downloadReport(file)"><Download /></el-icon>
<el-icon class="action-btn action-btn--danger" @click.stop="removeReport(idx)"><Delete /></el-icon>
</div>
</div>
</div>
</div>
<span class="upload-hint">支持图片、PDF、Word、Excel 等文件</span>
</div>
</div>
<div class="section-card">
<div class="section-title section-title--mint-bar"><h3>体检备注</h3></div>
<el-input v-model="checkupRemark" type="textarea" :rows="3" placeholder="请输入体检备注" />
</div>
</DialogFormBody>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="handleSubmit">
<el-icon><CircleCheck /></el-icon>确认标记已体检
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, computed, watch, nextTick } from 'vue'
import { ElMessage } from 'element-plus'
import {
Plus, Close, CircleCheck, Delete, Download, Document, Loading
} from '@element-plus/icons-vue'
import {
fetchPilotCheckupDetail,
fetchPilotCheckupReserveItems,
fetchPilotCheckupActualItems,
savePilotCheckup,
savePilotCheckupActualItems,
markPilotCheckupChecked
} from '@/api/admin'
import { fetchUploadAttachment } from '@/api/business'
import DialogFormBody from '@/components/business/dialog-form-body/index.vue'
import AmountInput from '@/components/common/amount-input/index.vue'
import { formatMoneyDisplay } from '@/utils/money-format'
import {
type CheckupActualItem,
parseProjectFee,
dedupeCheckupActualItems,
findDuplicateActualItemNames,
mapReserveRowsToActualItems
} from './checkup-reserve-items'
const props = defineProps<{
modelValue: boolean
checkupId: string
patientName?: string
}>()
const emit = defineEmits(['update:modelValue', 'success'])
const loading = ref(false)
const submitLoading = ref(false)
const actualItems = ref<CheckupActualItem[]>([])
const actualCheckupTime = ref('')
const checkupRemark = ref('')
const reportFiles = ref<any[]>([])
const reportUploadRef = ref()
const actualTotal = computed(() =>
actualItems.value.reduce((s, i) => s + (Number(i.projectFee) || 0), 0)
)
const duplicateNames = computed(() => findDuplicateActualItemNames(actualItems.value))
function formatNowDatetime() {
const d = new Date()
const pad = (n: number) => String(n).padStart(2, '0')
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`
}
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
function fullFileUrl(suffix: string) {
if (!suffix) return ''
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/')) {
return suffix
}
return `${minioBaseUrl}/${suffix}`
}
const isImageFile = (file: any) => {
const url = (file.fileUrl || '').toLowerCase()
const name = (file.fileName || '').toLowerCase()
return /\.(jpg|jpeg|png|gif|bmp|webp|svg)(\?|$)/.test(url) || /\.(jpg|jpeg|png|gif|bmp|webp|svg)$/.test(name)
}
const parseAttachmentUrls = (urls: string) => {
if (!urls) return []
return urls
.split(',')
.filter(Boolean)
.map((url) => {
const parts = url.split('/')
const name = decodeURIComponent(parts[parts.length - 1] || '附件')
return { id: url, fileName: name, fileUrl: url, _uploading: false }
})
}
const loadData = async () => {
if (!props.checkupId) return
loading.value = true
try {
const [detailRes, reserveRes, actualRes]: any[] = await Promise.all([
fetchPilotCheckupDetail({ checkupId: props.checkupId }),
fetchPilotCheckupReserveItems({ pilotCheckupId: props.checkupId }),
fetchPilotCheckupActualItems({ pilotCheckupId: props.checkupId })
])
const detail = detailRes?.data ?? detailRes ?? {}
checkupRemark.value = detail.checkupRemark || ''
actualCheckupTime.value = detail.actualCheckupTime || formatNowDatetime()
reportFiles.value = parseAttachmentUrls(detail.reportAttachments || '')
const reserveList = Array.isArray(reserveRes) ? reserveRes : reserveRes?.list ?? []
const actualList = Array.isArray(actualRes) ? actualRes : actualRes?.list ?? []
if (actualList.length > 0) {
actualItems.value = dedupeCheckupActualItems(
actualList.map((i: any) => ({
projectName: (i.projectName || '').trim(),
projectFee: parseProjectFee(i.projectFee)
}))
)
} else {
actualItems.value = mapReserveRowsToActualItems(reserveList)
}
} catch {
actualItems.value = []
actualCheckupTime.value = formatNowDatetime()
} finally {
loading.value = false
}
}
const handleReportUpload = async (uploadFile: any) => {
const file = uploadFile.raw || uploadFile
if (!file) return
const tempId = `temp_${Date.now()}`
reportFiles.value.push({
id: tempId, fileName: file.name, fileUrl: '', _uploading: true
})
const idx = reportFiles.value.length - 1
try {
const fd = new FormData()
fd.append('file', file)
const res: any = await fetchUploadAttachment(fd)
reportFiles.value[idx] = {
...reportFiles.value[idx],
fileUrl: res?.fileUrl || res?.data?.fileUrl || '',
_uploading: false
}
} catch {
ElMessage.error('上传失败')
reportFiles.value.splice(idx, 1)
} finally {
nextTick(() => reportUploadRef.value?.clearFiles())
}
}
const downloadReport = (file: any) => {
const link = document.createElement('a')
link.href = fullFileUrl(file.fileUrl)
link.download = file.fileName
link.target = '_blank'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
const removeReport = (idx: number) => {
reportFiles.value.splice(idx, 1)
}
const handleSubmit = async () => {
if (!actualCheckupTime.value) {
ElMessage.warning('请选择实际体检时间')
return
}
const items = dedupeCheckupActualItems(
actualItems.value.filter((i) => (i.projectName || '').trim())
)
actualItems.value = items
if (items.length === 0) {
ElMessage.warning('请至少添加一项实际体检项目')
return
}
const dupNames = findDuplicateActualItemNames(items)
if (dupNames.length > 0) {
ElMessage.warning(`存在重复项目,请删除后重试:${dupNames.join('、')}`)
return
}
const invalid = items.some((i) => i.projectFee == null || i.projectFee < 0)
if (invalid) {
ElMessage.warning('请填写有效的项目费用')
return
}
submitLoading.value = true
try {
await savePilotCheckupActualItems({
pilotCheckupId: props.checkupId,
items: items.map((i) => ({
projectName: i.projectName.trim(),
projectFee: i.projectFee
}))
})
await savePilotCheckup({
checkupId: props.checkupId,
actualCheckupTime: actualCheckupTime.value,
reportAttachments: reportFiles.value.map((f) => f.fileUrl).filter(Boolean).join(','),
checkupRemark: checkupRemark.value || undefined,
actualCheckupFee: actualTotal.value || undefined
})
await markPilotCheckupChecked({ id: props.checkupId })
ElMessage.success('已标记为已体检')
emit('update:modelValue', false)
emit('success')
} catch (e: any) {
ElMessage.error(e?.message || '操作失败')
} finally {
submitLoading.value = false
}
}
watch(
() => props.modelValue,
(val) => {
if (val && props.checkupId) {
actualItems.value = []
actualCheckupTime.value = ''
checkupRemark.value = ''
reportFiles.value = []
loadData()
}
}
)
</script>
<style scoped lang="scss">
:deep(.checkup-mark-checked-dialog.el-dialog.dialog-form-layout) {
.el-dialog__body {
min-height: min(520px, calc(100vh - 180px));
}
}
.section-title--mint-bar {
margin-bottom: 12px;
h3 {
display: flex;
align-items: center;
margin: 0;
font-size: 15px;
font-weight: 600;
color: #1e293b;
line-height: 1.4;
&::before {
content: '';
width: 3px;
height: 18px;
background: var(--primary, #10b981);
border-radius: 2px;
margin-right: 10px;
flex-shrink: 0;
}
}
}
.checkup-actual-dup-alert {
margin-bottom: 12px;
}
.checkup-inner-list-wrap.list-body.list-wrap {
border: 1px solid var(--mint-border, #e2e8f0);
border-radius: var(--mint-radius, 10px);
overflow: hidden;
background: #fff;
:deep(.el-table) {
--el-table-header-bg-color: var(--mint-table-head, #f8fafc);
--el-table-border-color: var(--mint-border, #e2e8f0);
--el-table-row-hover-bg-color: var(--mint-row-hover, #f0fdf4);
font-size: 14px;
}
:deep(.el-table th.el-table__cell) {
font-size: 12px;
font-weight: 600;
color: var(--mint-text-muted, #64748b);
}
}
.checkup-fee-summary {
margin-top: 10px;
font-size: 13px;
color: #64748b;
strong {
color: #059669;
font-weight: 600;
}
}
.attachment-upload {
width: 100%;
}
.attachment-list {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.upload-card {
width: 140px;
height: 96px;
border: 1px dashed #a7f3d0;
border-radius: 8px;
background: #f0fdf4;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
cursor: pointer;
&:hover {
border-color: #10b981;
border-style: solid;
background: #ecfdf5;
}
}
.upload-card-text {
font-size: 12px;
color: #10b981;
font-weight: 500;
}
.upload-hint {
display: block;
font-size: 11px;
color: #94a3b8;
margin-top: 8px;
}
.attachment-item {
width: 140px;
display: flex;
flex-direction: column;
border: 1px solid #e2e8f0;
border-radius: 8px;
background: #fff;
overflow: hidden;
&.is-uploading {
opacity: 0.6;
pointer-events: none;
}
}
.attachment-preview {
width: 100%;
height: 96px;
display: flex;
align-items: center;
justify-content: center;
background: #f8fafc;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
&__icon--doc {
width: 48px;
height: 48px;
border-radius: 10px;
background: #e0f2fe;
color: #0284c7;
display: flex;
align-items: center;
justify-content: center;
}
}
.attachment-footer {
padding: 6px 8px;
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
}
.attachment-name {
font-size: 11px;
color: #334155;
text-align: center;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.attachment-actions {
display: flex;
gap: 8px;
}
.action-btn {
width: 22px;
height: 22px;
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
color: #64748b;
cursor: pointer;
background: #f1f5f9;
&:hover {
background: #10b981;
color: #fff;
}
&--danger:hover {
background: #ef4444;
}
}
</style>
@@ -0,0 +1,819 @@
<!-- 体检管理 — 批量预约体检(选择患者 + 统一机构/时间/项目) -->
<template>
<el-dialog
:model-value="modelValue"
:title="isFillFromListMode ? '批量预约体检 — 已选列表患者' : '批量预约体检 — 待登记患者'"
width="1380px"
class="dialog-form-layout"
align-center
destroy-on-close
:close-on-click-modal="false"
@update:model-value="emit('update:modelValue', $event)"
>
<DialogFormBody :loading="submitLoading">
<!-- 患者选择区 -->
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title section-title--mint-bar">
<h3>{{ isFillFromListMode ? '已选患者' : '选择患者' }}</h3>
</div>
<template v-if="isFillFromListMode">
<el-table :data="listModePatients" class="list-table" stripe row-key="id" max-height="240">
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="applicationNo" label="申请单号" min-width="160" align="center" header-align="center" />
<el-table-column prop="patientName" label="患者姓名" min-width="100" align="center" header-align="center" />
<el-table-column prop="sex" label="性别" min-width="60" align="center" header-align="center">
<template #default="{ row }">{{ sexLabel(row.sex) || '—' }}</template>
</el-table-column>
<el-table-column prop="age" label="年龄" min-width="60" align="center" header-align="center">
<template #default="{ row }">{{ row.age ?? '—' }}</template>
</el-table-column>
<el-table-column prop="channelName" label="渠道名称" min-width="140" align="center" header-align="center" />
</el-table>
<div style="margin-top: 8px; font-size: 13px; color: #64748b">
共 <strong style="color: #10b981">{{ listModePatients.length }}</strong> 名患者,将统一预约相同机构、时间与体检项目
</div>
</template>
<template v-else>
<div style="display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap">
<el-input
v-model="patientSearch.applicationNo"
placeholder="申请单号"
clearable
style="width: 180px"
/>
<el-input
v-model="patientSearch.patientName"
placeholder="患者姓名"
clearable
style="width: 180px"
/>
<el-button class="btn-main" type="primary" @click="searchPatients">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
<el-table
:data="patientList"
v-loading="patientLoading"
class="list-table"
stripe
row-key="id"
max-height="240"
@selection-change="(rows) => (selectedPatients = rows)"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="applicationNo" label="申请单号" min-width="160" align="center" header-align="center" />
<el-table-column prop="patientName" label="患者姓名" min-width="100" align="center" header-align="center" />
<el-table-column prop="sex" label="性别" min-width="60" align="center" header-align="center">
<template #default="{ row }">{{ sexLabel(row.sex) || '—' }}</template>
</el-table-column>
<el-table-column prop="age" label="年龄" min-width="60" align="center" header-align="center">
<template #default="{ row }">{{ row.age ?? '—' }}</template>
</el-table-column>
<el-table-column prop="channelName" label="渠道名称" min-width="140" align="center" header-align="center" />
</el-table>
<div style="margin-top: 8px; font-size: 13px; color: #64748b">
已选 <strong style="color: #10b981">{{ selectedPatients.length }}</strong> 名患者(需体检且尚未登记体检记录)
</div>
</template>
</div>
<!-- 体检信息区 -->
<div class="section-card" style="margin-bottom: 16px">
<div class="section-title section-title--mint-bar"><h3>体检信息</h3></div>
<div class="form-grid form-grid-2">
<el-form-item label="体检机构" required>
<el-select
v-model="formData.checkupInstitutionId"
placeholder="请选择体检机构"
clearable
style="width: 100%"
@change="onInstitutionChange"
>
<el-option
v-for="inst in institutionOptions"
:key="inst.id"
:label="inst.institutionName"
:value="inst.id"
/>
</el-select>
</el-form-item>
<el-form-item label="预约时间" required>
<el-date-picker
v-model="formData.reserveTime"
type="datetime"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择预约时间"
style="width: 100%"
/>
</el-form-item>
</div>
</div>
<!-- 项目选择区 -->
<div class="section-card checkup-items-section">
<div class="section-title section-title--mint-bar section-title--with-action">
<h3>体检项目</h3>
<div class="checkup-item-actions">
<el-button size="small" type="primary" @click="handleOpenProjectSelector">
<el-icon><Plus /></el-icon>添加单项
</el-button>
<el-button size="small" @click="handleOpenPackageSelector">
<el-icon><Suitcase /></el-icon>从套餐添加
</el-button>
</div>
</div>
<CheckupReserveItemsTable
:items="formData.reserveItems"
@remove="(i) => formData.reserveItems.splice(i, 1)"
>
<template #total="{ total }">
单人预约费用合计:<strong>¥{{ formatMoneyDisplay(total) }}</strong>
<span v-if="patientCountForFee > 0" class="checkup-reserve-total-count">
× {{ patientCountForFee }} 人
</span>
</template>
</CheckupReserveItemsTable>
</div>
</DialogFormBody>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="handleSubmit">
<el-icon><Check /></el-icon>确定预约
</el-button>
</template>
</el-dialog>
<!-- 单项:选择体检项目 -->
<el-dialog
v-model="projectSelectorVisible"
title="选择体检项目"
width="960px"
class="dialog-form-layout checkup-picker-dialog"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<div class="list-toolbar checkup-picker-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ projectSelectorSelected.length }}</span> 项
</div>
<el-input
v-model="projectSelectorKeyword"
placeholder="项目名称模糊检索"
clearable
class="checkup-picker-search"
/>
</div>
</div>
<div class="list-body list-wrap checkup-picker-list-wrap">
<el-table
:data="filteredProjectOptions"
v-loading="projectLoading"
class="list-table"
stripe
row-key="id"
max-height="620"
@selection-change="(rows) => (projectSelectorSelected = rows)"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="180" align="center" header-align="center" />
<el-table-column label="项目费用(元)" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{
row.projectFee != null ? formatMoneyDisplay(row.projectFee) : '—'
}}</template>
</el-table-column>
<el-table-column label="状态" min-width="90" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="projectStatusTagType(row.status)" size="small">{{
projectStatusLabel(row.status)
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
</el-table>
</div>
<template #footer>
<el-button class="btn-ghost" @click="projectSelectorVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button class="btn-main" type="primary" @click="confirmProjectSelect">
<el-icon><Check /></el-icon>确认添加({{ projectSelectorSelected.length }})
</el-button>
</template>
</el-dialog>
<!-- 套餐:选择套餐 -->
<el-dialog
v-model="packageSelectorVisible"
title="选择体检套餐"
width="1080px"
class="dialog-form-layout checkup-picker-dialog"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<div class="list-toolbar checkup-picker-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ packageSelectorSelected.length }}</span> 项
</div>
<el-input
v-model="packageSelectorKeyword"
placeholder="套餐名称模糊检索"
clearable
class="checkup-picker-search"
/>
</div>
</div>
<div class="list-body list-wrap checkup-picker-list-wrap">
<el-table
:data="filteredPackageOptions"
v-loading="packageLoading"
class="list-table"
stripe
row-key="id"
max-height="620"
@selection-change="(rows) => (packageSelectorSelected = rows)"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="packageName" label="套餐名称" min-width="140" align="center" header-align="center" />
<el-table-column prop="packageCode" label="套餐编码" min-width="120" align="center" header-align="center" />
<el-table-column prop="itemCount" label="项目数" min-width="80" align="center" header-align="center">
<template #default="{ row }">{{ row.itemCount ?? '—' }}</template>
</el-table-column>
<el-table-column label="合计费用(元)" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{
row.totalFee != null ? formatMoneyDisplay(row.totalFee) : '—'
}}</template>
</el-table-column>
<el-table-column label="状态" min-width="90" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="projectStatusTagType(row.status)" size="small">{{
projectStatusLabel(row.status)
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="120"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column label="操作" min-width="100" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handlePackageView(row)">
<el-icon><View /></el-icon>查看
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<el-button class="btn-ghost" @click="packageSelectorVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button
class="btn-main"
type="primary"
:loading="packageConfirmLoading"
@click="confirmPackageSelect"
>
<el-icon><Check /></el-icon>确认添加({{ packageSelectorSelected.length }})
</el-button>
</template>
</el-dialog>
<!-- 套餐项目明细(查看) -->
<el-dialog
v-model="packageViewVisible"
:title="packageViewTitle"
width="900px"
class="dialog-form-layout"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
>
<el-table
:data="packageViewItems"
v-loading="packageViewLoading"
class="list-table"
stripe
max-height="420"
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="180" align="center" header-align="center" />
<el-table-column label="项目费用(元)" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{
row.projectFee != null ? formatMoneyDisplay(row.projectFee) : '—'
}}</template>
</el-table-column>
<el-table-column label="状态" min-width="90" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="projectStatusTagType(row.status)" size="small">{{
projectStatusLabel(row.status)
}}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
</el-table>
<template #footer>
<el-button class="btn-ghost" @click="packageViewVisible = false">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { ref, reactive, computed, watch, toRef } from 'vue'
import { ElMessage } from 'element-plus'
import { Plus, Close, Check, Search, Delete, Suitcase, View } from '@element-plus/icons-vue'
import {
fetchPilotCheckupPendingPatients,
fetchCheckupInstitutionList,
fetchCheckupInstitutionProjects,
fetchCheckupInstitutionPackages,
fetchCheckupInstitutionPackageDetail,
batchSavePilotCheckup,
savePilotCheckup,
savePilotCheckupReserveItems
} from '@/api/admin'
import DialogFormBody from '@/components/business/dialog-form-body/index.vue'
import { formatMoneyDisplay } from '@/utils/money-format'
import { sexLabel } from '@/utils/status-tag-registry'
import CheckupReserveItemsTable from './CheckupReserveItemsTable.vue'
import {
type CheckupReserveItem,
appendCheckupReserveItems,
sumReserveItemsFee
} from './checkup-reserve-items'
type CheckupBatchRow = {
id: string
pilotPatientId?: string
patientName?: string
applicationNo?: string
sex?: string
age?: number | null
channelName?: string
}
const props = defineProps<{
modelValue: boolean
/** 从列表勾选的待填写体检记录 */
initialCheckupRows?: CheckupBatchRow[]
}>()
const emit = defineEmits(['update:modelValue', 'success'])
const initialCheckupRows = toRef(props, 'initialCheckupRows')
const isFillFromListMode = computed(() => (initialCheckupRows.value?.length ?? 0) > 0)
const listModePatients = computed(() => initialCheckupRows.value ?? [])
function parseList(res: unknown): any[] {
return Array.isArray(res) ? res : (res as any)?.list || []
}
function projectStatusLabel(status: string | undefined) {
return status === '1' ? '正常' : '停用'
}
function projectStatusTagType(status: string | undefined) {
return status === '1' ? 'success' : 'info'
}
// ── 患者搜索 ──────────────────────────
const patientSearch = reactive({ applicationNo: '', patientName: '' })
const patientLoading = ref(false)
const patientList = ref<any[]>([])
const selectedPatients = ref<any[]>([])
const searchPatients = async () => {
patientLoading.value = true
try {
const res = await fetchPilotCheckupPendingPatients({
page: 1,
pageSize: 100,
applicationNo: patientSearch.applicationNo || undefined,
patientName: patientSearch.patientName || undefined
})
patientList.value = parseList(res)
} catch {
patientList.value = []
} finally {
patientLoading.value = false
}
}
// ── 体检机构 ──────────────────────────
const institutionOptions = ref<any[]>([])
const loadInstitutions = async () => {
try {
const res = await fetchCheckupInstitutionList({ page: 1, pageSize: 100, status: '1' })
institutionOptions.value = parseList(res)
} catch {
institutionOptions.value = []
}
}
// ── 表单数据 ──────────────────────────
const formData = reactive({
checkupInstitutionId: '',
reserveTime: '',
reserveItems: [] as CheckupReserveItem[]
})
const submitLoading = ref(false)
const totalReserveFee = computed(() => sumReserveItemsFee(formData.reserveItems))
const patientCountForFee = computed(() =>
isFillFromListMode.value ? listModePatients.value.length : selectedPatients.value.length
)
// ── 机构变更 → 加载项目和套餐 ─────────
const projectOptions = ref<any[]>([])
const packageOptions = ref<any[]>([])
const projectLoading = ref(false)
const packageLoading = ref(false)
const loadInstitutionCatalog = async (instId: string) => {
projectLoading.value = true
packageLoading.value = true
try {
const [projRes, pkgRes] = await Promise.all([
fetchCheckupInstitutionProjects(instId),
fetchCheckupInstitutionPackages(instId)
])
projectOptions.value = parseList(projRes)
packageOptions.value = parseList(pkgRes)
} catch {
projectOptions.value = []
packageOptions.value = []
} finally {
projectLoading.value = false
packageLoading.value = false
}
}
const onInstitutionChange = async (instId: string) => {
formData.reserveItems = []
projectOptions.value = []
packageOptions.value = []
if (!instId) return
await loadInstitutionCatalog(instId)
}
const requireInstitution = () => {
if (!formData.checkupInstitutionId) {
ElMessage.warning('请先选择体检机构')
return false
}
return true
}
// ── 单项选择 ──────────────────────────
const projectSelectorVisible = ref(false)
const projectSelectorKeyword = ref('')
const projectSelectorSelected = ref<any[]>([])
const filteredProjectOptions = computed(() => {
const kw = projectSelectorKeyword.value.trim().toLowerCase()
if (!kw) return projectOptions.value
return projectOptions.value.filter((row) => (row.projectName || '').toLowerCase().includes(kw))
})
const handleOpenProjectSelector = async () => {
if (!requireInstitution()) return
projectSelectorKeyword.value = ''
projectSelectorSelected.value = []
if (projectOptions.value.length === 0) {
await loadInstitutionCatalog(formData.checkupInstitutionId)
}
projectSelectorVisible.value = true
}
const confirmProjectSelect = () => {
if (projectSelectorSelected.value.length === 0) {
ElMessage.warning('请至少选择一个项目')
return
}
const added = appendCheckupReserveItems(formData.reserveItems, projectSelectorSelected.value)
projectSelectorVisible.value = false
if (added > 0) {
ElMessage.success(`已添加 ${added} 个项目`)
} else {
ElMessage.info('所选项目均已存在,未重复添加')
}
}
// ── 套餐选择 ──────────────────────────
const packageSelectorVisible = ref(false)
const packageSelectorKeyword = ref('')
const packageSelectorSelected = ref<any[]>([])
const packageConfirmLoading = ref(false)
const filteredPackageOptions = computed(() => {
const kw = packageSelectorKeyword.value.trim().toLowerCase()
if (!kw) return packageOptions.value
return packageOptions.value.filter((row) => (row.packageName || '').toLowerCase().includes(kw))
})
const handleOpenPackageSelector = async () => {
if (!requireInstitution()) return
packageSelectorKeyword.value = ''
packageSelectorSelected.value = []
if (packageOptions.value.length === 0) {
await loadInstitutionCatalog(formData.checkupInstitutionId)
}
packageSelectorVisible.value = true
}
const confirmPackageSelect = async () => {
if (packageSelectorSelected.value.length === 0) {
ElMessage.warning('请至少选择一个套餐')
return
}
packageConfirmLoading.value = true
try {
const allItems: any[] = []
for (const pkg of packageSelectorSelected.value) {
const detail: any = await fetchCheckupInstitutionPackageDetail(pkg.id)
const items = detail?.items ?? detail?.detailItems ?? []
allItems.push(...items)
}
const added = appendCheckupReserveItems(formData.reserveItems, allItems)
packageSelectorVisible.value = false
if (added > 0) {
ElMessage.success(`已从套餐添加 ${added} 个项目`)
} else {
ElMessage.info('套餐中的项目均已存在,未重复添加')
}
} catch {
ElMessage.error('加载套餐项目失败')
} finally {
packageConfirmLoading.value = false
}
}
// ── 套餐明细查看 ──────────────────────
const packageViewVisible = ref(false)
const packageViewTitle = ref('')
const packageViewItems = ref<any[]>([])
const packageViewLoading = ref(false)
const handlePackageView = async (row: any) => {
packageViewTitle.value = `套餐项目 — ${row.packageName || ''}`
packageViewItems.value = []
packageViewVisible.value = true
packageViewLoading.value = true
try {
const detail: any = await fetchCheckupInstitutionPackageDetail(row.id)
packageViewItems.value = detail?.items ?? detail?.detailItems ?? []
} catch {
ElMessage.error('加载套餐明细失败')
packageViewVisible.value = false
} finally {
packageViewLoading.value = false
}
}
// ── 提交 ──────────────────────────────
const reserveItemsPayload = () =>
formData.reserveItems.map((item) => ({
projectName: item.projectName,
projectFee: item.projectFee
}))
const handleSubmit = async () => {
if (isFillFromListMode.value) {
if (listModePatients.value.length === 0) {
ElMessage.warning('未选择患者')
return
}
} else if (selectedPatients.value.length === 0) {
ElMessage.warning('请至少选择一名患者')
return
}
if (!formData.checkupInstitutionId) {
ElMessage.warning('请选择体检机构')
return
}
if (!formData.reserveTime) {
ElMessage.warning('请选择预约时间')
return
}
if (formData.reserveItems.length === 0) {
ElMessage.warning('请至少添加一个体检项目')
return
}
submitLoading.value = true
try {
if (isFillFromListMode.value) {
const rows = listModePatients.value
for (const row of rows) {
await savePilotCheckup({
checkupId: row.id,
checkupInstitutionId: formData.checkupInstitutionId,
reserveTime: formData.reserveTime,
reserveFee: totalReserveFee.value || undefined
})
await savePilotCheckupReserveItems({
pilotCheckupId: row.id,
items: reserveItemsPayload()
})
}
ElMessage.success(`成功为 ${rows.length} 名患者预约体检`)
} else {
const patientIds = selectedPatients.value.map((p) => p.id)
await batchSavePilotCheckup({
patientIds,
checkupInstitutionId: formData.checkupInstitutionId,
reserveTime: formData.reserveTime,
reserveItems: reserveItemsPayload()
})
ElMessage.success(`成功为 ${patientIds.length} 名患者预约体检`)
}
emit('update:modelValue', false)
emit('success')
} catch (e: any) {
ElMessage.error(e?.message || '预约失败')
} finally {
submitLoading.value = false
}
}
watch(
() => props.modelValue,
(val) => {
if (val) {
patientSearch.applicationNo = ''
patientSearch.patientName = ''
selectedPatients.value = []
formData.checkupInstitutionId = ''
formData.reserveTime = ''
formData.reserveItems = []
projectOptions.value = []
packageOptions.value = []
if (isFillFromListMode.value) {
selectedPatients.value = []
} else {
searchPatients()
}
loadInstitutions()
}
}
)
</script>
<style scoped lang="scss">
.section-title--mint-bar {
margin-bottom: 12px;
h3 {
display: flex;
align-items: center;
margin: 0;
font-size: 15px;
font-weight: 600;
color: #1e293b;
line-height: 1.4;
&::before {
content: '';
width: 3px;
height: 18px;
background: var(--primary, #10b981);
border-radius: 2px;
margin-right: 10px;
flex-shrink: 0;
}
}
}
.checkup-items-section {
margin-top: 8px;
}
.section-title--with-action {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 8px;
margin-top: 12px;
margin-bottom: 16px;
}
.checkup-item-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin: 8px 0;
}
.checkup-reserve-total-count {
margin-left: 16px;
color: #64748b;
}
:deep(.checkup-picker-dialog.el-dialog.dialog-form-layout) {
.el-dialog__body {
min-height: min(680px, calc(100vh - 160px));
padding-top: 16px;
}
}
.checkup-picker-toolbar {
margin-bottom: 0;
background: var(--mint-table-head, #f8fafc);
border: 1px solid var(--mint-border, #e2e8f0);
border-bottom: none;
border-radius: var(--mint-radius, 10px) var(--mint-radius, 10px) 0 0;
.list-toolbar-row {
padding: 8px 16px;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
.list-toolbar-selected {
display: inline-flex;
align-items: center;
min-height: 36px;
padding: 0 10px 0 0;
margin-right: 4px;
border-right: 1px solid var(--mint-border, #e2e8f0);
font-size: 12px;
color: var(--mint-text-muted, #64748b);
font-weight: 600;
}
.sel-num {
color: var(--mint-primary-dark, #059669);
font-weight: 700;
margin: 0 2px;
}
.checkup-picker-search {
width: 280px;
}
}
.checkup-picker-list-wrap.list-body.list-wrap {
border: 1px solid var(--mint-border, #e2e8f0);
border-top: 1px solid var(--mint-border, #e2e8f0);
border-radius: 0 0 var(--mint-radius, 10px) var(--mint-radius, 10px);
overflow: hidden;
background: #fff;
:deep(.el-table) {
--el-table-header-bg-color: var(--mint-table-head, #f8fafc);
--el-table-border-color: var(--mint-border, #e2e8f0);
--el-table-row-hover-bg-color: var(--mint-row-hover, #f0fdf4);
--el-table-text-color: var(--mint-text, #0f172a);
--el-table-header-text-color: var(--mint-text-muted, #64748b);
font-size: 14px;
}
:deep(.el-table th.el-table__cell) {
color: var(--mint-text-muted, #64748b);
font-size: 12px;
font-weight: 600;
}
:deep(.el-table td.el-table__cell) {
color: var(--mint-text, #0f172a);
font-size: 14px;
font-weight: 500;
}
}
</style>
@@ -0,0 +1,114 @@
<!-- 体检预约已选项目表(原始费用 + 可编辑预约费用) -->
<template>
<div>
<div class="checkup-reserve-list-gap" />
<el-alert
v-if="duplicateNames.length"
class="checkup-reserve-dup-alert"
type="warning"
:closable="false"
show-icon
:title="`存在重复项目:${duplicateNames.join('、')},请删除重复行后再保存`"
/>
<div class="list-body list-wrap checkup-reserve-list-wrap">
<el-table :data="items" class="list-table" stripe :max-height="maxHeight">
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="160" align="center" header-align="center" />
<el-table-column label="原始项目费用(元)" min-width="130" align="center" header-align="center">
<template #default="{ row }">{{
row.originalProjectFee != null ? formatMoneyDisplay(row.originalProjectFee) : '—'
}}</template>
</el-table-column>
<el-table-column label="预约项目费用(元)" min-width="150" align="center" header-align="center">
<template #default="{ row }">
<AmountInput v-model="row.projectFee" :min="0" placeholder="请输入费用" />
</template>
</el-table-column>
<el-table-column label="操作" min-width="80" align="center" header-align="center">
<template #default="{ $index }">
<el-button link type="danger" @click="emit('remove', $index)">
<el-icon><Delete /></el-icon>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div v-if="showTotal" class="checkup-reserve-total">
<slot name="total" :total="totalFee">
预约费用合计:<strong>¥{{ formatMoneyDisplay(totalFee) }}</strong>
</slot>
</div>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { Delete } from '@element-plus/icons-vue'
import AmountInput from '@/components/common/amount-input/index.vue'
import { formatMoneyDisplay } from '@/utils/money-format'
import type { CheckupReserveItem } from './checkup-reserve-items'
import { sumReserveItemsFee, findDuplicateReserveItemNames } from './checkup-reserve-items'
const props = withDefaults(
defineProps<{
items: CheckupReserveItem[]
maxHeight?: number | string
showTotal?: boolean
}>(),
{
maxHeight: 400,
showTotal: true
}
)
const emit = defineEmits<{ remove: [index: number] }>()
const totalFee = computed(() => sumReserveItemsFee(props.items))
const duplicateNames = computed(() => findDuplicateReserveItemNames(props.items))
</script>
<style scoped lang="scss">
.checkup-reserve-list-gap {
height: 16px;
}
.checkup-reserve-dup-alert {
margin-bottom: 12px;
}
.checkup-reserve-list-wrap.list-body.list-wrap {
border: 1px solid var(--mint-border, #e2e8f0);
border-radius: var(--mint-radius, 10px);
overflow: hidden;
background: #fff;
:deep(.el-table) {
--el-table-header-bg-color: var(--mint-table-head, #f8fafc);
--el-table-border-color: var(--mint-border, #e2e8f0);
--el-table-row-hover-bg-color: var(--mint-row-hover, #f0fdf4);
font-size: 14px;
}
:deep(.el-table th.el-table__cell) {
font-size: 12px;
font-weight: 600;
}
:deep(.el-table td.el-table__cell) {
font-size: 14px;
font-weight: 500;
}
}
.checkup-reserve-total {
margin-top: 12px;
font-size: 13px;
color: #334155;
text-align: right;
strong {
color: #10b981;
font-size: 15px;
}
}
</style>
@@ -0,0 +1,366 @@
<!-- 体检管理 — 查看弹窗(SystemViewDialog 标准样式) -->
<template>
<SystemViewDialog
v-model:visible="innerVisible"
:title="viewData.patientName || '体检详情'"
:icon="Document"
:code="viewData.applicationNo"
code-label="申请单号"
:sections="sections"
:loading="loading"
:grid-columns="3"
width="1080px"
append-to-body
>
<template #reserve-items>
<div class="list-body list-wrap view-inner-table-wrap">
<el-table
v-if="reserveItems.length"
:data="reserveItems"
stripe
class="list-table inner-table"
max-height="320"
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="200" show-overflow-tooltip />
<el-table-column label="项目费用(元)" min-width="120" align="right" header-align="center">
<template #default="{ row }">
{{ row.projectFee != null ? `¥${formatMoneyDisplay(row.projectFee)}` : '—' }}
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无预约项目" :image-size="48" />
<p v-if="reserveItems.length" class="view-table-summary">
预约费用合计:<strong>¥{{ formatMoneyDisplay(reserveTotal) }}</strong>
</p>
</div>
</template>
<template #actual-items>
<div class="list-body list-wrap view-inner-table-wrap">
<el-table
v-if="actualItems.length"
:data="actualItems"
stripe
class="list-table inner-table"
max-height="320"
>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" />
<el-table-column prop="projectName" label="项目名称" min-width="200" show-overflow-tooltip />
<el-table-column label="项目费用(元)" min-width="120" align="right" header-align="center">
<template #default="{ row }">
{{ row.projectFee != null ? `¥${formatMoneyDisplay(row.projectFee)}` : '—' }}
</template>
</el-table-column>
</el-table>
<el-empty v-else description="暂无实际项目" :image-size="48" />
<p v-if="actualItems.length" class="view-table-summary">
实际费用合计:<strong>¥{{ formatMoneyDisplay(actualTotal) }}</strong>
</p>
</div>
</template>
<template #reports>
<div v-if="reportFiles.length" class="report-attachment-list">
<div v-for="(file, idx) in reportFiles" :key="file.url || idx" class="report-attachment-item">
<div class="report-attachment-preview">
<img v-if="isImageUrl(file.url)" :src="fullFileUrl(file.url)" :alt="file.name" />
<div v-else class="report-attachment-preview__icon">
<el-icon :size="28"><Document /></el-icon>
</div>
</div>
<div class="report-attachment-footer">
<span class="report-attachment-name" :title="file.name">{{ file.name }}</span>
<el-button link type="primary" @click="downloadReport(file)">
<el-icon><Download /></el-icon>下载
</el-button>
</div>
</div>
</div>
<span v-else class="view-empty-hint">—</span>
</template>
</SystemViewDialog>
</template>
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { Document, Download } from '@element-plus/icons-vue'
import SystemViewDialog, {
type ViewSection,
type TagType
} from '@/components/business/system-view-dialog/index.vue'
import {
fetchPilotCheckupDetail,
fetchPilotCheckupReserveItems,
fetchPilotCheckupActualItems
} from '@/api/admin'
import {
checkupStatusLabel,
checkupStatusTagType,
feeStatusLabel,
feeStatusTagType,
sexLabel
} from '@/utils/status-tag-registry'
import { formatMoneyDisplay } from '@/utils/money-format'
const props = defineProps<{
modelValue: boolean
checkupRow: Record<string, any> | null
}>()
const emit = defineEmits(['update:modelValue'])
const innerVisible = computed({
get: () => props.modelValue,
set: (v: boolean) => emit('update:modelValue', v)
})
const loading = ref(false)
const viewData = ref<Record<string, any>>({})
const reserveItems = ref<any[]>([])
const actualItems = ref<any[]>([])
const reserveTotal = computed(() =>
reserveItems.value.reduce((s, i) => s + (Number(i.projectFee) || 0), 0)
)
const actualTotal = computed(() =>
actualItems.value.reduce((s, i) => s + (Number(i.projectFee) || 0), 0)
)
const formatFee = (val: number | null | undefined) =>
val != null ? `¥${formatMoneyDisplay(val)}` : '—'
const sections = computed((): ViewSection[] => {
const row = viewData.value
if (!row?.id) return []
return [
{
title: '基本信息',
fields: [
{ label: '申请单号', value: row.applicationNo },
{ label: '患者姓名', value: row.patientName },
{ label: '性别', value: sexLabel(row.sex) || '—' },
{ label: '年龄', value: row.age != null ? String(row.age) : undefined },
{ label: '联系电话', value: row.phoneNo },
{ label: '渠道名称', value: row.channelName },
{ label: '体检机构', value: row.institutionName },
{ label: '预约时间', value: row.reserveTime },
{ label: '预约费用', value: formatFee(row.reserveFee) },
{ label: '实际费用', value: formatFee(row.actualCheckupFee) },
{
label: '体检状态',
value: checkupStatusLabel(row.checkupStatus),
tagType: checkupStatusTagType(row.checkupStatus) as TagType
},
{
label: '费用状态',
value: feeStatusLabel(row.feeStatus),
tagType: feeStatusTagType(row.feeStatus) as TagType
}
]
},
{
title: '预约项目',
fields: [],
slot: 'reserve-items'
},
{
title: '实际项目',
fields: [],
slot: 'actual-items'
},
{
title: '体检登记',
fields: [
{ label: '实际体检时间', value: row.actualCheckupTime || undefined },
{ label: '体检备注', value: row.checkupRemark || row.remark, span: true }
]
},
{
title: '体检报告',
fields: [],
slot: 'reports'
}
]
})
const parseAttachmentUrls = (urls: string) => {
if (!urls) return []
return urls
.split(',')
.filter(Boolean)
.map((url) => {
const parts = url.split('/')
const name = decodeURIComponent(parts[parts.length - 1] || '附件')
return { name, url }
})
}
const reportFiles = computed(() =>
parseAttachmentUrls(viewData.value.reportAttachments || '')
)
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
function fullFileUrl(suffix: string) {
if (!suffix) return ''
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/')) {
return suffix
}
return `${minioBaseUrl}/${suffix}`
}
const isImageUrl = (url: string) => {
const u = (url || '').toLowerCase()
return /\.(jpg|jpeg|png|gif|bmp|webp|svg)(\?|$)/.test(u)
}
const downloadReport = (file: { name: string; url: string }) => {
const link = document.createElement('a')
link.href = fullFileUrl(file.url)
link.download = file.name
link.target = '_blank'
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
const loadDetail = async () => {
const id = props.checkupRow?.id
if (!id) return
viewData.value = { ...(props.checkupRow || {}) }
loading.value = true
try {
const [detailRes, reserveRes, actualRes]: any[] = await Promise.all([
fetchPilotCheckupDetail({ checkupId: id }),
fetchPilotCheckupReserveItems({ pilotCheckupId: id }),
fetchPilotCheckupActualItems({ pilotCheckupId: id })
])
const detail = detailRes?.data ?? detailRes ?? {}
viewData.value = { ...viewData.value, ...detail }
reserveItems.value = Array.isArray(reserveRes) ? reserveRes : (reserveRes?.list ?? [])
actualItems.value = Array.isArray(actualRes) ? actualRes : (actualRes?.list ?? [])
} catch {
reserveItems.value = []
actualItems.value = []
} finally {
loading.value = false
}
}
watch(
() => props.modelValue,
(val) => {
if (val && props.checkupRow?.id) {
loadDetail()
} else if (!val) {
viewData.value = {}
reserveItems.value = []
actualItems.value = []
}
}
)
</script>
<style lang="scss" scoped>
.view-inner-table-wrap.list-body.list-wrap {
margin-top: 4px;
border: 1px solid var(--mint-border, #e2e8f0);
border-radius: var(--mint-radius, 10px);
overflow: hidden;
background: #fff;
:deep(.el-table) {
--el-table-header-bg-color: var(--mint-table-head, #f8fafc);
--el-table-border-color: var(--mint-border, #e2e8f0);
--el-table-row-hover-bg-color: var(--mint-row-hover, #f0fdf4);
--el-table-text-color: var(--mint-text, #0f172a);
--el-table-header-text-color: var(--mint-text-muted, #64748b);
font-size: 14px;
}
:deep(.el-table th.el-table__cell) {
font-size: 12px;
font-weight: 600;
color: var(--mint-text-muted, #64748b);
}
:deep(.el-table td.el-table__cell) {
font-size: 14px;
font-weight: 500;
color: var(--mint-text, #0f172a);
}
:deep(.el-empty) {
padding: 24px 0;
}
}
.view-table-summary {
margin: 10px 0 0;
padding: 10px 12px;
font-size: 13px;
color: #64748b;
background: #f8fafc;
border-radius: 8px;
border: 1px solid #e2e8f0;
strong {
color: #059669;
font-weight: 600;
}
}
.view-empty-hint {
font-size: 13px;
color: #94a3b8;
}
.report-attachment-list {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.report-attachment-item {
width: 140px;
border: 1px solid #e2e8f0;
border-radius: 8px;
overflow: hidden;
background: #fff;
}
.report-attachment-preview {
width: 100%;
height: 96px;
display: flex;
align-items: center;
justify-content: center;
background: #f8fafc;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
&__icon {
color: #0284c7;
background: #e0f2fe;
width: 48px;
height: 48px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
}
}
.report-attachment-footer {
padding: 6px 8px;
display: flex;
flex-direction: column;
gap: 4px;
align-items: center;
}
.report-attachment-name {
font-size: 11px;
color: #334155;
text-align: center;
word-break: break-all;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
</style>
@@ -0,0 +1,164 @@
/** 体检预约项目行(填写/批量预约弹窗共用) */
export type CheckupReserveItem = {
projectId?: string
projectName: string
/** 机构价目表原始费用 */
originalProjectFee: number | null
/** 本次预约实际费用(可改) */
projectFee: number | null
}
export function parseProjectFee(val: unknown): number | null {
if (val == null || val === '') return null
const n = parseFloat(String(val))
return Number.isFinite(n) ? n : null
}
/** 归一化项目名称(去重比对用) */
export function normalizeReserveProjectName(name: string) {
return (name || '').trim().toLowerCase()
}
/** 是否为同一预约项目(按机构项目 id 或项目名称,忽略大小写) */
export function isSameReserveItem(
a: { projectId?: string; projectName: string },
b: { projectId?: string; projectName: string }
): boolean {
const idA = (a.projectId || '').trim()
const idB = (b.projectId || '').trim()
if (idA && idB && idA === idB) return true
const nameA = normalizeReserveProjectName(a.projectName)
const nameB = normalizeReserveProjectName(b.projectName)
return !!nameA && nameA === nameB
}
export function reserveItemExists(
target: CheckupReserveItem[],
candidate: { projectId?: string; projectName: string }
): boolean {
return target.some((item) => isSameReserveItem(item, candidate))
}
/** @deprecated 请使用 isSameReserveItem */
export function reserveItemKey(item: { projectId?: string; projectName: string }) {
const id = (item.projectId || '').trim()
if (id) return `id:${id}`
return `name:${normalizeReserveProjectName(item.projectName)}`
}
function toReserveCandidate(proj: any): { projectId?: string; projectName: string } {
const projectId = (proj.checkupInstitutionProjectId || proj.id || proj.projectId || '').trim()
return {
projectId: projectId || undefined,
projectName: (proj.projectName || '').trim()
}
}
/** 列表去重(保留首次出现项;若仅有名称匹配则补全 projectId) */
export function dedupeCheckupReserveItems(items: CheckupReserveItem[]): CheckupReserveItem[] {
const result: CheckupReserveItem[] = []
for (const item of items) {
const idx = result.findIndex((r) => isSameReserveItem(r, item))
if (idx < 0) {
result.push({ ...item })
continue
}
if (item.projectId && !result[idx].projectId) {
result[idx].projectId = item.projectId
}
}
return result
}
/** 返回重复的项目名称(用于提示) */
export function findDuplicateReserveItemNames(items: CheckupReserveItem[]): string[] {
const dups = new Set<string>()
for (let i = 0; i < items.length; i++) {
for (let j = i + 1; j < items.length; j++) {
if (isSameReserveItem(items[i], items[j])) {
dups.add(items[i].projectName || items[j].projectName || '未命名项目')
}
}
}
return [...dups]
}
export function appendCheckupReserveItems(
target: CheckupReserveItem[],
projects: any[]
): number {
let added = 0
for (const proj of projects) {
const candidate = toReserveCandidate(proj)
if (!candidate.projectName) continue
const idx = target.findIndex((i) => isSameReserveItem(i, candidate))
if (idx >= 0) {
if (candidate.projectId && !target[idx].projectId) {
target[idx].projectId = candidate.projectId
}
continue
}
const fee = parseProjectFee(proj.projectFee)
target.push({
projectId: candidate.projectId,
projectName: candidate.projectName,
originalProjectFee: fee,
projectFee: fee
})
added++
}
return added
}
export function sumReserveItemsFee(items: CheckupReserveItem[]): number {
return items.reduce((sum, item) => sum + (item.projectFee || 0), 0)
}
/** 实际体检项目行(标记已体检等) */
export type CheckupActualItem = {
projectName: string
projectFee: number | null
}
export function isSameActualItem(
a: { projectName: string },
b: { projectName: string }
): boolean {
return isSameReserveItem(
{ projectName: a.projectName, projectId: undefined },
{ projectName: b.projectName, projectId: undefined }
)
}
export function dedupeCheckupActualItems(items: CheckupActualItem[]): CheckupActualItem[] {
const result: CheckupActualItem[] = []
for (const item of items) {
const name = (item.projectName || '').trim()
if (!name) continue
if (!result.some((r) => isSameActualItem(r, item))) {
result.push({ projectName: name, projectFee: item.projectFee })
}
}
return result
}
export function findDuplicateActualItemNames(items: CheckupActualItem[]): string[] {
const dups = new Set<string>()
for (let i = 0; i < items.length; i++) {
for (let j = i + 1; j < items.length; j++) {
if (isSameActualItem(items[i], items[j])) {
dups.add(items[i].projectName || items[j].projectName || '未命名项目')
}
}
}
return [...dups]
}
export function mapReserveRowsToActualItems(rows: any[]): CheckupActualItem[] {
return dedupeCheckupActualItems(
rows.map((r) => ({
projectName: (r.projectName || '').trim(),
projectFee: parseProjectFee(r.projectFee)
}))
)
}
@@ -0,0 +1,347 @@
<!-- 体检管理 — 列表页 -->
<template>
<div class="page-container">
<header class="page-head">
<h1>体检管理</h1>
<p class="page-desc">管理中试服务患者体检信息填写、报告上传与费用记录。</p>
</header>
<section class="panel">
<div class="panel-top">
<h2>体检记录</h2>
</div>
<!-- 筛选 -->
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" placeholder="申请单号/患者姓名/渠道名称" clearable />
</el-form-item>
<el-form-item label="体检状态">
<el-select v-model="searchForm.checkupStatus" placeholder="全部" clearable style="width: 100%">
<el-option label="待体检" value="dtj" />
<el-option label="已体检" value="ytj" />
</el-select>
</el-form-item>
<el-form-item label="体检机构">
<el-select v-model="searchForm.checkupInstitutionId" placeholder="全部" clearable style="width: 100%">
<el-option
v-for="inst in institutionOptions"
:key="inst.id"
:label="inst.institutionName"
:value="inst.id"
/>
</el-select>
</el-form-item>
</div>
<div class="filter-actions-row">
<span class="filter-hint">支持申请单号、患者姓名、渠道名称模糊查询,输入即检索。</span>
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button
class="btn-main"
type="primary"
:disabled="selectedRows.length === 0"
@click="handleBatchReserveFromList"
>
<el-icon><Calendar /></el-icon>批量预约体检
</el-button>
</div>
</div>
<!-- 表格 -->
<div class="list-body list-wrap">
<el-table
ref="tableRef"
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleView"
>
<el-table-column
type="selection"
min-width="55"
align="center"
header-align="center"
:selectable="isRowSelectable"
/>
<el-table-column type="index" label="序号" min-width="68" align="center" header-align="center" :index="(i: number) => (pagination.page - 1) * pagination.pageSize + i + 1" />
<el-table-column prop="applicationNo" label="申请单号" min-width="160" align="center" header-align="center" />
<el-table-column prop="patientName" label="患者姓名" min-width="100" align="center" header-align="center" />
<el-table-column prop="sex" label="性别" min-width="60" align="center" header-align="center">
<template #default="{ row }">{{ sexLabel(row.sex) || '—' }}</template>
</el-table-column>
<el-table-column prop="age" label="年龄" min-width="60" align="center" header-align="center">
<template #default="{ row }">{{ row.age ?? '—' }}</template>
</el-table-column>
<el-table-column prop="channelName" label="渠道名称" min-width="140" align="center" header-align="center">
<template #default="{ row }">{{ row.channelName || '—' }}</template>
</el-table-column>
<el-table-column prop="institutionName" label="体检机构" min-width="160" align="center" header-align="center">
<template #default="{ row }">{{ row.institutionName || '—' }}</template>
</el-table-column>
<el-table-column prop="reserveTime" label="预约时间" min-width="160" align="center" header-align="center">
<template #default="{ row }">{{ row.reserveTime || '—' }}</template>
</el-table-column>
<el-table-column prop="checkupStatus" label="体检状态" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag :type="checkupStatusTagType(row.checkupStatus)" size="small">
{{ checkupStatusLabel(row.checkupStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="actualCheckupFee" label="体检费用" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ row.actualCheckupFee != null ? '¥' + formatMoneyDisplay(row.actualCheckupFee) : '—' }}</template>
</el-table-column>
<el-table-column label="操作" min-width="400" fixed="right" align="center" header-align="center">
<template #default="{ row }">
<el-button
v-if="!row.institutionName && row.checkupStatus === 'dtj'"
class="btn-op-item primary"
@click="handleFill(row)"
>
<el-icon><Edit /></el-icon>填写体检信息
</el-button>
<template v-if="row.institutionName">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button class="btn-op-item" @click="handleEdit(row)">
<el-icon><EditPen /></el-icon>编辑
</el-button>
</template>
<el-button
v-if="row.checkupStatus === 'dtj' && row.institutionName"
class="btn-op-item"
@click="handleMarkChecked(row)"
>
<el-icon><CircleCheck /></el-icon>标记已体检
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(v) => ((pagination.page = 1), (pagination.pageSize = v), loadData())"
@current-change="(v) => ((pagination.page = v), loadData())"
/>
</div>
</div>
</section>
<!-- 批量预约体检弹窗 -->
<CheckupRegisterDialog
v-model="batchReserveVisible"
:initial-checkup-rows="batchCheckupRows"
@success="onBatchReserveSuccess"
/>
<!-- 填写 / 编辑体检信息弹窗 -->
<CheckupFillDialog
v-model="fillDialogVisible"
:checkup-id="currentCheckupId"
:patient-name="currentPatientName"
:edit-row="fillEditRow"
@success="onFillSuccess"
/>
<!-- 查看弹窗 -->
<CheckupViewDialog v-model="viewDialogVisible" :checkup-row="viewCheckupRow" />
<!-- 标记已体检弹窗 -->
<CheckupMarkCheckedDialog
v-model="markCheckedVisible"
:checkup-id="currentCheckupId"
:patient-name="currentPatientName"
@success="loadData"
/>
</div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import {
RefreshLeft, Search, View, CircleCheck, Edit, EditPen, Calendar
} from '@element-plus/icons-vue'
import {
fetchPilotCheckupList,
fetchCheckupInstitutionList
} from '@/api/admin'
import { checkupStatusLabel, checkupStatusTagType, sexLabel } from '@/utils/status-tag-registry'
import { formatMoneyDisplay } from '@/utils/money-format'
import CheckupFillDialog from './CheckupFillDialog.vue'
import CheckupViewDialog from './CheckupViewDialog.vue'
import CheckupRegisterDialog from './CheckupRegisterDialog.vue'
import CheckupMarkCheckedDialog from './CheckupMarkCheckedDialog.vue'
defineOptions({ name: 'CheckupManagement' })
// ── 搜索 ─────────────────────────────
const searchForm = reactive({
keyword: '',
checkupStatus: '',
checkupInstitutionId: ''
})
const institutionOptions = ref<any[]>([])
// ── 表格 ─────────────────────────────
const loading = ref(false)
const tableData = ref<any[]>([])
const tableRef = ref()
const selectedRows = ref<any[]>([])
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
/** 仅待体检且未填写机构信息的记录可勾选批量预约 */
const isRowSelectable = (row: any) => row.checkupStatus === 'dtj' && !row.institutionName
const handleSelectionChange = (rows: any[]) => {
selectedRows.value = rows
}
// ── 弹窗 ─────────────────────────────
const batchReserveVisible = ref(false)
const batchCheckupRows = ref<any[]>([])
const fillDialogVisible = ref(false)
const fillEditRow = ref<any>(null)
const viewDialogVisible = ref(false)
const viewCheckupRow = ref<any>(null)
const markCheckedVisible = ref(false)
const currentCheckupId = ref('')
const currentPatientName = ref('')
// ── 数据加载 ──────────────────────────
const loadData = async () => {
loading.value = true
try {
const res: any = await fetchPilotCheckupList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
checkupStatus: searchForm.checkupStatus || undefined,
checkupInstitutionId: searchForm.checkupInstitutionId || undefined
})
tableData.value = res?.list ?? []
pagination.total = res?.pagination?.total ?? 0
} catch {
tableData.value = []
} finally {
loading.value = false
}
}
const loadInstitutions = async () => {
try {
const res: any = await fetchCheckupInstitutionList({ page: 1, pageSize: 100, status: '1' })
institutionOptions.value = Array.isArray(res) ? res : res?.list ?? []
} catch {
institutionOptions.value = []
}
}
// ── 事件 ──────────────────────────────
const handleSearch = () => {
pagination.page = 1
loadData()
}
const handleReset = () => {
Object.assign(searchForm, {
keyword: '',
checkupStatus: '',
checkupInstitutionId: ''
})
pagination.page = 1
loadData()
}
const handleFill = (row: any) => {
currentCheckupId.value = row.id
currentPatientName.value = row.patientName || ''
fillEditRow.value = null
fillDialogVisible.value = true
}
const handleEdit = (row: any) => {
currentCheckupId.value = row.id
currentPatientName.value = row.patientName || ''
fillEditRow.value = { ...row }
fillDialogVisible.value = true
}
const onFillSuccess = () => {
fillEditRow.value = null
loadData()
}
const handleView = (row: any) => {
viewCheckupRow.value = { ...row }
viewDialogVisible.value = true
}
const handleBatchReserveFromList = () => {
if (selectedRows.value.length === 0) {
ElMessage.warning('请先在列表勾选待填写体检信息的记录')
return
}
const invalid = selectedRows.value.filter((r) => !isRowSelectable(r))
if (invalid.length > 0) {
ElMessage.warning('仅可选择「待体检」且尚未填写体检机构的记录')
return
}
batchCheckupRows.value = selectedRows.value.map((r) => ({ ...r }))
batchReserveVisible.value = true
}
const onBatchReserveSuccess = () => {
selectedRows.value = []
batchCheckupRows.value = []
tableRef.value?.clearSelection?.()
loadData()
}
const handleMarkChecked = (row: any) => {
currentCheckupId.value = row.id
currentPatientName.value = row.patientName || ''
markCheckedVisible.value = true
}
watchDebounced(
searchForm,
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
onMounted(() => {
loadData()
loadInstitutions()
})
</script>
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff