├── Application_Main ├── DOCTER │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-37.pyc │ │ │ ├── 0001_initial.cpython-37.pyc │ │ │ └── 0002_prescription2_total.cpython-37.pyc │ │ ├── 0002_prescription2_total.py │ │ └── 0001_initial.py │ ├── tests.py │ ├── views.py │ ├── apps.py │ ├── __pycache__ │ │ ├── admin.cpython-37.pyc │ │ ├── __init__.cpython-37.pyc │ │ └── models.cpython-37.pyc │ ├── admin.py │ └── models.py ├── PATIENT │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-37.pyc │ │ │ └── 0001_initial.cpython-37.pyc │ │ └── 0001_initial.py │ ├── tests.py │ ├── views.py │ ├── apps.py │ ├── __pycache__ │ │ ├── admin.cpython-37.pyc │ │ ├── models.cpython-37.pyc │ │ └── __init__.cpython-37.pyc │ ├── admin.py │ ├── models.py │ └── ReadMe.txt ├── COMMON_APP │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-37.pyc │ │ │ ├── 0001_initial.cpython-37.pyc │ │ │ └── 0002_auto_20200524_1511.cpython-37.pyc │ │ ├── 0002_auto_20200524_1511.py │ │ └── 0001_initial.py │ ├── tests.py │ ├── apps.py │ ├── __pycache__ │ │ ├── admin.cpython-37.pyc │ │ ├── models.cpython-37.pyc │ │ ├── utils.cpython-37.pyc │ │ ├── views.cpython-37.pyc │ │ └── __init__.cpython-37.pyc │ ├── admin.py │ ├── utils.py │ ├── models.py │ └── views.py ├── Application_Main │ ├── __init__.py │ ├── __pycache__ │ │ ├── urls.cpython-37.pyc │ │ ├── wsgi.cpython-37.pyc │ │ ├── __init__.cpython-37.pyc │ │ └── settings.cpython-37.pyc │ ├── asgi.py │ ├── wsgi.py │ ├── urls.py │ └── settings.py ├── templates │ ├── verification.html │ ├── patient_invoice.html │ ├── medical_history.html │ ├── docter_prescription.html │ ├── update_status.html │ ├── login.html │ ├── create_prescription.html │ ├── about.html │ ├── home.html │ ├── my_appointment.html │ ├── register.html │ ├── create_appointment.html │ ├── hr_accounting.html │ ├── hr_dashboard.html │ ├── docter_profile.html │ ├── invoice.html │ ├── patient_profile.html │ ├── create_patient.html │ ├── update_patient.html │ ├── receptionist_dashboard.html │ ├── update_docter.html │ └── nav.html ├── db.sqlite3 ├── static │ ├── 2.png │ ├── home.png │ ├── Python-Libraries.jpg │ ├── 1_Jy5kZCFLp2H26YR5tr-3kg.jpeg │ ├── GIS-Python-Libraries-Featured.png │ └── what-is-hacking-10122018182221.png ├── media │ └── report │ │ └── undraw_page_not_found_su7k.png └── manage.py ├── requirements.txt └── README.md /Application_Main/DOCTER/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/PATIENT/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/Application_Main/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/PATIENT/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/templates/verification.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /Application_Main/PATIENT/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Application_Main/PATIENT/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render 2 | 3 | # Create your views here. 4 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class DocterConfig(AppConfig): 5 | name = 'DOCTER' 6 | -------------------------------------------------------------------------------- /Application_Main/db.sqlite3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/db.sqlite3 -------------------------------------------------------------------------------- /Application_Main/static/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/static/2.png -------------------------------------------------------------------------------- /Application_Main/PATIENT/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class PatientConfig(AppConfig): 5 | name = 'PATIENT' 6 | -------------------------------------------------------------------------------- /Application_Main/static/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/static/home.png -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class CommonAppConfig(AppConfig): 5 | name = 'COMMON_APP' 6 | -------------------------------------------------------------------------------- /Application_Main/static/Python-Libraries.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/static/Python-Libraries.jpg -------------------------------------------------------------------------------- /Application_Main/static/1_Jy5kZCFLp2H26YR5tr-3kg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/static/1_Jy5kZCFLp2H26YR5tr-3kg.jpeg -------------------------------------------------------------------------------- /Application_Main/DOCTER/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/DOCTER/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/DOCTER/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/DOCTER/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/DOCTER/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/DOCTER/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/PATIENT/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/PATIENT/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/PATIENT/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/PATIENT/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/static/GIS-Python-Libraries-Featured.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/static/GIS-Python-Libraries-Featured.png -------------------------------------------------------------------------------- /Application_Main/static/what-is-hacking-10122018182221.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/static/what-is-hacking-10122018182221.png -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/__pycache__/admin.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/__pycache__/admin.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/__pycache__/models.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/__pycache__/models.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/__pycache__/utils.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/__pycache__/utils.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/__pycache__/views.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/__pycache__/views.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/PATIENT/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/PATIENT/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/PATIENT/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | from PATIENT.models import * 5 | admin.site.register(Patient) 6 | admin.site.register(Invoice) -------------------------------------------------------------------------------- /Application_Main/media/report/undraw_page_not_found_su7k.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/media/report/undraw_page_not_found_su7k.png -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/Application_Main/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/Application_Main/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/Application_Main/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/Application_Main/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/DOCTER/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | from DOCTER.models import * 5 | admin.site.register(Docter) 6 | admin.site.register(Prescription2) 7 | -------------------------------------------------------------------------------- /Application_Main/Application_Main/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/Application_Main/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/Application_Main/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/Application_Main/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/DOCTER/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/DOCTER/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/PATIENT/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/PATIENT/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/DOCTER/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/DOCTER/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/PATIENT/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/PATIENT/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | from .models import * 5 | admin.site.register(Receptionist) 6 | admin.site.register(Appointment) 7 | admin.site.register(HR) 8 | 9 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/migrations/__pycache__/0002_prescription2_total.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/DOCTER/migrations/__pycache__/0002_prescription2_total.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/migrations/__pycache__/0002_auto_20200524_1511.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devankit01/Django-Hospital-Management-System/HEAD/Application_Main/COMMON_APP/migrations/__pycache__/0002_auto_20200524_1511.cpython-37.pyc -------------------------------------------------------------------------------- /Application_Main/Application_Main/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for Application_Main project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Application_Main.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /Application_Main/Application_Main/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for Application_Main project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Application_Main.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/migrations/0002_prescription2_total.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.6 on 2020-05-24 11:00 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('DOCTER', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='prescription2', 15 | name='total', 16 | field=models.IntegerField(default=0), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/utils.py: -------------------------------------------------------------------------------- 1 | from io import BytesIO 2 | from django.http import HttpResponse 3 | from django.template.loader import get_template 4 | 5 | from xhtml2pdf import pisa 6 | 7 | def render_to_pdf(template_src, context_dict={}): 8 | template = get_template(template_src) 9 | html = template.render(context_dict) 10 | result = BytesIO() 11 | pdf = pisa.pisaDocument(BytesIO(html.encode("ISO-8859-1")), result) 12 | if not pdf.err: 13 | return HttpResponse(result.getvalue(), content_type='application/pdf') 14 | return None -------------------------------------------------------------------------------- /Application_Main/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Application_Main.settings') 9 | try: 10 | from django.core.management import execute_from_command_line 11 | except ImportError as exc: 12 | raise ImportError( 13 | "Couldn't import Django. Are you sure it's installed and " 14 | "available on your PYTHONPATH environment variable? Did you " 15 | "forget to activate a virtual environment?" 16 | ) from exc 17 | execute_from_command_line(sys.argv) 18 | 19 | 20 | if __name__ == '__main__': 21 | main() 22 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | arabic-reshaper==3.0.0 2 | asgiref==3.8.1 3 | asn1crypto==1.5.1 4 | backports.zoneinfo==0.2.1 5 | certifi==2024.2.2 6 | cffi==1.16.0 7 | chardet==5.2.0 8 | charset-normalizer==3.3.2 9 | click==8.1.7 10 | cryptography==42.0.5 11 | cssselect2==0.7.0 12 | Django==3.2.1 13 | html5lib==1.1 14 | idna==3.7 15 | lxml==5.2.1 16 | oscrypto==1.3.0 17 | pillow==10.3.0 18 | pycparser==2.22 19 | pyHanko==0.24.0 20 | pyhanko-certvalidator==0.26.3 21 | pypdf==4.2.0 22 | pypng==0.20220715.0 23 | python-bidi==0.4.2 24 | pytz==2024.1 25 | PyYAML==6.0.1 26 | qrcode==7.4.2 27 | reportlab==4.0.9 28 | requests==2.31.0 29 | six==1.16.0 30 | sqlparse==0.5.0 31 | svglib==1.5.1 32 | tinycss2==1.3.0 33 | typing-extensions==4.11.0 34 | tzlocal==5.2 35 | uritools==4.0.2 36 | urllib3==2.2.1 37 | webencodings==0.5.1 38 | xhtml2pdf==0.2.15 39 | -------------------------------------------------------------------------------- /Application_Main/PATIENT/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | 4 | # import in-Built User Models 5 | from django.contrib.auth.models import User 6 | 7 | # Create your models here. 8 | class Patient(models.Model): 9 | name = models.CharField(max_length=40) 10 | phone = models.CharField(max_length=12,default="",unique=True) 11 | email = models.CharField(max_length=50,unique=True) 12 | gender = models.CharField(max_length=30) 13 | address = models.CharField(max_length=200) 14 | age = models.IntegerField(default= 0 ) 15 | blood = models.CharField(max_length=10) 16 | medical = models.CharField(max_length=100) 17 | case = models.CharField(max_length=20) 18 | username = models.OneToOneField(User,on_delete = models.CASCADE) 19 | 20 | class Invoice(models.Model): 21 | patient = models.OneToOneField(Patient,on_delete = models.CASCADE) 22 | outstanding = models.CharField(max_length = 10) 23 | paid = models.CharField(max_length = 10) -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/migrations/0002_auto_20200524_1511.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.6 on 2020-05-24 09:41 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ('PATIENT', '0001_initial'), 13 | ('DOCTER', '0001_initial'), 14 | ('COMMON_APP', '0001_initial'), 15 | ] 16 | 17 | operations = [ 18 | migrations.AddField( 19 | model_name='appointment', 20 | name='docterid', 21 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='DOCTER.Docter'), 22 | ), 23 | migrations.AddField( 24 | model_name='appointment', 25 | name='patientid', 26 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='PATIENT.Patient'), 27 | ), 28 | ] 29 | -------------------------------------------------------------------------------- /Application_Main/templates/patient_invoice.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Update Docter 5 | 6 | 7 | 8 | 9 | 10 | {% include "nav.html" %} 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {% for data in data %} 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | {% endfor %} 37 | 38 |
InvoicePaidDateOutstanding
Invoice {{ data.paid }} {{ data.prescripted_date }} {{ data.outstanding }}
39 |
40 | 41 | -------------------------------------------------------------------------------- /Application_Main/templates/medical_history.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Mediacal Prescrition 6 | 7 | 16 | 17 | 18 | {% include "nav.html" %} 19 |
20 | 21 |

