From 1198c22083e90c89974292d96d16a3623a2b4b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=9C=EA=B3=A8=EC=95=BD=EC=82=AC?= Date: Mon, 16 Feb 2026 14:36:52 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20Excel=20=EC=9E=85=EA=B3=A0=20=EC=8B=9C?= =?UTF-8?q?=20=EB=B3=B4=ED=97=98=EC=BD=94=EB=93=9C=209=EC=9E=90=EB=A6=AC?= =?UTF-8?q?=20=ED=8C=A8=EB=94=A9=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Excel 읽기 시 제품코드를 문자열로 처리하여 앞자리 0 보존 - 한의사랑/한의정보 형식 모두 보험코드 9자리 패딩 적용 - 예: 60600420 → 060600420 자동 변환 이제 Excel 파일의 보험코드가 숫자로 읽혀도 정상 처리됨 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- excel_processor.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/excel_processor.py b/excel_processor.py index 474f48e..d351916 100644 --- a/excel_processor.py +++ b/excel_processor.py @@ -64,7 +64,8 @@ class ExcelProcessor: def read_excel(self, file_path): """Excel 파일 읽기""" try: - self.df_original = pd.read_excel(file_path) + # 제품코드를 문자열로 읽기 위한 dtype 설정 + self.df_original = pd.read_excel(file_path, dtype={'제품코드': str}) self.format_type = self.detect_format(self.df_original) return True except Exception as e: @@ -82,6 +83,12 @@ class ExcelProcessor: if old_col in df.columns: df_mapped[new_col] = df[old_col] + # 보험코드 9자리 패딩 처리 + if 'insurance_code' in df_mapped.columns: + df_mapped['insurance_code'] = df_mapped['insurance_code'].apply( + lambda x: str(x).zfill(9) if pd.notna(x) and str(x).isdigit() else str(x) if pd.notna(x) else None + ) + # 업체명 추가 (기본값) df_mapped['supplier_name'] = '한의사랑' @@ -112,6 +119,12 @@ class ExcelProcessor: if old_col in df.columns: df_mapped[new_col] = df[old_col] + # 보험코드 9자리 패딩 처리 + if 'insurance_code' in df_mapped.columns: + df_mapped['insurance_code'] = df_mapped['insurance_code'].apply( + lambda x: str(x).zfill(9) if pd.notna(x) and str(x).isdigit() else str(x) if pd.notna(x) else None + ) + # 날짜 처리 (YYYYMMDD 형식) if 'receipt_date' in df_mapped.columns: df_mapped['receipt_date'] = df_mapped['receipt_date'].astype(str)