feat:需求开发

This commit is contained in:
huxuejian 2026-10-14 13:31:13 +08:00
parent 5b21ba22d2
commit ed85ad990e
9 changed files with 130 additions and 39 deletions

View File

@ -398,7 +398,7 @@
"pagePath": "pages/home/case-home", "pagePath": "pages/home/case-home",
"iconPath": "static/tabbar/cart.png", "iconPath": "static/tabbar/cart.png",
"selectedIconPath": "static/tabbar/cart_selected.png", "selectedIconPath": "static/tabbar/cart_selected.png",
"text": "病历" "text": "档案"
}, },
{ {
"pagePath": "pages/home/work-home", "pagePath": "pages/home/work-home",

View File

@ -107,6 +107,7 @@
{{ i.eventStatusLabel }} {{ i.eventStatusLabel }}
</view> </view>
</view> </view>
<view v-if="i.taskContent" class="px-15 text-base leading-normal text-dark">{{ i.taskContent }}</view>
<view v-if="i.sendContent" class="px-15 text-base leading-normal text-gray">{{ i.sendContent }}</view> <view v-if="i.sendContent" class="px-15 text-base leading-normal text-gray">{{ i.sendContent }}</view>
<view v-if="i.enableSend && i.fileList.length" class="mt-10 px-15 flex items-center"> <view v-if="i.enableSend && i.fileList.length" class="mt-10 px-15 flex items-center">
<view class="mr-5 w-0 flex-grow"> <view class="mr-5 w-0 flex-grow">
@ -253,7 +254,9 @@ function editProfile() {
function handleCert() { function handleCert() {
if (doctorInfo.value.verifyStatus === 'verifying') { if (doctorInfo.value.verifyStatus === 'verifying') {
toast('信息认证中,请耐心等待!') uni.navigateTo({
url: '/pages/work/profile?type=cert',
})
} else { } else {
visible.value = true visible.value = true
} }
@ -314,6 +317,8 @@ async function getList() {
const newItems = arr.filter(item => !item._id || !existingIds.has(item._id)); const newItems = arr.filter(item => !item._id || !existingIds.has(item._id));
list.value = [...list.value, ...newItems]; list.value = [...list.value, ...newItems];
} }
console.clear()
console.log(list.value)
total.value = res && res.total > 0 ? res.total : 0; total.value = res && res.total > 0 ? res.total : 0;
pages.value = res && res.pages > 0 ? res.pages : 0; pages.value = res && res.pages > 0 ? res.pages : 0;
if (!res || !res.success) { if (!res || !res.success) {

View File

@ -1,12 +1,7 @@
<template> <template>
<view class="ai-assistant-buttons"> <view class="ai-assistant-buttons">
<view <view v-for="button in buttons" :key="button.id" class="ai-button" :class="{ loading: button.loading }"
v-for="button in buttons" @click="handleButtonClick(button)">
:key="button.id"
class="ai-button"
:class="{ loading: button.loading }"
@click="handleButtonClick(button)"
>
<image class="button-icon" :src="button.icon" mode="aspectFit" /> <image class="button-icon" :src="button.icon" mode="aspectFit" />
<text class="button-text">{{ <text class="button-text">{{
button.loading && button.loadingText ? button.loadingText : button.text button.loading && button.loadingText ? button.loadingText : button.text
@ -62,25 +57,32 @@ const emit = defineEmits([
const isGenerating = ref(false); const isGenerating = ref(false);
const buttons = ref([ const buttons = ref([
{ // {
id: "followUp", // id: "followUp",
text: "追问病情", // text: "追问病情",
loadingText: "AI分析中,正在为您生成追问建议…", // loadingText: "AI分析中,正在为您生成追问建议…",
icon: "/static/icon/zhuiwen.png", // icon: "/static/icon/zhuiwen.png",
loading: false, // loading: false,
}, // },
// { // {
// id: "aiAssistant", // id: "aiAssistant",
// text: "开启AI助手", // text: "推荐回复",
// icon: "/static/icon/kaiqiAI.png", // icon: "/static/icon/kaiqiAI.png",
// loading: false, // loading: false,
// }, // },
// {
// id: "supplementRecord",
// text: "补充档案",
// icon: "/static/icon/buchong.png",
// loading: false,
// },
{ {
id: "supplementRecord", id: "aiAssistant",
text: "补充档案", text: "推荐回复",
icon: "/static/icon/buchong.png", loadingText: "AI分析中,正在为您生成回复建议…",
icon: "/static/icon/kaiqiAI.png",
loading: false, loading: false,
}, }
]); ]);
// 处理按钮点击 // 处理按钮点击
@ -206,11 +208,72 @@ const streamTextToInput = (text) => {
}; };
// 处理AI助手 // 处理AI助手
const handleAIAssistant = (button) => { 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({ uni.showToast({
title: "AI助手功能开发中", title: "无法获取患者信息",
icon: "none", 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% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
} }
100% { 100% {
transform: rotate(360deg); transform: rotate(360deg);
} }

View File

@ -14,7 +14,7 @@
<!-- :hold-keyboard="true" --> <!-- :hold-keyboard="true" -->
<textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..." <textarea v-if="!showVoiceInput" class="text-input" v-model="inputText" placeholder="我来说两句..."
@confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput" :auto-height="true" @confirm="sendTextMessage" @focus="handleInputFocus" @input="handleInput" :auto-height="true"
:show-confirm-bar="false" :cursor-spacing="40" ref="textareaRef" /> :show-confirm-bar="false" :maxlength="-1" :cursor-spacing="40" ref="textareaRef" />
<input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord" <input v-else class="voice-input-btn" :class="{ recording: isRecording }" @touchstart="startRecord"
@touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord" @touchmove="onRecordTouchMove" @touchend="stopRecord" @touchcancel="cancelRecord"
:placeholder="isRecording ? '松开发送' : '按住说话'" disabled /> :placeholder="isRecording ? '松开发送' : '按住说话'" disabled />

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- 文本消息 --> <!-- 文本消息 -->
<text v-if="message.type === 'TIMTextElem'" class="message-text"> <text v-if="message.type === 'TIMTextElem'" class="message-text" @longpress="copyText(message.payload.text)">
{{ message.payload.text }} {{ message.payload.text }}
</text> </text>
@ -290,6 +290,22 @@ function isWechatChannels(data) {
const wechatChannels = data.wechatChannels || {}; const wechatChannels = data.wechatChannels || {};
return typeof wechatChannels.finderUserName === 'string' && wechatChannels.finderUserName.trim() && typeof wechatChannels.feedId === 'string' && wechatChannels.feedId.trim(); return typeof wechatChannels.finderUserName === 'string' && wechatChannels.finderUserName.trim() && typeof wechatChannels.feedId === 'string' && wechatChannels.feedId.trim();
} }
function copyText(text) {
if (typeof text !== 'string' || text.trim() === '') return;
console.log('11122')
uni.showActionSheet({
itemList: ['复制'],
success: (res) => {
console.log(res.tapIndex)
if (res.tapIndex === 0) {
uni.setClipboardData({ data: text.trim(), success: () => toast('复制成功') })
}
},
fail: res => console.log(res)
});
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -2,8 +2,8 @@
<full-page> <full-page>
<view class="p-15"> <view class="p-15">
<view class="bg-white px-10 mb-10 rounded"> <view class="bg-white px-10 mb-10 rounded">
<form-input :form="formData" :required="rule.anotherName.required" wordLimit="10" title="anotherName" <form-input :form="formData" :required="rule.anotherName.required" :disableChange="rule.anotherName.disabled"
:name="rule.anotherName.name" @change="onChange($event)" /> wordLimit="10" title="anotherName" :name="rule.anotherName.name" @change="onChange($event)" />
<common-cell title="avatar" name="头像"> <common-cell title="avatar" name="头像">
<view class="flex-grow flex items-center justify-end"> <view class="flex-grow flex items-center justify-end">
<image v-if="formData.avatar" class="avatar mr-5 rounded-full" :src="formData.avatar" /> <image v-if="formData.avatar" class="avatar mr-5 rounded-full" :src="formData.avatar" />

View File

@ -60,7 +60,7 @@
</view> </view>
<template #footer> <template #footer>
<button-footer cancelText="上一步" confirmText="提交审核" @confirm="save()" @cancel="back()" /> <button-footer cancelText="上一步" :confirmText="submitText" @confirm="save()" @cancel="back()" />
</template> </template>
</full-page> </full-page>
</template> </template>
@ -81,6 +81,8 @@ useGuard();
const { account, doctorInfo } = storeToRefs(useAccountStore()); const { account, doctorInfo } = storeToRefs(useAccountStore());
const form = ref({}) const form = ref({})
const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value })) const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value }))
const isResubmitting = computed(() => doctorInfo.value?.verifyStatus === 'verifying')
const submitText = computed(() => isResubmitting.value ? '重新提交审核' : '提交审核')
function back() { function back() {
uni.navigateBack() uni.navigateBack()
@ -119,7 +121,7 @@ async function save() {
} }
const res = await api('submitCertProfile', data); const res = await api('submitCertProfile', data);
if (res && res.success) { if (res && res.success) {
await toast('提交成功'); await toast(isResubmitting.value ? '重新提交成功' : '提交成功');
uni.navigateBack({ delta: 2 }) uni.navigateBack({ delta: 2 })
} else { } else {
toast(res.message || '提交失败') toast(res.message || '提交失败')

View File

@ -43,7 +43,7 @@
</view> </view>
</view> </view>
<template #footer> <template #footer>
<button-footer cancelText="上一步" confirmText="提交审核" @confirm="save()" @cancel="back()" /> <button-footer cancelText="上一步" :confirmText="submitText" @confirm="save()" @cancel="back()" />
</template> </template>
</full-page> </full-page>
</template> </template>
@ -63,6 +63,8 @@ useGuard();
const { account, doctorInfo } = storeToRefs(useAccountStore()); const { account, doctorInfo } = storeToRefs(useAccountStore());
const form = ref({}); const form = ref({});
const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value })) const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value }))
const isResubmitting = computed(() => doctorInfo.value?.verifyStatus === 'verifying')
const submitText = computed(() => isResubmitting.value ? '重新提交审核' : '提交审核')
function back() { function back() {
uni.navigateBack() uni.navigateBack()
@ -126,7 +128,7 @@ async function save() {
} }
const res = await api('submitCertProfile', data); const res = await api('submitCertProfile', data);
if (res && res.success) { if (res && res.success) {
await toast('提交成功'); await toast(isResubmitting.value ? '重新提交成功' : '提交成功');
uni.navigateBack({ delta: 2 }) uni.navigateBack({ delta: 2 })
} else { } else {
toast(res.message || '提交失败') toast(res.message || '提交失败')

View File

@ -206,7 +206,9 @@ function editProfile() {
function handleCert() { function handleCert() {
if (doctorInfo.value.verifyStatus === 'verifying') { if (doctorInfo.value.verifyStatus === 'verifying') {
toast('信息认证中,请耐心等待!') uni.navigateTo({
url: '/pages/work/profile?type=cert',
})
} else { } else {
visible.value = true visible.value = true
} }