--- // 외국인 환자용 체류 안내. 세 부분이다. // 1. Around the clinic — 도보·차 소요 시간으로 거른 주변 장소 // 2. Festivals — 계절로 묶은 행사 // 3. Suggested days — 시간표와 지도가 붙은 동선 // // 데이터는 한국관광공사 TourAPI 영문(EngService2)에서 scripts/fetch_medical_tourism.py 가 // 미리 수집한 src/data/medicalTourism.json 이다. 설명문은 detailCommon2 의 overview 다. // // 만들지 않는 것 // - 평점·리뷰·영업시간: TourAPI 미제공. 싣지 않는다. // - 링크: 공식 홈페이지가 있을 때만 걸고, 없으면 검색으로 보낸다. 주소를 지어내지 않는다. // - 식이 적합성·회복 일수: 의학 판단이라 병원 확정값만 쓴다. // - 일정의 시각: 진료 종료 시각을 가정으로 못박아 화면에 밝힌다. 병원 일정이 아니다. import Base from '../../layouts/Base.astro'; import { fact, site as S, SITE_NAME, clinicSchema, has } from '../../lib'; import data from '../../data/medicalTourism.json'; const f = fact as Record; const Sx = S as Record; const clinic = f.shortNameEn || f.nameEn || f.shortName || 'the clinic'; const site = Astro.site!.toString().replace(/\/$/, ''); const T = data as any; type Place = { id: string; title: string; address: string; image: string | null; overview: string; homepage: string; lat: number | null; lng: number | null; distanceM: number | null; travel: { mode: string; minutes: number; label: string } | null; }; const GROUPS: Array<{ key: string; label: string; note: string }> = [ { key: 'restaurant', label: 'Food', note: 'Restaurants and cafés' }, { key: 'stay', label: 'Hotels', note: 'Places to sleep' }, { key: 'wellness', label: 'Rest', note: 'Spas and jjimjilbang' }, { key: 'attraction', label: 'Sights', note: 'Streets, parks, landmarks' }, { key: 'culture', label: 'Culture', note: 'Museums, theatres, halls' }, { key: 'shopping', label: 'Shopping', note: 'Stores and markets' }, ]; const SEASONS = [ { key: 'spring', label: 'Spring' }, { key: 'summer', label: 'Summer' }, { key: 'autumn', label: 'Autumn' }, { key: 'winter', label: 'Winter' }, ]; const MONTHS = ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; const nowSeason = ['winter', 'winter', 'spring', 'spring', 'spring', 'summer', 'summer', 'summer', 'autumn', 'autumn', 'autumn', 'winter'][new Date().getMonth()]; // 검색으로 보낸다. 없는 URL 을 만들지 않는다. const searchUrl = (q: string) => `https://www.google.com/search?q=${encodeURIComponent(q + ' Seoul')}`; // 칩은 누적 임계값으로 거른다. 카드에 이동수단과 도보 분을 실어 두면 스크립트가 판단한다. const dt = (d: string | null) => (d && d.length === 8 ? `${MONTHS[+d.slice(4, 6)]} ${+d.slice(6, 8)}` : ''); // 사진이 없을 때 이름을 대신 넣는다. 빈 회색칸보다 낫고, 없는 사진을 지어내지도 않는다. const shortName = (t: string) => { const m = t.match(/\(([^)]+)\)\s*$/); return (m ? m[1] : t).replace(/\s*\[.*\]\s*/g, '').trim(); }; const firstSentence = (s: string, n = 150) => { if (!s) return ''; const cut = s.slice(0, n); const stop = cut.lastIndexOf('. '); return (stop > 60 ? cut.slice(0, stop + 1) : cut) + (s.length > n ? '…' : ''); }; /* ── 동선. 실제 데이터에서 만들고, 시각은 가정임을 화면에 밝힌다. ── */ const oLat = T.meta.origin.lat, oLng = T.meta.origin.lng; const pick = (key: string, maxMin: number, n: number): Place[] => ((T.places[key] ?? []) as Place[]) .filter((p) => p.travel && p.travel.mode === 'walk' && p.travel.minutes <= maxMin && p.lat) .slice(0, n); const pickAny = (key: string, n: number): Place[] => ((T.places[key] ?? []) as Place[]).filter((p) => p.lat).slice(0, n); const hhmm = (m: number) => `${String(Math.floor(m / 60) % 24).padStart(2, '0')}:${String(m % 60).padStart(2, '0')}`; function buildRoute(startMin: number, stops: Array<{ p: Place | null; label: string; stay: number; note: string }>) { let t = startMin; const out: any[] = []; stops.forEach((s, i) => { const move = i === 0 ? 0 : (s.p?.travel?.minutes ?? 5); t += move; const from = t; t += s.stay; out.push({ ...s, moveMin: move, from: hhmm(from), to: hhmm(t), lat: s.p?.lat ?? oLat, lng: s.p?.lng ?? oLng }); }); return { stops: out, total: t - startMin, from: hhmm(startMin), to: hhmm(t) }; } const clinicStop = (label: string, stay: number, note: string) => ({ p: null, label, stay, note }); const ROUTES = [ { id: 'near', title: 'The day of a check-up', who: 'When you come back to the clinic often', blurb: 'Everything within a short walk. You do not need a taxi.', route: buildRoute(15 * 60, [ clinicStop(clinic, 40, 'Your appointment ends here.'), ...pick('restaurant', 10, 1).map((p) => ({ p, label: p.title, stay: 50, note: firstSentence(p.overview, 90) })), ...pick('wellness', 12, 1).map((p) => ({ p, label: p.title, stay: 60, note: firstSentence(p.overview, 90) })), ]), }, { id: 'short', title: 'A short outing', who: 'When you can walk a little further', blurb: 'Still close, but out of the block.', route: buildRoute(13 * 60, [ clinicStop(clinic, 20, 'Start from the clinic.'), ...pickAny('shopping', 1).map((p) => ({ p, label: p.title, stay: 60, note: firstSentence(p.overview, 90) })), ...pickAny('restaurant', 2).slice(1, 2).map((p) => ({ p, label: p.title, stay: 60, note: firstSentence(p.overview, 90) })), ]), }, { id: 'city', title: 'When you can travel', who: 'Later in your stay', blurb: 'Sights across the city. Expect to take a taxi or the subway.', route: buildRoute(10 * 60, [ clinicStop(clinic, 10, 'Set off from the clinic.'), ...pickAny('attraction', 2).map((p) => ({ p, label: p.title, stay: 70, note: firstSentence(p.overview, 90) })), ...pickAny('culture', 1).map((p) => ({ p, label: p.title, stay: 70, note: firstSentence(p.overview, 90) })), ]), }, ].filter((r) => r.route.stops.length > 1); /* OpenStreetMap 타일을 좌표로 직접 깔아 지도를 만든다. 지도 라이브러리를 부르지 않는다. 빈 회색 칸에 점만 찍으면 어디인지 알 수 없어서, 실제 거리·블록이 보이게 한다. 타일은 OSM 정책상 출처를 반드시 표기한다. */ const TILE = 256, MAPW = 680, MAPH = 340; const lngToPx = (lng: number, z: number) => ((lng + 180) / 360) * TILE * 2 ** z; const latToPx = (lat: number, z: number) => { const r = (lat * Math.PI) / 180; return ((1 - Math.log(Math.tan(r) + 1 / Math.cos(r)) / Math.PI) / 2) * TILE * 2 ** z; }; function miniMap(stops: any[]) { const lats = stops.map((s) => s.lat), lngs = stops.map((s) => s.lng); const [la0, la1] = [Math.min(...lats), Math.max(...lats)]; const [ln0, ln1] = [Math.min(...lngs), Math.max(...lngs)]; // 모든 지점이 여백 안에 들어오는 가장 확대된 배율을 고른다. let z = 17; for (; z > 10; z--) { const w = lngToPx(ln1, z) - lngToPx(ln0, z); const h = latToPx(la0, z) - latToPx(la1, z); if (w <= MAPW - 90 && h <= MAPH - 90) break; } const cx = (lngToPx(ln0, z) + lngToPx(ln1, z)) / 2; const cy = (latToPx(la0, z) + latToPx(la1, z)) / 2; const left = cx - MAPW / 2, top = cy - MAPH / 2; const tiles: Array<{ src: string; x: number; y: number }> = []; for (let tx = Math.floor(left / TILE); tx <= Math.floor((left + MAPW) / TILE); tx++) { for (let ty = Math.floor(top / TILE); ty <= Math.floor((top + MAPH) / TILE); ty++) { const n = 2 ** z; if (tx < 0 || ty < 0 || tx >= n || ty >= n) continue; tiles.push({ src: `https://tile.openstreetmap.org/${z}/${tx}/${ty}.png`, x: tx * TILE - left, y: ty * TILE - top }); } } const pins = stops.map((s, i) => ({ x: +(lngToPx(s.lng, z) - left).toFixed(1), y: +(latToPx(s.lat, z) - top).toFixed(1), n: i + 1, label: s.label, })); return { tiles, pins, z }; } const allPlaces: Array = GROUPS.flatMap((g) => ((T.places[g.key] ?? []) as Place[]).map((p) => ({ ...p, cat: g.key }))); const ld = [ { '@type': 'WebPage', '@id': `${site}/en/stay#page`, name: `Your stay near ${clinic}`, url: `${site}/en/stay`, inLanguage: 'en', isPartOf: { '@id': `${site}/#website` }, about: { '@id': `${f.url}/#clinic` }, publisher: { '@type': 'Organization', name: SITE_NAME, url: site } }, clinicSchema(site), ]; ---
For international patients

