import 'antd/es/space/style';
import _Space from 'antd/es/space';
import 'antd/es/button/style';
import _Button from 'antd/es/button';
import _isEmpty from 'lodash/isEmpty';
import { b as __awaiter, c as __generator, a as __spreadArray } from './index.js';
import { HighriskGradeDisplay } from '@lm_fe/components_m';
import { rt_ctx, APP_CONFIG, mchcStore } from '@lm_fe/env';
import { BF_Wrap2, MyBaseList, mchcModal__ } from '@lm_fe/pages';
import { defineFormConfig, SLocal_History } from '@lm_fe/service';
import { downloadFile, request } from '@lm_fe/utils';
import React__default from 'react';
import 'antd/es/tabs/style';
import 'antd/es/tabs';
import 'lodash/size';
import 'lodash/get';
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 '@ant-design/icons';
var ctx = rt_ctx;
var React = rt_ctx.React;
var form_config = defineFormConfig([{
  title: '就诊卡号',
  dataIndex: 'outpatientNO',
  width: APP_CONFIG.CELL_WIDTH_MIDDLE,
  fixed: 'left'
}, {
  title: '姓名',
  dataIndex: 'name',
  width: APP_CONFIG.CELL_WIDTH_SMALL,
  fixed: 'left'
}, {
  title: '年龄',
  dataIndex: 'age',
  width: APP_CONFIG.CELL_WIDTH_TINY
}, {
  title: '孕/产',
  dataIndex: 'gravidity',
  width: APP_CONFIG.CELL_WIDTH_SMALL,
  render: function render(value, rowData) {
    return ctx.utils.format_gp(rowData);
  }
}, {
  title: '孕周',
  dataIndex: 'currentGestationalWeek',
  width: APP_CONFIG.CELL_WIDTH_SMALL
}, {
  title: '预产期-日期',
  dataIndex: 'edd',
  width: APP_CONFIG.CELL_WIDTH_MIDDLE
}, {
  title: '预产期-B超',
  dataIndex: 'sureEdd',
  width: APP_CONFIG.CELL_WIDTH_MIDDLE
}, {
  title: '手机号码',
  dataIndex: 'telephone',
  width: APP_CONFIG.CELL_WIDTH_MIDDLE
}, {
  title: '建档日期',
  dataIndex: 'validateDate',
  width: APP_CONFIG.CELL_WIDTH_MIDDLE
}, {
  title: '户口地址',
  dataIndex: 'permanentResidenceAddress',
  width: APP_CONFIG.CELL_WIDTH_LARGE
}, {
  title: '评定日期',
  dataIndex: 'eventDate',
  width: APP_CONFIG.CELL_WIDTH_SMALL
}, {
  title: '评定人',
  dataIndex: 'rDoctor',
  width: APP_CONFIG.CELL_WIDTH_SMALL
}, {
  title: '就诊日期',
  dataIndex: 'visitDate',
  ellipsis: false,
  width: APP_CONFIG.CELL_WIDTH_LARGE,
  render: function render(value, b) {
    if (!value) return '';
    var too_much = false;
    var arr = value.split(',').filter(function (_) {
      return _;
    });
    if (arr.length > 3) {
      arr = arr.slice(0, 3);
      too_much = true;
    }
    return /*#__PURE__*/React.createElement("span", null, arr.map(function (_) {
      return /*#__PURE__*/React.createElement(ctx.ui.Tag, null, _);
    }), too_much ? '...' : '');
  }
}, {
  title: '高危因素',
  dataIndex: 'highriskNote',
  width: APP_CONFIG.CELL_WIDTH_LARGE
}]);
rt_ctx.React;
var search_config = defineFormConfig([{
  label: '评定日期',
  name: 'eventDate',
  inputType: 'rangeDate'
}, {
  label: '预产期',
  name: 'edd',
  inputType: 'rangeDate'
}, {
  label: '预产期B超',
  name: 'sureEdd',
  inputType: 'rangeDate'
}, {
  label: '孕期状态',
  name: 'periodState',
  inputType: 'MS',
  inputProps: {
    optionKey: '孕期状态'
  }
}, {
  label: '高危等级',
  name: 'highriskGrade',
  inputType: 'MS',
  inputProps: {
    type: 'tags',
    options: mchcStore.highriskGradeConfig.map(function (_) {
      return {
        label: _.colorText,
        value: _.label
      };
    })
  }
}, {
  label: '传染病',
  name: 'infectionNote',
  inputType: 'MS',
  inputProps: {
    type: 'tags',
    options: mchcStore.highriskContagionConfig.options
  }
}, {
  label: '高危因素',
  name: 'highriskNote',
  inputType: 'Input'
}, {
  label: '姓名',
  name: 'name',
  inputType: 'Input'
}, {
  label: '居住地址',
  name: 'permanentResidenceAddress',
  inputType: 'Input'
}]);
function BreastCancerDataReport(prop) {
  var _this = this;
  var _a = BF_Wrap2({
      default_conf: {
        title: '高危孕产妇管理-高危统计',
        tableColumns: form_config,
        searchConfig: search_config
      }
    }),
    config = _a.config,
    Wrap = _a.Wrap;
  return /*#__PURE__*/React__default.createElement(Wrap, null, /*#__PURE__*/React__default.createElement(MyBaseList, {
    name: "/api/highriskSummaryByPregnancy-query",
    searchParams: {},
    initialSearchValue: {},
    searchConfig: config === null || config === void 0 ? void 0 : config.searchConfig,
    showAction: false,
    showAdd: false,
    RenderBtns: function RenderBtns(ctx) {
      return /*#__PURE__*/React__default.createElement(_Button.Group, null, /*#__PURE__*/React__default.createElement(_Button, {
        onClick: function onClick() {
          return __awaiter(_this, void 0, void 0, function () {
            var queryData, res;
            return __generator(this, function (_a) {
              switch (_a.label) {
                case 0:
                  queryData = ctx.getSearchParams();
                  return [4, request.get("/api/export/highriskSummaryByPregnancyDqe", {
                    params: queryData
                  })];
                case 1:
                  res = _a.sent();
                  downloadFile(res.data, '高危详情表', 'application/vnd.ms-excel', true);
                  return [2];
              }
            });
          });
        }
      }, "\u5BFC\u51FA"));
    },
    genColumns: function genColumns(cxt) {
      var _a;
      return __spreadArray(__spreadArray([], (_a = config === null || config === void 0 ? void 0 : config.tableColumns) !== null && _a !== void 0 ? _a : [], true), [{
        title: '高危等级',
        dataIndex: 'highriskGrade',
        width: APP_CONFIG.CELL_WIDTH_SMALL,
        fixed: 'right',
        render: function render(value) {
          return /*#__PURE__*/React__default.createElement(HighriskGradeDisplay, {
            type: "highriskGrade",
            data: value
          });
        }
      }, {
        title: '传染病',
        dataIndex: 'infectionNote',
        width: APP_CONFIG.CELL_WIDTH_SMALL,
        fixed: 'right',
        render: function render(value) {
          return /*#__PURE__*/React__default.createElement(HighriskGradeDisplay, {
            type: "contagion",
            data: value
          });
        }
      }, {
        title: '操作',
        align: 'center',
        fixed: 'right',
        width: 140,
        render: function render(rowData) {
          return /*#__PURE__*/React__default.createElement(_Space, {
            size: "small"
          }, /*#__PURE__*/React__default.createElement(_Button, {
            size: "small",
            disabled: _isEmpty(rowData.riskRecords),
            onClick: function onClick() {
              mchcModal__.open('高危因素管理', {
                modal_data: {
                  pregnancyId: rowData.id,
                  hide高危标记: true
                }
              });
            }
          }, "\u8BB0\u5F55"), /*#__PURE__*/React__default.createElement(_Button, {
            size: "small",
            disabled: _isEmpty(rowData.riskRecords),
            onClick: function onClick() {
              mchcModal__.open('高危随访', {
                modal_data: {
                  pregnancyId: rowData.id
                }
              });
            }
          }, "\u968F\u8BBF"), /*#__PURE__*/React__default.createElement(_Button, {
            size: "small",
            onClick: function onClick() {
              SLocal_History.historyPush("/prenatal-visit/pregnancy/doctor-end?id=".concat(rowData.id));
            }
          }, "\u770B\u8BCA"));
        }
      }], false);
    }
  }));
}
export { BreastCancerDataReport as default };
//# sourceMappingURL=pages.highrisk-management.list.js.map
