/**
 * 申请单检查
 * 
 *  */
import React from 'react';
import {
    Button, Table, Input, Row, Col, Icon, Card, Modal, Checkbox, Tabs, Select, Tooltip, Spin,
    message, Badge, Divider
} from 'antd';
import store from 'store';
import ShowChargeDetail from './ShowChargeDetail';
import { $http } from 'containers/config/https';
import ShowPartsModal from './ShowPartsModal';
import ShowConfirmModal from './ShowConfirmModal';
import ShowRevocationModal from './ShowRevocationModal';
import ShowUseTemplateModal from './ShowUseTemplateModal';
import { $loadTemplate } from '../../lodop/Common/Print.js';
import { Util } from 'tools/index';

const { TabPane } = Tabs;
const { TextArea } = Input;
const confirm = Modal.confirm;
const Option = Select.Option;

export default class ApplicationCheck extends React.Component {
    constructor(props) {
        super(props);
        var userData = JSON.parse(sessionStorage.getItem('userData'));
        var patientData = JSON.parse(sessionStorage.getItem('patientData'))
        this.state = {
            tableData: [], // 已开申请项目单表格数据
            visible: false, // 选择检查部位/体位弹窗
            checkVisible: false, // 检查部位/体位弹窗
            userData: userData,
            patientData: patientData,
            applicationMessage: {},
            count: 0,
            ids: [],
            chiefComplaint: '',
            appPurpose: '',
            HPIllness: '',
            sign: '',
            saveStatus: false
        };
        this.initData()
    }

    // 选择部位体位弹窗确认操作
    handleOk = () => {
        console.log(111)
    }

    componentWillReceiveProps(nextProp) {
        if (nextProp && nextProp.radioCode) {
            var newData = []
            var appItemID = ''
            if (nextProp.tableData && nextProp.tableData.data) {
                var data = nextProp.tableData.data
                for (var i = 0; i < data.length; i++) {
                    appItemID = data[0].appItemID
                    newData.push({
                        date: data[i].ordDate,
                        ordDesc: data[i].medDesc,
                        partList: data[i].bodyPartMessage,
                        ordSpecDesc: data[i].ordSpecDesc,
                        ordPrice: data[i].ordPrice,
                        ordQty: data[i].ordQty,
                        ordRecLocDesc: data[i].ordRecLocDesc,
                        ordEMFlag: data[i].ordEMFlag,
                        appItemStatus: data[i].appItemStatus,
                        appItemID: data[i].appItemID,
                        appItemStatusCode: data[i].appItemStatusCode,
                    })
                }

            }
            this.setState({
                tableData: !Util.isEmpty(nextProp.selectList) ? newData : newData.concat(this.state.tableData),
                applicationMessage: nextProp.tableData ? nextProp.tableData.applicationMessage :
                    (nextProp.DetailData ? nextProp.DetailData : ''),
                appItemID: appItemID,
                dataSource: nextProp.dataSource,
                tabStatus: nextProp.tabStatus
            }, () => {
                this.initData()
            })
        }
    }

    componentDidMount() {
        this.props.onRef(this)
        this.loadLocalMsg()
    }

