
/*
 * Creator:     ML
 * CreatDate:   
 * descripts：建卡登记(快捷版)
 * */
import React from 'react';
import { Form, Row, Col, Input, Select, DatePicker, Button, Modal, message, Divider, Tooltip, Icon, TimePicker } from 'antd';
import moment from 'moment';
import FindPatients from './FindPatients';
import PatientInformation from './PatientInformation';
import { $http } from '../../containers/config/https';
import './css/error.less';
import { Util } from 'tools/index';
import { $loadTemplate } from '../lodop/Common/Print.js';
import store from '../../store';
import ReadCard from '../../components/readcard/ReadCard'
import titleA from 'assets/images/title-0.png';
import titleB from 'assets/images/title-1.png';
import titleC from 'assets/images/title-2.png';

let timer = undefined;
const confirm = Modal.confirm;
const FormItem = Form.Item;
const Option = Select.Option;
const warning = Modal.warning;
const adressStyle = {
    width: '8.5%',
    padding: '0',
    marginRight: '14px'
}
const formItemLayout = { // label 和input宽度
    labelCol: { span: 8 },
    wrapperCol: { span: 14 },
}
const formItemLayoutBirth = {
    labelCol: { span: 7 },
    wrapperCol: { span: 14 },
}
const formItemMoney = {
    labelCol: { span: 11 },
    wrapperCol: { span: 11 },
}
const formItemNewCard = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
}
const formItemCard = {
    labelCol: { span: 10 },
    wrapperCol: { span: 23 },
}
const formItemNew = {
    labelCol: { span: 2 },
    wrapperCol: { span: 16 },
}
const formItemNewButton = {
    labelCol: { span: 2 },
    wrapperCol: { span: 22 },
}
const formItemLayoutName = {
    labelCol: { span: 6 },
    wrapperCol: { span: 16 },
}
const formItemLayoutBirthData = {
    labelCol: { span: 11 },
    wrapperCol: { span: 15 },
}
const formItemLayoutBirthTime = {
    labelCol: { span: 2 },
    wrapperCol: { span: 17 },
}
const formItemLayoutAge = {
    labelCol: { span: 7 },
    wrapperCol: { span: 15 },
}

const formItemLayoutBance = {
    labelCol: { span: 6 },
    wrapperCol: { span: 15 },
}
const formItemLayoutAdress = {
    labelCol: { span: 4 },
    wrapperCol: { span: 19 },
}
const formItemLayouAdress = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
}
const formItemLayoutSexy = {
    labelCol: { span: 10 },
    wrapperCol: { span: 14 },
}

