This commit is contained in:
Your Name
2026-03-13 14:08:52 +08:00
parent 08dd9cd307
commit eb283f008b
667 changed files with 8425 additions and 27053 deletions
+106 -69
View File
@@ -136,7 +136,7 @@
</template>
</el-table-column>
<el-table-column label="操作" width="360" fixed="right">
<el-table-column label="操作" width="320" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['doctor.appointment/detail']"
@@ -154,22 +154,6 @@
>
编辑患者
</el-button>
<el-button
v-perms="['tcm.diagnosis/video-call']"
type="success"
link
@click="handleVideoCall(row)"
>
1V1通话
</el-button>
<el-button
v-perms="['tcm.diagnosis/video-group']"
type="success"
link
@click="handleGroupVideoCall(row)"
>
群通话
</el-button>
<el-button
v-if="row.status === 1"
v-perms="['doctor.appointment/cancel']"
@@ -186,9 +170,9 @@
link
@click="handleComplete(row)"
>
完成视频面诊
完成面诊
</el-button>
<el-button
<el-button
v-if="row.status === 1"
v-perms="['doctor.appointment/prescription']"
type="success"
@@ -197,6 +181,15 @@
>
聊天
</el-button>
<el-button
v-if="row.status === 1"
v-perms="['tcm.diagnosis/guahao']"
type="primary"
link
@click="handleMiniProgramQRCode(row)"
>
确认诊单二维码
</el-button>
</template>
</el-table-column>
</el-table>
@@ -257,27 +250,59 @@
<!-- 编辑患者弹窗 -->
<edit-popup ref="editRef" @success="getLists" />
<!-- 视频通话组件 -->
<video-call ref="videoCallRef" />
<!-- 处方单抽屉 -->
<prescription-drawer ref="prescriptionDrawerRef" @success="loadData" />
<!-- 聊天对话框 -->
<chat-dialog ref="chatDialogRef" />
<!-- 小程序二维码弹窗 -->
<el-dialog
v-model="qrcodeDialogVisible"
title="小程序二维码"
width="400px"
:close-on-click-modal="false"
>
<div class="flex flex-col items-center justify-center py-4">
<div v-if="qrcodeLoading" class="text-center">
<el-icon class="is-loading" :size="40">
<Loading />
</el-icon>
<div class="mt-4 text-gray-500">生成中...</div>
</div>
<div v-else-if="qrcodeUrl" class="text-center">
<img :src="qrcodeUrl" alt="小程序二维码" class="w-64 h-64 border border-gray-200 rounded" />
<div class="mt-4 text-sm text-gray-600">
<div>患者{{ currentQRCodeRow?.patient_name }}</div>
<div class="mt-2">请使用微信扫描二维码</div>
<div class="mt-1 text-xs text-gray-400">跳转小程序路径pages/login/login</div>
</div>
</div>
<div v-else class="text-center text-gray-500">
生成失败请重试
</div>
</div>
<template #footer>
<el-button @click="qrcodeDialogVisible = false">关闭</el-button>
<el-button v-if="!qrcodeLoading" type="primary" @click="handleRegenerateQRCode">
重新生成
</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import { usePaging } from '@/hooks/usePaging'
import { appointmentLists, cancelAppointment, completeAppointment, appointmentDetail } from '@/api/doctor'
import { getCallSignature } from '@/api/tcm'
import { getCallSignature, generateMiniProgramQrcode } from '@/api/tcm'
import feedback from '@/utils/feedback'
import EditPopup from '../diagnosis/edit.vue'
import VideoCall from '@/components/video-call/index.vue'
import PrescriptionDrawer from './components/prescription-drawer.vue'
import ChatDialog from '@/components/chat-dialog/index.vue'
import useUserStore from '@/stores/modules/user'
import { getWeappConfig } from '@/api/channel/weapp'
import { Loading } from '@element-plus/icons-vue'
const userStore = useUserStore()
const userInfo = computed(() => userStore.userInfo)
@@ -367,10 +392,15 @@ const handleReset = () => {
const detailVisible = ref(false)
const detailData = ref<any>(null)
const editRef = ref()
const videoCallRef = ref()
const prescriptionDrawerRef = ref()
const chatDialogRef = ref()
// 小程序二维码相关
const qrcodeDialogVisible = ref(false)
const qrcodeLoading = ref(false)
const qrcodeUrl = ref('')
const currentQRCodeRow = ref<any>(null)
// 查看详情
const handleDetail = async (row: any) => {
try {
@@ -416,50 +446,6 @@ const handleEditPatient = (row: any) => {
editRef.value?.open('edit', row.patient_id)
}
// 1v1视频通话
const handleVideoCall = (row: any) => {
if (!row.patient_id) {
feedback.msgWarning('患者信息不完整')
return
}
videoCallRef.value?.open({
diagnosisId: row.diagnosis_id || row.id,
patientId: row.patient_id,
patientName: row.patient_name,
userId: `patient_${row.patient_id}`,
isGroup: false
})
}
// 群组视频通话
const handleGroupVideoCall = (row: any) => {
if (!row.patient_id) {
feedback.msgWarning('患者信息不完整')
return
}
if (!row.doctor_id) {
feedback.msgWarning('该预约没有医生信息,无法发起群组通话')
return
}
// 群组通话参与者:患者和医生
const userIds = [
`patient_${row.patient_id}`,
`doctor_${row.doctor_id}`
]
videoCallRef.value?.open({
diagnosisId: row.diagnosis_id || row.id,
patientId: row.patient_id,
patientName: row.patient_name,
doctorId: row.doctor_id,
userIds: userIds,
isGroup: true
})
}
// 聊天
const handleChat = async (row: any) => {
if (!row.patient_id) {
@@ -495,6 +481,57 @@ const handleChat = async (row: any) => {
}
}
// 生成小程序二维码(跳转小程序路径:pages/login/login
const handleMiniProgramQRCode = async (row: any) => {
if (!row.patient_id) {
feedback.msgWarning('患者信息不完整')
return
}
currentQRCodeRow.value = row
qrcodeDialogVisible.value = true
qrcodeLoading.value = true
qrcodeUrl.value = ''
try {
// 获取小程序配置
const config = await getWeappConfig()
if (!config?.app_id) {
feedback.msgError('小程序未配置,请先配置小程序信息')
qrcodeDialogVisible.value = false
return
}
const currentUser = userStore.userInfo
const result = await generateMiniProgramQrcode({
diagnosis_id: row.diagnosis_id || row.id,
patient_id: row.patient_id,
share_user_id: currentUser?.id || '',
mini_program_path: 'pages/login/login'
})
if (result?.qrcode_url) {
qrcodeUrl.value = result.qrcode_url
} else {
feedback.msgError('二维码生成失败')
}
} catch (error: any) {
console.error('生成小程序二维码失败:', error)
feedback.msgError(error?.msg || '生成二维码失败,请重试')
} finally {
qrcodeLoading.value = false
}
}
// 重新生成二维码
const handleRegenerateQRCode = () => {
if (currentQRCodeRow.value) {
handleMiniProgramQRCode(currentQRCodeRow.value)
}
}
loadData()
</script>