Search in sources :

Example 1 with Examination

use of com.zyf.bean.Examination in project HeartWatchdogJsp by Viczyf.

the class ExaminationServlet method emSingle.

public void emSingle(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ExaminationDao dao = new ExaminationDao();
    HttpSession session = request.getSession();
    int id = MyTools.strToint(request.getParameter("id"));
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    Examination em = dao.emSingle(id, uid);
    System.out.print(em.getUid());
    request.setAttribute("em", em);
    // System.out.print(em.getDate());
    RequestDispatcher rd = request.getRequestDispatcher("examinationsingle.jsp");
    // RequestDispatcher rd = request.getRequestDispatcher("homepage.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) ExaminationDao(com.zyf.dao.ExaminationDao) Examination(com.zyf.bean.Examination) RequestDispatcher(javax.servlet.RequestDispatcher)

Example 2 with Examination

use of com.zyf.bean.Examination in project HeartWatchdogJsp by Viczyf.

the class ExaminationServlet method emList.

public void emList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ExaminationDao dao = new ExaminationDao();
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    List emList = dao.queryList(uid);
    JsonArray array = new JsonArray();
    for (int i = 0; i < emList.size(); i++) {
        Examination em = (Examination) emList.get(i);
        JsonObject ob = new JsonObject();
        ob.addProperty("id", i + 1);
        ob.addProperty("date", em.getDate());
        ob.addProperty("hospital", em.getHospital());
        ob.addProperty("look", "<a href=\"ExaminationServlet?action=single&id=" + em.getId() + "\" target=\"_blank\">查看</a>");
        ob.addProperty("del", "<a href=\"ExaminationServlet?action=del&id=" + em.getId() + "\">删除</a>");
        array.add(ob);
    }
    PrintWriter out = response.getWriter();
    out.print(array);
    System.out.print(array);
}
Also used : JsonArray(com.google.gson.JsonArray) User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) JsonObject(com.google.gson.JsonObject) List(java.util.List) ExaminationDao(com.zyf.dao.ExaminationDao) Examination(com.zyf.bean.Examination) PrintWriter(java.io.PrintWriter)

Example 3 with Examination

use of com.zyf.bean.Examination in project HeartWatchdogJsp by Viczyf.

the class ExaminationServlet method emAdd.

