Merge branch 'long-consultation-desk'

This commit is contained in:
2026-04-30 12:19:12 +08:00
15 changed files with 675 additions and 272 deletions
+16 -2
View File
@@ -16,8 +16,13 @@ export function notifyAssistant(params: { id: number }) {
return request.post({ url: '/doctor.appointment/notifyAssistant', params })
}
// 医生备注 - 添加/追加(同一天追加 content + tongue_images
export function addDoctorNote(params: { diagnosis_id: number; content?: string; tongue_images?: string[] }) {
// 医生备注 - 添加/追加(同一天追加 content + tongue_images + report_files
export function addDoctorNote(params: {
diagnosis_id: number
content?: string
tongue_images?: string[]
report_files?: string[]
}) {
return request.post({ url: '/doctor.appointment/addDoctorNote', params })
}
@@ -25,3 +30,12 @@ export function addDoctorNote(params: { diagnosis_id: number; content?: string;
export function getDoctorNotes(params: { diagnosis_id: number }) {
return request.get({ url: '/doctor.appointment/doctorNotes', params })
}
// 医生备注 - 删除单张图片
export function deleteDoctorNoteImage(params: {
note_id: number
image_type: 'tongue_images' | 'report_files'
image_path: string
}) {
return request.post({ url: '/doctor.appointment/deleteDoctorNoteImage', params })
}
+4 -35
View File
@@ -135,16 +135,10 @@ import {
bindCallRoom,
endCall,
getCallSignature,
startCall,
tcmDiagnosisDetail,
tcmDiagnosisEdit
startCall
} from '@/api/tcm'
import { CallLocalRecorder } from '@/utils/call-local-recorder'
import { captureVideoFrameFromElement } from '@/utils/call-video-screenshot'
import {
DIAGNOSIS_TONGUE_IMAGES_UPDATED,
type DiagnosisTongueImagesUpdatedDetail
} from '@/utils/diagnosis-sync-events'
import feedback from '@/utils/feedback'
import {
formatTUICallUserError,
@@ -1274,9 +1268,8 @@ const onCallKitDragEnd = () => {
document.removeEventListener('mouseup', onCallKitDragEnd)
}
/** 截取当前视频画面并上传,同步到对应患者诊单的「舌苔照片」 */
/** 截取当前视频画面并上传,保存到医生备注 */
const handleCallKitScreenshot = async () => {
// 同步防重入:避免连点触发两次上传、诊单里出现两张图
if (captureUploading.value) return
captureUploading.value = true
try {
@@ -1305,32 +1298,8 @@ const handleCallKitScreenshot = async () => {
feedback.msgWarning('请先保存诊单后再从视频同步舌苔照片')
return
}
const detail = await tcmDiagnosisDetail({ id: diagnosisId.value })
if (Number(detail.patient_id) !== Number(patientId.value)) {
feedback.msgError('患者与当前诊单不匹配,无法同步')
return
}
const previous: string[] = [...((detail.tongue_images || []) as string[])]
// if (previous.length >= 9) {
// feedback.msgWarning('舌苔照片已达上限 9 张')
// return
// }
const next = [...previous, path]
const payload = JSON.parse(JSON.stringify(detail)) as Record<string, unknown>
payload.tongue_images = next
await tcmDiagnosisEdit(payload)
feedback.msgSuccess('舌苔照片已同步到诊单')
window.dispatchEvent(
new CustomEvent<DiagnosisTongueImagesUpdatedDetail>(DIAGNOSIS_TONGUE_IMAGES_UPDATED, {
detail: {
diagnosisId: diagnosisId.value,
tongue_images: next
}
})
)
try {
await addDoctorNote({ diagnosis_id: diagnosisId.value, tongue_images: [path] })
} catch { /* 写入备注表失败不阻塞主流程 */ }
await addDoctorNote({ diagnosis_id: diagnosisId.value, tongue_images: [path] })
feedback.msgSuccess('舌苔照片已保存')
} catch (e: unknown) {
const err = e as Error
console.error(err)
-9
View File
@@ -1,9 +0,0 @@
/**
* 跨组件同步诊单数据(如视频截屏写入舌苔照后刷新编辑抽屉)
*/
export const DIAGNOSIS_TONGUE_IMAGES_UPDATED = 'zyt:diagnosis-tongue-images-updated'
export type DiagnosisTongueImagesUpdatedDetail = {
diagnosisId: number
tongue_images: string[]
}
@@ -1,47 +1,108 @@
<template>
<div v-if="notes.length" class="note-timeline">
<div v-for="note in notes" :key="note.id" class="timeline-node">
<div class="timeline-dot"></div>
<div class="timeline-date">{{ note.note_date }}</div>
<div class="timeline-body">
<div v-if="note.content" class="timeline-content">
<div v-for="(line, idx) in splitLines(note.content)" :key="idx" class="content-line">
{{ line }}
<div class="note-timeline-wrap">
<div v-if="!readonly && diagnosisId" class="timeline-actions">
<material-picker
v-model="tongueModel"
:limit="99"
type="image"
:exclude-domain="true"
@change="handleTongueChange"
>
<template #upload>
<div class="upload-trigger">
<icon :size="20" name="el-icon-Plus" />
<span>舌苔照片</span>
</div>
</template>
</material-picker>
<material-picker
v-model="reportModel"
:limit="99"
type="file"
:exclude-domain="true"
@change="handleReportChange"
>
<template #upload>
<div class="upload-trigger">
<icon :size="20" name="el-icon-Plus" />
<span>检查报告</span>
</div>
</template>
</material-picker>
</div>
<div v-if="notes.length" class="note-timeline">
<div v-for="note in notes" :key="note.id" class="timeline-node">
<div class="timeline-dot"></div>
<div class="timeline-date">{{ note.note_date }}</div>
<div class="timeline-body">
<div v-if="note.content" class="timeline-content">
<div v-for="(line, idx) in splitLines(note.content)" :key="idx" class="content-line">
{{ line }}
</div>
</div>
<div v-if="note.tongue_images?.length" class="timeline-images">
<span class="images-label">舌苔照片</span>
<div v-for="(url, idx) in note.tongue_images" :key="idx" class="thumb-wrap">
<el-image
:src="getImageUrl(url)"
:preview-src-list="note.tongue_images.map(getImageUrl)"
:initial-index="idx"
fit="cover"
class="timeline-thumb"
preview-teleported
/>
<el-icon
v-if="!readonly"
class="thumb-delete"
@click.stop="handleDeleteImage(note.id, 'tongue_images', url)"
><CircleClose /></el-icon>
</div>
</div>
<div v-if="note.report_files?.length" class="timeline-images">
<span class="images-label">检查报告</span>
<template v-for="(url, idx) in note.report_files" :key="idx">
<div v-if="isImageFile(url)" class="thumb-wrap">
<el-image
:src="getImageUrl(url)"
:preview-src-list="getImagePreviewList(note.report_files)"
:initial-index="getImagePreviewIndex(note.report_files, idx)"
fit="cover"
class="timeline-thumb"
preview-teleported
/>
<el-icon
v-if="!readonly"
class="thumb-delete"
@click.stop="handleDeleteImage(note.id, 'report_files', url)"
><CircleClose /></el-icon>
</div>
<div v-else class="file-wrap">
<a :href="getImageUrl(url)" target="_blank" class="file-link" :title="getFileName(url)">
<el-icon :size="20"><Document /></el-icon>
<span class="file-name">{{ getFileName(url) }}</span>
</a>
<el-icon
v-if="!readonly"
class="file-delete"
@click.stop="handleDeleteImage(note.id, 'report_files', url)"
><CircleClose /></el-icon>
</div>
</template>
</div>
</div>
<div v-if="note.tongue_images?.length" class="timeline-images">
<span class="images-label">舌苔照片</span>
<el-image
v-for="(url, idx) in note.tongue_images"
:key="idx"
:src="getImageUrl(url)"
:preview-src-list="note.tongue_images.map(getImageUrl)"
:initial-index="idx"
fit="cover"
class="timeline-thumb"
preview-teleported
/>
</div>
<div v-if="note.report_files?.length" class="timeline-images">
<span class="images-label">检查报告</span>
<el-image
v-for="(url, idx) in note.report_files"
:key="idx"
:src="getImageUrl(url)"
:preview-src-list="note.report_files.map(getImageUrl)"
:initial-index="idx"
fit="cover"
class="timeline-thumb"
preview-teleported
/>
</div>
</div>
</div>
<el-empty v-if="!notes.length && readonly" description="暂无备注" :image-size="48" />
</div>
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { CircleClose, Document } from '@element-plus/icons-vue'
import { ElMessageBox } from 'element-plus'
import useAppStore from '@/stores/modules/app'
import { addDoctorNote, deleteDoctorNoteImage } from '@/api/patient'
import feedback from '@/utils/feedback'
export interface DoctorNoteItem {
id: number
@@ -51,18 +112,129 @@ export interface DoctorNoteItem {
report_files: string[]
}
defineProps<{ notes: DoctorNoteItem[] }>()
const props = defineProps<{
notes: DoctorNoteItem[]
diagnosisId?: number
readonly?: boolean
}>()
const emit = defineEmits<{ refresh: [] }>()
const appStore = useAppStore()
const getImageUrl = (url: string) => appStore.getImageUrl(url)
const tongueModel = ref<string[]>([])
const reportModel = ref<string[]>([])
const prevTongueCount = ref(0)
const prevReportCount = ref(0)
const IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg']
const isImageFile = (url: string): boolean => {
const ext = url.split('.').pop()?.toLowerCase().split('?')[0] || ''
return IMAGE_EXTENSIONS.includes(ext)
}
const getFileName = (url: string): string => {
const parts = url.split('/')
return decodeURIComponent(parts[parts.length - 1]?.split('?')[0] || '文件')
}
const getImagePreviewList = (files: string[]): string[] => {
return files.filter(isImageFile).map(getImageUrl)
}
const getImagePreviewIndex = (files: string[], currentIdx: number): number => {
const imageFiles = files.filter(isImageFile)
const currentUrl = files[currentIdx]
return imageFiles.indexOf(currentUrl)
}
const splitLines = (content: string | null): string[] => {
if (!content) return []
return content.split('\n').filter(Boolean)
}
const handleTongueChange = (val: string[]) => {
if (!props.diagnosisId) return
const newItems = Array.isArray(val) ? val : [val]
if (newItems.length <= prevTongueCount.value) {
prevTongueCount.value = newItems.length
return
}
const added = newItems.slice(prevTongueCount.value)
prevTongueCount.value = newItems.length
if (added.length > 0) {
addDoctorNote({ diagnosis_id: props.diagnosisId, tongue_images: added }).then(() => {
feedback.msgSuccess('舌苔照片已添加')
emit('refresh')
})
}
}
const handleReportChange = (val: string[]) => {
if (!props.diagnosisId) return
const newItems = Array.isArray(val) ? val : [val]
if (newItems.length <= prevReportCount.value) {
prevReportCount.value = newItems.length
return
}
const added = newItems.slice(prevReportCount.value)
prevReportCount.value = newItems.length
if (added.length > 0) {
addDoctorNote({ diagnosis_id: props.diagnosisId, report_files: added }).then(() => {
feedback.msgSuccess('检查报告已添加')
emit('refresh')
})
}
}
watch(() => props.notes, () => {
tongueModel.value = []
reportModel.value = []
prevTongueCount.value = 0
prevReportCount.value = 0
})
const handleDeleteImage = async (noteId: number, imageType: 'tongue_images' | 'report_files', imagePath: string) => {
try {
await ElMessageBox.confirm('确认删除?', '提示', { type: 'warning' })
} catch {
return
}
await deleteDoctorNoteImage({ note_id: noteId, image_type: imageType, image_path: imagePath })
feedback.msgSuccess('已删除')
emit('refresh')
}
</script>
<style scoped lang="scss">
.timeline-actions {
display: flex;
gap: 12px;
margin-bottom: 12px;
padding-bottom: 12px;
border-bottom: 1px dashed #ebeef5;
}
.upload-trigger {
width: 90px;
height: 90px;
border: 1px dashed #dcdfe6;
border-radius: 6px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
cursor: pointer;
color: #909399;
font-size: 12px;
transition: border-color 0.2s;
&:hover {
border-color: #409eff;
color: #409eff;
}
}
.note-timeline {
position: relative;
padding-left: 22px;
@@ -128,6 +300,10 @@ const splitLines = (content: string | null): string[] => {
color: #909399;
flex-shrink: 0;
}
.thumb-wrap {
position: relative;
display: inline-block;
}
.timeline-thumb {
width: 64px;
height: 64px;
@@ -139,4 +315,59 @@ const splitLines = (content: string | null): string[] => {
.timeline-thumb:hover {
transform: scale(1.05);
}
.thumb-delete {
position: absolute;
top: -6px;
right: -6px;
font-size: 16px;
color: #f56c6c;
background: #fff;
border-radius: 50%;
cursor: pointer;
display: none;
}
.thumb-wrap:hover .thumb-delete {
display: block;
}
.file-wrap {
position: relative;
display: inline-flex;
align-items: center;
}
.file-link {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 6px 10px;
border: 1px solid #ebeef5;
border-radius: 6px;
text-decoration: none;
color: #409eff;
font-size: 12px;
max-width: 180px;
transition: border-color 0.2s;
&:hover {
border-color: #409eff;
}
}
.file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 120px;
}
.file-delete {
position: absolute;
top: -6px;
right: -6px;
font-size: 16px;
color: #f56c6c;
background: #fff;
border-radius: 50%;
cursor: pointer;
display: none;
}
.file-wrap:hover .file-delete {
display: block;
}
</style>
+16 -7
View File
@@ -69,7 +69,7 @@
<el-tag v-if="row.status === 4" size="small" type="warning" class="ml-1">已过号</el-tag>
</div>
<div class="time-line">
{{ row.appointment_time || '—' }} · 医助 {{ row.assistant_name || '—' }}
{{ formatTimeHM(row.appointment_time) }} · 医助 {{ row.assistant_name || '—' }}
</div>
</div>
<div class="row-actions" @click.stop>
@@ -246,9 +246,12 @@
<!-- 医生备注 & 舌苔照片 -->
<div class="card note-card">
<div class="card-title">医生备注 & 舌苔照片</div>
<NoteTimeline v-if="doctorNotes.length" :notes="doctorNotes" />
<el-empty v-else description="暂无备注" :image-size="48" />
<div class="card-title">医生备注 & 舌苔照片 & 检查报告</div>
<NoteTimeline
:notes="doctorNotes"
:diagnosis-id="diag?.id"
@refresh="refreshDetailSilently"
/>
</div>
<!-- 血糖血压记录 -->
@@ -478,6 +481,11 @@ const formatGenderAge = (row: QueueRow) => {
return parts.filter((p) => p && p !== '—').join(' ')
}
const formatTimeHM = (time?: string) => {
if (!time) return '—'
return time.replace(/^(\d{2}:\d{2})(:\d{2})?$/, '$1')
}
const formatPeriod = (period?: string) => {
if (period === 'morning') return '上午'
if (period === 'afternoon') return '下午'
@@ -938,6 +946,7 @@ onUnmounted(() => {
gap: 14px;
flex: 1;
min-height: 0;
align-items: flex-start;
}
.queue-col {
width: 288px;
@@ -952,7 +961,6 @@ onUnmounted(() => {
flex-direction: column;
gap: 10px;
height: calc(100vh - 260px);
min-height: 480px;
}
.queue-head {
display: flex;
@@ -980,7 +988,7 @@ onUnmounted(() => {
.queue-row {
border: 1px solid var(--rx-line);
border-radius: 8px;
padding: 10px;
padding: 12px 10px;
display: flex;
justify-content: space-between;
align-items: center;
@@ -1011,6 +1019,7 @@ onUnmounted(() => {
display: flex;
align-items: baseline;
gap: 6px;
flex-wrap: wrap;
}
.name-meta {
font-size: 12px;
@@ -1018,7 +1027,7 @@ onUnmounted(() => {
font-weight: 400;
}
.time-line {
margin-top: 2px;
margin-top: 4px;
font-size: 12px;
color: var(--rx-soft);
font-family: var(--rx-font-data);
-19
View File
@@ -417,23 +417,6 @@
<div class="form-section">
<div class="section-title">诊断详情</div>
<el-form-item label="舌苔照片">
<material-picker
v-model="formData.tongue_images"
:limit="9"
type="image"
/>
<div class="form-tips">支持上传多张舌苔照片最多9张</div>
</el-form-item>
<el-form-item label="检查报告">
<material-picker
v-model="formData.report_files"
:limit="10"
type="image"
/>
<div class="form-tips">支持上传检查报告病历彩超等影像科检查图片最多10个文件</div>
</el-form-item>
<el-form-item label="舌苔" prop="tongue_coating">
<el-input v-model="formData.tongue_coating" placeholder="请输入舌苔情况" />
@@ -549,8 +532,6 @@ const formData = ref({
allergy_history: 0,
family_history: 0,
pregnancy_history: 0,
tongue_images: [],
report_files: [],
symptoms: '',
tongue_coating: '',
pulse: '',
+13 -81
View File
@@ -493,25 +493,6 @@
<!-- 诊断信息 -->
<el-divider content-position="left">诊断信息</el-divider>
<el-form-item label="舌苔照片">
<material-picker
v-model="formData.tongue_images"
:limit="9"
type="image"
:exclude-domain="true"
/>
<div class="form-tips">支持上传多张舌苔照片最多9张</div>
</el-form-item>
<el-form-item label="检查报告">
<material-picker
v-model="formData.report_files"
:limit="10"
type="image"
:exclude-domain="true"
/>
<div class="form-tips">支持上传检查报告病历彩超等影像科检查图片最多10个文件</div>
</el-form-item>
@@ -529,8 +510,11 @@
</el-tab-pane>
<el-tab-pane label="医生备注" name="doctorNote" :disabled="!formData.id" lazy>
<div v-if="formData.id" class="p-4">
<NoteTimeline v-if="diagNotes.length" :notes="diagNotes" />
<el-empty v-else description="暂无备注记录" :image-size="48" />
<NoteTimeline
:notes="diagNotes"
:diagnosis-id="Number(formData.id)"
@refresh="fetchDiagNotes"
/>
</div>
<el-empty v-else description="请先保存诊单后查看" />
</el-tab-pane>
@@ -567,40 +551,6 @@
<!-- 病历记录标签页开方后自动显示 -->
<el-tab-pane label="处方" name="bingli" :disabled="!formData.id" v-if="hasPermission(['tcm.diagnosis/chufang'])">
<div v-if="formData.id" class="bingli-tab-content">
<!-- 诊断信息舌苔照片检查报告 -->
<div class="bingli-diagnosis-section">
<el-divider content-position="left">诊断信息</el-divider>
<el-row :gutter="24">
<el-col :span="12">
<div class="bingli-label">舌苔照片</div>
<div v-if="formData.tongue_images?.length" class="bingli-images">
<el-image
v-for="(img, idx) in formData.tongue_images"
:key="idx"
:src="getImageUrl(img)"
:preview-src-list="(formData.tongue_images || []).map((u: string) => getImageUrl(u))"
class="bingli-img"
fit="cover"
/>
</div>
<span v-else class="bingli-empty">暂无</span>
</el-col>
<el-col :span="12">
<div class="bingli-label">检查报告</div>
<div v-if="formData.report_files?.length" class="bingli-images">
<el-image
v-for="(file, idx) in formData.report_files"
:key="idx"
:src="getImageUrl(file)"
:preview-src-list="(formData.report_files || []).map((u: string) => getImageUrl(u))"
class="bingli-img"
fit="cover"
/>
</div>
<span v-else class="bingli-empty">暂无</span>
</el-col>
</el-row>
</div>
<!-- 病历记录列表 -->
<case-record-list
ref="caseRecordListRef"
@@ -712,10 +662,6 @@ import AppointmentRecordPanel from './components/AppointmentRecordPanel.vue'
import NoteTimeline from '@/views/patient/reception/components/NoteTimeline.vue'
import TcmPrescription from '@/components/tcm-prescription/index.vue'
import { getDoctorNotes } from '@/api/patient'
import {
DIAGNOSIS_TONGUE_IMAGES_UPDATED,
type DiagnosisTongueImagesUpdatedDetail
} from '@/utils/diagnosis-sync-events'
const emit = defineEmits(['success'])
const appStore = useAppStore()
@@ -744,11 +690,16 @@ const drawerTitle = computed(() => {
const diagNotes = ref<any[]>([])
const fetchDiagNotes = async () => {
if (!formData.value.id) return
try {
diagNotes.value = await getDoctorNotes({ diagnosis_id: Number(formData.value.id) }) || []
} catch { diagNotes.value = [] }
}
watch(() => activeTab.value, async (tab) => {
if (tab === 'doctorNote' && formData.value.id) {
try {
diagNotes.value = await getDoctorNotes({ diagnosis_id: Number(formData.value.id) }) || []
} catch { diagNotes.value = [] }
await fetchDiagNotes()
}
})
@@ -772,21 +723,6 @@ watch([visible, activeTab], () => {
}
})
function onTongueImagesSyncedFromCall(e: Event) {
if (!visible.value) return
const d = (e as CustomEvent<DiagnosisTongueImagesUpdatedDetail>).detail
if (!d?.diagnosisId || !Array.isArray(d.tongue_images)) return
if (Number(formData.value.id) !== Number(d.diagnosisId)) return
formData.value.tongue_images = [...d.tongue_images]
}
onMounted(() => {
window.addEventListener(DIAGNOSIS_TONGUE_IMAGES_UPDATED, onTongueImagesSyncedFromCall as EventListener)
})
onUnmounted(() => {
window.removeEventListener(DIAGNOSIS_TONGUE_IMAGES_UPDATED, onTongueImagesSyncedFromCall as EventListener)
})
const formData = ref({
id: '',
@@ -831,8 +767,6 @@ const formData = ref({
family_history: 0,
pregnancy_history: 0,
assistant_id: undefined as number | undefined,
tongue_images: [] as string[],
report_files: [],
symptoms: '',
tongue_coating: '',
pulse: '',
@@ -1263,8 +1197,6 @@ const handleClose = () => {
family_history: 0,
pregnancy_history: 0,
assistant_id: undefined as number | undefined,
tongue_images: [] as string[],
report_files: [],
symptoms: '',
tongue_coating: '',
pulse: '',