## 처방 관리 (조제) 기능 - compounds API 추가 (목록/상세/환자별 조회) - 조제 시 자동 재고 차감 (FIFO) - 조제 내역 UI (EMR 스타일) - 조제 상세보기 모달 (처방구성, 재고소비내역) - 오늘/이번달 조제 통계 표시 ## 재고 원장 시스템 - stock-ledger API 구현 - 입출고 내역 실시간 추적 - 재고 현황 페이지 개선 (통계 카드 추가) - 입출고 원장 모달 UI - 약재별/전체 입출고 내역 조회 ## 확인된 동작 - 박주호 환자 오미자 200g 조제 - 재고 2000g → 1800g 정확히 차감 - 모든 입출고 stock_ledger에 기록 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
데이터베이스 데이터 수정
|
|
"""
|
|
|
|
import sqlite3
|
|
|
|
def fix_database():
|
|
conn = sqlite3.connect('database/kdrug.db')
|
|
cursor = conn.cursor()
|
|
|
|
print("=== 데이터베이스 수정 시작 ===")
|
|
|
|
# 1. receipt_date 수정 (튜플 문자열을 일반 문자열로)
|
|
print("\n1. receipt_date 수정...")
|
|
cursor.execute("""
|
|
UPDATE purchase_receipts
|
|
SET receipt_date = '20260211'
|
|
WHERE receipt_id = 6
|
|
""")
|
|
print(f" receipt_date 수정 완료: {cursor.rowcount}건")
|
|
|
|
# 2. total_amount 계산 및 수정
|
|
print("\n2. total_amount 재계산...")
|
|
cursor.execute("""
|
|
UPDATE purchase_receipts
|
|
SET total_amount = (
|
|
SELECT SUM(line_total)
|
|
FROM purchase_receipt_lines
|
|
WHERE receipt_id = 6
|
|
)
|
|
WHERE receipt_id = 6
|
|
""")
|
|
print(f" total_amount 수정 완료: {cursor.rowcount}건")
|
|
|
|
# 변경 사항 저장
|
|
conn.commit()
|
|
|
|
# 수정 결과 확인
|
|
print("\n=== 수정 후 데이터 확인 ===")
|
|
cursor.execute("""
|
|
SELECT receipt_date, total_amount
|
|
FROM purchase_receipts
|
|
WHERE receipt_id = 6
|
|
""")
|
|
result = cursor.fetchone()
|
|
print(f" receipt_date: {result[0]} (type: {type(result[0]).__name__})")
|
|
print(f" total_amount: {result[1]:,.0f}원 (type: {type(result[1]).__name__})")
|
|
|
|
conn.close()
|
|
print("\n✅ 데이터베이스 수정 완료!")
|
|
|
|
if __name__ == "__main__":
|
|
fix_database() |