//会诊处理
import React from 'react';
import { Card, Row, Col, Form, DatePicker, Select, Input, Button, Checkbox, Table, Switch, message, Pagination } from 'antd';
import { $http } from 'containers/config/https';
import Moment from 'moment';
import store from 'store';
import ConsultationProcessleft from './ConsultationProcessleft.jsx';
import ConsultationProcessCenter from './ConsultationProcessCenter.jsx';
import ConsultationProcessright from './ConsultationProcessright.jsx';
// import './ConsultationProcess.less';


const { Option } = Select;

const ConsultationProcess = Form.create()(
    class extends React.Component {
        constructor(props) {
            super(props);
            this.state = {
                leftspan: 5,
                centerspan: 19,
                rightspan: 5,
                iconType: "menu-fold",
                patient: [],
                sheet: {},
                reload: false,
                rightDatas: {},
                type: 'applyList',
                eventCenterToLeft: false
            }

        }
        componentDidMount() {

        }
        onChangeType = (type, callback) => {
            this.setState({ type }, () => {
                callback && callback();
            });
            //初始化center组件数据
            if (this.child) this.child.initConsultationInfo();
        }
        onBtnClick = () => {
            this.setState({
                leftspan: 5 - this.state.leftspan,
            });
        }
        onClose = () => {
            this.setState({
                visible: true,
            });
        }

        componentWillUnmount() {
            this.setState = (state, callback) => {
                return
            }
        }
        // 调用公共组件的连接事件
        onRef = (ref) => {
            this.load = ref
        }
        // 调用公共组件的连接事件
        onRightRef = (ref) => {
            this.RightChild = ref
        }
        // 调用公共组件的连接事件
        loadData = (ref) => {
            this.child = ref
        }
        loadinit = (data) => {
            this.child.getConsultationInfo(data);
        }
        consultationInfoListData = (data) => {
            this.setState({ rightDatas: data })
        }
    
        centerChangeSave = () => {
            this.setState({
                eventCenterToLeft: !eventCenterToLeft
            })
        }
         

        render() {
            return (
                <div style={{ width: '100%', height: '100%' }}>
                    <Row style={{ height: "100%", width: "100%" }}>
                        <Col span={this.state.leftspan} style={{ border: "1px solid #cccccc", height: "100%" ,overflow:'hidden'}}>
                            <Row style={{height:'100%'}}>
                                <ConsultationProcessleft
                                    handThis={this.loadinit}
                                    onRef={this.onRef}
                                    onChangeType={this.onChangeType}
                                    eventLeft={this.state.eventCenterToLeft}
                                    type={this.state.type} />
                            </Row>
                        </Col>
                        <Col span={this.state.centerspan} style={{ border: "1px solid #cccccc", height: "100%" }} >
                            <Row>
                                <Col span={19}>
                                    <ConsultationProcessCenter
                                        consultID={this.state.consultID}
                                        onRef={this.loadData}
                                        consultationInfoList={this.consultationInfoListData}
                                        type={this.state.type} 
                                        leftThis={this.load}
                                        rightThis={this.RightChild}
                                    />
                                </Col>
                                <Col span={this.state.rightspan} style={{ height: "100%" }} >
                                    <ConsultationProcessright onRef={this.onRightRef} rightData={this.state.rightDatas} />
                                </Col>
                            </Row>
                        </Col>

                    </Row>
                </div>
            )
        }

    }
);
export default ConsultationProcess;