/**
 * 视频通话 --门诊
 */
import React from 'react';
import { Table, Input, Form, Select, Col, Button, message, Radio, Tooltip, Switch, Modal, Row, Checkbox } from 'antd';
import { Util, dayFormat, speech } from 'tools/index';
import { $http } from 'containers/config/https';
import { $loadTemplate } from 'pages/lodop/Common/Print.js';
import ReadCard from 'components/readcard/ReadCard';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import CommonPagination from 'components/pagination/index';
import RangeDatePicker from 'components/rangePicker/index';
import { PAGE_NUM_MORE_STATUS } from 'tools/statusConstants';
import ShowFaceRecognitionModal from './ShowFaceRecognitionModal';
import { callNumberSocket } from 'tools/callNumber.js';
import ShowReferralModal from './ShowReferralModal';
import moment from 'moment';
import store from 'store';
import '../style/index.less';

const Option = Select.Option;
var mediaStreamTrack;

class OutPatientOfVideoTabPane extends React.Component {
    constructor(props) {
        super(props);
        var date = new Date();
        var userData = JSON.parse(sessionStorage.getItem('userData'));
        var recordData = JSON.parse(sessionStorage.getItem('patientData'));
        if (!recordData) {
            recordData = JSON.parse(sessionStorage.getItem('recordData'));
        }
        this.state = {
            dataSource: [],
            total: 0,
            page: 1,
            pageSize: 200,
            size: 'small',
            curPageDetail: PAGE_NUM_MORE_STATUS[0].code,
            recordData: recordData,
            userData: userData,
            receiveFlag: '1',
            queID: '',
            selectData: {},
            column: [],
            opLocAllPatListFlag: 'N',
            loading: false,
            roomPlusSignVisible: false, // 诊间加号弹窗
            roomPlusSignPatNo: undefined, // 人员标识
            roomPlusSignPatInfo: {},
            plusSignQueryErrorMsg: '', // 查询患者错误提示
            admDateFrom: moment(date).format(dayFormat),
            admDateTo: moment(date).format(dayFormat),
        };
        this.roomPlusSignRef = React.createRef();
    }

    componentWillReceiveProps(nextProp) {
        if (nextProp.isShowModal === true) {
        } else if (this.props.isShow === false) {
            this.cleanInput();
        }
    }

    componentDidMount() {
        this.props.onRef && this.props.onRef(this);
        let outPatientDefaultValue = store.getState() && store.getState().otherData && store.getState().otherData.outPatientDefaultValue ? store.getState().otherData.outPatientDefaultValue : {};
        this.setState({ ...outPatientDefaultValue }, () => {
            this.loadData(1);
        })
        this.initData();
        this.loadHeaderData();
        this.loadCardType()
        this.getBindInfo();
        document.querySelector('.ant-table-body').style.height = store.getState().tableHeight.y - 80 + 'px';
        window.addEventListener('focus', this.getBindInfo);
        if (this.state.receiveFlag == '1') {
            this.timer = setInterval(() => this.loadData(1), 60 * 1000)
        }
    }

    componentWillUnmount() {
        const { admDateFrom, admDateTo } = this.state;
        store.dispatch({
            type: 'outPatientDefaultValue',
            value: {
                admDateFrom,
                admDateTo
            }
        });
        // 组件销毁前将静止让setState修改state的状态
        window.removeEventListener('focus', this.getBindInfo);
        if (this.timer) {
            clearInterval(this.timer)
        }
        this.setState = (state, callback) => { return; }
    }

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

    //清空输入框
    cleanInput() {
        var date = new Date()
        var newDate = date.setMonth(date.getMonth() - 1);
        var dateTime = new Date()
        this.setState({
            ids: [],
            admID: '',
            leftData: [],
            rightData: [],
            admDateFrom: moment(newDate).format(dayFormat),
            admDateTo: moment(dateTime).format(dayFormat)
        })
    }

