--- /dev/null
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.ufcspa.simdecs.comunicacao;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author maroni
+ */
+public class MetodoGravaLog extends HttpServlet {
+
+ /**
+ * Processes requests for both HTTP
+ * <code>GET</code> and
+ * <code>POST</code> methods.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ response.setContentType("text/html;charset=UTF-8");
+ PrintWriter out = response.getWriter();
+ try {
+ } finally {
+ out.close();
+ }
+ }
+
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+ /**
+ * Handles the HTTP
+ * <code>GET</code> method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP
+ * <code>POST</code> method.
+ *
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ *
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }// </editor-fold>
+}
if (!nodo.getNodo().getTipo().equals(Nodo.SINAL_SINTOMA))
continue;
- out.println(" <sintoma uid=\"sintoma-" + nodo.getId() + "\" nomeCientifico=\"" + nodo.getNodo().getNome() + "\" nomePopular=\"" + nodo.getNodo().getNomeAmigavel() + "\" imagem=\"\" som=\"\" video=\"\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" falaPaciente=\"" + getPerguntaNodo(nodo.getNodo().getId()) + "\">");
+ out.println(" <sintoma uid=\"sintoma-" + nodo.getId() + "\" nomeCientifico=\"" + nodo.getNodo().getNome() + "\" nomePopular=\"" + nodo.getNodo().getNomeAmigavel() + "\" imagem=\"\" som=\"\" video=\"\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" falaPaciente=\"" + getPerguntaNodo(nodo.getNodo().getId()) + "\" />");
}
out.println(" </perguntar_sintoma>");
if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_FISICO))
continue;
- out.println(" <exame_fisico uid=\"exame-fisico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\">");
+ out.println(" <exame_fisico uid=\"exame-fisico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\" />");
}
out.println(" </realiza_exame_fisico>");
if (!nodo.getNodo().getTipo().equals(Nodo.EXAME_COMPLEMENTAR))
continue;
- out.println(" <exame_complementar uid=\"exame-complementar-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\">");
+ out.println(" <exame_complementar uid=\"exame-complementar-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"" + nodo.getNodo().getNomeAmigavel() + "\" resultado=\"\" imagem=\"\" som=\"\" video=\"\" />");
}
out.println(" </solicitar_exames_complementar>");
if (!nodo.getNodo().getTipo().equals(Nodo.HISTORICO))
continue;
- out.println(" <historico_medico uid=\"historico-medico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"Histórico Médico\" historico=\"" + nodo.getNodo().getNomeAmigavel() + "\" dependencia=\"\" imagem=\"\" som=\"\" video=\"\">");
+ out.println(" <historico_medico uid=\"historico-medico-" + nodo.getId() + "\" dependencia=\"" + getDependencia(nodo.getNodo().getId()) + "\" descricao=\"Histórico Médico\" historico=\"" + nodo.getNodo().getNomeAmigavel() + "\" dependencia=\"\" imagem=\"\" som=\"\" video=\"\" />");
}
+++ /dev/null
-/*\r
- * To change this template, choose Tools | Templates\r
- * and open the template in the editor.\r
- */\r
-package org.ufcspa.simdecs.comunicacao;\r
-\r
-\r
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import java.text.ParseException;\r
-import java.util.Date;\r
-import java.util.logging.Level;\r
-import java.util.logging.Logger;\r
-import javax.persistence.EntityManager;\r
-import javax.persistence.EntityManagerFactory;\r
-import javax.persistence.NoResultException;\r
-import javax.persistence.Persistence;\r
-import javax.servlet.ServletException;\r
-import javax.servlet.http.HttpServlet;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import javax.servlet.http.HttpSession;\r
-import org.ufcspa.simdecs.util.UtilitarioSql;\r
-import org.ufcspa.simdecs.entities.TipoEventoLog;\r
-\r
-/**\r
- *\r
- * @author pbarros\r
- */\r
-public class MetodoParaGravarLog extends HttpServlet {\r
-\r
- /**\r
- * Processes requests for both HTTP\r
- * <code>GET</code> and\r
- * <code>POST</code> methods.\r
- *\r
- * @param request servlet request\r
- * @param response servlet response\r
- * @throws ServletException if a servlet-specific error occurs\r
- * @throws IOException if an I/O error occurs\r
- */\r
- \r
- protected void processRequest(HttpServletRequest request, HttpServletResponse response)\r
- throws ServletException, IOException, ParseException {\r
- HttpSession session = request.getSession(true);\r
- session.getId();\r
-\r
- Date dt = new Date();\r
- Long idLong = new Long(request.getParameter("id"));\r
- Long paramTipoLog = new Long(request.getParameter("tipoLog"));\r
- UtilitarioSql util = new UtilitarioSql();\r
- PrintWriter out = response.getWriter();\r
- //response.setContentType("text/html;charset=UTF-8");\r
- /*\r
- * \r
- * 1 Iniciar simulador\r
- * 2 Caso \r
- * 3 Ficha do paciente \r
- * 4 Sinais / Sintomas \r
- * 5 Exames complementares \r
- * 6 Diagnóstico \r
- * 7 Tratamento \r
- * 8 Auxílio pedagógico \r
- * 9 Intervenção do Mediador \r
- */ \r
- response.setContentType( "text/xml" );\r
- response.setHeader( "Cache-Control", "no-cache" );\r
- out.println( "<xml>" );\r
- \r
- EntityManagerFactory emf = Persistence.createEntityManagerFactory("simdecsPU");\r
- EntityManager em = emf.createEntityManager();\r
- em.getTransaction().begin();\r
- //Log lg = new Log();\r
- TipoEventoLog tipo;\r
- \r
- try {\r
- tipo = (TipoEventoLog) em.createQuery("select tipo from TipoEventoLog as tp where tp.id=:idTipo")\r
- .setParameter("idTipo", paramTipoLog)\r
- .getSingleResult();\r
- \r
- // System.out.print(tipo.getId());\r
- System.out.print(tipo.getNome());\r
-// lg.setDatalog(util.converteDataUtilToSql(dt)); \r
-// lg.setDescricaolog(request.getParameter("log"));\r
-// lg.setTipo(tipo);\r
-// lg.setHoralog(dt);\r
-// lg.setUsuid(idLong);\r
- }catch (NoResultException ne){\r
- out.printf("Erro de tipo");\r
- } finally {\r
- // em.persist(tipo);\r
- //em.persist(lg);\r
- em.getTransaction().commit();\r
- }\r
-/*\r
- RespostaMediador resp;\r
- try {\r
- em.getTransaction().begin();\r
- resp = (RespostaMediador) em.createQuery("select resposta from RespostaMediador as resposta where resposta.idUsuario=:id and resposta.dataResposta is null" )\r
- .setParameter("id", idLong)\r
- //.setParameter("data",dtNull )\r
- .getSingleResult();\r
- if(resp.getId()>0)\r
- {\r
- out.println( "<id>" + String.valueOf(resp.getId()) + "</id>" );\r
- out.println("<resposta>" + resp.getNome() + "</resposta>");\r
- out.println("<arquivo>" + resp.getEndArquivo() + "</arquivo>");\r
- resp.setDataResposta(util.converteDataUtilToSql(dt));\r
- }\r
- else \r
- {\r
- out.println( "<id>0</id>" );\r
- out.println("<resposta></resposta>");\r
- out.println("<arquivo></arquivo>");\r
- }\r
-// out.println("OK "+ user.getId());\r
-// out.close();\r
- } catch (NoResultException ne) {\r
- \r
-// request.setAttribute("id","0"); \r
-// out.println("Usuario ou senha Inválido ");\r
- out.println( "<id>" + "0" + "</id>" );\r
- \r
- } finally { \r
- //em.persist(lg);\r
- em.getTransaction().commit();\r
- out.println( "</xml>" );\r
- out.close();\r
- }\r
- \r
-*/\r
- }\r
-\r
- // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">\r
- /**\r
- * Handles the HTTP\r
- * <code>GET</code> method.\r
- *\r
- * @param request servlet request\r
- * @param response servlet response\r
- * @throws ServletException if a servlet-specific error occurs\r
- * @throws IOException if an I/O error occurs\r
- */\r
-\r
-\r
- /**\r
- * Handles the HTTP\r
- * <code>POST</code> method.\r
- *\r
- * @param request servlet request\r
- * @param response servlet response\r
- * @throws ServletException if a servlet-specific error occurs\r
- * @throws IOException if an I/O error occurs\r
- */\r
- @Override\r
- protected void doPost(HttpServletRequest request, HttpServletResponse response)\r
- throws ServletException, IOException {\r
- try {\r
- processRequest(request, response);\r
- } catch (ParseException ex) {\r
- Logger.getLogger(MetodoParaGravarLog.class.getName()).log(Level.SEVERE, null, ex);\r
- }\r
- }\r
-\r
- /**\r
- * Returns a short description of the servlet.\r
- *\r
- * @return a String containing servlet description\r
- */\r
- @Override\r
- public String getServletInfo() {\r
- return "Short description";\r
- }// </editor-fold>\r
-}\r