/*
 * Creator:     ML
 * CreatDate:   2019-11-05
 * descripts：分诊前台
 * */
import React from 'react';
import { Row, Col, Icon, Modal, Table, Card, Select, Button, Form, Tooltip, Input, message, Drawer, AutoComplete } from 'antd';
import { $http } from '../../containers/config/https';
import { Util } from 'tools/index';
import store from '../../store';
import ReadCard from '../../components/readcard/ReadCard';
import ShowAssessmentModal from './component/ShowAssessmentModal';
import ShowReferralModal from './component/ShowReferralModal';
import ShowFaceRecognitionModal from 'pages/workstation/component/ShowFaceRecognitionModal';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import './style/frontDest.less';

const Option = Select.Option;
const FormItem = Form.Item;

const FrontDeskForTriage = Form.create()(
  class FrontDeskForTriage extends React.Component {
    constructor(porps) {
      super(porps);
      var userData = JSON.parse(sessionStorage.getItem('userData'));
      this.state = {
        selectData: {},
        allLocArr: [],
        locArr: [],
        docArr: [],
        locID: '',
        leftData: [],
        rowId: '',
        rightTopRowId: '',
        rightTopData: [],
        rightBottomData: [],
        rightBottomRowId: '',
        initCardDr: '',
        nowRead: '',
        idCardCode: '',
        cardLength: '',
        replenishZero: '',
        repariFeeFlag: '',
        nowCost: '',
        nowInv: '',
        cardNoMessage: '',
        cardNoVisible: false,
        rightLocID: '',
        rightDocID: '',
        docName: '',
        docId: '',
        blockArr: [],
        statusCode: 'ALL',
        regId: '',
        regLocId: '',
        userData: userData,
        loading: false,
        nurseTriageTimedRefresh: '', // 定时刷新列表
        column: [],
        docRangeId:''
      }
      this.ODfocus = React.createRef();
      this.OSfocus = React.createRef();
      this.ODIOPfocus = React.createRef();
      this.OSIOPfocus = React.createRef();
      this.ODOstiolefocus = React.createRef();
      this.OSOstiolefocus = React.createRef();
      this.ODWearGlassesfocus = React.createRef();
      this.OSWearGlassesfocus = React.createRef();
      this.ODVisionInfocus = React.createRef();
      this.OSVisionInfocus = React.createRef();
      this.ODNearVisionfocus = React.createRef();
      this.OSNearVisionfocus = React.createRef();
      this.OperPopfocus = React.createRef();
      this.Motivationfocus = React.createRef();
      this.SubjectiveResonfocus = React.createRef();
      this.ObjectiveResonfocus = React.createRef();
      this['OD Spheric mirrorfocus'] = React.createRef();
      this['OD Cylindrical mirrorfocus'] = React.createRef();
      this['OD Axial positionfocus'] = React.createRef();
      this['OS Spheric mirrorfocus'] = React.createRef();
      this['OS Cylindrical mirrorfocus'] = React.createRef();
      this['OS Axial positionfocus'] = React.createRef();
      this.timer = null;
    }

    componentDidMount = () => {
      this.loadFrontMessage()
      this.initData()
      var x = document.querySelectorAll(".ant-table-body");
      for (var i = 0; i < x.length; i++) {
        x[0].style.height = store.getState().tableHeight.y + 18 + 'px';
        // x[1].style.height = store.getState().tableHeight.y - 364 + "px";
        // x[2].style.height = store.getState().tableHeight.y - 256 + "px";
      }
      this.getAllLoc()
      this.loadTimeRange()
      this.getCard()
      this.getList()
      this.getRightLoc()
      this.getRightDoc()
      this.getRightDocList()
      this.loadTimeSolt()
      this.setState({
        locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""
      })
      this.input.focus()
    }

    componentWillUnmount() {
      if (this.timer) { // 清除定时器
        clearInterval(this.timer);
        this.timer = null;
      }
      // 组件销毁前将静止让setState修改state的状态
      this.setState = (state, callback) => { return; }
    }

    getUpdateInfo = () => {
      this.getAllLoc()
      this.getCard()
      this.getList()
      this.getRightLoc()
      this.getRightDoc()
      this.getRightDocList()
    }

    updateAll = () => {
      this.getAllLoc()
      this.getCard()
      this.getList()
      this.getRightLoc()
      this.getRightDoc()
      this.getRightDocList()
      this.setState({
        rightTopData: [],
        rightTopRowId: "",
        rightBottomData: [],
        // rowId: ""
      })
    }

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

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

    //获取评估单下拉数据
    loadFrontMessage() {
      var params = {
        params: [{
          locID: this.state.userData.locID,
          hospID: this.state.userData.hospID,
        }]
      }
      $http.post('urlS', this, {
        code: '03050269',
        data: params,
        success: function (res) {
          if (res.errorCode == '0') {
            this.setState({
              selectData: res.result,
              ODList: !Util.isEmpty(res.result) ? res.result.OD : '',
              ODIOPList: !Util.isEmpty(res.result) ? res.result.ODIOP : '',
              ODOstioleList: !Util.isEmpty(res.result) ? res.result.ODOstiole : '',
              OSIOPList: !Util.isEmpty(res.result) ? res.result.OSIOP : '',
              ODWearGlassesList: !Util.isEmpty(res.result) ? res.result.ODWearGlasses : '',
              OSList: !Util.isEmpty(res.result) ? res.result.OS : '',
              OSOstioleList: !Util.isEmpty(res.result) ? res.result.OSOstiole : '',
              OSWearGlassesList: !Util.isEmpty(res.result) ? res.result.OSWearGlasses : '',
              OperPopList: !Util.isEmpty(res.result) && res.result.OperPop ? res.result.OperPop : [],
              MotivationList: !Util.isEmpty(res.result) && res.result.Motivation ? res.result.Motivation : [],
              SubjectiveResonList: !Util.isEmpty(res.result) && res.result.SubjectiveReson ? res.result.SubjectiveReson : [],
              ObjectiveResonList: !Util.isEmpty(res.result) && res.result.ObjectiveReson ? res.result.ObjectiveReson : [],
            })
          }
        }
      })
    }

    initData() {
      let data = {
        params: [{
          compontName: "FrontDeskForTriage",
          type: "C",
          reactCode: ['FrontDeskForTriage']
        }]
      }
      $http.post('urlDeault', this, {
        code: "01040073",
        data: data,
        success: (res) => {
          if (+res.errorCode === 0) {
            const { selectData } = this.state;
            var columns = res.result.C;
            var dynColumns = []
            for (var i = 0; i < columns.length; i++) {
              let currentRecord = columns[i];
              let currentDataIndex = currentRecord?.dataIndex || '';
              if (columns[i].dataIndex == 'opertion') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  fixed: 'right',
                  focusFlag: 'N',
                  render: (text, data) => {
                    return <span style={{ color: '#007AFF', cursor: 'pointer' }} onClick={this.handleAssessmentSheet.bind(this, data)}>填写评估单</span>
                  }
                })
              } else if (columns[i].dataIndex == 'OD') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var ODList = !Util.isEmpty(this.state.ODList) ? this.state.ODList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.ODList) ? this.state.ODList.fieldID : ''
                    var ODListOption = []
                    ODList && ODList.map((item, index) => {
                      ODListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.ODtext == 'OD' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODfocus', 'ODtext')}>{data.OD}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.OD} open={data.openOD}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OD', '')}
                          defaultActiveFirstOption={false}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OD', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OD')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OD')}
                          ref={index == this.state.linkIndex ? this.ODfocus : ''} dataSource={ODListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OD')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODfocus', 'ODtext')}>{data.OD}</div>)
                  }
                })
              } else if (columns[i].dataIndex == 'OS') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var OSList = !Util.isEmpty(this.state.OSList) ? this.state.OSList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.OSList) ? this.state.OSList.fieldID : ''
                    var OSListOption = []
                    OSList && OSList.map((item, index) => {
                      OSListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.OStext == 'OS' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSfocus', 'OStext')}>{data.OS}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.OS} open={data.openOS}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OS', '')}
                          defaultActiveFirstOption={false}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OS', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OS')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OS')}
                          ref={index == this.state.linkIndex ? this.OSfocus : ''} dataSource={OSListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OS')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSfocus', 'OStext')}>{data.OS}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'ODIOP') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var ODIOPList = !Util.isEmpty(this.state.ODIOPList) ? this.state.ODIOPList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.ODIOPList) ? this.state.ODIOPList.fieldID : ''
                    var ODIOPListOption = []
                    ODIOPList && ODIOPList.map((item, index) => {
                      ODIOPListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.ODIOPtext == 'ODIOP' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODIOPfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODIOPfocus', 'ODIOPtext')}>{data.ODIOP}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.ODIOP} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'ODIOP', '')}
                          open={data.openODIOP}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'ODIOP', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'ODIOP')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'ODIOP')}
                          ref={index == this.state.linkIndex ? this.ODIOPfocus : ''} dataSource={ODIOPListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'ODIOP')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODIOPfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODIOPfocus', 'ODIOPtext')}>{data.ODIOP}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OSIOP') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var OSIOPList = !Util.isEmpty(this.state.OSIOPList) ? this.state.OSIOPList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.OSIOPList) ? this.state.OSIOPList.fieldID : ''
                    var OSIOPListOption = []
                    OSIOPList && OSIOPList.map((item, index) => {
                      OSIOPListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.OSIOPtext == 'OSIOP' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSIOPfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSIOPfocus', 'OSIOPtext')}>{data.OSIOP}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.OSIOP} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OSIOP', '')}
                          open={data.openOSIOP}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OSIOP', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OSIOP')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OSIOP')}
                          ref={index == this.state.linkIndex ? this.OSIOPfocus : ''} dataSource={OSIOPListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OSIOP')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSIOPfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSIOPfocus', 'OSIOPtext')}>{data.OSIOP}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OperPop') { // 手术人群
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var OperPopList = !Util.isEmpty(this.state.OperPopList) ? this.state.OperPopList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.OperPopList) ? this.state.OperPopList.fieldID : ''
                    var OperPopListOption = []
                    OperPopList && OperPopList.map((item, index) => {
                      OperPopListOption.push(<Option key={index} value={item.Desc}>{item.Desc}</Option>)
                    })
                    return data.OperPoptext == 'OperPop' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OperPopfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OperPopfocus', 'OperPoptext')}>{data.OperPop}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.OperPop} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OperPop', '')}
                          open={data.openOperPop}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OperPop', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OperPop')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OperPop')}
                          ref={index == this.state.linkIndex ? this.OperPopfocus : ''} dataSource={OperPopListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OperPop')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OperPopfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OperPopfocus', 'OperPoptext')}>{data.OperPop}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'Motivation') { // 手术动机
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var MotivationList = !Util.isEmpty(this.state.MotivationList) ? this.state.MotivationList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.MotivationList) ? this.state.MotivationList.fieldID : ''
                    var MotivationListOption = []
                    MotivationList && MotivationList.map((item, index) => {
                      MotivationListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.Motivationtext == 'Motivation' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'Motivationfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'Motivationfocus', 'Motivationtext')}>{data.Motivation}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.Motivation} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'Motivation', '')}
                          open={data.openMotivation}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'Motivation', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'Motivation')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'Motivation')}
                          ref={index == this.state.linkIndex ? this.Motivationfocus : ''} dataSource={MotivationListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'Motivation')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'Motivationfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'Motivationfocus', 'Motivationtext')}>{data.Motivation}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'ODOstiole') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var ODOstioleList = !Util.isEmpty(this.state.ODOstioleList) ? this.state.ODOstioleList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.ODOstioleList) ? this.state.ODOstioleList.fieldID : ''
                    var ODOstioleListOption = []
                    ODOstioleList && ODOstioleList.map((item, index) => {
                      ODOstioleListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.ODOstioletext == 'ODOstiole' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODOstiolefocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODOstiolefocus', 'ODOstioletext')}>{data.ODOstiole}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.ODOstiole} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'ODOstiole', '')}
                          open={data.openODOstiole}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'ODOstiole', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'ODOstiole')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'ODOstiole')}
                          ref={index == this.state.linkIndex ? this.ODOstiolefocus : ''} dataSource={ODOstioleListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'ODOstiole')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODOstiolefocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODOstiolefocus', 'ODOstioletext')}>{data.ODOstiole}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OSOstiole') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var OSOstioleList = !Util.isEmpty(this.state.OSOstioleList) ? this.state.OSOstioleList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.OSOstioleList) ? this.state.OSOstioleList.fieldID : ''
                    var OSOstioleListOption = []
                    OSOstioleList && OSOstioleList.map((item, index) => {
                      OSOstioleListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.OSOstioletext == 'OSOstiole' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSOstiolefocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSOstiolefocus', 'OSOstioletext')}>{data.OSOstiole}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.OSOstiole} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OSOstiole', '')}
                          open={data.openOSOstiole}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OSOstiole', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OSOstiole')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OSOstiole')}
                          ref={index == this.state.linkIndex ? this.OSOstiolefocus : ''} dataSource={OSOstioleListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OSOstiole')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSOstiolefocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSOstiolefocus', 'OSOstioletext')}>{data.OSOstiole}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'ODWearGlasses') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var ODWearGlassesList = !Util.isEmpty(this.state.ODWearGlassesList) ? this.state.ODWearGlassesList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.ODWearGlassesList) ? this.state.ODWearGlassesList.fieldID : ''
                    var ODWearGlassesListOption = []
                    ODWearGlassesList && ODWearGlassesList.map((item, index) => {
                      ODWearGlassesListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.ODWearGlassestext == 'ODWearGlasses' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODWearGlassesfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODWearGlassesfocus', 'ODWearGlassestext')}>{data.ODWearGlasses}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.ODWearGlasses} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'ODWearGlasses', '')}
                          open={data.openODWearGlasses}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'ODWearGlasses', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'ODWearGlasses')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'ODWearGlasses')}
                          ref={index == this.state.linkIndex ? this.ODWearGlassesfocus : ''} dataSource={ODWearGlassesListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'ODWearGlasses')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODWearGlassesfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODWearGlassesfocus', 'ODWearGlassestext')}>{data.ODWearGlasses}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OSWearGlasses') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var OSWearGlassesList = !Util.isEmpty(this.state.OSWearGlassesList) ? this.state.OSWearGlassesList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.OSWearGlassesList) ? this.state.OSWearGlassesList.fieldID : ''
                    var OSWearGlassesListOption = []
                    OSWearGlassesList && OSWearGlassesList.map((item, index) => {
                      OSWearGlassesListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.OSWearGlassestext == 'OSWearGlasses' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSWearGlassesfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSWearGlassesfocus', 'OSWearGlassestext')}>{data.OSWearGlasses}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.OSWearGlasses} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OSWearGlasses', '')}
                          open={data.openOSWearGlasses}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OSWearGlasses', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OSWearGlasses')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OSWearGlasses')}
                          ref={index == this.state.linkIndex ? this.OSWearGlassesfocus : ''} dataSource={OSWearGlassesListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OSWearGlasses')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSWearGlassesfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSWearGlassesfocus', 'OSWearGlassestext')}>{data.OSWearGlasses}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'SubjectiveReson') { //未检查原因（主观）
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var SubjectiveResonList = !Util.isEmpty(this.state.SubjectiveResonList) ? this.state.SubjectiveResonList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.SubjectiveResonList) ? this.state.SubjectiveResonList.fieldID : ''
                    var SubjectiveResonListOption = []
                    SubjectiveResonList && SubjectiveResonList.map((item, index) => {
                      SubjectiveResonListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.SubjectiveResontext == 'SubjectiveReson' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'SubjectiveResonfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'SubjectiveResonfocus', 'SubjectiveResontext')}>{data.SubjectiveReson}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.SubjectiveReson} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'SubjectiveReson', '')}
                          open={data.openSubjectiveReson}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'SubjectiveReson', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'SubjectiveReson')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'SubjectiveReson')}
                          ref={index == this.state.linkIndex ? this.SubjectiveResonfocus : ''} dataSource={SubjectiveResonListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'SubjectiveReson')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'SubjectiveResonfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'SubjectiveResonfocus', 'SubjectiveResontext')}>{data.SubjectiveReson}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'ObjectiveReson') {  //为检查原因（客观）
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var ObjectiveResonList = !Util.isEmpty(this.state.ObjectiveResonList) ? this.state.ObjectiveResonList.dataList : []
                    var fieldID = !Util.isEmpty(this.state.ObjectiveResonList) ? this.state.ObjectiveResonList.fieldID : ''
                    var ObjectiveResonListOption = []
                    ObjectiveResonList && ObjectiveResonList.map((item, index) => {
                      ObjectiveResonListOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.ObjectiveResontext == 'ObjectiveReson' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ObjectiveResonfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ObjectiveResonfocus', 'ObjectiveResontext')}>{data.ObjectiveReson}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data.ObjectiveReson} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'ObjectiveReson', '')}
                          open={data.openObjectiveReson}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'ObjectiveReson', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'ObjectiveReson')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'ObjectiveReson')}
                          ref={index == this.state.linkIndex ? this.ObjectiveResonfocus : ''} dataSource={ObjectiveResonListOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'ObjectiveReson')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ObjectiveResonfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ObjectiveResonfocus', 'ObjectiveResontext')}>{data.ObjectiveReson}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OD Vision in') { // OD中视力
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var ODVisionInList = selectData['OD Vision in']?.dataList || [];
                    var fieldID = selectData['OD Vision in']?.fieldID || '';
                    var ODVisionInOption = []
                    ODVisionInList && ODVisionInList.map((item, index) => {
                      ODVisionInOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.ODVisionInText == 'ODVisionIn' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODVisionInfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODVisionInfocus', 'ODVisionInText')}>{data['OD Vision in']}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data['OD Vision in']} open={data.openODVisionIn}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OD Vision in', '')}
                          defaultActiveFirstOption={false}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OD Vision in', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OD Vision in')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OD Vision in')}
                          ref={index == this.state.linkIndex ? this.ODVisionInfocus : ''} dataSource={ODVisionInOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OD Vision in')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODVisionInfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODVisionInfocus', 'ODVisionInText')}>{data['OD Vision in']}</div>)
                  }
                })
              } else if (columns[i].dataIndex == 'OS Vision in') { // OS中视力
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var OSVisionInList = selectData['OS Vision in']?.dataList || [];
                    var fieldID = selectData['OS Vision in']?.fieldID || '';
                    var OSVisionInOption = []
                    OSVisionInList && OSVisionInList.map((item, index) => {
                      OSVisionInOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.OSVisionIntext == 'OSVisionIn' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSVisionInfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSVisionInfocus', 'OSVisionIntext')}>{data['OS Vision in']}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data['OS Vision in']} open={data.openOSVisionIn}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OS Vision in', '')}
                          defaultActiveFirstOption={false}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OS Vision in', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OS Vision in')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OS Vision in')}
                          ref={index == this.state.linkIndex ? this.OSVisionInfocus : ''} dataSource={OSVisionInOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OS Vision in')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSVisionInfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSVisionInfocus', 'OSVisionIntext')}>{data['OS Vision in']}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OD Near vision') { // OD近视力
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var ODNearVisionList = selectData['OD Near vision']?.dataList || [];
                    var fieldID = selectData['OD Near vision']?.fieldID || '';
                    var ODNearVisionOption = []
                    ODNearVisionList && ODNearVisionList.map((item, index) => {
                      ODNearVisionOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.ODNearVisiontext == 'ODNearVision' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODNearVisionfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODNearVisionfocus', 'ODNearVisiontext')}>{data['OD Near vision']}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data['OD Near vision']} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OD Near vision', '')}
                          open={data.openODNearVision}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OD Near vision', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OD Near vision')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OD Near vision')}
                          ref={index == this.state.linkIndex ? this.ODNearVisionfocus : ''} dataSource={ODNearVisionOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OD Near vision')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'ODNearVisionfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'ODNearVisionfocus', 'ODNearVisiontext')}>{data['OD Near vision']}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OS Near vision') { // OS近视力 
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    var OSNearVisionList = selectData['OS Near vision']?.dataList || [];
                    var fieldID = selectData['OS Near vision']?.fieldID || '';
                    var OSNearVisionOption = []
                    OSNearVisionList && OSNearVisionList.map((item, index) => {
                      OSNearVisionOption.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data.OSNearVisiontext == 'OSNearVision' && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSNearVisionfocus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSNearVisionfocus', 'OSNearVisiontext')}>{data['OS Near vision']}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data['OS Near vision']} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, 'OS Near vision', '')}
                          open={data.openOSNearVision}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, 'OS Near vision', '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, 'OS Near vision')}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, 'OS Near vision')}
                          ref={index == this.state.linkIndex ? this.OSNearVisionfocus : ''} dataSource={OSNearVisionOption}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, 'OS Near vision')} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={'OSNearVisionfocus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, 'OSNearVisionfocus', 'OSNearVisiontext')}>{data['OS Near vision']}</div>)

                  }
                })
              } else if (columns[i].dataIndex == 'OD Spheric mirror' || columns[i].dataIndex == 'OD Cylindrical mirror' || columns[i].dataIndex == 'OD Axial position' || columns[i].dataIndex == 'OS Spheric mirror' || columns[i].dataIndex == 'OS Cylindrical mirror' || columns[i].dataIndex == 'OS Axial position') {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  render: (text, data, index) => {
                    let listData = selectData[currentDataIndex]?.dataList || [];
                    let fieldID = selectData[currentDataIndex]?.fieldID || '';
                    let optionData = []
                    listData && listData.map((item, index) => {
                      optionData.push(<Option key={index} value={item.descripts}>{item.descripts}</Option>)
                    })
                    return data[currentDataIndex + 'text'] == currentDataIndex && !data.editAble ? <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={currentDataIndex + 'focus'}
                      onClick={this.handleCheckEditMessage.bind(this, data, index, text, currentDataIndex + 'focus', currentDataIndex + 'text')}>{data[currentDataIndex]}</div> : (data.editAble ?
                        <AutoComplete style={{ width: '95%' }} dropdownMatchSelectWidth={false} value={data[currentDataIndex]} defaultActiveFirstOption={false}
                          onSelect={this.handleSelectChange.bind(this, data, index, fieldID, currentDataIndex, '')}
                          open={data['open' + currentDataIndex]}
                          onChange={this.handleChangeMessage.bind(this, data, index, fieldID, currentDataIndex, '1')}
                          onBlur={this.handleOnBlurSelect.bind(this, data, index, fieldID, currentDataIndex)}
                          onFocus={this.handleOnFocusSelect.bind(this, data, index, fieldID, currentDataIndex)}
                          ref={index == this.state.linkIndex ? this[currentDataIndex + 'focus'] : ''}
                          dataSource={listData}>
                          <Input onKeyDown={this.handleOnKeyDown.bind(this, data, index, fieldID, currentDataIndex)} />
                        </AutoComplete>
                        : <div style={{ width: '100%', minHeight: 30, lineHeight: '30px' }} value={currentDataIndex + 'focus'}
                          onClick={this.handleCheckEditMessage.bind(this, data, index, text, currentDataIndex + 'focus', currentDataIndex + 'text')}>{data[currentDataIndex]}</div>)

                  }
                })
              } else {
                dynColumns.push({
                  title: this.state.userData.language == 'EN' ? columns[i].enDescripts : columns[i].title,
                  dataIndex: columns[i].dataIndex,
                  width: parseInt(columns[i].width),
                  align: columns[i].align || 'center',
                  focusFlag: 'N'
                })
              }
            }
            this.setState({
              column: dynColumns,
              localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN
            })
            this.props.hanlderThis.setState({
              reload: false,
            })
          }
        }
      })

    }

    //获取焦点
    handleOnFocusSelect(data, index, fieldID, name, e) {
      if (name == 'OD') {
        this.state.leftData[index]['openOD'] = true
      } else if (name == 'OS') {
        this.state.leftData[index]['openOS'] = true
      } else if (name == 'ODIOP') {
        this.state.leftData[index]['openODIOP'] = true
      } else if (name == 'OSIOP') {
        this.state.leftData[index]['openOSIOP'] = true
      } else if (name == 'ODOstiole') {
        this.state.leftData[index]['openODOstiole'] = true
      } else if (name == 'OSOstiole') {
        this.state.leftData[index]['openOSOstiole'] = true
      } else if (name == 'ODWearGlasses') {
        this.state.leftData[index]['openODWearGlasses'] = true
      } else if (name == 'OSWearGlasses') {
        this.state.leftData[index]['openOSWearGlasses'] = true
      } else if (name == 'OperPop') { // 手术人群
        this.state.leftData[index]['openOperPop'] = true
      } else if (name == 'Motivation') { // 手术动机
        this.state.leftData[index]['openMotivation'] = true
      } else if (name == 'SubjectiveReson') { // 未检查原因（主观）
        this.state.leftData[index]['openSubjectiveReson'] = true
      } else if (name == 'ObjectiveReson') { // 未检查原因（客观）
        this.state.leftData[index]['openObjectiveReson'] = true
      } else if (name == 'OD Vision in') { // OD中视力
        this.state.leftData[index]['openODVisionIn'] = true
      } else if (name == 'OS Vision in') { // OS中视力
        this.state.leftData[index]['openOSVisionIn'] = true
      } else if (name == 'OD Near vision') { // OD近视力
        this.state.leftData[index]['openODNearVision'] = true
      } else if (name == 'OS Near vision') { // OS近视力
        this.state.leftData[index]['openOSNearVision'] = true
      } else if (name == 'OD Spheric mirror' || name == 'OD Cylindrical mirror' || name == 'OD Axial position' || name == 'OS Spheric mirror' || name == 'OS Cylindrical mirror' || name == 'OS Axial position') {
        this.state.leftData[index]['open' + name] = true
      }
      this.setState({})
    }

    //失去焦点
    handleOnBlurSelect(data, index, fieldID, name, e) {
      this.state.leftData[index][name] = e
      this.setState({
        fieldData: [{
          fieldID: fieldID,
          value: e,
        }]
      }, () => {
        var params = {
          params: [{
            hospID: this.state.userData.hospID,
            userID: this.state.userData.userID,
            admID: data.admID,
            fieldData: this.state.fieldData
          }]
        }
        $http.post('urlS', this, {
          code: '03050270',
          data: params,
          success: function (res) {
            if (res.errorCode == '0') {
              message.success('保存成功！')
              if (name == 'OD') {
                this.state.leftData[index]['openOD'] = false
                this.state.leftData[index]['ODtext'] = 'OD'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OS') {
                this.state.leftData[index]['openOS'] = false
                this.state.leftData[index]['OStext'] = 'OS'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'ODIOP') {
                this.state.leftData[index]['openODIOP'] = false
                this.state.leftData[index]['ODIOPtext'] = 'ODIOP'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OSIOP') {
                this.state.leftData[index]['openOSIOP'] = false
                this.state.leftData[index]['OSIOPtext'] = 'OSIOP'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'ODOstiole') {
                this.state.leftData[index]['openODOstiole'] = false
                this.state.leftData[index]['ODOstioletext'] = 'ODOstiole'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OSOstiole') {
                this.state.leftData[index]['openOSOstiole'] = false
                this.state.leftData[index]['OSOstioletext'] = 'OSOstiole'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'ODWearGlasses') {
                this.state.leftData[index]['openODWearGlasses'] = false
                this.state.leftData[index]['ODWearGlassestext'] = 'ODWearGlasses'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OSWearGlasses') {
                this.state.leftData[index]['openOSWearGlasses'] = false
                this.state.leftData[index]['OSWearGlassestext'] = 'OSWearGlasses'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OperPop') { // 手术人群
                this.state.leftData[index]['openOperPop'] = false
                this.state.leftData[index]['OperPoptext'] = 'OperPop'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'Motivation') { // 手术动机
                this.state.leftData[index]['openMotivation'] = false
                this.state.leftData[index]['Motivationtext'] = 'Motivation'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'SubjectiveReson') { // 未检查原因（主观）
                this.state.leftData[index]['openSubjectiveReson'] = false
                this.state.leftData[index]['SubjectiveResontext'] = 'SubjectiveReson'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'ObjectiveReson') { // 未检查原因（客观）
                this.state.leftData[index]['openObjectiveReson'] = false
                this.state.leftData[index]['ObjectiveResontext'] = 'ObjectiveReson'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OD Vision in') { // OD中视力
                this.state.leftData[index]['openODVisionIn'] = false
                this.state.leftData[index]['ODVisionIntext'] = 'ODVisionIn'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OS Vision in') { // OS中视力
                this.state.leftData[index]['openOSVisionIn'] = false
                this.state.leftData[index]['OSVisionIntext'] = 'OSVisionIn'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OD Near vision') { // OD近视力
                this.state.leftData[index]['openODNearVision'] = false
                this.state.leftData[index]['ODNearVisiontext'] = 'ODNearVision'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OS Near vision') { // OS近视力
                this.state.leftData[index]['openOSNearVision'] = false
                this.state.leftData[index]['OSNearVisiontext'] = 'OSNearVision'
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              } else if (name == 'OD Spheric mirror' || name == 'OD Cylindrical mirror' || name == 'OD Axial position' || name == 'OS Spheric mirror' || name == 'OS Cylindrical mirror' || name == 'OS Axial position') {
                this.state.leftData[index]['open' + name] = false;
                this.state.leftData[index][name + 'text'] = name;
                this.setState({}, () => {
                  this.initData()
                  // this.getList(1)
                })
              }
            }

          }
        })
      })
      if (name == 'OD') {
        this.state.leftData[index]['openOD'] = false
        this.state.leftData[index]['ODtext'] = 'OD'
      } else if (name == 'OS') {
        this.state.leftData[index]['openOS'] = false
        this.state.leftData[index]['OStext'] = 'OS'
      } else if (name == 'ODIOP') {
        this.state.leftData[index]['openODIOP'] = false
        this.state.leftData[index]['ODIOPtext'] = 'ODIOP'
      } else if (name == 'OSIOP') {
        this.state.leftData[index]['openOSIOP'] = false
        this.state.leftData[index]['OSIOPtext'] = 'OSIOP'
      } else if (name == 'ODOstiole') {
        this.state.leftData[index]['openODOstiole'] = false
        this.state.leftData[index]['ODOstioletext'] = 'ODOstiole'
      } else if (name == 'OSOstiole') {
        this.state.leftData[index]['openOSOstiole'] = false
        this.state.leftData[index]['OSOstioletext'] = 'OSOstiole'
      } else if (name == 'ODWearGlasses') {
        this.state.leftData[index]['openODWearGlasses'] = false
        this.state.leftData[index]['ODWearGlassestext'] = 'ODWearGlasses'
      } else if (name == 'OSWearGlasses') {
        this.state.leftData[index]['openOSWearGlasses'] = false
        this.state.leftData[index]['OSWearGlassestext'] = 'OSWearGlasses'
      } else if (name == 'OD Vision in') {
        this.state.leftData[index]['openODVisionIn'] = false
        this.state.leftData[index]['ODVisionIntext'] = 'ODVisionIn'
      } else if (name == 'OS Vision in') {
        this.state.leftData[index]['openOSVisionIn'] = false
        this.state.leftData[index]['OSVisionIntext'] = 'OSVisionIn'
      } else if (name == 'OD Near vision') {
        this.state.leftData[index]['openODNearVision'] = false
        this.state.leftData[index]['ODNearVisiontext'] = 'ODNearVision'
      } else if (name == 'OS Near vision') {
        this.state.leftData[index]['openOSNearVision'] = false
        this.state.leftData[index]['OSNearVisiontext'] = 'OSNearVision'
      } else if (name == 'OD Spheric mirror' || name == 'OD Cylindrical mirror' || name == 'OD Axial position' || name == 'OS Spheric mirror' || name == 'OS Cylindrical mirror' || name == 'OS Axial position') {
        this.state.leftData[index]['open' + name] = false
        this.state.leftData[index][name + 'text'] = name;
      }
      this.setState({})
    }

    handleOnKeyDown(data, index, fieldID, name, e) {
      //, () => { this.handleKeyDownMessage(data) }
      if (e.keyCode == '13') {
        if (name == 'OD') {
          // this.OSfocus.current && this.OSfocus.current.focus()
          this.state.leftData[index]['ODtext'] = 'OD'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OS') {
          // this.ODOstiolefocus.current && this.ODOstiolefocus.current.focus()
          this.state.leftData[index]['OStext'] = 'OS'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'ODIOP') {
          // this.OSIOPfocus.current && this.OSIOPfocus.current.focus()
          this.state.leftData[index]['ODIOPtext'] = 'ODIOP'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OSIOP') {
          // this.OperPopfocus.current && this.OperPopfocus.current.focus()
          this.state.leftData[index]['OSIOPtext'] = 'OSIOP'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'ODOstiole') {
          // this.OSOstiolefocus.current && this.OSOstiolefocus.current.focus()
          this.state.leftData[index]['ODOstioletext'] = 'ODOstiole'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OSOstiole') {
          // this.ODWearGlassesfocus.current && this.ODWearGlassesfocus.current.focus()
          this.state.leftData[index]['OSOstioletext'] = 'OSOstiole'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'ODWearGlasses') {
          // this.OSWearGlassesfocus.current && this.OSWearGlassesfocus.current.focus()
          this.state.leftData[index]['ODWearGlassestext'] = 'ODWearGlasses'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OSWearGlasses') {
          // this.ODIOPfocus.current && this.ODIOPfocus.current.focus()
          this.state.leftData[index]['OSWearGlassestext'] = 'OSWearGlasses'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OperPop') { // 手术人群
          // this.Motivationfocus.current && this.Motivationfocus.current.focus()
          this.state.leftData[index]['OperPoptext'] = 'OperPop'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'Motivation') { // 手术动机
          this.state.leftData[index]['Motivationtext'] = 'Motivation'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'SubjectiveReson') { // 未检查原因（主观）
          this.state.leftData[index]['SubjectiveResontext'] = 'SubjectiveReson'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'ObjectiveReson') { // 未检查原因（客观）
          this.state.leftData[index]['ObjectiveResontext'] = 'ObjectiveReson'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OD Vision in') { // OD中视力
          // this.OSVisionInfocus.current && this.OSVisionInfocus.current.focus()
          this.state.leftData[index]['ODVisionIntext'] = 'ODVisionIn'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OS Vision in') { // OS中视力
          // this.ODNearVisionfocus.current && this.ODNearVisionfocus.current.focus()
          this.state.leftData[index]['OSVisionIntext'] = 'OSVisionIn'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OD Near vision') { // OD近视力
          // this.OSNearVisionfocus.current && this.OSNearVisionfocus.current.focus()
          this.state.leftData[index]['ODNearVisiontext'] = 'ODNearVision'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OS Near vision') { // OS近视力
          // this.OSNearVisionfocus.current && this.OSNearVisionfocus.current.focus()
          this.state.leftData[index]['OSNearVisiontext'] = 'OSNearVision'
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        } else if (name == 'OD Spheric mirror' || name == 'OD Cylindrical mirror' || name == 'OD Axial position' || name == 'OS Spheric mirror' || name == 'OS Cylindrical mirror' || name == 'OS Axial position') {
          this.state.leftData[index][name + 'text'] = name;
          this.setState({ fieldData: [{ fieldID: fieldID, value: data[name] }] })
        }
        let nextDataIndex = this.getNextDataIndex(name);
        nextDataIndex && this[nextDataIndex + 'focus'] && this[nextDataIndex + 'focus']?.current?.focus();
      }
    }

    // 获取下一个可跳转的输入域
    getNextDataIndex = (name) => {
      const { column } = this.state;
      console.log('column', column, name)
      let nextDataIndex = '';
      function nextFocus(dataIndex) {
        for (let i = 0; i < column.length; i++) {
          if (column[i].dataIndex === dataIndex) {
            if (i < column.length - 1) {
              if (column[i + 1].focusFlag !== 'N') {
                nextDataIndex = column[i + 1].dataIndex;
              } else {
                nextFocus(column[i + 1].dataIndex);
              }
              break;
            }
          }
        }
      }
      nextFocus(name);
      if (nextDataIndex === 'OD Vision in') {
        nextDataIndex = 'ODVisionIn'
      } else if (nextDataIndex === 'OS Vision in') {
        nextDataIndex = 'OSVisionIn'
      } else if (nextDataIndex === 'OD Near vision') {
        nextDataIndex = 'ODNearVision'
      } else if (nextDataIndex === 'OS Near vision') {
        nextDataIndex = 'OSNearVision'
      }
      return nextDataIndex;
    }

    handleKeyDownMessage(data) {
      var params = {
        params: [{
          hospID: this.state.userData.hospID,
          userID: this.state.userData.userID,
          admID: data.admID,
          fieldData: this.state.fieldData
        }]
      }
      $http.post('urlDeault', this, {
        code: "03050270",
        data: params,
        success: function (res) {
          if (res.errorCode == '0') {
            message.success('保存成功！')
            this.initData()
          }
        }
      });
    }

    handleChangeMessage(data, index, fieldID, name, flag, e) {
      this.state.leftData[index][name] = e
      this.setState({})
    }

    //选择后，保存
    handleSelectChange(data, index, fieldID, name, flag, e) {
      this.state.leftData[index][name] = e
      this.setState({
        fieldData: [{
          fieldID: fieldID,
          value: e,
        }]
      }, () => {
        var params = {
          params: [{
            hospID: this.state.userData.hospID,
            userID: this.state.userData.userID,
            admID: data.admID,
            fieldData: this.state.fieldData
          }]
        }
        $http.post('urlS', this, {
          code: '03050270',
          data: params,
          success: function (res) {
            if (res.errorCode == '0') {
              message.success('保存成功！')
              if (name == 'OD') {
                // this.OSfocus.current.focus()
                this.state.leftData[index]['ODtext'] = 'OD'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OS') {
                // this.ODIOPfocus.current.focus()
                // this.ODOstiolefocus.current.focus()
                this.state.leftData[index]['OStext'] = 'OS'
                this.setState({}, () => { this.initData() })
              } else if (name == 'ODIOP') {//OD眼压
                // this.OSIOPfocus.current.focus()
                this.state.leftData[index]['ODIOPtext'] = 'ODIOP'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OSIOP') {//OS眼压
                // this.ODOstiolefocus.current.focus()
                this.state.leftData[index]['OSIOPtext'] = 'OSIOP'
                this.getList(1)
                this.getBlock()
                this.setState({}, () => { this.initData() })
              } else if (name == 'ODOstiole') {//OD小孔
                // this.OSOstiolefocus.current.focus()
                this.state.leftData[index]['ODOstioletext'] = 'ODOstiole'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OSOstiole') {//OS小孔
                // this.ODWearGlassesfocus.current.focus()
                this.state.leftData[index]['OSOstioletext'] = 'OSOstiole'
                this.setState({}, () => { this.initData() })
              } else if (name == 'ODWearGlasses') {//OD戴镜
                // this.OSWearGlassesfocus.current.focus()
                this.state.leftData[index]['ODWearGlassestext'] = 'ODWearGlasses'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OSWearGlasses') {//OS戴镜
                // this.ODIOPfocus.current.focus()
                this.state.leftData[index]['OSWearGlassestext'] = 'OSWearGlasses'
                this.setState({}, () => { this.initData() })
                // this.getList(1)
                // this.getBlock()
              } else if (name == 'OperPop') { // 手术人群
                // this.OperPopfocus.current.focus()
                this.state.leftData[index]['OperPoptext'] = 'OperPop'
                this.setState({}, () => { this.initData() })
              } else if (name == 'Motivation') { // 手术动机
                // this.Motivationfocus.current.focus()
                this.state.leftData[index]['Motivationtext'] = 'Motivation'
                this.setState({}, () => { this.initData() })
              } else if (name == 'SubjectiveReson') { // 检查未约原因(主观)	
                // this.Motivationfocus.current.focus()
                this.state.leftData[index]['SubjectiveResontext'] = 'SubjectiveReson'
                this.setState({}, () => { this.initData() })
              } else if (name == 'ObjectiveReson') { // 检查未约原因(客观)	
                // this.Motivationfocus.current.focus()
                this.state.leftData[index]['ObjectiveResontext'] = 'ObjectiveReson'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OD Vision in') { // OD中视力
                // this.ODVisionInfocus.current.focus()
                this.state.leftData[index]['ODVisionIntext'] = 'ODVisionIn'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OS Vision in') { // OS中视力
                // this.OSVisionInfocus.current.focus()
                this.state.leftData[index]['OSVisionIntext'] = 'OSVisionIn'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OD Near vision') { // OD近视力
                // this.ODNearVisionfocus.current.focus()
                this.state.leftData[index]['ODNearVisiontext'] = 'ODNearVision'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OS Near vision') { // OS近视力
                // this.OSNearVisionfocus.current.focus()
                this.state.leftData[index]['OSNearVisiontext'] = 'OSNearVision'
                this.setState({}, () => { this.initData() })
              } else if (name == 'OD Spheric mirror' || name == 'OD Cylindrical mirror' || name == 'OD Axial position' || name == 'OS Spheric mirror' || name == 'OS Cylindrical mirror' || name == 'OS Axial position') {
                // this[name + 'focus'] && this[name + 'focus'].current.focus()
                this.state.leftData[index][name + 'text'] = name;
              }
              let nextDataIndex = this.getNextDataIndex(name);
              nextDataIndex && this[nextDataIndex + 'focus'] && this[nextDataIndex + 'focus']?.current?.focus();
            }
          }
        })
      })
      this.setState({})
    }

    //点击行，聚焦点击的当前单元格
    handleCheckEditMessage(data, index, text, name, source, e) {
      // this.state.leftData[index][source] = undefined
      // this.state.leftData[index]['ODtext'] = undefined
      // this.state.leftData[index]['OStext'] = undefined
      // this.state.leftData[index]['ODIOPtext'] = undefined
      // this.state.leftData[index]['OSIOPtext'] = undefined
      // this.state.leftData[index]['ODOstioletext'] = undefined
      // this.state.leftData[index]['OSOstioletext'] = undefined
      // this.state.leftData[index]['ODWearGlassestext'] = undefined
      // this.state.leftData[index]['OSWearGlassestext'] = undefined
      this.setState({
        linkIndex: index
      }, () => {
        if (data.ID == this.state.rowId) {
          this.state.leftData[index]['editAble'] = true
        } else {
          this.state.leftData[index]['editAble'] = false
        }
        // var { leftData } = this.state;
        // if (!Util.isEmpty(leftData)) {
        //   for (var i = 0; i < leftData.length; i++) {
        //     if (index == i) {
        //       this.state.leftData[i]['editAble'] = true
        //     } else {
        //       this.state.leftData[i]['editAble'] = false
        //     }
        //   }
        // }
        setTimeout(() => {
          this[`${name}`] && this[`${name}`].current && this[`${name}`].current.focus()
        }, 100)
      })
    }

    //获取诊区所有科室
    getAllLoc = () => {
      let data = {}
      data = {
        params: [{
          locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""
          // locID: "426"//内科分诊区          
        }],
      }
      $http.post('urlS', this, {
        code: '03050095',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            this.setState({
              allLocArr: res.result
            })
          }

        },
        error: function () {
        }
      })
    }

    //获取诊区的全部分诊病人
    handleAll = () => {

    }

    //切换诊区科室
    handleLoc = (id) => {
      if (id) {
        if (this.state.locID === "") {
          this.setState({
            locID: id,
            rightDocID: "",
            rightLocID: ""
          }, () => {
            this.getList()
            this.getBlock()
            this.getRightDoc()
            // this.handleRightDoc()
          });
        } else {
          if (this.state.locID !== id) {
            this.setState({
              locID: id,
              rightDocID: "",
              rightLocID: ""
            }, () => {
              this.getList()
              this.getBlock()
              this.getRightDoc()
              // this.handleRightDoc()
            });
          } else {
            // this.setState({
            //   locID: "",
            // }, () => {
            //   this.getList()
            //   this.getBlock()
            // });
          }
        }
      }
    }

    //切换小页签
    handleBlock = (id) => {
      if (id) {
        if (this.state.statusCode === "") {
          this.setState({
            statusCode: id,
          }, () => {
            this.getList()
          });
        } else {
          if (this.state.statusCode !== id) {
            this.setState({
              statusCode: id,
            }, () => {
              this.getList()
            });
          } else {
            // this.setState({
            //   statusCode: "",
            // }, () => {
            //   this.getList()
            // });
          }
        }
      }
    }

    //获取小页签
    getBlock = () => {
      let data = {}
      data = {
        params: [{
          locID: this.state.locID || (sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""),
          timeRangeID: this.state.timeRangeId,
          docRangeID: this.state.docRangeId
          // locID: "426",//内科分诊区        
          // areaLocID: this.state.locID || ""
        }],
      }
      $http.post('urlS', this, {
        code: '03050105',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            this.setState({
              blockArr: res.result
            })
          }

        },
        error: function () {
        }
      })
    }

    //右侧获取诊室
    getRightLoc = () => {
      let data = {}
      data = {
        params: [{
          locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""
          // locID: "426"//内科分诊区          
        }],
      }
      $http.post('urlS', this, {
        code: '03050097',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            this.setState({
              locArr: res.result
            })
          }

        },
        error: function () {
        }
      })
    }

    //右侧获取排班医生
    getRightDoc = () => {
      let data = {}
      data = {
        params: [{
          locID: this.state.locID && this.state.locID ? this.state.locID : (sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "")
          // locID: "426"//内科分诊区          
        }],
      }
      $http.post('urlS', this, {
        code: '03050101',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0) {
            this.setState({
              docArr: res.result
            })
            // console.log("res.result",res.result)
          }
        },
        error: function () {
        }
      })
    }

    //查排班医生接诊情况
    handleGetLocDoc = () => {
      const { rightLocID, rightDocID, } = this.state
      this.getRightDocList(rightLocID, rightDocID)
    }

    //右下医生接诊信息
    getRightBottomDocList = (docID) => {
      let data = {}
      data = {
        params: [{
          locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "",
          // locID: "426",
          doctorID: docID || ""
        }],
      }
      $http.post('urlS', this, {
        code: '03050103',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            this.setState({
              rightBottomData: res.result
            })
          }

        },
        error: function () {
        }
      })
    }

    //右侧选择诊室
    handleRightLoc = (id) => {
      if (id) {
        this.setState({
          rightLocID: id,
        })
      } else {
        this.setState({
          rightLocID: ""
        })
      }
    }

    //右侧选择医生
    handleRightDoc = (id) => {
      if (id) {
        this.setState({
          rightDocID: id,
        })
      } else {
        this.setState({
          rightDocID: ""
        })
      }
    }

    //点击查询 左侧
    handleGetList = (e) => {
      this.getList()
    }

    handleChangeSelect(name, e) {
      this.setState({
        [name]: e
      }, () => {
        this.getBlock()
        this.getList()
      })
    }

    //默认获取诊区所有病人
    getKeyDownList(e) {
      // console.log("locID",this.state.locID)
      if (e.keyCode == '13') {
        let data = {}
        data = {
          params: [{
            locID: this.state.locID || (sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""),
            // arealocID: this.state.locID || "",//诊室科室ID
            statusCode: this.state.statusCode == "ALL" ? "" : this.state.statusCode,//小页签标识
            cardType: this.props.form.getFieldValue("cardTypeID") || "",//卡类型
            cardNo: this.props.form.getFieldValue("cardNo") || "",//卡号
            inputValue: this.props.form.getFieldValue("patInfo") || "",//输入框 病人信息
            timeRangeID: this.state.timeRangeId
          }],
        }
        $http.post('urlS', this, {
          code: '03050096',
          // code: "05100263",
          data: data,
          success: function (res) {
            if (+res.errorCode === 0 && res.result) {
              this.setState({
                leftData: res.result,
                rowId: !Util.isEmpty(res.result) ? res.result[0].ID : '',
                admID: !Util.isEmpty(res.result) ? res.result[0].admID : '',
                assessID: !Util.isEmpty(res.result) ? res.result[0].admID : '',
                regLocId: !Util.isEmpty(res.result) ? res.result[0].locID : '',
                // rightLocID:!Util.isEmpty(res.result) ? res.result[0].admLocID : '',
                regId: !Util.isEmpty(res.result) ? res.result[0].docID : '',
              }, () => {
                this.getRightDocList()
                this.getBlock()
              })
              // this.updateAll()
            }
          },
          error: function () {
          }
        })
      }
    }

    //右侧获取排班医生接诊信息
    getRightDocList = (rightLocID, rightDocID,) => {
      let data = {}
      data = {
        params: [{
          locID: this.state.locID || (sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""),
          // locID: "426",//内科分诊区         
          admLocID: this.state.regLocId || "",
          roomID: rightLocID || "",
          doctorID: rightDocID || "",
          regDoctorID: this.state.regId || ""
        }],
      }
      $http.post('urlS', this, {
        code: '03050102',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            this.setState({
              docName: "",
              rightTopRowId: "",
              rightBottomData: [],
              rightTopData: res.result
            })
          }
        },
        error: function () {
        }
      })
    }

    //默认获取诊区所有病人
    getList = (e) => {
      this.setState({ loading: true });
      let data = {
        params: [{
          locID: this.state.locID || (sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""),
          // arealocID: this.state.locID || "",//诊室科室ID
          statusCode: this.state.statusCode == "ALL" ? "" : this.state.statusCode,//小页签标识
          cardType: this.props.form.getFieldValue("cardTypeID") || "",//卡类型
          cardNo: this.props.form.getFieldValue("cardNo") || "",//卡号
          inputValue: this.props.form.getFieldValue("patInfo") || "",//输入框 病人信息
          timeRangeID: this.state.timeRangeId,
          docRangeID: this.state.docRangeId
        }],
      }
      $http.post('urlS', this, {
        code: '03050096',
        // code: "05100263",
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            this.setState({
              loading: false,
              leftData: res.result,
              // rowId: e == '1' ? (!Util.isEmpty(res.result) ? res.result[0].ID : '') : '',
              // admID: e == '1' ? (!Util.isEmpty(res.result) ? res.result[0].admID : '') : '',
            }, () => {
              this.getRightDocList()
            })
            // this.updateAll()
          } else {
            this.setState({ loading: false });
          }
        },
        error: function () {
          this.setState({ loading: false });
        }
      })
    }

    //点击Row 左侧表格  分诊病人列表
    onClickRow = (record, index) => {
      return {
        onClick: () => {
          // var { leftData } = this.state;
          // if (!Util.isEmpty(leftData)) {
          //   for (var i = 0; i < leftData.length; i++) {
          //     if (index == i) {
          //       this.state.leftData[i]['editAble'] = true
          //     } else {
          //       this.state.leftData[i]['editAble'] = false
          //     }
          //   }
          // }ODtext OStext ODIOPtext OSIOPtext ODOstioletext OSOstioletext ODWearGlassestext OSWearGlassestext
          var source = this.state.leftData;
          var dataSource = []
          if (!Util.isEmpty(source)) {
            for (var i = 0; i < source.length; i++) {
              if (source[i].ID !== record.ID) {
                source[i]['editAble'] = false
                // source[i]['ODtext'] = 'OD'
                // source[i]['OStext'] = 'OS'
                // source[i]['ODIOPtext'] = 'ODIOP'
                // source[i]['OSIOPtext'] = 'OSIOP'
                // source[i]['ODOstioletext'] = 'ODOstiole'
                // source[i]['OSOstioletext'] = 'OSOstiole'
                // source[i]['ODWearGlassestext'] = 'ODWearGlasses'
                // source[i]['OSWearGlassestext'] = 'OSWearGlasses'
                // // dataSource.push()
                this.state.leftData[i]['openOD'] = false
                this.state.leftData[i]['openOS'] = false
                this.state.leftData[i]['openODIOP'] = false
                this.state.leftData[i]['openOSIOP'] = false
                this.state.leftData[i]['openODOstiole'] = false
                this.state.leftData[i]['openOSOstiole'] = false
                this.state.leftData[i]['openODWearGlasses'] = false
                this.state.leftData[i]['openOSWearGlasses'] = false
                this.state.leftData[i]['openODVisionIn'] = false
                this.state.leftData[i]['openOSVisionIn'] = false
                this.state.leftData[i]['openODNearVision'] = false
                this.state.leftData[i]['openOSNearVision'] = false
              }
            }
          }
          if (record.ID) {
            // if (this.state.rowId === "") {
            this.setState({
              regId: record.docID,
              rowId: record.ID,
              regLocId: record.locID,
              admID: record.admID,
              assessID: record.admID,
            }, () => {
              this.getRightDocList()
            });
            // }
            //  else {
            //   if (this.state.rowId !== record.ID) {
            //     this.setState({
            //       regId: record.docID,
            //       rowId: record.ID,
            //       regLocId: record.locID,
            //       admID: record.admID,
            //       assessID: record.admID,
            //     }, () => {
            //       this.getRightDocList()
            //     });
            //   } else {
            //     this.setState({
            //       rowId: "",
            //       regId: "",
            //       regLocId: "",
            //       // admID: '',
            //       assessID: '',
            //     }, () => {
            //       this.getRightDocList()
            //     });
            //   }
            // }
          }
        },
        onDoubleClick: () => {
          this.setState({
            rowId: "",
          });
        }
      }
    }

    //设置点击row颜色 --左侧表格
    setRowClassName = (record) => {
      if (record.ID == this.state.rowId) {
        return 'clickRowStyle'
      } else if (record.statusCode == 'R') {
        return 'clickGreen'
      } else if (record.statusCode == 'TA') {
        return 'clckBlue'
      }
      // return record.ID == this.state.rowId ? 'clickRowStyle' : '';
    }

    //点击Row 右上表格  科室医生接诊情况
    onClickRightTopRow = (record) => {
      return {
        onClick: () => {
          if (record.ID) {
            if (this.state.rightTopRowId === "") {
              this.setState({
                rightTopRowId: record.ID,
                docName: record.doctorDesc,
                docId: record.doctorID
              });
              this.getRightBottomDocList(record.doctorID)

            } else {
              if (this.state.rightTopRowId !== record.ID) {
                this.setState({
                  rightTopRowId: record.ID,
                  docName: record.doctorDesc,
                  docId: record.doctorID
                });
                this.getRightBottomDocList(record.doctorID)
              } else {
                this.setState({
                  rightTopRowId: "",
                  docName: "",
                  rightBottomData: []
                });
              }
            }

          }
        },
        onDoubleClick: () => {
          this.setState({
            rightTopRowId: "",
          });
        }
      }
    }

    //设置点击row颜色 --右上表格
    setRightTopRowClassName = (record) => {
      return record.ID === this.state.rightTopRowId ? 'clickRowStyle' : '';
    }

    //点击Row 右下表格  科室医生接诊情况
    onClickRightBottomRow = (record) => {
      return {
        onClick: () => {
          if (record.listPatID) {
            if (this.state.rightBottomRowId === "") {
              this.setState({
                rightBottomRowId: record.listPatID,
              });
            } else {
              if (this.state.rightBottomRowId !== record.listPatID) {
                this.setState({
                  rightBottomRowId: record.listPatID,
                });
              } else {
                this.setState({
                  rightBottomRowId: "",
                });
              }
            }

          }
        },
        onDoubleClick: () => {
          this.setState({
            rightBottomRowId: "",
          });
        }
      }
    }

    //设置点击row颜色 --右上表格
    setRightBottomRowClassName = (record) => {
      return record.listPatID === this.state.rightBottomRowId ? 'clickRowStyle' : '';
    }

    //确认分配 等
    handleOk = () => {
      let data = {}
      data = {
        params: [{
          locID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : ""
          // locID: "426"//内科分诊区          
        }],
      }
      $http.post('urlS', this, {
        code: '03050097',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0 && res.result) {
            this.setState({
              // locArr: res.result
            })
          }

        },
        error: function () {
        }
      })
    }

    //分配医生 过号重排 复诊 优先 报到
    edit = (name) => {
      const { rowId, rightTopRowId } = this.state
      switch (name) {
        case 1:
          if (!rowId) {
            message.warning("请选择左侧分诊病人", this.state.userData && this.state.userData.messageTime)
          } else if (!rightTopRowId) {
            message.warning("请选择右侧科室医生", this.state.userData && this.state.userData.messageTime)
          } else {
            let data = {}
            data = {
              params: [{
                regQueID: String(this.state.rowId) || "",//
                doctorID: this.state.docId || "",
                userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : ""
              }],
            }
            $http.post('urlS', this, {
              code: '03050104',
              data: data,
              success: function (res) {
                if (+res.errorCode === 0) {
                  message.success("分配成功", this.state.userData && this.state.userData.messageTime)
                  // this.getUpdateInfo()

                  this.getRightBottomDocList(this.state.docId)
                }

              },
              error: function () {
              }
            })
          }
          break;
        case 2:
          if (!rowId) {
            message.warning("请选择左侧分诊病人", this.state.userData && this.state.userData.messageTime)
          } else {
            let data = {}
            data = {
              params: [{
                regQueID: String(this.state.rowId) || "",
                userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : ""
              }],
            }
            $http.post('urlS', this, {
              code: '03050106',
              data: data,
              success: function (res) {
                if (+res.errorCode === 0) {
                  message.success("重排成功", this.state.userData && this.state.userData.messageTime)
                  this.getUpdateInfo()
                }

              },
              error: function () {
              }
            })
          }

          break;
        case 3:
          if (!rowId) {
            message.warning("请选择左侧分诊病人", this.state.userData && this.state.userData.messageTime)
          } else {
            let data = {}
            data = {
              params: [{
                regQueID: String(this.state.rowId) || "",
                userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : ""
              }],
            }
            $http.post('urlS', this, {
              code: '03040015',
              data: data,
              success: function (res) {
                if (+res.errorCode === 0) {
                  message.success("复诊成功", this.state.userData && this.state.userData.messageTime)
                  this.getUpdateInfo()
                }

              },
              error: function () {
              }
            })
          }
          break;
        case 4:
          if (!rowId) {
            message.warning("请选择左侧分诊病人", this.state.userData && this.state.userData.messageTime)
          } else {
            let data = {}
            data = {
              params: [{
                regQueID: String(this.state.rowId) || "",
                userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : ""
              }],
            }
            $http.post('urlS', this, {
              code: '03040014',
              data: data,
              success: function (res) {
                if (+res.errorCode === 0) {
                  message.success("已设为优先", this.state.userData && this.state.userData.messageTime)
                  this.getUpdateInfo()
                }

              },
              error: function () {
              }
            })
          }
          break;
        case 5:
          if (!rowId) {
            message.warning("请选择左侧分诊病人", this.state.userData && this.state.userData.messageTime)
          } else {
            let data = {}
            data = {
              params: [{
                regQueID: String(this.state.rowId) || "",
                userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : ""
              }],
            }
            $http.post('urlS', this, {
              code: '03050133',
              data: data,
              success: function (res) {
                if (+res.errorCode === 0) {
                  message.success("报到成功", this.state.userData && this.state.userData.messageTime)
                  this.setState({
                    patInfo: undefined
                  }, () => {
                    this.props.form.resetFields();
                    this.input.focus()
                    this.getUpdateInfo()
                    this.getBlock()
                  })
                }

              },
              error: function () {
              }
            })
          }
          break;
        default:
      }
    }

    //选择建卡类型
    handleCred = (data) => {
      // console.log("data",data)
      const { cardTypeArr } = this.state
      this.props.form.setFieldsValue({ cardNo: undefined })
      for (var i = 0; i < cardTypeArr.length; i++) {
        if (data == cardTypeArr[i].id) {
          this.setState({
            initCardDr: cardTypeArr[i].id,
            nowRead: cardTypeArr[i].readMode,
            idCardCode: cardTypeArr[i].code,
            cardLength: cardTypeArr[i].cardLength && cardTypeArr[i].cardLength != "" ? cardTypeArr[i].cardLength + "位," : "",
            replenishZero: cardTypeArr[i].replenishZero,
            repariFeeFlag: cardTypeArr[i].repariFeeFlag,
            nowCost: cardTypeArr[i].cardCost,
            nowInv: cardTypeArr[i].invFlag,
          })
        }
      }
    }

    //选择建卡类型 格式验证
    validFunction = (rule, value, callback) => {
      //身份证 18位  就诊卡 银医卡 条形码 根据配置合理提示 不根据固定的卡类型做判断 根据配置项是否可补0以及卡号长度进行检测 区分身份证 code == 12
      const { cardLength, cardLengthCard, idCardCode, idCardCodePop, replenishZero, popCardVis, } = this.state
      //控制选择建卡和卡操作选择绑卡id 正确提示 及 校验
      let diffLength = cardLength
      let diffCode = idCardCode
      if (diffCode == '12') {
        var city = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江 ", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北 ", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏 ", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外 " };
        if (!value || !/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(value)) {
          this.setState({
            bindVail: true
          })
          callback('身份证号格式错误'); // 校验未通过
          return;
        }

        else if (!city[value.substr(0, 2)]) {
          this.setState({
            bindVail: true
          })
          callback('身份证号格式错误'); // 校验未通过
          return;
        }
        else {
          //18位身份证需要验证最后一位校验位
          if (value.length == 18) {
            value = value.split('');
            //∑(ai×Wi)(mod 11)
            //加权因子
            var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
            //校验位
            var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2];
            var sum = 0;
            var ai = 0;
            var wi = 0;
            for (var i = 0; i < 17; i++) {
              ai = value[i];
              wi = factor[i];
              sum += ai * wi;
            }
            var last = parity[sum % 11];
            //最后一位不区分大小写
            if (value[17] == 'x') value[17] = value[17].toUpperCase();
            if (parity[sum % 11] != value[17]) {
              this.setState({
                bindVail: true
              })
              callback('身份证号格式错误'); // 校验未通过
              return;
            } else {
              this.checkIs()
              // this.setState({
              //   bindVail:false
              // })
            }
          }
        }
        callback();
      }
      if (replenishZero == "N" && parseInt(diffLength) > 0) {
        let length = parseInt(diffLength)
        var reg = new RegExp('^\\d{' + length + '}$')
        if (!reg.test(value)) {
          this.setState({
            bindVail: true
          })
          callback('该卡号长度不正确，请输入有效卡号'); // 校验未通过
          return;
        } else {
          this.checkIs()
        }
      }
      if (replenishZero == "Y" && parseInt(diffLength) > 0) {
        let length = parseInt(diffLength)
        var reg = new RegExp("^\\d{" + length + "}$");
        if (!reg.test(value)) {
          this.setState({
            bindVail: true
          })
          callback('该卡号无效，请输入有效卡号,数字可自动补0'); // 校验未通过
          return;
        } else {
          this.checkIs()
          // this.setState({
          //   bindVail:false
          // })
        }
      }
      if (replenishZero == "N" && !parseInt(diffLength) > 0) {
        if (!/^[0-9]*$/.test(value)) {
          this.setState({
            bindVail: true
          })
          callback('请输入任意数字'); // 校验未通过
          return;
        } else {
          if (value.length != 0) {
            this.checkIs()
          } else {
            this.setState({
              bindVail: true
            })
          }
        }
      }
      callback();
    }

    handleKeydownM = () => {
      //进行卡号检测补0操作
      if (this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length == 0) {
        this.setState({
          cardNoVisible: false
        })
        return
      } else {
        //补0 Y 长度不为0
        if (this.state.replenishZero == "Y" && parseInt(this.state.cardLength) && parseInt(this.state.cardLength) > 0 && this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length > 0) {
          let No = this.props.form.getFieldValue('cardNo') ? this.props.form.getFieldValue('cardNo') : ''
          let length = parseInt(this.state.cardLength)
          let num = (Array(length).join(0) + No).slice(-length)
          this.props.form.setFieldsValue({ cardNo: num });
          this.setState({
            cardNoVisible: false,
          })
          this.getList()
        }
      }
      this.cardTip()
    }

    //建卡卡号
    cardTip = () => {
      this.props.form.validateFields(['cardNo',], (errors, values) => {
        if (!errors) {
          this.setState({
            cardNoVisible: false
          })
        } else {
          this.setState({
            cardNoVisible: true,
            cardNoMessage: errors.cardNo.errors[0].message,
          })
          setTimeout(() => {
            this.setState({
              cardNoVisible: false
            })
          }, 1500)
        }
      });
    }

    //获取卡类型
    getCard = () => {
      let data = {}
      data = {
        params: [{
          cardTypeFlag: 1,//卡类型
        }]
      }
      $http.post('urlS', this, {
        code: '03030005',
        data: data,
        success: function (res) {
          if (+res.errorCode === 0) {
            this.setState({
              cardTypeArr: res.cardType,
              nurseTriageTimedRefresh: res?.nurseTriageTimedRefresh || ''
            }, () => {
              this.handleIimedCallTableData();
            });
          }
        }
      })
    }

    // 定时调用列表数据
    handleIimedCallTableData = () => {
      const { nurseTriageTimedRefresh } = this.state;
      if (!this.timer && nurseTriageTimedRefresh) {
        console.log('触发了定时器')
        this.timer = setInterval(() => {
          this.getList();
        }, parseInt(nurseTriageTimedRefresh) * 1000);
      }
    }

    //点击读卡
    handleCardReading = () => {
      this.props.form.resetFields();
      const { initCardDr } = this.state
      this.readCard.ReadCard(initCardDr, "R", (json) => {
        // console.log(json)
        //读卡完成 信息回显
        this.props.form.setFieldsValue({ cardNo: json.cardNo, cardTypeID: json.cardTypeID })
        this.setState({
          initCardDr: json.cardTypeID,
          cardNoVisible: false
        }, () => {
          setTimeout(() => {
            this.getList()//读卡成功 直接搜索
          }, 300);
        })
      })
    }

    handlePlease = (v) => {
      if (!v) {
        this.setState({
          nowRead: "",
          replenishZero: "",
        })
      }
    }

    //填写评估单
    handleAssessmentSheet(data, e) {
      e.stopPropagation()
      this.setState({
        isShowAssessmentModal: true,
        assessID: data.admID,
        rowId: data.ID,
        admID: data.admID
      })
    }

    hideModal(name) {
      this.props.form.setFieldsValue({ patInfo: undefined })
      this.setState({
        [name]: false,
        patInfo: undefined
      }, () => {
        this.input.focus()
        this.getList(1)
        this.getBlock()
      })
    }

    //人脸识别
    handleShowFaceRecognition() {
      this.setState({
        isShowFaceRecognitionModal: true
      }, () => {
        var { clearData } = this.props;
        clearData && clearData()
      })
    }

    loadCallBackMsg(data) {
      this.props.form.setFieldsValue({ patInfo: data })
      this.setState({
        number: data
      }, () => {
        this.getList()
      })
    }

    onRef = ref => {
      this.onFace = ref
    }

    //转诊
    handleReferralModal() {
      this.setState({
        isShowReferralModal: true
      })
    }

    //提交转诊
    handleSubmitReferral(data) {
      var params = {
        params: [{
          admID: this.state.admID,
          admLocID: data.locID,
          admDocID: data.docID,
          workID: data.resDetailID,
          userID: this.state.userData.userID,
          queID: this.state.rowId,
        }]
      }
      $http.post('urlDeault', this, {
        code: "03040042",
        data: params,
        success: function (res) {
          if (res.errorCode == '0') {
            message.success('转诊成功！')
            this.hideModal('isShowReferralModal')
            this.getList()
          }
        }
      });
    }

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

    //动态配置是否必填
    setMessage(name, message) {
      return this.state.localeProvider && this.state.localeProvider[name] ? this.state.localeProvider[name][message] : ''
    }

    showDrawer = () => {
      this.setState({
        visible: true,
      });
    };

    onClose = () => {
      this.setState({
        visible: false,
      });
    };

    render() {
      const {
        form: { validateFields },
      } = this.props;
      const { getFieldDecorator } = this.props.form;
      let { locArr, docArr, allLocArr, locID, blockArr, cardTypeArr, initCardDr,
        nowRead,
        loading,
        cardLength,
        replenishZero,
        repariFeeFlag,
        nowCost,
        nowInv, rightLocArr } = this.state
      // const blockArr = [
      //   {
      //     id:"1",
      //   },
      // ]
      //卡类型
      let card = []
      cardTypeArr && cardTypeArr.map(item => {
        card.push(<Option key={item.id} onClick={() => this.handleCred(item.id)} value={String(item.id)} role={item.descripts + '^' + item.descriptsSPCode} title={item.readMode}>{item.descripts}</Option>)
      })
      //诊室
      let locOpt = []
      locArr && locArr.map(item => {
        locOpt.push(<Option key={item.id} onClick={() => this.handleRightLoc(item.id)} value={String(item.id)} role={item.descripts + '^' + item.descriptsSPCode} >{item.descripts}</Option>)
      })
      //医生
      let docOpt = []
      docArr && docArr.map(item => {
        docOpt.push(<Option key={item.id} onClick={() => this.handleRightDoc(item.id)} value={String(item.id)} role={item.descripts + '^' + item.descriptsSPCode} >{item.descripts}</Option>)
      })

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

      let doctorOption = []
      this.state.rightTopData && this.state.rightTopData.map((item, index) => {
        doctorOption.push(<Option key={index} value={item.doctorID}>{item.doctorDesc}</Option>)
      })

      //右上数据表
      const rightTopColumns = [
        {
          align: "center",
          title: '诊室',
          dataIndex: 'roomDesc',
          key: '1',
          width: 150,
        },
        {
          align: "center",
          width: 120,
          title: '医生',
          dataIndex: 'doctorDesc',
          key: '2',
          render: (text, record, index) => {
            return (
              <p style={{ margin: "0", textAlign: "left" }}><span style={{ color: "rgb(250, 173, 20)", marginRight: "8px", }}>
                {text}
              </span>
                <span style={{ background: (record.onLineStatus == "在线" ? "#1999db" : "#f5222d"), fontSize: "12px", color: "#fff", padding: "4px", borderRadius: "4px" }}>{record.onLineStatus}</span>
              </p>

            )
          }
        },
        {
          align: "center",
          width: 100,
          title: '等待接诊',
          dataIndex: 'BPatNum',
          key: '4',
          sorter: (a, b) => a.BPatNum - b.BPatNum,
          render: (text, record, index) => {
            return (
              <span style={{ color: "rgb(250, 173, 20)", fontWeight: "600" }}>
                {text}
              </span>
            )
          }
        },
        {
          align: "center",
          width: 120,
          title: '当前接诊序号',
          dataIndex: 'curSeqNo',
          key: '6',
          sorter: (a, b) => a.curSeqNo - b.curSeqNo,
        },
        {
          align: "center",
          width: 80,
          title: '已接诊',
          dataIndex: 'APatNum',
          key: '3',
          sorter: (a, b) => a.APatNum - b.APatNum,
        },
        {
          align: "center",
          width: 80,
          title: '总人数',
          dataIndex: 'totalPatNum',
          key: '5',
          sorter: (a, b) => a.totalPatNum - b.totalPatNum,

        },

      ];
      //右下数据表
      const rightBottomColumns = [
        {
          align: "center",
          title: '接诊序号',
          dataIndex: 'seqNo',
          key: '1',
          width: 160,
          render: (text, record, index) => {
            return (
              <p style={{ margin: "0" }}>
                <span style={{ display: (record.ifCurAdm && record.ifCurAdm ? "inline-block" : "none"), background: "#cb245b", color: "#fff", fontSize: "12px", padding: "4px", borderRadius: "4px" }}>{record.ifCurAdm}</span>
                <span style={{ color: "rgb(250, 173, 20)", marginLeft: "8px" }}>
                  {text}
                </span>
              </p>

            )
          }
        },
        {
          align: "center",
          width: 160,
          title: '病人ID',
          dataIndex: 'patNo',
          key: '2',
        },
        {
          align: "center",
          width: 100,
          title: '姓名',
          dataIndex: 'patName',
          key: '3',
        },
        {
          align: "center",
          width: 100,
          title: '性别',
          dataIndex: 'patSex',
          key: '4',
        },
        {
          align: "center",
          width: 100,
          title: '年龄',
          dataIndex: 'patAge',
          key: '5',

        },
        {
          align: "center",
          width: 160,
          title: '状态',
          dataIndex: 'status',
          key: '6',
        },
      ];
      const mesIcon = <Icon type="exclamation-circle" />
      return (
        <div className="frontDeskDom" style={{ overflow: 'hidden' }}>
          <ColumnAuthoritysModel
            clientWidth='800px'
            compontName="FrontDeskForTriage"
            configType="C"
            onRef={this.onColumnRef}
            reloadData={this.initData.bind(this)}
          />
          {/**评估单 */}
          {this.state.isShowAssessmentModal == true ? <ShowAssessmentModal assessID={this.state.assessID}
            isShow={this.state.isShowAssessmentModal}
            onHide={this.hideModal.bind(this, 'isShowAssessmentModal')}>
          </ShowAssessmentModal> : null}

          {/**人脸识别 */}
          <ShowFaceRecognitionModal isShow={this.state.isShowFaceRecognitionModal}
            businessCode='004' onRef={this.onRef}
            onSubmit={this.loadCallBackMsg.bind(this)}
            onHide={this.hideModal.bind(this, 'isShowFaceRecognitionModal')}>
          </ShowFaceRecognitionModal>

          {/** 转诊*/}
          {this.state.isShowReferralModal ? <ShowReferralModal isShow={this.state.isShowReferralModal}
            onHide={this.hideModal.bind(this, 'isShowReferralModal')}
            onSubmit={this.handleSubmitReferral.bind(this)}>
          </ShowReferralModal> : null}

          <Row style={{ padding: "10px 36px", position: "relative" }}>
            <Button style={{ borderRadius: "4px", cursor: "pointer", border: "1px solid #d9d9d9", marginRight: "2px", background: (locID == (sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "") ? "#40a9ff" : ""), color: (locID == (sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "") ? "#fff" : "#000000d9") }} span={2} onClick={() => this.handleLoc(sessionStorage.userData ? JSON.parse(sessionStorage.userData).locID : "")}>
              <span style={{ fontSize: "16px", marginRight: "4px" }}>全部</span>
              {/* <span style={{ fontSize: "14px" }}>待分诊：{item.waitPatNum}</span> */}
            </Button>
            {
              allLocArr && allLocArr.map((item, i) => {
                return (
                  <Button
                    key={i + 1}
                    style={{
                      borderRadius: "4px",
                      cursor: "pointer",
                      border: "1px solid #d9d9d9",
                      marginRight: "2px",
                      background: (locID == item.locID ? "#40a9ff" : ""),
                      color: (locID == item.locID ? "#fff" : "#000000d9")
                    }}
                    span={2}
                    onClick={() => this.handleLoc(item.locID)}
                  >
                    <span style={{ fontSize: "16px", marginRight: "4px" }}>{item.locDesc}</span>
                    {/* <span style={{ fontSize: "14px" }}>待分诊：{item.waitPatNum}</span> */}
                  </Button>
                )
              })
            }
            <span style={{ position: "absolute", right: "14px", top: "20px" }}>当前诊区：{sessionStorage.userData ? JSON.parse(sessionStorage.userData).locDesc : ""}</span>
          </Row>
          <Row>
            <Col span={24}>
              {/* <Card title="分诊列表(注:1、分配医生时，请先在左侧选择病人，然后在右侧选择医生，再点击'分配医生' 2、未呼叫的病人允许被重新分配医生)" bordered style={{ marginRight: "4px" }} className="frontListCard"> */}
              <Card className="frontListCard">
                <Form>
                  <Row gutter={24} >
                    <Col span={2} style={{ paddingRight: "0px" }}>
                      <FormItem wrapperCol={{ span: 23 }}>
                        {getFieldDecorator('cardTypeID', {
                          initialValue: undefined,
                          rules: [{ required: false, message: '' }],
                        })(
                          <Select placeholder="请选择卡类型" onChange={this.handlePlease} allowClear style={{ width: "100%" }} >
                            {card}
                          </Select>
                        )}
                      </FormItem>
                    </Col>
                    <Col span={3} className="cardNoDom" style={{ padding: "0px" }}>
                      <Tooltip getPopupContainer={() => document.querySelector('.cardNoDom')} overlayStyle={{ zIndex: 999, }} overlayClassName="toolTipDom cardNo" title={<div className="titleIcon">{mesIcon}<span >{this.state.cardNoMessage}</span></div>} visible={this.state.cardNoVisible}>
                        <FormItem wrapperCol={{ span: 30 }} style={{ width: '98%', }}>
                          {getFieldDecorator('cardNo', {
                            rules: [{ required: false, message: '' },
                            { validator: this.props.form.getFieldValue('cardNo') && this.props.form.getFieldValue('cardNo').length > 0 && this.props.form.getFieldValue('cardTypeID') && this.props.form.getFieldValue('cardTypeID') ? this.validFunction : "" },
                            ],
                            getValueFromEvent: (event) => {
                              return initCardDr == '3' ? event.target.value.replace(/[^\d|Xx]/g, '') : event.target.value.replace(/\D/g, '')
                            },
                          })(
                            <Input
                              // style={{ background: (isModefined == 1 ? "#f5f5f5" : "#ffffff"), border: (isModefined == 1 ? "1px solid #d9d9d9" : "1px solid #d9d9d9") }}
                              allowClear
                              maxLength={cardLength && cardLength != "" ? parseInt(cardLength) : 99}
                              onPressEnter={this.handleKeydownM}
                              onBlur={this.handleKeydownM}
                              placeholder={
                                nowRead == 'R' ? '请点击读卡按钮查找病人' :
                                  (nowRead == "" && replenishZero == "Y" ? cardLength + '刷卡/输入或点击读卡（卡号可自动补零）'
                                    : (nowRead == "" && replenishZero == "N" ? cardLength + '刷卡/输入或点击读卡' :
                                      (nowRead == 'I' && replenishZero == "Y" ? cardLength + '输入卡号（卡号可自动补零）'
                                        : (nowRead == 'I' && replenishZero == "N" ? cardLength + '输入卡号' : ""))))}
                              disabled={nowRead == 'R'}
                            />
                          )}
                        </FormItem>
                      </Tooltip>
                    </Col>
                    <Col span={1} style={{ padding: "0px", width: "5%" }}>
                      <FormItem wrapperCol={{ span: 16 }}>
                        <Button disabled={nowRead == "I"} type={nowRead == "I" ? "" : "primary"} onClick={this.handleCardReading}>
                          读卡
                        </Button>
                      </FormItem>
                    </Col>
                    <Col span={4} className="patinfoSpan" style={{ padding: "0px 0px 0px 16px" }}>
                      <FormItem label='人员标识' wrapperCol={{ span: 19 }} labelCol={{ span: 5 }} style={{ width: '100%', }}>
                        {getFieldDecorator('patInfo', {
                          initialValue: this.state.patInfo,
                          rules: [{ required: false, message: '' },
                          ]
                        })(
                          <Input
                            allowClear ref={(input) => this.input = input}
                            placeholder="病人ID/姓名/身份证号码/手机号码"
                            onKeyDown={this.getKeyDownList.bind(this)}
                          />
                        )}
                      </FormItem>
                    </Col>
                    <Col span={3} style={{ marginTop: 5 }}>
                      时段：<Select placeholder='时段' style={{ width: '80%' }}
                        value={this.state.timeRangeId}
                        onChange={this.handleChangeSelect.bind(this, 'timeRangeId')}
                        allowClear={true} getPopupContainer={triggerNode => triggerNode.parentNode}>
                        {timeRangeOption}
                      </Select>
                    </Col>
                    <Col span={1} style={{ padding: "0px" }} className="blockButton">
                      <Button type={"primary"} style={{ marginLeft: 5 }} onClick={this.handleShowFaceRecognition.bind(this)}>人脸识别</Button>

                    </Col>
                    <Col span={3} style={{ marginTop: 5 }}>
                      医生：<Select placeholder='时段' style={{ width: '80%' }}
                                   value={this.state.docRangeId}
                                   onChange={this.handleChangeSelect.bind(this, 'docRangeId')}
                                   allowClear={true} >
                      {doctorOption}
                    </Select>
                    </Col>
                    {/* <Col span={1} style={{ padding: "0px", width: "6%" }} className="blockButton">
                      <FormItem wrapperCol={{ span: 16 }}>
                        <Button style={{ color: "#40a9ff" }} onClick={() => this.edit(1)}>
                          <Icon type="arrow-down" />
                          <span>分配医生</span></Button>
                      </FormItem>
                    </Col>
                    <Col span={1} style={{ padding: "0px", width: "6%" }} className="blockButton">
                      <FormItem wrapperCol={{ span: 16 }}>
                        <Button style={{ color: "#faad14" }} onClick={() => this.edit(2)}>
                          <Icon type="arrow-down" />
                          <span>过号重排</span></Button>
                      </FormItem>
                    </Col>*/}
                    <Col span={1} className="blockButton">
                      <FormItem wrapperCol={{ span: 16 }}>
                        <Button style={{ color: "#f52298" }} onClick={() => this.edit(3)}>
                          <Icon type="arrow-down" />
                          <span>复诊</span></Button>
                      </FormItem>
                    </Col>
                    <div style={{textAlign:'right',marginRight:20}}>
                      {this.setMessage('FrontDeskForTriageReport', 'required') == 'Y' ?
                          <Button type='primary' onClick={() => this.edit(5)} disabled={Util.isEmpty(this.state.rowId)}>
                            <span>{this.setMessage('FrontDeskForTriageReport', 'descripts')}</span></Button> : null}

                      {this.setMessage('FrontDeskForTriageReferral', 'required') == 'Y' ?
                          <Button type={"primary"} style={{ marginLeft: 10, marginRight: 10 }} disabled={Util.isEmpty(this.state.rowId)}
                                  onClick={this.handleReferralModal.bind(this)}>
                            {this.setMessage('FrontDeskForTriageReferral', 'descripts')}
                          </Button> : null}

                      {this.setMessage('FrontDeskForTriagedoctorMessage', 'required') == 'Y' ?
                          <Button type='primary' style={{ marginLeft: 10 }} onClick={this.showDrawer}>
                            {this.setMessage('FrontDeskForTriagedoctorMessage', 'descripts')}
                          </Button> : null}
                    </div>

                    {/* {this.setMessage('FrontDeskForTriageReport', 'required') == 'Y' ?<Col span={1} style={{ padding: "0px", width: "5%" }} className="blockButton">
                      <FormItem wrapperCol={{ span: 16 }}>
                        <Button style={{ color: "#1999db" }} onClick={() => this.edit(4)}>
                          <Icon type="arrow-down" />
                          <span>优先</span></Button>
                      </FormItem>
                    </Col>:null} */}

                    {/*<div className='front-desk-title' style={{ display: 'flex', float: 'right', marginTop: 10, marginRight: 20 }}>*/}
                    {/*  <div className='headerBuild' style={{ display: 'flex' }}>*/}
                    {/*    <div className='rightBtn'></div><div style={{ marginLeft: '10px' }}>选中</div>*/}
                    {/*  </div>*/}
                    {/*  <div className='headerUnBuild' style={{ display: 'flex' }}>*/}
                    {/*    <div className='whiteBtn'></div><div style={{ marginLeft: '10px' }}>等待呼叫</div>*/}
                    {/*  </div>*/}
                    {/*  <div className='headerUpdate' style={{ display: 'flex' }}>*/}
                    {/*    <div className='redBtn'></div><div style={{ marginLeft: '10px' }}>转诊</div>*/}
                    {/*  </div>*/}
                    {/*</div>*/}
                  </Row>
                </Form>
                <Row className="moreFrontBlockDom">
                  <Col span={18}>
                    {
                        blockArr && blockArr.map((item, i) => {
                          return (
                              <Button
                                  key={i + 1}
                                  style={{ background: (this.state.statusCode == item.statusCode ? "#40a9ff" : ""), color: (this.state.statusCode == item.statusCode ? "#fff" : "#000000d9") }}
                                  onClick={() => this.handleBlock(item.statusCode)}
                              >
                                {item.statusDesc}({item.patNum})
                              </Button>
                          )
                        })
                    }
                  </Col>
                  <Col span={6}>
                    <div className='front-desk-title' style={{ display: 'flex', float: 'right', marginTop: 10, marginRight: 20 }}>
                      <div className='headerBuild' style={{ display: 'flex' }}>
                        <div className='rightBtn'></div><div style={{ marginLeft: '10px' }}>选中</div>
                      </div>
                      <div className='headerUnBuild' style={{ display: 'flex' }}>
                        <div className='whiteBtn'></div><div style={{ marginLeft: '10px' }}>等待呼叫</div>
                      </div>
                      <div className='headerUpdate' style={{ display: 'flex' }}>
                        <div className='redBtn'></div><div style={{ marginLeft: '10px' }}>转诊</div>
                      </div>
                    </div>
                  </Col>

                </Row>
                <Row>
                  <Table
                    loading={loading}
                    className="components-table-demo-nested"
                    columns={this.state.column}
                    pagination={false}
                    bordered
                    rowClassName={this.setRowClassName}
                    onRow={this.onClickRow}
                    rowKey={record => 'ID' in record && record.ID ? record.ID : record.key}
                    dataSource={this.state.leftData}
                    // title={()=>{
                    //   blockArr && blockArr.map((item, i) => {
                    //     return (
                    //       <Button style={{ background: (this.state.statusCode == item.statusCode ? "#40a9ff" : ""), color: (this.state.statusCode == item.statusCode ? "#fff" : "#000000d9") }} onClick={() => this.handleBlock(item.statusCode)}>{item.statusDesc}({item.patNum})</Button>
                    //     )
                    //   })
                    // }}
                    onHeaderRow={column => {
                      return {
                        onDoubleClick: () => {
                          this.columnRef.onOpenModel();
                        },
                      };
                    }}
                    scroll={{ y: store.getState().tableHeight.y + 20 + 'px', x: 900 }}
                  // style={{ height: store.getState().tableHeight.y + 20 + 'px', overflow: (this.state.leftData && this.state.leftData.length > 0 ? "auto" : "hidden") }}
                  />
                </Row>
              </Card>
            </Col>
            <Drawer className='front-body-style'
              title="Basic Drawer"
              placement="right"
              closable={false}
              width={800}
              onClose={this.onClose}
              visible={this.state.visible}
            >
              <Table
                className="components-table-demo-nested"
                columns={rightTopColumns}
                bordered
                pagination={false}
                title={() => {
                  return <span style={{ fontSize: '16px', fontWeight: 'bold' }}>医生排班信息</span>
                }}
                scroll={{ y: store.getState().tableHeight.y + 120 + 'px' }}
                rowKey={record => record.key}
                dataSource={this.state.rightTopData}
              />
            </Drawer>
            {/* <Col span={8}>
              <Card title="科室医生接诊情况" bordered className="frontListCard">
                <Row className="rightTopSelect" style={{ marginBottom: "12px" }}>
                  <Col span={8}>
                    诊室 <Select showSearch allowClear optionFilterProp="role" value={this.state.rightLocID} onChange={this.handleRightLoc} placeholder='请选择诊室'>
                      {locOpt}
                    </Select>
                  </Col>
                  <Col span={8}>
                    医生 <Select showSearch allowClear optionFilterProp="role" value={this.state.rightDocID} onChange={this.handleRightDoc} placeholder='请选择医生'>
                      {docOpt}
                    </Select>
                  </Col>
                  <Col span={1}>
                    <Button type="primary" onClick={this.handleGetLocDoc}>
                      查询
                  </Button>
                  </Col>
                </Row>
                <Row className="rightTopDom">
                  <Table
                    className="components-table-demo-nested"
                    columns={rightTopColumns}
                    bordered
                    pagination={false}
                    rowClassName={this.setRightTopRowClassName}
                    onRow={this.onClickRightTopRow}
                    rowKey={record => record.key}
                    dataSource={this.state.rightTopData}
                    style={{ height: store.getState().tableHeight.y - 358 + 'px', overflow: (this.state.rightTopData && this.state.rightTopData.length > 0 ? "auto" : "hidden") }}
                  />
                </Row>
                <Row className="waitListDom">
                  <Col>
                    <span>{this.state.docName || "--"}</span>
                    <span>接诊队列</span>
                  </Col>
                </Row>
                <Row>
                  <Table
                    className="components-table-demo-nested"
                    columns={rightBottomColumns}
                    bordered
                    pagination={false}
                    rowClassName={this.setRightBottomowClassName}
                    onRow={this.onClickRightBottomRow}
                    rowKey={record => record.key}
                    dataSource={this.state.rightBottomData}
                    style={{ height: store.getState().tableHeight.y - 253 + 'px', overflow: (this.state.rightBottomData && this.state.rightBottomData.length > 0 ? "auto" : "hidden") }}
                  />
                </Row>
              </Card>
            </Col> */}
          </Row>
          <ReadCard ref={r => this.readCard = r} />
        </div>
      )
    }
  })
export default FrontDeskForTriage;