From 4fc7a8f6f2386a850897f58619f27587687b0683 Mon Sep 17 00:00:00 2001
From: wangdongbo <949818794@qq.com>
Date: Thu, 29 Jan 2026 18:03:40 +0800
Subject: [PATCH 1/2] no message
---
pages.json | 6 +
pages/case/medical-case-form.vue | 486 ++++++++++++++++++
pages/message/chat.scss | 17 +-
.../components/ai-assistant-buttons.vue | 356 +++++++++++++
pages/message/components/chat-input.vue | 33 +-
.../components/medical-case-progress.vue | 197 +++++++
.../components/medical-case-type-selector.vue | 134 +++++
pages/message/index.vue | 29 +-
static/icon/buchong.png | Bin 0 -> 1095 bytes
static/icon/kaiqiAI.png | Bin 0 -> 1790 bytes
static/icon/zhuiwen.png | Bin 0 -> 1008 bytes
utils/api.js | 4 +-
12 files changed, 1251 insertions(+), 11 deletions(-)
create mode 100644 pages/case/medical-case-form.vue
create mode 100644 pages/message/components/ai-assistant-buttons.vue
create mode 100644 pages/message/components/medical-case-progress.vue
create mode 100644 pages/message/components/medical-case-type-selector.vue
create mode 100644 static/icon/buchong.png
create mode 100644 static/icon/kaiqiAI.png
create mode 100644 static/icon/zhuiwen.png
diff --git a/pages.json b/pages.json
index 203a112..f9151e3 100644
--- a/pages.json
+++ b/pages.json
@@ -115,6 +115,12 @@
"navigationBarTitleText": "病历详情"
}
},
+ {
+ "path": "pages/case/medical-case-form",
+ "style": {
+ "navigationBarTitleText": "添加病历"
+ }
+ },
{
"path": "pages/case/service-record-detail",
"style": {
diff --git a/pages/case/medical-case-form.vue b/pages/case/medical-case-form.vue
new file mode 100644
index 0000000..c650169
--- /dev/null
+++ b/pages/case/medical-case-form.vue
@@ -0,0 +1,486 @@
+
+
+
+
+
+
+ 就诊机构
+
+
+
+
+ 就诊日期
+
+
+ {{ formData.visitTime || '暂无' }}
+
+
+
+
+
+ 门诊诊断
+
+
+
+
+ 治疗方案
+
+
+
+
+
+
+
+ 就诊机构
+
+
+
+
+ 入院日期
+
+
+ {{ formData.inhosDate || '暂无' }}
+
+
+
+
+
+ 住院主诊断
+
+
+
+
+ 手术名称
+
+
+
+
+ 手术日期
+
+
+ {{ formData.operationDate || '暂无' }}
+
+
+
+
+
+ 治疗方案
+
+
+
+
+
+
+
+ 就诊机构
+
+
+
+
+ 体检日期
+
+
+ {{ formData.inspectTime || '暂无' }}
+
+
+
+
+
+ 体检小结
+
+
+
+
+ 阳性发现及处理意见
+
+
+
+
+
+
+
+ 主诉
+
+
+
+
+ 现病史
+
+
+
+
+ 既往史
+
+
+
+
+
+
+ 1、门诊、住院病历记录生成,生成后支持医生在线编辑,并保存至档案,或者重新生成;
+
+
+ 2、若未来集到有效信息则以模板字段中默认项写无内容生成,医生可以直接在存字段上进行编辑。
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/message/chat.scss b/pages/message/chat.scss
index d35fe0c..a5f27fb 100644
--- a/pages/message/chat.scss
+++ b/pages/message/chat.scss
@@ -348,23 +348,30 @@ $primary-color: #0877F1;
.text-input,
.voice-input-btn {
flex: 1;
- padding: 0 46rpx;
+ padding: 16rpx 46rpx;
background-color: #f3f5fa;
border-radius: 20rpx;
margin: 0 16rpx;
font-size: 28rpx;
- height: 80rpx;
+ min-height: 80rpx;
+ max-height: 200rpx;
border: none;
outline: none;
box-sizing: border-box;
- display: flex;
- align-items: center;
- line-height: 96rpx;
+ line-height: 1.5;
color: #333;
}
+.voice-input-btn {
+ height: 80rpx;
+ display: flex;
+ align-items: center;
+ padding: 0 46rpx;
+}
+
.voice-input-btn {
text-align: center;
+ line-height: 80rpx;
}
.more-panel {
diff --git a/pages/message/components/ai-assistant-buttons.vue b/pages/message/components/ai-assistant-buttons.vue
new file mode 100644
index 0000000..d097a4c
--- /dev/null
+++ b/pages/message/components/ai-assistant-buttons.vue
@@ -0,0 +1,356 @@
+
+
+
+
+ {{
+ button.loading && button.loadingText ? button.loadingText : button.text
+ }}
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/message/components/chat-input.vue b/pages/message/components/chat-input.vue
index 41f1bcb..b6727d1 100644
--- a/pages/message/components/chat-input.vue
+++ b/pages/message/components/chat-input.vue
@@ -6,8 +6,9 @@
-
+
@@ -25,7 +26,6 @@
{{ btn.text }}
-
@@ -95,6 +95,11 @@ const cloudCustomData = computed(() => {
return arr.filter(Boolean).join("|");
});
+// 流式输入文本
+const appendStreamText = (char) => {
+ inputText.value += char;
+};
+
// 录音相关扩展状态(特效 + 取消逻辑)
const recordingDuration = ref(0);
let recordingTimer = null;
@@ -165,9 +170,22 @@ const sendTextMessageFromPhrase = async (content) => {
});
};
+// 设置输入框文本(覆盖原内容)
+const setInputText = (text) => {
+ inputText.value = text;
+};
+
+// 清空输入框
+const clearInputText = () => {
+ inputText.value = '';
+};
+
// 暴露方法给父组件调用
defineExpose({
- sendTextMessageFromPhrase
+ sendTextMessageFromPhrase,
+ appendStreamText,
+ setInputText,
+ clearInputText
});
// 发送图片消息
@@ -432,6 +450,13 @@ function handleInputFocus() {
});
}
+function handleInput(e) {
+ // textarea 输入时触发,可以在这里处理额外逻辑
+ nextTick().then(() => {
+ emit("scrollToBottom");
+ });
+}
+
onMounted(() => {
// 初始化录音管理器
initRecorderManager();
diff --git a/pages/message/components/medical-case-progress.vue b/pages/message/components/medical-case-progress.vue
new file mode 100644
index 0000000..5bd762e
--- /dev/null
+++ b/pages/message/components/medical-case-progress.vue
@@ -0,0 +1,197 @@
+
+
+
+
+ ✕
+
+
+
+ {{ progressTitle }}
+
+
+
+
+
+ {{ progress }}%
+
+
+
+ 检测到以下{{ caseTypeName }}信息:
+
+
+ ✓
+ {{ item }}
+
+
+
+
+
+ 正在生成结构化{{ caseTypeName }}...
+
+
+
+
+
+
+
+
+
diff --git a/pages/message/components/medical-case-type-selector.vue b/pages/message/components/medical-case-type-selector.vue
new file mode 100644
index 0000000..9b696a2
--- /dev/null
+++ b/pages/message/components/medical-case-type-selector.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ {{ type.name }}
+
+
+
+
+
+
+
+
+
diff --git a/pages/message/index.vue b/pages/message/index.vue
index 131a069..210933e 100644
--- a/pages/message/index.vue
+++ b/pages/message/index.vue
@@ -125,6 +125,16 @@
@cancel="handleRejectReasonCancel"
/>
+
+
+
{
const sendCommonPhrase = (content) => {
if (chatInputRef.value) {
- chatInputRef.value.sendTextMessageFromPhrase(content);
+ // 覆盖输入框内容,而不是直接发送
+ chatInputRef.value.setInputText(content);
}
};
+
+// 处理流式文本输入
+const handleStreamText = (char) => {
+ if (chatInputRef.value) {
+ chatInputRef.value.appendStreamText(char);
+ }
+};
+
+// 处理清空输入框
+const handleClearInput = () => {
+ if (chatInputRef.value) {
+ chatInputRef.value.clearInputText();
+ }
+};
+
// 暴露方法给常用语页面调用
defineExpose({
sendCommonPhrase,
diff --git a/static/icon/buchong.png b/static/icon/buchong.png
new file mode 100644
index 0000000000000000000000000000000000000000..7dd053b3d4d1e493a8234279f603d21f1f77ecfb
GIT binary patch
literal 1095
zcmV-N1i1T&P)`n
zRZ$dP>*Cu=M}Z)vqlQWYgBnN)LeQidHt09_52Qa}<7N$-G?4~D6cR|3LLfb$>8%J+
zqL9L?bB$ry++7?6s
z2P+swX0%YXc+nUJN!UwfF9RkoqE@4!6-mAV#I_Ra4Awdiv0}J_wsW%@$k|pag&SFB
zr;}KulN5wi1O&7PjG5C
z7%HY9H+eW6$#Al<8`G=Tj{)@O4{aZe$1jP*P&bGe0Pt>#zGWq4sGVc#YXBh4K#Lud
zuX5RZ_`Ccs0AV<_J3sl+s1sC&JR^yvuu%%^I28}1d#CbU5s!ZxWTos5T?7&{{!2i{?{s8?78+DSRsNDbn
N002ovPDHLkV1mRtos;%Nl~2=2}J`%#SQZ?tcPMN7|ZE
zlNjdLE(+&_Y8<{~
zr01*gXwUJDU0iRH&Bw>0x%UiUmjE7v(i7N+Qjn4U#epmeKz+6;2^9<(#fp{$PJfl+
zW7-`u!U$SpC&bd;9n)@r1kNbGu7^jrI2e&f^O>sxP@m8us6nFcf=CfwkVC01Tc%qb
z?Px`f3_(;Uj|#z6i%=NB9J8S(wpQ(LOA?5d+03UvFd2Cw1{$3<(XE`Up)H`G+1hlZ
zSi7TfUPpKeTC3tYkx;vSCm16sTFb)ob5%gzVtfFDp<7(pVcCcQ9PPM3K~yf)bRS`A
z={OLz;tEAZLMXzpQ8vrW75KQ)b7Eg4>rJ{v5~JMPidrKt_WDu{3888+}Y*lEXPc)nN0-dh|_q|{l@IrQOr1H+ag1fdOn)5@(;xSGMQ+&QK
z445?WWf-%@_N3b1ewtv$Vs1hf%AYIO0@tqs{<;V>t)s;ofS*rUm;0gP0}VE?!J^OT
zfDOV(Nt;;MP?qk{7k!bBjfFB`RX4lJ7pSR^7fiw9=dnF^i3<`SN)h
zF^fe<4QVP8Mx0jKPo7y>SS9WIsu2A7V}d(20&BMb`CRNa10VzxA2aD|(l9}`A$KuqavjLq9oFQ6WFAYq~OZn;8B#G*R6H)G)=O!b?
zgR!iq12<|^5s)`0Yw=TJp`#68kLsJM2nVX3{PpHZ&>Tgmt>VRIZ_3kd<8%=_&wb
z;}Bb}1V*_@ceNMzKPS&lURtu&Vsqv>-Zi=aLHCzrSxH)U
zFVd1#0omQw$BnK9qJ8MNva_PINwsMv2BDi3%Rzx3{gRy=j}^0VwHc+`c`8;}1P!?|
zD^~?z1iWf!PlipZ9%GoJPu+?>FV()ywrULrs_3pSv7?qg<7*YLt4gHgwTdiQ3VKd=xaWFpI>OQ~1&pMVg-Qxt8kzFw>*90I^;L=*{OQrNhQXo67ykgyA=oSWU
zU|Mg|&DMMOM0P21mkb~RveN{W_P_ldsHAART=TO{NBNb0{$BwY5IQXb(fQnGs+v+$
gEYCU!3s~m(2cF4~{lV!(mjD0&07*qoM6N<$g0;v&CjbBd
literal 0
HcmV?d00001
diff --git a/static/icon/zhuiwen.png b/static/icon/zhuiwen.png
new file mode 100644
index 0000000000000000000000000000000000000000..d95bbd8e6ca350eb89ca4563057814e5700d9cc6
GIT binary patch
literal 1008
zcmVyJP0C)u6fF&N3ldEz-
zobIx^yQ-&l++`LcC+#pyPyc;ief4$s0{k!kdcp1vb?6dodVm{9Fq?ZQ^w#PmpU8id
zdx3Z|QGAF>Zs)r9@cQHntPfUka2A2Kn}H4VupC!I1BV%#@zSFD-|(UU3?49&2=DOi
zBAEx%GjZ7JnFM&TqyZsSz=s}}R1h+=%>*R3s8N&Yt@0dHh`{0TUVu{W5q!*f07Xp+cp*E1
z0)ho#@|>#1XrZAfVg7`xEe{8hbBJVyeE{HdDzKRVB+v{-(STX<*pyriAMap4e9wKL
ztbhd;P*6p{D1c9Cmq*?-*nM*4O51>f6-*LOL$YcSaE+dZNknqctUwowsm*qUmfob<
zsL2{5lj4o>0+`pRN!o>k_i%PWT4;ls3$;yL%#+;|bU)q3!}`3VyI5$wvrXNCJpncy
zYSalmP@Mu2dE7#w`mK2Z2(BzDm5dRQniK%t1(^4?Iy){
zM)4r3j8_qHlMsNMZ_xb>N+jhpnanJfPdsPjcKHqfu!d|R5HApWmTMH%meNC|B2YgA
zTs1G;1KEs|c!11gm6UWF>BS;|oi}t1PE*8Wwpu;^x^*Y=Kt5Ka>|jDNF~akh^i8wQjTSrD|6x+T;FO`;PXA~UEPj*
zeTgmG5dvL%wi_>mXb*>OJlVqfFd=Z^<|NoEpJA_wz{qVfyGh}??OLPB`Tpv74IjfF
zlo7XKQef0zvgS+D4)~5({l13pU|e}pJ{;FoOtr3){~dfhfij(N;^h7EC#;;Tr{4nO
z3bu+3esxB!=f`h{VpJpJM`LnMUmQQe#U^kmdvMOewDy{ByGcurI#Bu^UtyQEiTCC*
z)Kp<*_oQhQZpg(Fh$OJjByI%~
e{43&pz55r0KOOH
Date: Thu, 29 Jan 2026 18:44:34 +0800
Subject: [PATCH 2/2] IM
---
.../components/ai-assistant-buttons.vue | 151 +++++++++-----
.../components/medical-case-progress.vue | 195 +++++++++++++++++-
2 files changed, 289 insertions(+), 57 deletions(-)
diff --git a/pages/message/components/ai-assistant-buttons.vue b/pages/message/components/ai-assistant-buttons.vue
index d097a4c..00cf432 100644
--- a/pages/message/components/ai-assistant-buttons.vue
+++ b/pages/message/components/ai-assistant-buttons.vue
@@ -20,7 +20,11 @@
/>
-
+
@@ -211,12 +215,10 @@ const handleCaseTypeSelect = async (type) => {
try {
// 打开进度弹窗
progressRef.value?.open(type.id);
+ progressRef.value?.updateProgress(10);
- // 模拟进度更新
- progressRef.value?.updateProgress(20);
-
- // 调用补充病历接口
- const result = await request({
+ // 调用补充病历接口(流式处理)
+ await requestWithStream({
url: "/getYoucanData/im",
data: {
type: "supplementMedicalCase",
@@ -225,50 +227,22 @@ const handleCaseTypeSelect = async (type) => {
corpId: props.corpId,
caseType: type.id,
},
- });
-
- progressRef.value?.updateProgress(60);
-
- if (result.success && result.data) {
- const { detectedInfo, formData } = result.data;
-
- // 显示检测到的信息
- if (detectedInfo && detectedInfo.length > 0) {
- detectedInfo.forEach((info) => {
- progressRef.value?.addDetectedInfo(info);
+ onProgress: (data) => {
+ // 处理流式数据
+ handleStreamData(data, type.id);
+ },
+ onComplete: (finalData) => {
+ // 完成后跳转
+ handleComplete(finalData, type.id);
+ },
+ onError: (error) => {
+ progressRef.value?.close();
+ uni.showToast({
+ title: error.message || "生成病历失败",
+ icon: "none",
});
}
-
- progressRef.value?.updateProgress(80);
- progressRef.value?.setGenerating(true);
-
- // 模拟生成结构化病历
- setTimeout(() => {
- progressRef.value?.updateProgress(100);
-
- // 延迟后关闭进度弹窗并跳转
- setTimeout(() => {
- progressRef.value?.close();
-
- // 跳转到病历填写页面
- uni.navigateTo({
- url: `/pages/case/medical-case-form?caseType=${
- type.id
- }&customerId=${
- props.customerId || props.patientAccountId
- }&groupId=${props.groupId}&formData=${encodeURIComponent(
- JSON.stringify(formData || {})
- )}`,
- });
- }, 500);
- }, 1000);
- } else {
- progressRef.value?.close();
- uni.showToast({
- title: result.message || "生成病历失败",
- icon: "none",
- });
- }
+ });
} catch (error) {
console.error("补充病历失败:", error);
progressRef.value?.close();
@@ -279,6 +253,87 @@ const handleCaseTypeSelect = async (type) => {
}
};
+// 流式请求处理
+const requestWithStream = async ({ url, data, onProgress, onComplete, onError }) => {
+ try {
+ // 调用接口时不显示全局 loading(第二个参数为 false)
+ const result = await request({
+ url,
+ data,
+ }, false);
+
+ if (result.success && result.data) {
+ // 模拟流式处理(如果后端返回的是完整数据)
+ const extractedData = result.data.extractedData || {};
+
+ // 逐个字段动态显示(包括空值字段)
+ let progressValue = 20;
+ const fields = Object.entries(extractedData);
+ const delay = 300; // 每个字段显示间隔
+
+ for (let i = 0; i < fields.length; i++) {
+ const [key, value] = fields[i];
+
+ // 显示所有字段,包括空值(会在组件中显示为"暂无")
+ await new Promise(resolve => setTimeout(resolve, delay));
+ onProgress({ key, value });
+ progressValue += Math.floor(60 / fields.length);
+ progressRef.value?.updateProgress(Math.min(progressValue, 80));
+ }
+
+ // 完成
+ onComplete(result.data);
+ } else {
+ onError(new Error(result.message || "请求失败"));
+ }
+ } catch (error) {
+ onError(error);
+ }
+};
+
+// 处理流式数据
+const handleStreamData = (data, caseType) => {
+ const { key, value } = data;
+
+ // 添加检测到的信息
+ progressRef.value?.addDetectedInfo(key, value);
+};
+
+// 处理完成
+const handleComplete = (finalData, caseType) => {
+ progressRef.value?.updateProgress(90);
+ progressRef.value?.setGenerating(true);
+
+ // 延迟后完成
+ setTimeout(() => {
+ progressRef.value?.updateProgress(100);
+ progressRef.value?.setGenerating(false);
+
+ // 延迟后显示操作按钮(不自动跳转)
+ setTimeout(() => {
+ progressRef.value?.setCompleted(true, finalData);
+ }, 500);
+ }, 800);
+};
+
+// 处理从进度弹窗点击重新生成
+const handleRegenerateFromProgress = (data) => {
+ const type = { id: data.caseType };
+ handleCaseTypeSelect(type);
+};
+
+// 处理从进度弹窗点击下一步
+const handleNextFromProgress = (data) => {
+ // 跳转到病历填写页面
+ uni.navigateTo({
+ url: `/pages/case/medical-case-form?caseType=${data.caseType}&customerId=${
+ props.customerId || props.patientAccountId
+ }&groupId=${props.groupId}&formData=${encodeURIComponent(
+ JSON.stringify(data.data?.extractedData || {})
+ )}`,
+ });
+};
+
// 监听重新生成事件
onMounted(() => {
uni.$on("regenerateMedicalCase", handleRegenerateMedicalCase);
diff --git a/pages/message/components/medical-case-progress.vue b/pages/message/components/medical-case-progress.vue
index 5bd762e..c1fb044 100644
--- a/pages/message/components/medical-case-progress.vue
+++ b/pages/message/components/medical-case-progress.vue
@@ -15,18 +15,38 @@
{{ progress }}%
-
+
检测到以下{{ caseTypeName }}信息:
-
+
✓
- {{ item }}
+
+ {{ item.label }}:{{ item.value }}
+
- 正在生成结构化{{ caseTypeName }}...
+ 正在生成结构化{{ caseTypeName }}
+
+
+
+
+
+ 重新生成
+
+
+ 下一步
+
@@ -36,11 +56,15 @@
@@ -98,6 +181,8 @@ defineExpose({
border-radius: 24rpx;
padding: 48rpx 40rpx;
position: relative;
+ max-height: 80vh;
+ overflow-y: auto;
.close-btn {
position: absolute;
@@ -108,6 +193,7 @@ defineExpose({
display: flex;
align-items: center;
justify-content: center;
+ z-index: 10;
.close-icon {
font-size: 40rpx;
@@ -140,7 +226,7 @@ defineExpose({
.progress-fill {
height: 100%;
background: linear-gradient(90deg, #1890ff 0%, #40a9ff 100%);
- transition: width 0.3s ease;
+ transition: width 0.5s ease;
}
}
@@ -164,23 +250,39 @@ defineExpose({
}
.info-list {
+ max-height: 400rpx;
+ overflow-y: auto;
+
.info-item {
display: flex;
align-items: flex-start;
gap: 12rpx;
margin-bottom: 12rpx;
+ opacity: 0;
+ transform: translateX(-20rpx);
+
+ &.fade-in {
+ animation: fadeInSlide 0.4s ease forwards;
+ }
.check-icon {
font-size: 28rpx;
color: #52c41a;
font-weight: bold;
+ margin-top: 2rpx;
}
.info-text {
flex: 1;
font-size: 26rpx;
color: #333333;
- line-height: 1.5;
+ line-height: 1.6;
+ word-break: break-all;
+
+ // 暂无数据的样式
+ &.empty-value {
+ color: #999999;
+ }
}
}
}
@@ -191,7 +293,82 @@ defineExpose({
color: #1890ff;
text-align: center;
padding: 16rpx 0;
+
+ .dot-animation::after {
+ content: '...';
+ animation: dots 1.5s steps(4, end) infinite;
+ }
+ }
+
+ .action-buttons {
+ display: flex;
+ gap: 16rpx;
+ margin-top: 32rpx;
+
+ .action-button {
+ flex: 1;
+ height: 80rpx;
+ border-radius: 40rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: all 0.3s ease;
+
+ &.primary {
+ background: linear-gradient(90deg, #1890ff 0%, #40a9ff 100%);
+
+ .button-text {
+ color: #ffffff;
+ }
+
+ &:active {
+ opacity: 0.8;
+ transform: scale(0.98);
+ }
+ }
+
+ &.secondary {
+ background-color: #ffffff;
+ border: 2rpx solid #d9d9d9;
+
+ .button-text {
+ color: #666666;
+ }
+
+ &:active {
+ background-color: #f5f5f5;
+ transform: scale(0.98);
+ }
+ }
+
+ .button-text {
+ font-size: 30rpx;
+ font-weight: 500;
+ }
+ }
}
}
}
+
+@keyframes fadeInSlide {
+ to {
+ opacity: 1;
+ transform: translateX(0);
+ }
+}
+
+@keyframes dots {
+ 0%, 20% {
+ content: '';
+ }
+ 40% {
+ content: '.';
+ }
+ 60% {
+ content: '..';
+ }
+ 80%, 100% {
+ content: '...';
+ }
+}