Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica.cloud.web-education-admin
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
提交
打开侧边栏
com.pica.cloud.education.frontend
pica.cloud.web-education-admin
提交
001a6612
提交
001a6612
编写于
5月 17, 2019
作者:
yi.li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
编辑居民信息
上级
339c7698
变更
4
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
278 行增加
和
90 行删除
+278
-90
checkCardNum.js
src/utils/patients/checkCardNum.js
+137
-0
checkValid.js
src/utils/patients/checkValid.js
+10
-0
basic-info.vue
src/views/patients/mypatients-manage/basic-info.vue
+42
-66
edit-information.vue
...atients/mypatients-manage/components/edit-information.vue
+89
-24
未找到文件。
src/utils/patients/checkCardNum.js
0 → 100644
浏览文件 @
001a6612
// 检查号码是否符合规范,包括长度,类型
function
isCardNo
(
card
){
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
// var reg = /(^\d{15}$)|(^\d{17}(\d|X|x)$)/;
let
reg
=
/
(
^
\d{15}
$
)
|
(
^
\d{18}
$
)
|
(
^
\d{17}(\d
|X|x
)
$
)
/
;
if
(
reg
.
test
(
card
)
===
false
){
return
false
;
}
return
true
;
}
// 取身份证前两位,校验省份
function
checkProvince
(
card
,
vcity
){
var
province
=
card
.
substr
(
0
,
2
);
if
(
vcity
[
province
]
==
undefined
){
return
false
;
}
return
true
;
}
// 检查生日是否正确
function
checkBirthday
(
card
){
var
len
=
card
.
length
;
//身份证15位时,次序为省(3位)市(3位)年(2位)月(2位)日(2位)校验位(3位),皆为数字
if
(
len
==
'15'
){
var
re_fifteen
=
/^
(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})
$/
;
var
arr_data
=
card
.
match
(
re_fifteen
);
var
year
=
arr_data
[
2
];
var
month
=
arr_data
[
3
];
var
day
=
arr_data
[
4
];
var
birthday
=
new
Date
(
'19'
+
year
+
'/'
+
month
+
'/'
+
day
);
return
verifyBirthday
(
'19'
+
year
,
month
,
day
,
birthday
);
}
//身份证18位时,次序为省(3位)市(3位)年(4位)月(2位)日(2位)校验位(4位),校验位末尾可能为X
if
(
len
==
'18'
){
var
re_eighteen
=
/^
(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([
0-9
]
|X|x
)
$/
;
var
arr_data
=
card
.
match
(
re_eighteen
);
var
year
=
arr_data
[
2
];
var
month
=
arr_data
[
3
];
var
day
=
arr_data
[
4
];
var
birthday
=
new
Date
(
year
+
'/'
+
month
+
'/'
+
day
);
return
verifyBirthday
(
year
,
month
,
day
,
birthday
);
}
return
false
;
}
// 校验日期
function
verifyBirthday
(
year
,
month
,
day
,
birthday
)
{
var
now
=
new
Date
();
var
now_year
=
now
.
getFullYear
();
//年月日是否合理
if
(
birthday
.
getFullYear
()
==
year
&&
(
birthday
.
getMonth
()
+
1
)
==
month
&&
birthday
.
getDate
()
==
day
)
{
//判断年份的范围(0岁到100岁之间)
var
time
=
now_year
-
year
;
if
(
time
>=
0
&&
time
<=
100
)
{
return
true
;
}
return
false
;
}
return
false
;
}
// 校验位的检测
function
checkParity
(
card
){
//15位转18位
card
=
changeFivteenToEighteen
(
card
);
var
len
=
card
.
length
;
if
(
len
==
'18'
){
var
arrInt
=
new
Array
(
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
);
var
arrCh
=
new
Array
(
'1'
,
'0'
,
'X'
,
'9'
,
'8'
,
'7'
,
'6'
,
'5'
,
'4'
,
'3'
,
'2'
);
var
cardTemp
=
0
,
i
,
valnum
;
for
(
i
=
0
;
i
<
17
;
i
++
)
{
cardTemp
+=
card
.
substr
(
i
,
1
)
*
arrInt
[
i
];
}
valnum
=
arrCh
[
cardTemp
%
11
];
if
(
valnum
==
card
.
substr
(
17
,
1
).
toLocaleUpperCase
())
{
return
true
;
}
return
false
;
}
return
false
;
}
// 15位转18位身份证号
function
changeFivteenToEighteen
(
card
){
if
(
card
.
length
==
'15'
)
{
var
arrInt
=
new
Array
(
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
);
var
arrCh
=
new
Array
(
'1'
,
'0'
,
'X'
,
'9'
,
'8'
,
'7'
,
'6'
,
'5'
,
'4'
,
'3'
,
'2'
);
var
cardTemp
=
0
,
i
;
card
=
card
.
substr
(
0
,
6
)
+
'19'
+
card
.
substr
(
6
,
card
.
length
-
6
);
for
(
i
=
0
;
i
<
17
;
i
++
)
{
cardTemp
+=
card
.
substr
(
i
,
1
)
*
arrInt
[
i
];
}
card
+=
arrCh
[
cardTemp
%
11
];
return
card
;
}
return
card
;
}
export
const
checkCardNum
=
(
rule
,
value
,
callback
)
=>
{
var
vcity
=
{
11
:
"北京"
,
12
:
"天津"
,
13
:
"河北"
,
14
:
"山西"
,
15
:
"内蒙古"
,
21
:
"辽宁"
,
22
:
"吉林"
,
23
:
"黑龙江"
,
31
:
"上海"
,
32
:
"江苏"
,
33
:
"浙江"
,
34
:
"安徽"
,
35
:
"福建"
,
36
:
"江西"
,
37
:
"山东"
,
41
:
"河南"
,
42
:
"湖北"
,
43
:
"湖南"
,
44
:
"广东"
,
45
:
"广西"
,
46
:
"海南"
,
50
:
"重庆"
,
51
:
"四川"
,
52
:
"贵州"
,
53
:
"云南"
,
54
:
"西藏"
,
61
:
"陕西"
,
62
:
"甘肃"
,
63
:
"青海"
,
64
:
"宁夏"
,
65
:
"新疆"
,
71
:
"台湾"
,
81
:
"香港"
,
82
:
"澳门"
,
91
:
"国外"
};
//是否为空
// if(value === ''){
// callback(new Error('请输入正确的身份证'))
// }
if
(
value
)
{
//校验长度,类型
if
(
isCardNo
(
value
)
===
false
){
callback
(
new
Error
(
'请输入正确的身份证'
))
}
//检查省份
if
(
checkProvince
(
value
,
vcity
)
===
false
){
callback
(
new
Error
(
'请输入正确的身份证'
))
}
//校验生日
if
(
checkBirthday
(
value
)
===
false
){
callback
(
new
Error
(
'请输入正确的身份证'
))
}
//检验位的检测
if
(
checkParity
(
value
)
===
false
){
callback
(
new
Error
(
'请输入正确的身份证'
))
}
}
else
{
callback
()
}
}
src/utils/patients/checkValid.js
0 → 100644
浏览文件 @
001a6612
// 校验手机号
export
const
checkMobile
=
(
rule
,
value
,
callback
)
=>
{
var
reg
=
/^1
[
3|4|5|7|8
][
0-9
]{9}
$/
;
//验证规则
const
flag
=
reg
.
test
(
value
);
if
(
flag
){
callback
()
}
else
{
callback
(
new
Error
(
`请输入正确的手机号码`
))
}
}
src/views/patients/mypatients-manage/basic-info.vue
浏览文件 @
001a6612
...
...
@@ -11,7 +11,11 @@
<span>
基本信息
</span>
<p><el-button
plain
size=
"small"
>
取消
</el-button><el-button
type=
"primary"
size=
"small"
@
click=
"saveEdit"
>
保存
</el-button></p>
</div>
<edit-information
:patientInfoObj=
"patientInfo"
:checkForm=
"checkForm"
></edit-information>
<edit-information
:patientInfoObj=
"patientInfo"
:checkForm=
"checkForm"
@
addListenSave=
"addListenSave"
:patientId=
"patientId"
></edit-information>
</div>
</div>
</
template
>
...
...
@@ -34,16 +38,13 @@
curmbSecond
:
'我的居民'
,
curmbThird
:
'居民详情'
,
jumPathThird
:
'/patients-manage/mypatients-manage/patients-list'
,
patientId
:
''
,
//暂时写死一个居民的patientId
patientInfo
:
{
isWechatBind
:
1
,
remark
:
''
,
},
checkForm
:
false
patientId
:
''
,
patientInfo
:
{},
checkForm
:
false
,
}
},
created
()
{
this
.
patientId
=
this
.
$route
.
query
.
patientId
;
this
.
patientId
=
String
(
this
.
$route
.
query
.
patientId
)
;
this
.
init
();
},
computed
:
{
...
...
@@ -56,72 +57,47 @@
getPatientDetail
(
this
.
patientId
).
then
((
data
)
=>
{
if
(
data
.
code
==
'000000'
)
{
this
.
patientInfo
=
data
.
data
;
if
(
this
.
patientInfo
){
let
customLabels
=
this
.
patientInfo
.
customLabels
;
let
diseases
=
this
.
patientInfo
.
diseases
;
let
groupLabelNames
=
[];
let
groupDiseaseNames
=
[];
//对出生日期的处理
if
(
this
.
patientInfo
.
birthTime
){
let
timeArr
=
this
.
patientInfo
.
birthTime
.
split
(
'-'
);
let
mm
=
parseInt
(
timeArr
[
1
])
<
10
?
`0
${
parseInt
(
timeArr
[
1
])}
`
:
parseInt
(
timeArr
[
1
]);
let
dd
=
parseInt
(
timeArr
[
2
])
<
10
?
`0
${
parseInt
(
timeArr
[
2
])}
`
:
parseInt
(
timeArr
[
2
]);
this
.
birthTimeDisplay
=
`
${
timeArr
[
0
]}
-
${
mm
}
-
${
dd
}
`
;
}
else
{
this
.
birthTimeDisplay
=
''
;
}
// 对分组的处理
if
(
customLabels
)
{
customLabels
.
forEach
(
item
=>
{
groupLabelNames
.
push
(
item
.
label
)
});
this
.
showLabelName
=
groupLabelNames
.
join
(
';'
);
}
else
{
this
.
showLabelName
=
''
;
}
// 对诊断疾病的处理
if
(
diseases
)
{
diseases
.
forEach
(
item
=>
{
groupDiseaseNames
.
push
(
item
.
diseaseName
)
});
this
.
showDiseaseName
=
groupDiseaseNames
.
join
(
';'
);
}
else
{
this
.
showDiseaseName
=
''
;
}
}
}
})
},
saveEdit
()
{
this
.
checkForm
=
true
;
},
//提醒绑定
remindBind
()
{
let
remindMobileWechatPara
=
{
qrcodeType
:
1
,
patientId
:
this
.
patientId
,
// deviceInfo: window.getDeviceInfo()
}
getRemindPatient
({
...
remindMobileWechatPara
}).
then
(
data
=>
{
if
(
data
.
code
==
'000000'
)
{
this
.
$message
.
success
(
data
.
data
.
respMsg
);
}
else
{
this
.
$message
.
error
(
data
.
message
);
}
})
},
//保存备注
saveRemark
()
{
savePatientInfo
(
this
.
patientInfo
).
then
(
data
=>
{
if
(
data
.
code
==
'000000'
){
this
.
$message
.
success
(
'保存备注成功'
)
addListenSave
(
val
)
{
this
.
checkForm
=
false
;
if
(
val
.
status
)
{
// 调用保存接口
}
else
{
this
.
$message
.
error
(
data
.
message
);
this
.
$message
.
error
(
'请正确填写信息'
);
}
})
},
//提醒绑定
// remindBind() {
// let remindMobileWechatPara = {
// qrcodeType: 1,
// patientId: this.patientId,
// // deviceInfo: window.getDeviceInfo()
// }
// getRemindPatient({
// ...remindMobileWechatPara
// }).then( data => {
// if(data.code == '000000') {
// this.$message.success(data.data.respMsg);
// }else {
// this.$message.error(data.message);
// }
// })
// },
// //保存备注
// saveRemark() {
// savePatientInfo(this.patientInfo).then(data => {
// if(data.code == '000000'){
// this.$message.success('保存备注成功')
// }else {
// this.$message.error(data.message);
// }
// })
// },
},
filters
:
{
emptyFilter
:
function
(
value
)
{
...
...
src/views/patients/mypatients-manage/components/edit-information.vue
浏览文件 @
001a6612
...
...
@@ -14,6 +14,9 @@
<el-input
v-model=
"patientInfoForm.nickname"
placeholder=
"请输入居民姓名"
minlength=
"2"
maxlength=
"15"
:disabled=
"!baseInfoEdit"
clearable
>
</el-input>
</el-form-item>
...
...
@@ -24,6 +27,7 @@
v-model=
"patientInfoForm.mobilePhone"
maxlength=
"11"
placeholder=
"请输入手机号"
:disabled=
"!baseInfoEdit"
clearable
>
</el-input>
</el-form-item>
...
...
@@ -53,8 +57,8 @@
multiple
placeholder=
"请选择居民分组"
>
<el-option
v-for=
"
item
in labelsList"
:key=
"i
tem.labelId
"
v-for=
"
(item, index)
in labelsList"
:key=
"i
ndex
"
:label=
"item.labelName"
:value=
"item.labelId"
>
</el-option>
...
...
@@ -91,7 +95,7 @@
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label=
"年龄"
prop=
"age"
>
<span>
{{
patientInfoForm
.
age
}}
</span>
<span>
{{
patientInfoForm
.
age
?
`${patientInfoForm.age
}
岁`
:
'-'
}}
<
/span
>
<
/el-form-item
>
<
/el-col
>
<
el
-
col
:
span
=
"12"
>
...
...
@@ -141,6 +145,7 @@
<
el
-
input
v
-
model
=
"patientInfoForm.socialCard"
placeholder
=
"请输入居民医保卡号码"
maxlength
=
"30"
clearable
>
<
/el-input
>
<
/el-form-item
>
...
...
@@ -150,6 +155,7 @@
<
el
-
input
v
-
model
=
"patientInfoForm.fileLocator"
placeholder
=
"请输入居民健康档案编号"
maxlength
=
"30"
clearable
>
<
/el-input
>
<
/el-form-item
>
...
...
@@ -171,6 +177,7 @@
<
el
-
input
v
-
model
=
"patientInfoForm.address"
placeholder
=
"请输入居民的详细地址"
maxlength
=
"50"
clearable
>
<
/el-input
>
<
/el-form-item
>
...
...
@@ -182,11 +189,12 @@
<
el
-
input
v
-
model
=
"patientInfoForm.workplace"
placeholder
=
"请输入居民的工作单位"
maxlength
=
"30"
clearable
>
<
/el-input
>
<
/el-form-item
>
<
/el-col
>
<el-col
:span=
"12"
>
<
el
-
col
:
span
=
"12"
v
-
if
=
"patientId"
>
<
el
-
form
-
item
label
=
"微信"
prop
=
"address"
>
<
p
class
=
"info"
v
-
if
=
"patientInfoForm.isWechatBind == '1'"
>
未绑定
<
el
-
button
type
=
"text"
class
=
"ml10"
@
click
=
"remindBind"
v
-
if
=
"patientInfoForm.isRemind == '1'"
>
提醒绑定
<
/el-button><span class="ml10" v-if="patientInfoForm.isRemind == '2'">已提醒</
span
><
/p
>
<
p
class
=
"info"
v
-
else
-
if
=
"patientInfoForm.isWechatBind == '2'"
>
已绑定
<
span
class
=
"ml10"
>
(微信名:
{{
patientInfoForm
.
wechatNickname
|
emptyFilter
}}
)
<
/span></
p
>
...
...
@@ -214,8 +222,10 @@
<
/div
>
<
/template
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
getDiseasesList
,
getLabelList
,
getConstants
,
getNationsList
,
getRemindPatient
,
savePatientInfo
}
from
'@/utils/patients/patientsapi'
import
{
mapGetters
}
from
'vuex'
;
import
{
checkMobile
}
from
'@/utils/patients/checkValid'
;
import
{
checkCardNum
}
from
'@/utils/patients/checkCardNum'
;
import
{
getDiseasesList
,
getLabelList
,
getConstants
,
getNationsList
,
getRemindPatient
,
savePatientInfo
}
from
'@/utils/patients/patientsapi'
;
export
default
{
name
:
"basicInfo"
,
components
:
{
}
,
...
...
@@ -227,6 +237,7 @@
nationsList
:
[],
diseaseIdList
:
[],
labelIdList
:
[],
baseInfoEdit
:
true
,
patientInfoForm
:
{
nickname
:
''
,
mobilePhone
:
''
,
...
...
@@ -249,35 +260,43 @@
validStatus
:
false
,
rules
:
{
nickname
:
[{
required
:
true
,
message
:
'请输入居民姓名'
,
trigger
:
[
'change'
,
'blur'
]
}
],
mobilePhone
:
[{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
[
'change'
,
'blur'
]
}],
mobilePhone
:
[{
required
:
true
,
message
:
'请输入手机号'
,
trigger
:
[
'change'
,
'blur'
]
}
,{
validator
:
checkMobile
,
trigger
:
[
'blur'
,
'change'
]
}
],
idNo
:
[{
required
:
false
,
validator
:
checkCardNum
,
trigger
:
[
'change'
]
}
],
}
,
showLabelName
:
''
,
showDiseaseName
:
''
,
birthTimeDisplay
:
''
,
recordList
:
[{}],
}
}
,
props
:
{
patientInfoObj
:
Object
,
checkForm
:
Boolean
,
patientId
:
String
,
}
,
watch
:
{
patientInfoObj
(
val
){
if
(
val
){
if
(
this
.
patientId
){
this
.
patientInfoForm
=
val
;
this
.
baseInfoEdit
=
this
.
patientInfoForm
.
baseInfoEdit
;
let
customLabels
=
this
.
patientInfoForm
.
customLabels
;
let
diseases
=
this
.
patientInfoForm
.
diseases
;
if
(
customLabels
&&
customLabels
.
length
>
0
){
customLabels
.
forEach
((
kkk
)
=>
{
this
.
labelIdList
.
push
(
kkk
.
labelId
)
this
.
labelIdList
.
push
(
Number
(
kkk
.
labelId
)
)
}
)
}
else
{
this
.
labelIdList
=
[];
}
if
(
diseases
&&
diseases
.
length
>
0
)
{
diseases
.
forEach
((
kkk
)
=>
{
this
.
diseaseIdList
.
push
(
kkk
.
diseaseId
)
diseases
.
forEach
((
dis
)
=>
{
this
.
diseaseIdList
.
push
(
Number
(
dis
.
diseaseId
)
)
}
)
}
else
{
this
.
diseaseIdList
=
[];
}
if
(
this
.
patientInfoForm
.
idNo
)
{
this
.
hasIdNo
=
true
;
}
else
{
this
.
hasIdNo
=
false
;
}
// this.$refs['patientInfoForm'].clearValidate();
this
.
$forceUpdate
();
}
}
,
...
...
@@ -289,7 +308,8 @@
}
,
created
()
{
this
.
initConstant
();
}
,
mounted
(){
}
,
computed
:
{
...
mapGetters
([
...
...
@@ -308,8 +328,8 @@
}
);
getLabelList
({
type
:
1
,
token
:
'FFA85945A8374A4CB63A7616E38060DA'
,
//
token: this._token,
//
token: 'FFA85945A8374A4CB63A7616E38060DA',
token
:
this
.
_token
,
}
).
then
((
data
)
=>
{
if
(
data
.
code
==
'000000'
)
{
this
.
labelsList
=
data
.
data
.
labelNameList
;
...
...
@@ -347,23 +367,68 @@
}
,
saveInfoData
()
{
this
.
$refs
[
'patientInfoForm'
].
validate
((
valid
)
=>
{
// this.validStatus = valid;
console
.
log
(
'校验开始'
)
if
(
valid
)
{
this
.
$emit
(
'addListenSave'
,{
status
:
true
,
patientInfoForm
:
this
.
patientInfoForm
}
)
console
.
log
(
'校验通过'
)
}
else
{
this
.
$emit
(
'addListenSave'
,{
status
:
false
,
patientInfoForm
:
this
.
patientInfoForm
,
}
)
return
false
;
}
}
);
}
,
// async validID(rule,value,callback)
//
{
// // 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
// let reg = /(^\d
{
15
}
$
)
|
(
^
\
d
{
18
}
$
)
|
(
^
\
d
{
17
}
(
\
d
|
X
|
x
)
$
)
/
;
// if(value != '')
{
// if (reg.test(value))
{
// await this.go(value.length);
// callback()
//
}
else
{
// callback(new Error('身份证号码不正确'))
//
}
//
}
else
{
// callback();
//
}
//
}
,
//
// // 实现自动生成生日,性别,年龄
// go(val)
{
// let iden = this.patientInfoForm.idNo;
// let sex = null;
// let birth = null;
// let myDate = new Date();
// let month = myDate.getMonth() + 1;
// let day = myDate.getDate();
// let age = 0;
//
// if(val===18)
{
// age = myDate.getFullYear() - iden.substring(6, 10) - 1;
// sex = iden.substring(16,17);
// birth = iden.substring(6,10)+"-"+iden.substring(10,12)+"-"+iden.substring(12,14);
// if (iden.substring(10, 12) < month || iden.substring(10, 12) == month && iden.substring(12, 14) <= day) age++;
//
//
}
// if(val===15)
{
// age = myDate.getFullYear() - iden.substring(6, 8) - 1901;
// sex = iden.substring(13,14);
// birth = "19"+iden.substring(6,8)+"-"+iden.substring(8,10)+"-"+iden.substring(10,12);
// if (iden.substring(8, 10) < month || iden.substring(8, 10) == month && iden.substring(10, 12) <= day) age++;
//
}
//
// if(sex%2 === 0)
// sex = 2;
// else
// sex = 1;
// this.patientInfoForm.sex = sex;
// this.patientInfoForm.age = age;
// this.patientInfoForm.birthTime = birth;
// // this.baseInfo.birthplace = this.area[iden.substring(0,2)];
//
}
,
}
,
filters
:
{
emptyFilter
:
function
(
value
)
{
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录