/**
 * 挂号
 * 
 */

import React from 'react';
import {
    Card, Table, Input, Form, Select, Row, Col, TimePicker, Progress, Badge,
    DatePicker, Button, Popconfirm, Icon, Divider, message, Modal, Tooltip,Spin
} from 'antd';
import ShowRegistrModal from './component/ShowRegistrModal';
import ShowInvoiceNumModal from './component/ShowInvoiceNumModal';
import ShowBackNumModal from './component/ShowBackNumModal';
import CancelOrderModal from './component/CancelOrderModal';
import ShowToOrderModal from './component/ShowToOrderModal';
import ShowGetNumModal from './component/ShowGetNumModal';
import CorrelationModal from './component/CorrelationModal';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import { $loadTemplate } from '../lodop/Common/Print.js';
import ReadCard from 'components/readcard/ReadCard';
import { $http } from 'containers/config/https';
import store from 'store';
import { Util } from 'tools/index';
import { dayFormat } from 'tools/index';
import moment from 'moment';
import './style/index.less';

const Option = Select.Option;
const Search = Input.Search;
const confirm = Modal.confirm;
const noData = require('./image/no-data1.png');

class RegistrationPage extends React.Component {
    constructor(props) {
        super(props)
        var userData = JSON.parse(sessionStorage.getItem('userData'))
        var date = new Date();
        this.state = {
            dataSource: [],
            schedulData: [],
            patientData: [],
            timeRange: [],
            date: date,
            userData: userData,
            defaultId: '1',
            typeCode: '01',
            confirmLoading:false
        }
        this.keyDownElements = this.keyDownElement.bind(this)

        this.textInput = React.createRef();
        this.textSelect = React.createRef();
        this.textCard = React.createRef();
        this.bookName = React.createRef();
        this.bookSex = React.createRef();
        this.bookCardType = React.createRef();
        this.bookCard = React.createRef();
        this.bookPhone = React.createRef();
        this.bookTime = React.createRef();
    }

    componentDidMount() {
        this.loadTimeSolt();//获取时间段
        this.initData();
        this.loadTimeRange();
        this.loadCardType('def');//获取卡类型
        this.loadDepartMent();//挂号科室信息
        this.loadRegistrNumData();//号源消耗进度
        this.loadConfigFee();//配置收费
        // this.textInput.current.focus()
        this.input.focus()
        if (!Util.isEmpty(this.getQueryString('cardNum'))) {
            this.searchBuildCardMsg()
        }
        //计算当前组件的宽度做分辨率适配
        this.clientWidth = document.body.clientWidth;
    }

    getQueryString(name) {
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
        var r = this.props.location ? this.props.location.search.substr(1).match(reg) : null;
        if (r != null) {
            return decodeURIComponent(r[2]);
        }
        return null;
    }

    componentWillUnmount() {
        //组件销毁，移除键盘监听事件
        document.removeEventListener('keydown', this.keyDownElements)
    }

