今日总结——老年人评估2
今天已经把会建的表基本写好了,又赶了赶进度,这次的代码还没测试
create table user(
id char(18),
password char(18),
type varchar(18)
)
CREATE TABLE basic (
number VARCHAR(255) NOT NULL,
date DATE NOT NULL,
reason TEXT
);
CREATE TABLE people (
name VARCHAR(255) NOT NULL,
sex VARCHAR(10),
birthday DATE,
idnumber VARCHAR(20) UNIQUE,
socialid VARCHAR(20),
nation VARCHAR(50),
education VARCHAR(50),
religion VARCHAR(50),
marriage VARCHAR(20),
reside VARCHAR(50),
medical VARCHAR(255),
income VARCHAR(255),
stupid VARCHAR(50),
mental VARCHAR(50),
chronic VARCHAR(50),
tumble VARCHAR(50),
lost VARCHAR(50),
dysphoria VARCHAR(50),
suicide VARCHAR(50),
other VARCHAR(255),
number VARCHAR(20)
);
CREATE TABLE information (
name VARCHAR(255) NOT NULL,
relation VARCHAR(50),
contacts VARCHAR(255),
phone VARCHAR(20),
number VARCHAR(20),
idnumber VARCHAR(20)
);
CREATE TABLE daily (
eat INT,
bath INT,
wash INT,
cloth INT,
stool INT,
urinal INT,
toilet INT,
move INT,
walk INT,
floor INT,
total INT,
level INT,
number VARCHAR(20),
idnumber VARCHAR(20)
);
CREATE TABLE mind (
cognition INT NOT NULL,
attack INT,
depression,
total INT,
level INT,
number VARCHAR(255),
idnumber VARCHAR(255)
);
CREATE TABLE feel (
consciousness INT NOT NULL,
vision INT NOT NULL,
hearing INT NOT NULL,
communication INT NOT NULL,
level INT NOT NULL,
number VARCHAR(255) NOT NULL,
idnumber VARCHAR(255) NOT NULL
);
CREATE TABLE social (
live INT NOT NULL,
work INT NOT NULL,
timespace INT NOT NULL,
relation INT NOT NULL,
socialing INT NOT NULL,
total INT NOT NULL,
level INT NOT NULL,
number VARCHAR(255) NOT NULL,
idnumber VARCHAR(255) NOT NULL
);
CREATE TABLE summary (
level1 INT NOT NULL,
level2 INT NOT NULL,
level3 INT NOT NULL,
level4 INT NOT NULL,
level5 INT NOT NULL,
level6 INT NOT NULL,
level7 INT NOT NULL,
name1 VARCHAR(255) NOT NULL,
name2 VARCHAR(255) NOT NULL,
date1 DATE NOT NULL,
name3 VARCHAR(255) NOT NULL,
date2 DATE NOT NULL,
idnumber VARCHAR(255) NOT NULL,
number VARCHAR(255) NOT NULL
);
我想着利用idnumber和number这俩数据项把前面的数据穿起来,外键还不咋会
主界面,实现了分角色
<%@ 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;
}
.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;
overflow-y: auto;
max-height: calc(100vh - 40px); /* Adjust the height to fit the screen */
position: relative;
}
h2 {
font-size: 1.5em;
margin-bottom: 20px;
color: #333;
}
a {
display: block;
margin: 10px 0;
padding: 10px 20px;
background-color: #007bff;
color: white;
text-decoration: none;
border-radius: 4px;
transition: background-color 0.3s ease;
width: 70%; /* Adjust width to make it wider */
margin-left: auto;
margin-right: auto;
}
a:hover {
background-color: #0056b3;
}
.container div {
margin-top: 20px;
}
</style>
</head>
<body>
<div class="container">
<%
String type = (String) session.getAttribute("type");
String idnumber = (String) session.getAttribute("id");
if ("管理员".equals(type)) { %>
<a href="zhuce2.jsp" target="_blank">评估员添加</a>
<a href="checkbasic.jsp" target="_blank">查看老年人能力评估基本信息表</a>
<% } else if ("评估员".equals(type)) { %>
<div class="container">
<h2>操作界面</h2>
<a href="addbasic.jsp" target="_blank">填写信息</a>
<a href="checkbasic.jsp" target="_blank">查看老年人能力评估基本信息表</a>
<a href="adddaily.jsp" target="_blank">能力评估</a>
</div>
<% } %>
<a href="checkpeople.jsp?id=<%=idnumber%>&type=<%=type%>" target="_blank">被评估者基本信息查询</a>
<a href="checkinformation.jsp?id=<%=idnumber%>&type=<%=type%>" target="_blank">信息提供者及联系人信息查询</a>
<a href="checksummary.jsp?id=<%=idnumber%>&type=<%=type%>" target="_blank">老年人能力评估结果查询</a>
</div>
</body>
</html>
这是日常活动表
<%@ 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: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 450px;
}
h2 {
text-align: center;
color: #333;
}
.scrollable-container {
max-height: 600px;
overflow-y: auto;
padding: 10px;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
color: #666;
}
input[type="text"], select {
width: 100%;
padding: 8px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #0056b3;
border: none;
border-radius: 4px;
color: white;
font-size: 16px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<form action="adddaily" method="post">
<div class="container">
<h2>填写日常生活活动评估表</h2>
<div class="scrollable-container">
<div class="form-group">
<label for="idnumber">被评估者的身份证号:</label>
<input name="idnumber" type="text" id="idnumber">
</div>
<div class="form-group">
<label for="eat">进食(指用餐具将食物由容器送到口中、咀嚼、吞咽等过程):</label>
<select id="eat" name="eat">
<option value="10">10 分,可独立进食</option>
<option value="5">5 分,需部分帮助</option>
<option value="0">0 分,需极大帮助或完全依赖他人,或有留置营养管</option>
</select>
</div>
<div class="form-group">
<label for="bath">洗澡:</label>
<select id="bath" name="bath">
<option value="5">5 分,准备好洗澡水后,可自己独立完成洗澡过程</option>
<option value="0">0 分,在洗澡过程中需他人帮助</option>
</select>
</div>
<div class="form-group">
<label for="wash">修饰(指洗脸、刷牙、梳头、刮脸等):</label>
<select id="wash" name="wash">
<option value="5">5 分,可自己独立完成</option>
<option value="0">0 分,需他人帮助</option>
</select>
</div>
<div class="form-group">
<label for="cloth">穿衣(指穿脱衣服、系扣、拉拉链、穿脱鞋袜、系鞋带):</label>
<select id="cloth" name="cloth">
<option value="10">10 分,可独立完成</option>
<option value="5">5 分,需部分帮助</option>
<option value="0">0 分,需极大帮助或完全依赖他人</option>
</select>
</div>
<div class="form-group">
<label for="stool">大便控制:</label>
<select id="stool" name="stool">
<option value="10">10 分,可控制大便</option>
<option value="5">5 分,偶尔失控(每周<1 次),或需要他人提示</option>
<option value="0">0 分,完全失控</option>
</select>
</div>
<div class="form-group">
<label for="urinal">小便控制:</label>
<select id="urinal" name="urinal">
<option value="10">10 分,可控制小便</option>
<option value="5">5 分,偶尔失控(每天<1 次,但每周>1 次),或需要他人提示</option>
<option value="0">0 分,完全失控,或留置导尿管</option>
</select>
</div>
<div class="form-group">
<label for="toilet">如厕(包括去厕所、解开衣裤、擦净、整理衣裤、冲水):</label>
<select id="toilet" name="toilet">
<option value="10">10 分,可独立完成</option>
<option value="5">5 分,需部分帮助</option>
<option value="0">0 分,需极大帮助或完全依赖他人</option>
</select>
</div>
<div class="form-group">
<label for="move">床椅转移:</label>
<select id="move" name="move">
<option value="15">15 分,可独立完成</option>
<option value="10">10 分,需部分帮助</option>
<option value="5">5 分,需极大帮助</option>
<option value="0">0 分,完全依赖他人</option>
</select>
</div>
<div class="form-group">
<label for="walk">平地行走:</label>
<select id="walk" name="walk">
<option value="15">15 分,可独立在平地上行走 45m</option>
<option value="10">10 分,需部分帮助</option>
<option value="5">5 分,需极大帮助</option>
<option value="0">0 分,完全依赖他人</option>
</select>
</div>
<div class="form-group">
<label for="floor">上下楼梯:</label>
<select id="floor" name="floor">
<option value="10">10 分,可独立上下楼梯(连续上下 10-15 个台阶)</option>
<option value="5">5 分,需部分帮助</option>
<option value="0">0 分,需极大帮助或完全依赖他人</option>
</select>
</div>
<div class="form-group">
<label for="total">日常生活活动总分:</label>
<input name="total" type="text" id="total">
</div>
<div class="form-group">
<label for="level">日常生活活动分级:</label>
<select name="level" id="level">
<option value="0">0 能力完好:总分为 100 分</option>
<option value="1">1 轻度受损:总分为 65-95 分</option>
<option value="2">2 中度受损:总分 45-60 分</option>
<option value="3">3 重度受损:总分 ≤40 分</option>
</select>
</div>
<div class="form-group">
<input type="submit" value="提交">
</div>
</div>
</div>
</form>
</body>
</html>
</html>
package org.example.oldmandemo3;
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("/adddaily")
public class adddaily extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String idnumber = request.getParameter("idnumber");
int eat = parseInteger(request.getParameter("eat"), 0);
int bath = parseInteger(request.getParameter("bath"), 0);
int wash = parseInteger(request.getParameter("wash"), 0);
int cloth = parseInteger(request.getParameter("cloth"), 0);
int stool = parseInteger(request.getParameter("stool"), 0);
int urinal = parseInteger(request.getParameter("urinal"), 0);
int toilet = parseInteger(request.getParameter("toilet"), 0);
int walk = parseInteger(request.getParameter("walk"), 0);
int move = parseInteger(request.getParameter("move"), 0);
int floor = parseInteger(request.getParameter("floor"), 0);
int total = parseInteger(request.getParameter("total"), 0);
int level = parseInteger(request.getParameter("level"), 0);
daily data = new daily(eat, bath, wash, cloth, stool, urinal, toilet, walk, move, floor, total, level, "", idnumber);
Dao dao = new Dao();
try {
if (dao.adddaily(data)) {
request.getSession().setAttribute("idnumber", idnumber);
response.sendRedirect("addmind.jsp");
} else {
request.getRequestDispatcher("adddaily.jsp").forward(request, response);
}
} catch (SQLException | ClassNotFoundException e) {
throw new ServletException(e);
}
}
private int parseInteger(String value, int defaultValue) {
if (value == null || value.trim().isEmpty()) {
return defaultValue;
}
return Integer.parseInt(value);
}
}

浙公网安备 33010602011771号