예제 #1
0
 public function ListaHipotesesCaso($codcaso)
 {
     try {
         $sql = "select CodHipotese, Descricao, Correto, Justificativa, ConteudoAdicional ";
         $sql .= "from mescasohipotdiagn hip ";
         $sql .= "where hip.CodCaso = :pCodCaso;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
         $cmd->execute();
         if ($cmd->rowCount() > 0) {
             $tiporesp = Caso::BuscaConfiguracao($codcaso, "hipoteses", "TipoResp");
             switch ($tiporesp) {
                 case "CE":
                     $labelResposta = "Correto";
                     break;
                 case "ORD":
                     $labelResposta = "Ordem de chance";
                     break;
             }
             $tabela = Comuns::TopoTabelaListagem("Hipóteses cadastradas", "hipoteses", array("Nome", $labelResposta, "Ações"));
             while ($hipotese = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $tabela .= '<tr>';
                 $tabela .= '  <td>' . $hipotese->Descricao . "</td>";
                 $tabela .= '  <td>' . ($tiporesp == "CE" ? SimNao::Descreve($hipotese->Correto) : $hipotese->Correto) . "</td>";
                 $tabela .= '  <td>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($hipotese->CodHipotese) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntDeletaHipotese(\'' . base64_encode($hipotese->CodHipotese) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $tabela .= '  </td>';
                 $tabela = str_replace("##id##", "", $tabela);
                 $tabela .= "</tr>";
             }
             $tabela .= "</tbody></table>";
         } else {
             $tabela = "@lng[Nenhuma hipótese cadastrada até o momento]";
         }
     } catch (PDOException $ex) {
         $this->msg_erro = $ex->getMessage();
         $tabela = $this->msg_erro;
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     return $tabela;
 }
예제 #2
0
 public function ListaExamesCaso($codcaso)
 {
     try {
         $sql = "select ex.CodExame, ex.Descricao, ex.Tipo, t.Descricao as DescricaoTipo,  ex.Correto, ";
         $sql .= "ex.Justificativa, ex.ConteudoAdicional, ex.NumBateria, ex.MostraQuando ";
         $sql .= "from mescasoexames ex ";
         $sql .= "inner join mestipoexame t on t.Codigo = ex.Tipo ";
         $sql .= "where ex.CodCaso = :pCodCaso order by ex.Descricao;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
         $cmd->execute();
         if ($cmd->rowCount() > 0) {
             $tiporesp = Caso::BuscaConfiguracao($codcaso, "exames", "TipoResp");
             switch ($tiporesp) {
                 case "CE":
                     $labelResposta = "@lng[Correto]";
                     break;
                 case "ORD":
                     $labelResposta = "@lng[Importancia (ordem)]";
                     break;
             }
             $tabela = Comuns::TopoTabelaListagem("Exames cadastrados", "exames", array("Descrição", "Tipo", $labelResposta, "Ações"));
             while ($exame = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $tabela .= '<tr>';
                 $tabela .= '<td>' . $exame->Descricao . "</td>";
                 $tabela .= '<td>' . $exame->DescricaoTipo . "</td>";
                 //$tabela .= '<td>' . MostraQuando::Descreve($exame->MostraQuando) . '</td>';
                 $tabela .= '<td width="90px">' . ($tiporesp == "CE" ? SimNao::Descreve($exame->Correto) : $exame->Correto) . "</td>";
                 //$tabela .= '<td>' . $exame->NumBateria . "</td>";
                 $tabela .= '<td width="100px">';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($exame->CodExame) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntLoadItemDetalhes(\'exames\', \'' . base64_encode($exame->CodExame) . '\');">' . Comuns::IMG_ACAO_DETALHES . '</a>';
                 $tabela .= '  <a href="javascript:void(0);" onclick="javascript:fntDeletaExame(\'' . base64_encode($exame->CodExame) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $tabela .= '</td>';
                 $tabela = str_replace("##id##", "", $tabela);
                 $tabela .= "</tr>";
             }
             $tabela .= "</tbody></table>";
         } else {
             $tabela = "@lng[Nenhum exame cadastrado até o momento]";
         }
     } catch (PDOException $ex) {
         $this->msg_erro = $ex->getMessage();
         $tabela = $this->msg_erro;
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     return $tabela;
 }
예제 #3
0
function fntRetornaTratamentos()
{
    if (isset($_SESSION['caso']) && $_SESSION['caso'] > 0) {
        $tratamentos = new Tratamento();
        $lista = $tratamentos->ListaRecordSet($_SESSION['caso']);
        if ($lista != false && count($lista) > 0) {
            $html = Comuns::TopoTabelaListagem("", "tabTratamentos", array('&nbsp;', 'Tratamento', 'Correto'));
            foreach ($lista as $trat) {
                $html .= '<tr>';
                $html .= '<td><input type="checkbox" id="chk_trat_' . $trat->CodTratamento . '" class="item_arvore"></td>';
                $html .= '<td><span id="spn_trat_' . $trat->CodTratamento . '">' . $trat->Titulo . '</span></td>';
                $html .= '<td>' . SimNao::Descreve($trat->Correto) . '</td>';
                $html .= '</tr>';
            }
            $html .= "</tbody></table>";
            return $html;
        } else {
            return "@lng[Nenhum tratamento cadastrado]";
        }
    } else {
        return "Caso não encontrado";
    }
}
예제 #4
0
 public function Lista($codcaso)
 {
     $sql = "select CodDiagnostico, Descricao, Correto, Justificativa, ConteudoAdicional ";
     $sql .= "from mescasodiagnostico diag ";
     $sql .= "where diag.CodCaso = :pCodCaso;";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
     $cmd->execute();
     if ($cmd->rowCount() > 0) {
         $tiporesp = Caso::BuscaConfiguracao($codcaso, "diagnosticos", "TipoResp");
         switch ($tiporesp) {
             case "CE":
                 $labelResposta = "Correto";
                 break;
             case "ORD":
                 $labelResposta = "Chance";
                 break;
         }
         $tabela = Comuns::TopoTabelaListagem("Diagnósticos cadastradas", "diags", array("Descrição", $labelResposta, "Ações"));
         while ($diagnostico = $cmd->fetch(PDO::FETCH_OBJ)) {
             $tabela .= '<tr>';
             $tabela .= '  <td>' . $diagnostico->Descricao . "</td>";
             $tabela .= '  <td>' . ($tiporesp == "CE" ? SimNao::Descreve($diagnostico->Correto) : $diagnostico->Correto) . "</td>";
             $tabela .= '  <td>';
             $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($diagnostico->CodDiagnostico) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
             $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntDeletaDiagnostico(\'' . base64_encode($diagnostico->CodDiagnostico) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
             $tabela .= '  </td>';
             $tabela = str_replace("##id##", "", $tabela);
             $tabela .= "</tr>";
         }
         $tabela .= "</tbody></table>";
     } else {
         $tabela = "@lng[Nenhum diagnóstico cadastrado até o momento]";
     }
     return $tabela;
 }
예제 #5
0
function TratarDadosTratamentosDlg()
{
    $dados = new HashTable();
    if (isset($_SESSION['caso']) && $_SESSION['caso'] != 0) {
        $t = new Tratamento();
        $tiporesp = Caso::BuscaConfiguracao($_SESSION['caso'], "diagnosticos", "TipoResp");
        if ($_POST['r'] != "") {
            $codtratamento = base64_decode($_POST['r']);
            $_SESSION['tratamento'] = $codtratamento;
            $t->Carrega($_SESSION['caso'], $codtratamento);
            $dados->AddItem("txtTitulo", $t->getTitulo());
            $dados->AddItem("txtDescricao", $t->getDescricao());
            $dados->AddItem("txtJustificativa", $t->getJustificativa());
            $dados->AddItem("txtAdicional", $t->getConteudoadicional());
            $dados->AddItem("divRelacoes", $t->ListaRelacoesTratamento($_SESSION['caso'], $codtratamento));
            if ($tiporesp == "CE") {
                $dados->AddItem("selCorreto", SimNao::SelectSimNao($t->getCorreto()));
            } else {
                $n = $t->getNTratamentos();
                $opcoes = SelectNumerico::MontaSelect($n, 1, "@lng[Selecione]", $t->getCorreto());
                $dados->AddItem("selCorreto", $opcoes);
            }
        } else {
            $_SESSION['tratamento'] = 0;
            $dados->AddItem("txtTitulo", "");
            $dados->AddItem("txtDescricao", "");
            $dados->AddItem("txtJustificativa", "");
            $dados->AddItem("txtAdicional", "");
            $dados->AddItem("divRelacoes", $t->ListaRelacoesTratamento($_SESSION['caso'], 0));
            if ($tiporesp == "CE") {
                $dados->AddItem("selCorreto", SimNao::SelectSimNao());
            } else {
                $t->setCodcaso($_SESSION['caso']);
                $n = $t->getNTratamentos() + 1;
                $dados->AddItem("selCorreto", SelectNumerico::MontaSelect($n, 1, "@lng[Selecione]"));
            }
        }
        return $dados->ToXML();
    } else {
        return "@lng[Erro ao localizar o caso de estudo]";
    }
}
예제 #6
0
function Main()
{
    $u = unserialize($_SESSION['usu']);
    if (isset($_SESSION['perg']) && !is_null($_SESSION['perg']) && $_SESSION['perg'] != "") {
        // Verifica se já tem uma sessão iniciada para uma pergunta. Se tiver...
        if (isset($_GET['p'])) {
            // Se tiver mas vier via GET algum código, limpa a sessão e recarrega os dados
            unset($_SESSION['perg']);
            $cod = base64_decode($_GET['p']);
            $p = new Pergunta();
            $p->Carregar($cod);
        } else {
            $p = new Pergunta();
            $p->Carregar($_SESSION['perg']);
        }
    } else {
        // Se não tiver sessão iniciada...
        if (isset($_GET['p'])) {
            // Deve vir obrigatoriamente um código informado via GET. Caso veio, instancia a pergunta
            $cod = base64_decode($_GET['p']);
            $p = new Pergunta();
            $p->Carregar($cod);
        } else {
            // Se não veio código é porque alguma coisa saiu errado ou o usuário não deveria estar acessando a página
            $msg = base64_encode("Algo saiu errado.");
            header("Location:listagem.php?t=8&m=" . $msg);
        }
    }
    $tpl = file_get_contents('tpl/alternativas.html');
    $tpl = str_replace("<!--telatopo-->", Comuns::GeraTopoPagina($u), $tpl);
    $botoes = Botao::BotaoSalvar("fntGravaAlternativa();", "@lng[Salvar a alternativa]");
    $botoes .= Botao::BotaoCancelar("fntNavega('listagem.php?t=8');", "@lng[Cancelar edição]");
    $botoes .= Botao::BotaoVoltar("fntNavega('vwpergunta.php?r=" . base64_encode($p->getCodigo()) . "');");
    $tpl = str_replace("<!--itens-toolbar-->", $botoes, $tpl);
    $tpl = str_replace("<!--Mensagem-->", isset($mensagem) && $mensagem != "" ? base64_decode($mensagem) : "", $tpl);
    $tipconsatual = 1;
    $valconsatual = -1;
    if (count($p->getAlternativas()) > 0) {
        $arquivotpl = 'tpl/alternativas-comp' . $p->getTipo()->getCodigo() . '.html';
        //$item_padrao = file_get_contents('tpl/alternativas-comp1.html');
        $item_padrao = file_get_contents($arquivotpl);
        $itens = '';
        foreach ($p->getAlternativas() as $alt) {
            $copia = $item_padrao;
            $copia = str_replace("<!--perg-->", base64_encode($p->getCodigo()), $copia);
            $copia = str_replace("<!--seq-->", base64_encode($alt->getSequencia()), $copia);
            $copia = str_replace("<!--correta-->", $alt->getCorreto() == 1 ? "SIM" : "NÃO", $copia);
            $copia = str_replace("<!--ordem-->", $alt->getSequencia(), $copia);
            $copia = str_replace("<!--ordem-ex-->", base64_encode($alt->getSequencia()), $copia);
            $copia = str_replace("<!--codunico-->", base64_encode($alt->getCodUnico()), $copia);
            $copia = str_replace("<!--excluir-->", "", $copia);
            if ($p->getTipo()->getCodigo() == 1) {
                $copia = str_replace("<!--img-preview-->", $alt->getImagem(), $copia);
            } else {
                $copia = str_replace("<!--textoalternativa-->", strlen($alt->getTexto()) > 100 ? substr($alt->getTexto(), 0, 97) . "..." : $alt->getTexto(), $copia);
            }
            $itens .= $copia;
            if (isset($_GET['s']) && $_GET['s'] != "") {
                // Se foi informado um segundo parâmetro, contendo a sequência da alternativa,
                // quer dizer que deve ser carregada a alternativa para edição.
                if (base64_decode($_GET['s']) == $alt->getCodUnico()) {
                    if ($p->getTipo()->getCodigo() == 1) {
                        $tpl = str_replace("<!--hidSeq-->", $alt->getSequencia(), $tpl);
                        //$tpl = str_replace("<!--nomeimg-->", $alt->getImagem(), $tpl);
                        $tpl = str_replace("<!--nomeimg-->", "", $tpl);
                        $tpl = str_replace("<!--txtTextoAdicional-->", $alt->getTexto(), $tpl);
                        $tpl = str_replace("<!--opcoescorreto-->", SimNao::SelectSimNao($alt->getCorreto()), $tpl);
                        $tpl = str_replace("<!--txtExplicacao-->", $alt->getExplicacao(), $tpl);
                        $tpl = str_replace("<!--hidocultar-->", "N", $tpl);
                    } else {
                        if ($p->getTipo()->getCodigo() == 2 || $p->getTipo()->getCodigo() == 3) {
                            $tpl = str_replace("<!--hidSeq-->", $alt->getSequencia(), $tpl);
                            $tpl = str_replace("<!--txtAlternativa-->", $alt->getTexto(), $tpl);
                            $tpl = str_replace("<!--selcorretotxt-->", SimNao::SelectSimNao($alt->getCorreto()), $tpl);
                            $tpl = str_replace("<!--txtJustTxt-->", $alt->getExplicacao(), $tpl);
                            $tpl = str_replace("<!--hidocultar-->", "N", $tpl);
                        }
                    }
                } else {
                    $tpl = str_replace("<!--hidocultar-->", "S", $tpl);
                }
            } else {
                $tpl = str_replace("<!--hidocultar-->", "S", $tpl);
            }
        }
        $itens .= '<div id="addAlt" class="box-alternativa box-zero-alternativa">';
        $itens .= '    <span style="line-height:43px;">@lng[Adiciona alternativa]</span>';
        $itens .= '</div>';
    } else {
        $itens = '<div id="addAlt" class="box-alternativa box-zero-alternativa">';
        $itens .= '    @lng[Nenhuma alternativa cadastrada]<br />';
        $itens .= '    @lng[Adiciona alternativa]';
        $itens .= '</div>';
    }
    // Se não foi informado nenhum registro, limpa o que ficou pra traz
    $tpl = str_replace("<!--hidSeq-->", "", $tpl);
    $tpl = str_replace("<!--nomeimg-->", "", $tpl);
    $tpl = str_replace("<!--txtTextoAdicional-->", "", $tpl);
    $tpl = str_replace("<!--txtExplicacao-->", "", $tpl);
    $tpl = str_replace("<!--opcoescorreto-->", SimNao::SelectSimNao(), $tpl);
    $tpl = str_replace("<!--txtAlternativa-->", "", $tpl);
    $tpl = str_replace("<!--selcorretotxt-->", SimNao::SelectSimNao(), $tpl);
    $tips = '<option value="0">@lng[Todos]</option>';
    foreach ($p->tipos->ListaRecordSet() as $tipo) {
        $tips .= '<option value="' . $tipo->Codigo . '">' . $tipo->Descricao . '</option>';
    }
    $cls = '<option value="0">@lng[Todos]</option>';
    foreach ($p->classes->ListaRecordSet() as $classe) {
        $cls .= '<option value="' . $classe->Codigo . '">' . $classe->Descricao . '</option>';
    }
    $tpl = str_replace('<!--descricao-->', $p->getTexto(), $tpl);
    $tpl = str_replace('<!--alternativas-->', $itens, $tpl);
    $tpl = str_replace('<!--tipo-->', $p->getTipo()->getDescricao(), $tpl);
    $tpl = str_replace('<!--hidtipo-->', $p->getTipo()->getCodigo(), $tpl);
    $tpl = str_replace("<!--classespergunta-->", $cls, $tpl);
    $tpl = str_replace("<!--tipospergunta-->", $tips, $tpl);
    $_SESSION['perg'] = $p->getCodigo();
    echo Comuns::Idioma($tpl);
}
예제 #7
0
 public function Lista($codcaso)
 {
     try {
         $sql = "select CodCaso, CodTratamento, ";
         $sql .= "case when length(Titulo) > 75 then concat(left(Titulo, 75), '...') else Titulo end as Descricao, ";
         $sql .= "Correto, Justificativa, ConteudoAdicional ";
         $sql .= "from mescasotratamento ";
         $sql .= "where CodCaso = :pCodCaso;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodCaso", $codcaso, PDO::PARAM_INT);
         $cmd->execute();
         if ($cmd->rowCount() > 0) {
             $tiporesp = Caso::BuscaConfiguracao($codcaso, "tratamentos", "TipoResp");
             switch ($tiporesp) {
                 case "CE":
                     $labelResposta = "@lng[Correto]";
                     break;
                 case "ORD":
                     $labelResposta = "@lng[Indicação (ordem)]";
                     break;
             }
             $tabela = Comuns::TopoTabelaListagem("Tratamentos cadastrados", "tratcad", array("Descrição", $labelResposta, "Ações"));
             while ($tratamento = $cmd->fetch(PDO::FETCH_OBJ)) {
                 $tabela .= '<tr>';
                 $tabela .= '  <td>' . $tratamento->Descricao . '</td>';
                 $tabela .= '  <td>' . ($tiporesp == "CE" ? SimNao::Descreve($tratamento->Correto) : $tratamento->Correto) . '</td>';
                 $tabela .= '  <td>';
                 $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntExibeCadastroEtapa(\'' . base64_encode($tratamento->CodTratamento) . '\');">' . Comuns::IMG_ACAO_EDITAR . '</a>';
                 $tabela .= '    <a href="javascript:void(0);" onclick="javascript:fntDeletaTratamento(\'' . base64_encode($tratamento->CodTratamento) . '\');">' . Comuns::IMG_ACAO_DELETAR . '</a>';
                 $tabela .= '  </td>';
                 $tabela = str_replace("##id##", "", $tabela);
                 $tabela .= "</tr>";
             }
             $tabela .= "</tbody></table>";
         } else {
             $tabela = "@lng[Nenhum tratamento cadastrado até o momento]";
         }
     } catch (PDOException $ex) {
         $this->msg_erro = $ex->getMessage();
         $tabela = $this->msg_erro;
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     return $tabela;
 }
예제 #8
0
 public function FormEdita($cod)
 {
     $this->codigo = $cod;
     $tpl = Comuns::BuscaForm($this->form);
     if ($tpl) {
         $sql = "SELECT Descricao, Metodo, Condicao, Informacoes, Conservacao, TemComponentes, \tAtivo, PermiteImagem, PermiteDocs, PermiteValores ";
         $sql .= "FROM mestipoexame WHERE Codigo = :pCodigo;";
         $cnn = Conexao2::getInstance();
         $cmd = $cnn->prepare($sql);
         $cmd->bindParam(":pCodigo", $this->codigo, PDO::PARAM_INT);
         $cmd->execute();
         $rs = $cmd->fetch(PDO::FETCH_OBJ);
         if (count($rs) != 0) {
             $tpl = str_replace("<!--txtCodigo-->", $this->codigo, $tpl);
             $tpl = str_replace("<!--txtDescricao-->", $rs->Descricao, $tpl);
             $tpl = str_replace("<!--txtMetodo-->", $rs->Metodo, $tpl);
             $tpl = str_replace("<!--txtCondicao-->", $rs->Condicao, $tpl);
             $tpl = str_replace("<!--txtInformacoes-->", $rs->Informacoes, $tpl);
             $tpl = str_replace("<!--txtConservacao-->", $rs->Conservacao, $tpl);
             $tpl = str_replace("<!--selComponentes-->", SimNao::SelectSimNao($rs->TemComponentes), $tpl);
             $tpl = str_replace("<!--selAtivo-->", SimNao::SelectSimNao($rs->Ativo), $tpl);
             $tpl = str_replace("<!--chkImgs-->", $rs->PermiteImagem == 1 ? 'checked="checked"' : "", $tpl);
             $tpl = str_replace("<!--chkDocs-->", $rs->PermiteDocs == 1 ? 'checked="checked"' : "", $tpl);
             $tpl = str_replace("<!--chkVals-->", $rs->PermiteValores == 1 ? 'checked="checked"' : "", $tpl);
         } else {
             echo "@lng[Registro não encontrado]";
         }
     } else {
         $tpl = "@lng[Erro ao criar a tela de cadastro de tipos de exame].";
     }
     return $tpl;
 }