22 | 23 | {% for i in data %} 24 |
25 |

{{ i.prescripted_date }}

26 |

Symptoms : {{ i.symptoms}}

27 |

Prescription : {{ i.prescription }}

28 | 29 |
30 |

31 | {% endfor %} 32 |
33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Application_Main/templates/docter_prescription.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dashboard 6 | 7 | 16 | 17 | 18 | {% include "nav.html" %} 19 |
20 | Create Prescription 21 |

22 | 23 | {% for data in pers %} 24 |
25 |

{{ data.date }}

26 |

Symptoms : {{ data.symptoms}}

27 |

Prescription : {{ data.prescription }}

28 |

Patient Name : {{ data.patient.name }}

29 | 30 |
31 |

32 | {% endfor %} 33 |
34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from django.contrib.auth.models import User 3 | from DOCTER.models import * 4 | from PATIENT.models import * 5 | # Create your models here. 6 | 7 | # Model For Receptionist 8 | class Receptionist(models.Model): 9 | name = models.CharField(max_length=40) 10 | phone = models.CharField(max_length=12,default="",unique=True) 11 | email = models.CharField(max_length=50,unique=True) 12 | address = models.CharField(max_length=200) 13 | username = models.OneToOneField(User,on_delete = models.CASCADE) 14 | 15 | 16 | 17 | # Model For Appointment 18 | class Appointment(models.Model): 19 | docterid = models.ForeignKey('DOCTER.Docter',on_delete = models.CASCADE) 20 | patientid = models.ForeignKey('PATIENT.Patient',on_delete = models.CASCADE) 21 | time = models.CharField(max_length =40) 22 | date = models.CharField(max_length=40,default="") 23 | status = models.BooleanField(max_length = 15, default=0) 24 | 25 | 26 | # Model For HR 27 | class HR(models.Model): 28 | name = models.CharField(max_length=40) 29 | phone = models.CharField(max_length=12,default="",unique=True) 30 | email = models.CharField(max_length=50,unique=True) 31 | address = models.CharField(max_length=200) 32 | username = models.OneToOneField(User,on_delete = models.CASCADE) -------------------------------------------------------------------------------- /Application_Main/templates/update_status.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Update Status 6 | 7 | 26 | 27 | 28 | {% include "nav.html" %} 29 |
30 | {% csrf_token %} 31 |

32 |

