fix: product_id 충돌 해결 (임의 생성 5종 → MASTER-017~021)
This commit is contained in:
50
test_v2_all.py
Normal file
50
test_v2_all.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
v2 API 테스트 - 전체 약품
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
|
||||
from animal_med import AnimalMedRendererV2
|
||||
|
||||
|
||||
def main():
|
||||
renderer = AnimalMedRendererV2()
|
||||
|
||||
# 전체 마스터 약품
|
||||
drugs = renderer.list_drugs()
|
||||
print(f"총 {len(drugs)}개 약품 → {(len(drugs) + 3) // 4} 페이지")
|
||||
|
||||
# 전체 ID 수집
|
||||
all_ids = [d['product_id'] for d in drugs]
|
||||
|
||||
# PDF 생성
|
||||
output_dir = os.path.join(os.path.dirname(__file__), 'output')
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
pdf_path = os.path.join(output_dir, f'v2_all_{len(drugs)}drugs.pdf')
|
||||
|
||||
result = renderer.render_to_pdf(
|
||||
product_ids=all_ids,
|
||||
output_path=pdf_path,
|
||||
patient_name="김보호자",
|
||||
pet_name="뽀삐",
|
||||
pet_species="푸들",
|
||||
pet_age="3세"
|
||||
)
|
||||
|
||||
if result['success']:
|
||||
import fitz
|
||||
doc = fitz.open(pdf_path)
|
||||
size = os.path.getsize(pdf_path)
|
||||
print(f"✅ PDF 생성: {len(doc)} 페이지, {size/1024:.1f}KB")
|
||||
print(f"📄 {pdf_path}")
|
||||
doc.close()
|
||||
else:
|
||||
print(f"❌ 실패: {result.get('error')}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user