/*
 * Creator:     ML
 * CreatDate:   2019-12-26
 * descripts：  治疗工作站-治疗室
 * WalkinApplicationPage 无预约申请
 * AcographyPage 治疗记录
 * ReservationRecordPage 预约记录
 * */
import React from 'react';
import { Form, Row, Col, Input, Select, Button, DatePicker, Popconfirm, Modal, Table, Icon, Pagination, message, Divider, Tooltip, Card } from 'antd';
import moment from 'moment';
import { Util, dayFormat, Keup } from 'tools/index';
import { $http } from 'containers/config/https';
import store from 'store';
import './style/index.less';
import CommonPagination from 'components/pagination/index';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import CardTypeRead from 'components/cardType/index';
import RangeDatePicker from 'components/rangePicker/index';
import TreatmentAddModal from './component/TreatmentAddModal';
import TreatmentHistoryModal from './component/TreatmentHistoryModal';
import ShowConfirmApplicationModal from '../component/ShowConfirmApplicationModal';
import { callNumberSocket } from 'tools/callNumber.js';
// import PayContentModal from 'components/payModal/index'

const FormItem = Form.Item;
const Option = Select.Option;
const confirm = Modal.confirm;
const paddRightCol = {
    paddingRight: "0px"
}
const formItemLayoutType = {
    labelCol: { span: 9 },
    wrapperCol: { span: 15 }
}

