-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
88 lines (78 loc) · 2.71 KB
/
index.js
File metadata and controls
88 lines (78 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const express=require("express")
const app=express()
const port=3000
const path=require("path")
const { v4: uuidv4 } = require('uuid');
let details=[
{
id:uuidv4(),
patientname: 'Devansh',
contactnumber: '9015422926',
dob: '2006-09-17',
gender: 'male',
'blood group': 'B+',
condition: 'stable',
recenttests: 'ChatGPT Image Mar 30, 2025, 08_14_51 PM.png',
precautionsforthepatient: 'HHHSHSH',
hospital:"",
policynumber: 'wfegtrhy',
insurancepolicy: 'ChatGPT Image Mar 30, 2025, 08_14_11 PM.png',
idproof: 'ChatGPT Image Mar 30, 2025, 08_14_11 PM.png'
},
{
id:uuidv4(),
patientname: 'VASU',
contactnumber: '9015422926',
dob: '2006-09-17',
gender: 'male',
'blood group': 'B+',
condition: 'stable',
recenttests: 'ChatGPT Image Mar 30, 2025, 08_14_51 PM.png',
precautionsforthepatient: 'HHHSHSH',
hospital: '',
policynumber: 'wfegtrhy',
insurancepolicy: 'ChatGPT Image Mar 30, 2025, 08_14_11 PM.png',
idproof: 'ChatGPT Image Mar 30, 2025, 08_14_11 PM.png'
},
{
id:uuidv4(),
patientname: 'Kabir',
contactnumber: '9015422926',
dob: '2006-09-17',
gender: 'male',
'blood group': 'B+',
condition: 'stable',
recenttests: 'ChatGPT Image Mar 30, 2025, 08_14_51 PM.png',
precautionsforthepatient: 'HHHSHSH',
hospital: '',
policynumber: 'wfegtrhy',
insurancepolicy: 'ChatGPT Image Mar 30, 2025, 08_14_11 PM.png',
idproof: 'ChatGPT Image Mar 30, 2025, 08_14_11 PM.png'
},
]
app.use(express.urlencoded({ extended: true }));
app.set("view engine", "ejs");
app.set("views", path.join(__dirname, "views"));
app.use(express.static(path.join(__dirname, "public")));
app.listen(port, () => {
console.log("running");
});
app.get("/form", (req, res) => {
res.render("form.ejs");
});
app.post("/referralform", (req, res) => {
const id= uuidv4()
let {patientname,contactnumber,condition,hospital,dob,gender,bloodgroup,recenttests,precautionsforthepatient,policynumber,idproof,insurancepolicy}=req.body
details.push({patientname,contactnumber,condition,hospital,id,dob,gender,bloodgroup,recenttests,precautionsforthepatient,policynumber,idproof,insurancepolicy})
// res.render("history.ejs",{details});
res.redirect("/referralhistory");
});
app.get("/referralhistory", (req, res) => {
res.render("history.ejs",{details});
});
app.get("/referredform/:id", (req, res) => {
let {id}=req.params
console.log(id)
let detail=details.find((p)=>(id===p.id))
res.render("referredform",{detail})
});