diff --git a/.cursor/rules/Code-Standards.md b/.cursor/rules/Code-Standards.md deleted file mode 100644 index 9e5c2433..00000000 --- a/.cursor/rules/Code-Standards.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -description: -alwaysApply: true ---- - -1. 写代码的时候要补充详细的中文注释(每个方法是干嘛的,为什么要这样写),如果是工作区,则所有项目都适用该规则 -2. 注意不要生成太多的空行,上一部分代码和下一部分代码中间的空行不要大于2行 -3. 有封装好的方法、组件需要复用,不要重复造轮子 -4. 小程序端的抽屉全部需要用page-container来防止用户意外退出页面(记得使用v-if而不是v-show) -5. 数据库的(created_at、updated_at、deleted_at)统一使用时间戳,不要使用字符串,并且我在查询器中一级格式化成字符串了,无需再次格式化 diff --git a/apps/web-antd/src/store/prescription.ts b/apps/web-antd/src/store/prescription.ts index b542602f..4fd8bf89 100644 --- a/apps/web-antd/src/store/prescription.ts +++ b/apps/web-antd/src/store/prescription.ts @@ -582,8 +582,25 @@ export const usePrescriptionStore = defineStore('prescription', () => { } }, 300); - // 药品操作 + /** + * 从商品/药品数据解析处方分类 tab(与 activeCategory 对齐) + * 1 中药 / 2 西药 / 3 保健食品 / 5 产品服务包 / 6 非药品 / 7 医疗器械 + * 缺省按西药 2,避免挂号选药误入中药开方 + */ + const resolveDrugCategory = (data: any): number => { + const raw = data?.drug?.type ?? data?.type; + const n = Number(raw); + if (Number.isFinite(n) && n > 0) return n; + return 2; + }; + + // 药品操作:写入前按药型自动切到对应 tab,避免西药落入中药开方组件 const addProducts = (data: any) => { + const targetCategory = resolveDrugCategory(data); + if (Number(activeCategory.value) !== targetCategory) { + changeCategory(targetCategory); + } + const existItem = currentDrugs.value.find( (item) => item.index_id === data.id, ); @@ -1077,6 +1094,38 @@ export const usePrescriptionStore = defineStore('prescription', () => { }, userStore.currentUser.doctor_id, ); + // 在线复诊开方后自动连发购药指引与用药温馨提示 + const tipTexts = [ + '根据您的病情描述,已为您开具电子处方,请点击上方的‘立即支付’,进行购药;如有商品价格和订单等问题请咨询平台客服。', + '温馨提示:用药前请详细阅读药品说明书,并严格按照线下医嘱用药。如用药过程中出现病情变化或其它不适症状,请立即停药并及时就医。(请您注意,如果您尚未在医院就诊或未曾使用过本次申请的药品,请暂时不要支付订单。我们建议您在医生的指导下使用药品,以确保用药安全。)', + ]; + tipTexts.forEach((tip, tipIdx) => { + sendMessage({ + roomId: chatStore.currentFriend.room_id, + senderId: userStore.currentUser.doctor_id, + receiverId: chatStore.currentFriend.id, + type: 'text', + content: tip, + }); + chatStore.addMessage( + { + id: `${Date.now()}_tip_${tipIdx}`, + room_id: chatStore.currentFriend.room_id, + sender_user_id: `doctor-${userStore.currentUser.doctor_id}`, + receiver_user_id: chatStore.currentFriend.id, + message_type: 0, + message_content: tip, + messageTypeName: 'text', + created_at: Date.now() + tipIdx + 1, + created_at_text: new Date().toLocaleTimeString().slice(0, 5), + timestamp: Date.now() + tipIdx + 1, + isSent: true, + read: true, + duration: 0, + }, + userStore.currentUser.doctor_id, + ); + }); resetForm(); // 发送成功后清空本挂号下全部分类草稿(含另一分类与 activeCategory) clearLocalPrescriptionCache(); @@ -1240,6 +1289,7 @@ export const usePrescriptionStore = defineStore('prescription', () => { resetInitializationState, getDrugList, addProducts, + resolveDrugCategory, removeDrug, updateDrugQuantity, increment, diff --git a/apps/web-antd/src/views/business/chat/components/FollowUpDrugAssistantCard.vue b/apps/web-antd/src/views/business/chat/components/FollowUpDrugAssistantCard.vue index 19fba838..ac6daf77 100644 --- a/apps/web-antd/src/views/business/chat/components/FollowUpDrugAssistantCard.vue +++ b/apps/web-antd/src/views/business/chat/components/FollowUpDrugAssistantCard.vue @@ -1,13 +1,29 @@ @@ -122,7 +181,7 @@ const drugs = computed(() => } .answer-row { - @apply flex items-center justify-between rounded-lg bg-emerald-50 px-3 py-2 text-sm dark:bg-emerald-900/30; + @apply mb-3 flex items-center justify-between rounded-lg bg-emerald-50 px-3 py-2 text-sm dark:bg-emerald-900/30; } .answer-row .label { @@ -133,7 +192,23 @@ const drugs = computed(() => @apply font-medium text-emerald-800 dark:text-emerald-300; } +.info-block { + @apply mb-3 rounded-lg bg-slate-50 px-3 py-2 dark:bg-slate-900/50; +} + +.info-block-label { + @apply mb-1 text-xs text-slate-500 dark:text-slate-400; +} + +.info-block-content { + @apply text-sm leading-relaxed text-slate-800 dark:text-slate-100; +} + .pending-tip { @apply rounded-lg border border-dashed border-amber-200 bg-amber-50 px-3 py-2 text-center text-xs text-amber-800 dark:border-amber-700 dark:bg-amber-900/20 dark:text-amber-200; } + +.add-rx-wrap { + @apply mt-3 border-t border-slate-100 pt-3 dark:border-slate-600; +} diff --git a/apps/web-antd/src/views/business/chat/components/MessageBubble.vue b/apps/web-antd/src/views/business/chat/components/MessageBubble.vue index a85e7f77..71bbb95a 100644 --- a/apps/web-antd/src/views/business/chat/components/MessageBubble.vue +++ b/apps/web-antd/src/views/business/chat/components/MessageBubble.vue @@ -251,10 +251,15 @@ const canAddRegisterDrugsToRx = computed(() => { const handleAddRegisterDrugsToPrescription = async () => { if (registerAddToRxLoading.value) return; const cardRegisterId = registerCardDisplay.value?.id; + const followUpRegisterId = + isFollowUpDrugAssistant.value && parsedContent.value?.register_id + ? parsedContent.value.register_id + : ''; const registerId = prescriptionStore.currentRegisterId || chatStore.currentFriend?.register_id || - cardRegisterId; + cardRegisterId || + followUpRegisterId; if (!registerId) { antdMessage.warning('请先接诊患者'); return; @@ -308,6 +313,22 @@ const isFollowUpDrugAssistant = computed(() => { return !!(pc && typeof pc === 'object' && pc.flow === 'follow_up_drug'); }); +/** + * 复诊用药卡「添加到处方单」:有药、非本人发送、当前会话有挂号 + * 与挂号卡加方共用 handleAddRegisterDrugsToPrescription + */ +const canAddFollowUpDrugsToRx = computed(() => { + if (!isFollowUpDrugAssistant.value || props.isSent) return false; + const pc = parsedContent.value; + const drugs = pc && Array.isArray(pc.drugs) ? pc.drugs : []; + if (!drugs.length) return false; + return !!( + prescriptionStore.currentRegisterId || + chatStore.currentFriend?.register_id || + pc.register_id + ); +}); + function fetchRegisterCard() { if (props.message.message_type !== 10) return; const content = getParsedContent( @@ -1044,6 +1065,9 @@ const getSexText = (sex) => { diff --git a/apps/web-antd/src/views/system/system-config/index.vue b/apps/web-antd/src/views/system/system-config/index.vue index d1a6a104..57ed8148 100644 --- a/apps/web-antd/src/views/system/system-config/index.vue +++ b/apps/web-antd/src/views/system/system-config/index.vue @@ -54,7 +54,7 @@ function readStoredTab() { if (stored === 'price_adjust' || stored === 'input_audit' || stored === 'miniprogram' || stored === 'oa_notify') { activeKey.value = stored; } -} +}} function parseBoolConfig(val: unknown, defaultVal: boolean): boolean { if (val === undefined || val === null || val === '') return defaultVal;