假期作业13

socialParticipation评估表:

点击查看代码
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>社会参与评估</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            padding: 20px;
        }

        h1 {
            text-align: center;
            color: #333;
        }

        form {
            background-color: #fff;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            max-width: 600px;
            margin: 0 auto;
        }

        label {
            display: block;
            margin-bottom: 5px;
        }

        select,
        input {
            width: 100%;
            padding: 10px;
            margin-bottom: 15px;
            border: 1px solid #ccc;
            border-radius: 3px;
        }

        input[type="submit"] {
            background-color: #007BFF;
            color: #fff;
            cursor: pointer;
        }

        input[type="submit"]:hover {
            background-color: #0056b3;
        }

        #message {
            text-align: center;
            margin-top: 20px;
            color: green;
        }
    </style>
</head>

<body>
<h1>社会参与评估</h1>
<form id="addSocialParticipationForm" action="${pageContext.request.contextPath}/addSocialParticipationServlet" method="post">
    <!-- 生活能力 -->
    <label for="livingAbilityScore">生活能力:</label>
    <select id="livingAbilityScore" name="livingAbilityScore">
        <option value="0">0 分,除个人生活自理外(如饮食、洗漱、穿戴、二便),能料理家务(如做饭、洗衣)或当家管理事务</option>
        <option value="1">1 分,除个人生活自理外,能做家务,但欠好,家庭事务安排欠条理</option>
        <option value="2">2 分,个人生活能自理;只有在他人帮助下才能做些家务,但质量不好</option>
        <option value="3">3 分,个人基本生活事务能自理(如饮食、二便),在督促下可洗漱</option>
        <option value="4">4 分,个人基本生活事务(如饮食、二便)需要部分帮助或完全依赖他人帮助</option>
    </select><br>

    <!-- 工作能力 -->
    <label for="workingAbilityScore">工作能力:</label>
    <select id="workingAbilityScore" name="workingAbilityScore">
        <option value="0">0 分,原来熟练的脑力工作或体力技巧性工作可照常进行</option>
        <option value="1">1 分,原来熟练的脑力工作或体力技巧性工作能力有所下降</option>
        <option value="2">2 分,原来熟练的脑力工作或体力技巧性工作明显不如以往,部分遗忘</option>
        <option value="3">3 分,对熟练工作只有一些片段保留,技能全部遗忘</option>
        <option value="4">4 分,对以往的知识或技能全部磨灭</option>
    </select><br>

    <!-- 时间/空间定向 -->
    <label for="timeSpaceOrientationScore">时间/空间定向:</label>
    <select id="timeSpaceOrientationScore" name="timeSpaceOrientationScore">
        <option value="0">0 分,时间观念(年、月、日、时)清楚;可单独出远门,能很快掌握新环境的方位</option>
        <option value="1">1 分,时间观念有些下降,年、月、日清楚,但有时相差几天;可单独来往于近街,知道现住地的名称和方位,但不知回家路线</option>
        <option value="2">2 分,时间观念较差,年、月、日不清楚,可知上半年或下半年;只能单独在家附近行动,对现住地只知名称,不知道方位</option>
        <option value="3">3 分,时间观念很差,年、月、日不清楚,可知上午或下午;只能在左邻右舍间串门,对现住地不知名称和方位</option>
        <option value="4">4 分,无时间观念;不能单独外出</option>
    </select><br>

    <!-- 人物定向 -->
    <label for="personOrientationScore">人物定向:</label>
    <select id="personOrientationScore" name="personOrientationScore">
        <option value="0">0 分,知道周围人们的关系,知道祖孙、叔伯、姑姨、侄子侄女等称谓的意义;可分辨陌生人的大致年龄和身份,可用适当称呼</option>
        <option value="1">1 分,只知家中亲密近亲的关系,不会分辨陌生人的大致年龄,不能称呼陌生人</option>
        <option value="2">2 分,只能称呼家中人,或只能照样称呼,不知其关系,不辨辈分</option>
        <option value="3">3 分,只认识常同住的亲人,可称呼子女或孙子女,可辨熟人和生人</option>
        <option value="4">4 分,只认识保护人,不辨熟人和生人</option>
    </select><br>

    <!-- 社会交往能力 -->
    <label for="socialCommunicationAbilityScore">社会交往能力:</label>
    <select id="socialCommunicationAbilityScore" name="socialCommunicationAbilityScore">
        <option value="0">0 分,参与社会,在社会环境有一定的适应能力,待人接物恰当</option>
        <option value="1">1 分,能适应单纯环境,主动接触人,初见面时难让人发现智力问题,不能理解隐喻语</option>
        <option value="2">2 分,脱离社会,可被动接触,不会主动待人,谈话中很多不适词句,容易上当受骗</option>
        <option value="3">3 分,勉强可与人交往,谈吐内容不清楚,表情不恰当</option>
        <option value="4">4 分,难以与人接触</option>
    </select><br>

    <input type="submit" value="提交">
