import 'antd/es/popconfirm/style';
import _Popconfirm from 'antd/es/popconfirm';
import 'antd/es/divider/style';
import _Divider from 'antd/es/divider';
import 'antd/es/button/style';
import _Button from 'antd/es/button';
import _get from 'lodash/get';
import { _ as __extends, a as __spreadArray } from './index.js';
import React__default from 'react';
import { EyeOutlined, PrinterOutlined, DeleteOutlined } from '@ant-design/icons';
import { BaseTableOld, BaseQuery, BaseListOld } from '@lm_fe/components_m';
import 'antd/es/tag/style';
import _Tag from 'antd/es/tag';
import { APP_CONFIG } from '@lm_fe/env';
import store from 'store';
import { b as bindLifecycle } from './bindLifecycle.js';
import { mchcModal__ } from '@lm_fe/pages';
import 'antd/es/tabs/style';
import 'antd/es/tabs';
import 'lodash/size';
import '@lm_fe/utils';
import 'lodash/orderBy';
import 'lodash/map';
import '@lm_fe/components';
import 'antd/es/collapse/style';
import 'antd/es/collapse';
import 'antd/es/badge/style';
import 'antd/es/badge';
import 'lodash/assign';
import '@lm_fe/service';
import './hoist-non-react-statics.cjs.js';
var ProductsTable = function (_super) {
  __extends(ProductsTable, _super);
  function ProductsTable() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  return ProductsTable;
}(BaseTableOld);
var queryFormDescriptions = {
  referralDate: {
    label: '转诊时间',
    inputType: 'rangeDate',
    filterType: ''
  },
  referralDirection: {
    label: '类型',
    inputType: 'select',
    filterType: 'equals',
    options: [{
      label: '全部',
      value: ''
    }, {
      label: '平级',
      value: '1'
    }, {
      label: '上级',
      value: '2'
    }, {
      label: '下级',
      value: '3'
    }]
  },
  pregnancyName: {
    label: '姓名',
    inputType: 'input',
    filterType: ''
  }
};
var Query = function (_super) {
  __extends(Query, _super);
  function Query() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.state = {
      queryFormDescriptions: queryFormDescriptions
    };
    return _this;
  }
  return Query;
}(BaseQuery);
var tableColumns = [{
  title: '姓名',
  dataIndex: ['pregnancy', 'name'],
  width: 86,
  ellipsis: true
}, {
  title: '就诊卡号',
  dataIndex: ['pregnancy', 'outpatientNO'],
  ellipsis: true,
  width: APP_CONFIG.CELL_WIDTH_SMALL
}, {
  title: '年龄',
  dataIndex: ['pregnancy', 'age'],
  width: 46
}, {
  title: '手机号码',
  dataIndex: ['pregnancy', 'telephone'],
  width: APP_CONFIG.CELL_WIDTH_SMALL
}, {
  title: '高危等级',
  dataIndex: ['pregnancy', 'highriskGrade'],
  width: 68,
  align: 'center',
  render: function render(text) {
    return text && /*#__PURE__*/React.createElement(_Tag, {
      style: {
        marginRight: 0
      }
    }, text);
  }
}, {
  title: '转诊类型',
  dataIndex: 'referralDirection',
  width: 68,
  align: 'center',
  render: function render(value) {
    var text = '';
    if (value === 1) text = '平级';
    if (value === 2) text = '上级';
    if (value === 3) text = '下级';
    return text && /*#__PURE__*/React.createElement(_Tag, {
      style: {
        marginRight: 0
      }
    }, text);
  }
}, {
  title: '转出时间',
  dataIndex: 'referralDate',
  width: 86
}, {
  title: '转至单位',
  dataIndex: ['referralOrganization', 'name'],
  width: APP_CONFIG.CELL_WIDTH_MIDDLE
}, {
  title: '转至科室',
  dataIndex: 'referralDept',
  width: APP_CONFIG.CELL_WIDTH_SMALL
}, {
  title: '转出原因',
  dataIndex: 'reason',
  width: APP_CONFIG.CELL_WIDTH_LARGE
}];
var List = function (_super) {
  __extends(List, _super);
  function List() {
    var _a;
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.staticDefaultQuery = (_a = {
      page: 0,
      size: 20
    }, _a['referralType.equals'] = 1, _a);
    _this.state = {
      total: 0,
      defaultQuery: _this.staticDefaultQuery,
      dataSource: [],
      selectedRowKeys: [],
      selectedRows: [],
      visible: false,
      editable: false,
      id: undefined,
      editKey: undefined,
      loading: false,
      isSearchColumnModal: false,
      printId: ''
    };
    _this.columns = __spreadArray(__spreadArray([], _this.props.tableColumns, true), [{
      title: '操作.',
      showSorter: false,
      showFilter: false,
      fixed: 'right',
      width: 196,
      align: 'center',
      render: function render(value, rowData, index) {
        return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(_Button, {
          type: "link",
          size: "small",
          icon: /*#__PURE__*/React__default.createElement(EyeOutlined, {
            className: "global-table-action-icon"
          }),
          onClick: _this.handleView(rowData)
        }, "\u67E5\u770B"), /*#__PURE__*/React__default.createElement(_Divider, {
          type: "vertical"
        }), /*#__PURE__*/React__default.createElement(_Button, {
          type: "link",
          size: "small",
          icon: /*#__PURE__*/React__default.createElement(PrinterOutlined, {
            className: "global-table-action-icon"
          }),
          onClick: _this.handlePrint.bind(_this, rowData)
        }, "\u6253\u5370"), /*#__PURE__*/React__default.createElement(_Divider, {
          type: "vertical"
        }), /*#__PURE__*/React__default.createElement(_Popconfirm, {
          placement: "topRight",
          title: "\u786E\u5B9A\u8981\u5220\u9664\u8FD9\u4E2A".concat(_get(_this.props, 'baseTitle'), "\u5417?"),
          onConfirm: _this.handleDelete(rowData),
          okText: "\u786E\u5B9A",
          cancelText: "\u53D6\u6D88"
        }, /*#__PURE__*/React__default.createElement(_Button, {
          type: "link",
          size: "small",
          icon: /*#__PURE__*/React__default.createElement(DeleteOutlined, {
            className: "global-table-action-icon global-table-action-delete"
          })
        }, "\u5220\u9664")));
      }
    }], false);
    _this.handleAdd = function () {
      var history = _this.props.history;
      history.push('/referral-management/referral-out/add');
    };
    _this.handleView = function (rowData) {
      return function () {
        var history = _this.props.history;
        var id = rowData.id;
        history.push("/referral-management/referral-out/add?id=".concat(id));
      };
    };
    return _this;
  }
  List.prototype.handlePrint = function (rowData) {
    console.log({
      rowData: rowData
    });
    var localData = store.get('localData');
    mchcModal__.open('print_modal', {
      modal_data: {
        requestData: {
          url: '/api/pdf-preview',
          resource: 'referral',
          template: _get(localData, "referralStyle", 2),
          version: '',
          note: '',
          id: _get(rowData, "id")
        }
      }
    });
  };
  List.prototype.componentDidActivate = function () {
    this.handleSearch();
  };
  List.defaultProps = {
    baseUrl: '/api/referrals',
    baseTitle: '转出记录',
    needPagination: true,
    showQuery: true,
    showAdd: true,
    tableColumns: tableColumns,
    rowKey: 'id',
    Table: ProductsTable,
    Query: Query
  };
  return List;
}(BaseListOld);
var index = bindLifecycle(List);
export { index as default };
//# sourceMappingURL=referral-management.referral-out.list.js.map
