<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="index"
					@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="p2">
						<view class="p2left">
							下次随访时间：
						</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>{{footPulseAnomaly[pageInfo.footPulseAnomaly]}}</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>{{pageInfo.staple}}克/天</text>
					</view>
					<view class="p1">
						<view class="p1left">
							饮食情况调整：
						</view>
						<text>{{pageInfo.guideStaple}}克/天</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="information sign">
					<view class="p1">
						<view class="p1left">
							空腹血糖：
						</view>
						<text>{{pageInfo.fastingBloodGlucose}}mmol/L</text>
					</view>
					<view class="p1">
						<view class="p1left">
							糖化血红蛋白：
						</view>
						<text v-if="pageInfo.hbalc">{{pageInfo.hbalc}}%</text>
					</view>
					<view class="p1">
						<view class="p1left">
							检查日期：
						</view>
						<text>{{pageInfo.hbalcDate}}</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>{{pageInfo.insulinKind}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							用法用量：
						</view>
						<text>{{pageInfo.insulinUsage}}</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>{{pageInfo.insulinKind1}}</text>
					</view>
					<view class="p1">
						<view class="p1left">
							用法用量：
						</view>
						<text>{{pageInfo.insulinUsage1}}</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>{{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: {},
				followupWay: {
					'1': '门诊',
					'2': '家庭',
					'3': '电话',
					'99': '其他',
				},
				symptom: {
					'0': '无症状',
					'1': '头晕头疼',
					'2': '恶心呕吐',
					'3': '眼花耳鸣',
					'4': '呼吸困难',
					'5': '心悸胸闷',
					'6': '鼻衄出血不止',
					'7': '四肢发麻',
					'8': '下肢水肿',
					'99': '其他症状',
				},
				footPulseAnomaly: {
					'1': '触及正常',
					'2': '减弱',
					'3': '消失'
				},
				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('29', 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('29', 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: 48%;
					}
				}

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

					.p1left {
						width: 48%;
						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>