예제 #1
0
 def data(self, index, role=QtCore.Qt.DisplayRole):
     column = self.cols()[index.column()]
     columnFieldNames = column.fields()
     row = index.row()
     if role == QtCore.Qt.BackgroundColorRole:
         if self.items[row].get('isVIP', None):
             return QtCore.QVariant(self.items[row].get(
                 'vipColor', self.vipClientColor))
         elif self.items[row].get('isUnconscious', None):
             return toVariant(QtGui.QColor(self.unconsciousPatientRowColor))
         if 'statusObservationCode' in columnFieldNames and self.items[
                 row].get('statusObservationCode', None):
             return toVariant(
                 QtGui.QColor(self.items[row].get('statusObservationColor',
                                                  None)))
         elif len(self.items[row].get('MKB', '')) <= 0:
             return toVariant(QtGui.QColor(200, 230, 240))
     if role == QtCore.Qt.DisplayRole:
         if 'feed' in columnFieldNames:
             return QtCore.QVariant()
     elif role == QtCore.Qt.CheckStateRole:
         if 'feed' in columnFieldNames:
             item = self.items[row]
             return toVariant(QtCore.Qt.Checked if item.
                              get('feed', None) else QtCore.Qt.Unchecked)
     return CMonitoringModel.data(self, index, role)
예제 #2
0
 def data(self, index, role=QtCore.Qt.DisplayRole):
     column = self.cols()[index.column()]
     columnFieldNames = column.fields()
     row = index.row()
     if role == QtCore.Qt.BackgroundColorRole:
         if 'statusObservationCode' in columnFieldNames and self.items[row].get('statusObservationCode', None):
             return toVariant(QtGui.QColor(self.items[row].get('statusObservationColor', None)))
     return CMonitoringModel.data(self, index, role)
예제 #3
0
 def data(self, index, role=QtCore.Qt.DisplayRole):
     if role == QtCore.Qt.BackgroundColorRole:
         row = index.row()
         column = index.column()
         item = self.items[row]
         if not item['directionExecuted']:
             return toVariant(QtGui.QColor(255, 192, 192))
         else:
             return QtCore.QVariant()
     return CMonitoringModel.data(self, index, role)
예제 #4
0
 def data(self, index, role=QtCore.Qt.DisplayRole):
     column = self.cols()[index.column()]
     columnFieldNames = column.fields()
     row = index.row()
     if role == QtCore.Qt.DisplayRole:
         if 'feed' in columnFieldNames:
             return QtCore.QVariant()
     elif role == QtCore.Qt.CheckStateRole:
         if 'feed' in columnFieldNames:
             item = self.items[row]
             return toVariant(QtCore.Qt.Checked if item.get('feed', None) else QtCore.Qt.Unchecked)
     elif role == QtCore.Qt.BackgroundColorRole:
         if 'externalId' in columnFieldNames:
             if self.items[row].get('maternitywardBegDate', None):
                 return toVariant(QtGui.QColor(QtCore.Qt.green))
             elif self.items[row].get('reanimationBegDate', None):
                 return toVariant(QtGui.QColor(QtCore.Qt.red))
     return CMonitoringModel.data(self, index, role)
예제 #5
0
    def data(self, index, role=QtCore.Qt.DisplayRole):
        column = self.cols()[index.column()]
        columnFieldNames = column.fields()
        row = index.row()
        if role == QtCore.Qt.DisplayRole:
            if 'feed' in columnFieldNames:
                return self.items[row].get('feedTextValueItem',
                                           QtCore.QVariant())
        elif role == QtCore.Qt.CheckStateRole:
            if 'feed' in columnFieldNames:
                item = self.items[row]
                return toVariant(QtCore.Qt.Checked if item.
                                 get('feed', None) else QtCore.Qt.Unchecked)
        elif role == QtCore.Qt.FontRole:
            if 'comfortableDate' in columnFieldNames and self.items[row].get(
                    'comfortableDate', None):
                comfortDate = self.items[row]['comfortableDate']
                if comfortDate.date() == QtCore.QDate.currentDate():
                    result = QtGui.QFont()
                    result.setBold(True)
                    return QtCore.QVariant(result)
        elif role == QtCore.Qt.BackgroundColorRole:
            if self.items[row].get('isVIP', None):
                return QtCore.QVariant(self.items[row].get(
                    'vipColor', self.vipClientColor))
            elif self.items[row].get('isUnconscious', None):
                return toVariant(QtGui.QColor(self.unconsciousPatientRowColor))
            elif 'statusObservationCode' in columnFieldNames and self.items[
                    row].get('statusObservationCode', None):
                return toVariant(
                    QtGui.QColor(self.items[row].get('statusObservationColor',
                                                     None)))
            #обработка столбца "Комфортность"
            elif 'comfortableDate' in columnFieldNames and self.items[row].get(
                    'comfortableDate', None):
                #Если статус оплаты для комфортности НЕ оплачено (comfortablePayStatus = False)
                if not self.items[row].get('comfortablePayStatus', None):
                    return toVariant(QtGui.QColor(QtCore.Qt.red))
                #Если действие Законченно И дата окончания (endDate) меньше планируемой даты (plannedEndDate) (issue 409)
                elif self.items[row].get('endDate', None) and self.items[row][
                        'endDate'] < self.items[row]['comfortableDate']:
                    return toVariant(QtGui.QColor(QtCore.Qt.red))
            #Если столбец с ФИО и есть eventId
            elif 'clientName' in columnFieldNames and self.items[row].get(
                    'eventId', None):
                if self.items[row].get('isHasNotPayedActions', None):
                    return toVariant(QtGui.QColor(QtCore.Qt.red))
            elif 'externalId' in columnFieldNames:
                if self.items[row].get('maternitywardActive', None):
                    return toVariant(QtGui.QColor(QtCore.Qt.green))
                elif self.items[row].get('reanimationActive', None):
                    return toVariant(QtGui.QColor(QtCore.Qt.red))
            else:
                item = self.items[row]
                displayFieldName = columnFieldNames[self.cols()[
                    index.column()].displayFieldNumber()]

                if displayFieldName == 'begDateString':
                    if not self.timeRangeColors:
                        timeRangeColorsString = forceString(
                            QtGui.qApp.preferences.appPrefs.get(
                                'hospitalBedsTimeRangeColors', ''))
                        self.timeRangeColors = timeRangeColorParser(
                            timeRangeColorsString)

                    if self.timeRangeColors:
                        currentDatetime = QtCore.QDateTime.currentDateTime()
                        # TODO: skkachaev: Внезапно в этом месте item.get('begDate' возвоащает QDate
                        begDatetime = QtCore.QDateTime(
                            item.get('begDate', QtCore.QDateTime()))
                        currentTimeRange = begDatetime.secsTo(
                            currentDatetime) / 60

                        for (timeLow,
                             timeHigh), color in self.timeRangeColors.items():
                            if currentTimeRange >= timeLow and currentTimeRange <= timeHigh:
                                return toVariant(color)

        #Во всех остальных случаях
        return CMonitoringModel.data(self, index, role)