import 'antd/es/modal/style';
import _Modal from 'antd/es/modal';
import 'antd/es/button/style';
import _Button from 'antd/es/button';
import _get from 'lodash/get';
import { LazyAntd } from '@lm_fe/components';
import { request } from '@lm_fe/utils';
import React__default, { useState, useRef, useEffect } from 'react';
import ReactToPrint from 'react-to-print';
import { s as styleInject } from './index.js';
import '@lm_fe/env';
import 'antd/es/tabs/style';
import 'antd/es/tabs';
import 'lodash/size';
import 'lodash/orderBy';
import 'lodash/map';
import 'antd/es/collapse/style';
import 'antd/es/collapse';
import 'antd/es/badge/style';
import 'antd/es/badge';
import 'lodash/assign';
import '@ant-design/icons';
import '@lm_fe/components_m';
import '@lm_fe/service';
import '@lm_fe/pages';
var css_248z = ".diag-record-modal .add-class {\n  color: #02a7f0;\n}\n.diag-record-modal .del-class {\n  color: #ccc;\n  text-decoration: line-through;\n}\n.diag-record-modal .diag-wrapper {\n  display: none;\n}\n.diag-record-modal .diag-wrapper .diag-first .diag-GP {\n  display: inline-block;\n  width: 12px;\n}\n.diag-record-modal .diag-wrapper .diag-first .diag-week {\n  display: inline-block;\n  width: 34px;\n}\n.diag-record-modal .diag-wrapper .diag-item {\n  padding-left: 43px;\n}\n";
styleInject(css_248z);
LazyAntd.Tree;
LazyAntd.TreeSelect;
LazyAntd.Select;
var Table = LazyAntd.Table;
LazyAntd.Dropdown;
LazyAntd.Pagination;
function diagTable(_a) {
  var visitsData = _a.visitsData,
    closeModal = _a.closeModal,
    headerInfo = _a.headerInfo,
    isShowHisModal = _a.isShowHisModal;
  var _b = useState([]),
    recordData = _b[0],
    setRecordData = _b[1];
  var printDiagRef = useRef(null);
  useEffect(function () {
    var pregnancyId = _get(visitsData, 'id');
    request.get("/api/getDiagnosisHistories?pregnancyId=".concat(pregnancyId)).then(function (r) {
      return setRecordData(r.data);
    });
    return function () {};
  }, [visitsData]);
  var handleCancel = function handleCancel() {
    closeModal('isShowHisModal');
  };
  var renderTable = function renderTable() {
    var columns = [{
      title: '流水号',
      dataIndex: 'serialNo',
      key: 'serialNo',
      width: 150,
      align: 'center'
    }, {
      title: 'ICD编码',
      dataIndex: 'diagnosisCode',
      key: 'diagnosisCode',
      width: 150,
      align: 'center'
    }, {
      title: '诊断',
      dataIndex: 'diagnosis',
      key: 'diagnosis',
      align: 'center'
    }, {
      title: '诊断医生',
      dataIndex: 'doctor',
      key: 'doctor',
      width: 150,
      align: 'center'
    }, {
      title: '诊断日期',
      dataIndex: 'createdDate',
      key: 'createdDate',
      width: 200,
      align: 'center'
    }];
    return /*#__PURE__*/React__default.createElement(Table, {
      className: "prenatal-visit-main-table",
      columns: columns,
      dataSource: recordData,
      pagination: false
    });
  };
  var renderPrint = function renderPrint() {
    return /*#__PURE__*/React__default.createElement("div", {
      className: "diag-wrapper",
      ref: printDiagRef
    }, /*#__PURE__*/React__default.createElement("div", {
      style: {
        fontWeight: 700,
        fontSize: '18px',
        marginTop: '15px',
        marginLeft: '15px',
        marginBottom: '15px'
      }
    }, /*#__PURE__*/React__default.createElement("span", null, _get(headerInfo, 'name')), " \xA0\xA0\xA0\xA0", /*#__PURE__*/React__default.createElement("span", null, "\u5C31\u8BCA\u5361\u53F7\uFF1A", _get(headerInfo, 'outpatientNO')), "\xA0\xA0\xA0\xA0", /*#__PURE__*/React__default.createElement("span", null, "\u5E74\u9F84\uFF1A", _get(headerInfo, 'age'))), renderTable());
  };
  var buttons = [/*#__PURE__*/React__default.createElement(ReactToPrint, {
    trigger: function trigger() {
      return /*#__PURE__*/React__default.createElement(_Button, {
        type: "primary"
      }, "\u6253\u5370\u6700\u65B0\u8BCA\u65AD");
    },
    content: function content() {
      return printDiagRef.current;
    }
  })];
  return /*#__PURE__*/React__default.createElement(_Modal, {
    className: "diag-record-modal",
    width: "80%",
    footer: buttons,
    title: "\u8BCA\u65AD\u5386\u53F2",
    visible: isShowHisModal,
    onCancel: handleCancel
  }, renderTable(), renderPrint());
}
export { diagTable as default };
//# sourceMappingURL=prenatal-visit.pregnancy.doctor-end16.js.map
