feat: 诊所问题优化
This commit is contained in:
@@ -5,7 +5,7 @@ export const CLINIC_POST_REGISTER_STORAGE_KEY = '__clinic_post_register_payload'
|
||||
|
||||
/**
|
||||
* 从 r_info 解析复诊西药列表(与 register.vue 原 sendClinicFollowUpAssistantMessage 一致)
|
||||
* @returns {{ registerInfoId: string, drugsPayload: Array<{drug_id:number,name:string,quantity:number}> }}
|
||||
* @returns {{ registerInfoId: string, drugsPayload: Array<{drug_id:number,name:string,quantity:number,indications?:string,indications_array?:Array}> }}
|
||||
*/
|
||||
export function resolveFollowUpDrugsFromRInfo(rInfo) {
|
||||
const empty = { registerInfoId: '', drugsPayload: [] };
|
||||
@@ -29,10 +29,21 @@ export function resolveFollowUpDrugsFromRInfo(rInfo) {
|
||||
const row = Number(d.quantity ?? d.number);
|
||||
const quantity =
|
||||
Number.isFinite(row) && row >= 1 ? Math.min(99, row) : fallbackQty;
|
||||
// 规范化适用症数组,兼容字符串 indications
|
||||
let indicationsArray = Array.isArray(d.indications_array) ? d.indications_array : [];
|
||||
if (!indicationsArray.length && d.indications) {
|
||||
indicationsArray = String(d.indications)
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
.map((s) => ({ value: s, label: s }));
|
||||
}
|
||||
return {
|
||||
drug_id: Number(d.drug_id || d.id),
|
||||
name: d.name || d.drug_name || '药品',
|
||||
quantity,
|
||||
indications: d.indications || '',
|
||||
indications_array: indicationsArray,
|
||||
};
|
||||
});
|
||||
return { registerInfoId: String(infoId), drugsPayload };
|
||||
@@ -50,6 +61,8 @@ export async function sendFollowUpDrugAssistantMessage({
|
||||
drugsPayload,
|
||||
question,
|
||||
answerStatus,
|
||||
illnessInfo,
|
||||
supplement,
|
||||
}) {
|
||||
const payload = {
|
||||
flow: 'follow_up_drug',
|
||||
@@ -58,6 +71,9 @@ export async function sendFollowUpDrugAssistantMessage({
|
||||
drugs: drugsPayload,
|
||||
question: question || '您是否曾使用过以上药品?',
|
||||
answer_status: answerStatus,
|
||||
// 症状摘要给医生聊天侧展示
|
||||
illness_info: illnessInfo || '',
|
||||
supplement: supplement || '',
|
||||
};
|
||||
await sendToUserApi({
|
||||
room_id: roomId,
|
||||
|
||||
Reference in New Issue
Block a user