- 월비탕 1차~4차 단계별 처방 추가 (WBT001-1 ~ WBT001-4) - 삼소음 처방 추가 (SSE001) - 처방 추가 가이드 문서 작성 - 약재 성분 코드 확인 및 검증 스크립트 추가 월비탕: 단계별 비만치료 처방 (1차~4차) 삼소음: 리기화담, 해표산한 효능의 기침/가래 치료 처방 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
78 lines
2.0 KiB
Python
78 lines
2.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
월비탕에 사용되는 약재들의 성분 코드 확인
|
|
"""
|
|
|
|
import sqlite3
|
|
|
|
def check_herb_codes():
|
|
"""약재 성분 코드 확인"""
|
|
|
|
# 월비탕에 사용되는 약재들
|
|
herbs_to_check = [
|
|
"마황",
|
|
"석고",
|
|
"감초",
|
|
"진피",
|
|
"복령",
|
|
"갈근",
|
|
"건지황",
|
|
"창출"
|
|
]
|
|
|
|
conn = sqlite3.connect('database/kdrug.db')
|
|
cursor = conn.cursor()
|
|
|
|
herb_codes = {}
|
|
|
|
print("🌿 월비탕 약재 성분 코드 확인")
|
|
print("="*50)
|
|
|
|
for herb in herbs_to_check:
|
|
# 정확한 이름으로 먼저 검색
|
|
cursor.execute("""
|
|
SELECT ingredient_code, herb_name, herb_name_hanja
|
|
FROM herb_masters
|
|
WHERE herb_name = ?
|
|
""", (herb,))
|
|
|
|
result = cursor.fetchone()
|
|
|
|
# 정확한 이름이 없으면 포함된 이름으로 검색
|
|
if not result:
|
|
cursor.execute("""
|
|
SELECT ingredient_code, herb_name, herb_name_hanja
|
|
FROM herb_masters
|
|
WHERE herb_name LIKE ?
|
|
ORDER BY LENGTH(herb_name)
|
|
LIMIT 1
|
|
""", (f'%{herb}%',))
|
|
result = cursor.fetchone()
|
|
|
|
if result:
|
|
herb_codes[herb] = result[0]
|
|
print(f"✅ {herb}: {result[0]} ({result[1]}, {result[2]})")
|
|
else:
|
|
print(f"❌ {herb}: 찾을 수 없음")
|
|
# 비슷한 이름 찾기
|
|
cursor.execute("""
|
|
SELECT herb_name
|
|
FROM herb_masters
|
|
WHERE herb_name LIKE ?
|
|
LIMIT 5
|
|
""", (f'%{herb[:2]}%',))
|
|
similar = cursor.fetchall()
|
|
if similar:
|
|
print(f" 유사한 약재: {', '.join([s[0] for s in similar])}")
|
|
|
|
conn.close()
|
|
|
|
return herb_codes
|
|
|
|
if __name__ == "__main__":
|
|
herb_codes = check_herb_codes()
|
|
|
|
print("\n📊 약재 코드 매핑 결과:")
|
|
print("-"*50)
|
|
for herb, code in herb_codes.items():
|
|
print(f'"{herb}": "{code}",') |