Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 70 additions & 85 deletions resources/templates/surgery-opnote.hbs
Original file line number Diff line number Diff line change
@@ -1,94 +1,79 @@
<h1 class='text-2xl text-center bold'>
{{settings.hospital}}
</h1>
<h2 class='text-lg pt-1 text-center'>
{{settings.unit}}
</h2>
<div class='document'>
<!-- Header Section -->
<div class='header-section keep-together'>
<h1 class='text-2xl bold'>
{{settings.hospital}}
</h1>
<h2 class='text-lg pt-1'>
{{settings.unit}}
</h2>
{{#if settings.telephone}}
<p class='text-sm pt-1'>
Tel: {{settings.telephone}}
</p>
{{/if}}
</div>

<div class='grid grid-cols-3 gap-2 mt-3 p-3'>
<p>
<span class='bold'>
Name:
</span>
{{patient.name}}
</p>
<p>
<span class='bold'>
Age:
</span>
{{patient.age}}
</p>
<p>
<span class='bold'>
Gender:
</span>
{{patient.gender}}
</p>
<p>
<span class='bold'>
Ward:
</span>
{{surgery.ward}}
</p>
<p>
<span class='bold'>
BHT:
</span>
{{surgery.bht}}
</p>
<p>
<span class='bold'>
Date:
</span>
{{surgery.date}}
</p>
</div>
<!-- Patient Info Table -->
<table class='info-table keep-together'>
<tr>
<td class='label'>Name:</td>
<td colspan='3'>{{patient.name}}</td>
</tr>
<tr>
<td class='label'>BHT:</td>
<td>{{surgery.bht}}</td>
<td class='label'>Date:</td>
<td>{{surgery.date}}</td>
</tr>
<tr>
<td class='label'>Age/Sex:</td>
<td>{{patient.age}} / {{patient.gender}}</td>
<td class='label'>Ward:</td>
<td>{{surgery.ward}}</td>
</tr>
</table>

<hr />
<!-- Surgery Title -->
<div class='surgery-title keep-together'>
<h2 class='text-lg text-center bold'>
{{surgery.title}}
</h2>
</div>

<h2 class='text-lg mt-3 text-center p-3'>
{{surgery.title}}
</h2>
<!-- Doctors Section -->
<div class='doctors-section keep-together'>
{{#if surgery.doneBy.length}}
<div class='doctor-row'>
<span class='doctor-label'>Done By:</span>
<span>{{surgery.doneByAsString}}</span>
</div>
{{/if}}
{{#if surgery.assistedBy.length}}
<div class='doctor-row'>
<span class='doctor-label'>Assisted By:</span>
<span>{{surgery.assistedByAsString}}</span>
</div>
{{/if}}
</div>

<div class='flex flex-col'>
{{#if surgery.doneBy.length}}
<div class='p-1 flex'>
<span class='bold mr-1'>
Done By:
</span>
<span>
{{surgery.doneByAsString}}
</span>
<!-- Op Notes Section -->
{{#if surgery.notes}}
<div class='notes-section'>
<div class='section-header keep-together'>Op Notes</div>
<div class='prose'>
{{{surgery.notes}}}
</div>
</div>
{{/if}}
{{#if surgery.assistedBy.length}}
<div class='p-1 flex'>
<span class='bold mr-1'>
Assisted By:
</span>
<span>
{{surgery.assistedByAsString}}
</span>

<!-- Post-Op Notes Section -->
{{#if surgery.post_op_notes}}
<div class='notes-section'>
<div class='section-header keep-together'>Post-Op Notes</div>
<div class='prose'>
{{{surgery.post_op_notes}}}
</div>
</div>
{{/if}}
</div>

{{#if surgery.notes}}
<div class='p-1'>
<div class='prose'>
{{{surgery.notes}}}
</div>
</div>
{{/if}}

{{#if surgery.post_op_notes}}
<hr />
<div class='p-1'>
<h2 class='text-md mt-3 text-center p-3'>
Post-Op Notes
</h2>
<div class='prose'>
{{{surgery.post_op_notes}}}
</div>
</div>
{{/if}}
4 changes: 3 additions & 1 deletion src/main/db/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import * as m_000_init from './migrations/000_init'
import * as m_001_app_settings from './migrations/001_app_settings'
import * as m_002_telephone_setting from './migrations/002_telephone_setting'

export default {
'000_init': m_000_init,
'001_app_settings': m_001_app_settings
'001_app_settings': m_001_app_settings,
'002_telephone_setting': m_002_telephone_setting
}
13 changes: 13 additions & 0 deletions src/main/db/migrations/002_telephone_setting.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Kysely } from 'kysely'

export async function up(db: Kysely<any>): Promise<void> {
await db
.insertInto('app_settings')
.values({ key: 'telephone', value: null, display_name: 'Telephone' })
.execute()
}

export async function down(_db: Kysely<any>): Promise<void> {
// down
}
3 changes: 2 additions & 1 deletion src/renderer/src/lib/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const surgeryPrintData = (
},
settings: {
hospital: settings?.hospital || '',
unit: settings?.unit || ''
unit: settings?.unit || '',
telephone: settings?.telephone || ''
}
})
25 changes: 22 additions & 3 deletions src/renderer/src/routes/settings/settings-index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import toast from 'react-hot-toast'

const formSchema = z.object({
hospital: z.string(),
unit: z.string()
unit: z.string(),
telephone: z.string()
})

type FormSchema = z.infer<typeof formSchema>
Expand All @@ -35,7 +36,8 @@ export const SettingsIndex = () => {
resolver: zodResolver(formSchema),
defaultValues: {
hospital: '',
unit: ''
unit: '',
telephone: ''
}
})
const { setBreadcrumbs } = useBreadcrumbs()
Expand All @@ -48,7 +50,8 @@ export const SettingsIndex = () => {
if (settings) {
form.reset({
hospital: settings['hospital'] || '',
unit: settings['unit'] || ''
unit: settings['unit'] || '',
telephone: settings['telephone'] || ''
})
}
}, [form, settings])
Expand Down Expand Up @@ -112,6 +115,22 @@ export const SettingsIndex = () => {
</FormItem>
)}
/>
<FormField
name="telephone"
control={form.control}
render={({ field }) => (
<FormItem>
<FormLabel>Telephone</FormLabel>
<FormControl>
<Input placeholder="Telephone Number" {...field} />
</FormControl>
<FormDescription>
Contact telephone number, this will be used when printing BHT
</FormDescription>
<FormMessage />
</FormItem>
)}
/>

<div className="flex justify-start mt-2">
<Button
Expand Down
Loading