-
Notifications
You must be signed in to change notification settings - Fork 1
/
show_patient.py
160 lines (149 loc) · 7.55 KB
/
show_patient.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:/Users/Ecrin/Desktop/Yeni klasör/show_patient.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
import Hasta
import delete_patient # Ensure you have a delete_patient module
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QTableWidgetItem
class Ui_ShowPatient(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(810, 446)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.tableWidget = QtWidgets.QTableWidget(self.centralwidget)
self.tableWidget.setGeometry(QtCore.QRect(0, 0, 809, 316))
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setItalic(False)
font.setWeight(75)
self.tableWidget.setFont(font)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(8)
self.tableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(5, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(6, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(7, item)
self.pushButton_4 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_4.setGeometry(QtCore.QRect(10, 370, 791, 31))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.pushButton_4.setFont(font)
self.pushButton_4.setObjectName("btn_update_data")
self.layoutWidget = QtWidgets.QWidget(self.centralwidget)
self.layoutWidget.setGeometry(QtCore.QRect(10, 320, 581, 51))
self.layoutWidget.setObjectName("layoutWidget")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.pushButton = QtWidgets.QPushButton(self.layoutWidget)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.pushButton.setFont(font)
self.pushButton.setObjectName("btn_add_pat")
self.horizontalLayout.addWidget(self.pushButton)
self.pushButton_2 = QtWidgets.QPushButton(self.layoutWidget)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.pushButton_2.setFont(font)
self.pushButton_2.setObjectName("btn_update_pat")
self.horizontalLayout.addWidget(self.pushButton_2)
self.pushButton_3 = QtWidgets.QPushButton(self.layoutWidget)
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.pushButton_3.setFont(font)
self.pushButton_3.setObjectName("btn_del_pat")
self.horizontalLayout.addWidget(self.pushButton_3)
self.pushButton_5 = QtWidgets.QPushButton(self.centralwidget)
self.pushButton_5.setGeometry(QtCore.QRect(630, 330, 161, 31))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.pushButton_5.setFont(font)
self.pushButton_5.setObjectName("btn_update_pass")
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
self.pushButton_4.clicked.connect(self.update_data)
self.pushButton_3.clicked.connect(self.open_delete_patient)
self.hasta = Hasta.Hasta()
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Id"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Name"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("MainWindow", "Birthdate"))
item = self.tableWidget.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Identity"))
item = self.tableWidget.horizontalHeaderItem(4)
item.setText(_translate("MainWindow", "Specialization"))
item = self.tableWidget.horizontalHeaderItem(5)
item.setText(_translate("MainWindow", "Doctor Name"))
item = self.tableWidget.horizontalHeaderItem(6)
item.setText(_translate("MainWindow", "Triage Color"))
item = self.tableWidget.horizontalHeaderItem(7)
item.setText(_translate("MainWindow", "Situation"))
self.pushButton_4.setText(_translate("MainWindow", "Update Data"))
self.pushButton.setText(_translate("MainWindow", "Add Patient"))
self.pushButton_2.setText(_translate("MainWindow", "Update Patient"))
self.pushButton_3.setText(_translate("MainWindow", "Delete Patient"))
self.pushButton_5.setText(_translate("MainWindow", "Update Password"))
def update_data(self):
patients = self.hasta.patient()
self.tableWidget.setRowCount(len(patients))
for row, patient in enumerate(patients):
self.tableWidget.setItem(row, 0, QTableWidgetItem(patient["Id"]))
self.tableWidget.setItem(row, 1, QTableWidgetItem(patient["Name"]))
self.tableWidget.setItem(row, 2, QTableWidgetItem(patient["Birthdate"]))
self.tableWidget.setItem(row, 3, QTableWidgetItem(patient["Identity"]))
self.tableWidget.setItem(row, 4, QTableWidgetItem(patient["Specialization"]))
self.tableWidget.setItem(row, 5, QTableWidgetItem(patient["Doctor Name"]))
self.tableWidget.setItem(row, 6, QTableWidgetItem(patient["Triage Color"]))
self.tableWidget.setItem(row, 7, QTableWidgetItem(patient["Situation"]))
def open_delete_patient(self):
# Implement the logic to open the delete_patient functionality
delete_patient_window = QtWidgets.QMainWindow()
delete_ui = delete_patient.Ui_DeletePatient() # Assuming you have a class Ui_DeletePatient in delete_patient module
delete_ui.Ui_DeletePatient(delete_patient_window)
delete_patient_window.show()
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_ShowPatient()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())