Пример #1
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);
 }
Пример #2
0
 function DrawLine($ACEC)
 {
     $vBranchInfo = GetBranchInfo();
     $vHeight = $this->FontSize * 1.5;
     $vRowData = array();
     $vCECDate = ExtractWord($ACEC['date'], ' ', 0);
     $vCaseID = $ACEC['case_id'];
     $vNumCECesBefore = GetNumCECes($vCaseID, $vCECDate, $ACEC['id']);
     $vCECNumber = $ACEC['cec_number'];
     if ($vCECNumber == 0) {
         $vCECNumber = '';
     }
     $vRowData[] = $vCECNumber . "\n(" . ($vNumCECesBefore + 1) . ')';
     //   'Дата',
     $vRowData[] = Date2Readable($vCECDate);
     //   'Врач',
     $vRowData[] = FormatUserName($ACEC['user_id']);
     //   'Ф.И.О. больного' & 'Дата рождения'
     //            $vRowData[] = FormatName($ACEC['last_name'], $ACEC['first_name'],$ACEC['patr_name'])
     $vRowData[] = FormatNameEx($ACEC) . "\n" . FormatBornDateAndAge($vCECDate, $ACEC['born_date']) . "\nи.б. " . $vCaseID;
     //            $vRowData[] = FormatSex($ACase['is_male']);
     //   'Адрес',
     $vRowData[] = FormatAddress($ACEC['addr_reg_street'], $ACEC['addr_reg_num'], $ACEC['addr_reg_subnum'], $ACEC['addr_reg_apartment']);
     //            $vRowData[] = $ACase['phone'];
     //   'Место работы' & 'Профессия'
     $vTmpList = array();
     $vTmp = FormatWorkableAge($vCECDate, $ACEC['born_date'], $ACEC['is_male']);
     if (!empty($vTmp)) {
         $vTmpList[] = $vTmp;
     }
     $vTmp = FormatCategory($ACEC['employment_category_id']);
     if (!empty($vTmp)) {
         $vTmpList[] = $vTmp;
     }
     $vTmp = $ACEC['employment_place'];
     if (!empty($vTmp)) {
         $vTmpList[] = $vTmp;
     }
     $vTmp = $ACEC['profession'];
     if (!empty($vTmp)) {
         $vTmpList[] = $vTmp;
     }
     $vRowData[] = implode(",\n", $vTmpList);
     //   'Диагноз',
     $vRowData[] = $ACEC['diagnosis'];
     //   '№ листка нетрудоспособности',
     $vTmp = $ACEC['ill_doc'];
     if (!empty($vTmp)) {
         $vTmp .= "\n" . Date2Readable($ACEC['disability_from_date']);
         $vTmp .= "\n" . Date2Readable($vCECDate);
         $vTmp .= "\n(" . (DateDiff($vCECDate, $ACEC['disability_from_date']) + 1) . ')';
     }
     $vRowData[] = $vTmp;
     //   'Заключение комиссии'
     $vRowData[] = "лечение продлено\nс " . Date2Readable(DateAddDay($vCECDate)) . "\nпо " . Date2Readable($ACEC['cec_cureup_date']) . "\n(" . DateDiff($ACEC['cec_cureup_date'], $vCECDate) . ')';
     //   'Подписи членов комиссии'
     $vTmp = $ACEC['cec_members'];
     if (empty($vTmp)) {
         $vTmp = $vBranchInfo['cec_members'];
     }
     $vRowData[] = $vTmp;
     foreach ($vRowData as &$v) {
         $v = iconv('utf-8', 'cp1251', $v);
     }
     $this->OutTableRow($vHeight, $vRowData);
 }
