<template>
	<view class="app">
		<view class="label">
			<view class="img">
				<image mode="" src="@/static/headsculpture.png"></image>
			</view>
			<view class="text">
				<view class="name">
					{{userInfo.patientName?userInfo.patientName:''}}
					<text v-if="userInfo.sex == 'MALE'">男</text>
					<text v-if="userInfo.sex == 'FEMALE'">女</text>
				</view>
				<view class="id">
					{{userInfo.cardNo?userInfo.cardNo:''}}
				</view>
			</view>
		</view>
		<view class="items">
			<view class="item" @tap='gomyinformation'>
				<image mode="" :src="require('../images/userinfo.png')"></image>
				<view class="text">
					个人信息
				</view>
			</view>
			<view class="item" @tap='gophysicalexamination'>
				<image mode="" :src="require('../images/report.png')"></image>
				<view class="text">
					体检报告
				</view>
			</view>
			<view class="item" @tap="gohypertension">
				<image mode="" :src="require('../images/hypertension.png')"></image>
				<view class="text">
					高血压随访
				</view>
			</view>
			<view class="item" @tap='godiabetes'>
				<image mode="" :src="require('../images/Diabetes.png')"></image>
				<view class="text">
					糖尿病随访
				</view>
			</view>
			<view class="item" @tap='goSubsequentVisit' v-if="address == '德州市'">
				<image mode="" :src="require('../images/jnFcPic.png')"></image>
				<view class="text">
					复诊记录
				</view>
			</view>
			<view class="item" style="opacity: 0;">
				<!-- <image src="../images/Diabetes.png" mode=""></image>
      	<view class="text">
      		复诊记录
      	</view> -->
			</view>
			<!-- <view class="item">
				<image src="../images/HeartDisease.png" mode=""></image>
				<view class="text">
					冠心病随访
				</view>
			</view>
			<view class="item">
				<image src="../images/apoplexy.png" mode=""></image>
				<view class="text">
					闹卒中随访
				</view>
			</view> -->
		</view>
	</view>
</template>

<script>
	import {
		getPhysicalTime,
		getVisitTime,
		getSubsequentVisitTime,
		getUserInfo
	} from "@/api/pagesC/Healthrecords/index.js"
	export default {
		data() {
			return {
				userInfo: uni.getStorageSync('userinfo'),
				address: uni.getStorageSync('location')
			};
		},
		methods: {
			// 复诊记录
			goSubsequentVisit() {
				getSubsequentVisitTime(this.userInfo.cardNo).then(res => {
					if (!res.data || res.data.length == 0) {
						uni.showModal({
							title: '提示',
							content: '暂无相关数据',
							showCancel: false,
						})
					} else {
						uni.navigateTo({
							url: "/pagesC/subsequentVisitRecord/subsequentVisitRecord"
						})
					}
				})

			},
			gophysicalexamination() {
				getPhysicalTime(this.userInfo.cardNo).then(res => {
					if (!res.data || res.data.length == 0) {
						uni.showModal({
							title: '提示',
							content: '暂无相关数据',
							showCancel: false,
						})
					} else {
						uni.navigateTo({
							url: "/pagesC/archivesphysicalexamination/physicalexamination"
						})
					}
				})
			},
			gomyinformation() {
				getUserInfo(this.userInfo.cardNo).then(res => {
					if (!res.data || res.data.length == 0) {
						uni.showModal({
							title: '提示',
							content: '暂无相关数据',
							showCancel: false,
						})
					} else {
						uni.navigateTo({
							url: "/pagesC/myinformation/myinformation"
						})
					}
				})
			},
			godiabetes() {
				getVisitTime('29', this.userInfo.cardNo).then(res => {
					if (!res.data || res.data.length == 0) {
						uni.showModal({
							title: '提示',
							content: '暂无相关数据',
							showCancel: false,
						})
					} else {
						uni.navigateTo({
							url: "/pagesC/diabetes/diabetes"
						})
					}
				})
			},
			gohypertension() {
				getVisitTime('28', this.userInfo.cardNo).then(res => {
					if (!res.data || res.data.length == 0) {
						uni.showModal({
							title: '提示',
							content: '暂无相关数据',
							showCancel: false,
						})
					} else {
						uni.navigateTo({
							url: "/pagesC/hypertension/hypertension"
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.app {
		background-color: #f9f9f9;

		.items {
			width: 93%;
			margin: 0 auto;
			display: flex;
			justify-content: space-around;
			flex-wrap: wrap;
			text-align: center;

			.item {
				background-color: #fff;
				width: 46%;
				padding-top: 40rpx;
				height: 250rpx;
				margin-bottom: 30rpx;
				background-color: #ffffff;
				box-shadow: 0rpx 2rpx 13rpx 1rpx rgba(159, 159, 159, 0.26);
				border-radius: 10rpx;
				padding-bottom: 30rpx;

				.text {
					font-size: 36rpx;
					line-height: 43rpx;
					color: #333333;
					line-height: 100rpx;
				}

				image {
					width: 102rpx;
					height: 113rpx;
				}
			}
		}

		.label {
			background: url(../images/zu112x.png) no-repeat;
			width: 93%;
			margin: 31rpx auto 49rpx;
			border-radius: 20rpx;
			position: relative;
			height: 250rpx;

			.text {
				position: absolute;
				top: 60rpx;
				left: 230rpx;

				.name {
					font-size: 42rpx;
					line-height: 40rpx;
					color: #ffffff;

					text {
						font-size: 28rpx;
						line-height: 40rpx;
						color: #ffffff;
						padding-left: 20rpx;
					}
				}

				.id {
					font-size: 32rpx;
					line-height: 40rpx;
					letter-spacing: 2rpx;
					color: #ffffff;
					opacity: 0.85;
					padding-top: 40rpx;
				}
			}

			.img {
				width: 160rpx;
				height: 160rpx;
				padding-left: 30rpx;
				padding-top: 50rpx;

				image {
					width: 160rpx;
					border-radius: 50%;
					height: 160rpx;
				}
			}
		}
	}
</style>