yuhaitao14 před 6 roky
rodič
revize
3d4dea954e

+ 81 - 0
shop/src/main/java/com/zskk/shop/controller/pc/FamilyController.java

@@ -0,0 +1,81 @@
+package com.zskk.shop.controller.pc;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import com.zskk.shop.controller.AbstractController;
+import com.zskk.shop.controller.bean.UserBean;
+import com.zskk.shop.dao.entry.FamilyPeople;
+import com.zskk.shop.exception.ErrorConstant;
+import com.zskk.shop.exception.ZSKKException;
+import com.zskk.shop.service.FamilyPeopleService;
+import com.zskk.shop.service.UserCenterService;
+
+@Controller
+@RequestMapping("/family")
+public class FamilyController extends AbstractController  {
+
+	@Autowired
+	private FamilyPeopleService familyPeopleService;
+	
+	@Autowired
+	private UserCenterService userCenterService;
+	
+	@RequestMapping("/list")
+	public String list(Model model){
+		UserBean userBean 	= this.getUser();
+		List<FamilyPeople> list = familyPeopleService.queryMyPeoples(userBean.getUserid());
+		model.addAttribute("list", list);
+		this.initUser(model);
+		return "/family";
+	}
+	
+	@RequestMapping("goedit/{id}")
+	public String goedit(Model model, @PathVariable("id") Integer id){
+		FamilyPeople people = null;
+		if (id.equals(0)){
+			people = new FamilyPeople();
+			people.setId(0);
+			people.setIdcard("");
+			people.setSex(1);
+			people.setName("");
+			people.setPhone("");
+		}else{
+			people = familyPeopleService.queryMyPeople(id);
+		}
+		
+		if (people == null){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		
+		model.addAttribute("people", people);
+		this.initUser(model);
+		return "/edit_people";
+	}
+	
+	@RequestMapping("save")
+	public String goedit(Model model,
+			FamilyPeople people, @RequestParam("code") String code){
+		
+		if (!userCenterService.checkCode(people.getPhone(), code)){
+			model.addAttribute("msg", "验证码错误");
+			return "/h5/op_error";
+		}
+		
+		if (people.getId().equals(0)){
+			familyPeopleService.addMyPeople(this.getUser().getUserid(), people.getName(), people.getPhone(), 
+					people.getIdcard(), people.getSex(), people.getBirth());
+		}else{
+			familyPeopleService.updateMyPeople(this.getUser().getUserid(), people.getId(), people.getName(), people.getPhone(), 
+					people.getIdcard(), people.getSex(), people.getBirth());
+		}
+		
+		return this.list(model);
+	}
+}

+ 1 - 7
shop/src/main/resource/templates/appointment.html

@@ -33,6 +33,7 @@
 			<ul class="subnav l mt20">
 				<li class="u2"><a href="/mypayedorders" class="ca">预约体检</a></li>
                 <li class="u3"><a href="/tjorders">报告查询</a></li>
+                <li class="u3"><a href="/family/list">家人管理</a></li>
                 <li class="u6"><a href="/fqa">常见问题</a></li>
                 <li class="u7"><a th:attr="href=${ucweb} + '#/resetPwd'" target="_blank">修改密码</a></li>
                 <li class="u8"><a th:attr="href=${uccenter} + 'login/loginout?redirect=' + ${outredirect}">退出登录</a></li>
@@ -73,13 +74,6 @@
 					<div class="u-form" >
 	                    <dl>
 	                    	<dt>选择体检人:</dt>
-	                    	<dd>
-                            <label class="label">
-                                <input class="radio" type="radio" name="people" checked="checked" value="0"/>
-                                <span class="radioInput"></span>
-                                <span>新建体检人</span>
-                            </label>
-                        	</dd>
 	                    	<dd th:each="people:${peoples}">
 	                        	<label class="label">
 	                        		<input class="radio" type="radio" name="people" th:attr="value=${people.id}"/>

+ 1 - 7
shop/src/main/resource/templates/changeappointment.html

@@ -33,6 +33,7 @@
 			<ul class="subnav l mt20">
 				<li class="u2"><a href="/mypayedorders" class="ca">预约体检</a></li>
                 <li class="u3"><a href="/tjorders">报告查询</a></li>
+                <li class="u3"><a href="/family/list">家人管理</a></li>
                 <li class="u6"><a href="/fqa">常见问题</a></li>
                 <li class="u7"><a th:attr="href=${ucweb} + '#/resetPwd'" target="_blank">修改密码</a></li>
                 <li class="u8"><a th:attr="href=${uccenter} + 'login/loginout?redirect=' + ${outredirect}">退出登录</a></li>
@@ -44,13 +45,6 @@
 					<div class="u-form" >
 	                    <dl>
 	                    	<dt>选择体检人:</dt>
-	                    	<dd>
-                            <label class="label">
-                                <input class="radio" type="radio" name="fid" value="0"/>
-                                <span class="radioInput"></span>
-                                <span>新建体检人</span>
-                            </label>
-                        	</dd>
 	                    	<dd th:each="people:${peoples}">
 	                        	<label class="label">
 	                        		<input class="radio" type="radio" name="fid" th:attr="value=${people.id}" th:if="${people.id != appointment.fid}"/>

+ 180 - 0
shop/src/main/resource/templates/edit_people.html

@@ -0,0 +1,180 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>黑龙江昆仑盛和安体检中心</title>
+<link rel="stylesheet" type="text/css" href="/style/common.css" />
+<link rel="stylesheet" type="text/css" href="/style/user.css" />
+<!--[if lt IE 9]> 
+<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
+<![endif]-->
+<!--窗口自适应适配低端IE-->
+<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
+<style type="text/css">
+	.sendBtn {
+		background-color: #333 !important;	
+	}
+	
+	.sendingBtn {
+		background-color: #ccc !important;
+	}
+	
+	.error {
+		border: 1px solid red !important;
+	}
+</style>
+</head>
+
+<body>
+	<div th:include="/fragments :: header"></div>
+	<div class="wp">
+		<div class="main bgFF">
+			<ul class="subnav l mt20">
+				<li class="u2"><a href="/mypayedorders" class="ca">预约体检</a></li>
+                <li class="u3"><a href="/tjorders">报告查询</a></li>
+                <li class="u3"><a href="/family/list">家人管理</a></li>
+                <li class="u6"><a href="/fqa">常见问题</a></li>
+                <li class="u7"><a th:attr="href=${ucweb} + '#/resetPwd'" target="_blank">修改密码</a></li>
+                <li class="u8"><a th:attr="href=${uccenter} + 'login/loginout?redirect=' + ${outredirect}">退出登录</a></li>
+			</ul>
+			<div class="l" style="width: 80%;">
+				<div id="step2Content" >
+					<form action="/family/save" id="form1" method="post">
+					<input type="hidden" name="id" th:attr="value=${people.id}"/>
+					<div class="u-form" >
+	                    <div style="width:100%; height:1px; background-color:#EEE; font-size:0; "></div>
+	                  	<dl>
+	                  		<dt>体检人证件号:</dt>
+	                  		<dd>
+	                  			<select class="slt">
+	                  				<option>身份证</option>
+	                  			</select>
+	                  			<input id="idcard" name="idcard" type="text" class="txt ml5" style="width:231px; " placeholder="请输入身份证号码" maxlength="19" th:attr="value=${people.idcard}"/>
+	                  		</dd>
+	                  	</dl>
+	                    <dl>
+	                    	<dt>姓名:</dt>
+	                    	<dd>
+	                    		<input id="name" name="name" type="text" class="txt" placeholder="请输入与证件上一致的体检人姓名" style="width:300px; " maxlength="32" th:attr="value=${people.name}"/>
+	                    	</dd>
+	                    </dl>
+	                    <dl>
+	                    	<dt>性别:</dt>
+	                    	<dd>
+	                            <label class="label">
+	                            	<input id="sex1" class="radio" type="radio" name="sex" value="1" checked="checked" th:if="${people.sex == 1}"/>
+	                            	<input id="sex1" class="radio" type="radio" name="sex" value="1"  th:if="${people.sex == 0}"/>
+	                            	<span class="radioInput"></span>男
+	                            </label>
+	                        </dd>
+	                    	<dd>
+	                        	<label class="label">
+	                        		<input id="sex1" class="radio" type="radio" name="sex" value="0"  th:if="${people.sex == 1}"/>
+	                            	<input id="sex1" class="radio" type="radio" name="sex" value="0" checked="checked" th:if="${people.sex == 0}"/>
+	                        		<span class="radioInput"></span>女
+	                        	</label>
+	                        </dd>
+	                    </dl>
+	                    <dl>
+	                    	<dt>生日:</dt>
+	                    	<dd>
+	                    		<input id="birth" name="birth" type="text" class="txt" style="width:300px; " onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd'})" placeholder="请选择生日" readonly="readonly" th:attr="value=${people.birth}"/>
+	                    	</dd>
+	                    </dl>
+	                    <dl>
+	                    	<dt>手机号码:</dt>
+	                    	<dd>
+	                    		<input id="phone" name="phone" type="text" class="txt" style="width:300px; " placeholder="请输入手机号" maxlength="32" th:attr="value=${people.phone}"/>
+	                    	</dd>
+	                    </dl>
+	                    <dl>
+	                    	<dt>验证码:</dt>
+	                    	<dd>
+	                    		<input id="code" name="code" type="text" class="txt" style="width:300px; " placeholder="请输入验证码" maxlength="32"/>
+	                    	</dd>
+	                    </dl>
+	                </div>
+	                 <div class="user_speed_nextBar">
+	                 	<input type="button" value="保存" onclick="save()" class="nextBtn"/>
+	                 	<input id="sendCodeBtn" type="button" class="preBtn sendBtn" onclick="sendCode()" value="发送验证码"/>
+					</div>
+					</form>
+				</div>
+			</div>
+		</div>
+	</div>	
+	
+	<div th:replace="/fragments :: footer"></div>
+	<script src="/plugs/My97DatePicker/WdatePicker.js"></script>
+	<script th:inline="javascript">
+		/* <![CDATA[ */
+		
+		var maxTime = 10;
+        var nowTime = maxTime+1;
+			
+		function timer(){
+        	nowTime--;
+    		if (nowTime > 0){
+    			console.log(nowTime + "s");
+    			$("#sendCodeBtn").val(nowTime + "s");
+    			setTimeout(timer, 1000);
+    		}else{
+            	$("#sendCodeBtn").attr('disabled',false);
+            	$("#sendCodeBtn").addClass("sendBtn");
+            	$("#sendCodeBtn").removeClass("sendingBtn");
+    			$("#sendCodeBtn").val("发送验证码");
+            	nowTime = maxTime+1;
+    		}
+    	}
+		
+		function sendCode(){
+			var phone = $("#phone").val();
+        	if (phone.length == 0){
+        		alert("请输入手机号");
+        		return;
+        	}
+        	$("#sendCodeBtn").attr('disabled',true);
+        	$("#sendCodeBtn").addClass("sendingBtn");
+        	$("#sendCodeBtn").removeClass("sendBtn");
+        	
+        	timer();
+        	
+        	$.get("/api/sendCode/" + phone, function(data){
+        		if (data.code == 0){
+        			console.log("OK");
+        		}
+        	});
+		}
+		
+		function save(){
+			if (!this.check()){
+				return;
+			}
+			
+			console.log("22");
+			$("#form1").submit();
+		}
+		
+		function check(){
+			var idValidates = [/^\d{17}[\dXx]$/, /^.+$/, /^1\d{10}$/, /^.+$/, /^.+$/, /^.+$/]
+			var ok = true;
+			var ids = ["idcard", "name", "phone", "birth", "code"]
+			for (var i = 0; i < ids.length; ++i){
+				var id 	= ids[i]
+				var obj	= $("#" + id)
+				var val = obj.val()
+				
+				var validate = idValidates[i]
+				if (validate && validate.test(val)){
+					obj.removeClass("error")
+				}else{
+					obj.addClass('error')
+					ok = false
+				}
+			}
+			return ok;
+		}
+		/* ]]> */
+	</script>
+</body>
+</html>

+ 61 - 0
shop/src/main/resource/templates/family.html

@@ -0,0 +1,61 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>黑龙江昆仑盛和安体检中心</title>
+<link rel="stylesheet" type="text/css" href="../style/common.css"></link>
+<link rel="stylesheet" type="text/css" href="../style/user.css"></link>
+<!--[if lt IE 9]> 
+<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
+<![endif]--><!--窗口自适应适配低端IE-->
+<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
+<style>
+	.addBtn {
+		
+	}
+</style>
+</head>
+
+<body>
+	<div th:include="/fragments :: header"></div>
+	
+    <div class="wp">
+    	<div class="main bgFF">
+            <ul class="subnav l mt20">
+                <li class="u2"><a href="/mypayedorders" >预约体检</a></li>
+                <li class="u3"><a href="/tjorders">报告查询</a></li>
+                <li class="u3"><a href="/family/list" class="ca">家人管理</a></li>
+                <li class="u6"><a href="/fqa">常见问题</a></li>
+                <li class="u7"><a th:attr="href=${ucweb} + '#/resetPwd'" target="_blank">修改密码</a></li>
+                <li class="u8"><a th:attr="href=${uccenter} + 'login/loginout?redirect=' + ${outredirect}">退出登录</a></li>
+            </ul>
+            <div style="text-align: right;" class="user_speed_nextBar">
+            	<a href="/family/goedit/0" class="nextBtn" >添加家人</a>
+            </div>
+            <div class="l" style="width:80%; ">
+                <table class="tab-1-EEE mt20" th:each="people : ${list}">
+                    <thead>
+                        <tr>
+                            <td>名称:
+                            	<span th:text="${people.name}"></span>
+                            </td>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <tr >
+                            <td>
+                            	<div class="l">
+                            		<strong class="f12" th:text="'身份证:' + ${people.name}"></strong>
+                            		<div class="cBlue mt10" >手机号:<span th:text="${people.phone}"></span></div>
+                            	</div>
+                            	<a  th:attr="href='/family/goedit/' + ${people.id}" class="btn-blue y" >编辑</a>
+                            </td>
+                        </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+    <div th:replace="/fragments :: footer"></div>
+</body>
+</html>

+ 1 - 0
shop/src/main/resource/templates/mypayedorders.html

@@ -19,6 +19,7 @@
             <ul class="subnav l mt20">
                 <li class="u2"><a href="/mypayedorders" class="ca">预约体检</a></li>
                 <li class="u3"><a href="/tjorders">报告查询</a></li>
+                <li class="u3"><a href="/family/list">家人管理</a></li>
                 <li class="u6"><a href="/fqa">常见问题</a></li>
                 <li class="u7"><a th:attr="href=${ucweb} + '#/resetPwd'" target="_blank">修改密码</a></li>
                 <li class="u8"><a th:attr="href=${uccenter} + 'login/loginout?redirect=' + ${outredirect}">退出登录</a></li>

+ 1 - 0
shop/src/main/resource/templates/query_report.html

@@ -19,6 +19,7 @@
             <ul class="subnav l mt20">
                <li class="u2"><a href="/mypayedorders" class="ca">预约体检</a></li>
                 <li class="u3"><a href="/tjorders">报告查询</a></li>
+                <li class="u3"><a href="/family/list">家人管理</a></li>
                 <li class="u6"><a href="/fqa">常见问题</a></li>
                 <li class="u7"><a th:attr="href=${ucweb} + '#/resetPwd'" target="_blank">修改密码</a></li>
                 <li class="u8"><a th:attr="href=${uccenter} + 'login/loginout?redirect=' + ${outredirect}">退出登录</a></li>