feat: 인쇄에 투약주기/병용약 추가 + 인쇄 피드백 개선

- 인쇄 API: component_guide JOIN 추가
- 영수증에 ★ 투약 주기 ★ / ★ 함께 투약 권장 ★ 섹션 추가
- 인쇄 버튼: 로딩 중 → 인쇄 완료! 피드백
- 이모지 대신 ★ 사용 (프린터 호환)
This commit is contained in:
thug0bin
2026-03-04 20:48:47 +09:00
parent 9ff25dcbce
commit f829276431
2 changed files with 53 additions and 13 deletions

View File

@@ -6446,17 +6446,24 @@ def api_animal_drug_info_print():
with pg_engine.connect() as conn:
result = conn.execute(text("""
SELECT
product_name,
company_name,
main_ingredient,
efficacy_effect,
dosage_instructions,
precautions,
weight_min_kg,
weight_max_kg,
pet_size_label
FROM apc
WHERE apc = :apc
a.product_name,
a.company_name,
a.main_ingredient,
a.efficacy_effect,
a.dosage_instructions,
a.precautions,
a.weight_min_kg,
a.weight_max_kg,
a.pet_size_label,
a.component_code,
g.component_name_ko,
g.dosing_interval_adult,
g.dosing_interval_high_risk,
g.dosing_interval_puppy,
g.companion_drugs
FROM apc a
LEFT JOIN component_guide g ON a.component_code = g.component_code
WHERE a.apc = :apc
LIMIT 1
"""), {'apc': apc})
row = result.fetchone()
@@ -6591,6 +6598,27 @@ def api_animal_drug_info_print():
for line in wrap_text(para.strip(), 44):
message += f" {line}\n"
# 투약 주기 (component_guide JOIN)
if row.dosing_interval_adult:
message += f"""
{THIN}
★ 투약 주기 ★
"""
message += f" 일반: {row.dosing_interval_adult}\n"
if row.dosing_interval_high_risk:
message += f" 고위험: {row.dosing_interval_high_risk}\n"
if row.dosing_interval_puppy:
message += f" 새끼: {row.dosing_interval_puppy}\n"
# 병용약 권장 (component_guide JOIN)
if row.companion_drugs:
message += f"""
{THIN}
★ 함께 투약 권장 ★
"""
for line in wrap_text(row.companion_drugs, 44):
message += f" {line}\n"
message += f"""
{LINE}
청 춘 약 국