Download Hospital Management System PHP Source code


The assignment is to design and develop hospital management system. Below is the description of how the system works:

  1.  Patient attends the hospital and meets the Receptionist at the front counter.
  2.  The Receptionist asks about the patient’s details e.g. Name, what doctor they want to see etc. and assigns the patient to the relevant doctor as he/she sends the patient’s information to that doctor.
  3.  When the patient visits the doctor, the doctor asks about what he/she is suffering from. The doctor may assign the patient to the lab to undergo various tests / scans or he may prescribe medicine and assign the patient to the pharmacist.
  4.  The laboratory department will receive the patient’s information from the doctor and perform certain scans / tests as indicated by the doctor and will send the results back to the doctor.
  5.  The doctor will prescribe the medicine and send the prescription to the pharmacist.
  6.  The Pharmacist shall give the patient medicine and then will calculate the total cost of the medicine and send the report to the bursar.
  7.   The Bursar shall demand payment for the purchased medicine.

§ 


Note: The users can update/change their information e.g username / password once they log into the system.
https://app.box.com/s/p6x4gw2e659ul1fxx0kcgtwtd0pyzqej



USER INTERFACE


The requirement of this assignment is to create a user interface which cooperates with the database to access the Hospital Management System.

For user interface, we have used MySQL, PHP, and HTML

Logging in:


This is an interface for Administrator to Log in to the system. The administrator is responsible to for creating other users of the hospital from different departments including doctors, receptionist, pharmacist, laboratorist, bursar.

The following php code was used for log in:

<?php
$con = mysql_connect('localhost', 'root','');
if (empty($con)) {
    echo mysql_error();
 }
 $data = mysql_select_db("Hospital");
 if (empty($data)) {
    echo mysql_error();
 }
?>

The above code performs the following functions, whereby the user enters the username and password and upon clicking the login button it takes the user to the index page provided the credentials are correct.
Hospital Login Page
Login Page


ADMINISTRATOR FUNCTIONS

Staff account management:

The administrator is responsible for adding users, adding rooms and updating. The users refered here are Receptionist, Doctors, Pharmacists, lab etc. Below is the Php script to add users to the database whereby I have used the function to describe the parameters to add the users.

Script to Add user to the system.


