healthfiles.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <view class="hb column hidden container">
  3. <image class="bg" src="https://user.test.ylrztop.com/images/jkda_top_bg.png" mode="widthFix"></image>
  4. <view :style="{height: statusBarHeight,background: bgColor }"></view>
  5. <u-navbar
  6. title="健康档案" titleStyle="font-weight: bold;"
  7. @rightClick="rightClick"
  8. :autoBack="true"
  9. :bg-color="bgColor"
  10. >
  11. </u-navbar>
  12. <scroll-view class="content" :scroll-y="true">
  13. <view class="justify-between align-center bg-white radius12 p28">
  14. <view class="justify-start align-center">
  15. <image :src="info.avatar||maleurl" class="w140 h140"></image>
  16. <view class="ml30">
  17. <view class="bold fs32 mb12">{{info.username||'-'}}</view>
  18. <view class="justify-start align-center fs24">
  19. <text class="orangebox">{{info.sex==0?'男':'女'}}</text>
  20. <text class="orangebox ml12">{{info.age||'-'}}岁</text>
  21. </view>
  22. </view>
  23. </view>
  24. <u-icon name="arrow-right" @click="goToUser"></u-icon>
  25. </view>
  26. <view class="fs36 bold mt20">健康数据</view>
  27. <view class="health-monitoring">
  28. <view class="health-monitoring-item"
  29. @click="handleMonitoring(0)">
  30. <view class="health-monitoring-title">
  31. <view>
  32. <view class="health-monitoring-maintitle bold">{{BMI.toFixed(2)}}</view>
  33. <view :class="bmiCategory=='肥胖'?'text-color':''">{{bmiCategory}}</view>
  34. </view>
  35. <image src="/static/images/health/BMI_icon.png" mode="aspectFill"></image>
  36. </view>
  37. <view class="health-bmi mt50">
  38. <view class="justify-between align-center mb12">
  39. <view class="justify-start align-center ">
  40. <text class="color-text2 fs24 mr20">身高</text>
  41. <view class="fs24">{{form.height?form.height+'cm':'--'}}</view>
  42. </view>
  43. <image src="/static/images/health/services_edit_icon.png" class="w32 h32"></image>
  44. </view>
  45. <view class="justify-between align-center">
  46. <view class="justify-start align-center ">
  47. <text class="color-text2 fs24 mr20">体重</text>
  48. <view class="fs24">{{form.weight?form.weight+'kg':'--'}}</view>
  49. </view>
  50. <image src="/static/images/health/services_edit_icon.png" class="w32 h32"></image>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="health-monitoring-item" v-for="(item,index) in infoList" :key="index"
  55. @click="handleMonitoring(item,index+1)">
  56. <view class="health-monitoring-title">
  57. <view>
  58. <view class="health-monitoring-maintitle bold">{{item.title}}</view>
  59. <view>{{item.type==0?'正常':item.type==1?'偏小':'偏大'}}</view>
  60. </view>
  61. <image :src="img[index]" mode="aspectFill"></image>
  62. </view>
  63. <view>
  64. <view class="health-monitoring-res resnum">{{item.value.value1 || '--'}}</view>
  65. <view class="health-monitoring-time">{{item.value.measurementDate}} {{item.value.measurementTime}}</view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="fs36 bold mtb20">健康史</view>
  70. <view class="cardbox">
  71. <view class="health-item" @click="handleEditHealth()">
  72. <image class="health-bgicon" src="https://user.test.ylrztop.com/images/jbs_icon.png"></image>
  73. <view class="health-item-info">
  74. <view class="cardbox-maintitle" style="margin-bottom: 0;">疾病史</view>
  75. <view class="text-overflow" style="margin-top: 20rpx;">{{form.otherMedicalHistory || "尚未记录"}}</view>
  76. </view>
  77. </view>
  78. <view class="health-item" @click="handleEditHealth()">
  79. <image class="health-bgicon" src="https://user.test.ylrztop.com/images/zzs_icon.png"></image>
  80. <view class="health-item-info">
  81. <view class="cardbox-maintitle" style="margin-bottom: 0;">症状史</view>
  82. <view class="text-overflow" style="margin-top: 20rpx;">{{form.symptomHistory || "尚未记录"}}</view>
  83. </view>
  84. </view>
  85. </view>
  86. <view class="h80"></view>
  87. </scroll-view>
  88. </view>
  89. </template>
  90. <script>
  91. import {getUserInfo} from '@/api/user.js'
  92. import {getInfo,getDoc,homeInfo} from '@/api/healthUser.js'
  93. import carKeyboard from '../uni_modules/uview-ui/libs/config/props/carKeyboard';
  94. export default {
  95. data() {
  96. return {
  97. statusBarHeight:'',
  98. top:0,
  99. null:0,
  100. famaleurl:"/static/images/health/female_profile.png",
  101. maleurl:"/static/images/health/my_heads.png",
  102. img:[
  103. "/static/images/health/waist_circumference_icon.png",
  104. "/static/images/health/hip_circumference_icon.png",
  105. "/static/images/health/blood_sugar_icon.png",
  106. "/static/images/health/blood_pressure_icon.png",
  107. "/static/images/health/uric_acid_icon.png"
  108. ],
  109. indexInfo: [
  110. // {
  111. // data: "",
  112. // date: "",
  113. // height:'',
  114. // weight:'',
  115. // type: {
  116. // type: "BMI 24.8",
  117. // title: "肥胖",
  118. // icon:"/static/images/health/BMI_icon.png"
  119. // }
  120. // },
  121. {
  122. data: "",
  123. date: "",
  124. type: {
  125. type: "腰围",
  126. title: "腰围",
  127. icon:"/static/images/health/waist_circumference_icon.png"
  128. }
  129. },{
  130. data: "",
  131. date: "",
  132. type: {
  133. type: "臀围",
  134. title: "臀围",
  135. icon:"/static/images/health/hip_circumference_icon.png"
  136. }
  137. },
  138. {
  139. data: "",
  140. date: "",
  141. type: {
  142. type: "血糖",
  143. title: "血糖健康监测",
  144. icon: "/static/images/health/blood_sugar_icon.png"
  145. }
  146. },
  147. {
  148. data: "",
  149. date: "",
  150. type: {
  151. type: "血压",
  152. title: "血压健康监测",
  153. icon:"/static/images/health/blood_pressure_icon.png"
  154. }
  155. },
  156. {
  157. data: "",
  158. date: "",
  159. type: {
  160. type: "尿酸",
  161. title: "尿酸健康监测",
  162. icon:"/static/images/health/uric_acid_icon.png"
  163. }
  164. },
  165. ],
  166. healthRecordsList: [
  167. {
  168. title: '疾病史',
  169. type: "healthHistory",
  170. desc: '',
  171. bgicon: "https://user.test.ylrztop.com/images/jbs_icon.png",
  172. }, {
  173. title: '症状史',
  174. type: "symptomHistory",
  175. desc: '',
  176. bgicon: "https://user.test.ylrztop.com/images/zzs_icon.png",
  177. }
  178. ],
  179. user:null,
  180. info:{},
  181. infoList:[],
  182. form:null,
  183. dataMap:{},
  184. BMI:null
  185. }
  186. },
  187. computed: {
  188. // 计算属性的 getter
  189. bgColor: function() {
  190. var top=this.top/30;
  191. return 'rgba(11,179,242, ' + top + ')';
  192. },
  193. // // 计算BMI值
  194. // bmiValue() {
  195. // // if (!this.isValidInput) return 0;
  196. // if(this.form!==null) return '--';
  197. // // 获取体重和身高,确保为数字类型
  198. // // const weight = this.form.weight||0;
  199. // // const height = this.form.height||0;
  200. // if(this.form.weight>0 && this.form.height>0) {
  201. // const bmi = this.form.weight / (this.form.height * this.form.height);
  202. // console.log(bmi,this.form.height,'---')
  203. // return bmi.toFixed(2); // 保留两位小数
  204. // }else{
  205. // return '--'
  206. // }
  207. // },
  208. // 判断BMI对应的体重类别
  209. bmiCategory() {
  210. const bmi = parseFloat(this.bmiValue);
  211. if (bmi < 18.5) return '偏轻';
  212. if (bmi < 24) return '正常';
  213. if (bmi < 28) return '超重';
  214. return '肥胖';
  215. }
  216. },
  217. onLoad() {
  218. // 获取系统信息
  219. const sys = uni.getSystemInfoSync()
  220. this.statusBarHeight = sys.statusBarHeight+'px'
  221. // uni.navigateTo({
  222. // url: '/pages_health/doc?type=edit&docId='
  223. // })
  224. this.getUserInfo()
  225. uni.$on('refreshHealthFiles', () => {
  226. this.getDoc()
  227. this.getUserInfo()
  228. // this.homeInfo()
  229. })
  230. // this.getInfo()
  231. },
  232. onUnload() { //普通页面在 onUnload 生命周期中执行
  233. uni.$emit('stop')
  234. },
  235. onHide() { //tabBar页面在onHide生命周期中执行
  236. uni.$emit('stop')
  237. },
  238. onPageScroll(e) {
  239. //console.log(e)
  240. this.top=e.scrollTop;
  241. },
  242. methods: {
  243. getUserInfo(){
  244. getUserInfo().then(
  245. res => {
  246. if(res.code==200){
  247. if(res.user!=null){
  248. this.user=res.user;
  249. this.getInfo(this.user.userId)
  250. this.homeInfo(this.user.userId)
  251. }
  252. else{
  253. this.utils.loginOut();
  254. }
  255. }else{
  256. uni.showToast({
  257. icon:'none',
  258. title: "请求失败",
  259. });
  260. }
  261. },
  262. rej => {}
  263. );
  264. },
  265. getInfo(id) {
  266. var that=this
  267. var data = {
  268. userId: id
  269. };
  270. getInfo(data).then(
  271. res => {
  272. if (res.code == 200) {
  273. var data=res.data
  274. if(res.data.birthdate==null){
  275. uni.showToast({
  276. icon: 'none',
  277. title: "请先完善用户信息",
  278. });
  279. setTimeout(function() {
  280. uni.navigateTo({
  281. url: '/pages_health/addUser?type=edit&userId='+id
  282. })
  283. }, 500);
  284. }else{
  285. this.getDoc(id,data)
  286. }
  287. } else {
  288. uni.showToast({
  289. title: res.msg,
  290. });
  291. }
  292. },
  293. rej => {}
  294. );
  295. },
  296. getDoc(id,form) {
  297. var data = {
  298. userId: id
  299. };
  300. this.BMI=0
  301. getDoc(data).then(
  302. res => {
  303. if (res.code == 200) {
  304. this.form=res.data
  305. this.$set(this,'form',res.data)
  306. this.BMI=res.data.weight / (res.data.height * res.data.height)
  307. if(form.birthdate!==null&&res.data==null){
  308. uni.navigateTo({
  309. url: '/pages_health/addDoc?userId='+id
  310. })
  311. }
  312. }else {
  313. uni.showToast({
  314. title: res.msg,
  315. });
  316. }
  317. },
  318. rej => {}
  319. );
  320. },
  321. homeInfo(id) {
  322. var data = {
  323. userId:id
  324. };
  325. homeInfo(data).then(
  326. res => {
  327. if (res.code == 200) {
  328. this.info=res.data
  329. const valueList = Object.values(res.data.dataMap);
  330. const list = valueList.filter(item=>item!==null)
  331. this.infoList=list.map((item,index)=>({
  332. title:index==0?'腰围':index==1?'臀围':index==2?'血糖':index==3?'血压':'尿酸',
  333. type: item.level,
  334. value:item
  335. }));
  336. console.log(this.infoList,'--')
  337. }else {
  338. uni.showToast({
  339. title: res.msg,
  340. });
  341. }
  342. },
  343. rej => {}
  344. );
  345. },
  346. handleMonitoring(item,index){
  347. console.log(index,'index')
  348. switch (index) {
  349. case 1:
  350. uni.navigateTo({
  351. url: '/pages_echarts/waistLine?userId='+this.user.userId
  352. })
  353. break;
  354. case 2:
  355. uni.navigateTo({
  356. url: '/pages_echarts/hips?userId='+this.user.userId
  357. })
  358. break;
  359. case 3:
  360. uni.navigateTo({
  361. url: '/pages_echarts/bloodSugar?userId='+this.user.userId
  362. })
  363. break;
  364. case 4:
  365. uni.navigateTo({
  366. url: '/pages_echarts/bloodPressure?userId='+this.user.userId
  367. })
  368. break;
  369. case 5:
  370. uni.navigateTo({
  371. url: '/pages_echarts/acid?userId='+this.user.userId
  372. })
  373. break;
  374. default:
  375. uni.navigateTo({
  376. url: '/pages_health/addDoc?type=add&userId='+this.user.userId
  377. })
  378. break;
  379. }
  380. },
  381. handleEditHealth(item,index){
  382. uni.navigateTo({
  383. url: '/pages_health/addDoc?type=add&userId='+this.user.userId
  384. })
  385. },
  386. goToUser(){
  387. console.log(this.info,'---')
  388. if(this.info!==null){
  389. uni.navigateTo({
  390. url: '/pages_health/addUser?type=edit&userId='+this.user.userId
  391. })
  392. }
  393. }
  394. }
  395. }
  396. </script>
  397. <style lang="scss" scoped>
  398. .container{
  399. position: relative;
  400. background: #EFF3F7;
  401. .bg{
  402. width: 100%;
  403. height: 380rpx;
  404. position: absolute;
  405. top: 0;
  406. left: 0;
  407. z-index:0;
  408. }
  409. }
  410. .text-color{
  411. color:#FF4B33;
  412. width: 72rpx;
  413. height: 40rpx;
  414. text-align: center;
  415. line-height: 40rpx;
  416. border-radius: 8rpx 8rpx 8rpx 8rpx;
  417. border: 1rpx solid #FFA599;
  418. }
  419. .content{
  420. padding-top: calc(var(--status-bar-height) + 140rpx) !important;
  421. height: 100vh;
  422. box-sizing: border-box;
  423. width: 100%;
  424. padding: 20rpx;
  425. }
  426. .orangebox{
  427. border-radius: 24rpx;
  428. border: 1rpx solid #FFA599;
  429. color: #FF4B33;
  430. font-size: 24rpx;
  431. padding: 4rpx 20rpx;
  432. }
  433. .health-monitoring {
  434. // @include u-flex(row, center, flex-start);
  435. display: flex;
  436. justify-content: space-between;
  437. flex-wrap: wrap;
  438. // gap: 16rpx;
  439. margin-top: 20rpx;
  440. margin-bottom: -16rpx;
  441. margin-right: -16rpx;
  442. &-item {
  443. width: 343rpx;
  444. min-height: 264rpx;
  445. margin: 0 16rpx 16rpx 0;
  446. overflow: hidden;
  447. background: #FFFFFF;
  448. border-radius: 16rpx 16rpx 16rpx 16rpx;
  449. padding: 24rpx 34rpx 24rpx 24rpx;
  450. box-sizing: border-box;
  451. }
  452. &-maintitle {
  453. margin-bottom: 4rpx;
  454. font-size: 30rpx;
  455. color: #333333;
  456. }
  457. &-title {
  458. // @include u-flex(row, center, space-between);
  459. display: flex;
  460. justify-content: space-between;
  461. font-weight: 400;
  462. font-size: 24rpx;
  463. color: #999999;
  464. image {
  465. width: 72rpx;
  466. height: 72rpx;
  467. flex-shrink: 0;
  468. }
  469. }
  470. .resnum {
  471. font-family: DIN, DIN;
  472. font-weight: 500;
  473. font-size: 64rpx;
  474. }
  475. &-res {
  476. height: 78rpx;
  477. margin: 20rpx 0 6rpx;
  478. font-family: PingFang SC, PingFang SC;
  479. font-weight: 600;
  480. font-size: 48rpx;
  481. color: #333333;
  482. }
  483. &-time {
  484. font-weight: 400;
  485. font-size: 22rpx;
  486. color: #999999;
  487. }
  488. }
  489. .cardbox {
  490. display: flex;
  491. flex-direction: row;
  492. align-items: center;
  493. justify-content: space-between;
  494. flex-wrap: wrap;
  495. gap: 16rpx 14rpx;
  496. &-maintitle {
  497. margin-bottom: 4rpx;
  498. font-weight: 600;
  499. font-size: 30rpx;
  500. color: #333333;
  501. }
  502. }
  503. .health-item {
  504. width: 343rpx;
  505. height: 224rpx;
  506. padding: 24rpx;
  507. box-sizing: border-box;
  508. background: #FFFFFF;
  509. border-radius: 16rpx 16rpx 16rpx 16rpx;
  510. overflow: hidden;
  511. position: relative;
  512. font-family: PingFang SC, PingFang SC;
  513. font-weight: 400;
  514. font-size: 24rpx;
  515. color: #999999;
  516. }
  517. .health-item-info {
  518. position: relative;
  519. }
  520. .health-bgicon {
  521. position: absolute;
  522. right: 0;
  523. bottom: 0;
  524. width: 168rpx;
  525. height: 168rpx;
  526. }
  527. </style>