## 처방 관리 (조제) 기능 - 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>
62 lines
2.2 KiB
Python
62 lines
2.2 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
한약재 제품 코드 엑셀 파일 분석
|
|
"""
|
|
|
|
import pandas as pd
|
|
import openpyxl
|
|
|
|
def analyze_excel_file():
|
|
file_path = 'sample/(게시)한약재제품코드_2510.xlsx'
|
|
|
|
# 엑셀 파일 열기
|
|
wb = openpyxl.load_workbook(file_path, read_only=True)
|
|
|
|
print("=== 엑셀 파일 시트 목록 ===")
|
|
for i, sheet_name in enumerate(wb.sheetnames, 1):
|
|
print(f"{i}. {sheet_name}")
|
|
|
|
# 4번째 시트 데이터 읽기
|
|
if len(wb.sheetnames) >= 4:
|
|
sheet_name = wb.sheetnames[3] # 0-based index
|
|
print(f"\n=== 4번째 시트 '{sheet_name}' 분석 ===")
|
|
|
|
# pandas로 데이터 읽기
|
|
df = pd.read_excel(file_path, sheet_name=sheet_name)
|
|
|
|
print(f"\n데이터 크기: {df.shape[0]}행 x {df.shape[1]}열")
|
|
print(f"\n컬럼 목록:")
|
|
for i, col in enumerate(df.columns, 1):
|
|
# NaN이 아닌 값들의 예시
|
|
non_null_count = df[col].notna().sum()
|
|
sample_values = df[col].dropna().head(3).tolist()
|
|
print(f" {i}. {col} (유효값: {non_null_count}개)")
|
|
if sample_values:
|
|
print(f" 예시: {sample_values[:3]}")
|
|
|
|
print(f"\n=== 데이터 샘플 (처음 10행) ===")
|
|
pd.set_option('display.max_columns', None)
|
|
pd.set_option('display.width', None)
|
|
pd.set_option('display.max_colwidth', 50)
|
|
print(df.head(10))
|
|
|
|
# 주요 컬럼 분석
|
|
if '주성분코드' in df.columns:
|
|
print(f"\n=== 주성분코드 분석 ===")
|
|
print(f"유일한 주성분코드 수: {df['주성분코드'].nunique()}")
|
|
print(f"주성분코드 샘플: {df['주성분코드'].unique()[:10].tolist()}")
|
|
|
|
if '제품명' in df.columns:
|
|
print(f"\n=== 제품명 분석 ===")
|
|
print(f"유일한 제품 수: {df['제품명'].nunique()}")
|
|
print(f"제품명 샘플: {df['제품명'].head(10).tolist()}")
|
|
|
|
# 컬럼 정보를 더 자세히 분석
|
|
print(f"\n=== 데이터 타입 및 null 값 정보 ===")
|
|
print(df.info())
|
|
|
|
wb.close()
|
|
|
|
if __name__ == "__main__":
|
|
analyze_excel_file() |