Пример #1
0
 def __init__(self, parent, clientId, actionIdList, visibleOkButton=False):
     CDialogBase.__init__(self, parent)
     cols = [
         CDateTimeFixedCol(u'Дата и время приема', ['directionDate'], 20),
         CRefBookCol(u'Тип', ['actionType_id'], 'ActionType', 15),
         CEnumCol(u'Состояние', ['status'],
                  CActionType.retranslateClass(False).statusNames, 4),
         CRefBookCol(u'Назначил', ['setPerson_id'],
                     'vrbPersonWithSpeciality', 20),
         CRefBookCol(u'Специалист', ['person_id'],
                     'vrbPersonWithSpeciality', 20),
         CTextCol(u'Каб', ['office'], 6),
         CTextCol(u'Примечания', ['note'], 6),
     ]
     self.addModels('Actions', CTableModel(self, cols, 'Action'))
     self.btnPrint = QtGui.QPushButton(u'Печать', self)
     self.btnPrint.setObjectName('btnPrint')
     self.setupUi(self)
     self.setWindowFlags(QtCore.Qt.Dialog
                         | QtCore.Qt.WindowMaximizeButtonHint
                         | QtCore.Qt.WindowCloseButtonHint)
     if visibleOkButton:
         self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok
                                           | QtGui.QDialogButtonBox.Cancel)
     else:
         self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
     self.buttonBox.addButton(self.btnPrint,
                              QtGui.QDialogButtonBox.ActionRole)
     self.tblActions.setModel(self.modelActions)
     self.tblActions.addPopupPrintRow(self)
     self.clientId = clientId
     self.txtClientInfoBrowser.setHtml(
         getClientBanner(self.clientId) if self.clientId else '')
     self.modelActions.setIdList(actionIdList)
     self.buttonBox.setEnabled(bool(actionIdList))
Пример #2
0
 def on_btnPrint_clicked(self):
     doc = QtGui.QTextDocument()
     cursor = QtGui.QTextCursor(doc)
     format = QtGui.QTextCharFormat()
     format.setProperty(QtGui.QTextFormat.FontSizeIncrement,
                        QtCore.QVariant(2))
     format.setFontWeight(QtGui.QFont.Bold)
     cursor.setCharFormat(format)
     if len(self.actionPropertyList) == 1:
         title = u'Журнал значения свойства "' + self.actionPropertyList[0][
             0].type().name + '"'
     else:
         names = [
             '"' + actionProperty[0].type().name + '"'
             for actionProperty in self.actionPropertyList
         ]
         title = u'Журнал значения свойств ' + ', '.join(
             names[:-1]) + u' и ' + names[-1]
     cursor.insertText(title)
     cursor.insertBlock()
     cursor.setCharFormat(QtGui.QTextCharFormat())
     cursor.insertText(u'пациент:')
     cursor.insertBlock()
     cursor.insertHtml(getClientBanner(self.clientId))
     self.tblValues.addContentToTextCursor(cursor)
     view = CReportViewDialog(self)
     view.setWindowTitle(u'Журнал значения свойства')
     view.setText(doc)
     view.exec_()
Пример #3
0
    def setClientId(self, clientId):
        self.clientId = clientId
        if clientId:
            if u'онко' in forceString(QtGui.qApp.db.translate('Organisation', 'id', QtGui.qApp.currentOrgId(), 'infisCode')):
                vipRecord = QtGui.qApp.db.getRecordEx(
                    QtGui.qApp.db.table('ClientVIP'),
                    [
                        QtGui.qApp.db.table('ClientVIP')['client_id'],
                        QtGui.qApp.db.table('ClientVIP')['color']
                    ],
                    [
                        QtGui.qApp.db.table('ClientVIP')['deleted'].eq(0),
                        QtGui.qApp.db.table('ClientVIP')['client_id'].eq(self.clientId)
                    ]
                )

                self.isVipClient = forceBool(vipRecord);
                if self.isVipClient:
                    self.vipColor = forceString(vipRecord.value('color'))

            self.txtClientInfoBrowser.setHtml(getClientBanner(clientId))
            self.checkVipPerson(self.txtClientInfoBrowser)
            db = QtGui.qApp.db
            table = db.table('Client')
            record = db.getRecord(table, 'sex, birthDate', clientId)
            if record:
                self.clientSex = forceInt(record.value('sex'))
                self.clientBirthDate = forceDate(record.value('birthDate'))
                self.clientAge = calcAgeTuple(self.clientBirthDate, self.date)
        else:
            self.txtClientInfoBrowser.setText('')
