140 lines
7.6 KiB
SQL
140 lines
7.6 KiB
SQL
-- ═══════════════════════════════════════════════════════════════
|
|
-- Seed: 모든 marketing_reports에 강남언니 + 원장 정보 채우기
|
|
-- 실행 전: SELECT id, clinic_name, status FROM marketing_reports; 로 확인
|
|
-- Supabase SQL Editor에서 실행
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
|
|
-- 0. 현재 상태 조회 (실행 전 확인용)
|
|
SELECT
|
|
id,
|
|
clinic_name,
|
|
status,
|
|
channel_data->'gangnamUnni'->>'rating' AS gu_rating,
|
|
channel_data->'gangnamUnni'->>'totalReviews' AS gu_reviews,
|
|
report->'clinicInfo'->'leadDoctor'->>'name' AS lead_doctor,
|
|
report->'clinicInfo'->>'staffCount' AS staff_count,
|
|
scrape_data->>'source' AS source
|
|
FROM marketing_reports
|
|
ORDER BY created_at DESC;
|
|
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
-- 1. 바노바기성형외과 — gangnamUnni + 원장 정보
|
|
-- 강남언니 URL: https://www.gangnamunni.com/hospitals/23
|
|
-- 평점: 9.2 / 리뷰: 6,843
|
|
-- 대표원장: 반재상 (9.7점, 678리뷰), 오창현 (9.7점, 543리뷰)
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
UPDATE marketing_reports
|
|
SET
|
|
channel_data = channel_data || jsonb_build_object(
|
|
'gangnamUnni', jsonb_build_object(
|
|
'name', '바노바기성형외과의원',
|
|
'rating', 9.2,
|
|
'rawRating', 9.2,
|
|
'ratingScale', '/10',
|
|
'totalReviews', 6843,
|
|
'doctors', jsonb_build_array(
|
|
jsonb_build_object('name', '반재상', 'specialty', '성형외과 대표원장', 'rating', 9.7, 'reviews', 678),
|
|
jsonb_build_object('name', '오창현', 'specialty', '성형외과 대표원장', 'rating', 9.7, 'reviews', 543),
|
|
jsonb_build_object('name', '권희연', 'specialty', '성형외과', 'rating', 9.6, 'reviews', 687),
|
|
jsonb_build_object('name', '박선재', 'specialty', '성형외과', 'rating', 8.9, 'reviews', 92)
|
|
),
|
|
'procedures', jsonb_build_array('눈성형', '코성형', '안면윤곽/양악', '가슴성형', '지방성형', '필러', '보톡스', '리프팅', '모발이식'),
|
|
'address', '서울 강남구 논현로 517 바노바기',
|
|
'badges', jsonb_build_array('마취과 전문의 상주', '수술실 CCTV', '여성 의사 진료', '분야별 공동 진료', '시술 후 관리', '의료진 실명 공개', '입원 시설', '응급 대응 체계', '야간진료'),
|
|
'sourceUrl', 'https://www.gangnamunni.com/hospitals/23'
|
|
)
|
|
),
|
|
report = jsonb_set(
|
|
jsonb_set(
|
|
jsonb_set(
|
|
report,
|
|
'{clinicInfo,leadDoctor}',
|
|
'{"name": "반재상", "specialty": "성형외과 대표원장 (서울대 출신)", "rating": 9.7, "reviewCount": 678}'::jsonb
|
|
),
|
|
'{clinicInfo,staffCount}',
|
|
'20'::jsonb
|
|
),
|
|
'{channelAnalysis,gangnamUnni}',
|
|
'{"score": 82, "rating": 9.2, "ratingScale": 10, "reviews": 6843, "status": "active", "recommendation": "공동 대표원장 체제로 운영. 리뷰 볼륨 확대와 신규 시술 후기 유도 필요."}'::jsonb
|
|
),
|
|
scrape_data = scrape_data || jsonb_build_object(
|
|
'source', 'registry',
|
|
'registryData', jsonb_build_object(
|
|
'district', '강남',
|
|
'branches', NULL,
|
|
'brandGroup', '프리미엄/하이타깃 후보',
|
|
'naverPlaceUrl', 'https://m.place.naver.com/hospital/21033469',
|
|
'gangnamUnniUrl', 'https://www.gangnamunni.com/hospitals/23',
|
|
'googleMapsUrl', NULL
|
|
)
|
|
)
|
|
WHERE lower(clinic_name) LIKE '%바노바기%';
|
|
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
-- 2. 아이디병원 — gangnamUnni + 원장 정보
|
|
-- 강남언니 URL: https://www.gangnamunni.com/hospitals/257
|
|
-- 평점: 9.5 / 리뷰: 14,933
|
|
-- 대표원장: 박상훈 (9.8점, 9,058리뷰)
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
UPDATE marketing_reports
|
|
SET
|
|
channel_data = channel_data || jsonb_build_object(
|
|
'gangnamUnni', jsonb_build_object(
|
|
'name', '아이디병원-본원',
|
|
'rating', 9.5,
|
|
'rawRating', 9.5,
|
|
'ratingScale', '/10',
|
|
'totalReviews', 14933,
|
|
'doctors', jsonb_build_array(
|
|
jsonb_build_object('name', '박상훈', 'specialty', '성형외과 대표원장', 'rating', 9.8, 'reviews', 9058),
|
|
jsonb_build_object('name', '이지혁', 'specialty', '성형외과', 'rating', 9.2, 'reviews', 225),
|
|
jsonb_build_object('name', '황인석', 'specialty', '성형외과', 'rating', 9.5, 'reviews', 215),
|
|
jsonb_build_object('name', '이근석', 'specialty', '이비인후과', 'rating', 9.1, 'reviews', 87)
|
|
),
|
|
'procedures', jsonb_build_array('양악수술', '안면윤곽', '눈성형', '코성형', '가슴성형', '리프팅', '피부클리닉', '치과'),
|
|
'address', '서울 강남구 도산대로 142 아이디병원',
|
|
'badges', jsonb_build_array('수술실 CCTV', '마취과 전문의 상주', '시술 후 관리', '의료진 실명 공개', '여성 의사 진료', '입원 시설', '전용 휴식 공간', '야간진료', '응급 대응 체계'),
|
|
'sourceUrl', 'https://www.gangnamunni.com/hospitals/257'
|
|
)
|
|
),
|
|
report = jsonb_set(
|
|
jsonb_set(
|
|
jsonb_set(
|
|
report,
|
|
'{clinicInfo,leadDoctor}',
|
|
'{"name": "박상훈", "specialty": "성형외과 대표원장 (안면윤곽/양악 전문)", "rating": 9.8, "reviewCount": 9058}'::jsonb
|
|
),
|
|
'{clinicInfo,staffCount}',
|
|
'35'::jsonb
|
|
),
|
|
'{channelAnalysis,gangnamUnni}',
|
|
'{"score": 90, "rating": 9.5, "ratingScale": 10, "reviews": 14933, "status": "active", "recommendation": "강남언니 최상위권. 박상훈 원장 중심 콘텐츠 강화 및 양악수술 특화 후기 지속 확보 필요."}'::jsonb
|
|
),
|
|
scrape_data = scrape_data || jsonb_build_object(
|
|
'source', 'registry',
|
|
'registryData', jsonb_build_object(
|
|
'district', '강남',
|
|
'branches', '아이디병원 별관(역삼)',
|
|
'brandGroup', '프리미엄/하이타깃 후보',
|
|
'naverPlaceUrl', 'https://m.place.naver.com/hospital/11548359',
|
|
'gangnamUnniUrl', 'https://www.gangnamunni.com/hospitals/257',
|
|
'googleMapsUrl', NULL
|
|
)
|
|
)
|
|
WHERE lower(clinic_name) LIKE '%아이디%';
|
|
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
-- 3. 검증 — 업데이트 후 모든 리포트 상태 확인
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
SELECT
|
|
id,
|
|
clinic_name,
|
|
status,
|
|
channel_data->'gangnamUnni'->>'rating' AS gu_rating,
|
|
channel_data->'gangnamUnni'->>'totalReviews' AS gu_reviews,
|
|
report->'clinicInfo'->'leadDoctor'->>'name' AS lead_doctor,
|
|
report->'clinicInfo'->>'staffCount' AS staff_count,
|
|
scrape_data->>'source' AS source
|
|
FROM marketing_reports
|
|
ORDER BY created_at DESC;
|