-
Notifications
You must be signed in to change notification settings - Fork 1
/
update_patient.py
115 lines (106 loc) · 6.32 KB
/
update_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
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:/Users/Ecrin/Desktop/Yeni klasör/hasta_guncelle.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
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QVBoxLayout, QFormLayout, QLabel, QLineEdit, QComboBox, QDateEdit, QPushButton, QStatusBar, QWidget
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(442, 326)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.groupBox = QtWidgets.QGroupBox(self.centralwidget)
self.groupBox.setGeometry(QtCore.QRect(0, 0, 421, 331))
font = QtGui.QFont()
font.setPointSize(12)
font.setBold(True)
font.setWeight(75)
self.groupBox.setFont(font)
self.groupBox.setObjectName("groupBox")
self.formLayoutWidget = QtWidgets.QWidget(self.groupBox)
self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 411, 211))
self.formLayoutWidget.setObjectName("formLayoutWidget")
self.formLayout = QtWidgets.QFormLayout(self.formLayoutWidget)
self.formLayout.setContentsMargins(0, 0, 0, 0)
self.formLayout.setObjectName("formLayout")
self.label = QtWidgets.QLabel(self.formLayoutWidget)
self.label.setObjectName("label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
self.txt_new_name = QtWidgets.QLineEdit(self.formLayoutWidget)
self.txt_new_name.setObjectName("txt_new_name")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.txt_new_name)
self.label_2 = QtWidgets.QLabel(self.formLayoutWidget)
self.label_2.setObjectName("label_2")
self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2)
self.label_3 = QtWidgets.QLabel(self.formLayoutWidget)
self.label_3.setObjectName("label_3")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3)
self.txt_new_identity = QtWidgets.QLineEdit(self.formLayoutWidget)
self.txt_new_identity.setObjectName("txt_new_identity")
self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.txt_new_identity)
self.label_5 = QtWidgets.QLabel(self.formLayoutWidget)
self.label_5.setObjectName("label_5")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_5)
self.label_4 = QtWidgets.QLabel(self.formLayoutWidget)
self.label_4.setObjectName("label_4")
self.formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_4)
self.new_date_ = QtWidgets.QDateEdit(self.formLayoutWidget)
self.new_date_.setObjectName("new_date_")
self.new_date_.setCalendarPopup(True) # Tarih seçici popup olarak açılır
self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.new_date_)
self.label_6 = QtWidgets.QLabel(self.formLayoutWidget)
self.label_6.setObjectName("label_6")
self.formLayout.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_6)
self.box_new_spe = QtWidgets.QComboBox(self.formLayoutWidget)
self.box_new_spe.setObjectName("box_new_spe")
self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.box_new_spe)
self.box_new_dctr_name = QtWidgets.QComboBox(self.formLayoutWidget)
self.box_new_dctr_name.setObjectName("box_new_dctr_name")
self.formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.box_new_dctr_name)
self.box_new_triage_clr = QtWidgets.QComboBox(self.formLayoutWidget)
self.box_new_triage_clr.setObjectName("box_new_triage_clr")
self.formLayout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.box_new_triage_clr)
self.btn_update = QtWidgets.QPushButton(self.groupBox)
self.btn_update.setGeometry(QtCore.QRect(150, 240, 111, 51))
self.btn_update.setObjectName("btn_update")
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.hasta = Hasta.Hasta()
self.btn_update.clicked.connect(self.update_patient) # Düğmeyi metodumuza bağladık
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.groupBox.setTitle(_translate("MainWindow", "GroupBox"))
self.label.setText(_translate("MainWindow", "New Name:"))
self.label_2.setText(_translate("MainWindow", "New Birthdate:"))
self.label_3.setText(_translate("MainWindow", "New Identity:"))
self.label_5.setText(_translate("MainWindow", "New Specialization:"))
self.label_4.setText(_translate("MainWindow", "New Doctor Name:"))
self.label_6.setText(_translate("MainWindow", "New Triage Color:"))
self.btn_update.setText(_translate("MainWindow", "Update"))
def update_patient(self):
new_name = self.txt_new_name.text()
new_birthdate = self.new_date_.date().toString('yyyy-MM-dd') # Tarihi string formatına dönüştür
new_identity = self.txt_new_identity.text()
new_specialization = self.box_new_spe.currentText()
new_doctor_name = self.box_new_dctr_name.currentText()
new_triage_color = self.box_new_triage_clr.currentText()
self.hasta.hasta_guncelle(new_name, new_birthdate, new_identity, new_specialization, new_doctor_name, new_triage_color)
print("Hasta başarıyla güncellendi.") # Hata mesajı yerine çıktıyı doğrulamak için ekledim
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())