Example #1
0
 function Render(&$AInfo)
 {
     $vDB = GetDB();
     $vBranchInfo = GetBranchInfo();
     $this->AddPage();
     $this->SetFont('arial_rus', '', 10);
     $vWidth = $this->GetAreaWidth() / 2 - 10;
     $vHeight = $this->FontSize;
     $vHeightLN = $this->FontSize * 1.5;
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->SetXY($vX, $vY);
     $this->Cell($vWidth, $vHeight, 'Министерство здравоохранения', '', 0, 'L');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'и социального развития', '', 0, 'L');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'Российской Федерации', '', 0, 'L');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, iconv("utf8", "windows-1251", @$vBranchInfo['name']), '', 0, 'L');
     $this->Cell($vWidth, $vHeight, '', '', 0, 'L');
     $this->Ln($vHeightLN);
     $this->ExactCell($vHeight, 'Код ОГРН  ');
     $this->BoxedText($vWidth, $vHeight, iconv("utf8", "windows-1251", $vBranchInfo['OGRN']));
     $this->Ln($vHeightLN);
     $this->SetFont('arial_rus', '', 10);
     $vHeight = $this->FontSize;
     $vHeightLN = $this->FontSize * 1.5;
     $this->Cell($vWidth, $vHeight, 'НАПРАВЛЕНИЕ НА ЛФК', '', 0, 'C');
     $this->Ln($vHeightLN);
     //        $this->Notes('Карта стационарного (амб.) больного №', 0, $vWidth, 1, @$AInfo['case_id']);
     $this->Notes('Фамилия, имя, отчество', 0, $vWidth, 1, FormatShortNameEx($AInfo));
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->Notes('Возраст   ', 0, $vWidth / 2, 1, CalcAge(@$AInfo['born_date']));
     $this->SetXY($vX + $vWidth / 2, $vY);
     $this->Notes('Пол', 0, $vWidth / 2, 1, iconv("utf8", "windows-1251", FormatSex($AInfo['is_male'])));
     $vBlock = array();
     $vBlock[] = array('title' => 'Адрес', 'text' => iconv("utf8", "windows-1251", FormatAddress(@$AInfo['addr_reg_street'], @$AInfo['addr_reg_num'], @$AInfo['addr_reg_subnum'], @$AInfo['addr_reg_apartment'])));
     $vBlock[] = array('title' => 'Документ', 'text' => iconv("utf8", "windows-1251", FormatDocument(@$AInfo['doc_type_id'], @$AInfo['doc_series'], @$AInfo['doc_number'])));
     $vBlock[] = array('title' => 'Полис', 'text' => iconv("utf8", "windows-1251", FormatPolisEx(@$AInfo['insurance_company_id'], @$AInfo['polis_series'], @$AInfo['polis_number'])));
     $vBlock[] = array('title' => 'Диагноз', 'text' => iconv("utf8", "windows-1251", @$AInfo['diagnosis']), 'rows' => 3);
     $vBlock[] = array('title' => 'Дата', 'text' => iconv("utf8", "windows-1251", Date2ReadableLong(date('Y-m-d', time()))));
     $vBlock[] = array('title' => 'Врач', 'text' => iconv("utf8", "windows-1251", FormatUserName(@$AInfo['doctor_id'])));
     $this->BlockNotes($vBlock, $vWidth);
 }