    loadLocalMsg() {
        let data = {
            params: [{
                compontName: "ApplicationForm",
                type: "C",
                reactCode: ['ApplicationForm']
            }]
        }
        $http.post('urlDeault', this, {
            code: "01040073",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    this.input.focus()
                    this.setState({
                        localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN
                    }, () => {
                        this.initData()
                    })
                }
            }
        })
    }

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


    initData() {
        this.columns = [
            {
                title: this.setMessage('ApplicationFormStatus', 'descripts') || '状态',
                dataIndex: 'appItemStatus',
                key: '7',
                width: '80px',
                align: 'center'
            },
            {
                title: this.setMessage('ApplicationFormdates', 'descripts') || '开单日期',
                dataIndex: 'date',
                key: '1',
                width: '120px',
                align: 'center'
            }, {
                title: this.setMessage('ApplicationFormpro', 'descripts') || '项目名称',
                dataIndex: 'ordDesc',
                key: '2',
                width: '200px',
                align: 'left'
            }, {
                title: this.setMessage('ApplicationFormPart', 'descripts') || '部位',
                dataIndex: 'address',
                key: '3',
                width: '160px',
                align: 'left',
                // render: (text, data, index) => {
                //     data.tableIndex = index + 1
                //     var partListOption = []
                //     data && data.partList && data.partList.map((item, index) => {
                //         partListOption.push(<span style={{ marginLeft: 5, color: item.status == 'CO' ? 'gray' : 'rgb(64, 169, 255)' }}
                //             key={index} value={!Util.isEmpty(data.appItemID) ? index : item.id}>
                //             {!Util.isEmpty(data.appItemID) ? item.partDesc :
                //                 (item.title + (item.descripts ? ('(' + (item.descripts).join(',') + ')') : ''))}</span>)
                //     })
                //     return <span style={{ cursor: 'pointer' }}
                //         onClick={this.showRevocationModal.bind(this, data, index)}>{partListOption}</span>
                // }
                render: (text, data, index) => {
                    data.tableIndex = index + 1
                    var partListOption = []
                    var groupOption = []
                    data && data.partList && data.partList.map((item, index) => {
                        partListOption.push(<span style={{ marginLeft: 5, color: item.status == 'CO' ? 'gray' : 'rgb(64, 169, 255)' }}
                            key={index} value={!Util.isEmpty(data.appItemID) ? index : item.id}>
                            {!Util.isEmpty(data.appItemID) ? item.partDesc : item.descripts}</span>)
                    })

                    data && data.partList && data.partList.map((item, index) => {
                        groupOption.push(<Option key={index} value={item.id} partid={item.id} mutexflag={item.mutexFlag} ordprice={Number(item.ordPrice)}
                            title={item.descripts} number={item.number}>{item.descripts}</Option>)
                    })
                    return !Util.isEmpty(data.appItemID) ? <span style={{ cursor: 'pointer' }}
                        onClick={this.showRevocationModal.bind(this, data, index)}>{partListOption}</span> :
                        (data.radioFlag == 'Y' ? <Select style={{ width: '100%' }} placeholder='请选择部位' value={data.partListID} showArrow
                            onChange={this.handleRadioMessage.bind(this, data, index)}>{groupOption}</Select> :
                            <Select style={{ width: '100%' }} placeholder='请选择部位' mode='tags' value={data.partListID} showArrow
                                onChange={this.handleSelectMessage.bind(this, data, index)}>{groupOption}</Select>)
                }
            }, {
                title: '数量',
                dataIndex: 'ordQty',
                width: '80px',
                align: 'center',
                render: (text, data, index) => {
                    return !Util.isEmpty(data.appItemID) ? <span>{data.ordQty}</span> :
                        <Input value={data.ordQty} onChange={this.handleChangeQty.bind(this, 'ordQty', index)} />
                }
            }, {
                title: this.setMessage('ApplicationFormPrice', 'descripts') || '价格',
                dataIndex: 'ordPrice',
                key: '4',
                width: '80px',
                align: 'right',
                render: (text, data) => {
                    var price = 0;
                    var source = data.priceData;
                    source && source.map((item, index) => {
                        price += Number(item)
                    })
                    //data.nunmber
                    return <span>{!Util.isEmpty(data.appItemID) ? ((data.ordQty || 1) * data.ordPrice).toFixed(2) :
                        ((data.ordQty || 1) * (data.priceData ? price : data.ordPrice)).toFixed(2)}</span>
                }
            }, {
                title: this.setMessage('ApplicationFormexp', 'descripts') || '是否加急',
                dataIndex: 'ordEMFlag',
                key: '6',
                width: '80px',
                align: 'center',
                render: (text, data, index) => {
                    // return <span>{data.ordEMFlag == 'Y' ? '是' : '否'}</span>
                    return !Util.isEmpty(data.appItemID) ? <span>{data.ordEMFlag == 'Y' ? '是' : '否'}</span> :
                        <Checkbox checked={data.ordEMFlag == 'Y' ? true : (data.ordEMFlag == 'Y' ? true : false)}
                            onChange={this.changeCheckFlagBox.bind(this, 'ordEMFlag', index)} />
                }
            }, {
                title: this.setMessage('ApplicationFormdep', 'descripts') || '执行科室',
                dataIndex: 'ordRecLocID',
                key: '5',
                width: '140px',
                align: 'left',
                render: (text, data, index) => {
                    var reclocListOption = []
                    data && data.recLocList && data.recLocList.map((item, index) => {
                        reclocListOption.push(<Option key={index} value={item.recLocID}>{item.recLocDesc}</Option>)
                    })
                    return !Util.isEmpty(data.appItemID) ? <span>{data.ordRecLocDesc}</span> : (<Select style={{ width: '100%' }}
                        value={data.ordRecLocID}
                        onChange={this.changeCommonSelect.bind(this, 'ordRecLocID', index)}>{reclocListOption}</Select>)
                }
            },
        ]
    }

    handleRadioMessage(data, index, e, code) {
        var priceMsg = []
        var bodyPart = []
        this.state.tableData[index]['partListID'] = [e]
        if (data.partListID[0] == code.props.value) {
            bodyPart.push({
                partID: code.props.partid,
                number: code.props.number,
                title: code.props.title,
                bodyPart: []
            })
            priceMsg.push(code.props.ordprice)
            this.state.tableData[index]['bodyPart'] = bodyPart
            this.state.tableData[index]['priceData'] = priceMsg
        }
        this.setState({})
    }

    handleSelectMessage(data, index, e, code) {
        //取选中得数组，渲染到对应得数据去
        var partData = []
        var priceData = []
        if (!Util.isEmpty(code)) {
            for (var i = 0; i < code.length; i++) {
                //眼部互斥
                if (code[i].props.mutexflag == 'Y') {
                    var bodyPart = []
                    var priceMsg = []
                    this.state.tableData[index]['partListID'] = [code[i].props.value]
                    if (data.partListID[0] == code[i].props.value) {
                        bodyPart.push({
                            partID: code[i].props.partid,
                            number: code[i].props.number,
                            title: code[i].props.title,
                            bodyPart: []
                        })
                        priceMsg.push(code[i].props.ordprice)
                        this.state.tableData[index]['bodyPart'] = bodyPart
                        this.state.tableData[index]['priceData'] = priceMsg
                    }
                } else {
                    this.state.tableData[index]['partListID'] = e
                    partData.push({
                        partID: code[i].props.partid,
                        number: code[i].props.number,
                        title: code[i].props.title,
                        bodyPart: []
                    })
                    priceData.push(code[i].props.ordprice)
                    this.state.tableData[index]['bodyPart'] = partData
                    this.state.tableData[index]['priceData'] = priceData
                }
            }
        } else {
            this.state.tableData[index]['partListID'] = e
        }
        // this.state.tableData[index]['partListID'] = e
        this.setState({}, () => { console.dir(this.state.tableData) })
    }

    changeCheckFlagBox(name, index, e) {
        this.state.tableData[index][name] = e.target.checked ? 'Y' : 'N'
        this.setState({})
    }

    //撤销部件弹框
    showRevocationModal(data, index) {
        if (Util.isEmpty(data.appItemID)) {
            this.setState({
                // isShowPartsModal: true,
                update: true,
                updateIndex: index,//未保存数据修改部件
                partListModal: data.partList
            })
        } else {
            this.setState({
                isShowRevocationModal: true,
                itemData: data.appItemID
            })
        }
    }

    changeCommonSelect(name, index, e) {
        this.state.tableData[index][name] = e
        this.setState({})
    }

    handleChangeQty(name, index, e) {
        this.state.tableData[index][name] = e.target.value
        this.setState({})
    }

    // 打开选择部位体位弹窗
    showModal = () => {
        this.setState({ visible: true })
    }

    // 关闭选择部位体位弹窗
    handleCancel = () => {
        this.setState({ visible: false })
    }

    // 检查部位体位弹窗确认操作
    handleCheckOk = () => {
        console.log(111)
    }

    // 打开检查部位体位弹窗
    showCheckModal = () => {
        this.setState({ checkVisible: true })
    }

    // 关闭检查部位体位弹窗
    handleCheckCancel = () => {
        this.setState({ checkVisible: false })
    }

    handleCallback = key => {
        console.log(key)
    }

    //鼠标移动添加样式
    addMouseOverStyle(name, e) {
        this.setState({
            addMouseStyle: true,
            indexStyle: name
        })
    }
    addMouseLeaveStyle() {
        this.setState({
            addMouseStyle: false,
            indexStyle: ''
        })
    }

    //展示收费项弹框
    showChargeDetail(data) {
        this.setState({
            isSHowChargeDetail: true,
            detailSource: data
        })
    }

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

    searchDataSource(e) {
        if (e.keyCode == '13') {
            var { searchDataSource } = this.props;
            searchDataSource && searchDataSource(this.state.search)
        }
    }

    loadDoctorActive(id, index) {
        var params = {
            params: [{
                medID: this.state.medID,
                hospID: this.state.userData.hospID
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050146",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    if (Util.isEmpty(res.result)) {
                        this.state.dataSource[index]['count'] = this.state.count + 1
                        this.setState({
                            partData: res.result,
                            count: this.state.count + 1,
                            countIndex: index,
                            search: undefined
                        }, () => {
                            this.onSubmit('', '')
                        })
                    } else {
                        this.setState({
                            partData: res.result,
                            // isShowPartsModal: true,
                            count: this.state.count + 1,
                            cardIndex: index,
                            rowMedID: res.result.partList[0].id,
                            search: undefined
                        }, () => {
                            this.input.focus()
                            this.loadPartMessage()//获取部位信息
                        })
                    }
                }
            }
        });
    }

    loadPartMessage() {
        var data = []
        var params = {
            params: [{
                medID: this.state.medID,
                admID: this.state.patientData ? this.state.patientData.admID : '',
                // areaID: this.state.rowMedID,
                hospID: this.state.userData.hospID,
                // searchCode: this.state.templateName
            }]

        }
        $http.post('urlDeault', this, {
            code: "03050147",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    this.setState({
                        groupData: res.result,
                    }, () => {
                        this.submitPartData(data, this.state.groupData, 0)
                    })
                }
            }
        });
    }

    //勾选复选框，弹框
    changeCheckBox = Util.debounce((medID, medDesc, index, e) => {
        var { tableData } = this.state;
        var data = []
        if (!Util.isEmpty(this.state.appItemID)) {
            // message.error('已存在已经审核的申请单，不能再添加！')
            message.error(this.setMessage('ApplicationFormexam', 'descripts'), this.state.userData && this.state.userData.messageTime)
            return
        }
        this.state.dataSource[index]['checked'] = e.target.checked
        if (e.target.checked) {

            if (!Util.isEmpty(tableData)) {
                for (var i = 0; i < tableData.length; i++) {
                    if (medID == tableData[i].medID) {
                        // message.error('无法添加重复数据')
                        message.error(this.setMessage('ApplicationFormbh', 'descripts'), this.state.userData && this.state.userData.messageTime)
                        return
                    }
                }
            }
            this.setState({
                medID: medID,
                medDesc: medDesc,
                checked: e.target.checked,
                tableIndex: this.state.tableData.length,
                count: index == this.state.countIndex ? this.state.count : 0
            }, () => {
                this.loadDoctorActive(medID, index)
            })
        } else {
            this.state.dataSource[index]['count'] = 0
            // this.setState({count: index == this.state.countIndex ? 0 : 0})
            for (var i = 0; i < tableData.length; i++) {
                if (medID !== tableData[i].medID) {
                    data.push(tableData[i])
                }
            }
            this.setState({
                tableData: data,
                count: index == this.state.countIndex ? 0 : 0
            })
        }
    })

    onDoubleClickMsg = Util.debounce((medID, medDesc, index, e) => {
        var { tableData } = this.state;
        var data = []
        if (!Util.isEmpty(this.state.appItemID)) {
            // message.error('已存在已经审核的申请单，不能再添加！')
            message.error(this.setMessage('ApplicationFormexam', 'descripts'), this.state.userData && this.state.userData.messageTime)
            return
        }
        if (this.props.disBtn == 'alert') {
            message.error('当前病人已欠费，无法开具申请单！')
            return
        }
        if (this.state.dataSource[index]['checked'] == true) {
            this.state.dataSource[index]['checked'] = false
            this.state.dataSource[index]['count'] = 0
            for (var i = 0; i < tableData.length; i++) {
                if (medID !== tableData[i].medID) {
                    data.push(tableData[i])
                }
            }
            this.setState({
                tableData: data,
                count: index == this.state.countIndex ? 0 : 0
            })
        } else {
            this.state.dataSource[index]['checked'] = true
            if (!Util.isEmpty(tableData)) {
                for (var i = 0; i < tableData.length; i++) {
                    if (medID == tableData[i].medID) {
                        // message.error('无法添加重复数据')
                        message.error(this.setMessage('ApplicationFormbh', 'descripts'), this.state.userData && this.state.userData.messageTime)
                        return
                    }
                }
            }
            this.setState({
                medID: medID,
                medDesc: medDesc,
                tableIndex: this.state.tableData.length,
                count: index == this.state.countIndex ? this.state.count : 0,
                search: undefined
            }, () => {
                this.input.focus()
                this.loadDoctorActive(medID, index)
            })
        }
    })

    submitPartData(data, code, number) {
        if (this.state.update) {
            this.state.tableData[this.state.updateIndex]['bodyPart'] = data
            this.hideModal('isShowPartsModal')
        } else {
            // this.state.tableData.push({ tableIndex: this.state.tableData.length + 1 })
            this.setState({
            }, () => {
                this.onSubmit(data, code, number)
            })
        }
        this.state.dataSource[this.state.cardIndex]['count'] = this.state.count
        this.setState({ update: false })
    }

    clearInput() {
        this.setState({
            tableData: [],
            tabStatus: false,
            // chiefComplaint: undefined,
            // appPurpose: undefined,
            // HPIllness: undefined,
            // sign: undefined,
            // appItemID: undefined
        })
        var { clearInput } = this.props;
        clearInput && clearInput()
    }

    onSubmit(data, code, number) {
        var that = this;
        var params = {
            params: [{
                admID: this.state.patientData ? this.state.patientData.admID : '',
                orders: [{
                    medID: this.state.medID,
                    ordSetID: ''
                }]
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050020",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    if (res.errorData.length > 0) {
                        this.setState({
                            isShowConfirmModal: true,
                            errorData: res.errorData,
                            confirmData: res.confirmData,
                        })
                        return
                    }

                    if (res.confirmData.length > 0) {
                        confirm({
                            title: this.setMessage('ApplicationFormcomfirm', 'descripts'),
                            content: res.confirmData[0].errorMessage,
                            okText: that.state.userData.language == 'EN' ? 'Ok' : '确定',
                            cancelText: that.state.userData.language == 'EN' ? 'cancel' : '取消',
                            onOk() {
                                that.hideModal('isShowPartsModal')
                                that.state.tableData.push({ tableIndex: that.state.tableData.length + 1 })
                                var bodyPart = [{
                                    partID: res.data[0].defaultData.radioFlag == 'Y' ? res.data[0].defaultData.ordbodyPartID[0] : res.data[0].defaultData.ordbodyPartID[0],
                                    bodyPart: []
                                }]
                                that.state.tableData[that.state.tableIndex]['ordDesc'] = res.data[0].defaultData.ordDesc,
                                    that.state.tableData[that.state.tableIndex]['ordDose'] = res.data[0].defaultData.ordDose,
                                    that.state.tableData[that.state.tableIndex]['ordQty'] = res.data[0].defaultData.ordQty,
                                    that.state.tableData[that.state.tableIndex]['radioFlag'] = res.data[0].defaultData.radioFlag,
                                    that.state.tableData[that.state.tableIndex]['partListID'] = res.data[0].defaultData.radioFlag == 'Y' ? res.data[0].defaultData.ordbodyPartID[0] : res.data[0].defaultData.ordbodyPartID,
                                    that.state.tableData[that.state.tableIndex]['appItemStatusCode'] = res.data[0].defaultData.appItemStatusCode,
                                    // that.state.tableData[that.state.tableIndex]['bodyPart'] = bodyPart,
                                    that.state.tableData[that.state.tableIndex]['ordDate'] = res.data[0].defaultData.date,
                                    that.state.tableData[that.state.tableIndex]['ordTime'] = res.data[0].defaultData.time,
                                    that.state.tableData[that.state.tableIndex]['date'] = res.data[0].defaultData.date,
                                    that.state.tableData[that.state.tableIndex]['time'] = res.data[0].defaultData.time,
                                    that.state.tableData[that.state.tableIndex]['ordStartDate'] = res.data[0].defaultData.date,
                                    that.state.tableData[that.state.tableIndex]['ordStartTime'] = res.data[0].defaultData.time,
                                    that.state.tableData[that.state.tableIndex]['ordPrice'] = res.data[0].defaultData.ordPrice,
                                    that.state.tableData[that.state.tableIndex]['ordSpecID'] = res.data[0].defaultData.ordSpecID,
                                    that.state.tableData[that.state.tableIndex]['ordEMFlag'] = res.data[0].defaultData.ordEMFlag,
                                    that.state.tableData[that.state.tableIndex]['ordPriorityID'] = res.data[0].defaultData.ordPriorityID,
                                    that.state.tableData[that.state.tableIndex]['ordAdmReasonID'] = res.data[0].defaultData.ordAdmReasonID,
                                    that.state.tableData[that.state.tableIndex]['ordRecLocID'] = res.data[0].defaultData.ordRecLocID,
                                    that.state.tableData[that.state.tableIndex]['ordQtyUomID'] = res.data[0].defaultData.ordQtyUomID,
                                    that.state.tableData[that.state.tableIndex]['recLocList'] = res.data[0].dataList.recLocList,//接收科室
                                    that.state.tableData[that.state.tableIndex]['count'] = that.state.count,
                                    that.state.tableData[that.state.tableIndex]['partList'] = code,//接收科室
                                    that.state.tableData[that.state.tableIndex]['number'] = number,//部位数
                                    that.state.tableData[that.state.tableIndex]['bodyPart'] = !Util.isEmpty(data) ? data : bodyPart,
                                    that.state.tableData[that.state.tableIndex]['ordSeqNo'] = 1,
                                    // that.state.tableData[that.state.tableIndex]['ordQty'] = 1,
                                    that.state.tableData[that.state.tableIndex]['medID'] = that.state.medID,
                                    // that.state.dataSource[that.state.countIndex]['checked'] = false
                                    that.setState({
                                        // tableData: tableData,
                                        recLocList: res.data[0].dataList.recLocList,//接收科室
                                        partList: data,
                                        update: false,
                                        search: undefined
                                    }, () => {
                                        that.input.focus()
                                    })
                            },
                            onCancel() {
                                that.setState({
                                    search: undefined
                                }, () => {
                                    that.hideModal('isShowPartsModal')
                                })
                                console.log('Cancel');
                            },
                        });
                    } else {
                        this.hideModal('isShowPartsModal')
                        that.state.tableData.push({ tableIndex: that.state.tableData.length + 1 })
                        var bodyPart = [{
                            partID: res.data[0].defaultData.radioFlag == 'Y' ? res.data[0].defaultData.ordbodyPartID[0] : res.data[0].defaultData.ordbodyPartID[0],
                            bodyPart: []
                        }]
                        this.state.tableData[this.state.tableIndex]['ordDesc'] = res.data[0].defaultData.ordDesc,
                            this.state.tableData[this.state.tableIndex]['ordDose'] = res.data[0].defaultData.ordDose,
                            this.state.tableData[this.state.tableIndex]['radioFlag'] = res.data[0].defaultData.radioFlag,
                            this.state.tableData[this.state.tableIndex]['appItemStatusCode'] = res.data[0].defaultData.appItemStatusCode,
                            this.state.tableData[this.state.tableIndex]['ordDate'] = res.data[0].defaultData.date,
                            this.state.tableData[this.state.tableIndex]['ordTime'] = res.data[0].defaultData.time,
                            that.state.tableData[that.state.tableIndex]['partListID'] = res.data[0].defaultData.radioFlag == 'Y' ? res.data[0].defaultData.ordbodyPartID[0] : res.data[0].defaultData.ordbodyPartID,
                            this.state.tableData[this.state.tableIndex]['date'] = res.data[0].defaultData.date,
                            // that.state.tableData[that.state.tableIndex]['bodyPart'] = bodyPart,
                            this.state.tableData[this.state.tableIndex]['ordStartDate'] = res.data[0].defaultData.date,
                            this.state.tableData[this.state.tableIndex]['ordStartTime'] = res.data[0].defaultData.time,
                            this.state.tableData[this.state.tableIndex]['time'] = res.data[0].defaultData.time,
                            this.state.tableData[this.state.tableIndex]['ordPrice'] = res.data[0].defaultData.ordPrice,
                            this.state.tableData[this.state.tableIndex]['ordSpecID'] = res.data[0].defaultData.ordSpecID,
                            this.state.tableData[this.state.tableIndex]['ordEMFlag'] = res.data[0].defaultData.ordEMFlag,
                            this.state.tableData[this.state.tableIndex]['ordPriorityID'] = res.data[0].defaultData.ordPriorityID,
                            this.state.tableData[this.state.tableIndex]['ordAdmReasonID'] = res.data[0].defaultData.ordAdmReasonID,
                            this.state.tableData[this.state.tableIndex]['ordRecLocID'] = res.data[0].defaultData.ordRecLocID,
                            this.state.tableData[this.state.tableIndex]['ordQtyUomID'] = res.data[0].defaultData.ordQtyUomID,
                            this.state.tableData[this.state.tableIndex]['recLocList'] = res.data[0].dataList.recLocList,//接收科室
                            this.state.tableData[this.state.tableIndex]['partList'] = code,//接收科室
                            this.state.tableData[this.state.tableIndex]['count'] = this.state.count,
                            this.state.tableData[this.state.tableIndex]['number'] = number,//部位数
                            this.state.tableData[this.state.tableIndex]['bodyPart'] = !Util.isEmpty(data) ? data : bodyPart,
                            this.state.tableData[this.state.tableIndex]['ordSeqNo'] = 1,
                            this.state.tableData[this.state.tableIndex]['ordQty'] = res.data[0].defaultData.ordQty,
                            this.state.tableData[this.state.tableIndex]['medID'] = this.state.medID,
                            // this.state.dataSource[this.state.countIndex]['checked'] = false
                            this.setState({
                                // tableData: tableData,
                                recLocList: res.data[0].dataList.recLocList,//接收科室
                                partList: data,
                                update: false,
                                search: undefined
                            }, () => {
                                this.input.focus()
                            })
                    }
                }
            }
        });
        this.setState({})
    }

    confirmAdviceModal() {
        this.hideModal('isShowConfirmModal')
    }
    //保存数据
    saveDoctorAdvice() {
        this.setState({ saveStatus: true })
        var { tableData, applicationMessage, dataSource, ids } = this.state;
        var data = []
        if (Util.isEmpty(tableData)) {
            message.error(this.setMessage('ApplicationFormdata', 'descripts'), this.state.userData && this.state.userData.messageTime)
            this.setState({ saveStatus: false })
            return
        }
        // if (Util.isEmpty(this.state.chiefComplaint) && Util.isEmpty(applicationMessage.chiefComplaint)) {
        //     message.error(this.setMessage('ApplicationFormtmc', 'descripts'),this.state.userData && this.state.userData.messageTime)
        //     this.setState({saveStatus:false})
        //     return
        // }
        // if (Util.isEmpty(this.state.appPurpose) && Util.isEmpty(applicationMessage.appPurpose)) {
        //     message.error(this.setMessage('ApplicationFormcnt', 'descripts'),this.state.userData && this.state.userData.messageTime)
        //     this.setState({saveStatus:false})
        //     return
        // }
        // if (Util.isEmpty(this.state.HPIllness) && Util.isEmpty(applicationMessage.HPIllness)) {
        //     message.error(this.setMessage('ApplicationFormbe', 'descripts'))
        //     return
        // }
        // if (Util.isEmpty(this.state.sign) && Util.isEmpty(applicationMessage.sign)) {
        //     message.error(this.setMessage('ApplicationFormsign', 'descripts'))
        //     return
        // }

        var sourceMap = []
        if (!Util.isEmpty(ids)) {
            for (var i = 0; i < ids.length; i++) {
                for (var j = 0; j < tableData.length; j++) {
                    if (!Util.isEmpty(ids) && ids[i] == tableData[j].tableIndex) {
                        sourceMap.push(tableData[j])
                    }
                }
            }
        } else {
            sourceMap = tableData
        }

        var bodyPart = []
        let currentDiagRecord = this.props && this.props.getDiagRecord && this.props.getDiagRecord(); // 当前诊断数据
        for (var i = 0; i < sourceMap.length; i++) {
            if (!Util.isEmpty(sourceMap[i].appItemID)) {
                message.error(this.setMessage('ApplicationFormsaved', 'descripts'), this.state.userData && this.state.userData.messageTime)
                this.setState({ saveStatus: false })
                return
            }
            if (Util.isEmpty(sourceMap[i].ordRecLocID)) {
                message.error(this.setMessage('ApplicationFormexec', 'descripts'), this.state.userData && this.state.userData.messageTime)
                this.setState({ saveStatus: false })
                return
            }
            bodyPart.push({ bodyPart: sourceMap[i].bodyPart ? sourceMap[i].bodyPart : [], tabIndex: sourceMap[i].tableIndex })
            data.push({
                ordMedItemDesc: sourceMap[i].ordDesc,
                ordDose: sourceMap[i].ordDose,
                ordDate: sourceMap[i].date,
                ordTime: sourceMap[i].time,
                ordStartDate: sourceMap[i].date,
                ordStartTime: sourceMap[i].time,
                ordbodyPart: sourceMap[i].radioFlag == 'Y' ? ((sourceMap[i].partListID && (sourceMap[i].partListID).constructor == Array) ? sourceMap[i].partListID : [sourceMap[i].partListID]) : sourceMap[i].partListID,
                ordQty: sourceMap[i].ordQty,
                ordPrice: sourceMap[i].ordPrice,
                ordSpecID: sourceMap[i].ordSpecID,
                ordEMFlag: sourceMap[i].ordEMFlag,
                ordPriorityID: sourceMap[i].ordPriorityID,
                ordAdmReasonID: sourceMap[i].ordAdmReasonID,
                medID: sourceMap[i].medID,
                tabIndex: sourceMap[i].tableIndex,
                ordRecLocID: sourceMap[i].ordRecLocID,
                // bodyPart: sourceMap[i].bodyPart,
                // ordQty: 1,
                ordQtyUomID: sourceMap[i].ordQtyUomID,
                ordSeqNo: i,
                extvalue: [{
                    code: 'Diag', // 插入医嘱时绑定当前诊断
                    value: currentDiagRecord?.id || '',
                    refDescripts: currentDiagRecord?.diagCode || currentDiagRecord?.ICDCode || '',
                }]
            })
        }
        var params = {
            params: [{
                admID: this.state.patientData.admID,
                locID: this.state.userData.locID,
                docID: this.state.userData.userID,
                userID: this.state.userData.userID,
                hospID: this.state.userData.hospID,
                medType: 'WM',
                orders: data,
                appMessage: {
                    appPurpose: this.state.appPurpose ? this.state.appPurpose : (!Util.isEmpty(applicationMessage) ? applicationMessage.appPurpose : ''),
                    HPIllness: this.state.HPIllness ? this.state.HPIllness : (!Util.isEmpty(applicationMessage) ? applicationMessage.HPIllness : ''),
                    sign: this.state.sign ? this.state.sign : (!Util.isEmpty(applicationMessage) ? applicationMessage.sign : ''),
                    chiefComplaint: this.state.chiefComplaint ? this.state.chiefComplaint : (!Util.isEmpty(applicationMessage) ? applicationMessage.chiefComplaint : ''),
                    bodyPart: bodyPart
                }
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050001",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success(this.setMessage('ApplicationFormsuces', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    for (var i = 0; i < dataSource.length; i++) {
                        this.state.dataSource[i]['count'] = 0
                        this.state.dataSource[i]['checked'] = false
                    }
                    this.setState({
                        tableData: [],
                        tabStatus: false,
                        saveStatus: false,
                        search: undefined
                        // chiefComplaint: undefined,
                        // appPurpose: undefined,
                        // HPIllness: undefined,
                        // sign: undefined
                    }, () => {
                        this.input.focus()
                    })
                    var { loadRightCardData } = this.props;
                    loadRightCardData && loadRightCardData()
                } else {
                    this.setState({
                        saveStatus: false
                    })
                }
            }
        });
    }

    //撤销后回调列表数据
    delPartData() {
        var { delPartData } = this.props;
        delPartData && delPartData()
    }

    onSelectChange(ids, selectData) {
        this.setState({
            ids: ids,
            selectData: selectData
        })
    }

    //撤销
    delDoctorAdvice() {
        var { ids, tableData } = this.state;
        this.setState({ saveStatus: true })
        if (Util.isEmpty(ids)) {
            // message.error('请选择你需要撤销的数据！')
            message.error(this.setMessage('ApplicationFormbas', 'descripts'), this.state.userData && this.state.userData.messageTime)
            this.setState({ saveStatus: false })
            return
        }
        for (var i = 0; i < ids.length; i++) {
            if (typeof (ids[i]) !== 'string') {
                message.error(this.setMessage('ApplicationFormqwe', 'descripts'), this.state.userData && this.state.userData.messageTime)
                this.setState({ saveStatus: false })
                return
            }
        }
        for (var i = 0; i < ids.length; i++) {
            for (var j = 0; j < tableData.length; j++) {
                if (ids[i] == tableData[j].appItemID && tableData[j].appItemStatusCode == 'CO') {
                    message.error(this.setMessage('ApplicationFormef', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    this.setState({ saveStatus: false })
                    return
                }
            }

        }
        var params = {
            params: [{
                appItemID: this.state.ids,
                userID: this.state.userData.userID,
                locID: this.state.userData.locID,
            }]
        }
        $http.post('urlDeault', this, {
            code: "03050111",
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success('删除成功！', this.state.userData && this.state.userData.messageTime)
                    this.setState({
                        ids: [],
                        saveStatus: false
                    })
                    this.delPartData()
                } else {
                    this.setState({
                        saveStatus: false
                    })
                }
            }
        });
    }

    delMechansim() {
        var { ids, tableData, dataSource, selectData } = this.state;
        if (Util.isEmpty(ids)) {
            message.error(this.setMessage('ApplicationFormdete', 'descripts'), this.state.userData && this.state.userData.messageTime)
            return
        }
        for (var i = 0; i < ids.length; i++) {
            for (var j = 0; j < tableData.length; j++) {
                if (typeof (ids[i]) == 'string') {
                    // message.error(this.setMessage('ApplicationFormas', 'descripts'),this.state.userData && this.state.userData.messageTime)
                    // return
                    this.delDoctorAdvice()
                } else {
                    if (ids[i] == tableData[j].tableIndex) {
                        this.state.tableData.splice(j, 1);
                    }
                }
            }
        }

        for (var i = 0; i < selectData.length; i++) {
            for (var k = 0; k < dataSource.length; k++) {
                if (selectData[i].medID == dataSource[k].medID) {
                    this.state.count = 0
                    this.state.dataSource[k]['count'] = 0
                    this.state.dataSource[k]['checked'] = false
                }
            }
        }
        this.setState({ ids: [] })
    }

    //获取调用模版
    showUseTemplateModal(name) {
        this.setState({
            template: name,
            isShowUseTemplateModal: true
        })
    }

    loadTemplate(data) {
        var { applicationMessage } = this.state;
        if (this.state.template == 'chiefComplaint') {
            this.setState({
                chiefComplaint: (this.state.chiefComplaint || this.state.chiefComplaint.length == 0) ? (this.state.chiefComplaint + ';' + data) :
                    (applicationMessage ? (applicationMessage.chiefComplaint + ';' + data) : data)
            }, () => {
                this.hideModal('isShowUseTemplateModal')
            })
        } else if (this.state.template == 'appPurpose') {
            this.setState({
                appPurpose: (this.state.appPurpose || this.state.appPurpose.length == 0) ? (this.state.appPurpose + ';' + data) :
                    (applicationMessage ? (applicationMessage.appPurpose + ';' + data) : data)
            }, () => {
                this.hideModal('isShowUseTemplateModal')
            })
        } else if (this.state.template == 'HPIllness') {
            this.setState({
                HPIllness: (this.state.HPIllness || this.state.HPIllness.length == 0) ? (this.state.HPIllness + ';' + data) :
                    (applicationMessage ? (applicationMessage.HPIllness + ';' + data) : data)
            }, () => {
                this.hideModal('isShowUseTemplateModal')
            })
        } else if (this.state.template == 'sign') {
            this.setState({
                sign: (this.state.sign || this.state.sign.length == 0) ? (this.state.sign + ';' + data) :
                    (applicationMessage ? (applicationMessage.sign + ';' + data) : data)
            }, () => {
                this.hideModal('isShowUseTemplateModal')
            })
        }
    }

    //保存模版
    saveTemplate(name) {
        var { applicationMessage } = this.state;
        var desp = ''
        var code = ''
        if (name == 'chiefComplaint') {
            desp = this.state.chiefComplaint ? this.state.chiefComplaint :
                (applicationMessage ? applicationMessage.chiefComplaint : '')
            code = '03050114'
        } else if (name == 'appPurpose') {
            desp = this.state.appPurpose ? this.state.appPurpose :
                (applicationMessage ? applicationMessage.appPurpose : '')
            code = '03050117'
        } else if (name == 'HPIllness') {
            desp = this.state.HPIllness ? this.state.HPIllness :
                (applicationMessage ? applicationMessage.HPIllness : '')
            code = '03050120'
        } else if (name == 'sign') {
            desp = desp = this.state.sign ? this.state.sign :
                (applicationMessage ? applicationMessage.sign : '')
            code = '03050123'
        }
        var params = {
            params: [{
                userID: this.state.userData.userID,
                descripts: desp
            }]
        }
        $http.post('urlDeault', this, {
            code: code,
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success(this.setMessage('ApplicationFormsuces', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    this.hideModal('isSHowUseTemplateModal')
                }
            }
        });
    }

    //打印
    printMessage() {
        var params = {
            params: [{
                appItemID: [this.props.selectID]
            }]
        }
        $http.post('urlDeault', this, {
            code: '03050129',
            data: params,
            success: function (res) {
                if (res.errorCode == '0') {
                    message.success(this.setMessage('ApplicationFormprint', 'descripts'), this.state.userData && this.state.userData.messageTime)
                    var print = res.result;
                    if (!Util.isEmpty(print)) {
                        for (var i = 0; i < print.length; i++) {
                            $loadTemplate(print[i].template, print[i].printStr);
                        }
                    }
                }
            }
        });
    }

    commonInputChange(name, code, e) {
        if (name == 'chiefComplaint' && this.state.userData.language == 'EN') {
            var str = e.target.value
            if (str.split(' ').length > 19) {
                return
            }
        }
        this.setState({
            [name]: e.target.value,
            [code]: true
        })
    }
    render() {
        let { tableData, visible, checkVisible, dataSource, ids } = this.state;
        const rowSelection = {
            ids,
            onChange: this.onSelectChange.bind(this),
            selectedRowKeys: ids,
            getCheckboxProps: record => ({
                disabled: this.props.disBtn == 'alert', // Column configuration not to be checked
            }),
        }

        var strLength = 20;
        if (this.state.chiefComplaint) {
            strLength = this.state.chiefComplaint.split(' ').length + 1;
        }

        var sourceOption = []
        dataSource && dataSource.map((item, index) => {
            sourceOption.push(<Badge count={item.count} style={{ marginTop: 10, backgroundColor: '#fa541c' }}>
                <span className="check-child-spans" key={index}
                    style={{ display: 'block', width: '39vh', marginLeft: 15 }}>
                    <div style={{ display: 'flex' }}>
                        <Checkbox onChange={(e) => this.changeCheckBox(item.medID, item.medDesc, index, e)}
                            disabled={this.state.tabStatus == true ? true : (this.props.disBtn == 'alert' ? true : false)}
                            checked={item.checked} />
                        <div style={{ paddingLeft: '5px', cursor: 'pointer' }} className='doctor-text-ellipisis'
                            onClick={(e) => this.onDoubleClickMsg(item.medID, item.medDesc, index, e)}>
                            <Tooltip title={item.medDesc}>{item.medDesc}</Tooltip>
                        </div>
                        <div style={{ cursor: 'pointer', color: '#40a9ff' }}
                            onClick={this.showChargeDetail.bind(this, item)}>
                            <div style={{
                                marginRight: 5, background: 'rgba(245,244,244,1)', width: 20, borderLeft: '1px solid rgba(204,204,204,1)',
                                borderRight: '1px solid rgba(204,204,204,1)', textAlign: 'center', float: 'left', color: '#999999'
                            }}>¥</div>{item.medPrice}</div></div>
                </span></Badge>)
        })
        return (
            <Spin spinning={this.state.saveStatus} tip={'加载中...'}><div>
                {/**展示收费项明细弹框 */}
                <ShowChargeDetail isShow={this.state.isSHowChargeDetail}
                    detailSource={this.state.detailSource}
                    onHide={this.hideModal.bind(this, 'isSHowChargeDetail')}>
                </ShowChargeDetail>

                {/**部位弹框 */}
                <ShowPartsModal isShow={this.state.isShowPartsModal}
                    dataSource={this.state.partData}
                    onSubmit={this.submitPartData.bind(this)}
                    update={this.state.update}
                    medID={this.state.medID}
                    rowMedID={this.state.rowMedID}
                    partListModal={this.state.partListModal}
                    medDesc={this.state.medDesc}
                    onHide={this.hideModal.bind(this, 'isShowPartsModal')}>
                </ShowPartsModal>
                {/**确认医嘱弹框 */}
                <ShowConfirmModal isShow={this.state.isShowConfirmModal}
                    confirmData={this.state.confirmData}
                    errorData={this.state.errorData}
                    onSubmit={this.confirmAdviceModal.bind(this)}
                    onHide={this.hideModal.bind(this, 'isShowConfirmModal')}>
                </ShowConfirmModal>
                {/**撤销部件弹框 */}
                <ShowRevocationModal isShow={this.state.isShowRevocationModal}
                    itemData={this.state.itemData}
                    onSubmit={this.delPartData.bind(this)}
                    onHide={this.hideModal.bind(this, 'isShowRevocationModal')}>
                </ShowRevocationModal>
                {/**获取调用模版 */}
                <ShowUseTemplateModal isShow={this.state.isShowUseTemplateModal}
                    onHide={this.hideModal.bind(this, 'isShowUseTemplateModal')}
                    onSubmit={this.loadTemplate.bind(this)}
                    template={this.state.template}>
                </ShowUseTemplateModal>
                <div>
                    <div className="modal-header">
                        <span className='scheduling-title-border' style={{ margin: '10px' }}></span>
                        {this.props.breadcrumb}
                        <div style={{ float: 'right', height: 34 }}>
                            项目查询：<Input placeholder={this.setMessage('ApplicationFormquery', 'descripts')} style={{ width: '300px' }}
                                onChange={Util.commonInputChange.bind(this, 'search')} ref={(input) => this.input = input} value={this.state.search}
                                onKeyDown={this.searchDataSource.bind(this)} />
                        </div>
                    </div>
                    <div style={{ height: store.getState().tableHeight.y - 280 + 'px', overflow: 'auto' }}>
                        <Row style={{ height: '100%' }}>
                            <Col span={18} style={{ height: '100%', overflow: 'auto' }} className='source-btn'>
                                {sourceOption}
                            </Col>
                            <Col span={6} style={{ height: '100%', overflow: 'auto' }}>
                                <Card
                                    size="small"
                                    title={<div>{this.setMessage('ApplicationFormdeatil', 'descripts')}</div>}
                                    headStyle={{ background: 'linear-gradient(0deg,rgba(238,238,238,0.8) 0%,rgba(238,238,238,0.5) 50%,rgba(238,238,238,0.1) 100%)', color: ' rgba(102,102,102,1)' }}
                                    className="medical-advice-list "
                                >
                                    <div style={{ padding: '5px 8px' }}>
                                        {/* <span style={{ color: '#f5222d', fontFamily: 'SimSun' }}>*</span> */}
                                        <div><div style={{ float: 'left' }}>
                                            {this.setMessage('ApplicationFormnas', 'descripts')}</div>
                                            <div style={{ float: 'right', cursor: 'pointer' }}>
                                                <span className={this.state.indexStyle == '1' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.saveTemplate.bind(this, 'chiefComplaint')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '1')}>{this.setMessage('ApplicationFormasd', 'descripts')}</span>
                                                <span style={{ padding: '0 10px' }} className={this.state.indexStyle == '2' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.showUseTemplateModal.bind(this, 'chiefComplaint')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '2')}>{this.setMessage('ApplicationFormqvf', 'descripts')}</span></div>
                                        </div>
                                        {/* <div style={{height: '86px', background: 'rgba(242, 242, 242, 1)'}}></div> */}
                                        <TextArea onChange={this.commonInputChange.bind(this, 'chiefComplaint', 'chiefStatus')}
                                            maxLength={this.state.userData.language == 'CN' && this.setMessage('ApplicationFormComplaintLength', 'legth')}
                                            value={this.state.chiefComplaint ? this.state.chiefComplaint :
                                                (this.state.chiefStatus ? undefined : (this.state.applicationMessage ? this.state.applicationMessage.chiefComplaint : undefined))} />
                                    </div>
                                    <div style={{ padding: '5px 8px' }}>
                                        <div><div style={{ float: 'left' }}>
                                            {/* <span style={{ color: '#f5222d', fontFamily: 'SimSun' }}>*</span> */}
                                            {this.setMessage('ApplicationFormPurpose', 'descripts')}</div>
                                            <div style={{ float: 'right', cursor: 'pointer' }}>
                                                <span className={this.state.indexStyle == '3' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.saveTemplate.bind(this, 'appPurpose')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '3')}>{this.setMessage('ApplicationFormasd', 'descripts')}</span>
                                                <span style={{ padding: '0 10px' }} className={this.state.indexStyle == '4' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.showUseTemplateModal.bind(this, 'appPurpose')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '4')}>{this.setMessage('ApplicationFormqvf', 'descripts')}</span></div>
                                        </div>
                                        {/* <div style={{height: '86px', background: 'rgba(242, 242, 242, 1)'}}></div> */}
                                        <TextArea onChange={this.commonInputChange.bind(this, 'appPurpose', 'appStatus')}
                                            value={this.state.appPurpose ? this.state.appPurpose :
                                                (this.state.appStatus ? undefined : (this.state.applicationMessage ? this.state.applicationMessage.appPurpose : undefined))} />
                                    </div>
                                    <div style={{ padding: '5px 8px' }}>
                                        <div><div style={{ float: 'left' }}>{this.setMessage('ApplicationFormgff', 'descripts')}</div>
                                            <div style={{ float: 'right', cursor: 'pointer' }}>
                                                <span className={this.state.indexStyle == '5' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.saveTemplate.bind(this, 'HPIllness')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '5')}>{this.setMessage('ApplicationFormasd', 'descripts')}</span>
                                                <span style={{ padding: '0 10px' }} className={this.state.indexStyle == '6' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.showUseTemplateModal.bind(this, 'HPIllness')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '6')}>{this.setMessage('ApplicationFormqvf', 'descripts')}</span></div>
                                        </div>
                                        {/* <div style={{height: '86px', background: 'rgba(242, 242, 242, 1)'}}></div> */}
                                        <TextArea onChange={this.commonInputChange.bind(this, 'HPIllness', 'hpilStatus')}
                                            value={this.state.HPIllness ? this.state.HPIllness :
                                                (this.state.hpilStatus ? undefined : (this.state.applicationMessage ? this.state.applicationMessage.HPIllness : undefined))} />
                                    </div>
                                    <div style={{ padding: '5px 8px' }}>
                                        <div><div style={{ float: 'left' }}>{this.setMessage('ApplicationFormac', 'descripts')}</div>
                                            <div style={{ float: 'right', cursor: 'pointer' }}>
                                                <span className={this.state.indexStyle == '7' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.saveTemplate.bind(this, 'sign')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '7')}>{this.setMessage('ApplicationFormasd', 'descripts')}</span>
                                                <span style={{ padding: '0 10px' }} className={this.state.indexStyle == '8' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onClick={this.showUseTemplateModal.bind(this, 'sign')}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '8')}>{this.setMessage('ApplicationFormqvf', 'descripts')}</span></div>
                                        </div>
                                        {/* <div style={{height: '86px', background: 'rgba(242, 242, 242, 1)'}}></div> */}
                                        <TextArea onChange={this.commonInputChange.bind(this, 'sign', 'signStatus')}
                                            value={this.state.sign ? this.state.sign :
                                                (this.state.signStatus ? undefined : (this.state.applicationMessage ? this.state.applicationMessage.sign : undefined))} />
                                    </div>
                                    <div style={{ padding: '5px 8px' }}>
                                        <div><div style={{ float: 'left' }}>{this.setMessage('ApplicationFormrtf', 'descripts')}</div>
                                            <div style={{ float: 'right', cursor: 'pointer' }}>
                                                <span className={this.state.indexStyle == '9' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '9')}>{this.setMessage('ApplicationFormasd', 'descripts')}</span>
                                                <span style={{ padding: '0 10px' }} className={this.state.indexStyle == '10' ? 'mouse-add-Style' : ''}
                                                    onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                                    onMouseOver={this.addMouseOverStyle.bind(this, '10')}>{this.setMessage('ApplicationFormqvf', 'descripts')}</span></div>
                                        </div>
                                        {/* <div style={{height: '86px', background: 'rgba(242, 242, 242, 1)'}}></div> */}
                                        <TextArea onChange={Util.commonInputChange.bind(this, 'other')}
                                            value={this.state.other ? this.state.other :
                                                (this.state.applicationMessage ? this.state.applicationMessage.other : undefined)} />
                                    </div>
                                </Card>
                            </Col>
                        </Row>
                    </div>
                </div>
                <div>
                    <div className="modal-header">
                        <span className='scheduling-title-border' style={{ margin: '10px' }}></span>
                        {this.setMessage('ApplicationFormzz', 'descripts')}
                    </div>
                    <div style={{ height: '32px', lineHeight: '32px', padding: '0 12px' }}>
                        {/* <span className={tableData && tableData.length > 0 ? "span" : 'dis-span'}
                            onClick={this.delDoctorAdvice.bind(this)}>
                            <Icon className='application-reload' />
                            {this.setMessage('ApplicationFormRevoke', 'descripts')}
                        </span><Divider type="vertical" /> */}
                        <span className={tableData && tableData.length > 0 ? "span" : 'dis-span'}
                            onClick={this.delMechansim.bind(this)}>
                            <Icon className='doctor-delete-splice' />
                            {this.setMessage('ApplicationFormDelete', 'descripts')}
                        </span>
                        <span style={{ float: 'right' }}>
                            <Button type='primary' size='small' disabled={this.props.disBtn == 'alert'}
                                onClick={this.saveDoctorAdvice.bind(this)}>{this.setMessage('ApplicationFormReview', 'descripts')}</Button><Divider type="vertical" />
                            <Button size='small' type='primary' disabled={Util.isEmpty(this.props.selectID) ? true : (this.props.disBtn == 'alert' ? true : false)}
                                onClick={this.printMessage.bind(this)}>{this.setMessage('ApplicationFormprints', 'descripts')}</Button><Divider type="vertical" />
                            <Button onClick={this.clearInput.bind(this)} size='small' disabled={this.props.disBtn == 'alert'}>{this.setMessage('ApplicationFormClear', 'descripts')}</Button>
                        </span>
                    </div>
                    <div>
                        <Table
                            columns={this.columns}
                            dataSource={tableData}
                            scroll={{ y: 206 }}
                            rowSelection={rowSelection}
                            rowKey={(data) => {
                                return data.appItemID || data.tableIndex
                            }}
                            bordered pagination={false}
                        />
                    </div>
                </div>
                <Modal
                    title="选择检查部位/体位（当前检查项目：X射线检查）"
                    visible={visible}
                    onOk={this.handleOk}
                    onCancel={this.handleCancel}
                    style={{ width: '600px' }}
                >
                    <div>
                        <div style={{ width: '200px' }}>
                            <div>
                                <Input placeholder="请选择检查部位，输入名称回车可查询" />
                            </div>
                            <div>
                                <Tabs defaultActiveKey="1" onChange={this.handleCallback} tabPosition="left">
                                    <TabPane tab="Tab 1" key="1">
                                        Content of Tab Pane 1
                                    </TabPane>
                                    <TabPane tab="Tab 2" key="2">
                                        Content of Tab Pane 2
                                    </TabPane>
                                    <TabPane tab="Tab 3" key="3">
                                        Content of Tab Pane 3
                                    </TabPane>
                                </Tabs>
                            </div>
                        </div>
                        <div>
                            <div>
                                <Input placeholder="请选择体位，输入名称回车可查询" />
                            </div>
                            <div>
                                12
                            </div>
                        </div>
                        <div>
                            <div>
                                已选择检查部位/体位
                            </div>
                            <div>
                                122
                            </div>
                        </div>
                    </div>
                    <div style={{ position: 'absolute', bottom: '10px', left: '16px', height: '32px', lineHeight: '32px', opacity: '0.5' }}>说明：选择部位后，请选择体位</div>
                </Modal>
                <Modal
                    title="检查部位/体位"
                    visible={checkVisible}
                    onOk={this.handleCheckOk}
                    onCancel={this.handleCheckCancel}
                >
                    <div>

                    </div>
                </Modal>
            </div></Spin>
        )
    }
}