Build a Complete App with ASP.Net, C#, SQL Lite – Part 2

This is Part 2 of our complete application with Visual Studio, ASP.Net, C# and SQL Lite. In this part we, would plan the data model for our Hospital Management System.

Plan and Setup the Domain Models

The Domain models represents the objects that make up the HospitalMS database. For this tutorial, we would use the following 8 classes.

Also note that the constructors for the classes are not given here for simplicity. So you need to generate the constructors(allArgsConstructor and noArgsConstructor) in the classes.

Patient – this class represents a patient that is admitted to the hospital

public class Patient
{
    public int PatientId { get; set; }
    public string Firstname { get; set; }
    public string Lastname { get; set; }
    public string Email { get; set; }
    public string Address { get; set; }
    public Country Country { get; set; }
    public int CountryId { get; set; }
}

 

Appointment – appointments can be booked by patients

public enum Status
{
    New,
    Confirmed,
    Cancelled
}
public class Appointment
{
    public int AppointmentId { get; set; }
    public Patient Patient { get; set; }
    public int PatientID { get; set; }
    public Physician Physician { get; set; }
    public int PhysicianId { get; set; }
    public string Description { get; set; }
    public DateTime AppointmentDate { get; set; }
    public DateTime AppointmentTime { get; set; }
    public Status Status { get; set; }
    public int DurationInMinutes { get; set; }

}

 

Room – when a patient is admitted, he is assigned to a room

public class Room
{
    public int RoomID { get; set; }
    public string Description { get; set; }
    public int Number { get; set; }
}

 

Admission – records details of patient’s admission

public class Admission
{
    public int AdmissionId { get; set; }
    public string Complaint { get; set; }
    public Patient Patient { get; set; }
    public int PatientId { get; set; }
    public Room Room { get; set; }
    public int RoomId { get; set; }
    public DateTime AdmissionDate { get; set; }
    public DateTime AdmissionTime { get; set; }

}

 

Discharge – keeps track of when  patient recovers and is discharged

public class Discharge
{
    public int DischargeId { get; set; }
    public Patient Patient { get; set; }
    public int PatientId { get; set; }
    public DateTime DischargeDate { get; set; }
    public DateTime DischargeTime { get; set; }
    public string Details { get; set; }
}

 

Physician – a record of doctor and nurses

public class Physician
{
    public int PhysicianId { get; set; }
    public string Firstname { get; set; }
    public string Lastname { get; set; }
    public List<Specialty> Specialties { get; set; }
    public DateTime DateOfHire { get; set; }
}

 

Specialty – a physician can have one or more specialties

public class Specialty
{
    public int SpecialtyId { get; set; }
    public string Description { get; set; }
}

 

Country – list of countries.

public class Country
{
    public int CountryId { get; set; }
    public string Name { get; set; }
    public string Capital { get; set; }
}

 

The complete database diagram is given below  and please take some time to study it and and understand how the tables relate.

HospitalMS Database Diagram
HospitalMS Database Diagram
User Avatar

kindsonthegenius

Kindson Munonye is currently completing his doctoral program in Software Engineering in Budapest University of Technology and Economics

View all posts by kindsonthegenius →

Leave a Reply

Your email address will not be published. Required fields are marked *