Пример #4
0
    def setClientId(self, clientId):
        self._clientId = clientId
        if clientId:
            self.clientInfoBanner.setHtml(getClientBanner(clientId))
        else:
            self.clientInfoBanner.setText('')

        self.ambCardPageWidget.setClientId(clientId)
Пример #5
0
 def setup(self, cols, tableName, order):
     self.setWindowFlags(QtCore.Qt.Dialog
                         | QtCore.Qt.WindowMaximizeButtonHint
                         | QtCore.Qt.WindowCloseButtonHint)
     self.props = {}
     self.order = order
     self.model = CTableModel(self, cols, tableName)
     self.model.setIdList(self.eventIdList)
     self.tblOpenEvents.setModel(self.model)
     if self.eventIdList:
         self.tblOpenEvents.selectRow(0)
     if self.clientId:
         self.txtClientInfoEventsBrowser.setHtml(
             getClientBanner(self.clientId))
     else:
         self.txtClientInfoEventsBrowser.setText('')
     QtCore.QObject.connect(self.tblOpenEvents.horizontalHeader(),
                            QtCore.SIGNAL('sectionClicked(int)'),
                            self.setSort)
Пример #6
0
 def setup(self, orgStructureId = None, specialityId = None, personId = None):
     currentDate = forceDate(QtCore.QDate.currentDate())
     beginDate = QtCore.QDate(currentDate.year(), 1, 1)
     self.edtBeginDateVisitBeforeRecordClient.setDate(beginDate)
     self.edtEndDateVisitBeforeRecordClient.setDate(currentDate.addDays(- 1))
     if orgStructureId:
         self.cmbOrgStructureVisitBeforeRecordClient.setValue(orgStructureId)
     else:
         self.cmbOrgStructureVisitBeforeRecordClient.setValue(0)
     self.cmbSpecialityVisitBeforeRecordClient.setTable('rbSpeciality', order='name')
     if specialityId:
         self.cmbSpecialityVisitBeforeRecordClient.setValue(specialityId)
     else:
         self.cmbSpecialityVisitBeforeRecordClient.setValue(0)
     if personId:
         self.cmbPersonVisitBeforeRecordClient.setValue(personId)
     else:
         self.cmbPersonVisitBeforeRecordClient.setValue(0)
     if self.clientId:
         self.txtVisitBeforeRecordClient.setHtml(getClientBanner(self.clientId))
     else:
         self.txtVisitBeforeRecordClient.setText('')
Пример #7
0
 def setClientBanner(self, clientId):
     clientBanner = getClientBanner(clientId)
     self.textBrowser.setHtml(clientBanner)
Пример #8
0
 def showClientInfo(self, id):
     self.txtClientInfoBrowser.setHtml(getClientBanner(id) if id else '')
     self.actOpenClient2.setEnabled(bool(id))
