feat:诊所问题优化,气泡卡片优化,修复了导入药品的时候无法打开开方组件并且切换tab的问题

This commit is contained in:
李琦
2026-07-28 14:23:50 +08:00
parent 05885ed405
commit 5506c8917f
5 changed files with 154 additions and 15 deletions

View File

@@ -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,