<template>
	<div class="ptint-revserve">
		<nav-header></nav-header>
		<div style="margin: 5px;">
			<van-form ref="formRef"
								error-message-align="right">
				<van-cell-group title=""
												insert>
					<van-field v-model="form.ispID"
										 label="住院号"
										 is-link
										 readonly
										 required
										 placeholder="点击选择住院记录"
										 @click="state.ispShow = true"
										 :rules="[{required: true, message: '请选择住院记录', trigger: 'onSubmit'}]"></van-field>
					<van-field v-model="form.dx"
										 label="诊断内容"
										 readonly
										 required
										 placeholder="选择住院记录"></van-field>
					<van-field v-model="form.ptName"
										 label="病人姓名"
										 readonly
										 required
										 placeholder="选择住院记录"></van-field>
					<van-field v-model="form.deptName"
										 label="出院科室"
										 readonly
										 required
										 placeholder="选择住院记录"></van-field>
					<van-field v-model="form.ptIdcID"
										 required
										 label="身份证"
										 placeholder="身份证号"
										 :rules="[{required: true, message: '请输入身份证号', trigger: 'onSubmit'}]"></van-field>
					<van-field v-model="form.phone"
										 type="tel"
										 required
										 label="联系电话"
										 placeholder="联系电话"
										 :rules="[{required: true, message: '请输入联系电话', trigger: 'onSubmit'}]"></van-field>
					<!-- <van-field v-model="form.applicantName"
										 required
										 label="委托代理人姓名"
										 placeholder="委托代理人姓名"
										 :rules="[{required: true, message: '请输入委托代理人姓名', trigger: 'onSubmit'}]"></van-field>
					<van-field v-model="form.applicantRel"
										 required
										 label="申请人与病人关系"
										 placeholder="申请人与病人关系"
										 :rules="[{required: true, message: '请输入申请人与病人关系', trigger: 'onSubmit'}]"></van-field> -->
					<van-field v-model="formLabel.getWayLabel"
										 is-link
										 readonly
										 required
										 label="获取方式"
										 placeholder="点击选择获取方式"
										 @click="state.getWayShow = true"></van-field>
					<van-field v-model="form.address"
										 label="邮寄地址"
										 type="textarea"
										 rows="2"
										 autosize
										 required
										 placeholder="邮寄地址"
										 :rules="[{required: true, message: '请输入邮寄地址', trigger: 'onSubmit'}]"></van-field>
					<van-field v-model="form.useWay"
										 label="模板"></van-field>
				</van-cell-group>
				<van-cell-group title=""
												insert
												style="margin-top: 5px;">
					<div class="img_item">
						<div class="img_item_label"><span style="color: red;">*</span>本人身份证正面照片</div>
						<div class="img_item_upload">
							<van-uploader v-model="form.ptImg1"
														style="width: 100%;height: 100%;"
														:max-count="1">
								<div style="height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
									<svg t="1685244688694"
											 class="icon"
											 viewBox="0 0 1507 1024"
											 version="1.1"
											 xmlns="http://www.w3.org/2000/svg"
											 p-id="5693"
											 width="64"
											 height="64">
										<path d="M1404.827485 1023.962307v-19.562798h83.245546v-82.77438H1507.730061v102.337178h-102.902576zM1488.073031 19.638184H1404.827485V0.075387H1507.730061V102.337178h-19.65703V19.638184z m-73.363632 61.86719a55.829988 55.829988 0 0 1 16.597595 39.841767v768.533988c-0.012564 31.084368-25.361276 56.288589-56.640393 56.313718H123.483092c-31.272834-0.043975-56.608982-25.235632-56.640393-56.313718V121.347141c0.043975-31.071804 25.380123-56.244613 56.640393-56.282307h1251.208638c15.071018 0 29.281374 5.82989 40.017669 16.44054z m-39.986258 8.4747H123.483092v0.018846c-17.426847 0.018847-31.549252 14.053301-31.568098 31.37335v768.533988c0 17.288638 14.16638 31.398479 31.568098 31.398478h1251.183509c17.401718 0 31.593227-14.084712 31.593227-31.398478V121.347141c0-8.374184-3.285595-16.27092-9.247411-22.201325a32.026699 32.026699 0 0 0-22.289276-9.165742z m-462.326577 647.431852c1.030282-49.158282 10.133202-133.050896 59.354307-175.73222l67.766184 0.615656 63.462871 104.058503 11.961326-77.811436-8.650602-14.10984 0.647068-14.499337a280.846135 280.846135 0 0 1 37.712098 0.050257l0.703607 14.499338-8.625472 14.103558 12.011583 78.439656 49.290208-105.226994 74.965595-2.538012c38.74238 36.405399 63.588515 122.188957 57.494773 178.150871h-418.093546z m315.216099-288.680049c-5.163975 18.337767-11.201178 35.331141-19.85178 49.57919-9.881914 16.446822-22.948908 29.09919-41.418601 35.909105-8.254822 2.965202-29.337914 4.384982-49.623165 4.033178-19.556515-0.245006-39.213546-2.186209-47.034896-5.779632-16.798626-7.65173-28.609178-20.580515-37.511068-36.650405-7.670577-13.732908-13.110969-29.727411-17.904294-46.62027-7.846479-4.083436-13.73919-11.03784-17.728393-20.530258-4.334724-10.315387-6.31362-23.872393-6.062331-39.942282l0.075386-5.484368 4.586013-3.040589c1.155926-0.772712 2.330699-1.520294 3.511754-2.186209-5.163975-63.142479-3.210209-86.487166 20.385767-113.173987 46.004613-37.429399 151.464049-36.103853 198.046626-2.173644 31.744 29.802798 33.949055 63.192736 24.199067 114.719411 1.526577 0.873227 3.028025 1.796712 4.560884 2.814429l4.586012 3.065718 0.05654 5.459239c0.270135 15.743215-1.633374 29.080344-5.792196 39.370601-3.838429 9.391902-9.479853 16.396564-17.081325 20.630773z m-0.571681-54.718037a14.329718 14.329718 0 0 0-5.440393-0.822969l-9.354209 0.59681-1.727607-9.146896a119.035288 119.035288 0 0 0-9.706012-29.652024c-29.834209 5.811043-74.186601 10.89335-109.241325-8.738552-13.513031-7.551215-33.25173 7.921865-49.440982 6.326184a121.623558 121.623558 0 0 0-10.931043 32.064392l-1.809276 9.492417-9.580368-0.917202a14.612417 14.612417 0 0 0-5.584884 0.672196 26.385276 26.385276 0 0 0-2.58827 1.024c0.22616 10.510135 1.702479 19.204712 4.466651 25.738209 2.406086 5.729374 5.741939 9.44216 10.108073 10.811681l5.610013 1.746454 1.551705 5.60373c4.717939 17.269791 9.932172 33.641227 17.357743 46.915534 6.866454 12.313129 15.667828 22.151067 27.773644 27.685693 5.12 2.336982 21.416049 3.637399 38.440834 3.888687 18.099043 0.251288 36.128982-0.672196 42.09708-2.870969 13.412515-4.906405 23.093399-14.44908 30.588073-26.9067 8.02238-13.381104 13.764319-30.374479 18.802651-49.013791l1.457472-5.352442 5.314749-1.846969c4.20908-1.470037 7.494675-5.308466 9.875632-11.088098 2.607117-6.426699 4.03946-15.001914 4.315877-25.28589a16.06989 16.06989 0 0 0-2.355828-0.923485zM332.642945 457.049521h288.887362v49.309056H332.642945v-49.309056z m0-122.741791h288.887362v49.315337H332.642945v-49.315337z m0-122.735509h288.887362v49.309055H332.642945v-49.309055zM201.41389 457.049521h95.929325v49.309056h-95.929325v-49.309056z m0-122.741791h95.929325v49.315337h-95.929325v-49.315337z m0-122.735509h95.929325v49.309055h-95.929325v-49.309055z m254.712147 615.863754H201.41389v-49.334184h254.712147v49.334184z m464.248932 0H485.909988v-49.334184h434.464981v49.334184zM19.68216 102.337178H0V0.075387h102.927706v19.562797H19.68216V102.337178z m0 902.062331h83.245546v19.562798H0v-102.337178h19.68216v82.77438z"
													p-id="5694"
													fill="#dcdfe6"></path>
									</svg>
									<span>点击选择照片或拍照</span>
								</div>
							</van-uploader>
						</div>
						<div v-if="state.imgBlankError.ptImg1"
								 class="img__blank_error">请上传本人身份证正面照片</div>
					</div>

					<div class="img_item">
						<div class="img_item_label"><span style="color: red;">*</span>本人身份证背面照片</div>
						<div class="img_item_upload">
							<van-uploader v-model="form.ptImg2"
														style="width: 100%;height: 100%;"
														:max-count="1">
								<div style="height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
									<svg t="1685244916978"
											 class="icon"
											 viewBox="0 0 1499 1024"
											 version="1.1"
											 xmlns="http://www.w3.org/2000/svg"
											 p-id="9485"
											 width="64"
											 height="64">
										<path d="M1396.224 1024v-19.456h82.432V921.6h19.456v102.4h-101.888zM1479.168 19.456h-82.432V0h102.4v102.4H1479.68V19.456zM1405.952 81.92c10.24 10.24 16.384 24.576 16.384 39.424v769.024c0 30.72-25.088 55.808-55.808 55.808H122.88c-30.72 0-55.808-25.088-55.808-55.808V121.344c0-30.72 25.088-55.808 55.808-55.808h1243.648c14.336 0 28.672 5.632 39.424 16.384z m-39.424 7.168H122.88c-17.408 0-31.744 14.336-31.744 31.744v768.512c0 17.408 14.336 31.744 31.744 31.744h1243.648c16.384 0 30.208-12.8 31.744-29.184V121.344c0-8.192-3.584-16.384-9.216-22.528-6.144-6.144-14.336-9.728-22.528-9.728zM465.92 677.888h737.28v49.152H465.92v-49.152z m143.36-253.952h593.408v49.152H609.28v-49.152z m0-122.88h593.408v49.152H609.28v-49.152z m0-123.904h593.408v49.152H609.28v-49.152zM485.376 423.936h95.232v49.152H485.376v-49.152z m0-122.88h95.232v49.152H485.376v-49.152z m0-122.88h95.232v49.152H485.376v-49.152zM384 409.6l20.48 38.4c-9.216-6.656-20.992-8.192-31.232-3.584-10.752 7.168-18.944 17.92-23.04 30.72l-16.384-25.088v12.8h-107.52v-12.8l-14.848 25.088c-4.096-12.288-12.288-23.04-23.04-30.72-15.36-8.192-31.744 6.656-31.744 6.656l22.016-41.472c-49.152-54.784-46.08-138.752 7.168-189.44 53.248-51.2 137.216-51.2 190.464 0 53.248 51.2 56.32 134.656 7.168 189.44 0-1.024 0.512 0 0.512 0zM216.064 282.624l-3.584-9.728-5.12 8.704h-8.192l7.68 6.656v9.728l8.192-5.12 8.192 5.12-4.608-8.704 7.68-6.656h-10.24z m-2.048 117.76h140.8l-14.336-22.528h-112.64c0 0.512-13.824 22.528-13.824 22.528z m93.696-22.528l-4.608-14.848h-39.424l-5.12 14.848h49.152zM238.592 308.224l7.68 6.656v9.728l8.192-5.12 8.192 5.12-4.608-8.704 8.192-6.656h-10.752l-3.584-11.264-3.584 10.24h-9.728z m51.2-53.248L281.6 233.984l-8.192 20.992H250.88l16.896 14.848-5.12 22.528 18.944-12.288 18.944 12.288-5.12-22.528 16.896-14.848h-22.528z m35.328 54.784l-4.096-11.264-3.584 10.24h-10.24l7.68 6.656v9.728l8.192-5.12 8.192 5.12-6.656-8.704 7.68-6.656h-7.168z m31.744-32.256l-3.584-10.24-3.584 9.728h-10.24l7.68 6.656v9.728l8.192-5.12 8.192 5.12-4.608-9.728 7.68-6.656c0.512 0.512-9.728 0.512-9.728 0.512zM417.28 727.04H200.192v-49.152h217.088v49.152z m0 96.768H200.192v-49.152h217.088v49.152z m785.408 0H465.92v-49.152h736.768v49.152zM19.456 102.4H0V0h102.4v19.456H19.456V102.4z m0 902.144H102.4v19.456H0v-102.4h19.456v82.944z"
													p-id="9486"
													fill="#dcdfe6"></path>
									</svg>
									<span>点击选择照片或拍照</span>
								</div>
							</van-uploader>
						</div>
						<div v-if="state.imgBlankError.ptImg2"
								 class="img__blank_error">请上传本人身份证背面照片</div>
					</div>
