In a hospital there are a number of department based on disease. Major department exist are Dermatology, Cardiology, Gynecology, Pathology, etc. Each department is capable to serve the patient in increasingly fair manner. To avail the treatment facility, patient visits to the relevant department where (s)he is allotted a token number. Allotment of token number is purely on the basis of arrival time. Separate queue is maintained for each department. Hospital maintains the following information about the patient.
Based on the above information, solve the following challenges the hospital has to encounter.
i. Allot the unique token number to each patient.
ii. Store all the information related to the above field.
iii. Total number of patient in a particular queue.
iv. How many patients arrive in a day (you can take the average of week or month)?
v. Which type of data structure is preferred by you? Explain its advantages over any other data structure which you may consider near appropriate
I would prefer to solve this problem in object oriented style where we use class, object and queue data structure concept.
Since there are multiple departments, we need to create class for each department. For example if we take cardiology department, the class struture will be as follows:
Class Cardiology:
ii)Attributes : 1)Token Id, 2) Patient name 3)Appointment Date:
Current date 4)Patient Age etc.
So as per the above we need to create classes for the remaining departments with appropriate attribues.
When ever a patient arrives to lets say for Cardiology department, we need to create object for cardiology class and instatiate it with proper attribues.
The object thus create is pushed in to Queue data structure,
v)We are using Queue here because queue works on the concept of First Come First Serve Basis, So here in this scenario, since patients have to be served depending on their arrival time, the patient who comes first will have to be served first. This is the main advantage of queue compared to other data structures.
The patient objects which are pushed first are pulled from queue first.
i) In order to allot unique token number to each patient we can use global variable. whenever a patient object is created global variable is incremented and instantiated to token id attribute of the patient object.
iv)In order to get number of patients visited in particular day , we can pull out the patient objects and filter them according to date and then adding them will give total count of patients.
Thanks
Get Answers For Free
Most questions answered within 1 hours.