Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ManaS066 committed Sep 1, 2024
2 parents a9cf4a1 + 5245acc commit 396f706
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 45 deletions.
36 changes: 34 additions & 2 deletions Government of NCT of Delhi/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
from pymongo import MongoClient
import jwt
from functools import wraps
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import inch
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image, Table, TableStyle
from reportlab.graphics.barcode.qr import QrCodeWidget
from reportlab.graphics.shapes import Drawing
from reportlab.graphics import renderPDF
import qrcode
import io

#test pull
app = Flask(__name__)
Expand Down Expand Up @@ -487,6 +497,8 @@ def superadmin_login():

# Check if the username and password match an entry in the admin_collection
if superadmin_collection.find_one({"username": username, "password": password}):
session['username']=username
session['role']='superadmin'
return redirect('/superadmin')
else:
return redirect('/superadmin_login')
Expand All @@ -495,7 +507,7 @@ def superadmin_login():


@app.route('/superadmin/addHospital', methods=['GET', 'POST'])

@login_required('superadmin')
def add_hospital():
if request.method == 'POST':
hospital_name = request.form['hospitalName']
Expand Down Expand Up @@ -529,6 +541,7 @@ def add_hospital():


@app.route('/superadmin/checkHospitalStatus', methods=['GET', 'POST'])
@login_required('superadmin')
def check_hospital():
if request.method == 'POST':
hospital_name = request.form.get('hname')
Expand Down Expand Up @@ -561,6 +574,7 @@ def submit_discharge():
follow_up_instructions = request.form.get('follow_up_instructions')
medications = request.form.get('medications')
contact_info = request.form.get('contact_info')
gender=request.form.get('gender')

data_discharge={
'patient_id': patient_id,
Expand All @@ -575,7 +589,21 @@ def submit_discharge():
'medications': medications,
'contact_info': contact_info
}

# Generate PDF with the provided details
pdf_buffer = io.BytesIO()
doc = SimpleDocTemplate(pdf_buffer, pagesize=A4)
styles = getSampleStyleSheet()
#Patient details inside the pdf
elements = []
elements.append(Paragraph("Patient ID Card", styles['Title']))
elements.append(Spacer(1, 12))
elements.append(Paragraph(f"Full Name: {patient_name}", styles['Normal']))
elements.append(Paragraph(f"Admission Date: {admission_date}", styles['Normal']))
elements.append(Paragraph(f"Gender: {gender}", styles['Normal']))
elements.append(Paragraph(f"Address: {address}", styles['Normal']))
elements.append(Paragraph(f"Phone Number: {contact_info}", styles['Normal']))
elements.append(Paragraph(f"Email: {email}", styles['Normal']))
elements.append(Paragraph(f"Discharge Summary: {discharge_summary}", styles['Normal']))
hospital_discharge_collection.insert_one(data_discharge)
return redirect('/admin')
return render_template('Patient_discharge.html')
Expand All @@ -592,6 +620,10 @@ def user_logout():
def admin_logout():
session.clear()
return redirect('/')
@app.route('/superadmin_logout')
def sueperadmin_logout():
session.clear()
return redirect('/')


