- 판매 관리 기능 추가 - compounds 테이블에 판매 관련 컬럼 추가 (payment_method, discount_rate, delivery_method 등) - 판매 상태 관리 (조제완료→결제대기→결제완료→배송대기→배송완료) - 판매 처리 모달 UI 구현 - 9가지 상태별 뱃지 표시 - 마일리지 시스템 구축 - patients 테이블에 마일리지 컬럼 추가 (balance, earned, used) - mileage_transactions 테이블 생성 (거래 이력 관리) - 마일리지 사용/적립 기능 구현 - 복합 결제 기능 - 할인율(%) / 할인액(원) 직접 입력 선택 가능 - 마일리지 + 현금 + 카드 + 계좌이체 복합 결제 - 결제 금액 자동 검증 - 결제 방법 자동 분류 (복합결제 지원) - API 엔드포인트 추가 - POST /api/compounds/<id>/status (상태 업데이트) - PUT /api/compounds/<id>/price (가격 조정) - GET /api/sales/statistics (판매 통계) - 데이터베이스 설정 통합 - config.py 생성하여 DB 경로 중앙화 TODO: 처방별 기본가격 정책 시스템 (price_policies 테이블 활용) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
2.1 KiB
Python
65 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
조제(compound) 관련 테이블 스키마 확인
|
|
"""
|
|
|
|
import sqlite3
|
|
|
|
def check_compound_tables():
|
|
conn = sqlite3.connect('database/kdrug.db')
|
|
cursor = conn.cursor()
|
|
|
|
# compounds 테이블 구조 확인
|
|
print("=" * 80)
|
|
print("1. COMPOUNDS 테이블 구조:")
|
|
print("=" * 80)
|
|
cursor.execute("PRAGMA table_info(compounds)")
|
|
columns = cursor.fetchall()
|
|
for col in columns:
|
|
print(f" {col[1]:25s} {col[2]:15s} {'NOT NULL' if col[3] else 'NULL':10s} {col[4] or ''}")
|
|
|
|
# compound_items 테이블 구조 확인
|
|
print("\n" + "=" * 80)
|
|
print("2. COMPOUND_ITEMS 테이블 구조:")
|
|
print("=" * 80)
|
|
cursor.execute("PRAGMA table_info(compound_items)")
|
|
columns = cursor.fetchall()
|
|
for col in columns:
|
|
print(f" {col[1]:25s} {col[2]:15s} {'NOT NULL' if col[3] else 'NULL':10s} {col[4] or ''}")
|
|
|
|
# 관련 테이블 확인
|
|
print("\n" + "=" * 80)
|
|
print("3. 관련 테이블 목록:")
|
|
print("=" * 80)
|
|
cursor.execute("""
|
|
SELECT name FROM sqlite_master
|
|
WHERE type='table' AND (name LIKE '%sale%' OR name LIKE '%payment%' OR name LIKE '%invoice%')
|
|
ORDER BY name
|
|
""")
|
|
related_tables = cursor.fetchall()
|
|
if related_tables:
|
|
for table in related_tables:
|
|
print(f" - {table[0]}")
|
|
else:
|
|
print(" 판매/결제 관련 테이블 없음")
|
|
|
|
# 샘플 데이터 확인
|
|
print("\n" + "=" * 80)
|
|
print("4. 최근 조제 데이터 샘플:")
|
|
print("=" * 80)
|
|
cursor.execute("""
|
|
SELECT c.compound_id, p.name, f.formula_name, c.compound_date, c.created_at, c.status
|
|
FROM compounds c
|
|
LEFT JOIN patients p ON c.patient_id = p.patient_id
|
|
LEFT JOIN formulas f ON c.formula_id = f.formula_id
|
|
ORDER BY c.created_at DESC
|
|
LIMIT 5
|
|
""")
|
|
compounds = cursor.fetchall()
|
|
for comp in compounds:
|
|
print(f" ID:{comp[0]} | 환자:{comp[1]} | 처방:{comp[2]} | 조제일:{comp[3]} | 상태:{comp[5]}")
|
|
|
|
conn.close()
|
|
|
|
if __name__ == "__main__":
|
|
check_compound_tables() |