<?php
include_once("c_personal_person.php");
class c_page_cab_personal_person_card extends c_page_cab_personal_person
{
  public $h1='Карточка сотрудника - мед.карточка' ;

 function get_cur_page_meta_tags()
 {
   if ($this->rec_personal['pkey']) $this->h1='Медицинская карточка '.$this->rec_personal['obj_name'] ;
 }

 function second_menu_config()
 { $this->second_menu[$this->rec_personal['__href'].'card/']=array('title'=>'Медицинская карточка') ;
   if (function_exists('terapevt')) $this->second_menu['/cab/esmo_ct/person/'.$this->rec_personal['pkey'].'/terapia/']='История приемов' ;
   $this->second_menu[$this->rec_personal['__href'].'graf/']='Графики' ;
 }

    function block_main()
     { $this->page_title() ;
       $this->panel_card_personal_view() ;
       $this->panel_report_scan() ;
     }

     function panel_card_personal_view()
     { include_once('panel_personal_info_small.php') ;

       ?><div id="panel_card_personal_view">
           <table class="cols3">
             <tr><td class="img"><img class="shadow main" src="<?echo img_clone($this->rec_personal,'200')?>"><img class=qrcode src="/services/qrcode/<?echo $this->rec_personal['propusk']?>/" /></td>
                 <td class="info"><?panel_personal_info_small($this->rec_personal);?></td>
                 <td class="krit"><?$this->panel_personal_krit();?></td>
             </tr>
           </table>
           <div id="panel_pupilometer"></div>
        </div>
      <?
     }


    function panel_personal_krit()
    { $rec=$this->rec_personal ;
      // получаем стандартные критерий осмотра, без учета группы и режима МО
      $rules_info=ESMO_RULES()->get_mo_rules_to_personal($this->rec_personal,array('only_value_for_group'=>1,'terminal_id'=>1,'rmv_mo'=>1)) ;
      $rules_def=$rules_info['_rules'] ;
      ?><table id="panel_personal_krit" class="info" reffer="<?echo $rec['_reffer']?>">
         <tr><td>Группа:</td>
                 <td colspan="2" class="left"><div id=personal_groups><?echo  $rec['_groups_names'] ?></div></td>
         </tr>
         <tr><td>Критерии МО:</td>
             <td colspan="2" class="left"><? echo nl2br($rules_def['name']) ;  ?></td>
         </tr>
         <tr><th>Параметр:</th>
             <th>По группе</th>
             <th>Собственный</th></tr>
         <?if ($GLOBALS['LS_check_sd']){?>
         <tr><td>Давление систолическое:</td>
             <td><? echo ($rules_def['s'])?  $rules_def['s_min'].'...'.$rules_def['s_max']:'-' ?></td>
             <td><? if ($rec['s_min'] or $rec['s_max']) echo $rec['s_min'].'...'.$rec['s_max'] ?></td>
         </tr>
         <tr><td>Давление диастолическое:</td>
             <td><? echo ($rules_def['d'])? $rules_def['d_min'].'...'.$rules_def['d_max']:'-' ?></td>
             <td><? if ($rec['d_min'] or $rec['d_max']) echo $rec['d_min'].'...'.$rec['d_max'] ?></td>
         </tr><?}?>
         <?if ($GLOBALS['LS_check_p']){?>
         <tr><td>Пульс:</td>
             <td><? echo ($rules_def['p'])? $rules_def['p_min'].'...'.$rules_def['p_max']:'-' ?></td>
             <td><? if ($rec['p_min'] or $rec['p_max']) echo $rec['p_min'].'...'.$rec['p_max'] ?></td>
         </tr>
         <?}?>
         <?if ($GLOBALS['LS_check_t']){?>
         <tr><td>Температура:</td>
             <td><? echo ($rules_def['t'])? $rules_def['t_min'].'...'.$rules_def['t_max']:'-' ?></td>
             <td><? if ($rec['t_min'] or $rec['t_max']) echo $rec['t_min'].'...'.$rec['t_max'] ?></td>
         </tr><?}?>
         <?if ($GLOBALS['LS_check_a']){?>
         <tr><td>Алкоголь:</td>
             <td><? echo ($rules_def['a'])? 'Да':'-' ?></td>
             <td><? if ($rec['a']==2) echo 'Да' ; else if ($rec['a']==1) echo 'Нет' ; ?>&nbsp;</td>
         </tr><?}?>
         <?if ($GLOBALS['LS_check_n']){?>
         <tr><td>ЦНС:</td>
             <td><? echo ($rules_def['n'])? 'Да':'-' ?></td>
             <td><? if ($rec['n']==2) echo 'Да' ; else if ($rec['n']==1) echo 'Нет' ; ?>&nbsp;</td>
         </tr><?}?>
        <?if ($GLOBALS['LS_check_v']){?>
        <tr><td>ТКТ:</td>
            <td><? echo ($rules_def['v'])? 'Да':'-' ?></td>
            <td><? if ($rec['v']==2) echo 'Да' ; else if ($rec['v']==1) echo 'Нет' ; ?>&nbsp;</td>
        </tr><?}?>

         <tr><td colspan="3" class="buttons">
                 <?if ($this->allow_menu_items['c_page_cab_mo_change_personal_rules'] or
                       $this->allow_menu_items['c_page_cab_personal_person_card_rules'] or
                       MEMBER()->rol==1)
                       {?><button class="v2 fa fa-sliders" cmd="aspmo/get_panel_personal_limit"> Задать критерии</button>&nbsp;&nbsp;&nbsp;<?}?>
                     <!--<button class="v2 button_small" cmd="aspmo_personal/get_panel_select_group" personal_id="<?echo $rec['pkey']?>">Выбрать группы</button>-->
             </td>
         </tr>
       </table>
     <?
      //damp_array($rec) ;
    }

    function panel_report_scan()
    {
     include_once(_DIR_EXT.'/scan/report_scan.php') ;
     $report_obj=new report_scan() ;
     $report_obj->filter['personal_id']=$this->rec_personal['pkey'] ;
     $report_obj->view_as_HTML(array('template_name'=>'print_template_HTML_to_personal','order'=>'data_set desc')) ;

     }

}



?>