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 the patient's information, such as - name gender, birthdate, height, weight, phone, address, and city.
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.
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.
After that, the doctor is going to fill out the attendance form. In this form, we will collect the diagnosis, therapy, and clinic remarks.
In the patient's history, we have a view decorated with data tables.
In the Report section, we have reports of appointments, attendance, and diagnosis.
Appointment report
Attendance report
Accounts
There are two users; administrators and doctors.
Admin has full application access including adding a new patient and assigning him/her to an available doctor.
The doctor is 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.
Domain Entities
The patient has information such as a token (auto-generated serial number), name, phone, and Age (derived from birthdate). A patient will have one or more appointments or attendance, so we need to add a collection of appointments and attendances.
public class Patient
{
public int Id { get; set; }
public string Token { get; set; }
public string Name { get; set; }
public Gender Sex { get; set; }
public DateTime BirthDate { get; set; }
public string Phone { get; set; }
public string Address { get; set; }
public byte CityId { get; set; }
public City Cities { get; set; }
public DateTime DateTime { get; set; }
public string Height { get; set; }
public string Weight { get; set; }
public int Age
{
get
{
var now = DateTime.Today;
var age = now.Year - BirthDate.Year;
if (BirthDate > now.AddYears(-age)) age--;
return age;
}
}
public ICollection<Appointment> Appointments { get; set; }
public ICollection<Attendance> Attendances { get; set; }
public Patient()
{
Appointments = new Collection<Appointment>();
Attendances = new Collection<Attendance>();
}
}
Appointment has date time, details, and status (approved or pending).
public class Appointment
{
public int Id { get; set; }
public DateTime StartDateTime { get; set; }
public string Detail { get; set; }
public bool Status { get; set; }
public int PatientId { get; set; }
public Patient Patient { get; set; }
public int DoctorId { get; set; }
public Doctor Doctor { get; set; }
}
Each attendance has information such as diagnosis, therapy, and clinic remarks. It also has references to specific patients.
public class Attendance
{
public int Id { get; set; }
public string ClinicRemarks { get; set; }
public string Diagnosis { get; set; }
public string SecondDiagnosis { get; set; }
public string ThirdDiagnosis { get; set; }
public string Therapy { get; set; }
public DateTime Date { get; set; }
public int PatientId { get; set; }
public Patient Patient { get; set; }
}
Each doctor has one or more appointments and has also a reference to a specific specialization.
public class Doctor
{
public int Id { get; set; }
public string Name { get; set; }
public string Phone { get; set; }
public bool IsAvailable { get; set; }
public string Address { get; set; }
public int SpecializationId { get; set; }
public Specialization Specialization { get; set; }
public string PhysicianId { get; set; }
public ApplicationUser Physician { get; set; }
public ICollection<Appointment> Appointments { get; set; }
public Doctor()
{
Appointments = new Collection<Appointment>();
}
}
Conclusion
That’s it, I hope this post is useful for beginners. You can get the source code from here