import React from 'react'
import { Modal } from 'antd';
import PatientCourse from './PatientCourse.jsx'
import './style/style.less';

class PatientCourseInfo extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            visible: false, // 弹框显示状
            admID: '',
        }
    }

    componentDidMount() {
        this.props.onRef(this);
    }

    showModal = (admID, patID) => {
        let that = this;
        this.setState({
            visible: true,
            admID: admID,
            patID: patID,
        }, () => {
            if (that.child) {
                this.child.loadPatienCourse();
            }
        });
    };

    close = (e) => {
        this.setState({
            visible: false,
        });
    };

    onRef = (ref) => {
        this.child = ref;
    };

    render() {
        return (
            <Modal
                title="患者历程"
                className="PatientCourse"
                visible={this.state.visible}
                onCancel={this.close}
                footer={null}
            >
                <PatientCourse onRef={this.onRef} admID={this.state.admID} patID={this.state.patID}></PatientCourse>
            </Modal>
        )
    }
};

export default PatientCourseInfo;