def setParams(self, params): date = QtCore.QDate.currentDate().addDays(-3) self.edtBegDate.setDate(params.get('begDate', firstMonthDay(date))) self.edtEndDate.setDate(params.get('endDate', lastMonthDay(date))) self.cmbOrgStructure.setValue(params.get('orgStructureId', None)) self.cmbFinance.setValue(params.get('fiananceId', None)) self.chkPodtver.setChecked(params.get('podtver', False)) self.edtBegDatePodtver.setDate(params.get('begDatePodtver', firstMonthDay(date))) self.edtEndDatePodtver.setDate(params.get('endDatePodtver', lastMonthDay(date))) self.cmbPodtver.setCurrentIndex(params.get('podtverType', 0))
def setParams(self, params): date = QtCore.QDate.currentDate().addDays(-3) self.edtBegDate.setDate(params.get('begDate', firstMonthDay(date))) self.edtEndDate.setDate(params.get('endDate', lastMonthDay(date))) self.edtBegDateRecord.setDate( params.get('begDateBeforeRecord', firstMonthDay(date))) self.edtEndDateRecord.setDate( params.get('endDateBeforeRecord', lastMonthDay(date))) self.cmbOrgStructure.setValue(params.get('orgStructureId', None)) self.cmbSpeciality.setValue(params.get('specialityId', None)) self.cmbPerson.setValue(params.get('personId', None))
def setParams(self, params): date = QtCore.QDate.currentDate().addDays(-3) self.edtBegDate.setDate(params.get('begDate', firstMonthDay(date))) self.edtEndDate.setDate(params.get('endDate', lastMonthDay(date))) self.edtBegDateRecord.setDate( params.get('begDateBeforeRecord', firstMonthDay(date))) self.edtEndDateRecord.setDate( params.get('endDateBeforeRecord', lastMonthDay(date))) self.cmbOrgStructure.setValue(params.get('orgStructureId', None)) self.cmbPerson.setValue(params.get('personId', None)) self.chkIsGroupBySpeciality.setChecked( params.get('isGroupBySpeciality', False)) self.chkWrittenFromZhos.setChecked(params.get('writtenFromZhos', False)) self.chkOnlyWithExternalQuota.setChecked( params.get('onlyWithExternalQuota', False))
def setParams(self, params): date = QtCore.QDate.currentDate().addDays(-3) self.edtBegDate.setDate(params.get('begDate', firstMonthDay(date))) self.edtEndDate.setDate(params.get('endDate', lastMonthDay(date))) self.edtBegDateRecord.setDate( params.get('begDateBeforeRecord', firstMonthDay(date))) self.edtEndDateRecord.setDate( params.get('endDateBeforeRecord', lastMonthDay(date))) self.cmbOrgStructure.setValue(params.get('orgStructureId', None)) self.chkOrgStructure.setChecked(params.get('chkOrgStructure', False)) self.cmbSpeciality.setValue(params.get('specialityId', None)) self.cmbPerson.setValue(params.get('personId', None)) self.cmbUserId.setValue(params.get('beforeRecordUserId', None)) self.cmbUserProfile.setValue(params.get('userProfileId', None)) self.chkShowNotes.setChecked(params.get('chkShowNote', False)) currentIndex = params.get('queueType', 0) if currentIndex is None: currentIndex = 0 self.cmbQueueType.setCurrentIndex(currentIndex)
def setParams(self, params): date = QtCore.QDate.currentDate().addDays(-3) self.edtBegDate.setDate( params.get('begDate', QtCore.QDate.currentDate())) self.edtEndDate.setDate( params.get('endDate', QtCore.QDate.currentDate())) self.chkPodtver.setChecked(params.get('podtver', False)) self.edtBegDatePodtver.setDate( params.get('begDatePodtver', firstMonthDay(date))) self.edtEndDatePodtver.setDate( params.get('endDatePodtver', lastMonthDay(date))) self.cmbPodtver.setCurrentIndex(params.get('podtverType', 0)) self.cmbRefuseType.setValue(params.get('refuseType', None))
def setParams(self, params): self.edtBegDate.setDate( params.get('begDate', firstMonthDay(QtCore.QDate.currentDate()))) self.edtEndDate.setDate( params.get('endDate', lastMonthDay(QtCore.QDate.currentDate()))) self.cmbOrgStructure.setValue(params.get('orgStructureId', None)) self.cmbPerson.setValue(params.get('personId', None)) self.cmbFinance.setTable('rbFinance', addNone=True) self.cmbFinance.setValue( params.get('typeFinanceId', CFinanceType.getId(CFinanceType.CMI))) # 2 — код ОМС
def setParams(self, params): date = QtCore.QDate.currentDate().addDays(-3) self.edtBegDate.setDate( params.get('begDate', QtCore.QDate.currentDate())) self.edtEndDate.setDate( params.get('endDate', QtCore.QDate.currentDate())) self.cmbSex.setCurrentIndex(params.get('sex', 0)) self.edtAgeFrom.setValue(params.get('ageFrom', 0)) self.edtAgeTo.setValue(params.get('ageTo', 150)) self.chkPodtver.setChecked(params.get('podtver', False)) self.edtBegDatePodtver.setDate( params.get('begDatePodtver', firstMonthDay(date))) self.edtEndDatePodtver.setDate( params.get('endDatePodtver', lastMonthDay(date))) self.cmbPodtver.setCurrentIndex(params.get('podtverType', 0)) self.cmbRefuseType.setValue(params.get('refuseType', None)) self.cmbOrgStructure.setValue(params.get('orgStructureId', None)) self.cmbPerson.setValue(params.get('personId', None)) self.cmbWorkOrganisation.setValue(params.get('workOrganisation', None))
def checkPeriodicActionPosibility(self, actionTypeId): actionType = CActionTypeCache.getById(actionTypeId) if actionType.frequencyCount: actionDate = forceDate(self.eventEditor.eventSetDateTime) db = QtGui.qApp.db tableAction = db.table('Action') tableEvent = db.table('Event') tableActionType = db.table('ActionType') cond = [ tableEvent['client_id'].eq(self.eventEditor.clientId), tableActionType['id'].eq(actionTypeId) ] if actionType.frequencyPeriod and actionType.frequencyPeriodType: lowDate = None highDate = None if actionType.isFrequencyPeriodByCalendar: if actionType.frequencyPeriodType == 1: # день lowDate = actionDate highDate = actionDate elif actionType.frequencyPeriodType == 2: # неделя lowDate = firstWeekDay(actionDate).addDays( (1 - actionType.frequencyPeriod) * 7) highDate = lastWeekDay(actionDate).addDays( (1 - actionType.frequencyPeriod) * 7) elif actionType.frequencyPeriodType == 3: # месяц lowDate = firstMonthDay(actionDate).addMonths( 1 - actionType.frequencyPeriod) highDate = lastMonthDay(actionDate).addMonths( 1 - actionType.frequencyPeriod) elif actionType.frequencyPeriodType == 4: # квартал (3 месяца) lowDate = firstQuarterDay(actionDate).addMonths( (1 - actionType.frequencyPeriod) * 3) highDate = lastQuarterDay(actionDate).addMonths( (1 - actionType.frequencyPeriod) * 3) elif actionType.frequencyPeriodType == 5: # полугодие lowDate = firstHalfYearDay(actionDate).addMonths( (1 - actionType.frequencyPeriod) * 6) highDate = lastHalfYearDay(actionDate).addMonths( (1 - actionType.frequencyPeriod) * 6) elif actionType.frequencyPeriodType == 6: # год lowDate = firstYearDay(actionDate).addYears( (1 - actionType.frequencyPeriod)) highDate = lastYearDay(actionDate).addYears( (1 - actionType.frequencyPeriod)) else: if actionType.frequencyPeriodType == 1: # день lowDate = actionDate.addDays( -1 * actionType.frequencyPeriod) elif actionType.frequencyPeriodType == 2: # неделя lowDate = actionDate.addDays( -7 * actionType.frequencyPeriod) elif actionType.frequencyPeriodType == 3: # месяц lowDate = actionDate.addMonths( -1 * actionType.frequencyPeriod) elif actionType.frequencyPeriodType == 4: # квартал (3 месяца) lowDate = actionDate.addMonths( -3 * actionType.frequencyPeriod) elif actionType.frequencyPeriodType == 5: # полугодие lowDate = actionDate.addMonths( -6 * actionType.frequencyPeriod) elif actionType.frequencyPeriodType == 6: # год lowDate = actionDate.addYears( -1 * actionType.frequencyPeriod) if lowDate: lowDate = lowDate.addDays(1) highDate = actionDate if lowDate and highDate: cond.append(tableAction['begDate'].dateBetween( lowDate, highDate)) table = tableAction.innerJoin(tableEvent, [ tableEvent['id'].eq(tableAction['event_id']), tableEvent['deleted'].eq(0) ]) table = table.innerJoin( tableActionType, tableActionType['id'].eq(tableAction['actionType_id'])) count = db.getCount(table, tableAction['id'], cond) for record, action in self._items: if record.value('id').isNull() and actionTypeId == forceRef( record.value('actionType_id')): count += 1 if count >= actionType.frequencyCount: frequencyPeriodTypeNames = { 0: (u'-', ) * 3, 1: (u'день', u'дня', u'дней'), 2: (u'неделю', u'недели', u'недель'), 3: (u'месяц', u'месяца', u'месяцев'), 4: (u'квартал', u'квартала', u'кварталов'), 5: (u'полугодие', u'полугодия', u'полугодий'), 6: (u'год', u'года', u'лет') } widget = QtGui.qApp.activeModalWidget( ) or QtGui.qApp.mainWindow or None isStrict = actionType.isStrictFrequency and not QtGui.qApp.userHasRight( urIgnoreRestrictActionByFrequency) res = QtGui.QMessageBox.critical( widget, u'Произошла ошибка', u'Действие типа "%s" должно применяться не более %s в %s' % (actionType.name, formatNum1(actionType.frequencyCount, (u'раза', u'раз', u'раз')), formatNum1( actionType.frequencyPeriod, frequencyPeriodTypeNames[ actionType.frequencyPeriodType])), buttons=QtGui.QMessageBox.Close if isStrict else (QtGui.QMessageBox.Ignore | QtGui.QMessageBox.Close), defaultButton=QtGui.QMessageBox.Close) if res != QtGui.QMessageBox.Ignore: return False return True
def setParams(self, params): date = QtCore.QDate.currentDate().addDays(-3) self.chkExpandDoctorGroups.setChecked( params.get('expandDoctorGroups', True)) self.edtBegDate.setDate(params.get('begDate', firstMonthDay(date))) self.edtEndDate.setDate(params.get('endDate', lastMonthDay(date))) self.cmbOrgStructure.setValue(params.get('orgStructureId', None)) self.chkWithoutDescendants.setChecked( params.get('withoutDescendants', False)) self.cmbSpeciality.setValue(params.get('specialityId', None)) self.cmbPerson.setValue(params.get('personId', None)) if self.cmbAssistant.isEnabled() and self._assistantAvailable: self.cmbAssistant.setValue(params.get('assistantId', None)) self.chkInsurerDoctors.setChecked(params.get('chkInsurer', False)) self.on_chkInsurerDoctors_clicked(params.get('chkInsurer', False)) self.cmbInsurerDoctors.setValue(params.get('insurerId', None)) self.chkPodtver.setChecked(params.get('podtver', False)) self.edtBegDatePodtver.setDate( params.get('begDatePodtver', firstMonthDay(date))) self.edtEndDatePodtver.setDate( params.get('endDatePodtver', lastMonthDay(date))) self.cmbPodtver.setCurrentIndex(params.get('podtverType', 0)) self.cmbRefuseType.setValue(params.get('refuseType', None)) self.chkWithoutModernisation.setChecked( params.get('withoutModernisation', False)) self.chkDetailService.setChecked(params.get('detailService', False)) self.chkDetailService.setEnabled( self.chkExpandDoctorGroups.isChecked()) self.chkDetailServiceTypes.setChecked( params.get('detailServiceTypes', False)) self.chkDetailServiceTypes.setEnabled( self.chkExpandDoctorGroups.isChecked()) self.chkDetailPatients.setChecked(params.get('detailPatients', False)) self.chkDetailPatients.setEnabled( self.chkExpandDoctorGroups.isChecked()) self.lstServiceTypes.setEnabled( self.chkDetailServiceTypes.isChecked() and self.chkExpandDoctorGroups.isChecked()) self.cmbClientOrganisation.setValue( params.get('clientOrganisationId', None)) self.chkFreeInputWork.setChecked(params.get('freeInputWork', False)) self.edtFreeInputWork.setText(params.get('freeInputWorkValue', '')) self.rbtnByActionEndDate.setChecked( params.get('byActionEndDate', False)) self.cmbGroupBy.setCurrentIndex( params.get('groupBy', self.groupBySpeciality)) self.cmbFinance.setValue(params.get('typeFinanceId', None)) self.chkGroupAssistant.setChecked(params.get('groupAssistant', False)) self.cmbEventPurpose.setValue(params.get('eventPurposeId', None)) self.cmbEventType.setValue(params.get('eventTypeId', None)) self.chkByOrgStructAction.setChecked( params.get('byOrgStructAction', False)) selectedServiceTypes = params.get('serviceTypes') if selectedServiceTypes is not None: flags = self.lstServiceTypes.selectionCommand(QtCore.QModelIndex()) selectionModel = self.lstServiceTypes.selectionModel() model = self.lstServiceTypes.model() self.lstServiceTypes.clearSelection() for idx in selectedServiceTypes: selectionModel.select(model.index(idx), flags)