import 'antd/es/tabs/style';
import _Tabs from 'antd/es/tabs';
import 'antd/es/space/style';
import _Space from 'antd/es/space';
import 'antd/es/button/style';
import _Button from 'antd/es/button';
import 'antd/es/modal/style';
import _Modal from 'antd/es/modal';
import 'antd/es/message/style';
import _message from 'antd/es/message';
import 'antd/es/form/style';
import _Form from 'antd/es/form';
import _set from 'lodash/set';
import _isEqual from 'lodash/isEqual';
import _get from 'lodash/get';
import _forEach from 'lodash/forEach';
import _find from 'lodash/find';
import _cloneDeep from 'lodash/cloneDeep';
import { _ as __extends, a as __spreadArray, s as styleInject, b as __awaiter, c as __generator, D as DoctorEnd_Diagnoses, d as __assign, e as api } from './index.js';
import { TableOutlined, SyncOutlined, PrinterOutlined, SaveOutlined, ExclamationCircleOutlined, CheckCircleOutlined, ArrowRightOutlined } from '@ant-design/icons';
import { FormSectionForm, getBMI, CheckAndCancelButton, ALLOW_CALC_EDD_BASED_ON_IVF, menopauseWeek, getGesWeek, MyForm, MyLazyComponent, getFormData } from '@lm_fe/components_m';
import { mchcUtils, mchcEvent, mchcEnv, mchcLogger } from '@lm_fe/env';
import { DoctorEnd_检验检查_History, BF_Wrap2, HighRiskTableEntry, mchcModal__ } from '@lm_fe/pages';
import { SMchc_Doctor, SLocal_Calculator } from '@lm_fe/service';
import { getFutureDate, event, safe_json_parse } from '@lm_fe/utils';
import dayjs from 'dayjs';
import * as React from 'react';
import React__default, { useEffect, useState, useRef } from 'react';
import { I as Index$2, a as Index$3, M as ManagementPlan, f as filter_diagnoses } from './index2.js';
import { 孕 as 孕产史_config } from './孕产史.js';
import 'antd/es/row/style';
import _Row from 'antd/es/row';
import 'antd/es/col/style';
import _Col from 'antd/es/col';
import _isNil from 'lodash/isNil';
import { LazyAntd, useMyEffectSafe } from '@lm_fe/components';
import 'lodash/size';
import _isBoolean from 'lodash/isBoolean';
import { r as requestMethods, g as getTabMethods, u as updateTabMethods } from './request.js';
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';
function JianYanJianCha(props) {
  var form = props.form,
    active = props.active;
  var id = mchcUtils.getDoctorEndId();
  return active ? /*#__PURE__*/React.createElement(DoctorEnd_检验检查_History, {
    form: form,
    pregnancyId: id
  }) : null;
}
Object.assign(JianYanJianCha, {
  Title: '检验检查',
  ClassName: 'yi-ban-bing-shi label-width6',
  tmp: true
});
function JWS$3(props) {
  var form = props.form,
    active = props.active;
  var id = mchcUtils.getDoctorEndId();
  var _a = BF_Wrap2({
      default_conf: {
        title: '门诊-其他病史',
        tableColumns: function tableColumns() {
          return import('./prenatal-visit.pregnancy.doctor-end8.js');
        }
      }
    }),
    Wrap = _a.Wrap,
    config = _a.config;
  useEffect(function () {
    if (active) {
      SMchc_Doctor.othermhOutpatient(id).then(function (v) {
        form.setFieldsValue(v);
      });
    }
    return function () {};
  }, [active]);
  return /*#__PURE__*/React.createElement(Wrap, null, /*#__PURE__*/React.createElement(FormSectionForm, {
    onValuesChange: function onValuesChange(changedValues) {},
    onFinish: function onFinish(v) {
      SMchc_Doctor.updateOthermhOutpatient(v);
    },
    formDescriptions: config === null || config === void 0 ? void 0 : config.tableColumns,
    form: form
  }));
}
Object.assign(JWS$3, {
  Title: '其他病史',
  Config: null,
  ClassName: 'yi-ban-bing-shi label-width6',
  tmp: true
});
function JWS$2(props) {
  var form = props.form,
    active = props.active;
  var id = mchcUtils.getDoctorEndId();
  var _a = BF_Wrap2({
      default_conf: {
        title: '门诊-体格检查',
        tableColumns: function tableColumns() {
          return import('./prenatal-visit.pregnancy.doctor-end9.js');
        }
      }
    }),
    Wrap = _a.Wrap,
    config = _a.config;
  useEffect(function () {
    if (active) {
      SMchc_Doctor.physicalExamOfOutpatient(id).then(function (v) {
        form.setFieldsValue(v);
      });
    }
    return function () {};
  }, [active]);
  return /*#__PURE__*/React.createElement(Wrap, null, /*#__PURE__*/React.createElement(FormSectionForm, {
    onValuesChange: function onValuesChange(changedValues, values) {
      var changedBase = changedValues.physicalBaseExam;
      if ((changedBase === null || changedBase === void 0 ? void 0 : changedBase.preheight) || (changedBase === null || changedBase === void 0 ? void 0 : changedBase.weight)) {
        var _a = values.physicalBaseExam,
          preheight = _a.preheight,
          weight = _a.weight;
        var bmi = getBMI(weight, preheight);
        form.setFieldsValue({
          physicalBaseExam: {
            bmi: bmi
          }
        });
      }
      if ((changedBase === null || changedBase === void 0 ? void 0 : changedBase.preheight) || (changedBase === null || changedBase === void 0 ? void 0 : changedBase.preweight)) {
        var _b = values.physicalBaseExam,
          preheight = _b.preheight,
          preweight = _b.preweight;
        var preBmi = getBMI(preweight, preheight);
        form.setFieldsValue({
          physicalBaseExam: {
            preBmi: preBmi
          }
        });
      }
    },
    onFinish: function onFinish(v) {
      SMchc_Doctor.updatePhysicalExamOfOutpatient(v);
    },
    formDescriptions: config === null || config === void 0 ? void 0 : config.tableColumns,
    form: form
  }));
}
Object.assign(JWS$2, {
  Title: '体格检查',
  Config: null,
  ClassName: 'yi-ban-bing-shi label-width6',
  tmp: true
});
function JWS$1(props) {
  var form = props.form,
    active = props.active;
  var id = mchcUtils.getDoctorEndId();
  var _a = BF_Wrap2({
      default_conf: {
        title: '门诊-既往史',
        tableColumns: function tableColumns() {
          return import('./prenatal-visit.pregnancy.doctor-end10.js');
        }
      }
    }),
    Wrap = _a.Wrap,
    config = _a.config;
  useEffect(function () {
    if (active) {
      SMchc_Doctor.getFirstVisitPastmhOutpatient(id).then(function (v) {
        form.setFieldsValue(v);
      });
    }
    return function () {};
  }, [active]);
  return /*#__PURE__*/React.createElement(Wrap, null, /*#__PURE__*/React.createElement(FormSectionForm, {
    onValuesChange: function onValuesChange(changedValues) {},
    onFinish: function onFinish(v) {
      SMchc_Doctor.updateFirstVisitPastmhOutpatient(v);
    },
    formDescriptions: config === null || config === void 0 ? void 0 : config.tableColumns,
    form: form
  }));
}
Object.assign(JWS$1, {
  Title: '既往史',
  Config: null,
  ClassName: 'yi-ban-bing-shi label-width6',
  tmp: true
});
var Index$1 = function (_super) {
  __extends(Index, _super);
  function Index() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  Index.prototype.render = function () {
    return null;
  };
  Index.Title = '现病史';
  Index.ClassName = 'yu-chan-qi label-width6';
  return Index;
}(React.Component);
function JWS(props) {
  var active = props.active,
    form = props.form;
  var config = 孕产史_config();
  var pregnancyId = mchcUtils.getDoctorEndId();
  useEffect(function () {
    if (active) {
      SMchc_Doctor.getPregnacymh(pregnancyId).then(function (v) {
        form.setFieldsValue(v);
      });
    }
    return function () {};
  }, [active]);
  return /*#__PURE__*/React.createElement(FormSectionForm, {
    onValuesChange: function onValuesChange(changedValues) {},
    onFinish: function onFinish(v) {
      SMchc_Doctor.updatePregnacymh(v).then(function () {
        mchcEvent.emit('outpatient', {
          type: '刷新头部',
          pregnancyId: pregnancyId
        });
      });
    },
    formDescriptions: __spreadArray(__spreadArray([], config.children, true), [{
      name: 'id',
      form_hidden: true
    }], false),
    form: form
  });
}
Object.assign(JWS, {
  Title: '孕产史',
  Config: 孕产史_config().children,
  ClassName: 'yi-ban-bing-shi label-width6',
  tmp: true
});
var css_248z$2 = ".diag-reminder-wrapper .reminder-msg {\n  font-size: 16px;\n  margin-bottom: 10px;\n}\n.diag-reminder-wrapper .reminder-diag {\n  font-size: 16px;\n  color: red;\n}\n";
styleInject(css_248z$2);
var css_248z$1 = "/*诊断处理页面*/\n.zhen-duan {\n  max-width: calc(100% - 21px);\n  padding: 0 16px;\n}\n.zhen-duan .form-wrapper {\n  padding: 8px 0;\n  border: 1px solid #d7dce7;\n}\n.zhen-duan .form-wrapper .his-btn {\n  position: relative;\n  margin-bottom: 10px;\n  margin-left: 45px;\n  border-radius: 6px;\n}\n.zhen-duan .sc::after {\n  position: absolute;\n  top: 0px;\n  left: 0px;\n  width: 10px;\n  height: 10px;\n  background-color: red;\n  border-radius: 50%;\n  content: ' ';\n}\n.zhen-duan .eclampsia::after {\n  position: absolute;\n  top: 0px;\n  left: 0px;\n  width: 10px;\n  height: 10px;\n  background-color: red;\n  border-radius: 50%;\n  content: ' ';\n}\n.zhen-duan .vte::after {\n  position: absolute;\n  top: 0px;\n  left: 0px;\n  width: 10px;\n  height: 10px;\n  background-color: red;\n  border-radius: 50%;\n  content: ' ';\n}\n.zhen-duan .risk {\n  color: #ff9200;\n}\n.zhen-duan .zbtn-risk {\n  color: #ff9200;\n  background-color: #fff5e8;\n}\n";
styleInject(css_248z$1);
LazyAntd.Tree;
LazyAntd.TreeSelect;
LazyAntd.Select;
var Table = LazyAntd.Table;
LazyAntd.Dropdown;
LazyAntd.Pagination;
var Title = '诊断处理';
var ClassName = 'zhen-duan-chu-li';
function Index(props) {
  var _this = this;
  var serialNo = props.serialNo,
    diagnosesList = props.diagnosesList,
    changeScreening = props.changeScreening,
    _handlePrint = props.handlePrint,
    noShowBtn = props.noShowBtn,
    canSave = props.canSave,
    headerInfo = props.headerInfo,
    changePreventPreeclampsia = props.changePreventPreeclampsia,
    isShowPreventPreeclampsia = props.isShowPreventPreeclampsia,
    changeSyphilis = props.changeSyphilis,
    setDiagnosesList = props.setDiagnosesList,
    setDiagnosesWord = props.setDiagnosesWord,
    diagnosesWord = props.diagnosesWord,
    getHighriskDiagnosis = props.getHighriskDiagnosis,
    saveHeaderInfo = props.saveHeaderInfo,
    active = props.active,
    diagnosis_before_submit = props.diagnosis_before_submit,
    diagnosis_addon_btns = props.diagnosis_addon_btns,
    form = props.form;
  var preg_id = mchcUtils.getDoctorEndId();
  var _a = BF_Wrap2({
      default_conf: {
        title: '门诊-诊断处理',
        tableColumns: function tableColumns() {
          return import('./prenatal-visit.pregnancy.doctor-end11.js');
        }
      }
    }),
    Wrap = _a.Wrap,
    config = _a.config;
  var _b = useState(false),
    isShowMenzhen = _b[0],
    set_isShowMenzhen = _b[1];
  var _c = useState(false),
    isShowModifyRecord = _c[0],
    set_isShowModifyRecord = _c[1];
  var _d = useState(false);
  _d[0];
  var set_isShowDiagReminder = _d[1];
  var _e = useState(false),
    isShowManageModal = _e[0],
    set_isShowManageModal = _e[1];
  var _f = useState([]),
    recordData = _f[0],
    set_recordData = _f[1];
  var _g = useState(),
    visitData = _g[0],
    setVisitData = _g[1];
  useEffect(function () {
    if (active) {
      initData();
    }
    return function () {};
  }, [active]);
  useMyEffectSafe(props)(function () {
    var rm = mchcEvent.on_rm('my_form', function (e) {
      return __awaiter(_this, void 0, void 0, function () {
        var value;
        var _a;
        return __generator(this, function (_b) {
          if (e.type === 'onChange' && e.name === 'advice') {
            e.values;
            value = e.value;
            e.name;
            if (!_isNil(value.appointmentCycle)) {
              (_a = e.setValue) === null || _a === void 0 ? void 0 : _a.call(e, 'advice', {
                appointmentDate: getFutureDate(value.appointmentCycle)
              });
            }
          }
          return [2];
        });
      });
    });
    return rm;
  }, []);
  function initData() {
    SMchc_Doctor.getFirstVisitDiagnosisOutpatient(preg_id).then(function (v) {
      setVisitData(v);
      form.setFieldsValue(v);
    });
  }
  function handleSubmitBefore(sync) {
    if (sync === void 0) {
      sync = true;
    }
    if (diagnosis_before_submit) {
      return diagnosis_before_submit(handleSubmit, visitData, form, sync);
    }
    var values = form.getFieldsValue();
    handleSubmit(values);
  }
  function handleSubmit(values) {
    return __awaiter(this, void 0, void 0, function () {
      var re;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            return [4, SMchc_Doctor.updateFirstVisitDiagnosisOutpatient(__assign({
              currentGestationalWeek: _get(headerInfo, 'curgesweek') ? _get(headerInfo, 'curgesweek') : _get(headerInfo, 'gesweek'),
              diagnoses: diagnosesList,
              serialNo: serialNo
            }, values))];
          case 1:
            re = _a.sent();
            HighRiskTableEntry.highRiskTablePopup(re);
            return [2];
        }
      });
    });
  }
  function closeModal(type, items, key) {
    if (type === 'isShowDiagReminder') {
      set_isShowDiagReminder(false);
    } else if (type === 'isShowManageModal') {
      set_isShowManageModal(false);
    } else if (type === 'isShowMenzhen') {
      set_isShowMenzhen(false);
    } else if (type === 'isShowModifyRecord') {
      set_isShowModifyRecord(false);
    }
  }
  function handlePrint(type) {
    if (!_handlePrint) return;
    if (type == 'prenatalVisit1') {
      var id = _get(visitData, "advice.id");
      if (id) {
        _handlePrint(type, id);
      } else {
        _message.warning('请先保存');
      }
    } else {
      _handlePrint(type, undefined);
    }
  }
  function handleRecordBtn() {
    return __awaiter(this, void 0, void 0, function () {
      var headerInfo, pregnancyId, recordData;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            headerInfo = props.headerInfo;
            pregnancyId = headerInfo === null || headerInfo === void 0 ? void 0 : headerInfo.id;
            return [4, api.initial.findFirstVisitOperatingRecord(pregnancyId)];
          case 1:
            recordData = _a.sent();
            set_recordData(recordData);
            set_isShowModifyRecord(true);
            return [2];
        }
      });
    });
  }
  function renderModifyRecord() {
    var columns = [{
      title: '编号',
      dataIndex: 'items',
      key: 'items',
      render: function render(text, record, index) {
        return index + 1;
      },
      width: 30
    }, {
      title: '时间',
      dataIndex: 'operateDate',
      key: 'operateDate',
      width: 50
    }, {
      title: '修改人',
      dataIndex: 'operator',
      key: 'operator',
      width: 50
    }, {
      title: '修改字段',
      dataIndex: 'content',
      key: 'content',
      render: function render(text) {
        var str = '';
        _forEach(text, function (item) {
          str += "".concat(_get(item, 'operatingDescription'), "\uFF1B");
        });
        return str;
      },
      width: 200
    }];
    return /*#__PURE__*/React__default.createElement(_Modal, {
      visible: isShowModifyRecord,
      title: "\u5386\u53F2\u9996\u68C0\u8BB0\u5F55",
      footer: null,
      width: "80%",
      onCancel: function onCancel() {
        return set_isShowModifyRecord(false);
      }
    }, /*#__PURE__*/React__default.createElement(Table, {
      className: "prenatal-visit-main-table",
      columns: columns,
      dataSource: recordData,
      pagination: false
    }));
  }
  return /*#__PURE__*/React__default.createElement(_Row, {
    gutter: 16,
    className: "zhen-duan label-width5"
  }, /*#__PURE__*/React__default.createElement(_Col, {
    span: "8"
  }, /*#__PURE__*/React__default.createElement(DoctorEnd_Diagnoses, {
    changeScreening: changeScreening,
    changeSyphilis: changeSyphilis,
    saveHeaderInfo: saveHeaderInfo,
    setDiagnosesList: setDiagnosesList,
    setDiagnosesWord: setDiagnosesWord,
    diagnosesWord: diagnosesWord,
    getHighriskDiagnosis: getHighriskDiagnosis,
    headerInfo: headerInfo,
    diagnosesList: diagnosesList,
    noshowlist: false,
    isAllPregnancies: false,
    serialNo: serialNo,
    page: ''
  })), /*#__PURE__*/React__default.createElement(_Col, {
    span: "16"
  }, /*#__PURE__*/React__default.createElement("div", {
    className: "form-wrapper"
  }, /*#__PURE__*/React__default.createElement(Wrap, null, /*#__PURE__*/React__default.createElement(FormSectionForm, {
    onValuesChange: function onValuesChange(changedValues) {},
    onFinish: function onFinish(v) {
      var values = form.getFieldsValue();
      handleSubmit(values);
    },
    formDescriptions: __DEV__ ? function () {
      return import('./prenatal-visit.pregnancy.doctor-end11.js');
    } : config === null || config === void 0 ? void 0 : config.tableColumns,
    form: form
  })), /*#__PURE__*/React__default.createElement(_Button, {
    hidden: mchcEnv.is('广三'),
    className: "his-btn",
    type: "dashed",
    icon: /*#__PURE__*/React__default.createElement(TableOutlined, null),
    onClick: handleRecordBtn
  }, "\u9996\u68C0\u4FE1\u606F\u5386\u53F2\u4FEE\u6539\u8BB0\u5F55"), /*#__PURE__*/React__default.createElement(_Button, {
    hidden: mchcEnv.is('广三'),
    className: "his-btn",
    type: "dashed",
    icon: /*#__PURE__*/React__default.createElement(TableOutlined, null),
    onClick: function onClick() {
      return set_isShowManageModal(true);
    }
  }, "\u4EA7\u68C0\u8BA1\u5212"), /*#__PURE__*/React__default.createElement("div", {
    style: {
      marginTop: '10px'
    }
  }, /*#__PURE__*/React__default.createElement(HighRiskTableEntry, {
    headerInfo: headerInfo,
    data: visitData
  }), /*#__PURE__*/React__default.createElement(_Button, {
    icon: /*#__PURE__*/React__default.createElement(SyncOutlined, null),
    size: "large",
    onClick: initData,
    style: {
      marginLeft: 12
    }
  }, "\u5237\u65B0"))), !noShowBtn && /*#__PURE__*/React__default.createElement(_Space, {
    className: "prenatal-visit-main_initial-btns"
  }, diagnosis_addon_btns === null || diagnosis_addon_btns === void 0 ? void 0 : diagnosis_addon_btns(visitData), /*#__PURE__*/React__default.createElement(_Button, {
    size: "large",
    onClick: function onClick() {
      return handlePrint('prenatalVisit');
    },
    icon: /*#__PURE__*/React__default.createElement(PrinterOutlined, null)
  }, "\u6253\u5370\u6863\u6848"), /*#__PURE__*/React__default.createElement(_Button, {
    size: "large",
    onClick: function onClick() {
      return handlePrint('prenatalVisit1');
    },
    icon: /*#__PURE__*/React__default.createElement(PrinterOutlined, null)
  }, "\u6253\u5370\u75C5\u5386"), /*#__PURE__*/React__default.createElement(_Button, {
    size: "large",
    hidden: !mchcEnv.is('郫都'),
    type: "primary",
    disabled: !canSave,
    onClick: function onClick() {
      return handleSubmitBefore(false);
    }
  }, "\u4EC5\u4FDD\u5B58"), /*#__PURE__*/React__default.createElement(_Button, {
    size: "large",
    type: "primary",
    disabled: !canSave,
    onClick: function onClick() {
      return handleSubmitBefore(true);
    },
    icon: /*#__PURE__*/React__default.createElement(SaveOutlined, null)
  }, "\u4FDD\u5B58", mchcEnv.is('华医') ? '并关闭' : ''))), isShowMenzhen && /*#__PURE__*/React__default.createElement(Index$2, {
    isShowMenzhen: isShowMenzhen,
    closeModal: closeModal
  }), false, /*#__PURE__*/React__default.createElement(Index$3, {
    closeModal: closeModal,
    changePreventPreeclampsia: changePreventPreeclampsia,
    isShowPreventPreeclampsia: isShowPreventPreeclampsia
  }), isShowManageModal && /*#__PURE__*/React__default.createElement(ManagementPlan, {
    isShowManageModal: isShowManageModal,
    closeModal: closeModal,
    headerInfo: headerInfo
  }), renderModifyRecord());
}
Object.assign(Index, {
  Title: Title,
  Config: null,
  ClassName: ClassName
});
function ZhuanKeJianCha(props) {
  var form = props.form,
    active = props.active;
  var id = mchcUtils.getDoctorEndId();
  var _a = BF_Wrap2({
      default_conf: {
        tableColumns: function tableColumns() {
          return import('./prenatal-visit.pregnancy.doctor-end12.js');
        },
        title: '门诊-专科检查'
      }
    }),
    Wrap = _a.Wrap,
    config = _a.config;
  useEffect(function () {
    if (active) {
      SMchc_Doctor.getGynecologicalExamOfOutpatient(id).then(function (v) {
        form.setFieldsValue(v);
      });
    }
    return function () {};
  }, [active]);
  return /*#__PURE__*/React.createElement(Wrap, null, /*#__PURE__*/React.createElement(FormSectionForm, {
    onValuesChange: function onValuesChange(changedValues) {},
    onFinish: function onFinish(v) {
      SMchc_Doctor.updateGynecologicalExamOfOutpatient(v);
    },
    formDescriptions: config === null || config === void 0 ? void 0 : config.tableColumns,
    form: form
  }));
}
Object.assign(ZhuanKeJianCha, {
  Title: '专科检查',
  ClassName: 'yi-ban-bing-shi label-width6',
  tmp: true
});
var isChiefComplaintRequired = false;
var isPhiRequired = false;
var emptyData = {
  'tab-0': ['现病史'],
  'tab-1': ['既往史'],
  'tab-2': ['其他病史'],
  'tab-3': ['孕产史'],
  'tab-4': ['体格检查'],
  'tab-5': ['专科检查'],
  'tab-6': ['检验检查'],
  'tab-7': ['诊断处理']
};
var requiredForm = {
  'tab-0': [],
  'tab-1': [],
  'tab-2': [],
  'tab-3': [],
  'tab-4': [],
  'tab-5': [],
  'tab-6': [],
  'tab-7': []
};
var getRequiredForm = function getRequiredForm(tab, config) {
  var arr = [];
  config && config.forEach(function (item) {
    if (_get(item, 'rules') && _get(item, 'rules').indexOf('required') > 0) {
      var rules = jsonParse(_get(item, 'rules'));
      if (rules && _get(rules, '0.required')) {
        var key = _get(item, 'key');
        if (key === 'chiefComplaint') {
          isChiefComplaintRequired = true;
        }
        if (key === 'phi') {
          isPhiRequired = true;
        }
        if (key.indexOf('(Note)') > 0) {
          key = key.substring(0, key.length - 6);
        }
        arr.push(key);
      }
    }
  });
  _set(requiredForm, tab, arr);
};
var jsonParse = function jsonParse(str) {
  try {
    var obj = JSON.parse(str);
    return obj;
  } catch (_a) {
    return null;
  }
};
var getEmptyData = function getEmptyData(pregData, visitData) {
  var cloneForm = _cloneDeep(requiredForm);
  var tabKeys = Object.keys(emptyData);
  var preTabs = ['tab-0', 'tab-1', 'tab-2', 'tab-3', 'tab-6'];
  var judgeItem = function judgeItem(data, item, tab) {
    if (!_get(data, item) && !emptyData[tab].includes(item)) {
      !_isBoolean(_get(data, item)) && emptyData[tab].push(item);
    } else if ((_isBoolean(_get(data, item)) || !!_get(data, item)) && emptyData[tab].includes(item)) {
      emptyData[tab].splice(emptyData[tab].indexOf(item), 1);
    }
  };
  tabKeys.forEach(function (tab) {
    cloneForm[tab].forEach(function (formItem) {
      if (preTabs.includes(tab)) {
        judgeItem(pregData, formItem, tab);
        if (tab === 'tab-0' && isChiefComplaintRequired) {
          judgeItem(visitData, 'chiefComplaint', tab);
        }
        if (tab === 'tab-0' && isPhiRequired) {
          judgeItem(visitData, 'phi', tab);
        }
      } else {
        judgeItem(visitData, formItem, tab);
        if (tab === 'tab-4') {
          var extraArr = ['personalProfile.preweight', 'personalProfile.bmi'];
          extraArr.forEach(function (formItem) {
            judgeItem(pregData, formItem, tab);
          });
        }
      }
    });
  });
  return emptyData;
};
var css_248z = ".prenatal-visit-main_initial {\n  height: 100%;\n  overflow: auto;\n  padding: 6px;\n  background-color: #fff;\n}\n.prenatal-visit-main_initial .border {\n  position: relative;\n  margin: 16px 0;\n  padding: 16px 8px 4px;\n  border: 1px solid #d7dce7;\n  border-radius: 2px;\n}\n.prenatal-visit-main_initial .border .border-form_section_title {\n  position: absolute;\n  top: -13px;\n  left: 24px;\n  display: inline-block;\n  padding: 0 12px;\n  color: #150f55;\n  font-weight: bold;\n  font-size: 16px;\n  background-color: #1f1f1f;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs {\n  height: 100%;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs > .ant-tabs-content-holder {\n  padding-bottom: 128px;\n  max-height: 670px;\n  overflow-y: auto;\n  border: 1px solid #212c3d;\n  border-top: none;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs > .ant-tabs-content-holder .ant-tabs-content {\n  min-width: 1200px;\n  padding: 12px 0;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs > .ant-tabs-nav {\n  margin-bottom: 0;\n  background-color: #f0f2f5 !important;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs > .ant-tabs-nav .ant-tabs-nav-wrap {\n  border-bottom: 1px solid #212c3d;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs > .ant-tabs-nav .ant-tabs-tab {\n  height: 34px !important;\n  margin-right: 0px !important;\n  margin-left: 0 !important;\n  padding: 6px 16px !important;\n  background-color: #fff !important;\n  border-left-color: #fafafa !important;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs > .ant-tabs-nav .ant-tabs-tab.ant-tabs-tab-active {\n  color: #212c3d;\n  border-color: #212c3d !important;\n  border-bottom: none !important;\n  border-radius: 2px 2px 0 0 !important;\n  transform: translateY(1px) !important;\n}\n.prenatal-visit-main_initial .ant-tabs > .ant-tabs-nav .ant-tabs-nav-wrap,\n.prenatal-visit-main_initial .ant-tabs > div > .ant-tabs-nav .ant-tabs-nav-wrap {\n  overflow: visible;\n}\n.prenatal-visit-main_initial .prenatal-visit-main_initial-tabs .ant-tabs-bar {\n  margin-bottom: 0;\n}\n.prenatal-visit-main_initial-btns {\n  position: fixed;\n  right: 40px;\n  bottom: 24px;\n}\n.prenatal-visit-main_initial-btns .ant-btn {\n  min-width: 128px;\n  box-shadow: 0px 9px 10px -6px rgba(146, 171, 207, 0.2), 0px 2px 8px -4px #92abcf;\n}\n.prenatal-visit-main_initial-btns .ant-form-item-control-input-content {\n  text-align: center;\n}\n";
styleInject(css_248z);
var getDoctorEndId = mchcUtils.getDoctorEndId;
var tabContents = [Index$1, JWS$1, JWS$3, JWS, JWS$2, ZhuanKeJianCha, JianYanJianCha, Index];
var allTabs = tabContents.map(function (tab, i) {
  return {
    key: "tab-".concat(i),
    title: tab.Title,
    config: tab.Config,
    className: tab.ClassName,
    Content: tab,
    requestFrom: false,
    error: false
  };
});
function DoctorEnd_Initial(props) {
  var _this = this;
  var headerInfo = props.headerInfo,
    formChange = props.formChange,
    id = props.id;
  props.updateHeaderInfo;
  var setDiagnosesList = props.setDiagnosesList,
    setDiagnosesWord = props.setDiagnosesWord,
    diagnosesWord = props.diagnosesWord,
    saveHeaderInfo = props.saveHeaderInfo,
    getHighriskDiagnosis = props.getHighriskDiagnosis,
    changeScreening = props.changeScreening;
  props.changeDiagnosesTemplate;
  props.changePreeclampsia;
  var changeSyphilis = props.changeSyphilis,
    changePreventPreeclampsia = props.changePreventPreeclampsia,
    diagnosesList = props.diagnosesList,
    isShowPreventPreeclampsia = props.isShowPreventPreeclampsia;
  var pregnancyId = getDoctorEndId(props);
  useRef({});
  var _a = useState({}),
    visitData = _a[0];
  _a[1];
  var _b = useState({});
  _b[0];
  _b[1];
  var _c = useState(false),
    modalTips = _c[0],
    set_modalTips = _c[1];
  var _d = useState({
      subscribe: function subscribe(a, b, c) {},
      listenFormData: function listenFormData(v) {},
      submit: function submit() {
        return {
          validCode: null,
          res: null
        };
      },
      fieldChange: false
    }),
    formHandler = _d[0],
    set_formHandler = _d[1];
  var _e = useState({
      sureEdd: ''
    }),
    updateGesweekTips = _e[0],
    set_updateGesweekTips = _e[1];
  var _f = useState([]);
  _f[0];
  var set_zdFormConfig = _f[1];
  var _g = useState({}),
    newFormData = _g[0],
    set_newFormData = _g[1];
  var _h = useState(allTabs[0].key),
    cur_step = _h[0],
    set_cur_step = _h[1];
  var _j = useState(allTabs),
    tabs = _j[0],
    set_tabs = _j[1];
  var _k = useState(false),
    updateGesweekModalVisible = _k[0],
    set_updateGesweekModalVisible = _k[1];
  var _l = useState(true);
  _l[0];
  _l[1];
  var _m = useState(0),
    sureEddModify = _m[0],
    set_sureEddModify = _m[1];
  var _o = useState(),
    sureUpdateEdd = _o[0],
    set_sureUpdateEdd = _o[1];
  var forms = useRef(Array(10).fill(0).map(function (_) {
    return _Form.useForm()[0];
  }));
  var _p = useState(false),
    canSave = _p[0],
    setCanSave = _p[1];
  var _q = useState(''),
    serialNo = _q[0],
    setSerialNo = _q[1];
  useEffect(function () {
    if (id) {
      initTabs().then(function () {
        requestTabFormData('tab-0');
      });
    }
    event.on(CheckAndCancelButton.displayName, checkCb);
    var rm = mchcEvent.on_rm('my_form', function (e) {
      return __awaiter(_this, void 0, void 0, function () {
        var name, value, setValue, checkedValues, withInputValues, subValue, 移植时间, 天数, isIVF, value_1;
        var _a, _b, _c, _d;
        return __generator(this, function (_e) {
          switch (_e.label) {
            case 0:
              if (e.type !== 'onChange') return [2];
              name = e.name, value = e.value, setValue = e.setValue;
              if (!(name === 'conceiveMode(Note)')) return [3, 2];
              checkedValues = value['conceiveMode'];
              withInputValues = safe_json_parse(value['conceiveModeNote']);
              subValue = (_b = (_a = withInputValues === null || withInputValues === void 0 ? void 0 : withInputValues[checkedValues]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : {};
              移植时间 = subValue[0];
              天数 = (_c = subValue[1]) !== null && _c !== void 0 ? _c : 0;
              (_d = subValue[2]) !== null && _d !== void 0 ? _d : 0;
              isIVF = checkedValues === 1;
              if (!(isIVF && 移植时间)) return [3, 2];
              return [4, SLocal_Calculator.calcEddBasedOnIVF(移植时间, 天数)];
            case 1:
              value_1 = _e.sent();
              mchcModal__.confirmOnce({
                title: '根据胚胎移植时间，是否调整预产期B超时间？',
                storeKey: ALLOW_CALC_EDD_BASED_ON_IVF,
                cb: function cb() {
                  return setValue === null || setValue === void 0 ? void 0 : setValue('sureEdd', value_1);
                }
              });
              _e.label = 2;
            case 2:
              return [2];
          }
        });
      });
    });
    return function () {
      event.off(CheckAndCancelButton.displayName, checkCb);
      rm();
    };
  }, [id]);
  useEffect(function () {
    if (formHandler && formHandler.listenFormData) {
      formHandler.listenFormData(function () {
        return handleFormChange(true);
      });
    }
    if (formHandler.subscribe) {
      formHandler.subscribe('lmp', 'change', function (val) {
        return __awaiter(_this, void 0, void 0, function () {
          var res, conceiveMode, edd, ntUltrasounds, nfUltrasounds, data;
          var _a, _b;
          return __generator(this, function (_c) {
            switch (_c.label) {
              case 0:
                if (!val) return [2];
                return [4, formHandler.submit()];
              case 1:
                res = _c.sent().res;
                conceiveMode = (_b = (_a = res === null || res === void 0 ? void 0 : res['conceiveMode(Note)']) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.conceiveMode;
                return [4, api.initial.calcEddByLmp(val)];
              case 2:
                edd = _c.sent();
                if (_get(getTabData('tab-0'), 'sureEddModify') == 1) {
                  formHandler.edd.actions.setValue(edd);
                } else {
                  formHandler.edd.actions.setValue(edd);
                  conceiveMode !== 1 && formHandler.sureEdd.actions.setValue(edd);
                }
                ntUltrasounds = _cloneDeep(formHandler.ntExams.actions.getValue().value);
                nfUltrasounds = _cloneDeep(formHandler.nfExams.actions.getValue().value);
                _forEach(ntUltrasounds, function (item) {
                  if (item.checkdate) {
                    item.menopause = menopauseWeek(item.checkdate, val);
                  } else {
                    item.menopause = '';
                  }
                });
                _forEach(nfUltrasounds, function (item) {
                  if (item.checkdate) {
                    item.menopause = menopauseWeek(item.checkdate, val);
                  } else {
                    item.menopause = '';
                  }
                });
                formHandler.ntExams.actions.setValue(ntUltrasounds);
                formHandler.nfExams.actions.setValue(nfUltrasounds);
                if (!(_get(getTabData('tab-0'), 'sureEddModify') == 0)) return [3, 4];
                return [4, api.initial.updateGesweekAlert(pregnancyId, edd)];
              case 3:
                data = _c.sent();
                if (_get(data, 'remind')) {
                  set_updateGesweekTips(__assign(__assign({}, data), {
                    sureEdd: edd
                  }));
                  set_updateGesweekModalVisible(true);
                }
                _c.label = 4;
              case 4:
                return [2];
            }
          });
        });
      });
      formHandler.subscribe('sureEdd', 'change', function (val) {
        return __awaiter(_this, void 0, void 0, function () {
          var data;
          return __generator(this, function (_a) {
            switch (_a.label) {
              case 0:
                if (!val) return [2];
                if (!dayjs(val).isSame(_get(getTabData('tab-0'), 'sureEdd'))) {
                  set_sureEddModify(1);
                }
                return [4, api.initial.updateGesweekAlert(pregnancyId, val)];
              case 1:
                data = _a.sent();
                if (_get(data, 'remind')) {
                  set_updateGesweekTips(__assign(__assign({}, data), {
                    sureEdd: val
                  }));
                  set_updateGesweekModalVisible(true);
                }
                return [2];
            }
          });
        });
      });
      formHandler.subscribe('ntExams', 'change', function (val) {
        var newVal = _cloneDeep(val);
        var lmp = formHandler.lmp.actions.getValue().value;
        _forEach(newVal, function (item, index) {
          if (item.checkdate && lmp && !_isEqual(item.checkdate, _get(item, "oldCheckDate"))) {
            item.menopause = menopauseWeek(item.checkdate, lmp);
          }
        });
        formHandler.ntExams.actions.setValue(newVal);
      });
      formHandler.subscribe('nfExams', 'change', function (val) {
        var newVal = _cloneDeep(val);
        var lmp = formHandler.lmp.actions.getValue().value;
        _forEach(newVal, function (item) {
          if (item.checkdate && lmp && !_isEqual(item.checkdate, _get(item, "oldCheckDate"))) {
            item.menopause = menopauseWeek(item.checkdate, lmp);
          }
        });
        formHandler.nfExams.actions.setValue(newVal);
      });
    }
  }, [formHandler]);
  var handleFormChange = function handleFormChange(bool) {
    set_modalTips(!bool);
    formChange(bool);
  };
  var checkCb = function checkCb(name, flag) {
    var moduleName = name;
    var allKeys = Object.keys(formHandler);
    var targetKeys = allKeys.filter(function (k) {
      return k.startsWith(moduleName) && k.endsWith('(Note)');
    }).map(function (k) {
      return k.split('.')[1].replace(/\(.*\)/g, '');
    });
    targetKeys.forEach(function (k) {
      var _a;
      formHandler["".concat(moduleName, ".").concat(k, "(Note)")].actions.setValue((_a = {}, _a[k] = flag ? false : undefined, _a["".concat(k, "Note")] = undefined, _a));
    });
  };
  function initTabs() {
    return __awaiter(this, arguments, void 0, function (tab) {
      var cloneTabs, obj, res, ind;
      if (tab === void 0) {
        tab = 'tab-0';
      }
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            cloneTabs = _cloneDeep(tabs);
            obj = _find(cloneTabs, function (item) {
              return item.key == tab;
            });
            if (_get(obj, "requestFrom")) {
              return [2, false];
            }
            return [4, api.initial.getFormConfigByTab(tab)];
          case 1:
            res = _a.sent();
            if (tab == 'tab-7') {
              getRequiredForm('tab-7', res.fields);
              set_zdFormConfig(res.fields);
            }
            ind = parseInt(tab.slice(4)) || 0;
            cloneTabs[ind].config = cloneTabs[ind].config || res.fields;
            cloneTabs[ind].requestFrom = true;
            getRequiredForm('tab-0', cloneTabs[ind].config);
            set_tabs(cloneTabs);
            return [2];
        }
      });
    });
  }
  function requestTabFormData(tab) {
    return __awaiter(this, void 0, void 0, function () {
      var res, d, _diagnoses, ntExams_1;
      var _a;
      return __generator(this, function (_b) {
        switch (_b.label) {
          case 0:
            return [4, requestMethods[getTabMethods[tab]](pregnancyId)];
          case 1:
            res = _b.sent();
            if (res.serialNo) {
              setSerialNo(res.serialNo);
            }
            if (tab == 'tab-0') {
              if (mchcEnv["in"](['广三', '建瓯'])) {
                set_sureEddModify(_get(res, 'sureEddModify') ? _get(res, 'sureEddModify') : 0);
              }
              reduceTab0(res);
              if (mchcEnv.is('越秀妇幼') && res.visitId) {
                SMchc_Doctor.getVisitEmrEditable(res.visitId).then(setCanSave)["catch"](function () {
                  return setCanSave(true);
                });
              } else {
                setCanSave(true);
              }
            }
            set_newFormData(__assign(__assign({}, newFormData), (_a = {}, _a[tab] = res, _a)));
            if (tab == 'tab-7') {
              d = res.diagnoses;
              _diagnoses = filter_diagnoses(d);
              setDiagnosesList(_diagnoses);
            }
            if (tab == 'tab-0') {
              ntExams_1 = res.ntExams;
              if (ntExams_1 && ntExams_1.length > 0) {
                setTimeout(function () {
                  checkNtExamNeedCorrect(res, ntExams_1[0]);
                }, 300);
              }
            }
            return [2];
        }
      });
    });
  }
  function reduceTab0(res) {
    if (!mchcEnv.is('越秀妇幼')) return;
    var newNtVal = _cloneDeep(_get(res, 'ntExams'));
    var newNfVal = _cloneDeep(_get(res, 'nfExams'));
    var sureEdd = _get(res, 'sureEdd');
    _forEach(newNtVal, function (item, index) {
      if (item.checkdate && sureEdd) {
        item.menopause = getGesWeek(sureEdd, item.checkdate);
      }
    });
    _forEach(newNfVal, function (item) {
      if (item.checkdate && sureEdd) {
        item.menopause = getGesWeek(sureEdd, item.checkdate);
      }
    });
    _set(res, 'ntExams', newNtVal);
    _set(res, 'nfExams', newNfVal);
  }
  function cal_next_tab(key) {
    var idx = tabs.findIndex(function (item) {
      return item.key === key;
    });
    if (idx === -1 || idx === tabs.length) return;
    return tabs[idx + 1];
  }
  function cal_next_step(key) {
    var _a;
    return (_a = cal_next_tab(key)) === null || _a === void 0 ? void 0 : _a.key;
  }
  function handleSubmit(key) {
    return __awaiter(this, void 0, void 0, function () {
      var tab, idx, form, _data, validCode, __res, postData;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            if (cur_step == 'tab-7') return [2];
            tab = tabs.filter(function (item) {
              return item.key === cur_step;
            })[0];
            idx = Number(tab.key.slice(-1));
            if (!tab.Content.tmp) return [3, 6];
            _a.label = 1;
          case 1:
            _a.trys.push([1, 4,, 5]);
            form = forms.current[idx];
            if (!form) return [3, 3];
            return [4, form.validateFields()];
          case 2:
            _a.sent();
            form.submit();
            _a.label = 3;
          case 3:
            return [3, 5];
          case 4:
            _a.sent();
            _message.destroy();
            _message.error('请完善表单项！!');
            return [3, 5];
          case 5:
            return [2];
          case 6:
            return [4, formHandler.submit()];
          case 7:
            _data = _a.sent();
            validCode = _data.validCode;
            __res = _data.res;
            tab.error = !validCode;
            if (!validCode) return [3, 10];
            if (!__res) return [3, 9];
            delete __res['fmh'];
            postData = getFormData(__res, true);
            return [4, __handleSave(__assign(__assign(__assign({}, _get(newFormData, "".concat(cur_step))), postData), {
              sureEddModify: sureEddModify
            }))];
          case 8:
            _a.sent();
            _a.label = 9;
          case 9:
            return [3, 11];
          case 10:
            _message.destroy();
            _message.error('请完善表单项！!');
            set_tabs(tabs);
            _a.label = 11;
          case 11:
            return [2];
        }
      });
    });
  }
  function __handleSave(postData) {
    return __awaiter(this, void 0, void 0, function () {
      var cloneStep, ntExams, hasCheck;
      var _this = this;
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            mchcLogger.log('__handleSave', postData);
            cloneStep = cur_step;
            if (!(cloneStep == 'tab-0' && !modalTips)) return [3, 2];
            ntExams = _get(postData, 'ntExams', []);
            if (!(ntExams && ntExams.length > 0)) return [3, 2];
            return [4, checkNtExamNeedCorrect(postData, ntExams[0])];
          case 1:
            hasCheck = _a.sent();
            if (hasCheck) {
              return [2];
            }
            _a.label = 2;
          case 2:
            return [4, requestMethods[updateTabMethods[cur_step]](postData).then(function (data) {
              return __awaiter(_this, void 0, void 0, function () {
                var res;
                var _a;
                return __generator(this, function (_b) {
                  if (data) {
                    res = _cloneDeep(data);
                    set_newFormData(__assign(__assign({}, newFormData), (_a = {}, _a[cloneStep] = res, _a)));
                    mchcEvent.emit('outpatient', {
                      type: '刷新头部',
                      pregnancyId: pregnancyId
                    });
                    _message.success('信息保存成功');
                  }
                  return [2];
                });
              });
            })];
          case 3:
            _a.sent();
            formChange(false);
            return [2];
        }
      });
    });
  }
  function getTabData(tab) {
    var _a, _b;
    var oldValue = (_a = newFormData[tab]) !== null && _a !== void 0 ? _a : {};
    if (tab === 'tab-3') {
      (_b = oldValue.pregnancymh) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) {
        return a.gravidityindex - b.gravidityindex;
      });
    }
    return oldValue;
  }
  function getIcon(key, error) {
    if (headerInfo || visitData) {
      getEmptyData(headerInfo, visitData);
    }
    if (error) return /*#__PURE__*/React__default.createElement(ExclamationCircleOutlined, null);
    if (emptyData[key].length === 1) return /*#__PURE__*/React__default.createElement(CheckCircleOutlined, null);
    return null;
  }
  function handlePrint(resource, id) {
    if (resource === void 0) {
      resource = 'prenatalVisit';
    }
    var visitId = id || _get(headerInfo, 'id');
    mchcModal__.open('print_modal', {
      modal_data: {
        requestData: {
          url: '/api/pdf-preview',
          resource: resource || 'prenatalVisit',
          template: '',
          version: '',
          note: '',
          id: visitId
        }
      }
    });
  }
  function handleUpdateGesweek() {
    return __awaiter(this, void 0, void 0, function () {
      return __generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            return [4, api.initial.updateGesweekBysureEdd({
              pregnancyId: pregnancyId,
              sureEdd: _get(updateGesweekTips, 'sureEdd')
            })];
          case 1:
            _a.sent();
            set_updateGesweekModalVisible(false);
            set_sureUpdateEdd(_get(updateGesweekTips, 'sureEdd'));
            return [2];
        }
      });
    });
  }
  function cancelGesweekTips() {
    set_updateGesweekModalVisible(false);
    if (_get(newFormData, 'tab-0')) {
      if (sureUpdateEdd) {
        formHandler.sureEdd.actions.setValue(sureUpdateEdd);
      } else {
        formHandler.sureEdd.actions.setValue(_get(newFormData, 'tab-0.sureEdd'));
      }
    }
  }
  function renderUpdateGesweekTips() {
    return /*#__PURE__*/React__default.createElement(_Modal, {
      visible: updateGesweekModalVisible,
      onOk: handleUpdateGesweek,
      onCancel: cancelGesweekTips
    }, /*#__PURE__*/React__default.createElement("p", null, /*#__PURE__*/React__default.createElement(ExclamationCircleOutlined, null), /*#__PURE__*/React__default.createElement("span", null, " \u8BF7\u6CE8\u610F\uFF1A")), /*#__PURE__*/React__default.createElement("p", null, _get(updateGesweekTips, 'remind')));
  }
  function checkNtExamNeedCorrect(formData, ntExam) {
    var _this = this;
    var ntgestationalWeek = _get(ntExam, 'gestationalWeek') || '';
    var ntcheckdate = _get(ntExam, 'checkdate');
    if (!ntgestationalWeek) {
      return false;
    }
    if (!ntcheckdate) {
      return false;
    }
    var week = Number(ntgestationalWeek.split('+')[0]);
    var day = Number(ntgestationalWeek.split('+')[1]) || 0;
    var gestationalWeekDay = week * 7 + day;
    var ntEdd = dayjs(ntcheckdate).add(280 - gestationalWeekDay, 'days');
    var sureEdd = dayjs(headerInfo.edd);
    var diffDay = Math.abs(ntEdd.diff(sureEdd, 'days'));
    if (diffDay > 7) {
      _Modal.confirm({
        width: '700px',
        title: '预产期-B超纠正提醒',
        content: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, "\u6839\u636ENT\u68C0\u67E5\u5982\u5B55\u5468\u6570\uFF0C\u63A8\u6D4B\u9884\u4EA7\u671F-B\u8D85\uFF1A", ntEdd.format('YYYY-MM-DD'), "(\u539F\u9884\u4EA7\u671F\u4E3A", sureEdd.format('YYYY-MM-DD'), ")\uFF0C"), /*#__PURE__*/React__default.createElement("div", null, "\u662F\u5426\u9700\u8981\u7EA0\u6B63\u9884\u4EA7\u671F-B\u8D85\u53CA\u5F53\u524D\u5B55\u5468,")),
        onOk: function onOk() {
          return __awaiter(_this, void 0, void 0, function () {
            var step, postData, finalRes;
            var _a;
            return __generator(this, function (_b) {
              switch (_b.label) {
                case 0:
                  step = 'tab-0';
                  postData = __assign(__assign({}, formData), {
                    sureEdd: ntEdd.format('YYYY-MM-DD')
                  });
                  return [4, requestMethods[updateTabMethods[step]](postData)];
                case 1:
                  finalRes = _b.sent();
                  _message.success('修改成功');
                  set_newFormData(__assign(__assign({}, newFormData), (_a = {}, _a[step] = finalRes, _a)));
                  mchcEvent.emit('outpatient', {
                    type: '刷新头部',
                    pregnancyId: pregnancyId
                  });
                  set_modalTips(false);
                  return [2];
              }
            });
          });
        },
        okText: '确认纠正',
        cancelText: '关闭'
      });
      set_modalTips(true);
      return true;
    } else {
      return false;
    }
  }
  var saveBtnTxt = canSave ? "\u4FDD\u5B58" : '无权限保存';
  return /*#__PURE__*/React__default.createElement("div", {
    className: "prenatal-visit-main_initial"
  }, /*#__PURE__*/React__default.createElement(_Tabs, {
    type: "card",
    activeKey: cur_step,
    className: "prenatal-visit-main_initial-tabs",
    onChange: function onChange(_next) {
      set_cur_step(_next);
      initTabs(_next);
      requestTabFormData(_next);
    }
  }, tabs.map(function (_a, idx) {
    var key = _a.key,
      title = _a.title,
      error = _a.error,
      config = _a.config,
      Content = _a.Content,
      className = _a.className;
    var isFunc = Content.tmp;
    var optionNode = /*#__PURE__*/React__default.createElement(_Space, {
      className: "prenatal-visit-main_initial-btns"
    }, /*#__PURE__*/React__default.createElement(_Button, {
      size: "large",
      onClick: function onClick() {
        return handlePrint('prenatalVisit', undefined);
      }
    }, /*#__PURE__*/React__default.createElement(PrinterOutlined, null), " \u6253\u5370\u6863\u6848"), /*#__PURE__*/React__default.createElement(_Button, {
      size: "large",
      type: "primary",
      disabled: !canSave,
      onClick: function onClick() {
        return handleSubmit();
      }
    }, /*#__PURE__*/React__default.createElement(SaveOutlined, null), " ", saveBtnTxt), cur_step != 'tab-7' && /*#__PURE__*/React__default.createElement(_Button, {
      size: "large",
      type: "primary",
      onClick: function onClick() {
        var _next = cal_next_step(cur_step);
        if (_next) {
          set_cur_step(_next);
          initTabs(_next);
          requestTabFormData(_next);
        }
      }
    }, /*#__PURE__*/React__default.createElement(ArrowRightOutlined, null), " \u4E0B\u4E00\u9875"));
    var node = cur_step === key && cur_step !== 'tab-7' ? /*#__PURE__*/React__default.createElement(MyForm, {
      disabled_all: !canSave,
      config: config !== null && config !== void 0 ? config : [],
      value: getTabData(cur_step),
      getFormHandler: function getFormHandler(f) {
        set_formHandler(f);
      },
      submitChange: false
    }) : cur_step == 'tab-7' ? /*#__PURE__*/React__default.createElement(Index, {
      diagnosis_before_submit: props.diagnosis_before_submit,
      diagnosis_addon_btns: props.diagnosis_addon_btns,
      canSave: canSave,
      serialNo: serialNo,
      active: key === cur_step,
      form: forms.current[idx],
      handlePrint: handlePrint,
      changeScreening: changeScreening,
      changeSyphilis: changeSyphilis,
      changePreventPreeclampsia: changePreventPreeclampsia,
      diagnosesList: diagnosesList,
      noShowBtn: false,
      isShowPreventPreeclampsia: isShowPreventPreeclampsia,
      headerInfo: headerInfo,
      setDiagnosesList: setDiagnosesList,
      setDiagnosesWord: setDiagnosesWord,
      getHighriskDiagnosis: getHighriskDiagnosis,
      diagnosesWord: diagnosesWord,
      saveHeaderInfo: saveHeaderInfo
    }) : null;
    return /*#__PURE__*/React__default.createElement(_Tabs.TabPane, {
      key: key,
      tab: /*#__PURE__*/React__default.createElement("span", {
        style: error ? {
          color: '#ff0000'
        } : {}
      }, getIcon(key, error), title)
    }, /*#__PURE__*/React__default.createElement("div", {
      className: className
    }, /*#__PURE__*/React__default.createElement(MyLazyComponent, {
      size: "middle"
    }, isFunc ? /*#__PURE__*/React__default.createElement(Content, {
      active: key === cur_step,
      form: forms.current[idx]
    }) : node, cur_step == 'tab-7' ? null : optionNode)));
  })), renderUpdateGesweekTips());
}
export { DoctorEnd_Initial as default };
//# sourceMappingURL=prenatal-visit.pregnancy.doctor-end.js.map
