<template>
	<view class="cnt_wrapper">
		<view class="wrap">
			<view class="p_cnt">
				<view class="p_cnt_list">
					<view>头像</view>
					<view class="text">
						<image style="width: 100rpx;height: 100rpx;" src="../../static/images/recordhead.png" mode="">
						</image>
					</view>
				</view>
				<view class="p_cnt_list">
					<view>昵称</view>
					<view class="text">
						<input type="text"  placeholder="请输入" value=''/>
					</view>
				</view>
				<view class="p_cnt_list">
					<view>手机号码</view>
					<view class="text">
						<input type="text"  placeholder="请输入" value=''/>
					</view>
				</view>
				<view class="p_cnt_list">
					<view>真实姓名</view>
					<view class="text">
						<input type="text"  placeholder="请输入" value=''/>
					</view>
				</view>
				<view class="p_cnt_list">
					<view>身份证号</view>
					<view class="text">
						<input type="text"  placeholder="请输入" value=''/>
					</view>
				</view>
				<view class="p_cnt_list">
					<view>医院登记的手机号</view>
					<view class="text">
						<input type="text"  placeholder="请输入" value=''/>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import { getRecord,getOrg } from '@/api/api.js';
	export default {
		data() {
			return {
				form:{
					sex:'',
					birthday:'',
					ID:'',
					Mobile:'',
					address:'',
					hospital:''
				},
				dialysis_no:'',
				name:'',
				
			}
		},
		onLoad(){
			this.name = this.$store.state.data.userInfo.name
			this.dialysis_no = this.$store.state.data.userInfo.dialysis_no
			this.form={
				sex: this.$store.state.data.userInfo.gender,
				ID: this.$store.state.data.userInfo.id_card_no,
				Mobile: this.$store.state.data.userInfo.phone,
				address: this.$store.state.data.userInfo.home_address,
			}
			let hospital = this.$store.state.data.userInfo.id
			// this.getOrg(hospital)
			// this.getIdInfo(this.form.ID)
		},
		methods: {
			// 删除就诊人
			// deleteP() {
			// },
			async getOrg(patient_id){
				let params = {
					patient_id:patient_id
				}
				let res = await getOrg(params)
				console.log('zzzzz',res);
				this.form.hospital = res.data.data.orgInfo.org_name
				console.log(this.form);
				// return this.form.hospital
			},
			getIdInfo(cardNo) {
			    var reg = /(^\d{15}$)|(^\d{17}([0-9]|X)$)/; //验证身份证号码的正则
			    if(reg.test(cardNo)){ // 身份证号码是否合法
			        var birthday = "";
			        var gender = "";
			        if (cardNo.length == 15) {
			            var org_birthday = cardNo.substring(6, 12);
			            var org_gender = cardNo.substring(14, 15);
			            birthday = "19" + org_birthday.substring(0, 2) + "-"
			                + org_birthday.substring(2, 4) + "-"
			                + org_birthday.substring(4, 6);
			        } else if (cardNo.length == 18) {
			            var org_birthday = cardNo.substring(6, 14);
			            var org_gender = cardNo.substring(16, 17);
			            birthday = org_birthday.substring(0, 4) + "-"
			                + org_birthday.substring(4, 6) + "-"
			                + org_birthday.substring(6, 8);
			        }
			        this.form.birthday=birthday
			    }else{
			        return false;
			    }
			},

		}
	}
</script>

<style lang="scss" scoped>
	.p_cnt {
		width: 93vw;
		margin: 20rpx auto;
		border-radius: 10rpx;
		background: #fff;
		
		.p_cnt_list {
			height: 100rpx;
			padding: 10rpx 50rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 30rpx;
			border-bottom: 1px solid gainsboro;
			.text{
				text-align: right;
			}
			// font-weight: bold;
		}
		
	}
</style>

