新增功能
This commit is contained in:
@@ -170,7 +170,7 @@
|
||||
link
|
||||
@click="handleComplete(row)"
|
||||
>
|
||||
完成面诊
|
||||
接诊完成
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 1"
|
||||
@@ -188,7 +188,7 @@
|
||||
link
|
||||
@click="handleMiniProgramQRCode(row)"
|
||||
>
|
||||
确认诊单二维码
|
||||
视频二维码
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -21,16 +21,16 @@
|
||||
<!-- 基本信息 -->
|
||||
<el-divider content-position="left">基本信息</el-divider>
|
||||
|
||||
<el-form-item label="患者ID">
|
||||
<el-form-item label="诊单ID">
|
||||
<el-input v-model="formData.patient_id" disabled placeholder="系统自动生成" />
|
||||
</el-form-item>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="患者姓名" prop="patient_name">
|
||||
<el-form-item label="姓名" prop="patient_name">
|
||||
<el-input
|
||||
v-model="formData.patient_name"
|
||||
placeholder="请输入患者姓名"
|
||||
placeholder="请输入姓名"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -94,6 +94,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
||||
<!-- 生命体征 -->
|
||||
<el-divider content-position="left">生命体征</el-divider>
|
||||
|
||||
@@ -589,6 +590,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -596,7 +598,9 @@
|
||||
import { tcmDiagnosisAdd, tcmDiagnosisEdit, tcmDiagnosisDetail, checkPhone, checkIdCard } from '@/api/tcm'
|
||||
import { getDictData } from '@/api/app'
|
||||
import feedback from '@/utils/feedback'
|
||||
import useUserStore from '@/stores/modules/user'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
import BloodRecordList from './components/BloodRecordList.vue'
|
||||
|
||||
const emit = defineEmits(['success'])
|
||||
@@ -659,7 +663,8 @@ const formData = ref({
|
||||
prescription: '',
|
||||
doctor_advice: '',
|
||||
remark: '',
|
||||
status: 1
|
||||
status: 1,
|
||||
external_userid: ''
|
||||
})
|
||||
|
||||
// 自定义验证规则
|
||||
@@ -832,6 +837,9 @@ const open = async (type: string, id?: number) => {
|
||||
if (type === 'edit' && id) {
|
||||
const data = await tcmDiagnosisDetail({ id })
|
||||
formData.value = data
|
||||
} else if (type === 'add') {
|
||||
const userStore = useUserStore()
|
||||
formData.value.assistant_id = userStore.userInfo?.id || ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -917,7 +925,8 @@ const handleClose = () => {
|
||||
prescription: '',
|
||||
doctor_advice: '',
|
||||
remark: '',
|
||||
status: 1
|
||||
status: 1,
|
||||
external_userid: ''
|
||||
}
|
||||
visible.value = false
|
||||
}
|
||||
@@ -1082,4 +1091,5 @@ defineExpose({
|
||||
.el-select-dropdown {
|
||||
z-index: 3000 !important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@@ -76,8 +76,9 @@
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="账户编号" prop="id" width="80" />
|
||||
<el-table-column label="账户编号" prop="id" width="90" />
|
||||
<el-table-column label="账户姓名" prop="patient_name" min-width="100" />
|
||||
|
||||
<el-table-column label="性别" prop="gender_desc" width="80" />
|
||||
<el-table-column label="年龄" prop="age" width="80" />
|
||||
<el-table-column label="诊断日期" prop="diagnosis_date_text" min-width="120" />
|
||||
@@ -86,6 +87,12 @@
|
||||
<span>{{ getDictLabel(diagnosisTypeOptions, row.diagnosis_type) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="确认诊单" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.DiagnosisViewRecord && row.DiagnosisViewRecord.length > 0" type="success" size="small">已确认</el-tag>
|
||||
<el-tag v-else type="info" size="small">未确认</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="证型" prop="syndrome_type" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<span>{{ getDictLabel(syndromeTypeOptions, row.syndrome_type) }}</span>
|
||||
@@ -96,22 +103,22 @@
|
||||
<span>{{ getAssistantName(row.assistant_id || row.assistant) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="80">
|
||||
<!-- <el-table-column label="状态" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.status == 1" type="success">启用</el-tag>
|
||||
<el-tag v-else type="danger">禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="创建时间" prop="create_time" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<span>{{ formatDateTime(row.create_time) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="240" fixed="right">
|
||||
<el-table-column label="操作" width="300" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button type="primary" link @click="handleDetail(row.id)">
|
||||
<!-- <el-button type="primary" link @click="handleDetail(row.id)">
|
||||
查看
|
||||
</el-button>
|
||||
</el-button> -->
|
||||
<el-button
|
||||
v-perms="['tcm.diagnosis/assign']"
|
||||
type="success"
|
||||
@@ -155,6 +162,12 @@
|
||||
<el-button type="primary" link @click="handleEdit(row.id)" v-perms="['tcm.diagnosis/edit']">
|
||||
诊单
|
||||
</el-button>
|
||||
<!-- <el-button type="primary" link @click="handleWechatRecords(row)">
|
||||
企微记录
|
||||
</el-button> -->
|
||||
<el-button type="primary" link @click="handleCreateOrder(row)">
|
||||
创建订单
|
||||
</el-button>
|
||||
<el-button type="danger" link @click="handleDelete(row.id)" v-perms="['tcm.diagnosis/delete']">
|
||||
删除
|
||||
</el-button>
|
||||
@@ -248,11 +261,170 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 创建订单弹窗 -->
|
||||
<el-dialog
|
||||
v-model="createOrderVisible"
|
||||
title="创建订单"
|
||||
width="600px"
|
||||
@close="resetOrderForm"
|
||||
>
|
||||
<el-form
|
||||
ref="orderFormRef"
|
||||
:model="orderForm"
|
||||
:rules="orderRules"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="患者">
|
||||
<span class="font-medium">{{ orderForm.patient_name }} ({{ orderForm.phone }})</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="订单类型" prop="order_type">
|
||||
<el-select v-model="orderForm.order_type" placeholder="请选择" class="w-full">
|
||||
<el-option label="挂号费" :value="1" />
|
||||
<el-option label="问诊费" :value="2" />
|
||||
<el-option label="药品费用" :value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="订单金额" prop="amount">
|
||||
<el-input-number
|
||||
v-model="orderForm.amount"
|
||||
:min="0"
|
||||
:step="0.01"
|
||||
:precision="2"
|
||||
placeholder="请输入金额"
|
||||
class="w-full"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="orderForm.remark"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
placeholder="请输入备注(可选)"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="createOrderVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitOrder" :loading="orderLoading">创建订单</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 企业微信聊天记录抽屉 -->
|
||||
<el-drawer
|
||||
v-model="wechatDrawerVisible"
|
||||
:title="`企业微信记录 - ${wechatCurrentPatient?.patient_name || ''}`"
|
||||
size="600px"
|
||||
:destroy-on-close="true"
|
||||
>
|
||||
<!-- 患者与企微信息 -->
|
||||
<div v-if="wechatContactInfo" class="mb-4">
|
||||
<el-descriptions :column="2" border size="small">
|
||||
<el-descriptions-item label="患者姓名">{{ wechatCurrentPatient?.patient_name }}</el-descriptions-item>
|
||||
<el-descriptions-item label="手机号">{{ wechatContactInfo.phone || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item label="企微联系人ID">
|
||||
<span v-if="wechatContactInfo.external_userid">{{ wechatContactInfo.external_userid }}</span>
|
||||
<el-tag v-else type="info" size="small">未关联</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="会话存档">
|
||||
<el-tag v-if="wechatContactInfo.msgaudit_enabled" type="success" size="small">已开通</el-tag>
|
||||
<el-tag v-else type="info" size="small">未配置</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<!-- 存档成员列表 -->
|
||||
<div v-if="wechatContactInfo.permit_users?.length" class="mt-2">
|
||||
<span class="text-sm text-gray-500 mr-2">存档成员:</span>
|
||||
<el-tag
|
||||
v-for="uid in wechatContactInfo.permit_users"
|
||||
:key="uid"
|
||||
size="small"
|
||||
class="mr-1"
|
||||
>
|
||||
{{ uid }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<!-- 同意存档情况 -->
|
||||
<div v-if="wechatContactInfo.msgaudit_agree?.length" class="mt-2">
|
||||
<span class="text-sm text-gray-500 mr-2">存档同意:</span>
|
||||
<el-tag
|
||||
v-for="(info, idx) in wechatContactInfo.msgaudit_agree"
|
||||
:key="idx"
|
||||
:type="info.agree_status === 'Agree' ? 'success' : 'warning'"
|
||||
size="small"
|
||||
class="mr-1"
|
||||
>
|
||||
{{ info.userid }}: {{ info.agree_status === 'Agree' ? '已同意' : info.agree_status }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<el-divider />
|
||||
|
||||
<!-- 添加记录 -->
|
||||
<div class="mb-4">
|
||||
<div class="flex gap-2">
|
||||
<el-input
|
||||
v-model="wechatNewNote"
|
||||
type="textarea"
|
||||
:rows="2"
|
||||
placeholder="添加沟通记录..."
|
||||
class="flex-1"
|
||||
/>
|
||||
<el-button type="primary" @click="handleAddRecord" :loading="wechatAddLoading" class="self-end">
|
||||
添加
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 记录列表 -->
|
||||
<div v-loading="wechatRecordsLoading">
|
||||
<div v-if="wechatRecords.length === 0" class="text-center text-gray-400 py-10">
|
||||
暂无聊天记录
|
||||
</div>
|
||||
<div v-else class="record-list">
|
||||
<div
|
||||
v-for="record in wechatRecords"
|
||||
:key="record.id"
|
||||
class="record-item"
|
||||
>
|
||||
<div class="record-header">
|
||||
<div class="flex items-center gap-2">
|
||||
<el-tag :type="record.direction === 0 ? 'primary' : 'success'" size="small">
|
||||
{{ record.direction === 0 ? '员工' : '客户' }}
|
||||
</el-tag>
|
||||
<span class="font-medium text-sm">
|
||||
{{ record.direction === 0 ? record.staff_name : record.external_name || wechatCurrentPatient?.patient_name }}
|
||||
</span>
|
||||
<el-tag v-if="record.msg_type === 'note'" type="warning" size="small">备注</el-tag>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-xs text-gray-400">{{ formatTimestamp(record.chat_time) }}</span>
|
||||
<el-button type="danger" link size="small" @click="handleDeleteRecord(record.id)">
|
||||
删除
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="record-content">{{ record.content }}</div>
|
||||
<div v-if="record.media_url" class="mt-1">
|
||||
<el-image :src="record.media_url" style="max-width: 200px" fit="contain" :preview-src-list="[record.media_url]" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="wechatRecordTotal > wechatRecords.length" class="text-center mt-4">
|
||||
<el-button link type="primary" @click="loadMoreRecords">加载更多</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="tcmDiagnosis">
|
||||
import { tcmDiagnosisLists, tcmDiagnosisDelete, tcmDiagnosisAssign, getAssistants, generateMiniProgramQrcode } from '@/api/tcm'
|
||||
import { tcmDiagnosisLists, tcmDiagnosisDelete, tcmDiagnosisAssign, getAssistants, generateMiniProgramQrcode, generateOrderQrcode, getWechatChatRecords, addWechatChatRecord, deleteWechatChatRecord, getWechatExternalContact } from '@/api/tcm'
|
||||
import { orderCreate } from '@/api/order'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { getDictData } from '@/api/app'
|
||||
import { getWeappConfig } from '@/api/channel/weapp'
|
||||
@@ -340,6 +512,83 @@ const detailRef = ref()
|
||||
const appointmentRef = ref()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 创建订单相关
|
||||
const createOrderVisible = ref(false)
|
||||
const orderFormRef = ref()
|
||||
const orderLoading = ref(false)
|
||||
const orderForm = reactive({
|
||||
patient_id: '' as string | number,
|
||||
patient_name: '',
|
||||
phone: '',
|
||||
order_type: '' as string | number,
|
||||
amount: 0,
|
||||
remark: ''
|
||||
})
|
||||
const orderRules = {
|
||||
order_type: [{ required: true, message: '请选择订单类型', trigger: 'change' }],
|
||||
amount: [{ required: true, message: '请输入订单金额', trigger: 'blur' }]
|
||||
}
|
||||
|
||||
const handleCreateOrder = (row: any) => {
|
||||
orderForm.patient_id = row.patient_id || row.id
|
||||
orderForm.patient_name = row.patient_name
|
||||
orderForm.phone = row.phone || ''
|
||||
orderForm.order_type = ''
|
||||
orderForm.amount = 0
|
||||
orderForm.remark = ''
|
||||
orderFormRef.value?.clearValidate()
|
||||
createOrderVisible.value = true
|
||||
}
|
||||
|
||||
const resetOrderForm = () => {
|
||||
orderForm.patient_id = ''
|
||||
orderForm.patient_name = ''
|
||||
orderForm.phone = ''
|
||||
orderForm.order_type = ''
|
||||
orderForm.amount = 0
|
||||
orderForm.remark = ''
|
||||
orderFormRef.value?.clearValidate()
|
||||
}
|
||||
|
||||
const submitOrder = async () => {
|
||||
try {
|
||||
await orderFormRef.value?.validate()
|
||||
orderLoading.value = true
|
||||
const res = await orderCreate({
|
||||
patient_id: orderForm.patient_id,
|
||||
order_type: orderForm.order_type,
|
||||
amount: orderForm.amount,
|
||||
remark: orderForm.remark
|
||||
})
|
||||
createOrderVisible.value = false
|
||||
getLists()
|
||||
|
||||
const orderNo = res?.order_no
|
||||
if (orderNo) {
|
||||
qrcodeDialogVisible.value = true
|
||||
qrcodeLoading.value = true
|
||||
qrcodeUrl.value = ''
|
||||
currentQRCodePatient.value = { patient_name: orderForm.patient_name }
|
||||
try {
|
||||
const qrRes = await generateOrderQrcode({ order_no: orderNo })
|
||||
if (qrRes?.qrcode_url) {
|
||||
qrcodeUrl.value = qrRes.qrcode_url
|
||||
} else {
|
||||
feedback.msgError('二维码生成失败')
|
||||
}
|
||||
} catch (e: any) {
|
||||
feedback.msgError(e?.msg || '生成二维码失败')
|
||||
} finally {
|
||||
qrcodeLoading.value = false
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('创建订单失败:', error)
|
||||
} finally {
|
||||
orderLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 小程序二维码相关
|
||||
const qrcodeDialogVisible = ref(false)
|
||||
const qrcodeLoading = ref(false)
|
||||
@@ -502,10 +751,134 @@ const handleRegenerateQRCode = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// ========== 企业微信聊天记录 ==========
|
||||
const wechatDrawerVisible = ref(false)
|
||||
const wechatCurrentPatient = ref<any>(null)
|
||||
const wechatRecords = ref<any[]>([])
|
||||
const wechatRecordTotal = ref(0)
|
||||
const wechatRecordsLoading = ref(false)
|
||||
const wechatContactInfo = ref<any>(null)
|
||||
const wechatNewNote = ref('')
|
||||
const wechatAddLoading = ref(false)
|
||||
const wechatPage = ref(1)
|
||||
|
||||
const formatTimestamp = (ts: number) => {
|
||||
if (!ts) return '-'
|
||||
const t = String(ts).length === 10 ? ts * 1000 : ts
|
||||
return dayjs(t).format('YYYY-MM-DD HH:mm')
|
||||
}
|
||||
|
||||
const handleWechatRecords = async (row: any) => {
|
||||
wechatCurrentPatient.value = row
|
||||
wechatDrawerVisible.value = true
|
||||
wechatRecords.value = []
|
||||
wechatRecordTotal.value = 0
|
||||
wechatContactInfo.value = null
|
||||
wechatNewNote.value = ''
|
||||
wechatPage.value = 1
|
||||
|
||||
// 并行加载聊天记录和外部联系人信息
|
||||
wechatRecordsLoading.value = true
|
||||
try {
|
||||
const [recordsRes, contactRes] = await Promise.all([
|
||||
getWechatChatRecords({ diagnosis_id: row.id, patient_id: row.patient_id, page_no: 1, page_size: 20 }),
|
||||
getWechatExternalContact({ patient_id: row.patient_id || row.id }).catch(() => null)
|
||||
])
|
||||
|
||||
wechatRecords.value = recordsRes?.lists || []
|
||||
wechatRecordTotal.value = recordsRes?.count || 0
|
||||
wechatContactInfo.value = contactRes
|
||||
} catch (e) {
|
||||
console.error('加载企业微信记录失败:', e)
|
||||
} finally {
|
||||
wechatRecordsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadMoreRecords = async () => {
|
||||
if (!wechatCurrentPatient.value) return
|
||||
wechatPage.value++
|
||||
try {
|
||||
const res = await getWechatChatRecords({
|
||||
diagnosis_id: wechatCurrentPatient.value.id,
|
||||
patient_id: wechatCurrentPatient.value.patient_id,
|
||||
page_no: wechatPage.value,
|
||||
page_size: 20
|
||||
})
|
||||
wechatRecords.value.push(...(res?.lists || []))
|
||||
} catch (e) {
|
||||
console.error('加载更多记录失败:', e)
|
||||
}
|
||||
}
|
||||
|
||||
const handleAddRecord = async () => {
|
||||
if (!wechatNewNote.value.trim()) {
|
||||
feedback.msgWarning('请输入内容')
|
||||
return
|
||||
}
|
||||
wechatAddLoading.value = true
|
||||
try {
|
||||
await addWechatChatRecord({
|
||||
diagnosis_id: wechatCurrentPatient.value.id,
|
||||
patient_id: wechatCurrentPatient.value.patient_id,
|
||||
content: wechatNewNote.value.trim(),
|
||||
msg_type: 'note',
|
||||
staff_name: userStore.userInfo?.name || '',
|
||||
external_name: wechatCurrentPatient.value.patient_name || '',
|
||||
})
|
||||
wechatNewNote.value = ''
|
||||
// 重新加载记录
|
||||
handleWechatRecords(wechatCurrentPatient.value)
|
||||
} catch (e: any) {
|
||||
feedback.msgError(e?.msg || '添加失败')
|
||||
} finally {
|
||||
wechatAddLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeleteRecord = async (id: number) => {
|
||||
await feedback.confirm('确定删除该记录吗?')
|
||||
try {
|
||||
await deleteWechatChatRecord({ id })
|
||||
wechatRecords.value = wechatRecords.value.filter(r => r.id !== id)
|
||||
wechatRecordTotal.value--
|
||||
} catch (e: any) {
|
||||
feedback.msgError(e?.msg || '删除失败')
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await getDictOptions()
|
||||
getLists()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
<style lang="scss" scoped>
|
||||
.record-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.record-item {
|
||||
background: #f9fafb;
|
||||
border-radius: 8px;
|
||||
padding: 12px;
|
||||
border: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.record-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.record-content {
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user