老年人能力评估3

create table plan(
number varbinary(8),
date date,
reason text,
PRIMARY KEY (number)
);
create table people(
name text,
sex text,
birthday date,
idnumber varbinary(11),
socialid varbinary(9),
nation text,
education text,
religion text,
marriage text,
reside text,
medical text,
income text,
stupid text,
mental text,
chronic text,
tumble text,
lost text,
dysphoria text,
suicide text,
other text,
plan_number VARBINARY(8),
FOREIGN KEY (plan_number) REFERENCES plan(number)
);
create table informat(
name text,
relation text,
contacts text,
phone text,
plan_number VARBINARY(8),
FOREIGN KEY (plan_number) REFERENCES plan(number)
);
针对于表的改变,以便根据plan中的number来查询对应的people和informat的内容

被评估人基本信息的填写

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.Date;
import java.sql.SQLException;

@WebServlet("/addpeople")
public class addpeople extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String name = request.getParameter("name");
        String sex =request.getParameter("sex");
        Date birthday = Date.valueOf(request.getParameter("birthday"));
        String idnumber=request.getParameter("idnumber");
        String socialid=request.getParameter("socialid");
        String nation=request.getParameter("nation");
        if(nation.equals("少数民族")) nation=request.getParameter("othernation");
        String education=request.getParameter("education");
        String religion=request.getParameter("religion");
        if(religion.equals("有")) religion=request.getParameter("otherreligion");
        String marriage=request.getParameter("marriage");
        String reside=request.getParameter("reside");
        String medical=request.getParameter("medical");
        if(medical.equals("其他")) medical=request.getParameter("othermedical");
        String income=request.getParameter("income");
        if(income.equals("其他补贴")) income=request.getParameter("otherincome");
        String stupid=request.getParameter("stup");
        String mental=request.getParameter("mental");
        String chronic=request.getParameter("chronic");
        String tumble=request.getParameter("tumble");
        String lost=request.getParameter("lost");
        String dysphoria=request.getParameter("dysphoria");
        String suicide=request.getParameter("suicide");
        String other=request.getParameter("other");
        peopledata data=new peopledata(name,sex,birthday,idnumber,socialid,nation,education,religion,marriage,reside,medical,income,stupid,mental,chronic,tumble,lost,dysphoria,suicide,other);
        Dao dao=new Dao();
        try {
            if(dao.addpeople(data)){
                response.sendRedirect("operator.jsp");
            }
            else {
                request.getRequestDispatcher("addpeople.jsp").forward(request, response);
            }
        } catch (SQLException | ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
```plaintext
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>填写被评估者的基本信息</title>
    <script>
        function toggleNationInput() {
            var select = document.getElementById('nation');
            var inputBox = document.getElementById('othernation');

            if (select.value === '少数民族') {
                inputBox.style.display = 'block';
            } else {
                inputBox.style.display = 'none';
            }
        }
        function toggleReligionInput() {
            var select = document.getElementById('religion');
            var inputBox = document.getElementById('otherreligion');

            if (select.value === '有') {
                inputBox.style.display = 'block';
            } else {
                inputBox.style.display = 'none';
            }
        }
        function toggleIncomeInput() {
            var select = document.getElementById('income');
            var inputBox = document.getElementById('otherincome');

            if (select.value === '其他补贴') {
                inputBox.style.display = 'block';
            } else {
                inputBox.style.display = 'none';
            }
        }
        function toggleMedicalInput() {
            var select = document.getElementById('medical');
            var inputBox = document.getElementById('othermedical');

            if (select.value === '其他') {
                inputBox.style.display = 'block';
            } else {
                inputBox.style.display = 'none';
            }
        }
    </script>
</head>
<body>
<form action="addpeople" method="post">
    <label for="name">姓名:</label>
    <input name="name" type="text" id="name"><br>

    <label for="sex">性别:</label>
    <select name="sex" id="sex">
        <option value="男">男</option>
        <option value="女">女</option>
    </select><br>

    <label for="birthday">出生日期:</label>
    <input name="birthday" type="date" id="birthday"><br>

    <label for="idnumber">身份证号:</label>
    <input name="idnumber" type="text" id="idnumber"><br>

    <label for="socialid">社保卡号:</label>
    <input name="socialid" type="text" id="socialid"><br>

    <label for="nation">民族:</label>
    <select name="nation" id="nation">
        <option value="汉族">汉族</option>
        <option value="少数民族">少数民族</option>
    </select>

    <label for="othernation"></label>
    <input name="othernation" type="text" id="othernation" style="display: none;"><br>

    <label for="education">文化程度:</label>
    <select name="education" id="education">
        <option value="文盲">文盲</option>
        <option value="小学">小学</option>
        <option value="初中">初中</option>
        <option value="高中/技校/中专">高中/技校/中专</option>
        <option value="大学专科及以上">大学专科及以上</option>
        <option value="不详">不详</option>
    </select><br>

    <label for="religion">宗教信仰:</label>
    <select name="religion" id="religion">
        <option value="无">无</option>
        <option value="有">有</option>
    </select>

    <label for="otherreligion"></label>
    <input name="otherreligion" type="text" id="otherreligion" style="display: none;"><br>

    <label for="marriage">婚姻状况:</label>
    <select name="marriage" id="marriage">
        <option value="未婚">未婚</option>
        <option value="已婚">已婚</option>
        <option value="丧偶">丧偶</option>
        <option value="离婚">离婚</option>
        <option value="未说明的婚姻状况">未说明的婚姻状况</option>
    </select><br>

    <label for="reside">居住情况:</label>
    <select name="reside" id="reside">
        <option value="独居">独居</option>
        <option value="与配偶/伴侣居住">与配偶/伴侣居住</option>
        <option value="与子女居住">与子女居住</option>
        <option value="与父母居住">与父母居住</option>
        <option value="与兄弟姐妹居住">与兄弟姐妹居住</option>
        <option value="与其他亲属居住">与其他亲属居住</option>
        <option value="与非亲属关系的人居住">与非亲属关系的人居住</option>
        <option value="养老机构">养老机构</option>
    </select><br>

    <label for="medical">医疗费用支付方式:</label>
    <select name="medical" id="medical">
        <option value="城镇职工基本医疗保险">城镇职工基本医疗保险</option>
        <option value="城镇居民基本医疗保险">城镇居民基本医疗保险</option>
        <option value="新型农村合作医疗">新型农村合作医疗</option>
        <option value="贫困救助">贫困救助</option>
        <option value="商业医疗保险">商业医疗保险</option>
        <option value="全公费">全公费</option>
        <option value="全自费">全自费</option>
        <option value="其他">其他</option>
    </select>

    <label for="othermedical"></label>
    <input name="othermedical" type="text" id="othermedical" style="display: none;"><br>

    <label for="income">经济来源:</label>
    <select name="income" id="income">
        <option value="退休金/养老金">退休金/养老金</option>
        <option value="子女补贴">子女补贴</option>
        <option value="亲友资助">亲友资助</option>
        <option value="其他补贴">其他补贴</option>
    </select><br>

    <label for="otherincome"></label>
    <input name="otherincome" type="text" id="otherincome" style="display: none;"><br>

    <label for="stupid">痴呆:</label>
    <select name="stupid" id="stupid">
        <option value="无">无</option>
        <option value="轻度">轻度</option>
        <option value="中度">中度</option>
        <option value="重度">重度</option>
    </select><br>

    <label for="mental">精神疾病:</label>
    <select name="mental" id="mental">
        <option value="无">无</option>
        <option value="精神分裂症">精神分裂症</option>
        <option value="双相情感障碍">双相情感障碍</option>
        <option value="偏执性精神障碍">偏执性精神障碍</option>
        <option value="分裂情感性障碍">分裂情感性障碍</option>
        <option value="癫痫所致精神障碍">癫痫所致精神障碍</option>
        <option value="精神发育迟滞伴发精神障碍">精神发育迟滞伴发精神障碍</option>
    </select><br>

    <label for="chronic">慢性疾病:</label>
    <input name="chronic" type="text" id="chronic"><br>

    <label for="tumble">跌倒:</label>
    <select name="tumble" id="tumble">
        <option value="无">无</option>
        <option value="发生过 1 次">发生过 1 次</option>
        <option value="发生过 2 次">发生过 2 次</option>
        <option value="发生过 3 次及以上">发生过 3 次及以上</option>
    </select><br>

    <label for="lost">走失:</label>
    <select name="lost" id="lost">
        <option value="无">无</option>
        <option value="发生过 1 次">发生过 1 次</option>
        <option value="发生过 2 次">发生过 2 次</option>
        <option value="发生过 3 次及以上">发生过 3 次及以上</option>
    </select><br>

    <label for="dysphoria">噎食:</label>
    <select name="dysphoria" id="dysphoria">
        <option value="无">无</option>
        <option value="发生过 1 次">发生过 1 次</option>
        <option value="发生过 2 次">发生过 2 次</option>
        <option value="发生过 3 次及以上">发生过 3 次及以上</option>
    </select><br>

    <label for="suicide">自杀:</label>
    <select name="suicide" id="suicide">
        <option value="无">无</option>
        <option value="发生过 1 次">发生过 1 次</option>
        <option value="发生过 2 次">发生过 2 次</option>
        <option value="发生过 3 次及以上">发生过 3 次及以上</option>
    </select><br>

    <label for="other">其他:</label>
    <input name="other" type="text" id="other"><br>

    <input type="submit" value="完成">
</form>
</body>
</html>
posted @ 2025-02-02 21:06  sword_kong  阅读(9)  评论(0)    收藏  举报