医生备注优化

This commit is contained in:
2026-04-30 12:19:04 +08:00
parent cba04067bd
commit 901629ac6e
15 changed files with 675 additions and 272 deletions
+4 -35
View File
@@ -135,16 +135,10 @@ import {
bindCallRoom,
endCall,
getCallSignature,
startCall,
tcmDiagnosisDetail,
tcmDiagnosisEdit
startCall
} from '@/api/tcm'
import { CallLocalRecorder } from '@/utils/call-local-recorder'
import { captureVideoFrameFromElement } from '@/utils/call-video-screenshot'
import {
DIAGNOSIS_TONGUE_IMAGES_UPDATED,
type DiagnosisTongueImagesUpdatedDetail
} from '@/utils/diagnosis-sync-events'
import feedback from '@/utils/feedback'
import {
formatTUICallUserError,
@@ -1274,9 +1268,8 @@ const onCallKitDragEnd = () => {
document.removeEventListener('mouseup', onCallKitDragEnd)
}
/** 截取当前视频画面并上传,同步到对应患者诊单的「舌苔照片」 */
/** 截取当前视频画面并上传,保存到医生备注 */
const handleCallKitScreenshot = async () => {
// 同步防重入:避免连点触发两次上传、诊单里出现两张图
if (captureUploading.value) return
captureUploading.value = true
try {
@@ -1305,32 +1298,8 @@ const handleCallKitScreenshot = async () => {
feedback.msgWarning('请先保存诊单后再从视频同步舌苔照片')
return
}
const detail = await tcmDiagnosisDetail({ id: diagnosisId.value })
if (Number(detail.patient_id) !== Number(patientId.value)) {
feedback.msgError('患者与当前诊单不匹配,无法同步')
return
}
const previous: string[] = [...((detail.tongue_images || []) as string[])]
// if (previous.length >= 9) {
// feedback.msgWarning('舌苔照片已达上限 9 张')
// return
// }
const next = [...previous, path]
const payload = JSON.parse(JSON.stringify(detail)) as Record<string, unknown>
payload.tongue_images = next
await tcmDiagnosisEdit(payload)
feedback.msgSuccess('舌苔照片已同步到诊单')
window.dispatchEvent(
new CustomEvent<DiagnosisTongueImagesUpdatedDetail>(DIAGNOSIS_TONGUE_IMAGES_UPDATED, {
detail: {
diagnosisId: diagnosisId.value,
tongue_images: next
}
})
)
try {
await addDoctorNote({ diagnosis_id: diagnosisId.value, tongue_images: [path] })
} catch { /* 写入备注表失败不阻塞主流程 */ }
await addDoctorNote({ diagnosis_id: diagnosisId.value, tongue_images: [path] })
feedback.msgSuccess('舌苔照片已保存')
} catch (e: unknown) {
const err = e as Error
console.error(err)