SlideShare a Scribd company logo
1 of 43
Download to read offline
Name -Siddharth Kumar Jha
Class -12th ‘A’
Scholar number -676
Roll number -25
COMPUTER
PROJECT
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
 Before it all begins.
 Creating a java class
 Splash screen
a. Java main class screenScreen
 Login frame
i. Admin form 1
a. Sign up another authorized personal
ii. Admin form 2
a. Delete an account
 Main Frame
i. Register a new patient
ii. Delete a patient account
iii. List of pending patients
…3
…4
…4
…4 – 5
…4 – 5
…5 – 8
…8 – 9
…9 – 10
…10 – 11
…11 – 13
…13 – 23
…23 – 30
…30 – 35
…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.
Table	Structure	of	report	(java	database)
table to store Case Number( common to all)
Table which contains list of pending patient(common
for all)
Table one for patient(one for each)
Note* - The name of each table here depends on
case number. Eg – Case, Case_2, Case_3.
Table 2 for patient(unique for each)
3
Table for Storing Password
Table 3 for patient(unique for each)
Flow	Chart	showing	the	way	things	are	
connected
Splash Screen
(Splash.java)
Java Main Class
screenScreen.java
Password Form
Password_Frame.java
Admin form
admin.java
Admin form
admin2.java
Main Frame
Test_Frame.java
Sign up (add another
authorized person)
signup.java
Delete an account
Delete_account.java
Register a new patient
First_time_registry.java
List of pending patients
List_of_pending_Patients.java
Delete a patient’s account
delete_a_patient_account.java
4
Coding	of	the	project
1. Before it all begins
You must right click on libraries and then click on add library to add:
a. MySQL JDBC Driver, and
b. Java DB Driver
So that you can connect to the java database.
2. Creating a java class named javaDB to connect
everything
import java.sql.*;
import javax.swing.JOptionPane;
public class javaDB {
public static Connection jDB(){
try{
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection conn =
DriverManager.getConnection("jdbc:derby://localhost:1527/contact","root", "T#achedg#2011");
return conn;
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", 0);
return null;
}
}
}
3. Splash screen
First design the screen as shown:
Runtime image of splash screen
5
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) {
splash Splash = new splash( );
Splash.setVisible(true);
try {
for (int i = 0; i < 100; i++) {
Thread.sleep(50);
Splash.jLabel1.setText(i+"%");
Splash.jProgressBar1.setValue(i);
}
Splash.setVisible(false);
new Password_Frame( ).setVisible(true);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.ERROR_MESSAGE);
}
}
}
4. Login frame
Runtime Image of password frame
6
Import lines used
import java.awt.event.KeyEvent;
import javax.swing.JOptionPane;
import java.sql.*;
Variables declared in public class
PreparedStatement pst = null;
Connection conn = null;
ResultSet rs = null;
Lines written below initComponents();
public Password_Frame() {
initComponents( );
Login.setMnemonic(KeyEvent.VK_F1);
try{
conn = javaDB.jDB();
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "alert", 0);
}
}
Coding for visibleActionPerformed (our visible check box)
if(visible.isSelected()){
pass.setEchoChar((char)0);
}else
pass.setEchoChar('*');
Coding for jMenuItem2ActionPerformed
System.exit(0);
Coding for jMenuItem1ActionPerformed
this.dispose();
new admin().setVisible(true);
Coding for jMenuItem3ActionPerformed
JOptionPane.showMessageDialog(null, "Hello!" + "n" + "Welcome to Jha Infosys Pvt.
Ltd. Login Frame" + "n" + "u2022 " + "For creating new account please press
F12 key or go to file menu" + "n" + "u2022 "+ "For deleting an account please
press F10 key or again go to file menu" + "n" + "u2022" + " For exiting this
frame press F11 key or go to file menu or press the red cross on the top for exit"
+ "n" + "For further help contact the developer at below given contact details in the password
frame" + "n" + "", "help", JOptionPane.INFORMATION_MESSAGE);
7
Coding for jMenuItem4ActionPerformed
this.dispose();
new admin2().setVisible(true);
coding for LoginActionPerformed
try {
String a = user.getText();
String b = new String(pass.getPassword());
String c = "select * from ROOT.PASSWORD";
String d = null;
String e = null;
pst = conn.prepareStatement(c);
rs = pst.executeQuery();
int i = 0;
PassWord:
while(rs.next()){
d = rs.getString("USERNAME");
e = rs.getString("PASSWORD");
if(a.equals(d) && b.equals(e) || a.equals("admin") && b.equals("T#achedg#2011")){
JOptionPane.showMessageDialog(null, "Your password was correct", "success", 1);
this.dispose();
new Test_Frame().setVisible(true);
i++;
if(a.equals("admin") && b.equals("T#achedg#2011"))
break PassWord;
}
}
if(i > 0){
}else{
JOptionPane.showMessageDialog(null,"Your password was wrong", "warning",1);
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, ex,"alert",0);
}
Coding for logoutActionPerformed
System.exit(0);
8
I. Admin form1
Import lines used:
import static java.awt.event.KeyEvent.*;
import javax.swing.JOptionPane;
Lines written below initComponents();
public admin() {
initComponents();
enter.setMnemonic(VK_F1);
cancel.setMnemonic(VK_F2);
}
Code for visible check box:
if(visible.isSelected()){
pass.setEchoChar((char) 0);
}else pass.setEchoChar('*');
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 signup().setVisible(true);
}else JOptionPane.showMessageDialog(null, "You were wrong", "information", 1);
Code for cancel button
this.dispose();
new Password_Frame().setVisible(true);
9
a) Sign up another authorized personal
Import lines used
import static java.awt.event.KeyEvent.*;
import java.sql.*;
import javax.swing.JOptionPane;
Variables in the public class
PreparedStatement pst = null;
Connection conn = null;
ResultSet rs = null;
Variables declared below initComponents
public signup() {
initComponents();
try{
conn = javaDB.jDB();
create.setMnemonic(VK_F1);
cancel.setMnemonic(VK_F2);
exit.setMnemonic(VK_F3);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "Warning", 0);
}
}
Code for exit button
System.exit(0);
Code for cancel button
this.dispose();
new Password_Frame().setVisible(true);
Code for create button
try{
String a = new String(pass1.getPassword());
String b = new String(pass2.getPassword());
10
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
Import lines used
import static java.awt.event.KeyEvent.VK_F1;
import static java.awt.event.KeyEvent.VK_F2;
import javax.swing.JOptionPane;
Code below initComponents();
public admin2() {
11
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
Import lines used
import static java.awt.event.KeyEvent.VK_F1;
import static java.awt.event.KeyEvent.VK_F2;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Varibles declared in public class
PreparedStatement pst = null;
12
Connection conn = null;
ResultSet rs = null;
Code to write below initComponents();
public delete_account() {
initComponents();
try{
delete.setMnemonic(VK_F1);
cancel.setMnemonic(VK_F2);
conn = javaDB.jDB();
pst = conn.prepareStatement("Select * from ROOT.PASSWORD");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("USERNAME");
String b = rs.getString("PASSWORD");
Object[] row = {a, b};
DefaultTableModel abc = (DefaultTableModel)table.getModel();
abc.addRow(row);
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", 0);
}
}
Create a method update(); to update records
public void update() throws SQLException{
DefaultTableModel abc = (DefaultTableModel)table.getModel();
int numrows = table.getRowCount();
for(int i = numrows - 1; i >= 0; i--){
abc.removeRow(i);
}
pst = conn.prepareStatement("Select * from ROOT.PASSWORD");
rs = pst.executeQuery();
while(rs.next()){
String a = rs.getString("USER_NAME");
String b = rs.getString("PASSWORD");
Object[] row = {a, b};
abc.addRow(row);
}
}
Code for cancel button
this.dispose();
new Password_Frame().setVisible(true);
Code for delete button
13
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 lines used
import java.awt.print.PrinterException;
import java.io.File;
import java.text.*;
import java.util.Calendar;
import javax.swing.ImageIcon;
14
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);
Code for print bill jMenuItem
try {
Boolean a = PrintArea.print();
if(a){
15
JOptionPane.showMessageDialog(null, "printing successful", "Printing information",
JOptionPane.INFORMATION_MESSAGE);
}else{
JOptionPane.showMessageDialog(null, "Printing.......", "printing Information",
JOptionPane.INFORMATION_MESSAGE);
}
} catch (PrinterException ex) {
JOptionPane.showMessageDialog(null, ex, "Warning", JOptionPane.ERROR_MESSAGE);
}
Code for First_time_registration jMenuItem
try{
new First_time_registry().setVisible(true);
}catch(Exception e){
JOptionPane.showMessageDialog(null,
e,"Warning",
JOptionPane.INFORMATION_MESSAGE);
}
Code for help jMenuItem
JOptionPane.showMessageDialog(null, "Welcome to The help center of JIPL n u2022 if you
want to print bill press ctrl + shift + p or go to file menu n u2022 if you want to register a
new patient press ctrl + shift + N or go to file menu n u2022 if you want to logout press ctrl
+ shift + E or go to file menu n the Abbreviations stand for:- n u2022 Wt. - Weight n u2022 Ht. - Height n
u2022 Hc - Health Checkup done or not n u2022 Pr. - prothrombin ratio n u2022 BS - breath breath sound
bowel sounds (on auscultation using a stethoscope) n blood sugar body secretions n u2022 T.M. stands for
Tempreture of body as measured by authorised personnel n u2022 H/O - case history n u2022 The symbol
Rx is usually said to stand for the Latin word recipe meaning to take. nfor more help contact developer on
below given contact details :- n u2022 phone - 0755-2423076 n u2022 mob. no - 8889825554 n Thankyou
Please Visit Again!!!!", "help" , JOptionPane.INFORMATION_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));
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);
}
16
Code for save jMenuItem
try{
pst = conn.prepareStatement("delete from
ROOT."+CaseNo.getText()+" where S_NO = 1");
pst.execute();
pst = conn.prepareStatement("insert into ROOT."+CaseNo.getText()+"
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
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();
JOptionPane.showMessageDialog(null, "saved with success", "success",
JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.WARNING_MESSAGE);
}
Code for new button
try{
new First_time_registry().setVisible(true);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e,"Warning", JOptionPane.INFORMATION_MESSAGE);
}
Code for save button
try{
pst = conn.prepareStatement("delete from ROOT."+CaseNo.getText()+" where S_NO = 1");
pst.execute();
pst = conn.prepareStatement("insert into ROOT."+CaseNo.getText()+"
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
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();
JOptionPane.showMessageDialog(null, "saved with success", "success",
JOptionPane.INFORMATION_MESSAGE);
}catch(Exception e){
JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.WARNING_MESSAGE);
}
Code for updateVitalData button
try{
if(allergies2.getText() == null ||
allergies2.getText() == ""){
}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);
Code for print button
try{
Boolean printing = PrintArea.print();
if(printing){
JOptionPane.showMessageDialog(null, "Printing completed", "print dialog box",
JOptionPane.INFORMATION_MESSAGE);
}else{
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);
}
pst = conn.prepareStatement("select * from ROOT."+a+"_2");
rs = pst.executeQuery();
String d = null;
String e = null;
String i = null;
while(rs.next()){
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);
}
pst = conn.prepareStatement("select * from ROOT."+CaseNo.getText()+"_2");
rs = pst.executeQuery();
String d = null;
String e = null;
String i = null;
while(rs.next()){
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);
I. Register a new patient
Import lines used
import static java.awt.event.KeyEvent.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Random;
import java.sql.*;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
25
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++;
}
for(int i = 1; i <= size ; i++) {
for(int j = 0; j <= rowCount; j++)
{
if(b[j] != i){
list.add(i);
break;
}
}
}
}
26
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
pst = conn.prepareStatement("create table ROOT." +CaseText.getText() +CaseNo.getText()+
"(Refrence_NO varchar(25), date varchar(25), time varchar(25), WT varchar(25), HT varchar(25), Hc
varchar(25), pr varchar(25), bp1 varchar(25), bp2 varchar(25), bs varchar(25), tm varchar(25), bmi
varchar(25), bsa varchar(25), patient_name varchar(10000), Permanant_h_o varchar(10000),
photo_url varchar(1000), s_no integer primary key)");
pst.execute();
pst = conn.prepareStatement("delete from ROOT."+CaseText.getText()+CaseNo.getText()+"
where S_NO = 1");
pst.execute();
pst = conn.prepareStatement("insert into ROOT."+CaseText.getText()+CaseNo.getText()+"
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
pst.setString(1, RefNo.getText());
pst.setString(2, FirstVisit.getText());
pst.setString(3, "");
pst.setString(4, "Wt.");
pst.setString(5, "Ht");
pst.setString(6, "Hc");
pst.setString(7, "pr");
pst.setString(8, "Bp1");
pst.setString(9, "Bp2");
pst.setString(10, "Bs");
pst.setString(11, "Tm");
pst.setString(12, "BMI");
pst.setString(13, "BSA");
pst.setString(14, salutation.getText() +FirstName.getText() +MiddleName.getText() +
Surname.getText());
pst.setString(15, "Permanant H/O");
pst.setString(16, jLabel3.getIcon().toString());
pst.setInt(17, 1);
pst.execute();
pst = conn.prepareStatement("create table ROOT." +CaseText.getText() +CaseNo.getText()+
"_2(Patient_No varchar(10000), Complain varchar(10000), Examination varchar(10000), History
varchar(10000), Diagnosis_and_treatment varchar(10000), Vital_data varchar(1000), allergies
varchar(100), S_NO integer primary key)");
pst.execute();
pst = conn.prepareStatement("insert into ROOT."+CaseText.getText()+CaseNo.getText()+"_2
values(?,?,?,?,?,?,?,?)");
pst.setString(1, salutation.getText()+FirstName.getText()+MiddleName.getText()+Surname.getText());
pst.setString(2,"Complain>>");
pst.setString(3, "Examination>>");
pst.setString(4, "History");
pst.setString(5, "Diagnosis");
30
pst.setString(6, "Vital data");
pst.setString(7, "Allergies");
pst.setInt(8, 1);
pst.execute();
pst = conn.prepareStatement("create table ROOT."+CaseText.getText()+CaseNo.getText()+"_3(Sex
varchar(25), Mediclam varchar(25), Area varchar(100), Age varchar(25), Occupation varchar(25),
Ref_by varchar(25), Patient_name varchar(10000), S_NO integer primary key)");
pst.execute();
pst = conn.prepareStatement("insert into ROOT."+CaseText.getText()+CaseNo.getText()+"_3
values(?,?,?,?,?,?,?,?)");
pst.setString(1, Sex.getText());
pst.setString(2, Mediclam.getText());
pst.setString(3, Address.getText()+Area.getText()+ District.getText()+ State.getText()+
PinCode.getText());
pst.setString(4, Age.getText());
pst.setString(5, Occupation.getText());
pst.setString(6, ReferredBy.getText());
pst.setString(7, salutation.getText()+FirstName.getText()+MiddleName.getText()+Surname.getText());
pst.setInt(8, 1);
pst.execute();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
II. Delete a patient account
31
Import lines used
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Variables declared in public class
PreparedStatement pst = null;
Connection conn = null;
ResultSet rs = null;
Code to write below initComponents();
public delete_a_patient_account() {
initComponents();
try {
conn = javaDB.jDB();
String ab = "select * from ROOT.CASENO";
pst = conn.prepareStatement(ab);
rs = pst.executeQuery();
while(rs.next()){
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);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE);
}
}
Create a method update();
public void update() throws SQLException{
String ab = "select * from ROOT.CASENO";
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()){
32
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
JOptionPane.showMessageDialog(null, "Deleted the account with success" ,"Information" ,
JOptionPane.INFORMATION_MESSAGE);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e, "Warning",JOptionPane.ERROR_MESSAGE);
}
III. List of pending patients
Import lines used
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Variables declared in public class
PreparedStatement pst = null;
Connection conn = null;
ResultSet rs = null;
Code to write below initComponents();
public List_of_pending_Patients() {
initComponents();
try {
conn = javaDB.jDB();
String ab = "select * from ROOT.LIST_OF_PENDING_PATIENTS";
pst = conn.prepareStatement(ab);
36
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).

More Related Content

What's hot

Ip library management project
Ip library management projectIp library management project
Ip library management projectAmazShopzone
 
Library Management Python, MySQL
Library Management Python, MySQLLibrary Management Python, MySQL
Library Management Python, MySQLDarshit Vaghasiya
 
Computer science Project for class 11th and 12th(library management system)
Computer science Project for class 11th and 12th(library management system)Computer science Project for class 11th and 12th(library management system)
Computer science Project for class 11th and 12th(library management system)lokesh meena
 
computer science project on movie booking system
computer science project on movie booking systemcomputer science project on movie booking system
computer science project on movie booking systemAnurag Yadav
 
CLASS 12 ENGLISH PROJECT ON CHILD LABOUR
CLASS 12 ENGLISH PROJECT ON CHILD LABOURCLASS 12 ENGLISH PROJECT ON CHILD LABOUR
CLASS 12 ENGLISH PROJECT ON CHILD LABOURAryanNaglot
 
Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Self-employed
 
Computer Project for class 12 CBSE on school management
Computer Project for class 12 CBSE on school managementComputer Project for class 12 CBSE on school management
Computer Project for class 12 CBSE on school managementRemaDeosiSundi
 
Computer science project.pdf
Computer science project.pdfComputer science project.pdf
Computer science project.pdfHarshitSachdeva17
 
Informatics Practice Practical for 12th class
Informatics Practice Practical for 12th classInformatics Practice Practical for 12th class
Informatics Practice Practical for 12th classphultoosks876
 
class 12th computer science project Employee Management System In Python
 class 12th computer science project Employee Management System In Python class 12th computer science project Employee Management System In Python
class 12th computer science project Employee Management System In PythonAbhishekKumarMorla
 
Preparation of Soyabean Milk - 4 | CBSE Class 12 | Edu Resources
Preparation of Soyabean Milk - 4 | CBSE Class 12 | Edu ResourcesPreparation of Soyabean Milk - 4 | CBSE Class 12 | Edu Resources
Preparation of Soyabean Milk - 4 | CBSE Class 12 | Edu ResourcesSaksham Mittal
 
Student DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEmStudent DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEmhome
 
computer science project for class 12 on telephone billing
computer science project for class 12 on telephone billingcomputer science project for class 12 on telephone billing
computer science project for class 12 on telephone billinganshi acharya
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Pythonvikram mahendra
 
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12THBANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12THSHAJUS5
 
Employee Management (CS Project for 12th CBSE)
Employee Management (CS Project for 12th CBSE)Employee Management (CS Project for 12th CBSE)
Employee Management (CS Project for 12th CBSE)PiyushKashyap54
 
IP Final project 12th
IP Final project 12thIP Final project 12th
IP Final project 12thSantySS
 
Computer science project on Online Banking System class 12
Computer science project on Online Banking System class 12Computer science project on Online Banking System class 12
Computer science project on Online Banking System class 12OmRanjan2
 
cbse 12 computer science IP
cbse 12 computer science IPcbse 12 computer science IP
cbse 12 computer science IPD. j Vicky
 
Physics Practical File - with Readings | Class 12 CBSE
Physics Practical File - with Readings | Class 12 CBSEPhysics Practical File - with Readings | Class 12 CBSE
Physics Practical File - with Readings | Class 12 CBSESaksham Mittal
 

What's hot (20)

Ip library management project
Ip library management projectIp library management project
Ip library management project
 
Library Management Python, MySQL
Library Management Python, MySQLLibrary Management Python, MySQL
Library Management Python, MySQL
 
Computer science Project for class 11th and 12th(library management system)
Computer science Project for class 11th and 12th(library management system)Computer science Project for class 11th and 12th(library management system)
Computer science Project for class 11th and 12th(library management system)
 
computer science project on movie booking system
computer science project on movie booking systemcomputer science project on movie booking system
computer science project on movie booking system
 
CLASS 12 ENGLISH PROJECT ON CHILD LABOUR
CLASS 12 ENGLISH PROJECT ON CHILD LABOURCLASS 12 ENGLISH PROJECT ON CHILD LABOUR
CLASS 12 ENGLISH PROJECT ON CHILD LABOUR
 
Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12
 
Computer Project for class 12 CBSE on school management
Computer Project for class 12 CBSE on school managementComputer Project for class 12 CBSE on school management
Computer Project for class 12 CBSE on school management
 
Computer science project.pdf
Computer science project.pdfComputer science project.pdf
Computer science project.pdf
 
Informatics Practice Practical for 12th class
Informatics Practice Practical for 12th classInformatics Practice Practical for 12th class
Informatics Practice Practical for 12th class
 
class 12th computer science project Employee Management System In Python
 class 12th computer science project Employee Management System In Python class 12th computer science project Employee Management System In Python
class 12th computer science project Employee Management System In Python
 
Preparation of Soyabean Milk - 4 | CBSE Class 12 | Edu Resources
Preparation of Soyabean Milk - 4 | CBSE Class 12 | Edu ResourcesPreparation of Soyabean Milk - 4 | CBSE Class 12 | Edu Resources
Preparation of Soyabean Milk - 4 | CBSE Class 12 | Edu Resources
 
Student DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEmStudent DATABASE MANAGeMEnT SysTEm
Student DATABASE MANAGeMEnT SysTEm
 
computer science project for class 12 on telephone billing
computer science project for class 12 on telephone billingcomputer science project for class 12 on telephone billing
computer science project for class 12 on telephone billing
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
 
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12THBANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
BANK MANAGEMENT INVESTIGATORY PROJECT CLASS 12TH
 
Employee Management (CS Project for 12th CBSE)
Employee Management (CS Project for 12th CBSE)Employee Management (CS Project for 12th CBSE)
Employee Management (CS Project for 12th CBSE)
 
IP Final project 12th
IP Final project 12thIP Final project 12th
IP Final project 12th
 
Computer science project on Online Banking System class 12
Computer science project on Online Banking System class 12Computer science project on Online Banking System class 12
Computer science project on Online Banking System class 12
 
cbse 12 computer science IP
cbse 12 computer science IPcbse 12 computer science IP
cbse 12 computer science IP
 
Physics Practical File - with Readings | Class 12 CBSE
Physics Practical File - with Readings | Class 12 CBSEPhysics Practical File - with Readings | Class 12 CBSE
Physics Practical File - with Readings | Class 12 CBSE
 

Similar to IP project for class 12 cbse

code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql JOYITAKUNDU1
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdffathimafancy
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutionsbenewu
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfrajeshjangid1865
 
MeetJS Summit 2016: React.js enlightenment
MeetJS Summit 2016: React.js enlightenmentMeetJS Summit 2016: React.js enlightenment
MeetJS Summit 2016: React.js enlightenmentArtur Szott
 
Informatica_MDM_User_Exits.ppt
Informatica_MDM_User_Exits.pptInformatica_MDM_User_Exits.ppt
Informatica_MDM_User_Exits.pptDurganandYedlapati
 
Tmpj3 01 201181102muhammad_tohir
Tmpj3 01 201181102muhammad_tohirTmpj3 01 201181102muhammad_tohir
Tmpj3 01 201181102muhammad_tohirpencari buku
 
8 sql injection
8   sql injection8   sql injection
8 sql injectiondrewz lin
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfarvindarora20042013
 
(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docx
(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docx(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docx
(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docxajoy21
 
JavaScript Proven Practises
JavaScript Proven PractisesJavaScript Proven Practises
JavaScript Proven PractisesRobert MacLean
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeletonIram Ramrajkar
 
ProjectReport - Maurya,Shailesh
ProjectReport - Maurya,ShaileshProjectReport - Maurya,Shailesh
ProjectReport - Maurya,Shaileshsagar.247
 

Similar to IP project for class 12 cbse (20)

code for quiz in my sql
code for quiz  in my sql code for quiz  in my sql
code for quiz in my sql
 
Java programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdfJava programI made this Account.java below. Using the attached cod.pdf
Java programI made this Account.java below. Using the attached cod.pdf
 
Ecom lec4 fall16_jpa
Ecom lec4 fall16_jpaEcom lec4 fall16_jpa
Ecom lec4 fall16_jpa
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutions
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
Java
JavaJava
Java
 
I need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdfI need help creating a basic and simple Java program. Here is the ex.pdf
I need help creating a basic and simple Java program. Here is the ex.pdf
 
package org dev
package org devpackage org dev
package org dev
 
Package org dev
Package org devPackage org dev
Package org dev
 
MeetJS Summit 2016: React.js enlightenment
MeetJS Summit 2016: React.js enlightenmentMeetJS Summit 2016: React.js enlightenment
MeetJS Summit 2016: React.js enlightenment
 
Informatica_MDM_User_Exits.ppt
Informatica_MDM_User_Exits.pptInformatica_MDM_User_Exits.ppt
Informatica_MDM_User_Exits.ppt
 
Tmpj3 01 201181102muhammad_tohir
Tmpj3 01 201181102muhammad_tohirTmpj3 01 201181102muhammad_tohir
Tmpj3 01 201181102muhammad_tohir
 
8 sql injection
8   sql injection8   sql injection
8 sql injection
 
Java!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdfJava!!!!!Create a program that authenticates username and password.pdf
Java!!!!!Create a program that authenticates username and password.pdf
 
(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docx
(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docx(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docx
(ArrayIndexOutOfBoundsException) Modifythe program from the code bel.docx
 
Ad java prac sol set
Ad java prac sol setAd java prac sol set
Ad java prac sol set
 
JavaScript Proven Practises
JavaScript Proven PractisesJavaScript Proven Practises
JavaScript Proven Practises
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
 
ProjectReport - Maurya,Shailesh
ProjectReport - Maurya,ShaileshProjectReport - Maurya,Shailesh
ProjectReport - Maurya,Shailesh
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 

IP project for class 12 cbse

  • 1. Name -Siddharth Kumar Jha Class -12th ‘A’ Scholar number -676 Roll number -25 COMPUTER PROJECT
  • 2. 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  Before it all begins.  Creating a java class  Splash screen a. Java main class screenScreen  Login frame i. Admin form 1 a. Sign up another authorized personal ii. Admin form 2 a. Delete an account  Main Frame i. Register a new patient ii. Delete a patient account iii. List of pending patients …3 …4 …4 …4 – 5 …4 – 5 …5 – 8 …8 – 9 …9 – 10 …10 – 11 …11 – 13 …13 – 23 …23 – 30 …30 – 35 …35 – 42 9 Merits …42 10 De – Merits …42 11 Merits …42 12 Bibliography …42
  • 3. 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. Table Structure of report (java database) table to store Case Number( common to all) Table which contains list of pending patient(common for all) Table one for patient(one for each) Note* - The name of each table here depends on case number. Eg – Case, Case_2, Case_3. Table 2 for patient(unique for each)
  • 4. 3 Table for Storing Password Table 3 for patient(unique for each) Flow Chart showing the way things are connected Splash Screen (Splash.java) Java Main Class screenScreen.java Password Form Password_Frame.java Admin form admin.java Admin form admin2.java Main Frame Test_Frame.java Sign up (add another authorized person) signup.java Delete an account Delete_account.java Register a new patient First_time_registry.java List of pending patients List_of_pending_Patients.java Delete a patient’s account delete_a_patient_account.java
  • 5. 4 Coding of the project 1. Before it all begins You must right click on libraries and then click on add library to add: a. MySQL JDBC Driver, and b. Java DB Driver So that you can connect to the java database. 2. Creating a java class named javaDB to connect everything import java.sql.*; import javax.swing.JOptionPane; public class javaDB { public static Connection jDB(){ try{ Class.forName("org.apache.derby.jdbc.ClientDriver"); Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/contact","root", "T#achedg#2011"); return conn; } catch(Exception e){ JOptionPane.showMessageDialog(null, e, "warning", 0); return null; } } } 3. Splash screen First design the screen as shown: Runtime image of splash screen
  • 6. 5 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) { splash Splash = new splash( ); Splash.setVisible(true); try { for (int i = 0; i < 100; i++) { Thread.sleep(50); Splash.jLabel1.setText(i+"%"); Splash.jProgressBar1.setValue(i); } Splash.setVisible(false); new Password_Frame( ).setVisible(true); } catch (Exception e) { JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.ERROR_MESSAGE); } } } 4. Login frame Runtime Image of password frame
  • 7. 6 Import lines used import java.awt.event.KeyEvent; import javax.swing.JOptionPane; import java.sql.*; Variables declared in public class PreparedStatement pst = null; Connection conn = null; ResultSet rs = null; Lines written below initComponents(); public Password_Frame() { initComponents( ); Login.setMnemonic(KeyEvent.VK_F1); try{ conn = javaDB.jDB(); }catch(Exception e){ JOptionPane.showMessageDialog(null, e, "alert", 0); } } Coding for visibleActionPerformed (our visible check box) if(visible.isSelected()){ pass.setEchoChar((char)0); }else pass.setEchoChar('*'); Coding for jMenuItem2ActionPerformed System.exit(0); Coding for jMenuItem1ActionPerformed this.dispose(); new admin().setVisible(true); Coding for jMenuItem3ActionPerformed JOptionPane.showMessageDialog(null, "Hello!" + "n" + "Welcome to Jha Infosys Pvt. Ltd. Login Frame" + "n" + "u2022 " + "For creating new account please press F12 key or go to file menu" + "n" + "u2022 "+ "For deleting an account please press F10 key or again go to file menu" + "n" + "u2022" + " For exiting this frame press F11 key or go to file menu or press the red cross on the top for exit" + "n" + "For further help contact the developer at below given contact details in the password frame" + "n" + "", "help", JOptionPane.INFORMATION_MESSAGE);
  • 8. 7 Coding for jMenuItem4ActionPerformed this.dispose(); new admin2().setVisible(true); coding for LoginActionPerformed try { String a = user.getText(); String b = new String(pass.getPassword()); String c = "select * from ROOT.PASSWORD"; String d = null; String e = null; pst = conn.prepareStatement(c); rs = pst.executeQuery(); int i = 0; PassWord: while(rs.next()){ d = rs.getString("USERNAME"); e = rs.getString("PASSWORD"); if(a.equals(d) && b.equals(e) || a.equals("admin") && b.equals("T#achedg#2011")){ JOptionPane.showMessageDialog(null, "Your password was correct", "success", 1); this.dispose(); new Test_Frame().setVisible(true); i++; if(a.equals("admin") && b.equals("T#achedg#2011")) break PassWord; } } if(i > 0){ }else{ JOptionPane.showMessageDialog(null,"Your password was wrong", "warning",1); } } catch (SQLException ex) { JOptionPane.showMessageDialog(null, ex,"alert",0); } Coding for logoutActionPerformed System.exit(0);
  • 9. 8 I. Admin form1 Import lines used: import static java.awt.event.KeyEvent.*; import javax.swing.JOptionPane; Lines written below initComponents(); public admin() { initComponents(); enter.setMnemonic(VK_F1); cancel.setMnemonic(VK_F2); } Code for visible check box: if(visible.isSelected()){ pass.setEchoChar((char) 0); }else pass.setEchoChar('*'); 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 signup().setVisible(true); }else JOptionPane.showMessageDialog(null, "You were wrong", "information", 1); Code for cancel button this.dispose(); new Password_Frame().setVisible(true);
  • 10. 9 a) Sign up another authorized personal Import lines used import static java.awt.event.KeyEvent.*; import java.sql.*; import javax.swing.JOptionPane; Variables in the public class PreparedStatement pst = null; Connection conn = null; ResultSet rs = null; Variables declared below initComponents public signup() { initComponents(); try{ conn = javaDB.jDB(); create.setMnemonic(VK_F1); cancel.setMnemonic(VK_F2); exit.setMnemonic(VK_F3); }catch(Exception e){ JOptionPane.showMessageDialog(null, e, "Warning", 0); } } Code for exit button System.exit(0); Code for cancel button this.dispose(); new Password_Frame().setVisible(true); Code for create button try{ String a = new String(pass1.getPassword()); String b = new String(pass2.getPassword());
  • 11. 10 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 Import lines used import static java.awt.event.KeyEvent.VK_F1; import static java.awt.event.KeyEvent.VK_F2; import javax.swing.JOptionPane; Code below initComponents(); public admin2() {
  • 12. 11 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 Import lines used import static java.awt.event.KeyEvent.VK_F1; import static java.awt.event.KeyEvent.VK_F2; import java.sql.*; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; Varibles declared in public class PreparedStatement pst = null;
  • 13. 12 Connection conn = null; ResultSet rs = null; Code to write below initComponents(); public delete_account() { initComponents(); try{ delete.setMnemonic(VK_F1); cancel.setMnemonic(VK_F2); conn = javaDB.jDB(); pst = conn.prepareStatement("Select * from ROOT.PASSWORD"); rs = pst.executeQuery(); while(rs.next()){ String a = rs.getString("USERNAME"); String b = rs.getString("PASSWORD"); Object[] row = {a, b}; DefaultTableModel abc = (DefaultTableModel)table.getModel(); abc.addRow(row); } }catch(Exception e){ JOptionPane.showMessageDialog(null, e, "warning", 0); } } Create a method update(); to update records public void update() throws SQLException{ DefaultTableModel abc = (DefaultTableModel)table.getModel(); int numrows = table.getRowCount(); for(int i = numrows - 1; i >= 0; i--){ abc.removeRow(i); } pst = conn.prepareStatement("Select * from ROOT.PASSWORD"); rs = pst.executeQuery(); while(rs.next()){ String a = rs.getString("USER_NAME"); String b = rs.getString("PASSWORD"); Object[] row = {a, b}; abc.addRow(row); } } Code for cancel button this.dispose(); new Password_Frame().setVisible(true); Code for delete button
  • 14. 13 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 lines used import java.awt.print.PrinterException; import java.io.File; import java.text.*; import java.util.Calendar; import javax.swing.ImageIcon;
  • 15. 14 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); Code for print bill jMenuItem try { Boolean a = PrintArea.print(); if(a){
  • 16. 15 JOptionPane.showMessageDialog(null, "printing successful", "Printing information", JOptionPane.INFORMATION_MESSAGE); }else{ JOptionPane.showMessageDialog(null, "Printing.......", "printing Information", JOptionPane.INFORMATION_MESSAGE); } } catch (PrinterException ex) { JOptionPane.showMessageDialog(null, ex, "Warning", JOptionPane.ERROR_MESSAGE); } Code for First_time_registration jMenuItem try{ new First_time_registry().setVisible(true); }catch(Exception e){ JOptionPane.showMessageDialog(null, e,"Warning", JOptionPane.INFORMATION_MESSAGE); } Code for help jMenuItem JOptionPane.showMessageDialog(null, "Welcome to The help center of JIPL n u2022 if you want to print bill press ctrl + shift + p or go to file menu n u2022 if you want to register a new patient press ctrl + shift + N or go to file menu n u2022 if you want to logout press ctrl + shift + E or go to file menu n the Abbreviations stand for:- n u2022 Wt. - Weight n u2022 Ht. - Height n u2022 Hc - Health Checkup done or not n u2022 Pr. - prothrombin ratio n u2022 BS - breath breath sound bowel sounds (on auscultation using a stethoscope) n blood sugar body secretions n u2022 T.M. stands for Tempreture of body as measured by authorised personnel n u2022 H/O - case history n u2022 The symbol Rx is usually said to stand for the Latin word recipe meaning to take. nfor more help contact developer on below given contact details :- n u2022 phone - 0755-2423076 n u2022 mob. no - 8889825554 n Thankyou Please Visit Again!!!!", "help" , JOptionPane.INFORMATION_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)); 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); }
  • 17. 16 Code for save jMenuItem try{ pst = conn.prepareStatement("delete from ROOT."+CaseNo.getText()+" where S_NO = 1"); pst.execute(); pst = conn.prepareStatement("insert into ROOT."+CaseNo.getText()+" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); 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(); JOptionPane.showMessageDialog(null, "saved with success", "success", JOptionPane.INFORMATION_MESSAGE); }catch(Exception e){ JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.WARNING_MESSAGE); } Code for new button try{ new First_time_registry().setVisible(true); }catch(Exception e){ JOptionPane.showMessageDialog(null, e,"Warning", JOptionPane.INFORMATION_MESSAGE); } Code for save button try{ pst = conn.prepareStatement("delete from ROOT."+CaseNo.getText()+" where S_NO = 1"); pst.execute(); pst = conn.prepareStatement("insert into ROOT."+CaseNo.getText()+" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); pst.setString(1, RefrenceNo.getText());
  • 18. 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(); JOptionPane.showMessageDialog(null, "saved with success", "success", JOptionPane.INFORMATION_MESSAGE); }catch(Exception e){ JOptionPane.showMessageDialog(null, e, "warning", JOptionPane.WARNING_MESSAGE); } Code for updateVitalData button try{ if(allergies2.getText() == null || allergies2.getText() == ""){ }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(?,?,?,?,?,?,?,?)");
  • 19. 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); Code for print button try{ Boolean printing = PrintArea.print(); if(printing){ JOptionPane.showMessageDialog(null, "Printing completed", "print dialog box", JOptionPane.INFORMATION_MESSAGE); }else{ 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);
  • 20. 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();
  • 21. 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);
  • 22. 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); } pst = conn.prepareStatement("select * from ROOT."+a+"_2"); rs = pst.executeQuery(); String d = null; String e = null; String i = null; while(rs.next()){ 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");
  • 23. 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());
  • 24. 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); } pst = conn.prepareStatement("select * from ROOT."+CaseNo.getText()+"_2"); rs = pst.executeQuery(); String d = null; String e = null; String i = null; while(rs.next()){ d = rs.getString("COMPLAIN"); e = rs.getString("EXAMINATION"); i = rs.getString("ALLERGIES"); }
  • 25. 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); I. Register a new patient Import lines used import static java.awt.event.KeyEvent.*; import java.io.File; import java.util.ArrayList; import java.util.Random; import java.sql.*; import javax.swing.ImageIcon; import javax.swing.JFileChooser;
  • 26. 25 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++; } for(int i = 1; i <= size ; i++) { for(int j = 0; j <= rowCount; j++) { if(b[j] != i){ list.add(i); break; } } } }
  • 27. 26 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;
  • 28. 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
  • 29. 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();
  • 30. 29 pst = conn.prepareStatement("create table ROOT." +CaseText.getText() +CaseNo.getText()+ "(Refrence_NO varchar(25), date varchar(25), time varchar(25), WT varchar(25), HT varchar(25), Hc varchar(25), pr varchar(25), bp1 varchar(25), bp2 varchar(25), bs varchar(25), tm varchar(25), bmi varchar(25), bsa varchar(25), patient_name varchar(10000), Permanant_h_o varchar(10000), photo_url varchar(1000), s_no integer primary key)"); pst.execute(); pst = conn.prepareStatement("delete from ROOT."+CaseText.getText()+CaseNo.getText()+" where S_NO = 1"); pst.execute(); pst = conn.prepareStatement("insert into ROOT."+CaseText.getText()+CaseNo.getText()+" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); pst.setString(1, RefNo.getText()); pst.setString(2, FirstVisit.getText()); pst.setString(3, ""); pst.setString(4, "Wt."); pst.setString(5, "Ht"); pst.setString(6, "Hc"); pst.setString(7, "pr"); pst.setString(8, "Bp1"); pst.setString(9, "Bp2"); pst.setString(10, "Bs"); pst.setString(11, "Tm"); pst.setString(12, "BMI"); pst.setString(13, "BSA"); pst.setString(14, salutation.getText() +FirstName.getText() +MiddleName.getText() + Surname.getText()); pst.setString(15, "Permanant H/O"); pst.setString(16, jLabel3.getIcon().toString()); pst.setInt(17, 1); pst.execute(); pst = conn.prepareStatement("create table ROOT." +CaseText.getText() +CaseNo.getText()+ "_2(Patient_No varchar(10000), Complain varchar(10000), Examination varchar(10000), History varchar(10000), Diagnosis_and_treatment varchar(10000), Vital_data varchar(1000), allergies varchar(100), S_NO integer primary key)"); pst.execute(); pst = conn.prepareStatement("insert into ROOT."+CaseText.getText()+CaseNo.getText()+"_2 values(?,?,?,?,?,?,?,?)"); pst.setString(1, salutation.getText()+FirstName.getText()+MiddleName.getText()+Surname.getText()); pst.setString(2,"Complain>>"); pst.setString(3, "Examination>>"); pst.setString(4, "History"); pst.setString(5, "Diagnosis");
  • 31. 30 pst.setString(6, "Vital data"); pst.setString(7, "Allergies"); pst.setInt(8, 1); pst.execute(); pst = conn.prepareStatement("create table ROOT."+CaseText.getText()+CaseNo.getText()+"_3(Sex varchar(25), Mediclam varchar(25), Area varchar(100), Age varchar(25), Occupation varchar(25), Ref_by varchar(25), Patient_name varchar(10000), S_NO integer primary key)"); pst.execute(); pst = conn.prepareStatement("insert into ROOT."+CaseText.getText()+CaseNo.getText()+"_3 values(?,?,?,?,?,?,?,?)"); pst.setString(1, Sex.getText()); pst.setString(2, Mediclam.getText()); pst.setString(3, Address.getText()+Area.getText()+ District.getText()+ State.getText()+ PinCode.getText()); pst.setString(4, Age.getText()); pst.setString(5, Occupation.getText()); pst.setString(6, ReferredBy.getText()); pst.setString(7, salutation.getText()+FirstName.getText()+MiddleName.getText()+Surname.getText()); pst.setInt(8, 1); pst.execute(); } catch (Exception e) { JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE); } II. Delete a patient account
  • 32. 31 Import lines used import java.sql.*; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; Variables declared in public class PreparedStatement pst = null; Connection conn = null; ResultSet rs = null; Code to write below initComponents(); public delete_a_patient_account() { initComponents(); try { conn = javaDB.jDB(); String ab = "select * from ROOT.CASENO"; pst = conn.prepareStatement(ab); rs = pst.executeQuery(); while(rs.next()){ 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); } } catch (Exception e) { JOptionPane.showMessageDialog(null, e, "Warning", JOptionPane.ERROR_MESSAGE); } } Create a method update(); public void update() throws SQLException{ String ab = "select * from ROOT.CASENO"; 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()){
  • 33. 32 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");
  • 34. 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");
  • 35. 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();
  • 36. 35 JOptionPane.showMessageDialog(null, "Deleted the account with success" ,"Information" , JOptionPane.INFORMATION_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(null, e, "Warning",JOptionPane.ERROR_MESSAGE); } III. List of pending patients Import lines used import java.sql.*; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; Variables declared in public class PreparedStatement pst = null; Connection conn = null; ResultSet rs = null; Code to write below initComponents(); public List_of_pending_Patients() { initComponents(); try { conn = javaDB.jDB(); String ab = "select * from ROOT.LIST_OF_PENDING_PATIENTS"; pst = conn.prepareStatement(ab);
  • 37. 36 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);
  • 38. 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");
  • 39. 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");
  • 40. 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());
  • 41. 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");
  • 42. 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);
  • 43. 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).