Problem
AI SOLUTION CASE STUDY · 2026
ClinicBotAI clinic operations, from conversation to confirmed care.
แพลตฟอร์ม AI สำหรับคลินิกที่เชื่อมบทสนทนา การนัดหมาย งานหลังบ้าน และระบบอัตโนมัติไว้ใน workflow เดียว
BUSINESS → AI → OPERATIONS
EXECUTIVE SUMMARY
One system. Five outcomes.
ภาพรวมสำหรับผู้บริหาร: ปัญหา, วิธีแก้, บทบาท AI, automation และผลลัพธ์เชื่อมต่อกันอย่างไร
Solution
One operating layer
AI
Context-aware action
Automation
Always-on operations
Impact
Connected clinic journey
LIVE TEST ACCESS
Experience both sides of the system.
เริ่มบทสนทนาใน LINE แล้วเปิด Dashboard เพื่อดู workflow ฝั่งคลินิกด้วยบัญชีสำหรับทดสอบ

Talk to ClinicBot on LINE
สแกน QR หรือเปิด LINE Official Account เพื่อทดลองสนทนาและ workflow การจอง
Open LINE OAOpen the live Dashboard
cloud.care.admin@cloudcareclinic.comCloudcareadmin@2026For interview testing only · บัญชีนี้จัดเตรียมไว้สำหรับทดลองระบบ
THE PROBLEM
Continuity is the hard part.
โจทย์ไม่ใช่แค่ให้บอทตอบได้ แต่คือการรักษา context และสถานะธุรกิจให้ต่อเนื่องตลอด patient journey
CURRENT PROCESS
หลายช่องทางและหลายงาน
OPERATIONAL PRESSURE
Context ต้องไม่หลุด
BUSINESS IMPACT
บริการต้อง scale โดยยังควบคุมได้
THE SOLUTION
A connected operating layer.
ทุก layer มี responsibility, contract และ output ชัดเจน—จาก human interaction ไปถึง durable state
01Channels
LINE OA · Web Widget · Dashboard
Channels
LINE OA · Web Widget · Dashboardรับ interaction จากผู้ป่วยและเจ้าหน้าที่
- INPUT
- Message · Postback · Staff action
- OUTPUT
- Webhook · Web API · REST/WebSocket
02Application
FastAPI · Service layer
Application
FastAPI · Service layerตรวจสิทธิ์, route workflow และรักษา separation of concerns
- INPUT
- Verified request
- OUTPUT
- Service operation
03Intelligence
Google Gemini · RAG · Tool calling
Intelligence
Google Gemini · RAG · Tool callingเข้าใจบริบท ค้นความรู้ และตัดสินใจเรียกเครื่องมือ
- INPUT
- Prompt · Context · Retrieved knowledge
- OUTPUT
- Response · Function call
04Operations
Appointment · Conversation · Campaign
Operations
Appointment · Conversation · Campaignเปลี่ยน intent เป็น business action ที่ควบคุมสถานะได้
- INPUT
- Validated command
- OUTPUT
- Appointment · Message · State change
05Data & Jobs
PostgreSQL/pgvector · Redis · ARQ
Data & Jobs
PostgreSQL/pgvector · Redis · ARQเก็บข้อมูล/vector, realtime events และกระจายงานเบื้องหลัง
- INPUT
- Records · Vectors · Jobs
- OUTPUT
- Persistent state · Events · Scheduled actions
AI SOLUTION ARCHITECTURE
From channel to intelligence—and back.
คลิกแต่ละ node เพื่อดู responsibility, input/output และ dependency ตามหลักฐานในเอกสาร
Channels → FastAPI → Services → Gemini/Data → response
Scheduler → Redis → ARQ Worker → LINE / PostgreSQL
SERVICE ARCHITECTURE
13 services. Clear boundaries.
Service catalog สร้างจาก SERVICE_LIST.md โดยตรง; Future คือ service ที่เอกสารระบุว่ายังไม่อยู่ใน runtime หลักหรือเป็น stub
AI Service
ai_service.pyConversation Service
conversation_service.pyAppointment Service
appointment_service.pyBroadcast Service
broadcast_service.pyReview Service
review_service.pyLINE Service
line_service.pyChannel Adapter
channel_adapter.pyFlex Message
flex_message.pyBilling Service
billing_service.pyPlan Catalog
plan_catalog.pyPromptPay Service
promptpay_service.pyAudit Service
audit_service.pyNotification Service
notification_service.pyEND-TO-END FLOW
One message. Controlled execution.
LINE bot pipeline ตั้งแต่ signature verification, context, handoff gate, RAG ไปจนถึง tool loop และ durable log
Reason with knowledge
สร้างคำตอบที่อิงบริบทและข้อมูลคลินิก
- INPUT
- Message + context + Knowledge Base
- PROCESSING
- Gemini receives prompt, RAG context และ available tools
- AI COMPONENT
- Gemini · RAG · Prompting
- OUTPUT
- Response draft หรือ function call
BOOKING STATE FLOW
AI INTELLIGENCE LAYER
Grounded enough to answer. Structured enough to act.
AI อยู่ในขอบเขตของ context, retrieval, service tools และ conversation state—ไม่ใช่ autonomous black box
MODEL
Google Gemini
GROUNDING
Knowledge Base RAG
ACTION
Function calling
CONTROL
Human handoff
WHY THIS ARCHITECTURE
Decisions, not just technologies.
ทุก choice มีเหตุผล ทางเลือก และ trade-off ที่ต้องบริหาร
Gemini + tool calling
- WHY
- คำถามของผู้ป่วยต้องการทั้งภาษาธรรมชาติและ action กับข้อมูลจริง
- ALTERNATIVE
- rule-based chatbot
- TRADE-OFF
- เพิ่ม model cost และต้องควบคุม output
- RESULT
- AI สนทนาและขอให้ระบบทำงานผ่าน service boundary
RAG over static prompts
- WHY
- ความรู้เฉพาะคลินิกเปลี่ยนแปลงและควรแยกจาก prompt หลัก
- ALTERNATIVE
- ฝังข้อมูลทั้งหมดใน system prompt
- TRADE-OFF
- เพิ่ม retrieval pipeline และคุณภาพขึ้นกับ knowledge source
- RESULT
- Knowledge Base จัดการได้จาก Dashboard และส่ง context แบบมีขอบเขต
Channel Adapter
- WHY
- LINE และ Web Widget มี event/output contract ต่างกัน
- ALTERNATIVE
- เขียน bot flow แยกตาม channel
- TRADE-OFF
- เพิ่ม abstraction layer หนึ่งชั้น
- RESULT
- bot handler ใช้ interface เดียวและลด channel coupling
Redis + ARQ workers
- WHY
- reminder, campaign, no-show และ feedback ไม่ควรบล็อก API
- ALTERNATIVE
- ทำทั้งหมดใน request process
- TRADE-OFF
- ต้องดูแล queue และ worker เพิ่ม
- RESULT
- งานตามเวลาแยกจาก synchronous conversation path
SECURITY & GOVERNANCE
Be explicit about what exists—and what must come next.
Current controls แยกจาก Recommended controls เพื่อไม่ทำให้ maturity ของระบบถูกตีความเกินจริง
Verified ingress
- X-Line-Signature verification
- Tenant & plan limit check
- Token encryption in LINE Service
Operational control
- Human handoff state
- Admin Audit Service
- Conversation and usage logs
AI safety controls
- Prompt-injection test suite
- Sensitive-data redaction policy
- Structured-output validation at every tool boundary
Reliability controls
- Explicit retry / timeout policy
- Model fallback strategy
- Alerting and quality monitoring
PERFORMANCE & COST
Measure before optimizing.
ไม่มี latency, token หรือ cost metrics ในเอกสาร จึงนำเสนอเป็น measurement framework โดยไม่สร้าง KPI สมมติ
Model usage
AI message quota exists per plan
Track tokens, latency and cost by tenant/model
Context size
Conversation context + RAG knowledge are provided
Measure retrieval relevance and trim low-value context
Background load
ARQ separates scheduled work from API
Add queue depth, execution time and failure-rate monitoring
Repeated work
Redis is present for cache/pubsub/ARQ
Define and measure safe cache policies for repeated reads
BUSINESS IMPACT
Before and after—without invented KPIs.
ผลกระทบเชิงคุณภาพที่อนุมานได้ตรงจาก architecture และ workflow; ตัวเลขควรเติมเมื่อมี production baseline
BEFORE
Channel-specific bot handlingAFTER
Channel Adapter normalizes LINE and Web WidgetBEFORE
Staff must remain in every conversationAFTER
AI handles supported intents with explicit human handoffBEFORE
Time-based tasks compete with request workAFTER
ARQ workers run reminders, campaigns, no-show and feedbackBEFORE
Clinic knowledge is disconnected from the modelAFTER
Knowledge Base feeds RAG context through pgvectorSCALABILITY
Scale the boundaries, not the complexity.
Current architecture มีจุดแยกที่เหมาะกับการ scale; กลยุทธ์ด้านล่างคือ proposed evolution ไม่ใช่สิ่งที่อ้างว่า implement แล้ว
API
- CURRENT
- FastAPI service layer
- GROWTH CHALLENGE
- Concurrent channels and tenant growth
- SCALING STRATEGY
- Horizontal replicas behind a load balancer
Jobs
- CURRENT
- Redis + ARQ worker
- GROWTH CHALLENGE
- Campaign and reminder bursts
- SCALING STRATEGY
- Worker pools, priority queues and idempotent jobs
Data
- CURRENT
- PostgreSQL + pgvector
- GROWTH CHALLENGE
- Transactional and retrieval load
- SCALING STRATEGY
- Indexes, connection pooling, read strategy and vector tuning
AI
- CURRENT
- Gemini with context/RAG/tools
- GROWTH CHALLENGE
- Latency, token cost and quota
- SCALING STRATEGY
- Model routing, context budgets, caching and evaluation gates
Operations
- CURRENT
- Audit and usage logs
- GROWTH CHALLENGE
- Cross-tenant incident diagnosis
- SCALING STRATEGY
- Central observability with tenant-aware SLOs
FUTURE ROADMAP
Foundation → confidence → scale → expansion.
Roadmap ให้ความสำคัญกับ measurement และ governance ก่อนขยาย AI footprint
NOW
Connected foundation
Implemented- LINE + Web Widget channels
- Gemini RAG and tool calling
- Appointment and handoff workflows
- ARQ scheduled operations
NEXT
Measure & harden
Recommended- AI evaluation dataset
- Token/latency/cost dashboard
- Retry, timeout and fallback policy
- Prompt-injection testing
SCALE
Tenant-aware operations
Future- Horizontal service scaling
- Queue isolation and priorities
- SLOs and alerting by tenant
- Database/vector performance program
EXPAND
Governed AI growth
Future- Model routing by use case
- Approval gates for high-risk tools
- Knowledge quality lifecycle
- Selective channel/payment expansion
FROM AI ENGINEER TO AI MANAGER
Manage the whole system of value.
AI leadership คือการเชื่อม business, model behavior, architecture, people, risk, cost และ governance ให้ตัดสินใจร่วมกันได้
MANAGERUnderstand · Design
Build · Scale · Manage
Business
เริ่มจาก patient journey และ operational value ก่อนเลือก AI
AI
จำกัดขอบเขต model ด้วย knowledge, tools และ handoff
Technology
แยก service boundary เพื่อให้ทีมเปลี่ยนและ scale ได้
People
กำหนดจุดที่ AI ทำงาน และจุดที่ staff ต้องรับผิดชอบ
Risk & Cost
วัด usage, ควบคุม tenant quota และออกแบบ guardrails
Governance
สร้าง auditability, evaluation และมาตรฐานก่อนขยาย use case
KEY TAKEAWAYS
ClinicBot, remembered in five ideas.
Business-driven AI
Grounded intelligence
Controlled automation
Scalable service boundaries
Governance before expansion
THIS IS NOT JUST A CHATBOT.