</form>
<div id="message"></div>
</body>

</html>

pojo:

点击查看代码
package com.vivy.pojo;

import java.util.Date;

public class SocialParticipation {
    private Integer id;
    private Integer livingAbilityScore;
    private Integer workingAbilityScore;
    private Integer timeSpaceOrientationScore;
    private Integer personOrientationScore;
    private Integer socialCommunicationAbilityScore;
    private Integer totalScore;
    private Integer socialParticipationLevel;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getLivingAbilityScore() {
        return livingAbilityScore;
    }

    public void setLivingAbilityScore(Integer livingAbilityScore) {
        this.livingAbilityScore = livingAbilityScore;
    }

    public Integer getWorkingAbilityScore() {
        return workingAbilityScore;
    }

    public void setWorkingAbilityScore(Integer workingAbilityScore) {
        this.workingAbilityScore = workingAbilityScore;
    }

    public Integer getTimeSpaceOrientationScore() {
        return timeSpaceOrientationScore;
    }

    public void setTimeSpaceOrientationScore(Integer timeSpaceOrientationScore) {
        this.timeSpaceOrientationScore = timeSpaceOrientationScore;
    }

    public Integer getPersonOrientationScore() {
        return personOrientationScore;
    }

    public void setPersonOrientationScore(Integer personOrientationScore) {
        this.personOrientationScore = personOrientationScore;
    }

    public Integer getSocialCommunicationAbilityScore() {
        return socialCommunicationAbilityScore;
    }

    public void setSocialCommunicationAbilityScore(Integer socialCommunicationAbilityScore) {
        this.socialCommunicationAbilityScore = socialCommunicationAbilityScore;
    }

    public Integer getTotalScore() {
        return totalScore;
    }

    public void setTotalScore(Integer totalScore) {
        this.totalScore = totalScore;
    }

    public Integer getSocialParticipationLevel() {
        return socialParticipationLevel;
    }

    public void setSocialParticipationLevel(Integer socialParticipationLevel) {
        this.socialParticipationLevel = socialParticipationLevel;
    }

    @Override
    public String toString() {
        return "SocialParticipation{" +
                "id=" + id +
                ", livingAbilityScore=" + livingAbilityScore +
                ", workingAbilityScore=" + workingAbilityScore +
                ", timeSpaceOrientationScore=" + timeSpaceOrientationScore +
                ", personOrientationScore=" + personOrientationScore +
                ", socialCommunicationAbilityScore=" + socialCommunicationAbilityScore +
                ", totalScore=" + totalScore +
                ", socialParticipationLevel=" + socialParticipationLevel +
                '}';
    }
}

mapper:

点击查看代码
package com.vivy.mapper;


import com.vivy.pojo.SocialParticipation;

public interface SocialParticipationMapper {

    void add(SocialParticipation socialParticipation);

}

mapper.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.vivy.mapper.SocialParticipationMapper">

    <insert id="add" parameterType="com.vivy.pojo.SocialParticipation">
        INSERT INTO tb_socialParticipation (
            livingAbilityScore,workingAbilityScore,timeSpaceOrientationScore,
            personOrientationScore,socialCommunicationAbilityScore,totalScore,socialParticipationLevel
        ) VALUES (
                     #{livingAbilityScore}, #{workingAbilityScore}, #{timeSpaceOrientationScore},
                     #{personOrientationScore}, #{socialCommunicationAbilityScore}, #{totalScore},#{socialParticipationLevel}
                 )
    </insert>

</mapper>

service:

点击查看代码
<details>
<summary>点击查看代码</summary>

package com.vivy.service;

import com.vivy.mapper.SocialParticipationMapper;
import com.vivy.pojo.SocialParticipation;
import com.vivy.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public class SocialParticipationService {
SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();

public void add(SocialParticipation socialParticipation){

    SqlSession sqlSession = sqlSessionFactory.openSession();
    SocialParticipationMapper socialParticipationMapper = sqlSession.getMapper(SocialParticipationMapper.class);

    socialParticipationMapper.add(socialParticipation);

    sqlSession.commit();
    sqlSession.close();
}

}

</details>
posted @ 2025-02-20 19:25  vivi_vimi  阅读(11)  评论(0)    收藏  举报