예제 #1
0
파일: ExportR67DP.py 프로젝트: dio4/vista_1
    def process(self, dbf, record, codeLPU):
        eventId = forceString(record.value('event_id'))

        row = dbf.newRecord()
        row['FAM'] = forceString(record.value('lastName'))  # Фамилия
        row['IM'] = forceString(record.value('firstName'))  # Имя
        row['OT'] = forceString(record.value('patrName'))  # Отчество
        row['W'] = forceInt(record.value('sex'))  # Пол(1-муж,2-жен)
        row['DR'] = pyDate(forceDate(
            record.value('birthDate')))  # Дата рождения
        row['SPOL'] = forceString(record.value('policySerial'))  # Серия полиса
        row['NPOL'] = forceString(record.value('policyNumber'))  # Номер полиса
        row['Q'] = forceString(record.value('policyInsurer'))  # СМО
        clientAddress = formatAddress(forceRef(record.value('addressId')))
        row['ADRES'] = clientAddress if clientAddress else forceString(
            record.value('freeInput'))  # Адрес проживания
        row['DS'] = forceString(record.value('MKB'))  # Диагноз
        row['MCOD'] = codeLPU  #Код МО
        row['S_ALL'] = forceDouble(
            record.value('sum'))  # Сумма по диспансеризации

        diagDates = self.getDiagDates(eventId, self.dpSpecialityMap)
        analysisDates = self.getAnalysisDates(eventId, self.dpAnalysisMap)

        for dicts in (diagDates, analysisDates):
            for (key, val) in dicts.iteritems():
                row[key] = pyDate(val)

        row.store()
예제 #2
0
def get_adr(clientId):
    regAddressRecord = getClientAddress(clientId, 0)
    if regAddressRecord:
        return formatAddress(regAddressRecord.value('address_id'))
    return ''