Your Stay in Seoul

Around {clinic}. Everything below is measured from the clinic at {f.address?.fullEn || f.address?.full}. Names, photographs and descriptions come from the Korea Tourism Organization. For the clinic's own hours and phone, see Clinic informationKO.

Around the clinic

Updated {T.meta.fetchedAt.slice(0, 10)}

{T.filters.total} places, sorted by how long they take to reach on foot.

{GROUPS.map((g) => { const items = allPlaces.filter((p) => p.cat === g.key); if (!items.length) return null; return (

{g.label} {g.note}

{items.map((p) => (
{p.image ? {`${p.title} : {shortName(p.title)}} {p.travel && {p.travel.label} {p.distanceM! < 1000 ? `${p.distanceM} m` : `${(p.distanceM! / 1000).toFixed(1)} km`}}

{p.title}

{firstSentence(p.overview) || 'No description provided by the tourism data.'}

{p.address}

{p.homepage ? Official site ↗ : Open in search ↗}
))}
); })}

Source · Korea Tourism Organization TourAPI. Walking time is estimated at 80 m per minute and is not a routed distance.

Festivals and events

{T.festivals.length} events within {T.meta.festivalRadiusKm} km, grouped by season. Right now it is {nowSeason}.

{SEASONS.map((s) => { const n = T.festivals.filter((e: any) => e.season === s.key).length; return n ? : null; })}
{T.festivals.map((e: any) => (
{e.image ? {`${e.title} : {shortName(e.title)}} {MONTHS[e.month] ?? ''}

{e.title}

{dt(e.startDate)} – {dt(e.endDate)} · {e.travel ? e.travel.label : `${e.distanceKm} km`}

{firstSentence(e.overview) || 'No description provided by the tourism data.'}

{e.address}

Open in search ↗
))}

Source · Korea Tourism Organization TourAPI. Dates can change at the organiser's discretion.

Shaping your days

Three routes built from the places above. The clock times assume an appointment ending at the hour shown, and are an example, not your schedule.

{Sx.recoveryStagesEn ?

What {clinic} advises. {Sx.recoveryStagesEn}

:

Which of these you can do, and on which day, is a medical question. {clinic} has not yet published English guidance. Ask at your consultation.

} {ROUTES.map((r) => { const pins = miniMap(r.route.stops); return (

{r.title}

{r.who}

{r.route.from}–{r.route.to} · {Math.floor(r.route.total / 60)}h {r.route.total % 60}m

{r.blurb}

); })}

What this page does not tell you

  • No ratings, review counts or opening hours. The tourism data does not carry them.
  • No claim that any place suits your recovery. That is for {clinic} to say.
  • English tourism listings around Gangnam are thin. Only {T.filters.walk5} places sit within a five minute walk, and {T.filters.drive} of {T.filters.total} need a car.
  • We are not a travel agency, take no booking and no commission.

{has(f.urlEn) && Book a consultation in English}

{f.sideEffectNoticeEn || f.sideEffectNotice}