<template>
	<view class="main">
		<view class="content">
			<view class="nameBox">
				<view class="name">{{patientName}}</view>
			</view>
			<view class="cardNum">{{cardId}}</view>
			<view class="list">
				<view class="item" v-for="(item, index) in item">
					<view class="topTitle">{{ titleType(item.diagnosticType) }}</view>
					<view class="title">{{ item.diagnosticName }}</view>
					<view class="doc">主治医生: {{item.doctor}} </view>
					<view class="dept">就诊科室: {{item.departmentName}} </view>
					<view class="botBox">
						<view class="time">诊断时间: {{item.diagnosisTime}} </view>
						<view class="type">{{ diaCode(item.diagnosticCategoryCode) }}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item: [],
				patientName:'',
				cardId:'',
			}
		},
		onLoad(e) {
			console.log(e);
			this.cardId = e.cardId
			this.patientName = e.patientName
			this.http.request({
				url: '/work/diagnosis/list?visitId=' + e.id,
				loading: 'true',
				success: (res) => {
					console.log(res);
					this.item = res.data.rows
				}
			});
		},
		methods: {
			titleType(type) {
				// 诊断类型代码：
				// 0-主要诊断
				// 1-第一辅诊
				// 2-第二辅诊
				switch (type) {
					case '0':
						return "主要诊断:"
						break;
					case '1':
						return "第一辅诊:"
						break;
					case '2':
						return "第二辅诊:"
						break;
				}
			},
			diaCode(code) {
				// 诊断类别代码：
				// 0-门诊诊断
				// 1-入院诊断
				// 2-出院诊断
				// 3-中医入院诊断
				// 4-中医出院诊断
				// 5-修正诊断
				// 6-最终诊断
				// 7-初步诊断
				// 8 目前诊断
				// 9-术前诊断
				// 10-术后诊断
				// 11-产后诊断
				// 99-其他诊断
				switch (code) {
					case '0':
						return "门诊诊断"
						break;
					case '1':
						return "入院诊断"
						break;
					case '2':
						return "出院诊断"
						break;
					case '3':
						return "中医入院诊断"
						break;
					case '4':
						return "中医出院诊断"
						break;
					case '5':
						return "修正诊断"
						break;
					case '6':
						return "最终诊断"
						break;
					case '7':
						return "初步诊断"
						break;
					case '8':
						return "目前诊断"
						break;
					case '9':
						return "术前诊断"
						break;
					case '10':
						return "术后诊断"
						break;
					case '11':
						return "产后诊断"
						break;
					case '99':
						return "其他诊断"
						break;
				}
			},
		}
	}
</script>

<style lang="scss">
	.content {
		padding: 15px;
		background-color: white;
		border-radius: 8px;

		.nameBox {
			display: flex;
			align-items: center;

			.name {
				font-weight: bold;
				font-size: 16px;
			}
		}

		.cardNum {
			padding-top: 10px;
			font-size: 14px;
		}

		.list {
			.item {
				overflow: hidden;
				padding: 13px 0;
				border-bottom: 1px solid $line;
				margin-bottom: 10px;
				
				.topTitle{
					font-size: 18px;
					font-weight: bold;
				}

				.title {
					font-size: 24px;
					font-weight: bold;
				}

				.botBox {
					display: flex;
					justify-content: space-between;
					align-items: center;

					.time,
					.type {
						font-size: 14px;
						padding-top: 15px;
						color: $font-c;
					}
				}
			}
		}
	}
</style>