Search in sources :

Example 6 with ExaminationDao

use of com.zyf.dao.ExaminationDao 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)

Example 7 with ExaminationDao

use of com.zyf.dao.ExaminationDao in project HeartWatchdogJsp by Viczyf.

the class ExaminationServlet method emModify.

public void emModify(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 = new Examination();
    em.setId(id);
    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.emModify(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)

Aggregations

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