/**
 * 住院证列表
 */

import React from 'react'
import { Form, Col, Input, Select, Button, message, DatePicker, Table, Checkbox, Tooltip } from 'antd';
import { Util, dayFormat } from 'tools/index';
import { $http } from 'containers/config/https';
import { $loadTemplate } from '../../lodop/Common/Print.js';
import moment from 'moment';
import '../style/index.less';

const { Option } = Select;
var userData;
var recordData;
class AddHospitalization extends React.Component {
    constructor(props) {
        recordData = JSON.parse(sessionStorage.getItem('patientData'));
        if (!recordData) {
            recordData = JSON.parse(sessionStorage.getItem('recordData'));
        }
        userData = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
        super(props);
        this.state = {
            userData: userData,
            selectData: {},
            diagColumn: [],
            locList: [],
            wardList: [],
            bedList: [],
            adminCondtionList: [],
            defaultCondtion: '',
            adminPrincipleList: [],
            defaultPrinciple: '',
            adminRouteList: [],
            adminModeList: [],
            defaultMode: '',
            diagList: [],
            changeLocFlag: false,
            loginLocinfo: {},
            EN: {},
            CN: {},
            editAdmin: {},
            emptynumber: 0,
            waitnumber: 0,
            docdisnumber: 0,
            daytimenumber: 0,
            admReasonList: [],
            daytimeInhosp: "N",
            preInConfig: 'N',
            admReasonID: undefined, // 费别
        }
    }

    componentDidMount() {
        this.props.onRef(this);
        this.loadDiagColumn();
        this.loadBasicData();
        this.loadPatDiagData();
    }

    componentWillUnmount() {
        // 组件销毁前将静止让setState修改state的状态
        this.setState = (state, callback) => { return; }
    }

    componentWillReceiveProps(nextProps) {
        if (nextProps.activeTab) {
            this.loadPatDiagData();
        }
    }

