Professional Documents
Culture Documents
MEDICAL DIAGNOSIS1
MEDICAL DIAGNOSIS1
MEDICAL DIAGNOSIS1
1.0 INTRODUCTION
Medical care has increased its extent, direction and purpose. It is continually evolving in
response to perceive needs and demands. The management of health care delivery and services
involves considerable amount of medical records and managerial data, which have to be
collected, stored, selectively retrieved, updated and statistically analyzed. With the rapidity
growth of modern technology, especially computer technology in all fields of human endeavor,
i.e, professionals, scientist, education, industrial and even government activities, e.t.c.
necessitate the need for various sectors of the economy to be acquainted with at least basic
knowledge of computer application in their day to day operations. Therefore medical diagnosis
and therapy system involves the state of medical knowledge of a particular disease, patient
history, patient examination and drugs remedy. The standing orders which are disease
symptom, patient history, patient examination, diagnosis and therapy which is called the
hierarchical order gives basic health workers legal protection for providing primary health care.
They provide a systematic framework for history taking and physical examination of patient.
They facilitate a knowledge bank and timely recall of accurate information about specific
disease for the purpose of accurate diagnosis and therapy, also to provide standard procedures
With the recent development and proliferation of information technology, it is obvious that
computer is indispensable tool in every aspect of human activities. The use of computer
simplified the way businesses are done; it touches and helps our daily lives in a profound way.
1
Therefore, computer in medical diagnosis is guided by a sense of purpose rationally aimed at
outcome in terms of diagnostic and drugs prescription role of a doctor in the hospital than a
Computer technology is found in diagnosis and drug prescription ways, ranging from routine to
the highly sophisticated works. Just as the versatile computer serves various purposes in
business and industry, it performs many functions in the health care field. Medical researcher
stressed computer technology in several areas and have recorded some developments in areas
like medical statistics, diagnosis and drug prescription, data capitalization, simulation and
medical care and astronomic increase in patients‟ treatment in various hospitals made proper
view of the current method of medical service for a scientific and efficient approach in dealing
with patients problems more especially in case of emergency. This has been to some extent
since the introduction of computer to the field. To eradicate poor health maintenance, the
introduction of medical expert for diagnosis and drug prescription has other fundamental group.
This research has other details of medical expert system for diagnosis and drug prescription for
patients.
In the medical profession, the problems associated with doctors can be evidently seen as it
affects various areas of human and social endeavors. Therefore, this research found computer
as a means to develop and re-camp human life in our hospitals. Clearly stated, after a careful
study of the old medical service, the following are seen as some of the problems affecting the
hospital.
2
Detecting diseases at early stage can help to overcome and treat them appropriately. Identifying
the treatment accurately depends on the method that is used in diagnosing the diseases. Health
care facility should be accessible by all at all times. But some of the people that should access
these facilities are far removed from these facilities. More so, in the few available facilities,
qualified medical personnel are always key issues that need urgent redress.
In view of the foregoing, it would be of great necessity to provide a computerized system that
will provide a complementary medical service, such as medical disease diagnosis in places
where accessibility is a problem as well as health care facilities where qualified experts are
lacking, hence this topic, electronic medical diagnosis system on some medical illness and
disease.
Medical diagnosis, (often simply termed diagnosis) refers both to the process of attempting to
determine or identifying a possible disease or disorder to the opinion reached by this process. A
individual‟s health condition into separate and distinct categories that allow medical decisions
In the medical diagnostic system procedures, elucidation of the etiology of the disease or
conditions of interest, that is, what caused the disease or condition and its origin is not entirely
necessary. Such elucidation can be useful to optimize treatment, further specify the prognosis
Computer-based methods are increasingly used to improve the quality of medical services.
Artificial Intelligence (Al) is the area of computer science focusing on, creating expert
3
machines that can engage on behaviors that humans consider intelligent. The proposed system
DExS is for dealing with the problem of a disease diagnosis as an‟ expert system.
Clinical decision support systems (CDSS) are interactive computer programs designed to assist
scientists, dentists, pediatrists, nurse practitioners or physical assistants with decision making
skills. The clinician interacts with the software utilizing both the clinician‟s knowledge and the
software to make a better analysis of the patient‟s data than neither humans nor software could
Typically, the system makes suggestions for the clinician to look through and the he picks
To diagnose a disease, a physician is usually based on the clinical history and physical
examination of the patient, visual inspection of medical images, as well as the results of
laboratory tests. In some cases, confirmation of the diagnosis is particularly difficult because it
Resonance Imaging, Ultrasound, etc.) usually performed by radiologists, is often limited due to
the non-systematic search patterns of humans, the presence of structure noise (camouflaging
normal anatomical background) in the image, and the presentation of complex disease states
requiring the integration of vast amounts of image data and clinical information. Computer-
Aided Diagnosis (CAD), defined as a diagnosis made by a physician who uses the output from
disease severity, and making diagnostic decisions, is expected to enhance the diagnostic
4
capabilities of physicians and reduce the time required for accurate diagnosis. With CAD, the
In therapy, the selection of the optimal therapeutic scheme for a specific patient is a complex
procedure that requires sound judgement based on clinical expertise, and knowledge of patient
values and preferences, in addition to evidence from research. Usually, the procedure for the
selection of the therapeutic scheme is enhanced by the use of simple statistical tools applied to
empirical data. In general, decision making about therapy is typically based on recent and older
information about the patient and the disease, whereas information or prediction about the
potential evolution of the specific patient disease or response to therapy is not available. Recent
advances in hardware and software allow the development of modern Therapeutic Decision
Support (TDS) systems, which make use of advanced simulation techniques and available
patient data to optimize and individualize patient treatment, including diet, drug treatment, or
radiotherapy treatment.
In addition to this, CDS systems may be used to generate warning messages in unsafe
situations, provide information about abnormal values of laboratory tests, present complex
research results, and predict morbidity and mortality based on epidemiological data.
consuming process to wait for doctors in hospitals before getting medical attention. Some of the
time, diagnosis is wrongly done leading to error in drug prescription and further complications
in the patient‟s health. It has also been noticed that much time is spent in physical examination
5
1.3 AIM ND OBJECTIVES OF THE STUDY
The major aim of this work is to develop an expert system on diagnosis of some selected
1. To develop fast modern interactive diagnostic software that will aid clinicians in
2. To develop software that will eliminate wrong diagnosis and enable flexibility in access
prescription of medication.
3. To design a system that is fast and efficient in examining a patient based on simple
a. It will help to retain the skill of an expert medical doctor in case of any eventuality
c. It can be useful in many hospitals, both private and government, cases where the expert
is not on seat;
Information: A meaning full material derived from computer data by organizing it and
Information System: A set of interrelated components that collect (or retrieve), process,
organization.
Software: Software is set of related programs that are designed by the manufacturer to
control the hardware and to enable the computer perform a given task.
Hardware: Hardware is a physical part of a computer that can be touched, seen, feel
7
Programming: programming is a set of coded instruction which the computers
Technology: Technology is the branch of knowledge that deals with the creation and
use technical and their interrelation with life, society and the environment, drawing upon
Algorithm: A set of logic rules determined during the design phase of a data matching
application. The „blueprint‟ used to turn logic rules into computer instructions that detail
Application: The final combination of software and hardware which performs the data
matching.
recorded.
Patient History: This is the relevant data about the history of patient that have been
8
Patient Examination: This is when patient are examined physically and laboratory tests
9
CHAPTER TWO
LITERATURE REVIEW
2.0 Introduction
This chapter focuses on the review of related literature. A literature review includes the current
the state of the art with respect to Medical Diagnosis System. It surveys the literature in the
topic selected. In this project work the literature review includes the Expert Systems,
decision-making ability of a human expert. Expert systems are designed to solve complex
problems by reasoning about knowledge, represented primarily as if then rules rather than
through conventional procedural code” Expert systems (ES) are a branch of applied artificial
intelligence (Al), and were developed by the Al community in the mid-1960s. The basic idea
behind ES is simply that expertise, which is the vast body of task- specific knowledge, is
transferred from a human to a computer. This knowledge is then stored in the computer and
users call upon the computer for specific advice as needed, in this case for the diagnosis of
avian fever. The computer can make inferences and arrive at a specific conclusion. Then like a
human consultant, it gives advices and explains, if necessary, the logic behind the advice
(Turban & Aronson, 2) 01). ES provide powerful and flexible means for obtaining solutions to
a variety of problems that often cannot be dealt with by other, more traditional and orthodox
methods. Thus, their use is proliferating tomany sectors of our social and ethnological life,
10
where their applications are proving to be critical in the process of decision support and
problem solving.
and represents that information in the form of rules, such as IF_ THEN. The rule can then be
used to perform operations on data to inference in order to reach appropriate conclusion. These
inferences are essentially a computer program that provides a „methodology for reasoning
about information in the rule base or knowledge base, and for formulating conclusions.
The most common definition of KBS is human-centered. This highlights the fact that KBS have
their roots in the field of artificial intelligence (AT) and that they are attempts to understand
and initiate human knowledge in computer systems, Adetunmbi A.O, (2013). The four main
components of KBS are usually distinguished as: a knowledge base, an inference engine, a
knowledge engineering tool, and a specific user interface (Dhaliwal &Benbasat, 1996). On the
other hand, the term KBS includes all the organizational information technology applications
that may prove helpful to manage the knowledge assets of an organization, such as ESs, rule-
2013).
Some of these applications which are implemented by knowledge-based systems include the
following: medical treatment, personal finance planning, engineering failure analysis, waste
11
management, knowledge representation, power electronics design, framed buildings evaluation,
concept is „used to implement software simulations for the massively parallel processes that
receives inputs that are analogous to the electrochemical impulses that the dendrites of
biological neurons receive from other neurons. The output of the artificial neuron corresponds
to signals sent out from a biological neuron over its axon. These artificial signals can be
changed similarly to the physical changes occurring at neural synapses (Turban & Aronson,
2001).
Some of the applications that are implemented by neural networks are the following: fault
diagnosis, optimal power flow, decision making, alarm processing system, inference
mechanisms, diagnostic system, machine learning, power load forecasting, facility layout
design, process control, knowledge learning, gold mining process design, robotic systems,
parameter setting, waste treatment, engineering ceramics, mitigation processes control, acoustic
techniql4e, which uses the mathematical theory of fuzzy sets, simulates the process of normal
human reasoning by allowing the computer to behave less precisely and logically than
conventional computers. This approach is used because decision-making is not always a matter
12
of black and white, true or false; it often involves gray areas and the term may be. Accordingly,
Some applications implemented by fuzzy ESs are such as: power load forecasting, online
scheduling, chemical many different objects, but each will implement that message differently.
An object‟s data are encapsulated from other parts of the system, so each object is an
independent software building block that can be used in many different systems without
knowledge representation.
general idea of what the system will look like and how it is going to implement systems. The
architecture shows the general capabilities of the system, the users‟ interfaces, system
functions, system (data) flow, system management, DBMS, necessary protocol, and specific
programming language, such as blackboard architecture, Common KADS, etc. Once the system
architecture design and implementation are completed, users can manipulate and control system
architecture illustrate the following: material evaluation and selection, computer aided design,
13
concurrent engineering, military application, training simulator, liquid retaining structure
technology, and as such there are several definitions, database capabilities, and different
applications in autonomous programs. Several of the names used to describe lAs are include
software agents, wizards, and. multi-agent (Turban & Aronson, 2001). Some of the applications
implemented by lAs are such as: tutoring systems system analysis and design, electronic
air pollution control, building architecture design, agricultural decision support, industry
centralizing the data and minimizing redundant. Data (McFadden, Hoffer, & Prescott, 2000). A
DBMS is the software that permits an organization to centralize data, manage them efficiently,
and provide access to the stored data by application programs (Laudon & Laudon, 2002).
However, some large databases make knowledge discovery computationally expensive because
some domains or background knowledge, hidden in the database may guide and restrict the
search for important knowledge. Therefore, modern database methodologies need to process
large volumes, multiple hierarchies, and different data formats to discover in-depth expert
knowledge from large databases, such as, data mining and searching approach. Some
14
planning. geography planning, geographical information system, sedimentary rock
translation of a diseases specific knowledge in the standard symbolic form. In the first phase,
the medical background of diseases is recorded through the creation of personal interview with
doctors and patients. In the second phase, a set of rules is created where each rule contains in IF
part that has the symptoms and in THEN part that has the disease that should be realized. The
inference engine (forward reasoning) is a mechanism through which rules are selected to be
fired. It is based on a pattern matching algorithm whose main purpose is to associate the facts
(input data) with applicable rules from the rule base. Finally, the diseases are produced by the
inference engine, this expert system then define the symptoms for diseases.
DExS System can be used in consultation since it shows quickly the diagnosis and in addition,
it offers explanations of the obtained results, being very helpful to the professional. With the
expert system, the user can interact with a computer to solve a certain problem. This can occur
because the expert system can store heuristic knowledge. The proposed system performs many
functions, It will conclude the diagnosis based on answers of the user to specific question that
the system asks the user. The questions provide the system for explanation for the symptoms of
the patient that helps the expert system for diagnosis the disease by inference engine. It stores
the facts and the conclusion of the inference of the system, and the user, for each case, in
database. It processes the database in order to extract rules, which completes the knowledge
base.
15
2.4 Summary
An expert system (ES) known as knowledge based system, is a computer program that uses
knowledge and inference procedures to solve problems that are ordinarily solved through
human expertise. The main components of an ES are: (a) knowledge base, (b) inference engine,
(c) user interface. There are many applications of expert systems such as diagnosis, design,
planning, financial decision making etc. Most applications of expert systems in medicine
involve predicting, diagnosing and treating a particular disease. Now expert systems have many
other roles in clinical care such as disease prevention, therapy, rehabilitation of the patient after
therapy etc. In medicine, expert systems are used to train the medical students on various
medical tasks. In certain situations, where either the case is quite complex or there is no
medical experts readily available for patients medical expert systems are useful. From the very
beginning the main obstacle of using expert systems in medicine has been the accuracy of such
systems. The development of an expert system requires medical data of specialized doctor. This
data is collected in. two phases. Firstly, the creation of personal interview between doctor and
patient record the medical background of heart disease. Secondly, medical data is turned into
rules (IF_THEN). Rules for diagnosis contain in IF part the symptoms and in THEN part the
disease. Rules for treatment contain in IF part the disease and in THEN part the treatment. The
inference engine (forward reasoning) is the mechanism through which rules are selected to be
fired. It is based on a pattern matching algorithm whose main purpose is to associate the facts
16
CHAPTER THREE
METHODOLOGY AND SYSTEM DESIGN
3.0 Introduction
System analysis and design is an attempt towards understanding the existing system and
deploying a better system. This phase focuses on the detailed implementation of the system.
System design has two phases: logical design and physical design. During logical design phase,
the analyst describes inputs (sources), outputs (destinations), databases (data sources) and
procedures (data flows) all in a format that meets the uses requirements. The analyst also
specifies the user needs and .at a level that virtually determines the information flow into and
out of the system and the data resources. Hence, the logical design is done through data flow
3.1 Methodology
The methodology used in this research project is the waterfall model. The waterfall model is a
Waterfall model is the earliest SDLC (System Development Life Cycle) approach that was used
for software development. The waterfall Model illustrates the software development process in
a linear sequential flow; hence it is also referred to as a linear-sequential life cycle model. This
means that any phase in the development process begins, only if the previous phase is
completed.
17
Requirement
Analysis
System
Design
Implementation
Testing
Development
Maintenance
The research project passed through the following waterfall phases in order to achieve this
work.
document. It also includes the communication between the client and the developer
System Design: The requirement specifications from first phase are studied in this phase
and system design is prepared. System Design helps in specifying hardware and system
requirements and also helps in defining overall system architecture: The method of
Implementation: With inputs from system design, the system is first developed in small
programs called units, which are integrated in the next phase. Each unit is developed and
18
Integration and Testing: All the units developed in the implementation phase are
integrated into a system after testing of each unit. Post integration the entire system is
Deployment of system: Once the functional and non-functional testing is done, the
Maintenance: There are some issues which come up in the client environment. To fix
those issues patches are released. Also to enhance the product some better versions are
computerized and this has made the process of diagnosis and test to be very slow and tiresome.
During students and staff visit for medical attention, the time it takes, the normal diagnosis
system to finish testing before treatment is much and this has led of a lot of students and staff to
seek redress elsewhere . The manual system of diagnosis has another constraint of not
accessing information from the patients‟ database, hence there is a lot of strain on the person
managing the patients‟ record as no software is usually used in this context. This particular
project deals with the problems of clinical diagnosis and avoids the problems which occur
when carried, manually. Identification of the drawbacks of the existing system leads to the
designing of system that will be compatible to the existing system with the system which is
more users friendly. The efficiency of the system improve, thus overcome the drawbacks of the
existing system.
19
3.3 Analysis of the Proposed System
The proposed expert system assist user to diagnosis diseases, he/she might have, in a fuzzy
way. Based on the selection of the problem area/problem, the expert system gives some
symptom from which the user needs to select symptoms, based on the selection of symptoms
the user is asked some questions, according to the answer selection the fuzzy expert system
diagnosis diseases based on its knowledge, add catalyst factor (if any) and do ranking and gives
domain area is called an expert system. Basic characteristics of expert systems are:
Knowledge is encoded & maintained as an entity separate from the control program
information is needed.
Now if the characteristics of the proposed system are observed, it is seen that, it performs in a
narrow problem domain area (only diagnosis diseases) at a human expert level (like doctors). It
uses knowledge to make diagnosis decision; the knowledge is given by some expert doctors. It
can also explain how a particular decision made, that is why the proposed system is an expert
system. As it is using knowledge base in making decision, so it is also knowledge based expert
system.
20
3.4 Design of the Proposed System
In the design of the proposed system, “Expert System for diagnosis of some selected illness”,
there are three levels of the system. System level 1 is. an Adoptive Medical Diagnosis System;
system level 2 is a Medical Expert System and system level 3 is an update Adoptive Medical
Diagnosis System using Expert System. System level 1 describes general scenario thing about
the patient how he can get the prescription from the doctor. Generally in this level, patients
come to the hospitals with their diseases and AMDS system user interviews the patients
regarding their diseases and searches the prescription in database. If prescription was found in
the database then the user gives the prescription to the patient. If prescription is not found in the
database then the user goes to the incremental database into the second level of the system
which is the expert system. The important parts of this system are Interface, Knowledge base
Rules, facts, and Expert prescription, Patient. The inference engine is the program separation of
an Expert System. It shows a problem solving model which uses the rules in the knowledge
In this level the user offered incremental database and system see the questions that are
prepared according to the patients diseases. After given the feedback by the patient expert
system searches the possible disease description for the patients. System has a knowledge base
rule and matches then patient disease with knowledge rule rules and recommends the possible
prescription for patient disease. Good prescription gives to the patient and if the prescription is
not good then system goes the third level and the rule will be updated by the human expert.
The knowledge base can be used as the mind of the Expert System as all the necessary facts for
constructing the rules are contained in the knowledge base. This knowledge is used as a source
21
rules for the Expert System. The most important source for knowledge acquisition for the
Adoptive Medical Diagnosis System using Expert System was consultation with general
physician doctors, Internet medical website, medical books and research papers. The
knowledge based consisted of acquiring the symptoms of the diseases and possible treatments
of the diseases. The knowledge is represented in the form of rules. The basic form of the rule is
Rule: <name> IF condition 1, condition 2, condition 3...... condition n THEN act 1, act 2, act 3
act m. The, interface engine seeks to drive new information about a given situation using a
knowledge based expert system. There is also a choice for modifying and updating the expert
system with new knowledge - and new rules. When the new rules are written and implemented
the rules give solutions as a changed rule by human expert. The incremental database has all the
data regarding patient disease and prescription and also old data and updated data,
Age nvachar 50 No No No
nvachar
22
Blood nvachar 50 Yes No N
group
Marital nvachar 50 Yes No No
Status
23
CHAPTER FOUR
IMPLEMENTATION AND TESTING
4.0 Overview
This chapter talks about the implementation and testing of the medical diagnosis system, the
technologies and tools that were used when implementing the system, the problems and errors
encountered during the implementation, and how the problems were solved. This chapter also
The design of the new system promises to boost the operational level of the existing system by
proving easy means of clinical diagnosis for patients and medical practitioners. However, the
innumerable lapses and limitations that are inherent with the use of usual diagnosis, such as
transfer of virus, storage device failure and distance limitations have gotten their solution
All the major phases of software development, starting from input analysis to implementation
and documentation were used in developing this project. Also the basic characteristics of good
software were also implemented, like user friendliness, good documentation, keyboard access
keys, appropriateness, shortcut keys and effective colour combination to help user with colour
blindness.
24
Figure 4.1: PHP IDE
25
4.3 Software Testing
4.3.1 Doctor’s Login
26
4.3.3 Patient Registration
Figure 4.6:
27
4.3.5 Patient view
28
4.3.7 Diagnosis Interface
4.3.8 Diagnosis
29
4.3.9 Diagnosis Result Interface
30
CHAPTER FIVE
SUMMARY, CONCLUSION AND RECOMMENDATION
5.0 Summary
This chapter covers the evaluation of the project, the project conclusion and the project
recommendations. Firstly, it presents the objective assessment which is related with the aim of
the project and also the context of the project which give the general conclusion of the project.
This chapter also discusses the limitations of the project and the challenges encountered. Then,
some of the future enhancements are going to be made as the project got online and started to
be used. This chapter lastly contains the recommendations that are made.
Many developing countries are facing the shortage of medical experts in medical field. Due to
shortage of medical expert they are getting a huge queue of patients in hospitals. Especially in
rural areas we have young medical expert. This Medical Diagnosis System Using Expert
System can be substitute of the above, problem. This is very useful to diagnose patient diseases
and prescribe the good prescription to the patients as a human medical expert. From the above
study, it is concluded that this Medical Diagnosis System using Expert System can be applied
in Nuhu Bamalli Polytechnic Sickbay to improving medical services. Also this system can be
applied anytime, anyplace, any hospital to provides medical prescription for general diseases.
5.2 Conclusion
Different diagnosis strategies have been studied. Different e-health websites have been
browsed. Papers and articles on e-health management have been read and different diagnosis
tools have been used. Noted down important information like which information they are
collecting from the user! Patients and which approach they are following in diagnosis. Then
information (symptom, signs etc.) of different diseases have been collected for particular
31
category as sample. Made a comparative analysis to identify which symptoms are major
symptoms for particular diseases i.e. that symptom must be present, their acuity level etc. Then
met with few doctors with different level of expertise in their field, Asked them about those
diseases and their symptoms, which factors they consider while they diagnosis diseases, what
After studying and making a comparative analysis of what is gotten by consulting with
different doctors about which factors they consider while they diagnosis diseases, what
approach they follow, it is found that they are almost same. Then a uniform structure is made
and a mathematical equivalence is formed, which will be used to diagnosis by the expert
system. After that implementation of 1 he expert system is done and tested it thoroughly to
check whether the desired result is coming or not. After necessary corrections, when it seems
ok with respect to the desired goal, then consulted with the doctors again and explained about
the software implementation and showed it to them and they acknowledged it, gave some
suggestions to add catalyst factor which is some sort of personal information! Patient‟s history
5.3 Recommendation
Improving every project is necessary. Making provision for future enhancement has been
1. Nuhu Bamalli Sickbay should have more health experts on the project for consultation
regular user. This will make the project to have high reliability than before.
5. Future researchers are encouraged to look into the area of fuzzy logic in details, in
relation to expert system and also how it can boost the accuracy of the system.
33
REFERENCES
Adehor AB, Burell PR. An Intelligent Expert System for the Prompt Diagnosis of Malaria and
Typhoid Fever in the Malaria Belt of Africa. IFIP International Conference on Artificial
Intelligence in Theory and Practice. 2016; 276: 287-296.
Adetunmbi AO, Oguntimilehin A, Falaki SO (2013). “Web-Based Medical Assistant System
for Malaria Diagnosis
Alaba TO,Isaac OO,(2014),. Mobile-Based Fuzzy Expert System for Diagnosing Malaria
(MFES). I.J. Information Engineering and Electronic Business.; 2: 14-22.
Adewole KS, Hambali MA,Jimoh MK. Rule Based Expert System for Diseases Diagnosis.
Proceedings of the International Conference on Science, Technology, Education, Arts,
Management and Social Sciences. 2015.
Gath SJ, Kulkarni RV. A Review: Expert System for Diagnosis of Myocardial Infection.
International Journal of Computer Science and Information Technologies. 2012; 3(6):
5315-5321.
Gufran AA. An Adoptive Medical Diagnosis System Using Expert System with Applications.
Journal of Emerging Trends in Computing and Information Sciences. Mar. 2013; 4(3).
McFadden, Hoffer, & Prescott, (2000),: Principles and Programming. 4th Edition. Thomson
Publisher. .
34
SOURCE CODE
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required Meta Tags -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
35
<!-- Banner Area Starts -->
<section class="banner-area">
<div class="container">
<div class="row">
<div class="col-lg-8">
<h4>Caring for better life</h4>
<h1>
</div>
</div>
</div>
</section>
</body>
</html>
His_doc_account.php
<?php
session_start();
include('assets/inc/config.php');
include('assets/inc/checklogin.php');
check_login();
$doc_id = $_SESSION['doc_id'];
$doc_number = $_SESSION['doc_number'];
?>
<!DOCTYPE html>
<html lang="en">
<?php include('assets/inc/head.php');?>
<body>
<div class="row">
<div class="col-lg-6 col-xl-6">
<div class="card-box text-center">
<img src="../doc/assets/images/users/<?php echo $row->doc_dpic;?>" class="rounded-circle avatar-
lg img-thumbnail"
alt="profile-image">
37
</div>
while($row=$res->fetch_object())
{
$mysqlDateTime = $row->vit_daterec; //trim timestamp to date
?>
<tbody>
<tr>
<td><?php echo $row->vit_bodytemp;?>°C</td>
<td><?php echo $row->vit_heartpulse;?>BPM</td>
<td><?php echo $row->vit_resprate;?>bpm</td>
<td><?php echo $row->vit_bloodpress;?>mmHg</td>
<td><?php echo date("Y-m-d", strtotime($mysqlDateTime));?></td>
</tr>
</tbody>
<?php }?>
</table>
</div>
</div> <!-- end col-->
</div>
<!-- end row-->
</div>
<?php }?>
38
<!-- ============================================================== -->
<!-- End Page content -->
<!-- ============================================================== -->
</div>
<!-- END wrapper -->
</body>
</html>
His_doc_patient.php
<?php
session_start();
include('assets/inc/config.php');
include('assets/inc/checklogin.php');
check_login();
$doc_id = $_SESSION['doc_id'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include('assets/inc/head.php');?>
<style type="text/css">
/* Inline styles as requested */
#selectedOptions, #searchResults, #selectedOptions, #selectedItems, #searchButton, #diseaseResults {
margin: 20px;
}
#selectedItems {
list-style-type: none;
padding: 0;
}
#selectedItems li {
display: inline-block;
background-color: #f0f0f0;
padding: 5px 10px;
margin-right: 10px;
margin-bottom: 10px;
border-radius: 3px;
}
.remove-item {
cursor: pointer;
color: red;
margin-left: 5px;
}
</style>
39
</head>
<body>
<div id="wrapper">
<!-- Topbar Start -->
<?php include('assets/inc/nav.php');?>
<!-- End Topbar -->
<!-- Left Sidebar Start -->
<?php include("assets/inc/sidebar.php");?>
<!-- Left Sidebar End -->
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card-box">
<h4 class="header-title"></h4>
<div class="mb-2">
<div class="row">
<div class="col-12 text-sm-center form-inline" >
<div class="form-group mr-2" style="display:none">
<select id="demo-foo-filter-status" class="custom-select custom-select-sm">
<option value="">Show all</option>
<option value="Discharged">Discharged</option>
<option value="OutPatients">OutPatients</option>
<option value="InPatients">InPatients</option>
</select>
</div>
<div class="form-group">
<input id="demo-foo-search" type="text" placeholder="Search" class="form-control form-
control-sm" autocomplete="on">
</div>
</div>
</div>
</div>
<?php
if(isset($_GET['pat_number'])) {
$idDia = $mysqli->real_escape_string($_GET['pat_number']); // Sanitize input
40
$sql = "SELECT
sd.Patientdate,
p.pat_fname,
p.pat_lname,
p.pat_dob,
p.pat_number,
d.disease_name,
m.medication_name,
s.symptom_name,
COUNT(*) AS occurrence_count
FROM his_patients p
JOIN his_symptoms_diseases sd ON p.pat_number = sd.PatientID
JOIN his_diseases d ON sd.diseasesID = d.disease_id
JOIN his_disease_medications dm ON d.disease_id = dm.disease_id
JOIN his_medications m ON dm.medication_id = m.medication_id
JOIN his_disease_symptoms_map sm ON d.disease_id = sm.disease_id
JOIN his_symptoms s ON sm.symptom_id = s.symptom_id
WHERE p.pat_number = '$idDia'
GROUP BY p.pat_fname, p.pat_lname, p.pat_dob, p.pat_number, d.disease_name,
m.medication_name, s.symptom_name,sd.Patientdate"; // Grouping by all selected fields
$result = $mysqli->query($sql);
<div class="table-responsive">
<table id="demo-foo-filtering" class="table table-bordered toggle-circle mb-0" data-page-
size="7">
<thead>
<tr>
<th>#</th>
<th data-toggle="true">Patient Name</th>
<th data-hide="phone">Patient Number</th>
<th data-hide="phone">Patient Symptoms</th>
<th data-hide="phone">Patient Diseases</th>
<th data-hide="phone">Patient Medication</th>
<th data-hide="phone">Occurrences</th>
<th data-hide="phone">Date</th>
</tr>
</thead>
<tbody>
<?php
$cnt = 1; // Initialize a counter for row numbering
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
?>
<tr>
<td><?php echo $cnt;?></td>
<td><?php echo htmlspecialchars($row['pat_fname'] . ' ' . $row['pat_lname']); ?></td>
<td><?php echo htmlspecialchars($row['pat_number']); ?></td>
<td><?php echo htmlspecialchars($row['symptom_name']); ?></td>
<td><?php echo htmlspecialchars($row['disease_name']); ?></td>
<td><?php echo htmlspecialchars($row['medication_name']); ?></td>
41
<td><?php echo htmlspecialchars($row['occurrence_count']); ?></td>
<td><?php $row['Patientdate']; ?></td>
<td>
</td>
</tr>
<?php
$cnt++;
}
}
?>
</tbody>
<tfoot>
<tr class="active">
<td colspan="8">
<div class="text-right">
<ul class="pagination pagination-rounded justify-content-end footable-pagination
m-t-10 mb-0"></ul>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- End Table -->
<?php
}
} else {
?>
<div class="table-responsive">
<table id="demo-foo-filtering" class="table table-bordered toggle-circle mb-0" data-page-
size="7">
<thead>
<tr>
<th>#</th>
<th data-toggle="true">Patient Name</th>
<th data-hide="phone">Patient Number</th>
<th data-hide="phone">Patient Symptoms</th>
<th data-hide="phone">Patient Diseases</th>
<th data-hide="phone">Patient Medication</th>
<th data-hide="phone">Action</th>
</tr>
</thead>
<tbody>
<?php
$sql = "SELECT p.pat_id, p.pat_fname, p.pat_lname, p.pat_number, d.disease_name,
m.medication_name, s.symptom_name
FROM his_patients p
JOIN his_symptoms_diseases sd ON p.pat_number = sd.PatientID
JOIN his_diseases d ON sd.diseasesID = d.disease_id
JOIN his_disease_medications dm ON d.disease_id = dm.disease_id
JOIN his_medications m ON dm.medication_id = m.medication_id
JOIN his_disease_symptoms_map sm ON d.disease_id = sm.disease_id
JOIN his_symptoms s ON sm.symptom_id = s.symptom_id
42
ORDER BY p.pat_id, s.symptom_id, d.disease_id"; // Order by patient ID and then
symptoms and diseases
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
$current_patient_id = null;
$cnt = 1;
while ($row = $result->fetch_assoc()) {
if ($row['pat_id'] !== $current_patient_id) {
?>
<tr>
<td colspan="7"><strong><?php echo $row['pat_fname'] . ' ' . $row['pat_lname'] . ' - ' .
$row['pat_number'];?></strong></td>
</tr>
<?php
$current_patient_id = $row['pat_id']; // Update current patient ID
}
?>
<tr>
<td><?php echo $cnt;?></td>
<td><?php echo htmlspecialchars($row['pat_fname'] . ' ' . $row['pat_lname']); ?></td>
<td><?php echo htmlspecialchars($row['pat_number']); ?></td>
<td><?php echo htmlspecialchars($row['symptom_name']); ?></td>
<td><?php echo htmlspecialchars($row['disease_name']); ?></td>
<td><?php echo htmlspecialchars($row['medication_name']); ?></td>
<td>
<!-- Adjust the action links/buttons as needed -->
</td>
</tr>
<?php
$cnt++;
}
}
?>
</tbody>
<tfoot>
<tr class="active">
<td colspan="7">
<div class="text-right">
<ul class="pagination pagination-rounded justify-content-end footable-pagination m-t-
10 mb-0"></ul>
</div>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- End Table -->
<?php
}
?>
</div>
</div>
</div>
43
</div>
<!-- end container-fluid -->
</div>
<!-- end content -->
</div>
<!-- END wrapper -->
</body>
</html>
<?php
$result->free(); // Free the result set
$mysqli->close(); // Close database connection
?>
His_doc_patient.php
<?php
session_start();
include('assets/inc/config.php');
include('assets/inc/checklogin.php');
check_login();
$doc_id = $_SESSION['doc_id'];
?>
<!DOCTYPE html>
<html lang="en">
<?php include('assets/inc/head.php');?>
<body>
44
<!-- Begin page -->
<div id="wrapper">
<div class="content-page">
<div class="content">
<div class="row">
<div class="col-12">
<div class="card-box">
<h4 class="header-title"></h4>
<div class="mb-2">
<div class="row">
<div class="col-12 text-sm-center form-inline" >
<div class="form-group mr-2" style="display:none">
<select id="demo-foo-filter-status" class="custom-select custom-select-sm">
<option value="">Show all</option>
<option value="Discharged">Discharged</option>
<option value="OutPatients">OutPatients</option>
<option value="InPatients">InPatients</option>
</select>
</div>
<div class="form-group">
<input id="demo-foo-search" type="text" placeholder="Search" class="form-control form-
control-sm" autocomplete="on">
</div>
</div>
</div>
45
</div>
<div class="table-responsive">
<table id="demo-foo-filtering" class="table table-bordered toggle-circle mb-0" data-page-
size="7">
<thead>
<tr>
<th>#</th>
<th data-toggle="true">Patient Name</th>
<th data-hide="phone">Patient Number</th>
<th data-hide="phone">Patient Ailment</th>
<th data-hide="phone">Date Lab Test Conducted</th>
<th data-hide="phone">Action</th>
</tr>
</thead>
<?php
/*
*get details of allpatients
*
*/
$ret="SELECT * FROM his_laboratory ORDER BY RAND() ";
//sql code to get to ten docs randomly
$stmt= $mysqli->prepare($ret) ;
$stmt->execute() ;//ok
$res=$stmt->get_result();
$cnt=1;
while($row=$res->fetch_object())
{
$mysqlDateTime = $row->lab_date_rec;
?>
<tbody>
<tr>
<td><?php echo $cnt;?></td>
<td><?php echo $row->lab_pat_name;?></td>
<td><?php echo $row->lab_pat_number;?></td>
<td><?php echo $row->lab_pat_ailment;?></td>
<td><?php echo date("d/m/Y", strtotime($mysqlDateTime));?></td>
<td><a href="his_doc_add_single_lab_result.php?lab_number=<?php echo $row-
>lab_number ;?>" class="badge badge-success"><i class="mdi mdi-flask"></i> Add Lab Result</a></td>
</tr>
</tbody>
<?php $cnt = $cnt +1 ; }?>
<tfoot>
<tr class="active">
<td colspan="8">
<div class="text-right">
<ul class="pagination pagination-rounded justify-content-end footable-pagination m-t-10
mb-0"></ul>
</div>
</td>
</tr>
</tfoot>
</table>
</div> <!-- end .table-responsive-->
</div> <!-- end card-box -->
</div> <!-- end col -->
</div>
<!-- end row -->
46
</div> <!-- container -->
</div>
</div>
<!-- END wrapper -->
</body>
</html>
His_doc_registration.php
<?php
session_start();
include('assets/inc/config.php');
if(isset($_POST['add_patient']))
{
$pat_fname=$_POST['pat_fname'];
$pat_lname=$_POST['pat_lname'];
$pat_number=$_POST['pat_number'];
$pat_phone=$_POST['pat_phone'];
$pat_type=$_POST['pat_type'];
$pat_addr=$_POST['pat_addr'];
$pat_age = $_POST['pat_age'];
$pat_dob = $_POST['pat_dob'];
$pat_ailment = $_POST['pat_ailment'];
//sql to insert captured values
$query="insert into his_patients (pat_fname, pat_ailment, pat_lname, pat_age, pat_dob,
pat_number, pat_phone, pat_type, pat_addr) values(?,?,?,?,?,?,?,?,?)";
$stmt = $mysqli->prepare($query);
$rc=$stmt->bind_param('sssssssss', $pat_fname, $pat_ailment, $pat_lname, $pat_age, $pat_dob,
$pat_number, $pat_phone, $pat_type, $pat_addr);
47
$stmt->execute();
/*
*Use Sweet Alerts Instead Of This Fucked Up Javascript Alerts
*echo"<script>alert('Successfully Created Account Proceed To Log In ');</script>";
*/
//declare a varible which will be passed to alert function
if($stmt)
{
$success = "Patient Details Added";
}
else {
$err = "Please Try Again Or Try Later";
}
}
?>
<!--End Server Side-->
<!--End Patient Registration-->
<!DOCTYPE html>
<html lang="en">
<!--Head-->
<?php include('assets/inc/head.php');?>
<body>
<div class="content-page">
<div class="content">
<div class="form-row">
<div class="form-group col-md-6">
<label for="inputEmail4" class="col-form-label">Date Of Birth</label>
<input type="text" required="required" name="pat_dob" class="form-control"
id="inputEmail4" placeholder="DD/MM/YYYY">
</div>
<div class="form-group col-md-6">
<label for="inputPassword4" class="col-form-label">Age</label>
<input required="required" type="text" name="pat_age" class="form-control"
id="inputPassword4" placeholder="Patient`s Age">
</div>
</div>
<div class="form-group">
<label for="inputAddress" class="col-form-label">Address</label>
<input required="required" type="text" class="form-control" name="pat_addr"
id="inputAddress" placeholder="Patient's Addresss">
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="inputCity" class="col-form-label">Mobile Number</label>
<input required="required" type="text" name="pat_phone" class="form-control"
id="inputCity">
</div>
<div class="form-group col-md-4">
<label for="inputCity" class="col-form-label">Patient Ailment</label>
<input required="required" type="text" name="pat_ailment" class="form-control"
id="inputCity">
</div>
<div class="form-group col-md-4">
<label for="inputState" class="col-form-label">Patient's Type</label>
<select id="inputState" required="required" name="pat_type" class="form-control">
<option>Choose</option>
49
<option>InPatient</option>
<option>OutPatient</option>
</select>
</div>
<div class="form-group col-md-2" style="display:none">
<?php
$length = 5;
$patient_number =
substr(str_shuffle('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'),1,$length);
?>
<label for="inputZip" class="col-form-label">Patient Number</label>
<input type="text" name="pat_number" value="<?php echo $patient_number;?>"
class="form-control" id="inputZip">
</div>
</div>
</form>
<!--End Patient Form-->
</div> <!-- end card-body -->
</div> <!-- end card-->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
</div>
<!-- END wrapper -->
50