Sei sulla pagina 1di 32

HOSPITAL MANAGEMENT SYSTEM

Life Line Hospital was founded in 2011 with an aim to help people with their medical needs. It has become are all life line of for the city of Texas because it was founded with motive to serve people rather than make profits. Highly dedicated employees and a specialized medical staff are the key factors that help people to rely on Life Line. Life Line has a group of social and professional people as directors and managers in its management who provide a personal as well as professional touch to the overall working of the hospital. Proper guidelines and objectives are laid down for every process and section of the hospital which results in ensuring satisfaction of patients. The current department structure of Life Line is given below:-

Page 1 of 32

Current System
Life Line Hospital maintains a manual system to manage its operations. The front desk assistant handles the Out Patient (OP) registration details. When patient comes for admission or consultation, the front desk assistant makes the required entries in the OP file. The front desk assistant provides an OP number and then the patient is referred to the concerned doctor. The concerned department assistant then makes the entry of the patient in In-Patient(IP) file and provides an IP number. The patient is then referred to an available doctor and the treatment process starts. The Patient Insurance Department issues the required documents for the medical insurance of the patient. The documents are then sent to the concerned doctor and accounts department for approval and if approval is given, the documents are sent to the concerned insurance company. Below is the ER diagram of patients registration and management in Life Line:-Page 2 of 32

Front-End and Middle-Tier Code and Design


Visual C# programming is used to make the front-end for the users to work in the system while Ado.NET is used to connect the Front-End and Back-End. The forms used are divided into the following ways for ease of use:1. Log-In Form 2. Life Line System Workspace Form 3. Medical And Drug History 4. Diagnosis And Bills 5. Create An Event or Circular 6. Delete Confirm Form 7. Help Menu Log-In Form

The Log-In Form is shown above. The properties set are below:Property Name Form:Name Text MaximizeBox Value formLogin Log-In Form False

MinimizeBox StartPosition Font Size Panel:Name AutoSize Dock Labels:Name:Text FontColor Font Name Text Font

False CentreScreen TimesNewRoman,9.75pt,style=Bold 604,420

panelLogin True Fill

labelUsername Username Desktop TimesNewRoman,12pt,style=Bold,Underline labelInfo LogintoHospitalManagementSystem TimesNewRoman,15.75pt,style=Bold,Underlin e labelPassword Password TimesNewRoman,12pt,style=Bold,Underline Desktop

Name Text Font FontColor TextBox:Name Font TabIndex Name Font TabIndex Button:Name Text Font

textUsername TimesNewRoman,9.75pt,style=Bold 1 textpassword TimesNewRoman,9.75pt,style=Bold 2

btnLogin LOGIN TimesNewRoman,14.25pt,style=Bold

FontColor Name Text Font FontColor

Green btnCancel CANCEL TimesNewRoman,14.25pt,style=Bold 192,0,0

The code written for this form is below:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Hospital_Management_Project { public partial class formLogin : Form { public formLogin() { InitializeComponent(); }

int ctr; public string username, password;

private void buttonCancel_Click(object sender, EventArgs e) { //To exit the application on pressing the CANCEL button Application.Exit();

} private void buttonLogin_Click(object sender, EventArgs e) { //Code to login to the database. //User given 3 tries to login. username = textUsername.Text; password = textPassword.Text; ctr = ctr + 1; if ((username == "Hospital") && (password == "niit")) { labelLoginStatus.Visible = true; labelLoginStatus.Text = "Login Successful"; ctr = 0; formLifeLineSystemWorkspace fhmw = new fhmw.Show(); this.Hide(); } else if (ctr < 3) { labelLoginStatus.Visible = true; labelLoginStatus.Text = "Login Unsuccessful"; textUsername.ResetText(); textPassword.ResetText(); textUsername.Focus(); } else { MessageBox.Show("Unauthorized access. Aborting ............"); Application.Exit(); formLifeLineSystemWorkspace();

} } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void textPassword_TextChanged(object sender, EventArgs e) {

} } }

Life Line System Workspace Form

