IP Project
IP Project
PROJECT
Name -Siddharth Kumar Jha
Class -12th ‘A’
Scholar number -676
Roll number -25
1
Index
S. No. Title Page No.
1 Certificate for subject teacher …(i)
2 Certificate for examiner …(ii)
3 acknowledgement …(iii)
4 Introduction …1
5 Aim …1
6 Table Structure of report (java database) …1 – 2
7 Flow chart showing the way things are connected …2
8 Coding of the project …3
Before it all begins. …4
Creating a java class …4
Splash screen …4 – 5
a. Java main class screenScreen …4 – 5
Login frame …5 – 8
i. Admin form 1 …8 – 9
a. Sign up another authorized personal …9 – 10
ii. Admin form 2 …10 – 11
a. Delete an account …11 – 13
Main Frame …13 – 23
i. Register a new patient …23 – 30
ii. Delete a patient account …30 – 35
iii. List of pending patients …35 – 42
9 Merits …42
10 De – Merits …42
11 Merits …42
12 Bibliography …42
2
Introduction
‘Hospital Management’
This project has been made to keep record of all the patients like their BP, weight, case number, refrence
number, etc. in short their overall biodata of their last visit along with personal information like phone
number, photo, etc. In addition to this it allows the user to print a priscription cum bill. Total amount
being calculated automatically.
Aim
The main aim of my project is to make the doctor – patient interaction easier & convenient by making
doctor aware of all the health issues the patient already has including the allergies. So that the doctor can
save time in asking patient again and again the same question and can avoid giving patient the medicines
that they are allergic to.
}
}
3. Splash screen
First design the screen as shown:
Then create a java main class called screenScreen to run the above project:
import javax.swing.JOptionPane;
public class screenScreen {
public static void main(String[] args) {
}
4. Login frame
I. Admin form1
String c = user.getText();
if(a.equals(b)){
pst = conn.prepareStatement("insert into ROOT.PASSWORD values(?,?)");
pst.setString(1 , c);
pst.setString(2, b);
pst.execute();
JOptionPane.showMessageDialog(null, "Account created", "success", 1);
this.dispose();
new Password_Frame().setVisible(true);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "Warning", 0);
}
Code for Visible check box
if(visible.isSelected()){
pass1.setEchoChar((char) 0);
pass2.setEchoChar((char) 0);
}else{
pass1.setEchoChar('*');
pass2.setEchoChar('*');
}
II. Admin form 2
initComponents();
enter.setMnemonic(VK_F1);
cancel.setMnemonic(VK_F2);
}
Code for cancel button
this.dispose();
new Password_Frame().setVisible(true);
Code for enter button
String a = user.getText();
String b = new String(pass.getPassword());
if(a.equals("admin") && b.equals("T#achedg#2011")){
JOptionPane.showMessageDialog(null, "your password was correct", "information", 1);
this.dispose();
new delete_account().setVisible(true);
}else JOptionPane.showMessageDialog(null, "You were wrong", "information", 1);
Code for visible checkbox
if(visible.isSelected()){
pass.setEchoChar((char) 0);
}else pass.setEchoChar('*');
a) Delete an account
try{
String a = "delete from ROOT.PASSWORD where USERNAME = ?";
int b = table.getSelectedRow();
Object c = table.getValueAt(b, 0);
pst = conn.prepareStatement(a);
pst.setString(1, c.toString());
pst.execute();
update();
JOptionPane.showMessageDialog(null, "deleted with success", "information", 1);
this.dispose();
new Password_Frame().setVisible(true);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "Warning", 0);
}
5. Main frame
import javax.swing.JOptionPane;
import java.sql.*;
import javax.swing.JFileChooser;
import javax.swing.table.DefaultTableModel;
Variables declared in public class
Connection conn = null;
PreparedStatement pst = null;
ResultSet rs = null;
String icon = null;
Code to write below initComponents();
public Test_Frame() {
initComponents();
try{
conn = javaDB.jDB();
Calendar cal = Calendar.getInstance();
cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Time.setText(sdf.format(cal.getTime()));
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Date.setText(sd.format(cal.getTime()));
PrintArea.append("\t JIPL Billing services pvt.ltd. \n");
PrintArea.append("Services charge " +"\n");
PrintArea.append("Bill to: "+PatientName.getText());
PrintArea.append("\n "+Occupation.getText());
PrintArea.append("\n "+Area.getText());
PrintArea.append("\n date "+Date.getText());
PrintArea.append("\n S.No. | Dosage | Medicine name | advice | unit | days | Qty. \n");
PrintArea.append("\n \t \t \t Total:0 Rs.");
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.INFORMATION_MESSAGE);
}
}
Code for exit jMenuItem
System.exit(0);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.ERROR_MESSAGE);
}
16
pst.setString(1, RefrenceNo.getText());
pst.setString(2, Date.getText());
pst.setString(3, Time.getText());
pst.setString(4, Wt.getText());
pst.setString(5, Ht.getText());
pst.setString(6, Hc.getText());
pst.setString(7, Pr.getText());
pst.setString(8, Bp.getText());
pst.setString(9, Bp2.getText());
pst.setString(10, Bs.getText());
pst.setString(11, Tm.getText());
pst.setString(12, BMI.getText());
pst.setString(13, BSA.getText());
pst.setString(14, PatientName.getText());
pst.setString(15, permanentH_O.getText());
pst.setString(16, jLabel3.getIcon().toString());
pst.setInt(17, 1);
pst.execute();
pst.setString(1, RefrenceNo.getText());
17
pst.setString(2, Date.getText());
pst.setString(3, Time.getText());
pst.setString(4, Wt.getText());
pst.setString(5, Ht.getText());
pst.setString(6, Hc.getText());
pst.setString(7, Pr.getText());
pst.setString(8, Bp.getText());
pst.setString(9, Bp2.getText());
pst.setString(10, Bs.getText());
pst.setString(11, Tm.getText());
pst.setString(12, BMI.getText());
pst.setString(13, BSA.getText());
pst.setString(14, PatientName.getText());
pst.setString(15, permanentH_O.getText());
pst.setString(16, jLabel3.getIcon().toString());
pst.setInt(17, 1);
pst.execute();
}else{
allergies.setText(allergies2.getText());
}
String a = history.getText();
String b =diagnosis.getText();
String c = vital_data.getText();
Object[] o = {a,b,c};
DefaultTableModel abc = (DefaultTableModel)table3.getModel();
abc.addRow(o);
pst = conn.prepareStatement("select count(*) FROM ROOT."+CaseNo.getText()+"_2");
rs = pst.executeQuery();
int rowCount = 0;
while(rs.next()){
rowCount = rs.getInt("1");
}
rowCount += 1;
pst = conn.prepareStatement("insert into ROOT."+CaseNo.getText()+"_2 values(?,?,?,?,?,?,?,?)");
18
pst.setString(1, PatientName.getText());
pst.setString(2,Complain.getText());
pst.setString(3, Examination.getText());
pst.setString(4, history.getText());
pst.setString(5, diagnosis.getText());
pst.setString(6, vital_data.getText());
pst.setString(7, allergies.getText());
pst.setInt(8, rowCount);
pst.execute();
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.WARNING_MESSAGE);
}
Code for clearTextVD button
history.setText(null);
diagnosis.setText(null);
vital_data.setText(null);
allergies2.setText(null);
JOptionPane.showMessageDialog(null,
"printing..........", "print dialog box",
JOptionPane.INFORMATION_MESSAGE);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null,
"printing aborted", "printing dialog box",
JOptionPane.WARNING_MESSAGE);
}
Code for clear text for personal information
name2.setText(null);
sex2.setText(null);
age2.setText(null);
area2.setText(null);
19
refBy2.setText(null);
mediclam2.setText(null);
occupation2.setText(null);
Code for update personal information button
try{
PatientName.setText(name2.getText());
Sex.setText(sex2.getText());
Age.setText(age2.getText());
Area.setText(area2.getText());
RefBy.setText(refBy2.getText());
Mediclam.setText(mediclam2.getText());
Occupation.setText(occupation2.getText());
pst = conn.prepareStatement("delete from root."+CaseNo.getText()+"_3 where S_NO = 1");
pst.execute();
pst = conn.prepareStatement("insert into ROOT."+CaseNo.getText()+"_3 values(?,?,?,?,?,?,?,?)");
pst.setString(1, Sex.getText());
pst.setString(2, Mediclam.getText());
pst.setString(3, Area.getText());
pst.setString(4, Age.getText());
pst.setString(5, Occupation.getText());
pst.setString(6, RefBy.getText());
pst.setString(7, PatientName.getText());
pst.setInt(8, 1);
pst.execute();
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.ERROR_MESSAGE);
}
Code for delete button in medication tab
try{
DefaultTableModel abc =
(DefaultTableModel)table2.getModel();
int a = table2.getSelectedRow();
abc.removeRow(a);
JOptionPane.showMessageDialog(null,
"deleted with success", "Information",
JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e){
JOptionPane.showMessageDialog(null, "Please select something from the table above", "Warning",
JOptionPane.ERROR_MESSAGE);
}
Code for add button in medication tab
try{
DefaultTableModel abc = (DefaultTableModel)table2.getModel();
String a = dosage.getText();
String b = medicine_name.getText();
20
String c = advice.getText();
String d = unit.getText();
String e = days.getText();
String f = Qty.getText();
Object[] o = {a,b,c,d,e,f};
abc.addRow(o);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for visit button in the doctor’s corner tab
try{
Calendar cal = Calendar.getInstance();
cal.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
Time.setText(sdf.format(cal.getTime()));
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd");
Date.setText(sd.format(cal.getTime()));
String a = CaseNo.getText();
pst = conn.prepareStatement("SELECT * FROM ROOT."+a+" where S_NO = 1");
rs = pst.executeQuery();
while(rs.next()){
String c = rs.getString("REFRENCE_NO");
String d = rs.getString("WT");
String e = rs.getString("HT");
String f = rs.getString("HC");
String g = rs.getString("PR");
String h = rs.getString("BP1");
String i = rs.getString("BP2");
String r = rs.getString("BS");
String j = rs.getString("TM");
String k = rs.getString("BMI");
String l = rs.getString("BSA");
String m = rs.getString("PERMANANT_H_O");
String n = rs.getString("PHOTO_URL");
String p = rs.getString("DATE");
String q = rs.getString("TIME");
Bs.setText(r);
LastVisit.setText(p+" "+q);
RefrenceNo.setText(c);
Wt.setText(d);
Ht.setText(e);
Hc.setText(f);
Pr.setText(g);
Bp.setText(h);
21
Bp2.setText(i);
Tm.setText(j);
BMI.setText(k);
BSA.setText(l);
permanentH_O.setText(m);
jLabel3.setIcon(new ImageIcon(n));
}
DefaultTableModel my_model = (DefaultTableModel)table3.getModel();
int numrows = table3.getRowCount();
for(int i = numrows - 1; i >= 0; i--){
my_model.removeRow(i);
}
pst = conn.prepareStatement("select * from ROOT."+a+"_2");
rs = pst.executeQuery();
while(rs.next()){
String f = rs.getString("HISTORY");
String g = rs.getString("DIAGNOSIS_AND_TREATMENT");
String h = rs.getString("VITAL_DATA");
Object[] o = {f,g,h};
DefaultTableModel abc = (DefaultTableModel)table3.getModel();
abc.addRow(o);
}
d = rs.getString("COMPLAIN");
e = rs.getString("EXAMINATION");
i = rs.getString("ALLERGIES");
}
Complain.setText(d);
Examination.setText(e);
allergies.setText(i);
pst = conn.prepareStatement("select * from ROOT."+a+"_3");
rs = pst.executeQuery();
while(rs.next()){
String c = rs.getString("SEX");
String j = rs.getString("MEDICLAM");
String k = rs.getString("AREA");
String f = rs.getString("AGE");
String g = rs.getString("OCCUPATION");
String h = rs.getString("REF_BY");
22
String l = rs.getString("PATIENT_NAME");
PatientName.setText(l);
Sex.setText(c);
Mediclam.setText(j);
Area.setText(k);
Age.setText(f);
Occupation.setText(g);
RefBy.setText(h);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for pending button in doctor’s corner
this.dispose();
new List_of_pending_Patients().setVisible(true);
Code for close button in doctor’s corner
System.exit(0);
Code for import from table button
int a = table2.getRowCount();
String[] tableRecord = new String[6];
tableRecord[0] = "";
tableRecord[1] = "";
tableRecord[2] = "";
tableRecord[3] = "";
tableRecord[4] = "";
tableRecord[5] = "";
PrintArea.setText(null);
Double[] UnitPrice = new Double[a];
Double[] Quantity = new Double[a];
String value1 = null, value2 = null;
double total = 0;
for (int i = 0; i < a; i++) {
value1 = (String) table2.getValueAt(i,3);
UnitPrice[i] = Double.parseDouble(value1);
}
for (int i = 0; i < a; i++) {
value2 = (String) table2.getValueAt(i,5);
Quantity[i] = Double.parseDouble(value2);
total += UnitPrice[i] * Quantity[i];
}
PrintArea.append("\t JIPL Billing services pvt.ltd. \n");
PrintArea.append("Services charge " +"\n");
PrintArea.append("Bill to: "+CaseNo.getText()+"\n"+PatientName.getText());
PrintArea.append("\n "+Occupation.getText());
PrintArea.append("\n "+Area.getText());
PrintArea.append("\n date "+Date.getText());
23
PrintArea.append("\n Dosage | Medicine name | advice | unit price | days | Qty. \n");
for(int i = 0; i < a; i++){
for(int j = 0; j < table2.getColumnCount() ; j++){
tableRecord[j]= (String) table2.getValueAt(i, j);
}
PrintArea.append("\n"+tableRecord[0]+" |"+tableRecord[1]+" |"+tableRecord[2]+" |" +tableRecord[3]+
" |"+tableRecord[4]+" |"+tableRecord[5]);
}
PrintArea.append("\n \t \t \t Total: "+total+" Rs.");
Code for delete button of vital data
try{
int a = table3.getSelectedRow();
a += 1;
String c = "delete from
ROOT."+CaseNo.getText()+"_2 where S_NO
= ?";
pst = conn.prepareStatement(c);
pst.setInt(1, a);
pst.execute();
DefaultTableModel my_model = (DefaultTableModel)table3.getModel();
int numrows = table3.getRowCount();
for(int i = numrows - 1; i >= 0; i--){
my_model.removeRow(i);
}
pst = conn.prepareStatement("select * from ROOT."+CaseNo.getText()+"_2");
rs = pst.executeQuery();
while(rs.next()){
String f = rs.getString("HISTORY");
String g = rs.getString("DIAGNOSIS_AND_TREATMENT");
String h = rs.getString("VITAL_DATA");
Object[] o = {f,g,h};
DefaultTableModel abc = (DefaultTableModel)table3.getModel();
abc.addRow(o);
}
d = rs.getString("COMPLAIN");
e = rs.getString("EXAMINATION");
i = rs.getString("ALLERGIES");
}
24
Complain.setText(d);
Examination.setText(e);
allergies.setText(i);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
Code for remove a patient’s account from database jMenuItem
new delete_a_patient_account().setVisible(true);
import javax.swing.JOptionPane;
Variables declared in public class
Connection conn = null;
PreparedStatement pst = null;
ResultSet rs = null;
Code to write below initComponents();
public First_time_registry() {
initComponents();
conn = javaDB.jDB();
}
Code for the button ‘L’ (Load)
try{
int size = 200000;
ArrayList<Integer> list = new ArrayList<Integer>(size);
pst = conn.prepareStatement("select count(*) FROM ROOT.CASENO");
rs = pst.executeQuery();
int rowCount = 0;
while(rs.next()){
rowCount = rs.getInt("1");
}
int[] b = null;
if(rowCount != 0){
b = new int[rowCount];
int x = 0;
pst = conn.prepareStatement("select CASENO2 from ROOT.CASENO");
rs = pst.executeQuery();
while(rs.next()){
b[x] = rs.getInt("CASENO2");
x++;
}
else {
list.add(0);
CaseText.setText("R");
}
Random rand = new Random();
int index = 0;
while(list.size() > 0) {
index = rand.nextInt(list.size());
CaseNo.setText("" + list.remove(index));
}
String[] text = new String[27];
text[0] = "A";
text[1] = "B";
text[2] = "C";
text[3] = "D";
text[4] = "E";
text[5] = "F";
text[6] = "G";
text[7] = "H";
text[8] = "I";
text[9] = "J";
text[10] = "K";
text[11] = "L";
text[12] = "M";
text[13] = "N";
text[14] = "O";
text[15] = "P";
text[16] = "Q";
text[17] = "R";
text[18] = "S";
text[19] = "T";
text[20] = "U";
text[21] = "V";
text[22] = "W";
text[23] = "X";
text[24] = "Y";
text[25] = "Z";
text[26] = "";
String abc = "";
pst = conn.prepareStatement("select CASE_NO from ROOT.CASENO");
rs = pst.executeQuery();
int i = 0;
27
while(rs.next()){
String abcd = rs.getString("CASE_NO");
if(rowCount <= 2){
i = rand.nextInt(26);
abc += text[i];
i = rand.nextInt(26);
abc += text[i];
i = rand.nextInt(26);
abc += text[i];
i = rand.nextInt(26);
abc += text[i];
}else if(rowCount >2 && rowCount <=4){
i = rand.nextInt(26);
abc += text[i];
i = rand.nextInt(26);
abc += text[i];
i = rand.nextInt(26);
abc += text[i];
}
else{
i = rand.nextInt(26);
abc += text[i];
}
if(abcd != abc){
CaseText.setText(abc);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for upload photo button
try{
JFileChooser chooser = new
JFileChooser();
chooser.showOpenDialog(null);
File f = chooser.getSelectedFile();
String filename =
f.getAbsolutePath();
jLabel3.setIcon(new
ImageIcon(filename));
jFileChooser
28
JOptionPane.showMessageDialog(null, "Photo uploaded with success \n press save button after you
are done making changes \n thankyou!!!");
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.ERROR_MESSAGE);
}
Code for load new button
try {
this.dispose();
Thread.sleep(40);
new First_time_registry().setVisible(true);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.ERROR_MESSAGE);
}
Code for close button
this.dispose();
Code for save button
try {
pst = conn.prepareStatement("select count(*) FROM ROOT.CASENO");
rs = pst.executeQuery();
int rowCount = 0;
while(rs.next()){
rowCount = rs.getInt("1");
}
rowCount += 1;
pst = conn.prepareStatement("insert into ROOT.CASENO values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)" );
pst.setString(1, CaseText.getText());
pst.setString(2, CaseNo.getText());
pst.setString(3, salutation.getText()+FirstName.getText()+MiddleName.getText()+Surname.getText());
pst.setString(4, Age.getText());
pst.setString(5, DOB.getText());
pst.setString(6, Sex.getText());
pst.setString(7, FirstVisit.getText());
pst.setString(8, TelNo.getText());
pst.setString(9, MobNo.getText());
pst.setString(10, Email.getText());
pst.setString(11, Language.getText());
pst.setString(12, Religion.getText());
pst.setString(13, BloodGroup.getText());
pst.setString(14, Remark.getText());
pst.setInt(15, rowCount);
pst.execute();
29
String a = rs.getString("S_NO");
String b = rs.getString("CASE_NO");
String c = rs.getString("CASENO2");
String d = rs.getString("PATIENT_NAME");
String e = rs.getString("BLOOD_GROUP");
String f = rs.getString("REMARKS");
Object[] row = {a, b, c, d, e, f};
DefaultTableModel dtm = (DefaultTableModel)Table1.getModel();
dtm.addRow(row);
}
}
Code for clear button
IDText.setText(null);
IDNumber.setText(null);
Registration_date.setText(null);
Name.setText(null);
Age.setText(null);
DOB.setText(null);
Gender.setText(null);
Occupation.setText(null);
Address.setText(null);
Tel_no.setText(null);
Mob_no.setText(null);
Email.setText(null);
Language.setText(null);
Religion.setText(null);
Code for extract info using patient ID
try {
pst = conn.prepareStatement("select * from ROOT.CASENO where CASE_NO = ? and
CASENO2 = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("FIRSTVISITDATE");
String b = rs.getString("PATIENT_NAME");
String c = rs.getString("AGE");
String d = rs.getString("DOB");
String e = rs.getString("TELEPHONE_NO");
String f = rs.getString("MOBILE_NO");
String g = rs.getString("EMAIL");
String h = rs.getString("LANGUAGE");
33
String i = rs.getString("RELIGION");
Registration_date.setText(a);
Name.setText(b);
Age.setText(c);
DOB.setText(d);
Tel_no.setText(e);
Mob_no.setText(f);
Email.setText(g);
Language.setText(h);
Religion.setText(i);
}
pst = conn.prepareStatement("select * from ROOT."+IDText.getText()+IDNumber.getText()+"_3");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("SEX");
String b = rs.getString("OCCUPATION");
String c = rs.getString("AREA");
Gender.setText(a);
Occupation.setText(b);
Address.setText(c);
}
update();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for extract info of patient from table button
try {
int Rows = Table1.getSelectedRow();
Object o = Table1.getValueAt(Rows, 1);
Object o1 = Table1.getValueAt(Rows, 2);
IDText.setText("" + o);
IDNumber.setText(""+o1);
pst = conn.prepareStatement("select * from ROOT.CASENO where CASE_NO = ? and
CASENO2 = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("FIRSTVISITDATE");
String b = rs.getString("PATIENT_NAME");
String c = rs.getString("AGE");
String d = rs.getString("DOB");
34
String e = rs.getString("TELEPHONE_NO");
String f = rs.getString("MOBILE_NO");
String g = rs.getString("EMAIL");
String h = rs.getString("LANGUAGE");
String i = rs.getString("RELIGION");
Registration_date.setText(a);
Name.setText(b);
Age.setText(c);
DOB.setText(d);
Tel_no.setText(e);
Mob_no.setText(f);
Email.setText(g);
Language.setText(h);
Religion.setText(i);
}
pst = conn.prepareStatement("select * from ROOT."+IDText.getText()+IDNumber.getText()+"_3");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("SEX");
String b = rs.getString("OCCUPATION");
String c = rs.getString("AREA");
Gender.setText(a);
Occupation.setText(b);
Address.setText(c);
}
update();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for delete this account button
try {
pst = conn.prepareStatement("delete from ROOT.CASENO where CASE_NO = ? and CASENO2 = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
pst.execute();
pst = conn.prepareStatement("drop table ROOT."+IDText.getText()+IDNumber.getText());
pst.execute();
pst = conn.prepareStatement("drop table ROOT."+IDText.getText()+IDNumber.getText()+"_2");
pst.execute();
pst = conn.prepareStatement("drop table ROOT."+IDText.getText()+IDNumber.getText()+"_3");
pst.execute();
update();
35
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("S_NO");
String b = rs.getString("CASE_NAME");
String c = rs.getString("CASE_NO");
String d = rs.getString("PATIENT_NAME");
String e = rs.getString("BLOOD_GROUP");
Object[] row = {a, b, c, d, e};
DefaultTableModel dtm = (DefaultTableModel)Table1.getModel();
dtm.addRow(row);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
}
Create the method update();
public void update() throws SQLException{
String ab = "select * from ROOT.LIST_OF_PENDING_PATIENTS";
pst = conn.prepareStatement(ab);
rs = pst.executeQuery();
DefaultTableModel my_model = (DefaultTableModel)Table1.getModel();
int numrows = Table1.getRowCount();
for(int i = numrows - 1; i >= 0; i--){
my_model.removeRow(i);
}
while(rs.next()){
String a = rs.getString("S_NO");
String b = rs.getString("CASE_NAME");
String c = rs.getString("CASE_NO");
String d = rs.getString("PATIENT_NAME");
String e = rs.getString("BLOOD_GROUP");
Object[] row = {a, b, c, d, e};
DefaultTableModel dtm = (DefaultTableModel)Table1.getModel();
dtm.addRow(row);
}
}
Code for clear button
IDText.setText(null);
IDNumber.setText(null);
Registration_date.setText(null);
Name.setText(null);
Age.setText(null);
37
DOB.setText(null);
Gender.setText(null);
Occupation.setText(null);
Address.setText(null);
Tel_no.setText(null);
Mob_no.setText(null);
Email.setText(null);
Language.setText(null);
Religion.setText(null);
Code for delete this account button
try {
pst = conn.prepareStatement("delete from ROOT.LIST_OF_PENDING_PATIENTS where
CASE_NAME = ? and CASE_NO = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
pst.execute();
update();
JOptionPane.showMessageDialog(null, "Deleted the record with success","Information",
JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning",JOptionPane.ERROR_MESSAGE);
}
Code for extract info of patient from table
try {
visit.setEnabled(true);
int Rows = Table1.getSelectedRow();
Object o = Table1.getValueAt(Rows, 1);
Object o1 = Table1.getValueAt(Rows, 2);
IDText.setText("" + o);
IDNumber.setText(""+o1);
pst = conn.prepareStatement("select * from ROOT.CASENO where CASE_NO = ? and
CASENO2 = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("FIRSTVISITDATE");
String b = rs.getString("PATIENT_NAME");
String c = rs.getString("AGE");
String d = rs.getString("DOB");
String e = rs.getString("TELEPHONE_NO");
String f = rs.getString("MOBILE_NO");
38
String g = rs.getString("EMAIL");
String h = rs.getString("LANGUAGE");
String i = rs.getString("RELIGION");
Registration_date.setText(a);
Name.setText(b);
Age.setText(c);
DOB.setText(d);
Tel_no.setText(e);
Mob_no.setText(f);
Email.setText(g);
Language.setText(h);
Religion.setText(i);
}
pst = conn.prepareStatement("select * from ROOT."+IDText.getText()+IDNumber.getText()+"_3");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("SEX");
String b = rs.getString("OCCUPATION");
String c = rs.getString("AREA");
Gender.setText(a);
Occupation.setText(b);
Address.setText(c);
}
update();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for extract info of patient from patient ID
try {
visit.setEnabled(true);
pst = conn.prepareStatement("select * from ROOT.CASENO where CASE_NO = ? and
CASENO2 = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("FIRSTVISITDATE");
String b = rs.getString("PATIENT_NAME");
String c = rs.getString("AGE");
String d = rs.getString("DOB");
String e = rs.getString("TELEPHONE_NO");
String f = rs.getString("MOBILE_NO");
39
String g = rs.getString("EMAIL");
String h = rs.getString("LANGUAGE");
String i = rs.getString("RELIGION");
Registration_date.setText(a);
Name.setText(b);
Age.setText(c);
DOB.setText(d);
Tel_no.setText(e);
Mob_no.setText(f);
Email.setText(g);
Language.setText(h);
Religion.setText(i);
}
pst = conn.prepareStatement("select * from ROOT."+IDText.getText()+IDNumber.getText()+"_3");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("SEX");
String b = rs.getString("OCCUPATION");
String c = rs.getString("AREA");
Gender.setText(a);
Occupation.setText(b);
Address.setText(c);
}
update();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for visit button
try {
this.dispose();
Test_Frame f = new Test_Frame();
f.setVisible(true);
pst = conn.prepareStatement("delete from ROOT.LIST_OF_PENDING_PATIENTS where
CASE_NAME = ? and CASE_NO = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
pst.execute();
pst = conn.prepareStatement("create table ROOT.TemporaryTable(Case_Text
varchar(10000), Case_No varchar(10000))");
pst.execute();
pst = conn.prepareStatement("insert into ROOT.TemporaryTable values(?, ?)");
pst.setString(1, IDText.getText());
40
pst.setString(2, IDNumber.getText());
pst.execute();
pst = conn.prepareStatement("select * from ROOT.TemporaryTable");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("Case_Text");
String b = rs.getString("Case_No");
f.CaseNo.setText(a+b);
}
pst = conn.prepareStatement("drop table ROOT.TemporaryTable");
pst.execute();
f.visit.doClick();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning",JOptionPane.ERROR_MESSAGE);
}
Code for add a patient
try {
visit.setEnabled(true);
String abc = IDText.getText()+IDNumber.getText();
if(abc == "" || abc == null){
JOptionPane.showMessageDialog(null, "Please fill the text fields about Patient Case text and number to
proceed \n \t Thankyou!!!", "Information", JOptionPane.INFORMATION_MESSAGE);
}
else{
pst = conn.prepareStatement("select count(*) FROM ROOT.LIST_OF_PENDING_PATIENTS");
rs = pst.executeQuery();
int rowCount = 0;
while(rs.next()){
rowCount = rs.getInt("1");
}
rowCount += 1;
String e = "";
pst = conn.prepareStatement("select * from ROOT.CASENO where CASE_NO = ? and
CASENO2 = ?");
pst.setString(1, IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
rs = pst.executeQuery();
while(rs.next()){
String b = rs.getString("CASE_NO");
String c = rs.getString("CASENO2");
String d = rs.getString("PATIENT_NAME");
e = rs.getString("BLOOD_GROUP");
41
String f = rs.getString("FIRSTVISITDATE");
String h = rs.getString("AGE");
String i = rs.getString("DOB");
String j = rs.getString("TELEPHONE_NO");
String k = rs.getString("MOBILE_NO");
String l = rs.getString("EMAIL");
String m = rs.getString("LANGUAGE");
String n = rs.getString("RELIGION");
Registration_date.setText(f);
Name.setText(d);
Age.setText(h);
DOB.setText(i);
Tel_no.setText(j);
Mob_no.setText(k);
Email.setText(l);
Language.setText(m);
Religion.setText(n);
Object[] row = {rowCount, b, c, d, e};
DefaultTableModel dtm = (DefaultTableModel)Table1.getModel();
dtm.addRow(row);
}
pst = conn.prepareStatement("select * from ROOT."+IDText.getText()+IDNumber.getText()+"_3");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("SEX");
String b = rs.getString("OCCUPATION");
String c = rs.getString("AREA");
Gender.setText(a);
Occupation.setText(b);
Address.setText(c);
}
pst = conn.prepareStatement("insert into ROOT.LIST_OF_PENDING_PATIENTS values(?,?,?,?,?)");
pst.setString(1,IDText.getText());
pst.setInt(2, Integer.parseInt(IDNumber.getText()));
pst.setString(3,Name.getText());
pst.setString(4, e);
pst.setInt(5, rowCount);
pst.execute();
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
42
}
Code for return button
this.dispose();
new Test_Frame().setVisible(true);
Merits
Both bill and prescription can be generated in same page.
The records are managed efficiently.
Helps in doctor – patient interaction.
Prevents doctor from advising patient on medicines that they are allergic to.
Tells doctors the patients still sitting outside their cabin to be examined.
De – Merits
Once a patient record is deleted it cannot be brought back i.e. there is no recovery option for lost data.
The work is not saved automatically so if there is a power failure there is no option to get or retrieve the
lost data.
No multiple bills can be generated.
Most people can understand their native language only. Like – Hindi, Tamil, etc. but the only language
supported by form is English.
Conclusion
‘Hospital management’ system has been prepared to improve the doctor – patient interaction. With this
application there is no need to write a prescription manually or prepare a bill again on some counter. The
prescription is represented in tabular form this makes the prescription easier to read and instruction easier
to follow.
Bibliography
1) Class 11 IP book by Reeta Sahu and Gagan Sahu.
2) Class 12 IP book by Sumita Arora.
3) Donald E. Knuth: The art of computer programming, Volume – 2, Edition – 3 (For understanding
Random numbers).
4) www.google.com (For Images used in the project).