ykt-wxapp/pages/message/components/medical-case-progress.vue

379 lines
8.1 KiB
Vue
Raw Normal View History

2026-01-29 18:03:40 +08:00
<template>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="progress-modal">
<view class="close-btn" @click="close">
<text class="close-icon"></text>
</view>
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
<view class="progress-content">
<view class="progress-title">{{ progressTitle }}</view>
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
<view class="progress-bar-wrapper">
<view class="progress-bar">
2026-02-02 13:27:48 +08:00
<view
class="progress-fill"
:style="{ width: progress + '%' }"
></view>
2026-01-29 18:03:40 +08:00
</view>
<text class="progress-text">{{ progress }}%</text>
</view>
2026-02-02 13:27:48 +08:00
<view class="detected-info">
2026-01-29 18:03:40 +08:00
<text class="detected-title">检测到以下{{ caseTypeName }}信息</text>
<view class="info-list">
2026-02-02 13:27:48 +08:00
<view
v-for="(item, index) in detectedInfo"
:key="index"
2026-01-29 18:44:34 +08:00
class="info-item"
:class="{ 'fade-in': item.animated }"
>
2026-01-29 18:03:40 +08:00
<text class="check-icon"></text>
2026-02-02 13:27:48 +08:00
<text
class="info-text"
2026-01-29 18:44:34 +08:00
:class="{ 'empty-value': item.value === '暂无' }"
>
{{ item.label }}{{ item.value }}
</text>
2026-01-29 18:03:40 +08:00
</view>
</view>
</view>
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
<view v-if="isGenerating" class="generating-text">
2026-01-29 18:44:34 +08:00
<text class="dot-animation">正在生成结构化{{ caseTypeName }}</text>
</view>
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
<!-- 完成后的操作按钮 -->
<view v-if="isCompleted" class="action-buttons">
<view class="action-button secondary" @click="handleRegenerate">
<text class="button-text">重新生成</text>
</view>
<view class="action-button primary" @click="handleNext">
<text class="button-text">下一步</text>
</view>
2026-01-29 18:03:40 +08:00
</view>
</view>
</view>
</uni-popup>
</template>
<script setup>
2026-02-02 13:27:48 +08:00
import { ref, computed } from "vue";
2026-01-29 18:03:40 +08:00
2026-02-02 13:27:48 +08:00
const emit = defineEmits(["regenerate", "next"]);
2026-01-29 18:44:34 +08:00
2026-01-29 18:03:40 +08:00
const popup = ref(null);
const progress = ref(0);
const detectedInfo = ref([]);
const isGenerating = ref(false);
2026-01-29 18:44:34 +08:00
const isCompleted = ref(false);
2026-02-02 13:27:48 +08:00
const caseType = ref("");
2026-01-29 18:44:34 +08:00
const finalData = ref(null);
2026-01-29 18:03:40 +08:00
const CASE_TYPE_NAMES = {
2026-02-02 13:27:48 +08:00
outpatient: "门诊病历",
inhospital: "住院病历",
physicalExaminationTemplate: "体检记录",
preConsultation: "预问诊记录",
2026-01-29 18:03:40 +08:00
};
2026-01-29 18:44:34 +08:00
const FIELD_LABELS = {
// 门诊病历
2026-02-02 13:27:48 +08:00
visitTime: "就诊日期",
chiefComplaint: "主诉",
medicalHistorySummary: "病史概要",
examination: "检查",
diagnosisName: "门诊诊断",
2026-01-29 18:44:34 +08:00
// 住院病历
2026-02-02 13:27:48 +08:00
inhosDate: "入院日期",
operation: "手术名称",
operationDate: "手术日期",
treatmentPlan: "治疗方案",
2026-01-29 18:44:34 +08:00
// 体检记录
2026-02-02 13:27:48 +08:00
inspectTime: "体检日期",
inspectSummary: "体检小结",
positiveFind: "阳性发现及处理意见",
2026-01-29 18:44:34 +08:00
// 预问诊记录
2026-02-02 13:27:48 +08:00
presentIllnessHistory: "现病史",
pastMedicalHistory: "既往史",
2026-01-29 18:44:34 +08:00
};
2026-02-02 13:27:48 +08:00
const caseTypeName = computed(() => CASE_TYPE_NAMES[caseType.value] || "病历");
2026-01-29 18:03:40 +08:00
const progressTitle = computed(() => {
if (progress.value < 100) {
return `正在智能整理${caseTypeName.value}...`;
}
return `${caseTypeName.value}生成完成`;
});
const open = (type) => {
caseType.value = type;
progress.value = 0;
detectedInfo.value = [];
isGenerating.value = false;
2026-01-29 18:44:34 +08:00
isCompleted.value = false;
finalData.value = null;
2026-01-29 18:03:40 +08:00
popup.value?.open();
};
const close = () => {
popup.value?.close();
};
const updateProgress = (value) => {
progress.value = value;
};
2026-01-29 18:44:34 +08:00
const addDetectedInfo = (fieldKey, fieldValue) => {
const label = FIELD_LABELS[fieldKey] || fieldKey;
// 如果字段值为空,显示"暂无"
2026-02-02 13:27:48 +08:00
const displayValue = fieldValue && fieldValue.trim() ? fieldValue : "暂无";
2026-01-29 18:44:34 +08:00
detectedInfo.value.push({
label,
value: displayValue,
2026-02-02 13:27:48 +08:00
animated: true,
2026-01-29 18:44:34 +08:00
});
2026-01-29 18:03:40 +08:00
};
const setGenerating = (value) => {
isGenerating.value = value;
};
2026-01-29 18:44:34 +08:00
const setCompleted = (value, data = null) => {
isCompleted.value = value;
finalData.value = data;
};
const reset = () => {
progress.value = 0;
detectedInfo.value = [];
isGenerating.value = false;
isCompleted.value = false;
finalData.value = null;
};
const handleRegenerate = () => {
2026-02-02 13:27:48 +08:00
emit("regenerate", { caseType: caseType.value });
2026-01-29 18:44:34 +08:00
close();
};
const handleNext = () => {
2026-02-02 13:27:48 +08:00
emit("next", {
2026-01-29 18:44:34 +08:00
caseType: caseType.value,
2026-02-02 13:27:48 +08:00
data: finalData.value,
2026-01-29 18:44:34 +08:00
});
close();
};
2026-01-29 18:03:40 +08:00
defineExpose({
open,
close,
updateProgress,
addDetectedInfo,
2026-01-29 18:44:34 +08:00
setGenerating,
setCompleted,
2026-02-02 13:27:48 +08:00
reset,
2026-01-29 18:03:40 +08:00
});
</script>
<style scoped lang="scss">
.progress-modal {
width: 600rpx;
background-color: #ffffff;
border-radius: 24rpx;
padding: 48rpx 40rpx;
position: relative;
2026-01-29 18:44:34 +08:00
max-height: 80vh;
overflow-y: auto;
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.close-btn {
position: absolute;
top: 20rpx;
right: 20rpx;
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
2026-01-29 18:44:34 +08:00
z-index: 10;
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.close-icon {
font-size: 40rpx;
color: #999999;
}
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.progress-content {
.progress-title {
font-size: 32rpx;
font-weight: 600;
color: #333333;
margin-bottom: 32rpx;
text-align: center;
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.progress-bar-wrapper {
display: flex;
align-items: center;
gap: 16rpx;
margin-bottom: 32rpx;
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.progress-bar {
flex: 1;
height: 16rpx;
background-color: #e5e5e5;
border-radius: 8rpx;
overflow: hidden;
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #1890ff 0%, #40a9ff 100%);
2026-01-29 18:44:34 +08:00
transition: width 0.5s ease;
2026-01-29 18:03:40 +08:00
}
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.progress-text {
font-size: 28rpx;
color: #1890ff;
font-weight: 600;
min-width: 80rpx;
text-align: right;
}
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.detected-info {
margin-bottom: 24rpx;
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.detected-title {
font-size: 28rpx;
color: #666666;
display: block;
margin-bottom: 16rpx;
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.info-list {
2026-01-29 18:44:34 +08:00
max-height: 400rpx;
overflow-y: auto;
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.info-item {
display: flex;
align-items: flex-start;
gap: 12rpx;
margin-bottom: 12rpx;
2026-01-29 18:44:34 +08:00
opacity: 0;
transform: translateX(-20rpx);
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
&.fade-in {
animation: fadeInSlide 0.4s ease forwards;
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.check-icon {
font-size: 28rpx;
color: #52c41a;
font-weight: bold;
2026-01-29 18:44:34 +08:00
margin-top: 2rpx;
2026-01-29 18:03:40 +08:00
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.info-text {
flex: 1;
font-size: 26rpx;
color: #333333;
2026-01-29 18:44:34 +08:00
line-height: 1.6;
word-break: break-all;
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
// 暂无数据的样式
&.empty-value {
color: #999999;
}
2026-01-29 18:03:40 +08:00
}
}
}
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:03:40 +08:00
.generating-text {
font-size: 28rpx;
color: #1890ff;
text-align: center;
padding: 16rpx 0;
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
.dot-animation::after {
2026-02-02 13:27:48 +08:00
content: "...";
2026-01-29 18:44:34 +08:00
animation: dots 1.5s steps(4, end) infinite;
}
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
.action-buttons {
display: flex;
gap: 16rpx;
margin-top: 32rpx;
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
.action-button {
flex: 1;
height: 80rpx;
border-radius: 40rpx;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
&.primary {
background: linear-gradient(90deg, #1890ff 0%, #40a9ff 100%);
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
.button-text {
color: #ffffff;
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
&:active {
opacity: 0.8;
transform: scale(0.98);
}
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
&.secondary {
background-color: #ffffff;
border: 2rpx solid #d9d9d9;
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
.button-text {
color: #666666;
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
&:active {
background-color: #f5f5f5;
transform: scale(0.98);
}
}
2026-02-02 13:27:48 +08:00
2026-01-29 18:44:34 +08:00
.button-text {
font-size: 30rpx;
font-weight: 500;
}
}
2026-01-29 18:03:40 +08:00
}
}
}
2026-01-29 18:44:34 +08:00
@keyframes fadeInSlide {
to {
opacity: 1;
transform: translateX(0);
}
}
@keyframes dots {
2026-02-02 13:27:48 +08:00
0%,
20% {
content: "";
2026-01-29 18:44:34 +08:00
}
40% {
2026-02-02 13:27:48 +08:00
content: ".";
2026-01-29 18:44:34 +08:00
}
60% {
2026-02-02 13:27:48 +08:00
content: "..";
2026-01-29 18:44:34 +08:00
}
2026-02-02 13:27:48 +08:00
80%,
100% {
content: "...";
2026-01-29 18:44:34 +08:00
}
}
2026-01-29 18:03:40 +08:00
</style>