From b7198c15b0d53a55ce6afc45ee0639e4007df91c Mon Sep 17 00:00:00 2001 From: Shruti-S-Kapse <105603355+Shruti-S-Kapse@users.noreply.github.com> Date: Sun, 15 May 2022 23:15:24 +0530 Subject: [PATCH] Add files via upload --- CheckUp.java | 54 ++++++++++++++++ CheckUpList.java | 105 ++++++++++++++++++++++++++++++++ Doctor.java | 68 +++++++++++++++++++++ DoctorList.java | 114 ++++++++++++++++++++++++++++++++++ HospitalMain.java | 152 ++++++++++++++++++++++++++++++++++++++++++++++ Patient.java | 76 +++++++++++++++++++++++ PatientList.java | 110 +++++++++++++++++++++++++++++++++ Project Video.txt | 4 ++ 8 files changed, 683 insertions(+) create mode 100644 CheckUp.java create mode 100644 CheckUpList.java create mode 100644 Doctor.java create mode 100644 DoctorList.java create mode 100644 HospitalMain.java create mode 100644 Patient.java create mode 100644 PatientList.java create mode 100644 Project Video.txt diff --git a/CheckUp.java b/CheckUp.java new file mode 100644 index 0000000..1f4c773 --- /dev/null +++ b/CheckUp.java @@ -0,0 +1,54 @@ +package loop; + +public class Checkup { + Doctor Doctor; + Patient Patient; + int Priority; + String Recomendation; + String Date; + + public Checkup(Doctor Doctor, loop.Patient Patient, int Priority, String Recomendation, String Date) { + this.Doctor = Doctor; + this.Patient = Patient; + this.Priority = Priority; + this.Recomendation = Recomendation; + this.Date = Date; + } + public Doctor getDoctor() { + return Doctor; + } + public void setDoctor(Doctor Doctor) { + this.Doctor = Doctor; + } + public Patient getPatient() { + return Patient; + } + public void setPatient(Patient Patient) { + this.Patient = Patient; + } + public int getPriority() { + return Priority; + } + public void setPriority(int Priority) { + this.Priority = Priority; + } + public String getRecomendation() { + return Recomendation; + } + public void setRecomendation(String Recomendation) { + this.Recomendation = Recomendation; + } + public String getDate() { + return Date; + } + public void setDate(String Date) { + this.Date = Date; + } + @Override + public String toString() { + return "Checkup [Doctor=" + Doctor.toString() + ", Patient=" + Patient.toString()+ ", priority=" + Priority + ", Recomendation=" + Recomendation + ", Date=" + Date + "]"; + } + + + +} diff --git a/CheckUpList.java b/CheckUpList.java new file mode 100644 index 0000000..c27b9ae --- /dev/null +++ b/CheckUpList.java @@ -0,0 +1,105 @@ +package loop; + + class CheckNode { + Checkup cp; + CheckNode next,prev; + public CheckNode(Checkup cp) + { + next=prev=null; + this.cp=cp; + } + +} + public class CheckUpList{ + CheckNode head,tail; + public CheckUpList() + { + head=null; + tail=null; + } + + public void Enqueue(Checkup cp) + { + CheckNode node=new CheckNode(cp); + + if(head==null || tail==null) + { + head=node; + tail=node; + } + else if(head.cp.getPriority()=cp.getPriority()) + { + tail.prev=node; + node.next=tail; + tail=node; + } + else + { + CheckNode temp=tail; + while(temp!=null) + { + if(temp.cp.getPriority()>=cp.getPriority()) + { + break; + } + temp=temp.next; + } + node.next=temp; + node.prev=temp.prev; + temp.prev.next=node; + temp.prev=node; + } + } + + public Checkup Dequeue() + { + if(head==null) + { + return null; + } + CheckNode checkup=head; + head=head.next; + return checkup.cp; + } + + + + public Patient getPatient(int index) + { + CheckNode temp=head; + int i=0; + while(temp!=null) + { + if(index==1) + { + break; + } + i++; + temp=temp.prev; + } + return temp.cp.getPatient(); + + } + + public void print() + { + CheckNode temp=head; + while(temp!=null) + { + System.out.println(temp.cp.getPriority()+" "+temp.cp.getRecomendation()); + temp=temp.prev; + } + + } + + + +} + diff --git a/Doctor.java b/Doctor.java new file mode 100644 index 0000000..e7f957e --- /dev/null +++ b/Doctor.java @@ -0,0 +1,68 @@ +package loop; + +public class Doctor { + + //Deceleration of Variables + private String Id; + private String Name; + private String Speciality; + private int fees; + + + //Parameterized Constructor + public Doctor(String Id, String Name, String Speciality, int fees) { + this.Id = Id; + this.Name = Name; + this.Speciality = Speciality; + this.fees = fees; + } + + // Getter Setter... + public String getId() + { + return Id; + } + + public void setId(String Id) + { + this.Id = Id; + } + + public String getName() + { + return Name; + } + + public void setName(String Name) + { + this.Name = Name; + } + + public String getSpeciality() + { + return Speciality; + } + + public void setSpeciality(String Speciality) + { + this.Speciality = Speciality; + } + + public int getFees() + { + return fees; + } + + public void setFees(int fees) + { + this.fees = fees; + } + + @Override + public String toString() + { + return "Doctor [Id=" + Id + ", Name=" + Name + ", Speciality=" + Speciality + ", fees=" + fees + "]"; + } + + +} diff --git a/DoctorList.java b/DoctorList.java new file mode 100644 index 0000000..682249d --- /dev/null +++ b/DoctorList.java @@ -0,0 +1,114 @@ +package loop; + + +class dNode +{ + Doctor Doctor ; + dNode next; + dNode prev; + + //Constructor + + public dNode(Doctor Doctor) { + + this.Doctor = Doctor ; + next=null; + prev=null; + } + +} + +//Double Linked list TO insert Doctor +public class DoctorList { + + + dNode head,tail; + public DoctorList() + { + head=null; + tail=null; + } + public void Insert(Doctor Doctor) + { + + dNode node=new dNode(Doctor); + + if(head==null || tail==null) + { + head=node; + tail=node; + } + + else + { + head.next=node; + node.prev=head; + head=node; + } + } + + + public void searchBySpeciality(String Speciality) + { + boolean b=false; + dNode temp=head; + while(temp!=null) + { + if(temp.Doctor.getSpeciality().equals(Speciality)) + { + b=true; + System.out.println(temp.Doctor); + + } + + temp=temp.prev; + } + if(b==false) + { + System.out.println("Doctor with this speciality is not available"); + } + + } + public int Size() + { + dNode temp=head; + int count=0; + while(temp!=null) + { + count++; + temp=temp.prev; + } + return count; + } + + public void AllDoctorInfo() + { + dNode temp=tail; + while(temp!=null) + { + System.out.println(" DoctorId : "+temp.Doctor.getId() +" DoctorName : "+temp.Doctor.getName() +" Doctor Speciality : "+temp.Doctor.getSpeciality() +" Doctor fees : "+temp.Doctor.getFees()); + + temp=temp.next; + } + } + public void PrintData() + { + dNode temp =head; + int count=0; + while(temp!=null) + { + count++; + System.out.println(count+": "+temp.Doctor.toString()); + temp=temp.prev; + } + } + public Doctor getAtIndex(int index) { + dNode temp=head; + for(int i=0;i