<!-- 
					<div class="img_item">
						<div class="img_item_label"><span style="color: red;">*</span>申请人身份证正面照片</div>
						<div class="img_item_upload">
							<van-uploader v-model="form.applicantIdcImg1"
														style="width: 100%;height: 100%;"
														:max-count="1">
								<div style="height: 100%;display: flex;flex-direction: column;align-items: center;justify-content: center;">
									<svg t="1685244688694"
											 class="icon"
											 viewBox="0 0 1507 1024"
											 version="1.1"
											 xmlns="http://www.w3.org/2000/svg"
											 p-id="5693"
											 width="64"
											 height="64">
										<path d="M1404.827485 1023.962307v-19.562798h83.245546v-82.77438H1507.730061v102.337178h-102.902576zM1488.073031 19.638184H1404.827485V0.075387H1507.730061V102.337178h-19.65703V19.638184z m-73.363632 61.86719a55.829988 55.829988 0 0 1 16.597595 39.841767v768.533988c-0.012564 31.084368-25.361276 56.288589-56.640393 56.313718H123.483092c-31.272834-0.043975-56.608982-25.235632-56.640393-56.313718V121.347141c0.043975-31.071804 25.380123-56.244613 56.640393-56.282307h1251.208638c15.071018 0 29.281374 5.82989 40.017669 16.44054z m-39.986258 8.4747H123.483092v0.018846c-17.426847 0.018847-31.549252 14.053301-31.568098 31.37335v768.533988c0 17.288638 14.16638 31.398479 31.568098 31.398478h1251.183509c17.401718 0 31.593227-14.084712 31.593227-31.398478V121.347141c0-8.374184-3.285595-16.27092-9.247411-22.201325a32.026699 32.026699 0 0 0-22.289276-9.165742z m-462.326577 647.431852c1.030282-49.158282 10.133202-133.050896 59.354307-175.73222l67.766184 0.615656 63.462871 104.058503 11.961326-77.811436-8.650602-14.10984 0.647068-14.499337a280.846135 280.846135 0 0 1 37.712098 0.050257l0.703607 14.499338-8.625472 14.103558 12.011583 78.439656 49.290208-105.226994 74.965595-2.538012c38.74238 36.405399 63.588515 122.188957 57.494773 178.150871h-418.093546z m315.216099-288.680049c-5.163975 18.337767-11.201178 35.331141-19.85178 49.57919-9.881914 16.446822-22.948908 29.09919-41.418601 35.909105-8.254822 2.965202-29.337914 4.384982-49.623165 4.033178-19.556515-0.245006-39.213546-2.186209-47.034896-5.779632-16.798626-7.65173-28.609178-20.580515-37.511068-36.650405-7.670577-13.732908-13.110969-29.727411-17.904294-46.62027-7.846479-4.083436-13.73919-11.03784-17.728393-20.530258-4.334724-10.315387-6.31362-23.872393-6.062331-39.942282l0.075386-5.484368 4.586013-3.040589c1.155926-0.772712 2.330699-1.520294 3.511754-2.186209-5.163975-63.142479-3.210209-86.487166 20.385767-113.173987 46.004613-37.429399 151.464049-36.103853 198.046626-2.173644 31.744 29.802798 33.949055 63.192736 24.199067 114.719411 1.526577 0.873227 3.028025 1.796712 4.560884 2.814429l4.586012 3.065718 0.05654 5.459239c0.270135 15.743215-1.633374 29.080344-5.792196 39.370601-3.838429 9.391902-9.479853 16.396564-17.081325 20.630773z m-0.571681-54.718037a14.329718 14.329718 0 0 0-5.440393-0.822969l-9.354209 0.59681-1.727607-9.146896a119.035288 119.035288 0 0 0-9.706012-29.652024c-29.834209 5.811043-74.186601 10.89335-109.241325-8.738552-13.513031-7.551215-33.25173 7.921865-49.440982 6.326184a121.623558 121.623558 0 0 0-10.931043 32.064392l-1.809276 9.492417-9.580368-0.917202a14.612417 14.612417 0 0 0-5.584884 0.672196 26.385276 26.385276 0 0 0-2.58827 1.024c0.22616 10.510135 1.702479 19.204712 4.466651 25.738209 2.406086 5.729374 5.741939 9.44216 10.108073 10.811681l5.610013 1.746454 1.551705 5.60373c4.717939 17.269791 9.932172 33.641227 17.357743 46.915534 6.866454 12.313129 15.667828 22.151067 27.773644 27.685693 5.12 2.336982 21.416049 3.637399 38.440834 3.888687 18.099043 0.251288 36.128982-0.672196 42.09708-2.870969 13.412515-4.906405 23.093399-14.44908 30.588073-26.9067 8.02238-13.381104 13.764319-30.374479 18.802651-49.013791l1.457472-5.352442 5.314749-1.846969c4.20908-1.470037 7.494675-5.308466 9.875632-11.088098 2.607117-6.426699 4.03946-15.001914 4.315877-25.28589a16.06989 16.06989 0 0 0-2.355828-0.923485zM332.642945 457.049521h288.887362v49.309056H332.642945v-49.309056z m0-122.741791h288.887362v49.315337H332.642945v-49.315337z m0-122.735509h288.887362v49.309055H332.642945v-49.309055zM201.41389 457.049521h95.929325v49.309056h-95.929325v-49.309056z m0-122.741791h95.929325v49.315337h-95.929325v-49.315337z m0-122.735509h95.929325v49.309055h-95.929325v-49.309055z m254.712147 615.863754H201.41389v-49.334184h254.712147v49.334184z m464.248932 0H485.909988v-49.334184h434.464981v49.334184zM19.68216 102.337178H0V0.075387h102.927706v19.562797H19.68216V102.337178z m0 902.062331h83.245546v19.562798H0v-102.337178h19.68216v82.77438z"
													p-id="5694"
													fill="#dcdfe6"></path>
									</svg>
									<span>点击选择照片或拍照</span>
								</div>
							</van-uploader>
						</div>
						<div v-if="state.imgBlankError.applicantIdcImg1"
								 class="img__blank_error">请上传申请人身份证正面照片</div>
					</div>

					<div class="img_item">
						<div class="img_item_label"><span style="color: red;">*</span>申请人身份证背面照片</div>
						<div class="img_item_upload">
							<van-uploader v-model="form.applicantIdcImg2"
														style="width: 100%;height: 100%;"
														:max-count="1">
								<div style="height: 100%; display: flex;flex-direction: column;align-items: center;justify-content: center;">
									<svg t="1685244916978"
											 class="icon"
											 viewBox="0 0 1499 1024"
											 version="1.1"
											 xmlns="http://www.w3.org/2000/svg"
											 p-id="9485"
											 width="64"
											 height="64">
										<path d="M1396.224 1024v-19.456h82.432V921.6h19.456v102.4h-101.888zM1479.168 19.456h-82.432V0h102.4v102.4H1479.68V19.456zM1405.952 81.92c10.24 10.24 16.384 24.576 16.384 39.424v769.024c0 30.72-25.088 55.808-55.808 55.808H122.88c-30.72 0-55.808-25.088-55.808-55.808V121.344c0-30.72 25.088-55.808 55.808-55.808h1243.648c14.336 0 28.672 5.632 39.424 16.384z m-39.424 7.168H122.88c-17.408 0-31.744 14.336-31.744 31.744v768.512c0 17.408 14.336 31.744 31.744 31.744h1243.648c16.384 0 30.208-12.8 31.744-29.184V121.344c0-8.192-3.584-16.384-9.216-22.528-6.144-6.144-14.336-9.728-22.528-9.728zM465.92 677.888h737.28v49.152H465.92v-49.152z m143.36-253.952h593.408v49.152H609.28v-49.152z m0-122.88h593.408v49.152H609.28v-49.152z m0-123.904h593.408v49.152H609.28v-49.152zM485.376 423.936h95.232v49.152H485.376v-49.152z m0-122.88h95.232v49.152H485.376v-49.152z m0-122.88h95.232v49.152H485.376v-49.152zM384 409.6l20.48 38.4c-9.216-6.656-20.992-8.192-31.232-3.584-10.752 7.168-18.944 17.92-23.04 30.72l-16.384-25.088v12.8h-107.52v-12.8l-14.848 25.088c-4.096-12.288-12.288-23.04-23.04-30.72-15.36-8.192-31.744 6.656-31.744 6.656l22.016-41.472c-49.152-54.784-46.08-138.752 7.168-189.44 53.248-51.2 137.216-51.2 190.464 0 53.248 51.2 56.32 134.656 7.168 189.44 0-1.024 0.512 0 0.512 0zM216.064 282.624l-3.584-9.728-5.12 8.704h-8.192l7.68 6.656v9.728l8.192-5.12 8.192 5.12-4.608-8.704 7.68-6.656h-10.24z m-2.048 117.76h140.8l-14.336-22.528h-112.64c0 0.512-13.824 22.528-13.824 22.528z m93.696-22.528l-4.608-14.848h-39.424l-5.12 14.848h49.152zM238.592 308.224l7.68 6.656v9.728l8.192-5.12 8.192 5.12-4.608-8.704 8.192-6.656h-10.752l-3.584-11.264-3.584 10.24h-9.728z m51.2-53.248L281.6 233.984l-8.192 20.992H250.88l16.896 14.848-5.12 22.528 18.944-12.288 18.944 12.288-5.12-22.528 16.896-14.848h-22.528z m35.328 54.784l-4.096-11.264-3.584 10.24h-10.24l7.68 6.656v9.728l8.192-5.12 8.192 5.12-6.656-8.704 7.68-6.656h-7.168z m31.744-32.256l-3.584-10.24-3.584 9.728h-10.24l7.68 6.656v9.728l8.192-5.12 8.192 5.12-4.608-9.728 7.68-6.656c0.512 0.512-9.728 0.512-9.728 0.512zM417.28 727.04H200.192v-49.152h217.088v49.152z m0 96.768H200.192v-49.152h217.088v49.152z m785.408 0H465.92v-49.152h736.768v49.152zM19.456 102.4H0V0h102.4v19.456H19.456V102.4z m0 902.144H102.4v19.456H0v-102.4h19.456v82.944z"
													p-id="9486"
													fill="#dcdfe6"></path>
									</svg>
									<span>点击选择照片或拍照</span>
								</div>
							</van-uploader>
						</div>
						<div v-if="state.imgBlankError.applicantIdcImg2"
								 class="img__blank_error">请上传申请人身份证背面照片</div>
					</div> -->

					<div class="img_item">
						<div class="img_item_label"><span style="color: red;">*</span>申请书照片</div>
						<div class="img_item_upload">
							<van-uploader v-model="form.agreementLetterImg"
														style="width: 100%;height: 100%;"
														:max-count="1">
								<div style="height: 100%; display: flex;flex-direction: column;align-items: center;justify-content: center;">
									<svg t="1685250803648"
											 class="icon"
											 viewBox="0 0 1024 1024"
											 version="1.1"
											 xmlns="http://www.w3.org/2000/svg"
											 p-id="15083"
											 width="64"
											 height="64">
										<path d="M608.20558965 898.406c18.504 0 12.996-1.728 12.996 15.696s5.508 31.554-12.996 31.554H153.14758964c-55.494 0-82.368-42.39-82.368-94.68V156.68C70.77958964 104.39 97.67158965 71.198 153.14758964 71.198h569.304c83.664 0 91.224 43.902 91.224 85.482 0 17.424-9.486 31.554-27.99 31.554S755.94958964 174.104 755.94958964 156.68s-4.788-31.554-33.47999999-31.554H153.14758964c-24.246 0-33.48 14.13-33.48 31.554v710.172c0 17.424 14.994 31.554 33.48 31.554h455.058z m230.88599999-343.71v153.486c0 44.64-45 44.64-45 0v-153.486c0-31.932 45-33.336 45 0z"
													p-id="15084"
													fill="#dcdfe6"></path>
										<path d="M246.78358965 253.934c-18.504 0-26.658-10.08-26.65800001-22.5s8.154-22.5 26.658-22.5h247.03200001c18.504 0 27.702 10.08 27.702 22.5s-9.216 22.5-27.702 22.5H246.78358965z m1.51199999 167.436c-18.504 0-28.17-10.08-28.17-22.5s9.684-22.5 28.17-22.5h142.75800001c18.504 0 30.006 10.08 30.006 22.5s-11.52 22.5-30.006 22.5H248.29558965z m353.44800001 489.348c0 18.504-5.166 28.242-23.67 28.242s-23.652-9.756-23.652-28.242l0.594-132.48a100.44 100.44 0 0 1 100.458-100.458l133.686 1.206c12.33 0 20.682 6.75 25.074 20.232-4.374 17.118-12.744 25.668-25.074 25.668l-133.686-1.206c-48.51 0-53.136 36.072-53.136 54.558l-0.594 132.48z"
													p-id="15085"
													fill="#dcdfe6"></path>
										<path d="M601.34758965 944.54c-3.762-2.358-4.266-7.146-5.74200001-9.54-1.476-2.376 0.702-23.886 9.342-32.166l188.76600001-181.044c8.568-8.622 21.132-11.916 32.832-8.622 11.7 3.294 12.474-4.482 12.474-3.906-0.216 19.98-3.924 34.596-12.474 42.408l-188.748 181.08c-8.622 8.28-24.948 15.138-36.45 11.79z m290.736-619.218a32.85 32.85 0 0 0 3.47399999-46.476c-12.492-14.382-33.444-15.966-47.412-4.05L419.56558964 637.64l-15.91199999 54.252 61.056-4.752 427.374-361.818z m32.65199999 39.366L503.94958965 724.22c-4.482 3.816-10.062 6.12-15.948 6.57l-100.458 7.776a27.972 27.972 0 0 1-28.99800001-35.784l27.03600001-92.178c1.53-5.238 4.572-9.9 8.73-13.428L814.88158965 237.86a83.898 83.898 0 0 1 117.72 8.838c30.528 35.172 26.856 87.786-7.866 117.99z"
													p-id="15086"
													fill="#dcdfe6"></path>
									</svg>
									<span>点击选择照片或拍照</span>
								</div>
							</van-uploader>
						</div>
						<div v-if="state.imgBlankError.agreementLetterImg"
								 class="img__blank_error">请上传申请书照片</div>
					</div>
				</van-cell-group>
				<div class="footer">
					<van-button type="primary"
											block
											icon="sign"
											round
											@click="onSubmit">提&emsp;交</van-button>
				</div>
			</van-form>
		</div>

		<!-- 获取方式 -->
		<van-popup v-model:show="state.getWayShow"
							 round
							 lock-scroll
							 position="bottom">
			<van-picker title="获取方式"
									:columns="state.getWayColumns"
									:columns-field-names="state.getWayColumnFieldName"
									@confirm="onGetWayConfirm"
									@cancel="state.getWayShow = false" />
		</van-popup>

		<!-- 住院记录 -->
		<van-popup v-model:show="state.ispShow"
							 position="bottom">
			<div class="treat">
				<div class="head">
					<div class="head_cancel"
							 @click="state.ispShow = false">取 消</div>
					<div class="head_title">选择住院记录</div>
					<div class="head_confirm"
							 @click="onIspConfirm">确 定</div>
				</div>
				<div class="treat_cont">
					<template v-if="state.treatRecord.length > 0">
						<section v-for="item in state.treatRecord"
										 :key="item.mzNum">
							<div class="cont_item"
									 :class="[treat.mzNum === item.mzNum ? 'border_click' : 'border_default']"
									 @click="onClickTreat(item)">
								<div><span>时&emsp;&emsp;间：</span><span>{{ item.registerDate }}</span></div>
								<div><span>患者姓名：</span><span>{{ item.patientName }}&emsp;&emsp;{{ item.patientId }}</span></div>
								<div><span>住院编号：</span><span>{{ item.mzNum }}</span></div>
								<div><span>主&emsp;&emsp;诉：</span><span>{{ item.complaint }}</span></div>
								<div><span>医生姓名：</span><span>{{ item.doctName }}</span></div>
								<div><span>西医诊断：</span><span>{{ item.diagnose }}</span></div>
								<div><span>中医诊断：</span><span>{{ item.diagnoseZY }}</span></div>
								<div class="item_checked"
										 v-if="treat.mzNum === item.mzNum">
									<van-icon name="passed"
														color="var(--color-primary)"
														size="20" />
								</div>
							</div>
						</section>
					</template>
					<van-empty v-else
										 image-size="100"
										 description="暂无住院记录" />
				</div>
			</div>
		</van-popup>
	</div>