The workspace form's property set is given below:PropertyName Form:Name Text BackgroundImage Value formLifeLineSystemWorkspace LifeLineSystemWorkspace Hospital_Management_Project.Properties.Re sources.isuite

BackgroundImageLayout IsMDIContainer MainMenuStrip StartPosition WindowState MenuStripControl Name Collections

Stretch True menuStrip1 CenterScreen Maximized

menuStrip1 menuPatientRegistrationDetails menuFinancialAcconting menuMiscOperatingDepartments menuMoreOptionsMenuToolStrip menuHelp menuPatientRegistrationDetails PatientRegistrationDetails menuMedicalAndDrugHistory menuDiagnosisAndBills menuFinanialAccounting FinancialAccounting menuMiscOperatingDepartments Misc.OperatingDepartments menuMoreOptions MoreOptions createAnEventOrCircularToolStripMenuIte m

menuPatientRegistrationDetails Name Text Collections menuFinancialAccounting Name Text menuMiscOperatingDepartments Name Text menuMoreOptions Name Text Collections

menuHelp Name Text menuHelp Help

The code written for this form is below:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;

using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace Hospital_Management_Project { public partial class formLifeLineSystemWorkspace : Form { public formLifeLineSystemWorkspace() { InitializeComponent(); } private void menuMedicalDrugHistory_Click(object sender, EventArgs e) { //Shows Medical and Drug History form. formMedicalAndDrugHstory fmdh = new formMedicalAndDrugHstory(); fmdh.Show(); fmdh.MdiParent = this; }

private void menuPatientStatusAndBills_Click(object sender, EventArgs e) { //Shows Diagnosis And Bills form. formDiagnosisAndBills fdb = new formDiagnosisAndBills(); fdb.Show(); fdb.MdiParent = this; } private void formHospitlaManagementWorkspace_FormClosing(object sender, FormClosingEventArgs e) { //On clicking the close button on the workspace form, the application shuts down.

Application.Exit(); } private void menuFinancialAcconting_Click(object sender, EventArgs e) { MessageBox.Show("The application is still under construction, so not all parts of it are ready yet. We regret our convenience."); } private void menuMiscOperatingDepartments_Click(object sender, EventArgs e) { MessageBox.Show("The application is still under construction, so not all parts of it are ready yet. We regret our convenience."); } private void createAnEventOrCircularToolStripMenuItem_Click(object sender, EventArgs e) { //Shows the create and Event or Circular form formCreateAnEventOrCircular fcaeoc = new formCreateAnEventOrCircular(); fcaeoc.Show(); } private void menuHelp_Click(object sender, EventArgs e) { Process.Start(Application.StartupPath + @"\Help File\Hospital Management System.chm"); } } }

Medical And Drug History Form

10

The form's property set is given below:Property Name Form:Name Text BackColor ShowIcon Labels:Name Text Name Text Name Text Name Text Name Text Name Text labelOPID OPID labelIPID IPID labelPatientName PatientName labelAddress Address labelProblem Problem labelMedicineHistory MedicalHistory formMedicalAndDrugHistory MedicalAndDrugHistory LightSteelBlue False Value

11

Name Text Name Text Name Text Name Text Name Text Font(--setforalllabels--) TextBoxes:Name Name Name Name Name Name Name Name Name Font(--setforalltextboxes---) ComboBox:Name GroupBox:Name Text Font DataGridView:Name Buttons:Name Text Color Name Text Color Name

labelPreviousDoctor PreviousDoctor(Ifany.) labelPreviousHospital PreviousHospital(Ifany.) labelDostorSpeciality DoctorSpecialty labelDoctorID DoctorID labelOPIDSearch MentionOPIDHere Times New Roman, 11.25pt, style=Bold textIPID textOPID textPatientName textAddress textProblem textMedicalHistory textPreviousDoctor textPrevioudHospital textDoctorSpeciality TimesNewRoman,9.75pt ComboBoxOPIDSearch groupBoxSearch Searchanrecord MicrosoftSansSerif,9.75pt dataGridView1 btnAdd ADD DarkCyan btnSave Save Green btnReset

12

Text Color Name Text Color Name Text Color

Reset ControlText btnDelete Delete! 192,0,0 btnSearch Search MidnightBlue

The code written for this form is below:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace Hospital_Management_Project { public partial class formMedicalAndDrugHstory : Form { SqlConnection conn ; public formMedicalAndDrugHstory() { InitializeComponent(); conn = new SqlConnection("data Source=kol-11274-mrsrv;Initial catalog=HospitalManagementSystem;User Id=student;Password=sql_2005"); } private void formMedicalAndDrugHstory_Load_1(object sender, EventArgs e) { conn.Open(); string qry = "Select * from medicalanddrughistory";

13

DataSet Dhistory = new DataSet(); SqlDataAdapter adp = new SqlDataAdapter(qry, conn); adp.Fill(Dhistory); dataGridView1.DataSource = Dhistory.Tables[0]; comboBoxOPIDSearch.DataSource = Dhistory.Tables[0]; comboBoxOPIDSearch.DisplayMember = "opid"; conn.Close(); } private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { textOPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[0].Value); textIPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value); textPatientName.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value); textAddress.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[3].Value); textProblem.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value); textMedicineHistory.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[5].Value); textPreviousDoctor.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[6].Value); textPreviousHospital.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[7].Value); textDoctorSpeciality.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[8].Value); textDoctorID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[9].Value); } private void btnSearch_Click_1(object sender, EventArgs e) { conn.Open();

14

string query = "Select * from medicalanddrughistory where opid="+comboBoxOPIDSearch.Text+""; SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader rdr= cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(rdr); dataGridView1.DataSource = dt.DefaultView; conn.Close(); } private void btnAdd_Click(object sender, EventArgs e) { conn.Open(); //Implement Local transaction. string strinsert = "Insert into medicalanddrughistory( IPID, PName, PAddress, PProblem, PMedicalHistory, PrevDoctor, PrevHospital, DoctorSpeciality, DoctorID) values('" + textIPID.Text + "', '" + textPatientName.Text + "', '" + textAddress.Text + "', '" + textProblem.Text + "', '" + textMedicineHistory.Text + "', '" + textPreviousDoctor.Text + "','" + textPreviousHospital.Text + "', '" + textDoctorSpeciality.Text + "', '" + textDoctorID.Text + "')"; SqlCommand cmd = new SqlCommand(strinsert, conn); SqlTransaction tran = null; try { //Sources of possible exception errors. tran = conn.BeginTransaction(); SqlCommand cmd1 = new SqlCommand(strinsert, conn, tran); cmd1.ExecuteNonQuery(); tran.Commit(); MessageBox.Show("Patient Information added Successfully.", "Info message"); } catch (SqlException se) {

15

//In case of Sql Exception. MessageBox.Show("Error", se.Message); tran.Rollback(); } catch (System.Exception sysex) { //In case of Other Exception. MessageBox.Show("Error in Transaction" + sysex.Message); } finally { //Display changes in DataGridView SqlDataAdapter sda = new SqlDataAdapter("select * from medicalanddrughistory", conn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables[0].DefaultView; //Finally close the connection. conn.Close(); } }

private void btnSave_Click(object sender, EventArgs e) { conn.Open(); string savedetails = textOPID.Text; string strsave = "Update medicalanddrughistory set IPID='" + textIPID.Text + "', pname='" + textPatientName.Text + "', paddress='" + textAddress.Text + "', pproblem='" + textProblem.Text + "', pmedicalhistory='" + textMedicineHistory.Text + "', PrevDoctor='" + textPreviousDoctor.Text + "',PrevHospital='" + textPreviousHospital.Text + "',Doctorspeciality='" + textDoctorSpeciality.Text + "',DoctorID='" + textDoctorID.Text + "' where opid =" + Convert.ToInt32(textOPID.Text) + "";

16

try { SqlCommand cmd = new SqlCommand(strsave, conn); //cmd.Parameters.Add(new SqlParameter("@opid", savedetails)); cmd.ExecuteNonQuery(); SqlDataAdapter sda = new SqlDataAdapter(strsave, conn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables[0].DefaultView; } catch (SqlException se) { MessageBox.Show("error in :" + se.Message); } catch (Exception ex) { MessageBox.Show("Unknown error Find it.\n" + ex.Message); } finally { conn.Close(); } } private void btnReset_Click(object sender, EventArgs e) { textIPID.Clear(); textOPID.Clear(); textPatientName.Clear(); textAddress.Clear(); textDoctorID.Clear();

17

textDoctorSpeciality.Clear(); textProblem.Clear(); textMedicineHistory.Clear(); textPreviousDoctor.Clear(); textPreviousHospital.Clear(); } private void btnDelete_Click(object sender, EventArgs e) { conn.Open(); formDeleteConfirmation fdc = new formDeleteConfirmation(); DialogResult dr = fdc.ShowDialog(); if (dr == DialogResult.OK) { string deleterecord = textIPID.Text; string strdelete = "Delete from medicalanddrughistory where ipid = @ipid"; SqlCommand cmd = new SqlCommand(strdelete, conn); cmd.Parameters.Add(new SqlParameter("@ipid", deleterecord)); cmd.ExecuteNonQuery(); MessageBox.Show("Deleted"); SqlDataAdapter sda = new SqlDataAdapter("select * from medicalanddrughistory", conn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables[0].DefaultView; } conn.Close(); } } }

Diagnosis And Bills Form

18

The form's property set is given below:Property Name Form:Name Text BackColor ShowIcon Labels:Name Text Name Text Name Text Name Text Name Text Name Text Name Text Name Text Name Text Font (--For all labels--) Value formDiagnosisAndBills Diagnosis And Bills LightSteelBlue False labelIPID IPID labelOPID OPID labelDoctorID Doctor ID labelDoctorSpeciality Doctor Speciality labelPatientName Patient Name labelTreatmentDetaisl Treatment Details labelTreatmentCost Treatment Cost labelFinalCost Final Cost labelIPIDSearch Mention IPID here Times New Roman, 11.25pt, style=Bold

19

TextBox:Name Name Name Name Name Name Name Name Font (--For all textboxes--) ComboBox:Name GroupBox:Name Text Font DatGridView:Name Buttons:Name Text Font FontColor Name Text Font FontColor Name Text Font FontColor Name Text Font FontColor Name Text Font FontColor

textOPID textIPID textDoctorID textDoctorSpeciality textPatientName textTreatmentDetails textTreatmentCost textFinalCost Times New Roman, 9.75pt comboBoxIPIDSearch groupBoxSearch Search an record MicrosoftSansSerif,9.75pt dataGridView1 btnAdd Add Times New Roman, 14.25pt, style=Bold DarkCyan btnSave Save Times New Roman, 14.25pt, style=Bold Green btnReset Reset Times New Roman, 14.25pt, style=Bold ControlText btnDelete Delete! Times New Roman, 14.25pt, style=Bold 192, 0, 0 btnSearch Search Times New Roman, 14.25pt, style=Bold MidnightBlue

The code written for this form is below:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;

20

using System.Data.SqlClient; namespace Hospital_Management_Project { public partial class formDiagnosisAndBills : Form { SqlConnection conn; public formDiagnosisAndBills() { InitializeComponent(); conn = new SqlConnection("data Source=kol-11274-mrsrv;Initial catalog=HospitalManagementSystem;User Id=student;Password=sql_2005"); }

private void formDiagnosisAndBills_Load(object sender, EventArgs e) { conn.Open(); string qry = "Select * from diagnosisandbills"; DataSet ds = new DataSet(); SqlDataAdapter sdp = new SqlDataAdapter(qry, conn); sdp.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; comboBoxIPIDSearch.DataSource = ds.Tables[0]; comboBoxIPIDSearch.DisplayMember = "ipid"; conn.Close(); } private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { textOPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[0].Value); textIPID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[1].Value);

21

textDoctorID.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[2].Value); textDoctorSpeciality.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[3].Value); textPatientName.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[4].Value); textTreatmentDetails.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[5].Value); textTreatmentCost.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[6].Value); textFinalCost.Text = Convert.ToString(dataGridView1.CurrentRow.Cells[7].Value); } private void btnAdd_Click(object sender, EventArgs e) { conn.Open(); string strinsert = "Insert into diagnosisandbills(opid, ipid, doctorid, doctorspeciality, pname, treatmentdetails, treatmentcost, finalcost) values('"+ Convert.ToInt32(textOPID.Text)+"','"+ textIPID.Text + "', '" + textDoctorID.Text + "', '" + textDoctorSpeciality.Text + "', '" + textPatientName.Text + "', '" + textTreatmentDetails.Text + "', '" + Convert.ToInt32(textTreatmentCost.Text) + "','" + Convert.ToInt32(textFinalCost.Text) + "')"; SqlCommand cmd = new SqlCommand(strinsert, conn); SqlTransaction tran = null; try { //Sources of possible exception errors. tran = conn.BeginTransaction(); SqlCommand cmd1 = new SqlCommand(strinsert, conn, tran); cmd1.ExecuteNonQuery(); tran.Commit(); MessageBox.Show("Patient Information added Successfully.", "Info message"); } catch (SqlException se) {

22

//In case of Sql Exception. MessageBox.Show("Error", se.Message); tran.Rollback(); } catch (System.Exception sysex) { //In case of Other Exception. MessageBox.Show("Error in Transaction" + sysex.Message); } finally { SqlDataAdapter sda = new SqlDataAdapter("select * from diagnosisandbills", conn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; //Finally close the connection. conn.Close(); } } private void btnSave_Click(object sender, EventArgs e) { conn.Open(); // string savedetails = textIPID.Text; try { string strsave ="update diagnosisandbills set doctorid='"+textDoctorID.Text+"',doctorspeciality='"+textDoctorSpeciality. Text+"',pname='"+textPatientName.Text+"',treatmentdetails='"+textTreatment Details.Text+"',treatmentcost="+textTreatmentCost.Text+",finalcost="+textF inalCost.Text+" where ipid='"+textIPID.Text+"'"; SqlCommand cmd = new SqlCommand(strsave, conn); //cmd.Parameters.Add(new SqlParameter("@ipid", savedetails));

23

cmd.ExecuteNonQuery(); SqlDataAdapter sda = new SqlDataAdapter("select * from diagnosisandbills", conn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; } catch (FormatException fx) { MessageBox.Show(fx.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); } MessageBox.Show("Updation complete", "Update done.", MessageBoxButtons.OK, MessageBoxIcon.Information); }

private void btnReset_Click(object sender, EventArgs e) { textOPID.Clear(); textIPID.Clear(); textDoctorID.Clear(); textDoctorSpeciality.Clear(); textPatientName.Clear(); textTreatmentDetails.Clear(); textTreatmentCost.Clear();

24

textFinalCost.Clear(); } private void btnDelete_Click(object sender, EventArgs e) { //If chosen record is to be deleted, then confirmation throws up asking the user to confirm the deleteion. conn.Open(); formDeleteConfirmation fdc = new formDeleteConfirmation(); DialogResult dr = fdc.ShowDialog(); if (dr == DialogResult.OK) {

string deleterecord = textIPID.Text; string strdelete = "Delete from diagnosisandbills where ipid = @ipid"; SqlCommand cmd = new SqlCommand(strdelete, conn); cmd.Parameters.Add(new SqlParameter("@ipid", deleterecord)); cmd.ExecuteNonQuery(); MessageBox.Show("Deleted"); SqlDataAdapter sda = new SqlDataAdapter("select * from diagnosisandbills", conn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; } conn.Close(); } private void btnSearch_Click(object sender, EventArgs e) { conn.Open(); string query = "Select * from diagnosisandbills where ipid='" + comboBoxIPIDSearch.Text + "'";

25

SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader rdr = cmd.ExecuteReader(); DataTable dt = new DataTable(); dt.Load(rdr); dataGridView1.DataSource = dt.DefaultView; conn.Close(); }

} }

