<template>
	<view class="wrap">
		<view style="color: #00c4b3;font-size: 24rpx;margin: 20rpx;">报告时间：{{formatDate(time,'yyyy-MM-dd')}}</view>
		<view >
			<view class="table newMonitTable">

				<view class="tableTh">
					<view class="list_td">检查项目</view>
					<view>结果</view>
					<view>单位</view>
					<view>参考值</view>
				</view>


				<view v-for="i in list" :key="i" class="tableTr">
					<view>{{i.type}}</view>
					<view v-if="i.inspect_tips !=''">
						<view :class="[i.inspect_tips=='↑' ? 'shang':'xia']">
							{{i.result}}{{i.inspect_tips}}
						</view>
					</view>
					<view class="" v-else>{{i.result}}</view>
					<view>{{i.unit}}</view>
					<view>{{i.range_min}}~{{ i.range_max}}</view>	
					
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import {getInspectioninfo} from '@/api/api.js'
	import {formatDate} from "@/utils/formatDate.js"
export default {
	data() {
		return {
			time: '',
			list: [],
			project_id:'',
			inspect_date:'',
			patient_id:0,
			org_id:0
		}
	},
	onLoad(options) {
		this.patient_id = this.$store.state.data.userInfo.id
		this.org_id = this.$store.state.data.userInfo.user_org_id
		this.inspect_date=options.inspect_date
		this.project_id=options.project_id
		console.log('vvvvvv',options);
		this.getgetInspectioninfo()
	},
	methods:{
		async getgetInspectioninfo () {
			let params={
				project_id:this.project_id,
				inspect_date:this.inspect_date,
				patient_id:this.patient_id,
				org_id:this.org_id
				// org_id:10340
			}
			let res = await getInspectioninfo(params)
			console.log('zzzzz',res);
			let reas=res.data.data
			let list=[]
			console.log('sadfdfaaaa',reas.list);
			for(let i in reas.list){
				// console.log('bbbbb',reas.list[1]);
				let objs={}
				objs['type'] = reas.list[i].item_name,
				objs['result'] = reas.list[i].inspect_value,
				objs['unit'] = reas.list[i].inspection_reference.unit,
				objs['range_max'] = reas.list[i].inspection_reference.range_max
				objs['range_min'] = reas.list[i].inspection_reference.range_min
				objs['inspect_tips'] = reas.list[i].inspect_tips
				list.push(objs)
			}
			this.time=reas.list[0].inspect_date
			this.list=list
			console.log('22222',this.list);
		},
		formatDate(value, fmt) {
			return formatDate(new Date(value * 1000), fmt)
		},
	}
}
</script>

<style>
	.table {
		overflow: scroll;
		width: 100%;
	}
	.shang{
		color: red;
	}
	.xia{
		color: aquamarine;
	}

	.tableTh {
		display: -webkit-box;
		color: #8d8d8d;
		min-height: 80rpx;
		font-size: 28rpx
	}

	.tableTh view {
		width: 25vw;
		display: flex;
		flex-direction: column;
		justify-content: center;
		text-align: center;
		background: #f6f6f6;
		/* border-right: 2px solid #FFFFFF; */
	}

	.tableTr {
		display: -webkit-box;
		font-size: 28rpx
	}

	.tableTr view {
		width: 25vw;
		text-align: center;
		padding: 20rpx 0;
		display: table-cell;
		align-items: center;
		justify-content: space-around;
		display: flex;
		/* border-right: 2px solid #FFFFFF; */
		border-bottom: 2px solid #FFFFFF;
		background: #FFFFFF;
	}

	.table_wrap {
		display: table;
		overflow: scroll;
		width: 100%;
	}
</style>