33 | 34 | 35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Django Hospital Management System 2 | 3 | 4 | 5 | Welcome to the Django Hospital Management System repository! This project is built using HTML, CSS, JavaScript, and the Python Django framework. 6 | 7 | ## Overview 8 | 9 | Django Hospital Management System is a comprehensive application designed to efficiently manage hospital operations. It covers various aspects of hospital management, including patient and doctor records, appointments, prescriptions, receptionist tasks, HR functions, and more. 10 | 11 | ## Features 12 | 13 | - Keep track of patient and doctor details 14 | - Manage appointments and prescriptions 15 | - Receptionist functionalities, including appointment creation and fee management 16 | - HR section for doctor profile and status management 17 | - Automated reminders for outstanding fees sent to patients via email 18 | - Dynamically generated invoice bills for patients and HR 19 | - User-friendly and intuitive interface 20 | 21 | ## How to Use 22 | 23 | 1. Clone the repository to your local machine. 24 | 2. Install the required dependencies using the command: `pip install -r requirements.txt` 25 | 3. Navigate to the project directory and run the development server: `python manage.py runserver` 26 | 4. Open your web browser and visit `http://localhost:8000` to access the application. 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Application_Main/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Login 5 | 6 | 7 | 26 | 27 | 28 | {% include "nav.html" %} 29 | 30 | 31 |
32 |
33 |
34 | {% csrf_token %} 35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Application_Main/templates/create_prescription.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dashboard 6 | 7 | 27 | 28 | 29 | {% include "nav.html" %} 30 |
31 | {% csrf_token %} 32 |

33 |

34 |

39 | 40 |
41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | from PATIENT.models import * 3 | from .models import * 4 | from COMMON_APP.models import * 5 | # Create your models here. 6 | from django.contrib.auth.models import User 7 | 8 | # Create your models here. 9 | class Docter(models.Model): 10 | name = models.CharField(max_length=40) 11 | phone = models.CharField(max_length=12,default="",unique=True) 12 | email = models.CharField(max_length=50,unique=True) 13 | gender = models.CharField(max_length=30) 14 | address = models.CharField(max_length=200) 15 | age = models.IntegerField(default= 0) 16 | blood = models.CharField(max_length=10) 17 | username = models.OneToOneField(User,on_delete = models.CASCADE) 18 | status = models.BooleanField(default = 0) 19 | department = models.CharField(max_length=30 , default = "") 20 | attendance = models.IntegerField(default = 0) 21 | salary = models.IntegerField(default = 10000) 22 | 23 | 24 | 25 | 26 | # Prescription Model 27 | 28 | 29 | class Prescription2(models.Model): 30 | prescription = models.CharField(max_length=200) 31 | symptoms = models.CharField(max_length=200) 32 | patient = models.ForeignKey(Patient,on_delete = models.CASCADE,unique = False) 33 | docter = models.ForeignKey(Docter,on_delete = models.CASCADE,unique = False) 34 | appointment = models.ForeignKey('COMMON_APP.Appointment',on_delete = models.CASCADE,unique = False) 35 | prescripted_date = models.DateField(auto_now = True) 36 | outstanding = models.IntegerField(default = 0) 37 | paid = models.IntegerField(default = 0) 38 | total = models.IntegerField(default = 0) 39 | 40 | 41 | # HR Dashboard Data -------------------------------------------------------------------------------- /Application_Main/templates/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 22 | 23 | 24 | 25 | {% include "nav.html" %} 26 |
27 |
28 |
29 | {% load static %} 30 | My image 31 |
32 |
33 |

About DocMed

34 |

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum 35 | .

36 | 37 |
38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Application_Main/templates/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 22 | 23 | 24 | 25 | {% include "nav.html" %} 26 |
27 |
28 |
29 | {% load static %} 30 | My image 31 |
32 |
33 |

Welcome To DocMed

34 |

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum 35 | .

36 | 37 |
38 |
39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /Application_Main/templates/my_appointment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Appointment 6 | 7 | 12 | 13 | 14 | {% include "nav.html" %} 15 | 16 | 17 | 18 | 19 | 20 |
21 |
22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | {% if user == 'P' %} 32 | 33 | {% else %} 34 | 35 | {% endif %} 36 | 37 | 38 | 39 | 40 | 41 | {% for data in data %} 42 | 43 | 44 | 45 | {% if user == 'P' %} 46 | 47 | {% else %} 48 | 49 | {% endif %} 50 | 51 | 52 | 53 | {% if data.status %} 54 | 55 | {% else %} 56 | 57 | {% endif %} 58 | 59 | 60 | {% endfor %} 61 | 62 | 63 |
DateTimeDocterPatientStatus
{{ data.date }} {{ data.time }} {{ data.docterid.name }} {{ data.patientid.name }} CompletedPending
64 | 65 |
66 |
67 |
68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Application_Main/PATIENT/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.6 on 2020-05-24 09:41 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Patient', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('name', models.CharField(max_length=40)), 22 | ('phone', models.CharField(default='', max_length=12, unique=True)), 23 | ('email', models.CharField(max_length=50, unique=True)), 24 | ('gender', models.CharField(max_length=30)), 25 | ('address', models.CharField(max_length=200)), 26 | ('age', models.IntegerField(default=0)), 27 | ('blood', models.CharField(max_length=10)), 28 | ('medical', models.CharField(max_length=100)), 29 | ('case', models.CharField(max_length=20)), 30 | ('username', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 31 | ], 32 | ), 33 | migrations.CreateModel( 34 | name='Invoice', 35 | fields=[ 36 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 37 | ('outstanding', models.CharField(max_length=10)), 38 | ('paid', models.CharField(max_length=10)), 39 | ('patient', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='PATIENT.Patient')), 40 | ], 41 | ), 42 | ] 43 | -------------------------------------------------------------------------------- /Application_Main/templates/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Register 5 | 6 | 7 | 26 | 27 | 28 | 29 | {% include "nav.html" %} 30 | 31 | 32 |
33 |
34 |
35 | {% csrf_token %} 36 |
37 |
38 |
39 |
40 |
41 |
42 | 43 | 44 | 45 | 46 |
47 |

Patient or Docter

