コード例 #1
0
ファイル: run.py プロジェクト: boldyrev-d/vistamed
class MyForm(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MyForm()
        self.ui.setupUi(self)
        self.UpdateTable()
        self.ui.pushButton.clicked.connect(self.SearchButton)

    def UpdateTable(self):
        data = get_from_db("""SELECT Client.firstName, Client.lastName, Client.patrName, Client.birthDate, Client.sex, ClientPolicy.number, ClientPolicy.begDate, ClientPolicy.endDate, ClientDocument.documentType_id, ClientDocument.serial, ClientDocument.number, ClientDocument.date, ClientDocument.origin
                            FROM Client JOIN ClientPolicy JOIN ClientDocument
                            ON Client.id=ClientPolicy.client_id AND Client.id=ClientDocument.client_id;""")

        self.ui.tableWidget.setRowCount(len(data))

        for i in range(len(data)):
            for j in range(13):
                self.ui.tableWidget.setItem(i, j, QtGui.QTableWidgetItem(str(data[i][j])))

    def SearchButton(self):
        data = get_from_db("""SELECT Client.firstName, Client.lastName, Client.patrName, Client.birthDate, Client.sex, ClientPolicy.number, ClientPolicy.begDate, ClientPolicy.endDate, ClientDocument.documentType_id, ClientDocument.serial, ClientDocument.number, ClientDocument.date, ClientDocument.origin
                            FROM Client JOIN ClientPolicy JOIN ClientDocument
                            ON Client.id=ClientPolicy.client_id AND Client.id=ClientDocument.client_id;""")

        items   = self.ui.tableWidget.findItems(self.ui.lineEdit.text(), QtCore.Qt.MatchExactly)
        items_2 = self.ui.tableWidget.findItems(self.ui.lineEdit_2.text(), QtCore.Qt.MatchExactly)
        items_3 = self.ui.tableWidget.findItems(self.ui.lineEdit_3.text(), QtCore.Qt.MatchExactly)
        items_4 = self.ui.tableWidget.findItems(self.ui.lineEdit_4.text(), QtCore.Qt.MatchExactly)
        items_5 = self.ui.tableWidget.findItems(self.ui.lineEdit_5.text(), QtCore.Qt.MatchExactly)
        items_6 = self.ui.tableWidget.findItems(self.ui.lineEdit_6.text(), QtCore.Qt.MatchExactly)

        # ==========================================================

        # ПОИСК ПО ИМЕНИ
        result1 = search(items, 0)
        # ПОИСК ПО ФАМИЛИИ
        result2 = search(items_2, 1)
        # ПОИСК ПО ОТЧЕСТВУ
        result3 = search(items_3, 2)
        # ПОИСК ПО НОМЕРУ ПОЛИСА
        result4 = search(items_4, 5)
        # ПОИСК ПО СЕРИИ ДОКУМЕНТА
        result5 = search(items_5, 9)
        # ПОИСК ПО НОМЕРУ ДОКУМЕНТА
        result6 = search(items_6, 10)

        results = result1 + result2 + result3 + result4 + result5 + result6
        results = list_index(results)

        # ==========================================================

        self.ui.tableWidget_2.setRowCount(len(results))

        for i in range(len(results)):
            for j in range(13):
                self.ui.tableWidget_2.setItem(i, j, QtGui.QTableWidgetItem(str(data[results[i]][j])))

        results.clear()
コード例 #2
0
ファイル: run.py プロジェクト: boldyrev-d/vistamed
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_MyForm()
     self.ui.setupUi(self)
     self.UpdateTable()
     self.ui.pushButton.clicked.connect(self.SearchButton)