Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
462 views

Java Microproject

The document describes a Java-based patient management system that allows hospitals to better manage patient records and bills. It includes classes like Patient that store a patient's name, ID, disease, and other attributes. The main() method implements a menu system to add, view, and search patients stored in an ArrayList. Exceptions are handled to ensure valid input. The system aims to reduce time spent on record keeping and provide efficient internal communication and access to patient information for hospitals.

Uploaded by

Sohan Wagh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
462 views

Java Microproject

The document describes a Java-based patient management system that allows hospitals to better manage patient records and bills. It includes classes like Patient that store a patient's name, ID, disease, and other attributes. The main() method implements a menu system to add, view, and search patients stored in an ArrayList. Exceptions are handled to ensure valid input. The system aims to reduce time spent on record keeping and provide efficient internal communication and access to patient information for hospitals.

Uploaded by

Sohan Wagh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Introduction:

The main aim of developing this JAVA based Patient Management System project is to
provide better services to hospitals for both the doctors as well as patients.  This Java based
progrom will store all patients and it view patients bill. It can be used in any Hospital, Clinic,
Polyclinic or Pathology labs for maintaining patient details and their test results. This article
contains Hospital Management System source code in java, database files and documentation.
The Patient Record Management System is an offline application for patient record
management. It has been developed on java. It is a virtual showcase for managing patient data,
their names, roll no, year, course of patients etc. The Patient Record Management System will
reduce the amount of time spent by the employees of the hospitals/clinics and also provides a
convenient and efficient means of reaching to patients using cutting-edge-technologies. The main
goal is targeting towards smooth internal communication and functioning for the patients along
with other useful information
You can also check the patient list or you can admit new patient same as Doctors List for
that you have to go to the main menu and select patient than 2 option will occur 1. Add New
Entry or 2. Existing Patients List and by pressing 2 you can check the patient details
Concepts Used:
1. Package used:
The java.util.Scanner class is a simple text scanner which can parse primitive types and strings
using regular expressions. Following are the important points about Scanner −
o A Scanner breaks its input into tokens using a delimiter pattern, which by default
matches whitespace.
o A scanning operation may block waiting for input.
o A Scanner is not safe for multithreaded use without external synchronization.

2. Access Specifiers used:


public specifiers : Public Specifiers achieves the highest level of accessibility. Classes,
methods, and fields declared as public can be accessed any class in the Java program, whether
these classes are in the same package or in another package.
This specifier is used to declare class and constructor.
private specifiers : Private Specifiers achieves the lowest level of accessibility. private
methods and fields can only be accessed within the same class to which the methods and fields
belong. private methods and fields are not visible within subclasses and are not inherited by
subclasses. So, the private access specifier is opposite to the public access specifier. Using
Private Specifier we can achieve encapsulation and hide data from the outside world.
This specifier is used to declare data members in Patient class.

3. Exception Handling used:


Exception handling is done by transferring the execution of a program to an appropriate
exception handler when exception occurs.

• Java try block is used to enclose the code that might throw an exception. It must be used
within the method.

• Java try block must be followed by either catch or finally block.

• Java catch block is used to handle the Exception. It must be used after the try block only.

• You can use multiple catch block with a single try.

• Syntax of java try-catch:


try{
//code that may throw exception
} catch(Exception_class_Name ref)
{
//code that used for handling excption
}

Java Code :
Patient.java
import java.util.*;

public class Patient


{
private String m_name;
private int m_patientno;
private String m_patientdisease;
private String m_year;
private String m_section;

public Patient( String name, int pno, String disease, String year, String section )
{
m_name = name;
m_patientno = pno;
m_patientdisease = disease;
m_year=year;
m_section = section;
}
public String toString()
{
return "Name: " + m_name + ", Pno: " + m_patientno + ", Disease: " + m_patientdisease +
", year: " + m_year+ ", Section: " + m_section;
}

public static void main(String[] args)


{
ArrayList<Patient> patients = new ArrayList<Patient>();
Scanner input = new Scanner(System.in);

int menuChoice = 4;
do {
System.out.println("\t:::::>>>>>Patient Record Management<<<<<:::::");
System.out.println("\t");
System.out.println("Records Menu>>>");
System.out.println("\t\t1. Add Patient");
System.out.println("\t\t2. View Patient");
System.out.println("\t\t3. Search Patient");
System.out.println("\t\t4. Exit");

try {
System.out.println("Enter choice: ");
menuChoice = Integer.parseInt(input.nextLine());
} catch (NumberFormatException e) {
continue;
}

if (menuChoice==1)
{
System.out.println("Full name:");
String name = input.nextLine();

int pno = -1;


do {
try {
System.out.println("Patient no:");
pno = Integer.parseInt(input.nextLine());
} catch (NumberFormatException e) {
System.out.println("Enter a number!");
continue;
}
} while (pno <= 0);

System.out.println("Disease(level):");
String disease = input.nextLine();

System.out.println("year:");
String year= input.nextLine();

System.out.println("Section(Class):");
String section = input.nextLine();

Patient patient = new Patient(name, pno, disease, year, section);


patients.add(patient);

} else if (menuChoice==2) {
System.out.println("Patients List:");
for (Patient patient : patients)
{
System.out.println(patient);
}
}else if (menuChoice==3) {
System.out.println("Patients Are As Following:");
for (Patient patient : patients)
{
System.out.println(patient);
}
}
} while (menuChoice<4);
}
}

Output of the Code :


Conclusion :
Patient Management System can be used hospitals, clinics to maintain their patient
records easily. Achieving this objective is difficult using the manual system as the information is
scattered, can be redundant and collecting relevant information may be very time-consuming.

All these problems are solved by this project. This system helps in maintaining the
information of pupil of the organization. It can be easily accessed by the manager and kept safe
for a long period of time without any changes.

You might also like