const formItemLayoutCode = {
    labelCol: { span: 3 },//下拉框信息
    wrapperCol: { span: 20 },
}
const formItemBind = {
    labelCol: { span: 2 },
    wrapperCol: { span: 20 },
}
const RegisterPatCard = Form.create()(
    class RegisterPatCard extends React.Component {
        constructor(props) {
            super(props)
            this.state = {
                invoiceValue: '',
                loading: false,
                visible: false,
                baseParms: {},//下拉框信息
                parms: {},//接收查找病人传递来的信息
                patieParms: {},//接收关联病人传递来的信息
                municipals: [],//市区信息
                countys: [],//县信息
                villages: [],//乡镇信息
                hamlets: [],//村落信息
                readLoading: false,//读卡loading状态
                postLoading: false,//提交loading状态
                credSex: '',//性别
                credBirthday: undefined,//出生日期
                credAge: '',//年龄
                provinceId: '',//匹配省级id
                credCountry: 44,//国家Id
                posType: 1,//证件类型
                socialTag: -1,//身份标签
                nowCost: 0,//当前卡费
                nowRead: 'n',//卡类型设置是否可操作
                idCardCode: "",//身份证code 
                idCardCodePop: "",//弹窗身份证code
                cardLength: "",//卡长度
                replenishZero: "",//是否可补0
                nowReadCard: 'n',//卡类型设置是否可操作 --卡操作
                nowReadCardPop: "n",//卡类型设置是否可操作 -- 弹窗
                cardLengthCard: "",//卡长度 ---卡长度
                nowCard: '',//当前卡类型
                nowInv: '',//是否显示发票
                initCardDr: '',//默认卡类型
                isModefined: -1,//是否点击修改基本资料
                patiId: '',//病人id
                reciprocal: 2,//2S后关闭弹窗
                visibles: false,//是否弹取消补卡
                cardId: '',//记录头卡id
                isFlag: '',//卡操作
                originalNo: '',//卡操作---原卡号
                localProvince: [],//存第一次请求的loca 省
                localCity: [],//存第一次请求的loca 市
                localArea: [],//存第一次请求的loca 县
                defaultPos: '',//默认的已存在的病人信息证件号
                selfCredNo: '',//修改前的身份证号
                bindCardArr: [],//已绑卡类型
                allDis: false,//全部锁定建卡类型
                tipVisible: false,
                cardSatus: {},//当前录入卡        
                isCancel: -1,//是否挂失    
                bindDis: true,//绑定卡按钮
                patientInfo: [],//病人关联信息
                visibleCardTips: false,//卡操作成功弹窗
                reciprocal: 2,//2S后关闭弹窗
                cardInfo: {},//当前卡信息
                popCardVis: false,//卡操作 弹窗
                initpatCardID: "",//卡操作 弹窗 卡类型选择
                patId: "",//病人信息id
                bindVail: true,//允许点击button
                patPresentOthID: "",//修改现住址Id
                cardVal: false,
                status: false,
                bindMoreInfo: false,//绑卡更多信息显示
                canRetarCard: "N",//注销按钮

                cardNoVisible: false,//建卡卡号错误提示 - title框显示
                cardNoMessage: "",//建卡卡号错误提示 - 文字信息
                posVisible: false,//身份证号码错误提示 - title框显示
                posMessage: "",//身份证号码错误提示 - 文字信息
                patNameVisible: false,//病人姓名错误提示 - title框显示
                patNameMessage: "",//病人姓名错误提示 - 文字信息
                econNameVisible: false,//联系人姓名错误提示 - title框显示
                econNameMessage: "",//联系人姓名错误提示 - 文字信息
                econRelationMessage: "",//联系人关系错误提示 - 文字信息
                econRelationVisible: false,//联系人关系错误提示 - title框显示
                econPhoneVisible: false,
                econPhoneMessage: "",
                patBirthVisible: false,//病人出生日期错误提示 - title框显示
                patBirthMessage: "",//病人出生日期错误提示 - 文字信息
                patTypeVisible: false,//病人类型错误提示 - 文字信息
                patTypeMessage: "",//病人类型错误提示 - 文字信息
                patAdressVisible: false,//详细地址错误提示 - 文字信息
                patAdressMessage: "",//详细地址错误提示 - 文字信息
                cardPayMentID: "",//当前操作注销的卡

                changeCardVisible: false,//换卡操作错误提示 
                changeCardMessage: "",//换卡操作错误文字提示
                patchCardVisible: false,//补卡操作错误提示 
                patchCardMessage: "",//补卡操作错误文字提示
                bindCardVisible: false,//绑卡操作错误提示 
                bindCardMessage: "",//绑卡操作错误文字提示 
                credWarning: false,
                canSave: false,//保存修改按钮

                // provinces:[],//省数据
                // citys:[],//市数据

                formatType: true,//日期手动录入
                noCard: true,//绑卡显示
                repariFeeFlag: "N",//费用置为0或空
                repariFeeFlagCard: "N",//卡操作 费用置为0或空
                nowCostCard: 0,
                provinceDr: 0,//存 省id

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

                findPatNo: "",//记录上一条查找病人
                birthData: "",
                birthTime: "",
                isTransitionStart: false,
                openTime: false,
                openData: false,
                bindCardType: "",
                sexID: "",
                bsDoor: true
            }
            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.patType = React.createRef();
            this.nation = 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.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.changeOkButton = React.createRef();
            this.patchOkButton = React.createRef();
            this.bindOkButton = React.createRef();

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

        }
        componentDidMount() {
            let self = this
            document.addEventListener("keydown", function (e) {
                self.KeyDowns(e)
            })
            this.getDefaultAdress()
            let data = {}
            data = {
                params: [{
                    cardTypeFlag: 1,	    //卡类型
                    credTypeFlag: 1,		    //证件类型
                    patTypeFlag: 1,	        //病人类型
                    sexFlag: 1,	        //性别
                    countryFlag: 1,	    //国家
                    nationFlag: 1,	        //民族
                    occupationFlag: '',		//职业
                    maritalFlag: '',	    //婚姻
                    socialStatusFlag: 1,		//身份标签
                    provinceFlag: localStorage.getItem('province') != null ? '' : 1,//省
                    cityFlag: localStorage.getItem('city') != null ? '' : 1,  //市
                    // areaFlag: localStorage.getItem('area') != null ? '' : 1,//县
                    // villageFlag:1,
                    // hamletFlag:1,
                    ageUnitFlag: 1,
                    payMethodFlag: 1,
                    relationFlag: 1,
                }]
            }

            $http.post('urlS', this, {
                code: '03030005',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            baseParms: res,
                            invoiceValue: res.transactionNo,
                            credSex: res.sex[0].code
                        })
                        //接收挂号页面
                        if (this.getQueryString("cardTypeId") != null) {
                            res.cardType.map((item, i) => {
                                if (this.getQueryString("cardTypeId") == item.id) {
                                    this.setState({
                                        initCardDr: res.cardType[i].id,
                                        nowRead: res.cardType[i].readMode,
                                        cardLength: res.cardType[i].cardLength && res.cardType[i].cardLength != "" ? res.cardType[i].cardLength + "位," : "",
                                        idCardCode: res.cardType[i].code,
                                        cardLengthInput: res.cardType[i].cardLength,
                                        replenishZero: res.cardType[i].replenishZero,
                                        repariFeeFlag: res.cardType[i].repariFeeFlag,
                                        nowCost: res.cardType[i].cardCost,
                                        nowInv: res.cardType[i].invFlag,
                                    })
                                    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) {
                                this.props.form.setFieldsValue({ cardTypeID: this.getQueryString("cardTypeId"), cardNo: this.getQueryString("cardNum") }, () => {
                                    this.handleNoPopInmation()
                                })
                            } else {
                                this.props.form.setFieldsValue({ cardTypeID: this.getQueryString("cardTypeId"), cardNo: undefined })
                                if (this.state.nowRead == "R") {
                                    setTimeout(() => {
                                        this.readOneButton.current.buttonNode.focus();
                                    }, 300)
                                } else {
                                    //卡号输入框高亮
                                    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,
                                        replenishZero: item.replenishZero,
                                        repariFeeFlag: item.repariFeeFlag,
                                        nowCost: item.cardCost,
                                        nowInv: item.invFlag,

                                    })
                                    if (item.readMode == "R") {
                                        setTimeout(() => {
                                            this.readOneButton.current.buttonNode.focus();
                                        }, 300)
                                    } else {
                                        //卡号输入框高亮
                                        // console.log("this.cardNo",this.cardNo)
                                        if (this.cardNo.current && this.cardNo.current) {
                                            setTimeout(() => {
                                                this.cardNo.current.focus();
                                            }, 600)
                                        }

                                    }
                                }
                                if (res.cardType[i].defaultFlag == "N") {
                                    // console.log("都未默认")
                                    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,
                                        replenishZero: res.cardType[0].replenishZero,
                                        repariFeeFlag: res.cardType[0].repariFeeFlag,
                                        nowCost: res.cardType[0].cardCost,
                                        nowInv: res.cardType[0].invFlag,

                                    })
                                    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) {
                            let arr = []
                            arr = JSON.parse(localStorage.getItem('city'))
                            arr.map((item, i) => {
                                item.id = String(item.id)
                            })
                            this.setState({
                                localCity: arr
                            })
                        } else {
                            localStorage.setItem('city', JSON.stringify(res.city))
                            this.setState({
                                localCity: res.city
                            })

                        }
                    } else {

                    }
                }
            })
        }
        //默认取医院地址
        getDefaultAdress = () => {
            let data = {}
            data = {
                params: [{
                    hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
                }]
            }
            $http.post('urlS', this, {
                code: '04150018',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            parms: res.result
                        })
                    }
                }
            })
        }
        //取地址栏传过来的数据
        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
        }
        //建卡成功刷新发票号
        updataTrans = () => {
            let data = {}
            data = {
                params: [{

                }]
            }
            $http.post('urlS', this, {
                code: '03030005',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            invoiceValue: res.transactionNo
                        })
                    }
                }
            })
        }
        //查找病人
        handlePatients = () => {
            this.child.setValue(this.state.findPatNo)
            this.child.showModal()
        }
        // 失去焦点--日期
        onChangeTimeBlur = () => {
            this.setState({
                formatType: true
            });
        }
        //失去焦点 econNameTip
        patEconNameBlur = () => {
            this.econNameTip(2)
        }
        //失去焦点 econRelationTip
        patEconRelationBlur = () => {
            this.econRelationTip(2)
        }
        checkPatMobile = () => {
            this.econPhoneTip(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 7:
                    this.setState({
                        patchCardVisible: 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;
                default:

            }
        }
        //下拉框无选项时 跳到下一个必填项
        checkOption = (num) => {
            switch (num) {
                case 3:
                    setTimeout(() => {
                        if (this.state.countys.length == 0) {
                            this.patAddress.current.focus();
                        }
                    }, 600)
                    break;
                case 4:
                    setTimeout(() => {
                        if (this.state.villages.length == 0) {
                            this.patAddress.current.focus();
                        }
                    }, 600)
                    break;
                case 5:
                    setTimeout(() => {
                        if (this.state.hamlets.length == 0) {
                            this.patAddress.current.focus();
                        }
                    }, 600)
                    break;
                default:

            }
        }
        //建卡卡号
        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) => {
                // console.log(errors, values)
                if (!errors) {
                    this.setState({
                        patNameVisible: false
                    })
                    if (num != 1) {
                        if (this.props.form.getFieldValue('patName')) {
                            setTimeout(() => {
                                this.credType.current.focus();
                            }, 300)
                        }
                    }

                } else {
                    this.setState({
                        patNameVisible: true,
                        patNameMessage: errors.patName.errors[0].message,
                    })
                    setTimeout(() => {
                        this.setState({
                            patNameVisible: false
                        })
                    }, 1500)
                }
            });
        }
        //病人出生日期
        patBirthTip = () => {
            this.props.form.validateFields(['patBirthDate',], (errors, values) => {
                // console.log(errors, values)
                // if (errors == null) {
                //     return
                // }
                if (!errors) {
                    this.setState({
                        patBirthVisible: false
                    })
                    if (this.props.form.getFieldValue('patBirthDate')) {
                        setTimeout(() => {
                            this.patMobile.current.focus();
                        }, 800)
                    }
                } else {
                    setTimeout(() => {
                        this.setState({
                            patBirthVisible: true,
                            patBirthMessage: errors.patBirthDate.errors[0].message,
                        })
                    }, 800)
                    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('patCredTypeID') == '1') {
                        // this.handleInmations(this.props.form.getFieldValue('patCredNo'))
                        this.handleInmations(data)
                        if (this.props.form.getFieldValue('patCredNo').length == 18 && this.state.credWarning == false) {
                            this.setState({
                                credBirthday: this.getBirthday(data),
                                credAge: this.getAge(data),
                            })
                            this.props.form.setFieldsValue({ patSexCode: this.getSex(data), patBirthDate: moment(this.getBirthday(data)) });
                            if (num != 2) {
                                setTimeout(() => {
                                    this.sex.current.focus();
                                }, 600)
                            }
                        }
                    } 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) => {
                // console.log(errors, values)
                if (!errors) {
                    this.setState({
                        patMobileVisible: false
                    })
                    if (num != 2) {
                        if (this.props.form.getFieldValue('patMobile')) {
                            setTimeout(() => {
                                this.patType.current.focus();
                            }, 300)
                        }
                    }
                    //    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)
                }
            });
        }
        //病人类型
        patTypeTip = () => {
            this.props.form.validateFields(['patTypeID',], (errors, values) => {
                // console.log(errors, values)
                if (!errors) {
                    this.setState({
                        patTypeVisible: false
                    })
                    // if (this.props.form.getFieldValue('patCountryID') == 44 && this.props.form.getFieldValue('patNationID') == undefined) {
                    //     setTimeout(() => {
                    //         this.nation.current.focus();
                    //     }, 300)
                    // } else {
                    //     setTimeout(() => {
                    //         this.patAddress.current.focus();
                    //     }, 300)
                    // }
                } else {
                    this.setState({
                        patTypeVisible: true,
                        patTypeMessage: errors.patTypeID.errors[0].message,
                    })
                    setTimeout(() => {
                        this.setState({
                            patTypeVisible: false
                        })
                    }, 1500)
                }
            });
        }
        //详细地址
        patAdressTip = (num) => {
            const { repariFeeFlag, nowCost, isModefined, isFlag, noCard, credAge, parms } = this.state
            this.props.form.validateFields(['patAddress',], (errors, values) => {
                // console.log(errors, values)
                if (!errors) {
                    this.setState({
                        patAdressVisible: false
                    })
                    if (num != 2) {
                        if (this.props.form.getFieldValue('patAddress')) {
                            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 || 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.patAddress.errors[0].message,
                    })
                    setTimeout(() => {
                        this.setState({
                            patAdressVisible: false
                        })
                    }, 1500)
                }
            });
        }
        //换卡操作
        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,
                        })
                        setTimeout(() => {
                            this.setState({
                                changeCardVisible: false
                            })
                        }, 1500)
                    }
                }
            });
        }
        //绑卡操作
        bindCardTip = () => {
            this.props.form.validateFields(['cardBindNo',], (errors, values) => {
                // console.log(errors)
                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,
                        })
                        setTimeout(() => {
                            this.setState({
                                bindCardVisible: false
                            })
                        }, 1500)
                    }
                }
            });
        }
        //补卡操作
        patchCardTip = () => {
            this.props.form.validateFields(['patchNumber',], (errors, values) => {
                // console.log("补卡",errors)
                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,
                        })
                        setTimeout(() => {
                            this.setState({
                                patchCardVisible: false
                            })
                        }, 1500)
                    }
                }
            });
        }
        //联系人姓名
        econNameTip = (num) => {
            this.props.form.validateFields(['patEContact',], (errors, values) => {
                // if (errors == null) {
                //     return
                // }
                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 == null) {
                //     return
                // }
                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)
                }
            });
        }
        //联系人手机
        econPhoneTip = (num) => {
            const { repariFeeFlag, nowCost, isModefined, isFlag, noCard } = this.state
            this.props.form.validateFields(['patEContactMobile',], (errors, values) => {
                // if (errors == null) {
                //     return
                // }
                if (!errors) {
                    this.setState({
                        econPhoneVisible: false
                    })
                    if (num != 2) {
                        if (this.props.form.getFieldValue('patEContactMobile')) {
                            if (repariFeeFlag == "Y" || nowCost == 0 || isModefined == 1 || isFlag == 3 || !noCard) {
                                setTimeout(() => {
                                    this.creadCard.current.buttonNode.focus();
                                }, 300)
                            } else {
                                setTimeout(() => {
                                    this.cardPayMethodID.current.focus();
                                }, 300)
                            }
                        }
                    }
                } else {
                    this.setState({
                        econPhoneVisible: true,
                        econPhoneMessage: errors.patEContactMobile.errors[0].message,
                    })
                    setTimeout(() => {
                        this.setState({
                            econPhoneVisible: false
                        })
                    }, 1500)
                }
            });
        }
        //失去焦点 绑定卡
        bindCardBlur = () => {
            // this.checkLength();
            this.handleZero();
            this.bindCardTip();
        }
        //输入改变时 不可绑定
        closeBindVail = () => {
            this.setState({
                bindVail: true,
                changeCardVisible: false,
                patchCardVisible: false,
                bindCardVisible: false,
            })
        }
        //失去焦点 changeCard/patch
        changeCardBlur = (flag) => {
            if (flag == 1) {
                this.handleZero();
                //检测卡号格式 错误提示
                this.changCardTip();
            } else {
                this.handleZero();
                //检测卡号格式 错误提示
                this.patchCardTip();
            }

        }
        checkName = (e) => {
            // console.log(e.target.value)
            var str = e.target.value
            this.setState({
                onName: str
            })
            // var rep = /^(?:[\u4e00-\u9fa5]+)(?:●[\u4e00-\u9fa5]+)*$|^[a-zA-Z0-9]+\s?[\.·\-()a-zA-Z]*[a-zA-Z]+$/
            // var rep = /(^[\u4e00-\u9fa5]{1}[\u4e00-\u9fa5\.·。]{0,8}[\u4e00-\u9fa5]{1}$)|(^[a-zA-Z]{1}[a-zA-Z\s]{0,8}[a-zA-Z]{1}$)/
            // var rep = /^[\u4e00-\u9fa5 ]{2,20}$/

        }
        //失去焦点 patCard
        patCardBlur = () => {
            this.handleZero()
            this.cardTip(1)
        }
        //失去焦点 patName
        patBlur = () => {
            this.patNameTip(1)
        }
        //失去焦点 patMobile
        patMobileBlur = () => {
            this.patMobileTip(2)
        }
        //失去焦点 patTypeId
        patTypeBlur = () => {
            this.patTypeTip()
        }
        //失去焦点 payMethods
        patAdressBlur = () => {
            this.patAdressTip(2)
        }
        patBirthBlur = () => {
            this.patBirthTip()
        }
        //身份证点击获取焦点
        fouceCredNo = () => {
            setTimeout(() => {
                this.patCredNo.current.focus();
            }, 300)
        }
        //进行卡号检测补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()
                }
            }
        }
        //回车调到下一个必填项 卡号--->姓名
        handleKeydownM = (num) => {
            switch (num) {
                case 1:
                    this.handleZero()
                    break;
                case 2:
                    //验证姓名
                    this.patNameTip()
                    break;
                case 3:
                    if (this.props.form.getFieldValue('patBirthDate')) {
                        setTimeout(() => {
                            this.patMobile.current.focus();
                        }, 300)
                    } else {
                        setTimeout(() => {
                            this.patBirthDate.current.focus();
                        }, 300)
                    }
                    break;
                case 4:
                    setTimeout(() => {
                        this.patCredNo.current.focus();
                    }, 300)
                    break;
                // case 5:
                //     if(this.props.form.getFieldValue('patCredTypeID')&&this.props.form.getFieldValue('patCredTypeID').length>0&&this.props.form.getFieldValue('patCredTypeID')=="1"){
                //         console.log("身份证-------")
                //         this.posTip()
                //         return
                //     }
                //     if(this.props.form.getFieldValue('patCredTypeID')!="1"&&this.props.form.getFieldValue('patCredTypeID')&&this.props.form.getFieldValue('patCredTypeID').length>0){
                //         console.log("出生日期框-------")
                //         setTimeout(() => {
                //             this.patBirthDate.current.focus();
                //         }, 300)
                //         }
                //     break; 
                case 6:
                    this.patMobileTip()
                    break;
                case 7:
                    this.setState({
                        patTypeVisible: false
                    })
                    if (this.props.form.getFieldValue('patCountryID') == 44 && this.props.form.getFieldValue('patNationID') == undefined) {
                        setTimeout(() => {
                            this.nation.current.focus();
                        }, 300)
                    } else {
                        setTimeout(() => {
                            this.patAddress.current.focus();
                        }, 300)
                    }
                    break;
                case 8:
                    setTimeout(() => {
                        this.patAddress.current.focus();
                    }, 300)
                    break;
                case 9:
                    this.patAdressTip()
                    break;
                case 10:
                    if (this.state.nowCost != 0 && this.props.form.getFieldValue('cardPayMethodID')) {
                        setTimeout(() => {
                            this.creadCard.current.buttonNode.focus();
                        }, 300)
                    }
                    break;
                case 11:
                    setTimeout(() => {
                        this.patAddress.current.focus();
                    }, 300)
                    break;
                case 12:
                    this.econNameTip()
                    break;
                case 13:
                    setTimeout(() => {
                        this.econRelationTip()
                    }, 200)
                    break;
                case 13.1:
                    setTimeout(() => {
                        this.econPhoneTip()
                    }, 200)
                    break;
                default:
                    setTimeout(() => {
                        this.creadCard.current.buttonNode.focus();
                    }, 300)
            }
        }
        //地址回车/选中自动跳下一个
        autoFouce = (flag) => {
            switch (flag) {
                case "province":
                    setTimeout(() => {
                        this.city.current.focus();
                    }, 300)
                    break;
                case "presentCity":
                    setTimeout(() => {
                        this.country.current.focus();
                    }, 300)
                    break;
                case "presentAreas":
                    setTimeout(() => {
                        this.village.current.focus();
                    }, 300)
                    break;
                case "presentVillages":
                    setTimeout(() => {
                        this.hamlet.current.focus()
                    }, 300)
                    break;
            }
        }
        //病人姓名 格式验证 是否允许带空格
        validName = (rule, value, callback) => {
            // console.log("-----",this.state.onName)
            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
            // console.log( "卡长度",parseInt(this.state.cardLength),"是否可以补0",this.state.replenishZero,"身份证",idCardCode)
            // console.log( "弹窗卡长度",this.state.cardLengthCard,"是否可以补0",this.state.replenishZero)
            //控制选择建卡和卡操作选择绑卡id 正确提示 及 校验
            let diffLength = popCardVis ? cardLengthCard : cardLength
            let diffCode = popCardVis ? idCardCodePop : idCardCode
            if (diffCode == '12') {
                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()
                            // this.setState({
                            //   bindVail:false
                            // })
                        }
                    }
                }
                callback();
            }
            if (replenishZero == "N" && parseInt(diffLength) > 0) {
                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()
                    // this.setState({
                    //   bindVail:false
                    // })
                }
            }
            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();
        }
        //输入完身份证进行读卡操作
        handleInmations = (credN) => {
            const { credWarning } = this.state
            let data = {}
            data = {
                params: [{
                    cardTypeID: '',
                    cardNo: '',
                    credTypeID: this.props.form.getFieldValue('patCredTypeID') ? this.props.form.getFieldValue('patCredTypeID') : '',
                    credNo: typeof (credN) != 'object' ? credN : (this.props.form.getFieldValue('patCredNo') ? this.props.form.getFieldValue('patCredNo') : '')
                }],
            }
            $http.post('urlS', this, {
                code: '03030009',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0 && res.result.data.length > 0) {
                        //判断接口请求成功数据是否返回成功
                        if (this.state.isModefined == 1 && this.state.selfCredNo != this.props.form.getFieldValue('patCredNo')) {
                            this.setState({
                                credWarning: true
                            })
                            warning({
                                key: 'card',
                                centered: true,
                                maskClosable: true,
                                // visible:false,
                                content: (
                                    <div>
                                        <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>
                                    </div>
                                ),
                                onOk() {
                                    Modal.destroyAll();
                                },
                            })
                            return
                        } else {
                            this.setState({
                                credWarning: true
                            })
                            if (this.state.selfCredNo == this.props.form.getFieldValue('patCredNo')) {
                                return
                            } else {
                                if (res.result.patInfo.patNo) {
                                    this.setState({
                                        credWarning: true
                                    })
                                    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,
                            })
                        }

                    }
                },
                error: function () {
                }
            })
        }
        //点击读卡 --  卡号
        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') : '',
                        credTypeID: '',
                        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.setState({
                                    defaultPos: res.result.patInfo.patCredNo
                                })
                                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") {
                                setTimeout(() => {
                                    this.patName.current.focus();
                                }, 300)
                            }
                        }
                    }, error: function () {
                        this.setState({
                            readLoading: false
                        })
                    }
                })
            } else {
                this.setState({
                    readLoading: false,
                })
                message.warning('请输入卡号');
            }

        }
        //进行卡后验证
        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') : '',
                                    credTypeID: '',
                                    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') : '',
                                    credTypeID: '',
                                    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') : '',
                                credTypeID: '',
                                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);
                                            return
                                        }
                                        if (this.props.form.getFieldValue('patchNumber') != res.result.data[i].cardNo) {
                                            message.warning('卡号已存在,病人ID：' + str);
                                            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.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('非本人证件号码，不能绑定')
                                                } else {
                                                    message.warning('卡号已存在,病人ID：' + str);
                                                }
                                                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.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('非本人证件号码，不能绑定')
                                                } else {
                                                    message.warning('卡号已存在,病人ID：' + str);
                                                }
                                                this.setState({
                                                    bindVail: true,
                                                    bindMoreInfo: false,
                                                })
                                                return
                                            }
                                        }

                                    } else {
                                        if (this.props.form.getFieldValue('cardBindNo') == res.result.data[i].cardNo && (res.result.data[i].cardStatusDesc == "作废")) {
                                            message.warning('该卡卡号已被作废');
                                            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('非本人证件号码，不能绑定')
                                            } else {
                                                message.warning('卡号已存在,病人ID：' + str);
                                            }
                                            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('请选择建卡类型');
                }
            } else {
                this.setState({
                    bindVail: true,
                })
            }
        }
        //检测卡长度
        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 });
            }
        }
        //补卡 换卡 就诊卡自动补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 });
                }
            } 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 });
                }

            }
        }

        //重置卡操作表单
        handleRest = () => {
            this.props.form.setFieldsValue({
                newCard: undefined,
                cardNumber: undefined,
                patchMoney: undefined,
                transactionNo: undefined,
                originalCard: undefined,
                cardBindNo: undefined,
                // cardBindNom: undefined,
                payMethods: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
            })
            this.setState({
                initpatCardID: ''
            })
        }
        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
            let patDr = ''
            if (this.state.patiId != '') {
                patDr = this.state.patiId
            } else {
                this.setState({
                    patDr: ''
                })
            }
            if (flag == 3 || flag == 4) {
                let datas = {}
                datas = {
                    params: [{
                        cardID: cardInfo.cardID,
                        flag: flag,
                        newCard: {
                            patID: patDr,
                            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 : undefined,
                            ip: flag == 4 ? (React.$getSessionData('ipConfig').ipv4 || '') : undefined,
                            cardPayMethodID: flag == 4 ? this.props.form.getFieldValue('payMethods') : undefined,
                            tradeNum: flag == 4 ? 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) {
                                $loadTemplate("CardFeeReceipt", res.print);
                            }
                            this.setState({
                                popCardVis: false,
                                visibleCardTips: true,
                                reciprocal: 2,
                                //   postLoading: false,
                                //   visible: false,
                            })
                            this.timerStart()
                        } else {
                            this.setState({
                                //   postLoading: false,
                            })
                        }
                    },
                    error: function () {
                        this.setState({
                            // postLoading: false,
                        })
                    }
                })
            }
            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: patDr,
                                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: patDr,
                                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) {
                                $loadTemplate("CardFeeReceipt", res.print);
                            }
                            if (this.state.cardCost > 0) {
                                this.updataTrans()
                            }
                            this.setState({
                                popCardVis: false,
                                visibleCardTips: true,
                                reciprocal: 2,
                            })
                            // this.props.form.setFieldsValue({ cardBindNo: undefined })
                            this.timerStart()
                        } else {
                            this.setState({
                                //   postLoading: false
                            })
                        }
                    }
                })
            }

        }
        //已绑卡类型
        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].cardStatusDesc == "挂失") {
                        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
                    }
                })
            })
        }
        // //表单回显
        // setForm = (even) => {
        //     this.props.form.setFieldsValue({
        //          balance:parseInt(even.balance)==NaN?"￥--":"￥" + even.balance,
        //          patProvinceID:even.patPresentProvinceID,
        //          patCityID:String(even.patPresentCityID),
        //          patAreaID: even.patPresentAreaID,
        //          patVillageID: even.patPresentVillageID,
        //          patHamletID: even.patPresentHamletID,
        //          patCredTypeID: even.patCredTypeID,
        //          patCredNo: even.patCredNo,
        //          patName: even.patName,
        //          patAddress: even.patPresentAddressDesc,
        //          patSexCode: even.patSexCode,
        //          patBirthDate: moment(even.patBirthDate),
        //          patMobile: even.patMobile,
        //          patTypeID: even.patTypeID,
        //          patCountryID: even.patCountryID,
        //          patNationID: even.patNationID,
        //          patSocialStatusID: even.patSocialStatusID,
        //          age:even.patAge
        //          })
        //     this.setState({
        //     posType:even.patCredTypeID,
        //     isModefined: 1,
        //     parms: even,
        //     credCountry: even.patCountryID,
        //     credBirthday: even.patBirthDateTime,
        //     patiId: even.patID,
        //     selfCredNo:even.patCredNo
        //     })
        //     this.handleProvince(even.patPresentProvinceID?String(even.patPresentProvinceID):"",2)
        //     this.autoCity(even.patPresentCityID?String(even.patPresentCityID):"",2)
        //     this.handleCountys(even.patPresentAreaID?even.patPresentAreaID + 'auto':'',2)
        //     this.handlevillages(even.patPresentVillageID?String(even.patPresentVillageID):"",2)
        //     // this.autoAge(this.props.form.getFieldValue('patBirthDate')),

        // }
        //点击读卡
        handleCardReading = () => {
            this.setState({
                parms: {}
            })
            this.props.form.resetFields();
            const { initCardDr } = this.state
            this.readCard.ReadCard(initCardDr, "R", (json) => {
                // console.log(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.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') : '',
                        credTypeID: '',
                        credNo: ''
                    }],
                }
                this.props.form.resetFields();
                this.props.form.setFieldsValue({ cardNo: cardNo, cardTypeID: cardTypeID, });
                $http.post('urlS', this, {
                    code: '03030009',
                    data: data,
                    success: function (res) {
                        if (+res.errorCode != 0) {
                            this.setState({
                                cardSatus: [],
                                bindCardArr: []
                            })
                            this.props.form.setFieldsValue({ "cardNo": undefined })
                            // this.cardTip(1)
                            return
                        }
                        if (+res.errorCode === 0 && res.result.data.length > 0) {
                            //判断接口请求成功数据是否返回成功    
                            this.cardTip()
                            this.setState({
                                cardNo: res.result.patCurrentCard.cardNo,
                                credAge: res.result.patInfo.patAge ? res.result.patInfo.patAge : undefined,
                                // credBirthday:res.result.patInfo.patBirthDate?res.result.patInfo.patBirthDate:undefined,
                                credBirthday: res.result.patInfo.patBirthDateTime ? res.result.patInfo.patBirthDateTime : undefined,
                                parms: res.result.patInfo,
                                isModefined: 1,
                                posType: res.result.patCredTypeID,
                            })
                            setTimeout(() => {
                                this.patName.current.focus();
                            }, 300)
                            if (res.result.patInfo.patNo) {
                                const info = res.result.data;
                                this.setState({
                                    cardSatus: res.result.patCurrentCard
                                })
                                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,
                                    patiId: res.result.patInfo.patID,
                                    patientInfo: res.result.patInfo,
                                    selfCredNo: res.result.patInfo.patCredNo
                                })

                                this.bingCardArr(info)
                            } else {
                                this.setState({
                                    cardSatus: [],
                                    bindCardArr: []
                                })
                            }
                        } else {
                            if (this.state.cardNoVisible == false) {
                                this.cardTip()
                            }
                            this.setState({
                                cardSatus: [],
                                bindCardArr: []
                            })
                            // setTimeout(() => {
                            //     this.patName.current.focus();
                            // }, 300)
                        }
                    }, error: function () {


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

        }
        //卡操作成功后----关闭弹窗
        closeCardPop = () => {
            this.setState({
                visibleCardTips: false,
                isFlag: -1,
            })
            // this.handleCancel()
            clearInterval(timer)
            this.initType()
            this.handleReset()
        }
        //取消挂失 / 挂失 注销   成功后  再次请求更新状态
        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.handleReset()
                        //   this.props.handleEdit('','Other','')
                    } else {
                    }
                }
            })
        }
        //卡操作前 ---提示
        cardBefor = (flag, info) => {
            let self = this
            const { patientInfo } = this.state
            // console.log("病人信息",patientInfo)
            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 ? 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()
        }
        //绑定卡需收费 返回上一步
        handlePrev = () => {
            this.setState({
                isFlag: 6,
            })
        }
        //绑定卡 选择卡类型
        handleBindCardType = (data) => {
            this.props.form.setFieldsValue({ cardBindNo: undefined })
            for (var i = 0; i < this.state.baseParms.cardType.length; i++) {
                if (data == this.state.baseParms.cardType[i].id) {
                    this.props.form.setFieldsValue({ newCard: this.state.baseParms.cardType[i].id })
                    this.props.form.setFieldsValue({ newCardMoney: '￥' + this.state.baseParms.cardType[i].cardCost })
                    this.setState({
                        nowCostCard: this.state.baseParms.cardType[i].cardCost,
                        initpatCardID: this.state.baseParms.cardType[i].id,
                        // initCardDr: this.state.baseParms.cardType[i].id,
                        nowReadCardPop: this.state.baseParms.cardType[i].readMode,
                        idCardCodePop: this.state.baseParms.cardType[i].code,
                        repariFeeFlagCard: this.state.baseParms.cardType[i].repariFeeFlag,
                        cardLengthCard: this.state.baseParms.cardType[i].cardLength && this.state.baseParms.cardType[i].cardLength != "" ? this.state.baseParms.cardType[i].cardLength + "位," : "",
                        replenishZero: this.state.baseParms.cardType[i].replenishZero,
                    }, () => {
                        if (this.state.nowReadCardPop == 'I' || this.state.nowReadCardPop == '') {
                            setTimeout(() => {
                                this.bindCardNu.current.focus();
                            }, 300)
                        } else {
                            setTimeout(() => {
                                this.bindCardButton.current.buttonNode.focus();
                            }, 300)
                        }
                    })
                }
            }
            this.setState({
                bindCardVisible: false,
                bindVail: true
            })
        }
        //点击进行卡操作 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,
                                    idCardCodePop: this.state.baseParms.cardType[i].code,
                                    repariFeeFlagCard: this.state.baseParms.cardType[i].repariFeeFlag,
                                    cardLengthCard: this.state.baseParms.cardType[i].cardLength && this.state.baseParms.cardType[i].cardLength != "" ? this.state.baseParms.cardType[i].cardLength + "位," : "",
                                    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.patCardCost : '',
                            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 })
                            // console.log(canBindArr[0].readMode,)
                            this.setState({
                                // initCardDr:canBindArr[0].id,
                                nowCostCard: canBindArr[0].cardCost,
                                initpatCardID: canBindArr[0].id,
                                nowReadCardPop: canBindArr[0].readMode,
                                idCardCodePop: canBindArr[0].code,
                                repariFeeFlagCard: canBindArr[0].repariFeeFlag,
                                cardLengthCard: canBindArr[0].cardLength && canBindArr[0].cardLength != "" ? canBindArr[0].cardLength + "位," : "",
                                replenishZero: canBindArr[0].replenishZero,
                            }, () => {
                                if (this.state.nowReadCardPop == 'I' || this.state.nowReadCardPop == '') {
                                    setTimeout(() => {
                                        this.bindCardNu.current.focus();
                                    }, 300)
                                } else {
                                    setTimeout(() => {
                                        this.bindCardButton.current.buttonNode.focus();
                                    }, 1000)
                                }
                            })
                        }
                    }
                })
            }
            this.props.form.setFieldsValue({ originalCard: patientInfo.patInfo.patName + ',' + info.cardTypeDesc + ',' + info.cardNo })
        }
        //失去焦点进行读卡 --  卡号
        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') : '',
                        credTypeID: '',
                        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 (this.state.isFlag == 3 || this.state.isFlag == 4 || this.state.isModefined == 3 || this.state.isModefined == 6) {
                                // console.log(res)
                                let self = this
                                warning({
                                    key: 'card',
                                    centered: true,
                                    maskClosable: true,
                                    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>
                                    ),
                                });
                                this.setState({
                                    readLoading: false
                                })
                            } else {
                                if (res.result.patInfo.patNo) {
                                    // console.log("获取病人信息",res)
                                    this.setState({
                                        defaultPos: res.result.patCredNo
                                    })
                                    this.childs.showModals()
                                    this.childs.getBasepatientInfo(res, this.state.baseParms.cardType, this.props.form.getFieldValue('cardNo'))
                                    this.setState({
                                        readLoading: false
                                    })
                                } else {

                                }
                            }
                        } else {
                            if (this.popCardVis == "false") {
                                setTimeout(() => {
                                    // this.patName.current.focus();
                                }, 800)
                            }
                        }
                    }, error: function () {

                    }
                })
            } else {
                message.warning('请输入卡号');
            }

        }

        //选择建卡类型
        handleCred = (data) => {
            this.props.form.setFieldsValue({ cardNo: undefined });
            this.setState({
                cardNoVisible: false,
            })
            //输入框高亮
            setTimeout(() => {
                this.cardNo.current.focus();
            }, 300)
            for (var i = 0; i < this.state.baseParms.cardType.length; i++) {
                if (data == this.state.baseParms.cardType[i].id) {
                    this.setState({
                        initCardDr: this.state.baseParms.cardType[i].id,
                        nowRead: this.state.baseParms.cardType[i].readMode,
                        idCardCode: this.state.baseParms.cardType[i].code,
                        cardLength: this.state.baseParms.cardType[i].cardLength && this.state.baseParms.cardType[i].cardLength != "" ? this.state.baseParms.cardType[i].cardLength + "位," : "",
                        replenishZero: this.state.baseParms.cardType[i].replenishZero,
                        repariFeeFlag: this.state.baseParms.cardType[i].repariFeeFlag,
                        nowCost: this.state.baseParms.cardType[i].cardCost,
                        nowInv: this.state.baseParms.cardType[i].invFlag,
                    })
                }
            }
        }
        //选择证件类型
        handleCerdType = (data) => {
            setTimeout(() => {
                this.patCredNo.current.focus();
            }, 300)
            this.setState({
                posType: data
            })

            // this.next()
        }
        //身份选择
        handleposTagFouce = () => {
            let { repariFeeFlag, nowCost, isModefined, isFlag, noCard } = this.state
            if (repariFeeFlag == "Y" || nowCost == 0 || isModefined == 1 || isFlag == 3 || !noCard) {
                setTimeout(() => {
                    this.creadCard.current.buttonNode.focus();
                }, 300)
            } else {
                setTimeout(() => {
                    this.cardPayMethodID.current.focus();
                }, 300)
            }
        }
        //选择身份标签
        handleposTag = (data) => {
            setTimeout(() => {
                this.province.current.focus();
            }, 300)
            this.setState({
                socialTag: data
            })
            //三无人员时可不选证件
            if (data == 4) {
                if (this.props.form.getFieldValue('patCredNo') && this.props.form.getFieldValue('patCredNo').length > 0) {
                } else {
                    this.props.form.setFieldsValue({ patCredTypeID: undefined });
                    this.setState({
                        posType: '-1'
                    })
                }

            } else {
                if (this.props.form.getFieldValue('patCredNo') && this.props.form.getFieldValue('patCredNo').length > 0) {
                } else {
                    this.setState({
                        posType: 1
                    })
                    this.props.form.setFieldsValue({ patCredTypeID: '1' });
                }

            }
        }
        //输入身份证号码 自动获取到出生日期 年龄 性别 失去焦点
        validCard = (e, num) => {
            if (this.props.form.getFieldValue('patCredNo') && this.props.form.getFieldValue('patCredNo').length > 0 && this.props.form.getFieldValue('patCredTypeID') == "1") {
                this.posTip(e.target.value, num)
                return
            }
            if (this.props.form.getFieldValue('patCredTypeID') != "1" && 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"]: [],
                        })
                    }
                }
            })

        }
        //选择或清除省
        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({
                        bsDoor: false
                    })
                } else {
                    this.setState({
                        bsDoor: true
                    })
                }
                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
                });
            } else {
                //清除省
                this.props.form.setFieldsValue({
                    [flag + "CityID"]: undefined,
                    [flag + "AreaID"]: undefined,
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: 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,
                })
            }
        }
        //选择或清除市
        onCityChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    [flag + "ProvinceID"]: option.props.provinceid,
                    [flag + "AreaID"]: undefined,
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined
                });
                setTimeout(() => {
                    this.country.current.focus();
                }, 300)
                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
                });
                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"]: [],
                        })
                    }
                }
            })

        }
        //选择或清除县
        onAreaChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined
                });
                this.getVillages(value, flag, "1");
                setTimeout(() => {
                    this.village.current.focus();
                }, 300)
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    [flag + "VillageID"]: undefined,
                    [flag + "HamletID"]: undefined
                });
                let patInfo = this.state.parms;
                let patFlag = "";
                switch (flag) {
                    case "present":
                        patFlag = "Present";
                        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");
            }
        }
        //选择或清除乡
        onVillageChange(flag, value, option) {
            if (value) {
                this.props.form.setFieldsValue({
                    [flag + "HamletID"]: undefined
                });
                this.getHamlets(value, flag);
                setTimeout(() => {
                    this.hamlet.current.focus()
                }, 300)
            } else {
                //清除市
                this.props.form.setFieldsValue({
                    [flag + "HamletID"]: undefined
                });
                let patInfo = this.state.parms;
                let patFlag = "";
                switch (flag) {
                    case "present":
                        patFlag = "Present";
                        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 });
            }
        }
        //不足xx位补0
        handleLength = () => {
            if (this.state.popCardVis) return
            //补0 Y 长度不为0
            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.initCardDr == '3' && 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()
            }
        }
        //选择日期 计算年龄
        onPanelChange = (mode) => {
            this.setState({
                patBirthVisible: false,
                birthTime: this.state.birthTime,
                birthData: moment(mode).format('YYYY-MM-DD'),
            })
            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)
            }
        }
        range = (start, end) => {
            const result = [];
            for (let i = start; i <= end; i++) {
                result.push(i);
            }
            return result;
        };
        // //选择时间
        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'));
        }
        //当前时间之后的不可选
        disabledDateTime = () => {
            let hours = moment().hours();//0~23
            let minutes = moment().minutes();//0~59
            //当日只能选择当前时间之后的时间点
            if (this.state.birthTime.date() === moment().date()) {
                return {
                    disabledHours: () => this.range(0, hours),
                    disabledMinutes: () => this.range(0, minutes),
                };
            }
        };
        //展开/关闭起始时间
        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
                })
            }
        }

        //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);
        }
        //提交表格内容 --- 确认建卡
        handleSubmit = (e) => {
            this.props.form.validateFields((err, values) => {
                // console.log("提交表格",values.patCredTypeID,)
                if (err) {
                    this.cardTip()
                    this.patNameTip()
                    this.posTip()
                    this.patMobileTip()
                    this.patTypeTip()
                    this.patAdressTip()
                    // console.log(err,values)
                    // setTimeout(()=>{
                    //     // this.patBirthTip()
                    //     // this.econNameTip()
                    //     // this.econRelationTip()
                    //     // this.econPhoneTip()
                    // },1500)
                    var arr = []
                    for (let i in err) {
                        arr.push(err[i]); //属性
                        //arr.push(obj[i]); //值
                    }
                    let info = arr[0].errors[0].field
                    if (info == 'cardNo') {
                        setTimeout(() => {
                            this.cardNo.current.focus();
                        }, 300)
                        return
                    } if (info == 'patName') {
                        if (this.popCardVis == "false") {
                            setTimeout(() => {
                                this.patName.current.focus();
                            }, 300)
                        }
                        return
                    } if (info == 'patSexCode') {
                        setTimeout(() => {
                            this.sex.current.focus();
                        }, 300)
                        return
                    } if (info == 'patCredTypeID ') {
                        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 == 'patAddress') {

                        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 (!err) {
                    // console.log(values)
                    this.setState({
                        postLoading: true,
                        canSave: true
                    })
                    if (this.props.form.getFieldValue('patCredTypeID') == '1' && moment(values.patBirthDate).format('YYYY-MM-DD') != this.getBirthday(values.patCredNo)) {
                        this.setState({
                            postLoading: false,
                            canSave: false
                        })
                        message.warning("请保持身份证号码中的出生日期与出生日期框一致")
                        return
                    }
                    if (this.state.isModefined != 1 && this.state.isModefined != 2) {
                        let patDr = ''
                        if (this.state.patiId != '') {
                            patDr = this.state.patiId
                        } else {
                            this.setState({
                                patDr: ''
                            })
                        }
                        let idCard = ''
                        if (values.patCredTypeID == '1') {
                            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
                                // console.log(this.state.baseParms.cardType[index])
                            }
                        })
                        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: {
                                    patID: patDr,
                                    active: "",
                                    patName: values.patName,
                                    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,
                                    patCredTypeID: values.patCredTypeID,
                                    patCredNo: values.patCredNo,
                                    patNationID: values.patNationID,
                                    patTypeID: values.patTypeID,
                                    patMobile: values.patMobile,
                                    patEContact: values.patEContact,
                                    patEContactMobile: values.patEContactMobile,
                                    patERelationID: values.patERelationID,
                                    patCountryID: values.patCountryID,
                                    patSocialStatusID: values.patSocialStatusID,
                                    patCreateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                                    companyTel: '',
                                    addressInfo: [
                                        {
                                            addressTypeCode: 'Present',
                                            addressData: {
                                                patProvinceID: values.presentProvinceID,
                                                patCityID: values.presentCityID,
                                                patAreaID: values.presentAreaID,
                                                patVillageID: values.presentVillageID,
                                                patHamletID: values.presentHamletID,
                                                patAddress: values.patAddress,
                                            }

                                        }
                                    ],
                                },
                                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) {
                                    this.setState({
                                        isFlag: '',
                                        isModefined: -1,
                                        postLoading: false,
                                        canSave: false
                                    })
                                    message.success('提交成功');
                                    if (res.print && res.print) {
                                        $loadTemplate("CardFeeReceipt", res.print);
                                    }
                                    if (this.state.nowCost > 0) {
                                        this.updataTrans()
                                    }
                                    this.handleReset()
                                    //是否回到挂号页面
                                    if (this.getQueryString("cardTypeId") != null) {
                                        //弹窗 
                                        let self = this
                                        confirm({
                                            key: 10,
                                            title: "建卡完成,是否回到挂号页面",
                                            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() {
                                                self.props.history.push('./03040001?cardTypeId=' + cardTypeId + "&cardNum=" + cardNum + "&posId=" + idCard)
                                                Modal.destroyAll()
                                            },
                                            onCancel() {
                                            },
                                        });
                                    }
                                } else {
                                    this.setState({
                                        postLoading: false,
                                        canSave: false
                                    })
                                }
                            }
                        })
                    } if (this.state.isModefined == 1) {
                        let patDr = ''
                        if (this.state.patiId != '') {
                            patDr = this.state.patiId
                        } else {
                            this.setState({
                                patDr: ''
                            })
                        }
                        let data = {}
                        data = {
                            params: [{
                                active: "",
                                patID: patDr,
                                patName: values.patName,
                                patSexCode: values.patSexCode,
                                patBirthDate: values.patBirthDate ? moment(values.patBirthDate).format('YYYY-MM-DD') : undefined,
                                patBirthTime: values.patBirthTime ? moment(values.patBirthTime).format('HH:mm') : undefined,
                                patCredTypeID: values.patCredTypeID || "",
                                patCredNo: values.patCredNo,
                                patNationID: values.patNationID || "",
                                patTypeID: values.patTypeID,
                                patMobile: values.patMobile,
                                patEContact: values.patEContact,
                                patEContactMobile: values.patEContactMobile,
                                patERelationID: values.patERelationID,
                                patCountryID: values.patCountryID,
                                patSocialStatusID: values.patSocialStatusID,
                                patUpdateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                                patIDCardNo: '',
                                addressInfo: [
                                    {
                                        addressTypeCode: "Present",
                                        addressData: {
                                            patOthID: this.state.patPresentOthID,
                                            patAddress: values.patAddress,
                                            patProvinceID: values.presentProvinceID,
                                            patCityID: values.presentCityID,
                                            patAreaID: values.presentAreaID,
                                            patVillageID: values.presentVillageID,
                                            patHamletID: values.presentHamletID,
                                        }
                                    },
                                ],
                            }]
                        }
                        $http.post('urlS', this, {
                            code: '03030012',
                            data: data,
                            success: function (res) {
                                if (+res.errorCode === 0) {
                                    message.success('保存成功');
                                    this.setState({
                                        isModefined: -1,
                                        isFlag: '',
                                        patiId: '',
                                        postLoading: false,
                                        canSave: false
                                    })
                                    this.handleReset();
                                } else {
                                    this.setState({
                                        postLoading: false,
                                        canSave: false
                                    })
                                }
                            },
                            error: function () {
                                // message.warning('未知错误,请重试');
                                this.setState({
                                    postLoading: false,
                                    canSave: false
                                })
                            }
                        })
                    }
                }
            });
        }
        //隐藏验证提示
        handleVail = () => {
            this.setState({
                cardNoVisible: false,
                patNameVisible: false,
                patAdressVisible: false,
                patBirthVisible: false,
                posVisible: false,
                patTypeVisible: false,
                patMobileVisible: false,
                bindCardVisible: false,
                patchCardVisible: false,
                changeCardVisible: false,
                econPhoneVisible: false,
                econNameVisible: false,
                econRelationVisible: false,
            })
        }
        //清空表格内容
        handleReset = () => {
            this.handleVail()
            this.getDefaultAdress()
            this.props.form.resetFields();
            this.props.form.setFieldsValue({
                cardNo: undefined,
                patProvinceID: 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.state.baseParms.cardType.map((item, i) => {
                item['disabled'] = false
                if (item.defaultFlag == "Y") {
                    this.setState({
                        initCardDr: item.id,
                        nowRead: item.readMode,
                        cardLength: item.cardLength && item.cardLength != "" ? item.cardLength + "位," : "",
                        idCardCode: item.code,
                        cardLengthInput: item.cardLength,
                        replenishZero: item.replenishZero,
                        repariFeeFlag: item.repariFeeFlag,
                        nowCost: item.cardCost,
                        nowInv: item.invFlag,

                    })
                    if (item.readMode == "R") {
                        setTimeout(() => {
                            this.readOneButton.current.buttonNode.focus();
                        }, 300)
                    } else {
                        //卡号输入框高亮
                        setTimeout(() => {
                            this.cardNo.current.focus();
                        }, 600)
                    }
                }
            })
            this.state.baseParms.sex.map((item, i) => {
                this.setState({
                    credSex: this.state.baseParms.sex[0].code
                })
            })
            this.setState({
                bsDoor: true,
                credWarning: false,
                patiId: "",
                parms: {},
                credAge: '',
                credBirthday: '',
                cardNo: '',
                isModefined: -1,
                isFlag: '',
                defaultPos: '',
                bindCardArr: [],
                allDis: false,
                cardSatus: [],
                bindDis: true,
                noCard: true,
                isCancel: -1,
                openTime: false,
                canRetarCard: "N",
                countys: [],//县信息
                villages: [],//乡镇信息
                hamlets: [],//村落信息
                presentCity: [],//现住址市区信息
                presentAreas: [],//现住址县信息
                presentVillages: [],//现住址乡信息
                presentHamlets: [],//现住址村落信息
            })
        }
        //查找病人--子组件回调
        handleParms = (even) => {
            //查找病人之后使用居民身份证调起病人关联信息 若有并点击了修改资料 才将信息回显 否则不做回显 不覆盖用户已输入内容
            this.setState({
                credWarning: false,
                patPresentOthID: even.patPresentOthID,
                patiId: even.patID,
                findPatNo: even.patNo
            })
            let data = {}
            data = {
                params: [{
                    cardTypeID: '',
                    cardNo: '',
                    credTypeID: even.patCredTypeID ? even.patCredTypeID : '',
                    credNo: typeof (even.patCredNo) != 'object' ? even.patCredNo : (this.props.form.getFieldValue('patCredNo') ? this.props.form.getFieldValue('patCredNo') : '')
                }],
            }
            $http.post('urlS', this, {
                code: '03030009',
                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('patCredTypeID') == '1') {
                            this.handleInmations(this.props.form.getFieldValue('patCredNo'))
                        }
                        this.autoAge(this.props.form.getFieldValue('patBirthDate')),
                            this.setState({
                                presentCity: [],
                                bsDoor: true,
                                noCard: false,
                                isModefined: 1,
                                parms: even,
                                socialTag: even.patSocialStatusID,
                                posType: even.patCredTypeID,
                                credCountry: even.patCountryID,
                                credBirthday: even.patBirthDateTime ? even.patBirthDateTime : undefined,
                                credAge: even.patAge ? even.patAge : undefined,
                                patiId: even.patID,
                                invoiceValue: this.state.baseParms.transactionNo,
                                initCardDr: this.state.baseParms.cardType[0].id,
                                // 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,
                            })
                    }
                },
                error: function () {
                }
            })
        }

        //病人关联 -- 子组件回调
        handleEdit = (record, even, patientInfo) => {
            // console.log("record",record,"even", even,"patientInfo", patientInfo)
            setTimeout(() => {
                this.patName.current.focus();
            }, 800)
            this.props.form.resetFields();
            this.handleVail()
            //带回当前卡信息 以及 病人信息 已绑卡类
            const evens = even.patInfo
            const data = even.data
            this.setState({
                presentCity: [],
                bsDoor: true,
                credWarning: false,
                noCard: true,
                isModefined: 1,
                cardSatus: record,
                patientInfo: patientInfo,
                parms: evens,
                socialTag: evens.patSocialStatusID,
                posType: evens.patCredTypeID,
                idCardCode: "",
                initCardDr: record.cardTypeID,
                cardPayMentID: record.cardPayMentID,
                nowCost: record.cardCost,
                repariFeeFlag: record.cardCost,
                credAge: evens.patAge ? evens.patAge : undefined,
                credBirthday: evens.patBirthDateTime ? evens.patBirthDateTime : undefined,
                isTransitionStart: true,
                patiId: record.patID,
            })
            if (record.cardStatusDesc == "正常" || record.cardStatusDesc == "挂失") {
                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, cardNo: record.cardNo })
            this.bingCardArr(data)
        }
        //获取到出生日期自动计算年龄
        autoAge = (patBirthDate, patBirthTime) => {
            // console.log("patBirthDate",patBirthDate)
            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) {
                            this.setState({
                                credAge: res.result
                            })
                            this.props.form.setFieldsValue({ age: res.result })
                        } else {

                        }
                    }
                })
            }
        }
        //获取身份证号年龄
        getAge = (patCredNo) => {
            var len = (patCredNo + "").length;
            if (len == 0) {
                return 0;
            } else {
                if ((len != 15) && (len != 18))//身份证号码只能为15位或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 && patCredNo.length == 18) {
                birthdayno = patCredNo.substring(6, 14)
            } else if (patCredNo && patCredNo.length == 15) {
                birthdaytemp = patCredNo.substring(6, 12)
                patCredNo = "19" + birthdaytemp
            } else {
            }
            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 {
                return false
            }
            var tempid = sexno % 2;
            if (tempid == 0) {
                sex = '2'
            } else {
                sex = '1'
            }
            return sex
        }
        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();
                }
            }

        }
        componentWillUnmount() {
            // setTimeout(() => {
            //     let timer = undefined;
            //     clearInterval(timer);
            //     window.removeEventListener("keydown", this.KeyDowns())
            // }, 1000)
        }
        render() {
            const {
                form: { validateFields },
            } = this.props;
            const { getFieldDecorator } = this.props.form;
            let { provinceDr, nowCostCard, repariFeeFlag, noCard, nowReadCard, cardLengthCard, replenishZero, repariFeeFlagCard, cardNoMessage, posMessage, patNameMessage, patBirthMessage, patMobileMessage, patTypeMessage, patAdressMessage, changeCardMessage, patchCardMessage, bindCardMessage, nowReadCardPop, canSave, parms, setData, baseParms, municipals, countys, villages, hamlets, readLoading, provinceId, patieParms, credSex,
                credBirthday, credAge, credCountry, nowCost, nowRead, cardLength, nowInv, initCardDr, posType, isModefined, isFlag, reciprocal,
                socialTag, postLoading, cardNo, originalNo, localProvince, localCity, localArea, bindCardArr, allDis, tipVisible, cardSatus, isCancel, bindDis, patientInfo, cardInfo, popCardVis, initpatCardID, bindVail, cardVal, bindMoreInfo, canRetarCard } = this.state
            let card = []
            baseParms.cardType && baseParms.cardType.map(item => {
                card.push(<Option key={item.id} disabled={item.disabled} value={String(item.id)} role={item.descripts + '^' + item.descriptsSPCode} title={item.readMode}>{item.descripts}</Option>)
            })

            let sex = []
            baseParms.sex && baseParms.sex.map(item => {
                sex.push(<Option key={item.code} onClick={() => this.handleKeydownM(3)} disabled={isModefined == 2} value={String(item.code)}>{item.descripts}</Option>)
            })

            let credType = []
            baseParms.credType && baseParms.credType.map(item => {
                credType.push(<Option key={item.id} onClick={() => this.handleKeydownM(4)} disabled={isModefined == 2} value={String(item.id)}>{item.descripts}</Option>)
            })

            let ageUnit = []
            baseParms.ageUnit && baseParms.ageUnit.map(item => {
                ageUnit.push(<Option key={item.id} value={String(item.id)}>{item.descripts}</Option>)
            })

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

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

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

            let firstCityItem = [], presentVillagesItem = [], presentCityItem = [], presentHamletsItem = [], presentAreasItem = [];
            let { presentCity, presentAreas, presentVillages, presentHamlets } = this.state;
            let provinceItem = [];
            let patInfo = this.state.parms;
            localProvince && localProvince.map(item => {
                provinceItem.push(<Option key={item.id} onClick={() => this.autoFouce("province")} className={'1' + item.province} role={item.descripts + '^' + item.descriptsSPCode} value={String(item.id)} title={item.descripts}>{item.descripts}</Option>)
            });
            //第一次加载的城市;
            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 ((!presentCity) || (presentCity.length == 0 && this.state.bsDoor)) {
                //现住址城市下拉数据为空时加载所有城市
                presentCityItem = firstCityItem;
            } else {
                presentCity && presentCity.map(item => {
                    presentCityItem.push(<Option provinceid={item.province} onClick={() => this.autoFouce("presentCity")} 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.autoFouce("presentAreas")} 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.autoFouce("presentVillages")} 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>)
            }

            let socialStatus = []
            baseParms.socialStatus && baseParms.socialStatus.map(item => {
                socialStatus.push(<Option key={item.id} onClick={this.handleposTagFouce} 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 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 bindArr = []
            bindCardArr && bindCardArr.map(item => {
                bindArr.push(<span style={{ color: (item.light == true ? "#1999db" : "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" />
            return (
                <div className='registerDom' style={{ height: "100%", overflow: "hidden" }}>
                    <Form style={{ height: "100%", overflow: "hidden auto" }}>
                        <div className="cardTitleDom">
                            <div className="bg1"></div>
                            <Row style={{ background: "#ffffff" }} gutter={12} className="cardTitle cardTitles">
                                <span className="title">当前卡信息</span>
                            </Row>
                            <Row gutter={12} style={{ paddingLeft: "52px" }}>
                                <Col span={4}>
                                    <FormItem wrapperCol={{ span: 23 }}>
                                        {getFieldDecorator('cardTypeID', {
                                            initialValue: initCardDr,
                                            rules: [{ required: true, message: '请选择卡类型' }],
                                        })(
                                            <Select disabled={isModefined == 1 || allDis || !noCard} placeholder='请选择卡类型' onSelect={this.handleCred}>
                                                {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={{ width: '96%', }}>
                                            {getFieldDecorator('cardNo', {
                                                validateTrigger: [""],
                                                initialValue: cardNo && cardNo ? cardNo : undefined,
                                                rules: [{ required: noCard ? true : false, message: '请输入' },
                                                { validator: noCard && isModefined != 1 ? this.validFunction : '' },
                                                ],
                                                getValueFromEvent: (event) => {
                                                    return initCardDr == '3' ? event.target.value.replace(/[^\d|Xx]/g, '') : event.target.value.replace(/\D/g, '')
                                                },
                                            })(
                                                <Input
                                                    style={{ background: (isModefined == 1 ? "#f5f5f5" : "#ffffff"), border: (isModefined == 1 ? "1px solid #d9d9d9" : "1px solid #d9d9d9") }}
                                                    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' ? '请点击读卡按钮查找病人' :
                                                            (nowRead == "" && replenishZero == "Y" ? cardLength + '刷卡/输入或点击读卡（卡号可自动补零）'
                                                                : (nowRead == "" && replenishZero == "N" ? cardLength + '刷卡/输入或点击读卡' :
                                                                    (nowRead == 'I' && replenishZero == "Y" ? cardLength + '输入卡号（卡号可自动补零）'
                                                                        : (nowRead == 'I' && replenishZero == "N" ? cardLength + '输入卡号' : ""))))}
                                                    disabled={isModefined == 1 || nowRead == 'R' || !noCard}
                                                />
                                            )}
                                        </FormItem>
                                    </Tooltip>
                                </Col>
                                <Col span={7} >
                                    <Form.Item wrapperCol={{ span: 16 }}>
                                        <Button ref={this.readOneButton} disabled={nowRead == "I" || !noCard} type={nowRead == "I" || !noCard ? "" : "primary"} loading={readLoading} onClick={this.handleCardReading}>
                                            读卡
                                        </Button>
                                        <Button style={{ marginLeft: 10, }} onClick={this.handlePatients}>
                                            查找病人
                                        </Button>
                                    </Form.Item>
                                </Col>
                            </Row>
                        </div>
                        <Row gutter={12} className="cardTitle">
                            <div className="sCard">
                                <img src={titleA} style={{ marginRight: "8px" }} />
                                <span style={{ color: "#666666" }}>病人基本信息</span>
                            </div>
                        </Row>
                        <div className="baseInfoDom oneCont">
                            <Row gutter={70}>
                                <Col span={7} className="patNameDom">
                                    <Tooltip getPopupContainer={() => document.querySelector('.patNameDom')} overlayClassName="toolTipDom patName" title={<div className="titleIcon">{mesIcon}<span >{patNameMessage}</span></div>} visible={this.state.patNameVisible} overlayStyle={{ zIndex: 999, }}>
                                        <FormItem {...formItemLayoutName} label='病人姓名'>
                                            {getFieldDecorator('patName', {
                                                validateTrigger: ["onPressEnter", "onBlur"],
                                                initialValue: parms && parms.patName ? parms.patName : undefined,
                                                rules: [{ required: true, message: '请输入', },
                                                { validator: this.validName },],
                                            })(
                                                <Input
                                                    onChange={(e) => this.checkName(e)}
                                                    ref={this.patName}
                                                    onMouseOver={() => this.visibleTip(2)}
                                                    onPressEnter={() => this.handleKeydownM(2)}
                                                    onBlur={this.patBlur}
                                                    disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
                                                />
                                            )}
                                        </FormItem>
                                    </Tooltip>
                                </Col>
                                <Col span={5} >
                                    <FormItem  {...formItemLayoutAge} label='证件类型' >
                                        {getFieldDecorator('patCredTypeID', {
                                            initialValue: parms && parms.patCredTypeID || parms.patCredTypeID == "" ? parms.patCredTypeID : '1',
                                            rules: [{ required: socialTag == 4 ? false : true, message: '请选择证件类型' }],
                                        })(
                                            <Select ref={this.credType} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} placeholder='请选择证件类型' showSearch allowClear optionFilterProp="role" onSelect={this.handleCerdType}>
                                                {credType}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                                <Col span={6} style={{ padding: '0' }} className="patNoDom">
                                    <Tooltip overlayClassName="toolTipDom patNo" getPopupContainer={() => document.querySelector('.patNoDom')} title={<div className="titleIcon">{mesIcon}<span >{posMessage}</span></div>} visible={this.state.posVisible} overlayStyle={{ zIndex: 999 }}>
                                        <FormItem  {...formItemLayoutName} label='证件号码'>
                                            {getFieldDecorator('patCredNo', {
                                                validateTrigger: ["onPressEnter", "onBlur"],
                                                initialValue: parms && parms.patCredNo ? parms.patCredNo : undefined,
                                                rules: [{ required: posType == 1 ? true : false, message: '请输入' },
                                                { validator: posType == 1 ? Util.vailIdCard : "" },
                                                ],
                                                getValueFromEvent: (event) => {
                                                    if (posType == 1) {
                                                        return event.target.value.replace(/[^\d|Xx]/g, '')
                                                    }
                                                    else {
                                                        return event.target.value.replace(/[^0-9a-zA-Z]/g, '')
                                                    }
                                                },
                                            })(
                                                <Input
                                                    onChange={() => this.visibleTip(3)}
                                                    onClick={this.fouceCredNo}
                                                    onMouseOver={() => this.visibleTip(3)}
                                                    maxLength={posType == 1 ? 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={6}>
                                    <FormItem  {...formItemLayoutName} className="lastRightBorder" label='性别'>
                                        {getFieldDecorator('patSexCode', {
                                            initialValue: parms && parms.patSexCode ? String(parms.patSexCode) : String(credSex),
                                            rules: [{ required: true, message: ' ' }],
                                        })(
                                            <Select ref={this.sex} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}>
                                                {sex}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row gutter={60} style={{ position: "relative" }}>
                                <Col span={5} style={{ padding: "0" }} className="patBirths">
                                    <Tooltip getPopupContainer={() => document.querySelector('.patBirth')} overlayClassName="toolTipDom patName" title={<div className="titleIcon">{mesIcon}<span >{patBirthMessage}</span></div>} visible={this.state.patBirthVisible} overlayStyle={{ zIndex: 999 }}>
                                        <FormItem {...formItemLayoutBirthData} label={"出生日期"}>
                                            {getFieldDecorator('patBirthDate',
                                                {
                                                    initialValue: credBirthday && credBirthday ? moment(credBirthday, "YYYY-MM-DD") : (parms.patBirthDate ? moment(parms.patBirthDate, "YYYY-MM-DD") : undefined),
                                                    rules: [{ required: true, 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='YYYY-MM-DD'
                                                        separator="-"
                                                        allowClear
                                                        disabledDate={(curDate) => {
                                                            return curDate && curDate > moment().endOf('day');
                                                        }}
                                                    />
                                                )}
                                        </FormItem>
                                    </Tooltip>
                                </Col>
                                <Col span={2} className="patBirthTime" >
                                    <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}
                                                    onChange={this.onPanelChangeTime}
                                                    // disabledTime={this.disabledDateTime}

                                                    open={this.state.openTime}
                                                    onKeyDown={this.timeBlur}
                                                    style={{ width: '100%' }}
                                                    placeholder="非必选"
                                                />
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={5} style={{ padding: '0' }}>
                                    <FormItem {...formItemLayoutAge} label={'年龄'}>
                                        {getFieldDecorator('age', {
                                            initialValue: credAge && credAge ? credAge : (parms.patAge ? parms.patAge : undefined),
                                            rules: [{ required: false, message: '年龄' }],
                                        })(
                                            <Input disabled style={{ marginRight: '4px', textAlign: 'left' }} />
                                        )}
                                    </FormItem>
                                </Col>
                                <Col span={6} className="patMobile">
                                    <Tooltip getPopupContainer={() => document.querySelector('.patMobile')} overlayClassName="toolTipDom patNo" placement="right" title={<div className="titleIcon">{mesIcon}<span >{patMobileMessage}</span></div>} visible={this.state.patMobileVisible} overlayStyle={{ zIndex: 999 }}>
                                        <FormItem {...formItemLayoutName} label='联系电话'  >
                                            {getFieldDecorator('patMobile', {
                                                validateTrigger: ["onPressEnter", "onBlur"],
                                                initialValue: parms.patMobile ? parms.patMobile : undefined,
                                                rules: [{ required: true, message: '请输入', },
                                                { pattern: new RegExp(/^1\d{10}$/), message: '请输入正确的手机号' }],
                                                getValueFromEvent: (event) => {
                                                    return event.target.value.replace(/\D/g, '')
                                                },
                                            })(
                                                <Input
                                                    onMouseOver={() => this.visibleTip(4)}
                                                    onChange={() => this.visibleTip(4)}
                                                    maxLength={11}
                                                    ref={this.patMobile}
                                                    onPressEnter={() => this.handleKeydownM(6)}
                                                    disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
                                                    onBlur={this.patMobileBlur}
                                                />
                                            )}
                                        </FormItem>
                                    </Tooltip>
                                </Col>
                                <Col span={6} className="patType patTypeLine">
                                    <Tooltip getPopupContainer={() => document.querySelector('.patType')} overlayClassName="toolTipDom patNo" title={<div className="titleIcon">{mesIcon}<span >{patTypeMessage}</span></div>} visible={this.state.patTypeVisible} overlayStyle={{ zIndex: 999 }}>
                                        <FormItem className="lastRightBorder"  {...formItemLayoutName} 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: true, message: '请选择' }],
                                            })(
                                                <Select onMouseEnter={() => this.visibleTip(9)} ref={this.patType} onBlur={this.patTypeBlur} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}>
                                                    {patType}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Tooltip>
                                </Col>
                            </Row>
                            <Row gutter={60} className="countryLine">
                                <Col span={7}>
                                    <FormItem {...formItemLayoutName} label='国籍'>
                                        {getFieldDecorator('patCountryID', {
                                            initialValue: parms.patCountryID ? parms.patCountryID : "44",
                                            rules: [{ required: false, message: '请选择国籍' }],
                                        })(
                                            <Select disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} showSearch allowClear optionFilterProp="role" onChange={this.handleCountry}>
                                                {country}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                                <Col span={5} style={{ padding: "0" }}>
                                    <FormItem {...formItemLayoutAge} label='民族'>
                                        {getFieldDecorator('patNationID', {
                                            initialValue: parms.patNationID ? parms.patNationID : '1',
                                            rules: [{ required: credCountry == "44", message: '请选择民族' }],
                                        })(
                                            <Select ref={this.nation} disabled={credCountry != 44 || isModefined == 2 || isModefined == 3 || isModefined == 6} showSearch allowClear optionFilterProp="role" >
                                                {nation}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                                <Col span={6}>
                                    <FormItem label={"身份标签"}  {...formItemLayoutName} className="lastRightBorder">
                                        {getFieldDecorator('patSocialStatusID',
                                            {
                                                initialValue: parms.patSocialStatusID ? parms.patSocialStatusID : undefined,
                                                rules: [{ required: false, message: '' }],
                                            })(
                                                <Select showSearch allowClear optionFilterProp="role" disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} placeholder='三无人员可不输入证件' onChange={this.handleposTag} onSelect={this.handleposTag}>
                                                    {socialStatus}
                                                </Select>
                                            )}
                                    </FormItem>
                                </Col>
                            </Row>
                        </div>
                        {/* <Divider /> */}
                        <Row gutter={12} className="cardTitle">
                            <div className="sCard">
                                <img src={titleC} style={{ marginRight: "8px" }} />
                                <span>联系地址</span>
                            </div>
                        </Row>
                        {/* <Divider /> */}
                        <div className="baseInfoDom adressLine">
                            <Row gutter={60}>
                                <Col span={4}>
                                    <FormItem label={"联系地址"} className="lastRightBorder" wrapperCol={{ span: 13 }} labelCol={{ span: 11 }}>
                                        {getFieldDecorator('presentProvinceID',
                                            {
                                                initialValue: parms.patPresentProvinceID ? parms.patPresentProvinceID : undefined,
                                            })(
                                                <Select
                                                    ref={this.province}
                                                    allowClear={true}
                                                    showSearch={true}
                                                    placeholder='省'
                                                    optionFilterProp="role"
                                                    onChange={this.onProvinceChange.bind(this, "present")}
                                                >
                                                    {provinceItem}
                                                </Select>
                                            )}
                                    </FormItem>
                                </Col>
                                <Col span={5} style={adressStyle}>
                                    <FormItem className="lastRightBorder">
                                        {getFieldDecorator('presentCityID',
                                            {
                                                initialValue: parms.patPresentCityID ? parms.patPresentCityID : undefined,
                                            })(
                                                <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={5} style={adressStyle}>
                                    <FormItem className="lastRightBorder">
                                        {getFieldDecorator('presentAreaID',
                                            {
                                                initialValue: parms.patPresentAreaID ? parms.patPresentAreaID : undefined,
                                            })(
                                                <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={5} style={adressStyle}>
                                    <FormItem className="lastRightBorder">
                                        {getFieldDecorator('presentVillageID',
                                            {
                                                initialValue: parms.patPresentVillageID ? parms.patPresentVillageID : undefined,
                                            })(
                                                <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={5} style={{ padding: '0px', width: '8.5%', marginRight: '0px' }}>
                                    <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={8} className="lastRightBorder" id="patAdress">
                                    <Tooltip getPopupContainer={() => document.querySelector('#patAdress')} overlayClassName="toolTipDom patAd" title={<div className="titleIcon">{mesIcon}<span >{patAdressMessage}</span></div>} visible={this.state.patAdressVisible} overlayStyle={{ zIndex: 999 }}>
                                        <Form.Item className="addressTextBorder" label={"详细地址"} {...formItemLayoutAdress} >
                                            {getFieldDecorator('patAddress',
                                                {
                                                    initialValue: parms.patPresentAddressDesc ? parms.patPresentAddressDesc : undefined,
                                                    rules: [{ required: true, message: '请输入' }],
                                                })(
                                                    <Input onMouseOver={() => this.visibleTip(5)} style={{ width: '100%' }} ref={this.patAddress} onPressEnter={() => this.handleKeydownM(9)} onBlur={this.patAdressBlur} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6} />
                                                )}
                                        </Form.Item>
                                    </Tooltip>
                                </Col>
                            </Row>
                            <Row>
                                <Col span={4} className="ecoNameDom">
                                    <Tooltip getPopupContainer={() => document.querySelector('.ecoNameDom')} overlayClassName="toolTipDom patNameC" title={<div className="titleIcon">{mesIcon}<span >{this.state.econNameMessage}</span></div>} visible={this.state.econNameVisible} overlayStyle={{ zIndex: 999, }}>
                                        <Form.Item label={'联系人姓名'} wrapperCol={{ span: 13 }} labelCol={{ span: 11 }} >
                                            {getFieldDecorator('patEContact',
                                                {
                                                    validateTrigger: [""],
                                                    initialValue: parms.patEContact ? parms.patEContact : undefined,
                                                    // credAge&&parseInt(credAge)<14||parms.patAge&&parseInt(parms.patAge)<14?true:false
                                                    rules: [{ required: parseInt(credAge) < 14 || parseInt(parms.patAge) < 14 || credAge && credAge.indexOf("天") != -1 || parms.patAge && parms.patAge.indexOf("天") != -1 ? true : false, message: '请填写联系人姓名' },
                                                    { validator: this.validNames }],
                                                })(
                                                    <Input
                                                        onMouseOver={() => this.visibleTip(12)}
                                                        onPressEnter={() => this.handleKeydownM(12)}
                                                        ref={this.econName}
                                                        disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
                                                        onBlur={this.patEconNameBlur}
                                                    />
                                                )}
                                        </Form.Item>
                                    </Tooltip>
                                </Col>
                                <Col span={4} className="sexConant leftLine">
                                    <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={'联系人关系'} wrapperCol={{ span: 13 }} labelCol={{ span: 11 }} >
                                            {getFieldDecorator('patERelationID',
                                                {
                                                    initialValue: parms.patERelationID ? parms.patERelationID : undefined,
                                                    rules: [{ required: parseInt(credAge) < 14 || parseInt(parms.patAge) < 14 || credAge && credAge.indexOf("天") != -1 || parms.patAge && parms.patAge.indexOf("天") != -1 ? true : false, message: '请选择联系人关系' }],
                                                })(
                                                    <Select
                                                        ref={this.econRelation}
                                                        onBlur={this.patEconRelationBlur}
                                                        disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
                                                        showSearch
                                                        allowClear
                                                        optionFilterProp="role"
                                                    >
                                                        {relation}
                                                    </Select>
                                                )}
                                        </Form.Item>
                                    </Tooltip>
                                </Col>
                                <Col span={4} className="econPhone">
                                    <Tooltip getPopupContainer={() => document.querySelector('.econPhone')} overlayClassName="toolTipDom patNoC" placement="right" title={<div className="titleIcon">{mesIcon}<span >{this.state.econPhoneMessage}</span></div>} visible={this.state.econPhoneVisible} overlayStyle={{ zIndex: 999 }}>
                                        <Form.Item label={'联系人手机'} className="lastRightBorder" wrapperCol={{ span: 13 }} labelCol={{ span: 11 }}>
                                            {getFieldDecorator('patEContactMobile',
                                                {
                                                    validateTrigger: "",
                                                    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: '请填写联系人手机'
                                                    },
                                                    { 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(13.1)}
                                                        onBlur={this.checkPatMobile}
                                                        ref={this.econMobile} disabled={isModefined == 2 || isModefined == 3 || isModefined == 6}
                                                    />
                                                )}
                                        </Form.Item>
                                    </Tooltip>
                                </Col>
                            </Row>
                        </div>
                        {/* <Divider /> */}
                        <Row gutter={12} className="cardTitle">
                            <div className="sCard">
                                <img src={titleB} style={{ marginRight: "8px" }} />
                                <span>其他信息</span>
                            </div>
                        </Row>
                        {/* <Divider /> */}
                        <div className="baseInfoDom bottomDom">
                            <Row gutter={60} style={{ borderBottom: "1px solid rgb(181, 181, 181)" }}>
                                <Col span={7} style={{ padding: '0', marginRight: '5px' }}>
                                    <Form.Item label={"账户余额(元)"} {...formItemLayoutBance}>
                                        {getFieldDecorator('balance',
                                            {
                                                initialValue: parms.balance ? "￥" + parms.balance : "￥--",
                                                rules: [{ required: false, message: '' }],
                                            })(
                                                <Input disabled />
                                            )}
                                    </Form.Item>
                                </Col>
                                <Col span={5} style={{ padding: '0', marginRight: '5px', display: (nowCost == 0 || isModefined == 1 || isFlag == 3 ? 'none' : 'block') }}>
                                    <Form.Item label={"当前卡费"} {...formItemLayoutBirth}>
                                        {getFieldDecorator('currentBalance',
                                            {
                                                initialValue: this.state.repariFeeFlag != "Y" && nowCost != 0 ? '￥' + nowCost : '￥' + nowCost + " " + "仅补卡时收费",
                                                rules: [{ required: false, message: '' }],
                                            })(
                                                <Input disabled style={{ textAligh: 'center' }} />
                                            )}
                                    </Form.Item>
                                </Col>
                                <Col span={6} style={{ display: (this.state.repariFeeFlag != "Y" && nowCost != 0 ? 'block' : 'none') }}>
                                    <Form.Item label={"当前发票"} className="lastRightBorder" {...formItemLayoutBance}>
                                        {getFieldDecorator('currentInvoice',
                                            {
                                                initialValue: undefined,
                                                rules: [{ required: false, message: '' }],
                                            })(
                                                <Input disabled placeholder={this.state.invoiceValue} type="text" />
                                            )}
                                    </Form.Item>
                                </Col>
                                <Col span={5} style={{ padding: '0', display: (repariFeeFlag == "Y" || nowCost == 0 || isModefined == 1 || isFlag == 3 || !noCard ? 'none' : 'block') }}>
                                    <FormItem className="lastRightBorder"  {...formItemLayoutName} label='支付方式'>
                                        {getFieldDecorator('cardPayMethodID', {
                                            initialValue: this.state.baseParms.payMethod && this.state.baseParms.payMethod.length > 0 ? this.state.baseParms.payMethod[0].id : undefined,
                                            rules: [{ required: nowCost == 0 || isModefined == 1 || isFlag == 3 || this.state.repariFeeFlag == "Y" ? false : true, message: '请选择支付方式' }],
                                        })(
                                            <Select ref={this.cardPayMethodID} disabled={allDis || !noCard}>
                                                {payMethod}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row gutter={60} style={{ borderTop: "0" }} className="countryLine">
                                <Col span={21} className="bindLine">
                                    <Form.Item className="lastRightBorder bindLine" label={"已绑卡型"} {...formItemBind} >
                                        {getFieldDecorator('patientType',
                                            {
                                                initialValue: undefined,
                                                rules: [{ required: false, message: '' }],
                                            })(
                                                <div style={{
                                                    color: 'rgba(0, 0, 0, 0.25)',
                                                    borderRdius: '4px', height: '39px', borderRadius: '4px'
                                                }}>
                                                    {bindArr}
                                                </div>
                                            )}
                                    </Form.Item>
                                </Col>
                            </Row>
                        </div>
                        <Row className="handleLastDom">
                            <Col>
                                <Form.Item wrapperCol={{ span: 24, offset: 18.5 }}>
                                    <Button
                                        disabled={allDis || canSave}
                                        type="primary"
                                        ref={this.creadCard}
                                        loading={postLoading}
                                        onClick={this.handleSubmit}
                                    // style={{background:"#1999db",border:"0"}}
                                    >
                                        {isModefined == 1 ? '保存修改( ctrl + s )' : (isFlag == 3 ? '开始换卡' : (isFlag == 4 ? '开始补卡' : (isModefined == 6 ? '开始绑卡' : '开始建卡( ctrl + s )')))}
                                    </Button>
                                    <Button style={{ marginLeft: 8, display: (isModefined != 2 || isModefined != 3 || isModefined == 6 ? 'inline-block' : 'none') }} onClick={this.handleReset}>
                                        清空( ctrl + z )
                                    </Button>
                                    <Button title={bindDis && this.state.bindCardArr.length > 0 ? "已绑定全部卡类型，不能继续绑定" : (bindDis && this.state.bindCardArr.length == 0 ? "" : "")} style={{ marginLeft: 8, border: "0", display: (noCard ? "inline-block" : "none") }} disabled={bindDis} type={bindDis ? "" : "primary"} onClick={() => this.handleCard(6, cardSatus)}>绑卡</Button>
                                    <Button style={{ marginLeft: 8, border: "0", display: (noCard ? "none" : "inline-block") }} disabled={noCard} type={noCard ? "" : "primary"} onClick={() => this.handleCard(6, cardSatus)}>绑卡</Button>
                                    <Button title={cardSatus.changeFlag && cardSatus.changeFlag == 'N' ? cardSatus.unChangeReson : (this.state.bindCardArr.length == 0 ? "" : "")} style={{ marginLeft: 8, border: "0" }} disabled={!cardSatus.changeFlag || cardSatus.changeFlag == 'N'} type={!cardSatus.changeFlag || cardSatus.changeFlag == 'N' ? "" : "primary"} onClick={() => this.handleCard(3, cardSatus)} >换卡</Button>
                                    <Button title={cardSatus.lossFlag && cardSatus.lossFlag == 'N' ? cardSatus.unLossReson : (this.state.bindCardArr.length == 0 ? "" : "")} style={{ marginLeft: 8, border: "0" }} disabled={!cardSatus.lossFlag || cardSatus.lossFlag == 'N'} type={!cardSatus.lossFlag || cardSatus.lossFlag == 'N' ? "" : "primary"} onClick={() => this.handleCard(2, cardSatus)}  >挂失</Button>
                                    <Button title={cardSatus.repairFlag && cardSatus.repairFlag == 'N' ? cardSatus.unRepairReson : (this.state.bindCardArr.length == 0 ? "" : "")} style={{ margin: "0 8px 0 8px", 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 8px 0 10px", border: "0" }}
                                        type="primary"
                                        onClick={() => this.handleCard(1, cardSatus)}
                                        style={{ display: (isCancel == 1 ? 'inline-block' : 'none'), margin: "0 6px 0 0" }}
                                    >
                                        取消挂失
                                    </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>
                        {/* <Row style={{height:"139px",background:"#ffffff"}}></Row> */}
                    </Form>
                    <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 || isFlag == 6 ? "绑定成功" : "绑卡成功"))))}</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 ? '换卡' : "绑定其他类型卡"))}
                        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%' }} onSelect={this.handleBindCardType}>
                                                    {card}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col >
                                    <Col span={5} style={{ display: (this.state.repariFeeFlagCard != "Y" && nowCostCard != 0 ? '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 key="submits" ref={this.bindCardButton} type={nowReadCardPop == 'I' ? "" : "primary"} style={{ marginRight: '12px' }} disabled={nowReadCardPop == 'I'} 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" ? cardLengthCard + '刷卡/输入或点击读卡（卡号可自动补零）'
                                                                : (nowReadCardPop == "" && replenishZero == "N" ? cardLengthCard + '刷卡/输入或点击读卡'
                                                                    : (nowReadCardPop == 'I' && replenishZero == "Y" ? cardLengthCard + '刷卡/输入卡号（卡号可自动补零）'
                                                                        : (nowReadCardPop == 'I' && replenishZero == "N" ? cardLengthCard + '刷卡/输入卡号' : ""))))}
                                                        disabled={nowReadCardPop == 'R'}
                                                        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='新卡' {...formItemNewCard}>
                                        {getFieldDecorator('newCard', {
                                            initialValue: undefined,
                                            rules: [{ required: false, message: '' }],
                                        })(
                                            <Select style={{ width: '100%' }} disabled>
                                                {card}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col >
                                <Col span={12} 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  {...formItemCard}>
                                            {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 + '刷卡/输入卡号' : ""))))}
                                                    maxLength={cardLengthCard && cardLengthCard != "" ? parseInt(cardLengthCard) : 99}
                                                    disabled={nowReadCardPop == 'R'}
                                                    onMouseOver={() => this.visibleTip(7)}
                                                    onPressEnter={() => this.changeCardBlur(2)}
                                                    onBlur={() => this.changeCardBlur(2)}
                                                    onChange={this.closeBindVail}
                                                    ref={this.patchCard}
                                                />

                                            )}
                                        </FormItem>
                                    </Tooltip>
                                </Col >
                                <Col span={5} style={{ display: (isFlag != 7 ? 'block' : 'none') }}>
                                    <FormItem  {...formItemNewButton}>
                                        <Button ref={this.creadCardPops} disabled={nowReadCardPop == "I"} type={nowReadCardPop == "I" ? "" : "primary"} onClick={this.bindCardReadling} >读卡</Button>
                                        <Button style={{ marginLeft: "6px" }} disabled={bindVail} ref={this.patchOkButton} type={bindVail ? "" : "primary"} onKeyDown={this.handleOnKeydown} onClick={() => this.handleFlag(4)}>补卡</Button>
                                    </FormItem>
                                </Col >
                            </Row>
                            <Row style={{ display: (nowCost != 0 ? 'block' : 'none') }}>
                                <Col>
                                    <FormItem label='补卡费用' {...formItemNew}>
                                        {getFieldDecorator('patchMoney', {
                                            initialValue: nowCost != 0 ? '￥' + nowCost : 0,
                                            rules: [{ required: false, message: '' }],
                                        })(
                                            <Input disabled />
                                        )}
                                    </FormItem>
                                </Col >
                            </Row>
                            <Row style={{ display: (nowCost != 0 ? '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 ? '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" }} className="changeCardDom">
                            <Row>
                                <Col span={6} >
                                    <FormItem label='新卡' {...formItemNewCard}>
                                        {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  {...formItemCard}>
                                            {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" ? cardLengthCard + '刷卡/输入或点击读卡（卡号可自动补零）'
                                                            : (nowReadCardPop == "" && replenishZero == "N" ? cardLengthCard + '刷卡/输入或点击读卡'
                                                                : (nowReadCardPop == 'I' && replenishZero == "Y" ? cardLengthCard + '刷卡/输入卡号（卡号可自动补零）'
                                                                    : (nowReadCardPop == 'I' && replenishZero == "N" ? cardLengthCard + '刷卡/输入卡号' : ""))))}
                                                    maxLength={cardLengthCard && cardLengthCard != "" ? parseInt(cardLengthCard) : 99}
                                                    disabled={nowReadCardPop == 'R'}
                                                    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'} 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', {
                                            initialValue: undefined,
                                            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} defaultPos={this.state.defaultPos}></FindPatients>
                    <PatientInformation handleEdit={this.handleEdit.bind(this)} Onrefs={this.Onrefs}></PatientInformation>
                    <ReadCard ref={r => this.readCard = r} />
                </div>
            )
        }
    })
export default RegisterPatCard