<template>
	<view class="content">
		<view class="cont">
			<view class="bg">
				<image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/3305ca20c3f646c6b465918efb07f849.png"></image>
			</view>
			<view class="top-box"   >
				<view class="status_bar" :style="{height: statusBarHeight}"></view>
				<view class="top-title">
					<image @click="goBack()" src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/icon_back_w.png"></image>
					<view class="title"  >健康报告</view>
				</view>
				
			</view>
			<view class="cont-box" v-if="patient!=null">
				<view class="status_bar" :style="{height: statusBarHeight}"></view>
				<view class="user">
					<image :src="patient.avatar==null?'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/my_heads_icon.png':JSON.parse(report.patientJson).avatar"></image>
					<view class="user-box">
						<view class="sex">性别 {{patient.sex==1?"男":"女"}}</view>
						<view class="username">年龄 {{patient.age}}岁</view>
					</view>
					<view class="user-box">
						<view class="sex">身高 {{patient.height}}CM</view>
						<view class="username">体重 {{patient.weight}}KG</view>
					</view>
				</view>
				<view class="items">
					<view class="result-box">
						<view class="time">报告时间 {{report.createTime}}</view>
						<view class="name">{{report.inquiryResult}}</view>
					</view>
					<view class="item-box"  >
						<view class="item">
							<view class="title-box">
								<view class="title-line"></view>
								<view class="title">咨询问题</view>
							</view>
							<view class="descs" >{{patient.title}}</view>
							
						</view>
						<view   class="line"></view>
					</view>
					<view class="item-box"  v-if="patient!=null&&patient.medication!=null">
						<view class="item">
							<view class="title-box">
								<view class="title-line"></view>
								<view class="title">用药情况</view>
							</view>
							<view class="descs" >{{patient.medication}}</view>
						</view>
						<view   class="line"></view>
					</view>
					<view class="item-box" v-if="report!=null&&report.inquiryResult!=null" >
						<view class="item">
							<view class="title-box">
								<view class="title-line"></view>
								<view class="title">健康评估</view>
							</view>
							<view class="descs" >{{report.inquiryResult}}</view>
							
						</view>
						<view   class="line"></view>
					</view>
					<view class="item-box"  v-for="(item,index) in report.conditioningPlan"  >
						<view class="item" >
							<view class="title-box">
								<view class="title-line"></view>
								<view class="title">{{item.name=='用药调治'?'健康建议':item.name}}</view>
							</view>
							<view class="descs" >{{item.value}}</view>
						</view>
						<view   class="line"></view>
					</view>
					<!-- <view class="item-box"  >
						<view class="item">
							<view class="title-box">
								<view class="title-line"></view>
								<view class="title">备注</view>
							</view>
							<view class="descs" >{{report.remark}}</view>
						</view>
					</view> -->
				</view>
				<view class="sign">
					医生签名
					<image :src="report.doctorSignUrl"></image>
				</view>
				<view class="sign">
					药师签名
					<image :src="report.drugDoctorSignUrl"></image>
				</view>
				<view class="tips">
					注：本次咨询，仅为针对患者当前身体情况的咨询问诊建议，不作为长期参考依据。
				</view>
			</view>
		</view>
	</view> 
</template>

