老年人评估系统-6

下面是第三个功能:能力数据统计
mysql语句如下

点击查看代码
create table ability(
    number varchar(20),
    daily varchar(10),
    mental varchar(10),
    feel varchar(10),
    publics varchar(10),
    ability1 varchar(10),
    changing varchar(10),
    ability2 varchar(10),
    auditor1 varchar(10),
    auditor2 varchar(10),
    provider varchar(10),
    date varchar(10)
);
ability的存储结构
点击查看代码
package work.pojo;

public class ability {
    private String number;
    private String daily;
    private String mental;
    private String feel;
    private String publics;
    private String ability1;
    private String changing;
    private String ability2;
    private String auditor1;
    private String auditor2;
    private String provider;
    private String date;

    @Override
    public String toString() {
        return "ability{" +
                "number='" + number + '\'' +
                ", daily='" + daily + '\'' +
                ", mental='" + mental + '\'' +
                ", feel='" + feel + '\'' +
                ", publics='" + publics + '\'' +
                ", ability1='" + ability1 + '\'' +
                ", changing='" + changing + '\'' +
                ", ability2='" + ability2 + '\'' +
                ", auditor1='" + auditor1 + '\'' +
                ", auditor2='" + auditor2 + '\'' +
                ", provider='" + provider + '\'' +
                ", date='" + date + '\'' +
                '}';
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getDaily() {
        return daily;
    }

    public void setDaily(String daily) {
        this.daily = daily;
    }

    public String getMental() {
        return mental;
    }

    public void setMental(String mental) {
        this.mental = mental;
    }

    public String getFeel() {
        return feel;
    }

    public void setFeel(String feel) {
        this.feel = feel;
    }

    public String getAbility1() {
        return ability1;
    }

    public void setAbility1(String ability1) {
        this.ability1 = ability1;
    }

    public String getPublics() {
        return publics;
    }

    public void setPublics(String publics) {
        this.publics = publics;
    }

    public String getChanging() {
        return changing;
    }

    public void setChanging(String changing) {
        this.changing = changing;
    }

    public String getAbility2() {
        return ability2;
    }

    public void setAbility2(String ability2) {
        this.ability2 = ability2;
    }

    public String getAuditor1() {
        return auditor1;
    }

    public void setAuditor1(String auditor1) {
        this.auditor1 = auditor1;
    }

    public String getAuditor2() {
        return auditor2;
    }

    public void setAuditor2(String auditor2) {
        this.auditor2 = auditor2;
    }

    public String getProvider() {
        return provider;
    }

    public void setProvider(String provider) {
        this.provider = provider;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }
}

ability.html
点击查看代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>能力数据统计</title>
    <style>
        body {
            background-color: rgba(220, 220, 220, 0.32);
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
        }
        a {
            display: inline-block;
            width: 300px;
            height: 80px;
            background-color: dodgerblue;
            color: white;
            text-decoration: none;
            text-align: center;
            line-height: 80px;
            font-size: 20px;
            margin: 5px;
            border-radius: 8px;
        }
        a:hover {
            background-color: lightskyblue;
        }
        .select {
            background-color: lightskyblue;
        }
        .search-container {
            position: absolute;
            top: 10px;
            right: 10px;
        }
        .search-container input[type="text"] {
            padding: 8px;
            font-size: 16px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .search-container button {
            padding: 8px;
            font-size: 16px;
            background-color: dodgerblue;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .search-container button:hover {
            background-color: lightskyblue;
        }
        form {
            max-width: 1000px;
            margin: 0 auto;
            padding: 20px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }
        h1, h2 {
            text-align: center;
            color: #333;
        }
        h1 {
            font-size: 28px;
            margin-bottom: 20px;
        }
        h2 {
            font-size: 24px;
            margin-top: 30px;
            margin-bottom: 15px;
        }


        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            background-color: white;
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        th, td {
            padding: 15px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
        th {
            background-color: #f8f9fa;
            color: #333;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tr:hover {
            background-color: #f1f1f1;
        }
        input[type="text"], input[type="radio"], input[type="checkbox"] {
            margin-right: 10px;
        }
        input[type="text"] {
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
            width: 100%;
            max-width: 300px;
        }
        input[type="submit"] {
            padding: 10px 20px;
            background-color: dodgerblue;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            display: block;
            margin: 20px auto;
        }
        input[type="submit"]:hover {
            background-color: lightskyblue;
        }
        label {
            display: block;
            margin: 5px 0;
        }
    </style>
</head>
<body>
<div class="div1">
    <img src="https://www.jkheb2030.org.cn/Content/peixun/img/logo.png">
</div>
<div class="search-container">
    <input type="text" placeholder="搜索..." name="search" id="search">
    <button type="submit">搜索</button>
</div>
<a  href="informationadd.html">老年人信息导入</a>
<a href="assessment1.html">老年人能力定期评估</a>
<a href="select1.html">能力评估数据多条件查询</a>
<a class="select">能力数据统计</a>
<a href="enter.html">能力数据导出</a>

<form action="/work-demo/abilityadd" method="post">
    <h1>能力数据统计</h1>
    <h2>老年人能力评估报告</h2>
    <hr>
    <p>请输入老人身份证号码:<input type="text" name="number" id="number"></p>
    <hr>
    <table>
        <h3>一级指标分级</h3>

        <tr>
            <th>日常生活活动</th>
            <td><input type="number" id="daily" name="daily"></td>
        </tr>
        <tr>
            <th>精神状态</th>
            <td><input type="number" id="mental" name="mental"></td>
        </tr>
        <th>感知觉与沟通</th>
        <td><input type="number" id="feel" name="feel"></td>
        </tr>
        <th>社会参与</th>
        <td><input type="number" id="publics" name="publics"></td>
        </tr>
    </table>
    <h3>老年人能力初步等级</h3>
    <h4>0 能力完好:</h4>
    <p>日常生活活动、精神状态、感知觉与沟通分级均为 0,社会参与分级为 0 或 1</p>
    <h4>1 轻度失能:</h4>
    <p>日常生活活动分级为 0,但精神状态、感知觉与沟通中至少一项分级为 1 及以上,或社会参与的分级为 2;</p>
    <p>或日常生活活动分级为 1,精神状态、感知觉与沟通、社会参与中至少有一项的分级为 0 或 1 </p>
    <h4>2 中度失能:</h4>
    <p>日常生活活动分级为 1,但精神状态、感知觉与沟通、社会参与均为 2,或有一项为 3; </p>
    <p>或日常生活活动分级为 2,且精神状态、感知觉与沟通、社会参与中有 1-2 项的分级为 1 或 2</p>
    <h4>3 重度失能:</h4>
    <p>日常生活活动的分级为 3;</p>
    <p>或日常生活活动、精神状态、感知觉与沟通、社会参与分级均为 2;</p>
    <p>或日常生活活动分级为 2,且精神状态、感知觉与沟通、社会参与中至少有一项分级为 3 </p>
    <table>
        <tr>
            <th>0 能力完好   1 轻度失能   2 中度失能   3 重度失能</th>
        <td><input type="number" id="ability1" name="ability1"></td>
        </tr>
    </table>
    <h3>等级变更条款</h3>
    <p>0 无以下情况</p>
    <p>1 有认知障碍/痴呆、精神疾病者,在原有能力级别上提高一个等级; </p>
    <p>2 近 30 天内发生过 2 次及以上跌倒、噎食、自杀、走失者,在原有能力级别上提高一个等级; </p>
    <p>3 处于昏迷状态者,直接评定为重度失能;</p>
    <p>4 若初步等级确定为“3 重度失能”,则不考虑上述 1-3 中各情况对最终等级的影响,等级不再提高 </p>
    <table>
        <tr>
            <th>请输入等级变更情况</th>
            <td><input type="number" id="changing" name="changing"></td>
        </tr>
    </table>
    <h3>老年人能力最终等级</h3>
    <table>
        <tr>
            <th>0 能力完好 1 轻度失能 2 中度失能 3 重度失能 </th>
            <td><input type="number" id="ability2" name="ability2"></td>
        </tr>
    </table>
    <table>
        <tr>
            <th>评估员1签名:</th>
            <td><input type="text" name="auditor1" id="auditor1"></td>
        </tr>
    <tr>
        <th>评估员2签名:</th>
        <td><input type="text" name="auditor2" id="auditor2"></td>
    </tr>
    <tr>
        <th>信息提供者签名:</th>
        <td><input type="text" name="provider" id="provider"></td>
    </tr>
    <tr>
        <th>日期:</th>
        <td><input type="date" name="date" id="date"></td>
    </tr>
    </table>
    <br>
    <input type="submit" class="submit" value="提交">
</form>
</body>
</html>
abilityadd.java
点击查看代码
package work.web;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import work.mapper.UserMapper;

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.io.InputStream;
import java.io.Writer;

@WebServlet("/abilityadd")
public class abilityadd extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8"); // 解决乱码问题
        resp.setContentType("text/html;charset=utf-8");
        String number = req.getParameter("number");
        String daily = req.getParameter("daily");
        String mental = req.getParameter("mental");
        String feel= req.getParameter("feel");
        String publics = req.getParameter("publics");
        String ability1 = req.getParameter("ability1");
        String changing = req.getParameter("changing");
        String ability2 = req.getParameter("ability2");
        String auditor1 = req.getParameter("auditor1");
        String auditor2 = req.getParameter("auditor2");
        String provider = req.getParameter("provider");
        String date= req.getParameter("date");
        String resource = "mybatis-config.xml";
        InputStream inputStream = Resources.getResourceAsStream(resource);
        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
        SqlSession sqlSession = sqlSessionFactory.openSession();
        UserMapper usermapper = sqlSession.getMapper(UserMapper.class);
        int i=usermapper.abilityadd(number,daily,mental,feel,publics,ability1,changing,ability2,auditor1,auditor2,provider,date);
        Writer writer=resp.getWriter();
        sqlSession.commit();
        sqlSession.close();
        if(i>0){
            writer.write("<html><body>");
            writer.write("<form id='redirectForm' action='/work-demo/enter' method='post'>");
            writer.write("<input type='hidden' name='number' value='" + number + "' />");
            writer.write("</form>");
            writer.write("<script type='text/javascript'>");
            writer.write("document.getElementById('redirectForm').submit();");
            writer.write("</script>");
            writer.write("</body></html>");
        }else  writer.write("<html><body>");
        writer.write("<p>请重新填写...</p>");
        writer.write("<script type='text/javascript'>");
        writer.write("setTimeout(function() { window.location.href = './ability.html'; }, 3000);");
        writer.write("</script>");
        writer.write("</body></html>");
    }
}

posted on   睡觉时候不困  阅读(3)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
点击右上角即可分享
微信分享提示