<script setup>
	/**
	 * name：
	 * user：sa0ChunLuyu
	 * date：2023年3月19日 10:46:21
	 */
	import ReportType1 from '../../../components/report/type1.vue'
	import ReportType2 from '../../../components/report/type2.vue'
	import ReportType3 from '../../../components/report/type3.vue'
	import {
		onMounted,
		ref
	} from 'vue'
	import {
		$image,
		ReportInfoAction,
		$response
	} from '@/api'
	import {
		onShow
	} from '@dcloudio/uni-app'
	const $props = defineProps({
		type: {
			type: String,
			default: '1'
		},
		id: {
			type: String,
			default: '0'
		},
		hospital: {
			type: String,
			default: ''
		}
	});
	const chooseTypeClick = (type) => {
		if (Number($props.type) === type) return
		uni.redirectTo({
			url: `/pages/main/report/report?hospital=${$props.hospital}&type=${type}&id=${$props.id}`
		})
	}
	const ReportInfo = async () => {
		uni.showLoading({
			title: '加载中...'
		});
		const response = await ReportInfoAction({
			id: $props.id
		})
		$response(response, () => {
			uni.hideLoading();
			report_content.value = {
				content: response.data.content,
				conclusion: response.data.conclusion,
				list: response.data.list,
			}
		})
	}

	const report_content = ref(false)
	onMounted(() => {
		ReportInfo()
		

	})

</script>
<template>
	<view>
		<view class="type_group_top_blank_wrapper"></view>
		<view class="type_group_wrapper">
			<view @click="chooseTypeClick(1)" class="type_item_wrapper" :class="[
				Number($props.type) === 1 ? 'type_item_active_wrapper' : ''
			]">
				<view class="type_item_text_wrapper">总检结论</view>
				<view class="type_item_line_wrapper"></view>
			</view>
			<view @click="chooseTypeClick(2)" class="type_item_wrapper " :class="[
				Number($props.type) === 2 ? 'type_item_active_wrapper' : ''
			]">
				<view class="type_item_text_wrapper">报告详情</view>
				<view class="type_item_line_wrapper"></view>
			</view>
			<view @click="chooseTypeClick(3)" class="type_item_wrapper " :class="[
				Number($props.type) === 3 ? 'type_item_active_wrapper' : ''
			]">
				<view class="type_item_text_wrapper">报告下载</view>
				<view class="type_item_line_wrapper"></view>
			</view>
		</view>
		<view v-if="!!report_content" class="report_content_wrapper">
			<ReportType1 :info="report_content.conclusion" v-if="Number($props.type) === 1"></ReportType1>
			<ReportType2 :info="report_content.content" v-if="Number($props.type) === 2"></ReportType2>
			<ReportType3 :list="report_content.list" v-if="Number($props.type) === 3"></ReportType3>
		</view>
	</view>
</template>
<style scoped>
	.report_content_wrapper {
		position: absolute;
		bottom: 0;
		left: 0;
		right: 0;
		top: 114rpx;
		overflow-y: auto;
		padding-bottom: 20rpx;
	}

	.type_group_top_blank_wrapper {
		height: 15rpx;
	}

	.type_item_text_wrapper {
		font-size: 32rpx;
		font-weight: 500;
		line-height: 1;
		color: #757575;
	}

	.type_item_line_wrapper {
		width: 220rpx;
		height: 3rpx;
		border-radius: 2rpx;
		margin-top: 21rpx;
	}

	.type_group_wrapper {
		width: 750rpx;
		height: 90rpx;
		background: linear-gradient(180deg, #F7F7FF 0%, #F3FAFA 100%);
		display: flex;
		align-items: center;
		justify-content: space-around;
		text-align: center;
	}

	.type_item_active_wrapper .type_item_text_wrapper {
		color: #37B9A4;
	}

	.type_item_active_wrapper .type_item_line_wrapper {
		background: #16C5A9;
	}
</style>