Patient Management & EMR
v0.1.0Encrypted PHI at-rest, systemic medical alerts, emergency contacts, and digital informed consent governance.
Patient Management & Electronic Medical Records (EMR)
The Patient & EMR bounded context manages patient demographics, protected health information (PHI), clinical medical alerts, emergency contacts, and chairside informed consent governance.
Every patient record is treated as an aggregate root, enforcing strict data confidentiality under HIPAA Security Rule (45 CFR § 164.312) and GDPR Article 32.
The Patient Aggregate Root
The Patient model represents the primary clinical subject within the dental domain:
+--------------------------------------------------------------+
| Patient |
+--------------------------------------------------------------+
| id: int / uuid |
| medical_record_number: string (unique) |
| first_name: string (encrypted) |
| last_name: string (encrypted) |
| date_of_birth: date |
| ssn: string (encrypted, redacted in logs) |
| phone: string (encrypted) |
| email: string (encrypted) |
| address: json (encrypted) |
| is_active: boolean |
+------------------------------+-------------------------------+
|
+-----------------------+-----------------------+
| | |
+------v-------+ +------v-------+ +------v-------+
| MedicalAlert | | Emergency | | ConsentRecord|
| (Prophylaxis/| | Contact | | (Digital |
| Anticoagulant) | | | Signatures) |
+--------------+ +--------------+ +--------------+
Protected Health Information (PHI) Encryption
When compliance.encrypt_phi is enabled in configuration, all sensitive demographic and clinical fields are encrypted before database persistence using authenticated AES-256-CBC / AES-256-GCM encryption.
- Encrypted Fields:
first_name,last_name,ssn,phone,email,address,notes. - Searchable Identifiers:
medical_record_number(MRN) is hashed or indexed as a unique non-PHI identifier for rapid clinical lookup. - Zero-PHI Audit Logging: Audit log entries store only actor IDs, resource IDs, and action verbs—never unencrypted PHI payloads.
Systemic Medical Health Alerts
Dental surgical interventions require real-time visibility into systemic health conditions. Obelawium Dental classifies medical alerts by clinical severity and tracks high-risk medical invariants:
use Obelaw\Ium\Dental\Enums\AlertSeverity;
enum AlertSeverity: string
{
case LOW = 'low';
case MEDIUM = 'medium';
case HIGH = 'high';
case CRITICAL = 'critical';
}
Critical Medical Invariants
- Antibiotic Prophylaxis (
requires_antibiotic_prophylaxis = true): Required for patients with prosthetic cardiac valves, prior infective endocarditis, or complex congenital heart disease. Clinicians receive automated warnings prior to invasive periodontal probing or surgical extractions. - Anticoagulant Therapy (
anticoagulant_flag = true): Flags patients on blood thinners (Warfarin, Eliquis, Clopidogrel) to prevent uncontrollable intraoral hemorrhages during restorative and surgical encounters.
Digital Informed Consent Governance
Obelawium Dental enforces legally binding, digital informed consent captured chairside via touch-screen or stylus tablets:
use Obelaw\Ium\Dental\Enums\ConsentType;
enum ConsentType: string
{
case TREATMENT = 'treatment';
case BILLING = 'billing';
case IMAGING_CLOUD_SYNC = 'imaging_cloud_sync';
case THIRD_PARTY_PAYMENT = 'third_party_payment';
}
Consent Gating Matrix
| Consent Type | Description | Mandatory Gating Rule |
|---|---|---|
TREATMENT | Informed consent for planned dental procedures. | Treatment plans cannot be moved to APPROVED or executed chairside without a signed token. |
BILLING | Authorization to bill insurance and generate invoices. | External QuickBooks invoice generation is blocked without active billing consent. |
IMAGING_CLOUD_SYNC | Consent to upload diagnostic DICOM studies to off-site cloud storage. | If missing, DICOM files must remain air-gapped on local clinic PACS storage. |
THIRD_PARTY_PAYMENT | Authorization for external financial clearinghouses. | Blocking gate for merchant and third-party dental financing integrations. |
Fluent Service Operations
All patient operations are handled through ium()->dental()->patients():
1. Registering a Patient
use Obelaw\Ium\Dental\Data\CreatePatientDto;
use DateTimeImmutable;
$patient = ium()->dental()->patients()->create(CreatePatientDto::from([
'medical_record_number' => 'MRN-2026-00482',
'first_name' => 'Eleanor',
'last_name' => 'Vance',
'date_of_birth' => new DateTimeImmutable('1988-04-12'),
'ssn' => '123-45-6789',
'phone' => '+1-555-0144',
'email' => 'eleanor.vance@example.com',
'address' => [
'street' => '742 Evergreen Terrace',
'city' => 'Springfield',
'state' => 'IL',
'postal_code' => '62704',
],
'actor_id' => 'USER-FRONTDESK-01',
]));
2. Adding Systemic Medical Alerts
use Obelaw\Ium\Dental\Data\CreateMedicalAlertDto;
use Obelaw\Ium\Dental\Enums\AlertSeverity;
$alert = ium()->dental()->patients()->addMedicalAlert(
patientId: $patient->id,
dto: CreateMedicalAlertDto::from([
'alert_type' => 'cardiovascular',
'allergen_condition' => 'Prosthetic Mitral Valve Replacement',
'severity' => AlertSeverity::CRITICAL,
'requires_antibiotic_prophylaxis' => true,
'anticoagulant_flag' => true,
'notes' => 'Patient requires 2g Amoxicillin 1 hour prior to invasive procedures.',
'actor_id' => 'DR-MARTINEZ',
])
);
3. Recording Chairside Digital Informed Consent
use Obelaw\Ium\Dental\Data\RecordConsentDto;
use Obelaw\Ium\Dental\Enums\ConsentType;
$consent = ium()->dental()->patients()->recordConsent(
patientId: $patient->id,
dto: RecordConsentDto::from([
'patient_id' => $patient->id,
'consent_type' => ConsentType::TREATMENT,
'signature_blob' => 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0...',
'ip_address' => '192.168.1.145',
'device_info' => 'Apple iPad Pro 12.9 (Chairside Operatory 02)',
'actor_id' => 'DR-MARTINEZ',
])
);
4. Checking Active Consent Status
use Obelaw\Ium\Dental\Enums\ConsentType;
// Returns true only if consent was granted and has not been withdrawn
$canSyncQuickBooks = ium()->dental()->patients()->hasActiveConsent(
patientId: $patient->id,
type: ConsentType::BILLING
);
if (! $canSyncQuickBooks) {
// Prohibit transmission to external accounting ledger
}
5. Withdrawing Consent (Right to Revoke)
Under GDPR and HIPAA, patients may withdraw consent at any time. Revocation is recorded immutably:
ium()->dental()->patients()->withdrawConsent(
consentId: $consent->id,
actorId: 'USER-COMPLIANCE-01'
);
Emitted Domain Events
| Event Class | Trigger | Payload |
|---|---|---|
PatientRegistered | Dispatched after atomic creation of patient record. | Patient $patient, ?string $actorId |
MedicalAlertAdded | Dispatched when a new alert or allergy is attached. | MedicalAlert $alert, ?string $actorId |
ConsentGranted | Dispatched when a patient signs digital consent. | ConsentRecord $consent, ?string $actorId |
ConsentWithdrawn | Dispatched when a consent record is revoked. | ConsentRecord $consent, ?string $actorId |