寒假web开发3
表二: Older
sql
点击查看代码
CREATE TABLE tb_older (
AssessmentID CHAR(8) PRIMARY KEY, -- A.1.1 评估编号
AssessmentDate DATE, -- A.1.2 评估基准日期
AssessmentReason INT, -- A.1.3 评估原因
userID VARCHAR(12),
Name VARCHAR(50), -- A.2.1 姓名
Gender INT, -- A.2.2 性别 (1: 男, 2: 女)
BirthDate DATE, -- A.2.3 出生日期
IDCard CHAR(18), -- A.2.4 身份证号
SocialSecurityCard CHAR(9), -- A.2.5 社保卡号
Ethnicity VARCHAR(50), -- A.2.6 民族 (1: 汉族, 2: 少数民族)
EducationLevel INT, -- A.2.7 文化程度 (1: 文盲, 2: 小学, 3: 初中, 4: 高中/技校/中专, 5: 大学专科及以上, 6: 不详)
Religion VARCHAR(50), -- A.2.8 宗教信仰 (0: 无, 1: 有)
MaritalStatus INT, -- A.2.9 婚姻状况 (1: 未婚, 2: 已婚, 3: 丧偶, 4: 离婚, 5: 未说明的婚姻状况)
LivingSituation INT, -- A.2.10 居住情况 (1: 独居, 2: 与配偶/伴侣居住, 3: 与子女居住, 4: 与父母居住, 5: 与兄弟姐妹居住, 6: 与其他亲属居住, 7: 与非亲属关系的人居住, 8: 养老机构)
PaymentMethod VARCHAR(50), -- A.2.11 医疗费用支付方式 (多选, 用逗号分隔)
IncomeSource VARCHAR(50), -- A.2.12 经济来源 (多选, 用逗号分隔)
DementiaLevel INT, -- A.2.13.1 痴呆 (0: 无, 1: 轻度, 2: 中度, 3: 重度)
MentalIllness INT, -- A.2.13.2 精神疾病 (0: 无, 1: 精神分裂症, 2: 双相情感障碍, 3: 偏执性精神障碍, 4: 分裂情感性障碍, 5: 癫痫所致精神障碍, 6: 精神发育迟滞伴发精神障碍)
ChronicDiseases VARCHAR(255), -- A.2.13.3 慢性疾病 (可填写多个)
FallIncidents INT, -- A.2.14.1 跌倒 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
LostIncidents INT, -- A.2.14.2 走失 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
ChokingIncidents INT, -- A.2.14.3 噎食 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
SuicideIncidents INT, -- A.2.14.4 自杀 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
OtherIncidents VARCHAR(255) -- A.2.14.5 其他意外事件
);
Older pojo
点击查看代码
package com.QixunQiu.pojo;
import java.util.Date;
public class Older {
private String AssessmentID ;
private String AssessmentDate ;
private int AssessmentReason;
private String userID;
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
public String getAssessmentDate() {
return AssessmentDate;
}
public void setAssessmentDate(String assessmentDate) {
AssessmentDate = assessmentDate;
}
public String getAssessmentID() {
return AssessmentID;
}
public void setAssessmentID(String assessmentID) {
AssessmentID = assessmentID;
}
public int getAssessmentReason() {
return AssessmentReason;
}
public void setAssessmentReason(int assessmentReason) {
AssessmentReason = assessmentReason;
}
// A.2.1 姓名
private String name;
// A.2.2 性别 (1: 男, 2: 女)
private Integer gender;
// A.2.3 出生日期
private String birthDate;
// A.2.4 身份证号
private String idCard;
// A.2.5 社保卡号
private String socialSecurityCard;
// A.2.6 民族 (1: 汉族, 2: 少数民族)
private String ethnicity;
// A.2.7 文化程度 (1: 文盲, 2: 小学, 3: 初中, 4: 高中/技校/中专, 5: 大学专科及以上, 6: 不详)
private Integer educationLevel;
// A.2.8 宗教信仰 (0: 无, 1: 有)
private String religion;
// A.2.9 婚姻状况 (1: 未婚, 2: 已婚, 3: 丧偶, 4: 离婚, 5: 未说明的婚姻状况)
private Integer maritalStatus;
// A.2.10 居住情况 (1: 独居, 2: 与配偶/伴侣居住, 3: 与子女居住, 4: 与父母居住, 5: 与兄弟姐妹居住, 6: 与其他亲属居住, 7: 与非亲属关系的人居住, 8: 养老机构)
private Integer livingSituation;
// A.2.11 医疗费用支付方式 (多选, 用逗号分隔)
private String paymentMethod;
// A.2.12 经济来源 (多选, 用逗号分隔)
private String incomeSource;
// A.2.13.1 痴呆 (0: 无, 1: 轻度, 2: 中度, 3: 重度)
private Integer dementiaLevel;
// A.2.13.2 精神疾病 (0: 无, 1: 精神分裂症, 2: 双相情感障碍, 3: 偏执性精神障碍, 4: 分裂情感性障碍, 5: 癫痫所致精神障碍, 6: 精神发育迟滞伴发精神障碍)
private Integer mentalIllness;
// A.2.13.3 慢性疾病 (可填写多个)
private String chronicDiseases;
// A.2.14.1 跌倒 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
private Integer fallIncidents;
// A.2.14.2 走失 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
private Integer lostIncidents;
// A.2.14.3 噎食 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
private Integer chokingIncidents;
// A.2.14.4 自杀 (0: 无, 1: 发生过1次, 2: 发生过2次, 3: 发生过3次及以上)
private Integer suicideIncidents;
// A.2.14.5 其他意外事件
private String otherIncidents;
@Override
public String toString() {
return "Older{" +
"AssessmentID='" + AssessmentID + '\'' +
", AssessmentDate='" + AssessmentDate + '\'' +
", AssessmentReason=" + AssessmentReason +
", userID='" + userID + '\'' +
", name='" + name + '\'' +
", gender=" + gender +
", birthDate=" + birthDate +
", idCard='" + idCard + '\'' +
", socialSecurityCard='" + socialSecurityCard + '\'' +
", ethnicity='" + ethnicity + '\'' +
", educationLevel=" + educationLevel +
", religion='" + religion + '\'' +
", maritalStatus=" + maritalStatus +
", livingSituation=" + livingSituation +
", paymentMethod='" + paymentMethod + '\'' +
", incomeSource='" + incomeSource + '\'' +
", dementiaLevel=" + dementiaLevel +
", mentalIllness=" + mentalIllness +
", chronicDiseases='" + chronicDiseases + '\'' +
", fallIncidents=" + fallIncidents +
", lostIncidents=" + lostIncidents +
", chokingIncidents=" + chokingIncidents +
", suicideIncidents=" + suicideIncidents +
", otherIncidents='" + otherIncidents + '\'' +
'}';
}
public String getEthnicity() {
return ethnicity;
}
public void setEthnicity(String ethnicity) {
this.ethnicity = ethnicity;
}
public String getReligion() {
return religion;
}
public void setReligion(String religion) {
this.religion = religion;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getGender() {
return gender;
}
public void setGender(Integer gender) {
this.gender = gender;
}
public String getBirthDate() {
return birthDate;
}
public void setBirthDate(String birthDate) {
this.birthDate = birthDate;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public String getSocialSecurityCard() {
return socialSecurityCard;
}
public void setSocialSecurityCard(String socialSecurityCard) {
this.socialSecurityCard = socialSecurityCard;
}
public Integer getEducationLevel() {
return educationLevel;
}
public void setEducationLevel(Integer educationLevel) {
this.educationLevel = educationLevel;
}
public Integer getMaritalStatus() {
return maritalStatus;
}
public void setMaritalStatus(Integer maritalStatus) {
this.maritalStatus = maritalStatus;
}
public Integer getLivingSituation() {
return livingSituation;
}
public void setLivingSituation(Integer livingSituation) {
this.livingSituation = livingSituation;
}
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public Integer getDementiaLevel() {
return dementiaLevel;
}
public void setDementiaLevel(Integer dementiaLevel) {
this.dementiaLevel = dementiaLevel;
}
public Integer getMentalIllness() {
return mentalIllness;
}
public void setMentalIllness(Integer mentalIllness) {
this.mentalIllness = mentalIllness;
}
public String getIncomeSource() {
return incomeSource;
}
public void setIncomeSource(String incomeSource) {
this.incomeSource = incomeSource;
}
public Integer getFallIncidents() {
return fallIncidents;
}
public void setFallIncidents(Integer fallIncidents) {
this.fallIncidents = fallIncidents;
}
public Integer getChokingIncidents() {
return chokingIncidents;
}
public void setChokingIncidents(Integer chokingIncidents) {
this.chokingIncidents = chokingIncidents;
}
public String getOtherIncidents() {
return otherIncidents;
}
public void setOtherIncidents(String otherIncidents) {
this.otherIncidents = otherIncidents;
}
public Integer getSuicideIncidents() {
return suicideIncidents;
}
public void setSuicideIncidents(Integer suicideIncidents) {
this.suicideIncidents = suicideIncidents;
}
public Integer getLostIncidents() {
return lostIncidents;
}
public void setLostIncidents(Integer lostIncidents) {
this.lostIncidents = lostIncidents;
}
public String getChronicDiseases() {
return chronicDiseases;
}
public void setChronicDiseases(String chronicDiseases) {
this.chronicDiseases = chronicDiseases;
}
}
OlderMapper
点击查看代码
package com.QixunQiu.mapper;
import com.QixunQiu.pojo.Older;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface OlderMapper {
@Select("select * from tb_older where userID = #{userID} ")
List<Older> select(@Param("userID") String userID);
@Select("select * from tb_older where userID = #{userID} ")
Older selectOlder(@Param("userID") String userID);
void add(Older older);
}
OlderService
点击查看代码
package com.QixunQiu.service;
import com.QixunQiu.mapper.OlderMapper;
import com.QixunQiu.pojo.Older;
import com.QixunQiu.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import java.util.List;
public class OlderService {
SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();
public List<Older> selectOlder(String userID) {
SqlSession sqlSession = sqlSessionFactory.openSession();
OlderMapper olderMapper = sqlSession.getMapper(OlderMapper.class);
List<Older> olders=olderMapper.select(userID);
sqlSession.close();
return olders;
}
public void addOlder(Older older) {
SqlSession sqlSession = sqlSessionFactory.openSession();
OlderMapper olderMapper = sqlSession.getMapper(OlderMapper.class);
olderMapper.add(older);
sqlSession.commit();
sqlSession.close();
}
public Older selectOlderById(String userID) {
SqlSession sqlSession = sqlSessionFactory.openSession();
OlderMapper olderMapper = sqlSession.getMapper(OlderMapper.class);
Older older=olderMapper.selectOlder(userID);
sqlSession.close();
return older;
}
}
AddOlderServlet
点击查看代码
package com.QixunQiu.web;
import com.QixunQiu.pojo.Older;
import com.QixunQiu.pojo.User;
import com.QixunQiu.service.OlderService;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@WebServlet("/AddOlderServlet")
public class AddOlderServlet extends HttpServlet {
private OlderService olderService = new OlderService();
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
HttpSession session = request.getSession();
User user = (User) session.getAttribute("user");
// 获取表单数据
String AssessmentID=generateID();
String AssessmentDate=request.getParameter("评估日期");
String AssessmentReason=request.getParameter("评估原因");
String userID = user.getUserID();
String name = request.getParameter("姓名");
String gender = request.getParameter("性别");
String birthDate = request.getParameter("出生日期");
String idCard = request.getParameter("身份证号");
String socialSecurityCard = request.getParameter("社保卡号");
String ethnicity = request.getParameter("民族");
String educationLevel = request.getParameter("文化程度");
String religion = request.getParameter("宗教信仰");
String maritalStatus = request.getParameter("婚姻状况");
String livingSituation = request.getParameter("居住情况");
String paymentMethod = request.getParameter("医疗费用支付方式");
String incomeSource = request.getParameter("经济来源");
String dementiaLevel = request.getParameter("痴呆");
String mentalIllness = request.getParameter("精神疾病");
String chronicDiseases = request.getParameter("慢性疾病");
String fallIncidents = request.getParameter("跌倒");
String lostIncidents = request.getParameter("走失");
String chokingIncidents = request.getParameter("噎食");
String suicideIncidents = request.getParameter("自杀");
String otherIncidents = request.getParameter("其他意外事件");
Older older = new Older();
older.setAssessmentID(AssessmentID);
older.setAssessmentDate(AssessmentDate);
older.setAssessmentReason(Integer.parseInt(AssessmentReason));
older.setUserID(userID);
older.setName(name);
older.setGender(Integer.valueOf(gender));
older.setBirthDate(birthDate);
older.setIdCard(idCard);
older.setSocialSecurityCard(socialSecurityCard);
older.setEthnicity(ethnicity);
older.setEducationLevel(Integer.valueOf(educationLevel));
older.setReligion(religion);
older.setMaritalStatus(Integer.valueOf(maritalStatus));
older.setLivingSituation(Integer.valueOf(livingSituation));
older.setPaymentMethod(paymentMethod);
older.setIncomeSource(incomeSource);
older.setDementiaLevel(Integer.valueOf(dementiaLevel));
older.setMentalIllness(Integer.valueOf(mentalIllness));
older.setChronicDiseases(chronicDiseases);
older.setFallIncidents(Integer.valueOf(fallIncidents));
older.setLostIncidents(Integer.valueOf(lostIncidents));
older.setChokingIncidents(Integer.valueOf(chokingIncidents));
older.setSuicideIncidents(Integer.valueOf(suicideIncidents));
older.setOtherIncidents(otherIncidents);
olderService.addOlder(older);
List<Older> olders = olderService.selectOlder(user.getUserID());
session.setAttribute("olders", olders);
request.getRequestDispatcher("/older.jsp").forward(request,response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doGet(request, response);
}
private int sequenceNumber = 1;
public synchronized String generateID() {
// 获取当前日期
Date now = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
String dateStr = sdf.format(now);
// 读取或初始化sequenceNumber
if (sequenceNumber == 1) {
File file = new File("sequenceNumberHouse.txt");
if (file.exists()) {
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String line = reader.readLine();
sequenceNumber = Integer.parseInt(line);
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
// 组合房产编号
String sequenceStr = String.format("%04d", sequenceNumber++);
String houseID = dateStr + sequenceStr;
// 更新sequenceNumber到文件
try {
BufferedWriter writer = new BufferedWriter(new FileWriter("sequenceNumberHouse.txt"));
writer.write(String.valueOf(sequenceNumber));
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
return houseID;
}
}
selectOlderServlet
点击查看代码
package com.QixunQiu.web;
import com.QixunQiu.pojo.Older;
import com.QixunQiu.pojo.User;
import com.QixunQiu.service.OlderService;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
@WebServlet("/selectOlderServlet")
public class selectOlderServlet extends HttpServlet {
private OlderService olderService = new OlderService();
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8");
HttpSession session = request.getSession();
User user = (User) session.getAttribute("user");
List<Older> olders = olderService.selectOlder(user.getUserID());
System.out.println(olders);
PrintWriter writer = response.getWriter();
//3. 判断olders释放为null
if(!olders.isEmpty()){
// 登陆成功
writer.write("登陆成功");
session.setAttribute("olders", olders);
request.getRequestDispatcher("/older.jsp").forward(request,response);
}else {
// 登陆失败
writer.write("登陆失败");
request.getRequestDispatcher("/addOlder.jsp").forward(request,response);
}
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doGet(request, response);
}
}
OlderMapper.xml
点击查看代码
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.QixunQiu.mapper.OlderMapper">
<insert id="add" parameterType="com.QixunQiu.pojo.Older">
INSERT INTO tb_older (
AssessmentID,
AssessmentDate,
AssessmentReason,
userID,
Name,
Gender,
BirthDate,
IDCard,
SocialSecurityCard,
Ethnicity,
EducationLevel,
Religion,
MaritalStatus,
LivingSituation,
PaymentMethod,
IncomeSource,
DementiaLevel,
MentalIllness,
ChronicDiseases,
FallIncidents,
LostIncidents,
ChokingIncidents,
SuicideIncidents,
OtherIncidents
) VALUES (
#{AssessmentID},
#{AssessmentDate},
#{AssessmentReason},
#{userID},
#{name},
#{gender},
#{birthDate},
#{idCard},
#{socialSecurityCard},
#{ethnicity},
#{educationLevel},
#{religion},
#{maritalStatus},
#{livingSituation},
#{paymentMethod},
#{incomeSource},
#{dementiaLevel},
#{mentalIllness},
#{chronicDiseases},
#{fallIncidents},
#{lostIncidents},
#{chokingIncidents},
#{suicideIncidents},
#{otherIncidents}
)
</insert>
</mapper>
addOlder.jsp
点击查看代码
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加个人信息</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
.表单组 {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="text"], input[type="date"], select {
width: 100%;
padding: 8px;
box-sizing: border-box;
}
.提交按钮 {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
}
.提交按钮:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<h1>添加个人信息</h1>
<form action="${pageContext.request.contextPath}/AddOlderServlet" method="post">
<!-- 评估日期 -->
<div class="表单组">
<label for="评估日期">评估日期:</label>
<input type="date" id="评估日期" name="评估日期" required>
</div>
<!-- 评估原因 -->
<div class="表单组">
<label for="评估原因">评估原因:</label>
<select id="评估原因" name="评估原因" required>
<option value="1">接受服务前初评</option>
<option value="2">接受服务后的常规评估</option>
<option value="3">状况发生变化后的即时评估</option>
<option value="4">因评估结果有疑问进行的复评</option>
</select>
</div>
<!-- 姓名 -->
<div class="表单组">
<label for="姓名">姓名:</label>
<input type="text" id="姓名" name="姓名" required>
</div>
<!-- 性别 -->
<div class="表单组">
<label for="性别">性别:</label>
<select id="性别" name="性别" required>
<option value="1">男</option>
<option value="2">女</option>
</select>
</div>
<!-- 出生日期 -->
<div class="表单组">
<label for="出生日期">出生日期:</label>
<input type="date" id="出生日期" name="出生日期" required>
</div>
<!-- 身份证号 -->
<div class="表单组">
<label for="身份证号">身份证号:</label>
<input type="text" id="身份证号" name="身份证号" maxlength="18" required>
</div>
<!-- 社保卡号 -->
<div class="表单组">
<label for="社保卡号">社保卡号:</label>
<input type="text" id="社保卡号" name="社保卡号" maxlength="9" required>
</div>
<!-- 民族 -->
<div class="表单组">
<label for="民族">民族:</label>
<input type="text" id="民族" name="民族" required>
</div>
<!-- 文化程度 -->
<div class="表单组">
<label for="文化程度">文化程度:</label>
<select id="文化程度" name="文化程度" required>
<option value="1">文盲</option>
<option value="2">小学</option>
<option value="3">初中</option>
<option value="4">高中/技校/中专</option>
<option value="5">大学专科及以上</option>
<option value="6">不详</option>
</select>
</div>
<!-- 宗教信仰 -->
<div class="表单组">
<label for="宗教信仰">宗教信仰:</label>
<input type="text" id="宗教信仰" name="宗教信仰" required>
</div>
<!-- 婚姻状况 -->
<div class="表单组">
<label for="婚姻状况">婚姻状况:</label>
<select id="婚姻状况" name="婚姻状况" required>
<option value="1">未婚</option>
<option value="2">已婚</option>
<option value="3">丧偶</option>
<option value="4">离婚</option>
<option value="5">未说明的婚姻状况</option>
</select>
</div>
<!-- 居住情况 -->
<div class="表单组">
<label for="居住情况">居住情况:</label>
<select id="居住情况" name="居住情况" required>
<option value="1">独居</option>
<option value="2">与配偶/伴侣居住</option>
<option value="3">与子女居住</option>
<option value="4">与父母居住</option>
<option value="5">与兄弟姐妹居住</option>
<option value="6">与其他亲属居住</option>
<option value="7">与非亲属关系的人居住</option>
<option value="8">养老机构</option>
</select>
</div>
<!-- 医疗费用支付方式 -->
<div class="表单组">
<label for="医疗费用支付方式">医疗费用支付方式:</label>
<input type="text" id="医疗费用支付方式" name="医疗费用支付方式" placeholder="例如:1,2" required>
</div>
<!-- 经济来源 -->
<div class="表单组">
<label for="经济来源">经济来源:</label>
<input type="text" id="经济来源" name="经济来源" placeholder="例如:1,3" required>
</div>
<!-- 痴呆 -->
<div class="表单组">
<label for="痴呆">痴呆:</label>
<select id="痴呆" name="痴呆" required>
<option value="0">无</option>
<option value="1">轻度</option>
<option value="2">中度</option>
<option value="3">重度</option>
</select>
</div>
<!-- 精神疾病 -->
<div class="表单组">
<label for="精神疾病">精神疾病:</label>
<select id="精神疾病" name="精神疾病" required>
<option value="0">无</option>
<option value="1">精神分裂症</option>
<option value="2">双相情感障碍</option>
<option value="3">偏执性精神障碍</option>
<option value="4">分裂情感性障碍</option>
<option value="5">癫痫所致精神障碍</option>
<option value="6">精神发育迟滞伴发精神障碍</option>
</select>
</div>
<!-- 慢性疾病 -->
<div class="表单组">
<label for="慢性疾病">慢性疾病:</label>
<input type="text" id="慢性疾病" name="慢性疾病" placeholder="例如:高血压,糖尿病">
</div>
<!-- 跌倒 -->
<div class="表单组">
<label for="跌倒">跌倒:</label>
<select id="跌倒" name="跌倒" required>
<option value="0">无</option>
<option value="1">发生过1次</option>
<option value="2">发生过2次</option>
<option value="3">发生过3次及以上</option>
</select>
</div>
<!-- 走失 -->
<div class="表单组">
<label for="走失">走失:</label>
<select id="走失" name="走失" required>
<option value="0">无</option>
<option value="1">发生过1次</option>
<option value="2">发生过2次</option>
<option value="3">发生过3次及以上</option>
</select>
</div>
<!-- 噎食 -->
<div class="表单组">
<label for="噎食">噎食:</label>
<select id="噎食" name="噎食" required>
<option value="0">无</option>
<option value="1">发生过1次</option>
<option value="2">发生过2次</option>
<option value="3">发生过3次及以上</option>
</select>
</div>
<!-- 自杀 -->
<div class="表单组">
<label for="自杀">自杀:</label>
<select id="自杀" name="自杀" required>
<option value="0">无</option>
<option value="1">发生过1次</option>
<option value="2">发生过2次</option>
<option value="3">发生过3次及以上</option>
</select>
</div>
<!-- 其他意外事件 -->
<div class="表单组">
<label for="其他意外事件">其他意外事件:</label>
<input type="text" id="其他意外事件" name="其他意外事件">
</div>
<!-- 提交按钮 -->
<div class="表单组">
<input type="submit" class="提交按钮" value="提交">
</div>
</form>
</body>
</html>
older.jsp
点击查看代码
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>老年人信息列表</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
text-align: center;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid #ddd;
}
th, td {
padding: 10px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
tr:hover {
background-color: #f5f5f5;
}
</style>
</head>
<body>
<h1>老年人信息列表</h1>
<table>
<thead>
<tr>
<th>评估编号</th>
<th>评估日期</th>
<th>评估原因</th>
<th>用户ID</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>其他意外事件</th>
</tr>
</thead>
<tbody>
<c:forEach var="older" items="${olders}">
<tr>
<td>${older.assessmentID}</td>
<td>${older.assessmentDate}</td>
<td>
<c:choose>
<c:when test="${older.assessmentReason == 1}">接受服务前初评</c:when>
<c:when test="${older.assessmentReason == 2}">接受服务后的常规评估</c:when>
<c:when test="${older.assessmentReason == 3}">状况发生变化后的即时评估</c:when>
<c:when test="${older.assessmentReason == 4}">因评估结果有疑问进行的复评</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>${older.userID}</td>
<td>${older.name}</td>
<td>
<c:choose>
<c:when test="${older.gender == 1}">男</c:when>
<c:when test="${older.gender == 2}">女</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>${older.birthDate}</td>
<td>${older.idCard}</td>
<td>${older.socialSecurityCard}</td>
<td>${older.ethnicity}</td>
<td>
<c:choose>
<c:when test="${older.educationLevel == 1}">文盲</c:when>
<c:when test="${older.educationLevel == 2}">小学</c:when>
<c:when test="${older.educationLevel == 3}">初中</c:when>
<c:when test="${older.educationLevel == 4}">高中/技校/中专</c:when>
<c:when test="${older.educationLevel == 5}">大学专科及以上</c:when>
<c:when test="${older.educationLevel == 6}">不详</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>${older.religion}</td>
<td>
<c:choose>
<c:when test="${older.maritalStatus == 1}">未婚</c:when>
<c:when test="${older.maritalStatus == 2}">已婚</c:when>
<c:when test="${older.maritalStatus == 3}">丧偶</c:when>
<c:when test="${older.maritalStatus == 4}">离婚</c:when>
<c:when test="${older.maritalStatus == 5}">未说明的婚姻状况</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>
<c:choose>
<c:when test="${older.livingSituation == 1}">独居</c:when>
<c:when test="${older.livingSituation == 2}">与配偶/伴侣居住</c:when>
<c:when test="${older.livingSituation == 3}">与子女居住</c:when>
<c:when test="${older.livingSituation == 4}">与父母居住</c:when>
<c:when test="${older.livingSituation == 5}">与兄弟姐妹居住</c:when>
<c:when test="${older.livingSituation == 6}">与其他亲属居住</c:when>
<c:when test="${older.livingSituation == 7}">与非亲属关系的人居住</c:when>
<c:when test="${older.livingSituation == 8}">养老机构</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>${older.paymentMethod}</td>
<td>${older.incomeSource}</td>
<td>
<c:choose>
<c:when test="${older.dementiaLevel == 0}">无</c:when>
<c:when test="${older.dementiaLevel == 1}">轻度</c:when>
<c:when test="${older.dementiaLevel == 2}">中度</c:when>
<c:when test="${older.dementiaLevel == 3}">重度</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>
<c:choose>
<c:when test="${older.mentalIllness == 0}">无</c:when>
<c:when test="${older.mentalIllness == 1}">精神分裂症</c:when>
<c:when test="${older.mentalIllness == 2}">双相情感障碍</c:when>
<c:when test="${older.mentalIllness == 3}">偏执性精神障碍</c:when>
<c:when test="${older.mentalIllness == 4}">分裂情感性障碍</c:when>
<c:when test="${older.mentalIllness == 5}">癫痫所致精神障碍</c:when>
<c:when test="${older.mentalIllness == 6}">精神发育迟滞伴发精神障碍</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>${older.chronicDiseases}</td>
<td>
<c:choose>
<c:when test="${older.fallIncidents == 0}">无</c:when>
<c:when test="${older.fallIncidents == 1}">1次</c:when>
<c:when test="${older.fallIncidents == 2}">2次</c:when>
<c:when test="${older.fallIncidents == 3}">3次及以上</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>
<c:choose>
<c:when test="${older.lostIncidents == 0}">无</c:when>
<c:when test="${older.lostIncidents == 1}">1次</c:when>
<c:when test="${older.lostIncidents == 2}">2次</c:when>
<c:when test="${older.lostIncidents == 3}">3次及以上</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>
<c:choose>
<c:when test="${older.chokingIncidents == 0}">无</c:when>
<c:when test="${older.chokingIncidents == 1}">1次</c:when>
<c:when test="${older.chokingIncidents == 2}">2次</c:when>
<c:when test="${older.chokingIncidents == 3}">3次及以上</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>
<c:choose>
<c:when test="${older.suicideIncidents == 0}">无</c:when>
<c:when test="${older.suicideIncidents == 1}">1次</c:when>
<c:when test="${older.suicideIncidents == 2}">2次</c:when>
<c:when test="${older.suicideIncidents == 3}">3次及以上</c:when>
<c:otherwise>未知</c:otherwise>
</c:choose>
</td>
<td>${older.otherIncidents}</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能