BloodSugarApp
面向动态血糖仪管理场景的 Android 智能血糖管理应用,支持 BLE 连接、血糖数据记录与分析、健康报告和 AI 健康助手。
BloodSugar App is an Android application for continuous glucose management workflows. Built with Kotlin and Jetpack Compose, it brings together Bluetooth Low Energy (BLE) device connectivity, glucose tracking and visualisation, health reports, and an AI-powered health assistant in one project.
Note: This repository is provided for learning and reference only. It is not a medical device and must not replace professional medical advice, diagnosis, or treatment.
English Overview
BloodSugar App is a modular Android project that demonstrates how a modern glucose-management experience can be designed with Clean Architecture and Jetpack Compose. It supports manual records, CSV imports, BLE data synchronisation, trend analysis, personalised goals, and a RAG-based assistant for health-related questions.
Highlights
- Modern Android stack — Kotlin, Jetpack Compose, Material 3, and Navigation Compose.
- Connected data flow — BLE connectivity and CSV import for bringing glucose data into one place.
- Insights at a glance — dashboards, trends, target-range statistics, and health reports.
- AI assistant architecture — multi-model provider support and retrieval-augmented generation (RAG) for contextual responses.
- Maintainable by design — a clear Data → Domain → UI structure that is easy to explore and extend.
功能特性
- 📊 血糖仪表盘 — 实时血糖数据展示,趋势图可视化
- 📝 血糖记录 — 手动添加或蓝牙自动同步血糖数据,支持 CSV 导入
- 📈 健康报告 — 多维度血糖分析报告,包含波动趋势、达标率统计
- 🤖 AI 健康建议 — 基于 RAG 知识库的智能饮食/运动/用药建议
- 💬 AI 对话 — 内置健康助手对话功能,实时解答血糖管理问题
- 📡 蓝牙连接 — 支持蓝牙 BLE 连接动态血糖仪,自动同步数据
- 👤 用户管理 — 个人档案管理,个性化目标设定
- 🌙 深色主题 — Material3 设计风格,支持日间/夜间模式
Features (English)
- 📊 Glucose dashboard — View current glucose data and trends in a clear, visual dashboard.
- 📝 Glucose records — Add readings manually, synchronise them from a BLE device, or import CSV files.
- 📈 Health reports — Explore multi-dimensional reports with variability trends and time-in-range statistics.
- 🤖 AI health guidance — Receive RAG-powered, context-aware suggestions for diet, activity, and medication-related questions.
- 💬 AI chat — Ask the built-in health assistant questions about glucose-management workflows.
- 📡 Bluetooth connectivity — Connect compatible continuous glucose monitoring devices over Bluetooth Low Energy (BLE) and synchronise readings automatically.
- 👤 Personal profiles — Manage user profiles and set personalised glucose targets.
- 🌙 Dark theme — Enjoy a Material 3 interface with light and dark appearance modes.
技术架构
| 类别 | 技术选型 |
|---|---|
| 语言 | Kotlin |
| UI 框架 | Jetpack Compose + Material3 |
| 架构 | Clean Architecture (Data → Domain → UI) |
| 导航 | Navigation Compose |
| 蓝牙 | Android BLE API |
| AI 引擎 | 多模型支持(详见 docs/AI_TECH_SELECTION.md) |
| 知识库 | RAG 检索增强生成 |
| 最低 SDK | Android 8.0 (API 26) |
| 目标 SDK | Android 14 (API 34) |
项目结构
BloodSugarApp/
├── app/src/main/java/com/bloodsugar/
│ ├── data/ # 数据层
│ │ ├── ai/ # AI 服务提供者
│ │ ├── model/ # 数据模型
│ │ └── repository/ # 数据仓库
│ ├── domain/ # 业务层
│ │ ├── advice/ # 建议引擎
│ │ ├── agent/ # AI 健康助手
│ │ ├── analysis/ # 血糖分析器
│ │ ├── bluetooth/ # 蓝牙管理
│ │ └── rag/ # 知识库检索
│ ├── ui/ # UI 层
│ │ ├── advice/ # 建议页面
│ │ ├── bluetooth/ # 蓝牙页面
│ │ ├── chat/ # AI 对话
│ │ ├── dashboard/ # 仪表盘
│ │ ├── glucose/ # 血糖记录
│ │ ├── profile/ # 个人中心
│ │ ├── report/ # 报告页面
│ │ ├── navigation/ # 导航控制
│ │ └── theme/ # 主题配置
│ └── util/ # 工具类
└── docs/ # 项目文档
├── PRODUCT_DESIGN_V5.md # 产品设计文档
├── PRODUCT_PLAN_V5.md # 产品规划文档
├── AI_TECH_SELECTION.md # AI 技术选型
├── AI_MODEL_COMPARISON.md # AI 模型对比
├── AI_ACCURACY_COMPARISON.md # AI 准确性对比
├── AI_BADCASE_OPTIMIZATION.md # AI 坏案例优化
└── COMMERCIAL_STRATEGY.md # 商业化策略
构建运行
环境要求
- Android Studio Hedgehog (2023.1.1) 或更高版本
- JDK 17
- Kotlin 1.9.21
- Gradle 8.4
构建步骤
# 克隆项目
git clone https://github.com/huyujie275-gif/BloodSugarApp.git
# 进入项目并构建
cd BloodSugarApp
./gradlew assembleDebug
# 安装到设备
./gradlew installDebug
或直接使用 Android Studio 打开项目,点 ▶ 运行即可。
版本历史
| 版本 | 日期 | 主要更新 |
|---|---|---|
| v4.1.0 | 2026-01 | 最新正式版,AI 建议优化 |
| v4.0.x | 2026-01 | AI 模块重构,RAG 知识库 |
| v3.0.0 | 2025-12 | Compose 全面迁移,UI 重设计 |
| v2.x | 2025-12 | 蓝牙连接、CSV 导入 |
| v1.x | 2025-11 | 基础功能:记录、报告、建议 |
许可证
本项目仅供学习和参考使用。
Built with ❤️ using Kotlin + Jetpack Compose
