/*
* 新增革新信息
* */

import React, { Component } from 'react';
import {
    Input, Form, Select, Modal, Button, Progress, Upload, message, Tooltip, Icon, Table,
    Card, Row, Col, DatePicker, Popconfirm, Radio
} from 'antd';
import { Util, dayFormat } from 'tools/index';
import { $http } from 'containers/config/https';
import '../style/index.less';
import moment from 'moment';

const Option = Select.Option;
const Search = Input.Search;
const FormItem = Form.Item;
const { TextArea } = Input;

class ShowInformationModal extends Component {

    constructor(props) {
        super(props);
        var date = new Date();
        var userData = JSON.parse(sessionStorage.getItem('userData'));
        this.state = {
            leftData: [],
            rightData: [],
            userData: userData,
            total: 0,
            page: 1,
            pageSize: 10,
            codePage: 1,
            ids: [],
            totalCount: 0,
            fileList: [],
            dataSource: [],
            family: [{}],
        }
    }
    componentWillReceiveProps(nextProp) {
        if (nextProp.isShow === true) {
            this.initData()
            //
            if (!Util.isEmpty(nextProp.patID)) {
                this.setState({
                    family: !Util.isEmpty(nextProp.family) ? nextProp.family : [{}],
                    radioCode: nextProp.radioCode,
                    patCredNo:nextProp.patCredNo
                })
                this.loadProgress(nextProp.patID)
            }
        } else if (this.props.isShow === false) {
            this.cleanInput();
        }
    }

    componentDidMount() {
        this.props.onRef(this)
        this.loadSelectData()
        this.loadCardType()
        this.loadHealthMessage()
        this.loadHospitalDactor()//获取家庭医生
        this.loadPayWay()//医疗支付方式
        this.getProviceOther()
        this.getProviceOtherNow()
        this.loadMedicalType()
        this.loadPopulation()
    }

    loadData(id) {
    }

