/*
 * Creator:     ML
 * CreatDate:
 * descripts：建卡登记(完整版)
 * */
import React from 'react';
import {
	Form,
	Row,
	Col,
	Input,
	Select,
	DatePicker,
	Button,
	Modal,
	message,
	Tooltip,
	Icon,
	Spin,
	TimePicker
} from 'antd';
import moment from 'moment';
import FindPatients from './FindPatients';
import PatientInformation from './PatientInformation';
import { $http } from '../../containers/config/https';
import fetchJsonp from 'fetch-jsonp';
import { Util } from 'tools/index';
import './css/error.less';
import { $loadTemplate } from '../lodop/Common/Print.js';
import ReadCard from '../../components/readcard/ReadCard';
// import BasicUpload from 'pages/health/component/BasicUpload'
import MlUtils from './MlUtils';
import FaceRecognitionManual from 'pages/common/FaceRecognitionManual';
import store from 'store';

import iconCard from 'assets/images/icon_card.png';
import iconMessage from 'assets/images/icon_messages.png';

const FormItem = Form.Item;
const Option = Select.Option;
const style = {
	padding: "0 6px"
}
const adressStyle = {
	width: '13.2%',
	padding: '0',
	marginRight: '14px'
}

const provinceStyle = {
	width: '13.2%',
	padding: '0',
	marginRight: '14px'
}
const nowAdStyle = {
	width: '10.2%',
	padding: '0',
	marginRight: '14px'
}
const formItemLayoutBirthTime = {
	labelCol: { span: 2 },
	wrapperCol: { span: 24 },
}
const formItemMoney = {
	labelCol: { span: 11 },
	wrapperCol: { span: 11 },
}
const formItemLayouAdress = {
	labelCol: { span: 8 },
	wrapperCol: { span: 16 },
}
const formItemMoreAdress = {
	labelCol: { span: 10 },
	wrapperCol: { span: 23 },
}
const formItemThreeAdress = {
	labelCol: { span: 10 },
	wrapperCol: { span: 24 },
}
const formItemLayoutBirth = {
	labelCol: { span: 7 },
	wrapperCol: { span: 17 },
}
const formItemNew = {
	labelCol: { span: 2 },
	wrapperCol: { span: 16 },
}
const formItemNewButton = {
	labelCol: { span: 2 },
	wrapperCol: { span: 22 },
}
let timer = undefined;
const confirm = Modal.confirm;
const RegisterPatCardComplete = Form.create()(
	class RegisterPatCardComplete extends React.Component {
		constructor(props) {
			let userData = JSON.parse(sessionStorage.getItem('userData'));
			super(props)
			this.state = {
				userData: userData,
				birthCity: [],//出生地市区信息
				birthAreas: [],//出生地县信息
				birthVillages: [],//出生地乡信息
				birthHamlets: [],//出生地村落信息

				nativeCity: [],//籍贯市区信息
				nativeAreas: [],//籍贯县信息
				nativeVillages: [],//籍贯乡信息
				nativeHamlets: [],//籍贯村落信息

				presentCity: [],//现住址市区信息
				presentAreas: [],//现住址县信息
				presentVillages: [],//现住址乡信息
				presentHamlets: [],//现住址村落信息

				registerCity: [],//户口地址市区信息
				registerAreas: [],//户口地址县信息
				registerVillages: [],//户口地址乡信息
				registerHamlets: [],//户口地址村落信息

				companyCity: [],//单位市区信息
				companyAreas: [],//单位县信息
				companyVillages: [],//单位乡信息
				companyHamlets: [],//单位村落信息

				contactCity: [],//紧急联系人市区信息
				contactAreas: [],//紧急联系人县信息
				contactVillages: [],//紧急联系人乡信息
				contactHamlets: [],//紧急联系人村落信息

				invoiceValue: '',
				loading: false,
				postLoading: false,//提交loading状态
				visible: false,
				baseParms: {},//下拉框信息
				parms: {},//接收查找病人传递来的信息
				patieParms: {},//接收关联病人传递来的信息

				bindDis: true,//绑卡操作按钮
				cardSatus: {},//当前录入卡
				isCancel: -1,//是否挂失
				patId: "",//病人信息id
				patientInfo: [],//病人关联信息
				visibleCardTips: false,//卡操作成功弹窗
				popCardVis: false,//卡操作 弹窗
				initpatCardID: "",//卡操作 弹窗 卡类型选择
				bindMoreInfo: false,//绑卡更多信息显示
				bindVail: true,
				canRetarCard: "N",//注销按钮
				cardInfo: {},

				patPresentOthID: "",//修改现住址Id
				patNativeOthID: "",//修改籍贯住址Id
				patRegisterOthID: "",//修改户口住址Id
				patCompanyOthID: "",//修改单位住址Id
				patBirthOthID: "",//修改出生住址Id
				patContactOthID: "",//修改联系人住址Id

				nowAdressProvinceId: 0,//现住址省id
				bornProvinceId: 0,//出生地省id
				nativeProvinceId: 0,//籍贯省id
				houseProvinceId: 0,//户口地址省id
				workProvinceId: 0,//单位省id
				eContactProvinceId: 0,//紧急联系人

				municipals: [],//市区信息
				countys: [],//县信息
				villages: [],//乡镇信息
				hamlets: [],//村落信息
				readLoading: false,//读卡loading状态
				credSex: '',//性别
				credBirthday: '',//出生日期
				credAge: '',//年龄
				provinceId: '',//匹配省级id
				proviceBornId: '',//匹配出生省级id
				proviceNativeId: '',//匹配籍贯省级id
				proviceHouseId: '',//匹配户口省级id
				proviceWorkId: '',//匹配工作单位省级id
				proviceContactId: '',//匹配联系人省级id
				credCountry: 44,//国家Id
				posType: "",//证件类型code
				credTypeID: "",//证件类型id
				socialTag: -1,//身份标签
				nowCost: 0,//当前卡费
				str: '',//地址标识
				nowRead: 'n',//卡类型设置是否可操作
				cardLength: "",//卡长度
				idCardCode: "",//身份证code
				idCardCodePop: "",//弹窗身份证code
				nowReadCard: 'n',//卡类型设置是否可操作 --卡操作
				nowReadCardPop: "n",//卡类型设置是否可操作 -- 弹窗
				cardLengthCard: "",//卡长度 ---卡长度
				autoCreateCardNo: "",
				autoCreateCardNoCard: "",//卡号是否自动生成
				replenishZero: "",//是否补0
				nowCard: '',//当前卡类型
				nowInv: '',//是否显示发票
				initCardDr: '',//默认卡类型
				isModefined: -1,//是否点击修改基本资料
				patiId: '',//病人id
				reciprocal: 2,//2S后关闭弹窗
				visibles: false,//是否弹取消补卡
				cardId: '',//记录头卡id
				isFlag: '',//卡操作
				originalNo: '',//卡操作---原卡号
				localProvince: [],//存第一次请求的loca 省
				localCity: [],//存第一次请求的loca 市
				localArea: [],//存第一次请求的loca 县
				selfCredNo: '',//修改前的身份证号
				bindCardArr: [],//已绑卡类型
				allDis: false,//全部锁定建卡类型
				cardNoVisible: false,//建卡卡号错误提示 - title框显示
				cardNoMessage: "",//建卡卡号错误提示 - 文字信息
				posVisible: false,//身份证号码错误提示 - title框显示
				posMessage: "",//身份证号码错误提示 - 文字信息
				patNameVisible: false,//病人姓名错误提示 - title框显示
				patNameMessage: "",//病人姓名错误提示 - 文字信息
				econNameVisible: false,//联系人姓名错误提示 - title框显示
				econRelationMessage: "",//联系人关系错误提示 - 文字信息
				econRelationVisible: false,//联系人关系错误提示 - title框显示
				econNameMessage: "",//联系人姓名错误提示 - 文字信息
				patBirthVisible: false,//病人出生日期错误提示 - title框显示
				patBirthMessage: "",//病人出生日期错误提示 - 文字信息
				patTypeVisible: false,//病人类型错误提示 - 文字信息
				patTypeMessage: "",//病人类型错误提示 - 文字信息
				patAdressVisible: false,//详细地址错误提示 - 文字信息
				patAdressMessage: "",//详细地址错误提示 - 文字信息
				patAdressMessageZip: "",//详细地址邮编错误提示 - 文字信息
				patAdressZipVisible: false,
				patAdressHouseMessageZip: "",//详细地址户口邮编错误提示 - 文字信息
				patAdressHouseZipVisible: false,
				patAdressComMessageZip: "",//详细地址单位邮编错误提示 - 文字信息
				patAdressComZipVisible: false,

				cardPayMentID: "",//当前操作注销的卡
				econPhoneVisible: false,
				econPhoneMessage: "",

				changeCardVisible: false,//换卡操作错误提示
				changeCardMessage: "",//换卡操作错误文字提示
				patchCardVisible: false,//补卡操作错误提示
				patchCardMessage: "",//补卡操作错误文字提示
				bindCardVisible: false,//绑卡操作错误提示
				bindCardMessage: "",//绑卡操作错误文字提示
				canSave: false,
				credWarning: false,
				formatType: true,//日期手动录入
				noCard: true,//绑卡显示
				repariFeeFlag: "N",//费用置为0或空
				repariFeeFlagCard: "N",//卡操作 费用置为0或空
				nowCostCard: 0,
				readInfoLoading: false,//无卡时loading信息

				noSend: true,//优化 回车后失去焦点二次请求
				findPatNo: "",//记录上一条查找病人
				birthData: "",
				birthTime: "",
				isTransitionStart: false,
				openTime: false,
				bindCardType: "",
				canNext: true,

				birthDoor: true,//出生地址
				nativeDoor: true,//籍贯地址
				presentDoor: true,//现住址
				registerDoor: true,//户口地址
				companyDoor: true,//单位地址
				contactDoor: true,//联系人地址
				patBarPatID: "",//patID
				credMustFlag: "N",//挂号配置设置目前医院是否必填证件类型和证件号码
				faceImg: "",
				faceImgAdress: "",
				imageUrl: "",
				inBoxStatus: '', //输入框状态
				addressSame: 'N', // 读卡时现住址和单位地址是否和户口地址保持一致
				requireFlag: {}, // 必填标志 - 卡信息维护 - 按医院
			}
			this.readOneButton = React.createRef();

			this.cardNo = React.createRef();
			this.patName = React.createRef();
			this.sex = React.createRef();
			this.credType = React.createRef();
			this.patCredNo = React.createRef();
			this.patBirthDate = React.createRef();
			this.patMobile = React.createRef();
			this.telphone = React.createRef();
			this.patType = React.createRef();
			this.nation = React.createRef();
			this.patMaritalID = React.createRef();
			this.patAddress = React.createRef();
			this.cardPayMethodID = React.createRef();
			this.creadCard = React.createRef();

			this.province = React.createRef();
			this.city = React.createRef();
			this.country = React.createRef();
			this.village = React.createRef();
			this.hamlet = React.createRef();

			this.bornProvince = React.createRef();
			this.birthCity = React.createRef();
			this.bornCountry = React.createRef();
			this.bornVillage = React.createRef();
			this.bornHamlet = React.createRef();
			this.birthAddress = React.createRef();

			this.nativeProvince = React.createRef();
			this.nativeCity = React.createRef();
			this.nativeCountry = React.createRef();
			this.nativeVillage = React.createRef();
			this.nativeHamlet = React.createRef();
			this.nativeAddress = React.createRef();

			this.houseProvince = React.createRef();
			this.houseCity = React.createRef();
			this.houseCountry = React.createRef();
			this.houseVillage = React.createRef();
			this.houseHamlet = React.createRef();
			this.houseAddress = React.createRef();
			this.registerZIP = React.createRef();

			this.companyProvince = React.createRef();
			this.companyCity = React.createRef();
			this.companyCountry = React.createRef();
			this.companyVillage = React.createRef();
			this.companyHamlet = React.createRef();
			this.companyAddress = React.createRef();
			this.companyZIP = React.createRef();

			this.patSocialStatusID = React.createRef();
			this.patSourceID = React.createRef();
			this.econProvince = React.createRef();
			this.econCity = React.createRef();
			this.econCountry = React.createRef();
			this.econVillage = React.createRef();
			this.econHamlet = React.createRef();
			this.contactsAddress = React.createRef();

			this.econName = React.createRef();
			this.econMobile = React.createRef();
			this.econRelation = React.createRef();

			this.patCompany = React.createRef();
			this.patCompanyTel = React.createRef();

			this.changeCard = React.createRef();
			this.patchCard = React.createRef();
			this.creadCardPop = React.createRef();
			this.creadCardPops = React.createRef();
			this.bindNewCard = React.createRef();
			this.bindCardNu = React.createRef();
			this.bindCardButton = React.createRef();

			this.companyZIP = React.createRef();
			this.registerZIP = React.createRef();
			this.presentZIP = React.createRef();

			this.changeOkButton = React.createRef();
			this.patchOkButton = React.createRef();
			this.bindOkButton = React.createRef();
			this.upLoadRef = React.createRef();
			this.educationID = React.createRef();
		}

		componentDidMount() {
			// //卡号输入框高亮
			// setTimeout(() => {
			//     this.cardNo.current.focus();
			// }, 800)
			this.initData()
			let self = this
			document.addEventListener("keydown", function (e) {
				self.KeyDowns(e)
			})
			this.getPatForm()
			let data = {}
			data = {
				params: [{
					cardTypeFlag: 1,//卡类型
					credTypeFlag: 1,//证件类型
					patTypeFlag: 1,//病人类型
					sexFlag: 1,	//性别
					countryFlag: 1,	//国家
					nationFlag: 1,//民族
					occupationFlag: 1,//职业
					maritalFlag: 1,	//婚姻
					socialStatusFlag: 1,//身份标签
					ageUnitFlag: '',
					payMethodFlag: 1,
					eduFlag: 1,
					provinceFlag: localStorage.getItem('province') != null ? '' : 1,	//省
					cityFlag: localStorage.getItem('city') != null ? '' : 1,  //市
					// areaFlag: localStorage.getItem('area') != null ? '' : 1,//县
					relationFlag: 1,
					hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
				}]
			}
			$http.post('urlS', this, {
				code: '03030005',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							baseParms: res,
							nationData: res.nation,
							patCardTypeData: res.credType,
							invoiceValue: res.transactionNo,
							credSex: res.sex[0].code,
							credMustFlag: res.credMustFlag,
							addressSame: res.addressSame
						}, () => {

							//接收挂号页面
							if (this.getQueryString("cardTypeId") != null) {
								var scource = JSON.parse(sessionStorage.getItem('readCardMsg'))
								var code = ''
								var nationData = this.state.patCardTypeData;
								if (!Util.isEmpty(nationData)) {
									for (var i = 0; i < nationData.length; i++) {
										if (!Util.isEmpty(this.state.source)) {
											if (this.state.source.patCredTypeID == nationData[i].id) {
												code = nationData[i].code
											}
										}
									}
								}
								res.cardType.map((item, i) => {
									if (this.getQueryString("cardTypeId") == item.id) {
										this.setState({
											initCardDr: item.id,
											cardTypeID: this.getQueryString("cardTypeId"),
											nowRead: res.cardType[i].readMode,
											idCardCode: res.cardType[i].code,
											cardLength: res.cardType[i].cardLength && res.cardType[i].cardLength != "" ? res.cardType[i].cardLength + "位," : "",
											cardLengthInput: res.cardType[i].cardLength,
											replenishZero: res.cardType[i].replenishZero,
											repariFeeFlag: res.cardType[i].repariFeeFlag,
											educationList: res.cardType[i].education,
											nowCost: res.cardType[i].cardCost,
											nowInv: res.cardType[i].invFlag,
											autoCreateCardNo: res.cardType[i].autoCreateCardNo,
										}, () => {
											this.getDefaultAdress()
										})
										if (!Util.isEmpty(scource)) {
											this.props.form.setFieldsValue({
												cardPayMethodID: res.payMethod && res.payMethod.length > 0 ? res.payMethod[i].id : undefined,
												payMethods: res.payMethod && res.payMethod.length > 0 ? res.payMethod[i].id : undefined,
												patCredNo: this.getQueryString("paitId") && this.getQueryString("paitId").length == 18 ? this.getQueryString("paitId") : undefined,
												// patName: !Util.isEmpty(scource) ? scource.name : undefined,
												// patBirthDate: !Util.isEmpty(scource) ? moment(scource.birth,'YYYY-MM-DD') : undefined,
												// patName: !Util.isEmpty(scource) ? scource.name : '',
												// registerAddress: !Util.isEmpty(scource) ? scource.address : '',
												// patBirthDate: !Util.isEmpty(scource) ? moment(scource.birth, 'YYYY-MM-DD') : '',
												// // patCredNo: !Util.isEmpty(that.state.source) ? that.state.source.IDCardNo : '',
												// patSexCode: !Util.isEmpty(scource) ? scource.sex : '',
												// patNationID: code,
												patName: !Util.isEmpty(scource) ? scource.patName : '',
												registerAddress: !Util.isEmpty(scource) ? scource.address : '',
												patBirthDate: !Util.isEmpty(scource) ? moment(scource.patBirthDate, 'YYYY-MM-DD') : '',
												patCredNo: !Util.isEmpty(scource) ? scource.patCredNo : '',
												patCredTypeID: !Util.isEmpty(scource) ? scource.patCredTypeID : '',
												patCredTypeCode: code,
												patSexCode: !Util.isEmpty(scource) ? scource.patSexID : '',
												age: !Util.isEmpty(scource) ? scource.patAge : '',
												patNationID: !Util.isEmpty(scource) ? scource.patNationID : '',
												registerProvinceID: !Util.isEmpty(scource) ? scource.patRegisterProvinceID : '',
												registerCityID: !Util.isEmpty(scource) ? scource.patRegisterCityID : '',
												registerAreaID: !Util.isEmpty(scource) ? scource.patRegisterAreaID : '',
												registerAddress: !Util.isEmpty(scource) ? scource.patRegisterAddressDesc : '',
												registerVillageID: !Util.isEmpty(scource) ? scource.patRegisterVillageID : '',
											}, () => {
												this.autoFocusCountry("register")
												this.autoFocusVillage('register')
											})
										} else {
											this.props.form.setFieldsValue({
												cardPayMethodID: res.payMethod && res.payMethod.length > 0 ? res.payMethod[i].id : undefined,
												payMethods: res.payMethod && res.payMethod.length > 0 ? res.payMethod[i].id : undefined,
											})
										}
									}
								})
								if (this.getQueryString("cardNum") != null) {
									if (this.state.autoCreateCardNo == "Y") {
										this.props.form.setFieldsValue({ cardTypeID: this.getQueryString("cardTypeId"), cardNo: undefined })
										setTimeout(() => {
											this.patName.current.focus();
										}, 600)
									} else {
										this.props.form.setFieldsValue({ cardTypeID: this.getQueryString("cardTypeId"), cardNo: this.getQueryString("cardNum") }, () => {
											this.handleNoPopInmation()
										})
									}
								} else {
									if (this.state.autoCreateCardNo == "Y") {
										this.props.form.setFieldsValue({ cardTypeID: this.getQueryString("cardTypeId"), cardNo: undefined })
										setTimeout(() => {
											this.patName.current.focus();
										}, 600)
									}
									else if (this.state.nowRead == "R" && this.state.autoCreateCardNo != "Y") {
										this.props.form.setFieldsValue({ cardTypeID: this.getQueryString("cardTypeId"), cardNo: undefined })
										setTimeout(() => {
											this.readOneButton.current.buttonNode.focus();
										}, 300)
									} else {
										//卡号输入框高亮
										this.props.form.setFieldsValue({ cardTypeID: this.getQueryString("cardTypeId"), cardNo: this.getQueryString("cardNum") })
										if (this.cardNo.current && this.cardNo.current) {
											setTimeout(() => {
												this.cardNo.current.focus();
											}, 600)
										}
									}
								}
							} else {
								//卡号输入框高亮
								// setTimeout(() => {
								//     this.cardNo.current.focus();
								// }, 600)
								res.cardType.map((item, i) => {
									if (item.defaultFlag == "Y") {
										this.setState({
											initCardDr: item.id,
											nowRead: item.readMode,
											idCardCode: item.code,
											cardLength: item.cardLength && item.cardLength != "" ? item.cardLength + "位," : "",
											cardLengthInput: item.cardLength,
											autoCreateCardNo: item.autoCreateCardNo,
											replenishZero: item.replenishZero,
											repariFeeFlag: item.repariFeeFlag,
											nowCost: item.cardCost,
											nowInv: item.invFlag,
										}, () => {
											this.getDefaultAdress()
										})
										if (item.autoCreateCardNo == "Y") {
											setTimeout(() => {
												this.patName.current.focus();
											}, 300)
										} else {
											if (item.readMode == "R") {
												setTimeout(() => {
													this.readOneButton.current.buttonNode.focus();
												}, 300)
											} else {
												//卡号输入框高亮
												if (this.cardNo.current && this.cardNo.current) {
													setTimeout(() => {
														this.cardNo.current.focus();
													}, 600)
												}
											}
										}

									}
									if (res.cardType[i].defaultFlag == "N") {
										this.setState({
											initCardDr: res.cardType[0].id,
											nowRead: res.cardType[0].readMode,
											idCardCode: res.cardType[0].code,
											cardLength: res.cardType[0].cardLength && res.cardType[0].cardLength != "" ? res.cardType[0].cardLength + "位," : "",
											cardLengthInput: res.cardType[0].cardLength,
											autoCreateCardNo: res.cardType[0].autoCreateCardNo,
											replenishZero: res.cardType[0].replenishZero,
											repariFeeFlag: res.cardType[0].repariFeeFlag,
											nowCost: res.cardType[0].cardCost,
											nowInv: res.cardType[0].invFlag,

										}, () => {
											this.getDefaultAdress()
										})
										if (res.cardType[0].autoCreateCardNo == "Y") {
											setTimeout(() => {
												this.patName.current.focus();
											}, 300)
										} else {
											if (res.cardType[0].readMode == "R") {
												setTimeout(() => {
													this.readOneButton.current.buttonNode.focus();
												}, 300)
											} else {
												//卡号输入框高亮
												if (this.cardNo.current && this.cardNo.current) {
													setTimeout(() => {
														this.cardNo.current.focus();
													}, 600)
												}
											}
										}
									}
								})
								this.props.form.setFieldsValue({
									cardPayMethodID: res.payMethod && res.payMethod.length > 0 ? res.payMethod[0].id : undefined,
									payMethods: res.payMethod && res.payMethod.length > 0 ? res.payMethod[0].id : undefined
								})
							}
						})
						if (JSON.parse(localStorage.getItem('province')) && JSON.parse(localStorage.getItem('province')).length > 0) {
							this.setState({
								localProvince: JSON.parse(localStorage.getItem('province'))
							})
						} else {
							localStorage.setItem('province', JSON.stringify(res.province))
							this.setState({
								localProvince: res.province
							})
						} if (JSON.parse(localStorage.getItem('city')) && JSON.parse(localStorage.getItem('city')).length > 0) {
							this.setState({
								localCity: JSON.parse(localStorage.getItem('city'))
							})
						} else {
							localStorage.setItem('city', JSON.stringify(res.city))
							this.setState({
								localCity: res.city
							})

						}
					} else {

					}
				}
			})
			this.handleAdress()
		}

		componentWillUnmount() {
			setTimeout(() => {
				sessionStorage.removeItem('readCardMsg')
			}, 1000)
			this.setState = (state, callback) => { return; };
		}

		initData() {
			let data = {
				params: [{
					compontName: "RegistrationCard",
					type: "C",
					reactCode: ['RegistrationCard']
				}]
			}
			$http.post('urlDeault', this, {
				code: "01040073",
				data: data,
				success: (res) => {
					if (+res.errorCode === 0) {
						this.setState({
							localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN
						})
					}
				}
			})
		}

		//动态配置是否必填
		setMessage(name, message) {
			return this.state.localeProvider && this.state.localeProvider[name] ? this.state.localeProvider[name][message] : ''
		}

		handleAdress = () => {
			let data = {}
			data = {
				params: [{
					hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
					userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
					locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "",
				}]
			};

			$http.post('urlDeault', this, {
				code: "03030114",
				data: data,
				success: function (res) {
					if (res.errorCode == '0') {
						let windowHost = ''
						let url = ''
						if (process.env.NODE_ENV === 'production') {
							windowHost = window.location && window.location.origin ? window.location.origin : (window.location && window.location.protocol ? (window.location.protocol + '//' + window.location.hostname) : "");
							url = !Util.isEmpty(res.result) ? res.result.upLoadUrl : '';
						} else {
							windowHost = 'https://172.16.1.6'
							url = !Util.isEmpty(res.result) ? res.result.upLoadUrl : '';
						}
						this.setState({
							actionUrl: !Util.isEmpty(res.result) ? res.result.upLoadUrl : '',
							downLoadUrl: !Util.isEmpty(res.result) ? res.result.downLoadUrl : '',
							faceImgAdress: url.indexOf("http") !== -1 ? url : windowHost + url,
							imageAddress: url.indexOf("http") !== -1 ? url : windowHost + res.result.downLoadUrl
						}, () => {
							console.dir(this.state.faceImgAdress)
						})
					}
				}
			});
		}

		handleChange(value) {
		}

		onTitRef = (ref) => {
			this.childTitle = (ref)
		}

		// 默认取医院地址
		getDefaultAdress = () => {
			let data = {}
			data = {
				params: [{
					hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
					groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
					cardTypeID: this.state.initCardDr || this.state.cardTypeID,
				}]
			}
			$http.post('urlS', this, {
				code: '04150018',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							parms: res.result,
							requireFlag: res?.requireFlag || {}, // 卡信息维护必填标志 - 根据医院走的
							// credTypeID: !Util.isEmpty(res.result) ? res.result.credTypeID : undefined,
						}, () => {
							var scource = JSON.parse(sessionStorage.getItem('readCardMsg'))
							this.props.form.setFieldsValue({
								patSexCode: !Util.isEmpty(scource) && !Util.isEmpty(scource.patSexID) ? scource.patSexID : (!Util.isEmpty(res.result) ? res.result.sexCode : undefined),
								patCountryID: !Util.isEmpty(res.result) ? res.result.countryID : undefined,
								patCredTypeCode: !Util.isEmpty(res.result) ? res.result.credTypeCode : undefined,
								patNationID: !Util.isEmpty(res.result) ? res.result.nationID : undefined,
								patOccupationID: !Util.isEmpty(res.result) ? res.result.occupationID : undefined, // 默认职业 - 卡信息设置维护
							})
						})
					}
				}
			})
		}

		updataTrans = () => {
			let data = {}
			data = {
				params: [{
					hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
				}]
			}
			$http.post('urlS', this, {
				code: '03030005',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							invoiceValue: res.transactionNo,
							credMustFlag: res.credMustFlag,
						})
					}
				}
			})
		}

		range(start, end) {
			const result = [];
			for (let i = start; i < end; i++) {
				result.push(i);
			}
			return result;
		}

		//秒禁止
		disabledDateTime = () => {
			let that = this
			return {
				disabledSeconds: () => that.range(1, 60),
			};
		}

		//取消挂失 / 挂失 注销   成功后  再次请求更新状态
		cardSuccess = (flag, id) => {
			let datas = {}
			//卡收费记录
			if (this.state.cardPayMentID != "") {
				datas = {
					params: [{
						cardID: id,
						flag: flag,
						card: {
							recordID: this.state.cardPayMentID,//
							cost: this.state.nowCost,//卡费
							payWID: "",//支付方式
						}
					}],
				}
			} else {
				datas = {
					params: [{
						cardID: id,
						flag: flag,
					}],
				}
			}
			$http.post('urlS', this, {
				code: '03030010',
				data: datas,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							visibleCardTips: true,
							reciprocal: 2,
							// visible:false,
						})
						this.timerStart()
						// this.childTitle.titVisible()
						//   this.props.handleEdit('','Other','')
					} else {
					}
				}
			})
		}

		//补卡 换卡 就诊卡自动补0
		chaeckLength = (flag) => {
			if (flag == 3) {
				if (this.state.replenishZero == "Y"
					&& parseInt(this.state.cardLengthCard) && parseInt(this.state.cardLengthCard) > 0
					&& this.props.form.getFieldValue('cardNumber')
					&& this.props.form.getFieldValue('cardNumber').length != 0) {
					let No = this.props.form.getFieldValue('cardNumber') ? this.props.form.getFieldValue('cardNumber') : ''
					let length = parseInt(this.state.cardLengthCard)
					let num = (Array(length).join(0) + No).slice(-length)
					this.props.form.setFieldsValue({ cardNumber: num });
					this.props.form.setFieldsValue({ cardNumber: num });
					// this.checkIs()
				}
			} else {
				if (this.state.replenishZero == "Y"
					&& parseInt(this.state.cardLengthCard) && parseInt(this.state.cardLengthCard) > 0
					&& this.props.form.getFieldValue('patchNumber')
					&& this.props.form.getFieldValue('patchNumber').length != 0) {
					let No = this.props.form.getFieldValue('patchNumber') ? this.props.form.getFieldValue('patchNumber') : ''
					let length = parseInt(this.state.cardLengthCard)
					let num = (Array(length).join(0) + No).slice(-length)
					this.props.form.setFieldsValue({ patchNumber: num });
					this.props.form.setFieldsValue({ patchNumber: num });
					// this.checkIs()
				}

			}
		}

		//进行卡后验证
		checkIs() {
			if ((this.props.form.getFieldValue('cardBindNo') && this.props.form.getFieldValue('cardBindNo').length > 0)
				|| (this.props.form.getFieldValue('cardNumber') && this.props.form.getFieldValue('cardNumber').length > 0)
				|| (this.props.form.getFieldValue('patchNumber') && this.props.form.getFieldValue('patchNumber').length > 0)
			) {
				if (this.props.form.getFieldValue('newCard') && this.props.form.getFieldValue('newCard')) {
					let data = {}
					if (this.state.isFlag == 3 || this.state.isFlag == 4) {
						if (this.state.isFlag == 3) {
							data = {
								params: [{
									cardTypeID: this.props.form.getFieldValue('newCard') ? this.props.form.getFieldValue('newCard') : '',
									cardNo: this.props.form.getFieldValue('cardNumber') ? this.props.form.getFieldValue('cardNumber') : '',
									credTypeCode: '',
									credNo: ''
								}],
							}
						} else {
							data = {
								params: [{
									cardTypeID: this.props.form.getFieldValue('newCard') ? this.props.form.getFieldValue('newCard') : '',
									cardNo: this.props.form.getFieldValue('patchNumber') ? this.props.form.getFieldValue('patchNumber') : '',
									credTypeCode: '',
									credNo: ''
								}],
							}
						}
					} else {
						data = {
							params: [{
								cardTypeID: this.props.form.getFieldValue('newCard') ? this.props.form.getFieldValue('newCard') : '',
								cardNo: this.props.form.getFieldValue('cardBindNo') ? this.props.form.getFieldValue('cardBindNo') : '',
								patName: this.props.form.getFieldValue('patName') ? this.props.form.getFieldValue('patName') : '',
								patMobile: this.props.form.getFieldValue('patMobile') ? this.props.form.getFieldValue('patMobile') : '',
								credTypeCode: '',
								credNo: ''
							}],
						}
					}

					$http.post('urlS', this, {
						code: '03030009',
						data: data,
						success: function (res) {
							if (+res.errorCode === 0 && res.result.data.length > 0) {
								var str = "";
								str = res.result.patInfo.patNo;
								//判断接口请求成功数据是否返回成功
								// this.setState({
								//   readLoading: false
								// })
								for (var i = 0; i < res.result.data.length; i++) {
									if (this.state.isFlag == 3 || this.state.isFlag == 4) {
										if (this.props.form.getFieldValue('cardNumber') != res.result.data[i].cardNo) {
											message.warning('卡号已存在,病人ID：' + str, this.state.userData && this.state.userData.messageTime);
											return
										}
										if (this.props.form.getFieldValue('patchNumber') != res.result.data[i].cardNo) {
											message.warning('卡号已存在,病人ID：' + str, this.state.userData && this.state.userData.messageTime);
											return
										}
										if (this.state.isFlag == 3) {
											if (
												this.props.form.getFieldValue('cardNumber') == res.result.data[i].cardNo && (res.result.data[i].cardStatusDesc == "作废")
											) {
												message.warning('该卡卡号已被作废', this.state.userData && this.state.userData.messageTime);
												this.setState({
													bindVail: true
												})
												return
											}
											if (
												(this.props.form.getFieldValue('cardNumber') == res.result.data[i].cardNo && (res.result.data[i].cardStatusDesc != "回收" || res.result.data[i].cardStatusDesc != "退卡"))
											) {
												if (res.result.data[i].code == "12") {
													message.warning('非本人证件号码，不能绑定', this.state.userData && this.state.userData.messageTime)
												} else {
													message.warning('卡号已存在,病人ID：' + str, this.state.userData && this.state.userData.messageTime);
												}
												this.setState({
													bindVail: true,
													bindMoreInfo: false,
												})
												return
											}
										} else {
											if (
												this.props.form.getFieldValue('patchNumber') == res.result.data[i].cardNo && (res.result.data[i].cardStatusDesc == "作废")
											) {
												message.warning('该卡卡号已被作废', this.state.userData && this.state.userData.messageTime);
												this.setState({
													bindVail: true
												})
												return
											}
											if (
												(this.props.form.getFieldValue('patchNumber') == res.result.data[i].cardNo && (res.result.data[i].cardStatusDesc != "回收" || res.result.data[i].cardStatusDesc != "退卡"))
											) {
												if (res.result.data[i].code == "12") {
													message.warning('非本人证件号码，不能绑定', this.state.userData && this.state.userData.messageTime)
												} else {
													message.warning('卡号已存在,病人ID：' + str, this.state.userData && this.state.userData.messageTime);
												}
												this.setState({
													bindVail: true,
													bindMoreInfo: false,
												})
												return
											} else {
												message.warning('卡号已存在,病人ID：' + str, this.state.userData && this.state.userData.messageTime);
											}
										}

									} else {
										if (this.props.form.getFieldValue('cardBindNo') == res.result.data[i].cardNo && (res.result.data[i].cardStatusDesc == "作废")) {
											message.warning('该卡卡号已被作废', this.state.userData && this.state.userData.messageTime);
											this.setState({
												bindVail: true,
												bindMoreInfo: false,
											})
											return
										}
										if (this.props.form.getFieldValue('cardBindNo') == res.result.data[i].cardNo && (res.result.data[i].cardStatusDesc != "回收" || res.result.data[i].cardStatusDesc != "退卡")) {
											str = res.result.patInfo.patNo;
											if (res.result.data[i].code == "12") {
												message.warning('非本人证件号码，不能绑定', this.state.userData && this.state.userData.messageTime)
											} else {
												message.warning('卡号已存在,病人ID：' + str, this.state.userData && this.state.userData.messageTime);
											}
											this.setState({
												bindVail: true,
												bindMoreInfo: false,
											})
											return
										}
									}
								}

							}
							if (+res.errorCode === 0 && res.result.data.length == 0) {
								if (this.state.nowCostCard != 0 && this.state.repariFeeFlagCard != "Y" && this.state.isFlag != 3 && this.state.isFlag != 4) {
									this.setState({
										bindVail: false,
										bindMoreInfo: true,
										// flag: 7,
										isFlag: 7
									})
									setTimeout(() => {
										this.bindOkButton.current.buttonNode.focus();
									}, 300)
									this.props.form.setFieldsValue({ transactionNo: this.state.baseParms.transactionNo })
								} else {
									this.setState({
										bindMoreInfo: false,
										bindVail: false,
										// isFlag:-1
									})
									if (this.state.isFlag == 3) {
										setTimeout(() => {
											this.changeOkButton.current.buttonNode.focus();
										}, 300)
										return
									}
									if (this.state.isFlag == 4) {
										setTimeout(() => {
											this.patchOkButton.current.buttonNode.focus();
										}, 300)
										return
									}
									if (this.state.isFlag == 6 || this.state.isFlag == 7 || flag == 6) {
										setTimeout(() => {
											this.bindOkButton.current.buttonNode.focus();
										}, 300)
										return
									}
								}
								if (this.state.isFlag == 3 || this.state.isFlag == 4) {
									this.setState({
										bindVail: false,
										// isFlag:-1
									})
									if (this.state.isFlag == 3) {
										setTimeout(() => {
											this.changeOkButton.current.buttonNode.focus();
										}, 300)
									}
									if (this.state.isFlag == 4) {
										setTimeout(() => {
											this.patchOkButton.current.buttonNode.focus();
										}, 300)
									}
									this.props.form.setFieldsValue({ transactionNo: this.state.baseParms.transactionNo })
								}
							}
						}, error: function () {
							this.setState({
								bindVail: true
							})
						}
					})
				} else {
					this.setState({
						bindVail: true,
					})
					message.warning('请选择建卡类型', this.state.userData && this.state.userData.messageTime);
				}
			} else {
				this.setState({
					bindVail: true,
				})
				//   message.warning('请输入卡号');
			}
		}

		//检测卡长度
		checkLength = () => {
			if (this.state.replenishZero == "Y"
				&& parseInt(this.state.cardLengthCard) && parseInt(this.state.cardLengthCard) > 0
				&& this.props.form.getFieldValue('cardBindNo')
				&& this.props.form.getFieldValue('cardBindNo').length != 0) {
				let No = this.props.form.getFieldValue('cardBindNo') ? this.props.form.getFieldValue('cardBindNo') : ''
				let length = parseInt(this.state.cardLengthCard)
				let num = (Array(length).join(0) + No).slice(-length)
				this.props.form.setFieldsValue({ cardBindNo: num });
				this.props.form.setFieldsValue({ cardBindNom: num });
				// this.checkIs()
			}
		}

		handleOnKeydown = (e) => {
			var e = window.event || e;
			switch (e.keyCode) {
				case 13:
					e.preventDefault()
					this.handleFlag(this.state.isFlag)
					break;
			}
		}

		//选择卡操作确认
		handleFlag = (flag) => {
			const { cardInfo, patId, isFlag } = this.state
			if (flag == 3 || flag == 4) {
				let datas = {}
				datas = {
					params: [{
						// this.state.cardInfo.patCardID,
						cardID: cardInfo.cardID,
						flag: flag,
						newCard: {
							patID: this.state.patiId,
							cardTypeID: this.props.form.getFieldValue('newCard'),
							cardNo: flag == 3 ? this.props.form.getFieldValue('cardNumber') : this.props.form.getFieldValue('patchNumber'),
							userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
							cardCost: flag == 4 && cardInfo.cardCost != 0 && cardInfo.cardCost != "" ? cardInfo.cardCost : undefined,
							ip: flag == 4 && cardInfo.cardCost != 0 && cardInfo.cardCost != "" ? (React.$getSessionData('ipConfig')?.ipv4 || '') : undefined,
							cardPayMethodID: flag == 4 && cardInfo.cardCost != 0 && cardInfo.cardCost != "" ? this.props.form.getFieldValue('payMethods') : undefined,
							tradeNum: flag == 4 && cardInfo.cardCost != 0 && cardInfo.cardCost != "" ? this.state.baseParms.transactionNo : undefined,
						}
					}],
				}
				$http.post('urlS', this, {
					code: '03030010',
					data: datas,
					success: function (res) {
						if (+res.errorCode === 0) {
							if (res.print && res.print.length > 0) {
								$loadTemplate("CardFeeReceipt", res.print);
							}
							this.setState({
								popCardVis: false,
								visibleCardTips: true,
								reciprocal: 2,
							})
							this.timerStart()
							// this.childTitle.titVisible()
						} else {
							this.setState({

							})
						}
					},
					error: function () {
						this.setState({

						})
					}
				})
			}
			if (flag == 7 || flag == 6) {
				this.setState({
					bindCardType: ""
				})
				this.state.baseParms.cardType.map((item, i) => {
					if (this.props.form.getFieldValue('newCard') == item.id) {
						this.setState({
							bindCardType: item.descripts
						})
					}
				})
				let data = {}
				//未设置仅补卡时收费 且 有卡费时
				if (this.state.repariFeeFlagCard != "Y" && this.state.nowCostCard != 0 && this.state.nowCostCard != "") {
					data = {
						params: [{
							userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
							hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
							groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
							locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "",
							patient: {
								patID: this.state.patiId,
								active: "",
								createUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
								companyTel: ''
							},
							card: {
								cardTypeID: this.props.form.getFieldValue('newCard'),
								cardNo: this.props.form.getFieldValue('cardBindNo'),
								userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
								cardCost: this.state.repariFeeFlagCard != "Y" ? this.state.nowCostCard : "0",
								ip: React.$getSessionData('ipConfig').ipv4 || '',
								cardPayMethodID: this.props.form.getFieldValue('payMethods'),
								tradeNum: this.state.baseParms.transactionNo,
							},
							accm: {
								passWord: "",
								deposit: "",
								groupFlag: "",
							},

						}]
					}
				} else {
					data = {
						params: [{
							userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
							hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
							groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
							locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "",
							patient: {
								patID: this.state.patiId,
								active: "",
								createUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
								companyTel: ''
							},
							card: {
								cardTypeID: this.props.form.getFieldValue('newCard'),
								cardNo: this.props.form.getFieldValue('cardBindNo'),
								userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
							},
							accm: {
								passWord: "",
								deposit: "",
								groupFlag: "",
							},

						}]
					}
				}
				$http.post('urlS', this, {
					code: '03030003',
					data: data,
					success: function (res) {
						if (+res.errorCode === 0) {
							if (res.print && res.print.length > 0) {
								$loadTemplate("CardFeeReceipt", res.print);
							}
							if (res.patBarcode && res.patBarcode) {
								if (res.patBarcode.printStr.length > 0 && res.patBarcode.template.length > 0) {
									$loadTemplate(res.patBarcode.template, res.patBarcode.printStr);
								}
							}
							if (this.state.cardCost > 0) {
								this.updataTrans()
							}
							this.setState({
								popCardVis: false,
								visibleCardTips: true,
								reciprocal: 2,
							}, () => {
								this.props.form.setFieldsValue({ cardBindNo: res.patNo })
								// this.childTitle.titVisible()
							})
							this.timerStart()
						} else {
							this.setState({
								//   postLoading: false
							})
						}
					}
				})
			}
		}

		//卡操作前 ---提示
		cardBefor = (flag, info) => {
			let self = this
			const { patientInfo } = this.state
			confirm({
				key: flag == 1 ? '1' : (flag == 2 ? '2' : (flag == 5 ? '3' : '4')),
				title: flag == 1 ? '取消挂失后，该卡将继续启用，启用该卡？' : (flag == 2 ? '挂失后，将不能使用该卡，是否确认挂失？' : (flag == 5 ? '注销后，将不能使用该卡，是否确认注销？' : '')),
				centered: true,
				content: (
					<p style={{ color: 'rgba(0, 0, 0, 0.85)', fontSize: '16px' }}>病人: <span style={{ marginRight: '6px' }}>{patientInfo.patInfo ? patientInfo.patInfo.patName : ''}</span><span style={{ marginRight: '6px' }}>{info.cardTypeDesc && info.cardTypeDesc ? info.cardTypeDesc : ''}:</span><span>{info.cardNo && info.cardNo ? info.cardNo : ''}</span></p>
				),
				onOk() {
					self.cardSuccess(flag, info.cardID)
					Modal.destroyAll()
				},
				onCancel() {
				},
			});
		}

		//重置cardType
		initType = () => {
			this.state.baseParms.cardType.map((carditem, index) => {
				carditem["disabled"] = false
			})
		}

		//卡操作弹窗 取消
		handleCancelCard = () => {
			this.setState({
				popCardVis: false,
				changeCardVisible: false,
				bindCardVisible: false,
				patchCardVisible: false,
				bindMoreInfo: false,
				bindVail: true
			})
			this.initType()
		}

		//卡操作成功后----关闭弹窗
		closeCardPop = () => {
			this.setState({
				visibleCardTips: false,
				isFlag: -1,
			})
			// this.handleCancel()
			clearInterval(timer)
			this.initType()
			this.handleReset()
		}

		//绑定卡需收费 返回上一步
		handlePrev = () => {
			this.setState({
				isFlag: 6,
			})
		}

		//点击进行卡操作 1取消挂失 2挂失 3换卡 4补卡 5注销 6 绑定
		handleCard = (flag, info) => {
			const { patientInfo, patId, isFlag } = this.state
			this.props.form.setFieldsValue({ cardNumber: undefined, cardBindNo: undefined, patchNumber: undefined });
			this.setState({
				isFlag: flag,
				cardInfo: info,
				//   reciprocal: 2,
				//   bindVail:true
			})
			if (flag == 1) {
				this.cardBefor(flag, info)
			} if (flag == 2) {
				this.cardBefor(flag, info)
			}
			if (flag == 5) {
				this.cardBefor(flag, info)
			}
			if (flag == 3 || flag == 4 || flag == 6) {
				this.props.form.setFieldsValue({
					payMethods: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
				});
				const cardType = this.state.baseParms.cardType;
				let readMo = "";
				this.setState({
					popCardVis: true
				}, () => {
					cardType.map((item, i) => {
						if (info.cardTypeID == item.id) {
							readMo = item.readMode
							if (flag == 3) {
								if (item.readMode == 'I' || item.readMode == '') {
									setTimeout(() => {
										this.changeCard.current.focus();
									}, 300)
								} else {
									setTimeout(() => {
										this.creadCardPop.current.buttonNode.focus();
									}, 1000)
								}
							} if (flag == 4) {
								if (item.readMode == 'I' || item.readMode == '') {
									setTimeout(() => {
										this.patchCard.current.focus();
									}, 300)
								} else {
									setTimeout(() => {
										this.creadCardPops.current.buttonNode.focus();
									}, 1000)
								}
							}
						}
					})
					//3 换卡 4 补卡
					if (flag == 3 || flag == 4) {
						//选中当前卡类型
						for (var i = 0; i < this.state.baseParms.cardType.length; i++) {
							if (info.cardTypeDesc == this.state.baseParms.cardType[i].descripts) {
								this.props.form.setFieldsValue({ newCard: this.state.baseParms.cardType[i].id });
								this.setState({
									initpatCardID: this.state.baseParms.cardType[i].id,
									nowReadCardPop: this.state.baseParms.cardType[i].readMode,
									repariFeeFlagCard: this.state.baseParms.cardType[i].repariFeeFlag,
									idCardCodePop: this.state.baseParms.cardType[i].code,
									cardLengthCard: this.state.baseParms.cardType[i].cardLength && this.state.baseParms.cardType[i].cardLength != "" ? this.state.baseParms.cardType[i].cardLength + "位," : "",
									autoCreateCardNoCard: this.state.baseParms.cardType[i].autoCreateCardNo,
									replenishZero: this.state.baseParms.cardType[i].replenishZero,
								}, () => {
									//自动生成卡号 不做换卡 补卡操作
								});
							}

						}
					}
					if (flag == 4) {
						this.props.form.setFieldsValue({ patchMoney: '￥' + info.cardCost });
						this.props.form.setFieldsValue({ transactionNo: info.transactionNo ? info.transactionNo : this.state.baseParms.transactionNo })
						this.setState({
							nowCost: flag == 4 ? info.cardCost : '',
							initpatCardID: this.props.form.getFieldValue('newCard')
						})
					}
					if (flag == 6) { //绑定卡
						let canBindArr = []
						const { bindCardArr } = this.state
						this.props.form.setFieldsValue({ cardBindNo: undefined })
						if (bindCardArr) {
							this.state.baseParms.cardType.map((carditem, index) => {
								bindCardArr.map((item, index) => {
									if (item.cardTypeDesc == carditem.descripts) {
										carditem["disabled"] = true
									}
								})
							})
							this.state.baseParms.cardType.map((carditem, index) => {
								if (carditem.disabled == undefined || carditem.disabled == false) {
									canBindArr.push(carditem)
								}
							})

							this.props.form.setFieldsValue({ newCard: canBindArr[0].id })
							this.setState({
								// initCardDr:canBindArr[0].id,
								nowCostCard: canBindArr[0].cardCost,
								initpatCardID: canBindArr[0].id,
								nowReadCardPop: canBindArr[0].readMode,
								repariFeeFlagCard: canBindArr[0].repariFeeFlag,
								idCardCodePop: canBindArr[0].code,
								cardLengthCard: canBindArr[0].cardLength && canBindArr[0].cardLength != "" ? canBindArr[0].cardLength + "位," : "",
								autoCreateCardNoCard: canBindArr[0].autoCreateCardNo,
								replenishZero: canBindArr[0].replenishZero,
							}, () => {
								if (this.state.autoCreateCardNoCard == "Y") {
									this.setState({
										bindVail: false
									})
									setTimeout(() => {
										this.bindOkButton.current.buttonNode.focus();
									}, 1000)
									return
								}
								if (this.state.nowReadCardPop == 'I' || this.state.nowReadCardPop == '') {
									this.setState({
										bindVail: true
									}, () => {
										setTimeout(() => {
											this.bindCardNu.current.focus();
										}, 300)
									})
								} else {
									this.setState({
										bindVail: true
									}, () => {
										setTimeout(() => {
											this.bindCardButton.current.buttonNode.focus();
										}, 1000)
									})
								}
							})
						}
					}
				})
			}
			this.props.form.setFieldsValue({ originalCard: patientInfo.patInfo.patName + ',' + info.cardTypeDesc + ',' + info.cardNo })
		}

		//已绑卡类型
		bingCardArr = (data) => {
			let bindCardArr = []
			let newArr = []
			for (var i = 0; i < data.length; i++) {
				data[i].key = i + "info";
				if (this.props.form.getFieldValue('cardNo') == data[i].cardNo) {
					this.setState({
						cardSatus: data[i],
					})
					if ((data[i].cardStatusDesc == "正常" && data[i].autoCreateNo != "Y") || (data[i].cardStatusDesc == "挂失" && data[i].autoCreateNo != "Y")) {
						this.setState({
							canRetarCard: "Y"
						})
					} else {
						this.setState({
							canRetarCard: "N"
						})
					}
					if (data[i].cardStatusDesc == '挂失') {
						this.setState({
							isCancel: 1
						})
					} else {
						this.setState({
							isCancel: -1
						})
					}
				}
				if (data[i].cardStatusDesc == '退卡' || data[i].cardStatusDesc == '回收' || data[i].cardStatusDesc == '作废') {
					data.splice(i, 1)
				}
			}
			newArr = data
			if (newArr.length == this.state.baseParms.cardType.length) { //检测卡种是否全部都有绑定
				this.setState({
					bindDis: true
				})
			} else {
				this.setState({
					bindDis: false
				})
			}
			this.setState({
				bindCardArr: newArr
			}, () => {
				this.state.bindCardArr.map((item, index) => {
					if (this.props.form.getFieldValue('cardNo') == item.cardNo) {
						this.state.bindCardArr[index]["light"] = true
					} else {
						this.state.bindCardArr[index]["light"] = false
					}
				})
			})
		}

		//点击读卡
		handleCardReading = () => {
			this.setState({
				parms: {}
			})
			this.props.form.resetFields();
			const { initCardDr } = this.state
			this.readCard.ReadCard(initCardDr, "R", (json) => {
				//读卡完成 信息回显
				this.props.form.setFieldsValue({ cardNo: json.cardNo, cardTypeID: json.cardTypeID })
				this.setState({
					initCardDr: json.cardTypeID,
					cardNoVisible: false
				})
				//有关联病人信息 弹窗
				if (json && json.patInfo) {
					this.handleParms(json.patInfo)
				} else {
					setTimeout(() => {
						this.patName.current.focus();
					}, 300)
					// this.handleNoPopInmation()
				}
			})
		}

		//读卡 绑定 换卡  补卡
		bindCardReadling = () => {
			const { initpatCardID } = this.state
			this.readCard.ReadCard(initpatCardID, "R", (json) => {
				//读卡完成 信息回显  绑卡 换卡 补卡
				if (this.state.isFlag == 3) {
					this.props.form.setFieldsValue({ cardNumber: json.cardNo, newCard: json.cardTypeID })
					this.setState({
						bindVail: false
					})
					setTimeout(() => {
						this.changeOkButton.current.buttonNode.focus();
					}, 300)
				}
				else if (this.state.isFlag == 4) {
					this.props.form.setFieldsValue({ patchNumber: json.cardNo, newCard: json.cardTypeID })
					this.setState({
						bindVail: false
					})
					setTimeout(() => {
						this.patchOkButton.current.buttonNode.focus();
					}, 300)
				} else {
					this.props.form.setFieldsValue({ cardBindNo: json.cardNo, newCard: json.cardTypeID })
					this.setState({
						initpatCardID: json.cardTypeID,
						bindCardVisible: false
					})
					if (this.state.nowCostCard != 0 && this.state.repariFeeFlagCard != "Y" && this.state.isFlag != 3 && this.state.isFlag != 4) {
						this.setState({
							bindVail: false,
							bindMoreInfo: true,
							//   flag: 7,
							isFlag: 7
						})
						setTimeout(() => {
							this.bindOkButton.current.buttonNode.focus();
						}, 300)
						this.props.form.setFieldsValue({ transactionNo: this.state.baseParms.transactionNo })
					} else {
						this.setState({
							bindMoreInfo: false,
							bindVail: false,
							// isFlag:-1
						})
						setTimeout(() => {
							this.bindOkButton.current.buttonNode.focus();
						}, 300)
					}
				}
			})
		}

		//失去焦点进行读卡 --  卡号   不弹窗
		handleNoPopInmation = () => {
			let cardNo = this.props.form.getFieldValue('cardNo');
			let cardTypeID = this.props.form.getFieldValue('cardTypeID');
			if (this.state.popCardVis) {
				return
			}
			if (this.state.isModefined == 1) {
				return
			}
			this.setState({
				noSend: false,
				credAge: undefined,
				credBirthday: undefined,
				birthData: undefined,
				// parms:{}
			})
			if (this.state.noSend === false) {
				return
			}
			this.handleVail()
			if (this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length > 0) {
				let data = {}
				data = {
					params: [{
						cardTypeID: this.props.form.getFieldValue('cardTypeID') ? this.props.form.getFieldValue('cardTypeID') : '',
						cardNo: this.props.form.getFieldValue('cardNo') ? this.props.form.getFieldValue('cardNo') : '',
						patName: this.props.form.getFieldValue('patName') ? this.props.form.getFieldValue('patName') : '',
						patMobile: this.props.form.getFieldValue('patMobile') ? this.props.form.getFieldValue('patMobile') : '',
						credTypeCode: '',
						credNo: ''
					}],
				}
				this.props.form.resetFields();
				this.props.form.setFieldsValue({ cardNo: cardNo, cardTypeID: cardTypeID, });
				$http.post('urlS', this, {
					code: '03030009',
					data: data,
					success: function (res) {
						this.setState({
							noSend: true,
						})
						if (+res.errorCode != 0) {
							this.setState({
								cardSatus: [],
								bindCardArr: [],
								canNext: false
							})
							this.props.form.setFieldsValue({ "cardNo": undefined })
							// this.cardTip(1)
							return
						}
						if (+res.errorCode === 0 && res.result.data.length > 0) {
							this.cardTip()
							//年龄 出生日期 默认值不是patInfo.
							this.setState({
								cardNo: res.result.patCurrentCard.cardNo,
								credAge: res.result.patInfo.patAge ? res.result.patInfo.patAge : undefined,
								credBirthday: res.result.patInfo.patBirthDateTime ? res.result.patInfo.patBirthDateTime : undefined,
								birthData: res.result.patInfo.patBirthDate ? res.result.patInfo.patBirthDate : undefined,
								birthData: res.result.patInfo.patEduID ? res.result.patInfo.patEduID : undefined,
								parms: res.result.patInfo,
								isModefined: 1,
								posType: res.result.patCredTypeCode,
								credTypeID: res.result.patCredTypeID,
								canNext: true,
								patBarPatID: res.result.patInfo.patID
							})
							if (res.result.patInfo.patNo) {
								const info = res.result.data;
								const cardInfo = res.result.data
								for (var i = 0; i < cardInfo.length; i++) {
									if (this.props.form.getFieldValue('cardNo') == cardInfo[i].cardNo) {
										this.setState({
											cardPayMentID: cardInfo[i].cardPayMentID
										})
									}
								}
								//表单回显
								const even = res.result.patInfo
								this.setState({
									// parms:even,
									cardSatus: res.result.patCurrentCard,
									patiId: res.result.patInfo.patID,
									patientInfo: res.result.patInfo,
									selfCredNo: res.result.patInfo.patCredNo,
									patEduID: res.result.patInfo.patEduID,
								})

								this.bingCardArr(info)
							}
							else {
								this.setState({
									cardSatus: [],
									bindCardArr: []
								})
							}
						} else {
							if (this.state.cardNoVisible == false) {
								this.cardTip()
							}
							this.setState({
								cardSatus: [],
								bindCardArr: [],
								canNext: true
							})
						}
					}, error: function () {

					}
				})
			} else {
				if (this.state.autoCreateCardNo == "Y") {
					setTimeout(() => {
						this.patName.current.focus();
					}, 600)
					return
				}
				if (this.state.nowRead != "R" && this.state.autoCreateCardNo != "Y") {
					setTimeout(() => {
						this.cardNo.current.focus();
					}, 300)
					// message.warning('请输入卡号');
				}
			}

		}

		//选择建卡类型  code 10 就诊卡 12 身份证 14 银医卡
		handleCred = (id, code, readMode, cardLength, cardCost, invFlag, replenishZero, repariFeeFlag, autoCreateCardNo) => {
			this.setState({
				cardNoVisible: false,
				initCardDr: id,
				nowRead: readMode,
				idCardCode: code,
				cardLength: cardLength && cardLength != "" ? cardLength + "位," : "",
				nowCost: cardCost,
				nowInv: invFlag,
				replenishZero,
				repariFeeFlag,
				autoCreateCardNo,
			})
			this.props.form.setFieldsValue({ cardNo: undefined });
			if (autoCreateCardNo == "Y") {
				setTimeout(() => {
					this.patName.current.focus();
				}, 300)
			} else {
				setTimeout(() => {
					this.cardNo.current.focus();
				}, 300)
			}


		}

		//绑定卡 选择卡类型
		handleBindCardType = (id, code, readMode, cardLength, cardCost, invFlag, replenishZero, repariFeeFlag, autoCreateCardNo) => {
			this.props.form.setFieldsValue({ cardBindNo: undefined })
			this.props.form.setFieldsValue({ newCard: id })
			this.props.form.setFieldsValue({ newCardMoney: '￥' + cardCost })
			this.setState({
				nowCostCard: cardCost,
				initpatCardID: id,
				// initCardDr:this.state.baseParms.cardType[i].id,
				idCardCodePop: code,
				nowReadCardPop: readMode,
				cardLengthCard: cardLength && cardLength != "" ? cardLength + "位," : "",
				autoCreateCardNoCard: autoCreateCardNo,
				replenishZero,
				repariFeeFlagCard: repariFeeFlag,
			})
			if (autoCreateCardNo == "Y") {
				this.setState({
					bindCardVisible: false,
					bindVail: false
				}, () => {
					setTimeout(() => {
						this.bindOkButton.current.buttonNode.focus();
					}, 800)
				})
			} else {
				if (this.state.nowReadCardPop == 'I' || this.state.nowReadCardPop == '') {
					this.setState({
						bindCardVisible: false,
						bindVail: true
					}, () => {
						setTimeout(() => {
							this.bindCardNu.current.focus();
						}, 300)
					})

				} else {
					this.setState({
						bindCardVisible: false,
						bindVail: false
					}, () => {
						setTimeout(() => {
							this.bindCardButton.current.buttonNode.focus();
						}, 300)
					})

				}
			}
		}

		//补0配置
		handleLength = () => {
			if (this.state.replenishZero == "Y" && parseInt(this.state.cardLength) && parseInt(this.state.cardLength) > 0 && this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length > 0) {
				let No = this.props.form.getFieldValue('cardNo') ? this.props.form.getFieldValue('cardNo') : ''
				let length = parseInt(this.state.cardLength)
				let num = (Array(length).join(0) + No).slice(-length)
				this.props.form.setFieldsValue({ cardNo: num });
				this.setState({
					cardNoVisible: false,
				})
				this.handleNoPopInmation()
				return
			}
			if (this.state.idCardCode == '12' && this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length == 18) {
				this.handleNoPopInmation()
				return
			}
			if (this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length > 0) {
				this.handleNoPopInmation()
			}
		}

		//选择证件类型
		handleCerdType = (data) => {
			setTimeout(() => {
				this.patCredNo.current.focus();
			}, 300)
			this.setState({
				posType: data
			})
		}

		//清空证件类型 卡号不必填
		handleCredNo = (code) => {
			if (!code) {
				this.setState({
					posType: "",
					credTypeID: ""
				})
			} else {
				this.setState({
					posType: code
				})
			}
		}

		//建卡卡号
		cardTip = (num) => {
			this.props.form.validateFields(['cardNo',], (errors, values) => {
				if (errors == null && num != 1) {
					setTimeout(() => {
						this.patName.current.focus();
					}, 300)
					return
				}
				if (!errors) {
					this.setState({
						cardNoVisible: false
					})
					if (num != 1) {
						if (this.props.form.getFieldValue('cardNo') && this.state.popCardVis == false) {
							setTimeout(() => {
								this.patName.current.focus();
							}, 300)

						}
					}
				} else {
					this.setState({
						cardNoVisible: true,
						cardNoMessage: errors.cardNo.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							cardNoVisible: false
						})
					}, 1500)
				}
			});
		}

		//病人姓名
		patNameTip = (num) => {
			this.props.form.validateFields(['patName',], (errors, values) => {
				if (!errors) {
					this.setState({
						patNameVisible: false
					})
					if (num != 2) {
						if (this.props.form.getFieldValue("patCredTypeCode") && this.props.form.getFieldValue("patCredTypeCode") == "01") {
							setTimeout(() => {
								this.patCredNo.current.focus();
							}, 300)
						} else {
							setTimeout(() => {
								this.sex.current.focus()
							}, 300)
						}
					}
				} else {
					this.setState({
						patNameVisible: true,
						patNameMessage: errors.patName.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							patNameVisible: false
						})
					}, 1500)
				}
			});
		}

		//联系人姓名
		econNameTip = (num) => {
			this.props.form.validateFields(['patEContact',], (errors, values) => {
				if (!errors) {
					this.setState({
						econNameVisible: false
					})
					if (num != 2) {
						setTimeout(() => {
							this.econRelation.current.focus();
						}, 300)
					}
				} else {
					this.setState({
						econNameVisible: true,
						econNameMessage: errors.patEContact.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							econNameVisible: false
						})
					}, 1500)
				}
			});
		}

		//联系人关系
		econRelationTip = (num) => {
			this.props.form.validateFields(['patERelationID',], (errors, values) => {
				if (!errors) {
					this.setState({
						econRelationVisible: false
					})
					if (num != 2) {
						setTimeout(() => {
							this.econMobile.current.focus();
						}, 300)
					}
				} else {
					this.setState({
						econRelationVisible: true,
						econRelationMessage: errors.patERelationID.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							econRelationVisible: false
						})
					}, 1500)
				}
			});
		}

		//病人出生日期
		patBirthTip = () => {
			this.props.form.validateFields(['patBirthDate',], (errors, values) => {
				if (!errors) {
					this.setState({
						patBirthVisible: false
					})
					if (this.props.form.getFieldValue('patBirthDate')) {
						setTimeout(() => {
							this.patMobile.current.focus();
						}, 300)
					}
				} else {
					this.setState({
						patBirthVisible: true,
						patBirthMessage: errors.patBirthDate.errors[0].message,
					})
				}
				setTimeout(() => {
					this.setState({
						patBirthVisible: false
					})
				}, 1500)
			});
		}

		//证件号
		posTip = (data, num) => {
			this.props.form.validateFields(['patCredNo',], (errors, values) => {
				if (!errors) {
					this.setState({
						posVisible: false
					})
					if (this.props.form.getFieldValue('patCredTypeCode') == '01') {
						if (this.props.form.getFieldValue('patCredNo').length == 18 && this.state.credWarning == false) {
							this.setState({
								credBirthday: this.getBirthday(data),
								birthData: this.getBirthday(data),
								credAge: this.getAge(data),
							})
							this.props.form.setFieldsValue({ patSexCode: this.getSex(data), patBirthDate: moment(this.getBirthday(data)) });
							this.handleInmations(data, num)

						}
					} else {

					}
				} else {
					this.setState({
						posVisible: true,
						posMessage: errors.patCredNo.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							posVisible: false
						})
					}, 1500)
				}
			});
		}

		//病人手机号码
		patMobileTip = (num) => {
			this.props.form.validateFields(['patMobile',], (errors, values) => {
				if (!errors) {
					this.setState({
						patMobileVisible: false
					}, () => {
						// this.handleInmations('', num)
					})
					if (num != 2) {
						if (this.props.form.getFieldValue('patMobile')) {
							setTimeout(() => {
								this.patType.current.focus();
							}, 300)
						}
					}
				} else {
					this.setState({
						patMobileVisible: true,
						patMobileMessage: errors.patMobile.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							patMobileVisible: false
						})
					}, 1500)
				}
			});
		};

		//病人座机号码
		telphoneTip = (num) => {
			this.props.form.validateFields(['telphone',], (errors, values) => {
				if (!errors) {
					this.setState({
						telphoneVisible: false
					});
					if (num != 2) {
						if (this.props.form.getFieldValue('telphone')) {
							setTimeout(() => {
								this.patType.current.focus();
							}, 300)
						}
					}
				} else {
					this.setState({
						telphoneVisible: true,
						telphoneMessage: errors.telphone.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							telphoneVisible: false
						})
					}, 1500)
				}
			});
		};

		//病人类型
		patTypeTip = (num) => {
			this.props.form.validateFields(['patTypeID',], (errors, values) => {
				const { repariFeeFlag, nowCost, isModefined, isFlag, noCard, credAge, parms } = this.state
				if (!errors) {
					this.setState({
						patTypeVisible: false
					})
					if (num != 2) {
						if (parseInt(credAge) < 14 || parseInt(parms.patAge) < 14 || credAge && credAge.indexOf("天") != -1 || parms.patAge && parms.patAge.indexOf("天") != -1) {
							setTimeout(() => {
								this.econName.current.focus();
							}, 300)
							return
						} else {
							setTimeout(() => {
								this.patSourceID.current.focus()
							}, 300)
						}
					}
				} else {
					this.setState({
						patTypeVisible: true,
						patTypeMessage: errors.patTypeID.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							patTypeVisible: false
						})
					}, 1500)
				}
			});
		}

		//详细地址
		patAdressTip = (num) => {
			this.props.form.validateFields(['presentAddressDesc'], (errors, values) => {
				if (!errors) {
					this.setState({
						patAdressVisible: false
					})
					if (num != 2) {
						// if (this.props.form.getFieldValue('presentAddressDesc')) {
						// 	if (parseInt(credAge) < 14 || parseInt(parms.patAge) < 14 || credAge && credAge.indexOf("天") != -1 || parms.patAge && parms.patAge.indexOf("天") != -1) {
						// 		this.econName.current.focus();
						// 		return
						// 	}
						// 	if (repariFeeFlag == "Y" || nowCost == 0 || nowCost == "" || isModefined == 1 || isFlag == 3 || !noCard) {
						// 		setTimeout(() => {
						// 			this.creadCard.current.buttonNode.focus();
						// 		}, 300)
						// 	} else {
						// 		setTimeout(() => {
						// 			this.cardPayMethodID.current.focus();
						// 		}, 600)
						// 	}

						// }
					}
				} else {
					this.setState({
						patAdressVisible: true,
						patAdressMessage: errors.presentAddressDesc.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							patAdressVisible: false
						})
					}, 1500)
				}
			});
		}

		//详细地址单位邮编
		patAdressComZipTip = (num) => {
			const { repariFeeFlag, nowCost, isModefined, isFlag, noCard } = this.state
			this.props.form.validateFields(['companyZIP',], (errors, values) => {
				if (!errors) {
					this.setState({
						patAdressComZipVisible: false
					})
					if (num != 2) {

					}
				} else {
					this.setState({
						patAdressComZipVisible: true,
						patAdressComMessageZip: errors.companyZIP.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							patAdressComZipVisible: false
						})
					}, 1500)
				}
			});
		}

		//详细地址户口邮编
		patAdressHouseZipTip = (num) => {
			this.props.form.validateFields(['registerZIP',], (errors, values) => {
				if (!errors) {
					this.setState({
						patAdressHouseZipVisible: false
					})
					if (num != 2) {

					}
				} else {
					this.setState({
						patAdressHouseZipVisible: true,
						patAdressHouseMessageZip: errors.registerZIP.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							patAdressHouseZipVisible: false
						})
					}, 1500)
				}
			});
		}

		//详细地址邮编
		patAdressZipTip = (num) => {
			this.props.form.validateFields(['presentZIP',], (errors, values) => {
				if (errors == undefined) {
					return
				}
				if (!errors) {
					this.setState({
						patAdressZipVisible: false
					})
					if (num != 2) {
						// if (this.props.form.getFieldValue('presentZIP')) {
						//     if(repariFeeFlag=="Y"||nowCost == 0 || nowCost == "" || isModefined == 1 || isFlag == 3 ||!noCard){
						//         setTimeout(() => {
						//             this.creadCard.current.buttonNode.focus();
						//         }, 300)
						//     }else{
						//         setTimeout(() => {
						//             this.cardPayMethodID.current.focus();
						//         }, 600)
						//     }

						// }
					}
				} else {
					this.setState({
						patAdressZipVisible: true,
						patAdressMessageZip: errors.presentZIP.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							patAdressZipVisible: false
						})
					}, 1500)
				}
			});
		}

		//联系人手机
		econPhoneTip = (num) => {
			let { credAge, parms } = this.state
			this.props.form.validateFields(['patEContactMobile',], (errors, values) => {
				if (!errors) {
					this.setState({
						econPhoneVisible: false
					})
					if (num != 2) {
						if (this.props.form.getFieldValue('patEContactMobile')) {
							if (parseInt(credAge) < 14 || parseInt(parms.patAge) < 14 || credAge && credAge.indexOf("天") != -1 || parms.patAge && parms.patAge.indexOf("天") != -1) {
								setTimeout(() => {
									this.patSourceID.current.focus()
								}, 300)
							}
							else {
								setTimeout(() => {
									this.patCompany.current.focus();
								}, 300)
							}
						}
					}
				} else {
					this.setState({
						econPhoneVisible: true,
						econPhoneMessage: errors.patEContactMobile.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							econPhoneVisible: false
						})
					}, 1500)
				}
			});
		}

		//来源提示
		sourceTip = (num) => {
			let { repariFeeFlag, nowCost, isModefined, isFlag, noCard, credAge, parms } = this.state
			this.props.form.validateFields(['patSourceID',], (errors, values) => {
				if (!errors) {
					this.setState({
						sourceVisible: false
					})
					if (num != 2) {
						if (this.props.form.getFieldValue('patSourceID')) {
							if (repariFeeFlag == "Y" || nowCost == 0 || nowCost == "" || isModefined == 1 || isFlag == 3 || !noCard) {
								setTimeout(() => {
									this.creadCard.current.buttonNode.focus();
								}, 300)
							} else {
								setTimeout(() => {
									this.cardPayMethodID.current.focus();
								}, 300)
							}
						}
					}
				} else {
					this.setState({
						sourceVisible: true,
						sourceMessage: errors.patSourceID.errors[0].message,
					})
					setTimeout(() => {
						this.setState({
							sourceVisible: false
						})
					}, 1500)
				}
			});
		}

		//绑卡操作
		bindCardTip = () => {
			this.props.form.validateFields(['cardBindNo',], (errors, values) => {
				if (errors == null) {
					return
				}
				if (errors.cardBindNo.errors[0].message == "cardBindNo need to revalidate") {
					this.setState({
						bindCardVisible: false
					})
					return
				}
				if (!errors) {
					this.setState({
						bindCardVisible: false
					})
				} else {
					if (this.props.form.getFieldValue("cardBindNo") && this.props.form.getFieldValue("cardBindNo").length > 0) {
						this.setState({
							bindCardVisible: true,
							bindCardMessage: errors.cardBindNo.errors[0].message,
						})
					}
				}
			});
		}

		//补卡操作
		patchCardTip = () => {
			this.props.form.validateFields(['patchNumber',], (errors, values) => {
				if (errors == null) {
					return
				}
				if (errors.patchNumber.errors[0].message == "patchNumber need to revalidate") {
					this.setState({
						patchCardVisible: false
					})
					return
				}
				if (!errors) {
					this.setState({
						patchCardVisible: false
					})
				} else {
					if (this.props.form.getFieldValue("patchNumber") && this.props.form.getFieldValue("patchNumber").length > 0) {
						this.setState({
							patchCardVisible: true,
							patchCardMessage: errors.patchNumber.errors[0].message,
						})
					}
				}
			});
		}

		//换卡操作
		changCardTip = () => {
			this.props.form.validateFields(['cardNumber',], (errors, values) => {
				if (errors == null) {
					return
				}
				if (errors.cardNumber.errors[0].message == "cardNumber need to revalidate") {
					this.setState({
						changeCardVisible: false
					})
					return
				}
				if (!errors) {
					this.setState({
						changeCardVisible: false
					})
				} else {
					if (this.props.form.getFieldValue("cardNumber") && this.props.form.getFieldValue("cardNumber").length > 0) {
						this.setState({
							changeCardVisible: true,
							changeCardMessage: errors.cardNumber.errors[0].message,
						})
					}
				}
			});
		}

		//失去焦点 绑定卡
		bindCardBlur = () => {
			this.handleZero();
			this.bindCardTip();
		}

		//输入改变时 不可绑定
		closeBindVail = () => {
			this.setState({
				bindVail: true,
				changeCardVisible: false,
				patchCardVisible: false,
				bindCardVisible: false,
			})
		}

		//失去焦点 changeCard
		changeCardBlur = (flag) => {
			if (flag == 1) {
				this.handleZero()
				//检测卡号格式 错误提示
				this.changCardTip();
			} else {
				this.handleZero()
				//检测卡号格式 错误提示
				this.patchCardTip();
			}
		}

		//失去焦点 patName
		patBlur = () => {
			this.patNameTip(2)
		}

		//失去焦点 econNameTip
		patEconNameBlur = () => {
			this.econNameTip(2)
		}

		//失去焦点 econRelationTip
		patEconRelationBlur = () => {
			this.econRelationTip(2)
		}

		//失去焦点 patMobile
		patMobileBlur = () => {
			this.patMobileTip(2)
		}

		//失去焦点 telphone
		telphoneBlur = () => {
			this.telphoneTip(2)
		};

		//失去焦点 patTypeId
		patTypeBlur = () => {
			this.patTypeTip(2)
		}

		//失去焦点 patAdressBlur
		patAdressBlur = () => {
			this.patAdressTip(2)
		}

		//身份证点击获取焦点
		fouceCredNo = () => {
			setTimeout(() => {
				this.patCredNo.current.focus();
			}, 300)
		}

		// 失去焦点--日期
		onChangeTimeBlur = () => {
			this.setState({
				formatType: true
			});
		}

		checkPatMobile = () => {
			this.econPhoneTip(2)
		}

		checkPatSource = () => {
			this.sourceTip(2)
		}

		//必填项错误提示显示时 框内内容变化 隐藏
		visibleTip = (num) => {
			switch (num) {
				case 1:
					this.setState({
						cardNoVisible: false
					})
					break;
				case 2:
					this.setState({
						patNameVisible: false
					})
					break;
				case 3:
					this.setState({
						posVisible: false
					})
					break;
				case 4:
					this.setState({
						patMobileVisible: false
					})
					break;
				case 5:
					this.setState({
						patAdressVisible: false
					})
					break;
				case 6:
					this.setState({
						changeCardVisible: false
					})
					break;
				case 8:
					this.setState({
						bindCardVisible: false
					})
					break;
				case 9:
					this.setState({
						patTypeVisible: false
					})
					break;
				case 10:
					this.setState({
						patBirthVisible: false,
						formatType: false
					})
					break;
				case 11:
					this.setState({
						econPhoneVisible: false,
					})
					break;
				case 12:
					this.setState({
						econNameVisible: false,
					})
					break;
				case 13:
					this.setState({
						patAdressZipVisible: false,
					})
					break;
				case 14:
					this.setState({
						patAdressHouseZipVisible: false,
					})
					break;
				case 15:
					this.setState({
						patAdressComZipVisible: false,
					})
					break;
				case 16:
					this.setState({
						econRelationVisible: false,
					})
					break;
				default:

			}
		}

		//下拉框无数据时 跳到下一个必填项
		checkOption = (num) => {
			switch (num) {
				case 1:
					setTimeout(() => {
						if (this.state.bornhamlets.length == 0) {
							this.patAddress.current.focus();
						}
					}, 600)
					break;
				case 2:
					setTimeout(() => {
						if (this.state.nativehamlets.length == 0) {
							this.patAddress.current.focus();
						}
					}, 600)
					break;
				case 3:
					setTimeout(() => {
						if (this.state.hamlets.length == 0) {
							this.patAddress.current.focus();
						}
					}, 600)
					break;
				case 4:
					setTimeout(() => {
						if (this.state.househamlets.length == 0) {
							this.cardPayMethodID.current.focus();
						}
					}, 600)
					break;
				case 5:
					setTimeout(() => {
						if (this.state.eContacthamlets.length == 0) {
							this.cardPayMethodID.current.focus();
						}
					}, 600)
					break;
				case 6:
					setTimeout(() => {
						if (this.state.workhamlets.length == 0) {
							this.cardPayMethodID.current.focus();
						}
					}, 600)
					break;
				default:

			}
		}

		//进行卡号检测补0操作
		handleZero = () => {
			if (this.state.popCardVis) {
				if (this.state.isFlag == 3 || this.state.isFlag == 4) {
					this.chaeckLength(this.state.isFlag)
				} else { //绑定
					this.checkLength()
				}
			} else {
				if (this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length == 0) {
					this.setState({
						cardNoVisible: false
					})
					return
				} else {
					this.handleLength()
				}
			}
		}

		//失去焦点 patCard
		patCardBlur = () => {
			this.handleZero()
			this.cardTip(1)
		}

		//回车调到下一个必填项 卡号--->姓名
		handleKeydownM = (num, id) => {
			const { repariFeeFlag, nowCost, isModefined, isFlag, noCard, credAge, parms } = this.state
			switch (num) {
				case 1:
					this.handleZero()
					this.cardTip()
					break;
				case 2:
					this.patNameTip()
					break;
				case 3:
					setTimeout(() => {
						this.patBirthDate.current.focus();
					}, 300)
					break;
				case 4:
					this.setState({
						credTypeID: id
					})
					if (this.props.form.getFieldValue("patCredTypeCode") == "01") {
						setTimeout(() => {
							this.patCredNo.current.focus();
						}, 300)
					} else {
						setTimeout(() => {
							this.sex.current.focus()
						}, 300)
					}

					break;
				case 5:
					this.posTip()
					break;
				case 6:
					this.patMobileTip()
					this.handleInmations('', 2)
					break;
				case 7://病人类型
					this.patTypeTip()
					break;
				case 8://民族
					if (parseInt(credAge) < 14 || parseInt(parms.patAge) < 14 || credAge && credAge.indexOf("天") != -1 || parms.patAge && parms.patAge.indexOf("天") != -1) {
						this.econName.current.focus();
						return
					}
					if (repariFeeFlag == "Y" || nowCost == 0 || nowCost == "" || isModefined == 1 || isFlag == 3 || !noCard) {
						setTimeout(() => {
							this.creadCard.current.buttonNode.focus();
						}, 300)
					} else {
						setTimeout(() => {
							this.cardPayMethodID.current.focus();
						}, 600)
					}
					break;
				// case 9:
				//     this.patAdressTip()
				//     break;
				case 10:
					if (this.state.nowCost != 0 && nowCost != "") {
						setTimeout(() => {
							this.creadCard.current.buttonNode.focus();
						}, 300)
					}
					break;
				case 11:
					this.econNameTip()
					break;
				case 12:
					this.econPhoneTip()
					break;
				case 13:
					setTimeout(() => {
						this.econRelationTip()
					}, 100)
					break;
				case 14:
					setTimeout(() => {
						this.econHamlet.current.focus()
					}, 300)
					break;
				case 14.1:
					setTimeout(() => {
						this.contactsAddress.current.focus()
					}, 300)
					break;
				case 14.2:
					setTimeout(() => {
						this.cardPayMethodID.current.focus()
					}, 300)
					break;
				case 15:
					if (this.props.form.getFieldValue('patCompany')) {
						setTimeout(() => {
							this.patCompanyTel.current.focus();
						}, 300)
					}
					break;
				case 16:
					if (this.props.form.getFieldValue('patCompanyTel')) {
						setTimeout(() => {
							this.patSocialStatusID.current.focus();
						}, 300)
					}
					break;
				case 17:
					setTimeout(() => {
						this.companyAddress.current.focus();
					}, 300)
					break;
				case 18:
					if (this.props.form.getFieldValue('companyAddress')) {
						setTimeout(() => {
							this.companyZIP.current.focus();
						}, 300)
					}
					break;
				case 19:
					this.patAdressComZipTip()
					break;
				// case 20:
				//     setTimeout(() => {
				//         this.patAddress.current.focus();
				//     }, 300)
				//     break;
				// case 21:
				//     setTimeout(() => {
				//         this.patAddress.current.focus();
				//     }, 300)
				//     break;
				case 22:
					setTimeout(() => {
						this.birthAddress.current.focus();
					}, 300)
					break;
				// case 23:
				//     setTimeout(() => {
				//         this.patAddress.current.focus();
				//     }, 300)
				//     break;
				case 24:
					setTimeout(() => {
						this.nativeAddress.current.focus();
					}, 300)
					break;
				// case 25:
				//     setTimeout(() => {
				//         this.patAddress.current.focus();
				//     }, 300)
				//     break;
				// case 26:
				//     setTimeout(() => {
				//         this.patAddress.current.focus();
				//     }, 300)
				//     break;
				case 27://现住址邮编
					this.patAdressZipTip()
					break;
				case 28:
					setTimeout(() => {
						this.houseAddress.current.focus();
					}, 300)
					break;
				case 29:
					if (this.props.form.getFieldValue('houseAddress')) {
						setTimeout(() => {
							this.registerZIP.current.focus();
						}, 300)
					}
					break;
				case 30:
					this.patAdressHouseZipTip()
					break;
				case 31:
					setTimeout(() => {
						this.sourceTip()
					}, 100)
					break;
				default:
					setTimeout(() => {
						this.creadCard.current.buttonNode.focus();
					}, 300)
			}
		}

		//身份选择
		handleposTagFouce = (data) => {
			if (!data) {
				this.setState({
					socialTag: ""
				})
			} else {
				this.setState({
					socialTag: data
				})
			}
		}

		//输入身份证号码 自动获取到出生日期 年龄
		validCard = (e, num) => {
			if (this.props.form.getFieldValue('patCredNo') && this.props.form.getFieldValue('patCredNo').length > 0 && this.props.form.getFieldValue('patCredTypeCode') == "01") {
				this.posTip(e.target.value, num)
				return
			}
			if (this.props.form.getFieldValue('patCredTypeCode') != "01" && this.props.form.getFieldValue('patCredNo') && this.props.form.getFieldValue('patCredNo').length > 0) {
				setTimeout(() => {
					this.sex.current.focus();
				}, 300)
			}
		}

		onCityFocus = (provinceFlag, cityFlag) => {
			let city = this.state[cityFlag];
			let provinceID = this.props.form.getFieldValue(provinceFlag);
			if ((city.length === 0) && (provinceID)) {
				let newCity = []
				newCity = this.state.localCity.filter((item) => item.province == provinceID);
				this.setState({
					[cityFlag]: newCity,
				})
			}
		}

		//选择乡时加载村数据
		getHamlets = (villageID, flag) => {
			let data = {
				params: [{
					villageId: villageID
				}],
			}
			$http.post('urlS', this, {
				code: '03030008',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							[flag + "hamlets"]: res.result,
						})
					} else {
						this.setState({
							[flag + "hamlets"]: [],
						})
					}
				}
			})
		}

		//选择省 去到市区
		autoFocusCity = (flag) => {
			switch (flag) {
				case "birth":
					setTimeout(() => {
						this.birthCity.current.focus();
					}, 300)
					break;
				case "native":
					setTimeout(() => {
						this.nativeCity.current.focus();
					}, 300)
					break;
				case "present":
					setTimeout(() => {
						this.city.current.focus();
					}, 300)
					break;
				case "register":
					setTimeout(() => {
						this.houseCity.current.focus();
					}, 300)
					break;
				case "company":
					setTimeout(() => {
						this.companyCity.current.focus();
					}, 300)
					break;
				case "contact":
					setTimeout(() => {
						this.econCity.current.focus();
					}, 300)
					break;
			}
		}

		//选择或清除省
		onProvinceChange(flag, value, option) {
			if (value) {
				let city = []
				city = this.state.localCity.filter((item) => item.province == value);
				let patInfo = this.state.parms;
				let patFlag = this.firstToUp(flag);
				if (patInfo["pat" + patFlag + "ProvinceID"]) {
					patInfo["pat" + patFlag + "ProvinceID"] = undefined;
					patInfo["pat" + patFlag + "CityID"] = undefined;
					patInfo["pat" + patFlag + "AreaID"] = undefined;
					patInfo["pat" + patFlag + "VillageID"] = undefined;
					patInfo["pat" + patFlag + "HamletID"] = undefined;
				}
				if (city && city.length == 0) {
					this.setState({
						[flag + "Door"]: false
					})
				} else {
					this.setState({
						[flag + "Door"]: true
					})
				}
				this.autoFocusCity(flag)
				this.setState({
					[flag + "City"]: city,
					[flag + "Areas"]: [],
					[flag + "Villages"]: [],
					[flag + "Hamlets"]: [],
					parms: patInfo,
				})
				this.props.form.setFieldsValue({
					[flag + "CityID"]: undefined,
					[flag + "AreaID"]: undefined,
					[flag + "VillageID"]: undefined,
					[flag + "HamletID"]: undefined,
					[flag + "ZIP"]: undefined
				});
			} else {
				//清除省
				this.props.form.setFieldsValue({
					[flag + "CityID"]: undefined,
					[flag + "AreaID"]: undefined,
					[flag + "VillageID"]: undefined,
					[flag + "HamletID"]: undefined,
					[flag + "ZIP"]: undefined
				});
				let patInfo = this.state.parms;
				let patFlag = this.firstToUp(flag);
				if (patInfo["pat" + patFlag + "ProvinceID"]) {
					patInfo["pat" + patFlag + "ProvinceID"] = undefined;
					patInfo["pat" + patFlag + "CityID"] = undefined;
					patInfo["pat" + patFlag + "AreaID"] = undefined;
					patInfo["pat" + patFlag + "VillageID"] = undefined;
					patInfo["pat" + patFlag + "HamletID"] = undefined;
				}
				this.setState({
					[flag + "City"]: [],
					[flag + "Areas"]: [],
					[flag + "Villages"]: [],
					[flag + "Hamlets"]: [],
					parms: patInfo,
				})
			}
		}

		//首字母大写
		firstToUp = (str) => {
			return str.substring(0, 1).toUpperCase() + str.substring(1);
			// 正则法
			// str = str.toLowerCase();
			// var reg = /\b(\w)|\s(\w)/g; //  \b判断边界\s判断空格
			// return str.replace(reg, function (m) {
			//     return m.toUpperCase()
			// });
		}

		onCityFocus = (provinceFlag, cityFlag) => {
			let city = this.state[cityFlag];
			let provinceID = this.props.form.getFieldValue(provinceFlag);
			if ((city.length === 0) && (provinceID)) {
				let newCity = []
				newCity = this.state.localCity.filter((item) => item.province == provinceID);
				this.setState({
					[cityFlag]: newCity,
				})
			}

		}

		//选择市 去到县
		autoFocusCountry = (flag) => {
			switch (flag) {
				case "birth":
					setTimeout(() => {
						this.bornCountry.current.focus();
					}, 300)
					break;
				case "native":
					setTimeout(() => {
						this.nativeCountry.current.focus();
					}, 300)
					break;
				case "present":
					setTimeout(() => {
						this.country.current.focus();
					}, 300)
					break;
				case "register":
					setTimeout(() => {
						this.houseCountry.current.focus();
					}, 300)
					break;
				case "company":
					setTimeout(() => {
						this.companyCountry.current.focus();
					}, 300)
					break;
				case "contact":
					setTimeout(() => {
						this.econCountry.current.focus();
					}, 300)
					break;
			}
		}

		//选择或清除市
		onCityChange(flag, value, option) {
			if (value) {
				this.props.form.setFieldsValue({
					[flag + "ProvinceID"]: option.props.provinceid,
					[flag + "AreaID"]: undefined,
					[flag + "VillageID"]: undefined,
					[flag + "HamletID"]: undefined,
					[flag + "ZIP"]: undefined
				});
				this.autoFocusCountry(flag)
				let patInfo = this.state.parms;
				let patFlag = this.firstToUp(flag);
				if (patInfo["pat" + patFlag + "CityID"]) {
					patInfo["pat" + patFlag + "CityID"] = undefined;
					patInfo["pat" + patFlag + "AreaID"] = undefined;
					patInfo["pat" + patFlag + "VillageID"] = undefined;
					patInfo["pat" + patFlag + "HamletID"] = undefined;
				}
				this.setState({
					parms: patInfo,
				})
				this.getAreas(value, flag, "1");
			} else {
				//清除市
				this.props.form.setFieldsValue({
					[flag + "CityID"]: undefined,
					[flag + "AreaID"]: undefined,
					[flag + "VillageID"]: undefined,
					[flag + "HamletID"]: undefined,
					[flag + "ZIP"]: undefined
				});
				let patInfo = this.state.parms;
				let patFlag = this.firstToUp(flag);
				if (patInfo["pat" + patFlag + "CityID"]) {
					patInfo["pat" + patFlag + "CityID"] = undefined;
					patInfo["pat" + patFlag + "AreaID"] = undefined;
					patInfo["pat" + patFlag + "VillageID"] = undefined;
					patInfo["pat" + patFlag + "HamletID"] = undefined;
				}
				this.setState({
					[flag + "Areas"]: [],
					[flag + "Villages"]: [],
					[flag + "Hamlets"]: [],
					parms: patInfo,
				})
			}
		}

		//选择市时加载县数据
		getAreas = (cityID, flag, cleanFlag) => {
			let data = {
				params: [{
					cityId: cityID
				}],
			}
			$http.post('urlS', this, {
				code: '03030006',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						if (cleanFlag === "1") {
							this.setState({
								[flag + "Areas"]: res.result,
								[flag + "Villages"]: [],
								[flag + "Hamlets"]: [],
							})
						} else {
							this.setState({
								[flag + "Areas"]: res.result,
							})
						}
					} else {
						this.setState({
							[flag + "Areas"]: [],
							[flag + "Villages"]: [],
							[flag + "Hamlets"]: [],
						})
					}
				}
			})

		}

		//选择县 去到乡
		autoFocusVillage = (flag, zipCode) => {
			switch (flag) {
				case "birth":
					setTimeout(() => {
						this.bornVillage.current.focus();
					}, 300)
					break;
				case "native":
					setTimeout(() => {
						this.nativeVillage.current.focus();
					}, 300)
					break;
				case "present":
					setTimeout(() => {
						this.village.current.focus();
						if (zipCode) {
							this.props.form.setFieldsValue({ presentZIP: zipCode })
						}
					}, 300)
					break;
				case "register":
					setTimeout(() => {
						this.houseVillage.current.focus()
						if (zipCode) {
							this.props.form.setFieldsValue({ registerZIP: zipCode })
						}
					}, 300)
					break;
				case "company":
					setTimeout(() => {
						this.companyVillage.current.focus()
						if (zipCode) {
							this.props.form.setFieldsValue({ companyZIP: zipCode })
						}
					}, 300)
					break;
				case "contact":
					setTimeout(() => {
						this.econVillage.current.focus()
					}, 300)
					break;
			}
		}

		//选择或清除县
		onAreaChange(flag, value, option) {
			if (value) {
				this.props.form.setFieldsValue({
					[flag + "VillageID"]: undefined,
					[flag + "HamletID"]: undefined,
					[flag + "ZIP"]: undefined
				});
				this.getVillages(value, flag, "1");
				this.autoFocusVillage(flag)
			} else {
				//清除市
				this.props.form.setFieldsValue({
					[flag + "VillageID"]: undefined,
					[flag + "HamletID"]: undefined,
					[flag + "ZIP"]: undefined
				});
				let patInfo = this.state.parms;
				let patFlag = "";
				switch (flag) {
					case "birth":
						patFlag = "Birth";
						break;
					case "native":
						patFlag = "Native";
						break;
					case "present":
						patFlag = "Present";
						break;
					case "register":
						patFlag = "Register";
						break;
					case "company":
						patFlag = "Company";
						break;
					case "contact":
						patFlag = "Contact";
						break;
				}
				if (patInfo["pat" + patFlag + "AreaID"]) {
					patInfo["pat" + patFlag + "AreaID"] = undefined;
					patInfo["pat" + patFlag + "VillageID"] = undefined;
					patInfo["pat" + patFlag + "HamletID"] = undefined;
				}
				this.setState({
					[flag + "Villages"]: [],
					[flag + "Hamlets"]: [],
					parms: patInfo,
				})
			}
		}

		//县获取焦点
		onAreaFocus(cityFlag, areaFlag) {
			let area = this.state[areaFlag + "Areas"];
			let cityID = this.props.form.getFieldValue(cityFlag);
			if ((area.length === 0) && (cityID)) {
				this.getAreas(cityID, areaFlag, "0");
			}
		}

		//选择乡 去到村
		autoFocusHamlet = (flag, zipCode) => {
			switch (flag) {
				case "birth":
					setTimeout(() => {
						this.bornHamlet.current.focus()
					}, 300)
					break;
				case "native":
					setTimeout(() => {
						this.nativeHamlet.current.focus()
					}, 300)
					break;
				case "present":
					if (zipCode) {
						this.props.form.setFieldsValue({ presentZIP: zipCode })
					}
					setTimeout(() => {
						this.hamlet.current.focus()
					}, 300)
					break;
				case "register":
					if (zipCode) {
						this.props.form.setFieldsValue({ registerZIP: zipCode })
					}
					setTimeout(() => {
						this.houseHamlet.current.focus()
					}, 300)
					break;
				case "company":
					if (zipCode) {
						this.props.form.setFieldsValue({ companyZIP: zipCode })
					}
					setTimeout(() => {
						this.companyHamlet.current.focus()
					}, 300)
					break;
				case "contact":
					setTimeout(() => {
						this.econHamlet.current.focus()
					}, 300)
					break;
			}
		}

		//选择或清除乡
		onVillageChange(flag, value, option) {
			if (value) {
				this.props.form.setFieldsValue({
					[flag + "HamletID"]: undefined
				});
				this.getHamlets(value, flag);
				this.autoFocusHamlet(flag)
			} else {
				//清除市
				this.props.form.setFieldsValue({
					[flag + "HamletID"]: undefined,
					[flag + "ZIP"]: undefined
				});
				let patInfo = this.state.parms;
				let patFlag = "";
				switch (flag) {
					case "birth":
						patFlag = "Birth";
						break;
					case "native":
						patFlag = "Native";
						break;
					case "present":
						patFlag = "Present";
						break;
					case "register":
						patFlag = "Register";
						break;
					case "company":
						patFlag = "Company";
						break;
					case "contact":
						patFlag = "Contact";
						break;
				}
				if (patInfo["pat" + patFlag + "VillageID"]) {
					patInfo["pat" + patFlag + "VillageID"] = undefined;
					patInfo["pat" + patFlag + "HamletID"] = undefined;
				}
				this.setState({
					[flag + "Hamlets"]: [],
					parms: patInfo,
				})
			}
		}

		//乡获取焦点时调用
		onVillageFocus(areaFlag, villageFlag) {
			let village = this.state[villageFlag + "Villages"];
			let areaID = this.props.form.getFieldValue(areaFlag);
			if ((village.length === 0) && (areaID)) {
				this.getVillages(areaID, villageFlag, "0");
			}
		}

		//选择县时加载乡数据
		getVillages = (countyID, flag, cleanFlag) => {
			let data = {
				params: [{
					areaId: countyID,
				}],
			}
			$http.post('urlS', this, {
				code: '03030007',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						if (cleanFlag === "1") {
							this.setState({
								[flag + "Villages"]: res.result,
								[flag + "Hamlets"]: [],
							})
						} else {
							this.setState({
								[flag + "Villages"]: res.result,
							})
						}
					} else {
						this.setState({
							[flag + "Villages"]: [],
							[flag + "Hamlets"]: [],
						})
					}
				}
			})

		}

		onHamletFocus(villageFlag, hamletsFlag) {
			let hamlets = this.state[hamletsFlag + "Hamlets"];
			let villageID = this.props.form.getFieldValue(villageFlag);
			if ((hamlets.length === 0) && (villageID)) {
				this.getHamlets(villageID, hamletsFlag);
			}
		}

		//选择国籍 -- 民族
		handleCountry = (data, dats) => {
			this.setState({
				credCountry: data
			})
			if (data != 44) {
				this.props.form.setFieldsValue({ patNationID: undefined });
			}
		}

		//获取到出生日期自动计算年龄
		autoAge = (patBirthDate, patBirthTime) => {
			let data = {}
			data = {
				params: [{
					birthday: patBirthDate ? patBirthDate : undefined,
					birthTime: patBirthTime ? patBirthTime : undefined,
					hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
				}],
			}
			if (patBirthDate && patBirthDate != "Invalid date") {
				$http.post('urlS', this, {
					code: '03030013',
					data: data,
					success: function (res) {
						if (+res.errorCode === 0) {
							let parmsAge = { ...this.state.parms }
							parmsAge["patAge"] = res.result
							this.setState({
								credAge: res.result,
								parms: parmsAge
							})
							this.props.form.setFieldsValue({ age: res.result })
						} else {

						}
					}
				})
			}
		}

		//选择日期 计算年龄
		onPanelChange = (mode) => {
			this.setState({
				patBirthVisible: false,
				birthTime: this.state.birthTime,
				birthData: moment(mode).format('YYYY-MM-DD'),
			})
			this.props.form.setFieldsValue({ patBirthTime: undefined })
			this.autoAge(moment(mode).format('YYYY-MM-DD'), this.state.birthTime && this.state.birthTime ? this.state.birthTime : undefined);
		}

		//日期面板打开/关闭
		handleOnOpenChangeData = (status) => {
			if (!status) {
				setTimeout(() => {
					this.patMobile.current.focus();
				}, 300)
			}
		}

		//选择时间
		onPanelChangeTime = (mode) => {
			this.setState({
				patBirthVisible: false,
				birthTime: moment(mode).format('HH:mm'),
				birthData: this.state.birthData,
			})
			this.autoAge(this.state.birthData && this.state.birthData ? this.state.birthData : undefined, moment(mode).format('HH:mm'));
		}

		//展开/关闭起始时间
		handleOnOpenChangeStart = (status) => {
			if (status) {
				this.setState({
					openTime: true,
				})
			} else {
				this.setState({
					openTime: false,
				})
				setTimeout(() => {
					this.patMobile.current.focus();
				}, 300)
			}
			if (!status) {
				this.setState({ isTransitionStart: true })
			} else {
				this.setState({ isTransitionStart: false })
			}
		}

		//时间框回车跳到手机号码项
		timeBlur = (e) => {
			var e = window.event || e;
			if (e.keyCode == 13) {
				setTimeout(() => {
					this.patMobile.current.focus();
				}, 300)
				this.setState({
					openTime: false,
					isTransitionStart: true
				})
			}
		}
		// 回显社保卡信息
		fillInsuInfo = (patInfo) => {
			const { localProvince, localCity } = this.state;
			// 省
			if (patInfo.patPresentProvinceCode.length > 0) {
				const province = localProvince.filter(p => p.code == patInfo.patPresentProvinceCode);
				if (province && province.length > 0) {
					const curProvince = { patPresentProvinceID: province[0].id }
					patInfo = { ...patInfo, ...curProvince };
				}

			}
			// 市
			if (patInfo.patPresentCityCode.length > 0) {
				const city = localCity.filter(p => p.code == patInfo.patPresentCityCode);
				if (city && city.length > 0) {
					const curCity = { patPresentCityID: city[0].id }
					patInfo = { ...patInfo, ...curCity };
					this.getAreas(curCity.patPresentCityID, 'present', true);
				}
			}
			// 区县
			if (patInfo.patPresentAreaCode.length > 0) {
				setTimeout(() => {
					const { presentAreas } = this.state;
					const area = presentAreas.filter(p => p.code == patInfo.patPresentAreaCode);
					if (area && area.length > 0) {
						const curArea = { patPresentAreaID: area[0].id }
						patInfo = { ...patInfo, ...curArea };
					}
					this.fillPatInfo(patInfo);
				}, 300);
			} else {
				// 如果没有参保地址，则仅回显基本信息
				this.fillPatInfo(patInfo);
			}

		}

		// 设置基本信息
		fillPatInfo = (patInfo) => {
			this.setState({
				parms: patInfo,
				initCardDr: this.state.baseParms.cardType[0].id,
				idCardCode: this.state.baseParms.cardType[0].code,
				nowRead: this.state.baseParms.cardType[0].readMode,
				cardLength: this.state.baseParms.cardType[0].cardLength && this.state.baseParms.cardType[0].cardLength != "" ? this.state.baseParms.cardType[0].cardLength + "位" : "",
				nowCost: this.state.baseParms.cardType[0].cardCost,
				nowInv: this.state.baseParms.cardType[0].invFlag,
			});

		}

		//查找病人--子组件回调
		handleParms = (even, boxStatus) => {
			this.handleVail()
			// this.props.form.setFieldsValue({ patCredTypeCode: even.patCredTypeCode })
			// this.props.form.setFieldsValue({ patCredNo: even.patCredNo })
			//查找病人之后使用居民身份证调起病人关联信息 若有并点击了修改资料 才将信息回显 否则不做回显 不覆盖用户已输入内容
			this.setState({
				credWarning: false,
				patPresentOthID: even.patPresentOthID,
				patNativeOthID: even.patNativeOthID,
				patRegisterOthID: even.patRegisterOthID,
				patCompanyOthID: even.patCompanyOthID,
				patBirthOthID: even.patBirthOthID,
				patContactOthID: even.patContactOthID,
				patiId: even.patID,
				findPatNo: even.patNo,
				inBoxStatus: boxStatus,
			})

			// 新卡直接返回基本信息
			if (even.patNo == '') {
				this.fillInsuInfo(even);
				return;
			}


			let data = {}
			data = {
				params: [{
					number: even.patNo
				}],
			}
			$http.post('urlS', this, {
				code: '03030004',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0 && res.result.data.length > 0) {
						this.child.setValue(res.result.patInfo.patCredNo)
						this.childs.showModals()
						this.childs.getBasepatientInfo(res, this.state.baseParms.cardType, this.props.form.getFieldValue('cardNo'))
					} else {
						//只可绑定卡
						this.handleVail();
						this.props.form.resetFields();
						if (even.cardInfo && even.cardInfo.length > 0) {
							for (var i = 0; i < even.cardInfo.length; i++) {
								if (even.cardInfo[i].cardTypeDesc == '退卡' || even.cardInfo[i].cardTypeDesc == '回收' || even.cardInfo[i].cardTypeDesc == '作废') {
									even.cardInfo.splice(i, 1)
								}
							}
						}
						//表单回显
						if (this.props.form.getFieldValue('patCredTypeCode') == '01') {
							this.handleInmations(this.props.form.getFieldValue('patCredNo'), 2)
						}
						this.autoAge(this.props.form.getFieldValue('patBirthDate'));
						this.setState({
							birthDoor: true,//出生地址
							nativeDoor: true,//籍贯地址
							presentDoor: true,//现住址
							registerDoor: true,//户口地址
							companyDoor: true,//单位地址
							contactDoor: true,//联系人地址
							noCard: false,
							isModefined: 1,
							parms: even,
							patBarPatID: even.patID,
							posType: even.patCredTypeCode,
							credTypeID: even.patCredTypeID,
							credCountry: even.patCountryID,
							credBirthday: even.patBirthDateTime ? even.patBirthDateTime : undefined,
							birthData: even.patBirthDate ? even.patBirthDate : undefined,
							credAge: even.patAge ? even.patAge : undefined,
							patiId: even.patID,
							patEduID: res.result.patInfo ? res.result.patInfo.patEduID : undefined,
							invoiceValue: this.state.baseParms.transactionNo,
							initCardDr: this.state.baseParms.cardType[0].id,
							idCardCode: this.state.baseParms.cardType[0].code,
							nowRead: this.state.baseParms.cardType[0].readMode,
							cardLength: this.state.baseParms.cardType[0].cardLength && this.state.baseParms.cardType[0].cardLength != "" ? this.state.baseParms.cardType[0].cardLength + "位" : "",
							nowCost: this.state.baseParms.cardType[0].cardCost,
							nowInv: this.state.baseParms.cardType[0].invFlag,
							isTransitionStart: true,
						}, () => {
							this.props.form.setFieldsValue({ 'patEduID': res.result.patInfo ? res.result.patInfo.patEduID : undefined })
						})
						setTimeout(() => {
							this.patName.current.focus();
						}, 300)
					}
				},
				error: function () {
					message.error("数据请求异常,请联系管理员", this.state.userData && this.state.userData.messageTime)
				}
			})
		}

		//病人关联 -- 子组件回调
		handleEdit = (record, even, patientInfo) => {
			//带回当前卡信息 以及 病人信息 已绑卡类
			setTimeout(() => {
				this.patName.current.focus();
			}, 800)
			this.handleVail();
			this.props.form.resetFields();
			const evens = even.patInfo
			const data = even.data
			this.setState({
				birthCity: [],
				nativeCity: [],
				presentCity: [],
				registerCity: [],
				companyCity: [],
				contactCity: [],
				birthDoor: true,//出生地址
				nativeDoor: true,//籍贯地址
				presentDoor: true,//现住址
				registerDoor: true,//户口地址
				companyDoor: true,//单位地址
				contactDoor: true,//联系人地址
				credWarning: false,
				parms: evens,
				posType: evens.patCredTypeCode,
				credTypeID: evens.patCredTypeID,
				noCard: true,
				isModefined: 1,
				selfCredNo: evens.patCredNo,//本人身份证
				cardSatus: record,
				patientInfo: patientInfo,
				initCardDr: record.cardTypeID,
				patEduID: record.patEduID,
				cardPayMentID: record.cardPayMentID,
				nowCost: record.cardCost,
				repariFeeFlag: record.repairFlag,
				autoCreateCardNo: record.autoCreateCardNo,
				replenishZero: record.zeroFlag,
				idCardCode: record.cardCode,
				credAge: evens.patAge ? evens.patAge : undefined,
				credBirthday: evens.patBirthDateTime ? evens.patBirthDateTime : undefined,
				birthData: evens.patBirthDate ? evens.patBirthDate : undefined,
				isTransitionStart: true,
				patiId: record.patID,
				patBarPatID: evens.patID,
				// retrieveFlag:record.retrieveFlag,
			})
			if ((record.cardStatusDesc == "正常" && record.autoCreateNo != "Y") || (record.cardStatusDesc == "挂失" && record.autoCreateNo != "Y")) {
				this.setState({
					canRetarCard: "Y"
				})
			} else {
				this.setState({
					canRetarCard: "N"
				})
			}
			if (record.cardStatusDesc == '挂失') {
				this.setState({
					isCancel: 1
				})
			} else {
				this.setState({
					isCancel: -1
				})
			}
			this.props.form.setFieldsValue({ cardTypeID: record.cardTypeID })
			this.props.form.setFieldsValue({ cardNo: record.cardNo })
			// this.setForm(evens)
			this.bingCardArr(data)
		}

		//获取身份证号年龄
		getAge(patCredNo) {
			var len = (patCredNo + "").length;
			if (len == 0) {
				return 0;
			} else {
				if ((len != 15) && (len != 18))//身份证号码只能为15位或18位其它不合法 ---18位
				{
					return 0;
				}
			}
			var strBirthday = "";
			if (len == 18)//处理18位的身份证号码从号码中得到生日和性别代码
			{
				strBirthday = patCredNo.substr(6, 4) + "-" + patCredNo.substr(10, 2) + "-" + patCredNo.substr(12, 2);
			}
			if (len == 15) {
				strBirthday = "19" + patCredNo.substr(6, 2) + "-" + patCredNo.substr(8, 2) + "-" + patCredNo.substr(10, 2);
			}
			this.autoAge(strBirthday)
		}

		//获取身份证号出生日期
		getBirthday(patCredNo) {
			var birthdayno, birthdaytemp
			if (patCredNo.length == undefined) {
				return
			}
			if (patCredNo && patCredNo.length == 18) {
				birthdayno = patCredNo.substring(6, 14)
			} else if (patCredNo.length == 15) {
				birthdaytemp = patCredNo.substring(6, 12)
				patCredNo = "19" + birthdaytemp
			} else {
				return ''
			}
			var birthday = birthdayno.substring(0, 4) + "-" + birthdayno.substring(4, 6) + "-" + birthdayno.substring(6, 8)
			return birthday
		}

		//获取身份证号性别 第17位代表性别，奇数为男，偶数为女
		getSex(patCredNo) {
			let sexno, sex
			if (patCredNo && patCredNo.length == 18) {
				sexno = patCredNo.substring(16, 17)
			} else if (patCredNo.length == 15) {
				sexno = patCredNo.substring(14, 15)
			} else {
				// alert("错误的身份证号码，请核对！")
				return false
			}
			var tempid = sexno % 2;
			if (tempid == 0) {
				sex = '2'
			} else {
				sex = '1'
			}
			return sex
		}

		//取地址栏传过来的数据
		getQueryString(name) {
			var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
			var r = this.props.location.search.substr(1).match(reg);
			if (r != null) {
				return decodeURIComponent(r[2]);
			}
			return null;
		}

		// 调用子组件的连接事件 -- 寻找病人
		OnChildrefs = (ref) => {
			this.child = ref
		}

		// 调用子组件的连接事件 -- 关联病人信息
		Onrefs = (ref) => {
			this.childs = ref
		}

		//查找病人
		handlePatients = () => {
			this.child.setValue(this.state.findPatNo)
			this.child.showModal()
		}

		//病人姓名 格式验证 是否允许带空格
		validName = (rule, value, callback) => {
			if ((this.props.form.getFieldValue("patName") && this.props.form.getFieldValue("patName").length > 0)) {
				var reg = /^(([a-zA-Z+\.?\·?a-zA-Z+]{2,30}$)|([\u4e00-\u9fa5+\s·?\u4e00-\u9fa5+]{2,30}$))/;
				if (!reg.test(value)) {
					callback('姓名格式填写错误'); // 校验未通过
					return;
				}
				callback();
			}
			callback();
		}

		validNames = (rule, value, callback) => {
			if (this.props.form.getFieldValue("patEContact") && this.props.form.getFieldValue("patEContact").length > 0) {
				var reg = /^(([a-zA-Z+\.?\·?a-zA-Z+]{2,30}$)|([\u4e00-\u9fa5+\s·?\u4e00-\u9fa5+]{2,30}$))/;
				if (!reg.test(value)) {
					callback('姓名格式填写错误'); // 校验未通过
					return;
				}
				callback();
			}
			callback();
		}

		//选择建卡类型 格式验证
		validFunction = (rule, value, callback) => {
			//身份证 18位  就诊卡 银医卡 条形码 根据配置合理提示 不根据固定的卡类型做判断 根据配置项是否可补0以及卡号长度进行检测 区分身份证 code == 12
			const { cardLength, cardLengthCard, idCardCode, idCardCodePop, replenishZero, popCardVis, } = this.state
			//控制选择建卡和卡操作选择绑卡id 正确提示 及 校验
			let diffLength = popCardVis ? cardLengthCard : cardLength
			// console.log("cardLengthCard", cardLengthCard)
			let diffCode = popCardVis ? idCardCodePop : idCardCode
			if (diffCode == '02') {
				var city = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江 ", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北 ", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏 ", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外 " };
				if (!value || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(value)) {
					this.setState({
						bindVail: true
					})
					callback('身份证号格式错误'); // 校验未通过
					return;
				}

				else if (!city[value.substr(0, 2)]) {
					this.setState({
						bindVail: true
					})
					callback('身份证号格式错误'); // 校验未通过
					return;
				}
				else {
					//18位身份证需要验证最后一位校验位
					if (value.length == 18) {
						value = value.split('');
						//∑(ai×Wi)(mod 11)
						//加权因子
						var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
						//校验位
						var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
						var sum = 0;
						var ai = 0;
						var wi = 0;
						for (var i = 0; i < 17; i++) {
							ai = value[i];
							wi = factor[i];
							sum += ai * wi;
						}
						var last = parity[sum % 11];
						//最后一位不区分大小写
						if (value[17] == 'x') value[17] = value[17].toUpperCase();
						if (parity[sum % 11] != value[17]) {
							this.setState({
								bindVail: true
							})
							callback('身份证号格式错误'); // 校验未通过
							return;
						} else {
							this.checkIs()
						}
					}
				}
				callback();
			}
			if (replenishZero == "N" && parseInt(diffLength) > 0 && diffCode != '12') {
				let length = parseInt(diffLength)
				var reg = new RegExp('^\\d{' + length + '}$')
				if (!reg.test(value)) {
					this.setState({
						bindVail: true
					})
					callback('该卡号长度不正确，请输入有效卡号'); // 校验未通过
					return;
				} else {
					this.checkIs()

				}
			}
			if (replenishZero == "Y" && parseInt(diffLength) > 0) {
				let length = parseInt(diffLength)
				var reg = new RegExp("^\\d{" + length + "}$");
				if (!reg.test(value)) {
					this.setState({
						bindVail: true
					})
					callback('该卡号无效，请输入有效卡号,数字可自动补0'); // 校验未通过
					return;
				} else {
					this.checkIs()
				}
			}
			if (replenishZero == "N" && !parseInt(diffLength) > 0) {
				if (!/^[0-9]*$/.test(value)) {
					this.setState({
						bindVail: true
					})
					callback('请输入任意数字'); // 校验未通过
					return;
				} else {
					if (value.length != 0) {
						this.checkIs()
					} else {
						this.setState({
							bindVail: true
						})
					}
				}
			}
			callback();
		}

		/*
		code:03030009
		功能:进行身份证号码是否有建卡信息的相关检测
		事项：
		1.从关联病人页面/查找页面(无卡信息,不弹关联病人，直接进行基本信息回显)带过来的身份证信息 若未修改身份证号 不做弹窗验证和已使用提示 直接下一步 反之
		2.正常建卡流程 直接输入身份证号 进行检测
				A 有建卡信息
					a1 有有效的绑卡信息则弹出关联页面
					a2 无有效绑卡信息 则带出该卡的病人基本信息进行回显
				B 无建卡信息 为新身份证 不做提示  直接下一步
		*/
		handleInmations = (credN, num) => {
			let data = {}
			data = {
				params: [{
					cardTypeID: '',
					cardNo: '',
					credTypeCode: this.props.form.getFieldValue('patCredTypeCode') ? this.props.form.getFieldValue('patCredTypeCode') : '',
					patName: this.props.form.getFieldValue('patName') ? this.props.form.getFieldValue('patName') : '',
					patMobile: this.props.form.getFieldValue('patMobile') ? this.props.form.getFieldValue('patMobile') : '',
					credNo: typeof (credN) != 'object' ? credN : (this.props.form.getFieldValue('patCredNo') ? this.props.form.getFieldValue('patCredNo') : '')
				}],
			}
			if (this.state.selfCredNo != this.props.form.getFieldValue('patCredNo')) {
				$http.post('urlS', this, {
					code: '03030009',
					data: data,
					success: function (res) {
						//A 弹出的两个条件 不是关联病人页面带回 isModefined==-1 关联病人页面/查找页面带回身份证selfCredNo
						if (+res.errorCode === 0 && res.result.data.length > 0) {
							//病人信息/查找页面带回身份证且身份证进行了重新编辑进行是否被使用检测
							if (this.state.isModefined == 1 && this.state.selfCredNo != this.props.form.getFieldValue('patCredNo')) {
								let content = <p style={{ color: 'rgba(0, 0, 0, 0.85)', fontSize: '16px', marginTop: '-8px' }}>证件号码已被使用,病人ID:<span style={{ marginRight: '6px' }}>{res.result ? res.result.patInfo.patNo : ''}</span><span style={{ marginRight: '6px' }}>{res.res ? status.cardType : ''}</span><span>{status ? status.cardNo : ''}</span></p>
								Util.countDown("warning", "温馨提示", content, 3)
							} else { //直接输入
								if (this.state.selfCredNo == this.props.form.getFieldValue('patCredNo')) {
									setTimeout(() => {
										this.patMobile.current.focus();
									}, 600);
									return
								}
								if (res.result.patInfo.patNo) {
									this.child.setValue(res.result.patInfo.patCredNo)
									this.childs.showModals()
									this.childs.getBasepatientInfo(res, this.state.baseParms.cardType, this.props.form.getFieldValue('cardNo'))
								}
							}
						} else {
							//有建卡信息（无绑卡时）信息回显  下一步
							if (res.result.patInfo) {
								this.props.form.resetFields()
								this.setState({
									parms: res.result.patInfo,
									bindDis: false,
									presentCity: [],
									bsDoor: true,
									noCard: true,
									isModefined: 1,
									selfCredNo: res.result.patInfo.patCredNo,
									patBarPatID: res.result.patInfo.patID,
								})
								if (num != 2) {
									setTimeout(() => {
										this.patMobile.current.focus();
									}, 300)
								}
							} else {//无建卡信息,无绑卡时 下一步
								if (num != 2) {
									setTimeout(() => {
										this.patMobile.current.focus();
									}, 300)
								}
							}
						}
					},
					error: function () {

					}
				})
			} else {
				if (num != 2) {
					setTimeout(() => {
						this.patMobile.current.focus();
					}, 300)
				}
			}
		}

		//点击读卡  -----输入完卡号
		handleInmationChick = () => {
			this.setState({
				readLoading: true
			})
			if (this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length > 0) {
				let data = {}
				data = {
					params: [{
						cardTypeID: this.props.form.getFieldValue('cardTypeID') ? this.props.form.getFieldValue('cardTypeID') : '',
						cardNo: this.props.form.getFieldValue('cardNo') ? this.props.form.getFieldValue('cardNo') : '',
						patName: this.props.form.getFieldValue('patName') ? this.props.form.getFieldValue('patName') : '',
						patMobile: this.props.form.getFieldValue('patMobile') ? this.props.form.getFieldValue('patMobile') : '',
						credTypeCode: '',
						credNo: ''
					}],
				}
				$http.post('urlS', this, {
					code: '03030009',
					data: data,
					success: function (res) {
						if (+res.errorCode === 0 && res.result.data.length > 0) {
							//判断接口请求成功数据是否返回成功
							this.setState({
								readLoading: false
							})
							if (res.result.patInfo.patNo) {
								this.childs.showModals()
								this.childs.getBasepatientInfo(res, this.state.baseParms.cardType, this.props.form.getFieldValue('cardNo'))
								this.setState({
									readLoading: false
								})
							} else {
								this.setState({
									readLoading: false
								})
							}
						} else {
							this.setState({
								readLoading: false
							})
						}
						if (this.popCardVis == "false") {
						}
					},
					error: function () {
						this.setState({
							readLoading: false
						})
					}
				})
			} else {
				this.setState({
					readLoading: false,
				})
				message.warning('请输入卡号', this.state.userData && this.state.userData.messageTime);
			}
		}

		//弹窗提示
		//失去焦点读卡  -----输入完卡号
		handleInmation = () => {
			if (this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length > 0) {
				let data = {}
				data = {
					params: [{
						cardTypeID: this.props.form.getFieldValue('cardTypeID') ? this.props.form.getFieldValue('cardTypeID') : '',
						cardNo: this.props.form.getFieldValue('cardNo') ? this.props.form.getFieldValue('cardNo') : '',
						patName: this.props.form.getFieldValue('patName') ? this.props.form.getFieldValue('patName') : '',
						patMobile: this.props.form.getFieldValue('patMobile') ? this.props.form.getFieldValue('patMobile') : '',
						credTypeCode: '',
						credNo: ''
					}],
				}
				$http.post('urlS', this, {
					code: '03030009',
					data: data,
					success: function (res) {
						if (+res.errorCode === 0 && res.result.data.length > 0) {
							//判断接口请求成功数据是否返回成功
							if (this.state.isFlag == 3 || this.state.isFlag == 4 || isModefined == 3 || isModefined == 6) {
								let content = <p style={{ color: 'rgba(0, 0, 0, 0.85)', fontSize: '16px', marginTop: '-8px' }}>证件号码已被使用,病人ID:<span style={{ marginRight: '6px' }}>{res.result ? res.result.patInfo.patNo : ''}</span><span style={{ marginRight: '6px' }}>{res.res ? status.cardType : ''}</span><span>{status ? status.cardNo : ''}</span></p>
								Util.countDown("warning", "温馨提示", content, 3)
								this.setState({
									readLoading: false
								})
							} else {
								if (res.result.patInfo.patNo) {
									this.childs.showModals()
									this.childs.getBasepatientInfo(res, this.state.baseParms.cardType, this.props.form.getFieldValue('cardNo'))
								} else {

								}
							}
						} else {

						}
						if (this.popCardVis == "false") {
						}
					},
					error: function () {

					}
				})
			} else {
				message.warning('请输入卡号', this.state.userData && this.state.userData.messageTime);
			}
		}

		//2s后自动关闭提示
		timerStart = () => {
			timer = setInterval(() => {
				if (this.state.reciprocal > 0) {
					this.setState({
						reciprocal: this.state.reciprocal - 1
					})
				} else {
					this.handleCancelCard()
					this.handleReset();
					this.handleCancels()
				}
			}, 1000);
		}

		//关闭取消补卡弹窗
		handleCancels = () => {
			this.setState({ visibles: false });
			clearInterval(timer);
		}

		getBase64 = (img, callback) => {
			const reader = new FileReader();
			reader.addEventListener('load', () => callback(reader.result));
			reader.readAsDataURL(img);
		}

		loadDara = (v, img) => {
			this.setState({
				faceImg: v,
			})
			let fiel = this.dataURLtoFile(img, "x.jpg")

			this.getBase64(fiel, imageUrl =>
				this.setState({
					// imageUrl,
					// loading: false,
					// fileList: info.file,
				}, () => {
					let that = this
					let formData = new FormData();
					formData.append("file", fiel);
					const option = {
						method: 'post',
						mode: 'cors',
						headers: {},
						body: formData
					};
					// http://218.17.212.34:53774/uploadFile?fileType=health
					// let url  = "http://172.18.100.86:3008/uploadFile?fileType=health";
					fetch(that.state.faceImgAdress, option).then(response => {
						if (response.ok) {
							that.refChildFace.clearVideo()
							that.setState({
								loadingDom: false,
								tackPhoto: false
							})
							return response.text();
						} else {
							that.setState({
								loadingDom: false
							})
							console.log('网络错误，请稍后再试');
							return;
						}
					}).then(data => {
						let dataS = JSON.parse(data);
						if (+dataS.errorCode == 0) {
							// let str = that.state.faceImg.match(/(\S*)\/uploadFile/)[1];
							that.setState({
								// [name]:this.state.faceImg + dataS.filePath,
								imageUrl: dataS.filePath,
								defaultImg: that.state.downLoadUrl + dataS.filePath
							}, () => {
								console.log("imageUrlimageUrl----", that.state.imageUrl)
								console.log("defaultImg----", that.state.defaultImg)
							})
						} else {

							message.warning(dataS.errorMessage, this.state.userData && this.state.userData.messageTime)
							that.setState({
								// [name]:this.state.faceImg + dataS.filePath,

							}, () => {

							})
						}
						// this.state.fileList.push(obj);
						// this.setState({imgList:this.state.imgList});
					}).catch(error => {
						this.setState({
							// [name]:this.state.faceImg + dataS.filePath,

						}, () => {
							message.warning("上传失败,请重新上传", this.state.userData && this.state.userData.messageTime)
						})

					})
				}),

			);
		}

		dataURLtoFile = (dataurl, filename) => {//将base64转换为文件
			var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
				bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
			while (n--) {
				u8arr[n] = bstr.charCodeAt(n);
			}
			return new File([u8arr], filename, { type: mime });
		}

		//提交表格内容
		handleSubmit = () => {
			let { patiId, parms } = this.state;
			this.props.form.validateFields((err, values) => {
				if (patiId && (values.patName !== parms.patName)) {
					Modal.confirm({
						title: '病人姓名修改提醒',
						content: <div>确认将<span style={{ color: 'red' }}>（{parms.patName}）</span>修改为<span style={{ color: 'red' }}>（{values.patName}）</span>吗？</div>,
						okText: '保存',
						cancelText: '取消',
						onOk: () => {
							this.handleSave(err, values)
						},
						onCancel: () => {
							console.log('取消了')
						},
					});
				} else {
					this.handleSave(err, values)
				}
			})
		}

		// 保存
		handleSave = (err, values) => {
			try {
				if (err) {
					this.cardTip()
					this.patNameTip()
					this.econNameTip()
					this.econRelationTip()
					this.patBirthTip()
					this.posTip()
					this.patTypeTip()
					this.patAdressTip()
					this.econPhoneTip()
					this.sourceTip()
					this.patMobileTip(2)
					var arr = []
					for (let i in err) {
						arr.push(err[i]); //属性
						//arr.push(obj[i]); //值
					}
					let info = arr[0].errors[0].field
					if (info == 'patName') {
						if (this.popCardVis == "false") {
							setTimeout(() => {
								this.patName.current.focus();
							}, 800)
						}
						return
					}
					if (info == 'patSexCode') {
						setTimeout(() => {
							this.sex.current.focus();
						}, 300)
						return
					} if (info == 'patCredTypeCode ') {
						setTimeout(() => {
							this.credType.current.focus();
						}, 300)
						return
					}
					if (info == 'patCredNo') {
						setTimeout(() => {
							this.patCredNo.current.focus();
						}, 300)
						return
					} if (info == 'patBirthDate') {
						setTimeout(() => {
							this.patBirthDate.current.focus();
						}, 300)
						return
					} if (info == 'patMobile') {
						setTimeout(() => {
							this.patMobile.current.focus();
						}, 300)
						return
					} if (info == 'patTypeID') {
						setTimeout(() => {
							this.patType.current.focus();
						}, 300)
						return
					} if (info == 'patNationID') {
						setTimeout(() => {
							this.nation.current.focus();
						}, 300)
						return
					} if (info == 'presentAddressDesc') {
						setTimeout(() => {
							this.patAddress.current.focus();
						}, 300)
						return
					} if (info == 'patEContact') {

						setTimeout(() => {
							this.econName.current.focus();
						}, 300)
						return
					} if (info == 'patERelationID') {

						setTimeout(() => {
							this.econRelation.current.focus();
						}, 300)
						return
					} if (info == 'patEContactMobile') {
						setTimeout(() => {
							this.econMobile.current.focus();
						}, 300)
						return
					} if (info == 'cardPayMethodID') {
						setTimeout(() => {
							this.cardPayMethodID.current.focus();
						}, 300)
						return
					} if (info == 'patEContact') {
						setTimeout(() => {
							this.econName.current.focus();
						}, 300)
						return
					} if (info == 'presentZIP') {
						setTimeout(() => {
							this.presentZIP.current.focus();
						}, 300)
						return
					} if (info == 'registerZIP') {
						setTimeout(() => {
							this.registerZIP.current.focus();
						}, 300)
						return
					} if (info == 'companyZIP') {
						setTimeout(() => {
							this.companyZIP.current.focus();
						}, 300)
						return
					}
				}
				if (!err) {
					this.setState({
						postLoading: true,
						canSave: true,
					})
					if (this.props.form.getFieldValue('patCredTypeCode') == '01' && moment(values.patBirthDate).format('YYYY-MM-DD') != this.getBirthday(values.patCredNo)) {
						this.setState({
							postLoading: false,
							canSave: false
						})
						message.warning("请保持身份证号码中的出生日期与出生日期框一致", this.state.userData?.messageTime || 3)
						return
					}
					if (this.state.isModefined != 1 && this.state.isModefined != 2) {
						let idCard = ''
						if (values.patCredTypeCode == '01') {
							idCard = values.patCredNo
						} else {
							idCard = ''
						}
						let cardTypeId = values.cardTypeID;
						let cardNum = values.cardNo;
						let patName = values.patName;
						let cardDec = "";
						this.state.baseParms.cardType.map((item, index) => {
							if (cardTypeId == item.id) {
								cardDec = item.descripts
							}
						})
						let patDr = ''
						if (this.state.patiId != '') {
							patDr = this.state.patiId
						} else {
							this.setState({
								patDr: ''
							})
						}
						let data = {}
						data = {
							params: [{
								userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : '',
								hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : '',
								groupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : '',
								locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : '',
								patient: {
									faceValue: this.state.faceImg && this.state.faceImg || undefined,//记录人脸特征值
									patPicture: this.state.imageUrl && this.state.imageUrl || undefined,
									active: '',
									contractUnitDr: '',
									patID: patDr,
									patName: values.patName && typeof (values?.patName || '') === 'string' ? (values.patName)?.trim() : '',
									patSexCode: values.patSexCode,
									patBirthDate: values.patBirthDate ? moment(values.patBirthDate).format('YYYY-MM-DD') : undefined,
									patBirthTime: values.patBirthTime ? moment(values.patBirthTime).format('HH:mm') : undefined,
									patIDCardNo: idCard,
									patCredTypeCode: values.patCredTypeCode,
									patCredTypeID: this.state.credTypeID || '',
									patCredNo: values.patCredNo || '',
									patEduID: values.patEduID || '',
									adminUser: values.adminUser || '', // 报备人员
									otherSource: values.otherSource || '',
									patOccupationID: values.patOccupationID || '',
									patNationID: values.patNationID || '',
									patTypeID: values.patTypeID || '',
									patMobile: values.patMobile || '',	// 手机号码
									telphone: values.telphone || '',	// 座机号码
									patEContact: values.patEContact || '',
									patEContactMobile: values.patEContactMobile || '',
									patERelationID: values.patERelationID || '',
									patMaritalID: values.patMaritalID || '',
									patCompany: values.patCompany || '',
									patCountryID: values.patCountryID || '',
									patSocialStatusID: values.patSocialStatusID || '',
									patSourceID: values.patSourceID || '',
									appNo: this.state.appNo,//报备号
									patCreateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : '',
									patCompanyTel: values.patCompanyTel || '',
									addressInfo: [
										{
											addressTypeCode: 'Present',
											addressData: {
												patProvinceID: values.presentProvinceID,
												patCityID: values.presentCityID,
												patAreaID: values.presentAreaID,
												patVillageID: values.presentVillageID,
												patHamletID: values.presentHamletID,
												patAddress: values.presentAddressDesc,
												patZIP: values.presentZIP
											},
										},
										{
											addressTypeCode: 'Birth',
											addressData: {
												patAddress: values.birthAddress,
												patProvinceID: values.birthProvinceID,
												patCityID: values.birthCityID,
												patAreaID: values.birthAreaID,
												patVillageID: values.birthVillageID,
												patHamletID: values.birthHamletID,
											},
										},
										{
											addressTypeCode: 'Native',
											addressData: {
												patAddress: values.nativeAddress,
												patProvinceID: values.nativeProvinceID,
												patCityID: values.nativeCityID,
												patAreaID: values.nativeAreaID,
												patVillageID: values.nativeVillageID,
												patHamletID: values.nativeHamletID,
											},
										}, {
											addressTypeCode: 'Register',
											addressData: {
												patAddress: values.registerAddress,
												patProvinceID: values.registerProvinceID,
												patCityID: values.registerCityID,
												patAreaID: values.registerAreaID,
												patVillageID: values.registerVillageID,
												patHamletID: values.registerHamletID,
												patZIP: values.registerZIP,
											},
										},
										{
											addressTypeCode: 'Company',
											addressData: {
												patAddress: values.companyAddress,
												patProvinceID: values.companyProvinceID,
												patCityID: values.companyCityID,
												patAreaID: values.companyAreaID,
												patVillageID: values.companyVillageID,
												patHamletID: values.companyHamletID,
												patZIP: values.companyZIP
											},
										}, {
											addressTypeCode: 'Contact',
											addressData: {
												patAddress: values.contactAddress,
												patProvinceID: values.contactProvinceID,
												patCityID: values.contactCityID,
												patAreaID: values.contactAreaID,
												patVillageID: values.contactVillageID,
												patHamletID: values.contactHamletID,
											},
										}
									],
								},
								card: {
									cardTypeID: values.cardTypeID,
									cardNo: values.cardNo,
									user: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : '',
									cardCost: this.state.repariFeeFlag == "Y" ? "0" : this.state.nowCost,
									ip: React.$getSessionData('ipConfig')?.ipv4 || '',
									cardPayMethodID: values.cardPayMethodID,
								},
								accm: {
									passWord: '',
									deposit: '',
									groupFlag: '',
								},

							}]
						}
						$http.post('urlS', this, {
							code: '03030003',
							data: data,
							success: function (res) {
								if (+res.errorCode === 0) {
									message.success('提交成功', this.state.userData && this.state.userData.messageTime);
									if (res.print && res.print.length > 0) {
										$loadTemplate("CardFeeReceipt", res.print);
									}
									if (res.patBarcode && res.patBarcode) {
										if (res.patBarcode.printStr.length > 0 && res.patBarcode.template.length > 0) {
											$loadTemplate(res.patBarcode.template, res.patBarcode.printStr);
										}
									}
									if (this.state.nowCost > 0) {
										this.updataTrans()
									}
									this.setState({
										isFlag: '',
										isModefined: -1,
										postLoading: false,
										canSave: false,
										defaultImg: '',
										patBarPatID: res.patID
									}, () => {
										/*
											* Creater:     zxz
											* CreateDate:  2022/05/19
											* Describe：   成都普瑞建卡后自动打印条码
											* */
										/*
										if (sessionStorage.userData && JSON.parse(sessionStorage.userData).hospCode === 'H02') {
											this.handlePatBarcode()
										}
										*/

										if (this.state.baseParms?.PrinCertificate === 'Y') {
											this.handlePatBarcode()
										}
									})
									if (this.state.autoCreateCardNo == "Y") {
										//弹窗
										let self = this
										Modal.confirm({
											key: 11,
											title: "自动生成卡号成功",
											centered: true,
											maskClosable: true,
											okText: '去挂号',
											cancelText: '关闭弹框',
											content: (
												<p style={{ color: 'rgba(0, 0, 0, 0.85)', fontSize: '16px' }}>病人:<span style={{ marginRight: '6px' }}>{patName}</span><span style={{ marginRight: '6px' }}>{cardDec}:</span><span>{res.patNo || "--"}</span></p>
											),
											onOk() {
												// Modal.destroyAll()
												// self.handleReset();
												///groupID: "382"
												if ((sessionStorage.userData && JSON.parse(sessionStorage.userData).groupID === '382') || (sessionStorage.userData && JSON.parse(sessionStorage.userData).groupID === '352') || (sessionStorage.userData && (JSON.parse(sessionStorage.userData).groupDesc.indexOf("验") > -1))) {
													///角色是门诊客服(新) 走新挂号
													self.props.history.push('./03040006?cardTypeId=' + cardTypeId + "&cardNum=" + '' + "&posId=" + res.patNo)
												} else {

													self.props.history.push('./030400011?cardTypeId=' + cardTypeId + "&cardNum=" + '' + "&posId=" + res.patNo)
												}
												Modal.destroyAll()
											},
											onCancel() {
												Modal.destroyAll()
												self.handleReset();
											}
										});
									} else {
										this.handleReset();
									}

									//是否回到挂号页面
									if (this.getQueryString("cardTypeId") != null) {

										//弹窗
										let self = this
										confirm({
											key: 10,
											title: "建卡完成,是否回到挂号页面",
											okText: self.state.userData.language == 'CN' ? '确定' : 'OK',
											cancelText: self.state.userData.language == 'CN' ? '取消' : 'Cannel',
											centered: true,
											content: (
												<p style={{ color: 'rgba(0, 0, 0, 0.85)', fontSize: '16px' }}>病人:<span style={{ marginRight: '6px' }}>{patName}</span><span style={{ marginRight: '6px' }}>{cardDec}:</span><span>{cardNum}</span></p>
											),
											onOk() {
												if ((sessionStorage.userData && JSON.parse(sessionStorage.userData).groupID === '382') || (sessionStorage.userData && JSON.parse(sessionStorage.userData).groupID === '352') || (sessionStorage.userData && (JSON.parse(sessionStorage.userData).groupDesc.indexOf("验") > -1))) {
													///角色是门诊客服(新) 走新挂号
													self.props.history.push('./03040006?cardTypeId=' + cardTypeId + "&cardNum=" + '' + "&posId=" + idCard)
												} else {
													self.props.history.push('./030400011?cardTypeId=' + cardTypeId + "&cardNum=" + '' + "&posId=" + idCard)
												}
												Modal.destroyAll()
											},
											onCancel() {
											},
										});
									}
								} else {
									if (!this.props.form.getFieldValue('patCredTypeCode')) {
										setTimeout(() => {
											this.credType.current.focus();
										}, 800)
										this.setState({
											postLoading: false,
											canSave: false,
											defaultImg: ''
										})
										return
									} if (this.props.form.getFieldValue('patCredTypeCode') && !this.props.form.getFieldValue('patCredNo')) {
										setTimeout(() => {
											this.patCredNo.current.focus();
										}, 800)
										this.setState({
											postLoading: false,
											canSave: false,
											defaultImg: ''
										})
										return
									}
									this.setState({
										postLoading: false,
										canSave: false,
										defaultImg: ''
									})
								}
							}
						})
					} if (this.state.isModefined == 1) {
						let patDr = ''
						if (this.state.patiId != '') {
							patDr = this.state.patiId
						} else {
							this.setState({
								patDr: ''
							})
						}

						let data = {}
						data = {
							params: [{
								active: '',
								contractUnitDr: '',
								patID: patDr,
								patName: values.patName && typeof (values?.patName || '') === 'string' ? (values.patName)?.trim() : '',
								patSexCode: values.patSexCode,
								patBirthDate: values.patBirthDate ? moment(values.patBirthDate).format('YYYY-MM-DD') : undefined,
								patBirthTime: values.patBirthTime ? moment(values.patBirthTime).format('HH:mm') : undefined,
								patCredTypeCode: values.patCredTypeCode || '',
								patCredTypeID: this.state.credTypeID || '',
								patCredNo: values.patCredNo || '',
								patOccupationID: values.patOccupationID || '',
								patNationID: values.patNationID || '',
								patTypeID: values.patTypeID || '',
								patEduID: values.patEduID || '',
								adminUser: values.adminUser || '', // 报备人员
								otherSource: values.otherSource || '',
								patMobile: values.patMobile || '',
								telphone: values.telphone || '',
								patEContact: values.patEContact || '',
								patEContactMobile: values.patEContactMobile || '',
								patERelationID: values.patERelationID || '',
								patMaritalID: values.patMaritalID || '',
								patCompany: values.patCompany || '',
								patCountryID: values.patCountryID || '',
								patSocialStatusID: values.patSocialStatusID || '',
								patSourceID: values.patSourceID || '',
								patUpdateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : '',
								patCompanyTel: values.patCompanyTel || '',
								patIDCardNo: '',
								faceValue: this.state.faceImg && this.state.faceImg || undefined,//记录人脸特征值
								patPicture: this.state.imageUrl && this.state.imageUrl || undefined,
								addressInfo: [
									{
										addressTypeCode: 'Present',
										addressData: {
											patOthID: this.state.patPresentOthID,
											patProvinceID: values.presentProvinceID,
											patCityID: values.presentCityID,
											patAreaID: values.presentAreaID,
											patVillageID: values.presentVillageID,
											patHamletID: values.presentHamletID,
											patAddress: values.presentAddressDesc,
											patZIP: values.presentZIP
										}
									},
									{
										addressTypeCode: 'Birth',
										addressData: {
											patOthID: this.state.patBirthOthID,
											patAddress: values.birthAddress,
											patProvinceID: values.birthProvinceID,
											patCityID: values.birthCityID,
											patAreaID: values.birthAreaID,
											patVillageID: values.birthVillageID,
											patHamletID: values.birthHamletID,
										}
									},
									{
										addressTypeCode: 'Native',
										addressData: {
											patOthID: this.state.patNativeOthID,
											patAddress: values.nativeAddress,
											patProvinceID: values.nativeProvinceID,
											patCityID: values.nativeCityID,
											patAreaID: values.nativeAreaID,
											patVillageID: values.nativeVillageID,
											patHamletID: values.nativeHamletID,
										}
									}, {
										addressTypeCode: 'Register',
										addressData: {
											patOthID: this.state.patRegisterOthID,
											patAddress: values.registerAddress,
											patProvinceID: values.registerProvinceID,
											patCityID: values.registerCityID,
											patAreaID: values.registerAreaID,
											patVillageID: values.registerVillageID,
											patHamletID: values.registerHamletID,
											patZIP: values.registerZIP,
										}
									},
									{
										addressTypeCode: 'Company',
										addressData: {
											patOthID: this.state.patCompanyOthID,
											patAddress: values.companyAddress,
											patProvinceID: values.companyProvinceID,
											patCityID: values.companyCityID,
											patAreaID: values.companyAreaID,
											patVillageID: values.companyVillageID,
											patHamletID: values.companyHamletID,
											patZIP: values.companyZIP
										}
									}, {
										addressTypeCode: 'Contact',
										addressData: {
											patOthID: this.state.patContactOthID,
											patAddress: values.contactAddress,
											patProvinceID: values.contactProvinceID,
											patCityID: values.contactCityID,
											patAreaID: values.contactAreaID,
											patVillageID: values.contactVillageID,
											patHamletID: values.contactHamletID,
										}
									}
								],

							}]
						}
						$http.post('urlS', this, {
							code: '03030012',
							data: data,
							success: function (res) {
								if (+res.errorCode === 0) {
									message.success('保存成功', this.state.userData && this.state.userData.messageTime);
									this.handleReset();
									this.setState({
										isModefined: -1,
										postLoading: false,
										canSave: false,
										isFlag: '',
										defaultImg: ''
									})
								} else {
									this.setState({
										postLoading: false,
										canSave: false,
										defaultImg: ''
									})
								}
							},
							error: function () {
								message.warning('未知错误,请重试', this.state.userData && this.state.userData.messageTime);
								this.setState({
									postLoading: false,
									canSave: false,
								})
							}
						})
					} if (this.state.isModefined == 2) { //补卡 换卡
						//查找病人后 只可以操作新建卡
						this.props.form.setFieldsValue({ cardNo: undefined });
						let patDr = ''
						if (this.state.patiId != '') {
							patDr = this.state.patiId
						} else {
							this.setState({
								patDr: ''
							})
						}
						let datas = {}
						if (this.state.isFlag == 4) { //补卡
							datas = {
								params: [{
									cardID: this.state.cardId,
									flag: this.state.isFlag,
									newCard: {
										patID: patDr,
										cardTypeID: values.cardTypeID,
										cardNo: values.cardNo,
										userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
										cardCost: this.state.nowCost,
										ip: React.$getSessionData('ipConfig')?.ipv4 || '',
										payMethodID: values.cardPayMethodID,
										tradeNum: this.state.baseParms.transactionNo,
									}
								}],
							}
						} else {  //换卡
							datas = {
								params: [{
									cardID: this.state.cardId,
									flag: this.state.isFlag,
									newCard: {
										patID: patDr,
										cardTypeID: values.cardTypeID,
										cardNo: values.cardNo,
										userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
									}
								}],
							}
						}
						$http.post('urlS', this, {
							code: '03030010',
							data: datas,
							success: function (res) {
								if (+res.errorCode === 0) {
									this.setState({
										isFlag: '',
										isModefined: -1,
										postLoading: false
									})
									message.success('卡操作成功', this.state.userData && this.state.userData.messageTime);
									this.handleReset()
								} else {
									this.setState({
										postLoading: false,
									})
								}
							}
						})
					}
				}
			} catch (error) {
				this.setState({
					postLoading: false,
					canSave: false
				});
			}
		}

		//隐藏验证提示
		handleVail = () => {
			this.setState({
				cardNoVisible: false,
				patNameVisible: false,
				patAdressVisible: false,
				patAdressZipVisible: false,
				patBirthVisible: false,
				posVisible: false,
				patTypeVisible: false,
				patMobileVisible: false,
				telphoneVisible: false,
				econPhoneVisible: false,
				econNameVisible: false,
				econRelationVisible: false,
			})
		}

		//打印条码
		handlePatBarcode = () => {
			let data = {}
			data = {
				params: [{
					patID: this.state.patBarPatID,
				}]
			}
			$http.post('urlS', this, {
				code: '03030030',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						if (res.result.printStr && res.result.printStr.length > 0 && res.result.template && res.result.template.length > 0) {
							$loadTemplate(res.result.template, res.result.printStr);
						}
					}
				}
			})
		}

		//清空表格内容
		handleReset = () => {
			//卡号输入框高亮
			setTimeout(() => {
				this.cardNo.current.focus();
			}, 500)
			this.handleVail()
			this.getDefaultAdress()
			this.props.form.resetFields()
			this.state.baseParms.sex.map((item, i) => {
				this.setState({
					credSex: this.state.baseParms.sex[0].code
				})
			})
			this.state.baseParms.cardType.map((item, i) => {
				item['disabled'] = false
				if (item.defaultFlag == "Y") {
					this.setState({
						initCardDr: item.id,
						nowRead: item.readMode,
						idCardCode: item.code,
						cardLength: item.cardLength && item.cardLength != "" ? item.cardLength + "位," : "",
						cardLengthInput: item.cardLength,
						replenishZero: item.replenishZero,
						repariFeeFlag: item.repariFeeFlag,
						autoCreateCardNo: item.autoCreateCardNo,
						nowCost: item.cardCost,
						nowInv: item.invFlag,
					})
					if (item.autoCreateCardNo == "Y") {
						setTimeout(() => {
							this.patName.current.focus();
						}, 300)
					} else {
						if (item.readMode == "R") {
							setTimeout(() => {
								this.readOneButton.current.buttonNode.focus();
							}, 300)
						} else {
							//卡号输入框高亮
							setTimeout(() => {
								this.cardNo.current.focus();
							}, 600)
						}
					}
				}
			})
			this.props.form.setFieldsValue({
				cardNo: undefined,
				patProvinceID: undefined,
				appNo: undefined,
				cardPayMethodID: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
				payMethods: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
			})
			this.setState({
				birthDoor: true,//出生地址
				nativeDoor: true,//籍贯地址
				presentDoor: true,//现住址
				registerDoor: true,//户口地址
				companyDoor: true,//单位地址
				contactDoor: true,//联系人地址
				credWarning: false,
				posType: "",
				credTypeID: "",
				selfCredNo: "",
				proviceBornId: '',
				provinceId: '',
				proviceHouseId: '',
				proviceContactId: '',
				patEduID: '',
				proviceNativeId: '',
				proviceWorkId: '',
				defaultImg: '',
				patiId: "",
				parms: {},
				credAge: '',
				cardNo: '',
				credBirthday: '',
				birthData: "",
				appNo: undefined,
				isFlag: '',
				isModefined: -1,
				bindCardArr: [],
				allDis: false,
				noCard: true,
				cardSatus: [],
				bindDis: true,
				openTime: false,
				isCancel: -1,
				patBarPatID: "",
				canRetarCard: "N",
				birthCity: [],//出生地市区信息
				birthAreas: [],//出生地县信息
				birthVillages: [],//出生地乡信息
				birthHamlets: [],//出生地村落信息

				nativeCity: [],//籍贯市区信息
				nativeAreas: [],//籍贯县信息
				nativeVillages: [],//籍贯乡信息
				nativeHamlets: [],//籍贯村落信息

				presentCity: [],//现住址市区信息
				presentAreas: [],//现住址县信息
				presentVillages: [],//现住址乡信息
				presentHamlets: [],//现住址村落信息

				registerCity: [],//户口地址市区信息
				registerAreas: [],//户口地址县信息
				registerVillages: [],//户口地址乡信息
				registerHamlets: [],//户口地址村落信息

				companyCity: [],//单位市区信息
				companyAreas: [],//单位县信息
				companyVillages: [],//单位乡信息
				companyHamlets: [],//单位村落信息

				contactCity: [],//紧急联系人市区信息
				contactAreas: [],//紧急联系人县信息
				contactVillages: [],//紧急联系人乡信息
				contactHamlets: [],//紧急联系人村落信息
				inBoxStatus: ''
			})
		}

		//修改发票号
		modifyInvoice = (e, value) => {
			this.showModal()
		}

		//修改发票弹窗
		showModal = () => {
			this.setState({
				visible: true,
			});
		}

		handleOk = () => {
			this.setState({ loading: true });
			setTimeout(() => {
				this.setState({ loading: false, visible: false });
			}, 3000);
		}

		handleCancel = () => {
			this.setState({ visible: false });
		}

		KeyDowns = (e) => {
			if (e && e.keyCode) {
				let currKey = 0;
				e = e || event || window.event;
				currKey = e.keyCode || e.which || e.charCode;
				//快捷键保存  shilt/alt/ctrl + s
				if (currKey == 83 && (e.ctrlKey || e.metaKey || e.shiftKey)) {
					e.preventDefault();
					this.handleSubmit()
				}
				//快捷键清空 shilt/alt/ctrl + z
				if (currKey == 90 && (e.ctrlKey || e.metaKey || e.shiftKey)) {
					e.preventDefault();
					this.patName.current.blur();
					this.handleReset();
				}
			}
		}

		//获取病人来源下拉框
		getPatForm = () => {
			let data = {
				params: [{
				}],
			}
			$http.post("urlS", this, {
				code: "03050175",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							patFormData: res.result.data
						})
					} else {
						message.error('失败：' + res.errorMessage, this.state.userData && this.state.userData.messageTime);
					}
				},
				error: function (error) {
					message.error('失败：' + error, this.state.userData && this.state.userData.messageTime);
				}
			});
		}

		//人脸特征值录入
		onRef = (ref) => {
			this.refChildFace = ref
		}

		handleOpenPhoto() {
			this.setState({
				tackPhoto: true
			})
		}

		//报备号
		handleChangeReportNo(name, e) {
			this.setState({
				[name]: e.target.value
			})
		}

		//通过报备号查询病人信息
		handleSelectReportMsg(e) {
			let { parms } = this.state;
			if (e.keyCode == '13') {
				var params = {
					params: [{
						appNo: this.state.appNo
					}]
				}
				$http.post('urlS', this, {
					code: "03030111",
					data: params,
					success: function (res) {
						if (res.errorCode === '0') {
							//let parms = { ...res.result, sourceIsDis: true };
							parms.patName = res.result.patName;
							parms.patMobile = res.result.patMobile;
							parms.pattelphone = res.result.pattelphone;
							parms.patAge = res.result.patAge;
							parms.patSexCode = res.result.patSexCode;
							parms.patSexDesc = res.result.patSexDesc;
							parms.patPresentAddressDes = res.result.patPresentAddressDes;
							parms.patCompany = res.result.patCompany;
							parms.patSourceID = res.result.patSourceID;
							parms.patSourceDesc = res.result.patSourceDesc;
							parms.adminUser = res.result.adminUser;
							parms.sourceIsDis = true;
							this.setState({
								parms
							}, () => {
								this.props.form.setFieldsValue({
									patName: !Util.isEmpty(res.result) ? res.result.patName : '',
								})
							});
						} else {
							this.props.form.setFieldsValue({ appNo: undefined, patName: undefined })
							this.setState({
								appNo: undefined,
								parms: {}
							}, () => {
								this.getDefaultAdress()
							})
						}
					}
				});
			}
		}

		// 读身份证
		handleReadCard() {
			/**
			 * @ByYQL: 读卡功能，适配新读卡器华视100UC【hospID：济南-64、合肥-25、长春-62】
			 * Create 2021-12-9
			 */
			let hospID = sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "";
			let inputDirRoute = hospID == 25 || hospID == 62 ? 'ReadCard/ReadCard.dll' : 'ReadCard_UC/ReadCard.dll';
			let that = this;
			let dllParams = JSON.stringify({ 'inputDir': inputDirRoute, 'clsName': 'ReadCard.ReadCardObj', 'funcName': 'ReadIDCardInfo' });
			if (typeof (CefSharp) != "undefined") {   // 新元素定制浏览器
				CefSharp.BindObjectAsync("xysCefToJavaScripts");
				setTimeout(() => {
					xysCefToJavaScripts.driveLocalHardware(dllParams).then((returnVale) => {
						var json = JSON.parse(returnVale);
						if (json.errorCode == "0") {
							that.setState({
								// parms:json.result
								sourceData: json.result
							}, () => {
								that.loadReadCardMessage()
								// var code = ''
								// var nationData = that.state.nationData;
								// if (!Util.isEmpty(nationData)) {
								// 	for (var i = 0; i < nationData.length; i++) {
								// 		if (!Util.isEmpty(that.state.source)) {
								// 			if (that.state.source.nation == nationData[i].code) {
								// 				code = nationData[i].id
								// 			}
								// 		}
								// 	}
								// }
								// that.props.form.setFieldsValue({
								// 	patName: !Util.isEmpty(that.state.source) ? that.state.source.name : '',
								// 	registerAddress: !Util.isEmpty(that.state.source) ? that.state.source.address : '',
								// 	patBirthDate: !Util.isEmpty(that.state.source) ? moment(that.state.source.birth, 'YYYY-MM-DD') : '',
								// 	patCredNo: !Util.isEmpty(that.state.source) ? that.state.source.IDCardNo : '',
								// 	patSexCode: !Util.isEmpty(that.state.source) ? that.state.source.sex : '',
								// 	patNationID: code,
								// }, () => {
								// 	that.handleInmations(that.props.form.getFieldValue('patCredNo'))
								// })
							})
							message.success('读卡成功');
						} else {
							message.error(json.errorMessage);
						}
					})
				}, 100);
			} else {
				const frame = chrome?.webview?.hostObjects?.Bridge || ''; // 新版浏览器
				if (frame) {
					frame.DynamicLoadingDLL(dllParams)
						.then(
							data => {
								var json = JSON.parse(data);
								if (json.errorCode == "0") {
									that.setState({
										sourceData: json.result
									}, () => {
										that.loadReadCardMessage();
									})
									message.success('读卡成功');
								} else {
									message.error(json.errorMessage);
								}
							},
							err => {
								console.log(err)
							}
						)
				} else {
					let data = 'input={"inputDir":"' + inputDirRoute + '","clsName":"' + 'ReadCard.ReadCardObj' + '","funcName":"' + 'ReadIDCardInfo' + '"}';
					fetchJsonp('http://127.0.0.1:62534/XYSWCFService/DynamicLoadingDLL?' + '&' + data, {
						jsonpCallback: 'JsonCallback',
					})
						.then(function (response) {
							return response.json()
						}).then(function (json) {
							//返回卡号
							json = JSON.parse(json)
							if (json.errorCode == "0") {
								that.setState({
									sourceData: json.result
								}, () => {
									that.loadReadCardMessage();
								})
								message.success('读卡成功');
							} else {
								message.error(json.errorMessage);
							}
							// return cardNo
						}).catch(function (ex) {
							console.log(ex);
						})
				}
			}
		}

		loadReadCardMessage() {
			let { addressSame } = this.state;
			var params = {
				params: [this.state.sourceData]
				// params: [{ "name": "樊建鹏", "sex": "男", "nation": "汉", "birth": "1992-03-04", "address": "江西省吉安市永新县才丰乡华光村八组1号", "IDCardNo": "362430199203041713", "photoPath": "C:\\zp.bmp" }]
			}
			$http.post('urlS', this, {
				code: "03030115",
				data: params,
				success: function (res) {
					if (res.errorCode === '0') {
						this.setState({
							source: res.result
						}, () => {
							var code = ''
							var nationData = this.state.patCardTypeData;
							if (!Util.isEmpty(nationData)) {
								for (var i = 0; i < nationData.length; i++) {
									if (!Util.isEmpty(this.state.source)) {
										if (this.state.source.patCredTypeID == nationData[i].id) {
											code = nationData[i].code
										}
									}
								}
							}
							this.props.form.setFieldsValue({
								patName: !Util.isEmpty(this.state.source) ? this.state.source.patName : '',
								registerAddress: !Util.isEmpty(this.state.source) ? this.state.source.address : '',
								patBirthDate: !Util.isEmpty(this.state.source) ? moment(this.state.source.patBirthDate, 'YYYY-MM-DD') : '',
								patCredNo: !Util.isEmpty(this.state.source) ? this.state.source.patCredNo : '',
								patCredTypeID: !Util.isEmpty(this.state.source) ? this.state.source.patCredTypeID : '',
								patCredTypeCode: code,
								patSexCode: !Util.isEmpty(this.state.source) ? this.state.source.patSexID : '',
								age: !Util.isEmpty(this.state.source) ? this.state.source.patAge : '',
								patNationID: !Util.isEmpty(this.state.source) ? this.state.source.patNationID : '',
								// 户口地址
								registerProvinceID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterProvinceID : '',
								registerCityID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterCityID : '',
								registerAreaID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAreaID : '',
								registerVillageID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterVillageID : '',
								registerAddress: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAddressDesc : '',
							}, () => {
								this.autoFocusCountry("register")
								this.autoFocusVillage('register')
								this.handleInmations(this.props.form.getFieldValue('patCredNo'))
							})
							/**
							 * @ByShizi: 根据医院配置读卡时现住址和单位地址是否跟户口地址一致
							 * #806 - 南昌普瑞-建卡登记-读身份证的户口地址也带入到现住址和单位地址（按医院属性做成配置）
							 * Create 2021-07-25
							 * */
							if (addressSame === 'Y') {
								this.props.form.setFieldsValue({
									// 现住址
									presentProvinceID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterProvinceID : '',
									presentCityID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterCityID : '',
									presentAreaID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAreaID : '',
									presentVillageID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterVillageID : '',
									presentAddressDesc: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAddressDesc : '',
									// 单位地址
									companyProvinceID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterProvinceID : '',
									companyCityID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterCityID : '',
									companyAreaID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAreaID : '',
									companyVillageID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterVillageID : '',
									companyAddress: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAddressDesc : '',
								})
								this.setState({
									parms: {
										...this.state.parms,
										// 现住址
										patPresentAreaID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAreaID : '',
										patPresentAreaDesc: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAreaDesc : '',
										patPresentVillageID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterVillageID : '',
										patPresentVillageDesc: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterVillageDesc : '',
										// 单位地址
										patCompanyAreaID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAreaID : '',
										patCompanyAreaDesc: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterAreaDesc : '',
										patCompanyVillageID: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterVillageID : '',
										patCompanyVillageDesc: !Util.isEmpty(this.state.source) ? this.state.source.patRegisterVillageDesc : '',
									}
								})
							}
						})
					}
				}
			});
		}

		onRefIcon = (ref) => {
			this.childIcon = ref;
		};

		render() {
			const { getFieldDecorator } = this.props.form;
			let { province, birthCity, nativeCity, presentCity, registerCity, companyCity, contactCity } = this.state; //省,市
			let { birthAreas, nativeAreas, presentAreas, registerAreas, companyAreas, contactAreas } = this.state;//县
			let { birthVillages, nativeVillages, presentVillages, registerVillages, companyVillages, contactVillages } = this.state;//乡
			let { birthHamlets, nativeHamlets, presentHamlets, registerHamlets, companyHamlets, contactHamlets } = this.state;//村

			let { patFormData, readInfoLoading, replenishZero, nowCostCard, repariFeeFlag, repariFeeFlagCard, autoCreateCardNo, noCard, cardLengthCard,
				autoCreateCardNoCard,
				cardNoMessage, posMessage, patNameMessage, patBirthMessage, patMobileMessage, patTypeMessage, patAdressMessage,
				patAdressMessageZip, patAdressHouseMessageZip, patAdressComMessageZip, econPhoneMessage, sourceMessage, changeCardMessage,
				patchCardMessage, bindCardMessage, econNameMessage, nowReadCardPop, canSave, parms, baseParms,
				readLoading, postLoading, credSex, credBirthday, credAge, credCountry, nowCost, posType, nowRead, cardLength, initCardDr, isModefined,
				isFlag, reciprocal, cardNo, localProvince, localCity, bindCardArr, allDis, bindDis, cardSatus,
				isCancel, popCardVis, cardInfo, initpatCardID, bindMoreInfo, bindVail, canRetarCard, requireFlag } = this.state
			let card = []
			baseParms.cardType && baseParms.cardType.map(item => {
				card.push(<Option key={item.id}
					onClick={() => this.handleCred(item.id, item.code, item.readMode, item.cardLength, item.cardCost, item.invFlag, item.replenishZero, item.repariFeeFlag, item.autoCreateCardNo)}
					disabled={item.disabled ? item.disabled : (isFlag == 3 || isFlag == 4 ? true : false)}
					value={String(item.id)}>
					{item.descripts}
				</Option>)
			})
			let cardbind = []
			baseParms.cardType && baseParms.cardType.map(item => {
				cardbind.push(<Option key={item.id} onClick={() => this.handleBindCardType(item.id, item.code, item.readMode, item.cardLength, item.cardCost, item.invFlag, item.replenishZero, item.repariFeeFlag, item.autoCreateCardNo)} disabled={item.disabled ? item.disabled : (isFlag == 3 || isFlag == 4 ? true : false)} value={String(item.id)}>{item.descripts}</Option>)
			})
			let sex = []
			baseParms.sex && baseParms.sex.map(item => {
				sex.push(<Option key={item.code} onClick={() => this.handleKeydownM(3)} value={String(item.code)}>{item.descripts}</Option>)
			})
			let credType = []
			baseParms.credType && baseParms.credType.map(item => {
				credType.push(<Option key={item.code} value={String(item.code)} onClick={() => this.handleKeydownM(4, item.id)} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			let ageUnit = []
			baseParms.ageUnit && baseParms.ageUnit.map(item => {
				ageUnit.push(<Option key={item.id} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
			})
			let patType = []
			baseParms.patType && baseParms.patType.map(item => {
				patType.push(<Option key={item.id} value={String(item.id)} onClick={() => this.handleKeydownM(7)} title={item.descripts}>{item.descripts}</Option>)
			})
			let country = []
			baseParms.country && baseParms.country.map(item => {
				country.push(<Option key={item.id} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)}>{item.descripts}</Option>)
			})
			//文化程度
			let educationListOption = []
			baseParms.education && baseParms.education.map((item, index) => {
				educationListOption.push(<Option key={index} value={String(item.id)} name={item.descripts} code={item.descriptsSPCode} title={item.descripts}>{item.descripts}</Option>)
			})
			//病人来源渠道
			let patFormOpt = []
			patFormData && patFormData.map(item => {
				patFormOpt.push(<Option key={item.id} value={item.id} onClick={() => this.handleKeydownM(31)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts}>{item.descripts}</Option>)
			})
			let firstCityItem = [], birthCityItem = [], nativeCityItem = [], presentCityItem = [], registerCityItem = [], companyCityItem = [], contactCityItem = []; //省,市Option
			let birthAreasItem = [], nativeAreasItem = [], presentAreasItem = [], registerAreasItem = [], companyAreasItem = [], contactAreasItem = [];//县Option
			let birthVillagesItem = [], nativeVillagesItem = [], presentVillagesItem = [], registerVillagesItem = [], companyVillagesItem = [], contactVillagesItem = [];//乡
			let birthHamletsItem = [], nativeHamletsItem = [], presentHamletsItem = [], registerHamletsItem = [], companyHamletsItem = [], contactHamletsItem = [];//村
			let patInfo = this.state.parms;
			let provinceItem = [];
			localProvince && localProvince.map(item => {
				provinceItem.push(<Option key={item.id} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
			});

			// let firstCityItem = []
			//第一次加载的城市;
			localCity && localCity.map(item => {
				firstCityItem.push(<Option provinceid={item.province} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
			});
			//出生城市
			if ((!birthCity && this.state.birthDoor) || (birthCity.length === 0 && this.state.birthDoor)) {
				//出生城市下拉数据为空时加载所有城市
				birthCityItem = firstCityItem;
			} else {
				birthCity && birthCity.map(item => {
					birthCityItem.push(<Option provinceid={item.province} onClick={() => this.autoFocusCountry("birth")} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
				});
			}
			birthAreas && birthAreas.map(item => {
				birthAreasItem.push(<Option key={item.id} onClick={() => this.autoFocusVillage("birth")} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((birthAreas) && (birthAreas.length === 0) && (patInfo.patBirthAreaID)) {
				birthAreasItem.push(<Option key={patInfo.patBirthAreaID} role={patInfo.patBirthAreaDesc} title={patInfo.patBirthAreaDesc} value={String(patInfo.patBirthAreaID)}>{patInfo.patBirthAreaDesc}</Option>)
			}
			birthVillages && birthVillages.map(item => {
				birthVillagesItem.push(<Option key={item.id} onClick={() => this.autoFocusHamlet("birth", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((birthVillages) && (birthVillages.length === 0) && (patInfo.patBirthVillageID)) {
				birthVillagesItem.push(<Option key={patInfo.patBirthVillageID} role={patInfo.patBirthVillageDesc} title={patInfo.patBirthVillageDesc} value={String(patInfo.patBirthVillageID)}>{patInfo.patBirthVillageDesc}</Option>)
			}
			birthHamlets && birthHamlets.map(item => {
				birthHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((birthHamlets) && (birthHamlets.length === 0) && (patInfo.patBirthHamletID)) {
				birthHamletsItem.push(<Option key={patInfo.patBirthHamletID} role={patInfo.patBirthHamletDesc} title={patInfo.patBirthHamletDesc} value={String(patInfo.patBirthHamletID)}>{patInfo.patBirthHamletDesc}</Option>)
			}
			//籍贯
			if ((!nativeCity && this.state.nativeDoor) || (nativeCity.length === 0 && this.state.nativeDoor)) {
				//籍贯城市下拉数据为空时加载所有城市
				nativeCityItem = firstCityItem;
			} else {
				nativeCity && nativeCity.map(item => {
					nativeCityItem.push(<Option provinceid={item.province} onClick={() => this.autoFocusCountry("native")} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
				});
			}
			nativeAreas && nativeAreas.map(item => {
				nativeAreasItem.push(<Option key={item.id} onClick={() => this.autoFocusVillage("native")} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((nativeAreas) && (nativeAreas.length === 0) && (patInfo.patNativeAreaID)) {
				nativeAreasItem.push(<Option key={patInfo.patNativeAreaID} role={patInfo.patNativeAreaDesc} title={patInfo.patNativeAreaDesc} value={String(patInfo.patNativeAreaID)}>{patInfo.patNativeAreaDesc}</Option>)
			}
			nativeVillages && nativeVillages.map(item => {
				nativeVillagesItem.push(<Option key={item.id} onClick={() => this.autoFocusHamlet("native", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((nativeVillages) && (nativeVillages.length === 0) && (patInfo.patNativeVillageID)) {
				nativeVillagesItem.push(<Option key={patInfo.patNativeVillageID} role={patInfo.patNativeVillageDesc} title={patInfo.patNativeVillageDesc} value={String(patInfo.patNativeVillageID)}>{patInfo.patNativeVillageDesc}</Option>)
			}
			nativeHamlets && nativeHamlets.map(item => {
				nativeHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((nativeHamlets) && (nativeHamlets.length === 0) && (patInfo.patNativeHamletID)) {
				nativeHamletsItem.push(<Option key={patInfo.patNativeHamletID} role={patInfo.patNativeHamletDesc} title={patInfo.patNativeHamletDesc} value={String(patInfo.patNativeHamletID)}>{patInfo.patNativeHamletDesc}</Option>)
			}
			//现住址
			if ((!presentCity && this.state.presentDoor) || (presentCity.length === 0 && this.state.presentDoor)) {
				//现住址城市下拉数据为空时加载所有城市
				presentCityItem = firstCityItem;
			} else {
				presentCity && presentCity.map(item => {
					presentCityItem.push(<Option provinceid={item.province} onClick={() => this.autoFocusCountry("present")} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
				});
			}
			presentAreas && presentAreas.map(item => {
				presentAreasItem.push(<Option key={item.id} onClick={() => this.autoFocusVillage("present", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((presentAreas) && (presentAreas.length === 0) && (patInfo.patPresentAreaID)) {
				presentAreasItem.push(<Option key={patInfo.patPresentAreaID} role={patInfo.patPresentAreaDesc} title={patInfo.patPresentAreaDesc} value={String(patInfo.patPresentAreaID)}>{patInfo.patPresentAreaDesc}</Option>)
			}
			presentVillages && presentVillages.map(item => {
				presentVillagesItem.push(<Option key={item.id} onClick={() => this.autoFocusHamlet("present", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((presentVillages) && (presentVillages.length === 0) && (patInfo.patPresentVillageID)) {
				presentVillagesItem.push(<Option key={patInfo.patPresentVillageID} role={patInfo.patPresentVillageDesc} title={patInfo.patPresentVillageDesc} value={String(patInfo.patPresentVillageID)}>{patInfo.patPresentVillageDesc}</Option>)
			}
			presentHamlets && presentHamlets.map(item => {
				presentHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((presentHamlets) && (presentHamlets.length === 0) && (patInfo.patPresentHamletID)) {
				presentHamletsItem.push(<Option key={patInfo.patPresentHamletID} role={patInfo.patPresentHamletDesc} title={patInfo.patPresentHamletDesc} value={String(patInfo.patPresentHamletID)}>{patInfo.patPresentHamletDesc}</Option>)
			}
			//户口
			if ((!registerCity && this.state.registerDoor) || (registerCity.length === 0 && this.state.registerDoor)) {
				//户口城市下拉数据为空时加载所有城市
				registerCityItem = firstCityItem;
			} else {
				registerCity && registerCity.map(item => {
					registerCityItem.push(<Option provinceid={item.province} onClick={() => this.autoFocusCountry("register")} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
				});
			}
			registerAreas && registerAreas.map(item => {
				registerAreasItem.push(<Option key={item.id} onClick={() => this.autoFocusVillage("register", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((registerAreas) && (registerAreas.length === 0) && (patInfo.patRegisterAreaID)) {
				registerAreasItem.push(<Option key={patInfo.patRegisterAreaID} role={patInfo.patRegisterAreaDesc} title={patInfo.patRegisterAreaDesc} value={String(patInfo.patRegisterAreaID)}>{patInfo.patRegisterAreaDesc}</Option>)
			}
			registerVillages && registerVillages.map(item => {
				registerVillagesItem.push(<Option key={item.id} onClick={() => this.autoFocusHamlet("register", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((registerVillages) && (registerVillages.length === 0) && (patInfo.patRegisterVillageID)) {
				registerVillagesItem.push(<Option key={patInfo.patRegisterVillageID} role={patInfo.patRegisterVillageDesc} title={patInfo.patRegisterVillageDesc} value={String(patInfo.patRegisterVillageID)}>{patInfo.patRegisterVillageDesc}</Option>)
			}
			registerHamlets && registerHamlets.map(item => {
				registerHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((registerHamlets) && (registerHamlets.length === 0) && (patInfo.patRegisterHamletID)) {
				registerHamletsItem.push(<Option key={patInfo.patRegisterHamletID} role={patInfo.patRegisterHamletDesc} title={patInfo.patRegisterHamletDesc} value={String(patInfo.patRegisterHamletID)}>{patInfo.patRegisterHamletDesc}</Option>)
			}
			//单位
			if ((!companyCity && this.state.companyDoor) || (companyCity.length === 0 && this.state.companyDoor)) {
				//单位城市下拉数据为空时加载所有城市
				companyCityItem = firstCityItem;
			} else {
				companyCity && companyCity.map(item => {
					companyCityItem.push(<Option provinceid={item.province} onClick={() => this.autoFocusCountry("company")} key={item.id} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
				});
			}
			companyAreas && companyAreas.map(item => {
				companyAreasItem.push(<Option key={item.id} onClick={() => this.autoFocusVillage("company", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((companyAreas) && (companyAreas.length === 0) && (patInfo.patCompanyAreaID)) {
				companyAreasItem.push(<Option key={patInfo.patCompanyAreaID} role={patInfo.patCompanyAreaDesc} title={patInfo.patCompanyAreaDesc} value={String(patInfo.patCompanyAreaID)}>{patInfo.patCompanyAreaDesc}</Option>)
			}
			companyVillages && companyVillages.map(item => {
				companyVillagesItem.push(<Option key={item.id} onClick={() => this.autoFocusHamlet("company", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((companyVillages) && (companyVillages.length === 0) && (patInfo.patCompanyVillageID)) {
				companyVillagesItem.push(<Option key={patInfo.patCompanyVillageID} role={patInfo.patCompanyVillageDesc} title={patInfo.patCompanyVillageDesc} value={String(patInfo.patCompanyVillageID)}>{patInfo.patCompanyVillageDesc}</Option>)
			}
			companyHamlets && companyHamlets.map(item => {
				companyHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((companyHamlets) && (companyHamlets.length === 0) && (patInfo.patCompanyHamletID)) {
				companyHamletsItem.push(<Option key={patInfo.patCompanyHamletID} role={patInfo.patCompanyHamletDesc} title={patInfo.patCompanyHamletDesc} value={String(patInfo.patCompanyHamletID)}>{patInfo.patCompanyHamletDesc}</Option>)
			}
			//联系人
			if ((!contactCity && this.state.contactDoor) || (contactCity.length === 0 && this.state.contactDoor)) {
				//联系人城市下拉数据为空时加载所有城市
				contactCityItem = firstCityItem;
			} else {
				contactCity && contactCity.map(item => {
					contactCityItem.push(<Option provinceid={item.province} key={item.id} onClick={() => this.autoFocusCountry("contact")} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} className={'2' + item.province} title={item.descripts}>{item.descripts}</Option>)
				});
			}
			contactAreas && contactAreas.map(item => {
				contactAreasItem.push(<Option key={item.id} onClick={() => this.autoFocusVillage("contact")} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((contactAreas) && (contactAreas.length === 0) && (patInfo.patContactAreaID)) {
				contactAreasItem.push(<Option key={patInfo.patContactAreaID} role={patInfo.patContactAreaDesc} title={patInfo.patContactAreaDesc} value={String(patInfo.patContactAreaID)}>{patInfo.patContactAreaDesc}</Option>)
			}
			contactVillages && contactVillages.map(item => {
				contactVillagesItem.push(<Option key={item.id} onClick={() => this.autoFocusHamlet("contact", item.zipCode)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((contactVillages) && (contactVillages.length === 0) && (patInfo.patContactVillageID)) {
				contactVillagesItem.push(<Option key={patInfo.patContactVillageID} role={patInfo.patContactVillageDesc} title={patInfo.patContactVillageDesc} value={String(patInfo.patContactVillageID)}>{patInfo.patContactVillageDesc}</Option>)
			}
			contactHamlets && contactHamlets.map(item => {
				contactHamletsItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			});
			if ((contactHamlets) && (contactHamlets.length === 0) && (patInfo.patContactHamletID)) {
				contactHamletsItem.push(<Option key={patInfo.patContactHamletID} role={patInfo.patContactHamletDesc} title={patInfo.patContactHamletDesc} value={String(patInfo.patContactHamletID)}>{patInfo.patContactHamletDesc}</Option>)
			}

			let nation = []
			baseParms.nation && baseParms.nation.map(item => {
				nation.push(<Option key={item.id} onClick={() => this.handleKeydownM(8)} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
			})

			let occupation = []
			baseParms.occupation && baseParms.occupation.map(item => {
				occupation.push(<Option key={item.id} onClick={() => this.handleKeydownM(20)} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
			})

			let marital = []
			baseParms.marital && baseParms.marital.map(item => {
				marital.push(<Option key={item.id} onClick={() => this.handleKeydownM(21)} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
			})

			let relation = []
			baseParms.relation && baseParms.relation.map(item => {
				relation.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} onClick={() => this.handleKeydownM(13)} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
			})

			let socialStatus = []
			baseParms.socialStatus && baseParms.socialStatus.map(item => {
				socialStatus.push(<Option key={item.id} onClick={() => this.handleposTagFouce(item.id)} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
			})

			let payMethod = []
			baseParms.payMethod && baseParms.payMethod.map(item => {
				payMethod.push(<Option key={item.id} value={String(item.id)} onClick={() => this.handleKeydownM(10)}>{item.descripts}</Option>)
			})

			let bindArr = []
			bindCardArr && bindCardArr.map(item => {
				bindArr.push(<span style={{ color: (item.light == true ? "#007AFF" : "rgba(0, 0, 0, 0.75)") }}><span style={{ margin: '0 8px', }}>{item.cardTypeDesc}<span style={{ margin: "0 6px" }}>{item.cardNo}</span>({item.cardStatusDesc})</span></span>)
			})
			const mesIcon = <Icon type="exclamation-circle" />

			let formItemLayouAge = {
				labelCol: { span: 12 },
				wrapperCol: { span: 12 },
			}

			let formItemLayouName = {
				labelCol: { span: 10 },
				wrapperCol: { span: 14 },
			}

			let formItemLayouPatCountry = {
				labelCol: { span: 8 },
				wrapperCol: { span: 16 },
			}

			return (
				<Spin spinning={readInfoLoading}>
					<div className="registerDom shizi_registerDom" style={{ height: store.getState().tableHeight.y + 241 + 'px', overflow: "hidden" }}>
						<Form style={{ height: "100%", overflow: "hidden auto" }}>
							<div className="rd-title">
								<img src={iconCard} alt="" style={{ width: "20px", height: "16px", marginRight: "8px" }} />
								请读卡或输入卡号
							</div>
							<div className="cardTitleDom">
								{/* <div className="bg1"></div>
								<Row style={{ background: "#ffffff" }} gutter={12} className="cardTitle">
									<span className="title">当前卡信息</span>
								</Row> */}
								<Row gutter={12} style={{ paddingLeft: "20px" }} className="ctd-row">
									<Col span={4} className="cardDom">
										<FormItem wrapperCol={{ span: 24 }} style={{ paddingRight: "20px", boxSizing: "border-box" }}>
											{getFieldDecorator('cardTypeID', {
												initialValue: initCardDr,
												rules: [{ required: true, message: '请选择建卡类型' }],
											})(
												<Select disabled={isModefined == 1 || allDis || !noCard} placeholder='请选择卡类型'>
													{card}
												</Select>
											)}
										</FormItem>
									</Col>
									<Col span={6} className="cardNoDom">
										<Tooltip getPopupContainer={() => document.querySelector('.cardNoDom')} overlayStyle={{ zIndex: 999, }} overlayClassName="toolTipDom cardNo" title={<div className="titleIcon">{mesIcon}<span >{cardNoMessage}</span></div>} visible={this.state.cardNoVisible}>
											<FormItem wrapperCol={{ span: 30 }} style={{ paddingRight: "20px", boxSizing: "border-box" }}>
												{getFieldDecorator('cardNo', {
													validateTrigger: [""],
													initialValue: cardNo ? cardNo : undefined,
													rules: [{ required: noCard && autoCreateCardNo != "Y" ? true : false, message: '请输入' },
													{ validator: noCard && isModefined != 1 && autoCreateCardNo != "Y" ? this.validFunction : "" },],
													getValueFromEvent: (event) => {
														return this.state.idCardCode == '02' ? event.target.value.replace(/[^\d|Xx]/g, '') : event.target.value.replace(/\D/g, '')
													},
												})(
													<Input
														allowClear={isModefined != 1}
														onMouseOver={() => this.visibleTip(1)}
														maxLength={cardLength && cardLength != "" ? parseInt(cardLength) : 99}
														ref={this.cardNo}
														onPressEnter={() => this.handleKeydownM(1)}
														onBlur={this.patCardBlur}
														placeholder={
															nowRead == 'R' && autoCreateCardNo != "Y" ? '请点击读卡按钮查找病人' :
																(nowRead == "" && replenishZero == "Y" && autoCreateCardNo != "Y" ? cardLength + '刷卡/输入或点击读卡（卡号可自动补零）'
																	: (nowRead == "" && replenishZero == "N" && autoCreateCardNo != "Y" ? cardLength + '刷卡/输入或点击读卡'
																		: (nowRead == 'I' && replenishZero == "Y" && autoCreateCardNo != "Y" ? cardLength + '输入卡号（卡号可自动补零）'
																			: (nowRead == 'I' && replenishZero == "N" && autoCreateCardNo != "Y" ? cardLength + '输入卡号'
																				: (autoCreateCardNo == "Y" ? "新建病人信息自动生成卡号" : ""
																				)))))
														}
														disabled={isModefined == 1 || nowRead == 'R' || !noCard || autoCreateCardNo == "Y"}
													/>
												)}
											</FormItem>
										</Tooltip>
									</Col>
									<Col span={6} >
										<Form.Item wrapperCol={{ span: 16 }}>
											<Button ref={this.readOneButton} disabled={nowRead == "I" || !noCard || autoCreateCardNo == "Y"} type="primary" loading={readLoading} onClick={this.handleCardReading}>
												读卡
											</Button>
											<Button style={{ marginLeft: 20 }} onClick={this.handleReadCard.bind(this)}>读身份证</Button>
											<Button type="primary" style={{ marginLeft: 20 }} onClick={() => this.handlePatients()}>
												查找病人
											</Button>
										</Form.Item>
									</Col>

									<Col span={4}>
										{/* 00945039 */}
										<FormItem {...formItemLayouPatCountry} style={{ boxSizing: "border-box" }} label='预约号'>
											{getFieldDecorator('appNo', {
												initialValue: this.state.appNo
											})(
												<Input
													placeholder='输入预约号回车查询'
													disabled={this.state.inBoxStatus === 'Y' ? true : false}
													onChange={this.handleChangeReportNo.bind(this, 'appNo')}
													onKeyDown={this.handleSelectReportMsg.bind(this)}
												/>
											)}
										</FormItem>
									</Col>
								</Row>
							</div>
							{/* <Row gutter={12} className="cardTitle">
								<div className="sCard">
									<img src={titleA} style={{ marginRight: "8px" }} />
									<span>病人基本信息</span>
								</div>
							</Row> */}
							<div className="rd-title rd-message">
								<img src={iconMessage} alt="" style={{ width: "20px", height: "16px", marginRight: "8px" }} />
								请输入患者信息
							</div>
							<div className="basic-info" style={{ position: "relative" }}>
								<div style={{ width: '91.5%' }}>
									<Row gutter={60} style={{ position: "relative" }} className="bi-first-row margin-bottom-16">
										<Col span={3} style={style} className="patNameDom titleLeft margin-right-20">
											<Tooltip getPopupContainer={() => document.querySelector('.patNameDom')} overlayClassName="toolTipDom patNameC" title={<div className="titleIcon">{mesIcon}<span >{patNameMessage}</span></div>} visible={this.state.patNameVisible} overlayStyle={{ zIndex: 999, }}>
												<FormItem {...formItemLayouName} label='病人姓名'>
													{getFieldDecorator('patName', {
														// validateTrigger: [""],
														initialValue: parms.patName ? parms.patName : undefined,
														rules: [{ required: this.setMessage('RegistrationCardPatientName', 'required') == 'Y' || (requireFlag && 'patName' in requireFlag && requireFlag.patName) ? true : false, message: '请输入', },
															// { validator: this.validName },
														],
													})(
														<Input
															onMouseOver={() => this.visibleTip(2)}
															ref={this.patName}
															onPressEnter={() => this.handleKeydownM(2)}
															onBlur={this.patBlur}
														// disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
														/>
													)}
												</FormItem>
											</Tooltip>
										</Col>
										<Col span={4} style={{ padding: "0" }} className="leftLine margin-right-20">
											<FormItem {...formItemLayouPatCountry} label='证件类型'>
												{getFieldDecorator('patCredTypeCode', {
													initialValue: parms.patCredTypeCode || parms.patCredTypeCode == "" ? parms.patCredTypeCode : undefined,
													rules: [{ required: this.setMessage('RegistrationCardTypeOfCertificate', 'required') == 'Y' || (requireFlag && 'patCredTypeCode' in requireFlag && requireFlag.patCredTypeCode) ? true : false, message: '' }],
												})(
													<Select ref={this.credType} onChange={this.handleCredNo} onSelect={this.handleCerdType} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} showSearch allowClear placeholder='请选择证件类型' optionFilterProp="role" >
														{credType}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={4} style={{ padding: '0' }} className="patNoDom margin-right-20">
											<Tooltip overlayClassName="toolTipDom patNoC" getPopupContainer={() => document.querySelector('.patNoDom')} title={<div className="titleIcon">{mesIcon}<span >{posMessage}</span></div>} visible={this.state.posVisible} overlayStyle={{ zIndex: 999 }}>
												<FormItem  {...formItemLayouPatCountry} label='证件号码' className="contentLeft">
													{getFieldDecorator('patCredNo', {
														validateTrigger: ["onPressEnter", "onBlur"],
														initialValue: parms.patCredNo ? parms.patCredNo : undefined,
														rules: [{ required: this.setMessage('RegistrationCardIDNumber', 'required') == 'Y' || (requireFlag && 'patCredNo' in requireFlag && requireFlag.patCredNo) ? true : false, message: '请输入' },
														{ validator: posType == "01" ? Util.vailIdCard : '' },],
														getValueFromEvent: (event) => {
															if (posType == "01") {
																return event.target.value.replace(/[^\d|Xx]/g, '')
															}
															else {
																return event.target.value.replace(/[^0-9a-zA-Z]/g, '')
															}
														},
													})(
														<Input
															style={{ padding: "0 2px", }}
															onClick={this.fouceCredNo}
															onMouseOver={() => this.visibleTip(3)}
															maxLength={posType == "01" ? 18 : 99}
															ref={this.patCredNo}
															onPressEnter={this.validCard}
															disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
															placeholder='  完善证件,以便退款'
															onBlur={(e) => this.validCard(e, 2)}
														/>
													)}
												</FormItem>
											</Tooltip>
										</Col>
										<Col span={3} style={style} className="sexConant leftLine margin-right-20">
											<FormItem  {...formItemLayouPatCountry} label='性别'>
												{getFieldDecorator('patSexCode', {
													initialValue: parms.patSexCode ? String(parms.patSexCode) : String(credSex),
													rules: [{ required: this.setMessage('RegistrationCardGender', 'required') == 'Y' || (requireFlag && 'patSexCode' in requireFlag && requireFlag.patSexCode) ? true : false, message: ' ' }],
												})(
													<Select ref={this.sex} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}>
														{sex}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={4} style={{ padding: "0" }} className="patBirthComp leftLine">
											<Tooltip getPopupContainer={() => document.querySelector('.patBirthComp')} overlayClassName="toolTipDom patBir" title={<div className="titleIcon">{mesIcon}<span >{patBirthMessage}</span></div>} visible={this.state.patBirthVisible} overlayStyle={{ zIndex: 999 }}>
												<Form.Item {...formItemLayouPatCountry} label={"出生日期"}>
													{getFieldDecorator('patBirthDate',
														{
															initialValue: credBirthday ? moment(credBirthday, "YYYY-MM-DD") : (parms.patBirthDateTime ? moment(parms.patBirthDateTime, "YYYY-MM-DD") : (parms.patBirthDateTime ? moment(parms.patBirthDateTime, "YYYY-MM-DD") : undefined)),
															rules: [{ required: this.setMessage('RegistrationCardDateOfBirth', 'required') == 'Y' || (requireFlag && 'patBirthDate' in requireFlag && requireFlag.patBirthDate) ? true : false, message: '请选择' }],
														})(
															<DatePicker
																showToday={false}
																style={{ width: '100%' }}
																onBlur={() => this.onChangeTimeBlur()}
																onFocus={() => this.visibleTip(10)}
																ref={this.patBirthDate}
																disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
																format={this.state.formatType ? 'YYYY-MM-DD' : 'YYYYMMDD'}
																onOpenChange={this.handleOnOpenChangeData}
																onChange={this.onPanelChange}
																placeholder={'例:19910101'}
																separator="-"
																allowClear
																disabledDate={(curDate) => {
																	return curDate && curDate > moment().endOf('day');
																}}
															/>
														)}
												</Form.Item>
											</Tooltip>
										</Col>
										<Col span={2} className="patBirthTime margin-right-20" >
											<FormItem {...formItemLayoutBirthTime}>
												{getFieldDecorator('patBirthTime',
													{
														initialValue: parms.patAge && parms.patAge.includes("分") && parms.patBirthTime != "" ? moment(parms.patBirthTime, "HH:mm") : undefined,
														rules: [{ required: false, message: '' }],
													})(
														<TimePicker
															separator=":"
															showToday
															format={this.state.isTransitionStart ? 'HH:mm' : 'HHmm'}
															onOpenChange={this.handleOnOpenChangeStart}
															open={this.state.openTime}
															onKeyDown={this.timeBlur}
															onChange={this.onPanelChangeTime}
															style={{ width: '100%' }}
															placeholder="非必选"
															disabledHours={() => {
																let hours = moment().hours();//0~23
																if (this.state.birthData === moment().format('YYYY-MM-DD')) {
																	return MlUtils.range(hours + 1, 24);
																}
															}}
															disabledMinutes={
																() => {
																	let minutes = moment().minutes();//0~23
																	if (this.state.birthData === moment().format('YYYY-MM-DD')) {
																		return MlUtils.range(minutes - 1, 60);
																	}
																}
															}

														/>
													)}
											</FormItem>
										</Col>
										<Col span={2} style={{ padding: '0' }} className="lastLeft leftLine">
											<FormItem {...formItemLayouAge} className="lastRightBorder" label={'年龄'}>
												{getFieldDecorator('age', {
													initialValue: credAge ? credAge : (parms.patAge ? parms.patAge : undefined),
													rules: [{ required: this.setMessage('RegistrationCardAge', 'required') == 'Y' || (requireFlag && 'age' in requireFlag && requireFlag.age) ? true : false, message: '年龄' },],
												})(
													<Input disabled readOnly="ture" style={{ marginRight: '4px', textAlign: 'left' }} />
												)}
											</FormItem>
										</Col>
									</Row>
									<Row gutter={60}>
										<Col span={3} style={style} className="patMobile titleLeft margin-right-20">
											<Tooltip getPopupContainer={() => document.querySelector('.patMobile')} overlayClassName="toolTipDom patNoC" placement="right" title={<div className="titleIcon">{mesIcon}<span >{patMobileMessage}</span></div>} visible={this.state.patMobileVisible} overlayStyle={{ zIndex: 999 }}>
												<FormItem {...formItemLayouName} label='手机号码'>
													{getFieldDecorator('patMobile', {
														validateTrigger: [""],
														initialValue: parms.patMobile ? parms.patMobile : undefined,
														// rules: [{ required: this.setMessage('RegistrationCardContactNumber', 'required') == 'Y' || (requireFlag && 'patMobile' in requireFlag && requireFlag.patMobile) ? true : false, message: '请输入', },
														// { pattern: new RegExp(/^1\d{10}$/), message: '请输入正确的手机号' }],
														rules: [{ required: false, message: '请输入', }, { pattern: new RegExp(/^1\d{10}$/), message: '请输入正确的手机号' }],
														getValueFromEvent: (event) => {
															return event.target.value.replace(/\D/g, '')
														},
													})(
														<Input
															maxLength={11}
															ref={this.patMobile}
															onMouseOver={() => this.visibleTip(4)}
															onBlur={this.patMobileBlur} onPressEnter={() => this.handleKeydownM(6)} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} />
													)}
												</FormItem>
											</Tooltip>

											<Tooltip getPopupContainer={() => document.querySelector('.patMobile')} overlayClassName="toolTipDom patNoC" placement="right" title={<div className="titleIcon">{mesIcon}<span >{patMobileMessage}</span></div>} visible={this.state.telphoneVisible} overlayStyle={{ zIndex: 999 }}>
												{/** @ByYQL: 座机号*/}
												{/** Create 2022-2-24*/}
												<FormItem {...formItemLayouName} label='座机号码'>
													{getFieldDecorator('telphone', {
														validateTrigger: [""],
														initialValue: parms.telphone ? parms.telphone : undefined,
														rules: [{ required: false, message: '请输入' },
														{ pattern: new RegExp(/^\d{3,4}\d{8}$/), message: '请输入座机号' }],
														getValueFromEvent: (event) => {
															return event.target.value.replace(/\D/g, '')
														},
													})(
														<Input
															maxLength={12}
															ref={this.telphone}
															onMouseOver={() => this.visibleTip(4)}
															onBlur={this.telphoneBlur} onPressEnter={() => this.handleKeydownM(6)} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} />
													)}
												</FormItem>
											</Tooltip>

										</Col>
										<Col span={4} style={{ padding: '0' }} className="sexConant leftLine margin-right-20" id="patType">
											<Tooltip getPopupContainer={() => document.querySelector('#patType')} overlayClassName="toolTipDom patTypeC" title={<div className="titleIcon">{mesIcon}<span >{patTypeMessage}</span></div>} visible={this.state.patTypeVisible} overlayStyle={{ zIndex: 999 }}>
												<FormItem  {...formItemLayouPatCountry} label='病人类型'>
													{getFieldDecorator('patTypeID', {
														initialValue: parms && parms.patTypeID ? parms.patTypeID : (this.state.baseParms.patType && this.state.baseParms.patType.length > 0 ? String(this.state.baseParms.patType[0].id) : undefined),
														rules: [{ required: this.setMessage('RegistrationCardPatientsWithType', 'required') == 'Y' || (requireFlag && 'patTypeID' in requireFlag && requireFlag.patTypeID) ? true : false, message: '请选择' }],
													})(
														<Select onMouseEnter={() => this.visibleTip(9)} ref={this.patType} onBlur={this.patTypeBlur} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}>
															{patType}
														</Select>
													)}
												</FormItem>
											</Tooltip>
										</Col>
										<Col span={4} style={style} className="leftLine margin-right-20">
											<FormItem {...formItemLayouPatCountry} label='国籍'>
												{getFieldDecorator('patCountryID', {
													initialValue: parms.patCountryID ? parms.patCountryID : "44",
													rules: [{ required: this.setMessage('RegistrationCardCountryOfCitizenship', 'required') == 'Y' || (requireFlag && 'patCountryID' in requireFlag && requireFlag.patCountryID) ? true : false, message: '请选择国籍' }],
												})(
													<Select disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} showSearch allowClear optionFilterProp="role" onChange={this.handleCountry}>
														{country}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={3} style={style} className="margin-right-20">
											<FormItem {...formItemLayouPatCountry} label='民族' className="contentLeft">
												{getFieldDecorator('patNationID', {
													initialValue: parms.patNationID ? parms.patNationID : '1',
													rules: [{ required: credCountry != 44 ? false : (this.setMessage('RegistrationCardNationality', 'required') == 'Y' || (requireFlag && 'patNationID' in requireFlag && requireFlag.patNationID) ? true : false), message: '' }],
												})(
													<Select ref={this.nation} disabled={credCountry != 44 || isModefined == 2 || isModefined == 3 || isModefined == 6} showSearch allowClear optionFilterProp="role" >
														{nation}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={4} style={style} className="patBirthComp leftLine margin-right-20">
											<FormItem {...formItemLayouPatCountry} label='职业'>
												{getFieldDecorator('patOccupationID', {
													initialValue: parms.patOccupationID ? parms.patOccupationID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardCareer', 'required') == 'Y' || parms?.occupationRequireFlag === 'Y' ? true : false, message: '请选择职业' }],
												})(
													<Select disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} showSearch allowClear optionFilterProp="role" >
														{occupation}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={4} style={{ padding: '0' }} className="lastLeft leftLine">
											<FormItem {...formItemLayouPatCountry} className="lastRightBorder" label='婚姻状况'>
												{getFieldDecorator('patMaritalID', {
													initialValue: parms.patMaritalID ? parms.patMaritalID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardMaritalStatus', 'required') == 'Y' || (requireFlag && 'patMaritalID' in requireFlag && requireFlag.patMaritalID) ? true : false, message: '请选择婚姻状况' }],
												})(
													<Select ref={this.patMaritalID} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} showSearch allowClear optionFilterProp="role" >
														{marital}
													</Select>
												)}
											</FormItem>
										</Col>

										<Col span={3} style={style} className="patMobile titleLeft margin-right-20">
											<FormItem {...formItemLayouName} className="lastRightBorder" label='文化程度'>
												{getFieldDecorator('patEduID', {
													initialValue: parms.patEduID ? parms.patEduID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardMaritalStatus', 'required') == 'Y' || (requireFlag && 'patEduID' in requireFlag && requireFlag.patEduID) ? true : false, message: '请选择婚姻状况' }],
												})(
													<Select ref={this.educationID} showSearch allowClear optionFilterProp="role"
														filterOption={(input, option) =>
															option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
															|| option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
														}>
														{educationListOption}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} className="patMobile titleLeft margin-right-20" style={{ display: (isModefined == -1 ? 'none' : 'inline-block') }}>
											<Form.Item label={"已绑卡型"} {...formItemLayouPatCountry} className="lastRightBorder">
												{getFieldDecorator('patientType',
													{
														initialValue: undefined,
														rules: [{ required: requireFlag && 'patientType' in requireFlag && requireFlag.patientType ? true : false, message: '' }],
													})(
														<div style={{
															color: 'rgba(0, 0, 0, 0.25)', height: "32px", borderRdius: '4px', border: "1px solid #E5E5E5", marginTop: "4px",
															lineHeight: "32px",
														}}>
															{bindArr}
														</div>
													)}
											</Form.Item>
										</Col>
										<Col span={4} className="patMobile titleLeft margin-right-20" style={{ display: (repariFeeFlag == "Y" || nowCost == 0 || nowCost == "" || isModefined == 1 || isFlag == 3 || !noCard ? 'none' : 'inline-block') }}>
											<FormItem label='支付方式' className="lastRightBorder" {...formItemLayouPatCountry}>
												{getFieldDecorator('cardPayMethodID', {
													initialValue: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
													rules: [{ required: nowCost == 0 || nowCost == "" || isModefined == 1 || isFlag == 3 || this.state.repariFeeFlag == "Y" || (requireFlag && 'cardPayMethodID' in requireFlag && requireFlag.cardPayMethodID) ? false : true, message: '请选择支付方式' }],
												})(
													<Select
														disabled={allDis || !noCard}
														ref={this.cardPayMethodID}
													>
														{payMethod}
													</Select>
												)}
											</FormItem>
										</Col>

										<Col span={4} className="patMobile titleLeft margin-right-20" style={{ display: (nowCost == 0 || nowCost == "" || isModefined == 1 || isFlag == 3 ? 'none' : 'inline-block') }}>
											<Form.Item label={"当前卡费"} {...formItemLayouPatCountry}>
												{getFieldDecorator('currentBalance',
													{
														initialValue: this.state.repariFeeFlag != "Y" && nowCost != 0 && nowCost != "" ? '￥' + nowCost : '￥' + nowCost + " " + "仅补卡时收费",
														rules: [{ required: requireFlag && 'currentBalance' in requireFlag && requireFlag.currentBalance ? true : false, message: '' }],
													})(
														<Input disabled style={{ textAligh: 'center' }} />
													)}
											</Form.Item>
										</Col>

										<Col span={5} className="patMobile titleLeft margin-right-20" style={{ display: (isModefined != 1 && nowCost != 0 && nowCost != "" ? 'inline-block' : 'none') }}>
											<Form.Item label={"当前发票"} {...formItemLayouPatCountry}>
												{getFieldDecorator('currentInvoice',
													{
														initialValue: undefined,
														rules: [{ required: requireFlag && 'currentInvoice' in requireFlag && requireFlag.currentInvoice ? true : false, message: '' }],
													})(
														<Input disabled placeholder={this.state.invoiceValue} type="text" />
													)}
											</Form.Item>
										</Col>
									</Row>
								</div>

								<Row style={{ position: "absolute", top: "6px", right: "24px", width: '8%' }}>
									{/* <BasicUpload onRef={this.onRefIcon} fileLength={1} /> */}
									{!Util.isEmpty(this.state.defaultImg) || (parms && parms.patImage) ? <div onClick={this.handleOpenPhoto.bind(this)}><img src={this.state.defaultImg ? this.state.defaultImg :
										(parms.patImage ? (this.state.imageAddress + parms.patImage) : '')} style={{ width: '100px', height: '100px', cursor: 'pointer' }} />
									</div> : <div style={{
										width: '100px', height: '100px', cursor: 'pointer', textAlign: 'center',
										borderRadius: '4px', border: '2px dashed #e8e8e8'
									}} onClick={this.handleOpenPhoto.bind(this)}>
										<div style={{ marginTop: 25 }}><Icon type='plus' /><div>采集人像</div></div>
									</div>}
								</Row>
							</div>


							<div className="baseInfoDom oneConts" style={{ marginBottom: "12px" }}>
								<div className="rd-title rd-address">
									<span className="title-tree"></span>
									地址信息
								</div>

								{/* 出生地址 */}
								<Row gutter={60} className="borderBottomRow margin-bottom-16">
									<Col span={4} className="titleLeft margin-right-20">
										<FormItem className="lastRightBorder birthLine" label={"出生地址"} {...formItemLayouPatCountry} >
											{getFieldDecorator('birthProvinceID',
												{
													initialValue: parms.patBirthProvinceID ? parms.patBirthProvinceID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthAddress', 'required') == 'Y' || (requireFlag && 'birthProvinceID' in requireFlag && requireFlag.birthProvinceID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.bornProvince}
														allowClear={true}
														showSearch={true}
														placeholder='省'
														optionFilterProp="role"
														onChange={this.onProvinceChange.bind(this, "birth")}
													>
														{
															localProvince && localProvince.map(item => {
																return (<Option key={item.id + "birth"} onClick={() => this.autoFocusCity("birth")} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
															})
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('birthCityID',
												{
													initialValue: parms.patBirthCityID ? parms.patBirthCityID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthAddress', 'required') == 'Y' || (requireFlag && 'birthCityID' in requireFlag && requireFlag.birthCityID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.birthCity}
														allowClear={true}
														showSearch={true}
														placeholder='市'
														optionFilterProp="role"
														onFocus={this.onCityFocus.bind(this, "birthProvinceID", "birthCity")}
														onChange={this.onCityChange.bind(this, "birth")}
													>
														{birthCityItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('birthAreaID',
												{
													initialValue: parms.patBirthAreaID ? parms.patBirthAreaID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthAddress', 'required') == 'Y' || (requireFlag && 'birthAreaID' in requireFlag && requireFlag.birthAreaID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.bornCountry}
														allowClear={true}
														showSearch={true}
														placeholder='县'
														optionFilterProp="role"
														onChange={this.onAreaChange.bind(this, "birth")}
														onFocus={this.onAreaFocus.bind(this, "birthCityID", "birth")}
													>
														{birthAreasItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={adressStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('birthVillageID',
												{
													initialValue: parms.patBirthVillageID ? parms.patBirthVillageID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthAddress', 'required') == 'Y' || (requireFlag && 'birthVillageID' in requireFlag && requireFlag.birthVillageID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.bornVillage}
														allowClear={true}
														showSearch={true}
														placeholder='乡'
														optionFilterProp="role"
														onChange={this.onVillageChange.bind(this, "birth")}
														onFocus={this.onVillageFocus.bind(this, "birthAreaID", "birth")}
													>
														{birthVillagesItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('birthHamletID',
												{
													initialValue: parms.patBirthHamletID ? parms.patBirthHamletID : undefined,
												})(
													<Select
														ref={this.bornHamlet}
														allowClear={true}
														showSearch={true}
														placeholder='村'
														optionFilterProp="role"
														onFocus={this.onHamletFocus.bind(this, "birthVillageID", "birth")}
													>
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={5} style={{ padding: '0' }}>
										<FormItem className="lastRightBorder">
											{getFieldDecorator('birthAddress',
												{
													initialValue: parms.patBirthAddressDesc ? parms.patBirthAddressDesc : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthAddress', 'required') == 'Y' || (requireFlag && 'birthAddress' in requireFlag && requireFlag.birthAddress) ? true : false, message: '请选择' }]
												})(
													<Input placeholder='详细地址(出生)' style={{ width: "calc(100% + 30px)" }} />
												)}
										</FormItem>
									</Col>
								</Row>

								{/* 联系人地址 */}
								<Row gutter={60} className="borderBottomRow margin-bottom-16">
									<Col span={4} className="titleLeft margin-right-20">
										<FormItem className="lastRightBorder birthLine" label={"联系人地址"} {...formItemLayouAdress}>
											{getFieldDecorator('contactProvinceID',
												{
													initialValue: patInfo.patContactProvinceID ? patInfo.patContactProvinceID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardContactAddress', 'required') == 'Y' || (requireFlag && 'contactProvinceID' in requireFlag && requireFlag.contactProvinceID) ? true : false, message: '请选择' }]
												})(
													<Select
														allowClear={true}
														showSearch={true}
														placeholder='省'
														optionFilterProp="role"
														onChange={this.onProvinceChange.bind(this, "contact")}
													>
														{
															localProvince && localProvince.map(item => {
																return (<Option key={item.id + "contact"} onClick={() => this.autoFocusCity("contact")} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
															})
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('contactCityID',
												{
													initialValue: patInfo.patContactCityID ? patInfo.patContactCityID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardContactAddress', 'required') == 'Y' || (requireFlag && 'contactCityID' in requireFlag && requireFlag.contactCityID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.econCity}
														allowClear={true}
														showSearch={true}
														placeholder='市'
														optionFilterProp="role"
														onChange={this.onCityChange.bind(this, "contact")}
														onFocus={this.onCityFocus.bind(this, "contactProvinceID", "contactCity")}
													>
														{contactCityItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('contactAreaID',
												{
													initialValue: patInfo.patContactAreaID ? patInfo.patContactAreaID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardContactAddress', 'required') == 'Y' || (requireFlag && 'contactAreaID' in requireFlag && requireFlag.contactAreaID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.econCountry}
														allowClear={true}
														showSearch={true}
														placeholder='县'
														optionFilterProp="role"
														onChange={this.onAreaChange.bind(this, "contact")}
														onFocus={this.onAreaFocus.bind(this, "contactCityID", "contact")}
													>
														{contactAreasItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('contactVillageID',
												{
													initialValue: patInfo.patContactVillageID ? patInfo.patContactVillageID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardContactAddress', 'required') == 'Y' || (requireFlag && 'contactVillageID' in requireFlag && requireFlag.contactVillageID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.econVillage}
														allowClear={true}
														showSearch={true}
														placeholder='乡'
														optionFilterProp="role"
														onChange={this.onVillageChange.bind(this, "contact")}
														onFocus={this.onVillageFocus.bind(this, "contactAreaID", "contact")}
													>
														{contactVillagesItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('contactHamletID',
												{
													initialValue: patInfo.patContactHamletID ? patInfo.patContactHamletID : undefined,
												})(
													<Select
														ref={this.econHamlet}
														allowClear={true}
														showSearch={true}
														placeholder='村'
														optionFilterProp="role"
														onFocus={this.onHamletFocus.bind(this, "contactVillageID", "contact")}
													>
														{contactHamletsItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={5} style={{ padding: '0' }}>
										<FormItem className="lastRightBorder" >
											{getFieldDecorator('contactAddress',
												{
													initialValue: patInfo.patContactAddressDesc ? patInfo.patContactAddressDesc : undefined,
													rules: [{ required: this.setMessage('RegistrationCardContactAddress', 'required') == 'Y' || (requireFlag && 'contactAddress' in requireFlag && requireFlag.contactAddress) ? true : false, message: '请选择' }]
												})(
													<Input placeholder='详细地址(联系人地址)' style={{ width: "calc(100% + 30px)" }} />
												)}
										</FormItem>
									</Col>
								</Row>

								{/* 籍贯 */}
								<Row gutter={60} className="borderBottomRow margin-bottom-16">
									<Col span={4} className="titleLeft margin-right-20">
										<FormItem className="lastRightBorder" label={"籍贯"} {...formItemLayouAdress}>
											{getFieldDecorator('nativeProvinceID',
												{
													initialValue: parms.patNativeProvinceID ? parms.patNativeProvinceID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthPlace', 'required') == 'Y' || (requireFlag && 'nativeProvinceID' in requireFlag && requireFlag.nativeProvinceID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.nativeProvince}
														allowClear={true}
														showSearch={true}
														placeholder='省'
														optionFilterProp="role"
														onChange={this.onProvinceChange.bind(this, "native")}
													>
														{
															localProvince && localProvince.map(item => {
																return (<Option key={item.id + "native"} onClick={() => this.autoFocusCity("native")} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
															})
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('nativeCityID',
												{
													initialValue: parms.patNativeCityID ? parms.patNativeCityID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthPlace', 'required') == 'Y' || (requireFlag && 'nativeCityID' in requireFlag && requireFlag.nativeCityID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.nativeCity}
														allowClear={true}
														showSearch={true}
														placeholder='市'
														optionFilterProp="role"
														onChange={this.onCityChange.bind(this, "native")}
														onFocus={this.onCityFocus.bind(this, "nativeProvinceID", "nativeCity")}
													>
														{nativeCityItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('nativeAreaID',
												{
													initialValue: parms.patNativeAreaID ? parms.patNativeAreaID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthPlace', 'required') == 'Y' || (requireFlag && 'nativeAreaID' in requireFlag && requireFlag.nativeAreaID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.nativeCountry}
														allowClear={true}
														showSearch={true}
														placeholder='县'
														optionFilterProp="role"
														onChange={this.onAreaChange.bind(this, "native")}
														onFocus={this.onAreaFocus.bind(this, "nativeCityID", "native")}
													>
														{nativeAreasItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={adressStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('nativeVillageID',
												{
													initialValue: parms.patNativeVillageID ? parms.patNativeVillageID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthPlace', 'required') == 'Y' || (requireFlag && 'nativeVillageID' in requireFlag && requireFlag.nativeVillageID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.nativeVillage}
														allowClear={true}
														showSearch={true}
														placeholder='乡'
														optionFilterProp="role"
														onChange={this.onVillageChange.bind(this, "native")}
														onFocus={this.onVillageFocus.bind(this, "nativeAreaID", "native")}
													>
														{nativeVillagesItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={provinceStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('nativeHamletID',
												{
													initialValue: parms.patNativeHamletID ? parms.patNativeHamletID : undefined,
												})(
													<Select
														ref={this.nativeHamlet}
														allowClear={true}
														showSearch={true}
														placeholder='村'
														optionFilterProp="role"
														onFocus={this.onHamletFocus.bind(this, "nativeVillageID", "native")}
													>
														{nativeHamletsItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={5} style={{ padding: '0' }}>
										<FormItem className="lastRightBorder">
											{getFieldDecorator('nativeAddress',
												{
													initialValue: parms.patNativeAddressDesc ? parms.patNativeAddressDesc : undefined,
													rules: [{ required: this.setMessage('RegistrationCardBirthPlace', 'required') == 'Y' || (requireFlag && 'nativeAddress' in requireFlag && requireFlag.nativeAddress) ? true : false, message: '请选择' }]
												})(
													<Input placeholder='详细地址(籍贯)' style={{ width: "calc(100% + 30px)" }} />
												)}
										</FormItem>
									</Col>
								</Row>

								{/* 现住址 */}
								<Row gutter={60} className="borderBottomRow margin-bottom-16">
									<Col span={4} className="titleLeft margin-right-20">
										<FormItem className="lastRightBorder" label={"现住址"} {...formItemLayouAdress} >
											{getFieldDecorator('presentProvinceID',
												{
													initialValue: parms.patPresentProvinceID ? parms.patPresentProvinceID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardCurrentAddress', 'required') == 'Y' || (requireFlag && 'presentProvinceID' in requireFlag && requireFlag.presentProvinceID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.province}
														allowClear={true}
														showSearch={true}
														placeholder='省'
														optionFilterProp="role"
														onChange={this.onProvinceChange.bind(this, "present")}
													>
														{
															localProvince && localProvince.map(item => {
																return (<Option key={item.id + "present"} onClick={() => this.autoFocusCity("present")} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
															})
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('presentCityID',
												{
													initialValue: parms.patPresentCityID ? parms.patPresentCityID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardCurrentAddress', 'required') == 'Y' || (requireFlag && 'presentCityID' in requireFlag && requireFlag.presentCityID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.city}
														allowClear={true}
														showSearch={true}
														placeholder='市'
														optionFilterProp="role"
														onChange={this.onCityChange.bind(this, "present")}
														onFocus={this.onCityFocus.bind(this, "presentProvinceID", "presentCity")}
													>
														{
															presentCityItem
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('presentAreaID',
												{
													initialValue: parms.patPresentAreaID ? parms.patPresentAreaID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardCurrentAddress', 'required') == 'Y' || (requireFlag && 'presentAreaID' in requireFlag && requireFlag.presentAreaID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.country}
														allowClear={true}
														showSearch={true}
														placeholder='县'
														optionFilterProp="role"
														onChange={this.onAreaChange.bind(this, "present")}
														onFocus={this.onAreaFocus.bind(this, "presentCityID", "present")}
													>
														{presentAreasItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('presentVillageID',
												{
													initialValue: parms.patPresentVillageID ? parms.patPresentVillageID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardxian', 'required') == 'Y' || (requireFlag && 'presentVillageID' in requireFlag && requireFlag.presentVillageID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.village}
														allowClear={true}
														showSearch={true}
														placeholder='乡'
														optionFilterProp="role"
														onChange={this.onVillageChange.bind(this, "present")}
														onFocus={this.onVillageFocus.bind(this, "presentAreaID", "present")}
													>
														{presentVillagesItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('presentHamletID',
												{
													initialValue: parms.patPresentHamletID ? parms.patPresentHamletID : undefined,
												})(
													<Select
														ref={this.hamlet}
														allowClear={true}
														showSearch={true}
														placeholder='村'
														optionFilterProp="role"
														onFocus={this.onHamletFocus.bind(this, "presentVillageID", "present")}
													>
														{presentHamletsItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={5} style={{ padding: '0', position: "relative", }} id="patAdress" className="margin-right-20">
										<Tooltip getPopupContainer={() => document.querySelector('#patAdress')} overlayClassName="toolTipDom patAd" title={<div className="titleIcon">{mesIcon}<span >{patAdressMessage}</span></div>} visible={this.state.patAdressVisible} overlayStyle={{ zIndex: 999 }}>
											<FormItem className="lastRightBorder nowStarDom" label={""}  {...formItemThreeAdress}>
												{getFieldDecorator('presentAddressDesc',
													{
														initialValue: parms.patPresentAddressDesc ? parms.patPresentAddressDesc : undefined,
														rules: [{ required: this.setMessage('RegistrationCarddetails', 'required') == 'Y' || (requireFlag && 'presentAddressDesc' in requireFlag && requireFlag.presentAddressDesc) ? true : false, message: '请输入' }]
													})(
														<Input
															ref={this.patAddress}
															onMouseOver={() => this.visibleTip(5)}
															onBlur={this.patAdressBlur}
															placeholder='详细地址(现住址)'
														/>
													)}
											</FormItem>
										</Tooltip>
									</Col>
									<Col span={3} className="lastRightBorder lastLeft leftOLine" id="patAdressZip">
										<Tooltip getPopupContainer={() => document.querySelector('#patAdressZip')} overlayClassName="toolTipDom patAd" title={<div className="titleIcon">{mesIcon}<span >{patAdressMessageZip}</span></div>} visible={this.state.patAdressZipVisible} overlayStyle={{ zIndex: 999 }}>
											<FormItem label={"邮编"} {...formItemLayouAdress} className="zipBorder">
												{getFieldDecorator('presentZIP',
													{
														initialValue: parms.patPresentZIPDesc ? parms.patPresentZIPDesc : undefined,
														rules: [{ required: false, message: '' },
														{ pattern: new RegExp(/^[0-9][0-9]{5}$/), message: '请输入正确的邮编' }],
														getValueFromEvent: (event) => {
															return event.target.value.replace(/\D/g, '')
														},
													})(
														<Input
															maxLength={6}
															ref={this.presentZIP}
															onPressEnter={() => this.handleKeydownM(27)}
															onMouseOver={() => this.visibleTip(13)}
															onBlur={() => this.handleKeydownM(27)}
															disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
															placeholder='0-9 6位'
														/>
													)}
											</FormItem>
										</Tooltip>
									</Col>
								</Row>

								{/* 户口地址 */}
								<Row gutter={60} className="borderBottomRow margin-bottom-16">
									<Col span={4} className="titleLeft margin-right-20">
										<FormItem className="lastRightBorder" label={"户口地址"} {...formItemLayouAdress}>
											{getFieldDecorator('registerProvinceID',
												{
													initialValue: patInfo.patRegisterProvinceID ? patInfo.patRegisterProvinceID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardAccountAddress', 'required') == 'Y' || (requireFlag && 'registerProvinceID' in requireFlag && requireFlag.registerProvinceID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.houseProvince}
														allowClear={true}
														showSearch={true}
														placeholder='省'
														optionFilterProp="role"
														onChange={this.onProvinceChange.bind(this, "register")}
													>
														{
															localProvince && localProvince.map(item => {
																return (<Option key={item.id + "register"} onClick={() => this.autoFocusCity("register")} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
															})
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('registerCityID',
												{
													initialValue: patInfo.patRegisterCityID ? patInfo.patRegisterCityID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardAccountAddress', 'required') == 'Y' || (requireFlag && 'registerCityID' in requireFlag && requireFlag.registerCityID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.houseCity}
														allowClear={true}
														showSearch={true}
														placeholder='市'
														optionFilterProp="role"
														onChange={this.onCityChange.bind(this, "register")}
														onFocus={this.onCityFocus.bind(this, "registerProvinceID", "registerCity")}
													>
														{
															registerCityItem
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('registerAreaID',
												{
													initialValue: patInfo.patRegisterAreaID ? patInfo.patRegisterAreaID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardAccountAddress', 'required') == 'Y' || (requireFlag && 'registerAreaID' in requireFlag && requireFlag.registerAreaID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.houseCountry}
														allowClear={true}
														showSearch={true}
														placeholder='县'
														optionFilterProp="role"
														onChange={this.onAreaChange.bind(this, "register")}
														onFocus={this.onAreaFocus.bind(this, "registerCityID", "register")}
													>
														{registerAreasItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('registerVillageID',
												{
													initialValue: patInfo.patRegisterVillageID ? patInfo.patRegisterVillageID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardAccountAddress', 'required') == 'Y' || (requireFlag && 'registerVillageID' in requireFlag && requireFlag.registerVillageID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.houseVillage}
														allowClear={true}
														showSearch={true}
														placeholder='乡'
														optionFilterProp="role"
														onChange={this.onVillageChange.bind(this, "register")}
														onFocus={this.onVillageFocus.bind(this, "registerAreaID", "register")}
													>
														{registerVillagesItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('registerHamletID',
												{
													initialValue: patInfo.patRegisterHamletID ? patInfo.patRegisterHamletID : undefined,
												})(
													<Select
														ref={this.houseHamlet}
														allowClear={true}
														showSearch={true}
														placeholder='村'
														optionFilterProp="role"
														onFocus={this.onHamletFocus.bind(this, "registerVillageID", "register")}
													>
														{registerHamletsItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={5} style={{ padding: '0' }} className="margin-right-20">
										<FormItem className="lastRightBorder"  {...formItemThreeAdress}>
											{getFieldDecorator('registerAddress',
												{
													initialValue: patInfo.patRegisterAddressDesc ? patInfo.patRegisterAddressDesc : undefined,
													rules: [{ required: this.setMessage('RegistrationCardAccountAddress', 'required') == 'Y' || (requireFlag && 'registerAddress' in requireFlag && requireFlag.registerAddress) ? true : false, message: '请选择' }]
												})(
													<Input placeholder='详细地址(户口地址)' />
												)}
										</FormItem>
									</Col>
									<Col span={3} className="lastRightBorder lastLeft leftOLine" id="patAdressHouseZip">
										<Tooltip getPopupContainer={() => document.querySelector('#patAdressHouseZip')} overlayClassName="toolTipDom patAd" title={<div className="titleIcon">{mesIcon}<span >{patAdressHouseMessageZip}</span></div>} visible={this.state.patAdressHouseZipVisible} overlayStyle={{ zIndex: 999 }}>
											<FormItem label={"邮编"} {...formItemLayouAdress} className="zipBorder">
												{getFieldDecorator('registerZIP',
													{
														initialValue: patInfo.patRegisterZIPDesc ? patInfo.patRegisterZIPDesc : undefined,
														rules: [{ required: false, message: '' },
														{ pattern: new RegExp(/^[0-9][0-9]{5}$/), message: '请输入正确的邮编' }],
														getValueFromEvent: (event) => {
															return event.target.value.replace(/\D/g, '')
														},
													})(
														<Input maxLength={6}
															ref={this.registerZIP} onMouseOver={() => this.visibleTip(14)}
															onPressEnter={() => this.handleKeydownM(30)} onBlur={() => this.handleKeydownM(30)}
															disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} placeholder='0-9 6位' />
													)}
											</FormItem>
										</Tooltip>
									</Col>
								</Row>

								{/* 单位地址 */}
								<Row gutter={60} className="borderBottomRow">
									<Col span={4} className="titleLeft margin-right-20">
										<FormItem className="lastRightBorder" label={"单位地址"} {...formItemLayouAdress}>
											{getFieldDecorator('companyProvinceID',
												{
													initialValue: patInfo.patCompanyProvinceID ? patInfo.patCompanyProvinceID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardUnitAddress', 'required') == 'Y' || (requireFlag && 'companyProvinceID' in requireFlag && requireFlag.companyProvinceID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.companyProvince}
														allowClear={true}
														showSearch={true}
														placeholder='省'
														optionFilterProp="role"
														onChange={this.onProvinceChange.bind(this, "company")}
													>
														{
															localProvince && localProvince.map(item => {
																return (<Option key={item.id + "company"} onClick={() => this.autoFocusCity("company")} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
															})
														}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('companyCityID',
												{
													initialValue: patInfo.patCompanyCityID ? patInfo.patCompanyCityID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardUnitAddress', 'required') == 'Y' || (requireFlag && 'companyCityID' in requireFlag && requireFlag.companyCityID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.companyCity}
														allowClear={true}
														showSearch={true}
														placeholder='市'
														optionFilterProp="role"
														onChange={this.onCityChange.bind(this, "company")}
														onFocus={this.onCityFocus.bind(this, "companyProvinceID", "companyCity")}
													>
														{companyCityItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('companyAreaID',
												{
													initialValue: patInfo.patCompanyAreaID ? patInfo.patCompanyAreaID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardUnitAddress', 'required') == 'Y' || (requireFlag && 'companyAreaID' in requireFlag && requireFlag.companyAreaID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.companyCountry}
														allowClear={true}
														showSearch={true}
														placeholder='县'
														optionFilterProp="role"
														onChange={this.onAreaChange.bind(this, "company")}
														onFocus={this.onAreaFocus.bind(this, "companyCityID", "company")}
													>
														{companyAreasItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('companyVillageID',
												{
													initialValue: patInfo.patCompanyVillageID ? patInfo.patCompanyVillageID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardUnitAddress', 'required') == 'Y' || (requireFlag && 'companyVillageID' in requireFlag && requireFlag.companyVillageID) ? true : false, message: '请选择' }]
												})(
													<Select
														ref={this.companyVillage}
														allowClear={true}
														showSearch={true}
														placeholder='乡'
														optionFilterProp="role"
														onChange={this.onVillageChange.bind(this, "company")}
														onFocus={this.onVillageFocus.bind(this, "companyAreaID", "company")}
													>
														{companyVillagesItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={3} style={nowAdStyle} className="margin-right-20">
										<FormItem className="lastRightBorder">
											{getFieldDecorator('companyHamletID',
												{
													initialValue: patInfo.patCompanyHamletID ? patInfo.patCompanyHamletID : undefined,
												})(
													<Select
														ref={this.companyHamlet}
														allowClear={true}
														showSearch={true}
														placeholder='村'
														optionFilterProp="role"
														onFocus={this.onHamletFocus.bind(this, "companyVillageID", "company")}
													>
														{companyHamletsItem}
													</Select>
												)}
										</FormItem>
									</Col>
									<Col span={5} style={{ padding: '0' }} className="margin-right-20">
										<FormItem className="lastRightBorder"  {...formItemThreeAdress}>
											{getFieldDecorator('companyAddress',
												{
													initialValue: patInfo.patCompanyAddressDesc ? patInfo.patCompanyAddressDesc : undefined,
													rules: [{ required: this.setMessage('RegistrationCardUnitAddress', 'required') == 'Y' || (requireFlag && 'companyAddress' in requireFlag && requireFlag.companyAddress) ? true : false, message: '请选择' }]
												})(
													<Input placeholder='详细地址(单位地址)' />
												)}
										</FormItem>
									</Col>
									<Col span={3} className="lastRightBorder lastLeft leftOLine" id="patAdressComZip">
										<Tooltip getPopupContainer={() => document.querySelector('#patAdressComZip')} overlayClassName="toolTipDom patAd" title={<div className="titleIcon">{mesIcon}<span >{patAdressComMessageZip}</span></div>} visible={this.state.patAdressComZipVisible} overlayStyle={{ zIndex: 999 }}>
											<Form.Item label={"邮编"} {...formItemLayouAdress} className="zipBorder">
												{getFieldDecorator('companyZIP',
													{
														validateTrigger: "",
														initialValue: parms.patCompanyZIPDesc ? parms.patCompanyZIPDesc : undefined,
														rules: [{ required: false, message: '' }, { pattern: new RegExp(/^[0-9][0-9]{5}$/), message: '请输入正确的邮编' }],
														getValueFromEvent: (event) => {
															return event.target.value.replace(/\D/g, '')
														},
													})(
														<Input
															allowClear maxLength={6}
															ref={this.companyZIP} onMouseOver={() => this.visibleTip(15)}
															onPressEnter={() => this.handleKeydownM(19)}
															onBlur={() => this.handleKeydownM(19)}
															disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} placeholder='0-9 6位' />
													)}
											</Form.Item>
										</Tooltip>
									</Col>
								</Row>
							</div>
							<div className="baseInfoDom countryLine oneConts rightLine" style={{ marginBottom: "12px" }}>
								<div className="rd-title rd-address">
									<span className="title-tree"></span>
									其他信息
								</div>
								{/* 联系人姓名 */}
								<Row gutter={60} className="countryLine margin-bottom-16">
									<Col span={4} style={{ padding: '0' }} className="ecoNameDom titleLeft margin-right-20">
										<Tooltip getPopupContainer={() => document.querySelector('.ecoNameDom')} overlayClassName="toolTipDom patNameC" title={<div className="titleIcon">{mesIcon}<span >{econNameMessage}</span></div>} visible={this.state.econNameVisible} overlayStyle={{ zIndex: 999, }}>
											<Form.Item label={'联系人姓名'} {...formItemLayouPatCountry} >
												{getFieldDecorator('patEContact',
													{
														validateTrigger: ["onPressEnter",],
														initialValue: parms.patEContact ? parms.patEContact : undefined,
														/**
														 * @ByShizi: 南宁普瑞-登记建卡，<18岁和>60岁患者，家属信息必填 - 根据医院配置familyInforForCard
														 * 需求 #1127
														 * Create 2023-02-07
														 * */
														rules: [{
															required: (baseParms?.familyInforForCard === 'Y' ? ((parseInt(credAge) < 18) || (parseInt(parms.patAge) < 18) || (parseInt(credAge) > 60) || (parseInt(parms.patAge) > 60)) : this.setMessage('RegistrationCardContactName', 'required') === 'Y') ? true : false,
															message: '请填写联系人姓名'
														}],
													})(
														<Input
															onMouseOver={() => this.visibleTip(12)}
															onPressEnter={() => this.handleKeydownM(11)}
															ref={this.econName}
															disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
															onBlur={this.patEconNameBlur}
														/>
													)}
											</Form.Item>
										</Tooltip>
									</Col>
									<Col span={4} style={{ padding: '0' }} className="sexConant leftLine ecorelationDom margin-right-20">
										<Tooltip getPopupContainer={() => document.querySelector('.ecorelationDom')} overlayClassName="toolTipDom patNameC" title={<div className="titleIcon">{mesIcon}<span >{this.state.econRelationMessage}</span></div>} visible={this.state.econRelationVisible} overlayStyle={{ zIndex: 999, }}>
											<Form.Item label={'联系人关系'} {...formItemLayouPatCountry} >
												{getFieldDecorator('patERelationID',
													{
														validateTrigger: ["onPressEnter",],
														initialValue: parms.patERelationID ? parms.patERelationID : undefined,
														rules: [{
															required: (baseParms?.familyInforForCard === 'Y' ? ((parseInt(credAge) < 18) || (parseInt(parms.patAge) < 18) || (parseInt(credAge) > 60) || (parseInt(parms.patAge) > 60)) : this.setMessage('RegistrationCardContactRelationship', 'required') === 'Y') ? true : false,
															message: '请选择'
														}],
													})(
														<Select
															onMouseOver={() => this.visibleTip(16)}
															onBlur={this.patEconRelationBlur}
															ref={this.econRelation}
															disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
															showSearch
															allowClear
															optionFilterProp="role"
														>
															{relation}
														</Select>
													)}
											</Form.Item>
										</Tooltip>
									</Col>
									<Col span={4} style={{ padding: "0 0 0 12px" }} className="econPhone leftLine margin-right-20">
										<Tooltip getPopupContainer={() => document.querySelector('.econPhone')} overlayClassName="toolTipDom patNoC" placement="right" title={<div className="titleIcon">{mesIcon}<span >{econPhoneMessage}</span></div>} visible={this.state.econPhoneVisible} overlayStyle={{ zIndex: 999 }}>
											<Form.Item label={'联系人手机'} {...formItemLayouPatCountry}>
												{getFieldDecorator('patEContactMobile',
													{
														validateTrigger: ["onPressEnter",],
														initialValue: parms.patEContactMobile ? parms.patEContactMobile : undefined,
														rules: [{
															// required: parseInt(credAge) < 14 || parseInt(parms.patAge) < 14 || credAge && credAge.indexOf("天") != -1 || parms.patAge && parms.patAge.indexOf("天") != -1 ? true : false, message: '请填写联系人手机'
															required: (baseParms?.familyInforForCard === 'Y' ? ((parseInt(credAge) < 18) || (parseInt(parms.patAge) < 18) || (parseInt(credAge) > 60) || (parseInt(parms.patAge) > 60)) : this.setMessage('RegistrationCardContactPhone', 'required') === 'Y') ? true : false,
															message: '请填写联系人手机'
														},
														{ pattern: new RegExp(/^1\d{10}$/), message: '请输入正确的手机号' }
														],
														getValueFromEvent: (event) => {
															return event.target.value.replace(/\D/g, '')
														},
													})(
														<Input
															onMouseOver={() => this.visibleTip(11)}
															maxLength={11}
															onPressEnter={() => this.handleKeydownM(12)}
															onBlur={this.checkPatMobile}
															ref={this.econMobile} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
														/>
													)}
											</Form.Item>
										</Tooltip>
									</Col>
									<Col span={4} className="sexConant titleLeft margin-right-20">
										<Form.Item label={"报备人员"} {...formItemLayoutBirth}>
											{getFieldDecorator('adminUser',
												{
													initialValue: parms.adminUser ? parms.adminUser : undefined
												})(
													<Input style={{ textAligh: 'center' }} placeholder='请输入' disabled />
												)}
										</Form.Item>
									</Col>
									<Col span={5} className="lastLeft leftLine ecoNameDom sourceDom titleLeft margin-right-20">
										<Tooltip getPopupContainer={() => document.querySelector('.sourceDom')} overlayClassName="toolTipDom patNoC" placement="right" title={<div className="titleIcon">{mesIcon}<span >{sourceMessage}</span></div>} visible={this.state.sourceVisible} overlayStyle={{ zIndex: 999 }}>
											<Form.Item label={"渠道来源"} {...formItemLayouAdress} className="lastRightBorder" style={{ borderTop: "0" }}>
												{getFieldDecorator('patSourceID',
													{
														validateTrigger: ["onPressEnter",],
														initialValue: parms.patSourceID ? parms.patSourceID : undefined,
														rules: [{ required: this.setMessage('RegistrationCardway', 'required') == 'Y' || (requireFlag && 'patSourceID' in requireFlag && requireFlag.patSourceID) ? true : false, message: '请选择渠道来源' }],
													})(
														<Select
															ref={this.patSourceID}
															optionFilterProp="role"
															showSearch
															allowClear
															onBlur={this.checkPatSource}
															disabled
														>
															{patFormOpt}
														</Select>
													)}
											</Form.Item>
										</Tooltip>
									</Col>
								</Row>
								{/* 渠道来源 */}
								<Row gutter={60} style={{ padding: '0', borderTop: "0", borderLeft: "0" }}>
									<Col span={4} style={{ padding: '0' }} className="patNoDom margin-right-20">
										<Form.Item label={"工作单位"} {...formItemLayouPatCountry}>
											{getFieldDecorator('patCompany',
												{
													initialValue: parms.patCompany ? parms.patCompany : undefined,
													rules: [{ required: this.setMessage('RegistrationCardWorkUnits', 'required') == 'Y' || (requireFlag && 'patCompany' in requireFlag && requireFlag.patCompany) ? true : false, message: '请输入工作单位' }],
												})(
													<Input
														onPressEnter={() => this.handleKeydownM(15)}
														ref={this.patCompany}
														disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} />
												)}
										</Form.Item>
									</Col>
									<Col span={4} style={{ padding: "0" }} className="patBirth leftLine margin-right-20">
										<Form.Item label={'单位电话'} {...formItemLayouPatCountry}>
											{getFieldDecorator('patCompanyTel',
												{
													validateTrigger: ["onPressEnter",],
													initialValue: parms.patCompanyTel ? parms.patCompanyTel : undefined,
													rules: [{ required: this.setMessage('RegistrationCardWorkPhone', 'required') == 'Y' || (requireFlag && 'patCompanyTel' in requireFlag && requireFlag.patCompanyTel) ? true : false, message: '请输入单位电话' }],
													getValueFromEvent: (event) => {
														return event.target.value.replace(/[^0-9-]/g, '')
													},
												})
												(
													<Input
														onPressEnter={() => this.handleKeydownM(16)}
														ref={this.patCompanyTel}
														disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
													/>
												)}
										</Form.Item>
									</Col>
									<Col span={4} style={{ padding: '0' }} className="lastLeft leftLine margin-right-20">
										<Form.Item label={"身份标签"} {...formItemLayouPatCountry} className="lastRightBorder">
											{getFieldDecorator('patSocialStatusID',
												{
													initialValue: parms.patSocialStatusID ? parms.patSocialStatusID : undefined,
													rules: [{ required: this.setMessage('RegistrationCardIdentityTag', 'required') == 'Y' || (requireFlag && 'patSocialStatusID' in requireFlag && requireFlag.patSocialStatusID) ? true : false, message: '请选择身份标签' }],
												})(
													<Select ref={this.patSocialStatusID} optionFilterProp="role" showSearch allowClear disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} onChange={this.handleposTag}>
														{socialStatus}
													</Select>
												)}
										</Form.Item>
									</Col>
									<Col span={4} className="sexConant titleLeft margin-right-20">
										<Form.Item label={"备注"} {...formItemLayoutBirth}>
											{getFieldDecorator('otherSource',
												{
													initialValue: parms.otherSource ? parms.otherSource : undefined,
													rules: [{ required: false, message: '' }],
												})(
													<Input style={{ textAligh: 'center' }} placeholder='请输入' />
												)}
										</Form.Item>
									</Col>
									<Col span={5} className="titleLeft margin-right-20">
										<Form.Item label={"账户余额(元)"} {...formItemLayouPatCountry}>
											{getFieldDecorator('balance',
												{
													initialValue: parms.balance ? "￥" + parms.balance : "￥--",
													rules: [{ required: false, message: '' }],
												})(
													<Input disabled />
												)}
										</Form.Item>
									</Col>
								</Row>
							</div>
							<Row className="rd-btn">
								<Col>
									<Form.Item wrapperCol={{ span: 24, offset: 18.5 }} >
										{/* <Button type="primary" ghost style={{ marginRight: "32px" }} onClick={() => {
											this.handleOpenPhoto()
										}}>采集人像</Button> */}
										<Button
											disabled={allDis || canSave}
											ref={this.creadCard}
											type="primary"
											loading={postLoading}
											onClick={this.handleSubmit}>
											{isModefined == 1 ? '保存修改( ctrl + s )' : (isFlag == 3 ? '开始换卡' : (isFlag == 4 ? '开始补卡' : (isModefined == 6 ? '开始绑卡' : '开始建卡( ctrl + s )')))}
										</Button>
										<Button
											style={{ marginLeft: 32, display: (isModefined != 2 || isModefined != 3 || isModefined == 6 ? 'inline-block' : 'none') }}
											onClick={this.handleReset}>
											清空( ctrl + z )
										</Button>
										<Button
											style={{ marginLeft: 32, border: "0" }} type={isModefined != 1 && this.state.patBarPatID == "" ? "" : "primary"} disabled={isModefined != 1 && this.state.patBarPatID == ""}
											onClick={this.handlePatBarcode}>
											打印条码
										</Button>
										<Button title={bindDis && this.state.bindCardArr.length > 0 ? "已绑定全部卡类型，不能继续绑定" : (bindDis && this.state.bindCardArr.length == 0 ? "" : "")} type={bindDis ? "" : "primary"} style={{ marginLeft: 32, border: "0", display: (noCard ? "inline-block" : "none") }} disabled={bindDis} onClick={() => this.handleCard(6, cardSatus)}>绑卡</Button>
										<Button style={{ marginLeft: 32, border: "0", display: (noCard ? "none" : "inline-block") }} type={noCard ? "" : "primary"} disabled={noCard} onClick={() => this.handleCard(6, cardSatus)}>绑卡</Button>
										<Button title={cardSatus.changeFlag && cardSatus.changeFlag == 'N' ? cardSatus.unChangeReson : (this.state.bindCardArr.length == 0 ? "" : "")} style={{ marginLeft: 32, border: "0" }} type={!cardSatus.changeFlag || cardSatus.changeFlag == 'N' ? "" : "primary"} disabled={!cardSatus.changeFlag || cardSatus.changeFlag == 'N'} onClick={() => this.handleCard(3, cardSatus)} >换卡</Button>
										<Button title={cardSatus.lossFlag && cardSatus.lossFlag == 'N' ? cardSatus.unLossReson : (this.state.bindCardArr.length == 0 ? "" : "")} style={{ marginLeft: 32, border: "0" }} type={!cardSatus.lossFlag || cardSatus.lossFlag == 'N' ? "" : "primary"} disabled={!cardSatus.lossFlag || cardSatus.lossFlag == 'N'} onClick={() => this.handleCard(2, cardSatus)}  >挂失</Button>
										<Button title={cardSatus.repairFlag && cardSatus.repairFlag == 'N' ? cardSatus.unRepairReson : (this.state.bindCardArr.length == 0 ? "" : "")} style={{ margin: "0 32px 0 32px", border: "0" }} type={!cardSatus.repairFlag || cardSatus.repairFlag == 'N' ? "" : "primary"} disabled={!cardSatus.repairFlag || cardSatus.repairFlag == 'N'} onClick={() => this.handleCard(4, cardSatus)} >补卡</Button>
										<Button
											style={{ margin: "0 32px 0 32px", border: "0", display: (isCancel == 1 ? 'inline-block' : 'none') }}
											type="primary"
											onClick={() => this.handleCard(1, cardSatus)}
										>取消挂失</Button>
										<Button style={{ margin: "0 4px 0 0", background: (canRetarCard == "Y" ? "#f5222d" : "#f5f5f5"), color: (canRetarCard == "Y" ? "#ffffff" : "#cfcfcf"), border: "0" }} disabled={canRetarCard == "N"} onClick={() => this.handleCard(5, cardSatus)} >注销</Button>
									</Form.Item>
								</Col>
							</Row>
						</Form>

						<Modal
							width='1120px'
							visible={this.state.tackPhoto}
							title={"采集人像标识"}
							onCancel={() => {
								this.refChildFace.clearVideo()
								this.setState({
									tackPhoto: false
								}, () => {

								})
							}}
							centered={true}
							footer={null}>
							{
								this.state.tackPhoto && this.state.tackPhoto ? <FaceRecognitionManual ref={this.onRef} loadDara={this.loadDara}></FaceRecognitionManual> : ""
							}
						</Modal>
						{/* <TitleModal
                         onTitRef={this.onTitRef}
                         title={isFlag == 1 ? '取消挂失成功' : (isFlag == 2 ? '挂失成功' : (isFlag == 5 ? '注销成功' : (isFlag == 3 ? "换卡成功" : (isFlag == 4) ? "补卡成功" : (isFlag == 7 ? "绑定成功" : "绑卡成功"))))}
                         content={
                            <p style={{ textAlign: 'center', color: 'rgba(0, 0, 0, 0.85)', fontSize: '16px' }}>
                            病人:<span style={{ marginRight: '6px' }}>{this.props.form.getFieldValue('patName') ? this.props.form.getFieldValue('patName') : ''}</span>
                            <span style={{ marginRight: '6px' }}>{isFlag == 7 || isFlag == 6 ? this.state.bindCardType : cardInfo.cardTypeDesc},</span>
                            卡号：<span>{isFlag == 7 || isFlag == 6 ? this.props.form.getFieldValue("cardBindNo") : (isFlag == 3 ? this.props.form.getFieldValue("cardNumber") : (isFlag == 4 ? this.props.form.getFieldValue("patchNumber") : this.props.form.getFieldValue("cardNo")))}</span>
                        </p>
                         }
                         >
                         </TitleModal> */}
						<Modal
							width='600px'
							visible={reciprocal == 0 ? false : this.state.visibleCardTips}
							title={[
								<div>
									<p style={{ textAlign: 'center', height: '26px', fontSize: '18px' }}>
										<span>{isFlag == 1 ? '取消挂失成功' : (isFlag == 2 ? '挂失成功' : (isFlag == 5 ? '注销成功' : (isFlag == 3 ? "换卡成功" : (isFlag == 4) ? "补卡成功" : (isFlag == 7 ? "绑定成功" : "绑卡成功"))))}</span>
										<span style={{ color: 'red' }}>{reciprocal}S</span>
										<span>自动关闭</span>
									</p>
								</div>
							]}
							onCancel={this.closeCardPop}
							centered={true}
							footer={null}>

							<p style={{ textAlign: 'center', color: 'rgba(0, 0, 0, 0.85)', fontSize: '16px' }}>
								病人:<span style={{ marginRight: '6px' }}>{this.props.form.getFieldValue('patName') ? this.props.form.getFieldValue('patName') : ''}</span>
								<span style={{ marginRight: '6px' }}>{isFlag == 7 || isFlag == 6 ? this.state.bindCardType : cardInfo.cardTypeDesc},</span>
								卡号：<span>{isFlag == 7 || isFlag == 6 ? this.props.form.getFieldValue("cardBindNo") : (isFlag == 3 ? this.props.form.getFieldValue("cardNumber") : (isFlag == 4 ? this.props.form.getFieldValue("patchNumber") : this.props.form.getFieldValue("cardNo")))}</span>
							</p>
						</Modal>

						<Modal
							key='2'
							width='800px'
							className="modalDom"
							visible={popCardVis}
							title={isFlag === 6 ? '绑定其他类型卡' : (isFlag === 4 ? '补卡' : (isFlag === 3 ? '换卡' : ' 绑定其他类型卡'))}
							// onOk={this.handleOk}
							onCancel={this.handleCancelCard}
							footer={null}>
							<div style={{ display: (isFlag == 6 || isFlag == 7) ? "block" : "none" }}>
								<Form>
									<Row gutter={8}>
										<Col span={12} >
											<FormItem label='需绑定类型' wrapperCol={{ span: 16 }} labelCol={{ span: 8 }}>
												{getFieldDecorator('newCard', {
													initialValue: initpatCardID && initpatCardID ? initpatCardID : undefined,
													rules: [{ required: false, message: '' }],
												})(
													<Select ref={this.bindNewCard} style={{ width: '100%' }} >
														{cardbind}
													</Select>
												)}
											</FormItem>
										</Col >
										<Col span={5} style={{ display: (this.state.repariFeeFlagCard != "Y" && nowCostCard != 0 && autoCreateCardNoCard != "Y" ? 'block' : 'none') }}>
											<FormItem label='新卡费用' {...formItemMoney}>
												{getFieldDecorator('newCardMoney', {
													initialValue: this.state.repariFeeFlagCard != "Y" && nowCostCard != 0 ? '￥' + nowCostCard : '￥' + nowCostCard + " " + "仅补卡时收费",
													rules: [{ required: false, message: '' },],
												})(
													<Input disabled />
												)}
											</FormItem>
										</Col>
										<Col span={6} style={{ height: "40px", lineHeight: "40px" }}>
											<Button ref={this.bindCardButton} key="submits" type={nowReadCardPop == 'I' || autoCreateCardNoCard == "Y" ? "" : "primary"} style={{ marginRight: '12px' }} disabled={nowReadCardPop == 'I' || autoCreateCardNoCard == "Y"} onClick={this.bindCardReadling}>读卡</Button>
											<Button key="submit" disabled={bindVail} type={bindVail ? "" : "primary"} ref={this.bindOkButton} onKeyDown={this.handleOnKeydown} onClick={() => this.handleFlag(isFlag)}>绑定</Button>
										</Col >
									</Row>
									<Row gutter={8}>
										<Col span={19} className="cardBind">
											<Tooltip getPopupContainer={() => document.querySelector('.cardBind')} overlayClassName="toolTipDom cardBind" title={bindCardMessage} visible={this.state.bindCardVisible} overlayStyle={{ zIndex: 9999, }}>
												<FormItem label='卡号' wrapperCol={{ span: 16 }} labelCol={{ span: 5 }} >
													{getFieldDecorator('cardBindNo', {
														validateTrigger: [""],
														initialValue: undefined,
														rules: [{ required: false, message: '' },
														{ validator: popCardVis ? this.validFunction : '' },
														],
														getValueFromEvent: (event) => {
															return initpatCardID == '3' ? event.target.value.replace(/[^\d|Xx]/g, '')
																: event.target.value.replace(/\D/g, '')
														},
													})(
														<Input
															ref={this.bindCardNu}
															placeholder={nowReadCardPop == 'R' ? '请点击读卡按钮查找病人'
																: (nowReadCardPop == "" && replenishZero == "Y" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入或点击读卡（卡号可自动补零）'
																	: (nowReadCardPop == "" && replenishZero == "N" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入或点击读卡'
																		: (nowReadCardPop == 'I' && replenishZero == "Y" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入卡号（卡号可自动补零）'
																			: (nowReadCardPop == 'I' && replenishZero == "N" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入卡号'
																				: (autoCreateCardNoCard == "Y" ? "直接点击绑定可生成卡号" : "")))))}
															disabled={nowReadCardPop == 'R' || autoCreateCardNoCard == "Y"}
															onMouseOver={() => this.visibleTip(8)}
															maxLength={cardLengthCard && cardLengthCard != "" ? parseInt(cardLengthCard) : 99}
															onPressEnter={this.bindCardBlur}
															onBlur={this.bindCardBlur}
															onChange={this.closeBindVail}
														/>
													)}
												</FormItem>
											</Tooltip>
										</Col>
									</Row>
									<Row gutter={8} style={{ display: (repariFeeFlagCard != "Y" && nowCostCard != 0 && bindMoreInfo ? 'block' : 'none') }}>
										<Col span={19} >
											<FormItem label='支付方式' wrapperCol={{ span: 16 }} labelCol={{ span: 5 }}>
												{getFieldDecorator('payMethods', {
													initialValue: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
													rules: [{ required: false, message: '' }],
												})(
													<Select style={{ width: '100%' }}>
														{payMethod}
													</Select>
												)}
											</FormItem>
										</Col >
									</Row>
									<Row gutter={8} style={{ display: (repariFeeFlagCard != "Y" && nowCostCard != 0 && bindMoreInfo ? 'block' : 'none') }}>
										<Col span={19}>
											<FormItem label='当前发票' wrapperCol={{ span: 16 }} labelCol={{ span: 5 }}>
												{getFieldDecorator('transactionNo', {
													initialValue: undefined,
													rules: [{ required: false, message: '' }],
												})(
													<Input style={{ width: '100%' }} disabled />
												)}
											</FormItem>
										</Col >
									</Row>
								</Form>
							</div>
							<div style={{ display: isFlag === 4 ? "block" : "none" }}>
								<Row>
									<Col span={6} >
										<FormItem label='新卡' {...formItemLayouAdress}>
											{getFieldDecorator('newCard', {
												initialValue: undefined,
												rules: [{ required: false, message: '' }],
											})(
												<Select style={{ width: '100%' }} disabled>
													{card}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={10} className="patchNu" style={{ margin: '0 14px', display: (isFlag != 7 ? 'inline-block' : 'none') }}>
										<Tooltip getPopupContainer={() => document.querySelector('.patchNu')} overlayClassName="toolTipDom patAd" placement="right" title={patchCardMessage} visible={this.state.patchCardVisible} overlayStyle={{ zIndex: 9999, }}>
											<FormItem  {...formItemMoreAdress}>
												{getFieldDecorator('patchNumber', {
													validateTrigger: [""],
													initialValue: undefined,
													rules: [{ required: false, message: '' },
													{ validator: popCardVis ? this.validFunction : '' },
													],
													getValueFromEvent: (event) => {
														return initpatCardID == '3' ? event.target.value.replace(/[^\d|Xx]/g, '') : event.target.value.replace(/\D/g, '')
													},
												})(
													<Input
														placeholder={nowReadCardPop == 'R' ? '请点击读卡按钮查找病人'
															: (nowReadCardPop == "" && replenishZero == "Y" ? cardLengthCard + '刷卡/输入或点击读卡（卡号可自动补零）'
																: (nowReadCardPop == "" && replenishZero == "N" ? cardLengthCard + '刷卡/输入或点击读卡'
																	: (nowReadCardPop == 'I' && replenishZero == "Y" ? cardLengthCard + '刷卡/输入卡号（卡号可自动补零）'
																		: (nowReadCardPop == 'I' && replenishZero == "N" ? cardLengthCard + '刷卡/输入卡号'
																			: (autoCreateCardNoCard == "Y" ? "直接点击绑定可生成卡号" : "")))))}
														maxLength={cardLengthCard && cardLengthCard != "" ? parseInt(cardLengthCard) : 99}
														disabled={nowReadCardPop == 'R' || autoCreateCardNoCard == "Y"}
														onMouseOver={() => this.visibleTip(7)}
														onPressEnter={() => this.changeCardBlur(2)}
														onBlur={() => this.changeCardBlur(2)}
														onChange={this.closeBindVail}
														ref={this.patchCard}
													/>
												)}
											</FormItem>
										</Tooltip>
									</Col >
									<Col span={10} style={{ margin: '0 14px', display: (isFlag == 7 ? 'inline-block' : 'none') }}>
										<FormItem  {...formItemMoreAdress}>
											{getFieldDecorator('cardBindNom', {
												initialValue: undefined,
												rules: [{ required: false, message: '' }],
											})(
												<Input disabled />
											)}
										</FormItem>
									</Col >
									<Col span={5} style={{ display: (isFlag != 7 ? 'block' : 'none') }}>
										<FormItem  {...formItemNewButton}>
											<Button disabled={nowReadCardPop == "I" || autoCreateCardNoCard == "Y"} type={nowReadCardPop == "I" ? "" : "primary"} ref={this.creadCardPops} onClick={this.bindCardReadling}>读卡</Button>
											<Button style={{ marginLeft: "6px" }} ref={this.patchOkButton} disabled={bindVail} type={bindVail ? "" : "primary"} onKeyDown={this.handleOnKeydown} onClick={() => this.handleFlag(4)}>补卡</Button>
										</FormItem>
									</Col >
								</Row>
								<Row style={{ display: (nowCost != 0 && nowCost != "" && autoCreateCardNoCard != "Y" ? 'block' : 'none') }}>
									<Col>
										<FormItem label={isFlag == 7 ? '绑卡费用' : '补卡费用'} {...formItemNew}>
											{getFieldDecorator('patchMoney', {
												initialValue: nowCost != 0 && nowCost != "" ? '￥' + nowCost : '￥' + 0,
												rules: [{ required: false, message: '' }],
											})(
												<Input disabled />
											)}
										</FormItem>
									</Col >
								</Row>
								<Row style={{ display: (nowCost != 0 && nowCost != "" ? 'block' : 'none') }}>
									<Col>
										<FormItem label='支付方式' {...formItemNew}>
											{getFieldDecorator('payMethods', {
												initialValue: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
												rules: [{ required: false, message: '' }],
											})(
												<Select style={{ width: '100%' }}>
													{payMethod}
												</Select>
											)}
										</FormItem>
									</Col >
								</Row>
								<Row style={{ display: (nowCost != 0 && nowCost != "" && autoCreateCardNoCard != "Y" ? 'block' : 'none') }}>
									<Col>
										<FormItem label='当前发票' {...formItemNew}>
											{getFieldDecorator('transactionNo', {
												initialValue: undefined,
												rules: [{ required: false, message: '' }],
											})(
												<Input style={{ width: '100%' }} disabled />
											)}
										</FormItem>
									</Col >
								</Row>
								<Row style={{ display: (isFlag != 7 ? 'block' : 'none') }}>
									<Col>
										<FormItem label='原卡' {...formItemNew}>
											{getFieldDecorator('originalCard', {
												initialValue: undefined,
												rules: [{ required: false, message: '' }],
											})(
												<Input disabled />
											)}
										</FormItem>
									</Col >
								</Row>
								<Row style={{ display: (isFlag != 7 ? 'flex' : 'none') }}>
									<Col>
										<p style={{ color: 'red', lineHeight: "28px" }}>补卡后，原卡将作废，停止使用，启用新卡。</p>
									</Col >
								</Row>
							</div>
							<div style={{ display: (isFlag === 3) ? "block" : "none" }}>
								<Row>
									<Col span={6} >
										<FormItem label='新卡' {...formItemLayouAdress}>
											{getFieldDecorator('newCard', {
												initialValue: undefined,
												rules: [{ required: false, message: '' }],
											})(
												<Select style={{ width: '100%' }} disabled>
													{card}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={12} style={{ margin: '0 14px' }} className="cardNu">
										<Tooltip getPopupContainer={() => document.querySelector('.cardNu')} overlayClassName="toolTipDom patAd" title={changeCardMessage} visible={this.state.changeCardVisible} overlayStyle={{ zIndex: 9999, }}>
											<FormItem  {...formItemMoreAdress}>
												{getFieldDecorator('cardNumber', {
													validateTrigger: [""],
													initialValue: undefined,
													rules: [{ required: false, message: '' },
													{ validator: popCardVis ? this.validFunction : '' },
													],
													getValueFromEvent: (event) => {
														return initpatCardID == '3' ? event.target.value.replace(/[^\d|Xx]/g, '') : event.target.value.replace(/\D/g, '')
													},
												})(
													<Input
														placeholder={
															nowReadCardPop == 'R' ? '请点击读卡按钮查找病人'
																: (nowReadCardPop == "" && replenishZero == "Y" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入或点击读卡（卡号可自动补零）'
																	: (nowReadCardPop == "" && replenishZero == "N" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入或点击读卡'
																		: (nowReadCardPop == 'I' && replenishZero == "Y" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入卡号（卡号可自动补零）'
																			: (nowReadCardPop == 'I' && replenishZero == "N" && autoCreateCardNoCard != "Y" ? cardLengthCard + '刷卡/输入卡号' : (autoCreateCardNoCard == "Y" ? "直接点击绑定可生成卡号" : "")))))}
														maxLength={cardLengthCard && cardLengthCard != "" ? parseInt(cardLengthCard) : 99}
														disabled={nowReadCardPop == 'R' || autoCreateCardNoCard == "Y"}
														onMouseOver={() => this.visibleTip(6)}
														onPressEnter={() => this.changeCardBlur(1)}
														onBlur={() => this.changeCardBlur(1)}
														onChange={this.closeBindVail}
														ref={this.changeCard}
													/>
												)}
											</FormItem>
										</Tooltip>
									</Col >
									<Col span={5} >
										<FormItem  {...formItemNewButton}>
											<Button ref={this.creadCardPop} disabled={nowReadCardPop == 'I' || autoCreateCardNoCard == "Y"} type={nowReadCardPop == "I" ? "" : "primary"} onClick={this.bindCardReadling}>读卡</Button>
											<Button style={{ marginLeft: "6px" }} ref={this.changeOkButton} disabled={bindVail} type={bindVail ? "" : "primary"} onKeyDown={this.handleOnKeydown} onClick={() => this.handleFlag(3)}>换卡</Button>
										</FormItem>
									</Col >
								</Row>
								<Row>
									<Col>
										<FormItem label='原卡' {...formItemNew}>
											{getFieldDecorator('originalCard', {
												rules: [{ required: false, message: '' }],
											})(
												<Input disabled />
											)}
										</FormItem>
									</Col >
								</Row>
								<Row>
									<Col>
										<p style={{ color: 'red' }}>换卡后，原卡将被回收，停止使用，启用新卡。</p>
									</Col >
								</Row>
							</div>
						</Modal>

						<FindPatients handleParms={this.handleParms.bind(this)} OnChildrefs={this.OnChildrefs}></FindPatients>
						<PatientInformation handleEdit={this.handleEdit.bind(this)} Onrefs={this.Onrefs}></PatientInformation>
						<ReadCard ref={r => this.readCard = r} />
					</div>
				</Spin>
			)
		}
	});

export default RegisterPatCardComplete;