</template>

<script>
import { reactive, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { axios } from 'axios'
export default {
	name: 'ptint-revserve',
	component: {
		'nav-header': VueConfig.vueLoader('@/components/tab-router.vue')
	},
	setup(props, context) {
		const route = useRoute();
		const router = useRouter();
		const formRef = ref(null)
		const state = reactive({
			getWayShow: false,          // 获取方式弹框
			getWayColumns: [            // 获取方式 
				{
					code: '0',
					label: '自提'
				}, {
					code: '1',
					label: '邮寄'
				}, {
					code: '2',
					label: '电子版'
				}
			],
			getWayColumnFieldName: {    // 获取方式列明
				text: 'label'
			},
			ispShow: false,             // 住院记录弹框
			treatRecord: [],            // 住院记录
			imgBlankError: {            // 照片
				ptImg1: false,
				ptImg2: false,
				applicantIdcImg1: false,
				applicantIdcImg2: false,
				agreementLetterImg: false
			}
		})
		const form = reactive({
			ispID: '',              // 住院号
			dx: '',                 // 诊断名称
			ptId: '',               // 病人ID
			ptName: '',             // 病人姓名
			deptID: '',             // 出院科室ID
			deptName: '',           // 出院科室
			ptIdcID: '',            // 身份证
			phone: '',              // 联系电话（邮寄时也填这个）
			applicantName: '',      // 委托代理人姓名
			applicantRel: '',       // 申请人与病人关系
			applicantRelId: '',     // 申请人与病人关系代码
			ptImg1: [],             // 本人身份证正面照片
			ptImg2: [],             // 本人身份证背面照片
			applicantIdcImg1: [],   // 申请人身份证正面照片
			applicantIdcImg2: [],   // 申请人身份证背面照片
			agreementLetterImg: [], // 申请书照片
			useWay: '',             // 模板 (templateName)
			useWayId: '',           // 模板id (templateNo)
			getWay: '',             // 获取方式:0.自提 1.邮寄 2.电子版
			address: ''             // 邮寄的地址
		})

		const formLabel = reactive({
			getWayLabel: ''
		})

		function getMedicalRecordList(){
			axios.post('/wx/xbd/getMedicalRecordList',{patientId: patientId}).then((resp) => {
				console.log(resp)
			})
		}

		/**
		 * 判断照片是否上传
		 */
		function isImgBlank() {
			let checked = 0
			Object.keys(state.imgBlankError).forEach(key => {
				if (form[key].length === 0) {
					checked++
					state.imgBlankError[key] = true
				} else if (form[key].length > 0 && state.imgBlankError[key]) {
					state.imgBlankError[key] = false
				}
			})
			return checked !== 0
		}

		/**
		 * 提交预约
		 */
		function onSubmit() {
			formRef.value.validate().then(() => {
				if (isImgBlank()) {
					return vant.Toast.fail('提交内容出现错误，请检查！')
				}
				vant.Dialog.confirm({
					title: '提示',
					message: '确定提交打印预约申请？'
				}).then(() => {
					// /wx/xbd/addMRReserve
					axios.post('/wx/xbd/addMRReserve', JSON.stringify(form)).then(response => {
						if (response.code === 200) {
							vant.Toast.success('预约成功')
						}
					})
				}).catch(() => { })
			}).catch(error => {
				console.log('error', error)
				vant.Toast.fail('提交内容出现错误，请检查！')
			})

		}

		/**
		 * 选择获取方式
		 * @param {Object} value 获取方式
		 */
		function onGetWayConfirm(value) {
			console.log(value)
			form.getWay = value.code
			formLabel.getWayLabel = value.label
			state.getWayShow = false
		}

		/**
		 * 选择住院记录
		 * @param {Object} value 住院记录
		 */
		function onIspConfirm(value) {

		}

		return {
			state,
			formRef,
			form,
			formLabel,
			onSubmit,
			onGetWayConfirm,
			onIspConfirm,
      getMedicalRecordList
		}
	},
}
</script>
<style scoped>
.ptint-revserve {
}
.img_item {
	border-bottom: 1px solid var(--border-c);
}
.img_item_label {
	line-height: 25px;
	padding: 5px 16px;
	color: #646566;
}
.img_item_upload {
	height: 150px;
	margin: 5px;
	border: 1px solid var(--border-d);
	border-radius: 5px;
}
.img_item_upload span {
	line-height: 30px;
	color: var(--text-c);
}

.img_item_upload >>> .van-uploader__wrapper,
.img_item_upload >>> .van-uploader__input-wrapper {
	width: 100%;
	height: 100%;
}
.img_item_upload >>> .van-uploader__preview,
.img_item_upload >>> .van-uploader__preview-image {
	width: 100%;
	height: 100%;
	margin: auto;
}
.img_item_upload >>> .van-uploader__preview-image img {
	object-fit: contain !important;
}
.img__blank_error {
	color: red;
	font-size: 12px;
	text-align: right;
	padding: 0px 10px 5px;
}
.ptint-revserve >>> .van-field__control {
	text-align: right;
}

.print-reserve >>> .van-field__value .van-field__error-message {
	text-align: right;
}
.footer {
	margin: 10px 5px;
}
.treat {
	width: 100%;
	height: 65vh;
	box-sizing: border-box;
	background-color: #fff;
	border-radius: 8px 8px 0 0;
	padding: 8px 5px;
}

.treat .head {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	padding: 5px 10px;
}

.head_cancel {
	color: var(--text-c);
}

.head_title {
	text-align: center;
}

.head_confirm {
	color: var(--color-primary);
}

.treat_cont {
	height: calc(100% - 40px);
	overflow: auto;
	padding: 8px;
}

.cont_item {
	padding: 8px 5px 5px;
	margin-bottom: 5px;
	border-radius: 5px;
	font-size: 13px;
	line-height: 20px;
	position: relative;
	overflow: hidden;
}

.cont_item div span:nth-child(1) {
	color: var(--text-b);
}

.cont_item div span:nth-child(2) {
	color: var(--text-a);
}

.border_default {
	border: #e2e2e2 solid 1px;
}

.border_click {
	border: var(--color-primary) solid 1px;
}

.item_checked {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 20px;
	height: 20px;
}

.treat_filed >>> .van-field__control {
	text-align: right;
}
</style>