diff --git a/Government of NCT of Delhi/app.py b/Government of NCT of Delhi/app.py index 6627e3a..8413c84 100644 --- a/Government of NCT of Delhi/app.py +++ b/Government of NCT of Delhi/app.py @@ -1,5 +1,11 @@ -from flask import Flask, flash, render_template, request, redirect, url_for,make_response,session,send_file -import os,secrets +from flask_bcrypt import Bcrypt +from datetime import datetime, timedelta +from pymongo.server_api import ServerApi +from pymongo.mongo_client import MongoClient +import smtplib +from flask import Flask, flash, render_template, request, redirect, url_for, make_response, session +import os +import secrets from pymongo import MongoClient import jwt from functools import wraps @@ -15,20 +21,15 @@ import qrcode import io -#test pull +# test pull app = Flask(__name__) -#test push +# test push # app.config['SECRET_KEY']=secrets.token_hex()\ -app.secret_key=secrets.token_hex() +app.secret_key = secrets.token_hex() -import smtplib -from datetime import datetime,timedelta my_email = "nicdelhi2024@gmail.com" code = "zuff vkvx pamt kdor" -from flask_bcrypt import Bcrypt -from pymongo.mongo_client import MongoClient -from pymongo.server_api import ServerApi -bcrypt = Bcrypt(app) +bcrypt = Bcrypt(app) uri = "mongodb+srv://manasranjanpradhan2004:root@hms.m7j9t.mongodb.net/?retryWrites=true&w=majority&appName=HMS" # Create a new client and connect to the server client = MongoClient(uri, server_api=ServerApi('1')) @@ -46,10 +47,9 @@ admin_collection = db['admin'] appointment_collection = db['appointment'] contact_collection = db['contact'] -superadmin_collection=db['Superadmin'] -hospital_data_collection=db['hospital_data'] -hospital_discharge_collection=db['discharged'] - +superadmin_collection = db['Superadmin'] +hospital_data_collection = db['hospital_data'] +hospital_discharge_collection = db['discharged'] # def token_required(expected_role): @@ -73,32 +73,31 @@ # return redirect(f'/{expected_role}_login') # except jwt.ExpiredSignatureError: # return 'Token has expired',401 - + # except jwt.InvalidTokenError: # return redirect(f'/{expected_role}_login') - + # return f(current_user,*args,**kwargs) # return decorated # return decorator def login_required(role): def decorator(f): @wraps(f) - def decorated_function(*args,**kwargs): + def decorated_function(*args, **kwargs): print(f"Session data: {session}") print(f"Checking if username in session: {'username' in session}") print(f"Checking if role matches: {session.get('role')} == {role}") - if 'username' not in session or session.get('role')!=role: + if 'username' not in session or session.get('role') != role: return redirect(f'/{role}_login') - return f(*args,**kwargs) + return f(*args, **kwargs) return decorated_function return decorator - -@app.route('/',methods=['GET', 'POST']) +@app.route('/', methods=['GET', 'POST']) def landing(): - if request.method=='POST': - name= request.form['name'] + if request.method == 'POST': + name = request.form['name'] email = request.form['email'] number = request.form['number'] comment = request.form['comment'] @@ -132,44 +131,48 @@ def user_login(): # response=make_response(redirect('/appointment')) # response.set_cookie('access_token_user',token,httponly=True) # response.set_cookie('user_username',username,httponly=True) - + # return response - session['username']=username - session['role']='user' + session['username'] = username + session['role'] = 'user' print(f'user session details:{session}') return redirect('/user_app') else: return 'Wrong password' - + return 'User not found' return render_template('user_login.html') -@app.route('/user_app',methods=['GET','POST']) + +@app.route('/user_app', methods=['GET', 'POST']) @login_required('user') def user_app(): - user_info = users_collection.find_one({'username':session.get('username')}) - appointment = appointment_collection.find({'username':session.get('username')}) - return render_template('user_app.html',user = user_info,appointments =appointment) + user_info = users_collection.find_one( + {'username': session.get('username')}) + appointment = appointment_collection.find( + {'username': session.get('username')}) + return render_template('user_app.html', user=user_info, appointments=appointment) -@app.route('/user_register',methods=['GET','POST']) + +@app.route('/user_register', methods=['GET', 'POST']) def user_register(): - if request.method=='POST': - name=request.form['name'] - number=request.form['phone'] - email= request.form['email'] + if request.method == 'POST': + name = request.form['name'] + number = request.form['phone'] + email = request.form['email'] user_name = request.form['username'] # existing_user = users_collection.find_one({'$or': [{'username': user_name}, {'email': email}]}) # if existing_user: # return 'Username or email already exists' pa = request.form['password'] - password=bcrypt.generate_password_hash(pa).decode('utf-8') - user_data={ - 'name':name, - 'username':user_name, - 'email':email, - 'number':number, - 'password':password + password = bcrypt.generate_password_hash(pa).decode('utf-8') + user_data = { + 'name': name, + 'username': user_name, + 'email': email, + 'number': number, + 'password': password } users_collection.insert_one(user_data) return redirect('/user_login') @@ -187,7 +190,7 @@ def appointment(): if request.method == 'POST': # Extract form data name = request.form['name'] - user_name=session.get('username') + user_name = session.get('username') number = request.form['number'] email = request.form['email'] address = request.form['Address'] @@ -200,7 +203,7 @@ def appointment(): # print(total_no_of_appointments) appointment_data = { 'name': name, - 'username':user_name, + 'username': user_name, 'number': number, 'email': email, 'address': address, @@ -208,10 +211,10 @@ def appointment(): 'time_slot': time_slot, 'speciality': speciality, 'disease_description': disease_description, - 'hospital_name':hospital_name + 'hospital_name': hospital_name } appointment_collection.insert_one(appointment_data) - + # After saving or processing, redirect or render a success page return redirect('/admin/confirmation') # If GET request, just render the appointment form @@ -220,35 +223,36 @@ def appointment(): return render_template('appointment.html', hospitals=hospital_names) -@app.route('/admin/add_patient',methods=['GET','POST']) + +@app.route('/admin/add_patient', methods=['GET', 'POST']) # @token_required('admin') @login_required('admin') def add_patient(): - if request.method=='POST': + if request.method == 'POST': name = request.form['Name'] - dob =request.form['dob'] + dob = request.form['dob'] gender = request.form['gender'] address = request.form['address'] - phone= request.form['phone'] - email=request.form['email'] - aadhaar= request.form['aadhaar'] + phone = request.form['phone'] + email = request.form['email'] + aadhaar = request.form['aadhaar'] bed_type = request.form['bedtype'] bed_no = request.form['bedno'] - session['patient_name']=name - hospital_name_patient=session.get('hospital_name') + session['patient_name'] = name + hospital_name_patient = session.get('hospital_name') print(hospital_name_patient) data = { - 'name':name, - 'dob':dob, - 'gender':gender, - 'address':address, - 'phone':phone, - 'email':email, - "aadhaar":aadhaar, - "bed_type":bed_type, - "bed no":bed_no, - "hospital_name":hospital_name_patient + 'name': name, + 'dob': dob, + 'gender': gender, + 'address': address, + 'phone': phone, + 'email': email, + "aadhaar": aadhaar, + "bed_type": bed_type, + "bed no": bed_no, + "hospital_name": hospital_name_patient } patients_collection.insert_one(data) @@ -259,32 +263,30 @@ def add_patient(): return redirect(url_for('confirmation')) return render_template('add patient.html') + @app.route('/admin/confirmation') @login_required('admin') def confirmation(): return render_template('conformation.html', message="Patient successfully added!") -@app.route('/admin/manage_appointment',methods=['GET','POST']) +@app.route('/admin/manage_appointment', methods=['GET', 'POST']) @login_required('admin') def manage(): - hospital_name=session.get('hospital_name') - appointments= appointment_collection.find({"hospital_name":hospital_name}) - return render_template('manage_appointment.html',appointments = appointments) - - - + hospital_name = session.get('hospital_name') + appointments = appointment_collection.find( + {"hospital_name": hospital_name}) + return render_template('manage_appointment.html', appointments=appointments) - -@app.route('/admin_login',methods=["GET","POST"]) +@app.route('/admin_login', methods=["GET", "POST"]) def admin_login(): if request.method == 'POST': - username= request.form['username'] + username = request.form['username'] pa = request.form['password'] - password=bcrypt.generate_password_hash(pa).decode('utf-8') + password = bcrypt.generate_password_hash(pa).decode('utf-8') # print('this is executed') - + admin = admin_collection.find_one({'hospital_mail': username}) if admin: # Compare the entered password with the stored hashed password @@ -296,37 +298,43 @@ def admin_login(): # 'exp':datetime.utcnow()+timedelta(hours=1) # },app.config['SECRET_KEY'],algorithm="HS256") - # response=make_response(redirect('/admin')) # response.set_cookie('access_token',token,httponly=True) # response.set_cookie('user_username',username,httponly=True) - session['username']=username - session['role']='admin' - admin_email=session['username'] - hospital_data=admin_collection.find_one({"hospital_mail":admin_email}) - hospital_name_doctor=hospital_data.get("hospital_name") - session['hospital_name']=hospital_name_doctor + session['username'] = username + session['role'] = 'admin' + admin_email = session['username'] + hospital_data = admin_collection.find_one( + {"hospital_mail": admin_email}) + hospital_name_doctor = hospital_data.get("hospital_name") + session['hospital_name'] = hospital_name_doctor print(f'session details:{session}') # return response return redirect('/admin') - + else: return 'Wrong password' - + return 'User not found' return render_template("login_admin.html") -@app.route('/admin/',methods=['GET','POST']) + +@app.route('/admin/', methods=['GET', 'POST']) # @token_required('admin') @login_required('admin') def admin(): - hospital_name=session.get('hospital_name') + hospital_name = session.get('hospital_name') print(hospital_name) - total_appointment = appointment_collection.count_documents({"hospital_name":hospital_name}) + total_appointment = appointment_collection.count_documents( + {"hospital_name": hospital_name}) data = hospital_data_collection.find_one({'hospital_name': hospital_name}) if data: - beds = data['number_of_general_beds'] - return render_template('admin_dashboard.html',count=total_appointment,beds=beds) + g_beds = data['number_of_general_beds'] + icu_beds= data['number_of_icu_beds'] + v_beds = data['number_of_ventilators'] + total_patient = patients_collection.count_documents({'hospital_name': hospital_name}) + total_doc= doctors_collection.count_documents({"hospital_name":hospital_name}) + return render_template('admin_dashboard.html',count=total_appointment,general_total=g_beds,icu_total= icu_beds,vantilator_total =v_beds,patient = total_patient,doc=total_doc) else: return redirect('/admin/add_detail') @@ -336,26 +344,27 @@ def admin_contact_us(): contacts = contact_collection.find() return render_template("manage_appointment.html", contacts=contacts) -@app.route('/admin/add_detail',methods=['GET','POST']) + +@app.route('/admin/add_detail', methods=['GET', 'POST']) @login_required('admin') def add_details(): - if request.method=='POST': - name= request.form['hospitalName'] - ID =request.form['hospitalID'] - address1=request.form['addressLine1'] + if request.method == 'POST': + name = request.form['hospitalName'] + ID = request.form['hospitalID'] + address1 = request.form['addressLine1'] city = request.form['city'] state = request.form['stateProvince'] postal_code = request.form['postalCode'] - contact_number= request.form['contactNumber'] - emergency=request.form['emergencyContactNumber'] + contact_number = request.form['contactNumber'] + emergency = request.form['emergencyContactNumber'] email = request.form['emailAddress'] website = request.form['websiteURL'] no_beds = int(request.form['numberOfBeds']) - occupied_beds=int(request.form['Beds_occupied']) + occupied_beds = int(request.form['Beds_occupied']) no_icu = int(request.form['numberOfICUBeds']) occupied_icu = int(request.form['icu_occupied']) no_ventilator = int(request.form['numberOfVentilators']) - occupied_ventilator=int(request.form['ventilator_occupied']) + occupied_ventilator = int(request.form['ventilator_occupied']) emergency_dept = request.form['emergencyDepartment'] spetialisation = request.form['specialization'] operating_hour = request.form['hospitalOperatingHours'] @@ -367,105 +376,104 @@ def add_details(): bload_bank = request.form['bloodBank'] diagonis_services = request.form['diagnosticServices'] - data = { - "hospital_name": name, - "hospital_id": ID, - "address_line1": address1, - "city": city, - "state": state, - "postal_code": postal_code, - "contact_number": contact_number, - "emergency_contact_number": emergency, - "email_address": email, - "website_url": website, - "number_of_general_beds": no_beds, - "occupied_general":occupied_beds, - "number_of_icu_beds": no_icu, - "occupied_icu":occupied_icu, - "number_of_ventilators": no_ventilator, - "occupied_ventilator":occupied_ventilator, - "emergency_department": emergency_dept, - "specialization": spetialisation, - "hospital_operating_hours": operating_hour, - "visiting_hours": visiting_hour, - "pharmacy_on_site": pharmacy_onsite, - "total_number_of_nurses": no_nurse, - "administrative_staff_count": no_admin_staff, - "ambulance_services": ambulance, - "blood_bank": bload_bank, - "diagnostic_services": diagonis_services} - + data = { + "hospital_name": name, + "hospital_id": ID, + "address_line1": address1, + "city": city, + "state": state, + "postal_code": postal_code, + "contact_number": contact_number, + "emergency_contact_number": emergency, + "email_address": email, + "website_url": website, + "number_of_general_beds": no_beds, + "occupied_general": occupied_beds, + "number_of_icu_beds": no_icu, + "occupied_icu": occupied_icu, + "number_of_ventilators": no_ventilator, + "occupied_ventilator": occupied_ventilator, + "emergency_department": emergency_dept, + "specialization": spetialisation, + "hospital_operating_hours": operating_hour, + "visiting_hours": visiting_hour, + "pharmacy_on_site": pharmacy_onsite, + "total_number_of_nurses": no_nurse, + "administrative_staff_count": no_admin_staff, + "ambulance_services": ambulance, + "blood_bank": bload_bank, + "diagnostic_services": diagonis_services} + # Insert the data into the hospital collection hospital_data_collection.insert_one(data) - - return redirect('/admin') return render_template('hospital_details.html',) - - -@app.route('/add_doc',methods=['POST','GET']) +@app.route('/add_doc', methods=['POST', 'GET']) # @token_required('admin') @login_required('admin') def doctor_register(): - if request.method=='POST': - name=request.form['doctor_name'] - specialization=request.form['specialization'] - qualification=request.form['qualification'] - email=request.form['email'] - username=request.form['username'] - password=request.form['password'] - hash_password=bcrypt.generate_password_hash(password).decode('utf-8') - phone=request.form['phone'] - aadhar=request.form['aadhaar'] - #Doctor and hospital relation - session['doctor_name']=name - admin_email=session['username'] - hospital_data=admin_collection.find_one({"hospital_mail":admin_email}) - hospital_name_doctor=hospital_data.get("hospital_name") - session['hospital_name']=hospital_name_doctor + if request.method == 'POST': + name = request.form['doctor_name'] + specialization = request.form['specialization'] + qualification = request.form['qualification'] + email = request.form['email'] + username = request.form['username'] + password = request.form['password'] + hash_password = bcrypt.generate_password_hash(password).decode('utf-8') + phone = request.form['phone'] + aadhar = request.form['aadhaar'] + # Doctor and hospital relation + session['doctor_name'] = name + admin_email = session['username'] + hospital_data = admin_collection.find_one( + {"hospital_mail": admin_email}) + hospital_name_doctor = hospital_data.get("hospital_name") + session['hospital_name'] = hospital_name_doctor # print(hospital_name_patient) - doctor_data={ - 'name':name, - 'specialization':specialization, - 'qualification':qualification, - 'email':email, - 'username':username, - 'password':hash_password, - 'phone':phone, - 'aadhar':aadhar, - "hospital_name":hospital_name_doctor + doctor_data = { + 'name': name, + 'specialization': specialization, + 'qualification': qualification, + 'email': email, + 'username': username, + 'password': hash_password, + 'phone': phone, + 'aadhar': aadhar, + "hospital_name": hospital_name_doctor } - if doctors_collection.find_one({'username':username}): + if doctors_collection.find_one({'username': username}): return redirect('/add_doc') else: doctors_collection.insert_one(doctor_data) return render_template('add doc.html') return render_template('add doc.html') + @app.route('/doctor_login', methods=['POST', 'GET']) def doc_login(): if request.method == "POST": username = request.form['username'] password = request.form['password'] - + # Fetch the doctor's details from the database by username doctor = doctors_collection.find_one({'username': username}) # print(username,password) if doctor: # stored_hash = doctor['password'] # The stored hashed password - + # Check if the provided password matches the hashed passwor - if bcrypt.check_password_hash(doctor['password'],password): + if bcrypt.check_password_hash(doctor['password'], password): # Password matches, grant access # Store doctor ID in session - doctor_data=doctors_collection.find_one({'username':username}) + doctor_data = doctors_collection.find_one( + {'username': username}) - session['username']=username - session['hospital_name']=doctor_data.get('hospital_name') - session['specialization']=doctor_data.get('specialization') - session['role']='doc' - return redirect('/doctor_app') # Redirect to the doctor app + session['username'] = username + session['hospital_name'] = doctor_data.get('hospital_name') + session['specialization'] = doctor_data.get('specialization') + session['role'] = 'doc' + return redirect('/doctor_app') # Redirect to the doctor app else: # Password does not match @@ -477,52 +485,27 @@ def doc_login(): return "Wrong id" # Render the login page if GET request - return render_template('doctor login.html') # Replace with your login template + # Replace with your login template + return render_template('doctor login.html') - - - - -@app.route('/doctor_app',methods=["POST","GET"]) +@app.route('/doctor_app', methods=["POST", "GET"]) @login_required('doc') def doctor_app(): - appointments=appointment_collection.find({'hospital_name':session.get('hospital_name'),'speciality':session.get('specialization')}) - doc_detail = doctors_collection.find_one({'username':session.get('username')}) - return render_template('doctor_dash.html',appointments=appointments,doctor=doc_detail) + appointments = appointment_collection.find({'hospital_name': session.get( + 'hospital_name'), 'speciality': session.get('specialization')}) + doc_detail = doctors_collection.find_one( + {'username': session.get('username')}) + return render_template('doctor_dash.html', appointments=appointments, doctor=doc_detail) + @app.route('/superadmin/', methods=['GET', 'POST']) -@login_required('superadmin') def superadmin(): - # Count the total number of hospitals, doctors, and active patients - no_of_hospital = hospital_data_collection.count_documents({}) - total_doctor = doctors_collection.count_documents({}) - active_patient = patients_collection.count_documents({}) + no_of_hospital = hospital_data_collection.count_documents() + total_doctor = doctors_collection.count_documents() + active_patient = patients_collection.count_documents() - # Aggregate the total number of beds, ICU beds, and ventilators - total_beds = hospital_data_collection.aggregate([ - {"$group": {"_id": None, "total_beds": {"$sum": "$number_of_beds"}}} - ]).next()['total_beds'] - - total_icu_beds = hospital_data_collection.aggregate([ - {"$group": {"_id": None, "total_icu_beds": {"$sum": "$number_of_icu_beds"}}} - ]).next()['total_icu_beds'] - - total_ventilators = hospital_data_collection.aggregate([ - {"$group": {"_id": None, "total_ventilators": {"$sum": "$number_of_ventilators"}}} - ]).next()['total_ventilators'] - - # Debugging prints (can be removed in production) - print(total_ventilators, total_beds, total_icu_beds) - - # Render the template with the computed values - return render_template('super_admin_dash.html', - no_hospital=no_of_hospital, - doctor=total_doctor, - patient=active_patient, - total_beds=total_beds, - total_icu_beds=total_icu_beds, - total_ventilators=total_ventilators) + return render_template('super_admin_dash.html') @app.route("/superadmin_login", methods=['GET', 'POST']) @@ -530,16 +513,15 @@ def superadmin_login(): if request.method == 'POST': username = request.form['username'] password = request.form['password'] - print('hello') + # Check if the username and password match an entry in the admin_collection if superadmin_collection.find_one({"username": username, "password": password}): - print('hello') - session['username']=username - session['role']='superadmin' + session['username'] = username + session['role'] = 'superadmin' return redirect('/superadmin') else: return redirect('/superadmin_login') - + return render_template("Super_Admin_login.html") @@ -550,7 +532,7 @@ def add_hospital(): hospital_name = request.form['hospitalName'] hospital_mail = request.form['hospitalmail'] pa = request.form['hospitalpass'] - password=bcrypt.generate_password_hash(pa).decode('utf-8') + password = bcrypt.generate_password_hash(pa).decode('utf-8') # Store the hospital data in the hospital collection hospitalData = { "hospital_name": hospital_name, @@ -559,14 +541,13 @@ def add_hospital(): } admin_collection.insert_one(hospitalData) - with smtplib.SMTP("smtp.gmail.com", 587) as connection: connection.starttls() time = datetime.now() connection.login(user=my_email, password=code) connection.sendmail(from_addr=my_email, - to_addrs=hospital_mail, - msg=f""" + to_addrs=hospital_mail, + msg=f""" Dear, Your Hospital Account (Email ID {hospital_mail}) Password is:{pa}. @@ -575,31 +556,33 @@ def add_hospital(): ******************************** This is an auto-generated email. Do not reply to this email.""") return render_template('super_add_hospital.html') - - + + @app.route('/superadmin/checkHospitalStatus', methods=['GET', 'POST']) @login_required('superadmin') def check_hospital(): if request.method == 'POST': hospital_name = request.form.get('hname') - + if not hospital_name: return "Hospital name is missing", 400 # Bad Request - - data = hospital_data_collection.find_one({'hospital_name': hospital_name}) - + + data = hospital_data_collection.find_one( + {'hospital_name': hospital_name}) + if data: return render_template('superadmin_hospital_status.html', data=data) else: return "No hospital found" - + return render_template('superadmin_hospital_status.html') -@app.route('/admin/discharge',methods=['POST','GET']) + +@app.route('/admin/discharge', methods=['POST', 'GET']) @login_required('admin') def submit_discharge(): - if request.method=='POST': - # Extracting form data + if request.method == 'POST': + # Extracting form data patient_id = request.form.get('patient_id') patient_name = request.form.get('patient_name') admission_date = request.form.get('admission_date') @@ -611,9 +594,9 @@ 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') - address=request.form.get('address') - data_discharge={ + gender = request.form.get('gender') + + data_discharge = { 'patient_id': patient_id, 'patient_name': patient_name, 'admission_date': admission_date, @@ -628,96 +611,21 @@ def submit_discharge(): 'gender':gender, 'address':address } - hospital_discharge_collection.insert_one(data_discharge) # Generate PDF with the provided details pdf_buffer = io.BytesIO() doc = SimpleDocTemplate(pdf_buffer, pagesize=A4) styles = getSampleStyleSheet() #Patient details inside the pdf - # Customize Styles - title_style = styles['Title'] - title_style.fontSize = 24 - title_style.textColor = colors.darkblue - title_style.alignment = TA_CENTER - - header_style = ParagraphStyle( - name="Header", - fontSize=16, - textColor=colors.darkred, - spaceAfter=14, - alignment=TA_LEFT, - fontName="Helvetica-Bold" - ) - - normal_style = styles['Normal'] - normal_style.fontSize = 12 - normal_style.leading = 14 - normal_style.textColor = colors.black - - 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"Discharge Date: {discharge_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"Doctor: {doctor_name}",styles['Normal'])) elements.append(Paragraph(f"Diagnosis: {diagnosis}", styles['Normal'])) elements.append(Paragraph(f"Discharge Summary: {discharge_summary}", styles['Normal'])) - elements.append(Paragraph(f"Follow up instructions:{follow_up_instructions}",styles['Normal'])) - elements.append(Paragraph(f"Medications: {medications}",styles['Normal'])) - elements.append(Paragraph("Patient Discharge Summary", title_style)) - elements.append(Spacer(1, 12)) - - # # Table for Patient Details - # patient_info_table = [ - # ['Patient ID:', patient_id], - # ['Full Name:', patient_name], - # ['Gender:', gender], - # ['Address:', address], - # ['Phone Number:', contact_info], - # ['Admission Date:', admission_date], - # ['Discharge Date:', discharge_date], - # ['Doctor:', doctor_name] - # ] - # table = Table(patient_info_table, colWidths=[2*inch, 4*inch]) - # table.setStyle(TableStyle([ - # ('BACKGROUND', (0, 0), (-1, 0), colors.lightgrey), - # ('TEXTCOLOR', (0, 0), (-1, 0), colors.black), - # ('ALIGN', (0, 0), (-1, -1), 'LEFT'), - # ('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'), - # ('FONTSIZE', (0, 0), (-1, 0), 14), - # ('BOTTOMPADDING', (0, 0), (-1, 0), 12), - # ('BACKGROUND', (0, 1), (-1, -1), colors.whitesmoke), - # ('GRID', (0, 0), (-1, -1), 0.5, colors.grey) - # ])) - # elements.append(table) - # elements.append(Spacer(1, 12)) - - # Add detailed sections - # elements.append(Paragraph("Diagnosis:", header_style)) - # elements.append(Paragraph(diagnosis, normal_style)) - # elements.append(Spacer(1, 12)) - - # elements.append(Paragraph("Treatment:", header_style)) - # elements.append(Paragraph(treatment, normal_style)) - # elements.append(Spacer(1, 12)) - - # elements.append(Paragraph("Discharge Summary:", header_style)) - # elements.append(Paragraph(discharge_summary, normal_style)) - # elements.append(Spacer(1, 12)) - - # elements.append(Paragraph("Follow-Up Instructions:", header_style)) - # elements.append(Paragraph(follow_up_instructions, normal_style)) - # elements.append(Spacer(1, 12)) - - # elements.append(Paragraph("Medications:", header_style)) - # elements.append(Paragraph(medications, normal_style)) - # elements.append(Spacer(1, 12)) - # Generate QR code qr = qrcode.QRCode( @@ -744,28 +652,27 @@ def submit_discharge(): return send_file(pdf_buffer, as_attachment=True, download_name='patient_id_card.pdf', mimetype='application/pdf') # return redirect('/admin') return render_template('Patient_discharge.html') -#where is the change +# where is the change -#show +# show @app.route('/user_logout') def user_logout(): session.clear() return redirect('/') + @app.route('/admin_logout') def admin_logout(): session.clear() return redirect('/') + + @app.route('/superadmin_logout') def sueperadmin_logout(): session.clear() return redirect('/') -@app.route('/doc_logout') -def doc_logout(): - session.clear() - return redirect('/') if __name__ == '__main__': - app.run( port=8000,debug=True) \ No newline at end of file + app.run(port=8000, debug=True) diff --git a/Government of NCT of Delhi/templates/add patient.html b/Government of NCT of Delhi/templates/add patient.html index 6da81db..a0314f6 100644 --- a/Government of NCT of Delhi/templates/add patient.html +++ b/Government of NCT of Delhi/templates/add patient.html @@ -1,68 +1,69 @@ - - - - Add Patient - - + + + + Add Patient + + + +<<<<<<< HEAD