Create an Event or Circular

The form is shown above. The form's property set is given below:Property Name Form:Name Text ShowIcon BackColor Label:Name Text Value formCreateAnEventOrCircular Create an Event/Circular False Control labelName Name

26

Name Text Name Text Name Text Font (--Set for all labels--) TextBox:Name Name Name Name Font (--Set for all textboxes--) Buttons:Name Text Font FontColor Name Text Font FontColor

labelTitle Title labelSerialNumber Serial Number labelDescription Description Times New Roman, 9.75pt textName textTitle textSerialNumber textDescription Times New Roman, 9.75pt btnCreate Create Times New Roman, 14.25pt, style=Bold Green btnCancel Cancel Times New Roman, 14.25pt, style=Bold 192, 0, 0

The code written in this form is:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Xml; using System.Data.SqlClient; namespace Hospital_Management_Project { public partial class formCreateAnEventOrCircular : Form { public formCreateAnEventOrCircular() { InitializeComponent();

27

} private void btnCreate_Click(object sender, EventArgs e) { //Creates and XML file with the specified details. XmlWriterSettings set = new XmlWriterSettings(); set.Indent = true; set.IndentChars = " "; set.NewLineOnAttributes = true; using(XmlWriter write = XmlWriter.Create("D:\\Debi\\"+textName.Text+".xml", set)) { write.WriteStartElement(textName.Text);

write.WriteAttributeString(textTitle.Text,textSerialNumber.Text); write.WriteElementString("Details", textDescription.Text); //ConformanceLevel.Fragment = ConformanceLevel.Fragment;

write.WriteEndElement(); write.Flush(); } } } }

