feat: 5개 마스터 JSON 추가 (총 9개) + 외용제 레이아웃

This commit is contained in:
청춘약국
2026-03-18 23:13:05 +09:00
parent 25db8750cb
commit 1c5758d9d5
8 changed files with 311 additions and 7 deletions

69
test_v2_8drugs.py Normal file
View File

@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-
"""
v2 API 테스트 - 8개 약품 (2페이지)
"""
import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
from animal_med import AnimalMedRendererV2
def main():
print("=" * 60)
print("v2 API 테스트 - 8개 약품 (2페이지)")
print("=" * 60)
renderer = AnimalMedRendererV2()
# 마스터 약품 목록
print("\n[1] 마스터 약품 목록:")
for drug in renderer.list_drugs():
print(f" {drug['product_id']} - {drug['name']}")
# 8개 약품 사용 (2x2 x 2페이지)
test_ids = [
"MASTER-001", "MASTER-002", "MASTER-003", "MASTER-004",
"MASTER-005", "MASTER-006", "MASTER-007", "MASTER-008"
]
print(f"\n[2] PDF 렌더링 ({len(test_ids)}개 약품)")
# 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, 'v2_8drugs_2pages.pdf')
print(f"\n[3] PDF 생성 중...")
result = renderer.render_to_pdf(
product_ids=test_ids,
output_path=pdf_path,
patient_name="박보호자",
pet_name="콩이",
pet_species="말티즈",
pet_age="5세"
)
if result['success']:
print(f" ✅ 성공!")
print(f" 📄 PDF: {result['pdf_path']}")
print(f" 약품: {len(result['drugs'])}")
size = os.path.getsize(pdf_path)
print(f" 크기: {size / 1024:.1f} KB")
import fitz
doc = fitz.open(pdf_path)
print(f" 페이지 수: {len(doc)}")
doc.close()
else:
print(f" ❌ 실패: {result.get('error')}")
print("\n" + "=" * 60)
if __name__ == "__main__":
main()