Database Schema
CREATE TABLE daily_life (
id_card VARCHAR(20) PRIMARY KEY,
eating TINYINT,
bathing TINYINT,
grooming TINYINT,
dressing TINYINT,
bowel_ctl TINYINT,
bladder_ctl TINYINT,
toileting TINYINT,
transfer TINYINT,
ambulation TINYINT,
stair_climb TINYINT
);
CREATE TABLE mental_status (
id_card VARCHAR(20) PRIMARY KEY,
cognition TINYINT,
aggression TINYINT,
depression TINYINT
);
CREATE TABLE sensory_comm (
id_card VARCHAR(20) PRIMARY KEY,
awareness TINYINT,
vision TINYINT,
hearing TINYINT,
comm_skill TINYINT
);
CREATE TABLE social_participation (
id_card VARCHAR(20) PRIMARY KEY,
daily_task TINYINT,
work_task TINYINT,
orient_ts TINYINT,
orient_people TINYINT,
social_skill TINYINT
);
Entity Classes
package model;
public class DailyLife {
private String idCard;
private int eating;
private int bathing;
private int grooming;
private int dressing;
private int bowelCtl;
private int bladderCtl;
private int toileting;
private int transfer;
private int ambulation;
private int stairClimb;
/* getters & setters omitted */
}
public class MentalStatus {
private String idCard;
private int cognition;
private int aggression;
private int depression;
/* getters & setters omitted */
}
public class SensoryComm {
private String idCard;
private int awareness;
private int vision;
private int hearing;
private int commSkill;
/* getters & setters omitted */
}
public class SocialParticipation {
private String idCard;
private int dailyTask;
private int workTask;
private int orientTs;
private int orientPeople;
private int socialSkill;
/* getters and setters omitted */
}
Web Layer
Step 1 – Daily Living Assessment (daily.html)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Daily Living Assessment</title>
<link rel="stylesheet" href="css/assess.css">
</head>
<body>
<nav>
<a href="import.html">Import Profile</a>
<a class="active" href="#">Quarterly Assessment</a>
<a href="query.html">Multi-Query</a>
<a href="stats.html">Statistics</a>
<a href="export.html">Export</a>
</nav>
<section class="stepper">
<span class="current">Daily Living</span>
<span>Mental Status</span>
<span>Sensory & Communication</span>
<span>Social Participation</span>
</section>
<form action="/assess/daily" method="post">
<h1>Daily Living Capability</h1>
<label>ID Card
<input type="text" name="idCard" required>
</label>
<fieldset>
<legend>Eating (0–10)</legend>
<label><input type="radio" name="eating" value="10" required>Independent</label>
<label><input type="radio" name="eating" value="5">Partial help</label>
<label><input type="radio" name="eating" value="0">Full help</label>
</fieldset>
<fieldset>
<legend>Bathing (0–5)</legend>
<label><input type="radio" name="bathing" value="5" required>Independent</label>
<label><input type="radio" name="bathing" value="0">Needs help</label>
</fieldset>
<!-- Additional fields omitted for brevity -->
<button>Next →</button>
</form>
</body>
</html>
@WebServlet("/assess/daily")
public class DailyServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
req.setCharacterEncoding("UTF-8");
DailyLife d = new DailyLife();
d.setIdCard(req.getParameter("idCard"));
d.setEating(parse(req.getParameter("eating")));
d.setBathing(parse(req.getParameter("bathing")));
/* … other fields … */
try (SqlSession session = MyBatisUtil.open()) {
session.getMapper(AssessMapper.class).insertDaily(d);
session.commit();
}
resp.sendRedirect("mental.html");
}
private int parse(String s) { return Integer.parseInt(s); }
}
Step 2 – Mental Status (mental.html)
Same patttern; collects cognition, aggression, depresison.
Step 3 – Sensory & Communication (sensory.html)
Collects awareness, vision, hearing, communication.
Step 4 – Social Participation (social.html)
Collects daily task, work task, time/space orientation, people orientation, social skill.
Result Compilation (ResultServlet)
@WebServlet("/assess/result")
public class ResultServlet extends HttpServlet {
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
String id = req.getParameter("idCard");
try (SqlSession s = MyBatisUtil.open()) {
AssessMapper m = s.getMapper(AssessMapper.class);
DailyLife d = m.selectDaily(id);
MentalStatus n = m.selectMental(id);
SensoryComm c = m.selectSensory(id);
SocialParticipation p = m.selectSocial(id);
int dailyScore = d.total();
int mentalScore = n.total();
int sensoryScore = c.total();
int socialScore = p.total();
Level dailyLvl = Level.ofDaily(dailyScore);
Level mentalLvl = Level.ofMental(mentalScore);
Level sensoryLvl= Level.ofSensory(c);
Level socialLvl = Level.ofSocial(socialScore);
req.setAttribute("daily", new Result(dailyScore, dailyLvl));
req.setAttribute("mental", new Result(mentalScore, mentalLvl));
req.setAttribute("sensory",new Result(sensoryScore, sensoryLvl));
req.setAttribute("social", new Result(socialScore, socialLvl));
req.getRequestDispatcher("/WEB-INF/result.jsp").forward(req, resp);
} catch (Exception e) {
resp.sendError(500);
}
}
}
enum Level {
INTACT, MILD, MODERATE, SEVERE;
static Level ofDaily(int score) {
if (score == 100) return INTACT;
if (score >= 65) return MILD;
if (score >= 45) return MODERATE;
return SEVERE;
}
static Level ofMental(int score) {
if (score == 0) return INTACT;
if (score == 1) return MILD;
if (score <= 3) return MODERATE;
return SEVERE;
}
static Level ofSensory(SensoryComm c) {
int s = c.getAwareness() + c.getVision() + c.getHearing() + c.getCommSkill();
if (s == 0) return INTACT;
if (s <= 2) return MILD;
if (s <= 5) return MODERATE;
return SEVERE;
}
static Level ofSocial(int score) {
if (score <= 2) return INTACT;
if (score <= 7) return MILD;
if (score <= 13) return MODERATE;
return SEVERE;
}
}
class Result {
final int score;
final Level level;
Result(int score, Level level) {
this.score = score;
this.level = level;
}
}
Result JSP (result.jsp)
<%@ page contentType="text/html;charset=UTF-8" %>
The system guides evaluators through four consecutive forms, stores each section indepandently, and finally aggregates the scores into four discrete levels for reporting and care-planning purposes.