Add Patient

@@ -114,15 +115,69 @@

Add Patient

+======= + +
+

Add Patient

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+>>>>>>> 31aa4a44c411d1a9f9d7b2aab67568cfcdfb451c - -
- - -
-
- +
+ + +
+ + - - - - -
- + + + + + + \ No newline at end of file diff --git a/Government of NCT of Delhi/templates/admin_dashboard.html b/Government of NCT of Delhi/templates/admin_dashboard.html index 31dd0c7..10ebda4 100644 --- a/Government of NCT of Delhi/templates/admin_dashboard.html +++ b/Government of NCT of Delhi/templates/admin_dashboard.html @@ -158,15 +158,14 @@

Government of NCT of Delhi

@@ -174,16 +173,28 @@

Government of NCT of Delhi

Admin Dashboard

-

Total Patients

+

Total appointment

{{count}}

-

Available Beds

-

{{beds}}

+

Doctors

+

{{doc}}

-

Doctors On Duty

-

45

+

Total patient

+

{{patient}}

+
+
+

General bed

+

{{general_total}}

+
+
+

ICU Bed

+

{{icu_total}}

+
+
+

Ventilator

+

{{vantilator_total}}

diff --git a/Government of NCT of Delhi/templates/contact us.html b/Government of NCT of Delhi/templates/contact us.html deleted file mode 100644 index f3374fb..0000000 --- a/Government of NCT of Delhi/templates/contact us.html +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - Contact Us - - - - - - - -
- -
-
-
-

