diff --git a/src/components/exam/ExamModal.tsx b/src/components/exam/ExamModal.tsx index c2790d4..256c34e 100644 --- a/src/components/exam/ExamModal.tsx +++ b/src/components/exam/ExamModal.tsx @@ -5,10 +5,12 @@ import type { CustomerAppointmentInfo, CustomerExamAddItem, CustomerInfo, + OutputTongyishuFileInfo, PhysicalExamProgressItem, } from '../../api'; import { getCustomerDetail, getPhysicalExamProgressDetail, signInMedicalExamCenter, getTongyishuPdf } from '../../api'; -import { Button, Input } from '../ui'; +import type { SignaturePadHandle } from '../ui'; +import { Button, Input, SignaturePad } from '../ui'; interface ExamModalProps { client: ExamClient; @@ -164,7 +166,7 @@ export const ExamModal = ({ client, tab, onTabChange, onClose }: ExamModalProps) loading={detailLoading} /> )} - {tab === 'sign' && } + {tab === 'sign' && } {tab === 'addon' && } {tab === 'print' && } {tab === 'delivery' && } @@ -175,12 +177,18 @@ export const ExamModal = ({ client, tab, onTabChange, onClose }: ExamModalProps) ); }; -const ExamSignPanel = () => { +const ExamSignPanel = ({ examId }: { examId?: number }) => { const [idNo, setIdNo] = useState(''); const [ocrLoading, setOcrLoading] = useState(false); const [signLoading, setSignLoading] = useState(false); const [message, setMessage] = useState(null); const fileInputRef = useRef(null); + const [consentList, setConsentList] = useState([]); + const [consentLoading, setConsentLoading] = useState(false); + const [consentMessage, setConsentMessage] = useState(null); + const [previewPdf, setPreviewPdf] = useState(null); + const [showSignature, setShowSignature] = useState(false); + const signaturePadRef = useRef(null); const handlePickFile = () => { fileInputRef.current?.click(); @@ -230,6 +238,29 @@ const ExamSignPanel = () => { } }; + useEffect(() => { + if (!examId) { + setConsentList([]); + setConsentMessage('缺少体检ID,无法获取知情同意书'); + return; + } + setConsentLoading(true); + setConsentMessage(null); + getTongyishuPdf({ exam_id: examId }) + .then((res) => { + const list = res.Data?.list_pdf_url || []; + setConsentList(list); + if (!list.length) { + setConsentMessage(res.Data?.message || '暂无知情同意书'); + } + }) + .catch((err) => { + console.error('获取知情同意书失败', err); + setConsentMessage('知情同意书加载失败,请稍后重试'); + }) + .finally(() => setConsentLoading(false)); + }, [examId]); + return (
@@ -268,8 +299,82 @@ const ExamSignPanel = () => {
体检知情同意书
点击后弹出知情同意书全文及签名区域,签署完成后回到签到页面。
- +
+ {consentLoading &&
加载中...
} + {!consentLoading && consentMessage && ( +
{consentMessage}
+ )} + {!consentLoading && consentList.length > 0 && ( +
+ {consentList.map((item) => ( +
+
{item.pdf_name}
+ +
+ ))} +
+ )} +
+ {previewPdf && ( +
+
+
{previewPdf.pdf_name}
+
+ + +
+
+
+