48 lines
1.3 KiB
Python
48 lines
1.3 KiB
Python
# app/repositories/queries/health_queries.py
|
|
"""
|
|
HealthSync AI 건강 관련 쿼리 모음
|
|
"""
|
|
|
|
|
|
class HealthQueries:
|
|
"""건강 데이터 관련 쿼리"""
|
|
|
|
# 최신 건강검진 데이터 조회
|
|
GET_LATEST_HEALTH_CHECKUP = """
|
|
SELECT
|
|
hc.checkup_id,
|
|
hc.member_serial_number,
|
|
hc.reference_year,
|
|
hc.age,
|
|
hc.height,
|
|
hc.weight,
|
|
hc.bmi,
|
|
hc.waist_circumference,
|
|
hc.visual_acuity_left,
|
|
hc.visual_acuity_right,
|
|
hc.hearing_left,
|
|
hc.hearing_right,
|
|
hc.systolic_bp,
|
|
hc.diastolic_bp,
|
|
hc.fasting_glucose,
|
|
hc.total_cholesterol,
|
|
hc.triglyceride,
|
|
hc.hdl_cholesterol,
|
|
hc.ldl_cholesterol,
|
|
hc.hemoglobin,
|
|
hc.urine_protein,
|
|
hc.serum_creatinine,
|
|
hc.ast,
|
|
hc.alt,
|
|
hc.gamma_gtp,
|
|
hc.smoking_status,
|
|
hc.drinking_status,
|
|
hc.processed_at,
|
|
hc.created_at
|
|
FROM health_service.health_checkup hc
|
|
INNER JOIN user_service.user u ON hc.member_serial_number = u.member_serial_number
|
|
WHERE u.member_serial_number = :user_id
|
|
ORDER BY hc.reference_year DESC, hc.created_at DESC
|
|
LIMIT 1
|
|
"""
|