Пример #1
0
<?
	Util::VerificaChamada();
	$o = new Interpretacao();

	foreach($o->propertiesGetConfig() as $campo => $config){
		$tpl->assign($campo, 		$_POST[$campo]);
		//$o->set($campo,				$_POST[$campo]);
		//util::prt($campo, $_POST[$campo]);
	}
	$tpl->assign("vet_exames", 	Exame::getOptions());
	$tpl->assign("vet_convenios", 	Convenio::getOptions());
	if ($_POST[form] == "ok"){
		$data_cadastro		= date("Y-m-d H:i:s");
		$con		= new Convenio($_POST["con_id"]);
		$hos		= new Hospital($con->get("hos_id"));
		$exa		= new Exame($_POST["exa_id"]);
		
		$o->set("hos_id"				, $con->get("hos_id"));
		$o->set("con_id"   				, $_POST["con_id"]);
		$o->set("exa_id"   				, $_POST["exa_id"]);
		
		$o->set("int_status"   					, "nao_interpretado");
		$o->set("int_data_cadastro"				, $data_cadastro);
		
		$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"]);
Пример #2
0
 protected function afterFind()
 {
     //$this->calculaGastosVerbas();
     $this->defineClassFromStatus();
     $this->instrumento_juridico = InstrumentoJuridico::load(json_decode($this->instrumento_juridico));
     $this->convenio = Convenio::load(json_decode($this->convenio));
     //Coloca a situação do projeto
     if ($this->situacao == null) {
         $this->situacao = 0;
     }
     $this->situacao_text = $this->situacoes[$this->situacao];
     if ($this->nome_curto == null || $this->nome_curto == '') {
         $this->nome_curto = substr($this->nome, 0, 20);
     }
     //Calcula o financeiro novo
     $this->calcFinanceiro();
 }
Пример #3
0
<?
	Util::VerificaChamada();
	$o = new Convenio();
	$filtros			= array(
		"con_nome"				=> $_GET["con_nome"],
		"hos_id"				=> $_GET["hos_id"]
	);
	$ordenacao			= array(
		"campo_ordenacao"		=> $_GET["campo_ordenacao"],
		"tipo_ordenacao"		=> $_GET["tipo_ordenacao"]
	);
	$tamanho_pagina 	= (empty($_GET["tamanho_pagina"]) ? 20 : intval($_GET["tamanho_pagina"]));
	$pagina 			= (empty($_GET["pagina"]) ? 0 : intval($_GET["pagina"]));
	
	$o->setSqlBusca($filtros, $ordenacao, $tamanho_pagina);
	$p = new Pagination ($o->getLinkBasePaginacao(), $o->getSqlBusca(), $tamanho_pagina, $pagina);

	$tpl->assign("vet_hospitais", 			Hospital::getOptions());
	$tpl->assign("seta_ordenacao", 			$o->getSetasOrdenacao());
	$tpl->assign("link_ordenacao", 			$o->getLinksOrdenacao());
	$tpl->assign("vet_tamanho_pagina", 		array("10", "20", "30", "50", "100"));
	$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";
?>
Пример #4
0
<?
	Util::VerificaChamada();
	$o = new ValorExame();
	$filtros			= array(
		"exa_id"			=> $_GET["exa_id"],
		"con_id"			=> $_GET["con_id"],
	);
	$ordenacao			= array(
		"campo_ordenacao"		=> $_GET["campo_ordenacao"],
		"tipo_ordenacao"		=> $_GET["tipo_ordenacao"]
	);
	$tamanho_pagina 	= (empty($_GET["tamanho_pagina"]) ? 20 : intval($_GET["tamanho_pagina"]));
	$pagina 			= (empty($_GET["pagina"]) ? 0 : intval($_GET["pagina"]));
	
	$o->setSqlBusca($filtros, $ordenacao, $tamanho_pagina);
	$p = new Pagination ($o->getLinkBasePaginacao(), $o->getSqlBusca(), $tamanho_pagina, $pagina);

	$tpl->assign("vet_exames", 				Exame::getOptions());
	$tpl->assign("vet_convenios", 			Convenio::getOptions());
	$tpl->assign("seta_ordenacao", 			$o->getSetasOrdenacao());
	$tpl->assign("link_ordenacao", 			$o->getLinksOrdenacao());
	$tpl->assign("vet_tamanho_pagina", 		array("10", "20", "30", "50", "100"));
	$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";
?>
Пример #5
0
    /**
     * 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><?

	}
Пример #6
0
<?
	Util::VerificaChamada();
	if(is_numeric($_GET[id])){
		if($_SESSION["medico"] == "1"){
			$o = new Interpretacao($_GET[id]);
			
			foreach($o->propertiesGetConfig() as $campo => $config){
				$tpl->assign($campo, 		(empty($_POST[$campo]) ? $o->get($campo) : $_POST[$campo]));
				//util::prt($campo, (empty($_POST[$campo]) ? $o->get($campo) : $_POST[$campo]));
				//$o->set($campo,				$_POST[$campo]);
			}
			$hos = new Hospital($o->get("hos_id"));
			$tpl->assign("hos_nome", 	$hos->get("hos_nome"));
			
			$con = new Convenio($o->get("con_id"));
			$tpl->assign("con_nome", 	$con->get("con_nome"));
			
			$exa = new Exame($o->get("exa_id"));
			$tpl->assign("exa_nome", 	$exa->get("exa_nome"));
			
			$tpl->assign("textos", 	TextoPadrao::getToJs());
			
			if ($_POST[form] == "ok"){
				$o->propertiesClearConfig();
				$o->propertiesSetConfig(
					array(
						"int_status"	=> array(
							"titulo"		=> "Situação",
							"requerido"		=> "",
							"validacao"		=> "Text",
						),
Пример #7
0
<?
	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"));
	}
Пример #8
0
<?
	Util::VerificaChamada();
	$o = new Convenio();

	foreach($o->propertiesGetConfig() as $campo => $config){
		$tpl->assign($campo, 		$_POST[$campo]);
		$o->set($campo,				$_POST[$campo]);
	}
	$tpl->assign("vet_hospitais", 	Hospital::getOptions());
	//util::prt("",$o->exists());
	if ($_POST[form] == "ok"){
		//$o->propertiesDump(true);
		if ($new_id = $o->add()){
			Js::goto(array(
				"url" => "index.php?s=convenio&acao=add",
				"post_vars" => array(
					"hos_id" => $_POST[hos_id]
				)
			));
		} else {
			foreach($o->errors as $campo => $erro){
				$tpl->assign($campo."_erro", $erro);
				$tpl->assign($campo, "");
			}
		}
	}
	
	$template_html = $path_tpl."formulario.tpl";
?>
Пример #9
0
<?
	Util::VerificaChamada();
	if($_GET[id]){
		$o = new Convenio($_GET[id]);
		
		foreach($o->propertiesGetConfig() as $campo => $config){
			$tpl->assign($campo, 		(empty($_POST[$campo]) ? $o->get($campo) : $_POST[$campo]));
			$o->set($campo,				$_POST[$campo]);
		}
		$tpl->assign("vet_hospitais", 	Hospital::getOptions());
		$tpl->assign("vet_convenios", 	Convenio::getOptions());
		if ($_POST[form] == "ok"){
			if ($o->update()){
				if ($_POST["con_convenio_desc"] != ""){
					$o->descontaValores($_POST["con_desconto"], $_POST["con_convenio_desc"]);
				}
				Js::goto(array("url" => "index.php?s=convenio"));
			} else {
				foreach($o->errors as $campo => $erro){
					$tpl->assign($campo."_erro", $erro);
					$tpl->assign($campo, "");
				}
			}
		}
	} else {
		Js::goto(array("url" => "index.php?s=convenio"));
	}
	
	$template_html = $path_tpl."formulario.tpl";
?>
Пример #10
0
<?
	Util::VerificaChamada();
	if($_GET[id]){
		$o = new ValorExame($_GET[id]);

		$con_id = (empty($_POST["con_id"]) ? $o->get("con_id") : $_POST["con_id"]);
		if ($con_id){
			$con = new Convenio($con_id);
			$tpl->assign("con_valor_ch", 	$con->get("con_valor_ch"));
			$tpl->assign("con_valor_filme",	$con->get("con_valor_filme"));
		}

		foreach($o->propertiesGetConfig() as $campo => $config){
			$tpl->assign($campo, 		(empty($_POST[$campo]) ? $o->get($campo) : $_POST[$campo]));
			$o->set($campo,				$_POST[$campo]);
		}
		$tpl->assign("vet_exames", 				Exame::getOptions());
		$tpl->assign("vet_convenios", 			Convenio::getOptions());
		
		if ($_POST[form] == "ok"){
			if ($o->update()){
				Js::goto(array("url" => "index.php?s=valor_exame"));
			} else {
				foreach($o->errors as $campo => $erro){
					$tpl->assign($campo."_erro", $erro);
					$tpl->assign($campo, "");
				}
			}
		}
	} else {
		Js::goto(array("url" => "index.php?s=valor_exame"));
Пример #11
0
    /**
     * 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")." &nbsp;&nbsp; | &nbsp;&nbsp; ".$o->get("con_nome");
        }
        return $out;
	}
Пример #12
0
<?
	Util::VerificaChamada();
	if($_GET[id]){
		$o = new Convenio($_GET[id]);
		//$o->setDependences();
		//util::prt("", get_class_methods($o));
		foreach($o->propertiesGetConfig() as $campo => $config){
			$tpl->assign($campo, 	$o->get($campo));
		}
		$hos = new Hospital($o->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=convenio"));
			} 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";
?>
Пример #13
0
		$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::prt("3", $parte3);
 public function imprimirDadosConvenioAction()
 {
     $this->_helper->layout->disableLayout();
     // Desabilita o Zend Layout
     $idPronac = $this->_request->getParam("idPronac");
     if (strlen($idPronac) > 7) {
         $idPronac = Seguranca::dencrypt($idPronac);
     }
     if (!empty($idPronac)) {
         //****** Dados do Projeto - Cabecalho *****//
         $projetos = new Projetos();
         $DadosProjeto = $projetos->buscar(array('idPronac = ?' => $idPronac))->current();
         $this->view->idPronac = $idPronac;
         $this->view->DadosProjeto = $DadosProjeto;
         $where = array();
         $where['AnoProjeto = ?'] = $DadosProjeto->AnoProjeto;
         $where['Sequencial = ?'] = $DadosProjeto->Sequencial;
         $Convenio = new Convenio();
         $this->view->dados = $Convenio->buscarDadosConvenios($where);
     }
 }
