老年人能力评估5

为查看添加了删除按钮,并对目前所有的页面进行了美化
第一个表

<%@ page import="java.util.List" %>
<%@ page import="data.plandata" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查看老年人能力评估基本信息表</title>
    <meta charset="UTF-8">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-image: url("117a94c5-8e45-42c8-947f-6085fb41242b.jpg");
            background-size: cover;
            background-position: center;
        }
        .container {
            background-color: rgba(255, 255, 255, 0.9);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 80%;
            max-width: 800px;
            text-align: center;
        }
        h2 {
            font-size: 1.5em;
            margin-bottom: 20px;
        }
        form {
            margin-bottom: 20px;
        }
        label {
            display: inline-block;
            width: 150px;
            margin-right: 10px;
            font-weight: bold;
        }
        input[type="text"], input[type="submit"] {
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            padding: 10px;
            text-align: left;
            border: 1px solid #ddd;
        }
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tr:hover {
            background-color: #eaeaea;
        }
        .delete-form {
            display: inline-block;
        }
        .delete-form input[type="submit"] {
            background-color: #dc3545;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 6px 12px;
            cursor: pointer;
            margin-left: 10px;
            transition: background-color 0.3s ease;
        }
        .delete-form input[type="submit"]:hover {
            background-color: #c82333;
        }
    </style>
</head>
<body>
<div class="container">
    <h2>查看老年人能力评估基本信息表</h2>
    <form action="checkplan" method="get">
        <label for="date">评估基准日期:</label>
        <input name="date" type="text" id="date">
        <input type="submit" value="查看">
    </form>
    <table>
        <tr>
            <th>评估编号</th>
            <th>评估基准日期</th>
            <th>评估原因</th>
            <th>操作</th>
        </tr>
        <%
            List<plandata> data = (List<plandata>) request.getAttribute("data");
            if (data != null && !data.isEmpty()) {
                for (plandata d : data) { %>
        <tr>
            <td><%= d.getNumber() %></td>
            <td><%= d.getDate() %></td>
            <td><%= d.getReason() %></td>
            <td>
                <form action="deleteplan" method="post" class="delete-form">
                    <input name="number" type="hidden" value="<%= d.getNumber() %>">
                    <input type="submit" value="删除">
                </form>
            </td>
        </tr>
        <% }
        } else { %>
        <tr>
            <td colspan="4" style="text-align:center;">暂无数据</td>
        </tr>
        <% } %>
    </table>
</div>
</body>
</html>

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/deleteplan")
public class deleteplan extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String number = request.getParameter("number");
        Dao dao = new Dao();
        try {
            dao.deleteplan(number);
            response.sendRedirect("checkplan.jsp");
        } catch (SQLException | ClassNotFoundException e) {
            throw new ServletException(e);
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}

第二个表

<%@ page import="java.util.List" %>
<%@ page import="data.peopledata" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查看被评估者的基本信息表</title>
    <meta charset="UTF-8">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-image: url("117a94c5-8e45-42c8-947f-6085fb41242b.jpg");
            background-size: cover;
            background-position: center;
        }
        .container {
            background-color: rgba(255, 255, 255, 0.9);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 80%;
            max-width: 800px;
            text-align: center;
        }
        h2 {
            font-size: 1.5em;
            margin-bottom: 20px;
        }
        form {
            margin-bottom: 20px;
        }
        label {
            display: inline-block;
            width: 150px;
            margin-right: 10px;
            font-weight: bold;
        }
        input[type="text"], input[type="submit"] {
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            padding: 10px;
            text-align: left;
            border: 1px solid #ddd;
        }
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tr:hover {
            background-color: #eaeaea;
        }
        .delete-form {
            display: inline-block;
        }
        .delete-form input[type="submit"] {
            background-color: #dc3545;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 6px 12px;
            cursor: pointer;
            margin-left: 10px;
            transition: background-color 0.3s ease;
        }
        .delete-form input[type="submit"]:hover {
            background-color: #c82333;
        }
    </style>
</head>
<body>
<form action="checkpeople" method="get">
    <label for="number">评估编号:</label>
    <input name="number" type="text" id="number"><br>

    <input type="submit" value="查看">