const formItemLayout = { // label 和input宽度
    labelCol: { span: 8 },
    wrapperCol: { span: 14 },
}
const formItemLayoutInfo = {
    labelCol: { span: 5 },
    wrapperCol: { span: 19 },
}
const TreatmentRoom = Form.create()(
    class TreatmentRoom extends React.Component {
        constructor(props) {
            super(props)
            var userData = JSON.parse(sessionStorage.getItem('userData'))
            this.handleCallback = this.handleCallback.bind(this);
            var date = new Date();
            this.state = {
                userData: userData,
                total: 0,//表格总数据
                values: {},//查询条件数据
                rowIds: '',//表格行选中 页面数据
                page: 1,
                pageSize: 10,
                size: "small",
                search: "",
                treatArr: [],
                localeProvider: [],
                StartDate: moment(date).format(dayFormat),
                EndDate: moment(date).format(dayFormat),
                chargeordIDinfo: {},
                payModalVis: false
            }
        }
        componentDidMount() {
            // 初始化设置table的高度以及表体的高度
            document.querySelector('.listDom .ant-table-body').style.height = store.getState().tableHeight.y - 10 + 'px';
            this.getFindDate()
            this.getMainTableColumns()
            this.getPublicBaseLocSelect()
            this.getOutStatus()
            this.getTreatStatus()
            this.getBindInfo()
        }

        componentWillUnmount() {
            callNumberSocket.colse();
        }

        getBindInfo() {
            let data = {
                params: [{
                    dataID: "1",
                    hospID: this.state.userData.hospID,
                    purCode: "Room",
                }]
            }
            $http.post('urlDeault', this, {
                code: "04150007",
                data: data,
                success: (res) => {
                    if (res.errorCode == '0') {
                        if (res.result.serverIP != undefined) {
                            callNumberSocket.init(res.result.serverIP, res.result.serverPort);
                            this.setState({
                                bindInfo: res.result,
                            })
                        }
                    }
                }
            })
        }
        //动态表头
        onColumnRef = (ref) => {
            this.columnRef = ref;
        }
        // 获取主列表columns --服务组列表
        getMainTableColumns = () => {
            let data = {
                params: [{
                    compontName: "BookRecord",
                    reactCode: ['BookRecord'],
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map(item => {
                            return {
                                align: item.align,
                                widthNum: parseInt(item.width),
                                width: item.width,
                                dataIndex: item.dataIndex,
                                title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{this.state.userData.language == 'EN' ? item.descripts : item.title}</div>,
                                display: item.display,
                                key: item.seqNo,
                                // render: (text, record) => {
                                //    if (item.code == "status") {
                                //      return (
                                //      <span>{record.status=="Y"?"生效":"失效"}</span>
                                //      )
                                //    }
                                //    return text
                                //  }
                            }
                        }) : '';
                        let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                        this.setState({ localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN, columns: filterArr, widthTotal: res.totalWidth })
                        // console.log("res.totalWidth",res.totalWidth)
                    }
                }
            })
        }
        //获取科室下拉框
        getPublicBaseLocSelect = () => {
            let data = {}
            data = {
                params: [{
                    hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
                }],
            }
            $http.post('urlS', this, {
                code: '03020046',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0 && res.result.Data) {
                        let arr = res.result.Data && res.result.Data.map((item, index) => {
                            res.result.Data[index].key = Number(index)
                        })
                        this.setState({
                            publicBaseLocArr: res.result.Data,
                        })
                    } else {

                    }
                }
            })
        }
        //获取治疗状态 
        getTreatStatus = () => {
            let data = {}
            data = {
                params: [{

                }],
            }
            $http.post('urlS', this, {
                code: '01040176',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0 && res.result.Data) {
                        let arr = res.result.Data && res.result.Data.map((item, index) => {
                            res.result.Data[index].key = Number(index)
                        })
                        this.setState({
                            treatArr: res.result.Data,
                        })
                    } else {

                    }
                }
            })
        }
        //获取预约状态
        getOutStatus = () => {
            let data = {}
            data = {
                params: [{

                }],
            }
            $http.post('urlS', this, {
                code: '01040177',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0 && res.result.Data) {
                        let arr = res.result.Data && res.result.Data.map((item, index) => {
                            res.result.Data[index].key = Number(index)
                        })
                        this.setState({
                            outArr: res.result.Data,
                        })
                    } else {

                    }
                }
            })
        }
        // 显示分页总条数
        showTotal(total) {
            return `共 ${total} 条`;
        }

        // 修改page和pageSize 跳转至---
        onChange = (e, pageSize) => {
            this.setState({ page: e, pageSize: this.state.pageSize }, () => {
                // 重新调用查询方法
                let { values } = this.state;
                this.getFindDate(values);
            })
        }
        //下拉选择页数
        onShowSizeChange = (page, pageSize) => {
            this.setState({ page: 1, pageSize: pageSize }, () => {
                // 重新调用查询方法
                let { values } = this.state;
                this.getFindDate(values, "search");
            })
        }
        //定位到最新添加/当前修改的记录
        getNewData = (id) => {
            //跳至最后一页 并定位到刚添加的这条记录
            if (id) {
                let lastPage = Math.ceil((this.state.total + 1) / this.state.pageSize)
                this.onChange(lastPage, this.state.pageSize)
            } else {
                this.onChange(this.state.page, this.state.pageSize)
            }

        }
        //获取查询数据
        getFindDate = (values, e) => {
            if (this.state.total == 0) {
                this.setState({
                    searchLoading: true
                })
            }
            let { page, pageSize, cardType, patCardNo } = this.state;
            let data = {}
            data = {
                params: [{
                    // userID: JSON.parse(sessionStorage.userData).userID || '',
                    cardTypeID: cardType,//卡id
                    cardNo: patCardNo,//卡号
                    inputValue: values && values.patInfo || "",//人员标识
                    medicalNo: values && values.hosNumber || "",//住院号
                    bookStartDate: this.state.StartDate,
                    bookEndDate: this.state.EndDate,
                    appLocID: values && values.locID,//申请科室
                    cureStatusID: values && values.treatStatus || "",//治疗状态
                    bookStatusID: values && values.reservationStatus || "",//预约状态状态
                }],
                pagination: [{
                    pageSize: pageSize,
                    currentPage: page,
                }]
            }
            $http.post('urlS', this, {
                code: '01040173',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0 && res.result) {
                        this.setState({
                            searchLoading: false,
                            search: e
                        })
                        for (var i = 0; i < res.result.data.length; i++) {
                            res.result.data[i].key = i
                        }
                        this.setState({ listData: res.result.data, total: res.result.totalCount, }, () => {
                            this.state.listData.map((item, i) => {
                                if (this.state.rowIds == item.rowID) {
                                    this.setState({
                                        record: item
                                    })
                                }
                            })
                        })
                    } else {
                        this.setState({
                            searchLoading: false
                        })
                    }
                },
                error: function () {
                    this.setState({
                        searchLoading: false
                    })
                }
            })

        }
        //点击查询---
        findData = () => {
            this.props.form.validateFields((err, values) => {
                if (!err) {
                    this.setState({
                        values: values,
                        rowIds: ""
                    })
                    this.onShowSizeChange("1", this.state.pageSize)
                }
            })
        }
        // 调用子组件的连接事件 -- 添加新
        OnChildrefs = (ref) => {
            this.child = ref
        }
        // 调用子组件的连接事件 -- 历史
        OnHisRef = (ref) => {
            this.hisRef = ref
        }
        //点击查询后 表格行
        setRowClassNames = (record) => {
            return record.rowID === this.state.rowIds ? 'clickRowStyle' : '';
        }
        //点击Row ---列表
        onClickRow = (record) => {
            return {
                onClick: () => {
                    if (this.state.rowIds === "") {
                        this.setState({
                            rowIds: record.rowID,
                            cureAppID: record.cureAppID,
                            admID: record.admID,
                            record,
                        }, () => {
                        });

                    } else {
                        if (this.state.rowIds !== record.rowID) {
                            this.setState({
                                rowIds: record.rowID,
                                record,
                            }, () => {
                            });
                        } else {
                            this.setState({
                                rowIds: "",
                                record: {},
                            })
                        }
                    }
                },
            };
        }
        getValue = (cardType, patCardNo) => {
            this.setState({
                cardType,
                patCardNo,
            })
        }
        //开始日期
        startChange(date) {
            // console.log("s----",date)
            this.setState({
                StartDate: date,
            })
        }
        //结束日期
        endChange(date) {
            this.setState({
                EndDate: date,
            })
        }
        //国际化
        setMessage(name, message) {
            return this.state.localeProvider ? this.state.localeProvider[name][message] : ''
        }
        //取消到达
        handleCancelArrivals = () => {
            let data = {}
            data = {
                params: [{
                    bookScheduleID: this.state.record.rowID || "",
                    userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                }],
            }
            $http.post('urlS', this, {
                code: '01040175',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        message.success("取消到达")
                        this.getFindDate(this.state.values);
                    } else {

                    }
                }
            })
        }
        //到达
        handleArrivals = () => {
            let data = {}
            data = {
                params: [{
                    bookScheduleID: this.state.record.rowID || "",
                    userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                }],
            }
            $http.post('urlS', this, {
                code: '01040174',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        message.success("已到达")
                        this.getFindDate(this.state.values);
                    } else {

                    }
                }
            })
        }
        //取消完成
        handleCanceOK = () => {
            let data = {}
            data = {
                params: [{
                    cureRecordID: this.state.record.cureRecordID || "",
                    userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                }],
            }
            $http.post('urlS', this, {
                code: '01040178',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        message.success("取消完成")
                        this.getFindDate(this.state.values);
                    } else {

                    }
                }
            })

        }
        //治疗完成
        handleOk = () => {
            this.child.showModal(this.state.record, this.state.localeProvider)
        }
        //历次治疗单
        handleHistory = () => {
            this.hisRef.showModal(this.state.record, this.state.localeProvider)
        }
        handleButton = (num) => {
            //策略
            let obj = {
                "1": () => this.handleCancelArrivals(),
                "2": () => this.handleArrivals(),
                "3": () => this.handleCanceOK(),
                "4": () => this.handleOk(),
                "5": () => this.handleHistory()
            }
            if (obj[num]) {
                obj[num]()
            }
        }
        openPay = () => {
            message.warning("开发中..")
            //     if(this.state.rowIds&&this.state.rowIds){
            //        this.setState({
            //     payModalVis:true
            //    })  
            //     }else{
            //         message.warning(this.state.localeProvider && this.state.localeProvider.BookRecordPleaseSelectARecord ? this.setMessage('BookRecordPleaseSelectARecord', 'descripts') : "请选择一条记录")
            //     }

        }

        handleCallback(res) {
            this.setState({
                payModalVis: false,
            })
            if (res) {
                let messageTime = this.state.userData && this.state.userData.messageTime ? this.state.userData.messageTime : 3;
                Keup.ModalMessage(messageTime, this, res.errorMessage, '自动关闭', 'destroy', '确定', 'success')
            }
        }
        loadData(admID) {
            this.setState({
                admID,
            })
            var params = {
                params: [{
                    admID: admID || '',
                }],
            }
            $http.post('urlDeault', this, {
                code: "03050022",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        this.setState({
                            accountID: res.result.accmID.split('||')[0] || '', //病人账户ID || '',
                        })
                    }
                }
            })
        }
        handleCancelMoney = () => {
            this.setState({
                payModalVis: false
            })

            let chargeRecodeId = this.childPayContenRef.chargeRecodeId()
            var data = {
                params: [{
                    "recordIDinfo": chargeRecodeId, //付款记录串
                    "hisTradeNum": "",   //his交易流水
                    "userID": JSON.parse(window.sessionStorage.userData).userID || '', //操作人
                    "ip": React.$getSessionData('ipConfig')?.ipv4 || '', //ip
                }]
            }


            $http.post('urlADS', this, {
                code: "05210010",
                data: data,
                success: function (res) {
                    let errorCode = res.errorCode;
                    if (errorCode === '0') {

                    }
                }
            });

        }
        // handleOK = () => {
        //     this.childPayContenRef.chargingConfir()
        // }
        // PayContenRef = (ref) => {
        //     this.childPayContenRef = ref;
        // }

        //叫号
        loadCallNum() {
            var params = {
                params: [{
                    locID: this.state.userData.locID,
                    userID: this.state.userData.userID
                }]
            }
            $http.post('urlDeault', this, {
                code: "03050213",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        // message.success('叫号成功')
                        this.getFindDate()
                        this.setState({
                            callMsg: res.result
                        }, () => {
                            this.sendMessage()
                        })
                    }
                }
            });
        }

        /** 发送消息 */
        sendMessage = () => {
            if (Util.isEmpty(this.state.bindInfo)) {
                message.warn("未关联电子屏，不能呼叫!");
                return;
            }
            let msg = {};
            let ip = this.state.bindInfo.ip;
            callNumberSocket.sendMsg(this.state.callMsg, ip)
        }

        //过号
        loadPassNum() {
            var params = {
                params: [{
                    locID: this.state.userData.locID,
                    userID: this.state.userData.userID
                }]
            }
            $http.post('urlDeault', this, {
                code: "03050214",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        message.success('过号成功')
                        this.getFindDate()
                    }
                }
            });
        }

        onSubmit(judge) {
            var that = this;
            if (!Util.isEmpty(judge)) {
                if (judge == 'T') {
                    let secondsToGo = 1;
                    const modal = Modal.success({
                        title: '治疗完成',
                        content: <span>弹框将在&nbsp;<span style={{ fontSize: 16, color: 'red' }}>{secondsToGo}</span>&nbsp;秒后关闭.</span>
                    });
                    const timer = setInterval(() => {
                        secondsToGo -= 1;
                        modal.update({
                            content: <span>弹框将在&nbsp;<span style={{ fontSize: 16, color: 'red' }}>{secondsToGo}</span>&nbsp;秒后关闭.</span>
                        });
                    }, 1000);
                    setTimeout(() => {
                        clearInterval(timer);
                        modal.destroy();
                    }, secondsToGo * 1000);
                } else {
                    confirm({
                        title: '治预约疗',
                        content: '本次治疗完成，是否预约下次治疗？',
                        okText: '是',
                        cancelText: '否',
                        onOk() {
                            that.setState({
                                isShowConfirmApplicationModal: true,
                            })
                        },
                        onCancel() {
                            console.log('Cancel');
                        },
                    });
                }
            }
        }

        hideCommonModal(name) {
            this.setState({
                [name]: false
            }, () => {
                this.getFindDate()
            })
        }

        render() {
            const { getFieldDecorator } = this.props.form;
            const { searchLoading, columns, widthTotal, record, rowIds } = this.state;
            var date = new Date();
            let searchColConfig = {
                xs: { span: 24 },
                sm: { span: 12 },
                md: { span: 10 },
                lg: { span: 7 }
            }
            let statusData = [
                {
                    descriptsSPCode: "QB",
                    descripts: "全部",
                    id: "ALL",
                    descriptsEN: "All"
                }, {
                    descriptsSPCode: "SX",
                    descripts: "生效",
                    id: "Y",
                    descriptsEN: "Take effect"
                }, {
                    descriptsSPCode: "SX",
                    descripts: "失效",
                    id: "N",
                    descriptsEN: "Invalid"
                },
            ]
            //状态
            let statusOp = [];
            statusData && statusData.map((item, index) => {
                statusOp.push(<Option key={index} code={item.descriptsSPCode} value={item.id} title={item.descripts + '^' + item.id}>{this.state.userData.language == 'EN' ? item.descriptsEN : item.descripts}</Option>)
            })
            //医院
            let hosOp = []
            this.state.hospArr && this.state.hospArr.map((item) => {
                hosOp.push(<Option key={item.id} onClick={(e,) => this.handleBaseHosp(item.id)} value={String(item.id)}>{item.descripts}</Option>)
            })
            //科室类型
            let locOp = []
            this.state.publicBaseLocArr && this.state.publicBaseLocArr.map(item => {
                locOp.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            })
            //治疗状态
            let treatOp = []
            this.state.treatArr && this.state.treatArr.map(item => {
                treatOp.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            })
            //预约状态
            let outOp = []
            this.state.outArr && this.state.outArr.map(item => {
                outOp.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} title={item.descripts} value={String(item.id)}>{item.descripts}</Option>)
            })

            return (
                <div style={{ padding: '4px 2px' }} className="treatmentRoomDom">
                    {/**治疗预约 */}
                    <ShowConfirmApplicationModal isShow={this.state.isShowConfirmApplicationModal}
                        cureConAppID={this.state.cureAppID}
                        admID={this.state.admID}
                        onHide={this.hideCommonModal.bind(this, 'isShowConfirmApplicationModal')}>
                    </ShowConfirmApplicationModal>
                    <div className="department-header">
                        <Form>
                            <Row gutter={60} style={{ margin: '0', paddingLeft: "10px" }}>
                                <CardTypeRead getValue={this.getValue} getQuery={this.findData}></CardTypeRead>
                                <Col span={6} >
                                    <FormItem label={this.state.localeProvider && this.state.localeProvider.BookRecordPersonnelIdentification ? this.setMessage('BookRecordPersonnelIdentification', 'descripts') : '人员标识'} {...formItemLayoutInfo}>
                                        {getFieldDecorator('patInfo', {
                                            initialValue: undefined,
                                            rules: [{ required: false, message: '' }]
                                        })(
                                            <Input
                                                allowClear
                                                placeholder={this.state.localeProvider && this.state.localeProvider.BookRecordPatientIDNameID ? this.setMessage('BookRecordPatientIDNameID', 'descripts') : '病人ID/姓名/身份证号码/手机号码'}
                                                onPressEnter={this.findData}
                                                style={{ width: '100%' }}
                                            />
                                        )}
                                    </FormItem>
                                </Col >
                                <Col span={3} style={paddRightCol}>
                                    <FormItem {...formItemLayoutType} label={this.state.localeProvider && this.state.localeProvider.BookRecordAppointmentStatus ? this.setMessage('BookRecordAppointmentStatus', 'descripts') : "预约状态"}>
                                        {getFieldDecorator('reservationStatus', {
                                            initialValue: undefined,
                                            rules: [{ required: false, message: '' }],
                                        })(
                                            <Select
                                                allowClear
                                            >
                                                {outOp}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                                <Col span={3} style={paddRightCol}>
                                    <FormItem {...formItemLayoutType} label={this.state.localeProvider && this.state.localeProvider.BookRecordApplicationSection ? this.setMessage('BookRecordApplicationSection', 'descripts') : "申请科室"}>
                                        {getFieldDecorator('locID', {
                                            initialValue: undefined,
                                            rules: [{ required: false, message: '' }],
                                        })(
                                            <Select
                                                allowClear
                                            >
                                                {locOp}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                                <Col span={3} style={paddRightCol}>
                                    <FormItem {...formItemLayoutType} label={this.state.localeProvider && this.state.localeProvider.BookRecordTreatmentStatus ? this.setMessage('BookRecordTreatmentStatus', 'descripts') : "治疗状态"}>
                                        {getFieldDecorator('treatStatus', {
                                            initialValue: undefined,
                                            rules: [{ required: false, message: '' }],
                                        })(
                                            <Select
                                                allowClear
                                            >
                                                {treatOp}
                                            </Select>
                                        )}
                                    </FormItem>
                                </Col>
                            </Row>
                            <Row gutter={60} style={{ margin: '0', paddingLeft: "10px" }}>
                                <Col {...searchColConfig} style={{ padding: "4px 0" }}>
                                    <RangeDatePicker isChange={true} label={this.state.localeProvider && this.state.localeProvider.BookRecordbookDateTime ? this.setMessage('BookRecordbookDateTime', 'descripts') : "预约治疗时间: "} format='YYYY-MM-DD' width={389}
                                        startDate={this.state.StartDate} endDate={this.state.EndDate}
                                        startChange={this.startChange.bind(this)} endChange={this.endChange.bind(this)} locale={this.state.userData.language} />
                                </Col>
                                <Col span={6} >
                                    <FormItem {...formItemLayoutInfo} label={this.state.localeProvider && this.state.localeProvider.BookRecordHospitalNumber ? this.setMessage('BookRecordHospitalNumber', 'descripts') : "住院号"}>
                                        {getFieldDecorator('hosNumber', {
                                            initialValue: undefined,
                                            rules: [{ required: false, message: '' }],
                                        })(
                                            <Input placeholder={this.state.localeProvider && this.state.localeProvider.BookRecordPleaseEnter ? this.setMessage('BookRecordPleaseEnter', 'descripts') : "请输入"} onPressEnter={this.findData}></Input>
                                        )}
                                    </FormItem>
                                </Col>
                                <Col span={2} style={{ padding: "0 0 0 30px" }}>
                                    <FormItem  {...formItemLayout}>
                                        {getFieldDecorator('posInp', {
                                            initialValue: undefined,
                                            rules: [{ required: false, message: '' }],
                                        })(
                                            <Button onClick={this.findData} loading={searchLoading} style={{ background: 'rgba(66,185,131,1)', color: '#fff' }}>{this.state.localeProvider && this.state.localeProvider.BookRecordSearch ? this.setMessage('BookRecordSearch', 'descripts') : "查询"}</Button>
                                        )}
                                    </FormItem>
                                </Col>
                            </Row>
                        </Form>
                        <Row className="edit-Button" style={{ paddingLeft: "30px", marginBottom: "8px" }}>
                            <Col span={6}>
                                <span>{this.state.localeProvider && this.state.localeProvider.BookRecordAmount ? this.setMessage('BookRecordAmount', 'descripts') : "金额(元)"}:<span>{record && record.ordTotalAmt ? record.ordTotalAmt : "--"}</span></span>
                                <span style={{ margin: "8px", padding: "2px", background: "#FF9900", color: "#fff" }}>{record && record.billCode == "TB" ? (this.state.localeProvider && this.state.localeProvider.BookRecordNotCharged ? this.setMessage('BookRecordNotCharged', 'descripts') : "未收费") : (record && record.billCode == "B" || record && record.billCode == "p" ? (this.state.localeProvider && this.state.localeProvider.BookRecordForAFee ? this.setMessage('BookRecordForAFee', 'descripts') : "已收费") : "--")}</span>
                                <Button type="primary" onClick={this.openPay} disabled={record && record.billCode == "B" || record && record.billCode == "p" || record && record.billCode == ""} style={{ border: "1px solid #30AD69", padding: "6px 12px", borderRadius: "4px", color: "#30AD69", background: "#fff" }}> {this.state.localeProvider && this.state.localeProvider.BookRecordCardConsumption ? this.setMessage('BookRecordCardConsumption', 'descripts') : "卡消费"}</Button>
                                <Button style={{ background: '#1999db', color: 'white' }} className='patient-saveButton'
                                    onClick={this.loadCallNum.bind(this)}>呼叫</Button>
                                <Button style={{ background: '#FA8C16', color: 'white' }} className='patient-saveButton'
                                    onClick={this.loadCallNum.bind(this)}>重呼</Button>
                                <Button style={{ background: '#13C2C2', color: 'white' }} className='patient-saveButton'
                                    onClick={this.loadPassNum.bind(this)}>过号</Button>
                            </Col>
                            <Col span={18} style={{ textAlign: "right" }}>
                                <Button type="primary" disabled={rowIds && record && record.bookStatusCode == "AR" && (record.cureStatusCode != "F" || record.cureRecordID != "") ? false : true} onClick={() => this.handleButton("1")}>{this.state.localeProvider && this.state.localeProvider.BookRecordCancelArrival ? this.setMessage('BookRecordCancelArrival', 'descripts') : "取消到达"}</Button>
                                <Button type="primary" disabled={rowIds && record && record.bookStatusCode == "B" ? false : true} onClick={() => this.handleButton("2")}> {this.state.localeProvider && this.state.localeProvider.BookRecordArrivals ? this.setMessage('BookRecordArrivals', 'descripts') : "到达"}</Button>
                                <Button type="primary" disabled={rowIds && record && (record.cureStatusCode == "F" || "") ? false : true} onClick={() => this.handleButton("3")}> {this.state.localeProvider && this.state.localeProvider.BookRecordCancelCompleted ? this.setMessage('BookRecordCancelCompleted', 'descripts') : "取消完成"}</Button>
                                <Button type="primary" disabled={rowIds && record && (record.cureStatusCode == "C" || record.cureStatusCode == "") && record.bookStatusCode != "B" ? false : true} onClick={() => this.handleButton("4")}> {this.state.localeProvider && this.state.localeProvider.BookRecordTreatmentCompleted ? this.setMessage('BookRecordTreatmentCompleted', 'descripts') : "治疗完成"}</Button>
                                <Button type="primary" disabled={!rowIds} onClick={() => this.handleButton("5")}>{this.state.localeProvider && this.state.localeProvider.BookRecordPreviousTreatmentList ? this.setMessage('BookRecordPreviousTreatmentList', 'descripts') : "历次治疗单"} </Button>
                            </Col>
                        </Row>
                        {/* 收银弹框显示 */}
                        {/* <Modal
                            visible={this.state.payModalVis}
                            onCancel={this.handleCancelMoney}
                            onOk={this.handleOK}
                            width='600px'
                            title="收银"
                        >  <div>
                                <PayContentModal ref={this.PayContenRef} accountID={this.state.accountID ||""} admIDinfo={this.state.admID || ''} chargeordIDinfo={this.state.chargeordIDinfo} key={this.state.chargeordIDinfo} handleCallback={this.handleCallback}></PayContentModal>
                            </div>

                        </Modal> */}
                        <TreatmentAddModal getFindDate={() => this.getFindDate(this.state.values)}
                            onSubmit={this.onSubmit.bind(this)}
                            OnChildrefs={this.OnChildrefs}></TreatmentAddModal>
                        <TreatmentHistoryModal record={this.state.record} OnHisRef={this.OnHisRef}></TreatmentHistoryModal>
                        <div className="listDom">
                            <Table
                                scroll={{ x: (columns && columns.length > 0 ? widthTotal : 4000), y: store.getState().tableHeight.y - 90 }}
                                columns={columns}
                                dataSource={this.state.listData}
                                pagination={false}
                                rowKey={record => record.key}
                                onRow={this.onClickRow}
                                rowClassName={this.setRowClassNames}
                                bordered
                                style={{ height: store.getState().tableHeight.y - 30 + 'px', overflow: "auto" }}
                            />
                            <CommonPagination size={this.state.size} page={this.state.page} current={this.state.page} total={this.state.total} search={this.state.search}
                                onShowSizeChange={this.onShowSizeChange.bind(this)} complete={true} dataSource={this.state.listData}
                                onChange={this.onChange.bind(this)} />
                            <ColumnAuthoritysModel
                                clientWidth='800px'
                                compontName='BookRecord'
                                configType="C"
                                onRef={this.onColumnRef}
                                reloadData={this.getMainTableColumns}
                            />
                        </div>
                    </div>
                </div>

            )
        }
    })
export default TreatmentRoom    