Example #1
0
function fntSalvaTextoHipoteses()
{
    if (isset($_SESSION['caso']) && $_SESSION['caso'] != 0) {
        $hip = new Hipoteses();
        $texto = isset($_POST['txtPerguntaGuia']) && $_POST['txtPerguntaGuia'] != "" ? urldecode($_POST['txtPerguntaGuia']) : null;
        $ret = $hip->SalvaPerguntaNorteadora($_SESSION['caso'], $texto);
        if ($ret == false) {
            throw new Exception(Comuns::Idioma("@lng[Erro ao salvar.] ") + $hip->getErro(), 1002);
        }
    } else {
        throw new Exception(Comuns::Idioma("@lng[Caso não encontrado]"), 1003);
    }
}
Example #2
0
function fntRetornaHipoteses()
{
    if (isset($_SESSION['caso']) && $_SESSION['caso'] > 0) {
        $hipoteses = new Hipoteses();
        $lista = $hipoteses->ListaRecordSet($_SESSION['caso']);
        if ($lista != false && count($lista) > 0) {
            $html = Comuns::TopoTabelaListagem("", "tabHipoteses", array(' ', 'Hipótese diagnóstica', 'Correto'));
            foreach ($lista as $hip) {
                $html .= '<tr>';
                $html .= '<td><input type="checkbox" id="chk_hip_' . $hip->CodHipotese . '" class="item_arvore"></td>';
                $html .= '<td><span id="spn_hip_' . $hip->CodHipotese . '">' . $hip->Descricao . '</span></td>';
                $html .= '<td>' . SimNao::Descreve($hip->Correto) . '</td>';
                $html .= '</tr>';
            }
            $html .= "</tbody></table>";
            return $html;
        } else {
            return "@lng[Nenhuma hipótese diagnóstica cadastrada]";
        }
    } else {
        return "@lng[Caso não encontrado]";
    }
}
Example #3
0
function fntDeletaHipoteses()
{
    $t = new Hipoteses();
    $t->setCodcaso($_SESSION['caso']);
    $t->setCodhipotese(base64_decode($_POST['id']));
    if ($t->Deleta()) {
        return "@lng[Hipótese diagnóstica deletada com sucesso!]";
    } else {
        return "ERRO. @lng[Não foi possível excluir a hipótese diagnóstica.] " . $t->getErro();
    }
}
Example #4
0
function fntProcessaDadosHipoteses()
{
    if ($_SESSION['caso'] > 0) {
        $descricao = urldecode($_POST['txtDescricao']);
        $correto = $_POST['selCorreto'];
        $justificativa = stripcslashes(urldecode($_POST['txtJustificativa']));
        $adicional = stripcslashes(urldecode($_POST['txtAdicional']));
        $h = new Hipoteses();
        $h->setCodcaso($_SESSION['caso']);
        if ($descricao != "") {
            $h->setDescricao($descricao);
        }
        if ($correto != "") {
            $h->setCorreto($correto);
        }
        if ($justificativa != "") {
            $h->setJustificativa($justificativa);
        }
        if ($adicional != "") {
            $h->setConteudoadicional($adicional);
        }
        $ret = "";
        if ($_SESSION['hipotese'] > 0) {
            $h->setCodhipotese($_SESSION['hipotese']);
            $ret = $h->Atualiza();
            $_SESSION['hipotese'] = 0;
        } else {
            $ret = $h->Insere();
            $_SESSION['hipotese'] = 0;
        }
        if ($ret == true) {
            echo "OK";
        } else {
            echo $h->getErro();
        }
    }
}
Example #5
0
function TrataDadosHipotesesDlg()
{
    $dados = new HashTable();
    if (isset($_SESSION['caso']) && $_SESSION['caso'] != 0) {
        $h = new Hipoteses();
        $tiporesp = Caso::BuscaConfiguracao($_SESSION['caso'], "hipoteses", "TipoResp");
        if ($_POST['r'] != "") {
            $codhipotese = base64_decode($_POST['r']);
            $_SESSION['hipotese'] = $codhipotese;
            $h->Carrega($_SESSION['caso'], $codhipotese);
            $dados->AddItem("txtDescricao", $h->getDescricao());
            $dados->AddItem("txtJustificativa", $h->getJustificativa());
            $dados->AddItem("txtAdicional", $h->getConteudoadicional());
            if ($tiporesp == "CE") {
                $dados->AddItem("selCorreto", SimNao::SelectSimNao($h->getCorreto()));
            } else {
                if ($tiporesp == "ORD") {
                    $n = $h->getNHipoteses();
                    $opcoes = SelectNumerico::MontaSelect($n, 1, "@lng[Selecione]", $h->getCorreto());
                    $dados->AddItem("selCorreto", $opcoes);
                }
            }
        } else {
            $_SESSION['hipotese'] = 0;
            $dados->AddItem("txtDescricao", "");
            $dados->AddItem("txtJustificativa", "");
            $dados->AddItem("txtAdicional", "");
            if ($tiporesp == "CE") {
                $dados->AddItem("selCorreto", SimNao::SelectSimNao());
            } else {
                if ($tiporesp == "ORD") {
                    $h->setCodcaso($_SESSION['caso']);
                    $n = $h->getNHipoteses() + 1;
                    $dados->AddItem("selCorreto", SelectNumerico::MontaSelect($n, 1, "@lng[Selecione]"));
                }
            }
        }
        return $dados->ToXML();
    } else {
        return "@lng[Erro ao localilzar o caso de estudo]";
    }
}
Example #6
0
 private function BuscaConteudoHipoteses($prefixo, $chave, $tipocaso)
 {
     $hash = new HashTable();
     $hip = new Hipoteses();
     $sql = "select GrupoHipotese, Texto ";
     $sql .= "from mescasohipotdiagnperguntaguia ";
     $sql .= "where CodCaso = :pCodCaso and chave = :pChave;";
     $cnn = Conexao2::getInstance();
     $cmd = $cnn->prepare($sql);
     $cmd->bindParam(":pCodCaso", $this->codigo, PDO::PARAM_INT);
     $cmd->bindParam(":pChave", $chave, PDO::PARAM_STR);
     $cmd->execute();
     $rs = $cmd->fetch(PDO::FETCH_OBJ);
     $pergunta = $rs->Texto;
     $grupohip = $rs->GrupoHipotese;
     //$hip->CarregaPerguntaNorteadora($this->codigo, $chave);
     $hipoteses = $hip->ListaRecordSet($this->codigo, $grupohip);
     if (count($hipoteses) > 0) {
         $conteudo .= '<div class="item-cont">' . $pergunta . "</div>";
         $cont = 0;
         $conteudo .= '<div class="options">';
         foreach ($hipoteses as $reg) {
             $cont++;
             $conteudo .= '<div class="item-option"><label for="chkRespHip_' . $cont . '"><input type="checkbox" name="chkRespHip[]" id="chkRespHip_' . $cont . '" value="' . base64_encode($reg->CodHipotese) . '" onclick="javascript:fntMarcaDesmarca(\'chkRespHip_' . $cont . '\');" class="opcao-resposta" /> ' . $reg->Descricao . '</label></div>';
         }
         $conteudo .= '</div>';
         $conteudo .= '<div class="organizador"></div>';
     } else {
         $conteudo = "Erro";
     }
     $comandos = $this->MontaAcoesVisualizacaoCaso($prefixo, $tipocaso, $chave);
     $hash->AddItem("titulosecao", "@lng[Hipóteses diagnósticas]");
     $hash->AddItem("conteudo", $conteudo);
     $hash->AddItem("menu", $comandos);
     $hash->AddItem("Obrigatorio", true);
     return $hash;
 }