48 |
53 |
54 | 55 |
56 |
57 |
58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.6 on 2020-05-24 09:41 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ] 15 | 16 | operations = [ 17 | migrations.CreateModel( 18 | name='Appointment', 19 | fields=[ 20 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 21 | ('time', models.CharField(max_length=40)), 22 | ('date', models.CharField(default='', max_length=40)), 23 | ('status', models.BooleanField(default=0, max_length=15)), 24 | ], 25 | ), 26 | migrations.CreateModel( 27 | name='Receptionist', 28 | fields=[ 29 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 30 | ('name', models.CharField(max_length=40)), 31 | ('phone', models.CharField(default='', max_length=12, unique=True)), 32 | ('email', models.CharField(max_length=50, unique=True)), 33 | ('address', models.CharField(max_length=200)), 34 | ('username', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 35 | ], 36 | ), 37 | migrations.CreateModel( 38 | name='HR', 39 | fields=[ 40 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 41 | ('name', models.CharField(max_length=40)), 42 | ('phone', models.CharField(default='', max_length=12, unique=True)), 43 | ('email', models.CharField(max_length=50, unique=True)), 44 | ('address', models.CharField(max_length=200)), 45 | ('username', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 46 | ], 47 | ), 48 | ] 49 | -------------------------------------------------------------------------------- /Application_Main/templates/create_appointment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Login 5 | 6 | 7 | 27 | 28 | 29 | {% include "nav.html" %} 30 | 31 | 32 |
33 |
34 |
35 | {% csrf_token %} 36 |
37 |
38 |
39 |

Patient Name

40 |
45 |
46 |

Docter Name

47 |
52 |
53 |

Status

54 |
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 | -------------------------------------------------------------------------------- /Application_Main/DOCTER/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.6 on 2020-05-24 09:41 2 | 3 | from django.conf import settings 4 | from django.db import migrations, models 5 | import django.db.models.deletion 6 | 7 | 8 | class Migration(migrations.Migration): 9 | 10 | initial = True 11 | 12 | dependencies = [ 13 | migrations.swappable_dependency(settings.AUTH_USER_MODEL), 14 | ('PATIENT', '0001_initial'), 15 | ('COMMON_APP', '0001_initial'), 16 | ] 17 | 18 | operations = [ 19 | migrations.CreateModel( 20 | name='Docter', 21 | fields=[ 22 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 23 | ('name', models.CharField(max_length=40)), 24 | ('phone', models.CharField(default='', max_length=12, unique=True)), 25 | ('email', models.CharField(max_length=50, unique=True)), 26 | ('gender', models.CharField(max_length=30)), 27 | ('address', models.CharField(max_length=200)), 28 | ('age', models.IntegerField(default=0)), 29 | ('blood', models.CharField(max_length=10)), 30 | ('status', models.BooleanField(default=0)), 31 | ('department', models.CharField(default='', max_length=30)), 32 | ('attendance', models.IntegerField(default=0)), 33 | ('salary', models.IntegerField(default=10000)), 34 | ('username', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), 35 | ], 36 | ), 37 | migrations.CreateModel( 38 | name='Prescription2', 39 | fields=[ 40 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 41 | ('prescription', models.CharField(max_length=200)), 42 | ('symptoms', models.CharField(max_length=200)), 43 | ('prescripted_date', models.DateField(auto_now=True)), 44 | ('outstanding', models.IntegerField(default=0)), 45 | ('paid', models.IntegerField(default=0)), 46 | ('appointment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='COMMON_APP.Appointment')), 47 | ('docter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='DOCTER.Docter')), 48 | ('patient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='PATIENT.Patient')), 49 | ], 50 | ), 51 | ] 52 | -------------------------------------------------------------------------------- /Application_Main/templates/hr_accounting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dashboard 5 | 6 | 17 | 18 | 19 | {% include "nav.html" %} 20 | 21 | 22 |
23 | 24 |
25 |
26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | {% for data in individual %} 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | {% endfor %} 51 | 52 | 53 |
PatientOutstandingPaidReminder
{{ data.patient.name }} {{ data.outstanding }} {{ data.paid }} Send Reminder
54 |
55 | 56 | 57 | 58 |
59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | {% for data in consulation %} 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | {% endfor %} 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 |
DatePatientPaidOutstandingTotalInvoice
{{ data.prescripted_date }} {{ data.patient.name }} {{ data.paid }} {{ data.outstanding }} {{ data.total}} Invoice
101 |
102 |
103 |
104 | 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /Application_Main/PATIENT/ReadMe.txt: -------------------------------------------------------------------------------- 1 | Project Structure 2 | 3 | Application Main 4 | - Application Main 5 | - url.py 6 | - All urls of the website 7 | - settings.py 8 | - Necessary Configuration 9 | - COMMON_APP 10 | - models.py 11 | - Receptionist 12 | - Appointment 13 | - HR 14 | - views.py 15 | - All Views Functions 16 | - DOCTER 17 | - models.py 18 | - Docter 19 | - Prescription2 20 | - media 21 | - All Patient Reports Stored Here 22 | - PATIENT 23 | - models.py 24 | - Patient 25 | - Invoice 26 | - static 27 | - Project Images 28 | - templates 29 | - All Templates 30 | - db.sqlite3 31 | - Stored Data 32 | - manage.py 33 | 34 | 35 | 36 | How To Start Project ? 37 | Download the zip file , unzip it and go to Application_Main Folder , open cmd at that location and run command "manage.py runserver" , Server will started , copy the location and open in browser. 38 | 39 | 40 | 41 | Patient Login - Username=>Password 42 | Patient1=>1 43 | Patient2=>1 44 | Docter Login - Username=>Password 45 | Docter1=>1 46 | Docter2=>1 47 | Receptionist Login - Username=>Password 48 | r1=>ankit@98 49 | HR Login - Username=>Password 50 | hr1=>ankit@98 51 | 52 | 53 | 54 | Functionalities 55 | 56 | 1. Patient can register himself , login , can see his/her appointment , invoice and payments he/she have done with dynamic generated invoice pdf , date and more info. He/She can see medical history (Prescrition given by the docter) as well.He/she can also manage his/her Profile or edit/update it. 57 | 58 | 2. Docter can regsiter himself , login , can able to see his/her own appoinments with patients , can able to create prescription , can see his/her last given prescription and Patient name dynamically removed after Prescription Given. He/she can also manage his/her Profile or edit/update it. 59 | 60 | 3. Receptionist can not register , can only login as per requirement. A Receptionist can see total appointments , appointments done , upcoming appointments . He/she can create appoitnment b/w docter and patient with time and date , after appointment he/she can also update paid and outstanding amount and can also update status pf appointment ,i.e,Pending or completed .He/she can create patient with complete details , outstanding and Paid amount. 61 | 62 | 4. HR can not register , can only login as per requirement. HR can see Total docters , Total Patients and On Duty Docters . He can config Docter Profile along with department , attendance , salary , status (active/inactive) and also remove docter.In accounting part he/she can send emails by clicking a button and mail will be sended with amount information on Patient email. He can see Consulation's information and dynamic generated invoice. -------------------------------------------------------------------------------- /Application_Main/templates/hr_dashboard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | HR Dashboard 5 | 6 | 17 | 18 | 19 | {% include "nav.html" %} 20 | 21 | 22 | 23 | 24 |
25 |
26 | 27 |
28 |
Total Docters
29 |
{{ all_d }}
30 | 31 |
32 |
33 |
34 |
35 |
Total Patients
36 |
{{ all_p }}
37 | 38 | 39 |
40 |
41 |
42 |
43 |
On Duty Doctors
44 |
{{ active_d }}
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 | {% for data in all_data %} 78 | 79 | 80 | 81 | 82 | 83 | 84 | {% if data.status %} 85 | 86 | {% else %} 87 | 88 | {% endif %} 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | {% endfor %} 98 | 99 | 100 |
NamePhoneEmailGenderAgeStatusDepartmentAttendanceSalaryUpdate Remove
{{ data.name }} {{ data.phone }} {{ data.email }} {{ data.gender }} {{ data.age }} Active Inactive {{ data.department }} {{ data.attendance }} {{ data.salary }}UpdateRemove
101 |
102 |
103 |
104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /Application_Main/templates/docter_profile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 26 | 27 | 28 | 29 | 30 | {% include "nav.html" %} 31 | 32 |
33 | {% csrf_token %} 34 |
35 | 36 |
37 |
38 |
39 |
40 |

Gender

41 |
48 |
49 |
50 |

Blood Group

51 |

68 |
69 | 70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 |
78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /Application_Main/Application_Main/urls.py: -------------------------------------------------------------------------------- 1 | """Application_Main URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/3.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path 18 | from COMMON_APP.views import * 19 | from django.conf import settings 20 | from django.conf.urls.static import static 21 | 22 | urlpatterns = [ 23 | path('admin/', admin.site.urls), 24 | # Home Page 25 | path('', home , name = 'home' ), 26 | path('register', register , name = 'register' ), 27 | path('login', login , name = 'login' ), 28 | path('about', about , name = 'about' ), 29 | 30 | path('logout', logout , name = 'logout' ), 31 | path('profile/(?P.*)/$', profile , name = 'profile' ), 32 | path('dashboard/(?P.*)/$', dashboard , name = 'dashboard'), 33 | path('receptionist_dashboard/(?P.*)/$', receptionist_dashboard , name = 'receptionist_dashboard'), 34 | path('create_appointment/(?P.*)/$', create_appointment , name = 'create_appointment'), 35 | path('delete_patient/(?P\d+)/$', delete_patient , name = 'delete_patient'), 36 | path('update_patient/(?P\d+)/$', update_patient , name = 'update_patient'), 37 | 38 | path('create_patient/', create_patient , name = 'create_patient'), 39 | path('myappointment/', myappointment , name = 'myappointment'), 40 | path('docter_appointment/', docter_appointment , name = 'docter_appointment'), 41 | path('docter_prescription/', docter_prescription , name = 'docter_prescription'), 42 | path('create_prescription/', create_prescription , name = 'create_prescription'), 43 | path('medical_history/', medical_history , name = 'medical_history'), 44 | path('update_status/(?P\d+)/$', update_status , name = 'update_status'), 45 | path('hr_dashboard/', hr_dashboard , name = 'hr_dashboard'), 46 | path('hr_accounting/', hr_accounting , name = 'hr_accounting'), 47 | path('update_docter/(?P\d+)/$', update_docter , name = 'update_docter'), 48 | path('delete_docter/', delete_docter , name = 'delete_docter'), 49 | path('patient_invoice/', patient_invoice , name = 'patient_invoice'), 50 | path('get_pdf/(?P\d+)/$', get_pdf , name = 'get_pdf'), 51 | path('send_reminder/(?P\d+)/$', send_reminder , name = 'send_reminder'), 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | ] 73 | 74 | if settings.DEBUG: 75 | urlpatterns += static(settings.STATIC_URL,document_root= settings.STATIC_ROOT) 76 | urlpatterns += static(settings.MEDIA_URL,document_root= settings.MEDIA_ROOT) 77 | 78 | 79 | -------------------------------------------------------------------------------- /Application_Main/templates/invoice.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Invoice 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 |
23 |
24 |
25 | 26 | 27 |
28 |

Invoice

29 | 30 |
31 |
32 | 33 |
34 | 35 |
36 |
37 |

Patient Information

38 |

{{ data.patient.name}}

39 |

{{ data.patient.phone }}

40 |

{{ data.patient.address }}

41 |

{{ data.patient.email }}

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 |
DatePaidOutstanding
{{ data.prescripted_date }}{{ data.paid }}{{ data.outstanding }}
69 |
70 |
71 | 72 | 73 |
74 |
75 |
76 |
77 | 78 | 79 | 80 |
81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Application_Main/templates/patient_profile.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 26 | 27 | 28 | 29 | 30 | {% include "nav.html" %} 31 | 32 |
33 | {% csrf_token %} 34 |
35 | 36 |
37 |
38 |
39 |
40 |

Gender

41 |
48 |
49 |
50 |

Blood Group

51 |

68 |
69 |
70 |
71 |
72 | 73 | 74 | 75 | 76 | 77 | 78 |
79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Application_Main/templates/create_patient.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 26 | 27 | 28 | 29 | 30 | {% include "nav.html" %} 31 | 32 |
33 | {% csrf_token %} 34 |
35 |
36 | 37 | 38 |
39 |
40 |
41 |
42 |

Gender

43 |
50 |
51 |
52 |

Blood Group

53 |

70 |

71 |

72 |

73 | 74 |
75 |
76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Application_Main/templates/update_patient.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home 5 | 6 | 7 | 26 | 27 | 28 | 29 | 30 | {% include "nav.html" %} 31 | 32 |
33 | {% csrf_token %} 34 |
35 |
36 | 37 | 38 |
39 |
40 |
41 |
42 |

Gender

43 |
50 |
51 |
52 |

Blood Group

53 |

70 |

71 |

72 |

73 | 74 |
75 |
76 |
77 | 78 | 79 | 80 | 81 | 82 | 83 |
84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Application_Main/templates/receptionist_dashboard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dashboard 5 | 6 | 19 | 20 | 21 | {% include "nav.html" %} 22 | 23 | 24 | 25 | 26 |
27 |
28 | 29 |
30 |
Total Appointments
31 |
{{ Total }}
32 | 33 |
34 |
35 |
36 |
37 |
Appointments Done
38 |
{{ Done }}
39 | 40 | 41 |
42 |
43 |
44 |
45 |
Upcoming Appointments
46 |
{{ Pending }}
47 | 48 | 49 |
50 |
51 |
52 |
53 | 54 |
55 |
56 |
57 | Create Appointment 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | {% for data in all_data %} 73 | 74 | 75 | 76 | 77 | 78 | {% if data.status %} 79 | 80 | {% else %} 81 | 82 | {% endif %} 83 | 84 | 85 | 86 | 87 | {% endfor %} 88 | 89 | 90 |
DateTimeDocterPatientStatusAction
{{ data.date }} {{ data.time }} {{ data.docterid.name }} {{ data.patientid.name }}CompletedPending Done
91 |
92 | 93 | 94 | 95 |
96 | Create Patient 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | {% for data in last_patients %} 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | {% endfor %} 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 |
NamePhoneEmailGenderAge
{{ data.name }} {{ data.phone }} {{ data.email }} {{ data.gender }} {{ data.age }}UpdateDelete
136 |
137 |
138 |
139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /Application_Main/templates/update_docter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Update Docter 5 | 6 | 7 | 26 | 27 | 28 | 29 | 30 | {% include "nav.html" %} 31 | 32 |
33 | {% csrf_token %} 34 |
35 | 36 |
37 |
38 |
39 |
40 |

Gender

41 |
48 |
49 |
50 |

Blood Group

51 |

68 |
69 |
70 |
71 |
72 |
73 |

Status

74 |
80 |
81 |
82 | 83 | 84 | 85 | 86 | 87 | 88 |
89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Application_Main/Application_Main/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for Application_Main project. 3 | 4 | Generated by 'django-admin startproject' using Django 3.0.6. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/3.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/3.0/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'kyo3zp1q6x)=p=@1s=yzx)e88(5seb(m_p3@15#7g)anazl!as' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'COMMON_APP', 41 | 'PATIENT', 42 | 'DOCTER' 43 | ] 44 | 45 | MIDDLEWARE = [ 46 | 'django.middleware.security.SecurityMiddleware', 47 | 'django.contrib.sessions.middleware.SessionMiddleware', 48 | 'django.middleware.common.CommonMiddleware', 49 | 'django.middleware.csrf.CsrfViewMiddleware', 50 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 51 | 'django.contrib.messages.middleware.MessageMiddleware', 52 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 53 | ] 54 | 55 | ROOT_URLCONF = 'Application_Main.urls' 56 | 57 | TEMPLATES = [ 58 | { 59 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 60 | 'DIRS': ['templates'], 61 | 'APP_DIRS': True, 62 | 'OPTIONS': { 63 | 'context_processors': [ 64 | 'django.template.context_processors.debug', 65 | 'django.template.context_processors.request', 66 | 'django.contrib.auth.context_processors.auth', 67 | 'django.contrib.messages.context_processors.messages', 68 | ], 69 | }, 70 | }, 71 | ] 72 | 73 | WSGI_APPLICATION = 'Application_Main.wsgi.application' 74 | 75 | 76 | # Email 77 | EMAIL_BACKEND ='django.core.mail.backends.smtp.EmailBackend' 78 | EMAIL_HOST = 'smtp.gmail.com' 79 | EMAIL_USE_TLS = True 80 | EMAIL_PORT = 587 81 | EMAIL_HOST_USER = 'your@gmail.com' 82 | EMAIL_HOST_PASSWORD = 'yourpassword' 83 | 84 | 85 | # Database 86 | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases 87 | 88 | DATABASES = { 89 | 'default': { 90 | 'ENGINE': 'django.db.backends.sqlite3', 91 | 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), 92 | } 93 | } 94 | 95 | 96 | # Password validation 97 | # https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators 98 | 99 | AUTH_PASSWORD_VALIDATORS = [ 100 | { 101 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 102 | }, 103 | { 104 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 105 | }, 106 | { 107 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 108 | }, 109 | { 110 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 111 | }, 112 | ] 113 | 114 | 115 | # Internationalization 116 | # https://docs.djangoproject.com/en/3.0/topics/i18n/ 117 | 118 | LANGUAGE_CODE = 'en-us' 119 | 120 | TIME_ZONE = 'UTC' 121 | 122 | USE_I18N = True 123 | 124 | USE_L10N = True 125 | 126 | USE_TZ = True 127 | 128 | 129 | # Static files (CSS, JavaScript, Images) 130 | # https://docs.djangoproject.com/en/3.0/howto/static-files/ 131 | 132 | STATIC_URL = '/static/' 133 | MEDIA_URL = '/media/' 134 | MEDIA_ROOT = os.path.join(BASE_DIR,'media/report') 135 | STATICFILES_DIRS = [ 136 | os.path.join(BASE_DIR, "static") 137 | 138 | ] -------------------------------------------------------------------------------- /Application_Main/templates/nav.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Application_Main/COMMON_APP/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render , redirect , HttpResponse 2 | from django.contrib import auth 3 | from django.contrib.auth.models import User 4 | from django.http import HttpResponse 5 | from django.views.generic import View 6 | from django import template 7 | from django.template.loader import get_template 8 | from io import BytesIO 9 | import xhtml2pdf.pisa as pisa 10 | from .utils import render_to_pdf #created in step 4 11 | from django.db import IntegrityError 12 | from django.conf import settings 13 | from django.core.files.storage import FileSystemStorage 14 | from DOCTER.models import * 15 | from PATIENT.models import * 16 | from COMMON_APP.models import * 17 | from Application_Main.settings import EMAIL_HOST_USER 18 | from django.core.mail import send_mail 19 | 20 | 21 | # Create your views here. 22 | def home(request): 23 | return render(request , 'home.html',{"user":None}) 24 | 25 | def register(request) : 26 | if request.method == 'POST': 27 | print(request.POST['name']) 28 | print(request.POST['post']) 29 | try: 30 | user = User.objects.get(username=request.POST['username']) 31 | print(user) 32 | return render(request,'register.html') 33 | except User.DoesNotExist: 34 | user = User.objects.create_user(username=request.POST['username'],password=request.POST['pass1']) 35 | if request.POST['post'] == 'Patient': 36 | new = Patient(phone=request.POST['phone'],name=request.POST['name'],email=request.POST['email'],username=user) 37 | new.save() 38 | 39 | c_patient = Invoice(patient = new , outstanding = 0 , paid = 0) 40 | c_patient.save() 41 | 42 | return render(request,'register.html') 43 | else: 44 | new = Docter(phone=request.POST['phone'],name=request.POST['name'],email=request.POST['email'],username=user) 45 | new.save() 46 | return render(request,'register.html') 47 | 48 | print('Registered Successfully') 49 | return render(request,'register.html') 50 | else: 51 | return render(request , 'register.html') 52 | 53 | 54 | # Login 55 | def login(request): 56 | if request.method == 'POST': 57 | try: 58 | # Check User in DB 59 | uname = request.POST['username'] 60 | pwd = request.POST['pass1'] 61 | user_authenticate = auth.authenticate(username=uname,password=pwd) 62 | if user_authenticate != None: 63 | user = User.objects.get(username=uname) 64 | try: 65 | data = Patient.objects.get(username = user) 66 | print(data) 67 | print('Patient has been Logged') 68 | auth.login(request,user_authenticate) 69 | return redirect('dashboard',user= "P") 70 | except: 71 | try: 72 | data = Docter.objects.get(username = user ) 73 | auth.login(request,user_authenticate) 74 | print('Docter has been Logged') 75 | return redirect('dashboard',user = "D") 76 | except: 77 | try: 78 | data = Receptionist.objects.get(username = user ) 79 | auth.login(request,user_authenticate) 80 | print('Receptionist has been Logged') 81 | return redirect('receptionist_dashboard',user = "R") 82 | except: 83 | try: 84 | data = HR.objects.get(username = user ) 85 | auth.login(request,user_authenticate) 86 | print('HR has been Logged') 87 | return redirect('dashboard',user = "H") 88 | except: 89 | return redirect('/') 90 | 91 | 92 | 93 | else: 94 | print('Login Failed') 95 | return render(request,'login.html') 96 | except: 97 | return render(request,'login.html') 98 | return render(request , 'login.html') 99 | 100 | # Logout 101 | def logout(request): 102 | auth.logout(request) 103 | print('Logout') 104 | return redirect('/login') 105 | 106 | 107 | 108 | 109 | # Profile 110 | def profile(request, user): 111 | print(request.user) 112 | userid = User.objects.get(username=request.user) 113 | status = False 114 | if request.user: 115 | status = request.user 116 | if request.method == "POST": 117 | print(request.POST['name']) 118 | if user == "P": 119 | update = Patient.objects.get(username=userid) 120 | update.name = request.POST['name'] 121 | update.phone = request.POST['phone'] 122 | update.email = request.POST['email'] 123 | update.gender = request.POST['gender'] 124 | update.age = request.POST['age'] 125 | update.blood = request.POST['blood'] 126 | update.address = request.POST['address'] 127 | 128 | 129 | update.case = request.POST['case'] 130 | try: 131 | myfile = request.FILES['report'] 132 | fs = FileSystemStorage(location='media/report/') 133 | filename = fs.save(myfile.name,myfile) 134 | # print(name,file) 135 | url = fs.url(filename) 136 | print(url) 137 | update.medical = url 138 | except: 139 | pass 140 | update.save() 141 | return redirect('dashboard',user = user) 142 | else: 143 | update = Docter.objects.get(username=userid) 144 | update.name = request.POST['name'] 145 | update.phone = request.POST['phone'] 146 | update.email = request.POST['email'] 147 | update.gender = request.POST['gender'] 148 | update.age = request.POST['age'] 149 | update.blood = request.POST['blood'] 150 | update.address = request.POST['address'] 151 | update.save() 152 | return redirect('dashboard',user = user) 153 | 154 | 155 | if user == "P": 156 | userdata = Patient.objects.get(username=userid) 157 | return render(request , 'patient_profile.html',{'userdata' : userdata , 'user':user, "status": status}) 158 | 159 | else: 160 | userdata = Docter.objects.get(username=userid) 161 | return render(request , 'docter_profile.html',{'userdata' : userdata , 'user':user, "status": status}) 162 | 163 | 164 | return redirect('/') 165 | 166 | def dashboard(request , user): 167 | print(user) 168 | status = False 169 | if request.user: 170 | status = request.user 171 | if user == "AnonymousUser": 172 | return redirect('home') 173 | 174 | return render(request , 'home.html', {'user':user, "status": status}) 175 | 176 | 177 | 178 | def receptionist_dashboard(request , user): 179 | status = False 180 | if request.user: 181 | status = request.user 182 | row = Appointment.objects.all() 183 | status_done = len(Appointment.objects.filter(status = 1)) 184 | status_pending = len(row) - status_done 185 | last_patients = Patient.objects.all().order_by('-pk')[0:5] 186 | print(last_patients) 187 | return render(request , 'receptionist_dashboard.html' , {'user':user, "status": status , "Total" : len(row) , 188 | "Done" : status_done , "Pending" : status_pending , 'all_data' : row , 'last_patients' : last_patients}) 189 | 190 | 191 | 192 | def create_appointment(request , user): 193 | status = False 194 | if request.user: 195 | status = request.user 196 | 197 | if request.method == "POST": 198 | print(type(request.POST['docter'])) 199 | d_id = int(request.POST['docter']) 200 | p_id = int(request.POST['patient']) 201 | 202 | docter = Docter.objects.get(pk=d_id) 203 | patient = Patient.objects.get(pk=p_id) 204 | 205 | print(d_id, type(d_id)) 206 | p_id = int(request.POST['patient']) 207 | status = int(request.POST['status']) 208 | new_appointment = Appointment(docterid = docter , patientid = patient ,time = request.POST['time'] , date = request.POST['date'] , status = status ) 209 | new_appointment.save() 210 | return redirect('receptionist_dashboard', user = "R") 211 | 212 | patient_names = Patient.objects.all() 213 | docter_names = Docter.objects.all() 214 | 215 | return render(request , 'create_appointment.html' , {'user':user, "status": status , "patient_names" : patient_names , 216 | "docter_names" : docter_names }) 217 | 218 | 219 | 220 | 221 | # Delete Patient 222 | def delete_patient(request , id ): 223 | data = Patient.objects.get(id=id) 224 | data.delete() 225 | return redirect('receptionist_dashboard' , user="R") 226 | 227 | 228 | 229 | # Create Patient => Receptionist 230 | def create_patient(request): 231 | status = False 232 | if request.user: 233 | status = request.user 234 | if request.method =="POST": 235 | try: 236 | user = User.objects.get(username=request.POST['username']) 237 | print(user) 238 | return redirect('receptionist_dashboard', user = "R") 239 | except User.DoesNotExist: 240 | 241 | user = User.objects.create_user(username=request.POST['username'],password='default') 242 | try: 243 | myfile = request.FILES['report'] 244 | fs = FileSystemStorage(location='media/report/') 245 | filename = fs.save(myfile.name,myfile) 246 | # print(name,file) 247 | url = fs.url(filename) 248 | 249 | except: 250 | url = "" 251 | new = Patient(phone=request.POST['phone'],name=request.POST['name'],email=request.POST['email'],username=user,age=request.POST['age'] ,address = request.POST['address'] , gender = request.POST['gender'] , blood = request.POST['blood'] , case = request.POST['case'] , medical = url) 252 | new.save() 253 | 254 | c_patient = Invoice(patient = new , outstanding = request.POST['outstanding'] , paid = request.POST['paid']) 255 | c_patient.save() 256 | return redirect('receptionist_dashboard' , user="R") 257 | 258 | 259 | return render(request , 'create_patient.html' , {'user' : "R" , 'status' :status}) 260 | 261 | 262 | 263 | # Update Patient=> Receptionist 264 | def update_patient(request , id ): 265 | status = False 266 | if request.user: 267 | status = request.user 268 | if request.method == "POST": 269 | update = Patient.objects.get(id=id) 270 | update.name = request.POST['name'] 271 | update.phone = request.POST['phone'] 272 | update.email = request.POST['email'] 273 | update.gender = request.POST['gender'] 274 | update.age = request.POST['age'] 275 | update.blood = request.POST['blood'] 276 | update.address = request.POST['address'] 277 | update.case = request.POST['case'] 278 | try: 279 | myfile = request.FILES['report'] 280 | fs = FileSystemStorage(location='media/report/') 281 | filename = fs.save(myfile.name,myfile) 282 | # print(name,file) 283 | url = fs.url(filename) 284 | print(url) 285 | update.medical = url 286 | except: 287 | pass 288 | update.save() 289 | extra_update = Invoice.objects.get(patient = update) 290 | 291 | extra_update.outstanding = request.POST['outstanding'] 292 | extra_update.paid = request.POST['paid'] 293 | extra_update.save() 294 | return redirect('receptionist_dashboard' , user = "R") 295 | data = Patient.objects.get(id=id) 296 | extra = Invoice.objects.get(patient = data) 297 | return render(request , 'update_patient.html' , {'data':data , 'extra':extra , 'user' :"R" , 'status':status}) 298 | 299 | 300 | def myappointment(request): 301 | status = False 302 | if request.user: 303 | status = request.user 304 | user_id = User.objects.get(username=request.user) 305 | patient= Patient.objects.get(username=user_id) 306 | data = Appointment.objects.filter(patientid=patient) 307 | return render(request , 'my_appointment.html' , {'data':data, 'user' :"P" , 'status':status}) 308 | 309 | 310 | # Docter Appointsments 311 | 312 | def docter_appointment(request): 313 | status = False 314 | if request.user: 315 | status = request.user 316 | user_id = User.objects.get(username=request.user) 317 | docter= Docter.objects.get(username=user_id) 318 | data = Appointment.objects.filter(docterid=docter) 319 | 320 | return render(request , 'my_appointment.html' , {'data':data, 'user' :"D" , 'status':status}) 321 | 322 | 323 | # Docter Prescription 324 | 325 | def docter_prescription(request): 326 | status = False 327 | if request.user: 328 | status = request.user 329 | user_id = User.objects.get(username=request.user) 330 | docter = Docter.objects.get(username=user_id) 331 | print(docter) 332 | pers = Prescription2.objects.filter(docter = docter) 333 | print(len(pers)) 334 | for i in pers: 335 | print(i.patient) 336 | return render(request , 'docter_prescription.html' , {'pers':pers, 'user' :"D" , 'status':status}) 337 | 338 | 339 | # Create Prescription 340 | def create_prescription(request): 341 | status = False 342 | if request.user: 343 | status = request.user 344 | if request.method == 'POST': 345 | 346 | appointment = Appointment.objects.get(id=request.POST['appointment']) 347 | 348 | user_id = User.objects.get(username=request.user) 349 | docter = Docter.objects.get(username=user_id) 350 | new_prescrition = Prescription2(symptoms = request.POST['symptoms'] , prescription = request.POST['prescription'] , patient = appointment.patientid , docter = docter , appointment = appointment) 351 | new_prescrition.save() 352 | return redirect('docter_prescription') 353 | user_id = User.objects.get(username=request.user) 354 | docter = Docter.objects.get(username=user_id) 355 | data = Appointment.objects.filter(docterid=docter, status=0) 356 | print(data) 357 | 358 | return render(request , 'create_prescription.html',{"data":data , 'user' : "D" , 'status' : status}) 359 | 360 | 361 | # Mediacal History 362 | 363 | def medical_history(request): 364 | status = False 365 | if request.user: 366 | status = request.user 367 | user_id = User.objects.get(username=request.user) 368 | print(user_id) 369 | patient = Patient.objects.get(username = user_id) 370 | data = Prescription2.objects.filter(patient = patient) 371 | print(data) 372 | return render(request , 'medical_history.html',{"data":data , 'user' : "P" , 'status' : status}) 373 | 374 | 375 | 376 | # Upadate Status 377 | def update_status(request , id): 378 | print(id) 379 | status = False 380 | if request.user: 381 | status = request.user 382 | if request.method == "POST": 383 | data = Appointment.objects.get(id = id) 384 | pers = Prescription2.objects.get(appointment = data) 385 | pers.outstanding = request.POST['outstanding'] 386 | pers.paid = request.POST['paid'] 387 | pers.total = int(request.POST['outstanding'])+int(request.POST['paid']) 388 | pers.save() 389 | data.status = 1 390 | data.save() 391 | return redirect('receptionist_dashboard' , user = "R") 392 | 393 | return render(request , 'update_status.html' , {'user' : "R" , "id" : id , 'status' : status}) 394 | 395 | 396 | # HR Dashboard 397 | def hr_dashboard(request): 398 | status = False 399 | if request.user: 400 | status = request.user 401 | all_p = Patient.objects.all() 402 | all_d = Docter.objects.all() 403 | active_d = Docter.objects.filter(status = 1) 404 | return render(request , 'hr_dashboard.html' ,{"all_p":len(all_p) ,"all_d":len(all_d) ,"all_data" : all_d , "active_d":len(active_d) ,'user' : "H" , 'status' : status}) 405 | 406 | 407 | 408 | # => Docter Update 409 | def update_docter(request , id): 410 | status = False 411 | if request.user: 412 | status = request.user 413 | if request.method == "POST": 414 | update = Docter.objects.get(id=id) 415 | update.name = request.POST['name'] 416 | update.phone = request.POST['phone'] 417 | update.email = request.POST['email'] 418 | update.gender = request.POST['gender'] 419 | update.age = request.POST['age'] 420 | update.blood = request.POST['blood'] 421 | update.address = request.POST['address'] 422 | update.department = request.POST['department'] 423 | update.salary = request.POST['salary'] 424 | update.status = request.POST['status'] 425 | update.attendance = request.POST['attendance'] 426 | update.save() 427 | return redirect('hr_dashboard') 428 | data = Docter.objects.get(id= id) 429 | return render(request , 'update_docter.html' , {"userdata" : data , 'user' : "H" , 'status' : status}) 430 | 431 | 432 | 433 | # Docter Delete 434 | def delete_docter(request): 435 | return HttpResponse('

You are Not authorized

') 436 | 437 | 438 | 439 | # HR Accounting 440 | def hr_accounting(request): 441 | status = False 442 | if request.user: 443 | status = request.user 444 | individual = Invoice.objects.all() 445 | consulation = Prescription2.objects.all() 446 | 447 | return render(request , 'hr_accounting.html' , {'individual' : individual , 'consulation' : consulation , 'user' : 'H' , 'status' : status}) 448 | 449 | 450 | 451 | # Patient invoice 452 | def patient_invoice(request): 453 | status = False 454 | if request.user: 455 | status = request.user 456 | user_id = User.objects.get(username = request.user) 457 | p = Patient.objects.get(username = user_id) 458 | data = Prescription2.objects.filter(patient = p) 459 | return render(request , 'patient_invoice.html' , {'data':data , 'user' : 'P' , 'status' : status}) 460 | 461 | 462 | 463 | 464 | # About 465 | def about(request): 466 | status = False 467 | if request.user: 468 | status = request.user 469 | return render(request , 'about.html' ) 470 | 471 | 472 | 473 | 474 | # Invoice Generator 475 | def get_pdf(request , id): 476 | data = Prescription2.objects.get(id=id) 477 | pdf_data = {'data':data} 478 | template = get_template('invoice.html') 479 | data_p = template.render(pdf_data) 480 | response = BytesIO() 481 | pdf_page = pisa.pisaDocument(BytesIO(data_p.encode('UTF_8')),response) 482 | if not pdf_page.err: 483 | return HttpResponse(response.getvalue(),content_type = 'application/pdf') 484 | else: 485 | return HttpResponse('Error') 486 | 487 | 488 | 489 | 490 | # Send Reminder 491 | def send_reminder(request,id): 492 | p = Prescription2.objects.get(id=id) 493 | email = p.patient.email 494 | subject = 'Payment Reminder ' 495 | message = 'Your Due Amount is {} outstanding and {} rs. you have already paid'.format(p.outstanding,p.paid) 496 | recepient = [email] 497 | send_mail(subject, message, EMAIL_HOST_USER, recepient, fail_silently = False) 498 | return redirect('hr_accounting') 499 | --------------------------------------------------------------------------------