예제 #3
0
 def build(self, params):
     
     doc = QtGui.QTextDocument()
     cursor = QtGui.QTextCursor(doc)
     format = QtGui.QTextCharFormat()
     
     cursor.insertBlock()
     format.setFontPointSize(14)
     format.setFontWeight(QtGui.QFont.Bold)
     accountDate, sender, recipient = self.getAccountInfo(params.get('accountId', None))
     cursor.insertText(u'РЕЕСТР счетов за %s на %s.' % (forceString(accountDate),
                                                        u'оплату расходов по проведенной диспансеризации подростков'))
     cursor.insertBlock()
     
     cursor.insertBlock()
     format.setFontPointSize(8)
     format.setFontWeight(QtGui.QFont.Normal)
     cursor.insertText(u'Учреждение-отправитель: %s' % sender)
     cursor.insertBlock()
     
     cursor.insertBlock()
     cursor.insertText(u'Учреждение-получатель:  %s' % recipient)
     
     
     format.setFontPointSize(8)
     
     tableColumns = [
         ('?',  [u'№ п/п',
                 u'',
                 u'1'],  CReportBase.AlignLeft), 
         ('?',  [u'Фамилия',
                 u'',
                 u'2'],  CReportBase.AlignCenter), 
         ('?',  [u'Имя',
                 u'',
                 u'3'],  CReportBase.AlignCenter),  
         ('?',  [u'Отчество',
                 u'',
                 u'4'],  CReportBase.AlignCenter),  
         ('?',  [u'Пол',
                 u'',
                 u'5'],  CReportBase.AlignCenter),  
         ('?',  [u'Дата рождения',
                 u'',
                 u'6'],  CReportBase.AlignCenter),  
         ('?',  [u'Адрес по месту регистрации',
                 u'',
                 u'7'],  CReportBase.AlignCenter),  
         ('?',  [u'Серия и номер полиса',
                 u'',
                 u'8'],  CReportBase.AlignCenter),  
         ('?',  [u'СМО',
                 u'',
                 u'9'],  CReportBase.AlignCenter),  
         ('?',  [u'Диагноз по МКБ 10 (основной)',
                 u'',
                 u'10'],  CReportBase.AlignCenter),  
         ('?',  [u'Даты осмотров врачами-специалистами, проведения лабораторных и функциональных исследований',
                 u'педиатр',
                 u'11'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'невролог',
                 u'12'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'офтальмолог',
                 u'13'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'детский хирург',
                 u'14'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'оториноларинголог',
                 u'15'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'акушер-гинеколог',
                 u'16'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'травматолог-ортопед',
                 u'17'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'детский стоматолог',
                 u'18'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'детский уролог-андролог',
                 u'19'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'детский эндокринолог',
                 u'20'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'клин. анализ крови',
                 u'21'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'клин. анализ мочи',
                 u'22'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'анализ кала',
                 u'23'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'осмотр глазного дна',
                 u'24'],  CReportBase.AlignCenter),
         ('?',  [u'УЗИ',
                 u'щитовидной железы',
                 u'25'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'молочных желез',
                 u'26'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'органов малого таза',
                 u'27'],  CReportBase.AlignCenter),
         ('?',  [u'',
                 u'яичек',
                 u'28'],  CReportBase.AlignCenter),
         ('?',  [u'Цена',
                 u'',
                 u'29'],  CReportBase.AlignCenter),
         ('?',  [u'Федеральная цена',
                 u'',
                 u'30'],  CReportBase.AlignCenter),
         ('?',  [u'Норматив затрат на проведение диспансеризации',
                 u'',
                 u'31'],  CReportBase.AlignCenter),
         
         ]
     table = createTable(cursor, tableColumns, 3)
     
     for i in xrange(0, 10): #Объединение (вертикальное) для первых 10 полей
         table.mergeCells(0, i, 2, 1)
     table.mergeCells(0, 10, 1, 14)  #Объединение ячеек для поля "Даты осмотров врачами..."
     table.mergeCells(0, 24, 1, 4)   #Объединение для поля "УЗИ"
     table.mergeCells(0, 29, 1, 1)   #Объединение (вертикальное) для поля "Норматив затрат на проведение диспансеризации"
     
     self.prepareActionTypeGroups()
     
     query = selectData(params)
     n = 0
     fullSum = 0.0
     fullFederalSum = 0.0
     self.setQueryText(forceString(query.lastQuery()))
     while query.next():
         n += 1
         record = query.record()
         
         i = table.addRow()
         sex = formatSex(record.value('sex')).upper()
         price = forceDouble(record.value('price'))
         federalPrice = forceDouble(record.value('federalPrice'))               
         sum = forceDouble(record.value('sum'))
         federalSum = forceDouble(record.value('federalSum'))
         table.setText(i, 0, n, format)
         table.setText(i, 1, forceString(record.value('lastName')), format)
         table.setText(i, 2, forceString(record.value('firstName')), format)
         table.setText(i, 3, forceString(record.value('patrName')), format)
         table.setText(i, 4, sex, format)
         table.setText(i, 5, forceString(forceDate(record.value('birthDate'))), format)
         table.setText(i, 6, formatAddress(forceRef(record.value('addressId'))), format)
         table.setText(i, 7, forceString(record.value('policySN')), format)
         table.setText(i, 8, forceString(record.value('policyInsurer')), format)
         table.setText(i, 9, forceString(record.value('MKB')), format)
         
         eventId = forceString(record.value('event_id'))
         diagDates = getDiagDates(eventId, self.dpSpecialityMap)
         table.setText(i, 10, forceString(diagDates.get('PEDIATR', '-')), format)
         table.setText(i, 11, forceString(diagDates.get('NEVROL', '-')), format)
         table.setText(i, 12, forceString(diagDates.get('OFTAL', '-')), format)
         table.setText(i, 13, forceString(diagDates.get('HIRURG', '-')), format)
         table.setText(i, 14, forceString(diagDates.get('OTOLAR', '-')), format)
         table.setText(i, 15, forceString(diagDates.get('GINEKOL', '-')), format)
         table.setText(i, 16, forceString(diagDates.get('ORTOPED', '-')), format)
         table.setText(i, 17, forceString(diagDates.get('STOMAT', '-')), format)
         table.setText(i, 18, forceString(diagDates.get('ANDROL', '-')), format)
         table.setText(i, 19, forceString(diagDates.get('ENDOKR', '-')), format)
         
         analysisDates = getAnalysisDates(eventId, self.dpAnalysisMap)
         table.setText(i, 20, forceString(analysisDates.get('AN_KROV', '-')), format)
         table.setText(i, 21, forceString(analysisDates.get('AN_MOCH', '-')), format)
         table.setText(i, 22, forceString(analysisDates.get('AN_KAL', '-')), format)
         table.setText(i, 23, forceString(analysisDates.get('GLAZ_DNO', '-')), format)
         table.setText(i, 24, forceString(analysisDates.get('USI_SHC', '-')), format)
         table.setText(i, 25, forceString(analysisDates.get('USI_MJ', '-')), format)
         table.setText(i, 26, forceString(analysisDates.get('USI_MT', '-')), format)
         table.setText(i, 27, forceString(analysisDates.get('USI_YI', '-')), format)
         
         table.setText(i, 28, QtCore.QString.number(price, 'g', 9), format)
         table.setText(i, 29, QtCore.QString.number(federalPrice, 'g', 9), format)
         table.setText(i, 30, QtCore.QString.number(sum, 'g', 9), format)
         
         fullSum += sum
         fullFederalSum += federalSum
     
     cursor.movePosition(cursor.End)
     cursor.insertBlock()
     
     cursor.insertBlock()
     cursor.insertText(u'ВСЕГО ПРЕДСТАВЛЕНО К ОПЛАТЕ:')
     
     cursor.insertBlock()
     cursor.insertText(u'По территориальному тарифу на сумму: %s' % QtCore.QString.number(fullSum - fullFederalSum, 'f', 2)) 
     
     cursor.insertBlock()
     cursor.insertText(u'По дополнительному тарифу на сумму: %s' %  QtCore.QString.number(fullFederalSum, 'f', 2))
     
     cursor.insertBlock()
     createAutographField(cursor, [u'Гл. врач', u'Гл. бухгалтер'], getOrganisationMainStaff(QtGui.qApp.currentOrgId()), format)
     
     return doc
예제 #4
0
    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