合并缺失弥补

This commit is contained in:
zhanchao 2026-09-04 09:52:41 +08:00
parent 1040539640
commit f887d00a60

View File

@ -5,9 +5,7 @@
<view class="patient-info-content">
<view class="patient-basic-info">
<text class="patient-name">{{ patientInfo.name }}</text>
<text class="patient-detail"
>{{ patientInfo.sex }} · {{ patientInfo.age }}</text
>
<text class="patient-detail">{{ patientInfo.sex }} · {{ patientInfo.age }}</text>
</view>
<view class="header-actions">
<view class="patient-detail-btn" @click="handleViewPatientDetail">
@ -21,16 +19,8 @@
</view>
<!-- 聊天消息区域 -->
<scroll-view
class="chat-content"
scroll-y="true"
enhanced="true"
bounces="false"
:scroll-into-view="scrollIntoView"
@scroll="onScroll"
@scrolltoupper="handleScrollToUpper"
ref="chatScrollView"
>
<scroll-view class="chat-content" scroll-y="true" enhanced="true" bounces="false" :scroll-into-view="scrollIntoView"
@scroll="onScroll" @scrolltoupper="handleScrollToUpper" ref="chatScrollView">
<!-- 加载更多提示 -->
<view class="load-more-tip" v-if="messageList.length >= 15">
<view class="loading" v-if="isLoadingMore">
@ -46,21 +36,13 @@
<!-- 聊天消息列表 -->
<view class="message-list" @click="closeMorePanel">
<view
v-for="(message, index) in messageList"
:key="message.ID"
:id="`msg-${message.ID}`"
class="message-item"
<view v-for="(message, index) in messageList" :key="message.ID" :id="`msg-${message.ID}`" class="message-item"
:class="{
'message-right': message.flow === 'out',
'message-left': message.flow === 'in',
}"
>
}">
<!-- 时间分割线 -->
<view
v-if="shouldShowTime(message, index, messageList)"
class="time-divider"
>
<view v-if="shouldShowTime(message, index, messageList)" class="time-divider">
<text class="time-text">{{ formatTime(message.lastTime) }}</text>
</view>
@ -70,29 +52,18 @@
<!-- 消息内容 -->
<view v-else class="message-content">
<image
v-if="message.flow === 'in'"
class="doctor-msg-avatar"
:src="getUserAvatar(message.from)"
mode="aspectFill"
/>
<image
v-if="message.flow === 'out'"
class="user-msg-avatar"
:src="getUserAvatar(message.from)"
mode="aspectFill"
/>
<image v-if="message.flow === 'in'" class="doctor-msg-avatar" :src="getUserAvatar(message.from)"
mode="aspectFill" />
<image v-if="message.flow === 'out'" class="user-msg-avatar" :src="getUserAvatar(message.from)"
mode="aspectFill" />
<!-- 消息内容区域 -->
<view class="message-bubble-container">
<!-- 用户名显示 -->
<view
class="username-label"
:class="{
left: message.flow === 'in',
right: message.flow === 'out',
}"
>
<view class="username-label" :class="{
left: message.flow === 'in',
right: message.flow === 'out',
}">
<text class="username-text">{{
chatMember[message.from]?.name
}}</text>
@ -100,24 +71,15 @@
<view class="message-bubble" :class="getBubbleClass(message)">
<!-- 消息内容 -->
<MessageTypes
:message="message"
:formatTime="formatTime"
:playingVoiceId="playingVoiceId"
@playVoice="playVoice"
@previewImage="previewImage"
@viewDetail="(message) => handleViewDetail(message)"
/>
<MessageTypes :message="message" :formatTime="formatTime" :playingVoiceId="playingVoiceId"
@playVoice="playVoice" @previewImage="previewImage"
@viewDetail="(message) => handleViewDetail(message)" />
</view>
</view>
<!-- 发送状态 -->
<view v-if="message.flow === 'out'" class="message-status">
<text
v-if="message.status === 'failed'"
class="status-text failed"
>发送失败</text
>
<text v-if="message.status === 'failed'" class="status-text failed">发送失败</text>
</view>
</view>
</view>
@ -125,75 +87,38 @@
</scroll-view>
<!-- 接受问诊组件 -->
<ConsultAccept
v-if="showConsultAccept"
@accept="handleAcceptConsult"
@reject="handleRejectConsult"
/>
<ConsultAccept v-if="showConsultAccept" @accept="handleAcceptConsult" @reject="handleRejectConsult" />
<!-- 拒绝原因对话框 -->
<RejectReasonModal
:visible="showRejectReasonModal"
@confirm="handleRejectReasonConfirm"
@cancel="handleRejectReasonCancel"
/>
<RejectReasonModal :visible="showRejectReasonModal" @confirm="handleRejectReasonConfirm"
@cancel="handleRejectReasonCancel" />
<!-- 聊天输入组件 -->
<ChatInput
v-if="!isEvaluationPopupOpen && !showConsultAccept"
ref="chatInputRef"
:timChatManager="timChatManager"
:formatTime="formatTime"
:groupId="
chatInfo.conversationID
? chatInfo.conversationID.replace('GROUP', '')
: ''
"
:userId="openid"
:teamId="teamId"
:patientId="patientId"
:corpId="corpId"
:patientInfo="patientInfo"
:orderStatus="orderStatus"
:isGenerating="isGenerating"
@scrollToBottom="() => scrollToBottom(true)"
@messageSent="() => scrollToBottom(true)"
@endConsult="handleEndConsult"
@openConsult="handleOpenConsult"
>
<ChatInput v-if="!isEvaluationPopupOpen && !showConsultAccept" ref="chatInputRef" :timChatManager="timChatManager"
:formatTime="formatTime" :groupId="chatInfo.conversationID
? chatInfo.conversationID.replace('GROUP', '')
: ''
" :userId="openid" :teamId="teamId" :patientId="patientId" :corpId="corpId" :patientInfo="patientInfo"
:orderStatus="orderStatus" :isGenerating="isGenerating"
:canBenefitEntry="isBenefitEntryEnabled"
@scrollToBottom="() => scrollToBottom(true)" @messageSent="() => scrollToBottom(true)"
@endConsult="handleEndConsult" @openConsult="handleOpenConsult">
<!-- AI助手按钮组插槽 -->
<template #ai-assistant>
<AIAssistantButtons
v-if="orderStatus === 'processing'"
ref="aiAssistantRef"
:groupId="groupId"
:patientAccountId="chatInfo.userID || ''"
:patientId="patientId"
:corpId="corpId"
:typeSelectorRef="typeSelectorRef"
:progressRef="progressRef"
@streamText="handleStreamText"
@clearInput="handleClearInput"
@generatingStateChange="handleGeneratingStateChange"
@caseTypeSelect="handleCaseTypeSelect"
@regenerateFromProgress="handleRegenerateFromProgress"
@nextFromProgress="handleNextFromProgress"
/>
<AIAssistantButtons v-if="orderStatus === 'processing'" ref="aiAssistantRef" :groupId="groupId"
:patientAccountId="chatInfo.userID || ''" :patientId="patientId" :corpId="corpId"
:typeSelectorRef="typeSelectorRef" :progressRef="progressRef" @streamText="handleStreamText"
@clearInput="handleClearInput" @generatingStateChange="handleGeneratingStateChange"
@caseTypeSelect="handleCaseTypeSelect" @regenerateFromProgress="handleRegenerateFromProgress"
@nextFromProgress="handleNextFromProgress" />
</template>
</ChatInput>
<!-- 病历类型选择弹窗 -->
<MedicalCaseTypeSelector
ref="typeSelectorRef"
@select="handleCaseTypeSelect"
/>
<MedicalCaseTypeSelector ref="typeSelectorRef" @select="handleCaseTypeSelect" />
<!-- 进度显示弹窗 -->
<MedicalCaseProgress
ref="progressRef"
@regenerate="handleRegenerateFromProgress"
@next="handleNextFromProgress"
/>
<MedicalCaseProgress ref="progressRef" @regenerate="handleRegenerateFromProgress" @next="handleNextFromProgress" />
</view>
</template>
@ -308,10 +233,11 @@ const env = __VITE_ENV__;
const corpId = env.MP_CORP_ID || "";
//
const accountStore = useAccountStore();
const { account, openid, isIMInitialized, doctorInfo } = storeToRefs(
useAccountStore()
accountStore
);
const { initIMAfterLogin } = useAccountStore();
const { getDoctorInfo, initIMAfterLogin } = useAccountStore();
//
const chatInputRef = ref(null);
@ -358,6 +284,11 @@ const teamId = ref("");
// - pending
const showConsultAccept = computed(() => orderStatus.value === "pending");
const isBenefitEntryEnabled = computed(() => {
const value = doctorInfo.value?.benefitEntryEnabled ?? doctorInfo.value?.canBenefitEntry;
return value === true || value === 1 || ["true", "1", "yes"].includes(String(value).toLowerCase());
});
//
const showRejectReasonModal = ref(false);
//
@ -529,14 +460,14 @@ const checkLoginAndInitTIM = async () => {
const initTIMCallbacks = async () => {
//
isCallbacksInitialized.value = true;
timChatManager.setCallback("onSDKReady", () => {
if (messageList.value.length === 0 && !isLoading.value) {
loadMessageList();
}
});
timChatManager.setCallback("onSDKNotReady", () => {});
timChatManager.setCallback("onSDKNotReady", () => { });
timChatManager.setCallback("onMessageReceived", (message) => {
console.log("页面收到消息:", {
@ -905,14 +836,14 @@ const handleScrollToUpper = async () => {
};
//
onShow(() => {
onShow(async () => {
if (!account.value || !openid.value) {
uni.redirectTo({
url: "/pages-center/login/login",
});
return;
}
await getDoctorInfo();
if (!isIMInitialized.value) {
checkLoginAndInitTIM();
} else if (timChatManager.tim && !timChatManager.isLoggedIn) {
@ -933,13 +864,13 @@ onShow(() => {
// IMID
console.log("✓ 页面显示重新设置当前会话ID");
timChatManager.setConversationID(chatInfo.value.conversationID);
//
if (!isCallbacksInitialized.value) {
console.log("✓ 回调未初始化,进行初始化");
initTIMCallbacks();
}
//
if (timChatManager.tim && timChatManager.isLoggedIn) {
timChatManager.tim
@ -953,7 +884,7 @@ onShow(() => {
console.error("✗ 标记会话已读失败:", error);
});
}
startIMMonitoring(30000);
}
@ -1172,11 +1103,10 @@ const handleNextFromProgress = (data) => {
//
uni.navigateTo({
url: `/pages/case/ai-medical-case-form?caseType=${data.caseType}&patientId=${
patientId.value
}&groupId=${groupId.value}&formData=${encodeURIComponent(
JSON.stringify(extractedData)
)}`,
url: `/pages/case/ai-medical-case-form?caseType=${data.caseType}&patientId=${patientId.value
}&groupId=${groupId.value}&formData=${encodeURIComponent(
JSON.stringify(extractedData)
)}`,
});
};