Пример #9
0
 def tableAddRows(self, table):
     if len(self.diagnostic) > 0 and len(self.visit) > 0 and len(
             self.action) > 0 and self.clientId != None:
         if self.clientId == 206570:
             pass
         i = table.addRow()
         currentRow = [False, False]
         startRowClient = i
         table.setText(i, 0, self.number)
         table.setHtml(i, 1, getClientBanner(self.clientId))
         j = 0
         visitIndexLow = 0
         for visitMerge in self.visit[4]:
             sumDiagnostic = 0
             sumAction = 0
             indexDeposite = [[], []]
             if visitMerge != self.visit[4][0]:
                 i = table.addRow()
                 currentRow = [False, False]
             table.setText(i, 6, self.visit[1][j])
             table.setText(i, 7, self.visit[2][j])
             table.setText(i, 8, self.visit[3][j])
             for rowNumber in range(
                     len(self.diagnostic[0]) if len(self.diagnostic[0])
                     >= len(self.action[0]) else len(self.action[0])):
                 if rowNumber < len(
                         self.diagnostic[0]
                 ) and self.diagnostic[5][rowNumber] == visitIndexLow:
                     i, currentRow, indexDeposite, currentI = addRow(
                         table, currentRow, 0, i, indexDeposite)
                     table.setText(i, 2, self.diagnostic[1][rowNumber])
                     table.setText(i, 3, self.diagnostic[2][rowNumber])
                     table.setText(i, 4, self.diagnostic[3][rowNumber])
                     table.setText(i, 5, self.diagnostic[4][rowNumber])
                     sumDiagnostic += 1
                     i = currentI
                 if rowNumber < len(self.action[0]) and self.action[6][
                         rowNumber] == visitIndexLow:
                     i, currentRow, indexDeposite, currentI = addRow(
                         table, currentRow, 1, i, indexDeposite)
                     table.setText(i, 9, self.action[1][rowNumber])
                     table.setText(i, 10, self.action[2][rowNumber])
                     table.setText(i, 11, self.action[3][rowNumber])
                     table.setText(i, 12, self.action[4][rowNumber])
                     table.setText(i, 13, self.action[5][rowNumber])
                     if not self.chkDiagnosis:
                         table.setText(i, 14, self.action[7][rowNumber])
                     sumAction += 1
                     i = currentI
             j += 1
             if sumDiagnostic == 0:
                 sumDiagnostic = 1
             if sumAction == 0:
                 sumAction = 1
             table.mergeCells(
                 startRowClient + visitMerge + sumDiagnostic - 1, 2,
                 sumAction - sumDiagnostic + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumDiagnostic - 1, 3,
                 sumAction - sumDiagnostic + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumDiagnostic - 1, 4,
                 sumAction - sumDiagnostic + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumDiagnostic - 1, 5,
                 sumAction - sumDiagnostic + 1, 1)
             table.mergeCells(startRowClient + visitMerge, 6,
                              i + visitMerge - startRowClient + 1, 1)
             table.mergeCells(startRowClient + visitMerge, 7,
                              i + visitMerge - startRowClient + 1, 1)
             table.mergeCells(startRowClient + visitMerge, 8,
                              i + visitMerge - startRowClient + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumAction - 1, 9,
                 sumDiagnostic - sumAction + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumAction - 1, 10,
                 sumDiagnostic - sumAction + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumAction - 1, 11,
                 sumDiagnostic - sumAction + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumAction - 1, 12,
                 sumDiagnostic - sumAction + 1, 1)
             table.mergeCells(
                 startRowClient + visitMerge + sumAction - 1, 13,
                 sumDiagnostic - sumAction + 1, 1)
             if not self.chkDiagnosis:
                 table.mergeCells(
                     startRowClient + visitMerge + sumAction - 1, 14,
                     sumDiagnostic - sumAction + 1, 1)
             visitIndexLow += 1
         table.mergeCells(startRowClient, 0, i - startRowClient + 1, 1)
         table.mergeCells(startRowClient, 1, i - startRowClient + 1, 1)
     clearList(self)