function adduser()
{
    $username = trim(htmlspecialchars($_POST['username']));
    $fname = trim(htmlspecialchars($_POST['fname']));
    $sname = trim(htmlspecialchars($_POST['sname']));
    $type = trim(htmlspecialchars($_POST['type']));
    $password = trim(htmlspecialchars($_POST['password']));
    $pass = sha1($password);

    $sql1 = "SELECT * FROM `users` WHERE `username`='$username'";
    $query1 = mysql_query($sql1);
    if (mysql_num_rows($query1)==0) {
        $sql = "INSERT INTO `users` VALUES ('$username','$pass','$fname','$sname','$type')";
        $query = mysql_query($sql);
        if (!empty($query)) {
            echo "<br><b style='color:#008080;font-size:14px;font-family:Arial;'>User is Succesifully Added</b>";
        }
    }
    else{
        echo "<br><b style='color:#008080;font-size:14px;font-family:Arial;'>Choose Unique Name</b>";
    }
Add Users
Add Users



The total number of users is displayed on the Admin dashboard

Statistics
Home Page - Statistics


The next step which is most important is because the system comes into function now:


RECEPTIONIST FUNCTIONS


The receptionist logs into the system from the username and password created by the Admin:
Below is the receptionist dashboard and the functions that he / she can perform:
Receptionist Page
Receptionist Homepage

Below is the form the receptionist uses to add patient’s details and underneath the php code:
Add Patient
Add Patient Page
 function addpatient()
{
    $fname = trim(htmlspecialchars($_POST['fname']));
    $sname = trim(htmlspecialchars($_POST['sname']));
    $email = trim(htmlspecialchars($_POST['email']));
    $phone = trim(htmlspecialchars($_POST['phone']));
    $address = trim(htmlspecialchars($_POST['address']));
    $gender = trim(htmlspecialchars($_POST['gender']));
    $birthyear = trim(htmlspecialchars($_POST['birthyear']));
    $bloodgroup = trim(htmlspecialchars($_POST['bloodgroup']));

    require_once "connect.php";

    $sql = "INSERT INTO `patient` VALUES ('','$fname','$sname','$email','$address','$phone','$gender','$bloodgroup','$birthyear')";
    $query = mysql_query($sql);
    if (!empty($query)) {
        echo "<br><b style='color:#008080;font-size:14px;font-family:Arial;'>Patient is Succesifully Added</b><br><br>";
    }
    else{
        echo mysql_error();
    }}

The receptionist can update his / her information after logging in for the first time:
Update Receptionist
Update Receptionist


DOCTOR FUNCTIONS


The patient has now been assigned to the doctor and the doctor has received the patient details.


Below is the php script which takes input from the form that the doctor uses to add symptoms from the patient and and then sends the result to the lab for the patient to undergo scans and tests:
function addsymptoms()
{
    $symptoms = trim(htmlspecialchars($_POST['symptoms']));
    $test = trim(htmlspecialchars($_POST['test']));
    if (!empty($symptoms)) {
        $id = $_GET['id'];
        @require_once "connect.php";

        $sql = "UPDATE `medication` SET `status`='laboratory',`symptoms`='$symptoms',`tests`='$test' WHERE `id`='$id'";
        $query = mysql_query($sql);
        if (!empty($query)) {
            echo "<br><b style='color:#008080;font-size:14px;font-family:Arial;'>Succesifully Sent</b>";
        }
    }
}

 

LAB FUNCTIONS

The lab department received the request from the doctor to perform tests on the patient and sends back the results to the doctor.




Below is the php script which takes input from the form that the lab department fills after performing tests on the patient and sends back the results to the doctor.
function addresult()
{
            $results = trim(htmlspecialchars($_POST['results']));
            $price = trim(htmlspecialchars($_POST['price']));
            if (!empty($results)) {
                $id = $_GET['id'];
                @require_once "connect.php";

                $sql = "UPDATE `medication` SET `status`='labdoctor',`test_results`='$results',`test_price`='$price' WHERE `id`='$id'";
                $query = mysql_query($sql);
                if (!empty($query)) {
                    echo "<br><b style='color:#008080;font-size:14px;font-family:Arial;'>Succesifully Sent</b><br><br>";
                }    }



Below is what the doctor gets from the Lab and prescribes the medicine to the patient and send the information to the pharmacy.




 



Below is the php script for the above task whereby the function takes input from the form and performs the task of sending the results to the pharmacist

function addmedicine()
{
    $medicine = trim(htmlspecialchars($_POST['medicine']));
    if (!empty($medicine)) {
        $id = $_GET['id'];
        @require_once "connect.php";

        $sql = "UPDATE `medication` SET `status`='pharmacy',`medical`='$medicine' WHERE `id`='$id'";
        $query = mysql_query($sql);
        if (!empty($query)) {
            echo "<br><b style='color:#008080;font-size:14px;font-family:Arial;'>Succesifully Sent</b>";
        }
        else{
            echo mysql_error();
        }
    }
    else{
        echo mysql_error();
    }
}



PHARMACY FUCTIONS


The pharmacist gets the prescription from the doctor and enters the price of the medicine then gives the patient the indicated medicine. The Pharmacist can also Add medicine stock, edit the medicine details, add/ edit prices, search  as indicated below:

Pharmatist
Pharmatist

Below is the php script that performs that function above.

  function addmedicine()
{
            $price = trim(htmlspecialchars($_POST['price']));
            if (!empty($price)) {
                $id = $_GET['id'];
                @require_once "connect.php";

                $sql = "UPDATE `medication` SET `status`='finish',`medical_price`='$price'  WHERE `id`='$id'";
                $query = mysql_query($sql);
                if (!empty($query)) {
                    echo "<br><b style='color:#008080;font-size:14px;font-family:Arial;'>Finished!</b><br><br>";
                }
            }
}
Medicine System

BURSAR FUNCTIONS


The bursar is able to view the financial reports of different patient’s informations and is also able to filter the results
<?php
            require_once "../includes/connect.php";
            $day = date('d');
            $month = date('m');
            $year = date('Y');
               
                $sql = "SELECT sum(doctor_price) AS aa FROM `medication` WHERE `date`='$day' AND `month`='$month' AND `year`='$year'";
                $result = mysql_query($sql);
                while ($row = mysql_fetch_array($result)) {
                    $sql1 = mysql_query("SELECT sum(test_price) AS bb FROM `medication` WHERE `date`='$day' AND `month`='$month' AND `year`='$year'");
                    while ($row1 = mysql_fetch_array($sql1)) {
                        $sql2 =mysql_query("SELECT sum(medical_price) AS cc FROM `medication` WHERE `date`='$day' AND `month`='$month' AND `year`='$year'");
                        while ($row2 = mysql_fetch_assoc($sql2)) {
                            $all = $row['aa'] + $row1['bb'] + $row2['cc'];
                            echo number_format($all);
                        }
                   
                    }

                   
                }
            ?> Tsh</p>
            <p><b>This Month:</b><?php
            require_once "../includes/connect.php";
            $day = date('d');
            $month = date('m');
            $year = date('Y');
               
                $sql = "SELECT sum(doctor_price) AS aa FROM `medication` WHERE `month`='$month' AND `year`='$year'";
                $result = mysql_query($sql);
                while ($row = mysql_fetch_array($result)) {
                    $sql1 = mysql_query("SELECT sum(test_price) AS bb FROM `medication` WHERE `month`='$month' AND `year`='$year'");
                    while ($row1 = mysql_fetch_array($sql1)) {
                        $sql2 =mysql_query("SELECT sum(medical_price) AS cc FROM `medication` WHERE `month`='$month' AND `year`='$year'");
                        while ($row2 = mysql_fetch_assoc($sql2)) {
                            $all = $row['aa'] + $row1['bb'] + $row2['cc'];
                            echo number_format($all);
                        }
                   
                    }

                   
                }
            ?>
</p>
            <p><b>This Year:</b><?php
            require_once "../includes/connect.php";
            $day = date('d');
            $month = date('m');
            $year = date('Y');
               
                $sql = "SELECT sum(doctor_price) AS aa FROM `medication` WHERE  `year`='$year'";
                $result = mysql_query($sql);
                while ($row = mysql_fetch_array($result)) {
                    $sql1 = mysql_query("SELECT sum(test_price) AS bb FROM `medication` WHERE `year`='$year'");
                    while ($row1 = mysql_fetch_array($sql1)) {
                        $sql2 =mysql_query("SELECT sum(medical_price) AS cc FROM `medication` WHERE `year`='$year'");
                        while ($row2 = mysql_fetch_assoc($sql2)) {
                            $all = $row['aa'] + $row1['bb'] + $row2['cc'];
                            echo number_format($all);
                        }
                   
                    }

                   
                }
            ?> Tsh</p>
The Bursar can also filter the reports and get a customized view
 


<?php
                $sql = "SELECT * FROM `medication` WHERE `date`='$day' AND `month`='$month' AND `year`='$year' ORDER BY `patient_id` DESC";
                    $result = mysql_query($sql);
                    if (mysql_num_rows($result)> 0) {
                        while ($row = mysql_fetch_array($result)) {
                            echo "
                            <tr>
                                <td>".$row['patient_id']."</td>
                                <td>".$row['doctor_type']."</td>
                                <td>".$row['doctor_price']."</td>
                                <td>".$row['test_price']."</td>
                                <td>".$row['medical_price']."</td>
                            </tr>
                            ";
                    }
                }
                else{
                    echo "<br><b>No data Available</b>";
                }
    ?>



23 comments

Unfortunately, viewing the files with the extension .zip is not supported.

Download the file then extract in your web server

i can't download this..plz send me at
rehman88@outlook.com

download link is not work properly plz provide me download link on my mail
jaykarrishi@gmail.com

i am not getting download link properly so please provide me download link
mail-id:jaykarrishi@gmail.com

download link not working my mail id is saikatcdac@gmail.com

download link not working my mail id is
zakaria.bouzandil@gmail.com

Please send me download link arebfaraz@gmail.com

http://www.mediafire.com/download/b5fi68ryef40drq/hospital%281%29%281%29.zip

http://www.mediafire.com/download/b5fi68ryef40drq/hospital%281%29%281%29.zip

http://www.mediafire.com/download/b5fi68ryef40drq/hospital%281%29%281%29.zip

What is the username and password to access it?

What is the username and password?

please send php files to kene.nwabuoku@gmail.com. thanks fam

Please send the username and password to ndubuisijoel3@gmail.com

Please the database is not connecting. Send the download link to ndubuisijoel3@gmail.com.Thanks

please send php files to prabhakaran.vertex@gmail.com

Bother in which license , it is published GNU GPL LICENSE OR MIT LICENSE OR APACHE LICENSE etc

Write Comment...
EmoticonEmoticon