    loadProgress(patID) {
        var params = {
            params: [{
                patID: patID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03070062",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        progressList: res.result,
                    })
                }
            }
        });
    }

    initData() {
        this.columns = [
            {
                title: <span><span className='shuld-choose-btn'>*</span>姓名</span>,
                dataIndex: 'name',
                width: 100,
                align: 'left',
                render: (text, data, index) => {
                    data['ID'] = data.familyID
                    return <Input style={{ width: '95%' }} onChange={this.changeCommonInput.bind(this, 'name', index)}
                        value={data.name} />
                }
            },
            {
                title: <span><span className='shuld-choose-btn'>*</span>关系</span>,
                dataIndex: 'relationID',
                width: 100,
                align: 'left',
                render: (text, data, index) => {
                    //关系
                    data.relationID = data.relaID
                    var relationDataOption = []
                    this.state.relationData && this.state.relationData.map((item, index) => {
                        relationDataOption.push(<Option key={index} value={String(item.id)} code={item.descripts}
                            name={item.descriptsSPCode}>{item.descripts}</Option>)
                    })
                    return <Select style={{ width: '95%' }} onChange={this.changeCommonSelect.bind(this, 'relaID', index)}
                        value={data.relaID || data.relationID} showSearch allowClear filterOption={(input, option) =>
                            option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                            || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                        }>{relationDataOption}</Select>
                }
            },
            {
                title: <span><span className='shuld-choose-btn'>*</span>性别</span>,
                dataIndex: 'sexID',
                width: 100,
                align: 'left',
                render: (text, data, index) => {
                    //性别
                    var sexOption = []
                    this.state.sex && this.state.sex.map((item, index) => {
                        sexOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
                    })
                    return <Select style={{ width: '95%' }} onChange={this.changeCommonSelect.bind(this, 'sexID', index)}
                        value={data.sexID}>{sexOption}</Select>
                }
            },
            {
                title: '身份证号码',
                dataIndex: 'iDCardNo',
                width: 100,
                align: 'left',
                render: (text, data, index) => {
                    return <Input style={{ width: '95%' }} onChange={this.changeCommonInput.bind(this, 'iDCardNo', index)}
                        onKeyDown={this.onKeyDownCardNo.bind(this, 'iDCardNo', data, index)}
                        onBlur={this.onBlurCardNo.bind(this, 'iDCardNo', data, index)}
                        value={data.iDCardNo} />
                }
            },
            {
                title: <span><span className='shuld-choose-btn'>*</span>联系方式</span>,
                dataIndex: 'phone',
                width: 100,
                align: 'left',
                render: (text, data, index) => {
                    return <Input style={{ width: '95%' }} onChange={this.changeCommonInput.bind(this, 'phone', index)}
                        value={data.phone} />
                }
            },
            // {
            //     title: '是否医保',
            //     dataIndex: 'iNSUTypeID',
            //     width: 100,
            //     align: 'left',
            //     render: (text, data, index) => {

            //         var medicalTypeOption = []
            //         this.state.medicalType && this.state.medicalType.map((item, index) => {
            //             medicalTypeOption.push(<Option key={index} value={item.id} code={item.descripts}
            //                 name={item.descriptsSPCode}>{item.descripts}</Option>)
            //         })
            //         return <Select style={{ width: '95%' }} onChange={this.changeCommonSelect.bind(this, 'iNSUTypeID', index)}
            //             showSearch allowClear filterOption={(input, option) =>
            //                 option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
            //                 || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
            //             }
            //             value={data.typeID || data.iNSUTypeID}>{medicalTypeOption}</Select>
            //     }
            // },
            // {
            //     title: '人群分类',
            //     dataIndex: 'classificationID',
            //     width: 100,
            //     align: 'left',
            //     render: (text, data, index) => {
            //         var populationOption = []
            //         this.state.population && this.state.population.map((item, index) => {
            //             populationOption.push(<Option key={index} value={item.id} code={item.descripts}
            //                 name={item.descriptsSPCode}>{item.descripts}</Option>)
            //         })
            //         return <Select style={{ width: '95%' }} onChange={this.changeCommonSelect.bind(this, 'classificationID', index)}
            //             showSearch allowClear filterOption={(input, option) =>
            //                 option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
            //                 || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
            //             }
            //             value={data.classID || data.classificationID}>{populationOption}</Select>
            //     }
            // }, {
            //     title: '医保卡号',
            //     dataIndex: 'iNSUNo',
            //     width: 100,
            //     align: 'left',
            //     render: (text, data, index) => {
            //         return <Input style={{ width: '95%' }} onChange={this.changeCommonInput.bind(this, 'iNSUNo', index)}
            //             value={data.iNSUNo} />
            //     }
            // },
            {
                title: '操作',
                dataIndex: 'opertion',
                width: 100,
                align: 'left',
                render: (text, data, index) => {
                    return <span>
                        <Icon type="delete" style={{ color: 'rgba(240,65,52,1)' }}></Icon>
                        <Popconfirm title="确定删除成员信息吗?" onConfirm={this.handleDel.bind(this, data, index)} >
                            <span className='span' style={{ color: 'rgba(240,65,52,1)' }}>删除</span>
                        </Popconfirm></span>
                }
            },
        ]
    }

    onKeyDownCardNo(name, data, index, e) {
        if (e.keyCode == '13') {
            var idCard = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
            var cardNo = data.iDCardNo;
            if (!Util.isEmpty(cardNo) && !idCard.test(cardNo)) {
                message.error('身份证号码输入格式不正确，请重新输入')
                return
            }
        }
    }
    onBlurCardNo(name, data, index, e) {
        var idCard = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
        var cardNo = data.iDCardNo;
        if (!Util.isEmpty(cardNo) && !idCard.test(cardNo)) {
            message.error('身份证号码输入格式不正确，请重新输入')
            return
        }
    }

    changeCommonInput(name, index, e) {
        this.state.family[index][name] = e.target.value;
        this.setState({})
    }

    changeCommonSelect(name, index, e) {
        this.state.family[index][name] = e;
        this.setState({})
    }

    handleDel(data, index) {
        if (!Util.isEmpty(data.ID)) {
            this.handleDelfamily(data, index)
        }
        this.state.family.splice(index, 1);
        this.setState({})
    }

    handleDelfamily(data, index) {
        var params = {
            params: [{
                ID: data.ID,
                updateUserID: this.state.userData.userID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03070009",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success('删除成功')
                    // this.state.family.splice(index, 1);
                    this.setState({})
                }
            }
        });
    }

    //获取卡类型
    loadCardType() {
        var params = {
            params: [{
                cardTypeFlag: '1',//卡类型
                patTypeFlag: '1',
                credTypeFlag: '1',//证件类型
                nationFlag: '1',//民族
                occupationFlag: '1',//职业
                maritalFlag: '1',	//婚姻
                eduFlag: '1',//学历
                relationFlag: '1'
            }]
        }
        $http.post('urlDeault', this, {
            code: "03030005",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    var cardStatus = ''
                    var replaceZero = ''
                    var cardLength = 0
                    var readMode = ''
                    if (res.cardType && res.cardType.length > 0) {
                        var cardType = res.cardType;
                        for (var i = 0; i < cardType.length; i++) {
                            if (cardType[i].defaultFlag == 'Y') {
                                cardStatus = cardType[i].id,
                                    replaceZero = cardType[i].replenishZero
                                cardLength = cardType[i].cardLength
                                readMode = cardType[i].readMode
                            }
                        }
                    }
                    this.setState({
                        cardTypeData: res.cardType,
                        credTypeData: res.credType,//证件类型
                        nationData: res.nation,//民族
                        occupationData: res.occupation,//职业
                        maritalData: res.marital,//婚姻
                        eduData: res.education,//学历
                        sexData: res.sex,
                        relationData: res.relation,//关系
                        socialStatusData: res.patSocialStatusDesc,
                        cardStatus: cardStatus,
                        readMode: readMode,
                        cardLength: cardLength,
                        replaceZero: replaceZero,
                    })
                }
            }
        });
    }

    //切换卡类型
    changeCardType(name, e) {
        var { cardTypeData } = this.state;
        for (var i = 0; i < cardTypeData.length; i++) {
            if (e == cardTypeData[i].id) {
                this.setState({
                    cardLength: cardTypeData[i].cardLength,
                    replaceZero: cardTypeData[i].replenishZero,
                    cardTypeId: cardTypeData[i].id,
                    readMode: cardTypeData[i].readMode,
                    [name]: e,
                    inputStatus: true
                })
            }
        }
    }

    loadSelectData() {
        var params = {
            params: [{
                logonHospID: this.state.userData.hospID,
                logonGroupID: this.state.userData.groupID,
                sexFlag: 'Y'
            }]
        }
        $http.post('urlDeault', this, {
            code: "03010037",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        sex: res.result.sex,
                    })
                }
            }
        });
    }

    //医疗支付
    loadPayWay() {
        var params = {
            params: [{

            }]
        }
        $http.post('urlDeault', this, {
            code: "03070038",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        payWay: res.data,
                    })
                }
            }
        });
    }
    //医保类型
    loadMedicalType() {
        var params = {
            params: [{}]
        }
        $http.post('urlDeault', this, {
            code: "03070052",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        medicalType: res.result,
                    })
                }
            }
        });
    }

    //人群分类
    loadPopulation() {
        var params = {
            params: [{}]
        }
        $http.post('urlDeault', this, {
            code: "03070039",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        population: res.result,
                    })
                }
            }
        });
    }

    //获取家庭医生
    loadHospitalDactor() {
        var params = {
            params: [{
                hospID: this.state.userData.hospID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03070032",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        familyDoctor: res.result,
                    })
                }
            }
        });
    }

    changeCommonData(name, e) {
        this.setState({
            [name]: e
        }, () => {
            this.loadDoctorData()
        })
    }

    loadDoctorData(value) {
        var params = {
            params: [{
                hospID: this.state.signHospID ? this.state.signHospID : (value ? value : this.state.userData.hospID)
            }]
        }
        $http.post('urlDeault', this, {
            code: "03070033",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        doctorData: res.result.data,
                    })
                }
            }
        });
    }

    loadHealthMessage() {
        var params = {
            params: [{}]
        }
        $http.post('urlDeault', this, {
            code: "03070040",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        healthMessage: res.result,
                    })
                }
            }
        });
    }

    getProviceOther(value) {
        let data = {}
        data = {
            params: [{
                provinceFlag: 1,	//省
                cityFlag: 1,  //市
                countryFlag: 1,	//国家
            }]
        }
        $http.post('urlS', this, {
            code: '03030005',
            data: data,
            success: function (res) {
                if (res.errorCode == '0') {
                    if (this.state.patProvinceID || value) {
                        let city = []
                        city = res.city.filter((item) => item.province == (this.state.patProvinceID ? this.state.patProvinceID : value));
                        this.setState({
                            localCity: city,
                            localProvince: res.province,
                            patCityID: undefined,
                            patAreaID: undefined,
                            patVillageID: undefined,
                        }, () => {
                            if (this.state.filedStatus !== true) {
                                this.props.form.resetFields('patCityID')
                                this.props.form.resetFields('patAreaID')
                                this.props.form.resetFields('patVillageID')
                            }
                        })
                    } else {
                        this.setState({
                            localProvince: res.province,
                            localCity: [],
                            patCityID: undefined,
                            patAreaID: undefined,
                            patVillageID: undefined,
                        }, () => {
                            if (this.state.filedStatus !== true) {
                                this.props.form.resetFields('patCityID')
                                this.props.form.resetFields('patAreaID')
                                this.props.form.resetFields('patVillageID')
                            }
                        })
                    }
                }
            }
        })
    }

    getProviceOtherNow(value) {
        let data = {}
        data = {
            params: [{
                provinceFlag: 1,	//省
                cityFlag: 1,  //市
                countryFlag: 1,	//国家
            }]
        }
        $http.post('urlS', this, {
            code: '03030005',
            data: data,
            success: function (res) {
                if (res.errorCode == '0') {
                    if (this.state.receiveProvinceID || value) {
                        let code = []
                        code = res.city.filter((item) => item.province == (this.state.receiveProvinceID ? this.state.receiveProvinceID : value));
                        this.setState({
                            localCityNow: code,
                            localProvinceNow: res.province,
                            patCityID: undefined,
                            patAreaID: undefined,
                            patVillageID: undefined,
                        }, () => {
                            if (this.state.filedStatus !== true) {
                                this.props.form.resetFields('receiveCityID')
                                this.props.form.resetFields('receiveAreaID')
                                this.props.form.resetFields('receiveVillageID')
                            }
                        })
                    } else {
                        this.setState({
                            localProvinceNow: res.province,
                            localCityNow: [],
                            patCityID: undefined,
                            patAreaID: undefined,
                            patVillageID: undefined,
                        }, () => {
                            if (this.state.filedStatus !== true) {
                                this.props.form.resetFields('receiveCityID')
                                this.props.form.resetFields('receiveAreaID')
                                this.props.form.resetFields('receiveVillageID')
                            }
                        })
                    }
                }
            }
        })
    }

    //选择或清除省
    onProvinceChange(name, value) {
        this.setState({
            [name]: value,
            areaData: []
        }, () => {
            this.getProviceOther(value)
        })

    }
    //选择市
    changeReceiveCity(name, value) {
        this.setState({
            [name]: value,
            patAreaID: undefined,
            patVillageID: undefined,
        }, () => {
            if (this.state.filedStatus !== true) {
                this.props.form.resetFields('patAreaID')
                this.props.form.resetFields('patVillageID')
            }
            this.getAreas(value)
        })
    }
    //选择县
    changeAreaCity(name, value) {
        this.setState({
            [name]: value,
            patVillageID: undefined
        }, () => {
            if (this.state.filedStatus !== true) {
                this.props.form.resetFields('patVillageID')
            }
            this.getVillages(value)
        })
    }
    //选择乡
    changeVillageCity(name, value) {
        this.setState({
            [name]: value
        })
    }

    getVillages(value) {
        let data = {
            params: [{
                areaId: this.state.patAreaID ? this.state.patAreaID : value
            }],
        }
        $http.post('urlS', this, {
            code: '03030007',
            data: data,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        villageData: res.result
                    })
                }
            }
        })
    }

    getAreas(value) {
        let data = {
            params: [{
                cityId: this.state.patCityID ? this.state.patCityID : value
            }],
        }
        $http.post('urlS', this, {
            code: '03030006',
            data: data,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        areaData: res.result
                    })
                }
            }
        })
    }

    //首字母大写
    firstToUp = (str) => {
        return str.substring(0, 1).toUpperCase() + str.substring(1);
    }

    //选择或清除省
    onProvinceChangeNow(name, value) {
        this.setState({
            [name]: value,
            areaDataNow: []
        }, () => {
            this.getProviceOtherNow(value)
        })

    }
    //选择市
    changeNowReceiveCity(name, value) {
        this.setState({
            [name]: value,
            receiveAreaID: undefined,
            receiveVillageID: undefined,
        }, () => {
            if (this.state.filedStatus !== true) {
                this.props.form.resetFields('receiveAreaID')
                this.props.form.resetFields('receiveVillageID')
            }
            this.getAreasNow(value)
        })
    }
    //选择县
    changeNowAreaCity(name, value) {
        this.setState({
            [name]: value,
            receiveVillageID: undefined
        }, () => {
            if (this.state.filedStatus !== true) {
                this.props.form.resetFields('receiveVillageID')
            }
            this.getVillagesNow(value)
        })
    }
    //选择乡
    changeNowVillageCity(name, value) {
        this.setState({
            [name]: value
        })
    }

    getVillagesNow(value) {
        let data = {
            params: [{
                areaId: this.state.receiveAreaID ? this.state.receiveAreaID : value
            }],
        }
        $http.post('urlS', this, {
            code: '03030007',
            data: data,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        villageDataNow: res.result
                    })
                }
            }
        })
    }

    getAreasNow(value) {
        let data = {
            params: [{
                cityId: this.state.receiveCityID ? this.state.receiveCityID : value
            }],
        }
        $http.post('urlS', this, {
            code: '03030006',
            data: data,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        areaDataNow: res.result
                    })
                }
            }
        })
    }

    closeModal(name) {
        let { onHide } = this.props;
        onHide && onHide();
        this.cleanInput();
    }

    //清空输入框
    cleanInput() {
        this.props.form.resetFields();
        this.setState({
            detailData: {},
            receiveCityID: undefined,
            receiveAreaID: undefined,
            receiveVillageID: undefined,
            receiveProvinceID: undefined,
            receiveAddress: undefined,
            receiveMobile: undefined,
            receiveName: undefined,
            patCityID: undefined,
            patAreaID: undefined,
            patVillageID: undefined,
            patProvinceID: undefined,
            family: [{ tabIndex: 0 }],
            healthRecord: undefined,
            signHospID: undefined,
            signDoctorID: undefined,
            patAge: undefined,
            patSexID: undefined,
            patBirthDate: undefined,
            number: undefined,
            cardNo: undefined,
            filedStatus: false
        })
    }

    //获取人员标识信息
    loadEditData(e, code) {
        if (e.keyCode == '13') {
            var params = {
                params: [{
                    number: code == '1' ? this.state.patCredNo : this.state.number,
                    cardTypeID: this.state.carTypeDr ? this.state.carTypeDr : (this.state.cardStatus),
                    cardNo: this.state.cardNo,
                }]
            }
            $http.post('urlDeault', this, {
                code: "03070088",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        var source = res.result[0];
                        var editData = {}
                        this.props.form.setFieldsValue({
                            patName: source.personInfo && source.personInfo.patName,
                            patSexID: source.personInfo && source.personInfo.patSexID,
                            patAge: source.personInfo && source.personInfo.patAge,
                            patCredTypeID: source.personInfo && source.personInfo.patCredTypeID,
                            patCredNo: source.personInfo && source.personInfo.patCredNo,
                            patBirthDate: source.personInfo ? moment(source.personInfo.patBirthDate, dayFormat) : '',
                            patNationID: source.personInfo && source.personInfo.patNationID,
                            patMobile: source.personInfo && source.personInfo.patMobile,
                            patCityID: source.personInfo && source.personInfo.nativeCityID,
                            patAreaID: source.personInfo && source.personInfo.nativeAreaID,
                            patAddress: source.personInfo && source.personInfo.nativeAddress,
                            patVillageID: source.personInfo && source.personInfo.nativeVillageID,
                            patProvinceID: source.personInfo && source.personInfo.nativeProvinceID,
                            receiveCityID: source.personInfo && source.personInfo.presentCityID,
                            receiveAreaID: source.personInfo && source.personInfo.presentAreaID,
                            receiveVillageID: source.personInfo && source.personInfo.presentVillageID,
                            receiveProvinceID: source.personInfo && source.personInfo.presentProvinceID,
                            receiveAddress: source.personInfo && source.personInfo.presentAddress,
                            patMaritalID: source.personInfo && source.personInfo.patMaritalID ? parseInt(source.personInfo.patMaritalID) : '',
                            patEduID: source.personInfo && !Util.isEmpty(source.personInfo.patEduID) ? parseInt(source.personInfo.patEduID) : '',
                            patOccupationID: source.personInfo && source.personInfo.patOccupationID ? parseInt(source.personInfo.patOccupationID) : '',
                            patCompany: source.personInfo && source.personInfo.patCompany,
                            payWayID: source.personInfo && source.personInfo.payWayID,
                            patInsuNo: source.personInfo && source.personInfo.patInsuNo,
                        })
                        editData = {
                            patName: source.personInfo && source.personInfo.patName,
                            patSexID: source.personInfo && source.personInfo.patSexID,
                            patAge: source.personInfo && source.personInfo.patAge,
                            patCredTypeID: source.personInfo && source.personInfo.patCredTypeID,
                            patCredNo: source.personInfo && source.personInfo.patCredNo,
                            patBirthDate: source.personInfo && source.personInfo.patBirthDate,
                            patNationID: source.personInfo && source.personInfo.patNationID,
                            patMobile: source.personInfo && source.personInfo.patMobile,
                            patCityID: source.personInfo && source.personInfo.nativeCityID,
                            patAreaID: source.personInfo && source.personInfo.nativeAreaID,
                            patAddress: source.personInfo && source.personInfo.nativeAddress,
                            patVillageID: source.personInfo && source.personInfo.nativeVillageID,
                            patProvinceID: source.personInfo && source.personInfo.nativeProvinceID,
                            receiveCityID: source.personInfo && source.personInfo.presentCityID,
                            receiveAreaID: source.personInfo && source.personInfo.presentAreaID,
                            receiveVillageID: source.personInfo && source.personInfo.presentVillageID,
                            receiveProvinceID: source.personInfo && source.personInfo.presentProvinceID,
                            receiveAddress: source.personInfo && source.personInfo.presentAddress,
                            patMaritalID: source.personInfo && source.personInfo.patMaritalID ? parseInt(source.personInfo.patMaritalID) : '',
                            patEduID: source.personInfo && source.personInfo.patEduID ? parseInt(source.personInfo.patEduID) : '',
                            patOccupationID: source.personInfo && source.personInfo.patOccupationID ? parseInt(source.personInfo.patOccupationID) : '',
                            patCompany: source.personInfo && source.personInfo.patCompany,
                            payWayID: source.personInfo && source.personInfo.payWayID,
                            patInsuNo: source.personInfo && source.personInfo.patInsuNo,
                            healthRecord: source.ohterInfo && source.ohterInfo.healthRecord,
                            radioCode: source.ohterInfo && source.ohterInfo.healthRecordCode,
                            signHospID: source.ohterInfo && source.ohterInfo.signHospID,
                            signDoctorID: source.ohterInfo && source.ohterInfo.signDoctorID,
                            family: source.familyInfo && source.familyInfo,
                        }
                        this.setState({
                            editData: editData,
                            filedStatus: true,
                            patCredNo: source.personInfo && source.personInfo.patCredNo,
                            patID: source.personInfo && source.personInfo.patID,
                            healthRecord: source.ohterInfo && source.ohterInfo.healthRecord,
                            radioCode: source.ohterInfo && source.ohterInfo.healthRecordCode,
                            signHospID: source.ohterInfo && source.ohterInfo.signHospID,
                            signDoctorID: source.ohterInfo && source.ohterInfo.signDoctorID,
                            family: source.familyInfo && source.familyInfo,
                        }, () => {
                            //处理联动数据
                            this.getProviceOther(this.state.editData && this.state.editData.patProvinceID)
                            this.getAreas(this.state.editData && this.state.editData.patCityID)
                            this.getVillages(this.state.editData && this.state.editData.patAreaID)
                            this.getProviceOtherNow(this.state.editData && this.state.editData.receiveProvinceID)
                            this.getVillagesNow(this.state.editData && this.state.editData.receiveAreaID)
                            this.getAreasNow(this.state.editData && this.state.editData.receiveCityID)
                            this.loadDoctorData(this.state.editData && this.state.editData.signHospID)
                        })
                    }
                }
            });
        }
    }

    loadEnterData(page, e) {
        if (e.keyCode == '13') {
            this.setState({//自动补0，渲染到组件中
                cardNo: this.state.replaceZero == 'Y' ? (Array(parseInt(this.state.cardLength)).join(0) + this.state.cardNo).slice(-parseInt(this.state.cardLength)) : this.state.cardNo
            })
        }
    }

    handleReadCard() {
        var cardType = this.state.carTypeDr ? this.state.carTypeDr : (this.state.cardStatus);
        this.readCard.ReadCard(cardType, "R", (json) => {
            this.setState({ readPatID: json && json.patInfo ? json.patInfo.patID : '', patCardNo: json.cardNo, readStatus: 'read' }, () => {
                // this.loadData()
            })
        })
    }

    addFamilyList() {
        this.state.family.push({ tabIndex: this.state.family.length + 1 })
        this.setState({})
    }

    //提交
    onSubmit() {
        let { validateFields } = this.props.form;
        validateFields({ force: true }, (err, params) => {
            if (err) {
                return;
            }
            // if (Util.isEmpty(this.state.radioCode)) {
            //     message.error('其他问题不能为空')
            //     return
            // }
            // if (Util.isEmpty(this.state.signHospID) || Util.isEmpty(this.state.signDoctorID)) {
            //     message.error('家庭医生团队不能为空')
            //     return
            // }
            var temp = this.state.family
            if (!Util.isEmpty(temp)) {
                for (var i = 0; i < temp.length; i++) {
                    if (Util.isEmpty(temp[i].relationID) && Util.isEmpty(temp[i].relaID)
                     || Util.isEmpty(temp[i].name) || Util.isEmpty(temp[i].phone) || Util.isEmpty(temp[i].sexID)) {
                        message.error('家庭成员必填信息不能为空')
                        return
                    }
                }
            }
            var dataSource = {
                userID: this.state.userData.userID,
                patID: this.state.patID ? this.state.patID : this.props.patID,
                ...params,
                addressInfo: [
                    {
                        addressTypeCode: "Native",
                        addressData: {
                            patProvinceID: params.patProvinceID,
                            patCityID: params.patCityID,
                            patAreaID: params.patAreaID,
                            patVillageID: params.patVillageID,
                            patAddress: params.patAddress,
                        }

                    },
                    {
                        addressTypeCode: "Present",
                        addressData: {
                            patProvinceID: params.receiveProvinceID,
                            patCityID: params.receiveCityID,
                            patAreaID: params.receiveAreaID,
                            patVillageID: params.receiveVillageID,
                            patAddress: params.receiveAddress,
                        }

                    }
                ],
                family: this.state.family,
                patBirthDate: params.patBirthDate ? moment(params.patBirthDate).format(dayFormat) :
                    (this.state.patBirthDate ? moment(this.state.patBirthDate).format(dayFormat) : ''),
                healthRecord: this.state.healthRecord,
                signHospID: this.state.signHospID || this.props.signHospID,
                signDoctorID: this.state.signDoctorID || this.props.signDoctorID,
            }
            let { onSubmit } = this.props;

            onSubmit && onSubmit(dataSource);
        });
    }

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

    handlePreview = async file => {
        if (!file.url && !file.preview) {
            file.preview = await getBase64(file.originFileObj);
        }

        this.setState({
            previewImage: file.url || file.preview,
            previewVisible: true,
        });
    };

    handleChange = ({ fileList }) => this.setState({ fileList });

    //获取健康档案
    loadHealthMsg() {
        var { healthMessage } = this.state;
        var healthMessageOption = []
        healthMessage && healthMessage[0].basicSub && healthMessage[0].basicSub.map((item, index) => {
            healthMessageOption.push(
                <div style={{ marginTop: 5 }}>
                    <Radio key={index} value={item.id} code={item.code}>{item.descripts}</Radio>
                </div>
            )
        })
        return healthMessageOption
    }

    onChangeRadio(e) {
        this.setState({
            healthRecord: e.target.value,
            radioCode: e.target.code
        })
    }

    //回车键校验录入病人信息
    checkMessage(e) {
        if (e.keyCode == '13') {
            //手机号码校验
            var idCard = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
            var cardNo = this.state.patCredNo;
            if (!Util.isEmpty(cardNo) && !idCard.test(cardNo) && this.props.form.getFieldValue('patCredTypeID') == '1') {
                message.error('身份证号码输入格式不正确，请重新输入')
                return
            }
            this.loadEditData(e, '1')
            this.getSex()
        }
    }

    onBlurMessage(e) {
        var idCard = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
        var cardNo = this.state.patCredNo;
        if (!Util.isEmpty(cardNo) && !idCard.test(cardNo) && this.props.form.getFieldValue('patCredTypeID') == '1') {
            message.error('身份证号码输入格式不正确，请重新输入')
            return
        }
        this.loadEditData(e, '1')
        this.getSex()
    }


    //获取性别
    getSex() {
        var { patCredNo, sex } = this.state;
        let sexno
        if (patCredNo && patCredNo.length == 18) {
            sexno = patCredNo.substring(16, 17)
        } else if (patCredNo && patCredNo.length == 15) {
            sexno = patCredNo.substring(14, 15)
        } else {
            return false
        }
        var boyID = '', girlID = ''
        if (!Util.isEmpty(sex)) {
            for (var i = 0; i < sex.length; i++) {
                if (sex[i].code == '2') {
                    boyID = sex[i].id
                } else if (sex[i].code == '1') {
                    girlID = sex[i].id
                }
            }
        }
        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)
        var date = moment(birthday).format(dayFormat)
        var tempid = sexno % 2;
        if (tempid == 0) {
            this.props.form.setFieldsValue({ patSexID: boyID, patBirthDate: moment(date, dayFormat) })
            this.setState({
                patSexID: boyID,
                patBirthDate: date
            }, () => {
                this.autoAge()
            })
        } else {
            this.props.form.setFieldsValue({ girlID: boyID, patBirthDate: moment(date, dayFormat) })
            this.setState({
                patSexID: girlID,
                patBirthDate: date
            }, () => {
                this.autoAge()
            })
        }
    }

    autoAge() {
        let data = {}
        data = {
            params: [{
                birthday: this.state.patBirthDate ? (moment(this.state.patBirthDate).format(dayFormat)) : undefined,
                hospID: this.state.userData.hospID,
            }],
        }
        if (this.state.patBirthDate && this.state.patBirthDate != "Invalid date") {
            $http.post('urlS', this, {
                code: '03030013',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.props.form.setFieldsValue({ patAge: res.result })
                        this.setState({
                            patAge: res.result
                        })
                    } else {

                    }
                }
            })
        } else {
            this.setState({
                patAge: undefined
            })
        }
    }

     //单选框反选
     commonInputRadio(name, e) {
        const value = e.target;
        if (value.type == 'radio' && this.state[name] == value.value) {
            this.setState({
                [name]: '',
                radioCode:'02'
            })
        }
    }

    render() {
        var { sex, previewImage, fileList, previewVisible } = this.state;
        let { getFieldDecorator } = this.props.form;
        let formItemLayout = {
            labelCol: { span: 8 },
            wrapperCol: { span: 15 }
        };

        let formItemSexLayout = {
            labelCol: { span: 8 },
            wrapperCol: { span: 22 }
        };

        let searchColConfig = {
            xs: { span: 24 },
            sm: { span: 12 },
            md: { span: 8 },
            lg: { span: 10 }
        }
        //性别
        var sexOption = []
        sex && sex.map((item, index) => {
            sexOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
        })

        //卡类型
        let cardTypeOption = []
        this.state.cardTypeData && this.state.cardTypeData.map((item, index) => {
            cardTypeOption.push(<Option key={index} value={item.id} code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        //证件类型
        let credTypeDataOption = []
        this.state.credTypeData && this.state.credTypeData.map((item, index) => {
            credTypeDataOption.push(<Option key={index} value={item.id} code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        //民族
        let nationDataOption = []
        this.state.nationData && this.state.nationData.map((item, index) => {
            nationDataOption.push(<Option key={index} value={item.id} code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        /**
         * occupationData: res.occupation,//职业
                        maritalData: res.marital,//婚姻
                        eduData: res.edu,//学历
         */
        //职业
        let occupationOption = []
        this.state.occupationData && this.state.occupationData.map((item, index) => {
            occupationOption.push(<Option key={index} value={item.id} name={item.descriptsSPCode} code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        //婚姻
        let maritalOption = []
        this.state.maritalData && this.state.maritalData.map((item, index) => {
            maritalOption.push(<Option key={index} value={item.id} code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        //学历
        let eduOption = []
        this.state.eduData && this.state.eduData.map((item, index) => {
            eduOption.push(<Option key={index} value={item.id} code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        //省
        let localProvinceOption = []
        this.state.localProvince && this.state.localProvince.map((item, index) => {
            localProvinceOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        //市
        let localCityOption = []
        this.state.localCity && this.state.localCity.map((item, index) => {
            localCityOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        //县
        let areaDataOption = []
        this.state.areaData && this.state.areaData.map((item, index) => {
            areaDataOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        //乡
        let villageDataOption = []
        this.state.villageData && this.state.villageData.map((item, index) => {
            villageDataOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        //现住省
        let localProvinceNowOption = []
        this.state.localProvinceNow && this.state.localProvinceNow.map((item, index) => {
            localProvinceNowOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        //现住市
        let localCityNowOption = []
        this.state.localCityNow && this.state.localCityNow.map((item, index) => {
            localCityNowOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        //现住县
        let areaDataNowOption = []
        this.state.areaDataNow && this.state.areaDataNow.map((item, index) => {
            areaDataNowOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        //现住乡
        let villageDataNowOption = []
        this.state.villageDataNow && this.state.villageDataNow.map((item, index) => {
            villageDataNowOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        //家庭医生团队
        let familyDoctorOption = []
        this.state.familyDoctor && this.state.familyDoctor[0].subHospList && this.state.familyDoctor[0].subHospList.map((item, index) => {
            familyDoctorOption.push(<Option key={index} value={item.hospID}>{item.hospDesc}</Option>)
        })
        //家庭医生
        let doctorDataOption = []
        this.state.doctorData && this.state.doctorData.map((item, index) => {
            doctorDataOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })
        //医疗支付
        let payWayOption = []
        this.state.payWay && this.state.payWay.map((item, index) => {
            payWayOption.push(<Option key={index} value={item.id} name={item.descripts}
                code={item.descriptsSPCode}>{item.descripts}</Option>)
        })

        const uploadButton = (
            <div>
                {/* <PlusOutlined /> */}
                <div className="ant-upload-text">上传</div>
            </div>
        );

        return <div>
            <Modal className='show-information-modal'
                title={'基本信息采集'}
                maskClosable={false}
                visible={this.props.isShow}
                onCancel={this.closeModal.bind(this)}
                // footer={null}
                onOk={this.onSubmit.bind(this)}>
                <Card title={<span>请完善基本信息，资料完善度低于100%不允许对居民进行健康管理</span>}
                    extra={<Progress percent={parseFloat(this.state.progressList) * 100 || 0} />}>
                    <Row>
                        <Col span={12}>
                            <span style={{ fontWeight: 'bold', color: '#333333' }}>卡类型：</span><Select style={{ width: '20%' }} placeholder='请选择卡类型'
                                allowClear showSearch
                                value={this.state.carTypeDr ? this.state.carTypeDr : (this.state.cardStatus)}
                                filterOption={(input, option) =>
                                    option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                    || option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                }
                                getPopupContainer={triggerNode => triggerNode.parentNode}
                                onChange={this.changeCardType.bind(this, 'carTypeDr')}>
                                {cardTypeOption}
                            </Select>
                            <Search className={this.state.readMode == 'R' ? 'disable-input-title' : ''}
                                placeholder={'请输入卡号或读卡'} style={{ width: '50%', marginLeft: 10 }}
                                onChange={Util.commonInputChange.bind(this, 'cardNo')}
                                value={this.state.cardNo}
                                enterButton={'读卡'}
                                readOnly={this.state.readMode == 'R' ? true : false}
                                onPressEnter={(e) => console.dir(e)}
                                onKeyDown={this.loadEnterData.bind(this, '1')}
                                onSearch={this.handleReadCard.bind(this)}
                            />
                        </Col>

                        <Col span={10}>
                            <span style={{ fontWeight: 'bold', color: '#333333' }}>人员标识：</span><Input onChange={Util.commonInputChange.bind(this, 'number')} allowClear={true}
                                onKeyDown={this.loadEditData.bind(this)} value={this.state.number}
                                placeholder='病人ID/身份证号码' style={{ width: '77%' }} />
                        </Col>
                    </Row>
                </Card>
                <Card style={{ marginTop: 5 }} title={<span>基本信息</span>}>
                    {/* <div style={{ display: 'flex' }}>
                        <div> 采集居民头像：</div>
                        <div style={{ marginLeft: 20 }}>
                            <Upload
                                action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
                                listType="picture-card"
                                onPreview={this.handlePreview}
                                onChange={this.handleChange}
                            >
                                {fileList.length >= 8 ? null : uploadButton}
                            </Upload>
                            <Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}>
                                <img alt="example" style={{ width: '100%' }} src={previewImage} />
                            </Modal></div>
                    </div> */}

                    <Form>
                        <Row>
                            <Col span={8}>
                                <FormItem {...formItemLayout} label="姓名">
                                    {getFieldDecorator('patName', {
                                        initialValue: Util.isEmpty(this.props.patName) ? undefined : this.props.patName,
                                        rules: [{ required: true, message: '姓名不能为空' }],
                                    })(
                                        <Input placeholder='请输入姓名' />
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="证件类型">
                                    {getFieldDecorator('patCredTypeID', {
                                        initialValue: Util.isEmpty(this.props.patCredTypeID) ? '1' : this.props.patCredTypeID,
                                        rules: [{ required: true, message: '证件类型不能为空' }],
                                    })(
                                        <Select placeholder='请选择证件类型' getPopupContainer={triggerNode => triggerNode.parentNode}
                                            showSearch allowClear
                                            filterOption={(input, option) =>
                                                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {credTypeDataOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="证件号码">
                                    {getFieldDecorator('patCredNo', {
                                        initialValue: Util.isEmpty(this.props.patCredNo) ? undefined : this.props.patCredNo,
                                        rules: [{ required: true, message: '证件号码不能为空' }],
                                    })(
                                        <Input placeholder='请输入证件号码' onKeyDown={this.checkMessage.bind(this)}
                                            onBlur={this.onBlurMessage.bind(this)}
                                            onChange={Util.commonInputChange.bind(this, 'patCredNo')} />
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="性别">
                                    {getFieldDecorator('patSexID', {
                                        initialValue: Util.isEmpty(this.props.patSexID) ? this.state.patSexID : this.props.patSexID,
                                        rules: [{ required: true, message: '性别不能为空' }],
                                    })(
                                        <Select placeholder='请选择性别' getPopupContainer={triggerNode => triggerNode.parentNode}
                                            allowClear>
                                            {sexOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="年龄">
                                    {getFieldDecorator('patAge', {
                                        initialValue: Util.isEmpty(this.props.patAge) ? this.state.patAge : this.props.patAge,
                                        rules: [{ required: true, message: '年龄不能为空' }],
                                    })(
                                        <Input placeholder='请输入年龄' />
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="出生日期">
                                    {getFieldDecorator('patBirthDate', {
                                        initialValue: Util.isEmpty(this.props.patBirthDate) ?
                                            (this.state.patBirthDate ? moment(this.state.patBirthDate, dayFormat) : '') : moment(this.props.patBirthDate, dayFormat),
                                        rules: [{ required: true, message: '出生日期不能为空' }],
                                    })(
                                        <DatePicker format={dayFormat} style={{ width: '100%' }} />
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="手机号码">
                                    {getFieldDecorator('patMobile', {
                                        initialValue: Util.isEmpty(this.props.patMobile) ? undefined : this.props.patMobile,
                                        rules: [{ required: true, message: '手机号码不能为空' },
                                        { pattern: /^[1-9]\d{10}$/, message: '请输入正确的手机号码' }],
                                    })(
                                        <Input placeholder='请输入手机号码' />
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="民族">
                                    {getFieldDecorator('patNationID', {
                                        initialValue: Util.isEmpty(this.props.patNationID) ? '1' : this.props.patNationID,
                                        rules: [{ required: true, message: '民族不能为空' }],
                                    })(
                                        <Select placeholder='请选择民族' getPopupContainer={triggerNode => triggerNode.parentNode}
                                            showSearch allowClear
                                            filterOption={(input, option) =>
                                                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {nationDataOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="婚姻状况">
                                    {getFieldDecorator('patMaritalID', {
                                        initialValue: Util.isEmpty(this.props.patMaritalID) ? undefined : this.props.patMaritalID,
                                        rules: [{ required: true, message: '婚姻状况不能为空' }],
                                    })(
                                        <Select placeholder='请选择婚姻状况' getPopupContainer={triggerNode => triggerNode.parentNode}
                                            showSearch allowClear
                                            filterOption={(input, option) =>
                                                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {maritalOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="文化程度">
                                    {getFieldDecorator('patEduID', {
                                        initialValue: Util.isEmpty(this.props.patEduID) ? undefined : this.props.patEduID,
                                        rules: [{ required: true, message: '文化程度不能为空' }],
                                    })(
                                        <Select placeholder='请选择文化程度' getPopupContainer={triggerNode => triggerNode.parentNode}
                                            showSearch allowClear
                                            filterOption={(input, option) =>
                                                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {eduOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="退休前职业">
                                    {getFieldDecorator('patOccupationID', {
                                        initialValue: Util.isEmpty(this.props.patOccupationID) ? undefined : this.props.patOccupationID,
                                        rules: [{ required: true, message: '退休前职业不能为空' }],
                                    })(
                                        <Select placeholder='请选择退休前职业' getPopupContainer={triggerNode => triggerNode.parentNode}
                                            showSearch allowClear
                                            filterOption={(input, option) =>
                                                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {occupationOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="退休前工作单位">
                                    {getFieldDecorator('patCompany', {
                                        initialValue: Util.isEmpty(this.props.patCompany) ? undefined : this.props.patCompany,
                                        rules: [{ required: true, message: '退休前工作单位不能为空' }],
                                    })(
                                        <Input placeholder='请输入退休前工作单位' />
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="医疗费支付方式">
                                    {getFieldDecorator('payWayID', {
                                        initialValue: Util.isEmpty(this.props.payWayID) ? undefined : this.props.payWayID,
                                        rules: [{ required: true, message: '医疗费用支付方式不能为空' }],
                                    })(
                                        <Select placeholder='请选择医疗费用支付方式' getPopupContainer={triggerNode => triggerNode.parentNode}
                                            showSearch allowClear
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {payWayOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={8}>
                                <FormItem {...formItemLayout} label="医保卡号">
                                    {getFieldDecorator('patInsuNo', {
                                        initialValue: Util.isEmpty(this.props.patInsuNo) ? undefined : this.props.patInsuNo,
                                        // rules: [{ required: true, message: '退休前工作单位不能为空' }],
                                    })(
                                        <Input placeholder='请输入医保卡号' />
                                    )}
                                </FormItem>
                            </Col>
                        </Row>

                        <Row>
                            <Col span={7}>
                                <FormItem {...formItemLayout} label="户籍地址">
                                    {getFieldDecorator('patProvinceID', {
                                        initialValue: Util.isEmpty(this.props.patProvinceID) ? undefined : this.props.patProvinceID,
                                        // rules: [{ required: true, message: '省市不能为空' }],
                                    })(
                                        <Select placeholder='请选择省市/其他' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            onChange={this.onProvinceChange.bind(this, "patProvinceID")}
                                            // value={this.state.patProvinceID}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {localProvinceOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={5}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('patCityID', {
                                        initialValue: Util.isEmpty(this.props.patCityID) ? undefined : this.props.patCityID,
                                        // rules: [{ required: true, message: '城市不能为空' }],
                                    })(
                                        <Select placeholder='请选择城市' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            // value={this.state.receiveCityID}
                                            onChange={this.changeReceiveCity.bind(this, 'patCityID')}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {localCityOption}</Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={5}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('patAreaID', {
                                        initialValue: Util.isEmpty(this.props.patAreaID) ? undefined : this.props.patAreaID,
                                        // rules: [{ required: true, message: '区/县不能为空' }],
                                    })(
                                        <Select placeholder='请选择区/县' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            // value={this.state.receiveAreaID}
                                            onChange={this.changeAreaCity.bind(this, 'patAreaID')}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {areaDataOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={5}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('patVillageID', {
                                        initialValue: Util.isEmpty(this.props.patVillageID) ? undefined : this.props.patVillageID,
                                        // rules: [{ required: true, message: '乡/镇不能为空' }],
                                    })(
                                        <Select placeholder='请选乡/镇' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            // value={this.state.receiveVillageID}
                                            onChange={this.changeVillageCity.bind(this, 'patVillageID')}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {villageDataOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={21}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('patAddress', {
                                        initialValue: Util.isEmpty(this.props.patAddress) ? undefined : this.props.patAddress,
                                        rules: [{ required: true, message: '详细地址不能为空' }],
                                    })(
                                        <TextArea rows={1} style={{ marginLeft: '12%' }} placeholder='请输入具体的地址，无需重复填写省市县乡信息' />
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={7}>
                                <FormItem {...formItemLayout} label="现住址">
                                    {getFieldDecorator('receiveProvinceID', {
                                        initialValue: this.state.receiveProvinceID ? undefined : this.props.receiveProvinceID,
                                        // rules: [{ required: true, message: '省市不能为空' }],
                                    })(
                                        <Select placeholder='请选择省市/其他' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            onChange={this.onProvinceChangeNow.bind(this, "receiveProvinceID")}
                                            // value={this.state.receiveProvinceID}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {localProvinceNowOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={5}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('receiveCityID', {
                                        initialValue: Util.isEmpty(this.props.receiveCityID) ? undefined : this.props.receiveCityID,
                                        // rules: [{ required: true, message: '城市不能为空' }],
                                    })(
                                        <Select placeholder='请选择城市' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            // value={this.state.receiveCityID}
                                            onChange={this.changeNowReceiveCity.bind(this, 'receiveCityID')}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {localCityNowOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={5}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('receiveAreaID', {
                                        initialValue: Util.isEmpty(this.props.receiveAreaID) ? undefined : this.props.receiveAreaID,
                                        // rules: [{ required: true, message: '区/县不能为空' }],
                                    })(
                                        <Select placeholder='请选择区/县' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            // value={this.state.receiveAreaID}
                                            onChange={this.changeNowAreaCity.bind(this, 'receiveAreaID')}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {areaDataNowOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={5}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('receiveVillageID', {
                                        initialValue: Util.isEmpty(this.props.receiveVillageID) ? undefined : this.props.receiveVillageID,
                                        // rules: [{ required: true, message: '乡/镇不能为空' }],
                                    })(
                                        <Select placeholder='请选乡/镇' getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                                            // value={this.state.receiveVillageID}
                                            onChange={this.changeNowVillageCity.bind(this, 'receiveVillageID')}
                                            filterOption={(input, option) =>
                                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                            }>
                                            {villageDataNowOption}
                                        </Select>
                                    )}
                                </FormItem>
                            </Col>

                            <Col span={21}>
                                <FormItem {...formItemSexLayout}>
                                    {getFieldDecorator('receiveAddress', {
                                        initialValue: Util.isEmpty(this.props.receiveAddress) ? undefined : this.props.receiveAddress,
                                        rules: [{ required: true, message: '详细地址不能为空' }],
                                    })(
                                        <TextArea rows={1} style={{ marginLeft: '12%' }} placeholder='请输入具体的地址，无需重复填写省市县乡信息' />
                                    )}
                                </FormItem>
                            </Col>
                        </Row>
                    </Form>
                </Card>

                <Card style={{ marginTop: 5 }} title={<span>家庭成员信息</span>}
                    extra={<Button size='small' style={{ marginLeft: '65%' }}
                        onClick={this.addFamilyList.bind(this)}>添加</Button>}>
                    <Table columns={this.columns}
                        dataSource={this.state.family}
                        bordered
                        rowKey={(data) => {
                            return data.regID
                        }}
                        scroll={{ y: '7vh' }}
                        pagination={false}>
                    </Table>
                </Card>

                {/* <Card style={{ marginTop: 5 }} title={<span>其他</span>}>
                    <div><span className='shuld-choose-btn'>*</span>
                        <span style={{ fontWeight: 'bold', color: '#333333' }}>{this.state.healthMessage && this.state.healthMessage[0].descripts || '--'}</span></div>
                    <div onClick={this.commonInputRadio.bind(this,'healthRecord')}>
                    <Radio.Group onChange={this.onChangeRadio.bind(this)} //value={this.state.healthRecord}
                        value={this.state.healthRecord ? this.state.healthRecord : this.props.healthRecord}>
                        {this.loadHealthMsg()}
                    </Radio.Group>
                    </div>

                    {this.state.radioCode == '01' ? <div style={{ marginTop: 5 }}>
                        <span className='shuld-choose-btn'>*</span>
                    签约医生：<Select style={{ width: '200px' }} placeholder='请选择医生团队'
                            onChange={this.changeCommonData.bind(this, 'signHospID')}
                            // value={this.state.signHospID}
                            value={this.state.signHospID ? this.state.signHospID : this.props.signHospID}
                            getPopupContainer={triggerNode => triggerNode.parentNode} allowClear>
                            {familyDoctorOption}
                        </Select>
                        <Select style={{ width: '200px', marginLeft: 10 }} placeholder='请选择医生'
                            onChange={Util.handleSelectChange.bind(this, 'signDoctorID')}
                            // value={this.state.signDoctorID}
                            value={this.state.signDoctorID ? this.state.signDoctorID : this.props.signDoctorID}
                            getPopupContainer={triggerNode => triggerNode.parentNode} allowClear showSearch
                            filterOption={(input, option) =>
                                option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
                            }>
                            {doctorDataOption}
                        </Select>
                    </div> : null}
                </Card> */}
            </Modal></div>
    }
}

export default Form.create()(ShowInformationModal);