Delete Confirmation Form

The form's property set is given below:Property Name Form:Value

28

Name Text ShowIcon Font Label:Name Text Font FontColor Button:Name Text Font DialogResult Name Text Font DialogResult

formDeleteConfirmation Confirm Delete Record False Times New Roman, 8.25pt labelMessage Are you sure to delete the record? Press YES to confirm else press NO to keep the record. Times New Roman, 11.25pt ControlText button1 YES Times New Roman, 11.25pt, style=Bold, Underline OK button2 Cancel Times New Roman, 11.25pt, style=Bold, Underline Cancel

* There is no code written for this form as it acts only when there the delete confirm message box is to be shown to delete the particular record. Help Menu Opens the Help File associated with the form. The help file shall be accessed either using F1 shortcut key or by clicking Exit menu.

29

Back-End coding using SQL Server


The back-end of the system is taken care using SQL Server 2005. A database named HospitalManagementSystem is created and two tables are created Medicalanddrughistory and diagnosisandbills are created. Creating & Using the database
The commands are:/*Database creation*/ create database HospitalManagementSystem

To start using the database:use hospitalmanagementsystem

MedicineandDrugHistory table
The code to create the table is:-

30

create table MedicalAndDrugHistory ( OPID int constraint pkopid primary key identity(1,1) not null, IPID char(10), PName char(25), PAddress char(50), PProblem char(50), PMedicalHistory char(50), PrevDoctor char(25), PrevHospital char(25), DoctorSpeciality char(20), DoctorID char(10) );

The sample code to insert a record in the table:insert into medicalanddrughistory( IPID, PName, PAddress, PProblem, PMedicalHistory, PrevDoctor, PrevHospital, DoctorSpeciality, DoctorID) values('ip0001', 'Daniel Fleming', '24, Herbon Apts', 'Viral Infection', 'Normal', null, null, 'General', 'D0123');

DiagnosisandBills table
The code to create the table is:-31
create table DiagnosisAndBills ( OPID int constraint fkopid foreign key references medicalanddrughistory(opid), IPID char(10), DoctorID char(10), DoctorSpeciality char(20), pname char(25), TreatmentDetails char(100) not null, TreatmentCost int, FinalCost int );

The sample code to create a record in the table:insert into diagnosisandbills values(1, 'ip0001', 'do123', 'General', 'Daniel Fleming', 'Viral Infection', 20, 24);

31

32

Potrebbero piacerti anche