const { data: doc } = await clinik.documents.create({
status: 'final',
type: 'discharge-summary',
category: ['clinical', 'inpatient'],
patientId: 'pt_abc123',
encounterId: 'enc_xyz789',
practitionerId: 'prac_def456',
title: 'Discharge Summary - Jane Doe - Jan 15, 2025',
date: '2025-01-15',
confidentiality: 'N',
attester: [{
mode: 'professional',
time: '2025-01-15T16:00:00Z',
partyId: 'prac_attending',
}],
custodianId: 'org_hospital',
event: [{
code: [{ code: 'inpatient-stay', display: 'Inpatient Stay' }],
period: { start: '2025-01-12', end: '2025-01-15' },
}],
sections: [
{
title: 'Chief Complaint',
code: 'chief-complaint',
text: 'Patient admitted for evaluation of acute chest pain.',
},
{
title: 'Hospital Course',
code: 'hospital-course',
text: 'Cardiac workup negative. Discharged in stable condition.',
authorId: 'prac_resident', // Resident wrote this section
},
{
title: 'Discharge Medications',
code: 'medications',
text: 'Continue aspirin 81mg daily, atorvastatin 20mg daily.',
resourceIds: ['rx_aspirin', 'rx_statin'],
},
{
title: 'Follow-up',
code: 'follow-up',
text: 'PCP: 1 week. Cardiology: 4 weeks.',
},
],
});