diff --git a/pages.json b/pages.json index 163c210..9183cf0 100644 --- a/pages.json +++ b/pages.json @@ -398,7 +398,7 @@ "pagePath": "pages/home/case-home", "iconPath": "static/tabbar/cart.png", "selectedIconPath": "static/tabbar/cart_selected.png", - "text": "病历" + "text": "档案" }, { "pagePath": "pages/home/work-home", diff --git a/pages/home/work-home.vue b/pages/home/work-home.vue index 1cd1dcb..ac5ed72 100644 --- a/pages/home/work-home.vue +++ b/pages/home/work-home.vue @@ -107,6 +107,7 @@ {{ i.eventStatusLabel }} + {{ i.taskContent }} {{ i.sendContent }} @@ -253,7 +254,9 @@ function editProfile() { function handleCert() { if (doctorInfo.value.verifyStatus === 'verifying') { - toast('信息认证中,请耐心等待!') + uni.navigateTo({ + url: '/pages/work/profile?type=cert', + }) } else { visible.value = true } @@ -282,7 +285,7 @@ async function getList() { startDate: filterData.value.startDate, endDate: filterData.value.endDate, page: requestPage, - pageSize: pageSize.value + pageSize: pageSize.value } if (followUpType.value === 'person') { data.executorUserId = doctorInfo.value.userid; @@ -314,6 +317,8 @@ async function getList() { const newItems = arr.filter(item => !item._id || !existingIds.has(item._id)); list.value = [...list.value, ...newItems]; } + console.clear() + console.log(list.value) total.value = res && res.total > 0 ? res.total : 0; pages.value = res && res.pages > 0 ? res.pages : 0; if (!res || !res.success) { diff --git a/pages/message/components/ai-assistant-buttons.vue b/pages/message/components/ai-assistant-buttons.vue index 3ddf6d8..43e2a78 100644 --- a/pages/message/components/ai-assistant-buttons.vue +++ b/pages/message/components/ai-assistant-buttons.vue @@ -1,16 +1,11 @@ @@ -62,25 +57,32 @@ const emit = defineEmits([ const isGenerating = ref(false); const buttons = ref([ - { - id: "followUp", - text: "追问病情", - loadingText: "AI分析中,正在为您生成追问建议…", - icon: "/static/icon/zhuiwen.png", - loading: false, - }, + // { + // id: "followUp", + // text: "追问病情", + // loadingText: "AI分析中,正在为您生成追问建议…", + // icon: "/static/icon/zhuiwen.png", + // loading: false, + // }, // { // id: "aiAssistant", - // text: "开启AI助手", + // text: "推荐回复", // icon: "/static/icon/kaiqiAI.png", // loading: false, // }, + // { + // id: "supplementRecord", + // text: "补充档案", + // icon: "/static/icon/buchong.png", + // loading: false, + // }, { - id: "supplementRecord", - text: "补充档案", - icon: "/static/icon/buchong.png", + id: "aiAssistant", + text: "推荐回复", + loadingText: "AI分析中,正在为您生成回复建议…", + icon: "/static/icon/kaiqiAI.png", loading: false, - }, + } ]); // 处理按钮点击 @@ -206,11 +208,72 @@ const streamTextToInput = (text) => { }; // 处理AI助手 -const handleAIAssistant = (button) => { - uni.showToast({ - title: "AI助手功能开发中", - icon: "none", - }); +const handleAIAssistant = async (button) => { + try { + button.loading = true; + + let finalPatientAccountId = props.patientAccountId; + if (!finalPatientAccountId) { + const chatRecordsResult = await api("getChatRecordsByGroupId", { + groupID: props.groupId, + count: 5, + }); + + if ( + chatRecordsResult.success && + chatRecordsResult.data && + chatRecordsResult.data.records + ) { + const currentUserId = uni.getStorageSync("openid") || ""; + const patientMessage = chatRecordsResult.data.records.find( + (record) => + record.From_Account && record.From_Account !== currentUserId + ); + if (patientMessage) { + finalPatientAccountId = patientMessage.From_Account; + } + } + } + + if (!finalPatientAccountId) { + uni.showToast({ + title: "无法获取患者信息", + icon: "none", + }); + return; + } + + const result = await request( + { + url: "/getYoucanData/im", + data: { + type: "recommendReply", + groupId: props.groupId, + patientAccountId: finalPatientAccountId, + corpId: props.corpId, + }, + }, + false + ); + + if (result.success && result.data && result.data.suggestion) { + streamTextToInput(result.data.suggestion); + return; + } + + uni.showToast({ + title: result.message || "获取推荐回复失败", + icon: "none", + }); + } catch (error) { + console.error("获取推荐回复失败:", error); + uni.showToast({ + title: "操作失败,请重试", + icon: "none", + }); + } finally { + button.loading = false; + } }; // 处理补充病历 @@ -307,6 +370,7 @@ defineExpose({ 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } diff --git a/pages/message/components/chat-input.vue b/pages/message/components/chat-input.vue index f2d1276..86454ba 100644 --- a/pages/message/components/chat-input.vue +++ b/pages/message/components/chat-input.vue @@ -14,7 +14,7 @@