From 9ff25dcbceb3ca484d4a61552e1de5b6ffada952 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Wed, 4 Mar 2026 20:44:37 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Phase=202=20-=20=EC=84=B1=EB=B6=84?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EA=B8=B0=EB=B0=98=20=ED=88=AC=EC=95=BD?= =?UTF-8?q?=EC=A3=BC=EA=B8=B0/=EB=B3=91=EC=9A=A9=EC=95=BD=20JOIN=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - component_guide 테이블 생성 (PostgreSQL) - IC2030126 (메벤다졸+프라지퀸텔) 샘플 데이터 입력 - 미리보기 API: apc + component_guide LEFT JOIN - 모달에 투약주기, 병용약 섹션 추가 (보라색/녹색 강조) --- backend/app.py | 43 +++++++++++++++++++++------ backend/templates/admin_products.html | 12 ++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/backend/app.py b/backend/app.py index 8d87f97..392e5fa 100644 --- a/backend/app.py +++ b/backend/app.py @@ -6636,14 +6636,22 @@ def api_animal_drug_info_preview(): with pg_engine.connect() as conn: result = conn.execute(text(""" SELECT - product_name, - company_name, - main_ingredient, - efficacy_effect, - dosage_instructions, - precautions - FROM apc - WHERE apc = :apc + a.product_name, + a.company_name, + a.main_ingredient, + a.efficacy_effect, + a.dosage_instructions, + a.precautions, + a.component_code, + g.component_name_ko, + g.dosing_interval_adult, + g.dosing_interval_high_risk, + g.dosing_interval_puppy, + g.companion_drugs, + g.contraindication as guide_contraindication + 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() @@ -6673,6 +6681,17 @@ def api_animal_drug_info_preview(): text = re.sub(r'\s+(\d+)\)\s*', r'\n \1) ', text) return text.strip() + # 투약주기 조합 + dosing_interval = None + if row.dosing_interval_adult: + parts = [] + parts.append(f"일반: {row.dosing_interval_adult}") + if row.dosing_interval_high_risk: + parts.append(f"고위험: {row.dosing_interval_high_risk}") + if row.dosing_interval_puppy: + parts.append(f"새끼: {row.dosing_interval_puppy}") + dosing_interval = '\n'.join(parts) + return jsonify({ 'success': True, 'data': { @@ -6681,7 +6700,13 @@ def api_animal_drug_info_preview(): 'main_ingredient': row.main_ingredient if row.main_ingredient != 'NaN' else None, 'efficacy_effect': format_items(strip_html(row.efficacy_effect)), 'dosage_instructions': format_items(strip_html(row.dosage_instructions)), - 'precautions': format_items(strip_html(row.precautions)) + 'precautions': format_items(strip_html(row.precautions)), + # 성분 가이드 (component_guide JOIN) + 'component_code': row.component_code, + 'component_name': row.component_name_ko, + 'dosing_interval': dosing_interval, + 'companion_drugs': row.companion_drugs, + 'guide_contraindication': row.guide_contraindication } }) diff --git a/backend/templates/admin_products.html b/backend/templates/admin_products.html index 8d30a2f..3660d5a 100644 --- a/backend/templates/admin_products.html +++ b/backend/templates/admin_products.html @@ -1165,6 +1165,18 @@

${escapeHtml(info.precautions.substring(0, 800))}${info.precautions.length > 800 ? '...' : ''}

` : ''} + ${info.dosing_interval ? ` +
+
▶ 투약 주기 ⭐
+

${escapeHtml(info.dosing_interval)}

+
` : ''} + + ${info.companion_drugs ? ` +
+
▶ 함께 투약 권장 💊
+

${escapeHtml(info.companion_drugs)}

+
` : ''} +