public void emAdd(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ExaminationDao dao = new ExaminationDao();
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    Examination em = new Examination();
    em.setUid(uid);
    em.setName(request.getParameter("name"));
    em.setGender(request.getParameter("gender"));
    int age = MyTools.strToint(request.getParameter("age"));
    em.setAge(age);
    em.setDate(request.getParameter("date"));
    em.setHospital(request.getParameter("hospital"));
    em.setHeight(request.getParameter("height"));
    em.setWeight(request.getParameter("weight"));
    em.setShousuoya(request.getParameter("shousuoya"));
    em.setShuzhangya(request.getParameter("shuzhangya"));
    em.setTizhiCon(request.getParameter("tizhicon"));
    int neike1 = MyTools.strToint(request.getParameter("neike1"));
    em.setNeike1(neike1);
    em.setNeike2(request.getParameter("neike2"));
    em.setNeike3(request.getParameter("neike3"));
    em.setNeike4(request.getParameter("neike4"));
    em.setNeike5(request.getParameter("neike5"));
    em.setNeike6(request.getParameter("neike6"));
    em.setNeike7(request.getParameter("neike7"));
    em.setNeike8(request.getParameter("neike8"));
    em.setNeike9(request.getParameter("neike9"));
    em.setNeike10(request.getParameter("neike10"));
    em.setNeike11(request.getParameter("neike11"));
    em.setNeike12(request.getParameter("neike12"));
    em.setNeikeCon(request.getParameter("neikecon"));
    em.setWaike1(request.getParameter("waike1"));
    em.setWaike2(request.getParameter("waike2"));
    em.setWaike3(request.getParameter("waike3"));
    em.setWaike4(request.getParameter("waike4"));
    em.setWaike5(request.getParameter("waike5"));
    em.setWaike6(request.getParameter("waike6"));
    em.setWaike7(request.getParameter("waike7"));
    em.setWaike8(request.getParameter("waike8"));
    em.setWaike9(request.getParameter("waike9"));
    em.setWaike10(request.getParameter("waike10"));
    em.setWaike11(request.getParameter("waike11"));
    em.setWaike12(request.getParameter("waike12"));
    em.setWaikeCon(request.getParameter("waikecon"));
    em.setYanke1(request.getParameter("yanke1"));
    em.setYanke2(request.getParameter("yanke2"));
    em.setYanke3(request.getParameter("yanke3"));
    em.setYanke4(request.getParameter("yanke4"));
    em.setYanke5(request.getParameter("yanke5"));
    em.setYanke6(request.getParameter("yanke6"));
    em.setYanke7(request.getParameter("yanke7"));
    em.setYanke8(request.getParameter("yanke8"));
    em.setYanke9(request.getParameter("yanke9"));
    em.setYanke10(request.getParameter("yanke10"));
    em.setYankeCon(request.getParameter("yankecon"));
    em.setEr(request.getParameter("er"));
    em.setBi(request.getParameter("bi"));
    em.setYan(request.getParameter("yan"));
    em.setBiantaoti(request.getParameter("biantaoti"));
    em.setHou(request.getParameter("hou"));
    em.setErbihouCon(request.getParameter("erbihoucon"));
    em.setOral1(request.getParameter("oral1"));
    em.setOral2(request.getParameter("oral2"));
    em.setOral3(request.getParameter("oral3"));
    em.setOralCon(request.getParameter("oralcon"));
    em.setEcg1(request.getParameter("ecg1"));
    em.setEcg2(request.getParameter("ecg2"));
    em.setEcg3(request.getParameter("ecg3"));
    em.setEcg4(request.getParameter("ecg4"));
    em.setEcgCon(request.getParameter("ecgcon"));
    em.setBchaoCon(request.getParameter("bchaocon"));
    em.setFangshe1(request.getParameter("fangshe1"));
    em.setFangsheCon(request.getParameter("fangshecon"));
    em.setCancer1(request.getParameter("cancer1"));
    em.setCancer2(request.getParameter("cancer2"));
    em.setCancer3(request.getParameter("cancer3"));
    em.setCancer4(request.getParameter("cancer4"));
    em.setCancer5(request.getParameter("cancer5"));
    em.setCancer6(request.getParameter("cancer6"));
    em.setCancerCon(request.getParameter("cancercon"));
    em.setBlood1(request.getParameter("blood1"));
    em.setBlood2(request.getParameter("blood2"));
    em.setBlood3(request.getParameter("blood3"));
    em.setBlood4(request.getParameter("blood4"));
    em.setBlood5(request.getParameter("blood5"));
    em.setBlood6(request.getParameter("blood6"));
    em.setBlood7(request.getParameter("blood7"));
    em.setBlood8(request.getParameter("blood8"));
    em.setBlood9(request.getParameter("blood9"));
    em.setBlood10(request.getParameter("blood10"));
    em.setBlood11(request.getParameter("blood11"));
    em.setBlood12(request.getParameter("blood12"));
    em.setBlood13(request.getParameter("blood13"));
    em.setBlood14(request.getParameter("blood14"));
    em.setBlood15(request.getParameter("blood15"));
    em.setBlood16(request.getParameter("blood16"));
    em.setBlood17(request.getParameter("blood17"));
    em.setBlood18(request.getParameter("blood18"));
    em.setBlood19(request.getParameter("blood19"));
    em.setBloodCon(request.getParameter("bloodcon"));
    em.setUrine1(request.getParameter("urine1"));
    em.setUrine2(request.getParameter("urine2"));
    em.setUrine3(request.getParameter("urine3"));
    em.setUrine4(request.getParameter("urine4"));
    em.setUrine5(request.getParameter("urine5"));
    em.setUrine6(request.getParameter("urine6"));
    em.setUrine7(request.getParameter("urine7"));
    em.setUrine8(request.getParameter("urine8"));
    em.setUrine9(request.getParameter("urine9"));
    em.setUrine10(request.getParameter("urine10"));
    em.setUrine11(request.getParameter("urine11"));
    em.setUrine12(request.getParameter("urine12"));
    em.setUrine13(request.getParameter("urine13"));
    em.setUrine14(request.getParameter("urine14"));
    em.setUrine15(request.getParameter("urine15"));
    em.setUrine16(request.getParameter("urine16"));
    em.setUrineCon(request.getParameter("urinecon"));
    em.setLiver1(request.getParameter("liver1"));
    em.setLiver2(request.getParameter("liver2"));
    em.setLiver3(request.getParameter("liver3"));
    em.setLiver4(request.getParameter("liver4"));
    em.setLiver5(request.getParameter("liver5"));
    em.setLiver6(request.getParameter("liver6"));
    em.setLiver7(request.getParameter("liver7"));
    em.setLiver8(request.getParameter("liver8"));
    em.setLiver9(request.getParameter("liver9"));
    em.setLiver10(request.getParameter("liver10"));
    em.setLiver11(request.getParameter("liver11"));
    em.setLiver12(request.getParameter("liver12"));
    em.setLiverCon(request.getParameter("livercon"));
    em.setBloodfat1(request.getParameter("bloodfat1"));
    em.setBloodfat2(request.getParameter("bloodfat2"));
    em.setBloodfat3(request.getParameter("bloodfat3"));
    em.setBloodfat4(request.getParameter("bloodfat4"));
    em.setBloodfatCon(request.getParameter("bloodfatcon"));
    em.setKidney1(request.getParameter("kidney1"));
    em.setKidney2(request.getParameter("kidney2"));
    em.setKidney3(request.getParameter("kidney3"));
    em.setKidneyCon(request.getParameter("kidneycon"));
    em.setXuetang1(request.getParameter("xuetang1"));
    em.setXuetangCon(request.getParameter("xuetangcon"));
    em.setSummary(request.getParameter("summary"));
    boolean rs = dao.emAdd(em);
    if (rs) {
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        out.print("<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "    <meta charset=\"UTF-8\">\n" + "    <link href=\"css/sweet-alert.css\" rel=\"stylesheet\">\n" + "</head>\n" + "<body>\n" + "<script src=\"js/jquery-3.1.1.js\"></script>\n" + "<script src=\"js/sweet-alert.min.js\"></script>\n" + "<script type=\"text/javascript\">\n" + "    $(document).ready(function(){\n" + "        swal({\n" + "            type:\"success\",\n" + "            title: \"添加成功\",\n" + "            text: '<a href=\"examination.jsp\" role=\"button\"><font size=\"5\" color=\"green\"> 点此返回</font></a>。<br>3秒后自动返回。',\n" + "            animation:\"slide-from-top\",\n" + "            html: true,\n" + "            timer: 3000,\n" + "            showConfirmButton: false\n" + "        });\n" + "    })\n" + "    window.onload = function(){\n" + "        setTimeout(fun,3000);\n" + "    }\n" + "    function fun(){\n" + "        window.location=\"examination.jsp\"\n" + "        }\n" + "</script>\n" + "</body>\n" + "</html>");
        out.flush();
        out.close();
    } else {
        response.setCharacterEncoding("UTF-8");
        PrintWriter out = response.getWriter();
        out.print("<!DOCTYPE html>\n" + "<html>\n" + "<head>\n" + "    <meta charset=\"UTF-8\">\n" + "    <link href=\"css/sweet-alert.css\" rel=\"stylesheet\">\n" + "</head>\n" + "<body>\n" + "<script src=\"js/jquery-3.1.1.js\"></script>\n" + "<script src=\"js/sweet-alert.min.js\"></script>\n" + "<script type=\"text/javascript\">\n" + "    $(document).ready(function(){\n" + "        swal({\n" + "            type:\"error\",\n" + "            title: \"添加失败\",\n" + "            text: '<a href=\"examination.jsp\" role=\"button\"><font size=\"5\" color=\"green\"> 点此返回</font></a>。<br>3秒后自动返回。',\n" + "            animation:\"slide-from-top\",\n" + "            html: true,\n" + "            timer: 3000,\n" + "            showConfirmButton: false\n" + "        });\n" + "    })\n" + "    window.onload = function(){\n" + "        setTimeout(fun,3000);\n" + "    }\n" + "    function fun(){\n" + "        window.location=\"examination.jsp\"\n" + "        }\n" + "</script>\n" + "</body>\n" + "</html>");
        out.flush();
        out.close();
    }
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) ExaminationDao(com.zyf.dao.ExaminationDao) Examination(com.zyf.bean.Examination) PrintWriter(java.io.PrintWriter)

