Search in sources :

Example 1 with User

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

the class UserDao method login.

/**
 * 用户登录
 *
 * @param username 用户名
 * @param password 密码
 * @return 用户对象
 */
public User login(String username, String password) {
    String sql = "select * from users where uname='" + username + "' and passwd='" + password + "'";
    ResultSet rs = this.connection.executeQuery(sql);
    try {
        if (rs != null && rs.next()) {
            user = new User();
            user.setUid(rs.getInt("uid"));
            user.setUname(rs.getString("uname"));
            user.setPasswd(rs.getString("passwd"));
            user.setEmail(rs.getString("email"));
            user.setPhone(rs.getString("phone"));
            user.setLastLogin(rs.getString("lastlogin"));
            user.setGender(rs.getString("gender"));
            user.setAge(rs.getString("age"));
            user.setAddr(rs.getString("addr"));
            user.setWeight(rs.getString("weight"));
            user.setHeight(rs.getString("height"));
            user.setIden(rs.getString("iden"));
            user.setNationality(rs.getString("nationality"));
            user.setCompany(rs.getString("company"));
            user.setEdu(rs.getString("edu"));
            user.setJob(rs.getString("job"));
            user.setMarry(rs.getString("marry"));
            user.setBloodtype(rs.getString("bloodtype"));
            user.setSelfevaluate(rs.getString("selfevaluate"));
            user.setMentality(rs.getString("mentality"));
            user.setAllergy(rs.getString("allergy"));
            user.setDesease1(rs.getString("desease1"));
            user.setDesease2(rs.getString("desease2"));
            user.setDesease3(rs.getString("desease3"));
            user.setDeseasemore(rs.getString("deseasemore"));
            user.setDtime1(rs.getString("dtime1"));
            user.setDtime2(rs.getString("dtime2"));
            user.setDtime3(rs.getString("dtime3"));
            user.setOperation1(rs.getString("operation1"));
            user.setOperation2(rs.getString("operation2"));
            user.setOperation3(rs.getString("operation3"));
            user.setOperationmore(rs.getString("operationmore"));
            user.setOtime1(rs.getString("otime1"));
            user.setOtime2(rs.getString("otime2"));
            user.setOtime3(rs.getString("otime3"));
            user.setF1desease(rs.getString("f1desease"));
            user.setF2desease(rs.getString("f2desease"));
            user.setF3desease(rs.getString("f3desease"));
            user.setF4desease(rs.getString("f4desease"));
            user.setInheridesease(rs.getString("inheridesease"));
            user.setExefre(rs.getString("exefre"));
            user.setExeway(rs.getString("exeway"));
            user.setExetime(rs.getString("exetime"));
            user.setEathabit(rs.getString("eathabit"));
            user.setSmokestatus(rs.getString("smokestatus"));
            user.setSmokeamount(rs.getString("smokeamount"));
            user.setIsdrink(rs.getString("isdrink"));
            user.setDrinkamount(rs.getString("drinkamount"));
            user.setDrinkfre(rs.getString("drinkfre"));
            user.setSleepstatus(rs.getString("sleepstatus"));
            user.setSleeptime(rs.getString("sleeptime"));
            user.setJobmaterial(rs.getString("jobmaterial"));
            user.setIsjobprotect(rs.getString("isjobprotect"));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return user;
}
Also used : User(com.zyf.bean.User) ResultSet(java.sql.ResultSet) SQLException(java.sql.SQLException)

Example 2 with User

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

the class BloodpressureServlet method select_time_bloodpressure.

private void select_time_bloodpressure(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    BloodPressureDao bloodPressureDao = new BloodPressureDao();
    String startdate = request.getParameter("startdate");
    String enddate = request.getParameter("enddate");
    HttpSession session = request.getSession();
    User user = (User) session.getAttribute("user");
    int uid = user.getUid();
    System.out.println("uid" + uid);
    List bpList = bloodPressureDao.queryTimeBloodPressure(uid, startdate, enddate);
    System.out.println(bpList.size());
    JsonArray array = new JsonArray();
    for (int i = 0; i < bpList.size(); i++) {
        BloodPressure bp = (BloodPressure) bpList.get(i);
        JsonObject ob = new JsonObject();
        ob.addProperty("id", i + 1);
        ob.addProperty("date", bp.getDate());
        ob.addProperty("highPressure", bp.getHighpressure());
        ob.addProperty("lowPressure", bp.getLowpressure());
        ob.addProperty("xinlv", bp.getXinlv());
        array.add(ob);
    }
    System.out.println(array);
    PrintWriter out = response.getWriter();
    out.print(array);
}
Also used : JsonArray(com.google.gson.JsonArray) BloodPressure(com.zyf.bean.BloodPressure) User(com.zyf.bean.User) BloodPressureDao(com.zyf.dao.BloodPressureDao) HttpSession(javax.servlet.http.HttpSession) JsonObject(com.google.gson.JsonObject) List(java.util.List) PrintWriter(java.io.PrintWriter)

Example 3 with User

use of com.zyf.bean.User 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 4 with User

use of com.zyf.bean.User 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 5 with User

use of com.zyf.bean.User 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)

Aggregations

User (com.zyf.bean.User)53 HttpSession (javax.servlet.http.HttpSession)51 RequestDispatcher (javax.servlet.RequestDispatcher)28 List (java.util.List)18 PrintWriter (java.io.PrintWriter)17 JsonObject (com.google.gson.JsonObject)12 JsonArray (com.google.gson.JsonArray)11 InfoDao (com.zyf.dao.InfoDao)9 Info (com.zyf.bean.Info)7 ExaminationDao (com.zyf.dao.ExaminationDao)7 Info24 (com.zyf.bean.Info24)6 Info24Dao (com.zyf.dao.Info24Dao)6 RelaDao (com.zyf.dao.RelaDao)6 UserDao (com.zyf.dao.UserDao)6 Examination (com.zyf.bean.Examination)5 MedicalhistoryDao (com.zyf.dao.MedicalhistoryDao)5 Medicalhistory (com.zyf.bean.Medicalhistory)4 Urine (com.zyf.bean.Urine)4 FileDao (com.zyf.dao.FileDao)4 UrineDao (com.zyf.dao.UrineDao)4