<script>
	import {getInquiryOrderReport} from '@/api/inquiryOrder.js'
	export default {
		data() {
			return {
				orderId:null,
				statusBarHeight: uni.getStorageSync('menuInfo').statusBarHeight,
				report:null,
				patient:null,
			};
		},
		onLoad(option) {
			this.orderId=option.orderId;
			this.getInquiryOrderReport();
			 
		},
		onShow() {
		},
		methods:{
			getInquiryOrderReport(){
				let data = {orderId:this.orderId};
				getInquiryOrderReport(data).then(
					res => {
						if(res.code==200){
							if(data!=null){
								console.log(res.data)
								this.report=res.data;
								if(res.data.patientJson!=null){
									this.patient=JSON.parse(res.data.patientJson)
								}
								if(res.data.conditioningPlanJson!=null){
									this.report.conditioningPlan=JSON.parse(res.data.conditioningPlanJson)
									var list=[]
									this.report.conditioningPlan.forEach((item,index)=>{
										if(item.value!=""){
											list.push(item)
										}
									})
									this.report.conditioningPlan=list;
								}
								console.log(this.patient)
								
							}
						}
					},
					rej => {}
				);	
			},
			goBack(){
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #FDF7F0;
		height: 100%;
	}
	.content{
		.cont{
			position: relative;
			width: 100%;
			display: flex;
			flex-direction: column;
			.bg{
				width: 100%;
				height:650rpx;
				// background-color: #2583EB;
				// background: linear-gradient(#2583EB, #88e2da);
				position: fixed;
				image{
					width: 100%;
					height:100%;
				}
				z-index: 1;
			}
			.top-box{
				width: 100%;
				position: fixed;
				top: 0;
				left: 0;
				z-index: 1001;
				.top-title{
					height: 88upx;
					// line-height: 88upx;
					display: flex;
					align-items: center;
					justify-content: center;
					position: relative;
					image{
						position: absolute;
						left:15rpx;
						width:44rpx;
						height:44rpx;
					}
					.title{
						font-size: 32upx;
						font-family: PingFang SC;
						font-weight: bold;
						color: #ffffff;
					}
				}
				 
			}
			.cont-box{
				z-index: 1000;
				margin-top: 88rpx;
				.user{
					width: 100%;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					padding: 30rpx;
					image{
						border-radius: 50%;
						border: 2rpx solid #ffffff;
						width:120rpx;
						height:120rpx;
					}
					.user-box{
						padding: 30rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						.sex{
							font-size: 28supx;
							font-family: PingFang SC;
							color: #ffffff;
						}
						.username{
							margin-left: 15rpx;
							font-size: 28supx;
							font-family: PingFang SC;
							color: #ffffff;
						}
						
					}
				}
				.items{
					width: 100%;
					display: flex;
					flex-direction: column;
					align-items: flex-start;
					justify-content: flex-start;
					padding: 20rpx;
					.result-box{
						width: 100%;
						display: flex;
						flex-direction: column;
						align-items:center;
						justify-content: center;
						padding: 30rpx;
						background-color: #fff;
						border-radius: 15rpx;
						margin-bottom: 15rpx;
						.time{
							margin-top: 15rpx;
							font-family: PingFang SC;
							font-size: 24rpx;
							color: #9B9B9B;
						}
						.title{
							margin-top: 15rpx;
							font-family: PingFang SC;
							font-size: 28rpx;
							color: #626468;
							
						}
						.name{
							margin-top: 30rpx;
							font-family: PingFang SC;
							font-weight: bold;
							font-size: 38rpx;
							color: #DF6440;
						}
						.descs{
							font-family: PingFang SC;
							font-size: 28rpx;
							color: #2A2B2E;
							padding: 30rpx;
							margin-top: 30rpx;
							background-color: #F5F6F6;
							border-radius: 10rpx;
						}
					}
					.item-box{
						width: 100%;
						.item{
							width: 100%;
							padding: 30rpx;
							background-color: #fff;
							border-radius:30rpx;
							.title-box{
								display: flex;
								align-items:center;
								justify-content: flex-start;
								.title{
									margin-left: 10rpx;
									font-size: 32supx;
									font-family: PingFang SC;
									color: #2A2B2E;
									font-weight: bold;
								}
								.title-line{
									width: 8rpx;
									height: 28rpx;
									background: #2583EB;
									border-radius: 2px 2px 2px 2px;
									opacity: 1;
								}
								
							}
							.descs{
								white-space: pre-line; 
								margin-top: 10rpx;
								font-size: 28supx;
								font-family: PingFang SC;
								color: #2A2B2E;
							}
							
						}
						.line{
							margin: 0rpx 30rpx;
							border-bottom: #b5b5b5 3rpx dashed;
						}
						&:last-child{
							.line{
								margin: 0rpx 30rpx;
								border-bottom:none;
							}
						}
						
					}
				
					
					
				}
				.sign{
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					margin: 15rpx 0rpx;
					color: #9B9B9B;
					font-size: 24rpx;
					image{
						margin-left: 20rpx;
						width: 240rpx;
						height: 100rpx;
					}
				}
				.tips{
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
					margin: 15rpx 0rpx;
					color: #9B9B9B;
					font-size: 24rpx;
				}
			}
		}
		
	}
	 
</style>
