体检
This commit is contained in:
+1
-1
@@ -284,7 +284,7 @@ public class ActivityBasicScopeController {
|
|||||||
addv("is_H04", ShiroUtil.hasRole("H04"));
|
addv("is_H04", ShiroUtil.hasRole("H04"));
|
||||||
addv("is_H02", ShiroUtil.hasRole("club01"));
|
addv("is_H02", ShiroUtil.hasRole("club01"));
|
||||||
addv("is_H03", ShiroUtil.hasRole("SchoolUnionMemberAdmin"));
|
addv("is_H03", ShiroUtil.hasRole("SchoolUnionMemberAdmin"));
|
||||||
addv("is_sysadmin", ShiroUtil.hasRole("sysadmin,SCHOOL_UNION_SPORTS_ADMIN"));
|
addv("is_sysadmin", ShiroUtil.hasAnyRoles("sysadmin,SCHOOL_UNION_SPORTS_ADMIN"));
|
||||||
addv("unionid", Vi.getUnionId());
|
addv("unionid", Vi.getUnionId());
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|||||||
+42
-16
@@ -3,13 +3,14 @@ package io.v.nutz.zhgh.healthCheckup.controller;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.wizzer.framework.page.Pagination;
|
import cn.wizzer.framework.page.Pagination;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
|
import io.v.nutz.base.result.Result;
|
||||||
import io.v.nutz.base.utils.Vi;
|
import io.v.nutz.base.utils.Vi;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProjectSubject;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
||||||
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
|
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
|
||||||
import io.v.nutz.base.query.PageForm;
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
@@ -117,28 +118,53 @@ public class HealthCheckupListController {
|
|||||||
@ViReturn
|
@ViReturn
|
||||||
@Aop(TransAop.READ_COMMITTED)
|
@Aop(TransAop.READ_COMMITTED)
|
||||||
@RequiresPermissions("healthCheckup.list.mange")
|
@RequiresPermissions("healthCheckup.list.mange")
|
||||||
public Object doEditHealthCheckupData(String subjectId, String campus, String projectId, String userId) {
|
public Object doEditHealthCheckupData(HealthCheckupUserSelection selection) {
|
||||||
|
if (Lang.isEmpty(selection)) {
|
||||||
|
return Result.error("数据传递异常");
|
||||||
|
}
|
||||||
|
if (Lang.isEmpty(selection.getSelectUserId())) {
|
||||||
|
return Result.error("请选择用户");
|
||||||
|
}
|
||||||
//查询用户有没有选择过套餐
|
//查询用户有没有选择过套餐
|
||||||
HealthCheckupUserSelection userSelection = healthCheckupProjectService.dao().fetch(HealthCheckupUserSelection.class,
|
HealthCheckupUserSelection userSelection = healthCheckupProjectService.dao().fetch(HealthCheckupUserSelection.class,
|
||||||
Cnd.where("projectId", "=", projectId).and("selectUserId", "=", userId));
|
Cnd.where("projectId", "=", selection.getProjectId()).and("selectUserId", "=", selection.getSelectUserId()));
|
||||||
//如果选择过套餐就修改选择的套餐id
|
//如果选择过套餐就修改选择的套餐id
|
||||||
if (Lang.isNotEmpty(userSelection)) {
|
if (Lang.isNotEmpty(userSelection)) {
|
||||||
userSelection.setSubjectId(subjectId);
|
selection.setId(userSelection.getId());
|
||||||
userSelection.setCampus(campus);
|
|
||||||
healthCheckupProjectService.update(userSelection);
|
|
||||||
} else {
|
|
||||||
//如果没有选择过套餐添加一条记录
|
|
||||||
HealthCheckupUserSelection checkupUserSelection = new HealthCheckupUserSelection();
|
|
||||||
checkupUserSelection.setSelectUserId(userId);
|
|
||||||
checkupUserSelection.setProjectId(projectId);
|
|
||||||
checkupUserSelection.setSubjectId(subjectId);
|
|
||||||
checkupUserSelection.setCampus(campus);
|
|
||||||
checkupUserSelection.setSelectTime(new Date());
|
|
||||||
healthCheckupProjectService.insert(checkupUserSelection);
|
|
||||||
}
|
}
|
||||||
|
selection.setSelectTime(new Date());
|
||||||
|
healthCheckupProjectService.dao().insertOrUpdate(selection);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresPermissions("healthCheckup.list.mange")
|
||||||
|
public Object getHealthEditData(String userId, String projectId){
|
||||||
|
// 先去查询有没有选择,选择了直接返回数据
|
||||||
|
HealthCheckupUserSelection userSelection = healthCheckupProjectService.dao().fetch(HealthCheckupUserSelection.class,
|
||||||
|
Cnd.where("projectId", "=", projectId).and("selectUserId", "=", userId));
|
||||||
|
// 没有选择去查询基本信息
|
||||||
|
if (Lang.isNotEmpty(userSelection)) {
|
||||||
|
return userSelection;
|
||||||
|
} else {
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
loginname,
|
||||||
|
username,
|
||||||
|
sex,
|
||||||
|
mobile,
|
||||||
|
idcard,
|
||||||
|
TIMESTAMPDIFF(YEAR, STR_TO_DATE(SUBSTRING(idcard, 7, 8), '%Y%m%d'), CURDATE()) AS age
|
||||||
|
FROM
|
||||||
|
sys_user
|
||||||
|
WHERE id = @userId
|
||||||
|
""").setParam("userId", userId);
|
||||||
|
sql.setCallback(Sqls.callback.map());
|
||||||
|
healthCheckupProjectService.dao().execute(sql);
|
||||||
|
return sql.getResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,31 @@ public class HealthCheckupUserSelection {
|
|||||||
@ColDefine(type = ColType.VARCHAR, width = 32)
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
private String campus;
|
private String campus;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("用户名")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 50)
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("性别")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 32)
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("年龄")
|
||||||
|
@ColDefine(type = ColType.INT)
|
||||||
|
private Integer age;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("身份证号")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 18)
|
||||||
|
private String idcard;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
@Comment("联系方式")
|
||||||
|
@ColDefine(type = ColType.VARCHAR, width = 20)
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
@Column
|
@Column
|
||||||
@Comment("选择时间")
|
@Comment("选择时间")
|
||||||
@ColDefine(type = ColType.DATETIME)
|
@ColDefine(type = ColType.DATETIME)
|
||||||
|
|||||||
+58
-14
@@ -5,14 +5,16 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
import cn.wizzer.framework.base.Result;
|
import cn.wizzer.framework.base.Result;
|
||||||
import io.v.nutz.base.annontation.ViReturn;
|
import io.v.nutz.base.annontation.ViReturn;
|
||||||
import io.v.nutz.base.page.Pagination;
|
import io.v.nutz.base.page.Pagination;
|
||||||
|
import io.v.nutz.base.query.PageForm;
|
||||||
import io.v.nutz.base.service.BaseService;
|
import io.v.nutz.base.service.BaseService;
|
||||||
|
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupCampus;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupCampus;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupProject;
|
||||||
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
import io.v.nutz.zhgh.healthCheckup.model.HealthCheckupUserSelection;
|
||||||
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
|
import io.v.nutz.zhgh.healthCheckup.service.HealthCheckupProjectService;
|
||||||
import io.v.nutz.base.query.PageForm;
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
|
||||||
import org.nutz.dao.Cnd;
|
import org.nutz.dao.Cnd;
|
||||||
|
import org.nutz.dao.Dao;
|
||||||
import org.nutz.dao.Sqls;
|
import org.nutz.dao.Sqls;
|
||||||
import org.nutz.dao.sql.Sql;
|
import org.nutz.dao.sql.Sql;
|
||||||
import org.nutz.ioc.loader.annotation.Inject;
|
import org.nutz.ioc.loader.annotation.Inject;
|
||||||
@@ -31,25 +33,25 @@ import java.util.Date;
|
|||||||
@At("/mobile/healthCheckup")
|
@At("/mobile/healthCheckup")
|
||||||
public class MHealthCheckupListController {
|
public class MHealthCheckupListController {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Dao dao;
|
||||||
@Inject
|
@Inject
|
||||||
private BaseService baseService;
|
private BaseService baseService;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private HealthCheckupProjectService healthCheckupProjectService;
|
private HealthCheckupProjectService healthCheckupProjectService;
|
||||||
|
|
||||||
@At("/list")
|
@At("/list")
|
||||||
|
@RequiresAuthentication
|
||||||
@Ok("beetl:/mobile/healthCheckup/list.html")
|
@Ok("beetl:/mobile/healthCheckup/list.html")
|
||||||
public void index() {
|
public void index() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@At("/checkUp")
|
@At("/checkUp")
|
||||||
|
@RequiresAuthentication
|
||||||
@Ok("beetl:/mobile/healthCheckup/checkUp.html")
|
@Ok("beetl:/mobile/healthCheckup/checkUp.html")
|
||||||
public void checkUp() {
|
public void checkUp() {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@At("/mine")
|
@At("/mine")
|
||||||
|
@RequiresAuthentication
|
||||||
@Ok("beetl:/mobile/healthCheckup/mine.html")
|
@Ok("beetl:/mobile/healthCheckup/mine.html")
|
||||||
public void mine() {
|
public void mine() {
|
||||||
|
|
||||||
@@ -57,16 +59,29 @@ public class MHealthCheckupListController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
public Object pageData(PageForm pageForm, @Param(value = "tabName", required = false) String tabName) {
|
public Object pageData(PageForm pageForm, @Param(value = "tabName", required = false) String tabName) {
|
||||||
|
// Sql sql = Sqls.create("""
|
||||||
|
// select
|
||||||
|
// p.*,
|
||||||
|
// (select count(*) from health_checkup_user_selection s where s.projectId=p.id and s.selectUserId=@userId) as selectCount
|
||||||
|
// from
|
||||||
|
// health_checkup_project p
|
||||||
|
// LEFT JOIN health_checkup_user hcu on hcu.projectId = p.id
|
||||||
|
// $condition
|
||||||
|
// """).setParam("userId", ShiroUtil.getUserId());
|
||||||
|
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
select
|
SELECT
|
||||||
p.*,
|
p.*,
|
||||||
(select count(*) from health_checkup_user_selection s where s.projectId=p.id and s.selectUserId=@userId) as selectCount
|
sum(IF(hs.id is not null,1,0)) AS selectCount,
|
||||||
from
|
hs.id AS selectId
|
||||||
|
FROM
|
||||||
health_checkup_project p
|
health_checkup_project p
|
||||||
LEFT JOIN health_checkup_user hcu on hcu.projectId = p.id
|
LEFT JOIN health_checkup_user hcu ON hcu.projectId = p.id
|
||||||
|
LEFT JOIN health_checkup_user_selection hs ON hs.selectUserId = hcu.userId
|
||||||
$condition
|
$condition
|
||||||
""").setParam("userId", ShiroUtil.getUserId());
|
""");
|
||||||
Cnd cnd = Cnd.NEW();
|
Cnd cnd = Cnd.NEW();
|
||||||
cnd.and("hcu.userId", "=", ShiroUtil.getUserId());
|
cnd.and("hcu.userId", "=", ShiroUtil.getUserId());
|
||||||
if ("ing".equals(tabName)) {
|
if ("ing".equals(tabName)) {
|
||||||
@@ -74,6 +89,7 @@ public class MHealthCheckupListController {
|
|||||||
} else if ("end".equals(tabName)) {
|
} else if ("end".equals(tabName)) {
|
||||||
cnd.and("p.choiceTimeEnd", "<", DateUtil.now());
|
cnd.and("p.choiceTimeEnd", "<", DateUtil.now());
|
||||||
}
|
}
|
||||||
|
cnd.groupBy("p.id");
|
||||||
cnd.asc("selectCount");
|
cnd.asc("selectCount");
|
||||||
sql.setCondition(cnd);
|
sql.setCondition(cnd);
|
||||||
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
Pagination pagination = baseService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||||
@@ -82,6 +98,7 @@ public class MHealthCheckupListController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
public Object mineData(PageForm pageForm, @Param(value = "tabName", required = false) String tabName) {
|
public Object mineData(PageForm pageForm, @Param(value = "tabName", required = false) String tabName) {
|
||||||
Sql sql = Sqls.create("""
|
Sql sql = Sqls.create("""
|
||||||
SELECT
|
SELECT
|
||||||
@@ -109,6 +126,7 @@ public class MHealthCheckupListController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
public Object doSubmit(@Param("userSelection") HealthCheckupUserSelection userSelection) {
|
public Object doSubmit(@Param("userSelection") HealthCheckupUserSelection userSelection) {
|
||||||
Trans.exec(() -> {
|
Trans.exec(() -> {
|
||||||
if (userSelection.getId() == null) {
|
if (userSelection.getId() == null) {
|
||||||
@@ -126,6 +144,7 @@ public class MHealthCheckupListController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
public Object cancel(String id, String projectId) {
|
public Object cancel(String id, String projectId) {
|
||||||
HealthCheckupProject checkupProject = baseService.dao().fetch(HealthCheckupProject.class, projectId);
|
HealthCheckupProject checkupProject = baseService.dao().fetch(HealthCheckupProject.class, projectId);
|
||||||
if (DateUtil.compare(new Date(), checkupProject.getChoiceTimeEnd()) > 0) {
|
if (DateUtil.compare(new Date(), checkupProject.getChoiceTimeEnd()) > 0) {
|
||||||
@@ -141,6 +160,7 @@ public class MHealthCheckupListController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
public Object getSelectInfo(String id) {
|
public Object getSelectInfo(String id) {
|
||||||
HealthCheckupUserSelection selection = baseService.dao().fetch(HealthCheckupUserSelection.class, id);
|
HealthCheckupUserSelection selection = baseService.dao().fetch(HealthCheckupUserSelection.class, id);
|
||||||
baseService.dao().fetchLinks(selection, "companionList");
|
baseService.dao().fetchLinks(selection, "companionList");
|
||||||
@@ -155,12 +175,14 @@ public class MHealthCheckupListController {
|
|||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
public Object getCampus() {
|
public Object getCampus() {
|
||||||
return baseService.dao().query(HealthCheckupCampus.class, Cnd.NEW().asc("campusCode"));
|
return baseService.dao().query(HealthCheckupCampus.class, Cnd.NEW().asc("campusCode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@At
|
@At
|
||||||
@ViReturn
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
public Object validCondition(String cndId) {
|
public Object validCondition(String cndId) {
|
||||||
if (StrUtil.isBlank(cndId)) {
|
if (StrUtil.isBlank(cndId)) {
|
||||||
return Result.success();
|
return Result.success();
|
||||||
@@ -171,4 +193,26 @@ public class MHealthCheckupListController {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@At
|
||||||
|
@ViReturn
|
||||||
|
@RequiresAuthentication
|
||||||
|
public Object getUserInfo(){
|
||||||
|
Sql sql = Sqls.create("""
|
||||||
|
SELECT
|
||||||
|
loginname,
|
||||||
|
username,
|
||||||
|
sex,
|
||||||
|
mobile,
|
||||||
|
idcard,
|
||||||
|
TIMESTAMPDIFF(YEAR, STR_TO_DATE(SUBSTRING(idcard, 7, 8), '%Y%m%d'), CURDATE()) AS age
|
||||||
|
FROM
|
||||||
|
sys_user
|
||||||
|
WHERE id = @userId
|
||||||
|
""").setParam("userId", ShiroUtil.getUserId());
|
||||||
|
sql.setCallback(Sqls.callback.map());
|
||||||
|
dao.execute(sql);
|
||||||
|
return sql.getResult();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ layout("/mobile/platform.html"){
|
|||||||
|
|
||||||
<div id="app" v-cloak>
|
<div id="app" v-cloak>
|
||||||
<van-sticky>
|
<van-sticky>
|
||||||
<van-nav-bar title="体检套餐选择" left-arrow @click-left="pjaxReplace('/mobile/index')"></van-nav-bar>
|
<van-nav-bar title="体检套餐选择" left-arrow @click-left="pjaxReplace('/mobile/healthCheckup/list')"></van-nav-bar>
|
||||||
</van-sticky>
|
</van-sticky>
|
||||||
|
|
||||||
<div class="join_content">
|
<div class="join_content">
|
||||||
@@ -163,6 +163,7 @@ layout("/mobile/platform.html"){
|
|||||||
<van-field
|
<van-field
|
||||||
@click="campusVisible = true"
|
@click="campusVisible = true"
|
||||||
readonly
|
readonly
|
||||||
|
required
|
||||||
is-link
|
is-link
|
||||||
label="院区"
|
label="院区"
|
||||||
name="campus"
|
name="campus"
|
||||||
@@ -170,6 +171,55 @@ layout("/mobile/platform.html"){
|
|||||||
v-model="formData.campusName"
|
v-model="formData.campusName"
|
||||||
:rules="[{ required: true }]"
|
:rules="[{ required: true }]"
|
||||||
></van-field>
|
></van-field>
|
||||||
|
<van-field
|
||||||
|
label="姓名"
|
||||||
|
name="username"
|
||||||
|
required
|
||||||
|
placeholder="请填写姓名"
|
||||||
|
v-model="formData.username"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
></van-field>
|
||||||
|
<van-field
|
||||||
|
required
|
||||||
|
readonly
|
||||||
|
label="性别"
|
||||||
|
name="sex"
|
||||||
|
placeholder="输入身份证后自动匹配"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
v-model="formData.sex"
|
||||||
|
></van-field>
|
||||||
|
<van-field
|
||||||
|
label="年龄"
|
||||||
|
name="age"
|
||||||
|
required
|
||||||
|
readonly
|
||||||
|
placeholder="输入身份证后自动计算"
|
||||||
|
type="digit"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
v-model="formData.age"
|
||||||
|
></van-field>
|
||||||
|
<span style="font-size: 13px; margin-left: 1.4vh; color: #bc2a25">输入身份证后自动匹配性别和年龄</span>
|
||||||
|
<van-field
|
||||||
|
label="联系方式"
|
||||||
|
name="mobile"
|
||||||
|
required
|
||||||
|
placeholder="请填写联系方式"
|
||||||
|
type="digit"
|
||||||
|
maxlength="11"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
v-model="formData.mobile"
|
||||||
|
></van-field>
|
||||||
|
<van-field
|
||||||
|
label="身份证号"
|
||||||
|
name="idcard"
|
||||||
|
required
|
||||||
|
maxlength="18"
|
||||||
|
placeholder="请填写身份证号"
|
||||||
|
@input="getAgeAndSex"
|
||||||
|
:rules="[{ required: true }]"
|
||||||
|
v-model="formData.idcard"
|
||||||
|
></van-field>
|
||||||
|
|
||||||
<!-- <van-field :rules="[{ required: true, message: '请选择家属是否体检' }]" label="家属体检" name="validator">
|
<!-- <van-field :rules="[{ required: true, message: '请选择家属是否体检' }]" label="家属体检" name="validator">
|
||||||
<template #input>
|
<template #input>
|
||||||
<van-radio-group direction="horizontal" v-model="formData.isFamily" disabled>
|
<van-radio-group direction="horizontal" v-model="formData.isFamily" disabled>
|
||||||
@@ -270,6 +320,13 @@ layout("/mobile/platform.html"){
|
|||||||
<van-popup position="bottom" round v-model="descVisible" :style="{ height: '60%' }">
|
<van-popup position="bottom" round v-model="descVisible" :style="{ height: '60%' }">
|
||||||
<div v-html="desc" class="pre_text"></div>
|
<div v-html="desc" class="pre_text"></div>
|
||||||
</van-popup>
|
</van-popup>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<van-tabbar v-model="tarBarActive">
|
||||||
|
<van-tabbar-item icon="home-o" replace url="/mobile/healthCheckup/list">体检选择</van-tabbar-item>
|
||||||
|
<van-tabbar-item icon="manager-o" replace url="/mobile/healthCheckup/mine">我的体检</van-tabbar-item>
|
||||||
|
</van-tabbar>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
const vue = new Vue({
|
const vue = new Vue({
|
||||||
@@ -277,6 +334,7 @@ layout("/mobile/platform.html"){
|
|||||||
mixins: [mobileMixins],
|
mixins: [mobileMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
tarBarActive: 0,
|
||||||
id: "",
|
id: "",
|
||||||
selectId: "",
|
selectId: "",
|
||||||
active: 0,
|
active: 0,
|
||||||
@@ -292,6 +350,82 @@ layout("/mobile/platform.html"){
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getAgeAndSex(value) {
|
||||||
|
try {
|
||||||
|
const age = this.calculateAgeFromIdCard(value)
|
||||||
|
this.$set(this.formData, "age", age)
|
||||||
|
|
||||||
|
const sex = this.getGenderFromIdCard(value)
|
||||||
|
this.$set(this.formData, "sex", sex)
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
calculateAgeFromIdCard(idCard) {
|
||||||
|
// 检查身份证号码是否合法
|
||||||
|
if (!idCard) {
|
||||||
|
throw new Error("Invalid ID card format")
|
||||||
|
}
|
||||||
|
|
||||||
|
let birthDateStr
|
||||||
|
let birthYear, birthMonth, birthDay
|
||||||
|
|
||||||
|
// 处理18位身份证号码
|
||||||
|
if (idCard.length === 18) {
|
||||||
|
birthDateStr = idCard.substring(6, 14)
|
||||||
|
birthYear = parseInt(birthDateStr.substring(0, 4), 10)
|
||||||
|
birthMonth = parseInt(birthDateStr.substring(4, 6), 10) - 1 // 月份从0开始
|
||||||
|
birthDay = parseInt(birthDateStr.substring(6, 8), 10)
|
||||||
|
}
|
||||||
|
// 处理15位身份证号码
|
||||||
|
else if (idCard.length === 15) {
|
||||||
|
birthDateStr = idCard.substring(6, 12)
|
||||||
|
birthYear = parseInt("19" + birthDateStr.substring(0, 2), 10) // 使用字符串拼接
|
||||||
|
birthMonth = parseInt(birthDateStr.substring(2, 4), 10) - 1 // 月份从0开始
|
||||||
|
birthDay = parseInt(birthDateStr.substring(4, 6), 10)
|
||||||
|
} else {
|
||||||
|
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前日期
|
||||||
|
const currentDate = new Date()
|
||||||
|
|
||||||
|
// 计算年龄
|
||||||
|
let age = currentDate.getFullYear() - birthYear
|
||||||
|
|
||||||
|
// 如果当前日期还没过生日,则年龄减1
|
||||||
|
if (currentDate.getMonth() < birthMonth || (currentDate.getMonth() === birthMonth && currentDate.getDate() < birthDay)) {
|
||||||
|
age -= 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return age
|
||||||
|
},
|
||||||
|
getGenderFromIdCard(idCard) {
|
||||||
|
// 检查身份证号码是否合法
|
||||||
|
if (!idCard) {
|
||||||
|
throw new Error("Invalid ID card format")
|
||||||
|
}
|
||||||
|
|
||||||
|
let genderDigit
|
||||||
|
|
||||||
|
// 处理18位身份证号码
|
||||||
|
if (idCard.length === 18) {
|
||||||
|
genderDigit = parseInt(idCard.charAt(16), 10) // 第17位
|
||||||
|
}
|
||||||
|
// 处理15位身份证号码
|
||||||
|
else if (idCard.length === 15) {
|
||||||
|
genderDigit = parseInt(idCard.charAt(14), 10) // 第15位
|
||||||
|
} else {
|
||||||
|
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断性别
|
||||||
|
if (genderDigit % 2 === 0) {
|
||||||
|
return "女"
|
||||||
|
} else {
|
||||||
|
return "男"
|
||||||
|
}
|
||||||
|
},
|
||||||
viewDesc(o) {
|
viewDesc(o) {
|
||||||
if (o.description) {
|
if (o.description) {
|
||||||
this.desc = o.description
|
this.desc = o.description
|
||||||
@@ -305,6 +439,16 @@ layout("/mobile/platform.html"){
|
|||||||
vant.Toast("请选择体检套餐")
|
vant.Toast("请选择体检套餐")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!this.validatePhoneNumber(this.formData.mobile)) {
|
||||||
|
vant.Toast("请填写正确的手机号")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!this.validateIdCard(this.formData.idcard)) {
|
||||||
|
vant.Toast("请填写正确的身份证号")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//如果等于家属
|
//如果等于家属
|
||||||
if (this.project.healthCheckupType === "js" && this.formData.companionList && this.formData.companionList.length === 0) {
|
if (this.project.healthCheckupType === "js" && this.formData.companionList && this.formData.companionList.length === 0) {
|
||||||
vant.Toast("当前体检项目需要填写家属信息,请填写家属信息。")
|
vant.Toast("当前体检项目需要填写家属信息,请填写家属信息。")
|
||||||
@@ -389,6 +533,57 @@ layout("/mobile/platform.html"){
|
|||||||
this.formData = resp.data
|
this.formData = resp.data
|
||||||
const o = this.campusList.find((o) => o.id === this.formData.campus)
|
const o = this.campusList.find((o) => o.id === this.formData.campus)
|
||||||
this.formData.campusName = o.campusName
|
this.formData.campusName = o.campusName
|
||||||
|
},
|
||||||
|
async getUserInfo() {
|
||||||
|
const resp = await $.post("/mobile/healthCheckup/getUserInfo")
|
||||||
|
if (resp.code === 0) {
|
||||||
|
this.$set(this.formData, "username", resp.data.username)
|
||||||
|
this.$set(this.formData, "sex", resp.data.sex)
|
||||||
|
this.$set(this.formData, "mobile", resp.data.mobile)
|
||||||
|
this.$set(this.formData, "idcard", resp.data.idcard)
|
||||||
|
this.$set(this.formData, "age", resp.data.age)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validateIdCard(idCard) {
|
||||||
|
if (!idCard) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 18位身份证号码校验
|
||||||
|
if (idCard.length === 18) {
|
||||||
|
const idCardRegex = /^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}(\d|[Xx])$/
|
||||||
|
if (!idCardRegex.test(idCard)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验码计算
|
||||||
|
const weights = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
|
||||||
|
const checksums = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"]
|
||||||
|
let sum = 0
|
||||||
|
for (let i = 0; i < 17; i++) {
|
||||||
|
sum += idCard[i] * weights[i]
|
||||||
|
}
|
||||||
|
const checksum = checksums[sum % 11]
|
||||||
|
return checksum === idCard[17].toUpperCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 15位身份证号码校验
|
||||||
|
else if (idCard.length === 15) {
|
||||||
|
const idCardRegex = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/
|
||||||
|
return idCardRegex.test(idCard)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 外国人或其他情况
|
||||||
|
else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
validatePhoneNumber(phoneNumber) {
|
||||||
|
if (!phoneNumber) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const phoneRegex = /^1[3-9]\d{9}$/
|
||||||
|
return phoneRegex.test(phoneNumber)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
@@ -397,6 +592,8 @@ layout("/mobile/platform.html"){
|
|||||||
await this.getCampus()
|
await this.getCampus()
|
||||||
if (GetQueryString("selectId")) {
|
if (GetQueryString("selectId")) {
|
||||||
await this.getSelectInfo()
|
await this.getSelectInfo()
|
||||||
|
} else {
|
||||||
|
this.getUserInfo()
|
||||||
}
|
}
|
||||||
await this.findSubject()
|
await this.findSubject()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,6 +124,13 @@ layout("/mobile/platform.html"){
|
|||||||
</van-list>
|
</van-list>
|
||||||
<van-empty v-else description="暂无数据"></van-empty>
|
<van-empty v-else description="暂无数据"></van-empty>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<van-tabbar v-model="tarBarActive">
|
||||||
|
<van-tabbar-item icon="home-o" replace url="/mobile/healthCheckup/list">体检选择</van-tabbar-item>
|
||||||
|
<van-tabbar-item icon="manager-o" replace url="/mobile/healthCheckup/mine">我的体检</van-tabbar-item>
|
||||||
|
</van-tabbar>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
new Vue({
|
new Vue({
|
||||||
@@ -131,18 +138,13 @@ layout("/mobile/platform.html"){
|
|||||||
mixins: [mobileMixins],
|
mixins: [mobileMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
tarBarActive: 0,
|
||||||
tabName: "ing"
|
tabName: "ing"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toCheckUp(o) {
|
toCheckUp(o) {
|
||||||
if (o.selectCount > 0) {
|
console.log(o)
|
||||||
vant.Dialog.alert({
|
|
||||||
title: "温馨提示",
|
|
||||||
message: "此项活动您已选择"
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
//当前时间
|
//当前时间
|
||||||
const nowDate = moment().unix()
|
const nowDate = moment().unix()
|
||||||
//结束时间
|
//结束时间
|
||||||
@@ -153,6 +155,22 @@ layout("/mobile/platform.html"){
|
|||||||
message: "选择时间已过"
|
message: "选择时间已过"
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
if (o.selectCount > 0) {
|
||||||
|
vant.Dialog.confirm({
|
||||||
|
title: "温馨提示",
|
||||||
|
message: "此项活动您已选择,是否前往修改"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
location.href = "/mobile/healthCheckup/checkUp?projectId=" + o.id + "&selectId=" + o.selectId
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
//取消
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
location.href = "/mobile/healthCheckup/checkUp?projectId=" + o.id
|
location.href = "/mobile/healthCheckup/checkUp?projectId=" + o.id
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -117,13 +117,22 @@ layout("/mobile/platform.html"){
|
|||||||
</van-list>
|
</van-list>
|
||||||
<van-empty v-else description="暂无数据"></van-empty>
|
<van-empty v-else description="暂无数据"></van-empty>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<van-tabbar v-model="tarBarActive">
|
||||||
|
<van-tabbar-item icon="home-o" replace url="/mobile/healthCheckup/list">体检选择</van-tabbar-item>
|
||||||
|
<van-tabbar-item icon="manager-o" replace url="/mobile/healthCheckup/mine">我的体检</van-tabbar-item>
|
||||||
|
</van-tabbar>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
new Vue({
|
new Vue({
|
||||||
el: "#app",
|
el: "#app",
|
||||||
mixins: [mobileMixins],
|
mixins: [mobileMixins],
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
tarBarActive: 1
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
edit(o) {
|
edit(o) {
|
||||||
|
|||||||
@@ -1,14 +1,11 @@
|
|||||||
<!--#
|
<!--#
|
||||||
layout("/layouts/platform.html"){
|
layout("/layouts/platform.html"){
|
||||||
#-->
|
#-->
|
||||||
|
|
||||||
|
|
||||||
<div class="platform" id="app" v-cloak>
|
<div class="platform" id="app" v-cloak>
|
||||||
<guava padding="0 5%" ref="guava">
|
<guava padding="0 5%" ref="guava">
|
||||||
<template>
|
<template>
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<div class="search">
|
<div class="search">
|
||||||
|
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-item-label">年度:</div>
|
<div class="search-item-label">年度:</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
@@ -16,51 +13,53 @@ layout("/layouts/platform.html"){
|
|||||||
:clearable="true"
|
:clearable="true"
|
||||||
@change="yearChange"
|
@change="yearChange"
|
||||||
placeholder="选择年"
|
placeholder="选择年"
|
||||||
style="width: 100%;"
|
style="width: 100%"
|
||||||
type="year"
|
type="year"
|
||||||
v-model="pageForm.year"
|
v-model="pageForm.year"
|
||||||
value-format="yyyy">
|
value-format="yyyy"
|
||||||
</el-date-picker>
|
></el-date-picker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-item-label">体检项目:</div>
|
<div class="search-item-label">体检项目:</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-select @change="doSearch();getHealthCheckupSubject();"
|
<el-select @change="doSearch();getHealthCheckupSubject();" style="width: 100%" v-model="pageForm.projectId">
|
||||||
style="width: 100%;"
|
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in projectOptions"></el-option>
|
||||||
v-model="pageForm.projectId">
|
|
||||||
<el-option :key="item.id" :label="item.name" :value="item.id"
|
|
||||||
v-for="item in projectOptions"></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-item-label">职工信息:</div>
|
<div class="search-item-label">职工信息:</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-input @keyup.enter.native="doSearch" clearable placeholder="请输入内容"
|
<el-input
|
||||||
style="width: 100%" v-model="pageForm.searchKeyword">
|
@keyup.enter.native="doSearch"
|
||||||
<el-select slot="prepend" style="width: 80px;"
|
clearable
|
||||||
v-model="pageForm.searchName">
|
placeholder="请输入内容"
|
||||||
|
style="width: 100%"
|
||||||
|
v-model="pageForm.searchKeyword"
|
||||||
|
>
|
||||||
|
<el-select slot="prepend" style="width: 80px" v-model="pageForm.searchName">
|
||||||
<el-option label="姓名" value="hcu.username"></el-option>
|
<el-option label="姓名" value="hcu.username"></el-option>
|
||||||
<el-option label="工号" value="hcu.loginname"></el-option>
|
<el-option label="工号" value="hcu.loginname"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item"
|
<div class="search-item" v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')||@shiro.hasRole('H03')}">
|
||||||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')||@shiro.hasRole('H03')}">
|
|
||||||
<div class="search-item-label">所属工会:</div>
|
<div class="search-item-label">所属工会:</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-select @change="flushUnits" @clear="flushUnits"
|
<el-select
|
||||||
|
@change="flushUnits"
|
||||||
|
@clear="flushUnits"
|
||||||
clearable
|
clearable
|
||||||
filterable="true"
|
filterable="true"
|
||||||
placeholder="请选择所属工会" style="width: 100%;"
|
placeholder="请选择所属工会"
|
||||||
v-model="pageForm.unionId">
|
style="width: 100%"
|
||||||
<el-option :label="item.unionname" :value="item.id"
|
v-model="pageForm.unionId"
|
||||||
v-for="item in unions"></el-option>
|
>
|
||||||
|
<el-option :label="item.unionname" :value="item.id" v-for="item in unions"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -68,12 +67,8 @@ layout("/layouts/platform.html"){
|
|||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-item-label">所属单位:</div>
|
<div class="search-item-label">所属单位:</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-select clearable filterable
|
<el-select clearable filterable placeholder="所属单位" style="width: 100%" v-model="pageForm.unitId">
|
||||||
placeholder="所属单位"
|
<el-option :label="item.name" :value="item.id" v-for="item in units"></el-option>
|
||||||
style="width: 100%;"
|
|
||||||
v-model="pageForm.unitId">
|
|
||||||
<el-option :label="item.name" :value="item.id"
|
|
||||||
v-for="item in units"></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -82,17 +77,15 @@ layout("/layouts/platform.html"){
|
|||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-item-label">工会小组:</div>
|
<div class="search-item-label">工会小组:</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-select @change="getThreeUnits" clearable
|
<el-select
|
||||||
|
@change="getThreeUnits"
|
||||||
|
clearable
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
v-model="pageForm.unionGroupId">
|
v-model="pageForm.unionGroupId"
|
||||||
<el-option
|
>
|
||||||
:key="item.id"
|
<el-option :key="item.id" :label="item.groupName" :value="item.id" v-for="item in unionGroups"></el-option>
|
||||||
:label="item.groupName"
|
|
||||||
:value="item.id"
|
|
||||||
v-for="item in unionGroups">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -100,44 +93,42 @@ layout("/layouts/platform.html"){
|
|||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-item-label">组成科室:</div>
|
<div class="search-item-label">组成科室:</div>
|
||||||
<div class="search-item-option">
|
<div class="search-item-option">
|
||||||
<el-select clearable filterable placeholder="请选择"
|
<el-select clearable filterable placeholder="请选择" style="width: 100%" v-model="pageForm.threeUnitId">
|
||||||
style="width: 100%"
|
<el-option :key="item.id" :label="item.name" :value="item.id" v-for="item in threeUnits"></el-option>
|
||||||
v-model="pageForm.threeUnitId">
|
|
||||||
<el-option
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.name"
|
|
||||||
:value="item.id"
|
|
||||||
v-for="item in threeUnits">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div class="search-query">
|
<div class="search-query">
|
||||||
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索
|
<el-button @click="doSearch" icon="el-icon-search" type="primary">搜索</el-button>
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
<el-card class="mt10" shadow="never">
|
<el-card class="mt10" shadow="never">
|
||||||
<table-tool :app="this" label="体检项目">
|
<table-tool :app="this" label="体检项目">
|
||||||
<template #func>
|
<template #func></template>
|
||||||
</template>
|
|
||||||
|
|
||||||
</table-tool>
|
</table-tool>
|
||||||
|
|
||||||
|
<el-table
|
||||||
<el-table :data="tableData" :size="tableSize" @sort-change="pageOrder"
|
:data="tableData"
|
||||||
class="vi-table" ref="table"
|
:size="tableSize"
|
||||||
row-key="id" style="width: 100%" v-loading="tableLoading">
|
@sort-change="pageOrder"
|
||||||
|
class="vi-table"
|
||||||
|
ref="table"
|
||||||
<el-table-column :index="indexMethod" align="center" header-align="center"
|
row-key="id"
|
||||||
label="序号" type="index"
|
style="width: 100%"
|
||||||
width="80px"></el-table-column>
|
v-loading="tableLoading"
|
||||||
|
>
|
||||||
|
<el-table-column
|
||||||
|
:index="indexMethod"
|
||||||
|
align="center"
|
||||||
|
header-align="center"
|
||||||
|
label="序号"
|
||||||
|
type="index"
|
||||||
|
width="80px"
|
||||||
|
></el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:label="column.label"
|
:label="column.label"
|
||||||
:prop="column.prop"
|
:prop="column.prop"
|
||||||
@@ -145,79 +136,90 @@ layout("/layouts/platform.html"){
|
|||||||
:width="column.width"
|
:width="column.width"
|
||||||
align="center"
|
align="center"
|
||||||
header-align="center"
|
header-align="center"
|
||||||
min-width="100px" show-overflow-tooltip v-for="column in tableColumns">
|
min-width="100px"
|
||||||
|
show-overflow-tooltip
|
||||||
<template scope="{row}" v-if="column.prop=='optionName'">
|
v-for="column in tableColumns"
|
||||||
{{row.optionName?row.optionName:''}}
|
>
|
||||||
</template>
|
<template scope="{row}" v-if="column.prop=='optionName'">{{row.optionName?row.optionName:''}}</template>
|
||||||
|
|
||||||
|
|
||||||
<template scope="{row}" v-else-if="column.prop=='userSign'">
|
<template scope="{row}" v-else-if="column.prop=='userSign'">
|
||||||
<el-image :src="row.userSign"
|
<el-image :src="row.userSign" fit="cover" style="height: 60px" v-if="row.userSign"></el-image>
|
||||||
fit="cover"
|
|
||||||
style="height: 60px" v-if="row.userSign"></el-image>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" fixed="right" header-align="center"
|
<el-table-column align="center" fixed="right" header-align="center" label="操作" prop="userOnline" width="300px">
|
||||||
label="操作" prop="userOnline"
|
|
||||||
width="300px">
|
|
||||||
<template scope="{row}">
|
<template scope="{row}">
|
||||||
<el-button @click="openEditHealthCheckup(row)" size="mini"
|
<el-button @click="openEditHealthCheckup(row)" size="mini" type="primary">编辑</el-button>
|
||||||
type="primary">
|
<el-button @click="deleteHealthCheckup(row)" size="mini" type="danger">删除</el-button>
|
||||||
编辑
|
|
||||||
</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<!--#include("/layouts/pagination.html"){}#-->
|
<!--#include("/layouts/pagination.html"){}#-->
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</guava>
|
</guava>
|
||||||
|
|
||||||
<el-dialog :close-on-click-modal="false" :visible.sync="exportHealthCheckupDialog" title="修改套餐"
|
<el-dialog :close-on-click-modal="false" :visible.sync="exportHealthCheckupDialog" title="修改体检" width="50%">
|
||||||
width="50%">
|
<el-form :model="editHealthCheckupData" label-width="120px" ref="editHealthCheckupForm" :rules="editRules">
|
||||||
<el-form :model="editHealthCheckupData" label-width="120px" ref="editHealthCheckupForm">
|
|
||||||
<el-form-item label="姓名">
|
|
||||||
<el-input :value="editHealthCheckupData.username"></el-input>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="工号">
|
<el-form-item label="工号">
|
||||||
<el-input :value="editHealthCheckupData.loginname"></el-input>
|
<el-input v-model="editHealthCheckupData.loginname" readonly></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :rules="[{required:true,message:'请选择',trigger:['change','blur']}]"
|
<el-form-item label="姓名">
|
||||||
label="套餐"
|
<el-input v-model="editHealthCheckupData.username" readonly></el-input>
|
||||||
prop="subjectId">
|
</el-form-item>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="性别" prop="sex">
|
||||||
|
<el-input v-model="editHealthCheckupData.sex" readonly placeholder="输入身份证后自动匹配性别"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="年龄" prop="age">
|
||||||
|
<el-input v-model="editHealthCheckupData.age" readonly placeholder="输入身份证后自动计算年龄"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<div style="margin-left: 130px">
|
||||||
|
<span style="color: #bc2a25">输入身份证后自动匹配性别和年龄</span>
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item label="联系方式" prop="mobile">
|
||||||
|
<el-input v-model="editHealthCheckupData.mobile" placeholder="请输入手机号码" maxlength="11" type="text" show-word-limit></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="身份证号" prop="idcard">
|
||||||
|
<el-input
|
||||||
|
v-model="editHealthCheckupData.idcard"
|
||||||
|
@input="getAgeAndSex"
|
||||||
|
placeholder="请输入身份证号"
|
||||||
|
maxlength="18"
|
||||||
|
type="text"
|
||||||
|
show-word-limit
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="套餐" prop="subjectId">
|
||||||
<el-select style="width: 100%" v-model="editHealthCheckupData.subjectId">
|
<el-select style="width: 100%" v-model="editHealthCheckupData.subjectId">
|
||||||
<el-option :key="item.id" :label="item.optionName" :value="item.id"
|
<el-option :key="item.id" :label="item.optionName" :value="item.id" v-for="item in projectSubjectOptions"></el-option>
|
||||||
v-for="item in projectSubjectOptions"></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :rules="[{required:true,message:'请选择',trigger:['change','blur']}]"
|
<el-form-item label="院区" prop="campus">
|
||||||
label="院区"
|
|
||||||
prop="campus">
|
|
||||||
<el-select style="width: 100%" v-model="editHealthCheckupData.campus">
|
<el-select style="width: 100%" v-model="editHealthCheckupData.campus">
|
||||||
<el-option :key="item.id" :label="item.campusName" :value="item.id"
|
<el-option :key="item.id" :label="item.campusName" :value="item.id" v-for="item in campusOptions"></el-option>
|
||||||
v-for="item in campusOptions"></el-option>
|
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-row justify="end" type="flex">
|
<el-row justify="end" type="flex">
|
||||||
<el-button @click="exportHealthCheckupDialog=false" plain type="primary">取消</el-button>
|
<el-button @click="exportHealthCheckupDialog=false" plain type="primary">取消</el-button>
|
||||||
<el-button @click="doEditHealthCheckupData" type="primary" v-loading="loading">确定
|
<el-button @click="doEditHealthCheckupData" type="primary" v-loading="loading">确定</el-button>
|
||||||
</el-button>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const vue = new Vue({
|
const vue = new Vue({
|
||||||
el: '#app',
|
el: "#app",
|
||||||
mixins: [initTableMixins],
|
mixins: [initTableMixins],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pageForm: {
|
pageForm: {
|
||||||
year: moment().format('YYYY'),
|
year: moment().format("YYYY"),
|
||||||
searchName: "hcu.username",
|
searchName: "hcu.username"
|
||||||
},
|
},
|
||||||
threeUnits: [],
|
threeUnits: [],
|
||||||
unionGroups: [],
|
unionGroups: [],
|
||||||
@@ -226,53 +228,195 @@ layout("/layouts/platform.html"){
|
|||||||
projectOptions: [],
|
projectOptions: [],
|
||||||
projectSubjectOptions: [],
|
projectSubjectOptions: [],
|
||||||
tableColumns: [
|
tableColumns: [
|
||||||
{prop: 'loginname', label: '工号'},
|
{ prop: "loginname", label: "工号" },
|
||||||
{prop: 'username', label: '姓名'},
|
{ prop: "username", label: "姓名" },
|
||||||
{prop: 'sex', label: '性别', sortable: true, width: '100px'},
|
{ prop: "sex", label: "性别", sortable: true, width: "100px" },
|
||||||
{prop: 'unionname', label: '所属工会', sortable: true},
|
{ prop: "unionname", label: "所属工会", sortable: true },
|
||||||
{prop: 'unitname', label: '所属单位', sortable: true},
|
{ prop: "unitname", label: "所属单位", sortable: true },
|
||||||
{prop: 'threeUnitName', label: '所在科室', sortable: true, checked: 0},
|
{ prop: "threeUnitName", label: "所在科室", sortable: true, checked: 0 },
|
||||||
{prop: 'unionGroupName', label: '工会小组', sortable: true, checked: 0},
|
{ prop: "unionGroupName", label: "工会小组", sortable: true, checked: 0 },
|
||||||
{prop: 'optionName', label: '所选套餐', width: "100px"},
|
{ prop: "optionName", label: "所选套餐", width: "100px" }
|
||||||
// {prop: 'userSign', label: '签字', width: "100px"},
|
// {prop: 'userSign', label: '签字', width: "100px"},
|
||||||
],
|
],
|
||||||
exportHealthCheckupDialog: false,
|
exportHealthCheckupDialog: false,
|
||||||
editHealthCheckupData: {},
|
editHealthCheckupData: {},
|
||||||
|
editRules: {
|
||||||
|
sex: [{ required: true, message: "请选择性别", trigger: ["change", "blur"] }],
|
||||||
|
age: [{ required: true, message: "请输入年龄", trigger: ["change", "blur"] }],
|
||||||
|
mobile: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (!value) {
|
||||||
|
callback(new Error("请输入联系方式"))
|
||||||
|
} else if (/^[1][345789][0-9]{9}$/.test(value)) {
|
||||||
|
// 手机号格式正确
|
||||||
|
callback()
|
||||||
|
} else if (/^\d+-\d+$/.test(value) && value.length <= 16) {
|
||||||
|
// 座机号格式正确
|
||||||
|
callback()
|
||||||
|
} else {
|
||||||
|
// 格式错误,返回错误信息
|
||||||
|
callback(new Error(value.includes("-") ? "座机号码格式错误" : "手机号码格式错误"))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: ["change", "blur"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
idcard: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (!value) {
|
||||||
|
// 如果值为空,直接通过校验
|
||||||
|
callback()
|
||||||
|
} else if (
|
||||||
|
/^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}(\d|[Xx])$/.test(value)
|
||||||
|
) {
|
||||||
|
// 18位身份证号码格式正确
|
||||||
|
callback()
|
||||||
|
} else if (/^[1-9]\d{7}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
|
||||||
|
// 15位身份证号码格式正确
|
||||||
|
callback()
|
||||||
|
} else if (/^[1-9]\d{5}(18|19|20)?\d{2}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
|
||||||
|
// 外国人身份证号码格式正确(18位)
|
||||||
|
callback()
|
||||||
|
} else if (/^[1-9]\d{7}((0[1-9])|(10|11|12))(([0|1|2][0-9])|10|20|30|31)\d{3}$/.test(value)) {
|
||||||
|
// 外国人身份证号码格式正确(15位)
|
||||||
|
callback()
|
||||||
|
} else {
|
||||||
|
// 格式错误,返回错误信息
|
||||||
|
callback(new Error("身份证号码格式错误"))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
trigger: ["change", "blur"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
subjectId: [{ required: true, message: "请选择套餐", trigger: ["change", "blur"] }],
|
||||||
|
campus: [{ required: true, message: "请选择院区", trigger: ["change", "blur"] }]
|
||||||
|
},
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
campusOptions: [],
|
campusOptions: [],
|
||||||
isThreeUnit: null,
|
isThreeUnit: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
methods: {
|
methods: {
|
||||||
doEditHealthCheckupData() {
|
getAgeAndSex(value) {
|
||||||
this.$refs['editHealthCheckupForm'].validate(async valid => {
|
try {
|
||||||
if (valid) {
|
const age = this.calculateAgeFromIdCard(value)
|
||||||
this.loading = true
|
this.$set(this.editHealthCheckupData, "age", age)
|
||||||
const resp = await $.post(loc() + "/doEditHealthCheckupData", this.editHealthCheckupData)
|
|
||||||
this.exportHealthCheckupDialog = false
|
const sex = this.getGenderFromIdCard(value)
|
||||||
if (resp.code === 0) {
|
this.$set(this.editHealthCheckupData, "sex", sex)
|
||||||
this.notifySuccess(resp.msg)
|
} catch (error) {
|
||||||
this.doSearch()
|
console.log(error)
|
||||||
} else {
|
|
||||||
this.notifyWarning(resp.msg)
|
|
||||||
}
|
}
|
||||||
this.loading = false
|
},
|
||||||
|
calculateAgeFromIdCard(idCard) {
|
||||||
|
// 检查身份证号码是否合法
|
||||||
|
if (!idCard) {
|
||||||
|
throw new Error("Invalid ID card format")
|
||||||
|
}
|
||||||
|
|
||||||
|
let birthDateStr
|
||||||
|
let birthYear, birthMonth, birthDay
|
||||||
|
|
||||||
|
// 处理18位身份证号码
|
||||||
|
if (idCard.length === 18) {
|
||||||
|
birthDateStr = idCard.substring(6, 14)
|
||||||
|
birthYear = parseInt(birthDateStr.substring(0, 4), 10)
|
||||||
|
birthMonth = parseInt(birthDateStr.substring(4, 6), 10) - 1 // 月份从0开始
|
||||||
|
birthDay = parseInt(birthDateStr.substring(6, 8), 10)
|
||||||
|
}
|
||||||
|
// 处理15位身份证号码
|
||||||
|
else if (idCard.length === 15) {
|
||||||
|
birthDateStr = idCard.substring(6, 12)
|
||||||
|
birthYear = parseInt("19" + birthDateStr.substring(0, 2), 10) // 使用字符串拼接
|
||||||
|
birthMonth = parseInt(birthDateStr.substring(2, 4), 10) - 1 // 月份从0开始
|
||||||
|
birthDay = parseInt(birthDateStr.substring(4, 6), 10)
|
||||||
|
} else {
|
||||||
|
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前日期
|
||||||
|
const currentDate = new Date()
|
||||||
|
|
||||||
|
// 计算年龄
|
||||||
|
let age = currentDate.getFullYear() - birthYear
|
||||||
|
|
||||||
|
// 如果当前日期还没过生日,则年龄减1
|
||||||
|
if (currentDate.getMonth() < birthMonth || (currentDate.getMonth() === birthMonth && currentDate.getDate() < birthDay)) {
|
||||||
|
age -= 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return age
|
||||||
|
},
|
||||||
|
getGenderFromIdCard(idCard) {
|
||||||
|
// 检查身份证号码是否合法
|
||||||
|
if (!idCard) {
|
||||||
|
throw new Error("Invalid ID card format")
|
||||||
|
}
|
||||||
|
|
||||||
|
let genderDigit
|
||||||
|
|
||||||
|
// 处理18位身份证号码
|
||||||
|
if (idCard.length === 18) {
|
||||||
|
genderDigit = parseInt(idCard.charAt(16), 10) // 第17位
|
||||||
|
}
|
||||||
|
// 处理15位身份证号码
|
||||||
|
else if (idCard.length === 15) {
|
||||||
|
genderDigit = parseInt(idCard.charAt(14), 10) // 第15位
|
||||||
|
} else {
|
||||||
|
throw new Error("Invalid ID card format. Only 15 or 18 digits are supported.")
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断性别
|
||||||
|
if (genderDigit % 2 === 0) {
|
||||||
|
return "女"
|
||||||
|
} else {
|
||||||
|
return "男"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
doEditHealthCheckupData() {
|
||||||
|
this.$refs["editHealthCheckupForm"].validate(async (valid) => {
|
||||||
|
if (valid) {
|
||||||
|
// 确定要提交吗?
|
||||||
|
this.$confirm("确定要提交吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(async () => {
|
||||||
|
const resp = await $.post(loc() + "/doEditHealthCheckupData", this.editHealthCheckupData)
|
||||||
|
if (resp.code === 0) {
|
||||||
|
this.$message.success(resp.msg)
|
||||||
|
this.doSearch()
|
||||||
|
this.exportHealthCheckupDialog = false
|
||||||
|
} else {
|
||||||
|
this.$message.warning(resp.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async openEditHealthCheckup(row) {
|
async openEditHealthCheckup(row) {
|
||||||
this.editHealthCheckupData = {
|
const resp = await $.post("/platform/healthCheckup/list/mange/getHealthEditData", {
|
||||||
username: row.username,
|
userId: row.id,
|
||||||
loginname: row.loginname,
|
projectId: this.pageForm.projectId
|
||||||
subjectId: row.subjectId,
|
})
|
||||||
campus: row.campus,
|
if (resp.code === 0) {
|
||||||
projectId: this.pageForm.projectId,
|
console.log(resp.data)
|
||||||
userId: row.id
|
this.editHealthCheckupData = resp.data
|
||||||
|
this.editHealthCheckupData.id = null
|
||||||
|
this.editHealthCheckupData.projectId = this.pageForm.projectId
|
||||||
|
this.$set(this.editHealthCheckupData, "selectUserId", row.id)
|
||||||
|
if (resp.data.subjectId) {
|
||||||
|
this.$set(this.editHealthCheckupData, "loginname", row.loginname)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.exportHealthCheckupDialog = true
|
|
||||||
|
|
||||||
|
this.exportHealthCheckupDialog = true
|
||||||
},
|
},
|
||||||
async yearChange() {
|
async yearChange() {
|
||||||
const resp = await $.get("/platform/healthCheckup/project/mange/getHealthCheckupProject", { year: this.pageForm.year })
|
const resp = await $.get("/platform/healthCheckup/project/mange/getHealthCheckupProject", { year: this.pageForm.year })
|
||||||
@@ -310,22 +454,22 @@ layout("/layouts/platform.html"){
|
|||||||
},
|
},
|
||||||
async flushUnits() {
|
async flushUnits() {
|
||||||
this.$set(this.pageForm, "unitId", "")
|
this.$set(this.pageForm, "unitId", "")
|
||||||
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')||@shiro.hasRole('H03')}" === 'true') {
|
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('SchoolUnionAdmin')||@shiro.hasRole('H03')}" === "true") {
|
||||||
this.units = await getUnits(this.pageForm.unionId)
|
this.units = await getUnits(this.pageForm.unionId)
|
||||||
} else {
|
} else {
|
||||||
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
|
this.units = await getUnits("${@shiro.getPrincipalProperty('unit').getUnionid()}")
|
||||||
}
|
}
|
||||||
this.unionGroups = await unionGroupsByUnionId(this.pageForm.unionId)
|
this.unionGroups = await unionGroupsByUnionId(this.pageForm.unionId)
|
||||||
if ("${@shiro.hasRole('ghxzzz')}" === 'true') {
|
if ("${@shiro.hasRole('ghxzzz')}" === "true") {
|
||||||
this.$set(this.pageForm, 'unionGroupId', this.unionGroups[0].id)
|
this.$set(this.pageForm, "unionGroupId", this.unionGroups[0].id)
|
||||||
await this.getThreeUnits()
|
await this.getThreeUnits()
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
this.isThreeUnit = await getConfigKey('isThreeUnit') === 'true'
|
this.isThreeUnit = (await getConfigKey("isThreeUnit")) === "true"
|
||||||
if (this.isThreeUnit) {
|
if (this.isThreeUnit) {
|
||||||
this.tableColumns.forEach(v => {
|
this.tableColumns.forEach((v) => {
|
||||||
if (["threeUnitName", "unionGroupName"].includes(v.prop)) {
|
if (["threeUnitName", "unionGroupName"].includes(v.prop)) {
|
||||||
v.checked = 1
|
v.checked = 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user