Skip to content

Commit 51510b5

Browse files
Fix records search (#288)
1 parent d910005 commit 51510b5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

app/routes/find-record.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,26 @@ module.exports = router => {
100100

101101
})
102102

103+
router.post('/records/patient-search', (req, res) => {
104+
const data = req.session.data
105+
const firstName = data.firstName;
106+
const lastName = data.lastName;
107+
const dateOfBirth = data.dateOfBirth;
108+
const postcode = data.postcode;
109+
110+
if (firstName && lastName && dateOfBirth) {
111+
112+
data.patientName = firstName + " " + lastName
113+
data.nhsNumber = '9123456788'
114+
115+
res.redirect('/records/patient-history')
116+
} else {
117+
res.redirect('/records/patient-search')
118+
}
119+
120+
})
121+
122+
103123
router.get('/records/records/:id/:page', (req, res) => {
104124

105125
const id = req.params.id

app/views/records/patient-search.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h1 class="nhsuk-heading-l">Search for the patient</h1>
2323

2424
<p class="nhsuk-body">Make sure the details you enter match those registered with the patient’s GP.</p>
2525

26-
<form action="/records/search-result" method="post">
26+
<form action="/records/patient-search" method="post">
2727
{{ input({
2828
label: {
2929
text: "First name"

0 commit comments

Comments
 (0)