
import React from 'react';
import { Form, Row, Col, DatePicker, TimePicker, Table, Select, Input, Button, message, Divider } from 'antd';
import { $http } from 'containers/config/https';
import ConsultationCenterModel from './ConsultationCenterModel.jsx';//引用弹框
import ConsultationAuthorization from './ConsultationAuthorization.jsx';//开启授权弹框
import HistoryConsultation from './HistoryConsultation.jsx';//历史会诊弹框
import { $loadTemplate } from '../../lodop/Common/Print.js';
import store from '../../../store';
import { Util } from 'tools/index';
import moment from 'moment';


const FormItem = Form.Item;
const { TextArea } = Input;
const formItemLayout = {    // label 和input宽度
    labelCol: { span: 7 },
    wrapperCol: { span: 17 },
};
const formItemAddLayout = {    // label 和input宽度
    labelCol: { span: 7 },
    wrapperCol: { span: 17 },
};
// 点击编辑时记录当前行数据
let tableRecord = {};
let userData;
const ConsultationProcessCenter = Form.create()(
    class extends React.Component {
        constructor(props) {
            userData = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
            super(props);
            this.state = {
                conTypeData: [],        //会诊类型下拉数据
                conNatureData: [],      //会诊性质下拉数据
                conUserTypeData: [],    //会诊人员类型下拉数据
                conHospTypeData: [],    //会诊医院类型下拉数据
                cbTitleData: [],        //职称下拉数据
                hospData: [],           //医院下拉数据         
                locData: [],            //会诊科室下拉数据 
                contactUserData: [],    //联系人下拉数据 
                contactTellData: [],    //联系人电话
                conUserData: [],        //会诊人员下拉数据
                conContactTellData: [], //会诊联系人电话
                tableData: [],          // 表格数据
                conSatisfactionAry: [],//满意度
                index: 0,
                hospID: '',
                editingKey: '',
                //clickFlag: false,          // 按钮点击标志
                tableLocID: '',         //table科室id
                titleID: '',             //职称id
                consultID: '',
                conItemID: '',
                admID: '',
                consultationInfo: {},
                removeConsultLoc: [],
                value: '1',
                conNewestStatus: 'NULL',//状态
                searchInput: '',//评价
                btn1: "^SE^REF^REJ^",            //全部取消按钮对应状态
                btn2: "^SA^CS^",             //送法按钮对应状态
                btn3: "^SA^CS^",             //保存按钮对应状态
                btn4: "^SE^REF^CR^",           //取消发送按钮对应状态
                btn5: "^FI^CO^",               //评价按钮对应状态
                btn6: "^SE^CR^AU^",             //接收按钮对应状态
                btn7: "^RE^CF^",                //取消接收按钮对应状态
                btn8: "^SE^CR^AU^",             //拒绝接收按钮对应状态
                btn9: "^RE^CF^",        //完成按钮对应状态
                btn10: "^FI^",             //取消完成按钮对应状态
                leftListData: {},
                locType: '',              //科室类型
                QROrder: '',
                rowData: [],
                conItemIdea: "",
                parData: "",              // 与引用界面数据互通
                quoteCode: '',           // 引用code
                conContactFlag: false,   //是否修改会诊联系人
                conHospTypeDefault: '',  //默认会诊医院类型
                conNatureDefault: '',    //默认会诊性质类型
                conTypeDefault: '',      //默认会诊类型
            };
            this.columns = [
                {
                    key: 1,
                    title: '科室',
                    dataIndex: 'loc',
                    align: "center",
                    width: '30%',
                    render: (text, record, index) => {
                        const editable = this.isEditing(record);
                        let selectedLocs = [];       //已添加科室
                        const tableData = this.state.tableData;
                        for (let i = 0; i < tableData.length; i++) {
                            if ((tableData[i] !== undefined) && (tableData[i].locID !== '')) {
                                selectedLocs.push(tableData[i].locID)
                            }
                        }
                        return (
                            <Select
                                value={record.locID}
                                allowClear
                                style={{ width: "100%", textAlign: "center" }}
                                onChange={this.handleFieldChange.bind(this, index, 'locID')}
                                // onSelect={this.handleFieldChange.bind(this, record.key, 'locID')}
                                disabled={editable ? false : true}
                                showSearch={true}
                                optionFilterProp='role'
                            >
                                {this.state.locData.map(data => (
                                    <Select.Option
                                        role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                        key={data.id}
                                        disabled={selectedLocs.includes(data.id) || (data.id === userData.locID)}
                                    >{data.descripts}
                                    </Select.Option>
                                )
                                )}
                            </Select>
                        )
                    }
                },
                {
                    key: 2,
                    title: '职称',
                    dataIndex: 'title',
                    align: "center",
                    width: '15%',
                    render: (text, record, index) => {
                        const editable = this.isEditing(record);
                        return (
                            <Select
                                value={record.conItemRequireTitleID}
                                allowClear
                                style={{ width: "100%", textAlign: "center" }}
                                onChange={this.handleFieldChange.bind(this, index, 'conItemRequireTitleID')}
                                // onSelect={this.handleFieldChange.bind(this, record.key, 'conItemRequireTitleID')}
                                disabled={editable ? false : true}
                                showSearch={true}
                                optionFilterProp='role'
                            >
                                {this.state.cbTitleData.map(data => (
                                    <Select.Option
                                        role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                        key={data.id}
                                    >
                                        {data.descripts}
                                    </Select.Option>))}
                            </Select>
                        )
                    }
                },
                {
                    key: 3,
                    title: '会诊人员',
                    dataIndex: 'user',
                    align: "center",
                    width: '15%',
                    render: (text, record, index) => {
                        const editable = this.isEditing(record);
                        return (
                            <Select
                                value={record.conItemRequireUserID}
                                allowClear
                                style={{ width: "100%", textAlign: "center" }}
                                onChange={this.handleFieldChange.bind(this, index, 'conItemRequireUserID')}
                                // onSelect={this.handleFieldChange.bind(this, record.key, 'conItemRequireUserID')}
                                disabled={editable ? false : true}
                                showSearch={true}
                                optionFilterProp='role'
                            >
                                {this.state.conUserData.map(data => (
                                    <Select.Option
                                        role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
                                        key={data.id}
                                        conusertel={data.userContactAry}
                                    >
                                        {data.descripts}
                                    </Select.Option>))}
                            </Select>
                        )
                    }
                },
                {
                    key: 4,
                    title: '联系电话',
                    dataIndex: 'telephone',
                    align: "center",
                    width: '20%',
                    render: (text, record, index) => {
                        const editable = this.isEditing(record);
                        return (
                            (this.state.conContactTellData.length > 0) ?
                                <Select
                                    value={record.conItemRequireContact}
                                    allowClear
                                    style={{ width: "100%", textAlign: "center" }}
                                    onChange={this.handleFieldChange.bind(this, index, 'conItemRequireContact')}
                                    //onSelect={this.handleFieldChange.bind(this, record.key, 'conItemRequireContact')}
                                    disabled={editable ? false : true}
                                >
                                    {this.state.conContactTellData.map(data => (
                                    <Select.Option 
                                    key={data.userContactID} 
                                    value={data.userContactValue}>
                                    {data.userContactValue}</Select.Option>
                                    ))}
                                </Select> :
                                <Input
                                    value={record.conItemRequireContact}
                                    style={{ width: "100%", textAlign: "center" }}
                                    onChange={this.handleFieldChange.bind(this, index, 'conItemRequireContact')}
                                    disabled={editable ? false : true}
                                />
                        )
                    }
                },
                {
                    key: 5,
                    title: '操作',
                    dataIndex: 'operate',
                    align: "center",
                    render: (text, record) => {
                        const { editingKey } = this.state;
                        const editable = this.isEditing(record);
                        // console.log('asdf',this.props.type);
                        // console.log('qwer',editingKey);
                        // console.log('zxcv',this.state.conNewestStatus);
                        return editable ? (
                            <span>
                                <a onClick={(e) => this.handleUpdate(record, e)}>确认</a>
                                <Divider type="vertical" />
                                <a onClick={(e) => this.handleCancel(record, e)}>取消</a>
                            </span>
                        ) : (
                                this.props.type == 'applyList' ? <span>
                                    <a disabled={((editingKey == '') && (this.props.type === 'applyList') && (this.state.conNewestStatus !== 'SA') && (this.state.conNewestStatus !== 'CS')) ? true : false} onClick={(e) => this.handleEdit(record, e)}>编辑</a>
                                    <Divider type="vertical" />
                                    <a style={{ color: 'rgba(240,65,52,1)' }} disabled={((editingKey == '') && (this.props.type !== 'applyList') && (this.state.conNewestStatus !== 'SA') || (this.state.conNewestStatus === 'CS')) ? true : false} onClick={(e) => this.handleDelete(record, e)}>删除</a>
                                </span>
                                    : <span>
                                        <a disabled>编辑</a>
                                        <Divider type="vertical" />
                                        <a disabled>删除</a>
                                    </span>

                            );
                    }
                }
            ]
        }
        componentDidMount() {
            this.getHospData();
            this.getSelectData();
            this.getAllUserData();
            this.props.onRef(this);
            //this.getConsultationInfo();
        }

        componentWillUnmount() {
            this.getLocTypeByUserType();
            this.setState = (state, callback) => {
                return
            }
        }
        // 调用公共组件的连接事件
        onRef = (ref) => {
            this.child = ref
        }

        // 调用公共组件的连接事件
        onRefQuote = (ref) => {
            this.QuoteChild = ref
        }

        // 确认会诊科室
        handleUpdate = (record, e) => {
            e.preventDefault();
            // 未选择科室时提示
            if (record.locID === '') {
                message.warning('请选择会诊科室');
                return;
            }
            this.determineConType();
            this.setState({
                editingKey: '',
                conContactTellData: []
            });
        }
        // 编辑会诊科室
        handleEdit = (record, e) => {
            e.preventDefault();
            tableRecord = JSON.parse(JSON.stringify(record));
            this.getLocUserTableData(record.locID, record.conItemRequireTitleID);
            this.setState({
                editingKey: record.key
            });
        }
        // 取消编辑
        handleCancel = (record, e) => {
            e.preventDefault();
            let tableData = this.state.tableData;
            tableData[record.key] = tableRecord;
            if (record.conItemID !== '') {
                this.setState({
                    editingKey: '',
                    conContactTellData: [],
                    tableData
                }, () => {
                    this.getLocUserTableData(tableRecord.locID, tableRecord.conItemRequireTitleID);
                });
            } else {
                this.handleDelete(record, e);
                this.setState({
                    editingKey: ''
                });
            }
        }
        isEditing = (record) => {
            return record.key === this.state.editingKey
        };
        // 删除会诊科室
        handleDelete = (record, e) => {
            e.preventDefault();
            let { tableData, removeConsultLoc } = this.state;
            tableData.splice(record.key,1);
            if (record.conItemID !== '') {
                removeConsultLoc.push(record.conItemID);
            }
            // 重新给key赋值
            for (let i=0;i<tableData.length;i++)
            {
                tableData[i].key = i;
            }
            this.setState({
                tableData,
                removeConsultLoc
            }, () => this.determineConType())
        }
        // 根据登录人员确定科室类型
        getLocTypeByUserType = () => {
            if (userData.groupDesc.indexOf('护') > -1) {
                this.setState({ locType: 'W' })
            }
            if (userData.groupDesc.indexOf('医') > -1) {
                this.setState({ locType: 'O^OI^I' })
            }
        }

        // 根据table里的科室数量确定会诊类型
        determineConType = () => {
            let tempObj = {};
            let { conTypeData } = this.state;
            for (let i = 0; i < conTypeData.length; i++) {
                tempObj[conTypeData[i]['code']] = conTypeData[i]['id']
            }
            // 过滤空数据
            let tableData = this.state.tableData;
            let arr = [];
            for (var i = 0; i < tableData.length; i++) {
                if (tableData[i] && tableData[i].key) {
                    arr.push(tableData[i].key)
                }
            }
            if (arr && arr.length > 1) {
                this.props.form.setFieldsValue({ conTypeID: tempObj.MDC })
            } else {
                this.props.form.setFieldsValue({ conTypeID: tempObj.CDC })
            }
        }
        // 表格下拉框选中
        handleFieldChange = (index, code, value, opt) => {
            let { tableData, editingKey } = this.state;
            if (value !== undefined) {
                if ((typeof (value) !== 'string') && (value.target.value) && (/[^0-9-]/g.test(value.target.value))) {
                    message.error('请输入正确的联系电话')
                }
                tableData[editingKey][code] = (typeof (value) == 'string') ? value : value.target.value;
                if ((code === 'conItemRequireUserID') && (opt.props.conusertel.length > 0)) {
                    tableData[editingKey].conItemRequireContact = opt.props.conusertel[0].userContactValue
                }
                this.setState({ tableData });
                if ((code == 'locID') && (value !== '')) {
                    this.setState({
                        tableLocID: value
                    }, () =>
                        this.getLocUserTableData(this.state.tableLocID, this.state.titleID)
                    );
                }
                if ((code == 'conItemRequireTitleID') && (value !== '')) {
                    this.setState({ titleID: value },
                        () => {
                            if (this.state.tableLocID !== '') {
                                this.getLocUserTableData(this.state.tableLocID, this.state.titleID);
                            }
                        });
                }
                if (code == 'conItemRequireUserID') {
                    if (opt.props.conusertel.length > 0) {
                        this.setState({ conContactTellData: opt.props.conusertel });
                    } else {
                        this.setState({ conContactTellData: [] });
                    }
                }
            } else {
                tableData[editingKey][code] = '';
                if (code == 'locID') {
                    tableData[editingKey]['conItemRequireTitleID'] = '';
                    tableData[editingKey]['conItemRequireUserID'] = '';
                    tableData[editingKey]['conItemRequireContact'] = '';
                    this.setState({
                        tableData,
                        conUserData: []
                    });
                }
                if (code == 'conItemRequireTitleID') {
                    this.setState({ tableData });
                }
                if (code == 'conItemRequireUserID') {
                    tableData[editingKey]['conItemRequireContact'] = '';
                    this.setState({
                        tableData,
                        conContactTellData: []
                    });
                }
                if (code == 'conItemRequireContact') {
                    this.setState({ tableData });
                }
            }
        }
        // 获取下拉框数据
        getSelectData = () => {
            let data = {
                "params": [{
                    hospID: userData && userData.hospID ? userData.hospID : '', // 登录医院id
                    locID: userData.locID,
                    groupID: userData.groupID,
                    userID: userData.userID,
                    type: 'apply'
                }]
            };
            $http.post('urlDeault', this, {
                code: "04090011",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            conTypeData: res.result.conType,
                            conNatureData: res.result.conNature,
                            conUserTypeData: res.result.conUserType,
                            cbTitleData: res.result.title,
                            conHospTypeData: res.result.conHospType,
                            conSatisfactionAry: res.result.conSatisfactionAry,
                            conHospTypeDefault: res.result.conHospTypeDefault,  //默认会诊医院类型
                            conNatureDefault: res.result.conNatureDefault,    //默认会诊性质类型
                            conTypeDefault: res.result.conTypeDefault,      //默认会诊类型
                        })
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                }
            });
        }
        // 获取医院信息
        getHospData = () => {
            let data = {
                "params": [{
                    logonGroupID: userData && userData.groupID ? userData.groupID : '', //登录角色id
                    logonHospID: userData && userData.hospID ? userData.hospID : '', // 登录医院id
                }]
            };
            $http.post('urlDeault', this, {
                code: "01040001",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            hospData: res.result
                        })
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                }
            });
        }
        // 获取科室信息
        getLocData = () => {
            let data = {
                "params": [{
                    hospID: this.state.hospID ? this.state.hospID : userData.hospID,          // 会诊医院id
                    type: this.state.locType
                }]
            };
            $http.post('urlDeault', this, {
                code: "04020008",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            locData: res.result.Data
                        })
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                }
            });
        }
        // 获取科室人员
        getLocUserData = () => {
            if (this.state.type === 'applyList') {
                let data = {
                    "params": [{
                        hospID: userData && userData.hospID ? userData.hospID : '', // 登录医院id
                        // locID: userData && userData.locID && (this.props.type === 'applyList')? userData.locID : '', // 登录科室id
                        power: 'select',
                        deptEffective: 'Y',
                    }]
                };
                $http.post('urlDeault', this, {
                    code: "01040021",
                    data: data,
                    success: function (res) {
                        if (+res.errorCode === 0) {
                            this.setState({
                                conContactTellData: res.result.Data
                            })
                        }
                    },
                    error: function (error) {
                        message.error('失败：' + error);
                    }
                });
            } else {
                this.getAllUserData();
            }
        }
        // 获取所有人员(跨院会诊人员显示问题))
        getAllUserData = () => {
            let data = {
                "params": [{
                }]
            };
            $http.post('urlDeault', this, {
                code: "01040100",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            contactUserData: res.result
                        })
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                }
            });
        }
        // 获取表格科室人员
        getLocUserTableData = (locID, title) => {
            this.setState({
                conUserData: []
            })
            let data = {
                "params": [{
                    hospID: this.state.hospID,
                    locID,
                    title,
                    power: 'select',
                    deptEffective: 'Y',
                }]
            };
            $http.post('urlDeault', this, {
                code: "01040021",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            conUserData: res.result.Data
                        })
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                }
            });
        }
        // 获取申请会诊信息
        getConsultationInfo = (record) => {
            // console.log('触发乐乐乐乐',record);
            this.setState({ leftListData: record })
            if (record.consultID == '') return;
            let data = {
                "params": [{
                    consultID: record.consultID,
                    conItemID: record.conItemID,
                    type: 'applyList'
                }]
            };
            $http.post('urlDeault', this, {
                code: "04090014",
                data: data,
                success: function (res) {
                    // console.log('状态', res)
                    if (+res.errorCode === 0) {
                        let dataInfo = res.Data[0]
                        let conLocInfo = dataInfo.consultLoc;
                        this.setState({
                            consultationInfo: dataInfo,
                            tableData: dataInfo.consultLoc,
                            index: conLocInfo.length,
                            hospID: dataInfo.conHospID,
                            conNewestStatus: res.conNewestStatusCode,
                            consultID: record.consultID,
                            conItemID: record.conItemID
                        }, () => {
                            this.getLocData();
                            for (let i = 0; i < conLocInfo.length; i++) {
                                this.getLocUserTableData(conLocInfo[i].locID, conLocInfo[i].conItemRequireTitleID);
                                //console.log(this.state.conUserData)
                            }
                        });
                        this.props.consultationInfoList(res.Data[0]);
                    }
                }
            });
        }
        initConsultationInfo = () => {
            this.setState({
                consultationInfo: '',
                conNewestStatus: 'NULL',
                tableData: [],
            });
        }
        //申请列表
        saveALL = (code) => {
            this.props.form.validateFields();
            const formData = this.props.form.getFieldsValue();
            const consultLoc = this.state.tableData;
            let data = {
                "params": [{
                    conItemID: this.state.conItemID,
                    updateUserID: userData.userID,
                    hospID: userData.hospID,
                    locID: this.state.leftListData.locID,
                    conHospID: formData.conHospID,
                    // conItemSatisfactionID: "",
                    // conItemEvaluate: this.state.searchInput,
                    code
                }]
            };
            if (code === "EV") {
                data.params[0].conItemSatisfactionID = formData.conItemSatisfactionID,
                    data.params[0].conItemEvaluate = formData.conItemEvaluate
            }
            // console.log(this.state.consultID)  
            $http.post('urlDeault', this, {
                code: "04090016",
                data: data,
                success: function (res) {
                    if (+res.errorCode == '0') {
                        message.success(res.errorMessage);
                        this.handleReset();
                        this.props.leftThis.handleQuery();
                        this.getConsultationInfo(this.state.leftListData)
                        this.setState({
                            conNewestStatus: res.conNewestStatusCode ? res.conNewestStatusCode : '',
                        });
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                    //console.log(this.props.leftThis)
                    // this.setState({ clickFlag: false })
                }
            });
        }

        // 会诊列表接收
        saveAdd = (code) => {
            this.props.form.validateFields();
            const formData = this.props.form.getFieldsValue();
            const consultLoc = this.state.tableData;
            let data = {
                "params": [{
                    conItemID: this.state.conItemID,
                    updateUserID: userData.userID,
                    hospID: userData.hospID,
                    locID: userData.locID,
                    conHospID: formData.conHospID,
                    code
                }]
            };
            if (code === "FI") {
                data.params[0].conItemIdea = formData.conItemIdea,
                    data.params[0].conItemDate = formData.conItemDate ? moment(formData.conItemDate).format('YYYY-MM-DD') : null,
                    data.params[0].conItemTime = formData.conItemTime ? moment(formData.conItemTime).format('HH:mm:ss') : null
            }
            // console.log(this.state.consultID)  
            $http.post('urlDeault', this, {
                code: "04090016",
                data: data,
                success: function (res) {
                    if (+res.errorCode == '0') {
                        message.success(res.errorMessage);
                        this.handleReset();
                        this.props.leftThis.handleQuery();
                        this.getConsultationInfo(this.state.leftListData)
                        this.setState({
                            conNewestStatus: res.conNewestStatusCode ? res.conNewestStatusCode : '',
                        });
                    }
                },
                error: function (error) {
                    message.error('失败：' + error);
                    //this.setState({ clickFlag: false })
                }
            });
        }
        // 添加行
        addRow = () => {
            const { tableData } = this.state;
            // if ((index > 0) && (tableData[index - 1]) && (tableData[index - 1]['locID'] === '')) {
            //     message.warning('请先选择上一条记录的科室');
            //     return;
            // }
            this.determineConType();
            let newData = tableData;
            newData.push({
                key: tableData.length,
                conItemID: '',
                conItemRequireTitleID: '',
                locID: '',
                conItemRequireUserID: '',
                conItemRequireContact: '',
                editable: true
            });
            this.setState({
                tableData: newData,
                editingKey: newData.length-1
            });
        }
        // 保存
        save = (code) => {
            this.props.form.validateFields();
            const formData = this.props.form.getFieldsValue();
            const consultLoc = this.state.tableData;
            let data = {
                "params": [{
                    consultID: this.state.consultID,
                    conHospID: formData.conHospID,
                    hospID: userData.hospID,
                    conDictItemCode: code,
                    admID: this.state.leftListData.admID ? this.state.leftListData.admID : "",
                    conTypeID: formData.conTypeID,
                    conNatureID: formData.conNatureID,
                    conUserTypeID: formData.conUserTypeID,
                    conHospTypeID: formData.conHospTypeID,
                    conApplyLocID: userData.locID,
                    conAppuserID: userData.userID,
                    conPatCondition: formData.conPatCondition,
                    conAims: formData.conAims,
                    conContactUserID: formData.conContactUserID ? formData.conContactUserID : '',
                    conContactTell: formData.conContactTell ? formData.conContactTell : '',
                    conRequireDate: formData.conRequireDate ? moment(formData.conRequireDate).format('YYYY-MM-DD') : null,
                    conRequireTime: formData.conRequireTime ? moment(formData.conRequireTime).format('HH:mm:ss') : null,
                    conRequirePlace: formData.conRequirePlace,
                    updateUserID: userData.userID,
                    consultLoc: consultLoc,
                    removeConsultLoc: this.state.removeConsultLoc,
                    // conItemID:this.state.conItemID
                }]
            };
            $http.post('urlDeault', this, {
                code: "04090010",
                data: data,
                success: function (res) {
                    if (+res.errorCode == '0') {
                        message.success(res.errorMessage);
                        this.setState({
                            consultID: res.consultID
                        });
                    }
                    // console.log( this.props.leftThis)
                    // console.log( this.props)
                    this.handleReset();
                    this.props.leftThis.handleQuery();
                    this.getConsultationInfo(this.state.leftListData)
                    this.setState({
                        conNewestStatus: res.conNewestStatusCode ? res.conNewestStatusCode : '',
                    });
                },
                error: function (error) {
                    message.error('失败：' + error);
                    this.props.leftThis.handleQuery();
                }
            });
        }

        selectList = (e) => {
            this.setState({ searchInput: e.target.value })
        }
        //重置表单
        handleReset = () => {
            this.props.form.resetFields();
            this.props.form.setFieldsValue({ 'conItemDate': null, 'conItemTime': null })
        }
        hospOnChange = (id, opt) => {
            this.setState({
                hospID: id,
                tableData: [],
                index: 0
            }, () => {
                const { conHospTypeData } = this.state;
                if ((opt.props.title) && (opt.props.title === userData.hospID)) {
                    // 子院                                                        
                    // 循环找医院类型id
                    for (let i = 0; i < conHospTypeData.length; i++) {
                        if (conHospTypeData[i]['code'] === 'SH') {
                            this.props.form.setFieldsValue({ conHospTypeID: conHospTypeData[i]['id'] });
                        }
                    }
                } else if (id === userData.hospID) {
                    // 本院
                    for (let i = 0; i < conHospTypeData.length; i++) {
                        if (conHospTypeData[i]['code'] === 'OH') {
                            this.props.form.setFieldsValue({ conHospTypeID: conHospTypeData[i]['id'] });
                        }
                    }
                } else {
                    // 外院
                    for (let i = 0; i < conHospTypeData.length; i++) {
                        if (conHospTypeData[i]['code'] === 'EH') {
                            this.props.form.setFieldsValue({ conHospTypeID: conHospTypeData[i]['id'] });
                        }
                    }
                }
                this.getLocData();
            })
        }
        // 判断当前登录人员类型
        tellUserType = () => {
            if (userData.groupDesc.indexOf('护') > -1) {
                return 'Nur'
            }
            if (userData.groupDesc.indexOf('医') > -1) {
                return 'Doc'
            }
        }
        // 通过code获取对应id
        getIDByCode = (code, dataSource) => {
            for (let i = 0; i < dataSource.length; i++) {
                if (dataSource[i].code == code) {
                    return dataSource[i].id
                }
            }
        }
        onSearch(e) {
            this.setState({
                changeValue: e
            })
        }
        //引用结论数据
        addData = (data) => {
            const quoteCode = this.state.quoteCode
            this.props.form.setFieldsValue({
                [quoteCode]: data,

            })
        }
        openModel = (code) => {
            let parData = (code == 'conPatCondition') ? this.props.form.getFieldValue('conPatCondition') : this.props.form.getFieldValue('conAims');
            this.setState({
                visible: true,
                parData,
                quoteCode: code
            })
        }
        // openModelApplication =()=>{
        //     let conAims = this.props.form.getFieldValue('conAims');
        //     this.setState({
        //         visible: true,
        //         parData:conAims
        //     })
        // }

        print = () => {
            let data = {
                params: [{
                    conItemID: this.state.conItemID
                }]
            }
            $http.post('urlS', this, {
                code: "04090023",
                data: data,
                success: function (res) {
                  //  console.log(res)
                    if (res.errorCode === '0') {
                        const data = res.result
                        //加载模板
                        $loadTemplate("Contsultation", data);
                    }
                }
            })
        }
        render() {
            const { type } = this.props;
            // console.log('最新状态', this.state.conNewestStatus);
            // console.log('this.state.leftListData',type)
            const { getFieldDecorator } = this.props.form;
            const consultationInfo = this.state.consultationInfo;
            const conContactTell = !Util.isEmpty(this.state.conContactTell) ? this.state.conContactTell : (this.state.conContactFlag ? '' : consultationInfo.conContactTell)
            let disable1 = !((this.state.conNewestStatus === 'SA') || (this.state.conNewestStatus === 'CS'))
            return (
                <div className="WarehouseEntryCheck1">
                    <div>
                        <Row>
                            <Col>
                                <p style={{ background: "#e8e8e8", fontSize: '16px', height: '40px', lineHeight: '40px' }}>会诊申请单</p>
                            </Col>
                            <Col span={24}>
                                {
                                    type === 'applyList' ? (
                                        <div style={{ padding: '0 10px 10px' }}>
                                            <Button type="primary" htmlType="submit" disabled={this.state.btn1.indexOf('^'+this.state.conNewestStatus+'^') < 0} onClick={this.saveALL.bind(this, 'CSALL')}>全部取消发送</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" htmlType="submit" disabled={this.state.btn2.indexOf(this.state.conNewestStatus) < 0} onClick={this.save.bind(this, 'SE')}>发送</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" htmlType="submit" disabled={this.state.btn3.indexOf(this.state.conNewestStatus) < 0} onClick={this.save.bind(this, 'SA')}>保存</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" disabled={this.state.btn4.indexOf('^'+this.state.conNewestStatus+'^') < 0} onClick={this.saveALL.bind(this, 'CS')} >取消发送</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" disabled={this.state.btn5.indexOf(this.state.conNewestStatus) < 0} onClick={this.saveALL.bind(this, 'EV')}>评价</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" onClick={this.print}>打印</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    {/* <Button type="primary" onClick={() => this.setState({ visible_department: true })}>开启授权</Button>&nbsp;&nbsp;&nbsp;&nbsp; */}
                                            <Button type="primary" onClick={() => this.setState({ visible1: true })}>历次会诊</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    {/* <Button type="primary">会诊日志</Button>&nbsp;&nbsp;&nbsp;&nbsp; */}
                                        </div>
                                    ) : (
                                            <div style={{ padding: '0 10px 10px' }}>
                                                <Button type="primary" disabled={this.state.btn6.indexOf(this.state.conNewestStatus) < 0} htmlType="submit" onClick={this.saveAdd.bind(this, 'RE')}>接收</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" disabled={this.state.btn7.indexOf(this.state.conNewestStatus) < 0} htmlType="submit" onClick={this.saveAdd.bind(this, 'CR')}>取消接收</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" disabled={this.state.btn8.indexOf(this.state.conNewestStatus) < 0} htmlType="submit" onClick={this.saveAdd.bind(this, 'REF')}>拒绝接收</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" disabled={this.state.btn9.indexOf(this.state.conNewestStatus) < 0} htmlType="submit" onClick={this.saveAdd.bind(this, 'FI')}>完成</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" disabled={this.state.btn10.indexOf(this.state.conNewestStatus) < 0} htmlType="submit" onClick={this.saveAdd.bind(this, 'CF')}>取消完成</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <Button type="primary" onClick={this.print}>打印</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    {/* <Button type="primary">医嘱录入</Button>&nbsp;&nbsp;&nbsp;&nbsp; */}
                                                {/* <Button type="primary">查看病历</Button>&nbsp;&nbsp;&nbsp;&nbsp; */}
                                                <Button type="primary" onClick={() => this.setState({ visible1: true })}>历次会诊</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    {/* <Button type="primary">会诊日志</Button>&nbsp;&nbsp;&nbsp;&nbsp; */}
                                            </div>
                                        )
                                }


                            </Col>
                        </Row>
                        <Row style={{ height: store.getState().tableHeight.y + 61 + 'px', overflow: 'auto' }}>
                            <Form>
                                <Row>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="会诊类型">
                                            {getFieldDecorator('conTypeID', {
                                                initialValue: consultationInfo.conTypeID ? consultationInfo.conTypeID : this.state.conTypeDefault,
                                                rules: [{ required: true, message: '请选择会诊类型' }]
                                            })(
                                                <Select allowClear
                                                    disabled={disable1}
                                                    disabled={true}
                                                    // readOnly="ture"
                                                    showSearch
                                                    optionFilterProp='role'
                                                >
                                                    {this.state.conTypeData.map(data => (
                                                        <Select.Option role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} key={data.id} code={data.code}>{data.descripts}</Select.Option>
                                                    ))}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="会诊性质">
                                            {getFieldDecorator('conNatureID', {
                                                initialValue: consultationInfo.conNatureID ? consultationInfo.conNatureID : this.state.conNatureDefault,
                                                rules: [{ required: true, message: '请选择会诊性质' }]
                                            })(
                                                <Select allowClear
                                                    disabled={disable1}
                                                    readOnly="ture"
                                                    showSearch
                                                    optionFilterProp='role'
                                                >
                                                    {this.state.conNatureData.map(data => (
                                                        <Select.Option role={data.descripts + '^' + data.descriptsSPCode} key={data.id}>{data.descripts}</Select.Option>
                                                    ))}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="会诊人员">
                                            {getFieldDecorator('conUserTypeID', {
                                                initialValue: consultationInfo.conUserTypeID ? consultationInfo.conUserTypeID : this.getIDByCode(this.tellUserType(), this.state.conUserTypeData),
                                                rules: [{ required: true, message: '请选择会诊人员' }]
                                            })(
                                                <Select allowClear
                                                    disabled={disable1}
                                                    readOnly="ture"
                                                    showSearch
                                                    optionFilterProp='role'
                                                >
                                                    {this.state.conUserTypeData.map(data => (
                                                        <Select.Option role={data.descripts + '^' + data.descriptsSPCode} key={data.id}>{data.descripts}</Select.Option>
                                                    ))}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="会诊医院">
                                            {getFieldDecorator('conHospID', {
                                                initialValue: consultationInfo.conHospID ? consultationInfo.conHospID : userData.hospID,
                                                rules: [{ required: true, message: '请选择会诊医院' }]
                                            })(
                                                <Select allowClear
                                                    disabled={disable1}
                                                    readOnly="ture"
                                                    showSearch
                                                    optionFilterProp='role'
                                                    onSelect={this.hospOnChange}
                                                // onSelect={(id) => {
                                                //     this.setState({
                                                //         hospID: id
                                                //     }, () => this.getLocData())
                                                // }}
                                                >
                                                    {this.state.hospData.map(data => (
                                                        <Select.Option
                                                            title={data.hospDr}
                                                            role={data.descripts + '^' + data.descriptsSPCode}
                                                            key={data.id}>
                                                            {data.descripts}</Select.Option>
                                                    ))}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row>

                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="联系人">
                                            {getFieldDecorator('conContactUserID', {
                                                initialValue: consultationInfo.conContactUserID ? consultationInfo.conContactUserID : "",
                                            })(
                                                <Select allowClear
                                                    disabled={disable1}
                                                    readOnly="ture"
                                                    showSearch
                                                    optionFilterProp='role'
                                                    value={Util.isEmpty(this.state.conContactUserID) ? '' : this.state.conContactUserID}
                                                    onChange={(value, option) => {
                                                        if (value === undefined) {
                                                            this.setState({
                                                                conContactUserID: '',
                                                                conContactFlag: true,
                                                                contactTellData: [],
                                                                conContactTell: ''
                                                            })
                                                        } else {
                                                            this.setState({
                                                                conContactUserID: value,
                                                                conContactFlag: true,
                                                                contactTellData: option.props.contacttell,
                                                                conContactTell: option.props.contacttell.length>0 ? option.props.contacttell[0].userContactValue : ''
                                                            })
                                                        }
                                                    }}
                                            
                                                >
                                                    {this.state.contactUserData.map(data => (
                                                        <Select.Option role={data.descripts + '^' + data.descriptsSPCode} key={data.id} contacttell={data.userContactAry}>{data.descripts}</Select.Option>
                                                    ))}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="联系电话">
                                            {getFieldDecorator('conContactTell', {
                                                initialValue: this.state.changeValue ? this.state.changeValue : conContactTell,
                                                // getValueFromEvent: (event) => {
                                                //     return event.target.value.replace(/[^0-9-]/g, '')
                                                // },
                                            })(
                                                this.state.contactTellData.length ?
                                                    <Select allowClear
                                                        showSearch
                                                        optionFilterProp='value'
                                                        onSearch={this.onSearch.bind(this)}
                                                    >
                                                        {this.state.contactTellData.map(data => (
                                                            <Select.Option key={data.userContactID} value={data.userContactValue}>{data.userContactValue}</Select.Option>
                                                        ))}
                                                    </Select> :
                                                    <Input disabled={disable1} />
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="要求会诊日期">
                                            {getFieldDecorator('conRequireDate', {
                                                initialValue: consultationInfo.conRequireDate ? moment(consultationInfo.conRequireDate, 'YYYY-MM-DD') : null
                                            })(
                                                <DatePicker disabled={disable1} readOnly="ture" style={{ width: '100%' }}></DatePicker>
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="要求会诊时间">
                                            {getFieldDecorator('conRequireTime', {
                                                initialValue: consultationInfo.conRequireTime ? moment(consultationInfo.conRequireTime, 'HH:mm:ss') : null,
                                                rules: [{ required: true, message: '请选择要求会诊时间' }]
                                            })(
                                                <TimePicker disabled={disable1} readOnly="ture" style={{ width: '100%' }}></TimePicker>
                                            )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemAddLayout} label="会诊地址">
                                            {getFieldDecorator('conRequirePlace', {
                                                initialValue: consultationInfo.conRequirePlace ? consultationInfo.conRequirePlace : '',
                                            })(
                                                <Input disabled={disable1} />
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="申请人">
                                            <Input disabled value={userData.userName} />
                                        </FormItem>
                                    </Col>

                                    <Col span={6}>
                                        <FormItem {...formItemLayout} label="会诊医院类型">
                                            {getFieldDecorator('conHospTypeID', {
                                                initialValue: consultationInfo.conHospTypeID ? consultationInfo.conHospTypeID : this.state.conHospTypeDefault,
                                                rules: [{ required: true, message: '请选择会诊医院类型' }]
                                            })(
                                                <Select allowClear
                                                    showSearch
                                                    disabled={disable1}
                                                    disabled={true}
                                                    optionFilterProp='role'
                                                >
                                                    {this.state.conHospTypeData.map(data => (
                                                        <Select.Option role={data.descripts + '^' + data.descriptsSPCode} key={data.id} code={data.code}>{data.descripts}</Select.Option>
                                                    ))}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="会诊日期">
                                            {getFieldDecorator('conItemDate', {
                                                initialValue:consultationInfo.conItemDate ? moment(consultationInfo.conItemDate, 'YYYY-MM-DD') : undefined,
                                                // rules: [{ required: true }]
                                            })(
                                                <DatePicker
                                                    placeholder={''}
                                                    disabled={this.state.btn7.indexOf(this.state.conNewestStatus) < 0}
                                                    disabled={this.state.btn9.indexOf(this.state.conNewestStatus) < 0}
                                                    style={{ width: '100%' }} disabledDate={(curDate) => {
                                                        return curDate && curDate > moment().endOf('day');
                                                    }} />
                                            )}
                                        </FormItem>
                                    </Col>

                                </Row>
                                <Row>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="会诊时间">
                                            {getFieldDecorator('conItemTime', {
                                                initialValue: consultationInfo.conItemTime ? moment(consultationInfo.conItemTime, 'HH:mm:ss') : undefined,
                                            })(
                                                <TimePicker
                                                    placeholder={''}
                                                    disabled={this.state.btn7.indexOf(this.state.conNewestStatus) < 0}
                                                    disabled={this.state.btn9.indexOf(this.state.conNewestStatus) < 0}
                                                    style={{ width: '100%' }} disabledDate={(curDate) => {
                                                        return curDate && curDate > moment().endOf('time');
                                                    }} />
                                            )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row>
                                    <Col span={24} style={{ padding: '0 10px 10px' }}>
                                        <span style={{ color: 'red' }}>*</span>&nbsp;
                                         <span>病情摘要</span>&nbsp;&nbsp;
                                        <Button type="primary" disabled={this.state.btn2.indexOf(this.state.conNewestStatus) < 0} size="small" onClick={this.openModel.bind(this, 'conPatCondition')}>病情摘要引用</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <br />
                                        <FormItem label="">
                                            {getFieldDecorator('conPatCondition', {
                                                initialValue: consultationInfo.conPatCondition ? consultationInfo.conPatCondition : '',
                                                rules: [{ required: true, message: '请填写患者病情' }]
                                            })(
                                                <TextArea disabled={this.state.btn2.indexOf(this.state.conNewestStatus) < 0} placeholder="请填写会诊患者病情" style={{ marginTop: '10px' }} autosize={{ minRows: 2 }} />
                                            )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row>
                                    <Col span={24} style={{ padding: '0 10px 10px' }}>
                                        <span style={{ color: 'red' }}>*</span>&nbsp;
                                         <span>会诊理由及要求</span>&nbsp;&nbsp;
                                        <Button type="primary" disabled={this.state.btn2.indexOf(this.state.conNewestStatus) < 0} size="small" onClick={this.openModel.bind(this, 'conAims')}>会诊理由及要求引用</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                          <br />
                                        <FormItem label="">
                                            {getFieldDecorator('conAims', {
                                                initialValue: consultationInfo.conAims ? consultationInfo.conAims : '',
                                                rules: [{ required: true, message: '会诊理由及要求' }]
                                            })(
                                                <TextArea disabled={this.state.btn2.indexOf(this.state.conNewestStatus) < 0} placeholder="请填写会诊理由及要求" style={{ marginTop: '10px' }} autosize={{ minRows: 2 }} />
                                            )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                <Row >
                                    <Col span={24} style={{ padding: '0 10px 10px' }}>
                                        {/* <Button type="primary" disabled={this.state.btn9.indexOf(this.state.conNewestStatus) < 0} size="small" onClick={this.openModel}>引用</Button>&nbsp;&nbsp;&nbsp;&nbsp;
                                          <br /> */}
                                        <FormItem label="结论">
                                            {getFieldDecorator('conItemIdea', {
                                                initialValue: consultationInfo.conItemIdea ? consultationInfo.conItemIdea : "",
                                                rules: [{ required: '', message: '请填写结论' }]
                                            })(
                                                <TextArea disabled={this.state.btn9.indexOf(this.state.conNewestStatus) < 0} autosize={{ minRows: 2 }} />
                                                // <TextArea
                                                //     disabled={this.state.btn9.indexOf(this.state.conNewestStatus) < 0} placeholder="请填写结论" style={{ marginTop: '10px' }} autosize={{ minRows: 2 }} >
                                                // </TextArea>
                                            )}
                                        </FormItem>
                                    </Col>
                                </Row>
                                {type === 'applyList' ? <Row >
                                    <Col span={24}>
                                        <div>
                                            <span style={{ marginLeft: '15px' }}>申请医生评价</span>&nbsp;&nbsp;&nbsp;&nbsp;
                                     </div>
                                    </Col>
                                    <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="满意度">
                                            {getFieldDecorator('conItemSatisfactionID', {
                                                initialValue: consultationInfo.conItemSatisfactionID ? consultationInfo.conItemSatisfactionID : "",
                                                rules: [{ required: false, message: '请选择满意度' }]
                                            })(
                                                <Select allowClear
                                                    showSearch
                                                    optionFilterProp='role'
                                                    disabled={this.state.btn5.indexOf(this.state.conNewestStatus) < 0}
                                                >
                                                    {this.state.conSatisfactionAry.map(data => (
                                                        <Select.Option role={data.descripts + '^' + data.descriptsSPCode} key={data.id}>{data.descripts}</Select.Option>
                                                    ))}
                                                </Select>
                                            )}
                                        </FormItem>
                                    </Col>
                                    {/* <Col span={6} style={{ paddingRight: '15px' }}>
                                        <FormItem {...formItemLayout} label="评价">
                                            <Input disabled={this.state.btn5.indexOf(this.state.conNewestStatus) < 0}  onChange={this.selectList} />
                                        </FormItem>
                                    </Col> */}
                                    <Col span={24} style={{ padding: '0 10px 10px' }}>
                                        <FormItem label="">
                                            {getFieldDecorator('conItemEvaluate', {
                                                initialValue: consultationInfo.conItemEvaluate ? consultationInfo.conItemEvaluate : '',
                                                rules: [{ required: '', message: '请填写评价' }]
                                            })(
                                                <TextArea disabled={this.state.btn5.indexOf(this.state.conNewestStatus) < 0} placeholder="请填写评价" style={{ marginTop: '10px' }} autosize={{ minRows: 2 }} />
                                            )}
                                        </FormItem>
                                    </Col>
                                </Row> : ''}
                                <Row>

                                    <Col span={24}>
                                        <Button
                                            style={{ width: '97%', marginTop: 16, marginLeft: 10, marginBottom: 8 }}
                                            type="dashed"
                                            onClick={this.addRow}
                                            icon="plus"
                                            disabled={((type === 'applyList') && ((this.state.conNewestStatus === 'SA') || (this.state.conNewestStatus === 'CS'))) ? false : true}
                                        >会诊科室
                                       </Button>
                                        <Table
                                            style={{ padding: '0 24px 24px 24px', minHeight: '228px' }}
                                            columns={this.columns}
                                            dataSource={this.state.tableData}
                                            pagination={false}
                                            bordered
                                        />
                                    </Col>
                                </Row>
                            </Form>
                        </Row>
                    </div>
                    <ConsultationCenterModel
                        visible={this.state.visible}
                        parData={this.state.parData}
                        handleOk={() => this.setState({ visible: false })}
                        handthis={this}
                        onRef={this.onRefQuote}
                        admID={this.state.leftListData.admID}
                    />
                    <ConsultationAuthorization
                        visible={this.state.visible_department}
                        hideModal={() => this.setState({ visible_department: false })}
                    // handthis={this}
                    />
                    <HistoryConsultation
                        visible={this.state.visible1}
                        handleOk={() => this.setState({ visible1: false })}
                        handthis={this}
                    />


                </div>
            )
        }
    }
)
export default ConsultationProcessCenter;