pharmacy-pos-qr-system/backend/check_db.py
thug0bin ee300f80ca feat: 소수 환자 약품 뱃지 표시
- 1년간 3명 이하 환자만 사용하는 약품에 환자 이름 뱃지 표시
- 조회 기간 내 사용한 환자는 핑크색으로 강조
- 매출액 컬럼명 변경 (약가 → 매출액)
- SUM(DRUPRICE)로 매출액 계산
2026-03-07 00:43:02 +09:00

26 lines
772 B
Python

import sqlite3
conn = sqlite3.connect('db/mileage.db')
cur = conn.cursor()
# 테이블 목록
cur.execute("SELECT name FROM sqlite_master WHERE type='table'")
tables = cur.fetchall()
print('=== Tables ===')
for t in tables:
print(t[0])
# wholesaler/limit/setting 관련 테이블 스키마 확인
for t in tables:
tname = t[0].lower()
if 'wholesal' in tname or 'limit' in tname or 'setting' in tname or 'config' in tname:
print(f'\n=== {t[0]} schema ===')
cur.execute(f'PRAGMA table_info({t[0]})')
for col in cur.fetchall():
print(col)
cur.execute(f'SELECT * FROM {t[0]} LIMIT 5')
rows = cur.fetchall()
if rows:
print('Sample data:')
for r in rows:
print(r)