Пример #15
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     if (isset($_POST['Projeto'])) {
         if (isset($_POST['Projeto']['pessoas'])) {
             $model->pessoas = $_POST['Projeto']['pessoas'];
         }
         $orcamentos = null;
         if (isset($_POST['Orcamento'])) {
             $orcamentos = $_POST['Orcamento'];
         }
         if (isset($_POST['InstrumentoJuridico'])) {
             $model->instrumento_juridico = json_encode($_POST['InstrumentoJuridico']);
         }
         if (isset($_POST['Convenio'])) {
             $model->convenio = json_encode($_POST['Convenio']);
         }
         $model->attributes = $_POST['Projeto'];
         $connection = Yii::app()->db;
         $transaction = $connection->beginTransaction();
         try {
             //Retira a permisssão do coordenador antigo
             //$this->deleteDafaultPermissions($model);
             if ($model->save()) {
                 if (!$this->salvaOrcamento($model->cod_projeto, $orcamentos)) {
                     $model->addError('orcamentos', "Erro ao salvar orçamentos");
                 }
                 //Atualiza permissão do coordenador
                 //$this->createDafaultPermissions($model);
                 if (!$this->salvaPessoas($model->cod_projeto, explode(',', $model->pessoas))) {
                     $model->addError('pessoas', "Erro ao adicionar equipe");
                 }
                 //Verifica erros e gera exceção
                 if ($model->hasErrors()) {
                     throw new CHttpException(500, "ERRO AO SALVAR PROJETO");
                 }
                 //Salva definitivamente todas as alterações no banco
                 $transaction->commit();
                 //Redireciona
                 $this->redirect(array('view', 'id' => $model->cod_projeto));
             }
         } catch (Exception $e) {
             $transaction->rollBack();
             $model->instrumento_juridico = InstrumentoJuridico::load(json_decode($model->instrumento_juridico));
             $model->convenio = Convenio::load(json_decode($model->convenio));
         }
     }
     $this->render('update', array('model' => $model));
 }
Пример #16
0
 public function delete()
 {
     try {
         $objConvenio = new Convenio();
         $objConvenio->setCompany(request_var("company"));
         $objConvenio->setOffice(request_var("office"));
         $objConvenio->setId(request_var("cid"));
         $objConvenio->setDescription("");
         $objConvenio->setUsername("");
         $objConvenio->setPassword("");
         $objConvenio->setDiscount("0");
         $objConvenio->setStatus(INACTIVE);
         $_response = $objConvenio->save();
         if ($_response["GrabarActualizarConvenioResult"] == true && $_response["strError"] == "") {
             $_SESSION["ses_message_type"] = "success";
             $_SESSION["ses_message"] = "El Convenio se elimino correctamente";
         } else {
             $_SESSION["ses_message_type"] = "warning";
             $_SESSION["ses_message"] = $_response["strError"];
         }
         $this->getConvenio();
     } catch (Exception $ex) {
         $_SESSION["ses_message_type"] = "error";
         $_SESSION["ses_message"] = "Error al eliminar Convenio";
         echo $ex->getMessage();
     }
 }