if __name__ == '__main__':
Expand Down
59 changes: 27 additions & 32 deletions Government of NCT of Delhi/templates/Patient_discharge.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand All @@ -8,7 +9,6 @@
body {
font-family: Arial, sans-serif;
background-image: url("../static/images/Patient_Discharge.avif");
/* Replace with your image URL */
background-size: cover;
background-position: center;
margin: 0;
Expand All @@ -31,7 +31,6 @@
margin: 30px auto;
padding: 20px;
background-color: rgba(255, 255, 255, 0.9);
/* Semi-transparent white background */
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
Expand All @@ -45,7 +44,8 @@

input[type="text"],
input[type="date"],
textarea {
textarea,
select {
width: 100%;
padding: 10px;
margin-bottom: 20px;
Expand Down Expand Up @@ -75,70 +75,65 @@
<body>
<form action="/admin/discharge" method="POST">
<h2>Hospital Discharge Details Form</h2>

<label for="patient_id">Patient ID:</label>
<input type="text" id="patient_id" name="patient_id" required />

<label for="patient_name">Patient Name:</label>
<input type="text" id="patient_name" name="patient_name" required />

<!-- Gender Selection -->
<label for="gender">Gender:</label>
<select id="gender" name="gender" required>
<option value="">Select Gender</option>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>

<!-- Address Field -->
<label for="address">Address:</label>
<textarea id="address" name="address" rows="3" required></textarea>

<label for="admission_date">Date of Admission:</label>
<input type="date" id="admission_date" name="admission_date" required />

<label for="discharge_date">Date of Discharge:</label>
<input type="date" id="discharge_date" name="discharge_date" required />

<label for="diagnosis">Diagnosis:</label>
<textarea
id="diagnosis"
name="diagnosis"
rows="4"
cols="50"
required
></textarea>
<textarea id="diagnosis" name="diagnosis" rows="4" required></textarea>

<label for="treatment">Treatment Provided:</label>
<<<<<<< HEAD
<textarea
id="treatment"
name="treatment"
rows="4"
cols="50"
required
></textarea>
=======
<textarea id="treatment" name="treatment" rows="4" required></textarea>

>>>>>>> 7486dcecdfbd47ef0b8006d549e33176c1a0b934
<label for="doctor_name">Doctor's Name:</label>
<input type="text" id="doctor_name" name="doctor_name" required />

<label for="discharge_summary">Discharge Summary:</label>
<textarea
id="discharge_summary"
name="discharge_summary"
rows="4"
cols="50"
required
></textarea>
<textarea id="discharge_summary" name="discharge_summary" rows="4" required></textarea>

<label for="follow_up_instructions">Follow-up Instructions:</label>
<textarea
id="follow_up_instructions"
name="follow_up_instructions"
rows="4"
cols="50"
required
></textarea>
<textarea id="follow_up_instructions" name="follow_up_instructions" rows="4" required></textarea>

<label for="medications">Medications Prescribed:</label>
<textarea
id="medications"
name="medications"
rows="4"
cols="50"
required
></textarea>
<textarea id="medications" name="medications" rows="4" required></textarea>

<label for="contact_info">Contact Information:</label>
<input type="text" id="contact_info" name="contact_info" required />

<input type="submit" value="Submit" />
</form>
</body>
</html>

</html>
38 changes: 27 additions & 11 deletions Government of NCT of Delhi/templates/super_add_hospital.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,22 +128,38 @@
</head>

<body>

<div class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="#">
<img src="../static/images/delhi.png" alt="Delhi Logo" class="rounded-circle" width="40" height="40">
</a>
<h3 class="text-light">Government of NCT of Delhi</h3>
</div>

<div class="sidebar">
<a href="dashboard.html">Dashboard</a>
<a href="add-hospital.html">Add Hospital</a>
<!-- <a href="check-hospital-status.html">Check Hospital Status</a>
<a href="order-medicine.html">Order Medicine</a>
<a href="feedback.html">Feedback</a>
<a href="blood-bank-status.html">Blood Bank Status</a>
<a href="/">Logout</a> -->
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<div class="ml-auto">
<a class="nav-link btn btn-primary text-light" href="#"></a>
</div>
</li>
<li class="nav-item">
<div class="ml-auto">
<a class="nav-link btn btn-primary text-light" href="#"></a>
</div>
</li>
<li class="nav-item">
<div class="ml-auto">
<a class="nav-link btn btn-primary text-light" href="#"></a>
</div>
</li>
<li class="nav-item">
<div class="ml-auto">
<a class="nav-link btn btn-primary text-light" href="#"></a>
</div>
</li>
<li class="nav-item">
<div class="ml-auto">
<a class="nav-link btn btn-primary text-light" href="dashboard.html">Return to Dashboard</a>
</div>
</li>
</ul>
</div>

<div class="main-content">
Expand Down

0 comments on commit 396f706

Please sign in to comment.