/**
 * 分娩记录
 */

import React from 'react';
import { Card, Form, Row, Col, DatePicker, Button, Input, Select, InputNumber, message, TimePicker, Popconfirm } from 'antd';
import PatientInfo from '../Patient/PatientInfo';
import { $http } from '../../../containers/config/https';
import Moment from 'moment';
import { Util } from 'tools/index';
import './style/index.less';


let userData ;
let initAdmID, patID;
const FormItem = Form.Item;
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 7 },
    wrapperCol: { span: 17 },
};
const formItemInputLayout = {    // label 和input宽度
    labelCol: { span: 9 },
    wrapperCol: { span: 15 },
};
const formItemLayoutApgar = {    // label 和input宽度
    labelCol: { span: 5 },
    wrapperCol: { span: 14 },
};

const formItemLayoutApgarTime = {    // label 和input宽度
    labelCol: { span: 5 },
    wrapperCol: { span: 14 },
};

const ChildbirthRecord = Form.create()(
    class extends React.Component {
        constructor(props) {
            super(props);
            let patientData = {};
            if (window.sessionStorage.patientData) {
              patientData = JSON.parse(window.sessionStorage.patientData);
            }
            initAdmID = patientData.admID ? patientData.admID : '';
            patID = patientData.admID ? patientData.patID : '';
            userData = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
            this.state = {
                childbirthSeqNo: 0,
                childbirthNumber: 0,
                childbirth: [],
                admID: initAdmID,
                childbirthMethod: [],
                childbirthResult: [],
                sexAry: [],
                locDoctorList: [],
                apgarItemTime: [], //Apgar评分列数
                defaultBaby: '0',
                newBabyFlag: false, //新增婴儿标志
                saveBtnFlag: false, //保存按钮状态
                refs: {},   // 动态创建ref用
            }
        }

        componentDidMount() {
            this.initResource();
            this.languageSwitch();
        }
        // 中英文切换
		languageSwitch = () => {
			let data = {
				params: [{
					reactCode: ['ChildbirthRecord']
				}]
			}
			$http.post('urlS', this, {
				code: '01040073',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						let refs={};
						for (let i in res.result.language.CN) {
							if (res.result.language.CN[i].focusIndex != '') {
								let focusIndex = parseInt(res.result.language.CN[i].focusIndex);
								let ref = React.createRef();
								refs["ref" + focusIndex]=ref;
							}
						}
						this.setState({
							refs,
							EN: res.result.language.EN,
							CN: res.result.language.CN,
							refFalg: true,
						});
					}
				}
			})
		}
		display(name) {
			return userData.language != 'EN' ? (this.state.CN['ChildbirthRecord' + name] && this.state.CN['ChildbirthRecord' + name]['descripts'] ? this.state.CN['ChildbirthRecord' + name]['descripts'] : '') : (this.state.CN['ChildbirthRecord' + name] && this.state.EN['ChildbirthRecord' + name]['descripts'] ? this.state.EN['ChildbirthRecord' + name]['descripts'] : '')
		}
		getIndex(name) {
			return this.state.CN['ChildbirthRecord' + name] ? this.state.CN['ChildbirthRecord' + name]['focusIndex'] : '';
		}
		// 获取焦点
		changeFocus = (num) => {
			setTimeout(() => {
				this.state.refs['ref' + (parseInt(num) + 1)].current.focus();
			}, 300)
        }
        // 日期时间组件获取焦点
        changeFocusDT = (num,val,str) => {
            setTimeout(() => {
				this.state.refs['ref' + (parseInt(num) + 1)].current.focus();
			}, 300)
        }
        initResource = () => {
            let data = {
                params: [{
                }]
            }
            $http.post('urlS', this, {
                code: '04110010',
                data: data,
                success: function (res) {
                    let errorCode = res.errorCode;
                    if (errorCode === '0') {
                        this.setState({
                            apgarItem: res.result.apgarItem,
                            apgarItemTime: res.result.apgarItemTime,
                            childbirthMethod: res.result.childbirthMethod,
                            childbirthResult: res.result.childbirthResult,
                            locDoctorList: res.result.locDoctorList,
                            sexAry: res.result.sexAry,
                        }, () => {
                            this.handleQuery(initAdmID);
                        })
                    }
                }
            })
        }

        //初始化婴儿数据及下拉框数据
        handleQuery = (amdID) => {
            this.props.form.resetFields();
            this.setState({ saveBtnFlag: false })
            let data = {
                params: [{
                    admID: amdID,
                    power: "childbirthRecord"
                }]
            }
            $http.post('urlS', this, {
                code: '04110005',
                data: data,
                success: function (res) {
                    let errorCode = res.errorCode;
                    if (errorCode === '0') {
                        this.setState({
                            childbirthNumber: res.result.TotalCount,
                            childbirth: res.result.Data,
                            // newBabyFlag: res.result.TotalCount > 0 ? false : true,
                        },() => {
                            // 无分娩记录时，默认跳转到新建界面
                            if (res.result.TotalCount == 0) this.newBabyBtnChange();
                        })
                    }else{
                        this.setState({
                            saveBtnFlag:true,
                        })
                    }
                }
            })
        }
        //切换婴儿信息
        babyBtnChange = (e) => {
            this.props.form.resetFields();
            this.setState({
                defaultBaby: e.target.value,
                newBabyFlag: false,
            });
        }

        //新增婴儿信息
        newBabyBtnChange = () => {
            this.props.form.resetFields();
            this.setState({
                newBabyFlag: true,
                defaultBaby: ''
            });
        }
        //删除新生儿
        RemoveChildbirthRecord = () => {
            let data = {
                params: [{
                    birthRecordID: this.state.childbirth[this.state.defaultBaby].birthRecordID,
                }]
            }
            $http.post('urlADS', this, {
                code: '04110018',
                data: data,
                success: function (res) {
                    if (res.errorCode === "0") {
                        message.success('成功');
                        this.setState({
                            defaultBaby: 0
                        }, () => {
                            this.handleQuery(initAdmID)
                        })
                    }
                }
            })
        }

        //保存婴儿信息
        saveChildbirthRecord = () => {
            this.setState({ saveBtnFlag: true })
            const formData = this.props.form.getFieldsValue();
            // console.dir(formData)
            let babyApgarItem = {}
            //Apagr评分数据对象封装
            Object.getOwnPropertyNames(formData).forEach((val, idx, array) => {
                if ((val.indexOf('@') != -1) && (formData[val] != undefined) && (formData[val] != "")) {
                    let timeID = val.split('@')[0]
                    //总分
                    if (timeID.indexOf('!') != -1) {
                        let timeID = val.split('!')[0]
                        if (babyApgarItem.hasOwnProperty(timeID)) {
                            babyApgarItem[timeID].totalScore = formData[val]
                        } else {
                            let item = {}
                            item.totalScore = formData[val]
                            babyApgarItem[timeID] = item
                        }
                        //增加婴儿Apgar评分主表ID用来区分更新还是修改
                        if (!this.state.newBabyFlag) {
                            let babyApgarID = this.state.childbirth[this.state.defaultBaby].babyApgar[timeID]
                            babyApgarItem[timeID].babyApgarID = babyApgarID === undefined ? '' : babyApgarID
                        }
                    } else {
                        //详细评分项目
                        if (babyApgarItem.hasOwnProperty(timeID)) {
                            babyApgarItem[timeID].babyApgarDetail.push(formData[val])
                        } else {
                            let item = {}
                            let itemAry = [formData[val]]
                            item.babyApgarDetail = itemAry
                            babyApgarItem[timeID] = item
                        }
                    }

                }

            });
            // console.log(babyApgarItem)
            let data = {
                params: [{
                    type: this.state.newBabyFlag ? 'insert' : 'update',
                    childPatID: this.state.newBabyFlag ? '' : this.state.childbirth[this.state.defaultBaby].childPatID,
                    birthRecordID: this.state.newBabyFlag ? '' : this.state.childbirth[this.state.defaultBaby].birthRecordID,
                    hospID: userData.hospID,
                    patID: patID,
                    admID: initAdmID,
                    childbirthDate: formData.childbirthDate ? Moment(formData.childbirthDate).utcOffset(480).format('YYYY-MM-DD') : '',
                    childbirthTime: formData.childbirthTime ? Moment(formData.childbirthTime).format('HH:mm:ss') : '',
                    childPatName: formData.childPatName ? formData.childPatName : '',
                    childbirthMethodID: formData.childbirthMethodDesc ? formData.childbirthMethodDesc : '',
                    childbirthResultID: formData.childbirthResultDesc ? formData.childbirthResultDesc : '',
                    childbirthSexID: formData.childbirthSexDesc ? formData.childbirthSexDesc : '',
                    childbirthWeight: formData.childbirthWeight ? formData.childbirthWeight : '',
                    childbirthHeight: formData.childbirthHeight ? formData.childbirthHeight : '',
                    childHeadCircumference: formData.childHeadCircumference ? formData.childHeadCircumference : '',
                    childbirthUserID: formData.childbirthUserDesc ? formData.childbirthUserDesc : '',
                    babyApgar: babyApgarItem,
                    updateUserID: userData.userID,
                }],
            };
            $http.post('urlADS', this, {
                code: '04110004',
                data: data,
                success: (res) => {
                    // console.dir(res);
                    if (res.errorCode === "0") {
                        message.success('成功');
                        this.handleQuery(initAdmID)
                        if (this.state.childbirth.length > 0) {
                            let defaultBaby
                            //新增成功后定位到最新一条记录
                            if (this.state.newBabyFlag) {
                                defaultBaby = this.state.childbirth.length
                            } else {
                                //修改定位到当前
                                defaultBaby = this.state.defaultBaby
                            }
                            this.setState({
                                defaultBaby: defaultBaby,
                                saveBtnFlag: false,
                                newBabyFlag: false,
                            },()=>{
                                this.handleQuery(initAdmID);
                            })
                        }
                    } else {
                        this.setState({ saveBtnFlag: false })
                    }
                },
                error: (res) => {
                    this.setState({ saveBtnFlag: false })
                }
            });
        }

        apgarSelectChange = (e, option) => {
            if (!Util.isEmpty(e)) {
                let itemID = option.props.itemID
                let selectCode = option.props.selectcode
                let selectName = option.props.selectname
                let selectScore = option.props.selectscore
                let total = 0
                for (let i = 0; i < this.state.apgarItem.length; i++) {
                    //取该列所有已选下拉框所选择的ID
                    let checkOptionID = this.props.form.getFieldValue(itemID + "@" + this.state.apgarItem[i].code)
                    //过滤无选择项目
                    if (!checkOptionID) continue
                    //过滤当前正在选择项目
                    if (selectCode == this.state.apgarItem[i].code) continue
                    let apgarDetail = this.state.apgarItem[i].apgarDetail
                    for (let j = 0; j < apgarDetail.length; j++) {
                        if (apgarDetail[j].id === checkOptionID) {
                            total = total + apgarDetail[j].score
                        }

                    }
                }
                //为当前正在选择项目赋值
                this.props.form.setFieldsValue({ [selectName]: option.key })
                // console.log(total)
                this.props.form.setFieldsValue({
                    [itemID + '!@totalScore']: total + selectScore,
                })
            }
        }

        render() {
            const { getFieldDecorator } = this.props.form;
            let defaultChild = this.state.childbirth.length > 0 ? this.state.childbirth[this.state.defaultBaby] : {};
            if (this.state.newBabyFlag) { defaultChild = {} }
            return (
                <div className='childbirth-record-body'
                >
                    <Row style={{ borderBottom: "1px solid #cccccc", height: "15%", height: '48px', textAlign: 'left', lineHeight: '48px' }}>
                        <PatientInfo ref="PatientInfo" admID={this.state.admID} />
                    </Row>
                    <Card title="分娩记录" className='childbirth-record-btn'>
                        {this.state.childbirthNumber !== 0 ? (<span>
                            {this.state.childbirth.map(
                                (item, index) => {
                                    return (<Button className='childbirth-record-child' shape='circle' size='large' type='primary'
                                        key={item.birthRecordID}
                                        value={index}
                                        onClick={this.babyBtnChange}
                                        style={{
                                            background: (this.state.defaultBaby !== "") && (this.state.defaultBaby == index) ? "#409EFF" : "#64a982",
                                        }}
                                    >
                                        {item.childPatName}</Button>)
                                }
                            )}
                        </span>
                        ) : null}
                        {this.state.newBabyFlag ? (
                            <Button className='childbirth-record-child' shape='circle' size='large' type='primary'
                                style={{ background: "#409EFF" }}
                            >
                            </Button>
                        ) : null}
                        <Button id='childbirth-record-newBtn' className='childbirth-record-child' shape='circle' size='large'
                            onClick={this.newBabyBtnChange}
                        >+</Button>
                    </Card>
                    {this.state.refFalg ? (<div>
                        <Card title={this.display('BasicInformation')} className='childbirth-record-btn'>
                            <Row>
                                <Form>
                                    <Row>
                                        <Col span={4}>
                                            <FormItem {...formItemInputLayout} label={this.display('DateOfBirth')}>
                                                {getFieldDecorator('childbirthDate', {
                                                    initialValue: Util.isEmpty(defaultChild) ? Moment(Moment().format('L'), 'YYYY-MM-DD') : Moment(defaultChild.childbirthDate, 'YYYY-MM-DD'),
                                                    rules: [{ required: true }]
                                                })(
                                                    <DatePicker style={{ width: '100%' }} 
                                                    ref={this.state.refs['ref' + this.getIndex('DateOfBirth')]}
													onChange={this.changeFocusDT.bind(this,this.getIndex('DateOfBirth'))}/>
                                                )
                                                }
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemInputLayout} label={this.display('TimeOfBirth')}>
                                                {getFieldDecorator('childbirthTime', {
                                                    initialValue: Util.isEmpty(defaultChild) ? Moment(new Date(), 'HH:mm:ss') : Moment(defaultChild.childbirthTime, 'HH:mm:ss'),
                                                    rules: [{ required: true }]
                                                })(
                                                    <TimePicker style={{ width: '100%' }} 
                                                    ref={this.state.refs['ref' + this.getIndex('TimeOfBirth')]}
													onChange={this.changeFocusDT.bind(this,this.getIndex('TimeOfBirth'))}/>
                                                )
                                                }
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemInputLayout} label={this.display('Name')}
                                                required={true}
                                            >
                                                {getFieldDecorator('childPatName', {
                                                    initialValue: Util.isEmpty(defaultChild) ? undefined : defaultChild.childPatName,
                                                })(
                                                    <Input 
                                                    ref={this.state.refs['ref' + this.getIndex('Name')]}
													onPressEnter={() => this.changeFocus(this.getIndex('Name'))}/>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemLayout} label={this.display('DeliveryMethod')} required={true}>
                                                {getFieldDecorator('childbirthMethodDesc', {
                                                    initialValue: Util.isEmpty(defaultChild) ? undefined : defaultChild.childbirthMethodID,
                                                })(
                                                    <Select
                                                        allowClear
                                                        showSearch
                                                        optionFilterProp='role'
                                                        ref={this.state.refs['ref' + this.getIndex('DeliveryMethod')]}
													    onSelect={() => this.changeFocus(this.getIndex('DeliveryMethod'))}
                                                    >
                                                        {this.state.childbirthMethod.map(data => (
                                                            <Select.Option
                                                                role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                                                key={data.id}                                                                
                                                            >
                                                                {data.descripts}
                                                            </Select.Option>
                                                        ))}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemLayout} label={this.display('DeliveryResults')} required={true}>
                                                {getFieldDecorator('childbirthResultDesc', {
                                                    initialValue: Util.isEmpty(defaultChild) ? undefined : defaultChild.childbirthResultID,
                                                })(
                                                    <Select
                                                        showSearch
                                                        optionFilterProp='role'
                                                        ref={this.state.refs['ref' + this.getIndex('DeliveryResults')]}
													    onSelect={() => this.changeFocus(this.getIndex('DeliveryResults'))}
                                                    >
                                                        {this.state.childbirthResult.map(data => (
                                                            <Select.Option
                                                                role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                                                key={data.id}
                                                                disabled={Util.isEmpty(defaultChild) ? false : true}
                                                            >
                                                                {data.descripts}
                                                            </Select.Option>
                                                        ))}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemLayout} label={this.display('Sex')} required={true}>
                                                {getFieldDecorator('childbirthSexDesc', {
                                                    initialValue: Util.isEmpty(defaultChild) ? undefined : defaultChild.childbirthSexID,
                                                })(
                                                    <Select
                                                        allowClear
                                                        showSearch
                                                        optionFilterProp='role'
                                                        ref={this.state.refs['ref' + this.getIndex('Sex')]}
													    onSelect={() => this.changeFocus(this.getIndex('Sex'))}
                                                    >
                                                        {this.state.sexAry.map(data => (
                                                            <Select.Option
                                                                role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                                                key={data.id}
                                                            >
                                                                {data.descripts}
                                                            </Select.Option>
                                                        ))}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                    </Row>
                                    <Row>
                                        <Col span={4}>
                                            <FormItem {...formItemInputLayout} label={this.display('Weight')}>
                                                {getFieldDecorator('childbirthWeight', {
                                                    rules: [{ required: false, message: '' },
                                                    { pattern: new RegExp(/^(0|[1-9][0-9]*)(\.\d+)?$/), message: '请输入正确的体重' }],
                                                    initialValue: Util.isEmpty(defaultChild) ? '' : defaultChild.childbirthWeight,
                                                    getValueFromEvent: (event) => {
                                                        return event.target.value.replace(/[^\d|.]/g, '')
                                                    },
                                                })(
                                                    <Input ref={this.state.refs['ref' + this.getIndex('Weight')]}
                                                    onPressEnter={() => this.changeFocus(this.getIndex('Weight'))}/>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemInputLayout} label={this.display('Height')}>
                                                {getFieldDecorator('childbirthHeight', {
                                                    initialValue: Util.isEmpty(defaultChild) ? '' : defaultChild.childbirthHeight,
                                                    getValueFromEvent: (event) => {
                                                        return event.target.value.replace(/^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$/, '')
                                                    },
                                                })(
                                                    <Input ref={this.state.refs['ref' + this.getIndex('Height')]}
                                                    onPressEnter={() => this.changeFocus(this.getIndex('Height'))}/>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemInputLayout} label={this.display('HeadCircumference')}>
                                                {getFieldDecorator('childHeadCircumference', {
                                                    initialValue: Util.isEmpty(defaultChild) ? '' : defaultChild.childHeadCircumference,
                                                    getValueFromEvent: (event) => {
                                                        return event.target.value.replace(/[^0-9]/g, '')
                                                    },
                                                })(
                                                    <Input ref={this.state.refs['ref' + this.getIndex('HeadCircumference')]}
                                                    onPressEnter={() => this.changeFocus(this.getIndex('HeadCircumference'))}/>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemLayout} label={this.display('ChildbirthDoctor')} required={true}>
                                                {getFieldDecorator('childbirthUserDesc', {
                                                    initialValue: Util.isEmpty(defaultChild) ? undefined : defaultChild.childbirthUserID,
                                                })(
                                                    <Select
                                                        allowClear
                                                        showSearch
                                                        optionFilterProp='role'
                                                        ref={this.state.refs['ref' + this.getIndex('ChildbirthDoctor')]}
                                                        onSelect={() => this.changeFocus(this.getIndex('ChildbirthDoctor'))}
                                                    >
                                                        {this.state.locDoctorList.map(data => (
                                                            <Select.Option
                                                                role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                                                key={data.id}
                                                            >
                                                                {data.descripts}
                                                            </Select.Option>
                                                        ))}
                                                    </Select>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={4}>
                                            <FormItem {...formItemLayout} label={this.display('Order')}>
                                                {getFieldDecorator('count', {
                                                    initialValue: Util.isEmpty(defaultChild) ? undefined : defaultChild.count,
                                                })(
                                                    <InputNumber
                                                        style={{ width: '100%' }} 
                                                        ref={this.state.refs['ref' + this.getIndex('Order')]}
                                                        // onPressEnter={() => this.changeFocus(this.getIndex('Order'))}
                                                    />
                                                )}
                                            </FormItem>
                                        </Col>
                                    </Row>
                                </Form>
                            </Row>
                        </Card>
                        <Card title={this.display('Apgar')} className='childbirth-record-Apgar'>
                            <Row>
                                <Form layout='vertical'>
                                    {
                                        this.state.apgarItemTime.length > 0 ? (
                                            this.state.apgarItemTime.map(
                                                (item, index) => {
                                                    const spanSize = parseInt(24 / this.state.apgarItemTime.length);
                                                    let apg = Util.isEmpty(defaultChild) ? {} : defaultChild.babyApgar[item.id];
                                                    let apgarTotalScore = ''
                                                    if (!Util.isEmpty(defaultChild)) {
                                                        if (!Util.isEmpty(defaultChild.babyApgar[item.id])) { apgarTotalScore = defaultChild.babyApgar[item.id].apgarTotalScore }
                                                    }
                                                    return (
                                                        <Col span={spanSize} key={index}>
                                                            <FormItem {...formItemLayoutApgarTime}>
                                                                {getFieldDecorator('bornMinute', {
                                                                    initialValue: item.id,
                                                                })(
                                                                    <span style={{ marginLeft: '50px' }}>{item.descripts}</span>
                                                                )}
                                                            </FormItem>
                                                            {
                                                                this.state.apgarItem ? (
                                                                    this.state.apgarItem.map(
                                                                        (apgarItem, itemIndex) => {
                                                                            return <FormItem {...formItemLayoutApgar} label={apgarItem.descripts + " : "}
                                                                                key={itemIndex}>
                                                                                {getFieldDecorator(item.id + "@" + apgarItem.code, {
                                                                                    initialValue: Util.isEmpty(apg) ? undefined : apg.babyApgarDetail[apgarItem.id],
                                                                                })(
                                                                                    <Select
                                                                                        showSearch
                                                                                        optionFilterProp='role'
                                                                                        onChange={this.apgarSelectChange}
                                                                                    >
                                                                                        {apgarItem.apgarDetail.map(data => (
                                                                                            <Select.Option
                                                                                                role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                                                                                key={data.id}
                                                                                                selectcode={apgarItem.code}
                                                                                                selectname={item.id + "@" + apgarItem.code}
                                                                                                selectscore={data.score}
                                                                                                itemID={item.id}
                                                                                                style={{
                                                                                                    height: '30px'
                                                                                                }}
                                                                                            >
                                                                                                {data.descripts}
                                                                                            </Select.Option>
                                                                                        ))}
                                                                                    </Select>
                                                                                )}
                                                                            </FormItem>
                                                                        }
                                                                    )
                                                                ) : null
                                                            }
                                                            <FormItem {...formItemLayoutApgarTime} label='总分'>
                                                                {getFieldDecorator(item.id + '!@totalScore', {
                                                                    initialValue: apgarTotalScore,
                                                                })(
                                                                    <Input disabled={true} />
                                                                )}
                                                            </FormItem>
                                                        </Col>
                                                    )
                                                })
                                        ) : null
                                    }
                                </Form>
                            </Row>
                            <Row >
                                <Col span={8} offset={8}>
                                    <Button type="primary" style={{ marginLeft: '10px' }}
                                        disabled={this.state.saveBtnFlag}
                                        onClick={this.saveChildbirthRecord}
                                    >
                                        {(this.state.newBabyFlag|| Util.isEmpty(defaultChild)) ? '保存' : '修改'}</Button>
                                    {(this.state.newBabyFlag|| Util.isEmpty(defaultChild)) ? null : (
                                        <Popconfirm title="删除不可恢复，你确定要删除吗?" onConfirm={this.RemoveChildbirthRecord} >
                                            <Button type="primary" style={{ marginLeft: '200px' }}
                                            >删除</Button>
                                        </Popconfirm>
                                    )}
                                </Col>
                            </Row>
                        </Card>
                    </div>) : ''}
                </div>
            )
        }

    }
)
export default ChildbirthRecord;

