<template>
	<view class="app">
		<view class="" v-if="list&&list.length>0">
			<view class="list" v-for="aitem in list">
				<view class="item" v-for="item in aitem.records" @tap='goHistoryQuestionnaire(item)'>
					<view class="title">
						{{item.surveySubject==1001?'高血压评估问卷':item.surveySubject==1002?'糖尿病评估问卷':item.surveySubject==1003?
					'脑卒中评估问卷':item.surveySubject==1004?'慢阻肺评估问卷':item.surveySubject==1005?'慢病评估问卷':item.surveySubject==1006?'糖尿病肾病评估问卷':item.surveySubject==1007?
					'糖尿病眼病评估问卷':item.surveySubject==1008?'糖尿病足病评估问卷':''}}
					</view>
					<view class="time">
						{{item.date+' '}}{{item.time}}
					</view>
					<view class="text">
						{{item.evaluateResult}}
					</view>
				</view>
			</view>
		</view>
		<view v-else style="margin-top: 200rpx;">
			<u-empty mode="data" icon-size='220' text='暂无历史记录'></u-empty>
		</view>
	</view>
</template>

<script>
	import {
		timeline
	} from '@/api/questionnaire/index.js'
	export default {
		data() {
			return {
				list: null,
			};
		},
		onLoad() {
			this.info();
		},
		methods: {
			goHistoryQuestionnaire(item) {
				uni.navigateTo({
					url: `/questionnaire/HistoryQuestionnaire/HistoryQuestionnaire?item=${JSON.stringify(item)}`
				})
			},
			info() {
				timeline(uni.getStorageSync('patientId')).then(res => {
					this.list = res.data
				})
			},
		}
	}
</script>

<style lang="scss">
	.app {
		margin-top: 20rpx;

		.list {
			.item {
				margin: 20rpx auto;
				width: 96%;
				background-color: #fff;
				box-shadow: 0rpx 9rpx 31rpx 9rpx rgba(0, 0, 0, 0.03);
				border-radius: 5rpx;
				padding: 0 0 40rpx;
				position: relative;

				.time {
					position: absolute;
					right: 20rpx;
					top: 35rpx;
					transform: translateY(-50%);
					font-size: 24rpx;
					font-weight: 400;
					color: #646464;
				}

				.text {
					margin: 20rpx auto;
					width: 96%;
					font-size: 30rpx;
					font-weight: 400;
					color: #000000;
					line-height: 38rpx;
				}

				.title {
					margin: 0 auto;
					width: 96%;
					font-size: 25rpx;
					border-bottom: 2rpx solid #E6E6E6;
					font-weight: 400;
					color: #646464;
					line-height: 70rpx;
				}
			}
		}
	}
</style>