Contact Us

-
-

SmartCare Ninjas

-

Delhi, 110001

-

Board Number: +91-11-12345678 / 12345679

-

Fax: +91-11-12345680 / 12345681

-

Email: support@smartcareninjas@gmail.com -

-
- -
-
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- -
-
-
-
- - - - - - - \ No newline at end of file diff --git a/Government of NCT of Delhi/templates/manage_contactus.html b/Government of NCT of Delhi/templates/manage_contactus.html new file mode 100644 index 0000000..04b5de5 --- /dev/null +++ b/Government of NCT of Delhi/templates/manage_contactus.html @@ -0,0 +1,67 @@ + + + + + + + Admin Contact Us Data + + + + +
+

Admin Feedback Data

+ + + + + + + + {% for contact in contacts %} + + + + + + + {% endfor %} +
NameEmailNumberComment
{{ contact.name }}{{ contact.email }}{{ contact.number }}{{ contact.comment }}
+
+ + + \ No newline at end of file diff --git a/Government of NCT of Delhi/templates/super_admin_dash.html b/Government of NCT of Delhi/templates/super_admin_dash.html index 3287301..4c0af53 100644 --- a/Government of NCT of Delhi/templates/super_admin_dash.html +++ b/Government of NCT of Delhi/templates/super_admin_dash.html @@ -113,10 +113,10 @@

Government of NCT of Delhi