yby 2 months ago
parent
commit
173ce7bdd1

+ 2 - 2
src/com/gydx/hosp/dao/RegisterInfoMapper.xml

@@ -5,7 +5,7 @@
 <mapper namespace="com.gydx.hosp.dao.RegisterInfoMapper">
 
     <insert id="AddRegister" parameterType="com.gydx.hosp.vo.RegisterInfoVO">
-        insert into register_info (id, name ,sex ,age ,date ,reimburse ,phone ,remarks)
-        values (#{id}, #{name},#{sex}, #{age},#{date},#{reimburse},#{phone}, #{remarks});
+        insert into register_info (account, id, name ,sex ,age ,date ,reimburse ,phone ,remarks ,doctor_id ,doctor_name ,state ,time)
+        values (#{account}, #{id}, #{name},#{sex}, #{age},#{date},#{reimburse},#{phone}, #{remarks} ,#{doctorId} ,#{doctorName} ,#{state} ,#{time});
     </insert>
 </mapper>

+ 41 - 8
web/WEB-INF/page/app/sufferer-info.jsp

@@ -1,11 +1,11 @@
 <%@ page import="com.gydx.hosp.vo.RegisterInfoVO" %>
+<%@ page import="com.gydx.hosp.vo.ScheduleVO" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%
     String path = request.getContextPath();
     RegisterInfoVO vo = (RegisterInfoVO)session.getAttribute("selectDoctorRegisterInfoVO");
-
+    String account = (String) session.getAttribute("account");
 %>
-
 <html>
 <head>
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -105,6 +105,9 @@
     <h2 class="header-3">预约挂号</h2>
 </div>
 <div id="form">
+    <div class="form-group" style="display: none">
+        <input type="text" name="account" placeholder="账号" style="display: none">
+    </div>
     <div class="form-group">
         <input type="text" name="name" placeholder="请输入姓名">
     </div>
@@ -119,7 +122,10 @@
         <input type="text" name="age" placeholder="请输入年龄">
     </div>
     <div class="form-group">
-        <input type="date" name="date" placeholder="选择日期">
+        <input name="date" value="<%=vo.getDate()%>" disabled>
+    </div>
+    <div class="form-group">
+        <input type="text" name="time" value="<%=vo.getTime()%>" disabled>
     </div>
     <div class="form-group">
         <select name="reimburse">
@@ -135,6 +141,15 @@
     <div class="form-group">
         <textarea name="remarks" placeholder="请输入备注"></textarea>
     </div>
+    <div class="form-group" style="display: none">
+        <input type="text" name="doctor_id" value="<%=vo.getDoctorId()%>" style="display: none">
+    </div>
+    <div class="form-group" style="display: none">
+        <input type="text" name="doctor_name" value="<%=vo.getDoctorName()%>" style="display: none">
+    </div>
+    <div class="form-group" style="display: none">
+        <input type="text" name="state" value="NoChecked" style="display: none">
+    </div>
     <div class="form-group">
         <input type="button" onclick="submitAppointment()" value="确认支付">
     </div>
@@ -142,39 +157,58 @@
 </body>
 <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.js"></script>
 <script>
+
+    const phoneInput = document.querySelector('input[name="phone"]');
+    phoneInput.addEventListener('input', function () {
+        const value = this.value;
+        const onlyNumbers = value.replace(/\D/g, '');
+        if (onlyNumbers.length > 11 || onlyNumbers.length < 11) {
+            this.value = onlyNumbers.slice(0, 11);
+        }
+    });
+
     $(document).ready(init)
     function init(){
         console.log("<%=vo.getDoctorId()%> <%=vo.getDoctorName()%> <%=vo.getDate()%> <%=vo.getTime()%>")
     }
     function submitAppointment() {
         // 获取表单中的各个值
+        var account = "<%= account %>";
         var name = document.querySelector('input[name="name"]').value;
         var sex = document.querySelector('select[name="sex"]').value;
         var age = document.querySelector('input[name="age"]').value;
-        var date = document.querySelector('input[name="date"]').value;
+        var date = "<%= vo.getDate() %>";
+        var time = "<%= vo.getDate() %>";
         var reimburse = document.querySelector('select[name="reimburse"]').value;
         var phone = document.querySelector('input[name="phone"]').value;
         var remarks = document.querySelector('textarea[name="remarks"]').value;
+        var doctor_id = "<%= vo.getDoctorId() %>";
+        var doctor_name = "<%= vo.getDoctorName() %>";
+        var state = "NoChecked";
 
         // 检查必填字段是否有值
         if (!name || sex === '-请选择性别-' ||!age ||!date || reimburse === '-请选择报销方式-' ||!phone) {
             alert('请填写完整的预约信息!');
             return;
         }
-
         // 可以在这里进行数据的提交处理,假设使用 AJAX 提交到服务器
         $.ajax({
             url: '<%=path%>/addRegister/AddRegister.action', // 替换为实际的提交地址
             data: {
+                account:account,
                 name: name,
                 sex: sex,
                 age: age,
                 date: date,
+                time: time,
                 reimburse: reimburse,
                 phone: phone,
-                remarks: remarks
+                remarks: remarks,
+                doctorId: doctor_id,
+                doctorName: doctor_name,
+                state: state,
             },
-            method: 'post',
+            method: 'get',
             success: function(response) {
                 // 提交成功后的处理
                 alert('预约成功!');
@@ -182,7 +216,6 @@
                 document.querySelector('input[name="name"]').value = '';
                 document.querySelector('select[name="sex"]').value = '-请选择性别-';
                 document.querySelector('input[name="age"]').value = '';
-                document.querySelector('input[name="date"]').value = '';
                 document.querySelector('select[name="reimburse"]').value = '-请选择报销方式-';
                 document.querySelector('input[name="phone"]').value = '';
                 document.querySelector('textarea[name="remarks"]').value = '';