Пример #3
0
 function &loadDefaults()
 {
     global $gAddTodaySugrery;
     $vDB = GetDB();
     $vID = @$_GET['id'];
     if (!empty($vID)) {
         $vBaseInfo = $vDB->GetById('emst_cases', $vID);
         if (!is_array($vBaseInfo)) {
             $vBaseInfo = array();
         }
     } else {
         $vBaseInfo = array();
         $vBaseInfo['create_time'] = $vDB->ConvertToDateTime(time());
         $vBaseInfo['next_visit_date'] = $vDB->ConvertToDate(time());
         CopyRecordStrValue($vBaseInfo, $_GET, 'first_name');
         CopyRecordStrValue($vBaseInfo, $_GET, 'last_name');
         CopyRecordStrValue($vBaseInfo, $_GET, 'patr_name');
     }
     $vResult = array();
     $vResult['BaseInfo'] =& $vBaseInfo;
     if (!empty($vID)) {
         $vSurgeries =& $vDB->SelectList('emst_surgeries', '*', $vDB->CondEqual('case_id', $vID), 'date, id');
         // order
     } else {
         $vSurgeries = array();
     }
     $vNow = $vDB->ConvertToDateTime(time());
     $vToday = ExtractWord($vNow, ' ', 0);
     $vCount = count($vSurgeries);
     if ($gAddTodaySugrery && ($vCount == 0 || ExtractWord($vSurgeries[$vCount - 1]['date'], ' ', 0) != $vToday)) {
         $vSurgeries[] = array('date' => $vNow);
         if ($vCount == 0) {
             if (@DateIsEmpty($vBaseInfo['accident_datetime'])) {
                 $vBaseInfo['accident_datetime'] = $vToday;
             }
             $vBaseInfo['disability_from_date'] = $vToday;
             $vSurgeries[$vCount]['objective'] = 'Общее состояние удовлетворительное';
         } else {
             CopyValues($vSurgeries[$vCount], $vSurgeries[$vCount - 1], array('complaints', 'dynamic_id', 'diagnosis', 'diagnosis_mkb', 'disability', 'ill_refused', 'ill_sertificat', 'ill_doc', 'ill_doc_is_continue', 'ill_beg_date', 'ill_end_date', 'next_cec_date'));
             if (!empty($vSurgeries[$vCount - 1]['ill_doc_new'])) {
                 $vSurgeries[$vCount]['ill_doc'] = $vSurgeries[$vCount - 1]['ill_doc_new'];
                 $vSurgeries[$vCount]['ill_doc_is_continue'] = true;
             }
             if ($vSurgeries[$vCount - 1]['ill_end_date'] == $vToday) {
                 $vSurgeries[$vCount]['ill_beg_date'] = DateAddDay($vSurgeries[$vCount - 1]['ill_end_date']);
                 $vSurgeries[$vCount]['ill_end_date'] = '';
             }
             $vObjectiveList = array();
             $vClinicalOutcomeID = $vSurgeries[$vCount - 1]['clinical_outcome_id'];
             if (!empty($vClinicalOutcomeID)) {
                 $vList = GetClinicalOutcomesList();
                 $vObjectiveList[] = 'На предыдущем приёме был установлен исход "' . $vList[$vClinicalOutcomeID] . '". явку объясняет тем, что ... ';
             }
             $vNextVisitDate = $vSurgeries[$vCount - 1]['next_visit_date'];
             if ($vNextVisitDate != '0000-00-00' && $vNextVisitDate < $vToday) {
                 $vObjectiveList[] = 'На приём ' . Date2ReadableLong($vNextVisitDate) . " не явился, объясняет это тем, что ... ";
             }
             $vObjectiveList[] = 'Общее состояние удовлетворительное';
             $vSurgeries[$vCount]['objective'] = implode(".\n", $vObjectiveList);
             CopyValues($vSurgeries[$vCount], $vSurgeries[$vCount - 1], array('cure'));
             /*
                                 CopyValues($vSurgeries[$vCount],
                                            $vSurgeries[$vCount-1],
                                            array('objective',  'cure', 'notes'));
             */
             for ($i = $vCount - 1; $i >= 0; $i--) {
                 if ($vSurgeries[$i]['is_cec']) {
                     $vSurgeries[$vCount]['next_cec_date'] = $vSurgeries[$i]['cec_cureup_date'];
                     break;
                 }
             }
             if ($vSurgeries[$vCount - 1]['next_cec_date'] == $vToday) {
                 $vSurgeries[$vCount]['is_cec'] = 1;
             }
         }
         $vSurgeries[$vCount]['user_id'] = $_SESSION['User.ID'];
     }
     $vCount = count($vSurgeries);
     $vResult['surgeries'] =& $vSurgeries;
     for ($i = 0; $i < $vCount; $i++) {
         $vResult[DatePageName($i)] =& $vSurgeries[$i];
     }
     //            CopyValues($vSurgeries[0], $vBaseInfo, array('accident', 'accident_datetime', 'accident_place', 'antitetanus_id', 'antitetanus_series', 'phone_message_required', 'ice_trauma', 'animal_bite_trauma', 'ixodes_trauma', 'message_number', 'diagnosis', 'diagnosis_mkb', 'disability_from_date'));
     if ($vCount > 0) {
         CopyValues($vSurgeries[0], $vBaseInfo, array('accident', 'accident_datetime', 'accident_place', 'antitetanus_id', 'antitetanus_series', 'phone_message_required', 'ice_trauma', 'animal_bite_trauma', 'ixodes_trauma', 'message_number', 'disability_from_date'));
     }
     $vResult['MiscDocs']['studinfo_freed_beg_date'] = @$vBaseInfo['create_time'];
     $vResult['MiscDocs']['studinfo_freed_end_date'] = $vToday;
     $vResult['html_referer'] = $_SESSION['PrevPage'];
     return $vResult;
 }