// 住院一日费用清单
import React from 'react';
import { Select, Input, Row, Col, Button, Divider, message, Icon, Table, Collapse, Checkbox } from 'antd';
import { $http } from 'containers/config/https';
import { Util, ArraySome } from '../../../tools/index';
import './style/style.less'
import ReadCard from '../../../components/readcard/ReadCard';
import RangeDatePicker from 'components/rangePicker/index';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import { $loopPrint } from '../../lodop/Common/Print';

// 组件const
const { Option } = Select;
const { Search } = Input;
const { Panel } = Collapse;

export default class ListOfOneDayHospitalizationExpenses extends React.Component {
    constructor(props) {
        super(props)
        this.state = {
            dataTableTop: [], // table数据 上列表table
            dataTable1: [], // table数据 主列表table
            dataTable2: [], // table数据 折扣记账系数配置列表
            dataTable3: [], // table数据 不属于折扣内明细
            selectListData1: [],
            selectListData2: [],
            selectListData3: [],
            totalTop: 0,
            pageTop: 1,
            pageSizeTop: 10,
            // 表格数据总条数1
            total1: 0,
            page1: 1,
            pageSize1: 10,
            StartDateTop: undefined,  // //开始日期
            EndDateTop: undefined,  // //结束日期
            StartDate1: undefined,  // //开始日期
            EndDate1: undefined,  // //结束日期
            cardType: '', // 卡类型
            cardTypeData: [], // 卡类型
            cardNo: '', // 卡号
            patNo: '',
            select1: '',
            select2: '',
            select3: '',
            nameNo: '',
            execID: [],
            ordID: '',
            modalShow: false,
            columnsTop: [],
            columns1: [],
            money: {},
            bqType: '',
            jsType: '',
            bqData: [],
            jsTypeData: [],
            time1: '1',
            allMoney: 0,
            accSubStatus: {}, //账户状态
            userPayData: {}, //账户状态
            patBillID: '',
            idArr: [],
            selectedRowKeys: [], //选中
            readModeI: true,
            readModeR: true,
            CheckboxAll: [],
            bedData: [],
            bednum: '', // 床位
            languageData: {}, // 国际化语言包
            language: {},   // 国际化语言
            languageCode: JSON.parse(window.sessionStorage.userData).language, // 国际化语言标识
            ColumnAuthority: '',
            key1: undefined,
            tabsChangflag: ''
        }

        // this.columns1 = [{ title: '项目名称*规格', dataIndex: 'descripts', align: "center", width: 100, key: '1' },
        // { title: '住院费用类型', dataIndex: 'patTypeDesc', align: "center", width: 100, key: '2' },
        // { title: '单价', dataIndex: 'unitPrice', align: "center", width: 100, key: '3' },
        // { title: '数量', dataIndex: 'Qty', align: "center", width: 100, key: '4' },
        // { title: '总金额', dataIndex: 'patAmt', align: "center", width: 100, key: '5' },
        // { title: '单位', dataIndex: 'unitDesc', align: "center", width: 100, key: '6' },
        // { title: '自费比例', dataIndex: 'payDateTime', align: "center", width: 100, key: '7' },
        // { title: '自费金额', dataIndex: 'payDateTime', align: "center", width: 100, key: '8' },
        // { title: '计费科室', dataIndex: 'payDateTime', align: "center", width: 100, key: '9' },
        // { title: '操作员', dataIndex: 'payDateTime', align: "center", width: 100, key: '10' },
        // { title: '计费时间', dataIndex: 'billDate', align: "center", width: 100, key: '11' },
        // ]
    }

    componentDidMount() {
        this.props.onRef(this)
        this.cardTypeList() //卡类型
        this.jsList() //结算
        this.bqList() //病区
        // 重新调用查询方法
        this.ordList1() //国际化
    }

    static getDerivedStateFromProps(nextProps, prevState) {
        //该方法内禁止访问this
        if (nextProps.admID !== prevState.propsAdmID) {
            //通过对比nextProps和prevState，返回一个用于更新状态的对象
            return {
                propsAdmID: nextProps.admID
            }
        }
        return null
    }

