<template>
	<view class="app">
		<view class="lefttext">
			<scroll-view scroll-y style="white-space: nowrap;height: 100vh;">
				<view>
					随访日期
				</view>
				<view :class="currentValue == index ? 'showitem' : ''" v-for="(item, index) in timeList" :key="item.id"
					@click="currentInfo(index)" @tap="detail(item)">
					{{item.happentime}}
				</view>
			</scroll-view>
		</view>
		<view class="righttext">
			<scroll-view scroll-y style="white-space: nowrap;height: 100vh;">
				<view class="title">
					<view class="left">
					</view>
					<view class="right">
						基本信息
					</view>
				</view>
				<view class="information">
					<view class="p1">
						<view class="p1left">
							姓名：
						</view>
						<text>{{name}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							随访日期：
						</view>
						<text>{{pageInfo.followupTime ? pageInfo.followupTime.substring(0, 10) : ''}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							随访方式：
						</view>
						<text>{{followupWay[pageInfo.followupWay]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							下次随访时间：
						</view>
						<text v-if="pageInfo.followupNextTime">{{pageInfo.followupNextTime.substring(0,10)}}</text>
					</view>
				</view>
				<view class="title">
					<view class="left">
					</view>
					<view class="right">
						症状
					</view>
				</view>
				<view class="symptom">
					<text>{{symptom[pageInfo.symptom]}}</text>
					<text v-if="pageInfo.symptomOtherContent"> 其他：{{pageInfo.symptomOtherContent}}</text>
				</view>

				<view class="title">
					<view class="left">
					</view>
					<view class="right">
						体征
					</view>
				</view>

				<view class="information sign">
					<view class="p1">
						<view class="p1left">
							收缩压：
						</view>
						<text>{{pageInfo.systolic}}mmHg</text>
					</view>
					<view class="p1">
						<view class="p1left">
							舒张压：
						</view>
						<text>{{pageInfo.diastolic}}mmHg</text>
					</view>
					<view class="p1">
						<view class="p1left">
							体重：
						</view>
						<text>{{pageInfo.weight}}kg</text>
					</view>
					<view class="p1">
						<view class="p1left">
							目标体重：
						</view>
						<text>{{pageInfo.guideWeight}}kg</text>
					</view>
					<view class="p1">
						<view class="p1left">
							身高：
						</view>
						<text>{{pageInfo.height}}cm</text>
					</view>
					<view class="p1">
						<view class="p1left">
							体质指数：
						</view>
						<text>{{pageInfo.bmi}}Kg/㎡</text>
					</view>
					<view class="p1">
						<view class="p1left">
							目标体质指数：
						</view>
						<text>{{pageInfo.guideBmi}}Kg/㎡</text>
					</view>
					<view class="p1">
						<view class="p1left">
							心率：
						</view>
						<text>{{pageInfo.heartRate}}次/分钟</text>
					</view>
					<view class="p1">
						<view class="p1left">
							其他：
						</view>
						<text>{{pageInfo.signOtherContent}}</text>
					</view>
				</view>

				<view class="title">
					<view class="left">
					</view>
					<view class="right">
						生活方式指导
					</view>
				</view>

				<view class="information sign">
					<view class="p1">
						<view class="p1left">
							日吸烟量(支)：
						</view>
						<text v-if="pageInfo.smoking == '0'">-</text>
						<text v-else>{{pageInfo.smoking}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							目标日吸烟量(支)：
						</view>
						<text v-if="pageInfo.guideSmoking == '0'">-</text>
						<text v-else>{{pageInfo.guideSmoking}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							日饮酒量(两)：
						</view>
						<text v-if="pageInfo.drink == '0.0'">-</text>
						<text v-else>{{pageInfo.drink}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							目标日饮酒量(两)：
						</view>
						<text v-if="pageInfo.guideDrink == '0.0'">-</text>
						<text v-else>{{pageInfo.guideDrink}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							运动频率：
						</view>
						<text>{{pageInfo.exerciseFreq}}次/周, {{pageInfo.exerciseDuration}}分钟/次</text>
					</view>
					<view class="p1">
						<view class="p1left">
							目标运动：
						</view>
						<text>{{pageInfo.guideExerciseFreq}}次/周, {{pageInfo.guideExerciseDuration}}分钟/次</text>
					</view>
					<view class="p1">
						<view class="p1left">
							摄盐情况：
						</view>
						<text>{{saltSituation[pageInfo.saltSituation]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							摄盐情况调整：
						</view>
						<text>{{saltSituation[pageInfo.guideSaltSituation]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							心理调整：
						</view>
						<text>{{complianceState[pageInfo.psychologyState]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							遵医行为：
						</view>
						<text>{{complianceState[pageInfo.complianceState]}}</text>
					</view>
				</view>

				<view class="title">
					<view class="left">
					</view>
					<view class="right">
						辅助检查
					</view>
				</view>
				<view class="symptom">
					<text>{{pageInfo.auxiliaryExamination}}</text>
				</view>

				<view class="title">
					<!-- <view class="left">
				</view>
				<view class="right">
					辅助检查
				</view> -->
				</view>

				<view class="information sign">
					<view class="p1">
						<view class="p1left">
							服药依从性：
						</view>
						<text>{{drugState[pageInfo.drugState]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							药物不良反应：
						</view>
						<text>{{adr[pageInfo.adr]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							药物不良反应描述：
						</view>
						<text>{{pageInfo.adrRemark}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							低糖反应：
						</view>
						<text>{{hypoglycemia[pageInfo.hypoglycemia]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							此次随访分类：
						</view>
						<text>{{followupKind[pageInfo.followupKind]}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							下一步管理措施：
						</view>
						<text>{{nextManageMeasure[pageInfo.nextManageMeasure]}}</text>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	import {
		getVisitTime,
		getVisitDetail
	} from "@/api/pagesC/Healthrecords/index.js"
	export default {
		data() {
			return {
				currentValue: 0,
				identity: uni.getStorageSync('userinfo').cardNo,
				name: uni.getStorageSync('userinfo').patientName,
				timeList: [],
				pageInfo: {},
				saltSituation: {
					'1': '轻',
					'2': '中',
					'3': '重'
				},
				followupWay: {
					'1': '门诊',
					'2': '家庭',
					'3': '电话',
					'99': '其他',
				},
				symptom: {
					'0': '无症状',
					'1': '头晕头疼',
					'2': '恶心呕吐',
					'3': '眼花耳鸣',
					'4': '呼吸困难',
					'5': '心悸胸闷',
					'6': '鼻衄出血不止',
					'7': '四肢发麻',
					'8': '下肢水肿',
					'99': '其他症状',
				},
				complianceState: {
					'1': '良好',
					'2': '一般',
					'3': '差'
				},
				drugState: {
					'1': '规律',
					'2': '间断',
					'3': '不服药',
					'4': '医嘱无需用药'
				},
				adr: {
					'1': '无',
					'2': '有',
				},
				hypoglycemia: {
					'1': '无',
					'2': '偶尔',
					'3': '频繁',
				},
				followupKind: {
					'1': '控制满意',
					'2': '控制不满意',
					'3': '不良反应',
					'4': '并发症',
				},
				nextManageMeasure: {
					'1': '常规随访',
					'2': '第1次控制不满意2周随访',
					'3': '两次控制不满意转诊随访',
					'4': '紧急转诊',
				}
			};
		},
		onLoad() {
			getVisitTime('28', this.identity).then(res => {
				if (!res.data || res.data.length == 0) {
					uni.showModal({
						title: '提示',
						content: '暂无相关数据',
						showCancel: false,
						success(res) {
							if (res.confirm) {
								uni.navigateBack({
									delta: 1
								})
							}
						}
					})
					return
				}
				for (let item in res.data) {
					for (let i of res.data[item].list) {
						this.timeList.push(i)
					}
				}
				this.detail(this.timeList[0])
			})
		},
		methods: {
			currentInfo(index) {
				this.currentValue = index
			},
			detail(e) {
				getVisitDetail('28', this.identity, e.id).then(res => {
					this.pageInfo = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.app {
		width: 100%;
		display: flex;
		background-color: #f6f6f6;

		.lefttext {
			font-size: 28rpx;
			color: #666666;
			width: 25%;
			line-height: 80rpx;
			text-align: center;
			background-color: #fff;

			.showitem {
				background-color: #55d0df;
				color: #fff;
			}
		}

		.righttext {
			width: 75%;

			.symptom {
				width: 92%;
				margin: 0 auto;
				background-color: #ffffff;
				border-radius: 10rpx;
				padding: 20rpx 0 20rpx 25rpx;

				text {
					display: block;
					font-size: 32rpx;
					line-height: 60rpx;
					letter-spacing: 1rpx;
					color: #333333;
				}
			}

			.information {
				width: 92%;
				margin: 0 auto;
				background-color: #ffffff;
				border-radius: 10rpx;
				padding-left: 25rpx;

				.p2 {
					border-top: 1rpx solid #f0f1f6;
					font-size: 28rpx;
					line-height: 100rpx;

					letter-spacing: 1rpx;
					color: #333333;
					display: flex;

					.p2left {
						width: 50%;
					}
				}

				.p1 {
					display: flex;
					font-size: 26rpx;
					line-height: 80rpx;
					letter-spacing: 1rpx;
					color: #666666;

					.p1left {
						width: 50%;
						display: flex;
						align-items: center;
					}

					text {
						font-size: 28rpx;
						line-height: 80rpx;
						letter-spacing: 1rpx;
						color: #333333;
					}
				}
			}

			.title {
				display: flex;
				padding-left: 20rpx;
				margin-top: 40rpx;
				margin-bottom: 20px;
				font-size: 30rpx;

				.right {
					line-height: 34rpx;
					padding-left: 10rpx;
					color: #666666;
				}

				.left {
					width: 8rpx;
					height: 32rpx;
					background-color: #55d0df;
					border-radius: 4rpx;
				}
			}
		}
	}

	::-webkit-scrollbar {
		display: none !important;
	}
</style>