    initData() {
        let data = {
            params: [{
                compontName: "OutPatientPage",
                type: "C",
                reactCode: ['OutPatientPage']
            }]
        }
        $http.post('urlDeault', this, {
            code: "01040073",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    var columns = res.result.C;
                    var dynColumns = []
                    for (var i = 0; i < columns.length; i++) {
                        if (columns[i].dataIndex == 'patName') {
                            dynColumns.push({
                                title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                                dataIndex: columns[i].dataIndex,
                                width: parseInt(columns[i].width),
                                align: columns[i].align || 'center',
                                render: (text, data) => {
                                    return <span style={{ color: data.reAdm == 'N' ? '#52c41a' : '' }}>{data.patName}</span>
                                }
                            })
                        } else {
                            dynColumns.push({
                                title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                                dataIndex: columns[i].dataIndex,
                                width: parseInt(columns[i].width),
                                align: columns[i].align || 'center'
                            })
                        }
                    }
                    this.setState({
                        column: dynColumns,
                        localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN
                    })
                    this.props.hanlderThis.setState({
                        reload: false,
                    })
                }
            }
        })

    }

    loadData(page, pageSize, e, status) {
        this.setState({ loading: true });
        var date = new Date();
        var params = {
            params: [{
                patCardTypeID: this.props.patCardTypeID,
                patCardNo: this.props.patCardNo,
                flag: this.state.receiveFlag,
                number: this.props.number ? this.props.number : (this.state.number),
                admDateFrom: this.state.admDateFrom ? this.state.admDateFrom : moment(date).format(dayFormat),
                admDateTo: this.state.admDateTo ? this.state.admDateTo : moment(date).format(dayFormat),
                opLocAllPatListFlag: this.state.opLocAllPatListFlag, // 全科标志
            }],
            pagination: [{
                pageSize: this.state.size == 'small' ? this.state.pageSize : PAGE_NUM_MORE_STATUS[0].code,
                currentPage: page
            }]
        }
        $http.post('urlDeault', this, {
            code: this.props.convenience ? '03050264' : "03050004",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.initData()
                    this.setState({
                        loading: false,
                        dataSource: res.result.data,
                        total: res.result.totalCount,
                        rowId: res.result.data && res.result.data.length > 0 ? res.result.data[0].patAdmID : '',
                        page: page,
                        search: e,
                        number: undefined,
                        faceData: res.result.data && res.result.data.length > 0 ? res.result.data[0] : '',
                    }, () => {
                        if (status == 'face' && res.result.data && res.result.data.length > 0) {
                            let patientData = {}
                            patientData = {
                                admID: this.state.faceData.admID,
                                patID: this.state.faceData.patAdmID,
                            }
                            sessionStorage.setItem('patientData', JSON.stringify(patientData));
                            var { loadTitleData } = this.props;
                            loadTitleData && loadTitleData();
                            this.loadGetPatient(res.result.data[0])
                        }
                    })
                } else {
                    this.setState({ loading: false });
                }
            },
            error: function () {
                this.setState({ loading: false });
            }
        });
    }

    loadFaceTitle(status) {
        var params = {
            params: [{
                patID: this.state.faceData.patAdmID,
                admID: this.state.faceData.admID,
                locID: this.state.userData.locID,
                userID: this.state.userData.userID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050021",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    // sessionStorage.setItem('titleData', JSON.stringify(res.data))
                    this.setState({
                        titleData: res.data,
                        statusNote: !Util.isEmpty(res.data) ? res.data.statusCode : '',
                        statusCode: !Util.isEmpty(res.data) ? res.data.statusCode : '',
                    })
                }
            }
        });
    }

    searchPatientMsg(e) {
        if (e.keyCode == '13') {
            this.loadData(1)
        }
    }

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

    //获取卡类型
    loadCardType() {
        var params = {
            params: [{
                cardTypeFlag: '1',//卡类型
            }]
        }
        $http.post('urlDeault', this, {
            code: "03030005",
            data: params,
            success: function (res) {
                var cardStatus = '', replaceZero = '', cardLength = '', readMode = ''
                if (res.errorCode == '0') {
                    if (res.cardType && res.cardType.length > 0) {
                        var cardType = res.cardType;
                        for (var i = 0; i < cardType.length; i++) {
                            if (cardType[i].defaultFlag == 'Y') {
                                cardStatus = cardType[i].id,
                                    replaceZero = cardType[i].replenishZero
                                cardLength = cardType[i].cardLength
                                readMode = cardType[i].readMode
                            }
                        }
                    }
                    this.setState({
                        cardTypeData: res.cardType,
                        cardStatus: cardStatus,
                        readMode: readMode,
                        cardLength: cardLength,
                        replaceZero: replaceZero,
                        selectData: res?.result || {}
                    })
                }
            }
        });
    }

    getBindInfo = () => {
        let data = {
            params: [{
                userID: this.state.userData?.userID || '',
                hospID: this.state.userData?.hospID || '',
                purCode: "",
            }]
        }
        $http.post('urlDeault', this, {
            code: "04150007",
            data: data,
            success: (res) => {
                if (res.errorCode == '0') {
                    if (res.result.serverIP != undefined) {
                        callNumberSocket.init(res.result.serverIP, res.result.serverPort);
                        this.setState({
                            bindInfo: res.result,
                        })
                    }
                }
            }
        })
    }

    //叫号
    loadCallNum() {
        console.log("outV");
        this.setState({
            disCallNum: true
        })
        var params = {
            params: [{
                locID: this.state.userData.locID,
                userID: this.state.userData.userID,
                docID: this.state.userData.userID,
                admID: !Util.isEmpty(this.state.record) ? this.state.record.admID : undefined
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050006",
            data: params,
            success: async function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        disCallNum: false
                    })
                    // message.success('叫号成功')
                    message.success(this.setMessage('OutPatientPageCalled', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    this.loadData()
                    // speech.speechSynthesis(res.result, callNumberSocket.sendMsg);
                    let dllRes = await React.$dllPost(res?.dllFuncName || 'CallnumberInfo', res?.result?.readMsg || {}, res?.dllPath || 'Callnumber/MYGKProject.dll', res?.dllClassName || 'Callnumber.Callnumber');
                    console.log('dllRes', dllRes);
                } else {
                    this.setState({
                        disCallNum: false
                    })
                }
            }
        });
    }

    //过号
    loadPassNum() {
        this.setState({ disPassNum: true })
        var params = {
            params: [{
                locID: this.state.userData.locID,
                userID: this.state.userData.userID,
                docID: this.state.userData.userID,
                admID: !Util.isEmpty(this.state.record) ? this.state.record.admID : undefined
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050007",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({ disPassNum: false })
                    // message.success('过号成功')
                    message.success(this.setMessage('OutPatientPageOperation', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    this.loadData()
                } else {
                    this.setState({ disPassNum: false })
                }
            }
        });
    }

    // 一键退号
    oneClickBack = Util.debounce(() => {
        var params = {
            params: [{
                locID: this.state.userData.locID,
                userID: this.state.userData.userID,
                docID: this.state.userData.userID,
                admID: !Util.isEmpty(this.state.record) ? this.state.record.admID : undefined
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050279",
            data: params,
            success: function (res) {
                if (+res.errorCode === 0) {
                    message.success(res.errorMessage, this.state.userData && this.state.userData.messageTime);
                    this.loadData();
                }
            }
        });
    })

    startChange(date) {
        this.setState({
            admDateFrom: date,
        }, () => {
            this.loadData(1)
        })
    }

    endChange(date) {
        this.setState({
            admDateTo: date,
        }, () => {
            this.loadData(1)
        })
    }

    //分页切换
    onChange(e) {
        this.setState({ page: e }, () => {
            this.loadData(e);
        });
    }

    //分页切换
    changePageSize(current, pageSize) {
        this.setState({ pageSize: pageSize, page: current }, () => {
            this.loadData(current, pageSize);
        });
    }

    //接诊
    loadGetPatient(record) {
        // sessionStorage.setItem('recordData', JSON.stringify(record))
        var params = {
            params: [{
                patAdmID: record.patAdmID,
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050010",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    // message.success('接诊成功')
                    this.loadData(1)
                    this.loadPatientMsg(record)
                }
            }
        });
    }


    loadPatientMsg(record) {
        var params = {
            params: [{
                patID: record.patID,
                admID: record.id || record.admID,
                locID: this.state.userData.locID,
                userID: this.state.userData.userID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050021",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    sessionStorage.setItem('titleData', JSON.stringify(res.data))
                    this.setState({
                        titleData: res.data,
                    }, () => {
                        var { loadPatientMsg } = this.props;
                        loadPatientMsg && loadPatientMsg(res.data, record)

                    }
                    )
                }
            }
        });
    }

    //点击行，渲染当前行样式
    onClickRow = (record) => {
        return {
            onDoubleClick: () => {
                this.setState({
                    patAdmID: record.patAdmID
                });
                this.loadGetPatient(record)
            },
            onClick: () => {
                var patientData = {}
                patientData = {
                    admID: record.admID,
                    patID: record.patID
                }
                sessionStorage.setItem('patientData', JSON.stringify(patientData))
                this.setState({
                    rowId: record.patAdmID,
                    record: record,
                    regQueID: record.regQueID
                }, () => {
                    var { loadTitleData } = this.props;
                    loadTitleData && loadTitleData()
                })
            },
            onKeyDown: () => {
                this.setState({
                    patAdmID: record.patAdmID
                });
                this.loadGetPatient(record)
            }
        };
    }

    //提交
    onSubmit() {
        // let { onSubmit } = this.props;

        // onSubmit && onSubmit(admID, ids);
        this.loadGetPatient(this.state.record)
    }

    //点击行，渲染当前行样式
    setRowClassName = (record) => {
        return record.patAdmID === this.state.rowId ? 'clickRowStyle' : '';
    }

    commonCheckbox(name, e) {
        this.setState({
            [name]: e
        }, () => {
            this.loadData(1, '', 'search')
        })
    }

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

    onColumnRef = (ref) => {
        this.columnRef = ref;
    }

    //国际化
    setMessage(name, message) {
        return this.state.localeProvider && this.state.localeProvider[name] ? this.state.localeProvider[name][message] : ''
    }

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

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

    loadVideoCall() {
        this.setState({
            isShowVideoCallModal: true
        })
    }

    hideModal(name) {
        this.setState({
            [name]: false
        })
        if (mediaStreamTrack) {
            mediaStreamTrack.getTracks()[0].stop(); //关闭摄像头
        }
    }

    handleChangeReceive(e) {
        this.setState({
            receiveFlag: e.target.value
        }, () => {
            this.loadData(1)
        })
    }

    //人脸识别
    handleShowFaceRecognition() {
        try {
            var that = this;
            // 获取用户媒体,包含视频和音频
            navigator.mediaDevices.getUserMedia({ video: true })
                .then(stream => {
                    that.setState({ isShowFaceRecognitionModal: true }, () => {
                        var { clearData } = that.props;
                        clearData && clearData()
                    })
                    mediaStreamTrack = stream; // 将捕获的视频流传递给video  放弃window.URL.createObjectURL(stream)的使用

                }).catch(error => {
                    message.error('当前系统未检测到您的摄像头，请检查设备是否正常开启！')
                });
        } catch (error) {
            message.error("当前浏览器没有摄像头权限，请先授权。")
        }
    }

    onRef = ref => {
        this.onFace = ref
    }

    loadCallBackMsg(data) {
        this.setState({
            number: data
        }, () => {
            var { clearData } = this.props;
            clearData && clearData(data)
            this.loadData(1, '', '', 'face')
        })
    }

    //转诊
    handleReferralModal() {
        this.setState({
            isShowReferralModal: true
        })
    }

    //提交转诊
    handleSubmitReferral(data) {
        // console.log(this.state.rowId, "admID")
        // console.log(this.state.regQueID, "regQueID")
        var params = {
            params: [{
                admID: this.state.rowId,
                admLocID: data.locID,
                admDocID: data.docID,
                workID: data.resDetailID,
                userID: this.state.userData.userID,
                queID: this.state.regQueID,
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040042",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success('转诊成功！')
                    this.hideModal('isShowReferralModal')
                    this.loadData()
                }
            }
        });
    }

    // 腕带打印
    handleWristbandPrint = async (record, e) => {
        try {
            React.$stopPropagation(e);
            let data = {
                params: [{
                    admID: record?.admID || '',
                    bedID: record?.bedID || '',
                }]
            }
            let res = await React.$asyncPost(this, '04140013', data);
            $loadTemplate(record?.templateCode || 'WristbandOP', res.result);
        } catch (error) {
            console.log(error)
        }
    }

    // 全科Swicth切换
    handleQKSwitchChange = (e) => {
        this.setState({ opLocAllPatListFlag: e ? 'Y' : 'N' }, () => {
            this.loadData(1)
        })
    };

    // 诊间加号
    handleRoomPlusSignModify = (visible, isClear) => {
        this.setState({ roomPlusSignVisible: visible }, () => {
            setTimeout(() => {
                if (visible) {
                    this.roomPlusSignRef?.current?.focus();
                }
                isClear === 'Y' && this.setState({ roomPlusSignPatNo: undefined, roomPlusSignPatInfo: {} });
            }, 300)
        });
    };

    // 查询患者信息
    handleRoomPlusSignQuery = async () => {
        try {
            const { roomPlusSignPatNo } = this.state;
            if (!roomPlusSignPatNo) {
                message.error('请输入病人ID或身份证号查询！');
                this.setState({ roomPlusSignPatInfo: {}, plusSignQueryErrorMsg: '' });
                return;
            }
            let data = {
                params: [{
                    number: roomPlusSignPatNo,
                    present: 'Y'
                }]
            }
            let res = await React.$asyncPost(this, '03040004', data);
            this.setState({ roomPlusSignPatInfo: res?.data || res?.result || {}, plusSignQueryErrorMsg: '' });
        } catch (error) {
            console.log('error', error);
            this.setState({ roomPlusSignPatInfo: {}, plusSignQueryErrorMsg: error?.errorMessage || '' });
        }
    };

    // 确认加号
    handleConfirmPlusSign = async () => {
        try {
            const { roomPlusSignPatInfo } = this.state;
            if (!(roomPlusSignPatInfo?.patID)) {
                message.error('请先根据病人ID或身份证号查找需要加号的患者！');
                return;
            }
            let data = {
                params: [{
                    patID: roomPlusSignPatInfo?.patID || ''
                }]
            }
            let res = await React.$asyncPost(this, '03040050', data);
            message.success(res?.errorMessage || '加号成功');
            this.setState({ receiveFlag: '1' }, () => {
                this.handleRoomPlusSignModify(false, 'Y');
                this.loadData(1);
            });
        } catch (error) {
            console.log('error', error)
        }
    }

    render() {
        const { column, opLocAllPatListFlag, selectData, loading, roomPlusSignVisible, roomPlusSignPatNo, roomPlusSignPatInfo, admDateFrom, admDateTo } = this.state;

        //卡类型
        let cardTypeOption = []
        this.state.cardTypeData && this.state.cardTypeData.map((item, index) => {
            cardTypeOption.push(<Option key={index} value={item.id}>
                <Tooltip title={this.state.userData.language == 'EN' ? item.enDescripts : item.descripts}>
                    {this.state.userData.language == 'EN' ? item.enDescripts : item.descripts}</Tooltip></Option>)
        })

        return <div style={{ background: '#F5F7FE' }} className='outpatient-body'>
            <div>
                {/**读卡 */}
                <ReadCard ref={ref => this.readCard = ref}></ReadCard>
                <ColumnAuthoritysModel
                    clientWidth='800px'
                    compontName="OutPatientPage"
                    configType="C"
                    onRef={this.onColumnRef}
                    reloadData={this.initData}
                />

                {/**人脸识别 */}
                <ShowFaceRecognitionModal isShow={this.state.isShowFaceRecognitionModal}
                    businessCode='002' onRef={this.onRef}
                    onSubmit={this.loadCallBackMsg.bind(this)}
                    onHide={this.hideModal.bind(this, 'isShowFaceRecognitionModal')}>
                </ShowFaceRecognitionModal>

                <ShowReferralModal isShow={this.state.isShowReferralModal}
                    onHide={this.hideModal.bind(this, 'isShowReferralModal')}
                    onSubmit={this.handleSubmitReferral.bind(this)}>
                </ShowReferralModal>

                <div>
                    <Table
                        loading={loading}
                        columns={column}
                        style={{ background: 'white', height: store.getState().tableHeight.y + 16 + 'px' }}
                        dataSource={this.state.dataSource}
                        loadData={this.loadData.bind(this)}
                        onRow={this.onClickRow} bordered
                        rowClassName={this.setRowClassName}
                        title={() => {
                            return (<div className="flex-align-items" style={{ marginTop: 5 }}>
                                <Col span={6}>
                                    <Input.Group style={{ display: 'flex' }}>
                                        <div style={{ width: '37%' }}>
                                            <Input className='express-input-disables' style={{ width: '100%' }}
                                                value={'问诊日期：'} disabled />
                                        </div>
                                        <div>
                                            <RangeDatePicker
                                                label={''}
                                                format='YYYY-MM-DD'
                                                width={'100%'}
                                                isChange={true}
                                                locale={this.state.userData.language}
                                                className='express-select-border'
                                                startDate={admDateFrom}
                                                endDate={admDateTo}
                                                startChange={this.startChange.bind(this)}
                                                endChange={this.endChange.bind(this)}
                                            />
                                        </div>
                                    </Input.Group>
                                    {/* <RangeDatePicker label={this.setMessage('OutPatientPagetime', 'descripts')} format='YYYY-MM-DD' width={300}
                                        locale={this.state.userData.language}
                                        startDate={moment(date).format(dayFormat)} endDate={moment(date).format(dayFormat)}
                                        startChange={this.startChange.bind(this)} endChange={this.endChange.bind(this)} /> */}
                                </Col>
                                {selectData?.opLocAllPatListFlag === 'Y' ? (
                                    <div style={{ marginLeft: 10 }}>
                                        全科：<Switch checkedChildren="是" unCheckedChildren="否" checked={opLocAllPatListFlag === 'Y' ? true : false} onChange={this.handleQKSwitchChange} />
                                    </div>
                                ) : ''}
                                <Col span={2} style={{ marginLeft: 10 }}>
                                    <Button className='register-saveButton' type='primary' onClick={this.loadData.bind(this, 1, '', 'search')}>
                                        {this.setMessage('OutPatientPagesearch', 'descripts')}</Button>
                                </Col>

                                <div>
                                    {this.props.convenience ? null : (
                                        <span>
                                            <Button style={{ background: '#1890ff', color: 'white' }} className='patient-saveButton'
                                                onClick={this.handleShowFaceRecognition.bind(this)}>人脸识别</Button>
                                            <Radio.Group onChange={this.handleChangeReceive.bind(this)} buttonStyle="solid" value={this.state.receiveFlag}>
                                                <Radio.Button value="3">就诊完成</Radio.Button>
                                                <Radio.Button value="2">就诊中</Radio.Button>
                                                <Radio.Button value="1">未就诊</Radio.Button>
                                            </Radio.Group>
                                            <Button style={{ background: '#1999db', color: 'white', marginLeft: 24 }} className='patient-saveButton'
                                                disabled={this.state.disCallNum}
                                                onClick={this.loadCallNum.bind(this)}>{this.setMessage('OutPatientPageCall', 'descripts')}</Button>
                                            {/* <Button style={{ background: '#FA8C16', color: 'white' }} className='patient-saveButton'
                                            onClick={this.loadData.bind(this, 1, '')}>{this.setMessage('OutPatientPageReCall', 'descripts')}</Button> */}
                                            <Button style={{ background: '#13C2C2', color: 'white', marginLeft: 10 }} className='patient-saveButton'
                                                disabled={this.disPassNum}
                                                onClick={this.loadPassNum.bind(this)}>{this.setMessage('OutPatientPagePassNo', 'descripts')}</Button>
                                            {/* 一键退号 */}
                                            <Button style={{ background: this.state.record && this.state.record.admID ? "#fab926" : '#f5f5f5', color: this.state.record && this.state.record.admID ? 'white' : "rgba(0, 0, 0, 0.25)", marginLeft: 10 }} className='patient-saveButton'
                                                onClick={this.oneClickBack} disabled={this.state.record && this.state.record.admID ? false : true}>一键退号</Button>
                                            <Button disabled={this.state.record && this.state.record.admID ? false : true}
                                                type={"primary"} style={{ marginLeft: 10, marginRight: 10 }}
                                                onClick={this.handleReferralModal.bind(this)}
                                            >转诊</Button>
                                            {selectData?.doctorRegFlag === 'Y' && (
                                                <Button
                                                    style={{
                                                        marginLeft: 10,
                                                        background: '#fa8c17',
                                                        color: '#fff',
                                                        borderColor: '#fa8c17'
                                                    }}
                                                    onClick={() => this.handleRoomPlusSignModify(true)}
                                                >
                                                    诊间加号
                                                </Button>
                                            )}
                                        </span>
                                    )}
                                </div>
                            </div>)
                        }}
                        rowKey={(data) => {
                            return data.patAdmID
                        }}
                        // scroll={{ y: store.getState().tableHeight.y + 'px' }}
                        scroll={{ y: store.getState().tableHeight.y - 80 + 'px' }}
                        onHeaderRow={column => {
                            return {
                                onDoubleClick: () => {
                                    this.columnRef.onOpenModel();
                                },
                            };
                        }}
                        pagination={false}>
                    </Table>
                    <CommonPagination
                        current={this.state.page}
                        total={this.state.total}
                        search={this.state.search}
                        pageSize='200'
                        size='large'
                        onShowSizeChange={this.changePageSize.bind(this)} complete={true} dataSource={this.state.dataSource}
                        onChange={this.onChange.bind(this)}
                    />
                </div>
            </div>
            <Modal
                title="临时加号"
                width="800px"
                okText="确定"
                bodyStyle={{ padding: '24px 6px' }}
                visible={roomPlusSignVisible}
                onOk={this.handleConfirmPlusSign}
                onCancel={() => this.handleRoomPlusSignModify(false)}
            >
                <div style={{ padding: '0 18px' }} className="flex-between-center">
                    <div>
                        <Row>
                            <span style={{ display: 'inline-block', width: '10%', textAlign: 'right' }}>就诊卡号：</span>
                            <Input
                                allowClear
                                ref={this.roomPlusSignRef}
                                style={{ width: '34%', marginRight: '12px' }}
                                placeholder="就诊卡号/身份证号码"
                                value={roomPlusSignPatNo}
                                onChange={Util.commonInputChange.bind(this, 'roomPlusSignPatNo')}
                                onPressEnter={this.handleRoomPlusSignQuery}
                            />
                            <Button type="primary" onClick={this.handleRoomPlusSignQuery} >读卡</Button>
                            （输入已经存在的就诊卡号）
                        </Row>
                        <Row style={{ margin: '20px 0' }}>
                            <Col span={12}>
                                <span style={{ display: 'inline-block', width: '20%', textAlign: 'right' }}>病人姓名：</span>
                                <Input
                                    disabled
                                    placeholder=""
                                    style={{ width: '68%' }}
                                    value={roomPlusSignPatInfo?.patName || undefined}
                                />
                            </Col>
                            <Col span={12}>
                                <span style={{ display: 'inline-block', width: '20%', textAlign: 'right' }}>性别：</span>
                                <Input
                                    disabled
                                    placeholder=""
                                    style={{ width: '68%' }}
                                    value={roomPlusSignPatInfo?.patSexDesc || undefined}
                                />
                            </Col>
                        </Row>
                        <Row style={{ margin: '20px 0' }}>
                            <Col span={12}>
                                <span style={{ display: 'inline-block', width: '20%', textAlign: 'right' }}>出生日期：</span>
                                <Input
                                    disabled
                                    placeholder=""
                                    style={{ width: '68%' }}
                                    value={roomPlusSignPatInfo?.patBirthDate || undefined}
                                />
                            </Col>
                            <Col span={12}>
                                <span style={{ display: 'inline-block', width: '20%', textAlign: 'right' }}>身份证号：</span>
                                <Input
                                    disabled
                                    placeholder=""
                                    style={{ width: '68%' }}
                                    value={roomPlusSignPatInfo?.patCredNo || undefined}
                                />
                            </Col>
                        </Row>
                        <Row>
                            <Col span={8} style={{ textAlign: 'center' }}>
                                <div>
                                    <Checkbox>免挂号费</Checkbox>
                                </div>
                                <div className="common-record-delete-span" style={{ paddingLeft: '18px' }}>
                                    1.00元
                                </div>
                            </Col>
                            <Col span={8} style={{ textAlign: 'center' }}>
                                <div>
                                    <Checkbox>免诊查费</Checkbox>
                                </div>
                                <div className="common-record-delete-span" style={{ paddingLeft: '18px' }}>
                                    9.00元
                                </div>
                            </Col>
                            <Col span={8} style={{ textAlign: 'center' }}>
                                <div>
                                    <Checkbox>免病历费</Checkbox>
                                </div>
                                <div className="common-record-delete-span" style={{ paddingLeft: '18px' }}>
                                    0.60元
                                </div>
                            </Col>
                        </Row>
                        <Row style={{ color: '#999', fontWeight: 'normal', border: '1px solid #e8e8e8', borderRadius: '4px', padding: '12px', marginTop: '20px' }}>
                            点上免挂号费，将不会收取病人的挂号费，点上免诊查费将不会按你的职称收取诊查费，点上免病历费将不会收取病人病历费。
                        </Row>
                    </div>
                    {/* <span style={{ color: '#999', fontWeight: 'normal' }}>注：加号为绿色号</span> */}
                </div>
                {/* <div style={{ background: '#fbfbfb', marginTop: '20px', minHeight: '50px', fontWeight: 'normal', padding: '0 18px' }} className="flex-align-items">
                    {roomPlusSignPatInfo?.patID ? (
                        <div style={{ color: '#999' }} className="flex-wrap-align-items">
                            <div>
                                病人ID：
                                <span style={{ color: '#666', marginRight: '12px' }}>{roomPlusSignPatInfo?.patNo || ''}</span>
                            </div>
                            <div>
                                姓名：
                                <span style={{ color: '#666', marginRight: '12px' }}>{roomPlusSignPatInfo?.patName || ''}</span>
                            </div>
                            <div>
                                性别：
                                <span style={{ color: '#666', marginRight: '12px' }}>{roomPlusSignPatInfo?.patSexDesc || ''}</span>
                            </div>
                            <div>
                                年龄：
                                <span style={{ color: '#666', marginRight: '12px' }}>{roomPlusSignPatInfo?.patAge || ''}</span>
                            </div>
                            <div>
                                出生日期：
                                <span style={{ color: '#666', marginRight: '12px' }}>{roomPlusSignPatInfo?.patBirthDate || ''}</span>
                            </div>
                            <div>
                                手机号：
                                <span style={{ color: '#666', marginRight: '12px' }}>{roomPlusSignPatInfo?.patMobile || ''}</span>
                            </div>
                        </div>
                    ) : (
                        <span style={{ color: '#999' }}>{plusSignQueryErrorMsg || '请在人员标识输入框输入患者就诊卡号或身份证号码'}</span>
                    )}
                </div> */}
            </Modal>
        </div>
    }
};

export default Form.create()(OutPatientOfVideoTabPane);