</form>
<table border="1">
    <tr>
        <th>姓名</th>
        <th>性别</th>
        <th>出生日期</th>
        <th>身份证号</th>
        <th>社保卡号</th>
        <th>民族</th>
        <th>文化程度</th>
        <th>宗教信仰</th>
        <th>婚姻状况</th>
        <th>居住情况</th>
        <th>医疗费用支付方式</th>
        <th>经济来源</th>
        <th>痴呆</th>
        <th>精神疾病</th>
        <th>慢性疾病</th>
        <th>跌倒</th>
        <th>走失</th>
        <th>噎食</th>
        <th>自杀</th>
        <th>其他</th>
    </tr>
    <%
        List<peopledata> data=(List<peopledata>) request.getAttribute("data");
        if(data.size()>0)
            for(peopledata d:data){%>
    <tr>
        <td><%=d.getName()%></td>
        <td><%=d.getSex()%></td>
        <td><%=d.getBirthday()%></td>
        <td><%=d.getIdnumber()%></td>
        <td><%=d.getSocialid()%></td>
        <td><%=d.getNation()%></td>
        <td><%=d.getEducation()%></td>
        <td><%=d.getReligion()%></td>
        <td><%=d.getMarriage()%></td>
        <td><%=d.getReside()%></td>
        <td><%=d.getMedical()%></td>
        <td><%=d.getIncome()%></td>
        <td><%=d.getStupid()%></td>
        <td><%=d.getMental()%></td>
        <td><%=d.getChronic()%></td>
        <td><%=d.getTumble()%></td>
        <td><%=d.getLost()%></td>
        <td><%=d.getDysphoria()%></td>
        <td><%=d.getSuicide()%></td>
        <td><%=d.getOther()%></td>
        <td>
            <form action="deletepeople" method="post" class="delete-form">
                <input name="number" type="hidden" value=<%=d.getNumber()%> >

                <input type="submit" value="删除">
            </form>
        </td>
    </tr>
            <%}
    %>
</table>
</body>
</html>

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/deletepeople")
public class deletepeople extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String number = request.getParameter("number");
        Dao dao = new Dao();
        try {
            dao.deletepeople(number);
            response.sendRedirect("checkpeople.jsp");
        } catch (SQLException | ClassNotFoundException e) {
            throw new ServletException(e);
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}

第三个表

<%@ page import="java.util.List" %>
<%@ page import="data.informatdata" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>查看信息提供者及联系人信息表</title>
    <meta charset="UTF-8">
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-image: url("117a94c5-8e45-42c8-947f-6085fb41242b.jpg");
            background-size: cover;
            background-position: center;
        }
        .container {
            background-color: rgba(255, 255, 255, 0.9);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 80%;
            max-width: 800px;
            text-align: center;
        }
        h2 {
            font-size: 1.5em;
            margin-bottom: 20px;
        }
        form {
            margin-bottom: 20px;
        }
        label {
            display: inline-block;
            width: 150px;
            margin-right: 10px;
            font-weight: bold;
        }
        input[type="text"], input[type="submit"] {
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-sizing: border-box;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }
        th, td {
            padding: 10px;
            text-align: left;
            border: 1px solid #ddd;
        }
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tr:hover {
            background-color: #eaeaea;
        }
        .delete-form {
            display: inline-block;
        }
        .delete-form input[type="submit"] {
            background-color: #dc3545;
            color: white;
            border: none;
            border-radius: 4px;
            padding: 6px 12px;
            cursor: pointer;
            margin-left: 10px;
            transition: background-color 0.3s ease;
        }
        .delete-form input[type="submit"]:hover {
            background-color: #c82333;
        }
    </style>
</head>
<body>
<form action="checkinformat" method="get">
    <label for="checknumber">评估编号:</label>
    <input name="number" type="text" id="checknumber"><br>

    <input type="submit" value="查看">
</form>
<table border="1">
    <tr>
        <th>信息提供者的姓名</th>
        <th>信息提供者与老人的关系</th>
        <th>联系人姓名</th>
        <th>联系人电话</th>
    </tr>
    <%
        List<informatdata> data=(List<informatdata>)request.getAttribute("data");
        if(data.size()>0)
            for(informatdata d:data){%>
    <tr>
        <td><%=d.getName()%></td>
        <td><%=d.getRelation()%></td>
        <td><%=d.getContacts()%></td>
        <td><%=d.getPhone()%></td>
        <td>
            <form action="deleteinformat" method="post" class="delete-form">
                <input name="number" type="text" value=<%=d.getNumber()%>>

                <input type="submit" value="删除">
            </form>
        </td>
    </tr>
        <%}
    %>
</table>
</body>
</html>

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/deleteinformat")
public class deleteinformat extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String number = request.getParameter("number");
        Dao dao = new Dao();
        try {
            dao.deleteinformat(number);
            response.sendRedirect("checkinformat.jsp");
        } catch (SQLException | ClassNotFoundException e) {
            throw new ServletException(e);
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}

背景示例




posted @ 2025-02-05 22:42  sword_kong  阅读(22)  评论(0)    收藏  举报