新增
This commit is contained in:
@@ -590,6 +590,119 @@ export function prescriptionOrderSetShipMode(params: { id: number; ship_mode: 'g
|
||||
|
||||
// ========== 处方库 ==========
|
||||
|
||||
export type PrescriptionAiProfile = 'qwen' | 'openai'
|
||||
|
||||
export interface PrescriptionLibraryHerb {
|
||||
medicine_id?: number
|
||||
name: string
|
||||
dosage: number | string
|
||||
}
|
||||
|
||||
export interface PrescriptionLibraryRow {
|
||||
id: number
|
||||
prescription_name: string
|
||||
formula_type: '主方' | '辅方' | string
|
||||
herbs: PrescriptionLibraryHerb[]
|
||||
is_public: 0 | 1
|
||||
disable_edit: 0 | 1
|
||||
creator_id: number
|
||||
creator_name: string
|
||||
create_time: string
|
||||
update_time?: string
|
||||
}
|
||||
|
||||
export interface PrescriptionAiStructuredReport {
|
||||
summary: string
|
||||
possible_symptoms: string[]
|
||||
main_indications: string
|
||||
efficacy: string[]
|
||||
suitable_people: string[]
|
||||
compatibility_analysis: string
|
||||
cautions: string[]
|
||||
disclaimer: string
|
||||
}
|
||||
|
||||
export interface PrescriptionAiReportRecord {
|
||||
report_id: number
|
||||
id: number
|
||||
model_key: PrescriptionAiProfile
|
||||
model_name: string
|
||||
model_label: string
|
||||
prompt_version: string
|
||||
message_id: string
|
||||
prescription_fingerprint: string
|
||||
is_stale: boolean
|
||||
generated_by: number
|
||||
generated_time: number
|
||||
generated_at: string
|
||||
report?: PrescriptionAiStructuredReport | null
|
||||
content: string
|
||||
edited_by: number
|
||||
edited_time: number
|
||||
edited_at?: string
|
||||
is_edited: boolean
|
||||
}
|
||||
|
||||
export interface PrescriptionAiGenerationResult {
|
||||
model_key: PrescriptionAiProfile
|
||||
model_name: string
|
||||
model_label: string
|
||||
status: 'success' | 'error'
|
||||
report_id?: number
|
||||
message_id?: string
|
||||
prompt_version?: string
|
||||
latency_ms: number
|
||||
error_code?: string
|
||||
error_message?: string
|
||||
}
|
||||
|
||||
export interface PrescriptionAiCapabilities {
|
||||
can_view: boolean
|
||||
can_refresh: boolean
|
||||
can_edit: boolean
|
||||
}
|
||||
|
||||
export interface PrescriptionAiReportsResponse {
|
||||
prescription_id: number
|
||||
prescription_name: string
|
||||
formula_type: string
|
||||
prescription_updated_at: string
|
||||
prescription_fingerprint: string
|
||||
prompt_version: string
|
||||
reports: PrescriptionAiReportRecord[]
|
||||
missing_model_keys: PrescriptionAiProfile[]
|
||||
can_view: boolean
|
||||
can_refresh: boolean
|
||||
can_edit: boolean
|
||||
capabilities: PrescriptionAiCapabilities
|
||||
status?: 'success' | 'partial' | 'error'
|
||||
partial?: boolean
|
||||
success_count?: number
|
||||
failure_count?: number
|
||||
results?: PrescriptionAiGenerationResult[]
|
||||
}
|
||||
|
||||
export interface PrescriptionAiReportEditResponse {
|
||||
prescription_id: number
|
||||
report: PrescriptionAiReportRecord
|
||||
can_edit: boolean
|
||||
can_refresh: boolean
|
||||
}
|
||||
|
||||
export interface PrescriptionMissingAiReportItem {
|
||||
id: number
|
||||
prescription_name: string
|
||||
formula_type: string
|
||||
herb_count: number
|
||||
}
|
||||
|
||||
export interface PrescriptionMissingAiReportsResponse {
|
||||
total: number
|
||||
items: PrescriptionMissingAiReportItem[]
|
||||
limit: number
|
||||
truncated?: boolean
|
||||
}
|
||||
|
||||
// 处方库列表
|
||||
export function prescriptionLibraryLists(params: any) {
|
||||
return request.get({ url: '/tcm.prescriptionLibrary/lists', params })
|
||||
@@ -615,6 +728,58 @@ export function prescriptionLibraryDetail(params: { id: number }) {
|
||||
return request.get({ url: '/tcm.prescriptionLibrary/detail', params })
|
||||
}
|
||||
|
||||
/** 查询完全没有持久化 AI 报告的处方,单次最多返回 500 条。 */
|
||||
export function prescriptionLibraryMissingAiReports(params: { limit?: number } = {}) {
|
||||
return request.get<PrescriptionMissingAiReportsResponse>(
|
||||
{
|
||||
url: '/tcm.prescriptionLibrary/missingAiReports',
|
||||
params,
|
||||
timeout: 30000
|
||||
},
|
||||
{ ignoreCancelToken: true }
|
||||
)
|
||||
}
|
||||
|
||||
/** 读取数据库中已保存的 AI 报告;不会触发模型生成。 */
|
||||
export function prescriptionLibraryAiReports(params: { id: number }) {
|
||||
return request.get<PrescriptionAiReportsResponse>(
|
||||
{
|
||||
url: '/tcm.prescriptionLibrary/aiReports',
|
||||
params,
|
||||
timeout: 30000
|
||||
},
|
||||
{ ignoreCancelToken: true }
|
||||
)
|
||||
}
|
||||
|
||||
/** 重新生成整份多模型诊断报告;POST 不自动重试,避免重复计费。 */
|
||||
export function prescriptionLibraryGenerateAiReports(params: { id: number }) {
|
||||
return request.post<PrescriptionAiReportsResponse>(
|
||||
{
|
||||
url: '/tcm.prescriptionLibrary/generateAiReports',
|
||||
params,
|
||||
timeout: 210000
|
||||
},
|
||||
{ ignoreCancelToken: true, isOpenRetry: false }
|
||||
)
|
||||
}
|
||||
|
||||
/** 编辑一份已持久化的模型报告。 */
|
||||
export function prescriptionLibraryEditAiReport(params: {
|
||||
id: number
|
||||
report_id: number
|
||||
content: string
|
||||
}) {
|
||||
return request.post<PrescriptionAiReportEditResponse>(
|
||||
{
|
||||
url: '/tcm.prescriptionLibrary/editAiReport',
|
||||
params,
|
||||
timeout: 30000
|
||||
},
|
||||
{ ignoreCancelToken: true, isOpenRetry: false }
|
||||
)
|
||||
}
|
||||
|
||||
// ========== 诊单待办事项(T5) ==========
|
||||
|
||||
/** 待办列表(按 diagnosis_id) */
|
||||
|
||||
Reference in New Issue
Block a user