bloodPressure.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <view class="container">
  3. <uni-nav-bar fixed :border="false" :backgroundColor="`rgba(255,255,255,${opacity})`" title="血压监测" :statusBar="true"
  4. left-icon="left" @clickLeft="back"></uni-nav-bar>
  5. <image class="page-bg" src="@/static/images/pages_watch/images/blood_pressure_top_bg.png" mode="widthFix"></image>
  6. <view class="container-body">
  7. <dateTimePicker @onChange="onChangeTime" />
  8. <!-- 血压趋势 -->
  9. <view class="box">
  10. <view class="box-title">
  11. <view class="box-title-left">血压趋势</view>
  12. </view>
  13. <view class="ytitle" v-show="!loading && !isEmpty">单位:mmhg</view>
  14. <view class="echartbox">
  15. <qiun-data-charts v-show="!isEmpty" type="area" :opts="opts" :chartData="chartData" tooltipFormat="bpTooltip" />
  16. <myEmpty v-show="isEmpty" style="padding: 40rpx 0 0 0;"></myEmpty>
  17. </view>
  18. <view class="legend" v-show="!loading && !isEmpty">
  19. <view class="legend-item">
  20. <view class="legend-dot" style="background-color: #FF7700;"></view><text>收缩压90-140mmHg</text>
  21. </view>
  22. <view class="legend-item">
  23. <view class="legend-dot" style="background-color: #0065F7;"></view><text>舒张压60-90mmHg</text>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 血压异常记录 -->
  28. <view class="box">
  29. <view class="box-title" style="height: 80rpx;">
  30. <view class="box-title-left">血压异常记录</view>
  31. <view class="box-title-right" @tap="handleMore">
  32. 查看更多<image src="@/static/images/pages_watch/icons/my_right_arrow_right_icon.png"></image>
  33. </view>
  34. </view>
  35. <view class="abnormal">
  36. <view class="abnormal-item colorbg1">
  37. <view class="abnormal-item-title">重度</view>
  38. <view class="abnormal-item-num">
  39. <text>{{status1}}次</text>
  40. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon1.png"></image>
  41. </view>
  42. </view>
  43. <view class="abnormal-item colorbg2">
  44. <view class="abnormal-item-title">中度</view>
  45. <view class="abnormal-item-num">
  46. <text>{{status2}}次</text>
  47. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon2.png"></image>
  48. </view>
  49. </view>
  50. <view class="abnormal-item colorbg3">
  51. <view class="abnormal-item-title">轻度</view>
  52. <view class="abnormal-item-num">
  53. <text>{{status3}}次</text>
  54. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon3.png"></image>
  55. </view>
  56. </view>
  57. <view class="abnormal-item colorbg4">
  58. <view class="abnormal-item-title">正常高值</view>
  59. <view class="abnormal-item-num">
  60. <text>{{status4}}次</text>
  61. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon4.png"></image>
  62. </view>
  63. </view>
  64. <view class="abnormal-item colorbg6">
  65. <view class="abnormal-item-title">偏低</view>
  66. <view class="abnormal-item-num">
  67. <text>{{status5}}次</text>
  68. <image src="@/static/images/pages_watch/icons/blood_pressure_record_state5_icon.png"></image>
  69. </view>
  70. </view>
  71. <view class="abnormal-item colorbg5">
  72. <view class="abnormal-item-title">正常</view>
  73. <view class="abnormal-item-num">
  74. <text>{{status6}}次</text>
  75. <image src="@/static/images/pages_watch/icons/zyss_arrow_icon5.png"></image>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script>
  84. import {
  85. bpInfo,
  86. bpAbnormaInfo
  87. } from "@/api/pages_watch/healthMonitoring.js";
  88. import myEmpty from "@/pages_watch/components/myEmpty/myEmpty.vue"
  89. import dateTimePicker from "@/pages_watch/components/dateTimePicker/dateTimePicker.vue"
  90. export default {
  91. components: {
  92. myEmpty,
  93. dateTimePicker
  94. },
  95. data() {
  96. return {
  97. opacity: 0,
  98. loading: false,
  99. isEmpty: false,
  100. //1:重度 2:中度 3:轻度 4:正常高值 5:偏低 6:正常
  101. status1: 0,
  102. status2: 0,
  103. status3: 0,
  104. status4: 0,
  105. status5: 0,
  106. status6: 0,
  107. queryParam: {
  108. startTime: "",
  109. endTime: "",
  110. deviceId: uni.getStorageSync("deviceId")
  111. },
  112. chartData: {},
  113. opts: {
  114. padding: [25, 10, 0, 0],
  115. enableScroll: false,
  116. dataLabel: false,
  117. dataPointShapeType: "hollow",
  118. legend: {
  119. show: false
  120. },
  121. xAxis: {
  122. disableGrid: true,
  123. fontSize: 12,
  124. axisLine: false,
  125. fontColor: '#ccc',
  126. labelCount: 7,
  127. format: "formatterTime",
  128. },
  129. yAxis: {
  130. gridType: "dash",
  131. dashLength: 2,
  132. data: [{
  133. fontColor: '#ccc',
  134. min: 0,
  135. axisLine: false,
  136. fontSize: 12,
  137. }]
  138. },
  139. extra: {
  140. tooltip: {
  141. gridType: "dash",
  142. showArrow: false,
  143. legendShow: true,
  144. legendShape: "circle"
  145. },
  146. area: {
  147. type: "straight",
  148. opacity: 0.2,
  149. addLine: true,
  150. width: 2,
  151. gradient: true,
  152. activeType: "solid"
  153. }
  154. }
  155. }
  156. }
  157. },
  158. methods: {
  159. back() {
  160. uni.navigateBack({
  161. delta: 1
  162. })
  163. },
  164. onChangeTime(time) {
  165. const param = {
  166. startTime: this.$timeFormat(time[0], 'yyyy/mm/dd hh:MM:ss'),
  167. endTime: this.$timeFormat(time[1], 'yyyy/mm/dd hh:MM:ss'),
  168. deviceId: uni.getStorageSync("deviceId") || ""
  169. }
  170. this.queryParam = param
  171. this.getServerData(param)
  172. this.getAbnormalInfo(param)
  173. },
  174. getServerData(param) {
  175. this.loading = true
  176. bpInfo(param).then((res) => {
  177. this.loading = false
  178. this.isEmpty = !(res.data && res.data.length>0)
  179. if (res.code == 200 && res.data) {
  180. let chartData = {
  181. categories: res.data.map(item => item.createTime),
  182. series: [{
  183. name: "收缩压",
  184. color: "#FF7700",
  185. data: res.data.map(item => item.sbp)
  186. }, {
  187. name: "舒张压",
  188. color: "#0065F7",
  189. data: res.data.map(item => item.dbp)
  190. }]
  191. }
  192. this.chartData = JSON.parse(JSON.stringify(chartData));
  193. }
  194. }).catch((err) => {
  195. this.loading = false
  196. });
  197. },
  198. // 获取异常数据
  199. getAbnormalInfo(param) {
  200. this.status1 = 0
  201. this.status2 = 0
  202. this.status3 = 0
  203. this.status4 = 0
  204. this.status5 = 0
  205. this.status6 = 0
  206. bpAbnormaInfo(param).then((res) => {
  207. if (res.code == 200 && res.data && res.data.length > 0) {
  208. res.data.forEach(item => {
  209. this.status1 += item.status == 1 ? item.count : 0
  210. this.status2 += item.status == 2 ? item.count : 0
  211. this.status3 += item.status == 3 ? item.count : 0
  212. this.status4 += item.status == 4 ? item.count : 0
  213. this.status5 += item.status == 5 ? item.count : 0
  214. this.status6 += item.status == 6 ? item.count : 0
  215. })
  216. }
  217. }).catch((err) => {});
  218. },
  219. // 查看等多数据
  220. handleMore() {
  221. uni.navigateTo({
  222. url: "/pages_watch/healthMonitoring/bloodPressureAbnormal?startTime="+this.queryParam.startTime+ "&endTime=" + this.queryParam.endTime
  223. })
  224. }
  225. },
  226. onPageScroll(e) {
  227. if (e.scrollTop <= 44) {
  228. this.opacity = e.scrollTop / 44 * 1
  229. } else if (e.scrollTop > 44) {
  230. this.opacity = 1
  231. }
  232. }
  233. }
  234. </script>
  235. <style lang="scss" scoped>
  236. @mixin u-flex($flexD, $alignI, $justifyC) {
  237. display: flex;
  238. flex-direction: $flexD;
  239. align-items: $alignI;
  240. justify-content: $justifyC;
  241. }
  242. .container {
  243. padding: 0 24rpx;
  244. position: relative;
  245. }
  246. .page-bg {
  247. width: 100%;
  248. height: auto;
  249. position: absolute;
  250. top: 0;
  251. left: 0;
  252. }
  253. .container-body {
  254. position: relative;
  255. z-index: 1;
  256. padding-bottom: 24rpx;
  257. }
  258. .box-title {
  259. font-family: PingFang SC, PingFang SC;
  260. font-weight: 400;
  261. font-size: 24rpx;
  262. color: #757575;
  263. @include u-flex(row, center, space-between);
  264. &-left {
  265. font-weight: 500;
  266. font-size: 36rpx;
  267. color: #222222;
  268. line-height: 42rpx;
  269. }
  270. &-right {
  271. @include u-flex(row, center, flex-start);
  272. image {
  273. height: 48rpx;
  274. width: 48rpx;
  275. }
  276. }
  277. }
  278. .box {
  279. padding: 24rpx;
  280. margin-bottom: 20rpx;
  281. box-sizing: border-box;
  282. background: #FFFFFF;
  283. border-radius: 16rpx 16rpx 16rpx 16rpx;
  284. }
  285. .ytitle {
  286. margin-top: 10rpx;
  287. line-height: 34rpx;
  288. margin-bottom: 24rpx;
  289. font-family: PingFang SC, PingFang SC;
  290. font-weight: 400;
  291. font-size: 24rpx;
  292. color: #999999;
  293. }
  294. .echartbox {
  295. height: 466rpx;
  296. width: 100%;
  297. }
  298. .legend {
  299. height: 34rpx;
  300. margin-top: 44rpx;
  301. @include u-flex(row, center, space-between);
  302. font-family: PingFang SC, PingFang SC;
  303. font-weight: 400;
  304. font-size: 24rpx;
  305. color: #757575;
  306. &-item {
  307. flex: 1;
  308. text-align: center;
  309. @include u-flex(row, center, center);
  310. }
  311. &-dot {
  312. width: 16rpx;
  313. height: 16rpx;
  314. border-radius: 50%;
  315. margin: 16rpx;
  316. }
  317. }
  318. .abnormal {
  319. font-family: PingFang SC, PingFang SC;
  320. font-weight: 400;
  321. font-size: 24rpx;
  322. color: #757575;
  323. @include u-flex(row, center, flex-start);
  324. flex-wrap: wrap;
  325. // gap: 18rpx;
  326. margin-top: 20rpx;
  327. margin-bottom: 2rpx;
  328. margin-right: -18rpx;
  329. &-item {
  330. width: 206rpx;
  331. height: 144rpx;
  332. padding: 0 24rpx;
  333. margin: 0 18rpx 18rpx 0;
  334. box-sizing: border-box;
  335. border-radius: 16rpx 16rpx 16rpx 16rpx;
  336. border: 2rpx solid #FCF4F4;
  337. @include u-flex(column, flex-start, center);
  338. &-title {
  339. font-weight: 500;
  340. font-size: 32rpx;
  341. color: #333333;
  342. margin-bottom: 12rpx;
  343. }
  344. image {
  345. width: 24rpx;
  346. height: 24rpx;
  347. }
  348. &-num {
  349. width: 100%;
  350. @include u-flex(row, center, space-between);
  351. }
  352. }
  353. .colorbg1 {
  354. background: #FFFCFC;
  355. border-color: #FCF4F4;
  356. }
  357. .colorbg2 {
  358. background: #FEFAF8;
  359. border-color: #FDF7F3;
  360. }
  361. .colorbg3 {
  362. background: #FAFBFF;
  363. border-color: #F2F7FE;
  364. }
  365. .colorbg4 {
  366. background: #FAFCFF;
  367. border-color: #F6FAFF;
  368. }
  369. .colorbg5 {
  370. background: #FAFFFC;
  371. border-color: #EBFFF3;
  372. }
  373. .colorbg6 {
  374. background: #FCFBFF;
  375. border-color: #FBF8FF;
  376. }
  377. }
  378. </style>