Skip to content

Commit 4c96977

Browse files
authored
Merge pull request #5 from wavezync/feat/hospital-info
Feat/hospital info
2 parents f06c73c + ff24453 commit 4c96977

6 files changed

Lines changed: 382 additions & 98 deletions

File tree

Lines changed: 70 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,79 @@
1-
<h1 class='text-2xl text-center bold'>
2-
{{settings.hospital}}
3-
</h1>
4-
<h2 class='text-lg pt-1 text-center'>
5-
{{settings.unit}}
6-
</h2>
1+
<div class='document'>
2+
<!-- Header Section -->
3+
<div class='header-section keep-together'>
4+
<h1 class='text-2xl bold'>
5+
{{settings.hospital}}
6+
</h1>
7+
<h2 class='text-lg pt-1'>
8+
{{settings.unit}}
9+
</h2>
10+
{{#if settings.telephone}}
11+
<p class='text-sm pt-1'>
12+
Tel: {{settings.telephone}}
13+
</p>
14+
{{/if}}
15+
</div>
716

8-
<div class='grid grid-cols-3 gap-2 mt-3 p-3'>
9-
<p>
10-
<span class='bold'>
11-
Name:
12-
</span>
13-
{{patient.name}}
14-
</p>
15-
<p>
16-
<span class='bold'>
17-
Age:
18-
</span>
19-
{{patient.age}}
20-
</p>
21-
<p>
22-
<span class='bold'>
23-
Gender:
24-
</span>
25-
{{patient.gender}}
26-
</p>
27-
<p>
28-
<span class='bold'>
29-
Ward:
30-
</span>
31-
{{surgery.ward}}
32-
</p>
33-
<p>
34-
<span class='bold'>
35-
BHT:
36-
</span>
37-
{{surgery.bht}}
38-
</p>
39-
<p>
40-
<span class='bold'>
41-
Date:
42-
</span>
43-
{{surgery.date}}
44-
</p>
45-
</div>
17+
<!-- Patient Info Table -->
18+
<table class='info-table keep-together'>
19+
<tr>
20+
<td class='label'>Name:</td>
21+
<td colspan='3'>{{patient.name}}</td>
22+
</tr>
23+
<tr>
24+
<td class='label'>BHT:</td>
25+
<td>{{surgery.bht}}</td>
26+
<td class='label'>Date:</td>
27+
<td>{{surgery.date}}</td>
28+
</tr>
29+
<tr>
30+
<td class='label'>Age/Sex:</td>
31+
<td>{{patient.age}} / {{patient.gender}}</td>
32+
<td class='label'>Ward:</td>
33+
<td>{{surgery.ward}}</td>
34+
</tr>
35+
</table>
4636

47-
<hr />
37+
<!-- Surgery Title -->
38+
<div class='surgery-title keep-together'>
39+
<h2 class='text-lg text-center bold'>
40+
{{surgery.title}}
41+
</h2>
42+
</div>
4843

49-
<h2 class='text-lg mt-3 text-center p-3'>
50-
{{surgery.title}}
51-
</h2>
44+
<!-- Doctors Section -->
45+
<div class='doctors-section keep-together'>
46+
{{#if surgery.doneBy.length}}
47+
<div class='doctor-row'>
48+
<span class='doctor-label'>Done By:</span>
49+
<span>{{surgery.doneByAsString}}</span>
50+
</div>
51+
{{/if}}
52+
{{#if surgery.assistedBy.length}}
53+
<div class='doctor-row'>
54+
<span class='doctor-label'>Assisted By:</span>
55+
<span>{{surgery.assistedByAsString}}</span>
56+
</div>
57+
{{/if}}
58+
</div>
5259

53-
<div class='flex flex-col'>
54-
{{#if surgery.doneBy.length}}
55-
<div class='p-1 flex'>
56-
<span class='bold mr-1'>
57-
Done By:
58-
</span>
59-
<span>
60-
{{surgery.doneByAsString}}
61-
</span>
60+
<!-- Op Notes Section -->
61+
{{#if surgery.notes}}
62+
<div class='notes-section'>
63+
<div class='section-header keep-together'>Op Notes</div>
64+
<div class='prose'>
65+
{{{surgery.notes}}}
66+
</div>
6267
</div>
6368
{{/if}}
64-
{{#if surgery.assistedBy.length}}
65-
<div class='p-1 flex'>
66-
<span class='bold mr-1'>
67-
Assisted By:
68-
</span>
69-
<span>
70-
{{surgery.assistedByAsString}}
71-
</span>
69+
70+
<!-- Post-Op Notes Section -->
71+
{{#if surgery.post_op_notes}}
72+
<div class='notes-section'>
73+
<div class='section-header keep-together'>Post-Op Notes</div>
74+
<div class='prose'>
75+
{{{surgery.post_op_notes}}}
76+
</div>
7277
</div>
7378
{{/if}}
7479
</div>
75-
76-
{{#if surgery.notes}}
77-
<div class='p-1'>
78-
<div class='prose'>
79-
{{{surgery.notes}}}
80-
</div>
81-
</div>
82-
{{/if}}
83-
84-
{{#if surgery.post_op_notes}}
85-
<hr />
86-
<div class='p-1'>
87-
<h2 class='text-md mt-3 text-center p-3'>
88-
Post-Op Notes
89-
</h2>
90-
<div class='prose'>
91-
{{{surgery.post_op_notes}}}
92-
</div>
93-
</div>
94-
{{/if}}

src/main/db/migrations.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import * as m_000_init from './migrations/000_init'
22
import * as m_001_app_settings from './migrations/001_app_settings'
3+
import * as m_002_telephone_setting from './migrations/002_telephone_setting'
34

45
export default {
56
'000_init': m_000_init,
6-
'001_app_settings': m_001_app_settings
7+
'001_app_settings': m_001_app_settings,
8+
'002_telephone_setting': m_002_telephone_setting
79
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
import { Kysely } from 'kysely'
3+
4+
export async function up(db: Kysely<any>): Promise<void> {
5+
await db
6+
.insertInto('app_settings')
7+
.values({ key: 'telephone', value: null, display_name: 'Telephone' })
8+
.execute()
9+
}
10+
11+
export async function down(_db: Kysely<any>): Promise<void> {
12+
// down
13+
}

src/renderer/src/lib/print.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const surgeryPrintData = (
3131
},
3232
settings: {
3333
hospital: settings?.hospital || '',
34-
unit: settings?.unit || ''
34+
unit: settings?.unit || '',
35+
telephone: settings?.telephone || ''
3536
}
3637
})

src/renderer/src/routes/settings/settings-index.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import toast from 'react-hot-toast'
2323

2424
const formSchema = z.object({
2525
hospital: z.string(),
26-
unit: z.string()
26+
unit: z.string(),
27+
telephone: z.string()
2728
})
2829

2930
type FormSchema = z.infer<typeof formSchema>
@@ -35,7 +36,8 @@ export const SettingsIndex = () => {
3536
resolver: zodResolver(formSchema),
3637
defaultValues: {
3738
hospital: '',
38-
unit: ''
39+
unit: '',
40+
telephone: ''
3941
}
4042
})
4143
const { setBreadcrumbs } = useBreadcrumbs()
@@ -48,7 +50,8 @@ export const SettingsIndex = () => {
4850
if (settings) {
4951
form.reset({
5052
hospital: settings['hospital'] || '',
51-
unit: settings['unit'] || ''
53+
unit: settings['unit'] || '',
54+
telephone: settings['telephone'] || ''
5255
})
5356
}
5457
}, [form, settings])
@@ -112,6 +115,22 @@ export const SettingsIndex = () => {
112115
</FormItem>
113116
)}
114117
/>
118+
<FormField
119+
name="telephone"
120+
control={form.control}
121+
render={({ field }) => (
122+
<FormItem>
123+
<FormLabel>Telephone</FormLabel>
124+
<FormControl>
125+
<Input placeholder="Telephone Number" {...field} />
126+
</FormControl>
127+
<FormDescription>
128+
Contact telephone number, this will be used when printing BHT
129+
</FormDescription>
130+
<FormMessage />
131+
</FormItem>
132+
)}
133+
/>
115134

116135
<div className="flex justify-start mt-2">
117136
<Button

0 commit comments

Comments
 (0)