Clinic Management Project Using ASP.NET MVC 5

In this post, I am going to demonstrate how to build a clinic project covering most basic features, such as patient registration, making appointments and attendances.

Agenda

  • What we are going to build
  • What we are going to use
  • Application Structure
  • Domain Entities
  • Conclusion

https://media.giphy.com/media/ftdVYbwhSiR8woVjGZ/giphy.gif

What we are going to build

We are going to build a clinic management project to support the requirement of a clinic I named Tayo clinic. Here is the basic concept - 

Patients visit the clinic and get registered. In the patient form, we can collect patient's information, such as - name gender, birthdate, height, weight, phone, address, and city.
 
Clinic Management Project Using ASP.NET MVC 5 

Then, they make an appointment by selecting the populated list of available doctors which, in turn, lists the upcoming appointments for the selected doctor. By default, the appointment gets a pending status because it needs to be reviewed.

Clinic Management Project Using ASP.NET MVC 5 

The patient detail view is shown below where we can add the appointments (admin) and the attendances (doctor); we also display them using bootstrap modals and badges.

Clinic Management Project Using ASP.NET MVC 5
 
Clinic Management Project Using ASP.NET MVC 5 

After that, the doctor is going to fill out the attendance form. In this form, we will collect the diagnosis, therapy, and clinic remarks.

Clinic Management Project Using ASP.NET MVC 5 

In the patient's history, we have a view decorated with datatables .

Clinic Management Project Using ASP.NET MVC 5 

In the Report section, we have reports of appointment, attendance, and diagnosis.

Clinic Management Project Using ASP.NET MVC 5 

Appointment report -

Clinic Management Project Using ASP.NET MVC 5 

 Attendance report -

Clinic Management Project Using ASP.NET MVC 5 

Accounts

There are two users; administrator and doctors.

Admin has full application access including adding a new patient and assigning him/her to an available doctor.

The doctor is being registered first by an administrator, and has a view that displays the patients assigned to him.

What we are going to use

Server side

  • Asp.net mvc, a web application development framework
  • Entity Framework an ORM for accessing data.
  • Ninject for inversion of control container to resolve dependencies.
  • Automapper for mapping domain entities to dtos.
Front End

  • Bootstrap 3
  • Jquery Datatables
  • Bootbox js
Design template

Application structure

All persistence ignorant parts are in the Core folder; these are domain entities, Dtos, View models, and interfaces. The Persistence folder contains entity configurations and the implementation of repository interfaces.

Clinic Management Project Using ASP.NET MVC 5 

Domain Entities

Patient has information such as token (auto generated serial number), name, phone, and Age (derived from birthdate). A patient will have one or more appointment or attendance, so that we need to add a collection of appointments and attendances.

  1. public class Patient  
  2. {  
  3.     public int Id { getset; }  
  4.     public string Token { getset; }  
  5.     public string Name { getset; }  
  6.     public Gender Sex { getset; }  
  7.     public DateTime BirthDate { getset; }  
  8.     public string Phone { getset; }  
  9.     public string Address { getset; }  
  10.     public byte CityId { getset; }  
  11.     public City Cities { getset; }  
  12.     public DateTime DateTime { getset; }  
  13.     public string Height { getset; }  
  14.     public string Weight { getset; }  
  15.   
  16.     public int Age  
  17.     {  
  18.         get  
  19.         {  
  20.             var now = DateTime.Today;  
  21.             var age = now.Year - BirthDate.Year;  
  22.             if (BirthDate > now.AddYears(-age)) age--;  
  23.             return age;  
  24.         }  
  25.   
  26.     }  
  27.     public ICollection<Appointment> Appointments { getset; }  
  28.     public ICollection<Attendance> Attendances { getset; }  
  29.   
  30.     public Patient()  
  31.     {  
  32.         Appointments = new Collection<Appointment>();  
  33.         Attendances = new Collection<Attendance>();  
  34.     }  
  35. }  

Appointment has date time, details, and status (approved or pending).

  1. public class Appointment  
  2. {   
  3.     public int Id { getset; }  
  4.     public DateTime StartDateTime { getset; }  
  5.     public string Detail { getset; }  
  6.     public bool Status { getset; }  
  7.     public int PatientId { getset; }  
  8.     public Patient Patient { getset; }  
  9.     public int DoctorId { getset; }  
  10.     public Doctor Doctor { getset; }  
  11. }  

Each attendance has information such as diagnosis, therapy and clinic remarks. It also has reference to specific patient.

  1. public class Attendance  
  2.   {  
  3.       public int Id { getset; }  
  4.       public string ClinicRemarks { getset; }  
  5.       public string Diagnosis { getset; }  
  6.       public string SecondDiagnosis { getset; }  
  7.       public string ThirdDiagnosis { getset; }  
  8.       public string Therapy { getset; }  
  9.       public DateTime Date { getset; }  
  10.       public int PatientId { getset; }  
  11.       public Patient Patient { getset; }  
  12.   }  

Each doctor has one or more appointments and has also a reference to specific specialization.

  1. public class Doctor  
  2. {  
  3.     public int Id { getset; }  
  4.     public string Name { getset; }  
  5.     public string Phone { getset; }  
  6.     public bool IsAvailable { getset; }  
  7.     public string Address { getset; }  
  8.     public int SpecializationId { getset; }  
  9.     public Specialization Specialization { getset; }  
  10.     public string PhysicianId { getset; }  
  11.     public ApplicationUser Physician { getset; }  
  12.     public ICollection<Appointment> Appointments { getset; }  
  13.     public Doctor()  
  14.     {  
  15.         Appointments = new Collection<Appointment>();  
  16.     }   
  17. }  

Conclusion

That’s it, I hope this post is useful for beginners. You can get the source code from here