From 605db69daa676fec4dc2aa64a97b6474f72d6b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=9C=EA=B3=A8=EC=95=BD=EC=82=AC?= Date: Wed, 18 Feb 2026 06:32:31 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=ED=8C=90=EB=A7=A4=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=A7=88=EC=9D=BC=EB=A6=AC=EC=A7=80=20?= =?UTF-8?q?=ED=91=9C=EC=8B=9C=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - patient_id를 통한 직접 조회로 변경 - /api/patients/search 엔드포인트 추가 - 판매 버튼에 patient_id 데이터 속성 추가 - loadPatientMileage 함수 개선 (patient_id 기반 조회) 이제 박주호 회원의 50,000 마일리지가 판매 모달에서 정상 표시됨 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app.py | 20 ++++++++++++++++++++ static/app.js | 26 +++++++++++++++++--------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/app.py b/app.py index 8a5d833..d9f087a 100644 --- a/app.py +++ b/app.py @@ -110,6 +110,26 @@ def get_patient(patient_id): except Exception as e: return jsonify({'success': False, 'error': str(e)}), 500 +@app.route('/api/patients/search', methods=['GET']) +def search_patients(): + """환자 검색 (이름으로)""" + try: + name = request.args.get('name', '') + + with get_db() as conn: + cursor = conn.cursor() + cursor.execute(""" + SELECT patient_id, name, phone, gender, birth_date, notes, + mileage_balance, total_mileage_earned, total_mileage_used + FROM patients + WHERE name LIKE ? AND is_active = 1 + ORDER BY name + """, (f'%{name}%',)) + patients = [dict(row) for row in cursor.fetchall()] + return jsonify({'success': True, 'data': patients}) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}), 500 + @app.route('/api/patients', methods=['POST']) def create_patient(): """새 환자 등록""" diff --git a/static/app.js b/static/app.js index e1da7e4..228fff7 100644 --- a/static/app.js +++ b/static/app.js @@ -1380,6 +1380,7 @@ $(document).ready(function() {