This commit is contained in:
2024-05-15 10:08:22 +08:00
parent 63e41c8bce
commit 9b9f031159
3 changed files with 573 additions and 7 deletions

View File

@ -0,0 +1,480 @@
<template>
<view class="app" v-if="current == 7">
<view class="titletexts">
<view class="title">
正常范围
</view>
<view class="add" @click="addPressure">
添加数据
</view>
<view class="texts">
<view class="text">
<view class="p">
收缩压
</view>
<view class="ptwo">
90-140mmHg
</view>
</view>
<view class="text">
<view class="p">
舒张压
</view>
<view class="ptwo">
60-90mmHg
</view>
</view>
</view>
</view>
<view class="bottomlist">
<view class="timelist">
<uni-data-select class="item" v-model="deviceUserId" :localdata="deviceUserslist" @change="changePro"
:clear="false">
</uni-data-select>
<view class="item" v-for="(item,index) in timelist" :class="timeindex == index?'timeitem':''"
@tap='taptimeindex(index)'>
{{item.name}}
</view>
</view>
<view class="text">
:全部视图主要展示全部血压数值的趋势曲线 单位:mmHg
</view>
<qiun-data-charts type="line" loadingType="0" :opts="line_opts" :ontouch="true" :chartData="datalist" />
</view>
<view class="bottomtexts">
<view class="lefttext">
<view class="pone">
平均
</view>
<view class="ptwo">
{{echartData.calc.avgVal?echartData.calc.avgVal:'暂无'}}
</view>
</view>
<view class="lefttext">
<view class="pone">
最大
</view>
<view class="ptwo">
<view class="">
{{echartData.calc.maxDbpVal?echartData.calc.maxDbpVal:'暂无'}}
</view>
{{echartData.calc.maxSbpVal?echartData.calc.maxSbpVal:'暂无'}}
</view>
</view>
<view class="righttext">
<view class="pone">
最小
</view>
<view class="ptwo">
<view class="">
{{echartData.calc.minDbpVal?echartData.calc.minDbpVal:'暂无'}}
</view>
{{echartData.calc.minSbpVal?echartData.calc.minSbpVal:'暂无'}}
</view>
</view>
</view>
<view class="charts-box">
<qiun-data-charts type="pie" :opts="pie_opts" :chartData="datalisttwo" />
</view>
<uni-table border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th align="center" width='150'>记录时间</uni-th>
<uni-th align="center" width='70'>收缩压</uni-th>
<uni-th align="center" width='70'>舒张压</uni-th>
</uni-tr>
<uni-tr v-for="item in tablelist">
<uni-td align="center" width='150'>{{item.measureTime}}</uni-td>
<uni-td align="center" width='70'>{{item.sbp}}</uni-td>
<uni-td align="center" width='70'>{{item.dbp}}</uni-td>
</uni-tr>
</uni-table>
</view>
</template>
<script>
export default {
props: {
current: {
type: Number,
require: true
},
echartData: {
type: Object,
require: true
},
tablelist: {
type: Object,
require: true
}
},
computed: {},
data() {
return {
timelist: [{
name: '全部',
id: 0
}, {
name: '周',
id: 1
}, {
name: '月',
id: 2
}, {
name: '年',
id: 3
}, ],
timeindex: 0,
socketOpen: false,
timer: null,
datalist: null,
datalisttwo: null,
deviceUserId: '',
deviceUserslist: [{
value: '',
text: '全部',
}, {
value: 1,
text: '用户1',
}, {
value: 2,
text: '用户2',
}],
pie_opts: {
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
"#ea7ccc"
],
padding: [5, 5, 5, 5],
enableScroll: false,
extra: {
pie: {
activeOpacity: 0.5,
activeRadius: 10,
offsetAngle: 0,
labelWidth: 15,
border: false,
borderWidth: 3,
borderColor: "#FFFFFF"
},
},
},
line_opts: {
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
"#ea7ccc"
],
dataLabel: true,
enableScroll: true,
touchMoveLimit: 24,
padding: [15, 10, 0, 15],
xAxis: {
lineHeight: 40,
disableGrid: true,
boundaryGap: "center",
fontSize: 10,
type: 'grid',
gridType: 'dash',
itemCount: 4, //x5
scrollShow: true, //false
scrollAlign: 'left', //
},
yAxis: {
gridType: "dash",
dashLength: 2
},
extra: {
line: {
type: "straight",
width: 2,
activeType: "hollow"
}
}
},
}
},
created() {},
mounted() {
// if (this.current == 7) {
// this.scoket()
// }
this.getServerData()
},
destroyed() {
clearInterval(this.timer);
// if (this.socketOpen == true) {
// uni.closeSocket();
// }
},
watch: {
echartData: {
handler() {
this.getServerData()
},
deep: true
},
current(newValue, oldValue) {
if (newValue != 7) {
clearInterval(this.timer);
if (this.socketOpen == true) {
// uni.closeSocket();
}
} else {
setTimeout(() => {
// this.scoket()
}, 800)
}
}
},
methods: {
changePro(e) {
this.$emit('tapdeviceUser', e);
},
taptimeindex(index) {
this.timeindex = index
this.$emit('taptimeindex', index);
},
addPressure() {
uni.navigateTo({
url: "/pagesC/addPressure/addPressure"
})
},
getServerData() {
if (this.echartData) {
setTimeout(() => {
let res = {
categories: [],
series: [{
name: "舒张压",
data: []
},
{
name: "收缩压",
data: []
}
]
};
res.series[0].data = this.echartData.list.map(e => e.dbp)
res.series[1].data = this.echartData.list.map(e => e.sbp)
res.categories = this.echartData.list.map(e => e.measureTime)
this.datalist = res
let restwo = {
series: [{
data: [{
"name": "正常" + this.echartData.calc.normalNum + "次",
"value": this.echartData.calc.normalNum
}, {
"name": "超标" + this.echartData.calc.overNum + "次",
"value": this.echartData.calc.overNum
}]
}]
};
this.datalisttwo = restwo
}, 500)
}
},
scoket() {
var SOCKETURL = 'ws://112.7.50.34:9002/webSocket/' + uni.getStorageSync('userinfo').cardNo
const that = this
// uni.closeSocket()
this.socketOpen = false
try {
uni.connectSocket({
url: SOCKETURL
})
uni.onSocketOpen(res => {
console.log('webScoket连接已打开', res);
that.socketOpen = true
that.reset()
})
uni.onSocketError(err => {
console.log('webScoket连接打开失败', err);
if (err && err.code != 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketClose(err => {
console.log('webScoket连接关闭', err);
if (err && err.code !== 1000) {
setTimeout(() => {
that.socketOpen = true
uni.connectSocket({
url: SOCKETURL
})
}, 3 * 1000)
}
})
uni.onSocketMessage(res => {
console.log("webScoket监听收到的信息", res);
// that.newsList.push({
// senderName: that.currentItem.senderName,
// content: JSON.parse(res.data).message
// })
this.$emit('websocket-message');
this.$forceUpdate()
})
} catch (e) {
console.log(e);
}
},
//
reset() {
let that = this
var SOCKETURL = 'ws://112.7.50.34:9002/webSocket/' + uni.getStorageSync('userinfo').cardNo
clearInterval(that.timer);
that.timer = setInterval(() => {
uni.sendSocketMessage({
data: 'ping',
success(res) {
console.log('正在发送心跳');
},
fail(err) {
console.log('心跳发送失败,重新连接...');
_socketOpen = true
uni.connectSocket({
url: SOCKETURL
})
}
})
}, 60000)
},
}
}
</script>
<style lang="scss">
page {
background-color: #F7F5F5;
}
::v-deep .uni-select {
border: none !important;
}
.app {
width: 96%;
margin: 0 auto;
padding-bottom: 20rpx;
/* 请根据实际需求修改父元素尺寸,组件自动识别宽高 */
.charts-box {
width: 100%;
background-color: #fff;
margin-bottom: 20rpx;
}
.bottomtexts {
width: 100%;
display: flex;
background-color: #fff;
padding: 20rpx 0 40rpx;
.lefttext,
.righttext {
width: 50%;
text-align: center;
}
}
.bottomlist {
width: 100%;
background-color: #fff;
margin-top: 17rpx;
.text {
width: 90%;
margin: 20rpx auto 30rpx;
font-size: 18rpx;
font-weight: 400;
color: #595959;
}
.timelist {
width: 90%;
margin: 0 auto;
display: flex;
padding-top: 25rpx;
.item {
width: 25%;
// height: 56rpx;
border-radius: 5rpx 0rpx 0rpx 5rpx;
text-align: center;
line-height: 56rpx;
background: #FFFFFF;
border: 2rpx solid #26A888;
border-radius: 0rpx 5rpx 5rpx 0rpx;
color: #26A888;
}
.timeitem {
background: #26A888;
color: #fff;
}
}
}
.titletexts {
width: 100%;
height: 250rpx;
background: #FFFFFF;
box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
border-radius: 5rpx;
position: relative;
.texts {
width: 100%;
display: flex;
position: absolute;
top: 130rpx;
.text {
width: 50%;
.p {
text-align: center;
font-size: 24rpx;
font-weight: 500;
color: #000000;
}
.ptwo {
font-size: 30rpx;
font-weight: 500;
color: #26A888;
text-align: center;
margin-top: 20rpx;
}
}
}
.add {
width: 205rpx;
height: 64rpx;
background: #26A888;
border-radius: 32rpx 0rpx 0rpx 32rpx;
line-height: 64rpx;
text-align: center;
position: absolute;
right: 0%;
color: #fff;
top: 25rpx;
}
.title {
text-align: center;
font-size: 24rpx;
font-weight: 400;
color: #26A888;
width: 100%;
position: absolute;
top: 46rpx;
}
}
}
</style>

View File

@ -342,6 +342,73 @@
</view>
</view>
</view>
<view class="item" @tap='gohealthdata(7)'>
<view class="itemtitle">
动态血压
</view>
<view class="" v-if="!dataeight">
<view class="itemtext">
快来测量吧~
</view>
<view class="itemtext two">
您暂时未测量
</view>
<image src="@/static/pagesC/bloodpressure.png" mode=""></image>
</view>
<view class="titletexts" v-else>
<view class="time">
{{dataeight.date}}
</view>
<view class="bloodpressure">
<view class="bloodpressureitem">
<view class="bloodpressuretitle">
{{dataeight.ssy}}
</view>
<view class="mmHg">
mmHg
</view>
<view class="colorone" v-if="dataeight.ssy<90">
<view class="dot">
</view>
过低
</view>
<view class="colortwo" v-if="dataeight.ssy>=90&&dataeight.ssy<=140">
<view class="dot">
</view>
正常
</view>
<view class="colorthree" v-if="dataeight.ssy>=140">
<view class="dot">
</view>
过高
</view>
</view>
<view class="bloodpressureitem">
<view class="bloodpressuretitle">
{{dataeight.szy}}
</view>
<view class="mmHg">
mmHg
</view>
<view class="colorone" v-if="dataeight.szy<60">
<view class="dot">
</view>
过低
</view>
<view class="colortwo" v-if="dataeight.szy>=60&&dataeight.szy<=90">
<view class="dot">
</view>
正常
</view>
<view class="colorthree" v-if="dataeight.szy>90">
<view class="dot">
</view>
过高
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
@ -359,6 +426,7 @@
datafive: null,
datasix: null,
dataseven: null,
dataeight: null,
}
},
onShow() {
@ -376,14 +444,23 @@
e.type == '5' ? this.datafive = e : ''
e.type == '6' ? this.datasix = e : ''
e.type == '7' ? this.dataseven = e : ''
e.type == '8' ? this.dataeight = e : ''
})
if (this.datatwo && this.datatwo.val) {
this.datatwo.szy = this.datatwo.val.split('/')[1]
this.datatwo.ssy = this.datatwo.val.split('/')[0]
}
if (this.dataeight && this.dataeight.val) {
this.dataeight.szy = this.dataeight.val.split('/')[1]
this.dataeight.ssy = this.dataeight.val.split('/')[0]
}
if (this.datathree && this.datathree.val) {
this.datathree.tc = this.datathree.val.split('/')[0]
this.datathree.tg = this.datathree.val.split('/')[1]
this.datathree.hdl = this.datathree.val.split('/')[2]
this.datathree.ldl = this.datathree.val.split('/')[3]
}
}
})
},
goaddequipment() {

View File

@ -32,6 +32,11 @@
<Temperature :current="tabindex" :echartData="list" @taptimeindex='taptimeindex' :tablelist='tablelist'
v-on:websocket-message="handleWebSocketMessage"></Temperature>
</view>
<view v-if="tabindex == 7">
<Dynamicbloodpressure :tablelist='tablelist' @tapdeviceUser='tapdeviceUser' :current="tabindex"
:echartData="list" @taptimeindex='taptimeindex' v-on:websocket-message="handleWebSocketMessage">
</Dynamicbloodpressure>
</view>
</view>
</view>
</template>
@ -48,6 +53,7 @@
import BMI from '../BMI/BMI.vue'
import BloodOxygen from '../BloodOxygen/BloodOxygen.vue'
import HeartRate from '../HeartRate/HeartRate.vue'
import Dynamicbloodpressure from '../Dynamicbloodpressure/Dynamicbloodpressure.vue'
export default {
components: {
BloodPressure,
@ -56,7 +62,8 @@
BloodFat,
BMI,
BloodOxygen,
HeartRate
HeartRate,
Dynamicbloodpressure
},
data() {
return {
@ -75,6 +82,8 @@
name: '心率',
}, {
name: '体温',
}, {
name: '动态血压',
}, ],
list: null,
type: 0,