主要收获
此模板为您提供以用户为中心的 PHR 后端,具有文档存储、过敏、疫苗接种、药物、实验室结果、同意对象和审核日志,以便您可以快速交付以隐私为先的健康应用程序。
- 用户控制的健康数据 — 以患者为中心:记录和同意由用户的帐户所有和控制,使得可以与 Provider 进行选择性共享。
- 结构化临床实体 — 通过类型化字段建模过敏、疫苗接种、药物和实验室结果,以便进行准确查询和用户体验展示。
- 文档上传和版本管理 — 存储 PDF、图像和带有元数据和上传历史的结构化文档,以支持临床工作流程。
- 基于同意的共享 — 通过同意对象和时间限制的权限授予 Provider 细粒度访问。
- 跨平台准备 — 使用统一的 REST 和 GraphQL API 以及 Live Queries 进行实时更新,支持移动端、Web 和 Provider 门户。
什么是个人健康记录(PHR)应用后端模板?
Back4app 是一种后端即服务 (BaaS),用于快速产品交付。PHR 应用后端模板是针对医疗文档、过敏、免疫接种、药物、实验室结果、Provider、同意和审核日志的预构建模式。连接你的前端(React、Flutter、Next.js 等)并加速交付。
最佳适用:
概览
现代 PHR 产品需要安全的用户优先文件存储、准确的过敏和免疫接种记录、药物历史和与 Provider 分享数据的同意模型。
此模板定义了 HealthDocument、Allergy、Immunization、Medication、LabResult、Provider、Consent 和 AuditLog,并包含所有权规则和可扩展工作流程,以便团队可以快速且合规地实现 PHR 应用。
核心 PHR 功能
此中心中的每个技术卡片使用相同的PHR后端架构,包括HealthDocument、Allergy、Immunization、Medication、LabResult、Provider、Consent和AuditLog。
医疗文件库
上传和管理带有元数据和所有者指针的 PDF、图片和结构化记录的版本。
过敏和 React 追踪
记录过敏原、React、严重程度和与所有者关联的发作日期。
免疫和疫苗接种历史
记录疫苗名称、接种日期、批号和Provider参考信息。
药物清单和时间表
存储活动和历史药物的剂量、频率和说明。
实验室结果
存储带有数值、单位、参考范围和附件的实验室结果。
同意和共享控制
授予Provider特定的访问权限,带有到期和范围。
集中审计日志
记录操作人、操作、目标和有效负载元数据以便于追踪。
为什么选择用 Back4app 构建您的 PHR 后端?
Back4app 为 PHR 应用程序提供核心基础设施,让您的团队可以专注于用户体验、同意体验和集成,而不是后端管道。
- •以用户为中心的数据所有权: 实施所有权规则和同意对象,使患者能够控制谁可以查看或下载他们的记录。
- •安全的文档和元数据存储: 上传带有元数据、版本以及指向实验室和免疫接种等结构化数据的临床文档。
- •审计性 + API 灵活性: 持久化共享事件的审计日志和记录更改,同时为 Web 和移动客户端提供 REST 和 GraphQL。
快速交付以隐私为首的 PHR 后端,具备可扩展的存储、身份验证和跨所有平台的 API。
核心优势
一个帮助您提供隐私优先的健康体验的 PHR 后端,同时保持数据的结构化和可审计性。
市场速度
从一个完整的 PHR 模式开始,而不是从头设计临床实体和同意流程。
以患者为中心的访问控制
使患者能够管理同意并有选择性地与 Provider 和应用程序共享记录。
可互操作的数据模型
使用结构化的免疫接种、药物和实验室模型进行集成和分析。
细粒度权限
使用 ACL/CLP 和同意对象,使访问显式且可审计。
可靠的审计追踪
记录访问和共享事件,以确保透明度和合规性。
AI辅助引导流程
快速生成后端架构和集成指导,使用预构建的AI代理提示。
技术栈
这个PHR后端模板中包含所有内容。
ER图
PHR 后端架构的实体关系模型。
涵盖用户拥有的医疗文件、过敏、免疫接种、药物、实验室结果、同意和审计日志的模式。
查看图表来源
erDiagram
Profile ||--o{ MedicalDocument : "owns"
Profile ||--o{ Allergy : "has"
Profile ||--o{ Vaccination : "has"
Profile ||--o{ SharedAccess : "grants"
Profile ||--o{ EmergencyContact : "links to"
MedicalDocument }o--|| Profile : "profile"
Vaccination }o--|| Profile : "profile"
Allergy }o--|| Profile : "profile"
SharedAccess }o--|| Profile : "profile"
SharedAccess }o--|| _User : "grantee"
Profile {
String objectId PK
Pointer user FK
String fullName
Date birthDate
String gender
String bloodType
String primaryCareProvider
String notes
Date createdAt
Date updatedAt
}
MedicalDocument {
String objectId PK
Pointer profile FK
File file
String documentType
String title
String description
Array<String> tags
Date uploadedAt
Boolean isShared
Date createdAt
Date updatedAt
}
Allergy {
String objectId PK
Pointer profile FK
String substance
String severity
String reaction
String notes
Date recordedAt
Boolean isActive
Date createdAt
Date updatedAt
}
Vaccination {
String objectId PK
Pointer profile FK
String vaccineName
Date dateAdministered
String dose
String lotNumber
String provider
Date nextDoseDate
Pointer proofDocument FK
Date createdAt
Date updatedAt
}
SharedAccess {
String objectId PK
Pointer profile FK
Pointer grantee FK
String accessLevel
Array<String> scope
Date expiresAt
Pointer createdBy FK
Date createdAt
Date updatedAt
}
EmergencyContact {
String objectId PK
Pointer profile FK
String name
String relationship
String phone
String notes
Date createdAt
Date updatedAt
}
AuditLog {
String objectId PK
Pointer actor FK
String entityType
String entityId
String action
String summary
Object metadata
Date createdAt
Date updatedAt
}
集成流程
身份验证、记录访问、文档上传、授予同意和审计日志的典型运行流程。
查看图表来源
sequenceDiagram
participant User
participant App as Personal Health Record (PHR) App
participant Back4app as Back4app Cloud
User->>App: Login with email (patient) or OAuth (clinician)
App->>Back4app: POST /login
Back4app-->>App: Session token + user profile
User->>App: List my vaccinations and allergies
App->>Back4app: GET /classes/Vaccination?where={"profile":{"__type":"Pointer","className":"Profile","objectId":"profileId"}}
Back4app-->>App: Vaccination and Allergy records
User->>App: Upload lab result PDF
App->>Back4app: POST /files -> create MedicalDocument with file pointer
Back4app-->>App: File object + MedicalDocument.objectId
User->>App: Share record with Dr. Lee for 48h
App->>Back4app: POST /classes/SharedAccess with accessLevel and expiresAt
Back4app-->>App: SharedAccess.objectId + notification
Back4app-->>App: Live Query event: MedicalDocument updated by clinician
App-->>User: Notify patient in-app / refresh documents list数据字典
PHR 模式中每个类的完整字段级参考。
| 字段 | 类型 | 描述 | 必需 |
|---|---|---|---|
| objectId | String | Auto-generated unique identifier | 自动 |
| user | Pointer<_User> | Linked Back4app user account (patient or caregiver) | |
| fullName | String | Patient full name | |
| birthDate | Date | Date of birth | — |
| gender | String | Gender identity | — |
| bloodType | String | Blood type (e.g. A+, O-) | — |
| primaryCareProvider | String | Name or clinic of primary care provider | — |
| notes | String | Free-text health notes or summary | — |
| createdAt | Date | Auto-generated creation timestamp | 自动 |
| updatedAt | Date | Auto-generated last-update timestamp | 自动 |
10 字段在 Profile 中
安全性和权限
ACL、CLP、同意对象和云代码如何保护个人健康记录及共享。
患者拥有的记录
设置所有权和ACL,以便 HealthDocument、Allergy、Immunization、Medication 和 LabResult 条目仅由记录所有者和授权的 Provider 可读和可写。
基于同意的共享
使用同意类授予 Provider 明确范围和到期时间的访问权限;云代码在读取/下载端点上强制执行同意检查。
仅附加的审计日志
将审计日志条目仅限附加给标准用户;只有信任的后台流程或管理员可以写入或管理历史日志。
模式 (JSON)
原始 JSON 模式定义,可直接复制到 Back4app 或用作实施参考。
{
"classes": [
{
"className": "Profile",
"fields": {
"objectId": {
"type": "String",
"required": false
},
"user": {
"type": "Pointer",
"required": true,
"targetClass": "_User"
},
"fullName": {
"type": "String",
"required": true
},
"birthDate": {
"type": "Date",
"required": false
},
"gender": {
"type": "String",
"required": false
},
"bloodType": {
"type": "String",
"required": false
},
"primaryCareProvider": {
"type": "String",
"required": false
},
"notes": {
"type": "String",
"required": false
},
"createdAt": {
"type": "Date",
"required": false
},
"updatedAt": {
"type": "Date",
"required": false
}
}
},
{
"className": "MedicalDocument",
"fields": {
"objectId": {
"type": "String",
"required": false
},
"profile": {
"type": "Pointer",
"required": true,
"targetClass": "Profile"
},
"file": {
"type": "File",
"required": true
},
"documentType": {
"type": "String",
"required": true
},
"title": {
"type": "String",
"required": true
},
"description": {
"type": "String",
"required": false
},
"tags": {
"type": "Array",
"required": false
},
"uploadedAt": {
"type": "Date",
"required": true
},
"isShared": {
"type": "Boolean",
"required": true
},
"createdAt": {
"type": "Date",
"required": false
},
"updatedAt": {
"type": "Date",
"required": false
}
}
},
{
"className": "Allergy",
"fields": {
"objectId": {
"type": "String",
"required": false
},
"profile": {
"type": "Pointer",
"required": true,
"targetClass": "Profile"
},
"substance": {
"type": "String",
"required": true
},
"severity": {
"type": "String",
"required": true
},
"reaction": {
"type": "String",
"required": true
},
"notes": {
"type": "String",
"required": false
},
"recordedAt": {
"type": "Date",
"required": true
},
"isActive": {
"type": "Boolean",
"required": true
},
"createdAt": {
"type": "Date",
"required": false
},
"updatedAt": {
"type": "Date",
"required": false
}
}
},
{
"className": "Vaccination",
"fields": {
"objectId": {
"type": "String",
"required": false
},
"profile": {
"type": "Pointer",
"required": true,
"targetClass": "Profile"
},
"vaccineName": {
"type": "String",
"required": true
},
"dateAdministered": {
"type": "Date",
"required": true
},
"dose": {
"type": "String",
"required": false
},
"lotNumber": {
"type": "String",
"required": false
},
"provider": {
"type": "String",
"required": false
},
"nextDoseDate": {
"type": "Date",
"required": false
},
"proofDocument": {
"type": "Pointer",
"required": false,
"targetClass": "MedicalDocument"
},
"createdAt": {
"type": "Date",
"required": false
},
"updatedAt": {
"type": "Date",
"required": false
}
}
},
{
"className": "SharedAccess",
"fields": {
"objectId": {
"type": "String",
"required": false
},
"profile": {
"type": "Pointer",
"required": true,
"targetClass": "Profile"
},
"grantee": {
"type": "Pointer",
"required": true,
"targetClass": "_User"
},
"accessLevel": {
"type": "String",
"required": true
},
"scope": {
"type": "Array",
"required": false
},
"expiresAt": {
"type": "Date",
"required": false
},
"createdBy": {
"type": "Pointer",
"required": true,
"targetClass": "_User"
},
"createdAt": {
"type": "Date",
"required": false
},
"updatedAt": {
"type": "Date",
"required": false
}
}
},
{
"className": "EmergencyContact",
"fields": {
"objectId": {
"type": "String",
"required": false
},
"profile": {
"type": "Pointer",
"required": true,
"targetClass": "Profile"
},
"name": {
"type": "String",
"required": true
},
"relationship": {
"type": "String",
"required": true
},
"phone": {
"type": "String",
"required": true
},
"notes": {
"type": "String",
"required": false
},
"createdAt": {
"type": "Date",
"required": false
},
"updatedAt": {
"type": "Date",
"required": false
}
}
},
{
"className": "AuditLog",
"fields": {
"objectId": {
"type": "String",
"required": false
},
"actor": {
"type": "Pointer",
"required": true,
"targetClass": "_User"
},
"entityType": {
"type": "String",
"required": true
},
"entityId": {
"type": "String",
"required": true
},
"action": {
"type": "String",
"required": true
},
"summary": {
"type": "String",
"required": true
},
"metadata": {
"type": "Object",
"required": false
},
"createdAt": {
"type": "Date",
"required": false
},
"updatedAt": {
"type": "Date",
"required": false
}
}
}
]
}使用 AI 代理构建
使用 Back4app AI 代理从此模板生成真实的个人健康记录应用,包括前端、后端、认证和同意工作流程。
在 Back4app 上创建一个个人健康记录 (PHR) 后端,使用以下确切架构和行为。 架构: 1. HealthDocument: owner(指向用户的指针,必填),title(字符串,必填),file(文件,必填),tags(数组,可选),version(数字,默认1),createdAt,updatedAt(系统)。 2. Allergy: owner(指向用户的指针,必填),substance(字符串,必填),Reaction(字符串,可选),severity(字符串:轻度,中度,重度,必填),onsetDate(日期,可选)。 3. Immunization: owner(指向用户的指针,必填),vaccineName(字符串,必填),administeredAt(日期,必填),lotNumber(字符串,可选),Provider(指向 Provider 的指针,可选)。 4. Medication: owner(指向用户的指针,必填),name(字符串,必填),dose(字符串,可选),frequency(字符串,可选),instructions(字符串,可选),active(布尔值,默认true)。 5. LabResult: owner(指向用户的指针,必填),testName(字符串,必填),value(数字或字符串),units(字符串,可选),referenceRange(字符串,可选),date(日期,必填),attachment(指向HealthDocument的指针,可选)。 6. Provider: name(字符串,必填),systemId(字符串,可选),contact(对象,可选)。 7. Consent: owner(指向用户的指针,必填),Provider(指向 Provider 的指针,必填),scope(字符串数组:[documents, allergies, immunizations, medications, labs]),expiresAt(日期,可选),grantedBy(指向用户或系统的指针)。 8. AuditLog: actor(指向用户的指针,必填),action(字符串,必填),entityType(字符串,必填),entityId(字符串,必填),payload(对象,可选);createdAt,updatedAt(系统)。 安全性: - 使用ACL/CLP,只有所有者和同意的 Provider 可以访问记录。云代码在允许 Provider 读取/下载之前会验证同意。审计日志条目对于普通用户是只追加的。 认证: - 用户账户的注册、登录、注销。支持具有有限权限的 Provider 账户。 行为: - 身份验证,列出用户记录,上传HealthDocument,创建结构化的过敏/免疫/药物/实验结果条目,创建同意以与 Provider 分享选定记录,并为关键事件写入审计日志条目。 交付: - 包含架构、ACL、CLP 的 Back4app 应用;安全文档库的前端,过敏和免疫时间线,药物列表,实验结果视图,Provider 同意流程和审计历史。
按下面的按钮打开带有预填充模板提示的代理。
这是没有技术后缀的基础提示。您可以在之后调整生成的前端技术栈。
API 游乐场
尝试针对 PHR 模式的 REST 和 GraphQL 端点。响应使用模拟数据,无需 Back4app 账户。
使用与此模板相同的模式。
选择您的技术
展开每个卡片以获取集成步骤、状态模式、数据模型示例和离线说明。
Flutter PHR 后端
React PHR 后端
React 原生 PHR 后端
Next.js PHR 后端
JavaScript PHR 后端
Android PHR 后端
iOS PHR 后端
Vue PHR 后端
Angular PHR 后端
GraphQL PHR 后端
REST API PHR 后端
PHP PHR 后端
.NET PHR 后端
您将从每项技术中获得的内容
每个技术栈使用相同的 PHR 后端架构和 API 合同。
统一的个人健康记录数据结构
用于医疗文档和记录的预构建模式。
对于个人健康记录的安全共享
轻松与Provider共享健康信息,同时确保隐私。
个人健康记录的全面审计日志
跟踪对敏感健康数据的所有访问和更改。
用于个人健康记录的REST/GraphQL API
灵活的API访问,无缝集成多种前端。
个人健康记录的实时更新
健康记录和状态变化的即时通知。
个人健康记录的可扩展性
轻松添加自定义功能和模块以满足特定需求。
个人健康记录框架对比
比较所有支持技术的设置速度、SDK风格和AI支持。
| 框架 | 设置时间 | 个人健康记录的好处 | SDK 类型 | 人工智能支持 |
|---|---|---|---|---|
| 在5分钟内 | 移动和网页上的个人健康记录单一代码库。 | Typed SDK | 完整 | |
| ~3–7分钟 | 个人健康记录的快速网页仪表板。 | Typed SDK | 完整 | |
| 快速(5分钟)设置 | 个人健康记录的跨平台移动应用。 | Typed SDK | 完整 | |
| ~5分钟 | 个人健康记录的服务器渲染网页应用。 | Typed SDK | 完整 | |
| ~3分钟 | 个人健康记录的轻量级网页集成。 | Typed SDK | 完整 | |
| 在5分钟内 | 个人健康记录的原生Android应用。 | Typed SDK | 完整 | |
| ~3–7分钟 | 个人健康记录的原生iOS应用。 | Typed SDK | 完整 | |
| 快速(5分钟)设置 | React的个人健康记录网页用户界面。 | Typed SDK | 完整 | |
| ~5分钟 | 个人健康记录的企业网页应用。 | Typed SDK | 完整 | |
| 快速(2分钟)设置 | 灵活的GraphQL API用于个人健康记录。 | GraphQL API | 完整 | |
| ~2分钟 | REST API的个人健康记录集成。 | REST API | 完整 | |
| 在5分钟内 | 个人健康记录的服务器端PHP后台。 | REST API | 完整 | |
| 快速(5分钟)设置 | .NET的个人健康记录后台。 | Typed SDK | 完整 |
设置时间反映从项目启动到首次文档上传和使用此模板方案的同意流程的预期持续时间。
常见问题
关于使用此模板构建个人健康记录后端的常见问题。