499B Final Journal
499B Final Journal
Faculty Advisor:
Dr. Mohammad Monirujjaman Khan
Associate Professor
ECE Department
Fall’ 2019
2
DECLARATION
This is to certify that this project is our original work. No part of this work has been submitted
elsewhere partially or fully for the award of any other degree or diploma. Any material
reproduced in this project has been properly acknowledged.
___________________
___________________
___________________
3
APPROVAL
We, Sayed Mudasshir Hossain (ID- 1610046042), Fahim Ahmed Shakil (ID-1610736042),
Mustafaa Zenhar Jalal (ID-1521428642), members of CSE: 499 (Senior Design) from the
Electrical and Computer Engineering department of North South University; have worked on the
project titled “Development of Web And Mobile Based Online Healthcare System” under the
supervision of Mohammad Monirujjaman Khan as a partial fulfillment of the requirement for
the degree of Bachelor of Science in Engineering and has been accepted as satisfactory.
Supervisor’s Signature
Dr. K. M. A. Salam
Professor & Chair
Department of Electrical and Computer Engineering
North South University
Dhaka, Bangladesh.
4
ACKNOWLEDGEMENT
By the mercy of the Almighty we have completed our senior design capstone project entitled
“Development of Web and Mobile Based Online Healthcare System”.
We are deeply grateful to our advisor Dr. Mohammad Monirujjaman Khan, Associate
Professor, Department of Electrical and Computer Engineering, North South University for his
endless support, inspiration, encouragement and constructive criticism throughout this work. His
guidance helped us in the time of research, writing and completion of this project.
Our sincere thanks also go to North South University, Dhaka, Bangladesh for providing an
opportunity in our curriculum which enabled us to have an industrial level experience as part of
our academics.
Last but not the least, we would like to thank our family members and our friends for constantly
motivating us which helped us to stay focused.
5
Abstract
Health care system is one of the fundamental parts of society. In this project, we have developed
web and smartphone applications for the people of Bangladesh where both patients and doctors
can register and patients can have medical treatment via video calling. Using the developed web
and smartphone applications, patients can register via their phone number, store information
concerning their health, search available doctors, send text messages or make video calls to the
available doctors, set alarm to take medicine on time and complete payment online. Doctors can
also register to the system where the verification to ensure the authenticity of the information
provided by the doctor is handled manually. Doctors can view a patient’s medical history
whenever a patient makes contact through text or video call and provide treatment accordingly.
The system has been deployed and verified. The applications provide a faster and enhanced way
to get treatment and will ensure the availability of treatments in remote areas. The system will
help to spread health care services nationwide and provide doctors with the opportunity to help
in improving the health conditions of the citizens of Bangladesh.
Keywords- Online health care, Remote medical treatment, Doctor, NodeJS, Android, Twilio,
Firebase.
6
DECLARATION 2
APPROVAL 3
ACKNOWLEDGEMENT 4
Abstract 5
1 Introduction 9
1.1 Problems 9
1.2 Existing Solutions 12
1.3 Literature Review 14
1.3.1 History of Telemedicine in Bangladesh 16
1.3.2 Influencing Factors 18
1.4 Our Solution And Objectives 20
1.4.1 Our Solution 20
1.4.2 Objectives 21
2 Methodology 24
2.1 Workflow 24
2.2 Implementation And Usage 25
2.2.1 Usage For The Doctor 25
2.2.2 Usage For The Patient 26
2.3 Used Technologies 27
2.3.1 Technologies Used In The Web Application 27
2.3.1.1 ReactJS 27
2.3.1.2 Twilio 28
2.3.1.3 Socket.IO 28
2.3.1.4 MongoDB 28
2.3.1.5 MongoDB Atlas 28
2.3.1.6 Node.js 28
2.3.2 Technologies Used In The Android Application 29
2.3.2.1 Android Operating System 29
2.3.2.2 Java 30
2.3.2.3 Firebase Realtime Database 30
2.3.2.4 Sinch 30
2.4 Cost 30
2.5 Targeted Population 30
2.6 Innovation Of Our System 31
7
3 Android Application 33
3.1 Registration 33
Cloud Synced Alarm 34
3.3 Profiles 36
3.4 Doctor And Patient Communication 37
3.5 Video Call 39
4 Web Application 42
4.1 Registration 42
4.2 List Of Doctors 43
4.3 Review 44
4.4 Payment System 45
4.5 Video Call 46
4.6 Online Chatting 47
4.7 User Dashboard 48
5 Market Analysis 51
5.1 Unit Cost 51
5.2 Users 51
5.3 Demography 51
5.4 Existing Solutions vs Our Solution 56
5.5 Impact Factor 57
6 Conclusion 60
6.1 Future works 60
6.1.1 Our Shortcomings 60
6.1.2 Future Plans 61
7 References 62
8 Appendix 64
8
Chapter 1
Introduction
9
1 Introduction
Healthcare is of basic commodities. By natural process, we fall ill of one way or another so we
need medical attention almost like we need food or other basic commodities. With that in mind,
we wanted to make this very essential commodity easily accessible by the help of modern
technologies. Luckily we did not have to look further and found out that there is no platform
available with easy accessibility all over the country. So proceed to build a platform that will
help both doctor and patient by making their interaction much easier. So we decided to build a
Web application and an Android application where doctors and patients can interact and
exchange information easily with minimum effort. This will only require a standard internet
connection and a device to use the applications with. So we build the remote healthcare system
which is a cross-platform solution for remote healthcare services. Smart Telemedicine will let
people get medical treatment from doctors remotely via video calling and online chatting service
which will be provided as both web and smartphone applications.
Currently, to get treatment, people need to visit doctors. But there are many cases where the
disease is not severe and can be treated remotely. But there are very few platforms in our country
through which a person can get medical treatment remotely.
1.1 Problems
In Bangladesh, not all of the population live in urban areas. In fact, most of the people live in
remote village areas where the basic necessity of medicine is a luxury to them. The distribution
of doctors and medical facilities are very poor in our country. Figure 1 illustrates the reality of it.
It is clear from this figure that the distribution is not even close to being enough. Which is very
sad and also surprising considering that we are living in the 21st century. Also, one thing is clear
that not every place has the same density as the medical facilities. For example, Dhaka as being
the capital of our country enjoys the most density of the medical facilities also urban areas have
more doctors that in rural areas. For some reason, doctors and nurses are deciding to come to
urban areas. Which left the rural areas susceptible to ill healthcare services through these areas
10
needed more attention regarding this yet the reality is unfortunate. This is the core problem we
started working with. Also, there are other problems like affordability and availability, which are
the same for both rural and urban areas; meaning that most of the time the proper medical
attention is too costly to reach for and along with that not available when it is needed most.
There are many problems people faces to get treatment from doctors. First of all, the number of
specialized doctors available in our country is relatively low compared to the population.
Sometimes it takes up to 2-3 months to get an appointment to a specialized doctor. Therefore, it
prevents from getting proper treatment at the right time. Moreover, in the big cities of
Bangladesh such as Dhaka or Chittagong, life activities are greatly affected by the colossal
traffic jam. As a result, it also affects people adversely from getting proper treatment. Next, most
of the renowned doctors of the country carry out their profession in the capital city of
Bangladesh - Dhaka. Therefore, it is troublesome to get proper treatment for people who live
outside the city. To get proper medical treatment, people living outside of Dhaka and especially
people living in rural areas have to travel to Dhaka. It is bothersome to travel such a long
11
distance to get treatment which might have been possible to do remotely. Next, after getting the
diagnostic reports prescribed by the doctor, patients need to visit the doctor again to show the
reports. These multiple visits cause rather inconvenience to the patient and might have been
avoided by having a medium through which a patient could have submitted the reports for the
doctor to see. Furthermore, in Bangladesh, there are almost no qualified doctors in village areas
and so to meet just an MBBS qualified doctor, villagers have to travel to Upazilla.
Therefore, many villagers fall into early demise because of not being able to get proper medical
treatment.
As discussed above, there are many problems people face while trying to get medical treatment
from doctors. Even though these problems remain, there are some existing solutions that people
use to get on with them.
As it is difficult to get an appointment with a specialist doctor, people go to local doctors for
treatment. Again, as there is a massive traffic jam problem in the country and it is difficult for a
patient to spend hours on the road; people usually buy medicines from local pharmacies as a
treatment measure which is often prescribed by the pharmacist without consulting a doctor.
More to the point, people living in remote areas do the same that is they rather buy medicines
from their local pharmacies instead of visiting a doctor which results in improper treatment and
some cases to death.
According to the “World Health Organization (WHO)”, there are an estimated 3.05 physicians
per 10,000 population in Bangladesh[1]. Also, most health workers are concentrated in urban,
secondary and tertiary hospitals although 70% of the population lives in rural areas (Country
Case study (GHWA, 2008)[2].
Another study says, there is only 51,993 registered physician in the country with valid BMDC
number[3]. Which is quite low compared to the expanding population of the country.
Reliable and up-to-date health-related information is essential for developing an efficient health
system. Thus WHO has emphasized on it as one of the building blocks of any health system
12
The availability of a trusted health-related system is mostly absent here and WHO urged to focus
on that for developing the infrastructure of the medical system of the country. [4]
The number of unqualified doctors is high as well. There are about 12 unqualified doctors in the
village per 10 000.[5]
It can be seen that there is a massive shortage of doctors, especially for people living in remote
areas and so a medium that can connect these people to qualified doctors to get remote treatment
can be a huge solution to these problems.
Keeping all these in mind we proceeded with our project.
In India, Apollo has established a remote medical and health consultancy service where a patient
can get online consultancy from a specialist doctor and can also book an appointment to visit the
doctor physically [6]. Using the website, a patient can choose any doctor according to their
problem and get consultation and prescription without visiting the doctor physically. They
charge very minimum fee e.g. 199 Rs. for consulting a regular doctor virtually and also has the
option to take consultation from a designated specialist with fees ranging from 50 to 70 USD.
There are also other remote health consultancy services such as “Live Health Online” which
provides all their services completely virtually [7]. There are few remote health consultancy
services available in Bangladesh too. “Tonic Doctor”, a partnered service of GrameenPhone, is
one of the most popular online medical consultancy services of Bangladesh [8]. They offer
13
remote health consultancy including diabetes, hypertension, and heart disease for a very cheap
price.
They offer a monthly plan of just “296 BDT” to get a consultation from MBBS certified doctor.
Even though their service is very cheap and available 24/7, they do not offer any specialized
doctor and also their service is limited to just GrameenPhone customers. In Figure 2 we can see
their website portal and the list of doctors. Tonic Doctor has been in the market for a few times
now and it has gained some popularity. That means that the demand for remote healthcare
services is existing in our country. That was another inspiration for working in this project. Since
people want this to happen we wanted to give it to them. With this in mind, we next proceed to
14
see the works that have been done in this field in the scientific and academic sectors in
Bangladesh’s hand worldwide. “PlexusD” is another remote health service in the country that
offers online medical consultancy but it is still in the development stage [9].
The currently existing online health consultancy services in Bangladesh discussed above are
inadequate. “Tonic Doctor” which provides remote medical consultancy does not offer any
specialist doctor. “PlexusD” which promises to offer specialist doctor is still in the developing
phase. Also, the online treatment service provided by “AskApollo” is limited to just doctors from
“Apollo Hospital” and the “Live Health Online” does not provide any service to have physical
meetings with a doctor.
The proposed project will work as a medium between patients and doctors, where the doctors
will not be limited to any particular hospital rather any doctor will be able to open up an account
and do consult remotely. It will also include specialist doctors for cardiology, psychiatry, general
medicine, etc. Also, anyone will be allowed to open up an account and get virtual consultation
which is not possible for “Tonic Doctor” as it only allows GrameenPhone customers to avail of
the service.
suggested and designed an m-health system for prenatal and postnatal care of women in rural
areas of Bangladesh. Their proposed system is based on the mobile SMS and the web interface.
It also ensures the neonatal care up to the age of complication within our limited resources.
On the topic of Ubiquitous future M-Health system including wireless 3G technologies in
Bangladesh Najnin Sultana and Md. Ashraful Islam has been working in Bangladesh [15].
They have proposed a modified health infrastructure using 3G in remote side and Optical
Fiber in backbone side with wide range of services like video conferencing through
VoIP and Skype, MMS diagnostic reports, drug prescriptions and mobile purchase and
home delivery etc. Analysis shows that 3G needs less transmission time of 4s for
medical image upload and transmit.
Raqibul Mostafa and his team have proposed a framework regarding the Deployment of
Telemedicine Centers in Rural Bangladesh [16]. Their framework is stated to be a valuable
guide to deploy effective and long-term telemedicine center at any given location. the paper
presents the framework along with a detailed discussion of the constituent elements, and
analyzes several case studies to demonstrate the application of the framework to provide
site-specific telemedicine solutions at some selected test sites. All the previous telemedicine
projects in Bangladesh suffered from a lack of sustainability and it is expected that deployments
based on the proposed framework proposed by them would be effective, scalable, and
long-lasting in bringing e-healthcare to the target population in Bangladesh.
Rakibul Haque, Fahmi Ahsan, Yakun Bao worked on a paper about the current status, challenges
and future status of the e-health in Bangladesh. They stated that although the e-Health in
Bangladesh remains somewhat problematic, the difficulties could be overcome. Based on the
current scenario and challenges of e-Health, the scope of some fields requires further
improvement. They showed the findings of their study would help the policy makers to make
effective decisions regarding e-Health services. [17] Also in their paper Ahasanun Nessa ; M. A.
Ameen ; Sana Ullah had showed how impactful tele medicine could be in the current situation in
Bangladesh. In this paper they mentioned the reasons why Bangladesh has to move for
telemedicine. Also the past and on-going telemedicine activities and projects in Bangladesh.
16
Analyzing the projects they have found out some factors which should be assessed carefully for
successful implementation of telemedicine application. They have further proposed a prototype
telemedicine network for Bangladesh that can improve health facilities through telemedicine by
making a connection between rural health facility providers and special hospitals.[20].
Mid - 2000: Grameen Communications took rural tele-health initiatives using wireless
technology.
2001: TRCL demonstrated telemedicine system in the US Trade Show 2001 in Dhaka using
Icare software and normal Internet connection & started testrun of the system between US and
Bangladeshi physicians.
April 2001: The Bangladesh Telemedicine Association (BTA) is formed. But the lack of
government sector the technology remains out of reach to the majority of poor people of the
country 2003: Sustainable Development Network Program (SDNP) Bangladesh began in January
2003. The e-HL project built two network segments (8Km; and 6Km) using point-to-point radio
with bi-directional bandwidth of 2 Mbps. Currently, SDNP has four regional nodes in different
parts of Bangladesh (Cox’s Bazar, Dinajpur and Satkhira), including Mymensingh. These nodes
are connected to satellite through VSAT 22(SCPC/MCPC) technology. Under this project every
Friday they arrange consultancy and diagnostic support to the physician at remote end, though
medical experts at the SDNP head office [21].
2003: Bangladesh University of Engineering & Technology (BUET) and Comfort Nursing
Home had started a Telemedicine project with the financial collaboration from European Union
(EU) via Email. Recently the project is not functional.
May 2004: Bangladesh. DNS diagnoses Centre, Gulshan-1 and Comfort Diagnoses & Nursing
Home’s started a Telemedicine center. The project was discontinued because of lack of financial
viability, patient disinterest and poor market promotion
2005: In August 16, 2005 Grameen Telecom (GTC) in cooperation with the Diabetic Association
of Bangladesh (DAB) launched telemedicine services, giving patients at Faridpur (one district of
Bangladesh) General Hospital access to specialist doctors of their choice in Dhaka. DAB’s
BIRDEM Hospital Dhaka, was connected via a video conferencing link to DAB’s Faridpur
General Hospital. Consultations now take place over video conference where patient and doctor
see each other on television screen. The cost per consultation for a new patient was 600 BDTaka
(10 US$), with repeat patients getting some discount [22].
2006 November: Telemedicine Reference centre Ltd. And Grameen phone has started a unique
telemedicine Service “HealthLine Dial 789” A GSM infrastructure based call centre for Grameen
18
disorders in rural Bangladesh. Money spends for mental services are less than 0.5% of the total
national health expenditure. There are 50 outpatient mental health facilities, 31 community-based
psychiatric inpatient units, 111 community residential facilities and one 500 bedded mental
hospital in the country. In past telemedicine projects tele-psychiatry did not get attention. It can
be considered as a way for providing mental health care. Although telemedicine is not a panacea
for all problems related of health care, it can help to minimize the problems that are related with
time in distant. Telemedicine activities are still in primary level in Bangladesh. There is no
support to meet the emergency medical need such as a stroke, severe injury for people in remote
areas. Many developing countries have implemented telemedicine networks which have made a
connection between remote hospitals and special hospitals. We can take India, China for
example [26]. China has three major telemedicine networks. The IMNC network is primarily
based on telephone line and Internet. To possible data transmission over low bandwidth they are
using powerful image compression algorithm that can reduce the file size dramatically.[27]. The
successful expansion of Telemedicine fully depends on the improvement of Information and
telecommunication structure. In past telemedicine implementation was not easy due to poor
telecommunication infrastructure. Now the situation is in favor of telemedicine.
Telecommunication sector in Bangladesh has been experiencing a huge boom in the last few
years. Several private and public telecommunication operators are expanding their operation to
the most rural areas; they are also dwelling to improve the network performance and inclined to
introduce latest technologies to the people. Government always patronizes past telemedicine
projects. Government has lots of responsibility in this aspect. Government should encourage
private organization to invest in telemedicine implementation. Since telemedicine practicing is
increasing day by day so it is very much needed to provide structured laws and regulations about
physician provided service, patients’ issues, licensing of physician and telemedicine providers.
There should be clear rules about reimbursement issues. Since in telemedicine system local
doctor or paramedic treats a patient and they consult with specialist who is far away, who will be
responsible for patient issues? Government also should create policies in favor of rural people so
that they can enjoy low cost telemedicine services. The success of any system depends on user
acceptance. Though there is no difference between conventional consultation and a
20
tele-consultancy, patient and doctors who are accustomed to personal visit may be reluctant to
alter the traditional methods of health care. May be IT savvy medical staffs and physician will
face difficulty in using new technology. To overcome this problem, sufficient training programs
should be offered to enable physician to adapt to this new technology. Media can play a
significant role to make telemedicine popular to user. They should broadcast the successful case
history considering the efficacy and cost effectiveness of telemedicine. There are many factors
influencing the diffusion of telemedicine as well as other new technology. The following factors
should be assessed before considering telemedicine implementation in a specific health care.
Medical Need: First we have to consider what kind of medical facilities can be provided by this
specific health centre. Establishing a high-end telemedicine cell in thana (sub-town) level would
not be significant because of the structure of health care.
Organization and Structure of Health care: According to the structure of health care,
telemedicine support can be different.
Location of the Health Centre: If the location of the health centre is in the same city of the
super or large hospital then people would prefer face to face consultancy rather than
tele-consultancy. We faced this problem in DAB project where the health centre is in Faridpur
and special hospital is in Dhaka, the capital of Bangladesh. The distance between the two
locations is one and a half hour by bus.
will be a cheap solution because the internet is nowadays very cheap to access. So we went on
making a website where doctors and patients can have their own accounts and different
privileges and they can interact very easily. Later on, we realize that smartphone applications are
very popular nowadays so it will be great if we make a smartphone application with the same
functionalities and results. So we also planned to build an Android application because this is the
most popular choice of smartphone in our country and it is also cheaper than the other options.
We decided that video chatting with the doctor would make the process of treatment much
easier. We have also developed a chatting service through which patients can send text messages
to the doctor before a video calling session. The experience with every doctor would not be the
same. So we have developed a review system where a patient can review the video calling
experience with the doctor.
1.4.2 Objectives
Right from the beginning, our core objective was to make medicine and healthcare accessible
and reliable and available to all the people of Bangladesh. Later on, to make the doctors
interested we added the online easy payment system this would help to attract doctors. There are
a large number of people living in rural areas who do not have the opportunity to make an
appointment with the reputed doctors. Most of the reputed doctors practice in Dhaka. So in order
to get treatment from them, people from rural areas need to come to Dhaka first. Sometimes they
don’t have a place to stay. That adds more problem and expenditure of the entire tour becomes
high. It is not affordable for them most of the time. Our proposed solution will help them to get
remote treatment sitting at home. To make the lives of the people easier has always been a core
objective for us.
Among the upcoming sections; Chapter 2 contains the Methodology we used to build our
system. We discussed about the workflow and how we implemented the system. We have further
discussed the technologies we have used in the time of developing both the website and android
application. Chapter 3 contains the details description and contents of the Android
Application. We discussed about each feature in details. Chapter 4 contains the details
description and contents of the Web Application, Chapter 5 is about Market Analysis where
22
we discussed about the unit costs, the demography and compared our solution with the existing
solutions and Chapter 6 is the Conclusion where we discussed about the shortcomings and also
included the future plans with this project.
23
Chapter 2
Methodology
24
2 Methodology
This section has the detailed description of our workflow and the methods and technologies we
used to solve our problems and achieve our goals.
2.1 Workflow
We developed a website and a smartphone application that will enable people to get medical
consultancy from renowned doctors over a virtual medium. This system focuses on solving the
problems discussed above to make the lives of people easier.
The system consists of two user profiles as shown in Figure 3. There is a patient type account
and a doctor type account. Patients can access the Doctor's list after a successful registration
process. Patients can use video calling feature in order to remotely interact with the doctor. A
doctor type user can decide which patient to give treatment to. Once they start treating a patient,
they will have access to a certain part of the patient profile necessary for the treatment. All of
this happens after successful registration and login.
25
Council (BM&DC) registration number and National Identification Card (NID) number. The
system admin will then check it manually and if valid, then approve it. Only after that, the doctor
type user's registration can proceed further.
After login into the system, a doctor type user will be directed to a Doctor's dashboard. From
there, if a patient has contact with the doctor, then he/she will be able to see the patient's medical
history and will be able to communicate with the patient further via text messages or video
calling.
The prescription of the patient will be stored in the patient’s profile and all the medical histories
of the patient can be checked and monitored by the doctor. Patients can only see the prescription
given by the doctors while the doctors can edit it.
Whenever a doctor type user logs in, she/he will immediately go online. In order to go offline,
they need to log out of the system. Doctors will be able to see previously prescribed medicines
and all other medical histories of their patients.
Doctors will receive money from the patient type users from through mobile banking, visa card
and MasterCard.
Patients will be able to give feedback after a session with the doctor. There is also a rating
system, using which patient type users can provide their valuable opinions about their interaction
with doctors.
2.3.1.1 ReactJS
React (also known as React.js or ReactJS) is a JavaScript library for building user interfaces. It is
maintained by Facebook and a community of individual developers and companies.
28
2.3.1.2 Twilio
Twilio is a cloud communications platform as a service company based in San Francisco,
California. Twilio allows software developers programmatically to make and receive phone
calls, send and receive text messages, and perform other communication functions using its web
service APIs.
2.3.1.3 Socket.IO
Socket.IO is a JavaScript library for realtime web applications. It enables real time, bi-directional
communication between web clients and servers. It has two parts: a client-side library that runs
in the browser, and a server-side library for Node.js. Both components have a nearly identical
API.
2.3.1.4 MongoDB
MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL
database program, MongoDB uses JSON-like documents with a schema. MongoDB is developed
by MongoDB Inc. and licensed under the Server Side Public License.
2.3.1.6 Node.js
Node.js is an open-source, cross-platform, JavaScript runtime environment that executes
JavaScript code outside of a browser. Node.js lets developers use JavaScript to write
29
Though .js is the standard filename extension for JavaScript code, the name "Node.js" does not
refer to a particular file in this context and is merely the name of the product. Node.js has an
event-driven architecture capable of asynchronous I/O. These design choices aim to optimize
throughput and scalability in web applications with many input/output operations, as well as for
real-time Web applications (e.g., real-time communication programs and browser games).
The Node.js distributed development project, governed by the Node.js Foundation, is facilitated
by the Linux Foundation's Collaborative Projects program.
Corporate users of Node.js software include GoDaddy, Groupon, IBM, LinkedIn, Microsoft,
Netflix, PayPal, Rakuten, SAP, Voxer, Walmart, and Yahoo!.
2.3.2.2 Java
Java is a general-purpose programming language that is class-based, object-oriented, and
designed to have as few implementation dependencies as possible.
2.3.2.4 Sinch
Sinch is a telecommunications and cloud communications platform as a service company.
Headquartered in Stockholm, Sweden, Sinch also has offices in over 30 cities worldwide,
including Atlanta, London, Madrid, San Francisco, Singapore, and Sydney.
2.4 Cost
The main cost we had to undergo is the cost of the domain and other things acquiring. The
details costing has been given in the table below. Since we have done the development works all
by ourselves therefore the cost was minimal. Still we had to give our time for this project so that
worth some costing. We have given that costing based on the average market price of a
developer per hour. So that is not the amount we have actually spent but that will cost someone if
someone wants to build a project like this. For domain, we spent 1100 BDT.
Chapter 3
Android Application
33
3 Android Application
Using the mentioned technologies in Chapter 2, we have developed an android application which
has dual authentication system, separate dashboards for patient and doctor type users, chatting
functionality, video calling functionality, setting up multiple alarms which is also synced with
the cloud and payment system.
3.1 Registration
The Registration and Login page for two types of users has been developed for the android
application. The platform now has a dual authentication system. Firebase was used for storing
user data. The development of the dual user authentication was done using the Java
programming language alongside Firebase, Firebase Realtime Database, and XML. For the
implementation of dual authentication system, a user table in Firebase Realtime Database has
been created in which a field has been added called “type”, in which for patient type user value
patient is stored and for doctor type user value doctor is stored.
In the android application, the system admin approval from the backend for the registration of
the doctor type user has also been implemented. For the implementation of manual verification
for doctor type user, a field named “approved” has been added to the user table in Firebase
Realtime Database. Whenever a doctor registers for a new account using the android application,
he/she provides information which includes name, Bangladesh Medical and Dental Council
(BM&DC) number and National Identification Number (NID). Using Firebase console, system
admin can check the provided information and verify the authenticity of the person. After
checking the authenticity of a new doctor account, system admin can change the value of
“approved” field to “true” in user table in Firebase Realtime Database. After the completion of
verification and approval process, doctors will be able to log in to their account and access their
designated dashboard. Also the newly created doctor account will become available in the doctor
list.
34
Figure-6 presents the logic which has been used for the implementation of dual authentication
system in the developed android application. When a new user registers to the system using the
android application, if the account is patient type, then the user will be directed to patient
dashboard. On the other hand, if the account type is doctor, then the user will be directed to
doctor dashboard with limited access if the doctor account is not verified. After the doctor
account is verified, the doctor type user will be directed to doctor dashboard with full access.
taking medicine on time. Also, the alarm time set by user is synced with cloud database.
Therefore, patients can log into their account using the android application in any device and the
saved alarms will be synced to that device and notify the user to take his/her medicine on time.
Figure 7 illustrates the interface for the alarm.
In figure-7, the list of alarms set by a user is shown. Users can set alarms to notify on every day
of the week or in particular days of the week by using turning on/off the days name under alarm
time shown in figure-7. As alarms are synced to the cloud, the list of alarms will become
instantly available to users whenever they logic to their accounts on any device using the android
application.
36
3.3 Profiles
Patients and doctors will have seperate profiles. In the profile for patient type users, their name,
age, systolic blood pressure, diastolic blood pressure, heart rate, etc. information are shown and
whenever a patient communicate with a doctor; the doctor will be able to see these information
from patient profile which will help him/her to treat the patient properly. Whenever a patient
type user logs into his/her account he/she will be able to see the list of doctors available in the
system. By clicking on the list of available doctors, patients will be able to see doctors’ full
profiles and in which area a doctor has speciality. There is also edit option using which users will
be able to update their information such as names, phone numbers, emails, age, medical records
and upload profile images.
37
In figure-8, implemented dashboard for both patients and doctor type users have been shown.
From the figure-8, it can be seen that for two types of users the dashboard shows different
information such as for patient type user the dashboard displays information like name, email
and various medical records; on the other hand for doctor type user the dashboard displays
information like their name, email, speciality, etc.
Figure-9 shows the user interface for list of available doctors in the system which can be
accessed from android application by logging in as a patient user. The list is updated dynamically
and in real time. So whenever a new doctor register and his/her id gets verified and approved; the
list of doctors gets updated in real time. From the list, patients can click on any doctor and they
will be directed to chat interface. From the chat interface, user can click on doctor image to go to
doctor profile to see more information about him/her, click on video calling option or send a text
message to initiate chatting.
From figure-10, the implemented chatting interface for android application can be seen. Using
the implemented chatting functionality, users can see whenever a message has been sent and
whether the message has been seen or not. By logging in, a doctor user can see the messages that
have been sent and reply to the messages at his/her convenience. Doctor user can not see the list
of available doctors and can not see the available patient type users in the system. Whenever a
39
patient sends a doctor message through the implemented chatting system, the doctor will be able
to see that patient profile and the patient’s medical history and respond to the message. A patient
user can not communicate with other patient type user in the system and doctor type users can
not communicate with other doctor type users in the system. Patients can only communicate with
doctor and a doctor will only be able to communicate with a patient if the patient send the doctor
a message first through the chatting system.
Figure-11 briefly describes the flow diagram of video calling system. First a patient makes a
video call to a doctor and the request is then received by Sinch server which then sends the call
request to the receiver doctor account. If the doctor is not available/online, then Sinch server
40
sends a not available notification to the patient account. If the doctor is available and receives the
call, then two different token is automatically generated for patient and doctor account by Sinch
server and then video calling is established between the patient and doctor for which data traffic
is handled by Sinch server.
From figure-12, video calling interface for android application can be seen where the small
screen at the top right corner shows the live image/video of the caller and the large screen shows
the video of the receiver.
41
Chapter 4
Web Application
42
4 Web Application
A landing page of the website is developed with ReactJS and NodeJS. A dual authentication
system has been implemented and manual checking for the doctor type user's validation is added.
Using the mentioned technologies in Chapter 2, we have developed the web application which
has functionalities such as separate dashboards for patient and doctor type users, chatting service,
video calling service, doctor rating feature and payment system.
4.1 Registration
To register as patients, users need to provide their names, emails, and passwords. Registration
and login for the patient type user is easier and without much hassle. After a successful
registration process, patient type users can log in with their email and password. On the other
hand, to register as doctors, users will need to provide names, emails, passwords, Bangladesh
Medical and Dental Council (BMDC) registration number and National Identification Card
(NID) number. For doctors, verification is important. That is why they will need provide their
Bangladesh Medical and Dental Council (BMDC) registration number. Our system admin will
manually check it. Doctors will be able to login to their accounts only after the verification of
their information has been completed.
In the web app, the system admin approval from the backend for the registration of the doctor
type user has also been implemented. For the implementation of manual verification for doctor
type user, a field named “approved” has been added. Whenever a doctor registers for a new
account using the android application, he/she provides information which includes name,
Bangladesh Medical and Dental Council (BM&DC) number and National Identification Number
(NID). System admin can check the provided information and verify the authenticity of the
person. After checking the authenticity of a new doctor account, system admin can change the
value of “approved” field to “true” in user table in the Database. After the completion of
verification and approval process, doctors will be able to log in to their account and access their
designated dashboard. Also the newly created doctor account will become available in the doctor
list.
43
4.3 Review
A review system has been implemented through which patients will be able to provide feedback
about their experiences with the doctors. This system will help the patients to get some idea
about the doctors they want to consult. Sometimes, patients don't have any particular doctor in
mind. They don’t know which psychologist to consult with for counseling session. This review
system will help them to get some idea about the doctor they are choosing. Patient type users can
review a doctor on a scale of 5 based on their experience with the doctor. System admin will
regularly monitor the reviews and check on them if their is any inconvenience.
45
After selecting the doctor from the doctor’s list, patients will have to send text messages to the
doctor. If both parties agree for consultation, the video call may proceed. With the help of video
calling, the patients and the doctors will be able to see each other remotely which will enhance
the spectrum of giving treatment. With the video calling service, if there is something of a
patient’s body that a doctor needs to see, then he or she can see it. A video conference would
make the experience more authentic and humane.
With the help of chatting service, the doctor-patient communication would become easier. After
selecting the doctors from the doctor’s list, patients can send the doctors text messages. They can
use text messages to set up for the consultation through video calling and other issues. After the
communication through text messages, if the doctors agree, then things will proceed further.
In the profile for patient type users, their name, age, systolic blood pressure, diastolic blood
pressure, heart rate, etc. information are shown and whenever a patient communicate with a
doctor; the doctor will be able to see these information from patient profile which will help
him/her to treat the patient properly. Whenever a patient type user logs into his/her account
he/she will be able to see the list of doctors available in the system. By clicking on the list of
available doctors, patients will be able to see doctors’ full profiles and in which area a doctor has
speciality. There is also edit option using which users will be able to update their information
such as names, phone numbers, emails, age, medical records and upload profile images.
50
Chapter 5
Market Analysis
51
5 Market Analysis
In the market, we have reached a lot of users.
Domain 1100/-
5.2 Users
Unlike previously existed services like ours, ours service is completely open for everyone to use.
So no extra condition applied or no hidden charges. So that makes all the people of Bangladesh
our user base. Which makes all the 158.9 million(2017)[17] people of our country our user base.
Anyone interested in our service can use it from anywhere in the Bangladesh. All they will need
is a stable internet service.
5.3 Demography
In 2017 according to Statistical Bureau of Bangladesh, the population of our country was 158.9
million. Which is a lot considering the size of the country. So that makes our country one of the
most densely populated countries of the world. Figure 20 confirms that matter and we can see
52
that we have 79.6 million Male and 74.5 million Female among our population. The growth rate
of the population is 1.37. The total fertile population ratio(15-49 years) is 2.10. From the data it
is clear that lots of people are still living under the poverty range. Bangladesh suffers from both a
shortage of and geographic mal-distribution of HRH. There are an estimated 3.05 physicians per
10,000 population and 1.07 nurses per 10,000 population (estimates based on MoHFW HRD
2011). There is a severe gap between sanctioned and filled health worker positions: 36% vacancy
in sanctioned health worker positions and only 32% of facilities have 75% or more of the
sanctioned staff working in the facilities (World Bank, 2009). 28% of treatment provided in
53
Health workers are concentrated in urban secondary and tertiary hospitals, although 70% of the
population lives in rural areas (Country Case study (GHWA, 2008). Major challenges include: an
overly- centralized health system, weak governance structure and regulatory framework, weak
management and institutional capacity in the Ministry of Health and Family Welfare (MoHFW),
fragmented public service delivery, inefficient allocation of public resources, lack of regulation
of the private sector – which employs 58% of all physicians, shortage of HRH, high turnover and
absenteeism of health workers, and poor maintenance of health facilities and medical equipment.
Despite these challenges and the fact that HRH was not considered a priority in the current sector
program, there have been recent successes including: increase in the number of graduates and
health worker training facilities, and an increased number of rural health facilities. The MoHFW
prepared its new sector program - the Health, Population and Nutrition Sector Development
Program (HPNSDP) and is revising its draft National Health Policy, based on lessons learned
from previous programs. Goals include: developing an HRH plan, creating a functional HRH
Information System (HRIS), scaling up the production of critical health workers, introducing
incentive packages to deploy and retain critical health workers in remote and rural areas,
addressing the challenge of skilled birth attendance by training community-based SBAs and/or
nurse-midwives and family welfare visitors, and streamlining the recruitment and promotion of
nurses (PID, World Bank, 2011).
The first stakeholder dialogue on Human Resource for Health (HRH) in Bangladesh took place
on 28th March 2012. The dialogue was mainly to start advocacy on the need of adequate and
skilled health workforce for well functioning health system and advocate for the Country
Coordination and Facilitation (CCF) process as initiated by the Alliance.
54
The past Bangladesh Workforce Strategy (2008) focused on integrating the system of managing
and accreditation of HR across the public, private and NGO sectors. Included measures were:
● development of an HR master plan
● improved incentives to work in rural and remote areas
● increased community-focused aspects into training programs, and
● improved quality of health workforce education and planning, including improving the
capacity of teaching and training institutions with a shift from a more knowledge-based
to skills-based approach.
Other focuses were stewardship/regulation of health HR, recruitment and career development
and retention, performance management processes, leadership and coordination of HR functions,
public-private partnerships, effective financing and an Integrated Human Resource Management
Information System.
The Ministry of Health and Family Welfare is currently in the midst of a dialogue process with
the different stakeholders for finalizing the draft document of National Health Policy Health and
Family Welfare.There are currently 16 principals and 38 working strategies in the policy
including formulation of National Health Development Council to strengthen inter-ministerial
health related tasks and provide guidelines in implementing the policy.The specific goals of the
policy are ensuring primary and emergency health services for all, expanding equity based
quality health services and encouraging people to seek healthcare.
Our project will be very helpful since the scarcity of proper healthcare is evidently very high.
Since our goal is to provide healthcare for everyone from any place of the country this will be
very helpful for the elderly and other people who are physically unable to reach the healthcare
services. Since a lot of people among the population is either children or senior citizen it will be
especially very helpful for them to get the healthcare services from their home. From a published
paper about the rural healthcare situation in Bangladesh these findings has been come up[18]:
55
1. In rural health complex, they provide both curative and privative treatment.
2. They have few numbers of ambulances to pass on the Emergency patient.
3. They do not get sufficient medicine to provide the patient.
4. There is an extreme lack of Doctor, nurse, Medicine, Medical assistance, Family planning
worker in this system but in some cases there is enough but it is too rare.
5. In rural health complex, majority of the patient is women & children.
6. From our survey we came to know that some of the health complex is run by govt. and some
are run by both private organizations and NGO.
7. They find their necessary budget from both govt. and private sector.
8. Civil surgeon is responsible for the daily management regarding work schedule.
9. Director of General and ministry of health and upazila health officer take decision regarding
health activities.
10. The rural health care activities are not influenced by the local governments but in some cases
it also happened.
11. Medicine, check up, Consultation and food are free for the patient.
12. Medical and other fees are very reasonable for rural patients.
13. Respective authority is unconcerned about the patient satisfaction and they do not keep any
statistics about it.
14. We also saw that ‘illiteracy is the main barriers towards the improvement of health
system’15. Though health is one of the important needs of human being our country is not able
to make this facility available for our rural people.
16. Financial and technical support is also important for ensuring a high quality of health care
but the government’s allocation does not match the demand.
17. Most of the doctors’ say is that the public salary is not enough and that they are therefore
forced to go to the private sector.
So it is clear that our service will be very helpful for the people of Bangladesh.
56
restrictions for example some services require to use the product of that company to be able to
use the service. We do not have any of these.
This project is an innovation in the sense that no other services in Bangladesh have these
facilities like this one. There are few services available in the country in this sector but they
either arrange a physical meeting via online appointments or just provide consultation from
non-specialist doctors. On the other hand, in this proposed project, users will be able to get
online medical treatment from specialist doctors via video call using the web or smartphone
application which is not currently an available service in the country. Thus, the project is
innovative.
shift to city area. They feel that they become professionally isolated and outdated if stationed in
remote areas. As a result health staff in rural areas are usually young, have little work experience
and show high job rotation. In many cases rural Health Centers are headed by infirmary
technicians who are barely trained. In this situation rural people rarely get any specialist doctor’s
advice when they go to health centers in thana or Upazila level. To get better consultancy rural
people spend most of their money on travel to visit doctor in urban areas instead of meeting other
treatment expenses. Sometimes, it is not possible to transfer a patient to the suburbs or to the city
on time due to his/her critical health condition and poor communication facilities in those areas.
Under this circumstance to provide health care in rural area there are two options. One is,
building hospitals in rural areas and also improves the infrastructure so that doctors and other
staff feel convenient to stay that places. Another one, is to take any initiative so that it is easy to
access quality health care to rural areas. To implement first one needs huge investment and time.
So remaining is the second one. To implement the second one telemedicine is the best way to
provide better health care by using maximum utilization of limited resources.
With all that said it evident that our service will impact a great number of people of our country.
59
Chapter 6
Conclusion
60
6 Conclusion
Universal accessibility of modern healthcare is a problem in Bangladesh. Using modern
technologies we approached to solve this problem by making a web platform as well as an
application for smartphones so that interacting between doctor and patient gets easier. We have
successfully developed an application for both platforms though there are still a few
shortcomings. We are working to solve the issues. Even though the applications have been
developed for small user-base, in the future they can be scaled up for large user-base. This
system can help to ensure proper medicare in Bangladesh, especially in rural areas and as a
result, reduce the number of deaths due to the absence of treatment.
7 References
[1] WHO - Bangladesh (who.int/workforcealliance/countries/bgd/en)
[2] Country Case Study - Bangladesh Trains Health Workers to ReduceMaternal Mortality, World
Health Organization, 2008
[3] Foysal Ahmed, Health System of Bangladesh
[4] Islam, Anwar & Biswas, Tuhin. (2014). Health System in Bangladesh:Challenges and Opportunities.
American Journal of Health Research.
[5] Syed Masud Ahmed and Md Awlad Hossain, ”The health workforce crisis in Bangladesh:
shortage, inappropriate skill-mix and inequitable distribution”, Hum Resour Health, Vol. 9, Issue 3,
2011
[6] Ask Apollo (askapollo.com/online-doctors-consultation)
[7] Live Health Online (livehealthonline.com)
[8] Tonic Doctor - GrameenPhone (mytonic.com)
[9] PlexusD - Healthcare Network (plexusd.com)
[10] Yuan, Bingchuan, and John Herbert. ”Web-based real-time remote mon-itoring for pervasive
healthcare.” 2011 IEEE International Conferenceon Pervasive Computing and Communications
Workshops (PERCOMWorkshops). IEEE, 2011.
[11] Youm, Sekyoung, et al. ”Development of remote healthcare system for measuring and
promoting healthy lifestyle.” Expert Systems withApplications 38.3 (2011): 2828-2834.
[12] Al Mamun, Khondaker Abdullah, et al. ”Cloud based framework forParkinson’s disease
diagnosis and monitoring system for remote health-care applications.” Future Generation Computer
Systems 66 (2017): 36-47.
[13] Cronin, Edmond M., et al. ”Remote monitoring of cardiovascular devices: a time and
activity analysis.” Heart Rhythm 9.12 (2012): 1947-1951.
[14] Parvin, S. ”An Effective m-Health System for Antenatal and PostnatalCare in Rural Areas of
Bangladesh.” IOSR Journal of Computer Engi-neering 17.5 (2015): 15-19.
[15] Sultana, Najnin, and Md Ashraful Islam. ”Ubiquitous future M-Healthsystem including
wireless 3G technologies in Bangladesh.” Journal ofAdvances in Technology and Engineering
Research 1.1 (2015): 22-29.
[16] Mostafa, Raqibul, et al. ”Proposed framework for the deployment of telemedicine centers in
rural Bangladesh.” International Journal of E-Health and Medical Communications (IJEHMC) 2.1
(2011): 55-72.
[17] Hoque, Md & Mazmum, Fahami & Bao, Yukun. (2014). e-Health in Bangladesh: Current Status,
Challenges, and Future Direction. The International Technology Management Review.
[18] Bangladesh Bureau of Statistics (BBS)(2017) -
http://bbs.portal.gov.bd/sites/default/files/files/bbs.portal.gov.bd/page/a1d32f13_8553_44f1_92e6_8ff80a
4ff82e/Bangladesh%20%20Statistics-2017.pdf
63
8 Appendix
function App() {
return (
<div className="App">
<Route path='/register' component={ RegisterForm } />
<Route exact path='/' component={Home} />
<Route path='/login' component={Login} />
<Route path="/dashboard/:did/:pid/:name" component={Dashboard}
/>
<Route path='/videoroom/:did/:pid/:name' component={VideoRoom}
/>
<Route path='/profile/:id' component={Profile} />
</div>
)
}
useEffect(() => {
//Load data
axios.get('/api/user/getdoctors')
.then( res=>res.data.map((doc)=>{
setDoctors( (doctors)=> ([...doctors, doc]) )
return 0
}) )
.catch( err => console.log(err) )
axios.post('/api/user/getinfo', {
token: sessionStorage.getItem('authtoken')
})
.then(res=> {
setUserdata({ _id: res.data._id, name: res.data.name,
email: res.data.email })
})
.catch(err => console.log(err))
}, [])
66
function contactDoc(docId) {
let patientId = userdata._id
props.props.history.push(`/dashboard/${docId}/${patientId}/${userdata
.name}`)
}
function handleSeeProfile(id) {
props.props.history.push(`/profile/${id}`)
}
axios.put(`/api/user/rate/${id}`,{rating:newRating})
.then(res=> console.log('ok'))
.catch(err=> console.log(err))
setRating(newRating)
window.location.reload()
}
props.props.history.push(`/videoroom/${docId}/${patientId}/${userdata
.name}`)
}
return (
<div className='cards-wr'>
<div style={{
width: '100%',
height: '250px',
background: '#ddd'
67
useEffect(() => {
axios.post('/api/user/getinfo', {
token: sessionStorage.getItem('authtoken')
})
.then(res=> {
setUserdata({ _id: res.data._id, name: res.data.name,
email: res.data.email })
})
.catch(err => console.log(err))
}, [])
return (
<div className={styles.row}>
<div className={styles.is_7}>
<SVG className={styles.svg} />
</div>
<div className={styles.is_5}>
<div className={styles.tagLine}>
<h1 className='msgl'>We are providing remote<br
/>Health Care Services</h1>
</div>
</div>
<div className={styles.is_12}>
<div className={styles.mouse_icon} />
</div>
<div className={styles.block}>
<span>scroll</span>
</div>
69
import './Input.css';
Footer handler(Footer.js):
import React, { Component } from 'react';
import styles from './footer.module.css';
import { FaFacebookF } from 'react-icons/fa';
import { FaFacebookMessenger } from 'react-icons/fa';
import { FaTwitter } from 'react-icons/fa';
import { FaWhatsapp } from 'react-icons/fa';
class Footer extends Component {
handleSmoothScroll = () => {
70
ehavior:
document.querySelector('#TOP').scrollIntoView({ b
'smooth' });
console.log('done');
}
render() {
return (
<div className={styles.Bottom}>
{/* <div className={styles.firstFooterBox}>
<a href="#TOP">About</a>
<a href="#TOP">Need Help?</a>
<a href="#TOP">Privacy</a>
</div> */}
<div className={styles.secondFooterBox}>
<div>
<p>
RemoteHealthCare (c)2019
</p>
</div>
{/* <ul>
<li>
<i>
{''}
<FaFacebookF />
</i>
<a
onClick={this.handleSmoothScroll} href="#TOP">
Facebook
</a>
</li>
<li>
<i>
{''}
<FaFacebookMessenger />
</i>
<a
onClick={this.handleSmoothScroll} href="#TOP">
Messenger
71
</a>
</li>
<li>
<i>
{''}
<FaTwitter />
</i>
<a
onClick={this.handleSmoothScroll} href="#TOP">
Twitter
</a>
</li>
<li>
<i>
{''}
<FaWhatsapp />
</i>
<a
onClick={this.handleSmoothScroll} href="#TOP">
WhatsApp
</a>
</li>
</ul> */}
</div>
</div>
);
}
}
Infobar Handler(InfoBar.js):
import React from 'react';
import './InfoBar.css';
72
Message.js:
import React from 'react';
import './Message.css'
return (
isSentByCurrentUser
? (
<div className="messageContainer justifyEnd">
<p className="sentText pr-10">{trimmedName}</p>
<div className="messageBox backgroundBlue">
<p className="messageText colorWhite">{ text }</p>
</div>
73
</div>
)
: (
<div className="messageContainer justifyStart">
<div className="messageBox backgroundLight">
<p className="messageText colorDark"> { text }</p>
</div>
<p className="sentText pl-10 ">{user}</p>
</div>
)
);
}
Profile Handler(Profile.js):
import React,{ useState, useEffect } from 'react'
import './Profile.css'
import axios from 'axios'
import Avatar from '../DoctorCard/Avatar'
import bg from '../../media/bg.svg'
import { Link } from 'react-router-dom'
_id: '',
name: '',
email: ''
})
useEffect(() => {
axios.post('/api/user/getinfo', {
token: sessionStorage.getItem('authtoken')
})
.then(res=> {
setUserdata({ _id: res.data._id, name: res.data.name,
email: res.data.email })
})
.catch(err => console.log(err))
}, [])
useEffect(() => {
axios.get(`/api/user/getdoctor/${props.match.params.id}`)
.then( res => setUser([res.data[0]]) )
.catch(err=> console.log(err))
axios.post('/api/user/getinfo', {
token: sessionStorage.getItem('authtoken')
})
.then(res=> {
setType(res.data.type)
})
.catch(err => console.log(err))
}, [])
useEffect(() => {
if(user.length>0) {
console.log(user[0].profileInfo)
user[0].profileInfo.map(data=> setInfo(info=>[...info,
data]))
setPath(user[0].profilePic)
setName(user[0].name)
75
setId(user[0]._id)
setDegree(user[0].degree)
setDep(user[0].departament)
}
}, [user])
function addDegreeHandler(e) {
e.preventDefault()
axios.put(`/api/user/add-degree/${props.match.params.id}`, {
degree: addDegree
})
.then( res => console.log('ok...') )
.catch( err => console.log(err) )
window.location.reload()
}
function addDepHandler(e) {
e.preventDefault()
if( type==='doctor') {
axios.put(`/api/user/add-dep/${props.match.params.id}`, {
departament: addDep
})
.then( res => console.log('ok...') )
.catch( err => console.log(err) )
window.location.reload()
}
}
function addInfo(e) {
e.preventDefault()
76
if(type==='doctor') {
axios.put(`/api/user/add-info/${props.match.params.id}`,
{
info: {title, text}
})
.then(res => console.log('ok...'))
.catch(err => console.log(err))
window.location.reload()
}
}
function toChat(e) {
e.preventDefault()
function handleLogout(e) {
e.preventDefault()
sessionStorage.removeItem('authtoken')
props.history.push(`/login`)
}
function home() {
props.history.push(`/`)
}
function reload(e) {
window.location.reload()
}
return (
77
<div className='profile-wr'>
<nav className='desktop-nav'>
<div className='logo' >Remote Health Care</div>
<div className='nav-btns'>
<li></li>
<li onClick={e=>home()}>Home</li>
<li></li>
</div>
<div className="user-bar">
</nav>
<div className="profile-bg">
<img src={bg} alt="nu este"/>
</div>
<h1>Profile</h1>
<div className="profile-pic">
<Avatar path={path} className='pic' />
<div className={ type==='patient' ? 'display-none' :
' ' }>
<form className={path ? 'display-none' : ''}
action={`/api/profile/${id}`} method="post"
encType="multipart/form-data">
<input type="file" name="avatar"
className='tests' />
78
</div>
<div className="general-info">
<p className='profile-name'> <span>Name </span>
{name}</p>
<div>
<p className={ degree ? 'degree' : 'display-none'
} > <span>Degree</span> {degree}</p>
<form className={ degree ? 'display-none' :
'degree' }>
<input type="text" onChange={ e =>
setAddDegree(e.target.value) } />
<button onClick={ e => addDegreeHandler(e)
}>Add Degree</button>
</form>
</div>
<div>
<p className={ dep ? 'dep' : 'display-none' }>
<span>Departament</span> {dep}</p>
<form className={ dep ? 'display-none' : 'dep'
}>
<input type="text" onChange={ e =>
setAddDep(e.target.value) } />
<button onClick={ e => addDepHandler(e) }
>Add Departament</button>
</form>
<button onClick={ e=> toChat(e) }>Chat</button>
</div>
</div>
<h1 className='br'>Profile Info</h1>{console.log(type)}
<div className= 'profile-info' >
<div className='infos'> {info.map((data, i) => <div
key={i}><div className='info-title'>{data.title.toUpperCase()} </div>
<div className='info-text'> {data.text} </div></div> )} </div>
79
Registration form:
import React, { useState } from 'react'
import '../css/RegisterForm.css'
import axios f rom 'axios'
function clickOnType(type) {
if(type === 'doc') {
document.getElementById("only-docs").style.display =
'block'
setRT('doc')
const pbtn = document.getElementById('patient-type-btn')
pbtn.style.border = ' none'
pbtn.style.color = '#000'
pbtn.style.background = '#fff'
idCardNr: idCardNr
})
.then(() => props.history.push('/login') )
.catch(error => {
console.log(error)
})
}
return (
<div className="register-bg">
<div className='wr'>
<div className="register-form">
<div className="type-btns">
<button className='patient-type-btn'
id='patient-type-btn' onClick={ e => clickOnType('patient') }
>Patient</button>
<div>Or</div>
<button className='doc-type-btn'
id='doc-type-btn' onClick={ e => clickOnType('doc') }
>Doctor</button>
</div>
<label>
Email:
<input type="email" value={email}
name='email' onChange = { e => setEmail(e.target.value) }/>
</label>
82
<label>
Password:
<input type="password" value={password}
name='password' onChange = { e => setPassword(e.target.value) }/>
</label>
<div id="only-docs">
<label >
Practice Number
<input type="text" value={practiceNumber}
name='practiceNumber' onChange = { e => setPN(e.target.value) }/>
</label>
<label>
National ID card number
<input type="text" value={idCardNr}
name='idCardNr' onChange = { e => setICN(e.target.value) } />
</label>
</div>
<button type='submit'>Submit</button>
</form>
</div>
</div>
</div>
)
}
Home.js:
import React, { useState, useEffect } from 'react'
import '../css/Home.css'
import { Link } from 'react-router-dom'
import axios from 'axios'
import Landing from '../components/Landing/landing'
import Footer from '../components/Footer/Footer'
import ReviewsSection from '../components/ReviewsSection'
import DocCard from '../components/DoctorCard/DoctorCard'
83
useEffect(() => {
axios.post('/api/user/getinfo', {
token: sessionStorage.getItem('authtoken')
})
.then(res=> {
setUserdata({ _id: res.data._id, name: res.data.name,
email: res.data.email })
})
.catch(err => console.log(err))
}, [])
function handleLogout(e) {
e.preventDefault()
sessionStorage.removeItem('authtoken')
props.history.push(`/login`)
}
return (
<div >
<div className='home-wr'>
<nav className='desktop-nav'>
<div className='logo' >Remote Health Care</div>
<div className='nav-btns'>
<li></li>
<li></li>
<li></li>
</div>
<div className="user-bar">
84
</nav>
<div className="landing-board">
<Landing />
</div>
</div>
<h1 className='h1-review'>Reviews Section</h1>
<ReviewsSection />
<Footer />
</div>
</div>
)
}
Login Form:
import React, { useState } from 'react'
import { Link } from 'react-router-dom'
import '../css/LoginForm.css'
import axios from 'axios'
85
function clickOnType(type) {
if(type === 'doc') {
setRT('doc')
const pbtn = document.getElementById('patient-type-btn')
pbtn.style.border = ' none'
pbtn.style.color = '#000'
pbtn.style.background = '#fff'
})
.catch(err => console.log(err))
}
return (
<div className='login-bg'>
<div className='login-wr'>
<div className="type-btns">
<button className='patient-type-btn'
id='patient-type-btn' onClick={ e => clickOnType('patient') }
>Patient</button>
<div>Or</div>
87
<button className='doc-type-btn'
id='doc-type-btn' onClick={ e => clickOnType('doc') }
>Doctor</button>
</div>
<div className="login-form">
<form onSubmit={ e=> handleSubmit(e,
registrationType, props) }>
<label>
Email: <br />
<input type='email' name='email'
value={email} onChange={ e => setEmail( e.target.value) } /> <br />
</label>
<label>
Password: <br />
<input type="password" name='password'
value={password} onChange={ e => setPassword(e.target.value) } /> <br
/>
</label>
<div>
<button type='submit'>Log In</button>
<Link to='/register'>Register</Link>
</div>
</form>
</div>
</div>
</div>
)
}
Index file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1" />
<meta name="theme-color" content="#000000" />
88
</body>
</html>
//IMPORT ROUTES
equire('./routes/auth')
const authRoute = r
const chatRoute = r equire('./routes/chat')
dotenv.config()
app.use(express.json())
app.use((req, res, next) => {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Content-Type");
res.header("Access-Control-Allow-Methods", "GET, POST");
next();
});
app.use(bodyParser.urlencoded({ extended: false }))
app.use('/uploads/', express.static('uploads'))
app.use(cookieParser())
app.use(cors())
90
//Route Middlewere
app.use('/api/user', authRoute)
app.use('/api/chat', chatRoute)
// DB CONNECTION
et doc = a
l wait Doctor.findOneAndUpdate({_id: req.params.id}, {
profilePic: req.file.path }, { new:true })
res.redirect(`/profile/${req.params.id}`)
})
// SOKET.IO
const { addUser, removeUser, getUser, getUsersInRoom } =
require('./users')
socket.join(user.room)
callback()
91
})
callback()
})
socket.on('disconnect', () => {
const user = removeUser(socket.id)
if(user) {
io.to(user.room).emit('message', { user: 'Admin', text:
`${user.name} has left.` })
io.to(user.room).emit('roomData', { room: user.room, users:
getUsersInRoom(user.room)})
}
})
})
// STRIPE IMPLEMENTATION
const stripe =
require("stripe")("sk_test_vIpqlRKSUEUbJNdpxBQcjcBI00VQHOf7TI")
const uuid = require("uuid/v4")
let error;
93
let status;
try {
const { token } = req.body;
Users.js:
const users = []
users.push(user)
return { user }
95
Authentication Middleware:
const router = require('express').Router()
const bcrypt = require('bcryptjs')
const jwt = require('jsonwebtoken')
const { User, Doctor, registerValidation, loginValidation,
docRegisterValidation } = require('../models/user')
res.send(user)
})
practiceNumber: req.body.practiceNumber,
idCardNr: req.body.idCardNr,
type: 'doctor',
approved: false,
contactList: [],
profilePic: '',
degree: '',
departament: '',
profileInfo: [],
raters: 0,
rating: 0
})
doc = await doc.save()
res.send(doc)
})
})
res.send(doc)
99
})
res.send(doc)
})
res.send(doc)
})
res.send(doc)
})
module.exports = router
Chat Middleware(Chat.js):
const router = require('express').Router()
const bcrypt = require('bcryptjs')
const jwt = require('jsonwebtoken')
const { User, Doctor, registerValidation, loginValidation,
docRegisterValidation } = require('../models/user')
res.send(user)
})
res.send(doc)
})
incorrect')
})
res.send(doc)
})
res.send(doc)
})
res.send(doc)
})
res.send(doc)
})
module.exports = router
User Model(User.js):
const mongooose = require('mongoose')
const Joi = require('joi')
104
},
idCardNr: {
type: String,
required: true,
},
type: {
type: String
},
approved: {
type: Boolean
},
contactList: {
type: Array
},
rating: {
type: Number
},
raters: {
type: Number
},
profilePic: {
type: String
},
degree: {
type: String
},
departament: {
type: String
},
profileInfo: {
type: Array
}
})
email: Joi.string().min(6).required().email(),
password: Joi.string().min(8).required(),
idCardNr: Joi.string().min(6).required(),
practiceNumber: Joi.string().min(6).required(),
}
return Joi.validate(user, schema)
}
module.exports.docRegisterValidation = docRegisterValidation
module.exports.loginValidation = loginValidation
module.exports.registerValidation = registerValidation
module.exports.User = mongooose.model('User', userSchema)
module.exports.Doctor = mongooose.model('Doctor', docSchema)