Example 4 with Examination

use of com.zyf.bean.Examination in project HeartWatchdogJsp by Viczyf.

the class ExaminationDao method emSingle.

public Examination emSingle(int id, int uid) {
    String sql = "select * from examination where id=" + id + " and uid=" + uid;
    ResultSet rs = this.connection.executeQuery(sql);
    Examination em = null;
    try {
        if (rs.next()) {
            em = new Examination();
            em.setId(rs.getInt("id"));
            em.setUid(rs.getInt("uid"));
            em.setName(rs.getString("name"));
            em.setGender(rs.getString("gender"));
            em.setAge(rs.getInt("age"));
            em.setDate(rs.getString("date"));
            em.setHospital(rs.getString("hospital"));
            em.setHeight(rs.getString("height"));
            em.setWeight(rs.getString("weight"));
            em.setShousuoya(rs.getString("shousuoya"));
            em.setShuzhangya(rs.getString("shuzhangya"));
            em.setTizhiCon(rs.getString("tizhicon"));
            em.setNeike1(rs.getInt("neike1"));
            em.setNeike2(rs.getString("neike2"));
            em.setNeike3(rs.getString("neike3"));
            em.setNeike4(rs.getString("neike4"));
            em.setNeike5(rs.getString("neike5"));
            em.setNeike6(rs.getString("neike6"));
            em.setNeike7(rs.getString("neike7"));
            em.setNeike8(rs.getString("neike8"));
            em.setNeike9(rs.getString("neike9"));
            em.setNeike10(rs.getString("neike10"));
            em.setNeike11(rs.getString("neike11"));
            em.setNeike12(rs.getString("neike12"));
            em.setNeikeCon(rs.getString("neikeCon"));
            em.setWaike1(rs.getString("waike1"));
            em.setWaike2(rs.getString("waike2"));
            em.setWaike3(rs.getString("waike3"));
            em.setWaike4(rs.getString("waike4"));
            em.setWaike5(rs.getString("waike5"));
            em.setWaike6(rs.getString("waike6"));
            em.setWaike7(rs.getString("waike7"));
            em.setWaike8(rs.getString("waike8"));
            em.setWaike9(rs.getString("waike9"));
            em.setWaike10(rs.getString("waike10"));
            em.setWaike11(rs.getString("waike11"));
            em.setWaike12(rs.getString("waike12"));
            em.setWaikeCon(rs.getString("waikeCon"));
            em.setYanke1(rs.getString("yanke1"));
            em.setYanke2(rs.getString("yanke2"));
            em.setYanke3(rs.getString("yanke3"));
            em.setYanke4(rs.getString("yanke4"));
            em.setYanke5(rs.getString("yanke5"));
            em.setYanke6(rs.getString("yanke6"));
            em.setYanke7(rs.getString("yanke7"));
            em.setYanke8(rs.getString("yanke8"));
            em.setYanke9(rs.getString("yanke9"));
            em.setYanke10(rs.getString("yanke10"));
            em.setYankeCon(rs.getString("yankeCon"));
            em.setEr(rs.getString("er"));
            em.setBi(rs.getString("bi"));
            em.setYan(rs.getString("yan"));
            em.setBiantaoti(rs.getString("biantaoti"));
            em.setHou(rs.getString("hou"));
            em.setErbihouCon(rs.getString("erbihouCon"));
            em.setOral1(rs.getString("oral1"));
            em.setOral2(rs.getString("oral2"));
            em.setOral3(rs.getString("oral3"));
            em.setOralCon(rs.getString("oralCon"));
            em.setEcg1(rs.getString("ecg1"));
            em.setEcg2(rs.getString("ecg2"));
            em.setEcg3(rs.getString("ecg3"));
            em.setEcg4(rs.getString("ecg4"));
            em.setEcgCon(rs.getString("ecgCon"));
            em.setBchaoCon(rs.getString("bchaoCon"));
            em.setFangshe1(rs.getString("fangshe1"));
            em.setFangsheCon(rs.getString("fangsheCon"));
            em.setCancer1(rs.getString("cancer1"));
            em.setCancer2(rs.getString("cancer2"));
            em.setCancer3(rs.getString("cancer3"));
            em.setCancer4(rs.getString("cancer4"));
            em.setCancer5(rs.getString("cancer5"));
            em.setCancer6(rs.getString("cancer6"));
            em.setCancerCon(rs.getString("cancerCon"));
            em.setBlood1(rs.getString("blood1"));
            em.setBlood2(rs.getString("blood2"));
            em.setBlood3(rs.getString("blood3"));
            em.setBlood4(rs.getString("blood4"));
            em.setBlood5(rs.getString("blood5"));
            em.setBlood6(rs.getString("blood6"));
            em.setBlood7(rs.getString("blood7"));
            em.setBlood8(rs.getString("blood8"));
            em.setBlood9(rs.getString("blood9"));
            em.setBlood10(rs.getString("blood10"));
            em.setBlood11(rs.getString("blood11"));
            em.setBlood12(rs.getString("blood12"));
            em.setBlood13(rs.getString("blood13"));
            em.setBlood14(rs.getString("blood14"));
            em.setBlood15(rs.getString("blood15"));
            em.setBlood16(rs.getString("blood16"));
            em.setBlood17(rs.getString("blood17"));
            em.setBlood18(rs.getString("blood18"));
            em.setBlood19(rs.getString("blood19"));
            em.setBloodCon(rs.getString("bloodCon"));
            em.setUrine1(rs.getString("urine1"));
            em.setUrine2(rs.getString("urine2"));
            em.setUrine3(rs.getString("urine3"));
            em.setUrine4(rs.getString("urine4"));
            em.setUrine5(rs.getString("urine5"));
            em.setUrine6(rs.getString("urine6"));
            em.setUrine7(rs.getString("urine7"));
            em.setUrine8(rs.getString("urine8"));
            em.setUrine9(rs.getString("urine9"));
            em.setUrine10(rs.getString("urine10"));
            em.setUrine11(rs.getString("urine11"));
            em.setUrine12(rs.getString("urine12"));
            em.setUrine13(rs.getString("urine13"));
            em.setUrine14(rs.getString("urine14"));
            em.setUrine15(rs.getString("urine15"));
            em.setUrine16(rs.getString("urine16"));
            em.setUrineCon(rs.getString("urineCon"));
            em.setLiver1(rs.getString("liver1"));
            em.setLiver2(rs.getString("liver2"));
            em.setLiver3(rs.getString("liver3"));
            em.setLiver4(rs.getString("liver4"));
            em.setLiver5(rs.getString("liver5"));
            em.setLiver6(rs.getString("liver6"));
            em.setLiver7(rs.getString("liver7"));
            em.setLiver8(rs.getString("liver8"));
            em.setLiver9(rs.getString("liver9"));
            em.setLiver10(rs.getString("liver10"));
            em.setLiver11(rs.getString("liver11"));
            em.setLiver12(rs.getString("liver12"));
            em.setLiverCon(rs.getString("liverCon"));
            em.setBloodfat1(rs.getString("bloodfat1"));
            em.setBloodfat2(rs.getString("bloodfat2"));
            em.setBloodfat3(rs.getString("bloodfat3"));
            em.setBloodfat4(rs.getString("bloodfat4"));
            em.setBloodfatCon(rs.getString("bloodfatCon"));
            em.setKidney1(rs.getString("kidney1"));
            em.setKidney2(rs.getString("kidney2"));
            em.setKidney3(rs.getString("kidney3"));
            em.setKidneyCon(rs.getString("kidneyCon"));
            em.setXuetang1(rs.getString("xuetang1"));
            em.setXuetangCon(rs.getString("xuetangCon"));
            em.setSummary(rs.getString("summary"));
        }
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return em;
}
Also used : SQLException(java.sql.SQLException) ResultSet(java.sql.ResultSet) Examination(com.zyf.bean.Examination)

Example 5 with Examination

use of com.zyf.bean.Examination in project HeartWatchdogJsp by Viczyf.

the class ExaminationServlet method emEdit.

public void emEdit(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    ExaminationDao dao = new ExaminationDao();
    HttpSession session = request.getSession();
    int id = MyTools.strToint(request.getParameter("id"));
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    Examination em = dao.emSingle(id, uid);
    request.setAttribute("em", em);
    // System.out.print(em.getDate());
    RequestDispatcher rd = request.getRequestDispatcher("examinationmodify.jsp");
    // RequestDispatcher rd = request.getRequestDispatcher("homepage.jsp");
    rd.forward(request, response);
}
Also used : User(com.zyf.bean.User) HttpSession(javax.servlet.http.HttpSession) ExaminationDao(com.zyf.dao.ExaminationDao) Examination(com.zyf.bean.Examination) RequestDispatcher(javax.servlet.RequestDispatcher)

Aggregations

Examination (com.zyf.bean.Examination)7 User (com.zyf.bean.User)5 ExaminationDao (com.zyf.dao.ExaminationDao)5 HttpSession (javax.servlet.http.HttpSession)5 PrintWriter (java.io.PrintWriter)3 ResultSet (java.sql.ResultSet)2 SQLException (java.sql.SQLException)2 RequestDispatcher (javax.servlet.RequestDispatcher)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1