import 'antd/es/form/style';
import _Form from 'antd/es/form';
import { b as __awaiter, c as __generator, d as __assign } from './index.js';
import { BF_Wrap2, MyBaseList } from '@lm_fe/pages';
import { request, formatDate } from '@lm_fe/utils';
import React__default from 'react';
import { defineFormConfig } from '@lm_fe/service';
import { mchcEnv, APP_CONFIG } from '@lm_fe/env';
import 'lodash/get';
import 'antd/es/tabs/style';
import 'antd/es/tabs';
import 'lodash/size';
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 'antd/es/button/style';
import 'antd/es/button';
import 'lodash/assign';
import '@ant-design/icons';
import '@lm_fe/components_m';
React__default.createElement;
var engagementOption = [{
  label: '入',
  value: '入'
}, {
  label: '未',
  value: '未'
}, {
  label: '半',
  value: '半'
}];
if (mchcEnv["in"](['郫都'])) {
  engagementOption = [{
    label: '浮',
    value: '浮'
  }, {
    label: '半入',
    value: '半入'
  }, {
    label: '入',
    value: '入'
  }];
}
var fetalMovement = [{
  label: '无',
  value: '无'
}, {
  label: '有',
  value: '有'
}, {
  label: '120-140',
  value: '120-140'
}];
var fetalPosition = [{
  label: '左上',
  value: '左上'
}, {
  label: '左下',
  value: '左下'
}, {
  label: '右上',
  value: '右上'
}, {
  label: '右下',
  value: '右下'
}, {
  label: '脐上',
  value: '脐上'
}, {
  label: '脐下',
  value: '脐下'
}];
var position = [{
  label: 'LOT',
  value: 'LOT'
}, {
  label: 'LOA',
  value: 'LOA'
}, {
  label: 'ROT',
  value: 'ROT'
}, {
  label: 'ROA',
  value: 'ROA'
}];
var presentation = [{
  label: '头',
  value: '头'
}, {
  label: '臀',
  value: '臀'
}, {
  label: '肩',
  value: '肩'
}, {
  label: '-',
  value: '-'
}];
var form_confg = defineFormConfig([{
  title: '就诊卡号',
  dataIndex: 'outpatientNO',
  inputType: 'patient_auto_complete',
  inputProps: {},
  width: 120,
  layout: '1/3'
}, {
  title: '姓名',
  dataIndex: 'name',
  width: APP_CONFIG.CELL_WIDTH_SMALL - 20,
  ellipsis: true,
  layout: '1/3'
}, {
  title: '创建时间',
  dataIndex: 'createDate',
  rules: [{
    required: false,
    message: '请输入创建时间'
  }],
  inputType: 'DatePicker',
  inputProps: {
    disabled: true
  },
  sortType: 'date',
  layout: '1/3'
}, {
  title: '血压-首测(mmHg)',
  dataIndex: ['physicalExamMeasure'],
  inputType: 'MyPressure',
  align: 'center',
  processRemote: function processRemote(v, form) {
    var value = v ? v : {};
    return [value.systolic, value.diastolic];
  },
  processLocal: function processLocal(v, form) {
    if (!form) return;
    var value = v ? v : [];
    var old_value = form.getFieldValue('physicalExamMeasure') || {};
    return Object.assign({}, old_value, {
      systolic: value[0],
      diastolic: value[1]
    });
  },
  inputProps: {
    marshal: 0
  },
  layout: '1/3'
}, {
  title: '血压-二测(mmHg)',
  dataIndex: ['physicalExamMeasure'],
  inputType: 'MyPressure',
  align: 'center',
  processRemote: function processRemote(v, form) {
    var value = v ? v : {};
    return [value.systolic2, value.diastolic2];
  },
  processLocal: function processLocal(v, form) {
    if (!form) return;
    var value = v ? v : [];
    var old_value = form.getFieldValue('physicalExamMeasure') || {};
    return Object.assign({}, old_value, {
      systolic2: value[0],
      diastolic2: value[1]
    });
  },
  inputProps: {
    marshal: 0
  },
  width: APP_CONFIG.CELL_WIDTH_SMALL - 20,
  layout: '1/3'
}, {
  title: '血压-三测(mmHg)',
  dataIndex: ['physicalExamMeasure'],
  processRemote: function processRemote(v, form) {
    var value = v ? v : {};
    return [value.systolic3, value.diastolic3];
  },
  processLocal: function processLocal(v, form) {
    if (!form) return;
    var value = v ? v : [];
    var old_value = form.getFieldValue('physicalExamMeasure') || {};
    return Object.assign({}, old_value, {
      systolic3: value[0],
      diastolic3: value[1]
    });
  },
  inputType: 'MyPressure',
  align: 'center',
  inputProps: {
    marshal: 0
  },
  width: APP_CONFIG.CELL_WIDTH_SMALL - 20,
  layout: '1/3'
}, {
  title: '身高(cm)',
  dataIndex: ['physicalExamMeasure', 'height'],
  inputType: 'input_with_label',
  inputProps: {
    min: 0,
    type: 'number'
  },
  width: 50,
  sortType: 'number',
  showFilter: false,
  align: 'center',
  layout: '1/3'
}, {
  title: '体重(kg)',
  dataIndex: ['physicalExamMeasure', 'weight'],
  inputType: 'input_with_label',
  inputProps: {
    min: 0,
    type: 'number'
  },
  width: 50,
  sortType: 'number',
  showFilter: false,
  align: 'center',
  layout: '1/3'
}, {
  title: '脉搏(bpm)',
  dataIndex: ['physicalExamMeasure', 'pulse'],
  inputType: 'input_with_range',
  inputProps: {
    min: 60,
    max: 100,
    tip: '脉搏的正常范围值是60~100bpm'
  },
  width: 50,
  sortType: 'number',
  showFilter: false,
  align: 'center',
  layout: '1/3'
}, {
  title: '宫高',
  dataIndex: ['gynecologicalExamMeasure', 'fundalHeight'],
  width: 45,
  align: 'center',
  layout: '1/3'
}, {
  title: '腹围',
  dataIndex: ['gynecologicalExamMeasure', 'waistHip'],
  width: 45,
  align: 'center',
  layout: '1/3'
}, {
  title: '衔接',
  dataIndex: ['gynecologicalExamMeasure', 'engagement'],
  width: 60,
  align: 'center',
  layout: '1/3',
  inputType: 'normal_select',
  inputProps: {
    options: engagementOption,
    style: {
      width: 156
    }
  }
}, {
  "dataIndex": ["gynecologicalExamMeasure", "id"],
  "form_hidden": true,
  "hidden": true
}, {
  title: '胎动',
  dataIndex: 'fetusesMeasure',
  inputType: 'ArrayPanel',
  isActive: false,
  hidden: !mchcEnv.is('郫都'),
  render: function render(value) {
    if (!value) {
      return '';
    }
    var str = '';
    if (value.length === 1) {
      str = value[0].fetalMovement;
    } else {
      value.map(function (item) {
        return str += "".concat(item.fetalMovement || '--', ";");
      });
    }
    return str;
  },
  width: 60
}, {
  title: '胎心率',
  dataIndex: 'fetusesMeasure',
  inputType: 'ArrayPanel',
  inputProps: {
    marshal: 0,
    targetLabelCol: 2,
    tip: '胎儿信息',
    formDescriptions: [mchcEnv.is('郫都') ? {
      layout: '1/5',
      inputType: 'MA',
      label: '胎动',
      name: 'fetalMovement',
      inputProps: {
        marshal: 0,
        options: fetalMovement
      }
    } : null, {
      layout: '1/5',
      inputType: 'input_number',
      label: '胎心率',
      name: 'fetalHeartRate'
    }, {
      layout: '1/5',
      inputType: 'MS',
      label: '位置',
      name: 'fetalPosition',
      inputProps: {
        marshal: 0,
        options: fetalPosition
      }
    }, {
      layout: '1/5',
      inputType: 'MS',
      label: '胎方位',
      name: 'position',
      inputProps: {
        marshal: 0,
        options: position
      }
    }, {
      layout: '1/5',
      inputType: 'MS',
      label: '先露',
      name: 'presentation',
      inputProps: {
        marshal: 0,
        options: presentation
      }
    }]
  },
  render: function render(value) {
    if (!value) {
      return '';
    }
    var str = '';
    if (value.length === 1) {
      str = value[0].fetalHeartRate;
    } else {
      value.map(function (item) {
        return str += "".concat(item.fetalHeartRate || '--', ";");
      });
    }
    return str;
  },
  width: 60
}, {
  title: '位置',
  dataIndex: 'fetusesMeasure',
  inputType: 'ArrayPanel',
  isActive: false,
  render: function render(value) {
    if (!value) {
      return '';
    }
    var str = '';
    if (value.length === 1) {
      str = value[0].fetalPosition;
    } else {
      value.map(function (item) {
        return str += "".concat(item.fetalPosition || '--', ";");
      });
    }
    return str;
  },
  width: 60
}, {
  title: '胎方位',
  dataIndex: 'fetusesMeasure',
  inputType: 'ArrayPanel',
  isActive: false,
  render: function render(value) {
    if (!value) {
      return '';
    }
    var str = '';
    if (value.length === 1) {
      str = value[0].position;
    } else {
      value.map(function (item) {
        return str += "".concat(item.position || '--', ";");
      });
    }
    return str;
  },
  width: 60
}, {
  title: '先露',
  dataIndex: 'fetusesMeasure',
  inputType: 'ArrayPanel',
  isActive: false,
  render: function render(value) {
    if (!value) {
      return '';
    }
    var str = '';
    if (value.length === 1) {
      str = value[0].presentation;
    } else {
      value.map(function (item) {
        return str += "".concat(item.presentation || '--', ";");
      });
    }
    return str;
  },
  width: 60
}]);
var getPregnancyByOutpatientNO = function getPregnancyByOutpatientNO(outpatientNO) {
  return __awaiter(void 0, void 0, void 0, function () {
    return __generator(this, function (_a) {
      switch (_a.label) {
        case 0:
          return [4, request.get("/api/pregnancies?outpatientNO.equals=".concat(outpatientNO))];
        case 1:
          return [2, _a.sent().data];
      }
    });
  });
};
function Physical_sign_list(props) {
  var search_form = _Form.useForm()[0];
  var _a = BF_Wrap2({
      default_conf: {
        tableColumns: form_confg,
        title: '体征检查-列表',
        name: '/api/measures',
        searchConfig: [{
          inputType: 'input',
          name: 'outpatientNO',
          label: '就诊卡号'
        }, {
          inputType: 'rangeDate',
          name: 'createDate',
          label: '体检日期'
        }]
      }
    }),
    config = _a.config,
    Wrap = _a.Wrap;
  return /*#__PURE__*/React__default.createElement(Wrap, null, /*#__PURE__*/React__default.createElement(MyBaseList, {
    tableColumns: config === null || config === void 0 ? void 0 : config.tableColumns,
    searchConfig: config === null || config === void 0 ? void 0 : config.searchConfig,
    name: config === null || config === void 0 ? void 0 : config.name,
    searchForm: search_form,
    handleBeforePopup: function handleBeforePopup(values) {
      if (!values.createDate) {
        values.createDate = formatDate();
      }
      return values;
    },
    modalFormConfig: {
      modal_data: {
        onValuesChange: function onValuesChange(changedValues, values, form) {
          return __awaiter(this, void 0, void 0, function () {
            var outpatientNO, pregnancy, tempData;
            return __generator(this, function (_a) {
              switch (_a.label) {
                case 0:
                  if (!changedValues.outpatientNO) return [3, 2];
                  outpatientNO = changedValues.outpatientNO;
                  return [4, getPregnancyByOutpatientNO(outpatientNO)];
                case 1:
                  pregnancy = _a.sent();
                  tempData = {
                    name: '',
                    gestationalWeek: ''
                  };
                  if (pregnancy.length > 0) {
                    tempData.name = pregnancy[0].name;
                    tempData.gestationalWeek = pregnancy[0].currentGestationalWeek;
                  }
                  form.setFieldsValue(__assign({}, tempData));
                  _a.label = 2;
                case 2:
                  return [2];
              }
            });
          });
        }
      }
    }
  }));
}
export { Physical_sign_list as default };
//# sourceMappingURL=prenatal-visit.physical-sign.list.js.map
