This commit is contained in:
Your Name
2026-04-30 14:09:04 +08:00
154 changed files with 3606 additions and 22938 deletions
+41
View File
@@ -0,0 +1,41 @@
import request from '@/utils/request'
// 接诊台 - 待接诊队列(复用挂号列表接口)
// 建议调用方式:receptionQueue({ status: 1, start_date: today, end_date: today, page_size: 50 })
export function receptionQueue(params: any) {
return request.get({ url: '/doctor.appointment/lists', params })
}
// 接诊台 - 聚合详情:挂号信息 + 诊单病例 + 血糖血压记录
export function receptionDetail(params: { id: number }) {
return request.get({ url: '/doctor.appointment/reception', params })
}
// 接诊台 - 通知接诊医助(发企业微信)
export function notifyAssistant(params: { id: number }) {
return request.post({ url: '/doctor.appointment/notifyAssistant', params })
}
// 医生备注 - 添加/追加(同一天追加 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 })
}
// 医生备注 - 按诊单查询列表
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 })
}
+5 -32
View File
@@ -129,21 +129,16 @@
import { ref, nextTick, watch, computed, onMounted, onUnmounted } from 'vue'
import { Loading, Close, Rank, Camera, Fold, Expand } from '@element-plus/icons-vue'
import { uploadImageBlob, uploadVideoBlob } from '@/api/file'
import { addDoctorNote } from '@/api/patient'
import {
attachLocalCallRecording,
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,
@@ -1273,9 +1268,8 @@ const onCallKitDragEnd = () => {
document.removeEventListener('mouseup', onCallKitDragEnd)
}
/** 截取当前视频画面并上传,同步到对应患者诊单的「舌苔照片」 */
/** 截取当前视频画面并上传,保存到医生备注 */
const handleCallKitScreenshot = async () => {
// 同步防重入:避免连点触发两次上传、诊单里出现两张图
if (captureUploading.value) return
captureUploading.value = true
try {
@@ -1304,29 +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
}
})
)
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[]
}
@@ -0,0 +1,373 @@
<template>
<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>
</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
note_date: string
content: string | null
tongue_images: string[]
report_files: string[]
}
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;
}
.note-timeline::before {
content: '';
position: absolute;
left: 6px;
top: 4px;
bottom: 4px;
width: 2px;
background: #ebeef5;
border-radius: 1px;
}
.timeline-node {
position: relative;
padding-bottom: 16px;
}
.timeline-node:last-child {
padding-bottom: 0;
}
.timeline-dot {
position: absolute;
left: -19px;
top: 5px;
width: 10px;
height: 10px;
border-radius: 50%;
background: #409eff;
border: 2px solid #ecf5ff;
}
.timeline-date {
font-size: 13px;
font-weight: 600;
color: #303133;
margin-bottom: 6px;
font-family: 'IBM Plex Mono', Consolas, monospace;
}
.timeline-body {
display: flex;
flex-direction: column;
gap: 6px;
}
.timeline-content {
display: flex;
flex-direction: column;
gap: 2px;
}
.content-line {
font-size: 12.5px;
color: #606266;
line-height: 1.6;
word-break: break-word;
}
.timeline-images {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
}
.images-label {
font-size: 12px;
color: #909399;
flex-shrink: 0;
}
.thumb-wrap {
position: relative;
display: inline-block;
}
.timeline-thumb {
width: 64px;
height: 64px;
border-radius: 6px;
border: 1px solid #ebeef5;
cursor: pointer;
transition: transform 0.15s ease;
}
.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>
File diff suppressed because it is too large Load Diff
-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: '',
+28 -77
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>
@@ -527,7 +508,16 @@
</fieldset>
</el-form>
</el-tab-pane>
<el-tab-pane label="医生备注" name="doctorNote" :disabled="!formData.id" lazy>
<div v-if="formData.id" class="p-4">
<NoteTimeline
:notes="diagNotes"
:diagnosis-id="Number(formData.id)"
@refresh="fetchDiagNotes"
/>
</div>
<el-empty v-else description="请先保存诊单后查看" />
</el-tab-pane>
<!-- 血糖血压记录标签页 -->
<el-tab-pane label="血糖血压记录" name="blood" :disabled="!formData.id">
<blood-record-list
@@ -561,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"
@@ -662,6 +618,7 @@
/>
<el-empty v-else description="请先保存诊单后再查看挂号记录" />
</el-tab-pane>
</el-tabs>
<!-- 处方详情(查看病历) -->
@@ -702,11 +659,9 @@ import CallRecordPanel from './components/CallRecordPanel.vue'
import ImChatRecordPanel from './components/ImChatRecordPanel.vue'
import AssignLogPanel from './components/AssignLogPanel.vue'
import AppointmentRecordPanel from './components/AppointmentRecordPanel.vue'
import NoteTimeline from '@/views/patient/reception/components/NoteTimeline.vue'
import TcmPrescription from '@/components/tcm-prescription/index.vue'
import {
DIAGNOSIS_TONGUE_IMAGES_UPDATED,
type DiagnosisTongueImagesUpdatedDetail
} from '@/utils/diagnosis-sync-events'
import { getDoctorNotes } from '@/api/patient'
const emit = defineEmits(['success'])
const appStore = useAppStore()
@@ -733,6 +688,21 @@ const drawerTitle = computed(() => {
return mode.value === 'add' ? '新增诊单' : '编辑诊单'
})
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) {
await fetchDiagNotes()
}
})
watch([visible, activeTab], () => {
if (!visible.value) return
if (activeTab.value === 'chat' && !hasPermission(['tcm.diagnosis/chat'])) {
@@ -753,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: '',
@@ -812,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: '',
@@ -1244,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: '',
File diff suppressed because one or more lines are too long