    //查询诊断列头数据
    loadDiagColumn = () => {
        let data = {
            params: [{
                reactCode: ['AdminDiagList'],
                compontName: "AdminDiagList",
                type: "C",
            }]
        }
        $http.post('urlDeault', this, {
            code: "01040073",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    let diagColumn = res.result.C
                    for (let i = 0; i < diagColumn.length; i++) {
                        if (userData.language == 'EN') {
                            diagColumn[i].title = diagColumn[i].enDescripts
                        }
                    }
                    this.setState({
                        diagColumn: diagColumn,
                        EN: res.result.language.EN,
                        CN: res.result.language.CN
                    })
                }
            }
        })
    }

    // 中英文切换
    display(name) {
        return this.state.userData.language != 'EN' ? (this.state.CN['AdminDiagList' + name] && this.state.CN['AdminDiagList' + name]['descripts'] ? this.state.CN['AdminDiagList' + name]['descripts'] : '') : (this.state.CN['AdminDiagList' + name] && this.state.EN['AdminDiagList' + name]['descripts'] ? this.state.EN['AdminDiagList' + name]['descripts'] : '')
    }

    //查询床位数
    loadBedList = (wardID) => {
        let data = {
            params: [{
                wardID: wardID,
            }]
        }
        $http.post('urlDeault', this, {
            code: "04020018",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    this.setState({
                        bedList: res.result,
                    })
                }
            }
        })
    }

    //加载基础数据
    loadBasicData = () => {
        recordData = JSON.parse(sessionStorage.getItem('patientData'));
        let data = {
            params: [{
                patID: recordData.patID,
                admID: recordData.admID,
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050048",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    var admReasonID = ''
                    var admReasonList = res.result.admReason
                    if (!Util.isEmpty(admReasonList)) {
                        for (var i = 0; i < admReasonList.length; i++) {
                            if (admReasonList[i].defaultFlag == 'Y') {
                                admReasonID = admReasonList[i].id
                                break
                            }
                        }
                    }
                    let wardList = res.result?.ward || [];
                    if ((res.result.loginLocinfo) && (res.result.loginLocinfo.locTypeCode == 'OI')) {
                        wardList = res.result?.defaultWardList || [];
                        let inWardID = "";
                        if (res.result.defaultWardList.length > 0) {
                            inWardID = res.result.defaultWardList[0].id;
                            this.loadBedList(inWardID);
                        }
                        this.state.wardList = wardList;
                        this.props.form.setFieldsValue({
                            inLoc: res.result.loginLocinfo.id,
                            inWard: inWardID,
                        });
                    }
                    this.setState({
                        selectData: res?.result || {},
                        locList: res.result.loc,
                        adminCondtionList: res.result.adminCondtion,
                        adminPrincipleList: res.result.adminPrinciple,
                        adminRouteList: res.result.adminRoute,
                        adminModeList: res.result.adminMode,
                        loginLocinfo: res.result.loginLocinfo,
                        // linkWard: res.result.defaultWardList,
                        defaultCondtion: res.result.defaultCondtion,
                        defaultPrinciple: res.result.defaultPrinciple,
                        defaultMode: res.result.defaultMode,
                        admReasonList: res.result.admReason,
                        personelTypeList: res.result.personelTypeList,
                        daytimeInhosp: res.result.daytimeInhosp,
                        admReasonID: admReasonID,
                        preInConfig: res.result.preInConfig
                    })
                }
            }
        })
    }

    //加载本次诊断
    loadPatDiagData() {
        var params = {
            params: [{
                admID: recordData.admID,
                patID: recordData.patID,
                historyType: "",
                historyFlag: "N",
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050033",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        diagList: res.result.diagList, //本次诊断
                    })
                }
            }
        });
    }

    //保存住院证
    onSubmit = (e) => {
        e.preventDefault();
        if (Util.isEmpty(recordData.patID)) {
            message.warn(this.display('noPatient'));
            return;
        }
        if (this.state.diagList.length === 0) {
            message.warn(this.display('enterDiagnosisFirst'));
            return;
        }
        let editAdminObj = this.state.editAdmin || {};
        this.props.form.validateFields((err, values) => {
            if (!err) {  //!err
                let data = {
                    "params": [{
                        userID: userData.userID,                       //用户ID
                        hospID: userData.hospID,                       //医院ID
                        patID: recordData.patID,                       //患者ID
                        admID: recordData.admID,
                        inDate: moment(values.inDate).format(dayFormat) || '',    //入院日期
                        locID: values.inLoc,
                        wardID: values.inWard,
                        personelTypeCode: values.personelTypeCode,
                        personelTypeDesc: this.state.personelTypeDesc,
                        inCondtion: values.inCondtion,
                        inAdminRoute: values.inAdminRoute,
                        inPrinciple: values.inPrinciple,
                        inAdminMode: values.inAdminMode,
                        inBedID: values.inBedID,
                        status: "W",
                        daytimeOP: values.daytimeOP ? "Y" : "N",
                        admReasonID: values.admReasonID,
                        note: values.note,
                        inDeposit: values.inDeposit,
                        id: this.state.editAdmin.id ? this.state.editAdmin.id : "",
                        injuryFlag: values.injuryFlag ? "Y" : "N",
                        preInFlag: values.preInFlag ? "Y" : "N"
                    }]
                };
                $http.post('urlADS', this, {
                    code: "03050047",
                    data: data,
                    success: function (res) {
                        let errorCode = res.errorCode;
                        this.cleanData();
                        this.props.listchild.onloadPatAdminData();
                        if (errorCode === '0') {
                            message.success(this.display('successful'));
                        }
                    }
                });
            }
        });
    }

    handleChangeCheckBox(name, e) {
        this.setState({
            [name]: e.target.checked == true ? 'Y' : 'N'
        }, () => {
            this.props.form.setFieldsValue({ injuryFlag: e.target.checked == true ? 'Y' : 'N' })
        })
    }

    //取消编辑或清除数据
    cleanData = () => {
        this.props.form.resetFields();
        this.props.listchild.setState({
            editAdmin: {},
        })
        this.setState({
            wardList: [],
            bedList: [],
            personelTypeDesc: undefined,
            personelTypeCode: undefined,
            editAdmin: {},
            changeLocFlag: false,
            emptynumber: 0,
            waitnumber: 0,
            docdisnumber: 0,
            daytimenumber: 0,
        })
    }

    //重置数据
    resetData = (record) => {
        this.props.form.resetFields();
        this.setState({
            wardList: [],
            bedList: [],
            editAdmin: record,
            changeLocFlag: false,
            emptynumber: 0,
            waitnumber: 0,
            docdisnumber: 0,
            daytimenumber: 0,
        }, () => {
            record && 'locID' in record && record.locID && this.onLocChange(record?.locID || '', record?.wardID || '')
        })
    }

    //科室改变时触发
    onLocChange = (value, wardID) => {
        let inWardID = "";
        if (value) {
            let wardList = Util.returnDataCccordingToAttributes(this.state.locList, value)?.linkLoc || [];
            if (wardList && wardList.length > 0) {
                inWardID = wardID || wardList[0].id;
                // this.loadBedList(inWardID);
            }
            this.getLinkWardList(value); // 原接口太复杂，改后影响太大，走前接口获取数据
            this.setState({
                // wardList,
                changeLocFlag: true,
            });
        } else {
            this.setState({
                wardList: [],
                changeLocFlag: true,
            });
        }
        if (wardID) { // 编辑
            let wardObj = {}
            for (var j = 0; j < this.state.wardList.length; j++) {
                if (this.state.wardList[j].id == inWardID) {
                    wardObj = this.state.wardList[j];
                    break;
                }
            }
            this.setState({
                emptynumber: wardObj.bedEmptyNumber,
                waitnumber: wardObj.waitPatNumber,
                docdisnumber: wardObj.docdisPatNumber,
                daytimenumber: wardObj.daytimeNumber,
            })
        } else {
            this.props.form.setFieldsValue({
                inWard: undefined,
                inBedID: undefined,
            });
        }
        // !wardID && this.props.form.setFieldsValue({
        //     inWard: inWardID,
        // });
    }


    // 获取科室关联病区下拉数据
    getLinkWardList = async (locID) => {
        try {
            if (!locID) return;
            let data = {
                params: [{
                    locID
                }]
            }
            let res = await React.$asyncPost(this, '03050168', data);
            this.setState({ wardList: res.result });
        } catch (error) {
            console.log(error)
        }
    }

    //修改病区
    onWardChange = (value, opt) => {
        if (value) {
            this.loadBedList(value);
            this.setState({
                emptynumber: opt.props.emptynumber,
                waitnumber: opt.props.waitnumber,
                docdisnumber: opt.props.docdisnumber,
                daytimenumber: opt.props.daytimenumber,
            })
        } else {
            this.setState({
                bedList: [],
                emptynumber: 0,
                waitnumber: 0,
                docdisnumber: 0,
                daytimenumber: 0,
            });
        }
        this.props.form.setFieldsValue({
            inBedID: undefined,
        });
    }

    compateDate = (date1, date2) => {
        var oDate1 = new Date(date1);
        var oDate2 = new Date(date2);
        if (oDate1.getTime() >= oDate2.getTime()) {
            return false;
        } else {
            return true;
        }
    }

    //日期禁用
    disabledDate = (current) => {
        // Can not select days before today and today
        return this.compateDate(moment(current).format(dayFormat), moment(new Date()).format(dayFormat));
    }

    /** 病区筛选 */
    filterOption = (input, option) => {
        if (option.key == "-1") { return true; }
        return ((option.props.descripts.toLowerCase().indexOf(input.toLowerCase()) >= 0)
            || (option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0)
            || (option.props.descriptsspcode.toLowerCase().indexOf(input.toLowerCase()) >= 0))
    }

    // 打印住院证
    print = () => {
        if (Util.isEmpty(this.state.editAdmin)) {

        } else {
            let data = {};
            data = {
                params: [{
                    adminID: this.state.editAdmin.id
                }]
            }
            let code = '03050224'
            let templateCode = 'Inpatientcard'
            $http.post('urlS', this, {
                code: code,
                data: data,
                success: function (res) {
                    if (res.errorCode === '0') {
                        //加载模板
                        $loadTemplate(templateCode, res.result);
                    }
                }
            })
        }
    }

    handleChangeSelect(name, code, e, option) {
        this.setState({
            [name]: e,
            [code]: option ? option.props.name : undefined
        })
    }

    render() {
        const { getFieldDecorator } = this.props.form;
        const { selectData, admReasonID } = this.state;
        const formItemLayout = {
            labelCol: {
                xs: { span: 24 },
                sm: { span: 8 },
            },
            wrapperCol: {
                xs: { span: 24 },
                sm: { span: 15 },
            },
        };
        let editAdminObj = this.state.editAdmin || {};
        let locItem = [], wardItem = [], adminCondtion = [], adminPrinciple = [], adminRoute = [], adminMode = [], beds = [];
        let locIndex = -1;
        this.state.locList.map((item, index) => {
            if (editAdminObj.locID == item.id) {
                locIndex = index;
            }
            locItem.push(<Option key={item.id} role={item.descripts + '^' + item.descriptsSPCode} index={index}>{item.descripts} </Option>)
        })

        let wardList = this.state.wardList;
        if ((locIndex !== -1) && (this.state.wardList.length === 0) && (!this.state.changeLocFlag)) {
            // wardList = this.state.locList[locIndex].linkLoc;
        }
        let waitDesc = this.display('waitDesc');
        let emptyDesc = this.display('emptyDesc');
        let daytimeDesc = this.display('daytimeDesc');
        let docdisPat = this.display('docdisPat');
        wardItem.push(
            <Option disabled={true} key="-1" >
                <div style={{ width: '500px' }} className="title">
                    <Col span={8} style={{ borderRight: '2px solid #cccccc', textAlign: 'center' }}>
                        描述
                    </Col>
                    <Col span={4} style={{ borderRight: '2px solid #cccccc', textAlign: 'center' }}>
                        {emptyDesc}
                    </Col>
                    <Col span={4} style={{ borderRight: '2px solid #cccccc', textAlign: 'center' }}>
                        {waitDesc}
                    </Col>
                    <Col span={4} style={{ borderRight: '2px solid #cccccc', textAlign: 'center' }}>
                        {docdisPat}
                    </Col>
                    <Col span={4}>
                        {daytimeDesc}
                    </Col>
                </div>
            </Option>
        )
        wardList.map((item) => {
            wardItem.push(<Option key={item.id} code={item.code} descripts={item.descripts} descriptsspcode={item.descriptsSPCode} emptynumber={item.bedEmptyNumber} waitnumber={item.waitPatNumber} docdisnumber={item.docdisPatNumber} daytimenumber={item.daytimeNumber} role={item.descripts + '^' + item.descriptsSPCode} >
                <div style={{ width: '500px' }}>
                    <Col span={8} style={{ borderRight: '2px solid #cccccc', textAlign: 'left' }}>
                        {item.descripts}
                    </Col>
                    <Col span={4} style={{ borderRight: '2px solid #cccccc', textAlign: 'center' }}>
                        {item.bedEmptyNumber}
                    </Col>
                    <Col span={4} style={{ borderRight: '2px solid #cccccc', textAlign: 'center' }}>
                        {item.waitPatNumber}
                    </Col>
                    <Col span={4} style={{ borderRight: '2px solid #cccccc', textAlign: 'center' }}>
                        {item.docdisPatNumber}
                    </Col>
                    <Col span={4}>
                        {item.daytimeNumber}
                    </Col>
                </div>
            </Option>)
        })

        this.state.adminCondtionList.map((item) => {
            adminCondtion.push(<Option key={item.id}>{item.descripts} </Option>)
        })
        this.state.adminPrincipleList.map((item) => {
            adminPrinciple.push(<Option key={item.id}>{item.descripts} </Option>)
        })
        this.state.adminRouteList.map((item) => {
            adminRoute.push(<Option key={item.code}>{item.descripts} </Option>)
        })
        this.state.adminModeList.map((item) => {
            adminMode.push(<Option key={item.id}>{item.descripts} </Option>)
        })
        this.state.bedList.map((item) => {
            beds.push(<Option key={item.id}>{item.bedDescripts} </Option>)
        })
        let locTypeCode = this.state.loginLocinfo.locTypeCode;
        if ((locTypeCode) && (locTypeCode.indexOf("O") > -1)) {
            locTypeCode = "O";
        }
        let admReason = []
        this.state.admReasonList && this.state.admReasonList.map(item => {
            admReason.push(<Option key={item.id} role={item.descriptsSPCode + '^' + item.descripts} >{item.descripts}</Option>)
        });

        let personelTypeListOption = []
        this.state.personelTypeList && this.state.personelTypeList.map((item, index) => {
            personelTypeListOption.push(<Option key={index} code={item.code} english={item.descriptsSPCode} name={item.descripts}>{item.descripts}</Option>)
        })
        return (
            <div className='addHospitalization' >
                <div className='title'>
                    <Col span={20} style={{ fontWeight: 'bold', textAlign: 'left', color: '#409EFF', paddingLeft: '10px' }}>
                        <span className='scheduling-title-border'></span>
                        <span style={{ marginLeft: 7 }}>{editAdminObj.id && this.props.handlerThis.state.editFlag ? this.display('edit') : this.display('registration/printing')}{this.display('hospitalizationCard')}</span>
                    </Col>
                    <Col span={40} style={{ fontWeight: 'bold', color: '#409EFF', textAlign: 'right' }}>
                        {/* <span style={{ marginRight: '20px' }}><Icon type="printer" />{this.display('print')}</span> */}
                    </Col>
                </div>
                <div className="from">
                    <Form {...formItemLayout} layout="horizontal">
                        {/* 第一行 */}
                        <div className="fromItem">
                            <Col span={8}>
                                <Form.Item label={this.display('hospitalizationNo')}>
                                    {getFieldDecorator('adminNo', {
                                        initialValue: editAdminObj.adminNo ? editAdminObj.adminNo : "",
                                    })(
                                        <Input disabled style={{ color: '#666' }} />
                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label={this.display('inDate')}>
                                    {getFieldDecorator('inDate', {
                                        initialValue: editAdminObj.adminDate ? moment(editAdminObj.adminDate, 'YYYY-MM-DD') : moment(new Date(), 'YYYY-MM-DD'),
                                        rules: [{ required: true, message: this.display('selectDate') }]
                                    })(
                                        <DatePicker
                                            disabledDate={this.disabledDate}
                                        />
                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label={this.display('inRoute')}>
                                    {getFieldDecorator('inAdminRoute', {
                                        initialValue: editAdminObj.routeCode ? editAdminObj.routeCode : locTypeCode,
                                        rules: [{ required: true, message: this.display('selectRoute') }]
                                    })(
                                        <Select
                                            allowClear={true}
                                            showSearch={true}
                                            placeholder={this.display('inRoute')}
                                        >
                                            {adminRoute}
                                        </Select>
                                    )}
                                </Form.Item>
                            </Col>
                        </div>
                        {/* 第二行 */}
                        <div className="fromItem">
                            <Col span={8}>
                                <Form.Item label={this.display('inLoc')}>
                                    {getFieldDecorator('inLoc', {
                                        initialValue: editAdminObj.locID ? editAdminObj.locID : undefined,
                                        rules: [{ required: true, message: this.display('selectLoc') }]
                                    })(
                                        <Select
                                            allowClear={true}
                                            showSearch={true}
                                            placeholder={this.display('inLoc')}
                                            optionFilterProp="role"
                                            onChange={(e) => this.onLocChange(e)}
                                        >
                                            {locItem}
                                        </Select>
                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label={this.display('inWard')}>
                                    {getFieldDecorator('inWard', {
                                        initialValue: editAdminObj.wardID ? editAdminObj.wardID : undefined,
                                        rules: [{ required: true, message: this.display('pleaseSelectWard') }]
                                    })(
                                        <Select
                                            allowClear={true}
                                            showSearch={true}
                                            dropdownMatchSelectWidth={false}
                                            dropdownClassName="warddropdownClassName"
                                            filterOption={this.filterOption}
                                            onChange={this.onWardChange}
                                            placeholder={this.display('inWard')}
                                            optionLabelProp="descripts"
                                        >
                                            {wardItem}
                                        </Select>
                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label={this.display('inCondition')}>
                                    {getFieldDecorator('inCondtion', {
                                        initialValue: editAdminObj.condtionID ? editAdminObj.condtionID : this.state.defaultCondtion,
                                        rules: [{ required: true, message: this.display('selectCondition') }]
                                    })(
                                        <Select
                                            allowClear={true}
                                            showSearch={true}
                                            placeholder={this.display('inCondition')}
                                        >
                                            {adminCondtion}
                                        </Select>
                                    )}
                                </Form.Item>
                            </Col>

                        </div>
                        {/* 第三行 */}
                        <div className="fromItem">
                            <Col span={8}>
                                <Form.Item label={this.display('inMethod')}>
                                    {getFieldDecorator('inAdminMode', {
                                        initialValue: editAdminObj.modeID ? editAdminObj.modeID : this.state.defaultMode,
                                    })(
                                        <Select
                                            allowClear={true}
                                            showSearch={true}
                                            placeholder={this.display('inMethod')}
                                        >
                                            {adminMode}
                                        </Select>
                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label={this.display('principle')}>
                                    {getFieldDecorator('inPrinciple', {
                                        initialValue: editAdminObj.adminPrinID ? editAdminObj.adminPrinID : this.state.defaultPrinciple,
                                        rules: [{ required: true, message: this.display('selectPrinciple') }]
                                    })(
                                        <Select
                                            allowClear={true}
                                            showSearch={true}
                                            placeholder={this.display('principle')}
                                        >
                                            {adminPrinciple}
                                        </Select>

                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8}>
                                <Form.Item label={this.display('inBed')}>
                                    {getFieldDecorator('inBedID', {
                                        initialValue: editAdminObj.bedID ? editAdminObj.bedID : undefined,
                                    })(
                                        <Select
                                            allowClear={true}
                                            showSearch={true}
                                            placeholder={this.display('inBed')}
                                        >
                                            {beds}
                                        </Select>
                                    )}
                                </Form.Item>
                            </Col>
                        </div>

                        {/**4 */}
                        <div className="fromItem">
                            {/*<Col span={8}>*/}
                            {/*    <Form.Item label={this.display('settlementType')}>*/}
                            {/*        {getFieldDecorator('personelTypeCode', {*/}
                            {/*            initialValue: editAdminObj.personelTypeCode ? editAdminObj.personelTypeCode : this.state.personelTypeCode,*/}
                            {/*            rules: [{ required: false, message: this.display('pleaseSelType') }]*/}
                            {/*        })(*/}
                            {/*            <Select*/}
                            {/*                allowClear={true}*/}
                            {/*                showSearch={true}*/}
                            {/*                filterOption={(input, option) =>*/}
                            {/*                    option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0*/}
                            {/*                    || option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0*/}
                            {/*                    || option.props.english.toLowerCase().indexOf(input.toLowerCase()) >= 0*/}
                            {/*                }*/}
                            {/*                onChange={this.handleChangeSelect.bind(this, 'personelTypeCode', 'personelTypeDesc')}*/}
                            {/*                placeholder={this.display('settlementType')}*/}
                            {/*            >*/}
                            {/*                {personelTypeListOption}*/}
                            {/*            </Select>*/}

                            {/*        )}*/}
                            {/*    </Form.Item>*/}
                            {/*</Col>*/}
                            <Col span={8}>
                                <Form.Item label={'备注'}>
                                    {getFieldDecorator('note', {
                                        initialValue: editAdminObj.note ? editAdminObj.note : undefined,
                                        // rules: [{ required: false, message: this.display('selectPrinciple') }]
                                    })(
                                        <Input placeholder='请输入' />

                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8} >
                                <Form.Item label={"推荐预交金："}>
                                    {getFieldDecorator('inDeposit', {
                                        initialValue: editAdminObj.inDeposit ? editAdminObj.inDeposit : "",
                                        rules: [{ required: false, message: '', },
                                        ],
                                        getValueFromEvent: (event) => {
                                            return event.target.value.replace(/\D|^0/g, '',)
                                        },
                                    })(
                                        <Input maxLength={9}></Input>
                                    )}
                                </Form.Item>
                            </Col>
                            <Col span={8} style={{ display: selectData?.inAdminReasonFlag === 'Y' ? '' : 'none' }}>
                                <Form.Item label={this.display('settlementType')}>
                                    {getFieldDecorator('admReasonID', {
                                        initialValue: editAdminObj && editAdminObj.admReasonID ? editAdminObj.admReasonID : admReasonID,
                                        rules: [{ required: !!(selectData?.inAdminReasonFlag === 'Y'), message: this.display('pleaseSelType') }]
                                    })(
                                        <Select
                                            allowClear
                                            showSearch
                                            placeholder={this.display('settlementType')}
                                        >
                                            {admReason}
                                        </Select>

                                    )}
                                </Form.Item>
                            </Col>
                        </div>

                        {/* 第五行 */}
                        <div className="fromItem">

                            <Col span={8}>
                                <Tooltip title='勾选中表示外伤'>
                                    <Form.Item label="是否外伤">
                                        {getFieldDecorator('injuryFlag', {
                                            initialValue: editAdminObj.injuryFlag == "Y" ? true : false,
                                            valuePropName: 'checked',
                                        })(
                                            <Checkbox></Checkbox>
                                        )}
                                    </Form.Item>
                                </Tooltip>
                            </Col>
                            <Col span={8}>
                                {/* 
                                * @ByShizi: 普瑞集团-门诊医生站-住院证界面屏蔽日间手术
                                * 需求 #593
                                * Create 2022-05-06
                                */}
                                {/* <Form.Item label={this.display('daytimeOP')}>
                                    {getFieldDecorator('daytimeOP', {
                                        initialValue: editAdminObj.daytimeOP == "Y" ? true : false,
                                        valuePropName: 'checked',
                                    })(
                                        <Checkbox></Checkbox>
                                    )}
                                </Form.Item> */}
                                {this.state.preInConfig === 'Y' ? (
                                    <Tooltip title='勾选中表示预住院'>
                                        <Form.Item label="是否预住院">
                                            {getFieldDecorator('preInFlag', {
                                                initialValue: editAdminObj.preInFlag == "Y" ? true : false,
                                                valuePropName: 'checked',
                                            })(
                                                <Checkbox></Checkbox>
                                            )}
                                        </Form.Item>
                                    </Tooltip>
                                ) : ''}
                            </Col>

                            {/* <Col span={8} >
                                <Form.Item label={"推荐预交金："}>
                                    {getFieldDecorator('inDeposit', {
                                        initialValue: editAdminObj.inDeposit ? editAdminObj.inDeposit : "",
                                        rules: [{ required: false, message: '', },
                                        ],
                                        getValueFromEvent: (event) => {
                                            return event.target.value.replace(/\D|^0/g,'',)
                                        },
                                    })(
                                        <Input maxLength={9}></Input>
                                    )}
                                </Form.Item>
                            </Col> */}
                        </div>
                    </Form>
                </div>
                <div className="bedtitle">
                    <span className='scheduling-title-border' style={{ marginTop: "16px" }} ></span>
                    <span style={{ marginLeft: 7 }}>【{this.display('remaining')}：&nbsp;</span>
                    <span style={{ color: '#1999db' }}>{this.state.bedList.length}</span>&nbsp;
                    <span style={{ marginLeft: 3 }}>{this.display('waitDesc')}：&nbsp;</span>
                    <span style={{ color: '#1999db' }}>{this.state.waitnumber}</span>&nbsp;
                    <span style={{ marginLeft: 3 }}>{this.display('docdisPat')}：&nbsp;</span>
                    <span style={{ color: '#1999db' }}>{this.state.docdisnumber}</span>&nbsp;
                    <span style={{ marginLeft: 3 }}>{this.display('daytimeDesc')}：&nbsp;</span>
                    <span style={{ color: '#1999db' }}>{this.state.daytimenumber}</span>&nbsp;
                    】
                </div>
                <div className="diag">
                    <div style={{ height: '35px', lineHeight: '35px', padding: '0 10px' }}>
                        <span className='scheduling-title-border'></span>
                        <span style={{ marginLeft: 7 }}>{this.display('diagnosisList')}</span>
                    </div>
                    <Table
                        style={{ height: 'calc(100% - 45px)', padding: '10px', textAlign: 'left' }}
                        scroll={{ y: 'calc(100% - 45px)' }}
                        bordered
                        columns={this.state.diagColumn}
                        pagination={false}
                        dataSource={this.state.diagList}
                        rowKey={(data) => {
                            return data.id
                        }}
                    >
                    </Table>
                </div>
                <div className="applyInfo">
                    <div style={{ height: '32px', lineHeight: '32px', margin: '5px 0' }}>
                        <Col span={8}>
                            {this.display('appLoc')}:&nbsp;&nbsp;<Input disabled className="applyInput" value={editAdminObj.locDesc ? editAdminObj.locDesc : userData.locDesc} style={{ width: this.props.modal != "1" ? "65%" : "55%" }} />
                        </Col>
                        <Col span={8}>
                            {this.display('appDoc')}:&nbsp;&nbsp;<Input disabled className="applyInput" value={editAdminObj.docName ? editAdminObj.docName : userData.userName} style={{ width: this.props.modal != "1" ? "65%" : "55%" }} />
                        </Col>
                        <Col span={8}>
                            {this.display('appTime')}:&nbsp;&nbsp;<Input disabled className="applyInput" value={editAdminObj.createDateTime ? editAdminObj.createDateTime : moment(new Date()).format('YYYY-MM-DD HH:mm:ss')} style={{ width: this.props.modal != "1" ? "65%" : "55%" }} />
                        </Col>
                    </div>
                    <Button onClick={this.cleanData} >{editAdminObj.id ? this.display('cancel') : this.display('clear')}</Button>
                    <Button type='primary' onClick={this.onSubmit} style={{ border: '1px solid #1890FF', marginLeft: '20px', background: '#1890FF' }} >{this.display('save')}</Button>
                </div>
            </div >
        )
    }
};

const AddHospitalizationFrom = Form.create()(AddHospitalization);
export default AddHospitalizationFrom;
