{{template "base.html" .}} {{define "nav"}}
All Patients Home {{if .Practitioner}}
{{if .Practitioner.FirstName}}{{slice .Practitioner.FirstName 0 1}}{{end}}{{if .Practitioner.LastName}}{{slice .Practitioner.LastName 0 1}}{{end}}
Dr. {{.Practitioner.LastName}}
{{end}}
{{end}} {{define "content"}} {{/* ---- Flash Messages ---- */}} {{if .Synced}}
Sync complete Data has been refreshed from the EHR.
{{end}} {{if .Patient}}
{{/* ---- Top Header: Patient Banner ---- */}}
{{if .Patient.FirstName}}{{slice .Patient.FirstName 0 1}}{{end}}{{if .Patient.LastName}}{{slice .Patient.LastName 0 1}}{{end}}

{{.Patient.LastName}}, {{.Patient.FirstName}} {{.Patient.MiddleName}}

MRN: {{orDash .Patient.MRN}}
DOB: {{formatDate .Patient.DOB}} ({{calculateAge .Patient.DOB}} yrs) Gender: {{titleCase .Patient.Gender}} {{with .Patient.Email}}Email: {{.}}{{end}} {{with primaryPhone .RawPatient}}Phone: {{.}}{{end}}
Last Synced: {{if .LatestSync}}{{formatDateTime .LatestSync.SyncedAt}}{{else}}Never{{end}}
{{/* ---- Main Content Column ---- */}}
{{/* Clinical Summary Stats */}}
{{.Summary.ActiveCondCount}}
Active Conditions
{{.Summary.ActiveMedCount}}
Active Medications
{{.Summary.AbnormalLabCount}}
Abnormal Labs (30d)
{{/* Clinical Data Tabs */}}
{{/* ---- Summary Tab ---- */}}

Latest Vital Signs

{{if .Summary.LatestVitals}}
{{range .Summary.LatestVitals}}
{{orDash .CodeText}} {{if .ValueQuantity}}{{printf "%.4g" (derefFloat64 .ValueQuantity)}} {{.ValueUnit}} {{else if .ValueString}}{{.ValueString}} {{else}}—{{end}} {{formatDate .EffectiveDate}}
{{end}}
{{else}}

No vital signs recorded.

{{end}}

Recent Abnormal Labs

{{if .Summary.AbnormalLabsRecent}}
{{range .Summary.AbnormalLabsRecent}} {{end}}
DateTestResultFlag
{{formatDate .EffectiveDate}} {{.CodeText}} {{if .ValueQuantity}}{{printf "%.4g" (derefFloat64 .ValueQuantity)}} {{.ValueUnit}}{{else}}{{.ValueString}}{{end}} {{.Interpretation}}
{{else}}

No abnormal labs in the last 30 days.

{{end}}
{{/* ---- Vitals Tab ---- */}}
{{$vitals := latestObPerCode (filterObsByCategory .Observations "vital-signs")}} {{if $vitals}}
{{range $vitals}}
{{orDash .CodeText}} {{if isAbnormal .Interpretation}}{{.Interpretation}}{{end}}
{{if .ValueQuantity}}{{printf "%.4g" (derefFloat64 .ValueQuantity)}} {{.ValueUnit}} {{else if .ValueString}}{{.ValueString}} {{else}}—{{end}}
{{formatDate .EffectiveDate}} {{if or .ReferenceRangeLow .ReferenceRangeHigh}} Ref: {{if .ReferenceRangeLow}}{{printf "%.4g" (derefFloat64 .ReferenceRangeLow)}}{{else}}—{{end}}-{{if .ReferenceRangeHigh}}{{printf "%.4g" (derefFloat64 .ReferenceRangeHigh)}}{{else}}—{{end}} {{end}}
{{end}}
{{else}}

No vital signs found.

