def setReduced(self, value): self.txtClientInfoBrowser.setVisible(not value) if self.clientInfo is None: self.clientInfo = getClientInfo(self.clientId) name = formatName(self.clientInfo.lastName, self.clientInfo.firstName, self.clientInfo.patrName) self.setWindowTitle(self.windowTitle() + ' : ' + name) self.setVisibleBtnCloseWidgets(value)
def setClientBannerEx(self, id): if id != self._currentClientId: self._currentClientId = id clientInfo = self._mapIdToInfo.get(id, None) if not clientInfo: clientInfo = getClientInfo(id) self._mapIdToInfo[id] = clientInfo clientBanner = formatClientBanner(clientInfo) self.setClientBanner(clientBanner)
def on_actAdd_triggered(self): db = QtGui.qApp.db clientInfo = getClientInfo(self.clientId) if len(clientInfo.SNILS) == 0: QtGui.QMessageBox.warning( self, u'Внимание', u'У пациента не заполнен СНИЛС.\n' u'Укажите СНИЛС пациента в рег. карте.', QtGui.QMessageBox.Close) return if len(clientInfo.socStatuses) == 0: QtGui.QMessageBox.warning(self, u'Внимание', u'У пациента отсутствуют льготы.', QMessageBox.Close) return federalCode = forceString( db.translate('Person', 'id', self.personId, 'federalCode')) if len(federalCode) == 0: QtGui.QMessageBox.warning( self, u'Внимание', u'У ответственного за событие врача не указан федеральный код.', QMessageBox.Close) return record = self.tblItems.model().getEmptyRecord() record.setValue('dateTime', toVariant(QDateTime().currentDateTime())) try: record.setValue('percentage', toVariant(100)) if self.mkb: record.setValue('mkb', toVariant(self.mkb)) record.setValue('term', toVariant(2)) record.setValue('printMnn', toVariant(1)) context = CInfoContext() client, setPerson = self.getEventInfo(context) if len(client.socStatuses) == 0: raise Exception(u'В регистрационной карте не указаны льготы!') dlg = CRecipeEditDialog(self, client.socStatuses, client.id, setPerson.personId) dlg.setRecord(record) if dlg.exec_() == QDialog.Accepted: dlg.getRecord(record) recipeNumber = self.getRecipeNumber(record) record.setValue('number', recipeNumber) self.tblItems.model().addRecord(record) self.tblItems.model().reset() self.tblItems.setCurrentRow(self.tblItems.model().rowCount() - 1) except Exception as ex: QtGui.QMessageBox.question(self, u'Внимание', ex.message, QMessageBox.Close)
def __init__(self, parent, eventId): QtCore.QObject.__init__(self, parent) db = QtGui.qApp.db self._parent = parent self._id = eventId self._record = db.getRecord('Event', '*', eventId) self.eventTypeId = forceRef(self._record.value('eventType_id')) self.eventSetDateTime = forceDateTime(self._record.value('setDate')) self.eventDate = forceDate(self._record.value('execDate')) self.personId = forceRef(self._record.value('setPerson_id')) orgId = forceRef(self._record.value('org_id')) self.orgId = orgId if orgId else QtGui.qApp.currentOrgId() self.personSpecialityId = forceRef(db.translate('Person', 'id', self.personId, 'speciality_id')) self.contractId = forceRef(self._record.value('contract_id')) if self.contractId: self.eventFinanceId = forceRef(db.translate('Contract', 'id', self.contractId, 'finance_id')) else: self.eventFinanceId = getEventFinanceId(self.eventTypeId) self.clientId = forceRef(self._record.value('client_id')) self.clientInfo = getClientInfo(self.clientId) try: clientKLADRCode = self.clientInfo.regAddressInfo.KLADRCode except: clientKLADRCode = '' if KLADRMatch(clientKLADRCode, QtGui.qApp.defaultKLADR()): self.clientType = CFakeEventEditor.ctLocal elif KLADRMatch(clientKLADRCode, QtGui.qApp.provinceKLADR()): self.clientType = CFakeEventEditor.ctProvince else: self.clientType = CFakeEventEditor.ctOther self.clientSex = self.clientInfo.sexCode self.clientBirthDate = self.clientInfo.birthDate self.clientAge = calcAgeTuple(self.clientBirthDate, self.eventDate) workRecord = getClientWork(self.clientId) self.clientWorkOrgId = forceRef(workRecord.value('org_id')) if workRecord else None self.clientPolicyInfoList = [] policyRecord = self.clientInfo.compulsoryPolicyRecord if policyRecord: self.clientPolicyInfoList.append(self.getPolicyInfo(policyRecord)) policyRecord = self.clientInfo.voluntaryPolicyRecord if policyRecord: self.clientPolicyInfoList.append(self.getPolicyInfo(policyRecord)) self.personCache = {} self.contractTariffCache = CContractTariffCache()
def build(self, params): global groupTitles global reg_num global reg_ind groupTitles = [] reg_num = 0 reg_ind = {} begDate = getVal(params, 'begDate', QtCore.QDate()) endDate = getVal(params, 'endDate', QtCore.QDate()) eventTypeId = getVal(params, 'eventTypeId', None) onlyPermanentAttach = getVal(params, 'onlyPermanentAttach', False) onlyPayedEvents = getVal(params, 'onlyPayedEvents', False) begPayDate = getVal(params, 'begPayDate', QtCore.QDate()) endPayDate = getVal(params, 'endPayDate', QtCore.QDate()) primaryMarkIndex = params.get('primaryMarkIndex', 0) reportRowSize = 4 reportDataByGroups = [] reportData = [] query = selectData(begDate, endDate, eventTypeId, onlyPermanentAttach, onlyPayedEvents, begPayDate, endPayDate, primaryMarkIndex) self.setQueryText(forceString(query.lastQuery())) while query.next(): record = query.record() region = '' lpu_infis = forceString(record.value('infisCode')) if record.value('LPU_id'): if lpu_infis.strip(): region = forceString(record.value('lpu_region')).strip() else: lpu_infis = u'нет прикрепления' else: lpu_infis = u'нет прикрепления' clientId = forceInt(record.value('clientId')) clientInfo = getClientInfo(clientId) fio = clientInfo['lastName'] + ' ' + clientInfo[ 'firstName'] + ' ' + clientInfo['patrName'] if not region: # region = forceString(record.value('reg_region')).strip() region = getRegion(clientId) bd = forceString(clientInfo['birthDate']) # adr='' # adr=formatAddress(record.value('address_id')) adr = get_adr(clientId) # adr=clientInfo.get('regAddress', '') ind = reg_ind.get(region, -1) if ind == -1: groupTitles.append(region) reg_ind[region] = reg_num ind = reg_num reg_num += 1 reportDataByGroups.append([]) reportData = reportDataByGroups[ind] reportData.append([lpu_infis, fio, bd, adr]) # now text doc = QtGui.QTextDocument() cursor = QtGui.QTextCursor(doc) cursor.setCharFormat(CReportBase.ReportTitle) cursor.insertText(u'Сводка по Ф.131 по районам') cursor.insertBlock() self.dumpParams(cursor, params) tableColumns = [ ('10%', [u'Код ЛПУ'], CReportBase.AlignLeft), ('30%', [u'ФИО'], CReportBase.AlignLeft), ('10%', [u'Дата рождения'], CReportBase.AlignLeft), ('50%', [u'Адрес'], CReportBase.AlignLeft), ] table = createTable(cursor, tableColumns) rd = [] for i in range(len(groupTitles)): rd.append((groupTitles[i], reportDataByGroups[i])) rd.sort(key=(lambda x: x[0])) if rd and not rd[0][0]: rd = rd[1:] + [rd[0]] totalByReport = 0 for Title, reportData in rd: if reportData: totalByGroup = len(reportData) totalByReport += totalByGroup self.addGroupHeader(table, Title) for i, reportLine in enumerate(reportData): i = table.addRow() for j in xrange(reportRowSize): table.setText(i, j, reportLine[j]) self.addTotal(table, u'всего по району', totalByGroup) self.addTotal(table, u'Всего', totalByReport) return doc
def updateClientInfo(self): self.clientInfo = getClientInfo(self.clientId) self.txtClientInfoBrowser.setHtml(formatClientBanner(self.clientInfo)) self.clientSex = self.clientInfo.sexCode self.clientBirthDate = self.clientInfo.birthDate self.clientAge = calcAgeTuple(self.clientBirthDate, self.edtDirectionDate.date())
def build(self, params): global groupTitles global reg_num global reg_ind groupTitles = [] reg_num = 0 reg_ind = {} begDate = getVal(params, 'begDate', QtCore.QDate()) endDate = getVal(params, 'endDate', QtCore.QDate()) eventTypeId = getVal(params, 'eventTypeId', None) PermanentAttach = getVal(params, 'PermanentAttach', None) onlyPayedEvents = getVal(params, 'onlyPayedEvents', False) begPayDate = getVal(params, 'begPayDate', QtCore.QDate()) endPayDate = getVal(params, 'endPayDate', QtCore.QDate()) Raion = forceString(getVal(params, 'Raion', None)) YearDD = forceString(getVal(params, 'YearForDD', '')) reportRowSize = 4 reportDataByGroups = [] reportData = [] query = selectData(begDate, endDate, eventTypeId, PermanentAttach, onlyPayedEvents, begPayDate, endPayDate) num = 0 while query.next(): record = query.record() region = '' lpu_infis = forceString(record.value('infisCode')) if record.value('LPU_id'): if lpu_infis.strip(): region = forceString(record.value('lpu_region')).strip() else: lpu_infis = u'нет прикрепления' else: lpu_infis = u'нет прикрепления' clientId = forceInt(record.value('clientId')) clientInfo = getClientInfo(clientId) fio = clientInfo['lastName'] + ' ' + clientInfo[ 'firstName'] + ' ' + clientInfo['patrName'] if not region: region, KLADRCode = getRegion(clientId) if Raion == u'Иногородние' and KLADRCode[:2] in ['78', '47']: continue else: if Raion == u'Иногородние': continue if Raion == u'Неидентифицированные': if region: continue else: if region != Raion and Raion != u'Иногородние': continue bd = forceString(clientInfo['birthDate']) adr = get_adr(clientId) ind = reg_ind.get(region, -1) if ind == -1: groupTitles.append(region) reg_ind[region] = reg_num ind = reg_num reg_num += 1 reportDataByGroups.append([]) reportData = reportDataByGroups[ind] reportData.append([lpu_infis, fio, bd, adr]) num += 1 # now text doc = QtGui.QTextDocument() cursor = QtGui.QTextCursor(doc) cursor.setCharFormat(CReportBase.ReportBody) self.dumpParams(cursor, params) cursor.insertBlock() cursor.setCharFormat(CReportBase.ReportTitle) org_reg = forceString( QtGui.qApp.db.translate('Organisation', 'id', QtGui.qApp.currentOrgId(), 'region')) if not org_reg: OKATO = forceString( QtGui.qApp.db.translate('Organisation', 'id', QtGui.qApp.currentOrgId(), 'OKATO')) org_reg = forceString( QtGui.qApp.db.translate('kladr.OKATO', 'CODE', OKATO[:5], 'NAME')) cursor.insertText(u'''Акт передачи форм № 131.у-%s %s район Санкт-Петербурга ''' % (YearDD, org_reg)) cursor.insertBlock() cursor.setCharFormat(CReportBase.ReportBody) lpu = forceString( QtGui.qApp.db.translate('Organisation', 'id', QtGui.qApp.currentOrgId(), 'shortName')) OGRN = forceString( QtGui.qApp.db.translate('Organisation', 'id', QtGui.qApp.currentOrgId(), 'OGRN')) if Raion != u'Иногородние' and Raion != u'Ленинградская обл.' and Raion != u'Неидентифицированные' and Raion != u'Административные районы г Санкт-Петербург': dest = Raion + u' район Санкт-Петербурга' else: dest = Raion prik = u'' if PermanentAttach and PermanentAttach > 0: lpu2 = forceString( QtGui.qApp.db.translate('Organisation', 'id', PermanentAttach, 'shortName')) # dest=u'учреждение здравоохранения '+lpu2 prik = u' ' + lpu2 cursor.insertText(u'''%s (ОГРН %s) передаёт в %s формы № 131.у-%s "Карта учёта дополнительной диспансеризации гражданина" с результатами лабораторных и функциональных исследований в количестве %d по месту прикрепления к лечебно-профилактическому учреждению%s на следующих граждан: ''' % (lpu, OGRN, dest, YearDD, num, prik)) cursor.insertBlock() tableColumns = [ ('10%', [u'№'], CReportBase.AlignLeft), ('30%', [u'ФИО'], CReportBase.AlignLeft), ('10%', [u'Дата рождения'], CReportBase.AlignLeft), ('50%', [u'Адрес'], CReportBase.AlignLeft), ] table = createTable(cursor, tableColumns) rd = [] for i in range(len(groupTitles)): rd.append((groupTitles[i], reportDataByGroups[i])) rd.sort(key=(lambda x: x[0])) if rd and not rd[0][0]: rd = rd[1:] + [rd[0]] totalByReport = 0 for Title, reportData in rd: if reportData: totalByGroup = len(reportData) totalByReport += totalByGroup for i, reportLine in enumerate(reportData): i = table.addRow() table.setText(i, 0, i) for j in xrange(1, reportRowSize): table.setText(i, j, reportLine[j]) self.addTotal(table, u'Всего', totalByReport) cursor.movePosition(QtGui.QTextCursor.End) cursor.setCharFormat(CReportBase.ReportBody) cursor.insertBlock() org_chief = forceString( QtGui.qApp.db.translate('Organisation', 'id', QtGui.qApp.currentOrgId(), 'chief')) cursor.insertText(u''' Главный врач %s %s района ________________ / %s / Формы № 131/у-%s "Карта учёта дополнительной диспансеризации гражданина" с результатами лабораторных и функциональных исследований в количестве %d: ''' % (lpu, name_pad(org_reg), org_chief, YearDD, num)) cursor.insertBlock() rows = [] rows.append([ u'Начальник отдела здравоохранения', u'Начальник отдела здравоохранения' ]) rows.append([ u'%s района Санкт-Петербурга' % name_pad(org_reg), u'%s района Санкт-Петербурга' % name_pad(Raion) ]) rows.append([u'\n\n', u'\n\n']) rows.append([ u'Передал ________________________________', u'Принял ________________________________' ]) rows.append([ u' (подпись, расшифровка подписи)', u' (подпись, расшифровка подписи)' ]) rows.append([u'\n', u'\n']) columnDescrs = [('50%', [], CReportBase.AlignCenter), ('50%', [], CReportBase.AlignCenter)] table1 = createTable(cursor, columnDescrs, headerRowCount=len(rows), border=0, cellPadding=2, cellSpacing=0) for i, row in enumerate(rows): table1.setText(i, 0, row[0]) table1.setText(i, 1, row[1]) cursor.movePosition(QtGui.QTextCursor.End) cursor.insertBlock() return doc
def build(self, params): begDate = params.get('begDate', QtCore.QDate()) endDate = params.get('endDate', QtCore.QDate()) byPeriod = params.get('byPeriod', False) doctype = params.get('doctype', 0) tempInvalidReason = params.get('tempInvalidReason', None) onlyClosed = params.get('onlyClosed', True) orgStructureId = params.get('orgStructureId', None) personId = params.get('personId', None) durationFrom = params.get('durationFrom', 0) durationTo = params.get('durationTo', 0) sex = params.get('sex', 0) ageFrom = params.get('ageFrom', 0) ageTo = params.get('ageTo', 150) socStatusClassId = params.get('socStatusClassId', None) socStatusTypeId = params.get('socStatusTypeId', None) MKBFilter = params.get('MKBFilter', 0) MKBFrom = params.get('MKBFrom', '') MKBTo = params.get('MKBTo', '') insuranceOfficeMark = params.get('insuranceOfficeMark', 0) db = QtGui.qApp.db tbl = db.table('TempInvalid') tblDiag = db.table('Diagnosis') tblReas = db.table('rbTempInvalidReason') doc = QtGui.QTextDocument() cursor = QtGui.QTextCursor(doc) cursor.setCharFormat(CReportBase.ReportTitle) cursor.insertText(self.name) cursor.insertBlock() self.dumpParams(cursor, params) cursor.insertBlock() tableColumns = [ ('5%', [u'№'], CReportBase.AlignRight), ('5%', [u'код'], CReportBase.AlignLeft), ('20%', [u'ФИО,\nдата рождения (возраст),\nпол'], CReportBase.AlignLeft), ('25%', [u'Адрес,\nтелефон'], CReportBase.AlignLeft), ('10%', [u'Паспортные данные,\nсерия - номер'], CReportBase.AlignLeft), ('10%', [u'СНИЛС,\nполис'], CReportBase.AlignLeft), ('5%', [u'Шифр МКБ\nТип'], CReportBase.AlignLeft), ('5%', [u'Период'], CReportBase.AlignLeft), ('5%', [u'Дней'], CReportBase.AlignRight), ('5%', [u'Серия\nНомер'], CReportBase.AlignLeft), ('5%', [u'Место работы'], CReportBase.AlignLeft), ] table = createTable(cursor, tableColumns) n = 0 query = selectData( begDate, endDate, byPeriod, doctype, tempInvalidReason, onlyClosed, orgStructureId, personId, durationFrom, durationTo, sex, ageFrom, ageTo, socStatusClassId, socStatusTypeId, MKBFilter, MKBFrom, MKBTo, insuranceOfficeMark ) self.setQueryText(forceString(query.lastQuery())) while query.next(): n += 1 sumDuration = 0 record = query.record() clientId = forceRef(record.value('client_id')) serial = forceString(record.value('serial')) number = forceString(record.value('number')) caseBegDate = forceDate(record.value('caseBegDate')) # begDate = forceDate(record.value('begDate')) endDate = forceDate(record.value('endDate')) duration = forceInt(record.value('duration')) MKB = forceString(record.value('MKB')) work = forceString(record.value('work')) document = forceString(record.value('doc')) reasonCode = forceString(record.value('code')) prev_id = forceInt(record.value('prev_id')) info = getClientInfo(clientId) name = formatName(info['lastName'], info['firstName'], info['patrName']) nameBDateAndSex = '\n'.join([ name, '%s (%s)' % (formatDate(info['birthDate']), calcAge(info['birthDate'], begDate)), formatSex(info['sexCode']) ]) regAddress = getVal(info, 'regAddress', u'не указан') locAddress = getVal(info, 'locAddress', u'не указан') phones = getClientPhonesEx(clientId) addressAndPhone = regAddress if regAddress else '' addressAndPhone += '\n' + locAddress if locAddress else '' addressAndPhone += '\n' + phones if phones else '' SNILSAndPolicy = '\n'.join([formatSNILS(info['SNILS']), getVal(info, 'policy', u'нет')]) MKBandType = '\n'.join([MKB, reasonCode]) period = '\n'.join([forceString(caseBegDate), forceString(endDate)]) serialAndNumber = '\n'.join([serial, number]) i = table.addRow() table.setText(i, 0, n) table.setText(i, 1, clientId) table.setText(i, 2, nameBDateAndSex) table.setText(i, 3, addressAndPhone) table.setText(i, 4, document) table.setText(i, 5, SNILSAndPolicy) table.setText(i, 6, MKBandType) table.setText(i, 7, period) table.setText(i, 8, duration) table.setText(i, 9, serialAndNumber) table.setText(i, 10, work) if prev_id and onlyClosed: sumDuration += duration extraRows = 0 while prev_id: prev_record = db.getRecordEx( tbl, [ tbl['begDate'], tbl['endDate'], tbl['duration'], tbl['serial'], tbl['number'], tbl['prev_id'], tbl['diagnosis_id'], tbl['tempInvalidReason_id'] ], [tbl['id'].eq(prev_id), tbl['deleted'].eq(0)] ) if prev_record: i = table.addRow() extraRows += 1 begDate = forceDate(prev_record.value('begDate')) endDate = forceDate(prev_record.value('endDate')) duration = forceInt(prev_record.value('duration')) serial = forceString(prev_record.value('serial')) number = forceString(prev_record.value('number')) prev_id = forceInt(prev_record.value('prev_id')) diagnosis_id = forceInt(prev_record.value('diagnosis_id')) reason_id = forceInt(prev_record.value('tempInvalidReason_id')) MKB = forceString(db.translate(tblDiag, tblDiag['id'], diagnosis_id, tblDiag['MKB'])) reason = forceString(db.translate(tblReas, tblReas['id'], reason_id, tblReas['code'])) period = '\n'.join([forceString(begDate), forceString(endDate)]) serialAndNumber = '\n'.join([serial, number]) table.setText(i, 6, MKB + '\n' + reason) table.setText(i, 7, period) table.setText(i, 8, duration) table.setText(i, 9, serialAndNumber) sumDuration += duration i = table.addRow() extraRows += 1 table.setText(i, 7, u'') table.setText(i, 8, u'Всего дней: ' + unicode(sumDuration)) table.mergeCells(i - extraRows, 0, extraRows + 1, 1) table.mergeCells(i - extraRows, 1, extraRows + 1, 1) table.mergeCells(i - extraRows, 2, extraRows + 1, 1) table.mergeCells(i - extraRows, 3, extraRows + 1, 1) table.mergeCells(i - extraRows, 4, extraRows + 1, 1) table.mergeCells(i - extraRows, 5, extraRows + 1, 1) table.mergeCells(i, 6, 1, 2) return doc
def getClientInfo(self, clientId): if clientId in self.mapClientIdToInfo: return self.mapClientIdToInfo[clientId] clientInfo = getClientInfo(clientId) self.mapClientIdToInfo[clientId] = clientInfo return clientInfo
def build(self, params): begDate = getVal(params, 'begDate', QtCore.QDate()) endDate = getVal(params, 'endDate', QtCore.QDate()) eventTypeId = getVal(params, 'eventTypeId', None) onlyPayedEvents = getVal(params, 'onlyPayedEvents', False) begPayDate = getVal(params, 'begPayDate', QtCore.QDate()) endPayDate = getVal(params, 'endPayDate', QtCore.QDate()) workOrgId = getVal(params, 'workOrgId', None) onlyPermanentAttach = getVal(params, 'onlyPermanentAttach', None) db = QtGui.qApp.db reportData = [] query = selectData(begDate, endDate, eventTypeId, onlyPayedEvents, begPayDate, endPayDate, workOrgId, onlyPermanentAttach) while query.next(): record = query.record() clientId = forceInt(record.value('clientId')) Client = getClientInfo(clientId) lastName = Client['lastName'] firstName = Client['firstName'] patrName = Client['patrName'] sex = formatSex(Client['sexCode']) birthDate = Client['birthDate'].toString('dd.MM.yyyy') policy = '' policyRecord = getClientPolicy(clientId) if policyRecord: serial = forceString(policyRecord.value('serial')) number = forceString(policyRecord.value('number')) policy = serial + ' ' + number document = '' documentRecord = getClientDocument(clientId) if documentRecord: documentType_id = forceInt( documentRecord.value('documentType_id')) documentTypeTable = db.table('rbDocumentType') documentTypeRecord = db.getRecord(documentTypeTable, 'name', documentType_id) if documentTypeRecord: document = forceString(documentTypeRecord.value(0)) + ' ' serial = forceString(documentRecord.value('serial')) number = forceString(documentRecord.value('number')) document += (serial + ' ' + number) address = '' ClientAddress = getClientAddress(clientId, 0) if ClientAddress: address_id = ClientAddress.value('address_id') address = formatAddress(address_id) eventTypeName = forceString(record.value('eventTypeName')) execDate = forceDate( record.value('execDate')).toString('dd.MM.yyyy') healthGroup = forceInt(record.value('healthGroup_id')) MKB = forceString(record.value('MKB')) reportData.append([ clientId, lastName, firstName, patrName, sex, birthDate, policy, document, address, eventTypeName, execDate, healthGroup, MKB ]) doc = QtGui.QTextDocument() cursor = QtGui.QTextCursor(doc) cursor.setCharFormat(CReportBase.ReportTitle) cursor.insertText(self.title()) cursor.insertBlock() self.dumpParams(cursor, params) cursor.insertBlock() tableColumns = [ ('6%', [u'№ п/п'], CReportBase.AlignLeft), ('6%', [u'идентификатор клиента'], CReportBase.AlignLeft), ('10%', [u'Фамилия'], CReportBase.AlignLeft), ('10%', [u'Имя'], CReportBase.AlignLeft), ('10%', [u'Отчество'], CReportBase.AlignLeft), ('2%', [u'Пол'], CReportBase.AlignLeft), ('8%', [u'д/рождения'], CReportBase.AlignLeft), ('8%', [u'Полис'], CReportBase.AlignLeft), ('18%', [u'документ'], CReportBase.AlignLeft), ('50%', [u'Адрес'], CReportBase.AlignLeft), ('15%', [u'Тип события'], CReportBase.AlignLeft), ('8%', [u'дата окончания'], CReportBase.AlignLeft), ('2%', [u'группа'], CReportBase.AlignLeft), ('4%', [u'Закл.МКБ'], CReportBase.AlignLeft), ] table = createTable(cursor, tableColumns) for row in reportData: i = table.addRow() table.setText(i, 0, i) for j in xrange(len(row)): table.setText(i, j + 1, row[j]) return doc