├── CMC
├── .gitignore
├── WebContent
│ ├── META-INF
│ │ └── MANIFEST.MF
│ ├── media
│ │ ├── bmi.png
│ │ ├── admin.png
│ │ ├── edit.png
│ │ ├── user.png
│ │ ├── Location.png
│ │ ├── degree.png
│ │ ├── doctor.png
│ │ ├── gender.png
│ │ ├── patient.png
│ │ ├── bloodGroup.png
│ │ ├── labPerson.png
│ │ ├── appointment.png
│ │ ├── prescription.png
│ │ ├── receptionist.png
│ │ └── specialization.png
│ ├── css
│ │ ├── admin.css
│ │ ├── lab.css
│ │ ├── patient.css
│ │ ├── doctor.css
│ │ ├── appointment.css
│ │ ├── signup.css
│ │ ├── login.css
│ │ └── dashboard.css
│ ├── WEB-INF
│ │ ├── lib
│ │ │ └── mysql-connector-java-5.1.41-bin.jar
│ │ └── web.xml
│ ├── login.jsp
│ ├── editLabPersonProfile.jsp
│ ├── editAdminProfile.jsp
│ ├── labPerson.jsp
│ ├── receptionist.jsp
│ ├── signup.jsp
│ ├── doctor.jsp
│ ├── patient.jsp
│ ├── bookAppointment.jsp
│ └── editReceptionistProfile.jsp
└── src
│ ├── staff
│ ├── modal
│ │ ├── Staff.java
│ │ └── Doctor.java
│ └── servlet
│ │ ├── EditAdminProfile.java
│ │ ├── EditDoctorProfile.java
│ │ ├── LabReportOpen.java
│ │ ├── EditLabPersonProfile.java
│ │ ├── SubmitLabReport.java
│ │ ├── UpdateAdminProfile.java
│ │ ├── EditReceptionistProfile.java
│ │ ├── UpdateLabPersonProfile.java
│ │ ├── AllocateDoctor.java
│ │ ├── UpdateDoctorProfile.java
│ │ ├── LabPersonServlet.java
│ │ ├── UpdateReceptionistProfile.java
│ │ ├── DoctorServlet.java
│ │ ├── ReceptionistServlet.java
│ │ ├── AdminServlet.java
│ │ ├── DoctorAppointmentDetails.java
│ │ └── ReceptionistAppointmentDetails.java
│ ├── database
│ └── DatabaseConnector.java
│ ├── modal
│ ├── AppointmentItemType.java
│ ├── PersonType.java
│ ├── AppointmentItems.java
│ ├── Person.java
│ └── Appointment.java
│ ├── authentication
│ ├── Logout.java
│ ├── Signup.java
│ └── Login.java
│ ├── utils
│ ├── DateUtils.java
│ └── DashUtils.java
│ ├── patient
│ ├── modal
│ │ ├── DashBoard.java
│ │ └── Patient.java
│ └── servlet
│ │ ├── CloseAppointment.java
│ │ ├── EditProfile.java
│ │ ├── UpdatePatientProfile.java
│ │ ├── OpenBookAppointment.java
│ │ ├── BookAppointment.java
│ │ ├── PatientServlet.java
│ │ ├── PatientAppointmentDetails.java
│ │ └── NewAppointmentItem.java
│ └── prescription
│ ├── Prescription.java
│ └── Lab.java
├── Screenshots
├── Login.png
├── Signup.png
├── AdminDashboard.png
├── DoctorDashboard.png
├── PatientDashboard.png
├── ReceptionistDashboard.png
├── AdminDashboard-StaffList.png
├── AdminDashboard-DoctorList.png
├── AdminDashboard-PatientList.png
├── AdminDashboard-AppointmentList.png
├── PatientDashboard-BookAppointment.png
├── LabPersonDashboard-OpenLabReports.png
├── LabPersonDashboard-ClosedLabReports.png
├── ReceptionistDashboard-AllocateDoctor.png
└── PatientDashboard-ViewAppointmentDetails.png
├── constituent
└── SRS_Group_38.pdf
├── .gitignore
├── LICENSE
├── README.md
└── Database
├── cmc_personType.sql
├── cmc_appointmentItemsType.sql
├── cmc_doctor.sql
├── cmc_prescription.sql
├── cmc_patient.sql
├── cmc_lab.sql
├── cmc_appointmentItems.sql
├── cmc_appointment.sql
└── cmc_person.sql
/CMC/.gitignore:
--------------------------------------------------------------------------------
1 | /build/
2 | /bin/
3 |
--------------------------------------------------------------------------------
/CMC/WebContent/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Class-Path:
3 |
4 |
--------------------------------------------------------------------------------
/Screenshots/Login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/Login.png
--------------------------------------------------------------------------------
/Screenshots/Signup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/Signup.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/bmi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/bmi.png
--------------------------------------------------------------------------------
/constituent/SRS_Group_38.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/constituent/SRS_Group_38.pdf
--------------------------------------------------------------------------------
/CMC/WebContent/media/admin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/admin.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/edit.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/user.png
--------------------------------------------------------------------------------
/Screenshots/AdminDashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/AdminDashboard.png
--------------------------------------------------------------------------------
/CMC/WebContent/css/admin.css:
--------------------------------------------------------------------------------
1 | .tableHere{
2 | margin-top: 25px;
3 | }
4 | .padding-up{
5 | padding-top: 14px !important;
6 |
7 | }
--------------------------------------------------------------------------------
/CMC/WebContent/media/Location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/Location.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/degree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/degree.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/doctor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/doctor.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/gender.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/gender.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/patient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/patient.png
--------------------------------------------------------------------------------
/Screenshots/DoctorDashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/DoctorDashboard.png
--------------------------------------------------------------------------------
/Screenshots/PatientDashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/PatientDashboard.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/bloodGroup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/bloodGroup.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/labPerson.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/labPerson.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/appointment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/appointment.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/prescription.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/prescription.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/receptionist.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/receptionist.png
--------------------------------------------------------------------------------
/Screenshots/ReceptionistDashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/ReceptionistDashboard.png
--------------------------------------------------------------------------------
/CMC/WebContent/media/specialization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/media/specialization.png
--------------------------------------------------------------------------------
/Screenshots/AdminDashboard-StaffList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/AdminDashboard-StaffList.png
--------------------------------------------------------------------------------
/Screenshots/AdminDashboard-DoctorList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/AdminDashboard-DoctorList.png
--------------------------------------------------------------------------------
/Screenshots/AdminDashboard-PatientList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/AdminDashboard-PatientList.png
--------------------------------------------------------------------------------
/Screenshots/AdminDashboard-AppointmentList.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/AdminDashboard-AppointmentList.png
--------------------------------------------------------------------------------
/Screenshots/PatientDashboard-BookAppointment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/PatientDashboard-BookAppointment.png
--------------------------------------------------------------------------------
/Screenshots/LabPersonDashboard-OpenLabReports.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/LabPersonDashboard-OpenLabReports.png
--------------------------------------------------------------------------------
/Screenshots/LabPersonDashboard-ClosedLabReports.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/LabPersonDashboard-ClosedLabReports.png
--------------------------------------------------------------------------------
/Screenshots/ReceptionistDashboard-AllocateDoctor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/ReceptionistDashboard-AllocateDoctor.png
--------------------------------------------------------------------------------
/Screenshots/PatientDashboard-ViewAppointmentDetails.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/Screenshots/PatientDashboard-ViewAppointmentDetails.png
--------------------------------------------------------------------------------
/CMC/WebContent/WEB-INF/lib/mysql-connector-java-5.1.41-bin.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jainkuniya/central-medic-center/HEAD/CMC/WebContent/WEB-INF/lib/mysql-connector-java-5.1.41-bin.jar
--------------------------------------------------------------------------------
/CMC/WebContent/css/lab.css:
--------------------------------------------------------------------------------
1 | .tableHere{
2 | margin-top: 25px;
3 | }
4 | .padding-up{
5 | padding-top: 14px !important;
6 |
7 | }
8 | .labReports{
9 | padding-left: 20px;
10 | padding-top: 10px;
11 | padding-bottom: 10px;
12 | }
13 | .labReports:hover,.activeReports{
14 | color:#fff;
15 | background-color: #428bca;
16 | }
17 | .notActiveReports{
18 | background-color: #F5F5F5;
19 | color: #333333;
20 | }
--------------------------------------------------------------------------------
/CMC/WebContent/css/patient.css:
--------------------------------------------------------------------------------
1 | .card {
2 | border-width: 1px;
3 | border-style: solid;
4 | }
5 |
6 | .cardImage {
7 | display: flex;
8 | justify-content: center;
9 | align-items: center;
10 | padding: 20px;
11 | }
12 |
13 | .cardText {
14 | display: flex;
15 | justify-content: center;
16 | align-items: center;
17 | background-color: #222222;
18 | color: white;
19 | padding: 20px;
20 | font-size: larger;
21 | }
--------------------------------------------------------------------------------
/CMC/src/staff/modal/Staff.java:
--------------------------------------------------------------------------------
1 | package staff.modal;
2 |
3 |
4 | import modal.Person;
5 |
6 |
7 | public class Staff extends Person{
8 |
9 | public Staff(int id, String firstName, String lastName, String userName, long dob, int type, String gender,
10 | String address, String contactNumber) {
11 | super(id, firstName, lastName, userName, dob, type, gender, address, contactNumber);
12 |
13 | }
14 |
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/CMC/src/database/DatabaseConnector.java:
--------------------------------------------------------------------------------
1 | package database;
2 |
3 | import java.sql.*;
4 |
5 | public class DatabaseConnector {
6 |
7 | public static Connection getDatabase() {
8 |
9 | try {
10 | Class.forName("com.mysql.jdbc.Driver");
11 | Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/cmc?autoReconnect=true&useSSL=false", "root", "root");
12 |
13 | return con;
14 | } catch (Exception e) {
15 | System.out.println(e);
16 | }
17 |
18 | return null;
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/CMC/WebContent/css/doctor.css:
--------------------------------------------------------------------------------
1 | .card {
2 | border-width: 1px;
3 | border-style: solid;
4 | }
5 |
6 | .cardImage {
7 | display: flex;
8 | justify-content: center;
9 | align-items: center;
10 | padding: 20px;
11 | }
12 |
13 | .cardText {
14 | display: flex;
15 | justify-content: center;
16 | align-items: center;
17 | background-color: #222222;
18 | color: white;
19 | padding: 20px;
20 | font-size: larger;
21 | }
22 | .prescriptionOptions, .LabReportOptions{
23 | margin-top:20px;
24 | margin-bottom:20px;
25 | }
26 | .LabReportOptions .form-group{
27 | width:100%;
28 | }
--------------------------------------------------------------------------------
/CMC/WebContent/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | CMC
4 |
5 | index.html
6 | index.htm
7 | index.jsp
8 | default.html
9 | default.htm
10 | default.jsp
11 |
12 |
--------------------------------------------------------------------------------
/CMC/src/modal/AppointmentItemType.java:
--------------------------------------------------------------------------------
1 | package modal;
2 |
3 | public class AppointmentItemType {
4 |
5 | private int typeId;
6 | private String description;
7 |
8 | public AppointmentItemType(int typeId, String description) {
9 | this.typeId = typeId;
10 | this.description = description;
11 | }
12 |
13 |
14 |
15 | public AppointmentItemType(String description) {
16 | this.description = description;
17 | }
18 |
19 |
20 |
21 | public String getDescription() {
22 | return description;
23 | }
24 | public void setDescription(String description) {
25 | this.description = description;
26 | }
27 | public int getTypeId() {
28 | return typeId;
29 | }
30 |
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 |
11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12 | hs_err_pid*
13 |
14 | # the dist file could make some problems
15 | # dist/
16 | nbdist/
17 | nbactions.xml
18 | nb-configuration.xml
19 | .nb-gradle/
20 |
21 | # Eclipse
22 | .classpath
23 | .project
24 | .settings/
25 |
26 | # Intellij
27 | .idea/
28 | *.iml
29 | *.iws
30 |
31 | # Mac
32 | .DS_Store
33 |
34 | # Maven
35 | log/
36 | target/
37 | pom.xml.tag
38 | pom.xml.releaseBackup
39 | pom.xml.versionsBackup
40 | pom.xml.next
41 | release.properties
42 | dependency-reduced-pom.xml
43 |
--------------------------------------------------------------------------------
/CMC/src/modal/PersonType.java:
--------------------------------------------------------------------------------
1 | package modal;
2 |
3 | public class PersonType {
4 |
5 | private int typeId;
6 | private String description;
7 | private String type;
8 |
9 | public PersonType(int typeId, String description, String type) {
10 | this.typeId = typeId;
11 | this.description = description;
12 | this.type = type;
13 | }
14 |
15 |
16 | public PersonType(String description, String type) {
17 | this.description = description;
18 | this.type = type;
19 | }
20 |
21 |
22 | public int getTypeId() {
23 | return typeId;
24 | }
25 | public String getDescription() {
26 | return description;
27 | }
28 | public void setDescription(String description) {
29 | this.description = description;
30 | }
31 | public String getType() {
32 | return type;
33 | }
34 | public void setType(String type) {
35 | this.type = type;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/CMC/WebContent/css/appointment.css:
--------------------------------------------------------------------------------
1 | .main {
2 | background-color: #EFEEEF;
3 | }
4 |
5 | .content {
6 | transition: 0.3s;
7 | box-shadow: 1px 2px 3px 0 rgba(0, 0, 0, .10);
8 | background-color: white;
9 | padding: 20px;
10 | margin-bottom: 20px;
11 | }
12 |
13 | .content:hover {
14 | box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
15 | }
16 |
17 | .messageBox {
18 | padding: 0px !important;
19 | }
20 |
21 | .messageFrom {
22 | border-style: solid;
23 | border-width: 1px;
24 | text-align: center;
25 | font-weight: bold;
26 | padding: 10px;
27 | margin-right: -10px;
28 | }
29 |
30 | .message {
31 | border-style: solid;
32 | border-width: 1px;
33 | padding: 10px;
34 | margin-left: -10px;
35 | }
36 |
37 | .dateStamp {
38 | font-size: 2px;
39 | }
40 |
41 | .form-control {
42 | width: 100% !important;
43 | }
44 |
45 | .send {
46 | height: 75px;
47 | font-weight: bold;
48 | font-size: 20px;
49 | width: 100% !important;
50 | }
51 |
--------------------------------------------------------------------------------
/CMC/WebContent/css/signup.css:
--------------------------------------------------------------------------------
1 | @import "bourbon";
2 |
3 | body {
4 | background: #eee !important;
5 | }
6 |
7 | .form-signup {
8 | max-width: 720px;
9 | padding: 15px 35px 45px;
10 | margin: 0 auto;
11 | background-color: #fff;
12 | border: 1px solid rgba(0, 0, 0, 0.1);
13 | .
14 | form-signin-heading
15 | ,
16 | .checkbox
17 | {
18 | margin-bottom
19 | :
20 | 30px;
21 | }
22 |
23 | .checkbox {
24 | font-weight: normal;
25 | }
26 |
27 | .form-control {
28 | position: relative;
29 | font-size: 16px;
30 | height: auto;
31 | padding: 10px;
32 | @
33 | include
34 | box-sizing(border-box);
35 | &:
36 | focus
37 | {
38 | z-index
39 | :
40 | 2;
41 | }
42 |
43 | }
44 | input[type="text"] {
45 | margin-bottom: -1px;
46 | border-bottom-left-radius: 0;
47 | border-bottom-right-radius: 0;
48 | }
49 |
50 | input[type="password"] {
51 | margin-bottom: 20px;
52 | border-top-left-radius: 0;
53 | border-top-right-radius: 0;
54 | }
55 | }
--------------------------------------------------------------------------------
/CMC/WebContent/css/login.css:
--------------------------------------------------------------------------------
1 | @import "bourbon";
2 |
3 | body {
4 | background: #eee !important;
5 | }
6 |
7 | .wrapper {
8 | margin-top: 80px;
9 | margin-bottom: 80px;
10 | }
11 |
12 | .form-signin {
13 | max-width: 380px;
14 | padding: 15px 35px 45px;
15 | margin: 0 auto;
16 | background-color: #fff;
17 | border: 1px solid rgba(0, 0, 0, 0.1);
18 | .
19 | form-signin-heading
20 | ,
21 | .checkbox
22 | {
23 | margin-bottom
24 | :
25 | 30px;
26 | }
27 |
28 | .checkbox {
29 | font-weight: normal;
30 | }
31 |
32 | .form-control {
33 | position: relative;
34 | font-size: 16px;
35 | height: auto;
36 | padding: 10px;
37 | @
38 | include
39 | box-sizing(border-box);
40 | &:
41 | focus
42 | {
43 | z-index
44 | :
45 | 2;
46 | }
47 |
48 | }
49 | input[type="text"] {
50 | margin-bottom: -1px;
51 | border-bottom-left-radius: 0;
52 | border-bottom-right-radius: 0;
53 | }
54 |
55 | input[type="password"] {
56 | margin-bottom: 20px;
57 | border-top-left-radius: 0;
58 | border-top-right-radius: 0;
59 | }
60 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Vishwesh Jainkuniya, Vishal Sanghai, Shubham Mangal, Vivek K. Tiwari
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/CMC/src/authentication/Logout.java:
--------------------------------------------------------------------------------
1 | package authentication;
2 |
3 | import java.io.IOException;
4 | import javax.servlet.ServletException;
5 | import javax.servlet.annotation.WebServlet;
6 | import javax.servlet.http.HttpServlet;
7 | import javax.servlet.http.HttpServletRequest;
8 | import javax.servlet.http.HttpServletResponse;
9 | import javax.servlet.http.HttpSession;
10 |
11 | /**
12 | * Servlet implementation class Logout
13 | */
14 | @WebServlet("/logout")
15 | public class Logout extends HttpServlet {
16 | private static final long serialVersionUID = 1L;
17 |
18 | /**
19 | * @see HttpServlet#HttpServlet()
20 | */
21 | public Logout() {
22 | super();
23 |
24 | }
25 |
26 | /**
27 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
28 | */
29 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
30 |
31 | HttpSession session;
32 | session = request.getSession();
33 | session.invalidate();
34 | response.sendRedirect("login.jsp");
35 | // request.getRequestDispatcher("login.jsp").forward(request, response);
36 | }
37 |
38 | /**
39 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
40 | */
41 |
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/CMC/src/utils/DateUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import java.util.Calendar;
4 | import java.util.Date;
5 | import java.text.SimpleDateFormat;
6 |
7 | public class DateUtils {
8 |
9 | static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
10 |
11 | public static long getLongFromDate(String stringDate){
12 | try {
13 | Date d = (Date) simpleDateFormat.parse(stringDate);
14 | return d.getTime();
15 | } catch (Exception e) {
16 | e.printStackTrace();
17 | return 0;
18 | }
19 | }
20 |
21 | public static String getStringFromDate(long longDate){
22 | Date date=new Date(longDate);
23 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
24 | return simpleDateFormat.format(date);
25 | }
26 |
27 | public static String getDateTtimeSringFromDate(long longDate){
28 | Date date=new Date(longDate);
29 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd, hh:mm:aa");
30 | return simpleDateFormat.format(date);
31 | }
32 |
33 | public static int getYearsFromLong(long longDate){
34 | Date date = new Date(longDate);
35 | Calendar cal = Calendar.getInstance();
36 | Calendar currentCal = Calendar.getInstance();
37 | cal.setTime(date);
38 | return currentCal.get(Calendar.YEAR) - cal.get(Calendar.YEAR);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/CMC/src/patient/modal/DashBoard.java:
--------------------------------------------------------------------------------
1 | package patient.modal;
2 |
3 | public class DashBoard {
4 |
5 | private int noOfAppointment;
6 | private double bmi;
7 | private int noOfMedicines;
8 | private int percentProfile;
9 | private int patientCount;
10 | private int totalAppointment;
11 | private int unapproveAppointment;
12 |
13 | public DashBoard(int noOfAppointment, double bmi, int noOfMedicines, int percentProfile) {
14 | this.noOfAppointment = noOfAppointment;
15 | this.bmi = bmi;
16 | this.noOfMedicines = noOfMedicines;
17 | this.percentProfile = percentProfile;
18 | }
19 |
20 |
21 | public DashBoard(int noOfAppointment, int patientCount, int percentProfile) {
22 | this.noOfAppointment = noOfAppointment;
23 | this.patientCount = patientCount;
24 | this.percentProfile = percentProfile;
25 | }
26 |
27 |
28 | public int getPatientCount() {
29 | return patientCount;
30 | }
31 |
32 | public int getNoOfAppointment() {
33 | return noOfAppointment;
34 | }
35 |
36 | public double getBmi() {
37 | return bmi;
38 | }
39 |
40 | public int getNoOfMedicines() {
41 | return noOfMedicines;
42 | }
43 |
44 | public int getPercentProfile() {
45 | return percentProfile;
46 | }
47 |
48 |
49 | public int getTotalAppointment() {
50 | return totalAppointment;
51 | }
52 |
53 |
54 | public int getUnapproveAppointment() {
55 | return unapproveAppointment;
56 | }
57 |
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/CMC/src/prescription/Prescription.java:
--------------------------------------------------------------------------------
1 | package prescription;
2 |
3 | public class Prescription {
4 |
5 | private int medicineId;
6 | private String medicineName;
7 | private double quantity;
8 | private int times;
9 | private int itemId;
10 |
11 | public Prescription(int medicineId, String medicineName, double quantity, int times, int itemId) {
12 | this.medicineId = medicineId;
13 | this.medicineName = medicineName;
14 | this.quantity = quantity;
15 | this.times = times;
16 | this.itemId = itemId;
17 | }
18 |
19 |
20 |
21 | public Prescription(String medicineName, double quantity, int times, int itemId) {
22 | this.medicineName = medicineName;
23 | this.quantity = quantity;
24 | this.times = times;
25 | this.itemId = itemId;
26 | }
27 |
28 |
29 |
30 | public int getMedicineId() {
31 | return medicineId;
32 | }
33 | public String getMedicineName() {
34 | return medicineName;
35 | }
36 | public void setMedicineName(String medicineName) {
37 | this.medicineName = medicineName;
38 | }
39 | public double getQuantity() {
40 | return quantity;
41 | }
42 | public void setQuantity(double quantity) {
43 | this.quantity = quantity;
44 | }
45 | public int getTimes() {
46 | return times;
47 | }
48 | public void setTimes(int times) {
49 | this.times = times;
50 | }
51 | public int getItemId() {
52 | return itemId;
53 | }
54 | public void setItemId(int itemId) {
55 | this.itemId = itemId;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/CMC/src/patient/modal/Patient.java:
--------------------------------------------------------------------------------
1 | package patient.modal;
2 |
3 |
4 | import modal.Person;
5 |
6 |
7 |
8 | public class Patient extends Person {
9 |
10 | private int height;
11 | private int weight;
12 | private String bloodGroup;
13 |
14 | public Patient(int id, String firstName, String lastName, String userName, long dob, int type, String gender,
15 | String address, String contactNumber, int weight, int height, String bloodGroup) {
16 | super(id, firstName, lastName, userName, dob, type, gender, address, contactNumber);
17 | this.height = height;
18 | this.weight = weight;
19 | this.bloodGroup = bloodGroup;
20 | }
21 |
22 |
23 |
24 | public Patient(String firstName, String lastName, String userName, long dob, int type, String gender,
25 | String address, String contactNumber, int height, int weight, String bloodGroup) {
26 | super(firstName, lastName, userName, dob, type, gender, address, contactNumber);
27 | this.height = height;
28 | this.weight = weight;
29 | this.bloodGroup = bloodGroup;
30 | }
31 |
32 |
33 |
34 | public String getBloodGroup() {
35 | return bloodGroup;
36 | }
37 |
38 | public void setBloodGroup(String bloodGroup) {
39 | this.bloodGroup = bloodGroup;
40 | }
41 |
42 | public int getHeight() {
43 | return height;
44 | }
45 |
46 | public void setHeight(int height) {
47 | this.height = height;
48 | }
49 |
50 | public int getWeight() {
51 | return weight;
52 | }
53 |
54 | public void setWeight(int weight) {
55 | this.weight = weight;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/CMC/src/modal/AppointmentItems.java:
--------------------------------------------------------------------------------
1 | package modal;
2 |
3 | import utils.DateUtils;
4 |
5 | public class AppointmentItems {
6 | private int itemId;
7 | private long date;
8 | private int type;
9 | private String description;
10 | private int appointmentId;
11 |
12 | public AppointmentItems(int itemId, long date, int type, String description, int appointmentId) {
13 | this.itemId = itemId;
14 | this.date = date;
15 | this.type = type;
16 | this.description = description;
17 | this.appointmentId = appointmentId;
18 | }
19 |
20 | public AppointmentItems(long date, int type, String description, int appointmentId) {
21 | this.date = date;
22 | this.type = type;
23 | this.description = description;
24 | this.appointmentId = appointmentId;
25 | }
26 |
27 | public long getDate() {
28 | return date;
29 | }
30 |
31 | public String getStringDate() {
32 | return DateUtils.getDateTtimeSringFromDate(date);
33 | }
34 |
35 | public void setDate(long date) {
36 | this.date = date;
37 | }
38 |
39 | public String getDescription() {
40 | return description;
41 | }
42 |
43 | public void setDescription(String description) {
44 | this.description = description;
45 | }
46 |
47 | public int getType() {
48 | return type;
49 | }
50 |
51 | public void setType(int type) {
52 | this.type = type;
53 | }
54 |
55 | public int getAppointmentId() {
56 | return appointmentId;
57 | }
58 |
59 | public void setAppointmentId(int appointmentId) {
60 | this.appointmentId = appointmentId;
61 | }
62 |
63 | public int getItemId() {
64 | return itemId;
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/CMC/src/staff/modal/Doctor.java:
--------------------------------------------------------------------------------
1 | package staff.modal;
2 |
3 | import modal.Person;
4 |
5 |
6 |
7 | public class Doctor extends Person{
8 |
9 | private String degree;
10 | private String specialization;
11 |
12 | public Doctor(int id, String firstName, String lastName, String userName, long dob, int type, String gender,
13 | String address, String contactNumber, String degree, String specialization) {
14 | super(id, firstName, lastName, userName, dob, type, gender, address, contactNumber);
15 | this.degree = degree;
16 | this.specialization = specialization;
17 | }
18 |
19 |
20 |
21 | public Doctor(String firstName, String lastName, String userName, long dob, int type, String gender, String address,
22 | String contactNumber, String degree, String specialization) {
23 | super(firstName, lastName, userName, dob, type, gender, address, contactNumber);
24 | this.degree = degree;
25 | this.specialization = specialization;
26 | }
27 |
28 |
29 |
30 | public String getDegree() {
31 | return (degree==null) ? "" : degree;
32 | }
33 | /**
34 | * @param degree the degree to set
35 | */
36 | public void setDegree(String degree) {
37 | this.degree = degree;
38 | }
39 | /**
40 | * @return the specialization
41 | */
42 | public String getSpecialization() {
43 | return (specialization==null) ? "" : specialization;
44 | }
45 | /**
46 | * @param specialization the specialization to set
47 | */
48 | public void setSpecialization(String specialization) {
49 | this.specialization = specialization;
50 | }
51 |
52 |
53 |
54 |
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/CMC/src/authentication/Signup.java:
--------------------------------------------------------------------------------
1 | package authentication;
2 |
3 | import java.io.IOException;
4 | import javax.servlet.ServletException;
5 | import javax.servlet.annotation.WebServlet;
6 | import javax.servlet.http.HttpServlet;
7 | import javax.servlet.http.HttpServletRequest;
8 | import javax.servlet.http.HttpServletResponse;
9 |
10 | import database.DatabaseHelper;
11 |
12 | /**
13 | * Servlet implementation class Signup
14 | */
15 | @WebServlet("/signup")
16 | public class Signup extends HttpServlet {
17 | private static final long serialVersionUID = 1L;
18 |
19 | /**
20 | * @see HttpServlet#HttpServlet()
21 | */
22 | public Signup() {
23 | super();
24 |
25 | }
26 |
27 | /**
28 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
29 | */
30 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
31 |
32 |
33 | request.getRequestDispatcher("signup.jsp").forward(request, response);
34 |
35 | }
36 |
37 | /**
38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
39 | */
40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
41 |
42 | String username = request.getParameter("userName");
43 | int check = new DatabaseHelper().checkPerson(username);
44 |
45 | switch(check){
46 | case 0:
47 | request.setAttribute("error", "user already exist");
48 | request.getRequestDispatcher("signup.jsp").forward(request, response);
49 |
50 | break;
51 | case 1:
52 | new DatabaseHelper().createPerson(request);
53 | request.getRequestDispatcher("login.jsp").forward(request, response);
54 | break;
55 | default:
56 | request.setAttribute("error", "error in signup");
57 | request.getRequestDispatcher("signup.jsp").forward(request, response);
58 | break;
59 |
60 | }
61 |
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/CMC/src/prescription/Lab.java:
--------------------------------------------------------------------------------
1 | package prescription;
2 |
3 | import staff.modal.Doctor;
4 |
5 | public class Lab {
6 |
7 | private int labId;
8 | private String labName;
9 | private String testFor;
10 | private String labResult;
11 | private String reportFile;
12 | private int itemId;
13 | private Doctor doctor;
14 |
15 | public Lab(int labId, String labName, String testFor, String labResult, String reportFile, int itemId, Doctor doctor) {
16 | this.labId = labId;
17 | this.labName = labName;
18 | this.testFor = testFor;
19 | this.labResult = labResult;
20 | this.reportFile = reportFile;
21 | this.itemId = itemId;
22 | this.doctor = doctor;
23 | }
24 |
25 |
26 |
27 | public Lab(String labName, String testFor, String labResult, String reportFile, int itemId, Doctor doctor) {
28 | this.labName = labName;
29 | this.testFor = testFor;
30 | this.labResult = labResult;
31 | this.reportFile = reportFile;
32 | this.itemId = itemId;
33 | this.doctor = doctor;
34 | }
35 |
36 |
37 |
38 | public int getLabId() {
39 | return labId;
40 | }
41 | public String getLabName() {
42 | return labName;
43 | }
44 | public void setLabName(String labName) {
45 | this.labName = labName;
46 | }
47 | public String getTestFor() {
48 | return testFor;
49 | }
50 | public void setTestFor(String testFor) {
51 | this.testFor = testFor;
52 | }
53 | public String getLabResult() {
54 | return labResult;
55 | }
56 | public void setLabResult(String labResult) {
57 | this.labResult = labResult;
58 | }
59 | public String getReportFile() {
60 | return reportFile;
61 | }
62 | public void setReportFile(String reportFile) {
63 | this.reportFile = reportFile;
64 | }
65 | public int getItemId() {
66 | return itemId;
67 | }
68 | public void setItemId(int itemId) {
69 | this.itemId = itemId;
70 | }
71 |
72 |
73 |
74 | public Doctor getDoctor() {
75 | return doctor;
76 | }
77 |
78 |
79 |
80 | public void setDoctorId(Doctor doctor) {
81 | this.doctor = doctor;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/CMC/WebContent/css/dashboard.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding-top: 50px;
3 | }
4 |
5 | .sidebar {
6 | display: none;
7 | }
8 |
9 | ul {
10 | list-style-type: none;
11 | padding-left: 20px;
12 | }
13 |
14 | @media ( min-width : 768px) {
15 | .sidebar {
16 | position: fixed;
17 | top: 50px;
18 | bottom: 0;
19 | left: 0;
20 | z-index: 1000;
21 | display: block;
22 | padding: 20px;
23 | overflow-x: hidden;
24 | overflow-y: auto;
25 | /* Scrollable contents if viewport is shorter than content. */
26 | background-color: #f5f5f5;
27 | border-right: 1px solid #eee;
28 | }
29 | }
30 |
31 | /* Sidebar navigation */
32 | .nav-sidebar {
33 | margin-right: -21px; /* 20px padding + 1px border */
34 | margin-bottom: 20px;
35 | margin-left: -20px;
36 | }
37 |
38 | .nav-sidebar>li>a {
39 | padding-right: 20px;
40 | padding-left: 20px;
41 | }
42 |
43 | .topic {
44 | padding: 20px;
45 | padding-top: 0px;
46 | padding-bottom: 10px;
47 | }
48 |
49 | .btn-default {
50 | width: 95%;
51 | background-color: #F5F5F5;
52 | border-style: none;
53 | }
54 |
55 | .activeAppointment {
56 | background-color: #E6E6E6;
57 | }
58 |
59 | .text-left {
60 | text-align: left;
61 | }
62 |
63 | .text-right {
64 | text-align: right;
65 | }
66 |
67 | .nav-sidebar>.active>a,.nav-sidebar>.active>a:hover,.nav-sidebar>.active>a:focus,{
68 | color:#fff;
69 | background-color: #428bca;
70 | }
71 | .main {
72 | padding: 20px;
73 | height: 100%;
74 | }
75 |
76 | @media ( min-width : 768px) {
77 | .main {
78 | padding-right: 40px;
79 | padding-left: 40px;
80 | }
81 | }
82 |
83 | .main .page-header {
84 | margin-top: 0;
85 | text-align: center;
86 | }
87 |
88 | .sub-header {
89 | padding-bottom: 10px;
90 | border-bottom: 1px solid #eee;
91 | }
92 |
93 | .intro {
94 | margin: 10px;
95 | margin-bottom: 25px;
96 | }
97 |
98 | .profilePic {
99 | width: 100px;
100 | }
101 |
102 | .info {
103 | padding-left: 25px;
104 | }
105 |
106 | .info img {
107 | width: 16px;
108 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # central-medic-center
2 | Centeral Medic Center is a Hospital Management System made for our 'OOP with JAVA'course project.
3 |
4 | ## Dashboards
5 | * Patient
6 | * Doctor
7 | * Receptionist
8 | * Lab Person
9 | * Admin
10 |
11 | ## Technologies Used
12 | Java, Eclipse J2EE IDE, JSP, MySQL, Apache Tomcat 8.5.
13 |
14 | ### Our Project Proposal
15 | [SRS of CMC](./constituent/SRS_Group_38.pdf).
16 |
17 | ## Screenshots
18 |
19 |
20 |
21 |
22 | ### Patient Dashboard
23 |
24 |
25 |
26 |
27 |
28 | ### Doctor Dashboard
29 |
30 |
31 |
32 | ### Admin Dashboard
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | ### Lab Person Dashboard
41 |
42 |
43 |
44 |
45 | ### Receptionist Dashboard
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Database/cmc_personType.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Linux (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.17-0ubuntu0.16.10.1
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `personType`
20 | --
21 |
22 | DROP TABLE IF EXISTS `personType`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `personType` (
26 | `typeId` int(11) NOT NULL AUTO_INCREMENT,
27 | `description` varchar(45) DEFAULT NULL,
28 | `type` varchar(10) DEFAULT NULL,
29 | PRIMARY KEY (`typeId`),
30 | UNIQUE KEY `id_UNIQUE` (`typeId`)
31 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
32 | /*!40101 SET character_set_client = @saved_cs_client */;
33 |
34 | --
35 | -- Dumping data for table `personType`
36 | --
37 |
38 | LOCK TABLES `personType` WRITE;
39 | /*!40000 ALTER TABLE `personType` DISABLE KEYS */;
40 | INSERT INTO `personType` VALUES (1,'Patient','Patient'),(2,'Doctor','Doctor'),(3,'Admin','Admin'),(4,'Lab Person','LabPerson'),(5,'Receptionist','Reception');
41 | /*!40000 ALTER TABLE `personType` ENABLE KEYS */;
42 | UNLOCK TABLES;
43 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
44 |
45 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
46 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
47 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
48 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
49 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
50 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
51 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
52 |
53 | -- Dump completed on 2017-04-20 22:01:20
54 |
--------------------------------------------------------------------------------
/Database/cmc_appointmentItemsType.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Linux (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.17-0ubuntu0.16.10.1
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `appointmentItemsType`
20 | --
21 |
22 | DROP TABLE IF EXISTS `appointmentItemsType`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `appointmentItemsType` (
26 | `typeId` int(11) NOT NULL AUTO_INCREMENT,
27 | `description` varchar(45) DEFAULT NULL,
28 | PRIMARY KEY (`typeId`)
29 | ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
30 | /*!40101 SET character_set_client = @saved_cs_client */;
31 |
32 | --
33 | -- Dumping data for table `appointmentItemsType`
34 | --
35 |
36 | LOCK TABLES `appointmentItemsType` WRITE;
37 | /*!40000 ALTER TABLE `appointmentItemsType` DISABLE KEYS */;
38 | INSERT INTO `appointmentItemsType` VALUES (1,'Message from Doctor'),(2,'Message from Patient'),(3,'Prescription'),(4,'Lab Report'),(5,'Request For Lab Report'),(6,'System');
39 | /*!40000 ALTER TABLE `appointmentItemsType` ENABLE KEYS */;
40 | UNLOCK TABLES;
41 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
42 |
43 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
44 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
45 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
46 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
47 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
48 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
49 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
50 |
51 | -- Dump completed on 2017-04-20 22:01:20
52 |
--------------------------------------------------------------------------------
/CMC/WebContent/login.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" import="java.io.*,java.util.*"%>
3 | <%
4 |
5 | if (!session.isNew() && session.getAttribute("UserID")!=null){
6 | Date lastAccessTime = new Date(session.getLastAccessedTime());
7 | session.setAttribute("LastAccess", lastAccessTime);
8 | String type = (String) session.getAttribute("UserType");
9 |
10 | if(type.equals("patient")){
11 | response.sendRedirect("patient");
12 | }
13 | else if(type.equals("doctor")){
14 | response.sendRedirect("doctor");
15 | }
16 | else if(type.equals("admin")){
17 | response.sendRedirect("admin");
18 | }
19 | else if(type.equals("labPerson")){
20 | response.sendRedirect("labPerson");
21 | }
22 | else if(type.equals("receptionist")){
23 | response.sendRedirect("receptionist");
24 | }
25 |
26 | }
27 | else{
28 | %>
29 |
30 |
31 |
32 |
33 | Login - Central Medic Center
34 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | Central Medic Center
45 |
46 |
71 |
72 |
73 | <%
74 | }
75 | %>
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/CloseAppointment.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 |
12 | import database.DatabaseHelper;
13 |
14 | /**
15 | * Servlet implementation class CloseAppointment
16 | */
17 | @WebServlet("/closeAppointment")
18 | public class CloseAppointment extends HttpServlet {
19 | private static final long serialVersionUID = 1L;
20 |
21 | /**
22 | * @see HttpServlet#HttpServlet()
23 | */
24 | public CloseAppointment() {
25 | super();
26 |
27 | }
28 |
29 | /**
30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
31 | */
32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
33 | //redirect to login
34 | redirectToLogin(request, response);
35 | }
36 |
37 | /**
38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
39 | */
40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
41 | try{
42 | int appointmentId = Integer.valueOf(request.getParameter("appointmentId"));
43 | String by = (String)request.getParameter("by");
44 | int status = new DatabaseHelper().closeAppointment(appointmentId, by);
45 | if (status > 0) {
46 | // successfully inserted
47 | RequestDispatcher rs;
48 | rs = request.getRequestDispatcher((String)request.getParameter("requestDispatcher"));
49 | request.setAttribute("appointmentId", appointmentId);
50 | rs.forward(request, response);
51 | } else {
52 | // redirect to login
53 | redirectToLogin(request, response);
54 | }
55 | }catch(Exception e){
56 | e.printStackTrace();
57 | // redirect to login
58 | redirectToLogin(request, response);
59 | }
60 | }
61 |
62 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
63 | throws ServletException, IOException {
64 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
65 | request.setAttribute("error", "Please login again");
66 | rs.forward(request, response);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/EditAdminProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 | import javax.servlet.http.HttpSession;
12 |
13 | import database.DatabaseHelper;
14 |
15 | /**
16 | * Servlet implementation class EditProfile
17 | */
18 | @WebServlet("/editAdminProfile")
19 | public class EditAdminProfile extends HttpServlet {
20 | private static final long serialVersionUID = 1L;
21 |
22 | /**
23 | * @see HttpServlet#HttpServlet()
24 | */
25 | public EditAdminProfile() {
26 | super();
27 |
28 | }
29 |
30 | /**
31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
32 | */
33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
34 |
35 | response.getWriter().append("Served at: ").append(request.getContextPath());
36 | }
37 |
38 | /**
39 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
40 | */
41 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
42 | //get admin
43 | try {
44 | HttpSession session = request.getSession();
45 | int adminId = (int) session.getAttribute("UserID");
46 | // get admin details
47 | DatabaseHelper databaseHelper = new DatabaseHelper();
48 | int status = databaseHelper.updatePerson(adminId, request);
49 | if(status>0)
50 | {
51 | //successfully updated
52 | request.getRequestDispatcher("admin").forward(request, response);
53 | return;
54 | }else
55 | {
56 | // redirect to login
57 | redirectToLogin(request, response);
58 | }
59 | return;
60 | } catch (Exception e) {
61 | // redirect to login
62 | redirectToLogin(request, response);
63 | }
64 | }
65 |
66 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
67 | throws ServletException, IOException {
68 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
69 | request.setAttribute("error", "Please login again");
70 | rs.forward(request, response);
71 | }
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/EditDoctorProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 | import javax.servlet.http.HttpSession;
12 |
13 | import database.DatabaseHelper;
14 |
15 | /**
16 | * Servlet implementation class EditProfile
17 | */
18 | @WebServlet("/editDoctorProfile")
19 | public class EditDoctorProfile extends HttpServlet {
20 | private static final long serialVersionUID = 1L;
21 |
22 | /**
23 | * @see HttpServlet#HttpServlet()
24 | */
25 | public EditDoctorProfile() {
26 | super();
27 |
28 | }
29 |
30 | /**
31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
32 | */
33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
34 |
35 | response.getWriter().append("Served at: ").append(request.getContextPath());
36 | }
37 |
38 | /**
39 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
40 | */
41 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
42 | //get doctor
43 | try {
44 | HttpSession session = request.getSession();
45 | int doctorId = (int) session.getAttribute("UserID");
46 | // get doctor details
47 | DatabaseHelper databaseHelper = new DatabaseHelper();
48 | int status = databaseHelper.updateDoctor(doctorId, request);
49 | if(status>0)
50 | {
51 | //successfully updated
52 | request.getRequestDispatcher("doctor").forward(request, response);
53 | return;
54 | }else
55 | {
56 | // redirect to login
57 | redirectToLogin(request, response);
58 | }
59 | return;
60 | } catch (Exception e) {
61 | // redirect to login
62 | redirectToLogin(request, response);
63 | }
64 | }
65 |
66 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
67 | throws ServletException, IOException {
68 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
69 | request.setAttribute("error", "Please login again");
70 | rs.forward(request, response);
71 | }
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/EditProfile.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 |
12 | import database.DatabaseHelper;
13 |
14 | /**
15 | * Servlet implementation class EditProfile
16 | */
17 | @WebServlet("/editProfile")
18 | public class EditProfile extends HttpServlet {
19 | private static final long serialVersionUID = 1L;
20 |
21 | /**
22 | * @see HttpServlet#HttpServlet()
23 | */
24 | public EditProfile() {
25 | super();
26 |
27 | }
28 |
29 | /**
30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
31 | */
32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
33 |
34 | response.getWriter().append("Served at: ").append(request.getContextPath());
35 | }
36 |
37 | /**
38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
39 | */
40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
41 | //get patient
42 | try {
43 | int patientId = Integer.valueOf((String)request.getParameter("patientId"));
44 | // get patient details
45 | DatabaseHelper databaseHelper = new DatabaseHelper();
46 | int status = databaseHelper.updatePatient(patientId, request);
47 | if(status>0)
48 | {
49 | //successfully updated
50 | RequestDispatcher rs = request.getRequestDispatcher("patient");
51 | request.setAttribute("personId", patientId);
52 | rs.forward(request, response);
53 | return;
54 | }else
55 | {
56 | // redirect to login
57 | redirectToLogin(request, response);
58 | }
59 | return;
60 | } catch (Exception e) {
61 | // redirect to login
62 | redirectToLogin(request, response);
63 | }
64 | }
65 |
66 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
67 | throws ServletException, IOException {
68 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
69 | request.setAttribute("error", "Please login again");
70 | rs.forward(request, response);
71 | }
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/LabReportOpen.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import javax.servlet.RequestDispatcher;
5 | import javax.servlet.ServletException;
6 | import javax.servlet.annotation.WebServlet;
7 | import javax.servlet.http.HttpServlet;
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 | import javax.servlet.http.HttpSession;
11 | import database.DatabaseHelper;
12 | import staff.modal.Staff;
13 |
14 | /**
15 | * Servlet implementation class DoctorServlet
16 | */
17 | @WebServlet("/labReportOpen")
18 | public class LabReportOpen extends HttpServlet {
19 | private static final long serialVersionUID = 1L;
20 | HttpSession session;
21 | /**
22 | * @see HttpServlet#HttpServlet()
23 | */
24 | public LabReportOpen() {
25 | super();
26 |
27 | }
28 |
29 | /**
30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
31 | */
32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
33 |
34 | try {
35 |
36 |
37 | int personId = (int) session.getAttribute("UserID");
38 | // get labPerson details
39 | DatabaseHelper databaseHelper = new DatabaseHelper();
40 | Staff labPerson = databaseHelper.getStaff(personId);
41 | if (labPerson == null) {
42 | // redirect to login
43 | redirectToLogin(request, response);
44 | return;
45 | }
46 | // redirect to labPerson dashboard
47 | RequestDispatcher rs = request.getRequestDispatcher("labReportOpen.jsp");
48 | request.setAttribute("labPerson", labPerson);
49 | rs.forward(request, response);
50 | return;
51 |
52 | } catch (Exception e) {
53 | // redirect to login
54 | redirectToLogin(request, response);
55 | }
56 | }
57 |
58 | /**
59 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
60 | */
61 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
62 |
63 | doGet(request, response);
64 | }
65 |
66 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
67 | throws ServletException, IOException {
68 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
69 | request.setAttribute("error", "Please login again");
70 | rs.forward(request, response);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/Database/cmc_doctor.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.18-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `doctor`
20 | --
21 |
22 | DROP TABLE IF EXISTS `doctor`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `doctor` (
26 | `doctorId` int(11) NOT NULL,
27 | `degree` varchar(45) DEFAULT NULL,
28 | `specialization` varchar(45) DEFAULT NULL,
29 | PRIMARY KEY (`doctorId`),
30 | UNIQUE KEY `id_UNIQUE` (`doctorId`),
31 | CONSTRAINT `doctor_ibfk_1` FOREIGN KEY (`doctorId`) REFERENCES `person` (`personId`) ON DELETE NO ACTION ON UPDATE NO ACTION
32 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
33 | /*!40101 SET character_set_client = @saved_cs_client */;
34 |
35 | --
36 | -- Dumping data for table `doctor`
37 | --
38 |
39 | LOCK TABLES `doctor` WRITE;
40 | /*!40000 ALTER TABLE `doctor` DISABLE KEYS */;
41 | INSERT INTO `doctor` VALUES (11,'MBBS MD BHHS','Neurologist'),(12,'MBBS BDS','Physician'),(13,'MBBS BDS','Dermatologist'),(14,'MBBS BHBS MD','Cardiologist'),(15,'MBBS MD BDS','Gynecologist');
42 | /*!40000 ALTER TABLE `doctor` ENABLE KEYS */;
43 | UNLOCK TABLES;
44 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
45 |
46 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
47 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
48 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
49 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
50 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
51 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
52 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
53 |
54 | -- Dump completed on 2017-04-21 3:47:43
55 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/EditLabPersonProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 | import javax.servlet.http.HttpSession;
12 |
13 | import database.DatabaseHelper;
14 |
15 | /**
16 | * Servlet implementation class EditProfile
17 | */
18 | @WebServlet("/editLabPersonProfile")
19 | public class EditLabPersonProfile extends HttpServlet {
20 | private static final long serialVersionUID = 1L;
21 |
22 | /**
23 | * @see HttpServlet#HttpServlet()
24 | */
25 | public EditLabPersonProfile() {
26 | super();
27 |
28 | }
29 |
30 | /**
31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
32 | */
33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
34 |
35 | response.getWriter().append("Served at: ").append(request.getContextPath());
36 | }
37 |
38 | /**
39 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
40 | */
41 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
42 | //get labPerson
43 | try {
44 | HttpSession session = request.getSession();
45 | int labPersonId = (int) session.getAttribute("UserID");
46 | // get labPerson details
47 | DatabaseHelper databaseHelper = new DatabaseHelper();
48 | int status = databaseHelper.updatePerson(labPersonId, request);
49 | if(status>0)
50 | {
51 | //successfully updated
52 | request.getRequestDispatcher("labPerson").forward(request, response);
53 | return;
54 | }else
55 | {
56 | // redirect to login
57 | redirectToLogin(request, response);
58 | }
59 | return;
60 | } catch (Exception e) {
61 | // redirect to login
62 | redirectToLogin(request, response);
63 | }
64 | }
65 |
66 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
67 | throws ServletException, IOException {
68 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
69 | request.setAttribute("error", "Please login again");
70 | rs.forward(request, response);
71 | }
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/SubmitLabReport.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import javax.servlet.RequestDispatcher;
5 | import javax.servlet.ServletException;
6 | import javax.servlet.annotation.WebServlet;
7 | import javax.servlet.http.HttpServlet;
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 |
11 | import database.DatabaseHelper;
12 |
13 | /**
14 | * Servlet implementation class SubmitLabReport
15 | */
16 | @WebServlet("/submitLabReport")
17 | public class SubmitLabReport extends HttpServlet {
18 | private static final long serialVersionUID = 1L;
19 |
20 | /**
21 | * @see HttpServlet#HttpServlet()
22 | */
23 | public SubmitLabReport() {
24 | super();
25 |
26 | }
27 |
28 | /**
29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
30 | */
31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
32 | // redirect to login
33 | redirectToLogin(request, response);
34 | return;
35 | }
36 |
37 | /**
38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
39 | */
40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
41 | try {
42 | // get doctor lab report id
43 | int labReportId = Integer.parseInt((String)request.getParameter("labId"));
44 | DatabaseHelper databaseHelper = new DatabaseHelper();
45 | int status = databaseHelper.updateLabReport(labReportId, (String)request.getParameter("result"),
46 | Integer.parseInt((String)request.getParameter("itemId")));
47 | if (status<=0) {
48 | //error
49 | // redirect to login
50 | redirectToLogin(request, response);
51 | return;
52 | }
53 | // redirect to lab person dashboard
54 | RequestDispatcher rs = request.getRequestDispatcher("labPerson");
55 | rs.forward(request, response);
56 | return;
57 | } catch (Exception e) {
58 | // redirect to login
59 | redirectToLogin(request, response);
60 | }
61 | }
62 |
63 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
64 | throws ServletException, IOException {
65 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
66 | request.setAttribute("error", "Please login again");
67 | rs.forward(request, response);
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/UpdateAdminProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import javax.servlet.RequestDispatcher;
5 | import javax.servlet.ServletException;
6 | import javax.servlet.annotation.WebServlet;
7 | import javax.servlet.http.HttpServlet;
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 | import javax.servlet.http.HttpSession;
11 |
12 | import database.DatabaseHelper;
13 | import staff.modal.Staff;
14 |
15 | /**
16 | * Servlet implementation class UpdatePatientProfile
17 | */
18 | @WebServlet("/updateAdminProfile")
19 | public class UpdateAdminProfile extends HttpServlet {
20 | private static final long serialVersionUID = 1L;
21 |
22 | /**
23 | * @see HttpServlet#HttpServlet()
24 | */
25 | public UpdateAdminProfile() {
26 | super();
27 |
28 | }
29 |
30 | /**
31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
32 | */
33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
34 |
35 | try {
36 | HttpSession session = request.getSession();
37 | int adminId = (int) session.getAttribute("UserID");
38 | // get admin details
39 | DatabaseHelper databaseHelper = new DatabaseHelper();
40 | Staff admin = databaseHelper.getStaff(adminId);
41 | if (admin == null ) {
42 | // redirect to login
43 | redirectToLogin(request, response);
44 | return;
45 | }
46 | // redirect to admin dashboard
47 | RequestDispatcher rs = request.getRequestDispatcher("editAdminProfile.jsp");
48 | request.setAttribute("admin", admin);
49 | rs.forward(request, response);
50 | return;
51 | } catch (Exception e) {
52 | // redirect to login
53 | redirectToLogin(request, response);
54 | }
55 | }
56 |
57 | /**
58 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
59 | */
60 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
61 | //update patient
62 | doGet(request,response);
63 | }
64 |
65 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
66 | throws ServletException, IOException {
67 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
68 | request.setAttribute("error", "Please login again");
69 | rs.forward(request, response);
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/Database/cmc_prescription.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.18-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `prescription`
20 | --
21 |
22 | DROP TABLE IF EXISTS `prescription`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `prescription` (
26 | `medicineId` int(11) NOT NULL AUTO_INCREMENT,
27 | `medicineName` varchar(45) DEFAULT NULL,
28 | `quantity` double DEFAULT '0',
29 | `times` int(11) DEFAULT '0',
30 | `itemId` int(11) NOT NULL,
31 | PRIMARY KEY (`medicineId`),
32 | KEY `medine_key1_idx` (`itemId`),
33 | CONSTRAINT `medine_key1` FOREIGN KEY (`itemId`) REFERENCES `appointmentitems` (`itemId`) ON DELETE NO ACTION ON UPDATE NO ACTION
34 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
35 | /*!40101 SET character_set_client = @saved_cs_client */;
36 |
37 | --
38 | -- Dumping data for table `prescription`
39 | --
40 |
41 | LOCK TABLES `prescription` WRITE;
42 | /*!40000 ALTER TABLE `prescription` DISABLE KEYS */;
43 | INSERT INTO `prescription` VALUES (1,'Citrazin',0.5,2,11),(5,'Noraflex',1,3,40);
44 | /*!40000 ALTER TABLE `prescription` ENABLE KEYS */;
45 | UNLOCK TABLES;
46 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
47 |
48 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
49 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
50 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
51 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
52 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
53 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
54 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
55 |
56 | -- Dump completed on 2017-04-21 3:47:44
57 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/EditReceptionistProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 | import javax.servlet.http.HttpSession;
12 |
13 | import database.DatabaseHelper;
14 |
15 | /**
16 | * Servlet implementation class EditProfile
17 | */
18 | @WebServlet("/editReceptionistProfile")
19 | public class EditReceptionistProfile extends HttpServlet {
20 | private static final long serialVersionUID = 1L;
21 |
22 | /**
23 | * @see HttpServlet#HttpServlet()
24 | */
25 | public EditReceptionistProfile() {
26 | super();
27 |
28 | }
29 |
30 | /**
31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
32 | */
33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
34 |
35 | response.getWriter().append("Served at: ").append(request.getContextPath());
36 | }
37 |
38 | /**
39 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
40 | */
41 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
42 | //get admin
43 | try {
44 | HttpSession session = request.getSession();
45 | int receptionistId = (int) session.getAttribute("UserID");
46 | // get receptionist details
47 | DatabaseHelper databaseHelper = new DatabaseHelper();
48 | int status = databaseHelper.updatePerson(receptionistId, request);
49 | if(status>0)
50 | {
51 | //successfully updated
52 | request.getRequestDispatcher("receptionist").forward(request, response);
53 | return;
54 | }else
55 | {
56 | // redirect to login
57 | redirectToLogin(request, response);
58 | }
59 | return;
60 | } catch (Exception e) {
61 | // redirect to login
62 | redirectToLogin(request, response);
63 | }
64 | }
65 |
66 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
67 | throws ServletException, IOException {
68 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
69 | request.setAttribute("error", "Please login again");
70 | rs.forward(request, response);
71 | }
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/Database/cmc_patient.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.18-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `patient`
20 | --
21 |
22 | DROP TABLE IF EXISTS `patient`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `patient` (
26 | `patientId` int(11) NOT NULL,
27 | `height` int(11) DEFAULT NULL,
28 | `weight` int(11) DEFAULT NULL,
29 | `bloodGroup` varchar(5) DEFAULT NULL,
30 | PRIMARY KEY (`patientId`),
31 | UNIQUE KEY `id_UNIQUE` (`patientId`),
32 | CONSTRAINT `patient_ibfk_1` FOREIGN KEY (`patientId`) REFERENCES `person` (`personId`) ON DELETE NO ACTION ON UPDATE NO ACTION
33 | ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
34 | /*!40101 SET character_set_client = @saved_cs_client */;
35 |
36 | --
37 | -- Dumping data for table `patient`
38 | --
39 |
40 | LOCK TABLES `patient` WRITE;
41 | /*!40000 ALTER TABLE `patient` DISABLE KEYS */;
42 | INSERT INTO `patient` VALUES (1,178,60,'A+'),(2,165,80,'A+'),(3,171,49,'A-'),(4,180,51,'O+'),(5,175,59,'O-'),(6,176,75,'B+'),(7,170,80,'B+'),(8,165,100,'B-'),(9,166,120,'B-'),(10,159,69,'AB+');
43 | /*!40000 ALTER TABLE `patient` ENABLE KEYS */;
44 | UNLOCK TABLES;
45 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
46 |
47 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
48 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
49 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
50 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
51 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
52 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
53 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
54 |
55 | -- Dump completed on 2017-04-21 3:47:43
56 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/UpdateLabPersonProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import javax.servlet.RequestDispatcher;
5 | import javax.servlet.ServletException;
6 | import javax.servlet.annotation.WebServlet;
7 | import javax.servlet.http.HttpServlet;
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 | import javax.servlet.http.HttpSession;
11 |
12 | import database.DatabaseHelper;
13 | import staff.modal.Staff;
14 |
15 | /**
16 | * Servlet implementation class UpdatePatientProfile
17 | */
18 | @WebServlet("/updateLabPersonProfile")
19 | public class UpdateLabPersonProfile extends HttpServlet {
20 | private static final long serialVersionUID = 1L;
21 |
22 | /**
23 | * @see HttpServlet#HttpServlet()
24 | */
25 | public UpdateLabPersonProfile() {
26 | super();
27 |
28 | }
29 |
30 | /**
31 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
32 | */
33 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
34 |
35 | try {
36 | HttpSession session = request.getSession();
37 | int labPersonId = (int) session.getAttribute("UserID");
38 | // get labPerson details
39 | DatabaseHelper databaseHelper = new DatabaseHelper();
40 | Staff labPerson = databaseHelper.getStaff(labPersonId);
41 | if (labPerson == null ) {
42 | // redirect to login
43 | redirectToLogin(request, response);
44 | return;
45 | }
46 | // redirect to labPerson dashboard
47 | RequestDispatcher rs = request.getRequestDispatcher("editLabPersonProfile.jsp");
48 | request.setAttribute("labPerson", labPerson);
49 | rs.forward(request, response);
50 | return;
51 | } catch (Exception e) {
52 | // redirect to login
53 | redirectToLogin(request, response);
54 | }
55 | }
56 |
57 | /**
58 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
59 | */
60 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
61 | //update patient
62 | doGet(request,response);
63 | }
64 |
65 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
66 | throws ServletException, IOException {
67 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
68 | request.setAttribute("error", "Please login again");
69 | rs.forward(request, response);
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/AllocateDoctor.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import javax.servlet.RequestDispatcher;
5 | import javax.servlet.ServletException;
6 | import javax.servlet.annotation.WebServlet;
7 | import javax.servlet.http.HttpServlet;
8 | import javax.servlet.http.HttpServletRequest;
9 | import javax.servlet.http.HttpServletResponse;
10 | import database.DatabaseHelper;
11 | import utils.DateUtils;
12 |
13 | /**
14 | * Servlet implementation class AllocateDoctor
15 | */
16 | @WebServlet("/allocateDoctor")
17 | public class AllocateDoctor extends HttpServlet {
18 | private static final long serialVersionUID = 1L;
19 |
20 | /**
21 | * @see HttpServlet#HttpServlet()
22 | */
23 | public AllocateDoctor() {
24 | super();
25 | }
26 |
27 | /**
28 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
29 | */
30 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
31 | // redirect to login
32 | redirectToLogin(request, response);
33 | return;
34 | }
35 |
36 | /**
37 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
38 | */
39 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
40 | // get appointmentDetails from DB
41 | try {
42 | int appointmentId = Integer.parseInt((String) request.getParameter("appointmentId"));
43 | int doctorId = Integer.parseInt((String) request.getParameter("doctorId"));
44 | String allocatedDate = (String)request.getParameter("allocatedDate");
45 | // allocate doctor
46 | DatabaseHelper databaseHelper = new DatabaseHelper();
47 | int status = databaseHelper.allocateDoctor(appointmentId, doctorId, DateUtils.getLongFromDate(allocatedDate));
48 |
49 | if (status > 0) {
50 | // redirect to receptionlist detailed appointment
51 | RequestDispatcher rs = request.getRequestDispatcher("receptionistAppointmentDetails");
52 | request.setAttribute("appointmentId", appointmentId);
53 | rs.forward(request, response);
54 | return;
55 | }
56 | } catch (Exception e) {
57 | e.printStackTrace();
58 | // redirect to login
59 | redirectToLogin(request, response);
60 | }
61 | }
62 |
63 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
64 | throws ServletException, IOException {
65 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
66 | request.setAttribute("error", "Please login again");
67 | rs.forward(request, response);
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/Database/cmc_lab.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.18-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `lab`
20 | --
21 |
22 | DROP TABLE IF EXISTS `lab`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `lab` (
26 | `labId` int(11) NOT NULL AUTO_INCREMENT,
27 | `labName` varchar(45) NOT NULL,
28 | `testFor` varchar(45) NOT NULL,
29 | `labResult` varchar(45) DEFAULT NULL,
30 | `reportFile` varchar(45) DEFAULT NULL,
31 | `itemId` int(11) NOT NULL,
32 | `doctorId` int(11) NOT NULL,
33 | PRIMARY KEY (`labId`),
34 | KEY `labfk1_idx` (`itemId`),
35 | KEY `labfk2_idx` (`doctorId`),
36 | CONSTRAINT `labfk1` FOREIGN KEY (`itemId`) REFERENCES `appointmentItems` (`itemId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
37 | CONSTRAINT `labfk11` FOREIGN KEY (`doctorId`) REFERENCES `doctor` (`doctorId`) ON DELETE NO ACTION ON UPDATE NO ACTION
38 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
39 | /*!40101 SET character_set_client = @saved_cs_client */;
40 |
41 | --
42 | -- Dumping data for table `lab`
43 | --
44 |
45 | LOCK TABLES `lab` WRITE;
46 | /*!40000 ALTER TABLE `lab` DISABLE KEYS */;
47 | INSERT INTO `lab` VALUES (1,'Urine Test','Blood Sugar','High',NULL,12,12),(3,'Blood Test','Haemoglobin',NULL,NULL,41,12),(4,'Kidney Test','Stones','Low',NULL,46,12);
48 | /*!40000 ALTER TABLE `lab` ENABLE KEYS */;
49 | UNLOCK TABLES;
50 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
51 |
52 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
53 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
54 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
55 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
56 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
57 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
58 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
59 |
60 | -- Dump completed on 2017-04-21 3:47:43
61 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/UpdateDoctorProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import staff.modal.Doctor;
17 |
18 | /**
19 | * Servlet implementation class UpdatePatientProfile
20 | */
21 | @WebServlet("/updateDoctorProfile")
22 | public class UpdateDoctorProfile extends HttpServlet {
23 | private static final long serialVersionUID = 1L;
24 |
25 | /**
26 | * @see HttpServlet#HttpServlet()
27 | */
28 | public UpdateDoctorProfile() {
29 | super();
30 |
31 | }
32 |
33 | /**
34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
35 | */
36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
37 |
38 | try {
39 | HttpSession session = request.getSession();
40 | int doctorId = (int) session.getAttribute("UserID");
41 | // get doctor details
42 | DatabaseHelper databaseHelper = new DatabaseHelper();
43 | Doctor doctor = databaseHelper.getDoctor(doctorId);
44 | ArrayList> appointments = databaseHelper.getAppointments(doctorId, "doctorId");
45 | if (doctor == null || appointments == null) {
46 | // redirect to login
47 | redirectToLogin(request, response);
48 | return;
49 | }
50 | // redirect to doctor dashboard
51 | RequestDispatcher rs = request.getRequestDispatcher("editDoctorProfile.jsp");
52 | request.setAttribute("doctor", doctor);
53 | request.setAttribute("appointments", appointments);
54 | rs.forward(request, response);
55 | return;
56 | } catch (Exception e) {
57 | // redirect to login
58 | redirectToLogin(request, response);
59 | }
60 | }
61 |
62 | /**
63 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
64 | */
65 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
66 | //update patient
67 | doGet(request,response);
68 | }
69 |
70 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
71 | throws ServletException, IOException {
72 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
73 | request.setAttribute("error", "Please login again");
74 | rs.forward(request, response);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/UpdatePatientProfile.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import patient.modal.Patient;
17 |
18 | /**
19 | * Servlet implementation class UpdatePatientProfile
20 | */
21 | @WebServlet("/updatePatientProfile")
22 | public class UpdatePatientProfile extends HttpServlet {
23 | private static final long serialVersionUID = 1L;
24 |
25 | /**
26 | * @see HttpServlet#HttpServlet()
27 | */
28 | public UpdatePatientProfile() {
29 | super();
30 |
31 | }
32 |
33 | /**
34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
35 | */
36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
37 |
38 | try {
39 | HttpSession session = request.getSession();
40 | int patientId = (int) session.getAttribute("UserID");
41 | // get patient details
42 | DatabaseHelper databaseHelper = new DatabaseHelper();
43 | Patient patient = databaseHelper.getPatient(patientId);
44 | ArrayList> appointments = databaseHelper.getAppointments(patientId, "patientId");
45 | if (patient == null || appointments == null) {
46 | // redirect to login
47 | redirectToLogin(request, response);
48 | return;
49 | }
50 | // redirect to person dashboard
51 | RequestDispatcher rs = request.getRequestDispatcher("editProfile.jsp");
52 | request.setAttribute("patient", patient);
53 | request.setAttribute("appointments", appointments);
54 | rs.forward(request, response);
55 | return;
56 | } catch (Exception e) {
57 | // redirect to login
58 | redirectToLogin(request, response);
59 | }
60 | }
61 |
62 | /**
63 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
64 | */
65 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
66 | //update patient
67 | doGet(request,response);
68 | }
69 |
70 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
71 | throws ServletException, IOException {
72 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
73 | request.setAttribute("error", "Please login again");
74 | rs.forward(request, response);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/LabPersonServlet.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 | import database.DatabaseHelper;
14 | import prescription.Lab;
15 | import staff.modal.Staff;
16 |
17 | /**
18 | * Servlet implementation class DoctorServlet
19 | */
20 | @WebServlet("/labPerson")
21 | public class LabPersonServlet extends HttpServlet {
22 | private static final long serialVersionUID = 1L;
23 | HttpSession session;
24 | /**
25 | * @see HttpServlet#HttpServlet()
26 | */
27 | public LabPersonServlet() {
28 | super();
29 |
30 | }
31 |
32 | /**
33 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
34 | */
35 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
36 |
37 | try {
38 | session = request.getSession();
39 | if (session.isNew()){
40 | redirectToLogin(request, response);
41 | }
42 | else{
43 |
44 | int personId = (int) session.getAttribute("UserID");
45 | // get labPerson details
46 | DatabaseHelper databaseHelper = new DatabaseHelper();
47 | Staff labPerson = databaseHelper.getStaff(personId);
48 | ArrayList> labs = databaseHelper.getAllLabForLabPerson();
49 | if (labPerson == null || labs ==null) {
50 | // redirect to login
51 | redirectToLogin(request, response);
52 | return;
53 | }
54 | // redirect to labPerson dashboard
55 | RequestDispatcher rs = request.getRequestDispatcher("labPerson.jsp");
56 | request.setAttribute("labPerson", labPerson);
57 | request.setAttribute("labs", labs);
58 | rs.forward(request, response);
59 | return;
60 | }
61 | } catch (Exception e) {
62 | // redirect to login
63 | redirectToLogin(request, response);
64 | }
65 | }
66 |
67 | /**
68 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
69 | */
70 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
71 |
72 | doGet(request, response);
73 | }
74 |
75 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
76 | throws ServletException, IOException {
77 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
78 | request.setAttribute("error", "Please login again");
79 | rs.forward(request, response);
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/UpdateReceptionistProfile.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import staff.modal.Staff;
17 |
18 | /**
19 | * Servlet implementation class UpdatePatientProfile
20 | */
21 | @WebServlet("/updateReceptionistProfile")
22 | public class UpdateReceptionistProfile extends HttpServlet {
23 | private static final long serialVersionUID = 1L;
24 |
25 | /**
26 | * @see HttpServlet#HttpServlet()
27 | */
28 | public UpdateReceptionistProfile() {
29 | super();
30 |
31 | }
32 |
33 | /**
34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
35 | */
36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
37 |
38 | try {
39 | HttpSession session = request.getSession();
40 | int receptionistId = (int) session.getAttribute("UserID");
41 | // get receptionist details
42 | DatabaseHelper databaseHelper = new DatabaseHelper();
43 | ArrayList> appointments = databaseHelper.getAppointments(receptionistId, null);
44 | Staff receptionist = databaseHelper.getStaff(receptionistId);
45 | if (receptionist == null ) {
46 | // redirect to login
47 | redirectToLogin(request, response);
48 | return;
49 | }
50 | // redirect to receptionist dashboard
51 | RequestDispatcher rs = request.getRequestDispatcher("editReceptionistProfile.jsp");
52 | request.setAttribute("receptionist", receptionist);
53 | request.setAttribute("appointments", appointments);
54 | rs.forward(request, response);
55 | return;
56 | } catch (Exception e) {
57 | // redirect to login
58 | redirectToLogin(request, response);
59 | }
60 | }
61 |
62 | /**
63 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
64 | */
65 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
66 | //update patient
67 | doGet(request,response);
68 | }
69 |
70 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
71 | throws ServletException, IOException {
72 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
73 | request.setAttribute("error", "Please login again");
74 | rs.forward(request, response);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/OpenBookAppointment.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import patient.modal.Patient;
17 |
18 | /**
19 | * Servlet implementation class OpenBookAppointment
20 | */
21 | @WebServlet("/openBookAppointment")
22 | public class OpenBookAppointment extends HttpServlet {
23 | private static final long serialVersionUID = 1L;
24 |
25 | /**
26 | * @see HttpServlet#HttpServlet()
27 | */
28 | public OpenBookAppointment() {
29 | super();
30 |
31 | }
32 |
33 | /**
34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
35 | */
36 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
37 | HttpSession session=request.getSession();
38 | RequestDispatcher rs;
39 | try{
40 | int patientId = (int)session.getAttribute("UserID");
41 | if(patientId>0)
42 | {
43 | DatabaseHelper databaseHelper = new DatabaseHelper();
44 | Patient patient = databaseHelper.getPatient(patientId);
45 | ArrayList> appointments = databaseHelper.getAppointments(patientId, "patientId");
46 | if(patient!=null && appointments!=null)
47 | {
48 | rs = request.getRequestDispatcher("bookAppointment.jsp");
49 | request.setAttribute("patient", patient);
50 | request.setAttribute("appointments", appointments);
51 | rs.forward(request, response);
52 | }else
53 | {
54 | //redirect to login
55 | redirectToLogin(request,response);
56 | }
57 | }else
58 | {
59 | //redirect to login
60 | redirectToLogin(request,response);
61 | }
62 | }catch(Exception e){
63 | e.printStackTrace();
64 | //redirect to login
65 | redirectToLogin(request,response);
66 |
67 | }
68 | }
69 |
70 | /**
71 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
72 | */
73 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
74 | doGet(request, response);
75 | }
76 |
77 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
78 | throws ServletException, IOException {
79 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
80 | request.setAttribute("error", "Please login again");
81 | rs.forward(request, response);
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/CMC/src/modal/Person.java:
--------------------------------------------------------------------------------
1 | package modal;
2 |
3 | import utils.DateUtils;
4 |
5 | public class Person {
6 |
7 | private int id;
8 | private String firstName;
9 | private String lastName;
10 | private String userName;
11 | private long dob;
12 | private int type;
13 | private String gender;
14 | private String address;
15 | private String contactNumber;
16 |
17 |
18 |
19 | public Person(int id, String firstName, String lastName, String userName, long dob, int type, String gender,
20 | String address, String contactNumber) {
21 |
22 | this.id = id;
23 | this.firstName = firstName;
24 | this.lastName = lastName;
25 | this.userName = userName;
26 | this.dob = dob;
27 | this.type = type;
28 | this.gender = gender;
29 | this.address = address;
30 | this.contactNumber = contactNumber;
31 | }
32 |
33 |
34 |
35 | public Person(String firstName, String lastName, String userName, long dob, int type, String gender, String address,
36 | String contactNumber) {
37 |
38 | this.firstName = firstName;
39 | this.lastName = lastName;
40 | this.userName = userName;
41 | this.dob = dob;
42 | this.type = type;
43 | this.gender = gender;
44 | this.address = address;
45 | this.contactNumber = contactNumber;
46 | }
47 |
48 | public String getFirstName() {
49 | return firstName;
50 | }
51 |
52 | public void setFirstName(String firstName) {
53 | this.firstName = firstName;
54 | }
55 |
56 | public String getLastName() {
57 | return lastName;
58 | }
59 |
60 | public void setLastName(String lastName) {
61 | this.lastName = lastName;
62 | }
63 |
64 | public void setDob(long dob) {
65 | this.dob=dob;
66 | }
67 |
68 | public String getStringDob() {
69 | return DateUtils.getStringFromDate(dob);
70 | }
71 |
72 | public String getGender() {
73 | return gender;
74 | }
75 |
76 | public void setGender(String gender) {
77 | this.gender = gender;
78 | }
79 |
80 | public String getAddress() {
81 | return address;
82 | }
83 |
84 | public void setAddress(String address) {
85 | this.address = address;
86 | }
87 |
88 | public String getContactNumber() {
89 | return contactNumber;
90 | }
91 |
92 | public void setContactNumber(String contactNumber) {
93 | this.contactNumber = contactNumber;
94 | }
95 |
96 | public int getId() {
97 | return id;
98 | }
99 |
100 | public String getUserName() {
101 | return userName;
102 | }
103 |
104 | public void setUserName(String userName) {
105 | this.userName = userName;
106 | }
107 |
108 | public int getUserType() {
109 | return type;
110 | }
111 |
112 | public void setUserType(int userType) {
113 | this.type = userType;
114 | }
115 |
116 | public String getAge(){
117 | return String.valueOf(DateUtils.getYearsFromLong(dob)) + " years";
118 | }
119 |
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/BookAppointment.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 | import javax.servlet.http.HttpSession;
12 |
13 | import database.DatabaseHelper;
14 | import modal.Appointment;
15 | import patient.modal.Patient;
16 | import utils.DateUtils;
17 |
18 | /**
19 | * Servlet implementation class BookAppointment
20 | */
21 | @WebServlet("/bookAppointment")
22 | public class BookAppointment extends HttpServlet {
23 | private static final long serialVersionUID = 1L;
24 |
25 | /**
26 | * @see HttpServlet#HttpServlet()
27 | */
28 | public BookAppointment() {
29 | super();
30 |
31 | }
32 |
33 | /**
34 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
35 | * response)
36 | */
37 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
38 | throws ServletException, IOException {
39 | // error
40 | //redirect to login
41 | redirectToLogin(request, response);
42 | }
43 |
44 | /**
45 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
46 | * response)
47 | */
48 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
49 | throws ServletException, IOException {
50 |
51 | HttpSession session;
52 | session = request.getSession();
53 | if (session.isNew()) {
54 | redirectToLogin(request, response);
55 | } else {
56 | Patient patient = new DatabaseHelper().getPatient((int) session.getAttribute("UserID"));
57 | Appointment appointment = new Appointment(patient, (String) request.getParameter("symptons"),
58 | (String) request.getParameter("disease"),
59 | DateUtils.getLongFromDate((String) request.getParameter("preferredDate")),
60 | (String)request.getParameter("title"));
61 |
62 |
63 | // insert in DB
64 | int status = new DatabaseHelper().createAppointment(appointment);
65 | if (status > 0) {
66 | // successfully inserted
67 | // redirect to patient dashboard
68 | RequestDispatcher rs;
69 | rs = request.getRequestDispatcher("patient");
70 | request.setAttribute("personId", appointment.getPatient().getId());
71 | rs.forward(request, response);
72 | } else {
73 | // error
74 | //redirect to login
75 | redirectToLogin(request, response);
76 | }
77 | }
78 | }
79 |
80 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
81 | throws ServletException, IOException {
82 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
83 | request.setAttribute("error", "Please login again");
84 | rs.forward(request, response);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Database/cmc_appointmentItems.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.18-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `appointmentItems`
20 | --
21 |
22 | DROP TABLE IF EXISTS `appointmentItems`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `appointmentItems` (
26 | `itemId` int(11) NOT NULL AUTO_INCREMENT,
27 | `date` double DEFAULT NULL,
28 | `typeId` int(11) NOT NULL,
29 | `description` varchar(45) DEFAULT NULL,
30 | `appointmentId` int(11) NOT NULL,
31 | PRIMARY KEY (`itemId`),
32 | KEY `appointmentId` (`appointmentId`),
33 | KEY `type` (`typeId`),
34 | CONSTRAINT `appointmentItems_ibfk_3` FOREIGN KEY (`appointmentId`) REFERENCES `appointment` (`appointmentId`),
35 | CONSTRAINT `appointmentItems_ibfk_4` FOREIGN KEY (`typeId`) REFERENCES `appointmentItemsType` (`typeId`)
36 | ) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
37 | /*!40101 SET character_set_client = @saved_cs_client */;
38 |
39 | --
40 | -- Dumping data for table `appointmentItems`
41 | --
42 |
43 | LOCK TABLES `appointmentItems` WRITE;
44 | /*!40000 ALTER TABLE `appointmentItems` DISABLE KEYS */;
45 | INSERT INTO `appointmentItems` VALUES (1,1492426867320,6,'Appointment Created',1),(2,1492427049030,6,'Appointment Created',2),(3,1492427176793,6,'Appointment Created',3),(4,1492427176793,6,'Appointment Created',4),(5,1492427176793,6,'Appointment Created',5),(6,1492427176793,6,'Appointment Created',6),(7,1492427176793,6,'Appointment Created',7),(8,1492427176793,6,'Appointment Created',8),(9,1492427176793,6,'Appointment Created',9),(10,1492427176793,6,'Appointment Created',10),(11,1492427176793,3,'Medicine',1),(12,1492427176793,4,'Lab Report',1);
46 | /*!40000 ALTER TABLE `appointmentItems` ENABLE KEYS */;
47 | UNLOCK TABLES;
48 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
49 |
50 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
51 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
52 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
53 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
54 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
55 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
56 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
57 |
58 | -- Dump completed on 2017-04-20 22:38:20
59 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/DoctorServlet.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import patient.modal.DashBoard;
17 | import staff.modal.Doctor;
18 | import utils.DashUtils;
19 |
20 | /**
21 | * Servlet implementation class DoctorServlet
22 | */
23 | @WebServlet("/doctor")
24 | public class DoctorServlet extends HttpServlet {
25 | private static final long serialVersionUID = 1L;
26 | HttpSession session;
27 | /**
28 | * @see HttpServlet#HttpServlet()
29 | */
30 | public DoctorServlet() {
31 | super();
32 |
33 | }
34 |
35 | /**
36 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
37 | */
38 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
39 |
40 | try {
41 | session = request.getSession();
42 | if (session.isNew()){
43 | redirectToLogin(request, response);
44 | }
45 | else{
46 |
47 | int personId = (int) session.getAttribute("UserID");
48 | // get doctor details
49 | DatabaseHelper databaseHelper = new DatabaseHelper();
50 | DashBoard dashBoard = new DashBoard(databaseHelper.getAppointmentCount(personId,"doctorId"),
51 | databaseHelper.getPatientCount(personId),DashUtils.getProfileRating(personId, 2));
52 | Doctor doctor = databaseHelper.getDoctor(personId);
53 | ArrayList> appointments = databaseHelper.getAppointments(personId, "doctorId");
54 | if (doctor == null || appointments == null) {
55 | // redirect to login
56 | redirectToLogin(request, response);
57 | return;
58 | }
59 | // redirect to doctor dashboard
60 | RequestDispatcher rs = request.getRequestDispatcher("doctor.jsp");
61 | request.setAttribute("doctor", doctor);
62 | request.setAttribute("appointments", appointments);
63 | request.setAttribute("dashBoard", dashBoard);
64 | rs.forward(request, response);
65 | return;
66 | }
67 | } catch (Exception e) {
68 | // redirect to login
69 | redirectToLogin(request, response);
70 | }
71 | }
72 |
73 | /**
74 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
75 | */
76 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
77 |
78 | doGet(request, response);
79 | }
80 |
81 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
82 | throws ServletException, IOException {
83 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
84 | request.setAttribute("error", "Please login again");
85 | rs.forward(request, response);
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/ReceptionistServlet.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 | import database.DatabaseHelper;
14 | import modal.Appointment;
15 | import patient.modal.DashBoard;
16 | import staff.modal.Staff;
17 | import utils.DashUtils;
18 |
19 | /**
20 | * Servlet implementation class DoctorServlet
21 | */
22 | @WebServlet("/receptionist")
23 | public class ReceptionistServlet extends HttpServlet {
24 | private static final long serialVersionUID = 1L;
25 | HttpSession session;
26 | /**
27 | * @see HttpServlet#HttpServlet()
28 | */
29 | public ReceptionistServlet() {
30 | super();
31 |
32 | }
33 |
34 | /**
35 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
36 | */
37 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
38 |
39 | try {
40 | session = request.getSession();
41 | if (session.isNew()){
42 | redirectToLogin(request, response);
43 | }
44 | else{
45 |
46 | int personId = (int) session.getAttribute("UserID");
47 | // get receptionist details
48 | DatabaseHelper databaseHelper = new DatabaseHelper();
49 | DashBoard dashBoard = new DashBoard(DashUtils.getUnapprovedAppointment(),
50 | DashUtils.getTotalAppointment(),DashUtils.getProfileRating(personId, 5));
51 | Staff receptionist = databaseHelper.getStaff(personId);
52 | ArrayList> appointments = databaseHelper.getAppointments(personId, null);
53 | if (receptionist == null || appointments == null) {
54 | // redirect to login
55 | redirectToLogin(request, response);
56 | return;
57 | }
58 | // redirect to receptionist dashboard
59 | RequestDispatcher rs = request.getRequestDispatcher("receptionist.jsp");
60 | request.setAttribute("receptionist", receptionist);
61 | request.setAttribute("dashBoard", dashBoard);
62 | request.setAttribute("appointments", appointments);
63 | rs.forward(request, response);
64 | return;
65 | }
66 | } catch (Exception e) {
67 | // redirect to login
68 | redirectToLogin(request, response);
69 | }
70 | }
71 |
72 | /**
73 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
74 | */
75 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
76 |
77 | doGet(request, response);
78 | }
79 |
80 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
81 | throws ServletException, IOException {
82 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
83 | request.setAttribute("error", "Please login again");
84 | rs.forward(request, response);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/PatientServlet.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import patient.modal.DashBoard;
15 | import patient.modal.Patient;
16 | import utils.DashUtils;
17 | import database.DatabaseHelper;
18 | import modal.Appointment;
19 |
20 | /**
21 | * Servlet implementation class Patient
22 | */
23 | @WebServlet("/patient")
24 | public class PatientServlet extends HttpServlet {
25 | private static final long serialVersionUID = 1L;
26 | HttpSession session;
27 | /**
28 | * @see HttpServlet#HttpServlet()
29 | */
30 | public PatientServlet() {
31 | super();
32 |
33 | }
34 |
35 | /**
36 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
37 | * response)
38 | */
39 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
40 | throws ServletException, IOException {
41 |
42 | try {
43 | session = request.getSession();
44 | if (session.isNew()){
45 | redirectToLogin(request, response);
46 | }
47 | else{
48 |
49 | int personId = (int) session.getAttribute("UserID");
50 | // get patient details
51 | DatabaseHelper databaseHelper = new DatabaseHelper();
52 | Patient patient = databaseHelper.getPatient(personId);
53 | DashBoard dashBoard = new DashBoard(databaseHelper.getAppointmentCount(personId,"patientId"),
54 | DashUtils.getBMI(patient.getHeight(), patient.getWeight()),DashUtils.getMedicineCount(personId),DashUtils.getProfileRating(personId, 1));
55 | ArrayList> appointments = databaseHelper.getAppointments(personId, "patientId");
56 | if (patient == null || appointments == null || dashBoard == null) {
57 | // redirect to login
58 | redirectToLogin(request, response);
59 | return;
60 | }
61 | // redirect to person dashboard
62 | RequestDispatcher rs = request.getRequestDispatcher("patient.jsp");
63 | request.setAttribute("patient", patient);
64 | request.setAttribute("appointments", appointments);
65 | request.setAttribute("dashBoard", dashBoard);
66 | rs.forward(request, response);
67 | return;
68 | }
69 | } catch (Exception e) {
70 | // redirect to login
71 | redirectToLogin(request, response);
72 | }
73 | }
74 |
75 |
76 |
77 |
78 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
79 | throws ServletException, IOException {
80 | doGet(request,response);
81 | }
82 |
83 | /**
84 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
85 | * response)
86 | */
87 |
88 |
89 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
90 | throws ServletException, IOException {
91 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
92 | request.setAttribute("error", "Please login again");
93 | rs.forward(request, response);
94 | }
95 |
96 | }
97 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/AdminServlet.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 | import database.DatabaseHelper;
14 | import modal.Appointment;
15 | import patient.modal.Patient;
16 | import staff.modal.Doctor;
17 | import staff.modal.Staff;
18 |
19 | /**
20 | * Servlet implementation class DoctorServlet
21 | */
22 | @WebServlet("/admin")
23 | public class AdminServlet extends HttpServlet {
24 | private static final long serialVersionUID = 1L;
25 | HttpSession session;
26 |
27 | /**
28 | * @see HttpServlet#HttpServlet()
29 | */
30 | public AdminServlet() {
31 | super();
32 |
33 | }
34 |
35 | /**
36 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
37 | * response)
38 | */
39 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
40 | throws ServletException, IOException {
41 |
42 | try {
43 | session = request.getSession();
44 | if (session.isNew()) {
45 | redirectToLogin(request, response);
46 | } else {
47 |
48 | int personId = (int) session.getAttribute("UserID");
49 | // get patient details
50 | DatabaseHelper databaseHelper = new DatabaseHelper();
51 | Staff admin = databaseHelper.getStaff(personId);
52 | ArrayList doctors = databaseHelper.getDoctors();
53 | ArrayList patients = databaseHelper.getPatients();
54 | ArrayList appointments = databaseHelper.getAppointment();
55 | ArrayList staffs = databaseHelper.getStaff();
56 | if (admin == null || doctors==null || patients==null || appointments == null) {
57 | // redirect to login
58 | redirectToLogin(request, response);
59 | return;
60 | }
61 | // redirect to person dashboard
62 | RequestDispatcher rs = request.getRequestDispatcher("admin.jsp");
63 | request.setAttribute("admin", admin);
64 | request.setAttribute("doctors", doctors);
65 | request.setAttribute("patients", patients);
66 | request.setAttribute("appointments", appointments);
67 | request.setAttribute("staffs", staffs);
68 | rs.forward(request, response);
69 | return;
70 | }
71 | } catch (Exception e) {
72 | e.printStackTrace();
73 | // redirect to login
74 | redirectToLogin(request, response);
75 | }
76 | }
77 |
78 | /**
79 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
80 | * response)
81 | */
82 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
83 | throws ServletException, IOException {
84 |
85 | doGet(request, response);
86 | }
87 |
88 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
89 | throws ServletException, IOException {
90 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
91 | request.setAttribute("error", "Please login again");
92 | rs.forward(request, response);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/PatientAppointmentDetails.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import patient.modal.Patient;
17 | import prescription.Lab;
18 | import prescription.Prescription;
19 |
20 | /**
21 | * Servlet implementation class PatientAppointmentDetails
22 | */
23 | @WebServlet("/patientAppointmentDetails")
24 | public class PatientAppointmentDetails extends HttpServlet {
25 | private static final long serialVersionUID = 1L;
26 |
27 | /**
28 | * @see HttpServlet#HttpServlet()
29 | */
30 | public PatientAppointmentDetails() {
31 | super();
32 |
33 | }
34 |
35 | /**
36 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
37 | * response)
38 | */
39 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
40 | throws ServletException, IOException {
41 | // redirect to login
42 | redirectToLogin(request, response);
43 | }
44 |
45 | /**
46 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
47 | * response)
48 | */
49 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
50 | throws ServletException, IOException {
51 | // get appointmentDetails from DB
52 | try {
53 | HttpSession session = request.getSession();
54 | int patientId = (int) session.getAttribute("UserID");
55 | int appointmentId = Integer.parseInt((String) request.getParameter("appointmentId"));
56 | // get appointment details
57 | DatabaseHelper databaseHelper = new DatabaseHelper();
58 | Appointment apointment = databaseHelper.getDetailedAppointment(appointmentId);
59 | ArrayList> appointments = databaseHelper.getAppointments(patientId, "patientId");
60 | ArrayList prescriptions = databaseHelper.getPrescription();
61 | ArrayList labs = databaseHelper.getLab();
62 | Patient patient = databaseHelper.getPatient(patientId);
63 | if (apointment == null || patient == null || appointments == null) {
64 | // redirect to login
65 | redirectToLogin(request, response);
66 | return;
67 | }
68 | // redirect to person detailed appointment
69 | RequestDispatcher rs = request.getRequestDispatcher("patientDetailedAppointment.jsp");
70 | request.setAttribute("apointment", apointment);
71 | request.setAttribute("patient", patient);
72 | request.setAttribute("appointments", appointments);
73 | request.setAttribute("prescriptions", prescriptions);
74 | request.setAttribute("labs", labs);
75 | rs.forward(request, response);
76 | return;
77 | } catch (Exception e) {
78 | e.printStackTrace();
79 | // redirect to login
80 | redirectToLogin(request, response);
81 | }
82 | }
83 |
84 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
85 | throws ServletException, IOException {
86 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
87 | request.setAttribute("error", "Please login again");
88 | rs.forward(request, response);
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/DoctorAppointmentDetails.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import prescription.Lab;
17 | import prescription.Prescription;
18 | import staff.modal.Doctor;
19 |
20 | /**
21 | * Servlet implementation class DoctorAppointmentDetails
22 | */
23 | @WebServlet("/doctorAppointmentDetails")
24 | public class DoctorAppointmentDetails extends HttpServlet {
25 | private static final long serialVersionUID = 1L;
26 |
27 | /**
28 | * @see HttpServlet#HttpServlet()
29 | */
30 | public DoctorAppointmentDetails() {
31 | super();
32 |
33 | }
34 |
35 | /**
36 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
37 | * response)
38 | */
39 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
40 | throws ServletException, IOException {
41 |
42 | response.getWriter().append("Served at: ").append(request.getContextPath());
43 | }
44 |
45 | /**
46 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
47 | * response)
48 | */
49 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
50 | throws ServletException, IOException {
51 | // get appointmentDetails from DB
52 | try {
53 | HttpSession session = request.getSession();
54 | int doctorId = (int) session.getAttribute("UserID");
55 | int appointmentId = Integer.parseInt((String) request.getParameter("appointmentId"));
56 | // get appointment details
57 | DatabaseHelper databaseHelper = new DatabaseHelper();
58 | Appointment apointment = databaseHelper.getDetailedAppointment(appointmentId);
59 | ArrayList> appointments = databaseHelper.getAppointments(doctorId, "doctorId");
60 | ArrayList prescriptions = databaseHelper.getPrescription();
61 | ArrayList labs = databaseHelper.getLab();
62 | Doctor doctor = databaseHelper.getDoctor(doctorId);
63 | if (apointment == null || doctor == null || appointments == null) {
64 | // redirect to login
65 | redirectToLogin(request, response);
66 | return;
67 | }
68 | // redirect to person detailed appointment
69 | RequestDispatcher rs = request.getRequestDispatcher("doctorDetailedAppointment.jsp");
70 | request.setAttribute("apointment", apointment);
71 | request.setAttribute("doctor", doctor);
72 | request.setAttribute("appointments", appointments);
73 | request.setAttribute("prescriptions", prescriptions);
74 | request.setAttribute("labs", labs);
75 | rs.forward(request, response);
76 | return;
77 | } catch (Exception e) {
78 | e.printStackTrace();
79 | // redirect to login
80 | redirectToLogin(request, response);
81 | }
82 | }
83 |
84 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
85 | throws ServletException, IOException {
86 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
87 | request.setAttribute("error", "Please login again");
88 | rs.forward(request, response);
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/CMC/src/patient/servlet/NewAppointmentItem.java:
--------------------------------------------------------------------------------
1 | package patient.servlet;
2 |
3 | import java.io.IOException;
4 |
5 | import javax.servlet.RequestDispatcher;
6 | import javax.servlet.ServletException;
7 | import javax.servlet.annotation.WebServlet;
8 | import javax.servlet.http.HttpServlet;
9 | import javax.servlet.http.HttpServletRequest;
10 | import javax.servlet.http.HttpServletResponse;
11 |
12 | import database.DatabaseHelper;
13 |
14 | /**
15 | * Servlet implementation class NewAppointmentItem
16 | */
17 | @WebServlet("/newAppointmentItem")
18 | public class NewAppointmentItem extends HttpServlet {
19 | private static final long serialVersionUID = 1L;
20 |
21 | /**
22 | * @see HttpServlet#HttpServlet()
23 | */
24 | public NewAppointmentItem() {
25 | super();
26 |
27 | }
28 |
29 | /**
30 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
31 | */
32 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
33 | // redirect to login
34 | redirectToLogin(request, response);
35 | }
36 |
37 | /**
38 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
39 | */
40 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
41 | try{
42 | int appointmentId = Integer.valueOf(request.getParameter("appointmentId"));
43 | // insert in DB
44 | int sendType = Integer.valueOf((String)request.getParameter("sendType"));
45 | int status = 0;
46 | if(sendType == 1 || sendType == 2 || sendType == 6){
47 | status = new DatabaseHelper().addItemInAppointment(appointmentId,
48 | sendType, (String) request.getParameter("description"));
49 | }else if(sendType == 3){
50 | status = new DatabaseHelper().addItemInAppointment(appointmentId,
51 | sendType, "Medicine Prescribed");
52 | }else if(sendType == 4){
53 | status = new DatabaseHelper().addItemInAppointment(appointmentId,
54 | sendType, "Lab Report Generated For "+ request.getParameter("labName"));
55 | }else if(sendType == 5){
56 | status = new DatabaseHelper().addItemInAppointment(appointmentId,
57 | sendType, request.getParameter("labName")+": Lab Report Requested");
58 | }
59 |
60 | if (status > 0) {
61 | // successfully inserted
62 | // redirect to detailedPatientAppointment
63 | if(sendType == 3){
64 | new DatabaseHelper().addPrescription(request.getParameter("medicineName"),
65 | Double.parseDouble(request.getParameter("quantity")),Integer.parseInt(request.getParameter("times")),status);
66 | }
67 | else if(sendType == 5){
68 | new DatabaseHelper().addLab(request.getParameter("labName"),
69 | request.getParameter("testFor"),status,
70 | Integer.parseInt((String)(request.getParameter("doctorId"))));
71 | }
72 | RequestDispatcher rs;
73 | rs = request.getRequestDispatcher((String)request.getParameter("requestDispatcher"));
74 | request.setAttribute("appointmentId", appointmentId);
75 | rs.forward(request, response);
76 | } else {
77 | // redirect to login
78 | redirectToLogin(request, response);
79 | }
80 | }catch(Exception e){
81 | e.printStackTrace();
82 | // redirect to login
83 | redirectToLogin(request, response);
84 | }
85 | }
86 |
87 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
88 | throws ServletException, IOException {
89 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
90 | request.setAttribute("error", "Please login again");
91 | rs.forward(request, response);
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/Database/cmc_appointment.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.18-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `appointment`
20 | --
21 |
22 | DROP TABLE IF EXISTS `appointment`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `appointment` (
26 | `appointmentId` int(11) NOT NULL AUTO_INCREMENT,
27 | `patientId` int(11) NOT NULL,
28 | `doctorId` int(11) DEFAULT NULL,
29 | `isClosed` int(11) DEFAULT '0',
30 | `dateCreated` double DEFAULT NULL,
31 | `symptons` varchar(45) DEFAULT NULL,
32 | `disease` varchar(45) DEFAULT NULL,
33 | `preferredDate` double DEFAULT NULL,
34 | `allocatedDate` double DEFAULT '0',
35 | `title` varchar(45) DEFAULT NULL,
36 | PRIMARY KEY (`appointmentId`),
37 | KEY `appointment_ibfk_1_idx` (`patientId`),
38 | KEY `appointment_ibfk_2_idx` (`doctorId`),
39 | CONSTRAINT `appointment_ibfk_1` FOREIGN KEY (`patientId`) REFERENCES `patient` (`patientId`),
40 | CONSTRAINT `appointment_ibfk_2` FOREIGN KEY (`doctorId`) REFERENCES `doctor` (`doctorId`)
41 | ) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1;
42 | /*!40101 SET character_set_client = @saved_cs_client */;
43 |
44 | --
45 | -- Dumping data for table `appointment`
46 | --
47 |
48 | LOCK TABLES `appointment` WRITE;
49 | /*!40000 ALTER TABLE `appointment` DISABLE KEYS */;
50 | INSERT INTO `appointment` VALUES (1,1,12,1,1492426867320,'Cough',' Tubercolosis',1492426867320,1492426867320,'Tubercolosis in Cough'),(2,1,11,0,1492427049030,'Heart Pain',' Heart Attack',1492427049030,1492427049030,'Heart Attack and pain'),(3,2,12,1,1492427176793,'Headache',' Brain Tumor',1492427176793,1492427176793,'Tumour in Brain'),(4,2,11,0,1492427265008,'Headache','Migraine',1492427265008,1492427265008,'Migraine'),(5,3,12,1,1492427355113,'Pain in Bones',' Bone Fracture',1492427355113,1492427355113,'Bone Broken'),(6,3,11,0,1492427586601,'Pain in Left Ear','Ear Drum Rupture',1492427586601,1492427586601,'Left Ear Damage'),(7,4,12,1,1492427777615,'Pain in eye','Eye Infection',1492427777615,1492427777615,'Eye Problem'),(8,4,11,0,1492519085680,'Sneezing','Cold',1492519085680,1492519085680,'Cold and Sneeze'),(9,5,12,1,1492620672132,'Nose Bleeding','Nose Cancer',1492540200020,1492519085681,'Nose Problem'),(10,5,11,0,1492633630915,'Constipation','Mental Pressure',1492540200040,1492519089681,'Acute Constipation Problem'),(11,1,14,0,1492722733367,'the ache in the stomach','Worms',1492972200000,1492972200000,'Stomach'),(12,1,15,0,1492723131704,'Headache','Migrane',1492713000000,1492713000000,'Headache');
51 | /*!40000 ALTER TABLE `appointment` ENABLE KEYS */;
52 | UNLOCK TABLES;
53 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
54 |
55 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
56 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
57 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
58 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
59 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
60 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
61 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
62 |
63 | -- Dump completed on 2017-04-21 3:47:43
64 |
--------------------------------------------------------------------------------
/Database/cmc_person.sql:
--------------------------------------------------------------------------------
1 | -- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
2 | --
3 | -- Host: localhost Database: cmc
4 | -- ------------------------------------------------------
5 | -- Server version 5.7.18-log
6 |
7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 | /*!40101 SET NAMES utf8 */;
11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 | /*!40103 SET TIME_ZONE='+00:00' */;
13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
17 |
18 | --
19 | -- Table structure for table `person`
20 | --
21 |
22 | DROP TABLE IF EXISTS `person`;
23 | /*!40101 SET @saved_cs_client = @@character_set_client */;
24 | /*!40101 SET character_set_client = utf8 */;
25 | CREATE TABLE `person` (
26 | `personId` int(11) NOT NULL AUTO_INCREMENT,
27 | `firstName` varchar(10) NOT NULL,
28 | `lastName` varchar(10) DEFAULT NULL,
29 | `userName` varchar(20) NOT NULL,
30 | `password` varchar(20) NOT NULL,
31 | `dob` double DEFAULT NULL,
32 | `token` varchar(10) CHARACTER SET big5 DEFAULT '0',
33 | `personType` int(1) NOT NULL DEFAULT '1',
34 | `gender` varchar(2) DEFAULT 'NA',
35 | `address` varchar(45) DEFAULT NULL,
36 | `contactNumber` varchar(14) DEFAULT NULL,
37 | PRIMARY KEY (`personId`),
38 | UNIQUE KEY `userName_UNIQUE` (`userName`),
39 | KEY `type` (`personType`),
40 | CONSTRAINT `person_ibfk_1` FOREIGN KEY (`personType`) REFERENCES `persontype` (`typeId`)
41 | ) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
42 | /*!40101 SET character_set_client = @saved_cs_client */;
43 |
44 | --
45 | -- Dumping data for table `person`
46 | --
47 |
48 | LOCK TABLES `person` WRITE;
49 | /*!40000 ALTER TABLE `person` DISABLE KEYS */;
50 | INSERT INTO `person` VALUES (1,'Vishal','Sanghai','vishal','qwerty',925842600000,'1',1,'M','Dover Terrace, Kolkata','9521113802'),(2,'Shubham ','Mangal','shubham','qwerty',925842600000,'1',1,'M','Mansarovar, Jaipur','9571620779'),(3,'Satyam','Shubham','satyam','qwerty',925842600000,'1',1,'M','Bihar Sharif, Nalanda','8981000909'),(4,'Harsh','Modi','harsh','qwerty',925842600000,'1',1,'M','Jaipuria Marg, Indore','8981000899'),(5,'Hemant','Verma','hemant','qwerty',925842600000,'1',1,'M','Pagal Gali, Ganganagar','8981001717'),(6,'Anmol','Ratnam','anmol','qwerty',925842600000,'1',1,'M','Panchawati Chowk, Hazaribagh','9521113806'),(7,'Utsav','Singh','utsav','qwerty',925842600000,'1',1,'M','Ram Gali, Patna','9521113816'),(8,'Akshat','Mathur','akshat','qwerty',925842600000,'1',1,'M','Jai Baba, Ajmer','9163990299'),(9,'Rishabh','Tiwari','rishabh','qwerty',925842600000,'1',1,'M','Ankur Villa, Gurgaon','9830085588'),(10,'Vishwesh','Jainkuniya','vishwesh','qwerty',889236840000,'1',1,'M','Park Street, Pratapgarh','8100055671'),(11,'Dr. Rachit','Sharma','rachit','qwerty',925842600000,'1',2,'M','Billu Marg, Jaipur','8114487323'),(12,'Dr. Gourav','Khatri','gourav','qwerty',889236840000,'1',2,'M','Howrah, Kolkata','8240558662'),(13,'Dr. Ankur','Arora','ankur','qwerty',925842600000,'1',2,'M','Hauz Kauz, Delhi','9521356402'),(14,'Dr. Vivek','Tewari','vivek','qwerty',889236840000,'1',2,'M','Jheel, Hazaribagh','8987213127'),(15,'Dr. Manas','Jain','manas','qwerty',925842600000,'1',2,'M','Boli Marg, Udaipur','8898645151'),(16,'Ruchika','Sharma','ruchika','qwerty',925842600000,'1',3,'F','Jaipur','8574878596'),(17,'Ritu','Jain','ritu','qwerty',925842600000,'1',4,'F','Udaipur','8574875485'),(18,'Karishma','Chawla','karishma','qwerty',925842600000,'1',5,'F',' CP, New Delhi','9865478521');
51 | /*!40000 ALTER TABLE `person` ENABLE KEYS */;
52 | UNLOCK TABLES;
53 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
54 |
55 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
56 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
57 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
58 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
59 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
60 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
61 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
62 |
63 | -- Dump completed on 2017-04-21 3:47:43
64 |
--------------------------------------------------------------------------------
/CMC/src/staff/servlet/ReceptionistAppointmentDetails.java:
--------------------------------------------------------------------------------
1 | package staff.servlet;
2 |
3 | import java.io.IOException;
4 | import java.util.ArrayList;
5 |
6 | import javax.servlet.RequestDispatcher;
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 | import modal.Appointment;
16 | import prescription.Lab;
17 | import prescription.Prescription;
18 | import staff.modal.Doctor;
19 | import staff.modal.Staff;
20 |
21 | /**
22 | * Servlet implementation class ReceptionistAppointmentDetails
23 | */
24 | @WebServlet("/receptionistAppointmentDetails")
25 | public class ReceptionistAppointmentDetails extends HttpServlet {
26 | private static final long serialVersionUID = 1L;
27 |
28 | /**
29 | * @see HttpServlet#HttpServlet()
30 | */
31 | public ReceptionistAppointmentDetails() {
32 | super();
33 | }
34 |
35 | /**
36 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
37 | * response)
38 | */
39 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
40 | throws ServletException, IOException {
41 | // redirect to login
42 | redirectToLogin(request, response);
43 | return;
44 | }
45 |
46 | /**
47 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
48 | * response)
49 | */
50 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
51 | throws ServletException, IOException {
52 | // get appointmentDetails from DB
53 | try {
54 | HttpSession session = request.getSession();
55 | int personId = (int) session.getAttribute("UserID");
56 | int appointmentId = Integer.parseInt((String) request.getParameter("appointmentId"));
57 | // get appointment details
58 | DatabaseHelper databaseHelper = new DatabaseHelper();
59 | Appointment apointment = databaseHelper.getDetailedAppointment(appointmentId);
60 | ArrayList> appointments = databaseHelper.getAppointments(personId, null);
61 | ArrayList prescriptions = databaseHelper.getPrescription();
62 | ArrayList labs = databaseHelper.getLab();
63 | Staff receptionist = databaseHelper.getStaff(personId);
64 |
65 | if (apointment != null && receptionist != null && appointments != null) {
66 | if (apointment.getAllocatedDate() == 0) {
67 |
68 | ArrayList doctors = databaseHelper.getDoctors();
69 | if (doctors == null) {
70 | // redirect to login
71 | redirectToLogin(request, response);
72 | return;
73 | } else {
74 | // redirect to receptionist detailed appointment
75 | RequestDispatcher rs = request.getRequestDispatcher("receptionistDetailedAppointment.jsp");
76 | request.setAttribute("appointment", apointment);
77 | request.setAttribute("receptionist", receptionist);
78 | request.setAttribute("appointments", appointments);
79 | request.setAttribute("doctors", doctors);
80 | request.setAttribute("prescriptions", prescriptions);
81 | request.setAttribute("labs", labs);
82 | rs.forward(request, response);
83 | return;
84 | }
85 | }else
86 | {
87 | // redirect to receptionist detailed appointment
88 | RequestDispatcher rs = request.getRequestDispatcher("receptionistDetailedAppointment.jsp");
89 | request.setAttribute("appointment", apointment);
90 | request.setAttribute("receptionist", receptionist);
91 | request.setAttribute("appointments", appointments);
92 | request.setAttribute("prescriptions", prescriptions);
93 | request.setAttribute("labs", labs);
94 | rs.forward(request, response);
95 | return;
96 | }
97 |
98 | }
99 |
100 | } catch (Exception e) {
101 | e.printStackTrace();
102 | // redirect to login
103 | redirectToLogin(request, response);
104 | }
105 | }
106 |
107 | private void redirectToLogin(HttpServletRequest request, HttpServletResponse response)
108 | throws ServletException, IOException {
109 | RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
110 | request.setAttribute("error", "Please login again");
111 | rs.forward(request, response);
112 | }
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/CMC/src/utils/DashUtils.java:
--------------------------------------------------------------------------------
1 | package utils;
2 |
3 | import java.util.ArrayList;
4 |
5 | import database.DatabaseHelper;
6 | import modal.Appointment;
7 | import patient.modal.Patient;
8 | import staff.modal.Doctor;
9 | import staff.modal.Staff;
10 |
11 | public class DashUtils {
12 |
13 | public static double getBMI(double height, double weight) {
14 | if (height > 0 && weight > 0) {// convert height in meter
15 | double meterHeight = height / 100;
16 | // square height
17 | double squareHeight = meterHeight * meterHeight;
18 | return (int)(weight / squareHeight);
19 | } else {
20 | return 0;
21 | }
22 | }
23 |
24 | public static int getMedicineCount(int patientId){
25 | DatabaseHelper databaseHelper = new DatabaseHelper();
26 | ArrayList appointments = databaseHelper.getAppointment();
27 | int count = 0;
28 | for(int i = 0; i < appointments.size(); i++ ){
29 | if(appointments.get(i).getPatient().getId() == patientId){
30 | for(int j = 0; j < appointments.get(i).getItems().size(); j++){
31 | if(appointments.get(i).getItems().get(j).getType() == 3){
32 | count++;
33 | }
34 | }
35 | }
36 | }
37 | return count;
38 | }
39 |
40 | public static int getProfileRating(int personId, int type){
41 | DatabaseHelper databaseHelper = new DatabaseHelper();
42 | int res = 0, count = 0,rate;
43 | switch(type){
44 | case 1:
45 | rate = 10;
46 | Patient patient = databaseHelper.getPatient(personId);
47 | if(patient.getFirstName()!=null)count++;
48 | if(patient.getLastName()!=null)count++;
49 | if(patient.getGender()!=null)count++;
50 | if(patient.getAddress()!=null)count++;
51 | if(patient.getContactNumber()!=null)count++;
52 | if(patient.getBloodGroup()!=null)count++;
53 | if(patient.getHeight()!=0)count++;
54 | if(patient.getWeight()!=0)count++;
55 | if(patient.getUserName()!=null)count++;
56 | if(patient.getStringDob()!=null)count++;
57 | res= (count/rate)*100;
58 | break;
59 | case 2:
60 | rate = 9;
61 | Doctor doctor = databaseHelper.getDoctor(personId);
62 | if(doctor.getFirstName()!=null)count++;
63 | if(doctor.getLastName()!=null)count++;
64 | if(doctor.getGender()!=null)count++;
65 | if(doctor.getAddress()!=null)count++;
66 | if(doctor.getContactNumber()!=null)count++;
67 | if(doctor.getSpecialization()!=null)count++;
68 | if(doctor.getDegree()!=null)count++;
69 | if(doctor.getUserName()!=null)count++;
70 | if(doctor.getStringDob()!=null)count++;
71 | res= (count/rate)*100;
72 | break;
73 | case 3:
74 | rate = 7;
75 | Staff admin = databaseHelper.getStaff(personId);
76 | if(admin.getFirstName()!=null)count++;
77 | if(admin.getLastName()!=null)count++;
78 | if(admin.getGender()!=null)count++;
79 | if(admin.getAddress()!=null)count++;
80 | if(admin.getContactNumber()!=null)count++;
81 | if(admin.getUserName()!=null)count++;
82 | if(admin.getStringDob()!=null)count++;
83 | res= (count/rate)*100;
84 | break;
85 | case 4:
86 | rate = 7;
87 | Staff labPerson = databaseHelper.getStaff(personId);
88 | if(labPerson.getFirstName()!=null)count++;
89 | if(labPerson.getLastName()!=null)count++;
90 | if(labPerson.getGender()!=null)count++;
91 | if(labPerson.getAddress()!=null)count++;
92 | if(labPerson.getContactNumber()!=null)count++;
93 | if(labPerson.getUserName()!=null)count++;
94 | if(labPerson.getStringDob()!=null)count++;
95 | res= (count/rate)*100;
96 | break;
97 | case 5:
98 | rate = 7;
99 | Staff receptionist = databaseHelper.getStaff(personId);
100 | if(receptionist.getFirstName()!=null)count++;
101 | if(receptionist.getLastName()!=null)count++;
102 | if(receptionist.getGender()!=null)count++;
103 | if(receptionist.getAddress()!=null)count++;
104 | if(receptionist.getContactNumber()!=null)count++;
105 | if(receptionist.getUserName()!=null)count++;
106 | if(receptionist.getStringDob()!=null)count++;
107 | res= (count/rate)*100;
108 | break;
109 |
110 | }
111 | return res;
112 | }
113 |
114 | public static int getTotalAppointment(){
115 | DatabaseHelper databaseHelper = new DatabaseHelper();
116 | ArrayList appointments = databaseHelper.getAppointment();
117 | return appointments.size();
118 | }
119 |
120 | public static int getUnapprovedAppointment(){
121 | DatabaseHelper databaseHelper = new DatabaseHelper();
122 | ArrayList appointments = databaseHelper.getAppointment();
123 | int count = 0;
124 | for(int i = 0; i < appointments.size(); i++ ){
125 | if(appointments.get(i).getAllocatedDate()==0){
126 | count++;
127 | }
128 | }
129 | return count;
130 | }
131 |
132 |
133 | }
134 |
--------------------------------------------------------------------------------
/CMC/src/authentication/Login.java:
--------------------------------------------------------------------------------
1 | package authentication;
2 |
3 | import java.io.IOException;
4 | import java.io.PrintWriter;
5 | import java.util.Date;
6 |
7 | import javax.servlet.ServletException;
8 | import javax.servlet.annotation.WebServlet;
9 | import javax.servlet.http.HttpServlet;
10 | import javax.servlet.http.HttpServletRequest;
11 | import javax.servlet.http.HttpServletResponse;
12 | import javax.servlet.http.HttpSession;
13 |
14 | import database.DatabaseHelper;
15 |
16 | /**
17 | * Servlet implementation class login
18 | */
19 | @WebServlet("/login")
20 | public class Login extends HttpServlet {
21 | private static final long serialVersionUID = 1L;
22 |
23 | /**
24 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
25 | * response)
26 | */
27 | protected void doGet(HttpServletRequest request, HttpServletResponse response)
28 | throws ServletException, IOException {
29 | if (!response.isCommitted()) {// redirect to login page
30 | request.getRequestDispatcher("login.jsp").forward(request, response);
31 | }
32 | }
33 | protected void doPost(HttpServletRequest request, HttpServletResponse response)
34 | throws ServletException, IOException {
35 |
36 | response.setContentType("text/html;charset=UTF-8");
37 | PrintWriter out = response.getWriter();
38 | HttpSession session;
39 | Date createTime;
40 | String userName = request.getParameter("username");
41 | String password = request.getParameter("password");
42 |
43 | // validate credentials and get user type
44 | int personType[] = new DatabaseHelper().getPersonType(userName, password);
45 | switch (personType[0]) {
46 | case -1:
47 | // can't connect to DB
48 | out.println("can't connect to DB");
49 | request.getRequestDispatcher("login.jsp").include(request, response);
50 | break;
51 | case 0:
52 | // not valid credentials
53 | out.println("Username or Password incorrect");
54 | request.setAttribute("error", "We can't recognize you!!");
55 | request.getRequestDispatcher("login.jsp").forward(request, response);
56 | break;
57 | case 1:
58 | // person is patient
59 | session = request.getSession();
60 | session.setAttribute("UserID", personType[1]);
61 | session.setAttribute("UserType", "patient");
62 | session.setMaxInactiveInterval(60000);
63 | createTime = new Date(session.getCreationTime());
64 | session.setAttribute("CreateTime", createTime);
65 | session.setAttribute("LastAccess", createTime);
66 | request.getRequestDispatcher("patient").forward(request, response);
67 | break;
68 | case 2:
69 | // person is doctor
70 | session = request.getSession();
71 | session.setAttribute("UserID", personType[1]);
72 | session.setAttribute("UserType", "doctor");
73 | session.setMaxInactiveInterval(60000);
74 | createTime = new Date(session.getCreationTime());
75 | session.setAttribute("CreateTime", createTime);
76 | session.setAttribute("LastAccess", createTime);
77 | request.getRequestDispatcher("doctor").forward(request, response);
78 | break;
79 | case 3:
80 | // person is admin
81 | session = request.getSession();
82 | session.setAttribute("UserID", personType[1]);
83 | session.setAttribute("UserType", "admin");
84 | session.setMaxInactiveInterval(60000);
85 | createTime = new Date(session.getCreationTime());
86 | session.setAttribute("CreateTime", createTime);
87 | session.setAttribute("LastAccess", createTime);
88 | request.getRequestDispatcher("admin").forward(request, response);
89 | break;
90 | case 4:
91 | // person is labPerson
92 | session = request.getSession();
93 | session.setAttribute("UserID", personType[1]);
94 | session.setAttribute("UserType", "labPerson");
95 | session.setMaxInactiveInterval(60000);
96 | createTime = new Date(session.getCreationTime());
97 | session.setAttribute("CreateTime", createTime);
98 | session.setAttribute("LastAccess", createTime);
99 | request.getRequestDispatcher("labPerson").forward(request, response);
100 | break;
101 | case 5:
102 | // person is receptionist
103 | session = request.getSession();
104 | session.setAttribute("UserID", personType[1]);
105 | session.setAttribute("UserType", "receptionist");
106 | session.setMaxInactiveInterval(60000);
107 | createTime = new Date(session.getCreationTime());
108 | session.setAttribute("CreateTime", createTime);
109 | session.setAttribute("LastAccess", createTime);
110 | request.getRequestDispatcher("receptionist").forward(request, response);
111 | break;
112 | default:
113 | // redirect to login page
114 | request.getRequestDispatcher("login.jsp").forward(request, response);
115 | }
116 |
117 | doGet(request, response);
118 | }
119 |
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/CMC/src/modal/Appointment.java:
--------------------------------------------------------------------------------
1 | package modal;
2 |
3 | import java.util.ArrayList;
4 |
5 | import patient.modal.Patient;
6 | import staff.modal.Doctor;
7 | import utils.DateUtils;
8 |
9 | public class Appointment {
10 | private int id;
11 | private Doctor doctor;
12 | private Patient patient;
13 | private int isClosed;
14 | private long preferredDate;
15 | private long allocatedDate;
16 | private long dateCreated;
17 | private ArrayList items;
18 | private String symptons;
19 | private String disease;
20 | private String title;
21 |
22 | public Appointment(int id, Doctor doctor, Patient patient, int isClosed, long preferredDate, long allocatedDate,
23 | long dateCreated, ArrayList items, String symptons, String disease, String title) {
24 | this.id = id;
25 | this.doctor = doctor;
26 | this.patient = patient;
27 | this.isClosed = isClosed;
28 | this.preferredDate = preferredDate;
29 | this.allocatedDate = allocatedDate;
30 | this.dateCreated = dateCreated;
31 | this.items = items;
32 | this.symptons = symptons;
33 | this.disease = disease;
34 | this.title = title;
35 | }
36 |
37 |
38 |
39 | public Appointment(Doctor doctor, Patient patient, int isClosed, long preferredDate, long allocatedDate,
40 | long dateCreated, ArrayList items, String symptons, String disease, String title) {
41 | this.doctor = doctor;
42 | this.patient = patient;
43 | this.isClosed = isClosed;
44 | this.preferredDate = preferredDate;
45 | this.allocatedDate = allocatedDate;
46 | this.dateCreated = dateCreated;
47 | this.items = items;
48 | this.symptons = symptons;
49 | this.disease = disease;
50 | this.title = title;
51 | }
52 |
53 |
54 |
55 | public Appointment(int id, Doctor doctor, int isClosed, long dateCreated, ArrayList items) {
56 | this.id = id;
57 | this.doctor= doctor;
58 | this.isClosed = isClosed;
59 | this.dateCreated = dateCreated;
60 | this.items = items;
61 | }
62 |
63 | public Appointment(Patient patient, String symptons, String disease, long preferredDate, String title) {
64 | this.setPatient(patient);
65 | this.setIsClosed(0);
66 | this.setDateCreated(System.currentTimeMillis());
67 | this.setSymptons(symptons);
68 | this.setDisease(disease);
69 | this.preferredDate = preferredDate;
70 | this.title = title;
71 | }
72 |
73 | public Appointment(int id, Doctor doctor, String title, long dateCreated, Patient patient, String disease) {
74 | this.id=id;
75 | this.doctor= doctor;
76 | this.title=title;
77 | this.dateCreated = dateCreated;
78 | this.patient=patient;
79 | this.disease = disease;
80 | }
81 |
82 | public Appointment(int id, Doctor doctor, String title, long dateCreated, String symptons,
83 | String disease, Patient patient, long allocatedDate, long preferredDate, int isClosed) {
84 | this.id=id;
85 | this.doctor= doctor;
86 | this.title=title;
87 | this.dateCreated = dateCreated;
88 | this.symptons=symptons;
89 | this.disease =disease;
90 | this.patient = patient;
91 | this.allocatedDate =allocatedDate;
92 | this.preferredDate = preferredDate;
93 | this.isClosed=isClosed;
94 | }
95 |
96 | public int getId() {
97 | return id;
98 | }
99 |
100 | public Patient getPatient() {
101 | return patient;
102 | }
103 |
104 | public void setPatient(Patient patient) {
105 | this.patient = patient;
106 | }
107 |
108 | public String getSymptons() {
109 | return symptons;
110 | }
111 |
112 | public void setSymptons(String symptons) {
113 | this.symptons = symptons;
114 | }
115 |
116 | public String getDisease() {
117 | return disease;
118 | }
119 |
120 | public void setDisease(String disease) {
121 | this.disease = disease;
122 | }
123 |
124 | public String getStringPreferredDate() {
125 | return DateUtils.getStringFromDate(preferredDate);
126 | }
127 |
128 | public long getPreferredDate() {
129 | return preferredDate;
130 | }
131 |
132 | public void setPreferredDate(long preferredDate) {
133 | this.preferredDate = preferredDate;
134 | }
135 |
136 | public String getStringAllocatedDate() {
137 | return DateUtils.getDateTtimeSringFromDate(allocatedDate);
138 | }
139 |
140 | public long getAllocatedDate() {
141 | return allocatedDate;
142 | }
143 |
144 | public void setAllocatedDate(long allocatedDate) {
145 | this.allocatedDate = allocatedDate;
146 | }
147 |
148 | public ArrayList getItems() {
149 | return items;
150 | }
151 |
152 | public void setItems(ArrayList items) {
153 | this.items = items;
154 | }
155 |
156 |
157 | public String getStringDateCreated() {
158 | return DateUtils.getDateTtimeSringFromDate(dateCreated);
159 | }
160 |
161 | public void setDateCreated(long dateCreated) {
162 | this.dateCreated = dateCreated;
163 | }
164 |
165 | public int getIsClosed() {
166 | return isClosed;
167 | }
168 |
169 | public void setIsClosed(int isClosed) {
170 | this.isClosed = isClosed;
171 | }
172 |
173 | public Doctor getDoctor() {
174 | return doctor;
175 | }
176 |
177 | public void setDoctor(Doctor doctor) {
178 | this.doctor = doctor;
179 | }
180 |
181 |
182 | public String getTitle() {
183 | return title;
184 | }
185 |
186 |
187 | public void setTitle(String title) {
188 | this.title = title;
189 | }
190 | }
191 |
--------------------------------------------------------------------------------
/CMC/WebContent/editLabPersonProfile.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ page
4 | import="staff.modal.Staff"%>
5 | <%
6 | if(request.getAttribute("labPerson")==null){
7 | response.sendRedirect("labPerson");
8 | }
9 | else{
10 | Staff labPerson = (Staff)request.getAttribute("labPerson");
11 | %>
12 |
13 |
14 |
15 |
16 | Edit Profile - LabPerson Dashboard - Central Medic Center
17 |
21 |
22 |
23 |
24 |
25 |
26 |
50 |
51 |
163 |
164 |
166 |
167 |
169 |
170 |
172 |
173 |
174 | <%
175 | }
176 | %>
--------------------------------------------------------------------------------
/CMC/WebContent/editAdminProfile.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 | <%@ page
5 | import="staff.modal.Staff"%>
6 | <%
7 | if(request.getAttribute("admin")==null){
8 | response.sendRedirect("admin");
9 | }
10 | else{
11 | Staff admin = (Staff)request.getAttribute("admin");
12 | %>
13 |
14 |
15 |
16 |
17 | Edit Profile - Admin Dashboard - Central Medic Center
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
52 |
53 |
54 |
55 |
79 |
80 |
81 |
84 |
85 |
162 |
163 |
164 |
165 |
166 |
168 |
169 |
171 |
172 |
174 |
175 |
176 | <%
177 | }
178 | %>
--------------------------------------------------------------------------------
/CMC/WebContent/labPerson.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ page
4 | import="staff.modal.Staff, java.util.ArrayList, prescription.Lab"%>
5 | <%
6 | if(request.getAttribute("labPerson")==null || request.getAttribute("labs")==null){
7 | response.sendRedirect("labPerson");
8 | }
9 | else{
10 | Staff labPerson = (Staff)request.getAttribute("labPerson");
11 | ArrayList> labs = (ArrayList>)request.getAttribute("labs");
12 | %>
13 |
14 |
15 |
16 |
17 | LabPerson Dashboard - Central Medic Center
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
54 |
55 |
56 |
57 |
84 |
85 |
86 |
87 |
123 |
124 |
125 |
126 |
127 | | Report Id :- |
128 | Doctor Name |
129 | Lab Name |
130 | Test For |
131 | Lab Result |
132 | |
133 |
134 |
135 |
136 | <% ArrayList closedLabs = labs.get(1);
137 | for(int i=0; i
140 |
141 | | <%=lab.getLabId() %> |
142 | <%=lab.getDoctor().getFirstName() %> |
143 | <%=lab.getLabName() %> |
144 | <%=lab.getTestFor() %> |
145 | <%=lab.getLabResult() %> |
146 |
147 | <% } %>
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
Last Login
160 |
161 | <%= session.getAttribute("LastAccess") %>
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
172 |
173 |
175 |
176 |
178 |
186 |
194 |
195 |
196 | <%
197 | }
198 | %>
--------------------------------------------------------------------------------
/CMC/WebContent/receptionist.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 | <%@ page
5 | import="staff.modal.Staff, java.util.ArrayList, modal.Appointment, staff.modal.Doctor, patient.modal.DashBoard"%>
6 | <%
7 | if(request.getAttribute("receptionist")==null || request.getAttribute("appointments")==null ){
8 | response.sendRedirect("receptionist");
9 | }
10 | else{
11 | Staff receptionist = (Staff)request.getAttribute("receptionist");
12 | ArrayList> arrayList = (ArrayList>)request.getAttribute("appointments");
13 | DashBoard dashBoard = (DashBoard)request.getAttribute("dashBoard");
14 |
15 | %>
16 |
17 |
18 |
19 |
20 | Receptionist Dashboard - Central Medic Center
21 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
56 |
57 |
58 |
59 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |

152 |
153 |
<%= dashBoard.getNoOfAppointment() %> Appointment Request
154 |
155 |
156 |
157 |
158 |
159 |

160 |
161 |
<%= dashBoard.getPatientCount() %> Total Appointments
162 |
163 |
164 |
165 |
166 |
167 |

168 |
169 |
<%= dashBoard.getPercentProfile() %>% Profile
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 | Last Login
179 |
180 |
181 | <%= session.getAttribute("LastAccess") %>
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
192 |
193 |
195 |
196 |
198 |
199 |
200 | <%
201 | }
202 | %>
--------------------------------------------------------------------------------
/CMC/WebContent/signup.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8" import="java.io.*,java.util.*"%>
3 | <%
4 |
5 | if (!session.isNew() && session.getAttribute("UserID")!=null){
6 | Date lastAccessTime = new Date(session.getLastAccessedTime());
7 | session.setAttribute("LastAccess", lastAccessTime);
8 | String type = (String) session.getAttribute("UserType");
9 |
10 | if(type.equals("patient")){
11 | response.sendRedirect("patient");
12 | }
13 | else if(type.equals("doctor")){
14 | response.sendRedirect("doctor");
15 | }
16 |
17 | }
18 | else{
19 | %>
20 |
21 |
22 |
23 |
24 | Sign Up - Central Medic Center
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | Central Medic Center
36 |
37 |
38 |
187 |
188 |
189 |
190 |
191 |
193 |
194 |
196 |
214 |
215 |
216 | <%
217 | }
218 | %>
--------------------------------------------------------------------------------
/CMC/WebContent/doctor.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 | <%@ page
5 | import="patient.modal.Patient, java.util.ArrayList, modal.Appointment, staff.modal.Doctor, patient.modal.DashBoard"%>
6 | <%
7 | if(request.getAttribute("doctor")==null || request.getAttribute("appointments")==null){
8 | response.sendRedirect("doctor");
9 | }
10 | else{
11 | Doctor doctor = (Doctor)request.getAttribute("doctor");
12 | ArrayList> arrayList = (ArrayList>)request.getAttribute("appointments");
13 | DashBoard dashBoard = (DashBoard)request.getAttribute("dashBoard");
14 | %>
15 |
16 |
17 |
18 |
19 | Doctor Dashboard - Central Medic Center
20 |
24 |
25 |
26 |
27 |
28 |
29 |
53 |
54 |
55 |
56 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |

153 |
154 |
<%= dashBoard.getNoOfAppointment() %> Appointments
155 |
156 |
157 |
158 |
159 |
160 |

161 |
162 |
<%= dashBoard.getPatientCount() %> Patients Treated
163 |
164 |
165 |
173 |
174 |
175 |
176 |

177 |
178 |
<%= dashBoard.getPercentProfile() %>% Profile
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 | Last Login
188 |
189 |
190 | <%= session.getAttribute("LastAccess") %>
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
202 |
203 |
205 |
206 |
208 |
209 |
210 | <%
211 | }
212 | %>
--------------------------------------------------------------------------------
/CMC/WebContent/patient.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 | <%@ page
5 | import="patient.modal.Patient, java.util.ArrayList, modal.Appointment, staff.modal.Doctor, patient.modal.DashBoard"%>
6 | <%
7 | if(request.getAttribute("patient")==null || request.getAttribute("appointments")==null || request.getAttribute("dashBoard") == null){
8 | response.sendRedirect("patient");
9 | }
10 | else{
11 | Patient patient = (Patient)request.getAttribute("patient");
12 | ArrayList> arrayList = (ArrayList>)request.getAttribute("appointments");
13 | DashBoard dashBoard = (DashBoard)request.getAttribute("dashBoard");
14 | %>
15 |
16 |
17 |
18 |
19 | Patient Dashboard - Central Medic Center
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
55 |
56 |
57 |
58 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |

157 |
158 |
<%= dashBoard.getNoOfAppointment() %> Appointments
159 |
160 |
161 |
162 |
163 |
164 |

165 |
166 |
BMI : <%= dashBoard.getBmi() %>
167 |
168 |
169 |
170 |
171 |
172 |

173 |
174 |
<%= dashBoard.getNoOfMedicines() %> Medicines
175 |
176 |
177 |
178 |
179 |
180 |

181 |
182 |
<%= dashBoard.getPercentProfile() %>% Profile
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 | Last Login
192 |
193 |
194 | <%= session.getAttribute("LastAccess") %>
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
205 |
206 |
208 |
209 |
211 |
212 |
213 | <%
214 | }
215 | %>
--------------------------------------------------------------------------------
/CMC/WebContent/bookAppointment.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=UTF-8"
2 | pageEncoding="UTF-8"%>
3 | <%@ page
4 | import="patient.modal.Patient, java.util.ArrayList, modal.Appointment, staff.modal.Doctor, utils.DateUtils"%>
5 |
6 |
7 |
8 |
9 |
10 | Book Appointment - Patient Dashboard - Central Medic
11 | Center
12 |
16 |
17 |
18 |
19 |
20 | <% Patient patient = (Patient)request.getAttribute("patient"); %>
21 |
22 |
46 |
47 |
48 |
49 |
142 |
143 |
144 |
202 |
203 |
204 |
205 |
206 |
208 |
209 |
211 |
212 |
214 |
215 |
--------------------------------------------------------------------------------
/CMC/WebContent/editReceptionistProfile.jsp:
--------------------------------------------------------------------------------
1 |
2 | <%@ page language="java" contentType="text/html; charset=UTF-8"
3 | pageEncoding="UTF-8"%>
4 | <%@ page
5 | import="staff.modal.Staff, java.util.ArrayList, modal.Appointment, staff.modal.Doctor"%>
6 | <%
7 | if(request.getAttribute("receptionist")==null){
8 | response.sendRedirect("receptionist");
9 | }
10 | else{
11 | Staff receptionist = (Staff)request.getAttribute("receptionist");
12 | ArrayList> arrayList = (ArrayList>)request.getAttribute("appointments");
13 | %>
14 |
15 |
16 |
17 |
18 | Edit Profile - Receptionist Dashboard - Central Medic Center
19 |
23 |
24 |
25 |
26 |
27 |
28 |
52 |
53 |
54 |
55 |
139 |
140 |
141 |
144 |
145 |
222 |
223 |
224 |
225 |
226 |
228 |
229 |
231 |
232 |
234 |
235 |
236 | <%
237 | }
238 | %>
--------------------------------------------------------------------------------