    initData() {
        let data = {
            params: [{
                compontName: "RegistrationPage",
                type: "C",
            }]
        }
        $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++) {
                        dynColumns.push({
                            title: columns[i].title,
                            dataIndex: columns[i].dataIndex,
                            width: parseInt(columns[i].width),
                            align: columns[i].align || 'center'
                        })
                    }
                    this.setState({
                        column: dynColumns,
                    })
                    this.props.hanlderThis.setState({
                        reload: false,
                    })
                }
            }
        })
    }

    //获取时间段
    loadTimeSolt() {
        var params = {
            params: []
        }
        $http.post('urlDeault', this, {
            code: "03040001",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    var timeSolt = res.data;
                    for (var i = 0; i < timeSolt.length; i++) {
                        this.setState({
                            timeSolt: timeSolt[i].id
                        }, () => {
                            this.loadSchedulingMsg();//获取挂号排班记录
                        })
                    }
                }
            }
        });
    }

    //获取建卡后跳转过来信息
    searchBuildCardMsg() {
        var params = {
            params: [{
                number: this.getQueryString('posId'),
                cardTypeID: this.getQueryString('cardTypeId'),
                cardNo: this.getQueryString('cardNum')
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040004",
            data: params,
            success: function (res) {
                this.loadRegisterMsg(res.data);//查询患者挂号/预约记录
                if (res.errorCode === '0') {
                    this.textInput.current.focus()
                    message.success('患者信息查询成功！')
                    this.setState({
                        patientMsg: res.data,
                        admReason: res.data.admReason,
                        mobilephone: '',
                        credNo: '',
                        count:'',
                        returnFlag: 'N',
                        priorFalag: 'N',
                        regFlag: 'N',
                        cancleRegFlag: 'N',
                        cancleAPPFlag: 'N',
                        regPrintFlag: 'N',
                        APPPrintFlag: 'N',
                    })
                }
            }
        });
    }

    //获取卡类型
    loadCardType(data) {
        var params = {
            params: [{
                cardTypeFlag: '1',//卡类型
                sexFlag: '1',//性别
                credTypeFlag: '1',//证件类型
                socialStatusFlag: '1',//身份标签
                patTypeFlag: '1',//病人类型
                payMethodFlag: '1',//支付方式
            }]
        }
        $http.post('urlDeault', this, {
            code: "03030005",
            data: params,
            success: function (res) {
                var cardStatus = ''
                var replaceZero = ''
                var cardLength = 0
                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
                            }
                        }
                    }
                    this.setState({
                        cardTypeData: res.cardType,
                        credTypeData: res.credType,
                        patTypeData: res.patType,
                        sexData: res.sex,
                        socialStatusData: res.socialStatus,
                        cardStatus: cardStatus,
                        replenishZero: replaceZero,
                        cardLength: cardLength,
                        defCard:data
                    })
                }
            }
        });
    }

    //获取挂号排班记录
    loadSchedulingMsg() {
        var admReasonFlags = '';
        var admId = '';
        var defAdmId = '';
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlags = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlags = false;
                    defAdmId = admReason[0].id;
                }
            }
        }
        var params = {
            params: [{
                date: moment(this.state.date).format(dayFormat),
                timeRangeID: this.state.timeRangeId ? this.state.timeRangeId : this.state.timeSolt,//timeRangeId -->timeRangeID
                docID: this.state.depDoctorId,//doctorId -->docID
                locID: this.state.locId,//locId--> locID
                admReasonID: this.state.admReasonId ? this.state.admReasonId : (admReasonFlags ? admId : defAdmId),
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040002",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        schedulData: res.result.data,
                    })
                }
            }
        });
    }

    //查询患者预约/挂号记录
    loadRegisterMsg(data) {
        var admReasonFlags = '';
        var admId = '';
        var defAdmId = '';
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlags = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlags = false;
                    defAdmId = admReason[0].id;
                }
            }
        }
        if (this.state.paitId || (data && data.patID) || (this.state.patientMsg && this.state.patientMsg.patID)) {
            var params = {
                params: [{
                    patIDCardNo: this.state.paitId,
                    date: moment(this.state.date).format(dayFormat),
                    patID: data ? data.patID : (this.state.patientMsg) ? this.state.patientMsg.patID : '',//patientDr --> patID
                    admReasonID: this.state.admReasonId ? this.state.admReasonId : (admReasonFlags ? admId : defAdmId),
                }]
            }
            $http.post('urlDeault', this, {
                code: "03040003",
                data: params,
                success: function (res) {
                    if (res.errorCode === '0') {
                        this.setState({
                            patientData: res.data
                        })
                    }
                }
            });
        }
    }


    //查询时段服务
    loadTimeRange() {
        var params = {
            params: [{
                hospID: this.state.userData.hospID
            }]
        }
        $http.post('urlDeault', this, {
            code: "01040010",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        timeRange: res.timeRange
                    })
                }
            }
        });
    }

    loadDepartMent() {
        var params = {
            params: [{
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040005",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        departMentData: res.result.Data
                    })
                }
            }
        });
    }

    //号源消耗进度
    loadRegistrNumData() {
        var date = new Date();
        var params = {
            params: [{
                date: this.state.date ? moment(this.state.date).format(dayFormat) : moment(date).format(dayFormat)
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040012",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        registrNumData: res.data
                    })
                }
            }
        });
    }

    //配置收费
    loadConfigFee() {
        var params = {
            params: [{
                logonHospID: this.state.userData.hospID,
                logonGroupID: this.state.userData.groupID,
                logonUserID: this.state.userData.userID,
                invTypeCode: 'R',
                menuType: this.state.userData.defaultMenuType
            }]
        }
        $http.post('urlDeault', this, {
            code: "05210001",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.state.groupConfig = res.groupConfig
                    this.state.sysConfig = res.sysConfig
                    this.state.currentInvNoInfo = res.currentInvNoInfo
                    this.state.registerInfo = res.registerInfo
                    this.state.newPayWay = res.groupConfig.HBOPConfigPaymode[0].Reg
                    this.setState({}, () => {
                        var invNo = '';
                        var currentInvNo = ''
                        //对发票号进行截取
                        if (this.state.currentInvNoInfo) {
                            var currentInvNoInfo = this.state.currentInvNoInfo;
                            invNo = currentInvNoInfo.substring(currentInvNoInfo.indexOf('^') + 1);
                            currentInvNo = invNo.substring(invNo.indexOf('^') + 1)
                        }
                        if (this.state.groupConfig && this.state.groupConfig.IfInvNo == 'Y' && Util.isEmpty(currentInvNo)) {
                            message.error('当前无发票号，无法进行挂号')
                        }
                    })
                }
            }
        });
    }

    //获取挂号医生信息
    loadDoctorId() {
        var params = {
            params: [{
                locID: this.state.locId
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040006",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        depDoctorData: res.depDoctor
                    })
                }
            }
        });
    }

    //鼠标移入card，添加挂号按钮
    addRegistrBtn(index, e) {
        this.setState({
            setBabkground: true,
            mouseElement: true,
            rowIds: index
        })
    }

    addFloatElement(code, item) {
        // var floatOption = []
        var params = {
            params: [{
                patID: this.state.patientMsg ? (this.state.patientMsg.patID) : '',
                resDetailID: item.resDetailID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040018",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        orderData: res.data,
                        floatStatus: true,
                        floatData: item
                    }, () => {
                        this.loadElementDome()
                    })
                }
            }
        });
        // return floatOption
    }

    loadElementDome() {
        var floatOption = []
        if (!Util.isEmpty(this.state.orderData)) {
            var resDetail = this.state.orderData.resDetail;
            resDetail && resDetail.map((item, index) => {
                floatOption.push(
                    <div className='order-table-body-float' onDoubleClick={this.handleFloatToOrder.bind(this, '', item.id)}>
                        <div><div className={item.workStatusCode == 'S' ? 'stop-order-num-new' :
                            (item.workStatusCode == 'F' ? 'full-order-num-new' : '')}></div>
                            <div className={item.workStatusCode == 'N' ? 'order-table-disable-new' : 'order-table-title-new'}>
                                {item.timeDetail}</div></div>
                        <div style={{ background: 'white', height: 28 }}>{item.workStatusCode == 'S' ? <span style={{ color: 'red' }}>停诊</span> :
                            (item.workStatusCode == 'F' ? <span style={{ color: '#bbbbbb' }}>约满</span> :
                                <span style={{ color: 'rgba(102,102,102,1)' }}>{item.regResources}</span>)
                        }</div>
                    </div>
                )
            })
        }
        return floatOption
    }

    handleFloatToOrder(name, code, e) {
        e.stopPropagation()//冒泡阻止多次调用点击事件
        if (Util.isEmpty(this.state.patientMsg)) {
            message.error('必填信息不能为空！')
            return
        }
        this.setState({
            bookStatus: true,
            isShowToOrderModal: true,
            floatStatus: false,
            bookCode: code
        }, () => {
            this.handleToOrder(this.state.floatData)
        })
    }

    //enter键去挂号
    handleRegistrBtn(index, data, e) {
        this.setState({
            floatStatus: false
        })
        if (e.keyCode == '13') {
        } else if (e.keyCode == '37') {//左方向键
            if (parseInt(this.state.rowIds) - 1 < 0) {
                this.setState({//当向左移动已无数据时，默认第一个数据
                    rowIds: '0'
                })
            } else {
                this.setState({
                    rowIds: parseInt(this.state.rowIds) - 1
                })
            }
        } else if (e.keyCode == '38') {//上方向键
            if (this.clientWidth < 1500) {
                if (parseInt(this.state.rowIds) - 4 < 0) {
                    this.setState({//当上移已无数据时，默认当前数据
                        rowIds: index
                    })
                } else {
                    this.setState({
                        rowIds: parseInt(this.state.rowIds) - 4
                    })
                }
            } else {
                if (parseInt(this.state.rowIds) - 5 < 0) {
                    this.setState({//当上移已无数据时，默认当前数据
                        rowIds: index
                    })
                } else {
                    this.setState({
                        rowIds: parseInt(this.state.rowIds) - 5
                    })
                }
            }
        } else if (e.keyCode == '39') {//右方向键schedulData
            if (parseInt(this.state.rowIds) + 1 == this.state.schedulData.length) {
                this.setState({//当右移大于当前数据的长度时，默认当前数据
                    rowIds: index
                })
            } else {
                this.setState({
                    rowIds: parseInt(this.state.rowIds) + 1
                })
            }
        } else if (e.keyCode == '40') {//下方向键
            if (this.clientWidth < 1500) {
                if (parseInt(this.state.rowIds) + 4 >= this.state.schedulData.length) {
                    this.setState({//当下移大于当前数据的长度时，默认当前数据
                        rowIds: index
                    })
                } else {
                    this.setState({
                        rowIds: parseInt(this.state.rowIds) + 4
                    })
                }
            } else {
                if (parseInt(this.state.rowIds) + 5 >= this.state.schedulData.length) {
                    this.setState({//当下移大于当前数据的长度时，默认当前数据
                        rowIds: index
                    })
                } else {
                    this.setState({
                        rowIds: parseInt(this.state.rowIds) + 5
                    })
                }
            }
        }
    }

    //鼠标离开，移除挂号按钮
    removeRegistrBtn() {
        this.setState({
            mouseElement: false,
            floatStatus: true,
            setBabkground: false//鼠标移出，title回复
        })
    }

    //双击，添加背景颜色
    addBackground(index, e) {
        this.setState({
            setBabkground: true,
            mouseElement: true,
            rowIds: index
        })
    }

    //键盘F1-F12按钮事件
    keyDownElement(e) {
        // var rthis = this;
        if (e.keyCode == '113' && this.state.regFlag == 'Y') {
            this.showGetNumModal()//F2,取号
        } else if (e.keyCode == '117' && this.state.cancleRegFlag == 'Y') {
            this.showBackNumModal()//F6，退号
        } else if (e.keyCode == '121' && this.state.cancleAPPFlag == 'Y') {
            this.showCannelOrderModal()//F10，取消预约
        } else if (e.keyCode == '119') {//重打凭条
            this.printEntrySlip()
        } else if (e.keyCode == '120') {//重打发票
            this.printInvoice()
        } else if (e.keyCode == '27') {
            this.setState({
                focusStatus: true
            }, () => {
                this.textSelect.current.focus()
            })
        }
    }

    //隐藏弹出框
    hideModal(name) {
        this.setState({
            [name]: false,//将所有参数置为false
            bookStatus: false,
            confirmLoading:false
        });
    }

    handleSelectChange(name, e) {
        this.setState({
            [name]: e
        }, () => {
            this.loadSchedulingMsg();
            this.loadRegisterMsg();//查询患者挂号/预约记录
        })
    }

    changeDepartMent(e) {
        var id = '';
        if (e) {
            id = e.substring(e.indexOf('^') + 1)
        }
        this.setState({
            locId: id,
            rowIds: '0',
            setBabkground: true,
            mouseElement: true,
            focusStatus: false
        }, () => {
            this.loadSchedulingMsg();
            this.loadDoctorId();
        })
        document.addEventListener('keydown', this.keyDownElements)
    }

    changeDepDoctor(e) {
        var id = '';
        if (e) {
            id = e.substring(e.indexOf('*') + 1);
        }
        this.setState({
            depDoctorId: id,
            rowIds: '0',
            setBabkground: true,
            mouseElement: true

        }, () => {
            this.loadSchedulingMsg();
        })
    }

    //去挂号弹框
    showRegistrModal(data) {
        if (parseInt(data.registedNum) >= parseInt(data.registNum)) {
            message.error('挂号已满，请选择其他科室或者坐诊医生');
            return
        }
        var { registrSumData } = this.state;
        var admReasonFlags = '';
        var admId = '';
        var defAdmId = '';
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlags = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlags = false;
                    defAdmId = admReason[0].id;
                }
            }
        }
        if (this.state.admReason && this.state.admReason.length > 0) {
            if (this.state.patientMsg) {
                var params = {
                    params: [{
                        patID: this.state.patientMsg.patID,
                        admReasonID: this.state.admReasonId ? this.state.admReasonId : (admReasonFlags ? admId : defAdmId),
                        insuBalance: 0,
                        insuSum: 0,
                        resDetailID: data.resDetailID
                    }]
                }
                $http.post('urlDeault', this, {
                    code: "03040008",
                    data: params,
                    success: function (res) {
                        if (res.errorCode === '0') {
                            this.setState({
                                registrSumData: res.data
                            })
                        }
                    }
                });
                this.setState({
                    isShowRegistrModal: true,
                    registrMsg: data
                })
            } else {
                message.error('必填信息不能为空')
            }
        } else {
            message.error('结账费别不能为空')
        }
    }

    //设置发票号    
    showInvoiceNumModal() {
        this.setState({
            isShowInvoiceNumModal: true
        })
    }

    changeBirthDay(e) {
        this.setState({
            birthDayDate: e
        })
    }

    chengeTime(e) {
        var date = moment(new Date()).format(dayFormat);
        var afterDate = moment(e).format(dayFormat);
        if (date < afterDate) {
            this.setState({
                date: e,
                orderStatus: true
            }, () => {
                this.loadSchedulingMsg();//获取挂号排班记录
                this.loadRegisterMsg();
                this.loadRegistrNumData()
            })
        } else {
            this.setState({
                date: e,
                orderStatus: false
            }, () => {
                this.loadSchedulingMsg();//获取挂号排班记录
                this.loadRegisterMsg();
                this.loadRegistrNumData()
            })
        }
    }

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

    //输入卡号进行查询
    changeCardNum(e) {
        this.setState({
            cardNum: e.target.value,
            clearStatus: true
        })
    }

    changePaitId(e) {
        this.setState({
            paitId: e.target.value,
            paitStatus: true
        })
    }

    handleReadCard() {
        var cardType = this.state.cardTypeId ? this.state.cardTypeId : (this.state.cardStatus ? this.state.cardStatus : this.getQueryString('cardTypeId'))
        this.readCard.ReadCard(cardType, "R", (json) => {
            this.setState({ readPatID: json && json.patInfo ? json.patInfo.patID : '', readCardNo: json.cardNo, readStatus: 'read' }, () => {
                this.serachPatiMsg('read')
            })
        })
    }

    serachPatiMsg(e) {
        this.setState({//自动补0，渲染到组件中
            cardNum: this.state.replenishZero == 'Y' ? (Array(parseInt(this.state.cardLength)).join(0) + this.state.cardNum).slice(-parseInt(this.state.cardLength)) : this.state.cardNum
        })
        var params = {
            params: [{
                number: e == 'read' ? this.state.readPatID : (this.state.paitId ? this.state.paitId : this.getQueryString('posId')),
                cardTypeID: this.state.cardTypeId ? this.state.cardTypeId : (this.state.cardStatus ? this.state.cardStatus : this.getQueryString('cardTypeId')),//cardTypeDr -->cardTypeID
                // cardNo: this.state.cardNum
                cardNo: e == 'read' ? this.state.readCardNo : (this.state.replenishZero == 'Y' ? (Array(parseInt(this.state.cardLength)).join(0) + this.state.cardNum).slice(-parseInt(this.state.cardLength)) :
                    (this.state.cardNum ? this.state.cardNum : this.getQueryString('cardNum')))
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040004",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.textInput.current.focus()
                    message.success('患者信息查询成功！')
                    this.setState({
                        patientMsg: res.data,
                        admReason: res.data.admReason,
                        mobilephone: '',
                        credNo: '',
                        count:'',
                        returnFlag: 'N',
                        priorFalag: 'N',
                        regFlag: 'N',
                        cancleRegFlag: 'N',
                        cancleAPPFlag: 'N',
                        regPrintFlag: 'N',
                        APPPrintFlag: 'N',
                    }, () => {
                        this.loadSchedulingMsg()
                        this.loadRegisterMsg(res.data);//查询患者挂号/预约记录
                    })
                } else {
                    var that = this;
                    var cardTypeId = this.state.cardTypeId ? this.state.cardTypeId : (this.state.cardStatus);
                    var paitId = e == 'read' ? ('&paitId=' + this.state.paitId) : (this.state.paitId ? ('&paitId=' + this.state.paitId) : '');
                    var cardNum = e == 'read' ? ('&cardNum=' + this.state.readCardNo) : (this.state.cardNum ? ('&cardNum=' + this.state.cardNum) : '');
                    confirm({
                        title: '确认建卡',
                        content: <span><span style={{ color: 'red' }}>当前为{res.errorMessage},</span>
                            <span>确定要跳转到建卡页面吗？</span></span>,
                        onOk() {
                            that.goRegistrCard(cardTypeId, paitId, cardNum)
                        },
                        onCancel() {
                            console.log('Cancel');
                        },
                    });
                    this.setState({
                        patientMsg: ''
                    })
                }
            }
        });
    }
    //that.props.history.push('./03030002?cardTypeId=' + cardTypeId + paitId + cardNum)

    goRegistrCard(cardTypeId, paitId, cardNum) {
        if (!Util.isEmpty(this.state.registerInfo)) {
            if (this.state.registerInfo.jumpFlag == 'Y') {
                this.props.history.push('./03030002?cardTypeId=' + cardTypeId + paitId + cardNum)
            } else {
                message.error('暂无权限建卡，请先联系管理员！')
                return
            }
        }
    }

    //enter查询病人信息
    handleSelectPersonMsg(data, e) {
        if (e.keyCode == '13') {
            if (Util.isEmpty(this.state.cardNum) && Util.isEmpty(data)) {
                message.error('请先输入您需要查询的卡号！')
                return
            }
            this.textInput.current.focus()
            if (Util.isEmpty(data)) {
                this.setState({//自动补0，渲染到组件中
                    cardNum: this.state.replenishZero == 'Y' ? (Array(parseInt(this.state.cardLength)).join(0) + this.state.cardNum).slice(-parseInt(this.state.cardLength)) : this.state.cardNum
                })
            }
            // var params = {
            //     params: [{
            //         number: this.state.paitId,
            //         cardTypeID: this.state.cardTypeId ? this.state.cardTypeId : (this.state.cardStatus),//cardTypeDr -->cardTypeID
            //         // cardNo: this.state.cardNum
            //         cardNo: this.state.replenishZero == 'Y' ? (Array(parseInt(this.state.cardLength)).join(0) + this.state.cardNum).slice(-parseInt(this.state.cardLength)) : this.state.cardNum
            //     }]
            // }
            var params = {
                params: [{
                    number: this.state.paitId ? this.state.paitId : this.getQueryString('posId'),
                    cardTypeID: this.state.cardTypeId ? this.state.cardTypeId : (this.state.cardStatus ? this.state.cardStatus : this.getQueryString('cardTypeId')),//cardTypeDr -->cardTypeID
                    // cardNo: this.state.cardNum
                    cardNo: (this.state.cardNum ? this.state.cardNum : (this.getQueryString('cardNum') || ''))
                }]
            }
            $http.post('urlDeault', this, {
                code: "03040004",
                data: params,
                success: function (res) {
                    if (res.errorCode === '0') {
                        message.success('患者信息查询成功！')
                        this.setState({
                            patientMsg: res.data,
                            admReason: res.data.admReason,
                            mobilephone: '',
                            credNo: '',
                            count:'',
                            returnFlag: 'N',
                            priorFalag: 'N',
                            regFlag: 'N',
                            cancleRegFlag: 'N',
                            cancleAPPFlag: 'N',
                            regPrintFlag: 'N',
                            APPPrintFlag: 'N',
                        }, () => {
                            this.loadRegisterMsg(res.data);//查询患者挂号/预约记录
                            this.loadSchedulingMsg()
                        })
                    } else {
                        var that = this;
                        var cardTypeId = this.state.cardTypeId ? this.state.cardTypeId : (this.state.cardStatus);
                        var paitId = this.state.paitId ? ('&paitId=' + this.state.paitId) : '';
                        var cardNum = this.state.cardNum ? ('&cardNum=' + this.state.cardNum) : '';
                        confirm({
                            title: '确认建卡',
                            content: <span><span style={{ color: 'red' }}>当前为{res.errorMessage},</span>
                                <span>确定要跳转到建卡页面吗？</span></span>,
                            onOk() {
                                // that.props.history.push('./03030002?cardTypeId=' + cardTypeId + paitId + cardNum)
                                if (that.state.userData.defaultMenuType == '2') {
                                    that.goRegistrCards(cardTypeId, paitId, cardNum)
                                } else {
                                    that.props.history.push('./03030002?cardTypeId=' + cardTypeId + paitId + cardNum)
                                }
                            },
                            onCancel() {
                                console.log('Cancel');
                            },
                        });
                        this.setState({
                            patientMsg: ''
                        })
                    }
                }
            });
        }
    }

    goRegistrCards(cardTypeId, paitId, cardNum) {
        if (!Util.isEmpty(this.state.registerInfo)) {
            if (this.state.registerInfo.jumpFlag == 'Y') {
                var data = {
                    cardTypeId: cardTypeId,
                    paitId: paitId,
                    cardNum: cardNum
                }
                this.props.openWindowBySubTab({
                    title: '建卡登记',
                    path: '/03030002',
                    Paras: {
                        targetKey: '建卡登记',
                        flag: 'compile',
                        userInfo: data
                    },
                    component: "pages/registercard/RegisterPatCard.jsx"
                });
            } else {
                message.error('暂无权限建卡，请先联系管理员！')
                return
            }
        }
    }

    //清除输入框数据
    clearInput() {
        this.setState({
            patientMsg: '',
            cardNum: '',
            paitId: '',
            patientData: [],
            bookName: '',
            bookSex: undefined,
            credType: '',
            credNo: '',
            birthDayDate: '',
            yearOld: '',
            mobilephone: '',
            personDr: undefined,
            personType: undefined,
            personMoney: '',
            patinId: '',
            returnFlag: 'N',
            priorFalag: 'N',
            regFlag: 'N',
            cancleRegFlag: 'N',
            cancleAPPFlag: 'N',
            regPrintFlag: 'N',
            APPPrintFlag: 'N',
            checkData: '',
            admReasonId: undefined,
            admReason: [],
            correCode: false
        })
    }

    //点击预约，获取预约状态，对预约时间进行disabled操作
    showDate() {
        var { bookName, bookSex, credType, credNo, mobilephone, patientMsg } = this.state;
        // if (Util.isEmpty(patientMsg) && (Util.isEmpty(bookName) || Util.isEmpty(bookSex)
        //     || Util.isEmpty(credNo) || Util.isEmpty(mobilephone))) {
        //     message.error('病人必填信息不能为空，请先输入相关信息')
        //     return
        // }
        var date = new Date();//点击预约，日期+1
        if (this.state.showNewDate) {
            this.setState({
                showDate: false,
                date: date,
                orderStatus: false,
                showNewDate: false
            }, () => {
                this.loadSchedulingMsg()
                this.loadRegisterMsg()
                this.loadRegistrNumData()
            })
        } else {
            this.setState({
                showDate: true,
                date: moment(new Date()).add(1, 'days').format(),
                orderStatus: true,
                showNewDate: true
            }, () => {
                this.loadSchedulingMsg()
                this.loadRegisterMsg()
                this.loadRegistrNumData()
                this.bookName.current.focus()
            })
        }
    }

    showRegistrDate() {
        var date = new Date();//点击预约，日期-1
        this.setState({
            showNewDate: true,
            date: moment(new Date()).add(-1, 'days').format(),
            orderStatus: false,
            showDate: true
        }, () => {
            this.loadSchedulingMsg()
        })
    }

    //点击行，渲染当前行样式
    onClickRow = (record) => {
        return {
            onClick: () => {
                this.setState({
                    rowId: record.admID,
                    admDr: record.admID,
                    payMentDr: record.recordID,
                    regQueDr: record.regQueID,
                    recordData: record,
                    bookScheduleDr: record.bookScheduleID,
                    workScheduleDr: record.resDetailID,//点击行，获取排班id
                    count: record.count,
                    returnFlag: record.returnFlag,//复诊标识
                    priorFalag: record.priorFalag,//优先标识
                    regFlag: record.regFlag,//取号标识
                    cancleRegFlag: record.cancleRegFlag,//退号标识
                    cancleAPPFlag: record.cancleAPPFlag,//取消预约标识
                    regPrintFlag: record.regPrintFlag,//重打凭条标识
                    APPPrintFlag: record.APPPrintFlag,//重打发票
                    cancleRegTips: record.cancleRegTips

                });
                //点击表格后，监听键盘事件
                document.addEventListener('keydown', this.keyDownElements)
            },
        };
    }

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

    //不结算挂号
    loadRegistration(data) {
        var { registrSumData } = this.state;
        var admReasonFlags = '';
        var admId = '';
        var defAdmId = '';
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlags = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlags = false;
                    defAdmId = admReason[0].id;
                }
            }
        }
        var params = {
            params: [{
                resDetailID: data.resDetailID,
                userID: this.state.userData.userID,
                groupID: this.state.userData.groupID,
                cardID: this.state.patientMsg.cardID,
                locID: this.state.userData.locID,//loc -->locID
                hospID: this.state.userData.hospID,
                patID: this.state.patientMsg.patID,//patientDr -->patID
                contractUnitID: this.state.userData.hospID,
                bookMethodID: "Win",//写死
                admReasonID: this.state.admReasonId ? this.state.admReasonId : (admReasonFlags ? admId : defAdmId),
                paywStr: []
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040007",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('挂号成功！')
                    // this.loadRegisterMsg()
                    this.loadSchedulingMsg();
                    this.loadRegistrNumData();
                    this.loadConfigFee();
                    this.hideModal('isShowRegistrModal')
                    // $loadTemplate("Registration", res.print);
                    if(!Util.isEmpty(res.print)){
                        $loadTemplate("Registration", res.print);
                      }
                      if(!Util.isEmpty(res.invPrint.data) && !Util.isEmpty(res.invPrint.template)){
                        $loadTemplate(res.invPrint.template, res.invPrint.data);
                      }
                    this.clearInput()
                    this.setState({
                        patientData: [],
                        returnFlag: 'N',
                        priorFalag: 'N',
                        regFlag: 'N',
                        cancleRegFlag: 'N',
                        cancleAPPFlag: 'N',
                        regPrintFlag: 'N',
                        APPPrintFlag: 'N',
                        count: '',
                    })
                }
            }
        });
    }

    //挂号
    onSubmitRegastr(data, payWayId, payWayMoney, realPayMoney, hospitalId, checkAccount) {
        var { registrSumData } = this.state;
        var admReasonFlags = '';
        var admId = '';
        var defAdmId = '';
        this.setState({confirmLoading:true})
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlags = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlags = false;
                    defAdmId = admReason[0].id;
                }
            }
        }
        var params = {
            params: [{
                resDetailID: this.state.registrMsg.resDetailID,
                userID: this.state.userData.userID,
                groupID: this.state.userData.groupID,
                cardID: this.state.patientMsg.cardID,
                locID: this.state.userData.locID,//loc -->locID
                hospID: this.state.userData.hospID,
                patID: this.state.patientMsg.patID,//patientDr -->patID
                contractUnitID: hospitalId,
                bookMethodID: "Win",//写死
                admReasonID: this.state.admReasonId ? this.state.admReasonId : (admReasonFlags ? admId : defAdmId),
                // paywStr: (registrSumData.paywCASHID + '^' + realPayMoney + '^' + (Util.isEmpty(hospitalId) ? '' : hospitalId)) + String.fromCharCode(2) +
                //     (registrSumData.paywACCID + '^' + (checkAccount?0:data.accountFee) + '^' + (Util.isEmpty(hospitalId) ? '' : hospitalId)) + String.fromCharCode(2) +
                //     ((payWayId?payWayId:'') + '^' + payWayMoney + '^' + (Util.isEmpty(hospitalId) ? '' : hospitalId))
                paywStr: [{
                    payWayID: registrSumData.paywCASHID,
                    payWayAmt: realPayMoney,
                    hospID: Util.isEmpty(hospitalId) ? '' : hospitalId
                }, {
                    payWayID: registrSumData.paywACCID,
                    payWayAmt: checkAccount ? 0 : data.accountFee,
                    hospID: Util.isEmpty(hospitalId) ? '' : hospitalId
                }, {
                    payWayID: payWayId ? payWayId : '',
                    payWayAmt: Math.abs(payWayMoney.toFixed(2)),
                    hospID: Util.isEmpty(hospitalId) ? '' : hospitalId
                }]
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040007",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('挂号成功！')
                    // this.loadRegisterMsg()
                    this.loadSchedulingMsg();
                    this.loadRegistrNumData();
                    this.loadConfigFee();
                    this.hideModal('isShowRegistrModal')
                    // $loadTemplate("Registration", res.print);
                    if(!Util.isEmpty(res.print)){
                        $loadTemplate("Registration", res.print);
                      }
                      if(!Util.isEmpty(res.invPrint.data) && !Util.isEmpty(res.invPrint.template)){
                        $loadTemplate(res.invPrint.template, res.invPrint.data);
                      }
                    this.clearInput()
                    this.input.focus()
                    this.setState({
                        patientData: [],
                        locId: '',
                        returnFlag: 'N',
                        priorFalag: 'N',
                        regFlag: 'N',
                        cancleRegFlag: 'N',
                        cancleAPPFlag: 'N',
                        regPrintFlag: 'N',
                        APPPrintFlag: 'N',
                        count: '',
                        confirmLoading:false
                    })
                }else{
                    this.setState({
                        confirmLoading:false
                    })
                }
            }
        });
    }

    //取号
    onSubmitGetNum(data, payWayId, payWayMoney, realPayMoney, hospitalId, checkAccount) {
        var { getRegistrData } = this.state;
        var admReasonFlags = '';
        var admId = '';
        var defAdmId = '';
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlags = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlags = false;
                    defAdmId = admReason[0].id;
                }
            }
        }

        var params = {
            params: [{
                resDetailID: this.state.workScheduleDr,
                userID: this.state.userData.userID,
                groupID: this.state.userData.groupID,
                cardID: this.state.patientMsg.cardID,
                locID: this.state.userData.locID,
                hospID: this.state.userData.hospID,
                patID: this.state.patientMsg.patID,
                contractUnitID: hospitalId,
                bookScheduleID: this.state.recordData.bookScheduleID,
                bookMethodID: "Win",//写死
                admReasonID: this.state.admReasonId ? this.state.admReasonId : (admReasonFlags ? admId : defAdmId),
                paywStr: [{
                    payWayID: getRegistrData.paywCASHID,
                    payWayAmt: realPayMoney,
                    hospID: Util.isEmpty(hospitalId) ? '' : hospitalId
                }, {
                    payWayID: getRegistrData.paywACCID,
                    payWayAmt: checkAccount ? 0 : data.accountFee,
                    hospID: Util.isEmpty(hospitalId) ? '' : hospitalId
                }, {
                    payWayID: payWayId ? payWayId : '',
                    payWayAmt: Math.abs(payWayMoney.toFixed(2)),
                    hospID: Util.isEmpty(hospitalId) ? '' : hospitalId
                }]
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040007",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success('取号成功！')
                    this.loadRegisterMsg()
                    this.hideModal('isShowGetNumModal')
                    // $loadTemplate("Registration", res.print);
                    if(!Util.isEmpty(res.print)){
                        $loadTemplate("Registration", res.print);
                      }
                      if(!Util.isEmpty(res.invPrint.data) && !Util.isEmpty(res.invPrint.template)){
                        $loadTemplate(res.invPrint.template, res.invPrint.data);
                      }
                    this.setState({
                        returnFlag: 'N',
                        priorFalag: 'N',
                        regFlag: 'N',
                        cancleRegFlag: 'N',
                        cancleAPPFlag: 'N',
                        regPrintFlag: 'N',
                        APPPrintFlag: 'N',
                        count: '',
                    })
                }
            }
        });
    }

    //加载当日号源消耗进度
    loadRegistrNum() {
        var registrNumOption = []
        var { registrNumData } = this.state;
        registrNumData && registrNumData.map((item, index) => {
            registrNumOption.push(
                <div style={{ marginLeft: '10px', marginRight: '10px' }} key={index}>
                    <Badge status='success' text={item.locDescripts + ':已用号源/总号源' + (
                        item.registedNumSum + '/' + item.registNumSum)}></Badge><Progress percent={item.proportion} />
                </div>
            )
        })
        return registrNumOption;
    }

    //退号
    showBackNumModal() {
        if (this.state.groupConfig) {
            if (this.state.groupConfig.IfAbortFlag !== 'Y' && this.state.recordData.SFlag !== 'A') {
                message.error('暂无作废权限，无法进行退号')
                return
            } else if (this.state.groupConfig.IfStrikeFlag !== 'Y' && this.state.recordData.SFlag !== 'S') {
                message.error('暂无红冲权限，无法进行退号')
                return
            }
        }
        var params = {
            params: [{
                recodeIDStr: this.state.payMentDr
            }]
        }
        $http.post('urlDeault', this, {
            code: "05210008",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        registrFee: res.chargeAmtInfo[0]
                    })
                }
            }
        });
        this.setState({
            isShowBackNumModal: true
        })
    }

    //取号
    showGetNumModal() {
        var { registrSumData } = this.state;
        var admReasonFlags = '';
        var admId = '';
        var defAdmId = '';
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlags = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlags = false;
                    defAdmId = admReason[0].id;
                }
            }
        }
        var params = {
            params: [{
                patID: this.state.patientMsg.patID,
                resDetailID: this.state.workScheduleDr,
                admReasonID: this.state.admReasonId ? this.state.admReasonId : (admReasonFlags ? admId : defAdmId),
                insuBalance: 0,
                insuSum: 0,
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040008",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    this.setState({
                        getRegistrData: res.data
                    })
                }
            }
        });
        this.setState({
            isShowGetNumModal: true
        })
    }

    //退号
    registrBackNum(id) {
        var params = {
            params: [{
                admID: this.state.admDr,
                repaywID: id
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040016",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('退号成功！')
                    this.setState({
                        count: '',
                        returnFlag: 'N',//复诊标识
                        priorFalag: 'N',//优先标识
                        regFlag: 'N',//取号标识
                        cancleRegFlag: 'N',//退号标识
                        cancleAPPFlag: 'N',//取消预约标识
                        regPrintFlag: 'N',//重打凭条标识
                        APPPrintFlag: 'N',//重打发票
                    })
                    this.hideModal('isShowBackNumModal')
                    this.loadRegisterMsg()
                }
            }
        });
    }

    //复诊  
    visitDoctor() {
        var params = {
            params: [{
                regQueID: this.state.regQueDr,
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040015",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('操作成功！')
                    this.loadRegisterMsg()
                }
            }
        });
    }

    //优先
    loadPriority() {
        var params = {
            params: [{
                regQueID: this.state.regQueDr,
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040014",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('操作成功！')
                    this.loadRegisterMsg()
                }
            }
        });
    }

    showRegistrOrOrder(data) {
        var invNo = '';
        var currentInvNo = ''
        //对发票号进行截取
        if (this.state.currentInvNoInfo) {
            var currentInvNoInfo = this.state.currentInvNoInfo;
            invNo = currentInvNoInfo.substring(currentInvNoInfo.indexOf('^') + 1);
            currentInvNo = invNo.substring(invNo.indexOf('^') + 1)
        }
        if (Util.isEmpty(this.state.groupConfig) || (this.state.groupConfig && this.state.groupConfig.IfChargeFlag == 'N')) {
            message.error('无收费权限，暂时无法挂号')
            return
        }
        if (this.state.groupConfig && this.state.groupConfig.IfInvNo == 'Y' && Util.isEmpty(currentInvNo)) {
            message.error('当前无可用发票，无法挂号')
            return
        }
        if (this.state.orderStatus) {
            this.handleToOrder(data)
        } else if (!Util.isEmpty(this.state.registerInfo) && this.state.registerInfo.noChargeFlag == 'Y') {
            this.loadRegistration(data)
        } else if (!Util.isEmpty(this.state.registerInfo) && this.state.registerInfo.noChargeFlag == 'N') {
            this.showRegistrModal(data)
        }
    }

    //预约
    handleToOrder(data) {
        if (parseInt(data.registedNum) >= parseInt(data.registNum)) {
            message.error('号源已满，请选择其他科室或者坐诊医生');
            return
        }
        //手机号码校验
        var mobile = /^[1-9]\d{10}$/;
        var phone = this.state.mobilephone;
        if (phone && !mobile.test(phone)) {
            message.error('手机号码输入格式不正确，请重新输入')
            return
        }
        var idCard = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
        var cardNo = this.state.credNo;
        if (cardNo && !idCard.test(cardNo) && this.state.typeCode == '01') {
            message.error('身份证号码输入格式不正确，请重新输入')
            return
        }
        var { bookName, bookSex, credType, credNo, credTypeData } = this.state;
        if (this.state.patientMsg || (bookName && bookSex && (credType || (credTypeData ? credTypeData[0].id : '')) && credNo)) {
            var params = {
                params: [{
                    patID: this.state.patientMsg ? (this.state.patientMsg.patID) : '',
                    resDetailID: data.resDetailID
                }]
            }
            $http.post('urlDeault', this, {
                code: "03040018",
                data: params,
                success: function (res) {
                    if (res.errorCode === '0') {
                        this.setState({
                            orderData: res.data,
                            setRowId: res.data.resDetail[0].id
                        })
                    }
                }
            });
            this.setState({
                isShowToOrderModal: true,
                orderSchData: data
            })
        } else {
            this.setState({
                orderStyle: true
            })
            message.error('必填信息不能为空')
        }
    }

    //预约
    handleSubmitOrder(id, code) {
        var params = {}
        if (this.state.patientMsg && this.state.patientMsg.patID) {
            params = {
                params: [{
                    patID: this.state.patientMsg ? this.state.patientMsg.patID : '',
                    resDetailID: this.state.orderSchData ? this.state.orderSchData.resDetailID : '',
                    userID: this.state.userData.userID,
                    bookMethodID: "Win",//写死
                    resTimeID: code ? code : this.state.bookCode,
                }]
            }
        } else {
            params = {
                params: [{
                    resDetailID: this.state.orderSchData ? this.state.orderSchData.resDetailID : '',
                    userID: this.state.userData.userID,
                    bookMethodID: "Win",//写死
                    resTimeID: code ? code : this.state.bookCode,
                    bookName: this.state.bookName,
                    patCredTypeID: this.state.credType ? this.state.credType : (this.state.credTypeData ? this.state.credTypeData[0].id : ''),
                    patCredNo: this.state.credNo,
                    patMobile: this.state.mobilephone
                }]
            }
        }
        $http.post('urlDeault', this, {
            code: "03040011",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    var date = new Date();
                    message.success('预约成功！')
                    this.hideModal('isShowToOrderModal')
                    this.clearInput()
                    this.setState({
                        showDate: false,
                        date: date,
                        showNewDate: false,
                        patientData: [],
                        orderStatus: false
                    }, () => {
                        this.loadSchedulingMsg();
                        this.loadConfigFee();
                    })
                }
            }
        });
    }

    //取消预约弹框
    showCannelOrderModal() {
        this.setState({
            isCancelOrderModal: true
        })
    }

    //重打凭条
    printEntrySlip() {
        var params = {
            params: [{
                admID: this.state.admDr
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040027",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('操作成功！')
                    if (!Util.isEmpty(res.result)) {
                        $loadTemplate("Registration", res.result);
                    }
                }
            }
        });
    }

    //重打发票
    printInvoice() {
        var params = {
            params: [{
                admID: this.state.admDr
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040028",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('操作成功！')
                    if (!Util.isEmpty(res.result.data)) {
                        $loadTemplate(res.result.template, res.result.data);
                    }
                }
            }
        });
    }

    //取消预约
    cannelRegistr() {
        var params = {
            params: [{
                bookScheduleID: this.state.bookScheduleDr
            }]
        }
        $http.post('urlDeault', this, {
            code: "03040013",
            data: params,
            success: function (res) {
                if (res.errorCode === '0') {
                    message.success('取消预约成功！')
                    this.loadRegisterMsg()
                    this.hideModal('isCancelOrderModal')
                }
            }
        });
    }

    disabledDate(e) {
        var date = new Date()
        return e && e < moment(date).startOf('day');
    }

    //回车键校验录入病人信息
    checkMessage(e) {
        if (e.keyCode == '13') {
            //手机号码校验
            var mobile = /^[1-9]\d{10}$/;
            var phone = this.state.mobilephone;
            // if (!mobile.test(phone)) {
            //     message.error('手机号码输入格式不正确，请重新输入')
            //     return
            // }
            var idCard = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
            var cardNo = this.state.credNo;
            if (!idCard.test(cardNo) && this.state.typeCode == '01') {
                message.error('身份证号码输入格式不正确，请重新输入')
                return
            }
            var params = {
                params: [{
                    credTypeID: (this.state.credType ? this.state.credType : (this.state.credTypeData ? this.state.credTypeData[0].id : undefined)),
                    credNo: this.state.credNo
                }]
            }
            $http.post('urlDeault', this, {
                code: "03040019",
                data: params,
                success: function (res) {
                    if (res.errorCode === '0') {
                        if (Util.isEmpty(res.patInfo.patCredNo)) {
                            message.error('当前用户不存在')
                            this.bookPhone.current.focus()
                        }
                        this.setState({
                            checkData: res.patInfo,
                            isShowCorrelationModal: res.patInfo.patCredNo ? true : false,
                            checkMsg: res.message
                        })
                    }
                }
            });
        }
    }

    //跳号
    loadInvoiceNum(currentNo, jumpReason, data) {
        var params = {
            params: [{
                hospID: this.state.userData.hospID,
                userID: this.state.userData.userID,
                paytype: 'R',
                staInvNo: data[0].currentInvNo,
                endInvNo: data[0].preFix + currentNo,
                jumpReason: jumpReason
            }]
        }
        $http.post('urlDeault', this, {
            code: "05210027",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success('跳号成功!')
                    this.hideModal('isShowInvoiceNumModal')
                    this.loadConfigFee()
                }
            }
        });
    }

    submitCorrelation() {
        var { checkData } = this.state;
        this.setState({
            patientMsg: checkData,
            correCode: true
        })
        this.hideModal('isShowCorrelationModal')
        this.bookTime.current.focus()
    }

    onKeyDownCheckPhone(e) {
        if (e.keyCode == '13') {
            //手机号码校验
            var mobile = /^[1-9]\d{10}$/;
            var phone = this.state.mobilephone;
            if (phone && !mobile.test(phone)) {
                message.error('手机号码输入格式不正确，请重新输入')
                return
            } else {
                this.bookTime.current.focus()
            }
        }
    }

    onChangeSex() {
        this.bookCardType.current.focus()
    }

    onKeyDownCheckName(e) {
        if (e.keyCode == '13') {
            var reg = /^(([a-zA-Z+\.?\·?a-zA-Z+]{2,30}$)|([\u4e00-\u9fa5+\s·?\u4e00-\u9fa5+]{2,30}$))/;
            if (!reg.test(this.state.bookName)) {
                message.error('姓名格式填写错误，请重新输入！'); // 校验未通过
                return;
            } else {
                this.bookSex.current.focus()
            }
        }
    }

    //获取证件类型的code
    onSelectCardType(e, id) {
        this.setState({
            typeCode: id.props.code
        })
        this.bookCard.current.focus()
    }

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

    render() {
        let searchColConfig = {
            xs: { span: 24 },
            sm: { span: 12 },
            md: { span: 12 },
            lg: { span: 12 }
        }

        //时间段0000144406
        let timeRangeOption = []
        this.state.timeRange && this.state.timeRange.map((item, index) => {
            timeRangeOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
        })

        //卡类型
        let cardTypeOption = []
        this.state.cardTypeData && this.state.cardTypeData.map((item, index) => {
            cardTypeOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
        })

        //证件类型
        let credTypeOption = []
        this.state.credTypeData && this.state.credTypeData.map((item, index) => {
            credTypeOption.push(<Option key={index} value={item.id} code={item.code}>{item.descripts}</Option>)
        })
        //性别
        let sexOption = []
        this.state.sexData && this.state.sexData.map((item, index) => {
            sexOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
        })

        //身份标签
        let socialStatusOption = []
        this.state.socialStatusData && this.state.socialStatusData.map((item, index) => {
            socialStatusOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
        })

        //病人类型
        let patTypeOption = []
        this.state.patTypeData && this.state.patTypeData.map((item, index) => {
            patTypeOption.push(<Option key={index} value={item.id + ''}>{item.descripts}</Option>)
        })

        //结算类型admReason
        let admReasonOption = []
        this.state.admReason && this.state.admReason.map((item, index) => {
            admReasonOption.push(<Option key={index} value={item.id}>{item.descripts}</Option>)
        })

        //获取科室信息
        let departMentOption = []
        this.state.departMentData && this.state.departMentData.map((item, index) => {
            departMentOption.push(<Option key={index} value={item.id} code={item.descripts}>{item.descripts}</Option>)
        })

        //获取科室医生信息
        let depDoctorOption = []
        this.state.depDoctorData && this.state.depDoctorData.map((item, index) => {
            depDoctorOption.push(<Option key={index} value={item.descripts + '-' + item.code + item.descriptsSPCode + '*' + item.id + ''}>{item.descripts}</Option>)
        })

        var patStatus = false
        if (!Util.isEmpty(this.state.patTypeData) && !Util.isEmpty(this.state.patientMsg)) {
            var patType = this.state.patTypeData
            for (var i = 0; i < patType.length; i++) {
                if (patType[i].id == this.state.patientMsg.patTypeID) {
                    patStatus = true
                    break;
                }
            }
        } else {
            if (!Util.isEmpty(this.state.patientMsg) && !Util.isEmpty(this.state.patientMsg.patTypeID)) {
                patStatus = false
            }
        }

        var admReasonFlag = '';
        var admId = '';
        var defAdmId = '';
        if (this.state.admReason) {
            var admReason = this.state.admReason;
            for (var i = 0; i < admReason.length; i++) {
                if (admReason[i].defaultFlag == 'Y') {
                    admReasonFlag = true;
                    admId = admReason[i].id;
                    break;
                } else {
                    admReasonFlag = false;
                    defAdmId = admReason[0].id;
                }
            }
        }

        var { dataSource, schedulData, patientMsg, checkData } = this.state;
        var registOption = []
        if (this.state.schedulData && this.state.schedulData.length > 0) {
            schedulData && schedulData.map((item, index) => {
                registOption.push(
                    <Col span={6} style={{ marginTop: '5px' }} key={index + 'col'} className={this.clientWidth < 1500 ? 'registr-unStandard-card' : 'registr-standard-card'} >
                        <Card style={{ height: '10rem' }} className={this.state.rowIds == index && this.state.setBabkground ?
                            (parseInt(item.registedNum) >= parseInt(item.registNum) ? '' : 'scheduling-card-hover') : ''}
                            title={<div className={this.state.rowIds == index && this.state.setBabkground ?
                                (parseInt(item.registedNum) >= parseInt(item.registNum) ? 'header-class' : 'registr-bgd-hover') : ''}>
                                <div style={{ display: 'flex' }}>{parseInt(item.registedNum) >= parseInt(item.registNum) ? <div className='noNum-sprite'></div> : null}
                                    <div>已用号源/总号源：{item.registedNum + '/' + item.registNum}</div></div></div>}
                            bordered={true} key={index + 'crad'}
                            tabIndex={'-1'} hoverable={true}
                            // id={parseInt(item.registedNum) >= parseInt(item.registNum) ? 'header-class' : ''}
                            // className={this.state.rowIds == index && this.state.setBabkground ? 'registration-card-bg' : ''}
                            onKeyDown={this.handleRegistrBtn.bind(this, index, item)}
                            onMouseOver={this.addRegistrBtn.bind(this, index)}
                            onMouseEnter={this.addFloatElement.bind(this, index, item)}
                            onDoubleClick={this.showRegistrOrOrder.bind(this, item)}
                            onClick={this.addBackground.bind(this, index)}
                            onMouseLeave={this.removeRegistrBtn.bind(this)}>
                            <div style={{ display: 'flex' }}>
                                {this.state.mouseElement && index == this.state.rowIds && this.state.floatStatus && this.state.orderStatus ?
                                    <Tooltip getPopupContainer={() => document.querySelector('.registration-body')} placement="bottom"
                                        overlayStyle={{ maxHeight: '30%', maxWidth: '28%', zIndex: '10000' }}
                                        title={this.loadElementDome()}><div style={{ background: '#eff9f2', width: '100%' }}>
                                            科室名称：<span style={{ color: '#FA8C16' }} key={index + '1'}>{item.locDescripts}</span><br />
                                            坐诊医生：<span key={index + '2'}>{item.docName}</span><br />
                                            职称：<span key={index + '3'}>{item.regTitle}</span><br />
                                            挂号费：<span key={index + '4'}>{item.price + '元/次'}</span><br />
                                            当前状态：<Badge key={index + '6'} status={item.onLineStatusCode == 'Y' ? 'success' : 'error'}
                                                text={item.onLineStatus}></Badge>
                                        </div></Tooltip> : <div style={{ background: '#eff9f2', width: '100%' }}>
                                        科室名称：<span style={{ color: '#FA8C16' }} key={index + '1'}>{item.locDescripts}</span><br />
                                        坐诊医生：<span key={index + '2'}>{item.docName}</span><br />
                                        职称：<span key={index + '3'}>{item.regTitle}</span><br />
                                        挂号费：<span key={index + '4'}>{item.price + '元/次'}</span><br />
                                        当前状态：<Badge key={index + '6'} status={item.onLineStatusCode == 'Y' ? 'success' : 'error'}
                                            text={<span>{item.onLineStatus}</span>}></Badge>
                                    </div>}
                            </div>
                            <div>
                                {this.state.rowIds == index && this.state.mouseElement ? (this.state.orderStatus ?
                                    (parseInt(item.registedNum) >= parseInt(item.registNum) ?
                                        <div className='registr-btn'>
                                            <Button autoFocus size='small' style={{ color: '#666666', height: '5px', border: '0px' }}></Button></div> : <div className='registr-btn'
                                                onClick={this.handleToOrder.bind(this, item)}>
                                            <Button autoFocus size='small' style={{ color: '#1999db', height: '5px', border: '0px' }}></Button></div>) :
                                    (this.state.groupConfig && this.state.groupConfig.IfChargeFlag ?
                                        (parseInt(item.registedNum) >= parseInt(item.registNum) ?
                                            <div className='registr-btn'>
                                                <Button autoFocus size='small' style={{ color: '#666666', height: '5px', border: '0px' }}></Button></div> : <div className='registr-btn'
                                                    onClick={this.showRegistrModal.bind(this, item)}>
                                                <Button autoFocus size='small' style={{ color: '#1999db', height: '5px', border: '0px' }}></Button></div>) : null)) : null}
                            </div>
                        </Card>
                    </Col>
                )
            })
        } else {
            registOption.push(
                <div key='1' style={{ color: 'red', textAlign: 'center', fontSize: '15px' }}>
                    <img src={noData} /><div>当前时间段，该科室无坐诊医生</div></div>
            )
        }

        var invNo = '';
        var currentInvNo = ''
        //对发票号进行截取
        if (this.state.currentInvNoInfo) {
            var currentInvNoInfo = this.state.currentInvNoInfo;
            invNo = currentInvNoInfo.substring(currentInvNoInfo.indexOf('^') + 1);
            currentInvNo = invNo.substring(invNo.indexOf('^') + 1)
        }

        return (<div className='registration-body' style={{ background: '#F1F1F1' }}>
            {/**读卡 */}
            <ReadCard ref={ref => this.readCard = ref}></ReadCard>
            <ColumnAuthoritysModel
                clientWidth='800px'
                compontName="RegistrationPage"
                configType="C"
                visible={this.state.visible}
                onRef={this.onColumnRef}
                reloadData={this.initData}
            />
            {/**挂号弹窗 */}
            
            <ShowRegistrModal isShow={this.state.isShowRegistrModal}
                patientMsg={this.state.patientMsg}
                registrMsg={this.state.registrMsg}
                confirmLoading={this.state.confirmLoading}
                newPayWay={this.state.newPayWay}
                onSubmitRegastr={this.onSubmitRegastr.bind(this)}
                registrSumData={this.state.registrSumData}
                onHide={this.hideModal.bind(this, 'isShowRegistrModal')}>
            </ShowRegistrModal>

            {/**设置发票号  */}
            <ShowInvoiceNumModal isShow={this.state.isShowInvoiceNumModal}
                currentInvNo={currentInvNo}
                onSubmit={this.loadInvoiceNum.bind(this)}
                onHide={this.hideModal.bind(this, 'isShowInvoiceNumModal')}>
            </ShowInvoiceNumModal>

            {/**退号 */}
            <ShowBackNumModal isShow={this.state.isShowBackNumModal}
                registrFee={this.state.registrFee}
                patientMsg={this.state.patientMsg}
                recordData={this.state.recordData}
                onSubmit={this.registrBackNum.bind(this)}
                onHide={this.hideModal.bind(this, 'isShowBackNumModal')}>
            </ShowBackNumModal>

            {/**预约 , bookSex, credType, credNo, mobilephone*/}
            <ShowToOrderModal isShow={this.state.isShowToOrderModal}
                onSubmit={this.handleSubmitOrder.bind(this)}
                orderData={this.state.orderData}
                bookStatus={this.state.bookStatus}
                setRowId={this.state.setRowId}
                bookName={this.state.bookName}
                bookSex={this.state.bookSex}
                credNo={this.state.credNo}
                mobilephone={this.state.mobilephone}
                recordData={this.state.orderSchData}
                date={this.state.date}
                onHide={this.hideModal.bind(this, 'isShowToOrderModal')}>
            </ShowToOrderModal>
            {/**取消预约 */}
            <CancelOrderModal isShow={this.state.isCancelOrderModal}
                patientMsg={this.state.patientMsg}
                recordData={this.state.recordData}
                onSubmit={this.cannelRegistr.bind(this)}
                onHide={this.hideModal.bind(this, 'isCancelOrderModal')}></CancelOrderModal>

            {/**取号 */}
            <ShowGetNumModal isShow={this.state.isShowGetNumModal}
                patientMsg={this.state.patientMsg}
                recordData={this.state.recordData}
                newPayWay={this.state.newPayWay}
                onSubmitGetNum={this.onSubmitGetNum.bind(this)}
                registrSumData={this.state.getRegistrData}
                onHide={this.hideModal.bind(this, 'isShowGetNumModal')}>
            </ShowGetNumModal>

            {/**关联信息弹框 */}
            <CorrelationModal isShow={this.state.isShowCorrelationModal}
                onSubmit={this.submitCorrelation.bind(this)}
                checkData={this.state.checkMsg}
                onHide={this.hideModal.bind(this, 'isShowCorrelationModal')}>
            </CorrelationModal>
            {/**左列表 */}
            <div className='registration-left-content'>
                <Card style={{ height: '75%', borderTop: '2px solid #1999db', overflow: 'overlay' }}>
                    <div style={{ textAlign: 'center' }}>
                        <Select style={{ width: '90%' }} placeholder='请选择卡类型' getPopupContainer={triggerNode => triggerNode.parentNode}
                            value={this.state.cardTypeId ? this.state.cardTypeId : (this.state.cardStatus)}
                            onSelect={this.changeCardType.bind(this)}>
                            {cardTypeOption}
                        </Select>
                        {/* <Search
                            placeholder='请输入或读卡' style={{ width: '90%', marginTop: '5px' }}
                            value={this.state.cardNum ? this.state.cardNum : (this.state.clearStatus ? '' : (this.getQueryString('cardNum') || ''))}
                            ref={(input) => this.input = input}
                            // disabled={this.state.cardStatus?false:(!this.state.inputStatus)}
                            onChange={this.changeCardNum.bind(this)}
                            enterButton="读卡"
                            onClick={this.handleReadCard.bind(this)}
                            // onKeyDown={this.handleSelectPersonMsg.bind(this)}defaultPickerValue
                            onPressEnter={this.serachPatiMsg.bind(this)}
                        /> */}
                        <div style={{ display: 'flex', marginTop: '5px', marginLeft: 5, width: '90%' }}>
                            <Input placeholder='请输入或读卡' style={{ width: '80%', marginLeft: 15 }}
                                value={this.state.readStatus == 'read' ? this.state.readCardNo :
                                    (this.state.cardNum ? this.state.cardNum : (this.state.clearStatus ? '' : (this.getQueryString('cardNum') || '')))}
                                ref={(input) => this.input = input}
                                onKeyDown={this.handleSelectPersonMsg.bind(this, '')}
                                onChange={this.changeCardNum.bind(this)} />
                            <Button onClick={this.handleReadCard.bind(this)} type='primary' style={{ marginLeft: 15 }}>读卡</Button>
                        </div>
                        <Input placeholder='输入病人ID/证件号码回车查询' style={{ width: '90%', marginTop: '5px' }}
                            onKeyDown={this.handleSelectPersonMsg.bind(this, 'msg')}
                            value={this.state.paitId ? this.state.paitId : (this.state.paitStatus ? '' : (this.getQueryString('posId') || ''))}
                            onChange={this.changePaitId.bind(this)} />
                        <div style={{ marginTop: '5px', marginLeft: 5 }}><span>病人ID号：</span>
                            <Input placeholder='请输入病人ID' disabled={patientMsg ? true : false} value={patientMsg ? patientMsg.patNo : this.state.patinId}
                                onChange={Util.commonInputChange.bind(this, 'patinId')} style={{ width: '69%' }} /></div>
                        <div style={{ marginTop: '5px' }}><span style={{ color: '#f5222d', fontFamily: 'SimSun' }}>*</span>
                            病人姓名：<Input placeholder='输入病人姓名，回车键校验' style={{ width: '68%' }} disabled={patientMsg ? true : false}
                                onChange={Util.commonInputChange.bind(this, 'bookName')}
                                ref={this.bookName}
                                className={this.state.orderStyle && Util.isEmpty(patientMsg) && Util.isEmpty(checkData) && Util.isEmpty(this.state.bookName) ? 'registr-btn-style' : ''}
                                onKeyDown={this.onKeyDownCheckName.bind(this)}
                                value={this.state.bookName ? this.state.bookName : (this.state.correCode && checkData ? checkData.patName : (patientMsg ? patientMsg.patName : this.state.bookName))} />
                        </div>
                        <div style={{ marginTop: 5 }}><span style={{ color: '#f5222d', fontFamily: 'SimSun' }}>*</span>
                            病人性别：<Select style={{ width: '68%' }} getPopupContainer={triggerNode => triggerNode.parentNode}
                                placeholder='请选择病人性别'
                                ref={this.bookSex}
                                className={this.state.orderStyle && Util.isEmpty(patientMsg) && Util.isEmpty(checkData) && Util.isEmpty(this.state.bookSex) ? 'registr-btn-style' : ''}
                                onChange={Util.handleSelectChange.bind(this, 'bookSex')}
                                onSelect={this.onChangeSex.bind(this)}
                                value={this.state.bookSex ? this.state.bookSex : (this.state.correCode && checkData ? checkData.patSexID : (patientMsg ? patientMsg.patSexID : this.state.bookSex))}
                                disabled={patientMsg ? true : false}>
                                {sexOption}
                            </Select>
                        </div>
                        <div style={{ marginTop: '5px' }}><span style={{ color: '#f5222d', fontFamily: 'SimSun' }}>*</span><span>证件类型：</span>
                            <Select style={{ width: '68%' }} getPopupContainer={triggerNode => triggerNode.parentNode}
                                onChange={Util.handleSelectChange.bind(this, 'credType')}
                                onSelect={this.onSelectCardType.bind(this)}
                                ref={this.bookCardType}
                                disabled={patientMsg ? true : false} value={patientMsg ? patientMsg.patCredTypeID :
                                    (this.state.credType ? this.state.credType : (this.state.credTypeData ? this.state.credTypeData[0].id : undefined))} placeholder='请选择证件类型'>
                                {credTypeOption}
                            </Select></div>
                        <div style={{ marginTop: '5px' }}><span style={{ color: '#f5222d', fontFamily: 'SimSun' }}>*</span><span >证件号码：</span>
                            <Input placeholder='请输入证件号码,按回车键校验' disabled={patientMsg ? true : false} maxLength={18}
                                onKeyDown={this.checkMessage.bind(this)}
                                ref={this.bookCard}
                                className={this.state.orderStyle && Util.isEmpty(patientMsg) && Util.isEmpty(checkData) && Util.isEmpty(this.state.credNo) ? 'registr-btn-style' : ''}
                                onChange={Util.commonInputChange.bind(this, 'credNo')}
                                value={this.state.credNo ? this.state.credNo : (checkData ? checkData.patCredNo : (patientMsg ? patientMsg.patCredNo : this.state.credNo))}
                                style={{ width: '68%' }} /></div>
                        <div style={{ marginTop: '5px', marginLeft: 5 }}><span>出生日期：</span>
                            <DatePicker placeholder='出生日期' disabled={patientMsg ? true : false} style={{ width: '49%' }}
                                onChange={this.changeBirthDay.bind(this)}
                                value={patientMsg ? moment(patientMsg.patBirthDate, dayFormat) : this.state.birthDayDate} />
                            <Input style={{ width: '20%' }} placeholder='年龄' disabled={patientMsg ? true : false}
                                onChange={Util.commonInputChange.bind(this, 'yearOld')}
                                value={patientMsg ? patientMsg.patAge : this.state.yearOld} />
                        </div>
                        <div style={{ marginTop: '5px' }}><span style={{ color: '#f5222d', fontFamily: 'SimSun' }}>*</span>联系电话：
                            <Input style={{ width: '68%' }} disabled={patientMsg ? true : false} maxLength={11}
                                onChange={Util.commonInputChange.bind(this, 'mobilephone')}
                                className={this.state.orderStyle && Util.isEmpty(patientMsg) && Util.isEmpty(checkData) && Util.isEmpty(this.state.mobilephone) ? 'registr-btn-style' : ''}
                                onKeyDown={this.onKeyDownCheckPhone.bind(this)}
                                ref={this.bookPhone}
                                value={this.state.mobilephone ? this.state.mobilephone : (this.state.correCode && checkData ? checkData.patMobile : (patientMsg ? patientMsg.patMobile : this.state.mobilephone))}
                                placeholder='请输入手机号码,按回车键校验' /></div>
                        <div style={{ marginTop: '5px', marginLeft: 5 }}>身份标签：
                            <Select style={{ width: '69%' }} getPopupContainer={triggerNode => triggerNode.parentNode}
                                onChange={Util.handleSelectChange.bind(this, 'personDr')} allowClear
                                disabled={patientMsg ? true : false} value={patientMsg ? patientMsg.patSocialStatusID : this.state.personDr} placeholder='请选择身份标签'>
                                {socialStatusOption}
                            </Select></div>
                        <div style={{ marginTop: '5px', marginLeft: 5 }}>病人类型：
                        <Select style={{ width: '69%' }} getPopupContainer={triggerNode => triggerNode.parentNode}
                                onChange={Util.handleSelectChange.bind(this, 'personType')} allowClear
                                disabled={patientMsg ? true : false} value={patientMsg ? (patStatus == true ? patientMsg.patTypeID : undefined) : this.state.personType} placeholder='请选择病人类型'>
                                {patTypeOption}
                            </Select></div>
                        <div style={{ marginTop: '5px', marginLeft: 5 }}>账户余额：
                        <Input addonBefore='¥' style={{ width: '69%' }} disabled={patientMsg ? true : false}
                                onChange={Util.commonInputChange.bind(this, 'personMoney')}
                                value={patientMsg ? patientMsg.accountBalance : this.state.personMoney} placeholder='请输入账户余额' /></div>
                        <div style={{ marginTop: '5px', marginLeft: 5 }}>结账费别：
                        <Select style={{ width: '69%' }} getPopupContainer={triggerNode => triggerNode.parentNode}
                                onChange={this.handleSelectChange.bind(this, 'admReasonId')}
                                value={this.state.admReasonId ? this.state.admReasonId :
                                    (admReasonFlag ? admId : (defAdmId ? defAdmId : undefined))} placeholder='请选择结账类型'>
                                {admReasonOption}
                            </Select></div>
                        <div style={{ marginTop: '5px', marginLeft: 5 }}>预约日期：
                        <DatePicker placeholder='预约日期' style={{ width: '69%' }} disabled={!this.state.showDate}
                                disabledDate={this.disabledDate.bind(this)}
                                onChange={this.chengeTime.bind(this)}
                                ref={this.bookTime}
                                value={this.state.date ? moment(this.state.date, dayFormat) : ''}
                            // value={patientMsg ? moment(patientMsg.birthDate, dayFormat) : undefined}
                            /></div>
                        <Button style={{ marginTop: '5px' }} onClick={this.clearInput.bind(this)}>清空</Button>
                        {this.state.showNewDate ? <Button style={{ marginLeft: '10px', marginTop: '5px' }} onClick={this.showDate.bind(this)}>当日挂号</Button>
                            : <Button type='primary' style={{ marginLeft: '10px', marginTop: '5px' }} onClick={this.showDate.bind(this)}>预约</Button>}
                    </div>
                </Card>
                {/**进度条 */}
                <Card style={{ marginTop: '10px', overflow: 'auto', height: '23%' }} title={<span>
                    <Icon type='unordered-list' style={{ color: 'white', marginLeft: 10 }} />
                    <span style={{ marginLeft: 10, color: 'white' }}>当日号源消耗进度排行</span></span>}>
                    {this.loadRegistrNum()}
                </Card>
            </div>
            {/**右列表 */}
            <div className='registration-right-content'>
                <Card className='register-card' style={{ borderTop: '2px solid #1999db' }}>
                    <Row style={{ paddingBottom: '10px' }}>
                        <span>日期：</span><DatePicker placeholder='时间' style={{ width: '18%' }}
                            disabledDate={this.disabledDate.bind(this)}
                            disabled={!this.state.showDate}
                            onChange={this.chengeTime.bind(this)}
                            value={this.state.date ? moment(this.state.date, dayFormat) : ''} />
                        <span style={{ marginLeft: 10 }}>时段：</span><Select placeholder='时段' style={{ minWidth: 80 }}
                            value={this.state.timeRangeId ? this.state.timeRangeId : this.state.timeSolt}
                            onChange={this.handleSelectChange.bind(this, 'timeRangeId')}
                            allowClear={true} getPopupContainer={triggerNode => triggerNode.parentNode}>
                            {timeRangeOption}
                        </Select>
                        <span style={{ marginLeft: 10 }}>挂号科室：</span><Select placeholder='挂号科室' style={{ width: '18%' }}
                            onChange={this.changeDepartMent.bind(this)} showSearch={true}
                            filterOption={(input, option) =>
                                option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                                || option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
                            }
                            value={this.state.locId ? this.state.locId : undefined}
                            ref={this.textInput}
                            allowClear={true} getPopupContainer={triggerNode => triggerNode.parentNode}>
                            {departMentOption}
                        </Select>
                        <span style={{ marginLeft: 10 }}>挂号医生：</span><Select placeholder='挂号医生' style={{ width: '18%' }}
                            onChange={this.changeDepDoctor.bind(this)} showSearch={true}
                            ref={this.textSelect}
                            allowClear={true} getPopupContainer={triggerNode => triggerNode.parentNode}>
                            {depDoctorOption}
                        </Select>
                    </Row>
                    <Row gutter={16} className='registr-nodata-screen'>
                        {registOption}
                    </Row>
                </Card>

                <div style={{ marginTop: 5 }} className={document.body.clientWidth > 1800 ? 'placeHolder-style' : ''}>
                    <Table columns={this.state.column} dataSource={this.state.patientData}
                        className={this.state.patientData.length > 0 ? 'registr-table-list' : ''}
                        // onKeyDown={this.keyDownElement.bind(this)}
                        scroll={{ y: '250px', x: 1500 }}
                        tabIndex={this.state.rowId}
                        onRow={this.onClickRow}
                        bordered
                        rowClassName={this.setRowClassName}
                        rowKey={(data) => {
                            return data.count
                        }}
                        onHeaderRow={column => {
                            return {
                                onDoubleClick: () => {
                                    this.columnRef.onOpenModel();
                                },
                            };
                        }}
                        pagination={false}
                        title={() => {
                            return <div style={{ display: 'flex' }} className='registr-header-btn'>
                                <div className='invoice-splice'></div>
                                <div style={{ marginLeft: 10 }}>
                                    <Button size='small' disabled={(this.state.groupConfig && this.state.groupConfig.IfInvNo == 'Y' && !Util.isEmpty(currentInvNo)) ? false : true}
                                        onClick={this.showInvoiceNumModal.bind(this)}>当前发票号:{currentInvNo}</Button></div>
                                <div className='rgistr-btn-screen'>
                                    <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.returnFlag == 'Y' ? false : true} onClick={this.visitDoctor.bind(this)}>复诊</Button>
                                    <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.priorFalag == 'Y' ? false : true} onClick={this.loadPriority.bind(this)}>优先</Button>
                                    <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.regFlag == 'Y' ? false : true} onClick={this.showGetNumModal.bind(this)}>取号(F2)</Button>
                                    {this.state.cancleRegFlag == 'N' ? <Tooltip title={this.state.cancleRegTips}>
                                        <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.cancleRegFlag == 'Y' ? false : true} onClick={this.showBackNumModal.bind(this)}>退号(F6)</Button></Tooltip> :
                                        <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.cancleRegFlag == 'Y' ? false : true} onClick={this.showBackNumModal.bind(this)}>退号(F6)</Button>}
                                    <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.cancleAPPFlag == 'Y' ? false : true} onClick={this.showCannelOrderModal.bind(this)}>取消预约(F10)</Button>
                                    <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.regPrintFlag == 'Y' ? false : true} onClick={this.printEntrySlip.bind(this)}>重打凭条(F8)</Button>
                                    <Button type='primary' style={{ marginLeft: 10 }} size='small' disabled={this.state.APPPrintFlag == 'Y' ? false : true} onClick={this.printInvoice.bind(this)}>重打发票(F9)</Button></div>
                            </div>
                        }}>
                    </Table>
                </div>
            </div>
        </div>)

    }
}

export default RegistrationPage;