Пример #10
0
    def build(self, params):
        doc = QtGui.QTextDocument()
        cursor = QtGui.QTextCursor(doc)

        cursor.setCharFormat(CReportBase.ReportTitle)
        cursor.insertText(self.title())
        cursor.insertBlock()
        chkTraumaType = params.get('chkTraumaType', False)
        if chkTraumaType:
            self.dumpParamsTraumaType(cursor, params)
        self.dumpParams(cursor, params)
        cursor.insertBlock()

        tableColumns = [('5%', [u'№'], CReportBase.AlignRight),
                        ('25%', [u'Пациент'], CReportBase.AlignLeft),
                        ('5%', [u'Заболевания',
                                u'Код по МКБ'], CReportBase.AlignLeft),
                        ('5%', [u'', u'Доп.код'], CReportBase.AlignLeft),
                        ('5%', [u'', u'С'], CReportBase.AlignLeft),
                        ('5%', [u'', u'По'], CReportBase.AlignLeft),
                        ('5%', [u'', u'Характер'], CReportBase.AlignLeft),
                        ('5%', [u'', u'Тип травмы'], CReportBase.AlignLeft),
                        ('5%', [u'Осмотры', u'Дата'], CReportBase.AlignLeft),
                        ('5%', [u'', u'Госп.'], CReportBase.AlignLeft),
                        ('5%', [u'', u'СКЛ'], CReportBase.AlignLeft),
                        ('5%', [u'', u'ДН'], CReportBase.AlignLeft),
                        ('15%', [u'', u'Врач'], CReportBase.AlignLeft)]

        table = createTable(cursor, tableColumns)
        table.mergeCells(0, 0, 2, 1)
        table.mergeCells(0, 1, 2, 1)
        table.mergeCells(0, 2, 1, 6)
        table.mergeCells(0, 8, 1, 5)

        prevClientId = None
        prevClientRowIndex = 0
        prevDiagnosisId = None
        prevDiagnosisRowIndex = 0
        cnt = 0
        i = 0
        query = selectData(params)
        self.setQueryText(forceString(query.lastQuery()))
        while query.next():
            record = query.record()
            clientId = forceInt(record.value('client_id'))
            diagnosisId = forceInt(record.value('diagnosis_id'))
            MKB = forceString(record.value('MKB'))
            MKBEx = forceString(record.value('MKBEx'))
            setDate = forceDate(record.value('setDate'))
            endDate = forceDate(record.value('endDate'))
            diseaseCharacter = forceString(record.value('diseaseCharacter'))
            if diseaseCharacter == '1':
                diseaseCharacter = u'острый'
            elif diseaseCharacter == '3':
                diseaseCharacter = u'хронический'

            traumaType = forceString(record.value('traumaType'))
            diagnosticDate = forceDate(record.value('diagnosticDate'))
            diagnosticHospital = forceString(
                record.value('diagnosticHospital'))
            diagnosticSanatorium = forceString(
                record.value('diagnosticSanatorium'))
            diagnosticDispanser = forceString(
                record.value('diagnosticDispanser'))
            diagnosticPerson = forceString(record.value('diagnosticPerson'))

            i = table.addRow()
            if prevClientId != clientId:
                prevClientId = clientId
                self.mergePatientRows(table, prevClientRowIndex, i)
                prevClientRowIndex = i
                cnt += 1
                table.setText(i, 0, cnt)
                table.setHtml(i, 1, getClientBanner(clientId))

            if prevDiagnosisId != diagnosisId:
                prevDiagnosisId = diagnosisId
                self.mergeDiagnosisRows(table, prevDiagnosisRowIndex, i)
                prevDiagnosisRowIndex = i

                table.setText(i, 2, MKB)
                table.setText(i, 3, MKBEx)
                table.setText(i, 4, forceString(setDate))
                table.setText(i, 5, forceString(endDate))
                table.setText(i, 6, forceString(diseaseCharacter))
                table.setText(i, 7, forceString(traumaType))
            table.setText(i, 8, forceString(diagnosticDate))
            table.setText(i, 9, diagnosticHospital)
            table.setText(i, 10, diagnosticSanatorium)
            table.setText(i, 11, diagnosticDispanser)
            table.setText(i, 12, diagnosticPerson)
        self.mergePatientRows(table, prevClientRowIndex, i + 1)
        self.mergeDiagnosisRows(table, prevDiagnosisRowIndex, i + 1)
        return doc
Пример #11
0
    def build(self, params):
        clientId = params.get('clientId', None)
        begDate = params.get('begDate', None)
        endDate = params.get('endDate', None)
        eventPurposeId = params.get('eventPurposeId', None)
        specialityId = params.get('specialityId', None)
        personId = params.get('personId', None)
        orgStructureId = params.get('orgStructureId', None)

        doc = QtGui.QTextDocument()
        cursor = QtGui.QTextCursor(doc)
        cursor.setCharFormat(CReportBase.ReportTitle)
        cursor.insertText(self.name)
        cursor.setCharFormat(CReportBase.TableBody)
        cursor.insertBlock()
        cursor.insertHtml(getClientBanner(clientId))
        cursor.insertBlock()

        tableColumns = [
            ('10?', [u'Дата'], CReportBase.AlignLeft),
            ('15?', [u'Врач'], CReportBase.AlignLeft),
            ('15?', [u'Специальность'], CReportBase.AlignLeft),
            ('5?', [u'Место'], CReportBase.AlignLeft),
            ('10?', [u'Код услуги'], CReportBase.AlignLeft),
            ('10?', [u'Тип события'], CReportBase.AlignLeft),
            ('5?', [u'МЭС'], CReportBase.AlignLeft),
            ('5?', [u'Код диагноза'], CReportBase.AlignLeft),
            ('20?', [u'Расшифровка диагноза'], CReportBase.AlignLeft),
            ('5?', [u'Результат'], CReportBase.AlignLeft),
        ]
        table = createTable(cursor, tableColumns)

        db = QtGui.qApp.db
        query = selectData(clientId, begDate, endDate, eventPurposeId,
                           specialityId, personId, orgStructureId)
        self.setQueryText(forceString(query.lastQuery()))
        while query.next():
            record = query.record()
            i = table.addRow()
            table.setText(i, 0, forceString(forceDate(record.value('date'))))
            table.setText(i, 1, forceString(record.value('person')))
            table.setText(i, 2, forceString(record.value('speciality')))
            table.setText(i, 3, forceString(record.value('scene')))
            table.setText(i, 4, forceString(record.value('service')))
            table.setText(i, 5, forceString(record.value('eventType')))
            table.setText(
                i, 6,
                forceString(
                    db.translate('mes.MES', 'id',
                                 forceRef(record.value('mes')), 'code')))
            table.setText(i, 9, forceString(record.value('resultName')))
            diagnosisCodes = []
            diagnosisNames = []
            MKB = forceString(record.value('MKB'))
            MKBEx = forceString(record.value('MKBEx'))
            if MKB:
                diagnosisCodes.append(MKB)
                diagnosisNames.append(getMKBName(MKB))
            if MKBEx:
                diagnosisCodes.append(MKBEx)
                diagnosisNames.append(getMKBName(MKBEx))
            table.setText(i, 7, '\n'.join(diagnosisCodes))
            table.setText(i, 8, '\n'.join(diagnosisNames))
        return doc