    componentDidUpdate(prevProps, prevState) {
        if (prevProps.admID !== this.state.propsAdmID) {
            this.setState({ propsAdmID: prevProps.admID }, () => {
                this.tableData();
            })
        }
    }

    // 费用类型table
    ordList1 = () => {
        let data = {
            params: [{
                "reactCode": ["ListOfOneDayHospitalizationExp"],
                "compontName": "ListOfOneDayHospitalizationExp",
                "type": "C"

            }]
        }
        $http.post('urlS', this, {
            code: "01040073",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let resC = res.result.C
                    let { languageCode } = this.state

                    for (var i = 0; i < resC.length; i++) {
                        resC[i].key = i;
                    }

                    if (languageCode === "EN") {
                        resC.map((item, i) => {
                            item.title = item.enDescripts
                        })
                    }

                    if (languageCode === "CN") {
                        resC.map((item, i) => {
                            item.title = item.descripts
                        })
                    }
                    let arr = res.result && resC.length > 0 ? JSON.parse(JSON.stringify(resC)).map(item => {
                        return {
                            align: item.align,
                            widthNum: parseInt(item.width),
                            width: item.width,
                            dataIndex: item.dataIndex,
                            title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{item.title}</div>,
                            display: item.display,
                            key: item.seqNo
                        }
                    }) : '';

                    let filterArr = arr.filter(function (item) { return item.display === 'Y' });


                    this.setState({
                        columns1: filterArr, // 费用类型table
                        languageData: res.result.language || {},  // 国际化语言包
                    }, () => {
                        // this.columns1(this.state.columns1)
                        this.LanCNEN(this.state.languageCode)
                    })
                }
            }
        });
    }

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

    // 数据配置
    columns1(resC) {
        let { languageCode } = this.state
        for (var i = 0; i < resC.length; i++) {
            resC[i].key = i;
        }
        if (languageCode === "EN") {
            resC.map((item, i) => {
                item.title = item.enDescripts
            })
        }
        if (languageCode === "CN") {
            resC.map((item, i) => {
                item.title = item.descripts
            })
        }
        this.setState({
            columns1: resC, // 费用类型table
        });
    }

    LanCNEN = (code) => {
        let { languageData } = this.state
        this.setState({
            language: languageData[code]
        })
    }

    startChange(date) {
        this.setState({
            StartDate1: date,
        })
    }

    endChange(date) {
        this.setState({
            EndDate1: date,
        })
    }

    clearn = () => {
        this.setState({
            dataTableTop: [], // table数据 上列表table
            dataTable1: [], // table数据 主列表table
            dataTable2: [], // table数据 折扣记账系数配置列表
            dataTable3: [], // table数据 不属于折扣内明细
            selectListData1: [],
            selectListData2: [],
            selectListData3: [],
            totalTop: 0,
            pageTop: 1,
            pageSizeTop: 10,
            // 表格数据总条数1
            total1: 0,
            page1: 1,
            pageSize1: 10,
            StartDateTop: undefined,  // //开始日期
            EndDateTop: undefined,  // //结束日期
            StartDate1: undefined,  // //开始日期
            EndDate1: undefined,  // //结束日期
            cardNo: '', // 卡号
            patNo: '',
            select1: '',
            select2: '',
            select3: '',
            nameNo: '',
            execID: [],
            ordID: '',
            modalShow: false,
            money: {},
            bqType: '', //科室,
            jsType: '',
            time1: '1',
            allMoney: 0,
            accSubStatus: {}, //账户状 态
            userPayData: {}, //账户状态
            patBillID: '',
            idArr: [],
            selectedRowKeys: [], //选中
            readModeI: true,
            readModeR: true,
            CheckboxAll: [],
            bedData: [],
            bednum: '', // 床位
            key1: undefined,
        }, () => {
            this.setState({
                key1: '1',
            })
        })
    }

    //查询床位
    BedChange = (locID) => {
        let data = {
            params: [{
                locID: locID,
            }]
        }
        $http.post('urlS', this, {
            code: "01050021",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    this.setState({ bedData: res.result.Data })
                }
            }
        })
    }

    //卡类型
    cardTypeList = () => {
        var data = {
            params: [{
                hospID: JSON.parse(window.sessionStorage.userData).hospID, //医院id 
            }]
        }
        $http.post('urlS', this, {
            code: "01040059",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let cardDeffault = res.cardType.filter((item) => {
                        return item.defaultFlag === 'Y';
                    })
                    this.setState({
                        cardType: cardDeffault[0].id, // 默认卡
                        cardTypeData: res.cardType,  // 用户数据
                    }, () => {
                        this.CardTypeChange(this.state.cardType)
                    });
                }
            }
        });
    }

    //1.1.49.住院费用明细相关下拉框（病区）
    bqList = () => {
        var data = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
                "type": "W",
            }]
        }
        $http.post('urlS', this, {
            code: "04020008",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    var data = res.result.Data
                    var code = ''
                    if (!Util.isEmpty(data)) {
                        for (var i = 0; i < data.length; i++) {
                            if (JSON.parse(window.sessionStorage.userData).locID == data[i].id) {
                                code = data[i].id
                            }
                        }
                    }
                    this.setState({
                        bqData: res.result.Data || [], // 数据
                        bqType: code
                    }, () => {
                        this.dataTableTopData();
                    });
                }
            }
        });
    }

    //1.1.49.住院费用明细相关下拉框（结算）
    jsList = () => {
        var data = {
            params: [{
                "hospID": JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
            }]
        }

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

                    this.setState({
                        jsTypeData: res.data || [], // 数据
                    });
                }
            }
        });
    }

    // 回车查询登记号
    patNodownE = (e, type) => {
        if (e.keyCode === 13) {
            this.searchUser(type)
        }
    }

    // 读卡 --- 根据卡号取病人信息
    handleReadCard = (value, event) => {
        let { readModeI, readModeR, cardType } = this.state
        if (event.keyCode) {
            if (readModeI) {
                this.searchUser('cardNo'); // 重新调用查询接口
            }
            return false
        }
        if (readModeR) {
            this.readCard.ReadCard(cardType, "R", (json) => {
                let patNo = json && json.patInfo ? json.patInfo.patNo : ''
                this.setState({ patNo, cardNo: json.cardNo }, () => {

                    //this.searchUser('cardNo'); // 重新调用查询接口
                    if (patNo) {
                        this.searchUser('patNo'); // 重新调用查询接口
                    } else {
                        this.searchUser('cardNo'); // 重新调用查询接口
                    }
                })
            })
        }
    }

    // 读卡
    searchUser = (type) => {
        var data;
        let { cardType, cardNo, patNo, cardTypeData } = this.state
        if (!type) {   // 查询全部
            data = {
                params: [{
                    "number": patNo || '', // 登记号/身份证号
                    "cardTypeID": cardType,   //卡类型id
                    "cardNo": cardNo,    //卡号
                }]
            }
        }

        if (type === 'patNo') {
            data = {
                params: [{
                    "number": patNo || '', // 登记号/身份证号
                    "cardTypeID": "",   //卡类型id
                    "cardNo": "",    //卡号
                }]
            }

            if (patNo === '') {
                return false
            }
        }

        if (type === 'cardNo') {
            data = {
                params: [{
                    "number": '', // 登记号/身份证号
                    "cardTypeID": cardType || '',     //卡类型id
                    "cardNo": cardNo || '', //卡号
                }]
            }

            if (cardNo === '') {
                return false
            }
            if (cardType === '') {
                message.error('请选择卡类型')
                return false
            }


            let cardTypeFilter = cardTypeData.filter(function (item) {
                return item.id == cardType;
            })

            let zeroLength = cardTypeFilter[0].cardLength

            if (zeroLength && zeroLength != '' && parseFloat(zeroLength) != 0) {
                this.setState({
                    cardNo: ArraySome.addPreZero(cardNo, zeroLength)
                })
                data = {
                    params: [{
                        "number": '', // 登记号/身份证号
                        "cardTypeID": cardType || '',     //卡类型id
                        "cardNo": ArraySome.addPreZero(cardNo, zeroLength) || '', //卡号
                    }]
                }
            }
        }

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

                    this.setState({

                        patNo: res.data.patNo || '',  // ID
                    }, () => {
                        this.dataTableTopData() // 就诊信息
                    });

                } else {
                    message.error(res.errorMessage);
                    // this.clearnFile()  // 清空 
                }
            }
        });
    }

    // 查询条件 --- 病区
    bqType = (e) => {
        this.setState({ bqType: e }, () => {
            this.BedChange(e)
        });
    }

    // 查询条件 --- 床位
    bednum = (e) => {
        this.setState({ bednum: e });
    }

    // 查询条件 --- 结算
    jsType = (e) => {
        this.setState({ jsType: e });
    }

    // 查询条件 --- 时间类型
    time1 = (e) => {
        this.setState({ time1: e });
    }

    // 查询条件 --- 卡类型·
    cardType = (e) => {
        this.setState({ cardType: e }, () => {
            this.CardTypeChange(e)
        });
    }
    // 查询条件 --- 卡号
    cardNo = (e) => {
        let { readModeI } = this.state
        if (!readModeI) {
            return false
        }
        this.setState({ cardNo: e.target.value });
    }

    // Card
    CardTypeChange = (e) => {
        if (!e) {
            return false
        }
        let { cardTypeData } = this.state
        let readMode = cardTypeData.filter((item, i) => {
            return item.id == e;
        })

        switch (readMode[0] && readMode[0].readMode) {
            // 只可input
            case 'I':
                this.setState({
                    readModeI: true,
                    readModeR: false,
                    cardNo: "",

                })
                break;
            // 只可读卡
            case 'R':
                this.setState({
                    readModeR: true,
                    readModeI: false,
                    cardNo: "",
                })
                break;
            // 皆可
            default:
                this.setState({
                    readModeI: true,
                    readModeR: true,
                    cardNo: "",
                })
                break;
        }
    }

    // 查询条件 --- 登记号
    patNo = (e) => {
        this.setState({ patNo: e.target.value });
    }

    // 查询条件 --- 登记号
    adminNo = (e) => {
        this.setState({ adminNo: e.target.value });
    }

    ///主界面传参数
    TabsChang = (parameterData) => {
        this.setState({
            tabsChangflag: '1',
            patNo: parameterData.patNo || '', // 登记号/身份证号
            cardType: parameterData.cardTypeID,   //卡类型id
            cardNo: parameterData.cardNo,    //卡号
            hospID: JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
            adminNo: parameterData.medicalNo,
            EndDate1: parameterData.EndDateTop,
            StartDate1: parameterData.StartDateTop,
            bqType: parameterData.wardID, //病区
            jsType: parameterData.payReasonID,  //费别
            bednum: parameterData.bednum,// 床号
        }, () => {
            this.dataTableTopData();
        });
    }

    //checkChange
    onSelectChange = (selectedRowKeys, selectedRows) => {
        let { idArr } = this.state
        idArr = selectedRows.map((item, i) => {
            return item.admID
        })
        this.setState({
            selectedRowKeys: selectedRowKeys || [],
            idArr: idArr || []
        }, () => {
            this.dataTable1Data()
        })
    }

    // 1.1.52.住院费用明细相关接口（就诊信息及费用信息接口）
    dataTableTopData = (e) => {
        let { pageSizeTop, pageTop, bednum, StartDateTop, EndDateTop, time1, bqType, jsType, cardType, cardNo, patNo, StartDate1, EndDate1, adminNo } = this.state
        var data = {
            params: [{
                "number": patNo || '', // 登记号/身份证号
                "cardTypeID": cardType,   //卡类型id
                "cardNo": cardNo,    //卡号
                hospID: JSON.parse(window.sessionStorage.userData).hospID || '', //医院id 
                "adminNo": adminNo,
                "stopDate": EndDate1,
                "startDate": StartDate1,
                "wardID": bqType, //病区
                "admReasonID": jsType,  //费别
                bedID: bednum,// 床号

            }]
        }
        $http.post('urlS', this, {
            code: "05100238",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    for (var i = 0; i < res.result.length; i++) {
                        res.result[i].key = i;
                    }
                    this.setState({
                        dataTable1: res.result,
                        // bqType: res.wardID,
                        // locID: res.bedID,
                        // admReasonID: res.admReasonID,
                        adminNo: res.adminNo
                    }, () => {
                        let { idArr, dataTable1 } = this.state

                        idArr = dataTable1.map((item, i) => {
                            return item.admID
                        })
                        this.setState({
                            idArr: idArr || [],
                            CheckboxAll: idArr || []
                        })
                    });

                } else {
                    this.setState({
                        dataTable1: [],
                        idArr: [],
                        CheckboxAll: []
                    })
                }
            }
        });
    }

    // 选中行操作
    setRowClassNamePublicTop = (record) => {
        return this.state.idArr.includes(record.ID) ? 'clickRowStyle' : '';
    }

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

    onChangeTop = (page, pageSize) => {
        this.setState({ pageTop: page, pageSizeTop: pageSize }, () => {
            // 重新调用查询方法
            this.dataTableTopData();
        })
    }

    // 条数改变的回调
    onShowSizeChangeTop = (current, size) => {
        this.setState({ pageTop: 1, pageSizeTop: size }, () => {
            // 重新调用查询方法
            this.dataTableTopData();
        })
    }

    // 页码改变的回调，参数是改变后的页码及每页条
    onChange1 = (page, pageSize) => {
        this.setState({ page1: page, pageSize1: pageSize }, () => {
            // 重新调用查询方法
            this.dataTable1Data();
        })
    }

    // 条数改变的回调
    onShowSizeChange1 = (current, size) => {
        this.setState({ page1: 1, pageSize1: size }, () => {
            // 重新调用查询方法
            this.dataTable1Data();
        })
    }


    // 时间
    onChangeTimeTop = (date, dateString) => {
        this.setState({
            StartDateTop: dateString[0],    //开始日期
            EndDateTop: dateString[1],  //结束日期
        })
    }

    // 打印
    // DY = () => {
    //     let item = this.state.CheckboxAll
    //     for (var i = 0; i < item.length; i++) {
    //         var admID = item[i]
    //         this.printList(admID)
    //     }
    // }

    // printList = (admId) => {
    //     if (!admId) {
    //         message.error("请选择要打印的就诊人");
    //         return;
    //     }
    //     let { StartDate1, EndDate1 } = this.state
    //     const data = {
    //         params: [{
    //             "hospID": JSON.parse(window.sessionStorage.userData).hospID,
    //             "admID": admId,
    //             "stopDate": EndDate1,
    //             "startDate": StartDate1,
    //         }]
    //     };
    //     $http.post('urlS', this, {
    //         code: "05100368",
    //         data: data,
    //         success: function (res) {
    //             if (+res.errorCode === 0) {
    //                 $loopPrint('', res.result);
    //             } else {
    //                 message.error(res.errorMessage);
    //             }
    //         }
    //     })
    // }

    // 打印
    DY = () => {
        let _this = this;
        let { dataTable1, CheckboxAll } = this.state;
        let checkData = [];
        for (let i = 0; i < dataTable1.length; i++) {
            if (CheckboxAll.indexOf(dataTable1[i].admID) > -1) {
                checkData.push(dataTable1[i].admID);
            }
        }
        async function run() {
            for (let i = 0; i < checkData.length; i++) {
                await _this.printList(checkData[i], i)
            }
        }
        run().then((res) => {
            console.log(res, '执行完成')
        })
    }

    // 按照顺序执行打印
    printList = async (admId, index) => {
        await Promise.resolve(admId, index);
        return await new Promise((resolve, reject) => {
            setTimeout(async () => {
                try {
                    if (!admId) {
                        message.error('请选择要打印的就诊人');
                        resolve();
                        return;
                    }
                    let { StartDate1, EndDate1 } = this.state
                    const data = {
                        params: [{
                            hospID: JSON.parse(window.sessionStorage.userData).hospID,
                            admID: admId,
                            stopDate: EndDate1,
                            startDate: StartDate1,
                        }]
                    };
                    let res = await React.$asyncPost(this, '05100368', data);
                    if (res.errorCode === '0') {
                        $loopPrint('', res.result);
                        resolve();
                    } else {
                        message.error(res.errorMessage);
                        resolve();
                    }
                } catch (error) {
                    resolve();
                }
            }, 300)
        });
    }

    CheckboxAll = (e) => {
        let { idArr } = this.state
        this.setState({
            CheckboxAll: e.target.checked ? idArr : []
        })
    }

    Checkbox = (e, item) => {
        e.stopPropagation()
        let { CheckboxAll } = this.state
        if (e.target.checked) {
            CheckboxAll.push(item.admID)

        } else {
            CheckboxAll = CheckboxAll.filter(function (items) {
                return items !== item.admID
            })
        }
        this.setState({
            CheckboxAll: CheckboxAll
        })
    }

    sexDr = (patSexCode) => {
        let config = {
            '1': 'boysmall',
            '2': 'girlsmall',
        }
        return config[patSexCode] || 'unkonwsmall';
    }

    sexDrSpan = (patSexCode) => {
        let config = {
            '1': 'boySpan',
            '2': 'girlSpan',
        }
        return config[patSexCode] || 'unkonwSpan';
    }

    render() {
        let { language, columns1 } = this.state
        const genExtra = (item) => (
            <Checkbox onChange={(e) => this.Checkbox(e, item)} checked={this.state.CheckboxAll.includes(item.admID) ? true : false} ></Checkbox>
        );
        const addUSerInfo = (item) => (
            <div style={{ background: '#1999db' }}>
                <Row className="TipHeader" style={{ display: "flex", alignItems: "center", padding: "0 10px" }}>
                    <div className={`${this.sexDr(item.patSexCode)} imgBox`} style={{ height: '40px' }}></div>
                    <div className='imgTitle' style={{ lineHeight: '32px', marginLeft: "24px", padding: "0 10px" }} >
                        <span style={{ display: !Util.isNull(item) ? 'none' : 'inline', padding: ' 0 24px', color: "#333", }} > <i className='unknow'></i> ——</span>
                        <Col style={{ display: Util.isNull(item) ? 'none' : 'flex', alignItems: "center", flexWrap: "wrap" }}>
                            <Icon style={{ color: '#CDCDCD' }} type="user" />
                            <span style={{ marginLeft: '10px', color: '#FA8C16' }}>{item.patNo}</span>
                            <Divider type="vertical" style={{ margin: '0 10px', }} />
                            <span style={{ fontSize: '16px', color: '#1999db' }}>{item.patName}</span>
                            <Divider type="vertical" style={{ margin: '0 10px', }} />
                            <span className={`${this.sexDrSpan(item.patSexCode)} `} >{item.patSexDesc}</span>
                            <Divider type="vertical" style={{ margin: '0 10px', }} />
                            <Icon style={{ marginLeft: '10px', color: '#CDCDCD' }} type="code-sandbox" />
                            <span style={{ marginLeft: '10px', color: '#13C2C2' }}>{item.patTypeDesc}</span>
                            <Divider type="vertical" style={{ margin: '0 10px', }} />
                            <span style={{ marginLeft: '10px' }}>{item.admDate + ' ' + item.admTime} 入院</span>
                            <Divider type="vertical" style={{ margin: '0 10px', }} />
                            <span style={{ marginRight: '20px' }}> {language.ListOfOneDayHospitalizationExpDailyfee && language.ListOfOneDayHospitalizationExpDailyfee.descripts}：<span style={{ color: '#1999db', }}>￥：{item.todayAmt || '0'}</span></span>
                            <span style={{ marginRight: '20px' }}> {language.ListOfOneDayHospitalizationExpFeesby && language.ListOfOneDayHospitalizationExpFeesby.descripts}：<span style={{ color: '#1999db', }}>￥：{item.todayEndAmt || '0'}</span></span>
                            <span style={{ marginRight: '20px' }}> {language.ListOfOneDayHospitalizationExpTotalcost && language.ListOfOneDayHospitalizationExpTotalcost.descripts}：<span style={{ color: '#1999db', }}>￥：{item.patAmt || '0'}</span></span>
                            <span style={{ marginRight: '20px' }}> {language.ListOfOneDayHospitalizationExpAccountamount && language.ListOfOneDayHospitalizationExpAccountamount.descripts}：<span style={{ color: '#1999db', }}>￥：{item.accDeposit || '0'}</span></span>
                            <span style={{ marginRight: '20px' }}> {language.ListOfOneDayHospitalizationExpbalance && language.ListOfOneDayHospitalizationExpbalance.descripts}：<span style={{ color: '#1999db', }}>￥：{item.balance || '0'}</span></span>
                        </Col>
                    </div>
                </Row>
            </div>
        )
        return (
            <div>
                <ReadCard ref={r => this.readCard = r} />
                {this.state.tabsChangflag != '1' ?
                    <div >
                        <Row>
                            <Col span={24} style={{ padding: 10 }}>
                                <div className="table-operations">
                                    <Row style={{ minHeight: '50px', paddingBottom: '10px' }}>
                                        <Col span={24}>
                                            <Select allowClear style={{ width: '100px', margin: '12px 15px 0 0' }} placeholder="请选择卡类型" value={this.state.cardType} onChange={(event) => { this.cardType(event) }}  >
                                                <Option value=''>{language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.message}</Option>
                                                {this.state.cardTypeData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                            </Select>
                                            <Search className={`search ${!this.state.readModeI ? 'disabled' : ''}`} style={{ width: '200px', margin: '12px 15px 0 0' }} allowClear placeholder="请输入卡号" disabled={this.state.disabledInput} value={this.state.cardNo} enterButton="读卡" onChange={(event) => { this.cardNo(event) }} onSearch={this.handleReadCard} />
                                            {language.ListOfOneDayHospitalizationExpPatientinformation && language.ListOfOneDayHospitalizationExpPatientinformation.descripts}：<Input allowClear style={{ width: '200px', margin: '12px 15px 0 0' }} placeholder={language.ListOfOneDayHospitalizationExpPatientinformation && language.ListOfOneDayHospitalizationExpPatientinformation.message} className='input' value={this.state.patNo} onChange={(event) => { this.patNo(event) }} onKeyUp={(e) => { this.patNodownE(e, 'patNo'); }} />
                                            {language.ListOfOneDayHospitalizationExpInpatientNo && language.ListOfOneDayHospitalizationExpInpatientNo.descripts}：<Input allowClear style={{ width: '200px', margin: '12px 15px 0 0' }} placeholder={language.ListOfOneDayHospitalizationExpInpatientNo && language.ListOfOneDayHospitalizationExpInpatientNo.message} className='input' value={this.state.adminNo} onChange={(event) => { this.adminNo(event) }} />
                                            {language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.descripts}： <Select allowClear style={{ width: '200px', margin: '12px 15px 0 0' }} placeholder={language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.message} value={this.state.bqType} onChange={(event) => { this.bqType(event) }}  >
                                                <Option value=''>{language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.message}</Option>
                                                {this.state.bqData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                            </Select>
                                            <div>
                                                {language.ListOfOneDayHospitalizationExpBednumber && language.ListOfOneDayHospitalizationExpBednumber.descripts}：<Select allowClear style={{ width: '200px', margin: '12px 15px 0 0' }} placeholder={language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.message} value={this.state.bednum} onChange={(event) => { this.bednum(event) }}  >
                                                    <Option value=''>{language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.message}</Option>
                                                    {this.state.bedData.map(item => <Option title={item.bedDesc} key={item.bedCBID} value={item.bedCBID}  >{item.bedDesc}</Option>)}
                                                </Select>
                                                {language.ListOfOneDayHospitalizationExpSettlementtype && language.ListOfOneDayHospitalizationExpSettlementtype.descripts}：<Select allowClear style={{ width: '245px', margin: '12px 15px 0 0' }} placeholder={language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.message} value={this.state.jsType} onChange={(event) => { this.jsType(event) }}  >
                                                    <Option value=''>{language.ListOfOneDayHospitalizationExpVisitingward && language.ListOfOneDayHospitalizationExpVisitingward.message}</Option>
                                                    {this.state.jsTypeData.map(item => <Option title={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                                </Select>
                                                {language.ListOfOneDayHospitalizationExpDateConsultation && language.ListOfOneDayHospitalizationExpDateConsultation.descripts}：<span style={{ display: 'inline-block', margin: '12px 15px 0 0', verticalAlign: 'top' }}><RangeDatePicker format='YYYY-MM-DD' style={{ width: 260 }}
                                                    key={this.state.key1} startDate={this.state.StartDate1} endDate={this.state.EndDate1} startChange={this.startChange.bind(this)} endChange={this.endChange.bind(this)} /></span>
                                                <Button onClick={() => this.clearn()} style={{ margin: '12px 15px 0 0', background: 'rgba(255,255,255,1)' }}>{language.ListOfOneDayHospitalizationExpempty && language.ListOfOneDayHospitalizationExpempty.descripts}</Button>
                                                <Button onClick={() => this.dataTableTopData()} style={{ margin: '12px 15px 0 0', background: 'rgba(255,255,255,1)' }}>{language.ListOfOneDayHospitalizationExpquery && language.ListOfOneDayHospitalizationExpquery.descripts}</Button>
                                            </div>
                                        </Col>
                                    </Row>
                                </div>
                            </Col>
                        </Row>
                    </div> : ''}
                <div style={{ background: '#f0f2f5', height: '10px' }}></div>
                <Row>
                    <div style={{ margin: '10px 10px 0 10px', float: 'right', width: '100%', lineHeight: '32px' }}>
                        <Checkbox onChange={this.CheckboxAll} style={{ marginLeft: '20px', float: 'left' }} defaultChecked={true}  >{language.ListOfOneDayHospitalizationExpAllelection && language.ListOfOneDayHospitalizationExpAllelection.descripts}</Checkbox>
                        <Button onClick={() => this.DY()} className='ant-btn-primary' style={{ marginRight: '10px', }}>{language.ListOfOneDayHospitalizationExpPrinting && language.ListOfOneDayHospitalizationExpPrinting.descripts}</Button>
                    </div>
                    <Col span={24} style={{ padding: "0 10px", margin: "10px 0", overflow: "auto", height: this.props && this.props.collapseHeight ? this.props.collapseHeight : "730px" }}>
                        <Collapse className='checkCollapse' >
                            {this.state.dataTable1.map((item, i) =>
                                <Panel header={addUSerInfo(item)} key={i} extra={genExtra(item)} >
                                    <div style={{ padding: 12 }} key={i} >
                                        <Table
                                            key={i}
                                            pagination={false}
                                            bordered
                                            scroll={{ y: 160, x: 1100 }}
                                            columns={columns1}
                                            dataSource={item.doctorArr}
                                            style={{ minHeight: '200px' }}
                                        />
                                    </div>
                                </Panel>
                            )}
                        </Collapse>
                    </Col>
                    <ColumnAuthoritysModel
                        clientWidth='900px'
                        compontName='ListOfOneDayHospitalizationExp'
                        configType="C"
                        onRef={this.onColumnRef}
                        reloadData={() => {
                            this.ordList1()
                        }}
                    />
                </Row>
            </div >
        )
    }
}