123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694 |
- <template>
- <view class="mb-5" ref="ccc">
- <view class="position-relative bghead" style="margin-top: -80rpx;">
- <image src="@/static/img/other/tou.png" mode="widthFix" class="w-100"></image>
- </view>
- <view class="p-3">
- <view class="centerY mb-3 w-100 font-bold">
- <view class="bule_line" style="height: 26rpx;"></view>
- <text class="font-bold text-dark ml-2 fs-16 line-height1">身体健康数据</text>
- </view>
- <view class="bg-white" style="border-radius: 16rpx;overflow: hidden;">
- <view class="px-2 py-1 centerY" style="background: linear-gradient(180deg, #F6FFFF 0%, #EAFEFF 100%);">
- <view class="w-15">
- <view class="picbox">
- <image class="picimg" src="@/static/img/other/xy.png" mode="aspectFit"></image>
- </view>
- </view>
- <view class=" ml-2">
- <view class="fs-14 font-bold line-height1" style="color: #35B79C;">血压</view>
- <view class="fs-10">
- <text class="text-gry">测量时间</text>
- </view>
- </view>
- <view class="ml-auto fs-14">
- <view class="font-bold text-right line-height1" style="color: #868687;">
- <span v-if="dataArray.gxyList&&dataArray.gxyList[0]">{{dataArray.gxyList&&dataArray.gxyList[0].rbp||'未测量'}}/{{dataArray.gxyList&&dataArray.gxyList[0].sbp||'未测量'}} mmHg</span>
- <span v-else>未测量</span>
- </view>
- <view class="fs-12 centerY" style="color: #868687 ;">
- <text class="iconfont Clock"></text>
- <view class="ml-1">
- <span v-if="dataArray.gxyList&&dataArray.gxyList[0]">{{dataArray.gxyList&&dataArray.gxyList[0].uploadTime}}</span>
- <span v-else>暂无</span>
- </view>
- </view>
- </view>
- <view class="iconfont Chevron-Right fs-24" style="color: #35B79C;"></view>
- </view>
- <view class="px-3 py-2" v-if="dataArray.gxyList&&dataArray.gxyList.length">
- <view class="fs-14 text-gry mb-1">
- 近7次测量记录
- </view>
- <view class="">
- <view id="echarts1" class="echarts"></view>
- </view>
- <view class="mt-3 p-2 mb-2"
- style="box-shadow: 0px 2px 13px 2px rgba(211,212,214,0.45);border-radius: 8px;">
- <view class="centerY">
- <image class="w-10" src="@/static/img/other/xy2.png" mode="widthFix"></image>
- <view class="fs-14 font-bold ml-2 space-nowrap">
- 血压标准
- </view>
- <view class=" ml-2 fs-12" style="color: #868687;">
- <view class="">
- 收缩压:90~139 mmHg
- </view>
- <view class="">
- 舒张压:60~90 mmHg
- </view>
- </view>
- </view>
- <view class="centerY mt-2">
- <image class="w-10" src="@/static/img/other/zjjy.png" mode="widthFix"></image>
- <view class="fs-14 font-bold ml-2 space-nowrap">
- 专家建议
- </view>
- <view class=" ml-2 fs-12" style="color: #868687;">
- 正常
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="bg-white mt-2" style="border-radius: 16rpx;overflow: hidden;">
- <view class="px-2 py-1 centerY" style="background: linear-gradient(180deg, #ebf6ff 0%, #D4EBFF 100%);">
- <view class="w-15 ">
- <view class="picbox">
- <image class="picimg" src="@/static/img/other/xuet.png" mode="aspectFit"></image>
- </view>
- </view>
- <view class=" ml-2">
- <view class="fs-14 font-bold line-height1" style="color: #369FE5;">血糖</view>
- <view class="fs-10">
- <text class="text-gry">测量时间</text>
- </view>
- </view>
- <view class="ml-auto fs-14">
- <view class="font-bold text-right line-height1" style="color: #868687;">
- <span v-if="dataArray.gxyList&&dataArray.tnbList[0]">{{dataArray.tnbList&&dataArray.tnbList[0].glu||'未测量'}} mmol/L</span>
- <span v-else>未测量</span>
- </view>
- <view class=" centerY" style="color: #868687 ;">
- <text class="iconfont Clock"></text>
- <view class="fs-12 ml-1">
- <span v-if="dataArray.tnbList&&dataArray.tnbList[0]">{{dataArray.tnbList&&dataArray.tnbList[0].uploadTime}}</span>
- <span v-else>暂无</span>
- </view>
- </view>
- </view>
- <view class="iconfont Chevron-Right fs-24" style="color: #369FE5;"></view>
- </view>
- <view class="px-3 py-2" v-if="dataArray.tnbList&&dataArray.tnbList.length">
- <view class="fs-14 text-gry mb-1">
- 近7次测量记录
- </view>
- <view class="">
- <view id="echarts2" class="echarts"></view>
- </view>
- <view class="mt-3 p-2 mb-2"
- style="box-shadow: 0px 2px 13px 2px rgba(211,212,214,0.45);border-radius: 8px;">
- <view class="centerY">
- <image class="w-10" src="@/static/img/other/xtfw.png" mode="widthFix"></image>
- <view class="fs-14 font-bold ml-2 space-nowrap">
- 血糖标准
- </view>
- <view class=" ml-2 fs-12" style="color: #868687;">
- <view class="">
- 3.9~6.9 mmol/L
- </view>
- </view>
- </view>
- <view class="centerY mt-2">
- <image class="w-10" src="@/static/img/other/zjjy.png" mode="widthFix"></image>
- <view class="fs-14 font-bold ml-2 space-nowrap">
- 专家建议
- </view>
- <view class=" ml-2 fs-12" style="color: #868687;">
- 正常
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="bg-white mt-2" style="border-radius: 16rpx;overflow: hidden;">
- <view class="px-2 py-1 centerY" style="background: linear-gradient(180deg, #F6FFFF 0%, #EAFEFF 100%);">
- <view class="w-15 ">
- <view class="picbox">
- <image class="picimg" src="@/static/img/other/xinl.png" mode="aspectFit"></image>
- </view>
- </view>
- <view class=" ml-2">
- <view class="fs-14 font-bold line-height1" style="color: #35B79C">心率</view>
- <view class="fs-10">
- <text class="text-gry">测量时间</text>
- </view>
- </view>
- <view class="ml-auto fs-14">
- <view class="font-bold text-right line-height1" style="color: #868687;">
- <span v-if="dataArray.gxyList&&dataArray.gxyList[0]">{{dataArray.gxyList&&dataArray.gxyList[0].pulse||'未测量'}} 次/分钟</span>
- <span v-else>未测量</span>
- </view>
- <view class="fs-10 centerY" style="color: #868687 ;">
- <text class="iconfont Clock"></text>
- <view class="ml-1">
- <span v-if="dataArray.gxyList&&dataArray.gxyList[0]">{{dataArray.gxyList&&dataArray.gxyList[0].uploadTime}}</span>
- <span v-else>暂无</span>
- </view>
- </view>
- </view>
- <view class="iconfont Chevron-Right fs-24" style="color: #35B79C "></view>
- </view>
- <view class="px-3 py-2" v-if="dataArray.gxyList&&dataArray.gxyList.length">
- <view class="fs-14 text-gry mb-1">
- 近7次测量记录
- </view>
- <view class="">
- <view id="echarts3" class="echarts"></view>
- </view>
- <view class="mt-3 p-2 mb-2"
- style="box-shadow: 0px 2px 13px 2px rgba(211,212,214,0.45);border-radius: 8px;">
- <view class="centerY">
- <image class="w-10" src="@/static/img/other/xlfw.png" mode="widthFix"></image>
- <view class="fs-14 font-bold ml-2 space-nowrap">
- 心率标准
- </view>
- <view class=" ml-2 fs-12" style="color: #868687;">
- 60~100 次/分钟
- </view>
- </view>
- <view class="centerY mt-2">
- <image class="w-10" src="@/static/img/other/zjjy.png" mode="widthFix"></image>
- <view class="fs-14 font-bold ml-2 space-nowrap">
- 专家建议
- </view>
- <view class=" ml-2 fs-12" style="color: #868687;">
- 正常
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- dataArray:{}
- };
- },
- onLoad() {
- this.find_home_data()
- },
- methods: {
- async find_home_data() {
- uni.showLoading({
- title: '加载中'
- });
- let idCard = uni.getStorageSync('idCard')
- let {
- data,
- code
- } = await this.$api.find_home_data({
- idCard
- })
- if (code == 0) {
- this.dataArray = data;
- if(data&&data.gxyList.length){
- this.getdom('echarts1',()=>{
- this.chartOption1(data.gxyList, 'echarts1')
- })
- this.getdom('echarts3',()=>{
- this.chartOption3(data.gxyList, 'echarts3')
- })
- }
- if(data&&data.tnbList.length){
- this.getdom('echarts2',()=>{
- this.chartOption2(data.tnbList, 'echarts3')
- })
- }
- uni.hideLoading();
- uni.stopPullDownRefresh()
- } else {
- uni.hideLoading();
- uni.stopPullDownRefresh()
- }
- console.log(this.dataArray)
- },
- getdom(dom,cb){
- let timer = setInterval(()=>{
- if(document.getElementById(dom)){
- clearInterval(timer)
- cb&&cb()
- }
- },300)
- }
- },
- onPullDownRefresh() {
- this.find_home_data()
- }
- }
- </script>
- <script module="echarts" lang="renderjs">
- import * as echarts from 'echarts';
- import { config } from '@/static/js/defult_value.js';
- export default {
- mounted() {
- console.log(echarts)
-
- // this.initChart('echarts1', this.option)
- // this.initChart('echarts2', this.option2)
- },
- methods: {
- initChart(dom, option) {
- let chart = echarts.init(document.getElementById(dom))
- chart.setOption(option)
- },
- // updateEcharts(newValue, oldValue, ownerInstance, instance) {
- // // 监听 service 层数据变更
- // myChart.setOption(newValue)
- // },
- onClick(event, ownerInstance) {
- // 调用 service 层的方法
- },
- check({
- type,
- value,
- age,
- sex
- }) {
- let msg = uni.getStorageSync('userData')
- let arr = config
- if (type == 'shrink' && age) {
- if (msg.age > 65) {
- if (value > arr['shrinktop'][1]) {
- return true
- }
- if (value < arr['shrinktop'][0]) {
- return true
- }
- } else {
- if (value > arr['shrinklow'][1]) {
- return true
- }
- if (value < arr['shrinklow'][0]) {
- return true
- }
- }
- }
- if (sex) {
- if (msg.sex == 1) {
- if (value > arr[type][0][1]) {
- return true
- }
- if (value < arr[type][0][0]) {
- return true
- }
- } else {
- if (value > arr[type][1][1]) {
- return true
- }
- if (value < arr[type][1][0]) {
- return true
- }
- }
- }
- if (value > arr[type][1]) {
- return true
- }
- if (value < arr[type][0]) {
- return true
- }
- return false
- },
- chartOption1(data, dom) {
- // console.log(data)
- let data1 = [],
- data2 = [],
- data3 = [],
- time = []
- data.map((item) => {
- time.push(this.$mf.timeTrans({
- time: item.uploadTime,
- format: 'M.D'
- }))
- data1.push(item.sbp)
- data2.push(item.rbp)
- data3.push(item.pulse)
- })
- let arr = []
- data.map((item, index) => {
- if (this.check({
- type: 'shrink',
- value: data1[index],
- age: true
- })) {
- arr.push({
- name: '收缩压',
- value: [item.uploadTime, data1[index]],
- symbolSize: 8,
- })
- }
- if (this.check({
- type: 'diastole',
- value: data2[index]
- })) {
- arr.push({
- name: '舒张压',
- value: [item.uploadTime, data2[index]],
- symbolSize: 8,
- })
- }
- })
- // console.log(arr)
- var option = (option = {
- legend: {
- data: ['收缩压', '舒张压', '心率'],
- },
- tooltip: {
- formatter: function(params) {
- console.log(params)
- let str =
- '<view style="padding:0px;width:140px"><view>' +
- params[0].name +
- '</view><view class="centerY" style="margin-top:6px"><view style="background:#5470c6;width:10px;height:10px;border-radius: 50%;" ></view><view class="" style="margin-left:4px">' +
- params[0].seriesName +
- '</view> <view class="ml-auto font-bold">' +
- params[0].value +
- '</view></view> <view class="centerY" style="margin-top:6px"><view style="background:#91cc75;width:10px;height:10px;border-radius: 50%;" ></view><view class="" style="margin-left:4px">' +
- params[1].seriesName +
- '</view><view class="ml-auto font-bold">' +
- params[1].value +
- '</view></view><view class="centerY" style="margin-top:6px"><view style="background:#fac858;width:10px;height:10px;border-radius: 50%;" ></view><view class="" style="margin-left:4px">' +
- params[2].seriesName +
- '</view><view class="ml-auto font-bold">' +
- params[2].value +
- '</view></view></view>'
- return str
- },
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: '#6a7985',
- },
- },
- },
- grid: {
- top: '20%',
- left: '3%',
- right: '5%',
- bottom: '3%',
- containLabel: true,
- },
- xAxis: [{
- type: 'category',
- axisPointer: {
- type: 'shadow',
- },
- data: time.reverse(),
- }, ],
- yAxis: [{
- type: 'value',
- }, ],
- series: [{
- name: '收缩压',
- label: {
- show: true,
- formatter: '{@score}',
- position: 'top'
- },
- smooth: true,
- type: 'line',
- data: data1.reverse(),
- },
- {
- name: '舒张压',
- label: {
- show: true,
- formatter: '{@score}',
- position: 'bottom',
- },
- smooth: true,
- type: 'line',
- data: data2.reverse(),
- },
- {
- type: 'effectScatter',
- coordinateSystem: 'cartesian2d',
- data: arr,
- showEffectOn: 'render',
- // zlevel:1,
- rippleEffect: {
- // 波纹的绘制方式,可选'stroke'和'fill'
- brushType: 'fill',
- },
- itemStyle: {
- color: '#F2597F'
- },
- hoverAnimation: false,
- },
- ],
- })
- if (document.getElementById(dom)) {
- this.initChart(dom, option)
- }
- },
- chartOption2(data) {
- // console.log(data)
- let data1 = [],
- time = []
- data.map((item) => {
- time.push(this.$mf.timeTrans({
- time: item.uploadTime,
- format: 'M.D'
- }))
- data1.push(item.glu)
- })
- let arr = []
- data.map((item, index) => {
- if (this.check({
- type: 'bloodGlucose',
- value: data1[index],
- age: true
- })) {
- arr.push({
- name: '血糖',
- value: [item.uploadTime, data1[index]],
- symbolSize: 8,
- })
- }
- })
- var option = (option = {
- legend: {
- data: ['血糖'],
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: '#6a7985',
- },
- },
- },
- grid: {
- top: '20%',
- left: '3%',
- right: '5%',
- bottom: '3%',
- containLabel: true,
- },
- xAxis: [{
- type: 'category',
- axisPointer: {
- type: 'shadow',
- },
- data: time.reverse(),
- }, ],
- yAxis: [{
- type: 'value',
- }, ],
- series: [{
- name: '血糖',
- label: {
- show: true,
- formatter: '{@score}',
- position: 'top'
- },
- smooth: true,
- type: 'line',
- data: data1.reverse(),
- itemStyle: {
- color: '#369FE5'
- },
- },
- {
- type: 'effectScatter',
- coordinateSystem: 'cartesian2d',
- data: arr,
- showEffectOn: 'render',
- // zlevel:1,
- rippleEffect: {
- // 波纹的绘制方式,可选'stroke'和'fill'
- brushType: 'fill',
- },
- itemStyle: {
- color: '#F2597F'
- },
- hoverAnimation: false,
- },
- ],
- })
- this.$nextTick(() => {
- if (document.getElementById('echarts2')) {
- this.initChart('echarts2', option)
- }
- })
- },
- chartOption3(data, dom) {
- // console.log(data)
- let data1 = [],
- data2 = [],
- data3 = [],
- time = []
- data.map((item) => {
- time.push(this.$mf.timeTrans({
- time: item.uploadTime,
- format: 'M.D'
- }))
- data3.push(item.pulse)
- })
- let arr = []
- data.map((item, index) => {
- if (this.check({
- type: 'pulse',
- value: data3[index]
- })) {
- arr.push({
- name: '心率',
- value: [item.uploadTime, data3[index]],
- symbolSize: 10,
- })
- }
- })
- // console.log(arr)
- var option = (option = {
- legend: {
- data: ['心率'],
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross',
- label: {
- backgroundColor: '#6a7985',
- },
- },
- },
- grid: {
- top: '20%',
- left: '3%',
- right: '5%',
- bottom: '3%',
- containLabel: true,
- },
- xAxis: [{
- type: 'category',
- axisPointer: {
- type: 'shadow',
- },
- data: time.reverse(),
- }, ],
- yAxis: [{
- type: 'value',
- }, ],
- series: [{
- name: '心率',
- label: {
- show: true,
- formatter: '{@score}',
- position: 'top',
- },
- itemStyle: {
- color: '#35B79C'
- },
- smooth: true,
- type: 'line',
- data: data3.reverse(),
- areaStyle: {
- color: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- global: false,
- colorStops: [{
- offset: 0,
- color: 'rgba(53,183,156,.7)'
- },
- {
- offset: 0.5,
- color: 'rgba(53,183,156,0.3)'
- },
- {
- offset: 1,
- color: 'rgba(53,183,156,0)'
- }
- ]
- }
- },
- },
- {
- type: 'effectScatter',
- coordinateSystem: 'cartesian2d',
- data: arr,
- showEffectOn: 'render',
- // zlevel:1,
- rippleEffect: {
- // 波纹的绘制方式,可选'stroke'和'fill'
- brushType: 'fill',
- },
- itemStyle: {
- color: '#F2597F'
- },
- hoverAnimation: false,
- },
- ],
- })
- if (document.getElementById(dom)) {
- this.initChart(dom, option)
- }
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- background: #F5F9FF;
- }
- .echarts {
- width: 100%;
- height: 400rpx;
- }
- </style>
|