Пример #12
0
    def build(self, params):
        begDate = params.get('begDate', QtCore.QDate())
        endDate = params.get('endDate', QtCore.QDate())
        eventPurposeId = params.get('eventPurposeId', None)
        eventTypeId = params.get('eventTypeId', None)
        orgStructureId = params.get('orgStructureId', None)
        personId = params.get('personId', None)
        sceneId = params.get('sceneId', None)
        workOrgId = params.get('workOrgId', None)
        sex = params.get('sex', 0)
        ageFrom = params.get('ageFrom', 0)
        ageTo = params.get('ageTo', 150)

        db = QtGui.qApp.db
        query = selectData(begDate, endDate, orgStructureId, personId,
                           eventPurposeId, eventTypeId, sceneId, workOrgId,
                           sex, ageFrom, ageTo)

        doc = QtGui.QTextDocument()
        cursor = QtGui.QTextCursor(doc)
        cursor.setCharFormat(CReportBase.ReportTitle)
        cursor.insertText(self.title())
        cursor.insertBlock()
        self.dumpParams(cursor, params)
        cursor.insertBlock()

        tableColumns = [
            ('10%', [u'Дата'], CReportBase.AlignLeft),
            ('5%', [u'№'], CReportBase.AlignRight),
            ('45%', [u'Пациент'], CReportBase.AlignLeft),
            ('10%', [u'Тип обращения'], CReportBase.AlignLeft),
            ('10%', [u'Место'], CReportBase.AlignLeft),
            ('5%', [u'Закл. диагноз'], CReportBase.AlignLeft),
            ('5%', [u'ДН'], CReportBase.AlignLeft),
        ]
        table = createTable(cursor, tableColumns)

        prevVisitId = None
        prevDate = None
        cnt = 0
        total = 0
        self.setQueryText(forceString(query.lastQuery()))
        while query.next():
            record = query.record()
            visitId = forceRef(record.value('visit_id'))
            date = forceDate(record.value('date'))
            clientId = forceRef(record.value('client_id'))
            eventType = forceString(record.value('eventType'))
            scene = forceString(record.value('scene'))
            MKB = forceString(record.value('MKB'))
            dispanser = forceString(record.value('dispanser'))

            if date != prevDate:
                self.produceTotalLine(table, prevDate, cnt)
                prevDate = date
                total += cnt
                cnt = 0
                prevVisitId = None

            if prevVisitId != visitId:
                cnt += 1
                i = table.addRow()
                table.setText(i, 0, forceString(date))
                table.setText(i, 1, cnt)
                table.setHtml(i, 2, getClientBanner(clientId, date))
                table.setText(i, 3, eventType)
                table.setText(i, 4, scene)
                table.setText(i, 5, MKB)
                table.setText(i, 6, dispanser)
            else:
                i = table.addRow()
                for j in xrange(7):
                    if j != 5:
                        table.mergeCells(i - 1, j, 2, 1)
                table.setText(i, 5, MKB)
        self.produceTotalLine(table, prevDate, cnt)
        total += cnt
        i = table.addRow()
        table.setText(i, 0, u'ВСЕГО', CReportBase.TableTotal)
        table.setText(i, 1, total, CReportBase.TableTotal)
        return doc
Пример #13
0
 def on_btnPrintVisitBeforeRecordClient_clicked(self):
     if self.clientId and self.modelVisitByQueueTable.rowCount() > 0:
         self.tblVisitByQueue.setReportHeader(u'Протокол обращений пациента по предварительной записи')
         self.tblVisitByQueue.setReportDescription(getClientBanner(self.clientId))
         dataRoles = [QtCore.Qt.DisplayRole]*(self.tblVisitByQueue.model().columnCount())
         self.tblVisitByQueue.printContent(dataRoles)