|
@ -1,11 +1,478 @@
|
|
|
<!DOCTYPE html>
|
|
|
<html lang="en">
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>设备</title>
|
|
|
</head>
|
|
|
<body>
|
|
|
|
|
|
</body>
|
|
|
</html>
|
|
|
<head>
|
|
|
<meta charset="UTF-8" />
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
<title>新增设备</title>
|
|
|
<link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css" />
|
|
|
<link rel="stylesheet" type="text/css" href="../../../css/style.min.css" />
|
|
|
<link rel="stylesheet" type="text/css" href="../../../css/cross.css" />
|
|
|
<link rel="stylesheet" href="../../../plugins/toastr/toastr.min.css" />
|
|
|
<link rel="stylesheet" href="../../../plugins/element-ui/element-ui.css" />
|
|
|
<link rel="stylesheet" type="text/css" href="../css/date.css" />
|
|
|
<link rel="stylesheet" href="../css/common.css" />
|
|
|
<style>
|
|
|
#app {
|
|
|
padding: 20px;
|
|
|
position: relative;
|
|
|
height: 100%;
|
|
|
}
|
|
|
.box {
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
padding: 12px;
|
|
|
}
|
|
|
.item {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
|
}
|
|
|
.item .img-box {
|
|
|
width: 200px;
|
|
|
height: 200px;
|
|
|
background-color: #fff;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
}
|
|
|
.item img {
|
|
|
width: 100px;
|
|
|
}
|
|
|
.device-info {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
|
font-size: 18px;
|
|
|
}
|
|
|
.device-info img {
|
|
|
width: 180px;
|
|
|
margin: 10px 0;
|
|
|
}
|
|
|
.form-item {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
.form-item .form-label {
|
|
|
width: 70px;
|
|
|
}
|
|
|
.title {
|
|
|
font-size: 18px;
|
|
|
position: relative;
|
|
|
margin-left: 6px;
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
.title::before {
|
|
|
content: '';
|
|
|
width: 3px;
|
|
|
height: 14px;
|
|
|
position: absolute;
|
|
|
left: -8px;
|
|
|
top: 50%;
|
|
|
transform: translateY(-50%);
|
|
|
background-color: #17b3ec;
|
|
|
}
|
|
|
.ml6 {
|
|
|
margin-left: 6px;
|
|
|
}
|
|
|
.add-device-btn {
|
|
|
position: absolute;
|
|
|
bottom: 28px;
|
|
|
left: 50%;
|
|
|
transform: translateX(-50%);
|
|
|
width: 400px;
|
|
|
}
|
|
|
</style>
|
|
|
</head>
|
|
|
<body>
|
|
|
<div id="app" v-cloak>
|
|
|
<template v-if="step==1">
|
|
|
<el-tabs v-model="active" type="card" @tab-click="tabChange">
|
|
|
<el-tab-pane label="血压计" name="xueya" class="box">
|
|
|
<div v-for="item in xueyaList" :id="item.id" class="item" @click="selectItem(item)">
|
|
|
<div class="img-box">
|
|
|
<img :src="item.photo" alt="" v-if="item.photo!=''" />
|
|
|
<img src="../../../images/img.png" alt="" v-else />
|
|
|
</div>
|
|
|
<span>{{item.name}}</span>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="智能手表" name="watch">
|
|
|
<div v-for="item in watchList" :id="item.id" class="item" @click="selectItem(item)">
|
|
|
<div class="img-box">
|
|
|
<img :src="item.photo" alt="" v-if="item.photo!=''" />
|
|
|
<img src="../../../images/img.png" alt="" v-else />
|
|
|
</div>
|
|
|
<span>{{item.name}}</span>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
<el-tab-pane label="血糖仪" name="xuetang">
|
|
|
<div v-for="item in xuetangList" :id="item.id" class="item" @click="selectItem(item)">
|
|
|
<div class="img-box">
|
|
|
<img :src="item.photo" alt="" v-if="item.photo!=''" />
|
|
|
<img src="../../../images/img.png" alt="" v-else />
|
|
|
</div>
|
|
|
<span>{{item.name}}</span>
|
|
|
</div>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<div class="device-info">
|
|
|
<span>{{deviceObj.name}}</span>
|
|
|
<img :src="deviceObj.photo" alt="" />
|
|
|
</div>
|
|
|
<div v-if="deviceObj.categoryCode == 2">
|
|
|
<div class="form-item">
|
|
|
<div class="form-label">SN码</div>
|
|
|
<el-input v-model="query.device_sn" placeholder="请输入设备唯一码"></el-input>
|
|
|
</div>
|
|
|
<div class="form-item" v-if="deviceObj.deviceId == 6">
|
|
|
<div class="form-label">SIM码</div>
|
|
|
<el-input v-model="query.sim" placeholder="请输入SIM码"></el-input>
|
|
|
</div>
|
|
|
<div class="title">绑定快捷键</div>
|
|
|
<el-radio v-model="query.userType" label="1" class="ml6">A</el-radio>
|
|
|
<br />
|
|
|
<el-radio v-model="query.userType" label="2" class="ml6">B</el-radio>
|
|
|
<br />
|
|
|
绑定后,从该快捷键上传的数据将导入您的健康记录中!
|
|
|
</div>
|
|
|
<div v-else-if="deviceObj.categoryCode == 4">
|
|
|
<div class="form-item">
|
|
|
<div class="form-label">IMEI码</div>
|
|
|
<el-input v-model="query.deviceSn" placeholder="请输入设备唯一码"></el-input>
|
|
|
</div>
|
|
|
绑定后,智能手表监测的心率数据将自动同步导入您的健康记录中!
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<div class="form-item">
|
|
|
<div class="form-label">SN码</div>
|
|
|
<el-input v-model="query.device_sn" placeholder="请输入设备唯一码"></el-input>
|
|
|
</div>
|
|
|
绑定后,血氧仪测量的数据将自动同步导入您的健康记录中!
|
|
|
</div>
|
|
|
<el-button class="add-device-btn" type="primary" @click="bindDeviceFn">立即绑定</el-button>
|
|
|
</template>
|
|
|
</div>
|
|
|
<script type="text/javascript" src="../../../js/vue.js"></script>
|
|
|
<script type="text/javascript" src="../../../js/jquery-2.2.4.js"></script>
|
|
|
<script type="text/javascript" src="../../../js/es6-promise.js" charset="utf-8"></script>
|
|
|
<script type="text/javascript" src="../../../plugins/toastr/toastr.min.js"></script>
|
|
|
<script type="text/javascript" src="../../../plugins/element-ui/element-ui.js"></script>
|
|
|
<script type="text/javascript" src="../../../api/http-request.js"></script>
|
|
|
<script type="text/javascript" src="../../../plugins/layer/layer.min.js"></script>
|
|
|
<script type="text/javascript" src="../../../api/rehabilitation-api.js"></script>
|
|
|
<script type="text/javascript" src="../../../api/recover_api.js"></script>
|
|
|
<script type="text/javascript" src="../../../js/underscore-1.9.1.js"></script>
|
|
|
<script type="text/javascript" src="../../../js/util.js" charset="utf-8"></script>
|
|
|
<script>
|
|
|
new Vue({
|
|
|
el: '#app',
|
|
|
data() {
|
|
|
return {
|
|
|
active: 'xueya',
|
|
|
patient: '',
|
|
|
step: 1,
|
|
|
query: {},
|
|
|
xueyaList: [
|
|
|
{
|
|
|
'id': 2,
|
|
|
'categoryCode': '1',
|
|
|
'photo': 'http://f1.yihuimg.com/TFS/upfile/doctor_honor/2016-07-12/497280_1468291541996.png',
|
|
|
'brands': '康为',
|
|
|
'model': 'G-426-3',
|
|
|
'isMultiUser': '0',
|
|
|
'multiUser': '{"默认":"-1"}',
|
|
|
'name': '康为G-426-3',
|
|
|
'czrq': '2016-09-08',
|
|
|
'del': '1',
|
|
|
'authorizationTime': null
|
|
|
},
|
|
|
{
|
|
|
'id': 3,
|
|
|
'categoryCode': '1',
|
|
|
'photo': 'http://f1.yihuimg.com/TFS/upfile/doctor_honor/2016-07-12/497276_1468291512115.png',
|
|
|
'brands': '爱奥乐',
|
|
|
'model': 'G-777G',
|
|
|
'isMultiUser': '0',
|
|
|
'multiUser': '{"默认":"-1"}',
|
|
|
'name': '爱奥乐G-777G',
|
|
|
'czrq': '2016-09-08',
|
|
|
'del': '1',
|
|
|
'authorizationTime': null
|
|
|
},
|
|
|
{
|
|
|
'id': 5,
|
|
|
'categoryCode': '1',
|
|
|
'photo': 'http://www.xmtyw.cn/group1/M00/00/30/Cl8WjFonog2Af6nAAAFuhkn1vlY658.png',
|
|
|
'brands': '三诺',
|
|
|
'model': '亲智',
|
|
|
'isMultiUser': '0',
|
|
|
'multiUser': '{"默认":"-1"}',
|
|
|
'name': '三诺亲智',
|
|
|
'czrq': '2017-12-06',
|
|
|
'del': '1',
|
|
|
'authorizationTime': null
|
|
|
},
|
|
|
{
|
|
|
'id': 8,
|
|
|
'categoryCode': '1',
|
|
|
'photo': '',
|
|
|
'brands': '弈拓',
|
|
|
'model': 'YTSE-1606',
|
|
|
'isMultiUser': '',
|
|
|
'multiUser': '',
|
|
|
'name': '自助体检一体机',
|
|
|
'czrq': '2019-01-27',
|
|
|
'del': '1',
|
|
|
'authorizationTime': null
|
|
|
}
|
|
|
],
|
|
|
watchList: [],
|
|
|
xuetangList: [],
|
|
|
deviceObj: {}
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
tabChange(val) {
|
|
|
switch (val) {
|
|
|
case 'xueya':
|
|
|
this.getXueyaList()
|
|
|
break
|
|
|
case 'watch':
|
|
|
this.getWatchList()
|
|
|
break
|
|
|
case 'xuetang':
|
|
|
this.getXuetangList()
|
|
|
break
|
|
|
}
|
|
|
},
|
|
|
getXueyaList() {
|
|
|
const vm = this
|
|
|
httpRequest.get('common/device/DeviceList', { data: { category_code: 2 } }).then(function (res) {
|
|
|
vm.xueyaList = res.data
|
|
|
})
|
|
|
},
|
|
|
getWatchList() {
|
|
|
const vm = this
|
|
|
httpRequest.get('common/device/DeviceList', { data: { category_code: 4 } }).then(function (res) {
|
|
|
vm.watchList = res.data
|
|
|
})
|
|
|
},
|
|
|
getXuetangList() {
|
|
|
const vm = this
|
|
|
httpRequest.get('common/device/DeviceList', { data: { category_code: 1 } }).then(function (res) {
|
|
|
vm.xuetangList = res.data
|
|
|
})
|
|
|
},
|
|
|
selectItem(item) {
|
|
|
const vm = this
|
|
|
httpRequest.get('common/device/DeviceInfo', { data: { id: item.id } }).then(function (res) {
|
|
|
vm.step++
|
|
|
vm.deviceObj = { ...res.data, categoryCode: 4 }
|
|
|
vm.query = {}
|
|
|
})
|
|
|
},
|
|
|
bindDeviceFn() {
|
|
|
return
|
|
|
const vm = this
|
|
|
var b = /^[0-9a-zA-Z]*$/g
|
|
|
if (!b.test(this.device_sn)) {
|
|
|
this.$message.warning('对不起,您输入的SN有误,请重新输入')
|
|
|
}
|
|
|
let params = {
|
|
|
device_sn: this.query.device_sn,
|
|
|
patient: this.patient,
|
|
|
type: this.deviceObj.categoryCode
|
|
|
}
|
|
|
httpRequest.get('doctor/device/PatientDeviceIdcard', { data: params }).then(function (res) {
|
|
|
if (res.data.length == 0) {
|
|
|
checkSuccess(snCode)
|
|
|
return
|
|
|
}
|
|
|
//遍历绑定信息
|
|
|
var isbind = false //是否绑定
|
|
|
var bindnum = 0
|
|
|
var showTitle = ''
|
|
|
var fatherData = null
|
|
|
var montherData = null
|
|
|
//循环取出爸爸妈妈健的数据
|
|
|
for (var j in res.data) {
|
|
|
var data = res.data[j] //取出设置
|
|
|
var dataType = data['type'] //按键类型1.爸爸建2.妈妈键
|
|
|
var others = data['others'] //others==1为被别人绑定
|
|
|
if (dataType == 1) {
|
|
|
fatherData = data
|
|
|
if (others == 1) {
|
|
|
bindnum += 1
|
|
|
if (vm.userType == 1) vm.userType = 0 //被绑定
|
|
|
}
|
|
|
} else {
|
|
|
montherData = data
|
|
|
if (others == 1) {
|
|
|
if (vm.userType == 2) vm.userType = 0 //被绑定
|
|
|
$('.monther').attr('data-click', '0') //设置键2无法点击
|
|
|
$('.montherbf').html('已经被' + data['name'] + '绑定') //设置绑定信息
|
|
|
$('.div-monther-band').show() //显示绑定信息
|
|
|
bindnum += 1
|
|
|
if ($('.monther').hasClass('active')) {
|
|
|
//用户已经选择了爸爸建,就重置
|
|
|
$('.monther').removeClass('active')
|
|
|
showTitle = '该快捷键已经被' + data['name'] + '绑定,若要绑定该快捷键,需' + data['name'] + '先解绑设备'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (bindnum == 2) {
|
|
|
mui.confirm('该设备所有快捷键已被绑定,解绑快捷键后,方可再次绑定!', '', ['我知道了'], function (e) {
|
|
|
return
|
|
|
})
|
|
|
$('#bang-btn').addClass('active')
|
|
|
return false
|
|
|
} else if (bindnum == 1 && showTitle != '') {
|
|
|
//被绑定的按键选项
|
|
|
mui.confirm(showTitle, '', ['我知道了'], function (e) {
|
|
|
return
|
|
|
})
|
|
|
$('#bang-btn').addClass('active')
|
|
|
return false
|
|
|
}
|
|
|
if (fatherData != null) {
|
|
|
var others = fatherData['others'] //others==1为被别人绑定
|
|
|
if (others != 1) {
|
|
|
//被别人绑定了
|
|
|
//被自己绑定
|
|
|
if (dataId == null) {
|
|
|
//新增的时候输入被自己绑定的SN码
|
|
|
$('.father').attr('data-click', '-1') //设置爸爸妈妈键不能点击
|
|
|
$('.monther').attr('data-click', '-1')
|
|
|
if ($('.father').hasClass('active')) {
|
|
|
//用户已经选择了爸爸建,就重置
|
|
|
$('.father').removeClass('active')
|
|
|
}
|
|
|
mui.confirm('对不起,该居民已绑定过该设备,解绑后方可继续操作', '', ['我知道了'], function (e) {
|
|
|
return
|
|
|
})
|
|
|
$('#bang-btn').addClass('active')
|
|
|
return false //直接退出不保存
|
|
|
} else {
|
|
|
if (!checkSuccess) {
|
|
|
//界面初始化的时候没有校验成功回调
|
|
|
userType = 1
|
|
|
//选中爸爸键
|
|
|
$('.father').addClass('active')
|
|
|
} else if (oldSn != snCode) {
|
|
|
$('.father').attr('data-click', '-1') //设置爸爸妈妈键不能点击
|
|
|
$('.monther').attr('data-click', '-1')
|
|
|
if ($('.father').hasClass('active')) {
|
|
|
//用户已经选择了爸爸建,就重置
|
|
|
$('.father').removeClass('active')
|
|
|
}
|
|
|
mui.confirm('对不起,该居民已绑定过该设备,解绑后方可继续操作', '', ['我知道了'], function (e) {
|
|
|
return
|
|
|
})
|
|
|
$('#bang-btn').addClass('active')
|
|
|
return false //直接退出不保存
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (montherData != null) {
|
|
|
var others = montherData['others'] //others==1为被别人绑定
|
|
|
if (others != 1) {
|
|
|
//被自己绑定
|
|
|
if (dataId == null) {
|
|
|
//新增的时候输入被自己绑定的SN码
|
|
|
$('.father').attr('data-click', '-1') //设置爸爸妈妈键不能点击
|
|
|
$('.monther').attr('data-click', '-1')
|
|
|
//$(".monther").addClass("active");//自己绑定了的键设置高亮
|
|
|
if ($('.monther').hasClass('active')) {
|
|
|
//用户已经选择了爸爸建,就重置
|
|
|
$('.monther').removeClass('active')
|
|
|
}
|
|
|
mui.confirm('对不起,该居民已绑定过该设备,解绑后方可继续操作', '', ['我知道了'], function (e) {
|
|
|
return
|
|
|
})
|
|
|
$('#bang-btn').addClass('active')
|
|
|
return false //直接退出不保存
|
|
|
} else {
|
|
|
if (!suc) {
|
|
|
userType = 2
|
|
|
//选中妈妈键
|
|
|
$('.monther').addClass('active')
|
|
|
} else if (oldSn != snCode) {
|
|
|
$('.father').attr('data-click', '-1') //设置爸爸妈妈键不能点击
|
|
|
$('.monther').attr('data-click', '-1')
|
|
|
//$(".monther").addClass("active");//自己绑定了的键设置高亮
|
|
|
if ($('.monther').hasClass('active')) {
|
|
|
//用户已经选择了爸爸建,就重置
|
|
|
$('.monther').removeClass('active')
|
|
|
}
|
|
|
mui.confirm('对不起,该居民已绑定过该设备,解绑后方可继续操作', '', ['我知道了'], function (e) {
|
|
|
return
|
|
|
})
|
|
|
$('#bang-btn').addClass('active')
|
|
|
return false //直接退出不保存
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
checkSuccess(snCode)
|
|
|
})
|
|
|
},
|
|
|
checkSuccess(snCode) {
|
|
|
if (userType == 0) {
|
|
|
mui.toast('请选择要绑定的快捷键!')
|
|
|
$('#bang-btn').addClass('active')
|
|
|
return false
|
|
|
}
|
|
|
var name1 = '血压计-' + name
|
|
|
var params = {}
|
|
|
params.deviceId = deviceId //设备ID
|
|
|
params.deviceName = name1 //设备名称
|
|
|
params.deviceSn = snCode //设备SN码
|
|
|
params.categoryCode = type //设备分类 血糖仪1 血压计 2
|
|
|
params.userType = userType //是否多用户,1.爸爸建,2.妈妈键
|
|
|
params.user = patient
|
|
|
if (rowData.id) {
|
|
|
params.id = rowData.id
|
|
|
}
|
|
|
if (deviceId == 6) {
|
|
|
params.sim = $('#simcode').val()
|
|
|
}
|
|
|
|
|
|
//增加绑定信息
|
|
|
var docInfo = JSON.parse(plus.storage.getItem('docInfo'))
|
|
|
params.hospital = docInfo.hospital
|
|
|
params.hospitalName = docInfo.hospitalName
|
|
|
params.checkDoctorName = docInfo.name
|
|
|
|
|
|
sendPost(
|
|
|
'doctor/device/SavePatientDevice',
|
|
|
{ 'data': JSON.stringify(params) },
|
|
|
function (res) {
|
|
|
mui.toast('设备绑定失败!')
|
|
|
$('#bang-btn').addClass('active')
|
|
|
},
|
|
|
function (res) {
|
|
|
if (res.status == '200') {
|
|
|
mui.toast('设备绑定成功')
|
|
|
openwdsb()
|
|
|
} else {
|
|
|
$('#bang-btn').addClass('active')
|
|
|
mui.toast(res.msg)
|
|
|
}
|
|
|
}
|
|
|
)
|
|
|
}
|
|
|
},
|
|
|
|
|
|
mounted() {
|
|
|
// this.getXueyaList()
|
|
|
this.patient = GetRequest().patient
|
|
|
}
|
|
|
})
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|