/** * gera um pdf dos laudos * * @param array $r */ function pdfLaudos($rs){ //error_reporting(E_ALL); set_time_limit(1800); include 'lib/php/classes/class.ezpdf.php'; $pdf = new Cezpdf('a4','portrait'); $pdf -> ezSetMargins(50,70,50,50); $all = $pdf->openObject(); $pdf->saveState(); $pdf->setStrokeColor(0,0,0,1); $pdf->restoreState(); $pdf->closeObject(); $pdf->addObject($all,'all'); $mainFont = './fonts/Courier.afm'; $codeFont = './fonts/Courier.afm'; $pdf->selectFont($mainFont); $n_rows = sizeof($rs); $c = 0; $t=945; $fator = 25; foreach($rs as $id => $r){ $o = new Interpretacao($r["int_id"]); $hos = new Hospital($o->get("hos_id")); $hos_nome = $hos->get("hos_nome"); $con = new Convenio($o->get("con_id")); $con_nome = $con->get("con_nome"); $exa = new Exame($o->get("exa_id")); $exa_nome = $exa->get("exa_nome"); $pdf->ezText($hos_nome,18,array('justification'=>'center')); $pdf->ezText(" ",20,array('justification'=>'left')); $pdf->ezText("PACIENTE : ".$r["int_paciente_prontuario"]." ".$r["int_paciente_nome"],10,array('justification'=>'left')); if ($r["int_paciente_nascimento"] == "0000-00-00") $pdf->ezText("NASCIMENTO : SEXO: ".$r["int_paciente_sexo"],10,array('justification'=>'left')); else $pdf->ezText("NASCIMENTO : ".Formatacao::formatBrData($r["int_paciente_nascimento"])." SEXO: ".$r["int_paciente_sexo"],10,array('justification'=>'left')); $pdf->ezText("CONVÊNIO : ".$con_nome,10,array('justification'=>'left')); $pdf->ezText("EXAME : ".$exa_nome,10,array('justification'=>'left')); $pdf->ezText(" ",20,array('justification'=>'left')); $pdf->ezText(" DATA: ".Formatacao::formatBrDataHoraminSeg($r["int_data_interpretacao"]),10,array('justification'=>'left')); $pdf->ezText("N DO EXAME : ".$r["int_opcional"],10,array('justification'=>'left')); $pdf->ezText("MÉDICO REQUISITANTE : ".$r["int_requisitante"],10,array('justification'=>'left')); $pdf->ezText("EXAME INTERPRETADO POR : 9679 Ernesto Sousa Nunes",10,array('justification'=>'left')); $pdf->ezText("TÉCNICO RX : ".$r["int_tecnico_rx"],10,array('justification'=>'left')); $pdf->ezText(" ",20,array('justification'=>'left')); $pdf->ezText("I N T E R P R E T A Ç Ã O",18,array('justification'=>'center')); $pdf->ezText(" ",20,array('justification'=>'left')); $vet_txt = split("\n",$r["int_texto"]); $pdf->ezText("============================================================================",10,array('justification'=>'left')); $pdf->ezText(" ",8,array('justification'=>'left')); foreach($vet_txt as $linha){ $pdf->ezText(" ".$linha,10,array('justification'=>'left')); } $pdf->ezText(" ",8,array('justification'=>'left')); $pdf->ezText("============================================================================",10,array('justification'=>'left')); $pdf->ezText(" Exame interpretado por: 9676 - Dr. Ernesto Sousa Nunes",10,array('justification'=>'left')); $pdf->addJpegFromFile('ass.jpg',250, 0); $pdf->openHere('Fit'); if ($c+1 < $n_rows) $pdf->ezNewPage(); $c++; $o->informaImpressao(); //$sql = "update laudo set LAU_DATA_EXPORTACAO = now() where LAU_ID = ".$r["LAU_ID"]." LIMIT 1"; //$up = mysql_query($sql, $db) or die(mysql_error()); } $pdfcode = $pdf->Output(); //$pdfcode = str_replace("\n","\n<br>",htmlspecialchars($pdfcode)); //$cont = trim($pdfcode); $fh = fopen("laudos_prontos.pdf", 'w+'); fwrite($fh, $pdfcode); fclose($fh); ?><script language="javascript">document.location.href="laudos_prontos.pdf";</script><? }
$o->set("int_paciente_nome" , $_POST["int_paciente_nome"]); $o->set("int_paciente_sexo" , $_POST["int_paciente_sexo"]); $o->set("int_paciente_nascimento" , Formatacao::formatData($_POST["int_paciente_nascimento"])); $o->set("int_paciente_prontuario" , $_POST["int_paciente_prontuario"]); $o->set("int_opcional" , $_POST["int_opcional"]); $o->set("int_tecnico_rx" , $_POST["int_tecnico_rx"]); $o->set("int_requisitante" , $_POST["int_requisitante"]); $valor_absoluto = $exa->getValorAbsoluto($_POST["con_id"]); $valor_contraste = $exa->getValorContraste($_POST["con_id"]); $ch = $exa->getCh($_POST["con_id"]); $filme = $exa->getFilme($_POST["con_id"]); $valor_ch = $con->get("con_valor_ch"); $valor_filme = $con->get("con_valor_filme"); $o->set("int_percentual" , $hos->get("hos_percentual")); $o->set("int_valor_absoluto" , $valor_absoluto); $o->set("int_valor_contraste" , $valor_contraste); $o->set("int_ch" , $ch); $o->set("int_filme" , $filme); $o->set("int_valor_ch" , $valor_ch); $o->set("int_valor_filme" , $valor_filme); $o->set("int_valor_final" , strval(floatval($valor_absoluto) > 0 ? $valor_absoluto : floatval($valor_contraste) + (floatval($ch) * floatval($valor_ch)) + (floatval($filme) * floatval($valor_filme)))); $o->propertiesClearConfig(); if ($new_id = $o->add()){ if ($_POST[mesmo_paciente] != "1") { Js::goto(array("url" => "index.php?s=interpretacao&acao=add")); } else { unset($_POST[form]);
Util::VerificaChamada(); if($_GET[id]){ $o = new ValorExame($_GET[id]); //$o->setDependences(); //util::prt("", get_class_methods($o)); foreach($o->propertiesGetConfig() as $campo => $config){ $tpl->assign($campo, $o->get($campo)); } $exa = new Exame($o->get("exa_id")); $tpl->assign("exa_nome", $exa->get("exa_nome")); $con = new Convenio($o->get("con_id")); $tpl->assign("con_nome", $con->get("con_nome")); $hos = new Hospital($con->get("hos_id")); $tpl->assign("hos_nome", $hos->get("hos_nome")); if ($_GET[del] == "1" || $_POST[del] == "1"){ if ($o->delete($_GET[delete_dependences])){ Js::goto(array("url" => "index.php?s=valor_exame")); } else { $dep = $o->getDependences(); if (sizeof($dep)){ $tpl->assign("dependences", $dep); } } } } else { Js::goto(array("url" => "index.php?s=convenio")); } $template_html = $path_tpl."show.tpl";
/** * monta um array com os dados de clientes que deverão ser exibidos em options de select * * @return array */ function getOptions(){ $objs = Convenio::getAll(); $out = array(); foreach($objs as $o) { $h = new Hospital($o->get("hos_id")); $out[$o->get("con_id")] = $h->get("hos_nome")." | ".$o->get("con_nome"); } return $out; }
$tpl->assign("tamanho_pagina", $tamanho_pagina); $tpl->assign("total_registros", $p->getTotalRegistros()); $tpl->assign("registros", $p->getRegistrosPagina()); $tpl->assign("paginacao", $p->getHtml()); $template_html = $path_tpl."gerenciar.tpl"; } else { //util::prt("", $p->getRegistrosPagina()); $max_caracteres = 75; $rs = array(); $i = 0; foreach($p->getRegistrosPagina() as $id => $r){ //util::prt("", $r); $rs[$i] = $r; $o = new Interpretacao($r["int_id"]); $hos = new Hospital($o->get("hos_id")); $rs[$i]["hos_nome"] = $hos->get("hos_nome"); $con = new Convenio($o->get("con_id")); $rs[$i]["con_nome"] = $con->get("con_nome"); $exa = new Exame($o->get("exa_id")); $rs[$i]["exa_nome"] = $exa->get("exa_nome"); $vet_txt = split("\n",$r["int_texto"]); $rs[$i]["int_texto"] = ""; foreach($vet_txt as $linha){ if(strlen($linha) > $max_caracteres){ //util::prt(strlen($linha), $linha); $parte1 = substr($linha,0,$max_caracteres)."\n"; $parte2 = substr($linha,$max_caracteres,$max_caracteres)."\n"; $parte3 = substr($linha,$max_caracteres*2,$max_caracteres)."\n"; $parte4 = substr($linha,$max_caracteres*3,$max_caracteres)."\n"; //util::prt("1", $parte1); //util::prt("2", $parte2);
<? Util::VerificaChamada(); if($_GET[id]){ $o = new Hospital($_GET[id]); $_POST["med_id"] = $_SESSION["med_id"]; foreach($o->propertiesGetConfig() as $campo => $config){ $tpl->assign($campo, (empty($_POST[$campo]) ? $o->get($campo) : $_POST[$campo])); $o->set($campo, $_POST[$campo]); } if ($_POST[form] == "ok"){ //$o->propertiesDump(); if ($o->update()){ Js::goto(array("url" => "index.php?s=hospital")); } else { foreach($o->errors as $campo => $erro){ $tpl->assign($campo."_erro", $erro); $tpl->assign($campo, ""); } } } } else { Js::goto(array("url" => "index.php?s=hospital")); } $template_html = $path_tpl."formulario.tpl"; ?>
<? Util::VerificaChamada(); if($_GET[id]){ $o = new Hospital($_GET[id]); //$o->setDependences(); //util::prt("", get_class_methods($o)); foreach($o->propertiesGetConfig() as $campo => $config){ $tpl->assign($campo, $o->get($campo)); } if ($_GET[del] == "1" || $_POST[del] == "1"){ if ($o->delete($_GET[delete_dependences])){ Js::goto(array("url" => "index.php?s=hospital")); } else { $dep = $o->getDependences(); if (sizeof($dep)){ $tpl->assign("dependences", $dep); } } } } else { Js::goto(array("url" => "index.php?s=convenio")); } $template_html = $path_tpl."show.tpl"; ?>