コード例 #1
0
class SearchApp(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.hospitalOracle = HospitalOracle()
        self.pushButtonSearch.clicked.connect(self.searchForInfo)

    def searchForInfo(self):
        # Get query from field
        PFNAME = self.patientSFNameLineEdit.text().strip()
        PLNAME = self.patientSLNameLineEdit.text().strip()

        # Store result from Oracle
        storage = self.hospitalOracle.searchPatient(PFNAME, PLNAME)

        # Reset table
        self.tableWidget.setRowCount(0)

        # Insert into table
        for rowPosition, row in enumerate(storage):
            self.tableWidget.insertRow(rowPosition)
            for colPosition, data in enumerate(row):
                self.tableWidget.setItem(
                    rowPosition, colPosition,
                    QtWidgets.QTableWidgetItem(str(data).strip()))
コード例 #2
0
class InsertApp(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.hospitalOracle = HospitalOracle()
        self.pushButtonInsert.clicked.connect(self.insertIntoPatient)

    def insertIntoPatient(self):
        PFNAME = self.pFNameLineEdit.text().strip()
        PLNAME = self.pLNameLineEdit.text().strip()
        PDOB = self.pDoBLineEdit.text().strip()
        PGENDER = self.pGenderLineEdit.text().strip()
        PPHONE = self.pPhoneLineEdit.text().strip()
        PADDRESS = self.pAddressLineEdit.text().strip()
        PDOBLIST = PDOB.split('-')
        WillInsert = True
        msg = QMessageBox()
        msg.setIcon(QMessageBox.Information)

        if PFNAME is '' or PLNAME is '' or PGENDER is '' or PPHONE is '' or PADDRESS is '':
            msg.setText("All fields must not be empty")
            msg.setWindowTitle("Failed")
            msg.setStandardButtons(QMessageBox.Ok)
            msg.exec_()
            WillInsert = False

        if (len(PDOBLIST) != 3 or len(PDOBLIST[0]) != 4
                or len(PDOBLIST[1]) != 2 or len(PDOBLIST[2]) != 2
                or int(PDOBLIST[1]) > 12 or int(PDOBLIST[1]) < 0
                or int(PDOBLIST[2]) < 0 or int(PDOBLIST[2]) > 31):
            msg.setText("Please enter date of birth correctly")
            msg.setWindowTitle("Failed")
            msg.setStandardButtons(QMessageBox.Ok)
            msg.exec_()
            WillInsert = False

        if WillInsert:
            self.hospitalOracle.insertIntoPatient(PFNAME, PLNAME, PDOB,
                                                  PGENDER, PPHONE, PADDRESS)
            msg.setText("Add patient successfully")
            msg.setWindowTitle("Successfully")
            msg.setStandardButtons(QMessageBox.Ok)
            msg.exec_()
コード例 #3
0
class ReportApp(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.hospitalOracle = HospitalOracle()
        self.pushButtonSearch.clicked.connect(self.showReport)

    def showReport(self):
        PFNAME = self.patientSFNameLineEdit.text().strip()
        PLNAME = self.patientSLNameLineEdit.text().strip()

        storage = self.hospitalOracle.makeAReport(PFNAME, PLNAME)

        # Reset table
        self.tableWidget.setRowCount(0)
        self.tableWidget_2.setRowCount(0)

        rowOut = 0
        rowIn = 0
        listOut = [0, 1, 3, 4, 6]
        listIn = [0, 2, 3, 5, 7]
        for row in storage:
            if row[1] is not None:
                colPositionOut = 0
                self.tableWidget.insertRow(rowOut)
                for posOut in listOut:
                    self.tableWidget.setItem(
                        rowOut, colPositionOut,
                        QtWidgets.QTableWidgetItem(str(row[posOut]).strip()))
                    colPositionOut += 1
                rowOut += 1
            else:
                colPositionIn = 0
                self.tableWidget_2.insertRow(rowIn)
                for posIn in listIn:
                    self.tableWidget_2.setItem(
                        rowIn, colPositionIn,
                        QtWidgets.QTableWidgetItem(str(row[posIn]).strip()))
                    colPositionIn += 1
                rowIn += 1
コード例 #4
0
class ListApp(QtWidgets.QMainWindow, Ui_MainWindow):
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.hospitalOracle = HospitalOracle()
        self.pushButtonSearchPatients.clicked.connect(self.searchPatients)

    def searchPatients(self):
        # Get input
        DFNAME = self.doctorSFNameLineEdit.text().strip()
        DLNAME = self.doctorSLNameLineEdit.text().strip()

        # Ger data from table
        storage = self.hospitalOracle.listPatientTreatedByDoctor(DFNAME, DLNAME)

        # Reset all rows
        self.tableWidget.setRowCount(0)
        self.tableWidget_2.setRowCount(0)
        
        # Insert to 2 tables
        rowOut = 0
        rowIn = 0
        listOut = [0,1,2,3,4,5,6,7,8]
        listIn = [0,1,2,3,4,9,10,11]
        for row in storage:
            if row[5] is not None:
                colPositionOut = 0
                self.tableWidget.insertRow(rowOut)
                for posOut in listOut:
                    self.tableWidget.setItem(rowOut, colPositionOut, QtWidgets.QTableWidgetItem(str(row[posOut]).strip()))
                    colPositionOut += 1
                rowOut += 1
            else:
                colPositionIn = 0
                self.tableWidget_2.insertRow(rowIn)
                for posIn in listIn:
                    self.tableWidget_2.setItem(rowIn, colPositionIn, QtWidgets.QTableWidgetItem(str(row[posIn]).strip()))
                    colPositionIn += 1
                rowIn += 1
コード例 #5
0
 def __init__(self):
     QtWidgets.QMainWindow.__init__(self)
     Ui_MainWindow.__init__(self)
     self.setupUi(self)
     self.hospitalOracle = HospitalOracle()
     self.pushButtonInsert.clicked.connect(self.insertIntoPatient)
コード例 #6
0
 def __init__(self):
     QtWidgets.QMainWindow.__init__(self)
     Ui_MainWindow.__init__(self)
     self.setupUi(self)
     self.hospitalOracle = HospitalOracle()
     self.pushButtonSearchPatients.clicked.connect(self.searchPatients)