feat(pmr): 환자 전화번호 표시/수정 기능 추가

- API: 처방 조회 시 CD_PERSON.PHONE 반환
- API: PUT /api/members/{code}/phone - 전화번호 저장
- UI: 나이/성별 옆에 전화번호 뱃지 표시
- UI: 전화번호 없으면 '전화번호 추가' 클릭 가능
- UI: 클릭 시 모달에서 전화번호 입력/저장
This commit is contained in:
thug0bin
2026-03-11 23:42:13 +09:00
parent 4c033b0584
commit e254c5c23d
3 changed files with 172 additions and 9 deletions

View File

@@ -5193,6 +5193,42 @@ def api_member_detail(cuscode):
return jsonify({'success': False, 'error': str(e)}), 500
@app.route('/api/members/<cuscode>/phone', methods=['PUT'])
def api_update_phone(cuscode):
"""환자 전화번호 수정 API"""
try:
data = request.get_json() or {}
new_phone = data.get('phone', '').strip()
# 길이 제한 (20자)
if len(new_phone) > 20:
return jsonify({'success': False, 'error': '전화번호는 20자를 초과할 수 없습니다.'}), 400
base_session = db_manager.get_session('PM_BASE')
# PHONE 업데이트
update_query = text("""
UPDATE CD_PERSON
SET PHONE = :phone
WHERE CUSCODE = :cuscode
""")
result = base_session.execute(update_query, {'phone': new_phone, 'cuscode': cuscode})
base_session.commit()
if result.rowcount == 0:
return jsonify({'success': False, 'error': '해당 고객을 찾을 수 없습니다.'}), 404
return jsonify({
'success': True,
'message': '전화번호가 저장되었습니다.',
'phone': new_phone
})
except Exception as e:
logging.error(f"전화번호 수정 오류: {e}")
return jsonify({'success': False, 'error': str(e)}), 500
@app.route('/api/members/<cuscode>/cusetc', methods=['PUT'])
def api_update_cusetc(cuscode):
"""특이(참고)사항 수정 API"""