個人健康記錄(PHR)應用程式後端模板
用戶擁有的醫療文件、過敏原追蹤和疫苗接種記錄
一個生產就緒的 個人健康記錄後端 在 Back4app,具備醫療文件存儲、過敏和疫苗接種歷史、藥物及實驗室模型、同意/共享、審計日誌、ER 圖,以及快速啟動的 AI 代理 提示。
關鍵要點
此模板為您提供了一個以用戶為中心的 PHR 後端,具備文件儲存、過敏、免疫接種、藥物、實驗室結果、同意對象和審計日誌,可以快速交付隱私優先的健康應用。
- 用戶控制的健康數據 — 以病人為中心:記錄和同意由用戶的帳戶擁有和控制,能夠與 Provider 進行選擇性共享。
- 結構化臨床實體 — 使用類型化字段建模過敏、免疫接種、藥物和實驗室結果,以便準確查詢和用戶體驗顯示。
- 文件上傳和版本控制 — 儲存 PDF、圖像和結構化文件,並附帶元數據和上傳歷史,以支持臨床工作流程。
- 基於同意的共享 — 通過同意對象和時間限制的權限授予細粒度的 Provider 存取權。
- 跨平台準備 — 使用統一的 REST 和 GraphQL API 以及 Live Queries 來為移動端、網頁和 Provider 門戶提供實時更新。
什麼是個人健康記錄 (PHR) 應用後端模板?
Back4app 是一種後端即服務 (BaaS),用於快速產品交付。PHR 應用後端模板是一個預構建的 schema,涵蓋醫療文件、過敏、免疫接種、藥物、實驗室結果、Provider、同意和審計日誌。連接您的前端(React、Flutter、Next.js 等)並加快交付。
最佳用於:
概覽
一個現代的個人健康記錄產品需要安全的以用戶為中心的文件存儲、準確的過敏和免疫記錄、用藥歷史以及一個可用於與 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 靈活性: 持續記錄共享事件的審計日誌和記錄變更,同時為網絡和移動客戶端提供 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,使健康文件、過敏、免疫接種、藥物和檢驗結果條目僅可由紀錄擁有者和授權的 Provider 閱讀和寫入。
基於同意的分享
使用 Consent 類別授予 Provider 明確範圍和到期的訪問權限;Cloud Code 在讀取/下載端點上強制執行同意檢查。
僅追加的審計日誌
保持 AuditLog 條目僅供標準用戶追加;只有受信任的後端流程或管理員可以寫入或管理歷史日誌。
架構 (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(布林值,預設為真)。 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 讀取/下載之前會驗證同意。對於標準用戶,AuditLog 條目為追加式。 身份驗證: - 用戶帳戶的註冊、登錄、登出。支持具有有限權限的 Provider 帳戶。 行為: - 認證、列出用戶記錄、上傳 HealthDocument、創建結構化的 Allergy/Immunization/Medication/LabResult 條目、創建同意以與 Provider 分享選定的記錄,並為關鍵事件寫入 AuditLog 條目。 交付: - Back4app 應用,包含架構、ACL、CLP;安全文檔庫的前端,過敏和免疫接種時間表,藥物清單,實驗室結果視圖,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 APIs 用於 個人健康紀錄
靈活的API訪問,無縫整合各種前端。
實時更新 個人健康紀錄
對健康紀錄和狀態變更的即時通知。
擴展性 個人健康紀錄
輕鬆添加自定義功能和模組以滿足特定需求。
個人健康紀錄框架比較
比較所有支持技術的設置速度、SDK風格和AI支持。
| 框架 | 設置時間 | 個人健康紀錄的好處 | SDK 類型 | AI 支援 |
|---|---|---|---|---|
| 少於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 的個人健康紀錄網頁UI。 | Typed SDK | 完整 | |
| ~5分鐘 | 企業網頁應用的個人健康紀錄。 | Typed SDK | 完整 | |
| 快速(2分鐘)設置 | 靈活的 GraphQL API 用於個人健康紀錄。 | GraphQL API | 完整 | |
| ~2分鐘 | REST API 整合的個人健康紀錄。 | REST API | 完整 | |
| 少於5分鐘 | 伺服器端 PHP 後端的個人健康紀錄。 | REST API | 完整 | |
| 快速(5分鐘)設置 | .NET 後端的個人健康紀錄。 | Typed SDK | 完整 |
設置時間反映從專案啟動到首次文檔上傳和使用此模板架構的同意流程的預期持續時間。
常見問題
有關使用此模板建立個人健康紀錄後端的常見問題。