Example #2
0
function OutSurgery($ADBF, $ACase, $ASurgery, $AService)
{
    $vSMOList = locGetSMOList();
    $vDocSeries = trim(str_replace('-', ' ', $ACase['doc_series']));
    $vSpacePos = strpos($vDocSeries, ' ');
    if ($vSpacePos === false) {
        $vSerLeft = substr($vDocSeries, 0, 2);
        $vSerRight = substr($vDocSeries, 2);
    } else {
        $vSerLeft = substr($vDocSeries, 0, $vSpacePos);
        $vSerRight = substr($vDocSeries, $vSpacePos + 1);
    }
    $vBornDate = $ACase['born_date'];
    if (empty($vBornDate)) {
        $vBornDate = '0000-00-00';
    }
    $vBornDate = explode('-', $vBornDate);
    if ($vBornDate[0] == '0000') {
        $vBornDate[0] = '1901';
    }
    if ($vBornDate[1] == '00') {
        $vBornDate[1] = '01';
    }
    if ($vBornDate[2] == '00') {
        $vBornDate[2] = '01';
    }
    $vBornDate = implode('-', $vBornDate);
    $vSurgeryDate = $ASurgery['date'];
    //        Trace(@$ACase['insurance_company_id'].'=->'.@$vSMOList[$ACase['insurance_company_id']]);
    $vFirstDoctorId = $ACase['first_doctor_id'];
    $CurrDoctorId = $ASurgery['user_id'];
    $vRecord = array(FormatName($ACase['last_name']), FormatName($ACase['first_name']), FormatName($ACase['patr_name']), Date2DBF($vBornDate), $ACase['is_male'] ? 'м' : 'ж', 'э', strtoupper($ACase['polis_series']), strtoupper($ACase['polis_number']), '', '', $ACase['addr_reg_street'], '', '', $ACase['addr_reg_num'], $ACase['addr_reg_subnum'], $ACase['addr_reg_apartment'], 'аТрОт', CalcAge($vBornDate, $vSurgeryDate) >= 18 ? 'в' : 'д', Date2DBF($vSurgeryDate), Date2DBF($vSurgeryDate), '1', str_replace(' ', '', $ACase['diagnosis_mkb']), false, '', $ACase['doc_type_id'], $vSerLeft, $vSerRight, $ACase['doc_number'], FormatAddress(@$ACase['addr_reg_street'], @$ACase['addr_reg_num'], @$ACase['addr_reg_subnum'], @$ACase['addr_reg_apartment']), @$ACase['id'], 1, 0, 23, 'тр.' . @$ACase['id'], 118, 118, str_replace(' ', '', $ACase['diagnosis_mkb']), '', '', 16, 31, 31, 29, 1, 1, getUserEisCode($CurrDoctorId), getUserEisCode($vFirstDoctorId), '1', '1', 0, 0, 0, 0, 3, 5, 5, 0, 2, 0, 0, 0, 0);
    $vOutRecord = array();
    foreach ($vRecord as $vField) {
        $vOutRecord[] = iconv('UTF-8', 'CP866', $vField);
    }
    dbase_add_record($ADBF, $vOutRecord);
}
Example #3
0
 function OutCard($ACaseID, &$ASurgeries)
 {
     $vDB = GetDB();
     $vCase = $vDB->GetById('emst_cases', $ACaseID);
     $this->SetFont('arial_rus', '', 10);
     $vHeight = $this->FontSize * 1.5;
     $vWidth = $this->GetAreaWidth();
     //            $vName = trim(@$vCase['last_name'].' '.@$vCase['first_name'].' '.@$vCase['patr_name']);
     $vName = FormatNameEx($vCase);
     $this->Cell(20, $vHeight, 'Ф.И.О.');
     $this->Cell(70, $vHeight, $vName, 'B');
     $this->ExactCell($vHeight, '  И.Б. №  ');
     $this->Cell(15, $vHeight, $ACaseID, 'B');
     //            $this->Ln($vHeight);
     $this->ExactCell($vHeight, '  пол  ');
     $this->Cell(5, $vHeight, FormatSex(@$vCase['is_male']), 'B');
     $this->ExactCell($vHeight, '  дата рождения  ');
     $this->Cell(30, $vHeight, Date2Readable(@$vCase['born_date']), 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Категория');
     $this->Cell(20, $vHeight, '11-прочее', 'B');
     $this->ExactCell($vHeight, '  работабщий  ');
     $this->Cell(10, $vHeight, FormatBoolean(@$vCase['employment_category_id'] == 1), 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Документ');
     $this->Cell(70, $vHeight, FormatDocument(@$vCase['doc_type_id'], @$vCase['doc_series'], @$vCase['doc_number']), 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Полис');
     $this->Cell(70, $vHeight, FormatPolis(@$vCase['insurance_company_id'], @$vCase['polis_series'], @$vCase['polis_number']), 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Адр.рег.');
     $this->Cell(70, $vHeight, FormatAddress(@$vCase['addr_reg_street'], @$vCase['addr_reg_num'], @$vCase['addr_reg_subnum'], @$vCase['addr_reg_apartment']), 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Адр.факт.');
     $this->Cell(70, $vHeight, FormatAddress(@$vCase['addr_phys_street'], @$vCase['addr_phys_num'], @$vCase['addr_phys_subnum'], @$vCase['addr_phys_apartment']), 'B');
     $this->Ln($vHeight);
     $vCount = count($ASurgeries);
     if ($vCount > 0) {
         $vLast = $ASurgeries[$vCount - 1];
     } else {
         $vLast = array();
     }
     $this->Cell(20, $vHeight, 'Цель');
     $this->Cell(30, $vHeight, '1-Леч.-диагн.', 'B');
     $this->Cell(20, $vHeight, 'Случай');
     $this->Cell(30, $vHeight, '1-Первичный', 'B');
     $this->Cell(30, $vHeight, 'Законченность');
     $this->Cell(10, $vHeight, FormatBoolean(!empty($vLast['clinical_outcome_id'])), 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Исход');
     $this->Cell(70, $vHeight, FormatClinicalOutcome(@$vLast['clinical_outcome_id'], @$vLast['clinical_outcome_notes']), 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Диагноз');
     $vTmp = $vCase['diagnosis'];
     if (strlen($vTmp) > 80) {
         $vTmp = substr($vTmp, 0, 80 - 3) . '...';
     }
     $this->Cell(140, $vHeight, $vTmp, 'B');
     $this->Cell(10, $vHeight, 'МКБ');
     $this->Cell(20, $vHeight, @$vCase['diagnosis_mkb'], 'B');
     $this->Ln($vHeight);
     $this->Cell(20, $vHeight, 'Характер');
     $this->Cell(20, $vHeight, '1-Острое', 'B');
     $this->Cell(20, $vHeight, 'Травма');
     $this->Cell(60, $vHeight, FormatTraumaType(@$vCase['trauma_type_id']), 'B');
     $this->Ln($vHeight);
     $this->CheckSpace($vHeight * 4);
     $this->Cell(40, $vHeight, 'ПОСЕЩЕНИЯ');
     $this->Ln($vHeight);
     $this->OutSurgery($vHeight, array('№', 'Дата', 'Врач', 'Специальность', 'Цель', 'Место'), 'C');
     for ($i = 0; $i < $vCount; $i++) {
         $vSurgery =& $ASurgeries[$i];
         $this->OutSurgery($vHeight, array(1 + $i, Date2Readable(ExtractWord($vSurgery['date'], ' ', 0)), FormatUserName($vSurgery['user_id']), 'травматолог', '1-Леч.диагн.', '1-Амбулаторно'));
     }
     $vIllDocs = array();
     $vPrevIllDoc = null;
     for ($i = 0; $i < $vCount; $i++) {
         $vSurgery =& $ASurgeries[$i];
         if (!empty($vSurgery['ill_doc'])) {
             if (empty($vPrevIllDoc) || $vPrevIllDoc['ill_doc'] != $vSurgery['ill_doc'] || $vPrevIllDoc['ill_beg_date'] != $vSurgery['ill_beg_date'] || $vPrevIllDoc['ill_end_date'] != $vSurgery['ill_end_date']) {
                 $vIllDocs[] = $vSurgery;
                 $vPrevIllDoc =& $vSurgery;
             }
         }
     }
     if (count($vIllDocs)) {
         $this->CheckSpace($vHeight * 4);
         $this->Cell(40, $vHeight, 'НЕТРУДОСПОСОБНОСТЬ');
         $this->Ln($vHeight);
         $this->OutIllDoc($vHeight, array('№', 'Док.', 'Врач', 'Повод', 'Дата откр.', 'Дата закр.', 'Кому', 'Пол', 'Возр.'), 'C');
         for ($i = 0; $i < count($vIllDocs); $i++) {
             $vSurgery = $vIllDocs[$i];
             $this->OutIllDoc($vHeight, array(1 + $i, '1-Б/Л', FormatUserName($vSurgery['user_id']), '1-Заб.', Date2Readable($vSurgery['ill_beg_date']), Date2Readable($vSurgery['ill_end_date']), '1-Пац', FormatSex(@$vCase['is_male']), CalcAge(@$vCase['born_date'], $vSurgery['ill_beg_date'])));
         }
         $this->Cell(20, $vHeight, 'Б/Л. ');
         $this->Cell(40, $vHeight, $vIllDocs[count($vIllDocs) - 1]['ill_doc'], 'B');
     }
     //            $this->Ln($vHeight);
     //            $this->Cell($vWidth, $vHeight, );
     //            $this->Ln($vHeight);
     //            $this->Cell($vWidth, $vHeight, Date2Readable(@$vCase['born_date']));
     $this->Ln($vHeight);
     $this->Ln($vHeight);
 }
Example #4
0
 function FirstPage($ASurgery)
 {
     $this->AddPage();
     $this->SetFont('arial_rus', '', 10);
     $vWidth = $this->GetAreaWidth();
     $vHeight = $this->FontSize;
     //            $this->Image('images/ill.jpeg', 0, 0, 140, 207);
     if ($ASurgery['ill_doc_is_continue']) {
         $this->MarkContinue();
     } else {
         $this->MarkPrimary();
     }
     $vCase =& $ASurgery['case'];
     if (DateIsEmpty($ASurgery['ill_beg_date']) && !DateIsEmpty($vCase['disability_from_date'])) {
         $ASurgery['ill_beg_date'] = $vCase['disability_from_date'];
     } else {
         if (!DateIsEmpty($ASurgery['ill_beg_date']) && DateIsEmpty($vCase['disability_from_date'])) {
             $vCase['disability_from_date'] = $ASurgery['ill_beg_date'];
         }
     }
     //            print_r($ASurgery);
     //            $vName = trim($vCase['last_name'].' '.$vCase['first_name'].' '.$vCase['patr_name']);
     $vName = iconv('utf-8', 'cp1251', FormatNameEx($vCase));
     $this->Text(18, 19, $vName);
     $vDocName = iconv('utf-8', 'cp1251', FormatUserName($ASurgery['user_id']));
     $this->Text(95, 19, $vDocName);
     $vAddress = iconv('utf-8', 'cp1251', @FormatAddress($vCase['addr_reg_street'], $vCase['addr_reg_num'], $vCase['addr_reg_subnum'], $vCase['addr_reg_apartment']));
     $this->Text(18, 24, $vAddress);
     $this->Text(120, 24, $vCase['id']);
     $this->Text(18, 29, $vCase['employment_place']);
     $vDate = explode(' ', iconv('utf-8', 'cp1251', Date2ReadableLong($ASurgery['ill_beg_date'])));
     if (!empty($vDate[2])) {
         $vDate[2] = substr($vDate[2], -2);
     }
     $this->Text(27, 34, @($vDate[0] . ' ' . $vDate[1]));
     $this->Text(75, 34, @$vDate[2]);
     // -----------------------------------------------------------------
     $vIllFromDate = iconv('utf-8', 'cp1251', Date2ReadableLong($vCase['disability_from_date']));
     if (!empty($vIllFromDate)) {
         $this->Text(80, 48, 'C ' . $vIllFromDate);
     }
     //          $this->Text(15, 59, 'СПб ГУЗ ГП №51, Космонавтов 35');
     $vBranchInfo = GetBranchInfo();
     $this->Text(15, 59, @$vBranchInfo['ill_doc_name']);
     $this->Text(24, 63.5, $vDate[0] . ' ' . $vDate[1]);
     $this->Text(70, 63.5, $vDate[2]);
     $this->Text(15, 69, $vName);
     $this->Text(110, 69, CalcAge($vCase['born_date'], $ASurgery['ill_beg_date']));
     if ($vCase['is_male']) {
         $this->Ellipse(124, 68, 3, 2);
     } else {
         $this->Ellipse(131, 68, 3, 2);
     }
     $this->Text(15, 73.5, $vCase['employment_place']);
 }
Example #5
0
 function Render($AParams)
 {
     global $RowDescr;
     $vBranchInfo = GetBranchInfo();
     $vWidths = array(40, 35, 5, 5);
     $vAligns = array('L', 'L', 'C', 'R');
     for ($i = 0; $i < 12; $i++) {
         $vWidths[] = 16;
         $vAligns[] = 'R';
     }
     $vDB = GetDB();
     $vBegDate = $AParams['beg_date'];
     $vEndDate = $AParams['end_date'];
     $this->SetFont('arial_rus', '', 10);
     $vHeight = $this->FontSize * 1.5;
     $vWidth = $this->GetAreaWidth();
     $this->AddPage();
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->Cell($vWidth, $vHeight, iconv("utf8", "windows-1251", @$vBranchInfo['name']), '', 0, 'L');
     $this->SetXY($vX, $vY);
     $this->Cell($vWidth, $vHeight, 'Ф.16ВН', '', 0, 'R');
     $this->Ln($vHeight);
     $this->Cell($vWidth, $vHeight, 'Дата создания: ' . iconv("utf8", "windows-1251", Date2ReadableLong(date('Y-m-d H:i:s'))), '', 0, 'L');
     $this->Ln($vHeight);
     $this->SetFont('arial', 'B', 12);
     $this->Cell($vWidth, $vHeight, 'СВЕДЕНИЯ О ТРАВМАХ, ОТРАВЛЕНИЯХ И НЕКОТОРЫХ ДРУГИХ ПОСЛЕДСТВИЯХ ВОЗДЕЙСТВИЯ ВНЕШНИХ ПРИЧИН', '', 0, 'C');
     $this->SetFont('arial_rus', '', 10);
     $this->Ln($vHeight);
     $this->Cell($vWidth, $vHeight, 'за период с ' . iconv("utf8", "windows-1251", Date2ReadableLong($vBegDate)) . ' г. по ' . iconv("utf8", "windows-1251", Date2ReadableLong($vEndDate)) . ' г.', '', 0, 'C');
     $this->Ln($vHeight * 2);
     $this->CellML($vWidths[0], $vHeight * 3, 'Причина нетрудоспособности', 'L', 'R');
     $this->CellML($vWidths[1], $vHeight * 3, 'Код по МКБ X пересмотра', 'L', 'R');
     $this->CellML($vWidths[2], $vHeight * 3, 'Пол', 'C', 'U');
     $this->CellML($vWidths[3], $vHeight * 3, '№ строки', 'C', 'U');
     $this->CellML($vWidths[4], $vHeight * 3, 'Число дней', 'C', 'R');
     $this->CellML($vWidths[5], $vHeight * 3, 'Число случаев', 'C', 'R');
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->CellML($vWidths[6] * 10, $vHeight, 'В том числе по возрастам', 'C', 'R');
     $this->SetXY($vX, $vY + $vHeight);
     $this->CellML($vWidths[6], $vHeight * 2, '15-19', 'C', 'R');
     $this->CellML($vWidths[7], $vHeight * 2, '20-24', 'C', 'R');
     $this->CellML($vWidths[8], $vHeight * 2, '25-29', 'C', 'R');
     $this->CellML($vWidths[9], $vHeight * 2, '30-34', 'C', 'R');
     $this->CellML($vWidths[10], $vHeight * 2, '35-39', 'C', 'R');
     $this->CellML($vWidths[11], $vHeight * 2, '40-44', 'C', 'R');
     $this->CellML($vWidths[12], $vHeight * 2, '45-49', 'C', 'R');
     $this->CellML($vWidths[13], $vHeight * 2, '50-54', 'C', 'R');
     $this->CellML($vWidths[14], $vHeight * 2, '55-69', 'C', 'R');
     $this->CellML($vWidths[15], $vHeight * 2, '60 и старше', 'C', 'R');
     $this->Ln($vHeight * 2);
     $vCodeToRow =& PrepareCodeToRowMap();
     /*
             SELECT 
               emst_cases.id as id,
               emst_cases.create_time,
               emst_cases.born_date, 
               emst_cases.is_male, 
               DATEDIFF( max(emst_surgeries.ill_end_date), 
                         emst_cases.disability_from_date
                       ) as days,
               emst_cases.diagnosis_mkb
             FROM
               emst_cases 
               JOIN emst_surgeries ON emst_surgeries.case_id = emst_cases.id
             WHERE 
               emst_surgeries.disability=2 AND 
               emst_surgeries.ill_end_date != '0000-00-00' AND
               emst_cases.disability_from_date != '0000-00-00' AND
               emst_cases.create_time >= '2006-01-01' AND
               emst_cases.create_time < '2007-01-01'
             GROUP BY
               emst_cases.id  
     */
     $vTable = 'emst_cases JOIN emst_surgeries ON emst_surgeries.case_id = emst_cases.id';
     $vFields = 'emst_cases.id as id, emst_cases.create_time, emst_cases.born_date, emst_cases.is_male, DATEDIFF( max(emst_surgeries.ill_end_date), emst_cases.disability_from_date) as days, emst_cases.diagnosis_mkb';
     $vFilterParts = array();
     $vFilterParts[] = 'emst_surgeries.disability=2';
     $vFilterParts[] = "emst_surgeries.ill_end_date != '0000-00-00'";
     $vFilterParts[] = "emst_cases.disability_from_date != '0000-00-00'";
     $vFilterParts[] = $vDB->CondGE('create_time', $vBegDate);
     $vFilterParts[] = $vDB->CondLT('create_time', DateAddDay($vEndDate));
     $vFilter = implode(' AND ', $vFilterParts) . ' GROUP BY emst_cases.id';
     $vOrder = '';
     $vRecords = $vDB->Select($vTable, $vFields, $vFilter, $vOrder);
     $vBadCodes = array();
     $vReport = array();
     while ($vRecord = $vRecords->Fetch()) {
         if ($vRecord['diagnosis_mkb'] === NULL || $vRecord['is_male'] === NULL) {
             continue;
         }
         $vCode = str_replace(' ', '', $vRecord['diagnosis_mkb']);
         if ($vCode == '') {
             continue;
         }
         if (preg_match('/^[A-Z][0-9][0-9]$/i', $vCode)) {
             $vCode = $vCode . '.0';
         } else {
             if (preg_match('/^[A-Z][0-9][0-9]\\.[0-9].*$/i', $vCode)) {
                 $vCode = substr($vCode, 0, 5);
             }
         }
         if (empty($vCodeToRow[$vCode])) {
             $vBadCodes[$vRecord['diagnosis_mkb']] = $vRecord['diagnosis_mkb'];
             continue;
         }
         $vRowIndexes = $vCodeToRow[$vCode];
         $vIsMale = $vRecord['is_male'] ? 1 : 0;
         $vAge = CalcAge($vRecord['born_date'], $vRecord['create_time']);
         $vAgeColIndex = AgeToColIndex($vAge);
         if ($vAgeColIndex > 0) {
             foreach ($vRowIndexes as $vRowIndex) {
                 $vReport[$vRowIndex][$vIsMale][0] = $vRecord['days'] + 1 + @$vReport[$vRowIndex][$vIsMale][0];
                 $vReport[$vRowIndex][$vIsMale][1] = 1 + @$vReport[$vRowIndex][$vIsMale][1];
                 $vReport[$vRowIndex][$vIsMale][$vAgeColIndex + 2] = 1 + @$vReport[$vRowIndex][$vIsMale][$vAgeColIndex + 2];
             }
         }
     }
     $vRowNum = 0;
     for ($i = 0; $i < count($RowDescr); $i++) {
         $vRow = array($RowDescr[$i]['title'], $RowDescr[$i]['codes'], 'М', ++$vRowNum);
         for ($j = 0; $j <= 20; $j++) {
             $vRow[] = @$vReport[$i][1][$j];
         }
         $this->OutputTableRow($vWidths, $vHeight, $vRow, $vAligns);
         $vRow = array('', '', 'Ж', ++$vRowNum);
         for ($j = 0; $j <= 20; $j++) {
             $vRow[] = @$vReport[$i][0][$j];
         }
         $this->OutputTableRow($vWidths, $vHeight, $vRow, $vAligns);
     }
     /*
             if ( @$AParams['show_unlisted_cases'] )
             {
                 $vTable  = 'emst_cases';
                 $vFields = 'id, diagnosis_mkb, trauma_type_id, born_date';
                 $vFilter = $vDB->CondGE('create_time', $vBegDate) .
                            ' AND '.
                            $vDB->CondLT('create_time', DateAddDay($vEndDate)).
                            ' AND ('.
                              $vDB->CondIn('diagnosis_mkb', $vBadCodes).
                               ' OR diagnosis_mkb IS NULL'.
                               ' OR trauma_type_id IS NULL'.
                               ' OR born_date IS NULL'.
                               ' OR born_date = 0000-00-00'.
                               ')';
     
                 $vOrder  = 'id';
                 $vRecords= $vDB->Select($vTable, $vFields, $vFilter, $vOrder);
                 if ( $vRecords->Count() > 0 )
                 {
                     $this->AddPage();
                     $this->Cell(30, $vHeight,  '№ по порядку', 1, 0, 'R');
                     $this->Cell(30, $vHeight,  '№ истории', 1, 0, 'R');
                     $this->Cell(180, $vHeight, 'причина', 1, 0, 'L');
                     $this->Ln($vHeight);
     
                     $i = 0;
                     while ( $vRecord = $vRecords->Fetch() )
                     {
                        $vMessage = array();
                        $vCode = str_replace(' ', '', $vRecord['diagnosis_mkb']);
                        if ( $vCode != '' &&
                             !( preg_match('/^[A-Z][0-9][0-9](\.[0-9])?$/i', $vCode) &&
                                $vCode>='S00' &&
                                $vCode<='T98.9'
                              )   
                           )
                        {
                           $vMessage[] = 'Код МКБ "'.$vRecord['diagnosis_mkb'].'"';
                        }
                        if ( $vRecord['trauma_type_id'] === NULL || $vRecord['trauma_type_id'] === '' )
                           $vMessage[] = 'не указан тип травмы';
                        if ( $vRecord['born_date'] === NULL || $vRecord['born_date'] === '' || $vRecord['born_date'] === '0000-00-00' )
                           $vMessage[] = 'дата рождения не указана';
     
                        $this->Cell(30, $vHeight, ++$i, 1, 0, 'R');
                        $this->Cell(30, $vHeight, $vRecord['id'], 1, 0, 'R');
                        $this->Cell(180, $vHeight, implode(', ', $vMessage), 1, 0, 'L');
                        $this->Ln($vHeight);
                     }
                 }
             }
     */
 }
Example #6
0
 function _renderForm(&$page)
 {
     global $gTemplateName;
     $vContainer =& $page->controller->container();
     $vTemplate =& CreateTemplate();
     $vRenderer =& CreateRenderer($vTemplate);
     $page->accept($vRenderer);
     $vView = new TPageView();
     $vView->page =& $page;
     $vView->form =& $vRenderer->toObject();
     $vDefaults =& $vContainer['defaults'];
     $vValues =& $vContainer['values'];
     $vBaseInfoDefaults =& $vDefaults['BaseInfo'];
     $vBaseInfoValues =& $vValues['BaseInfo'];
     $vFirstPageDefaults =& $vDefaults[DatePageName(0)];
     $vFirstPageValues =& $vValues[DatePageName(0)];
     $vView->case_id = @$vBaseInfoDefaults['id'];
     $vView->create_time = @Date2ReadableLong($vBaseInfoDefaults['create_time']);
     $vBaseInfo =& $vBaseInfoDefaults;
     if (DataAvailable($vBaseInfoValues)) {
         $vBaseInfo =& $vBaseInfoValues;
     }
     $vView->name = FormatNameEx($vBaseInfo);
     if (DocsEmpty($vBaseInfo)) {
         $vView->docs_is_empty = true;
     }
     $vView->category = @FormatCategory($vBaseInfo['employment_category_id']);
     $vView->age = 'полных лет ' . CalcAge(DateValueToStr($vBaseInfo['born_date']));
     $vView->paytype = @GetPaytypeName($vBaseInfo['paytype']);
     if (DataAvailable($vFirstPageValues)) {
         $vView->disability_from_date = empty($vFirstPageValues['ill_doc']) ? '' : Date2ReadableLong(DateValueToStr($vFirstPageValues['disability_from_date']));
     } else {
         $vView->disability_from_date = empty($vFirstPageDefaults['ill_doc']) ? '' : Date2ReadableLong($vBaseInfoDefaults['disability_from_date']);
     }
     if (!empty($vContainer['_PopupURL'])) {
         $vView->popup_url = $vContainer['_PopupURL'];
         unset($vContainer['_PopupURL']);
     }
     $vTemplate->compile($gTemplateName);
     $vTemplate->outputObject($vView);
 }
Example #7
0
 function Render(&$AInfo)
 {
     $vDB = GetDB();
     $vBranchInfo = GetBranchInfo();
     $this->AddPage();
     $this->SetFont('arial_rus', '', 10);
     $vWidth = $this->GetAreaWidth() / 2 - 10;
     $vHeight = $this->FontSize;
     $vHeightLN = $this->FontSize * 1.5;
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->SetXY($vX, $vY);
     $this->Cell($vWidth, $vHeight, 'Министерство здравоохранения', '', 0, 'L');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'и социального развития', '', 0, 'L');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'Российской Федерации', '', 0, 'L');
     $this->Ln($vHeightLN);
     //        $this->Cell($vWidth, $vHeight, @$vBranchInfo['name'], '', 0, 'L');
     $this->Cell($vWidth, $vHeight, '', '', 0, 'L');
     $this->Ln($vHeightLN);
     $this->ExactCell($vHeight, 'Код ОГРН  ');
     //        $this->BoxedText($vWidth, $vHeight, $vBranchInfo['OGRN']);
     $this->BoxedText($vWidth, $vHeight, '             ');
     $this->Ln($vHeightLN);
     $this->SetXY($vX, $vY);
     $this->Cell($vWidth, $vHeight, 'Медицинская документация', '', 0, 'R');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'форма № 044/у', '', 0, 'R');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'УТВЕРЖДЕНА', '', 0, 'R');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'Минздравом СССР', '', 0, 'R');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, '04.10.80 №1030', '', 0, 'R');
     $this->Ln($vHeightLN);
     $this->Ln($vHeightLN);
     $this->SetFont('arial_rus', '', 10);
     $vHeight = $this->FontSize;
     $vHeightLN = $this->FontSize * 1.5;
     $this->Cell($vWidth, $vHeight, 'КАРТА', '', 0, 'C');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'больного, лечащегося в физиотерапевтическом отделении (кабинете)', '', 0, 'C');
     $this->Ln($vHeightLN);
     $this->Notes('Карта стационарного (амб.) больного №', 0, $vWidth, 1, @$AInfo['case_id']);
     $this->Notes('Лечащий врач', 0, $vWidth, 1, _2w(FormatUserName(@$AInfo['doctor_id'])));
     //        $this->Notes('Фамилия, имя, отчество', 0, $vWidth, 1, FormatShortName(@$AInfo['last_name'], @$AInfo['first_name'], @$AInfo['patr_name']));
     /*
             $this->Notes('Фамилия, имя, отчество', 0, $vWidth, 1, _2w(FormatShortNameEx($AInfo)));
             $vX = $this->GetX();
             $vY = $this->GetY();
             $this->Notes('Возраст', 0, $vWidth/2, 1, CalcAge(@$AInfo['born_date']));
             $this->SetXY($vX+$vWidth/2, $vY);
             $this->Notes('Пол', 0, $vWidth/2, 1, FormatSex($AInfo['is_male']));
     */
     $this->Notes('Фамилия, имя, отчество', 0, $vWidth, 1, FormatShortNameEx($AInfo));
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->Notes('Возраст', 0, $vWidth / 2, 1, CalcAge(@$AInfo['born_date']));
     $this->SetXY($vX + $vWidth / 2, $vY);
     $this->Notes('Пол', 0, $vWidth / 2, 1, _2w(FormatSex($AInfo['is_male'])));
     $this->Notes('Адрес', 0, $vWidth, 1, _2w(FormatAddress(@$AInfo['addr_reg_street'], @$AInfo['addr_reg_num'], @$AInfo['addr_reg_subnum'], @$AInfo['addr_reg_apartment'])));
     $this->Notes('Из какого отделения (кабинета) направлен больной', 0, $vWidth, 1, _2w($vBranchInfo['name']), false);
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->Notes('Диагноз', 0, $vWidth, 4, _2w(@$AInfo['diagnosis']), false);
     $vX1 = $this->GetX();
     $vY1 = $this->GetY();
     $this->SetFont('arial_rus', '', 4);
     $this->SetXY($vX, $vY + $vHeightLN * 2 - $this->FontSize / 2);
     $this->Cell($vWidth, $vHeight, 'подчеркнуть заболевание, по поводу', '', 0, 'C');
     $this->Ln($vHeightLN);
     $this->Cell($vWidth, $vHeight, 'которого больной направлен на физиотерапию', '', 0, 'C');
     $this->SetXY($vX1, $vY1);
     $this->SetFont('arial_rus', '', 10);
     $this->Notes('Жалобы больного', 0, $vWidth, 2, '', false);
     $vX = $this->GetX();
     $vY = $this->GetY() + 3;
     $this->SetXY($vX, $vY);
     $this->Cell(35, $vHeight, 'Назначение ');
     $this->Ln($vHeight);
     $this->Cell(35, $vHeight, 'процедуры');
     $this->Ln($vHeight);
     $this->Cell(35, $vHeight, 'лечащим врачом');
     $this->Ln($vHeight);
     $this->Cell(35, $vHeight, 'или врачом-');
     $this->Ln($vHeight);
     $this->Cell(35, $vHeight, 'физиотерапевтом');
     $this->Ln($vHeight);
     $this->Cell(35, $vHeight, '(подчеркнуть)');
     $vX += 38;
     $this->SetXY($vX, $vY);
     $this->Cell(15, $vHeight, 'Дата', 'LTR', 0, 'C');
     $this->Cell(30, $vHeight, 'Наименование', 'LTR', 0, 'C');
     $this->Cell(10, $vHeight, 'К-во', 'LTR', 0, 'R');
     $this->Cell(20, $vHeight, 'Продолжи-', 'LTR', 0, 'C');
     $this->Cell(15, $vHeight, 'Дози-', 'LTR', 0, 'C');
     $this->SetXY($vX, $vY + $vHeight);
     $this->Cell(15, $vHeight, '', 'LR', 0, 'C');
     $this->Cell(30, $vHeight, 'процедуры', 'LR', 0, 'C');
     $this->Cell(10, $vHeight, '', 'LR', 0, 'C');
     $this->Cell(20, $vHeight, 'тельность', 'LR', 0, 'C');
     $this->Cell(15, $vHeight, 'ровка', 'LR', 0, 'C');
     for ($i = 0; $i < 3; $i++) {
         $this->SetXY($vX, $vY + $vHeight * 2 + $i * $vHeightLN);
         $this->Cell(15, $vHeightLN, '', 'LTRB', 0, 'C');
         $this->Cell(30, $vHeightLN, '', 'LTRB', 0, 'C');
         $this->Cell(10, $vHeightLN, '', 'LTRB', 0, 'C');
         $this->Cell(20, $vHeightLN, '', 'LTRB', 0, 'C');
         $this->Cell(15, $vHeightLN, '', 'LTRB', 0, 'C');
     }
     $this->Ln($vHeightLN);
     $vX = $this->GetX();
     $vY = $this->GetY();
     $this->Line($vX, $vY + $vHeight / 2, $vX + $vWidth, $vY + $vHeight / 2);
     $this->Ln($vHeight);
     $this->Cell($vWidth * 0.6, $vHeight, 'Место проведения процедуры: кабинет,');
     $this->Ln($vHeight);
     $this->Cell($vWidth * 0.6, $vHeight, 'перевязочная, на дому (подчеркнуть)');
     $this->Ln($vHeight);
     $this->Cell($vWidth * 0.6, $vHeight, 'Виды лечения, назначенные помимо');
     $this->Ln($vHeight);
     $this->Cell($vWidth * 0.6, $vHeight, 'физиотерапии (в том числе и медикаментозные)');
     $this->Ln($vHeight);
     $this->Notes('', 0, $vWidth * 0.6, 3, '', false);
     $this->Notes('Эпикриз', 0, $vWidth * 0.6, 2, '', false);
     $this->Notes('Врач-физиотерапевт', 0, $vWidth * 0.6, 1, '');
     $this->Image('images/angels.jpeg', $vX + $vWidth * 0.65, $vY + $vHeight, $vWidth * 0.35);
 }
Example #8
0
function IsWorkableAge($AToday, $ABornDate, $AIsMale)
{
    $vAge = CalcAge($ABornDate, $AToday);
    $vWorkableAges = GetWorkableAgesList();
    return @($vWorkableAges[0][$AIsMale] <= $vAge && $vAge <= $vWorkableAges[1][$AIsMale]);
}