{{end}}
{{/* ---- Labs Tab ---- */}}
{{$labs := filterObsByCategory .Observations "laboratory"}} {{if $labs}}
{{range $labs}} {{end}}
DateTestResultRef RangeFlag
{{formatDate .EffectiveDate}} {{orDash .CodeText}} {{if .ValueQuantity}}{{printf "%.4g" (derefFloat64 .ValueQuantity)}} {{.ValueUnit}} {{else if .ValueString}}{{.ValueString}} {{else}}—{{end}} {{if or .ReferenceRangeLow .ReferenceRangeHigh}} [{{if .ReferenceRangeLow}}{{printf "%.4g" (derefFloat64 .ReferenceRangeLow)}}{{else}}—{{end}} – {{if .ReferenceRangeHigh}}{{printf "%.4g" (derefFloat64 .ReferenceRangeHigh)}}{{else}}—{{end}}] {{else}}—{{end}} {{if isAbnormal .Interpretation}}{{.Interpretation}}{{else if .Interpretation}}{{.Interpretation}}{{end}}
{{else}}

No lab results found.

{{end}}
{{/* ---- Conditions Tab ---- */}}
{{if .Conditions}}
{{range .Conditions}} {{end}}
OnsetConditionStatusVerification
{{formatDate (or .OnsetDate .RecordedDate)}} {{orDash .CodeText}} {{if eq .ClinicalStatus "active"}}Active{{else}}{{.ClinicalStatus}}{{end}} {{titleCase .VerificationStatus}}
{{else}}

No conditions found.

{{end}}
{{/* ---- Medications Tab ---- */}}
{{if .Medications}}
{{range .Medications}} {{end}}
AuthoredMedicationDosageStatus
{{formatDate .AuthoredOn}} {{orDash .MedCodeText}} {{orDash .DosageText}} {{if eq .Status "active"}}Active{{else}}{{.Status}}{{end}}
{{else}}

No medications found.

{{end}}
{{/* ---- Allergies Tab ---- */}}
{{if .Allergies}}
{{range .Allergies}} {{end}}
AllergenReactionSeverityStatus
{{orDash .CodeText}} {{orDash .ReactionManifestation}} {{if eq .ReactionSeverity "severe"}}Severe{{else if .ReactionSeverity}}{{.ReactionSeverity}}{{else}}—{{end}} {{titleCase .ClinicalStatus}}
{{else}}

No allergies found.

{{end}}
{{/* ---- Notes Tab ---- */}}
{{if .DocumentReferences}}
{{range .DocumentReferences}}
{{formatDate .Date}} {{orDash .TypeText}} {{if .ContentURL}}View Document{{end}}

{{orDash .Description}}

{{end}}
{{else}}

No clinical notes found.

{{end}}
{{/* ---- More Tab (Procedures, Immunizations, Encounters) ---- */}}

Recent Procedures

{{if .Procedures}}
    {{range (slice .Procedures 0 (min (len .Procedures) 5))}}
  • {{formatDate .PerformedDate}}: {{.CodeText}}
  • {{end}}
{{else}}

None recorded

{{end}}

Recent Immunizations

{{if .Immunizations}}
    {{range (slice .Immunizations 0 (min (len .Immunizations) 5))}}
  • {{formatDate .OccurrenceDate}}: {{.VaccineText}}
  • {{end}}
{{else}}

None recorded

{{end}}

Recent Encounters

{{if .Encounters}}
    {{range (slice .Encounters 0 (min (len .Encounters) 5))}}
  • {{formatDate .PeriodStart}}: {{or .TypeText "Visit"}}
  • {{end}}
{{else}}

None recorded

{{end}}
{{/* ---- Sidebar Column ---- */}}
{{/* High Priority: Alerts */}} {{if hasCriticalAllergies .Allergies}}

Critical Alerts

{{range .Allergies}} {{if eq .Criticality "high"}}
{{.CodeText}} Allergy {{with .ReactionManifestation}}{{.}}{{with $.ReactionSeverity}} ({{.}}){{end}}{{end}}
{{end}} {{end}}
{{end}} {{/* Patient Details (Expanded) */}}

Patient Information

Full Name {{.Patient.FirstName}} {{.Patient.MiddleName}} {{.Patient.LastName}}
FHIR ID {{.Patient.FHIRID}}
{{with primaryAddress .RawPatient}}
Address {{.}}
{{end}} {{with usRace .RawPatient}}
Race {{.}}
{{end}} {{with usEthnicity .RawPatient}}
Ethnicity {{.}}
{{end}}
{{/* Low Priority: SMART Inspector */}}
System Inspector
EHR Server {{.Session.EHRURL}}
Granted Scopes
{{range (split .Session.Scope " ")}} {{.}} {{end}}
{{end}} {{end}} {{define "scripts"}} {{end}}