qx
qx
2025-06-06 1e38903e0fae9c8d422de585f86914dd1d09da1d
src/views/doctor/check/index.vue
@@ -292,7 +292,7 @@
                  <el-table-column prop="exceptionDesc" label="异常" width="55px" align="center">
                    <template slot-scope="scope">
                      <el-checkbox v-model="scope.row.exceptionDesc" @change="changDesc(scope.row)"
                        :disabled="scope.row.project.sfcyyc === 1"></el-checkbox>
                        :disabled="scope.row.project.sfcyyc === 1 || scope.row.project.proName === 'BMI'"></el-checkbox>
                    </template>
                  </el-table-column>
                  <el-table-column label="规则" width="70">
@@ -302,7 +302,12 @@
                  </el-table-column>
                  <el-table-column prop="project.proMetering" label="单位" width="55">
                  </el-table-column>
                  <el-table-column prop="project.proScope" label="参考范围" width="70">
                  <el-table-column label="参考范围" width="70" align="center">
                    <template slot-scope="scope">
                      {{ scope.row.project.proScope }}
                    </template>
                  </el-table-column>
                  <el-table-column prop="conclusion" label="结果结论" width="200">
                    <template slot-scope="scope">
@@ -966,10 +971,27 @@
  },
  methods: {
    getBMIStatus(row) {
      const bmi = parseFloat(row.proResult);
      if (isNaN(bmi) || !row.proResult) return ''; // 处理无效或空的BMI值
      if (bmi > 28) {
        row.exceptionDesc = true; // 自动勾选异常复选框
        row.conclusion = '偏高'; // 设置结论
        return '偏高';
      }
      if (bmi < 12) {
        row.exceptionDesc = true; // 自动勾选异常复选框
        row.conclusion = '偏低'; // 设置结论
        return '偏低';
      }
      row.exceptionDesc = false; // 正常范围内取消勾选
      row.conclusion = '正常'; // 设置结论
      return '正常';
    },
    // 计算 BMI
    calculateBMI(height, weight) {
      if (height && weight) {
        const heightInMeters = parseFloat(height) / 100; // cm 转换为 m
        const heightInMeters = parseFloat(height) / 100; // 厘米转换为米
        const weightInKg = parseFloat(weight);
        const bmi = weightInKg / (heightInMeters * heightInMeters);
        return bmi.toFixed(1); // 保留一位小数
@@ -979,6 +1001,7 @@
    // 实时更新 BMI
    vale(value, row) {
      console.log(3333)
      if (row.project.proName === '身高' || row.project.proName === '体重') {
        const heightRow = this.proParentList.sons.find(
          item => item.project.proName === '身高'
@@ -994,25 +1017,54 @@
          const height = row.project.proName === '身高' ? value : heightRow.proResult;
          const weight = row.project.proName === '体重' ? value : weightRow.proResult;
          const bmi = this.calculateBMI(height, weight);
          bmiRow.proResult = bmi || ''; // 实时更新 BMI
          bmiRow.proResult = bmi || ''; // 实时更新BMI值
          this.getBMIStatus(bmiRow); // 检查BMI状态并更新异常复选框
        }
      }
      // 现有的规则检查逻辑保持不变
      this.focusrow = row;
      this.proResult = row;
      const pattern3 = new RegExp("[0-9]+");
      if (row.proResult) { }
      if (pattern3.test(row.proResult)) {
        let data = {
          proId: this.focusrow.proId,
          cusId: this.tableAll.cusId,
          tjNum: this.tableAll.tjNumber,
          keyNum: this.proResult.proResult,
        };
        AutoGetRule(data).then((res) => {
          this.focusrow.conclusion = "";
          if (res.data) {
            this.autorule = res.data;
            this.focusrow.rulesList = res.data;
            if (row.project.sfcyyc == 1) {
              return;
            } else {
              if (res.data.length > 0) {
                const conditions = ["正常", "未见异常", "阴性", "未见明显异常"];
                this.focusrow.exceptionDesc = !conditions.some((condition) =>
                  this.autorule[0].bz.includes(condition)
                );
              } else {
                this.focusrow.exceptionDesc = false;
              }
            }
            if (this.autorule.length !== 0 && (this.autorule[0] || this.autorule[0].nr)) {
              this.focusrow.proAdvice = this.autorule[0].nr;
            }
            this.autorule.forEach((item) => {
              this.focusrow.conclusion += this.focusrow.conclusion ? item.bz : item.bz;
            });
          }
        });
      }
    },
    // 输入确认时更新 BMI
    handleInputConfirm(row, params) {
      console.log(row, params, 55555)
      // 如果有 params 且为空,取消异常状态并清空相关字段
      if (params && params.length === 0) {
        row.exceptionDesc = false;
        row.proResult = "";
        row.conclusion = "";
        row.proAdvice = "";
        row.rulesList = [];
        return;
      }
      // 现有 BMI 计算逻辑
    // 输入确认时更新 BMI
    handleInputConfirm(row) {
      if (row.proResult) {
        if (row.project.proName === '身高' || row.project.proName === '体重') {
          const heightRow = this.proParentList.sons.find(
@@ -1030,85 +1082,48 @@
            const weight = weightRow.proResult;
            const bmi = this.calculateBMI(height, weight);
            bmiRow.proResult = bmi || '';
            this.getBMIStatus(bmiRow); // 检查BMI状态并更新异常复选框
          }
        }
        this.focusrow = row;
        this.proResult = row;
        const pattern3 = new RegExp("[0-9]+");
        if (pattern3.test(row.proResult)) {
          let data = {
            proId: this.focusrow.proId,
            cusId: this.tableAll.cusId,
            tjNum: this.tableAll.tjNumber,
            keyNum: this.proResult.proResult,
          };
          AutoGetRule(data).then((res) => {
            this.focusrow.conclusion = "";
            if (res.data) {
              this.autorule = res.data;
              this.focusrow.rulesList = res.data;
              if (row.project.sfcyyc == 1) {
                return
              } else {
                if (res.data.length > 0) {
                  const conditions = ["正常", "未见异常", "阴性", "未见明显异常"];
                  this.focusrow.exceptionDesc = !conditions.some((condition) =>
                    this.autorule[0].bz.includes(condition)
                  );
                } else {
                  this.focusrow.exceptionDesc = false;
                }
              }
              if (this.autorule.length !== 0 && (this.autorule[0] || this.autorule[0].nr)) {
                this.focusrow.proAdvice = this.autorule[0].nr;
              }
              this.autorule.forEach((item) => {
                this.focusrow.conclusion += this.focusrow.conclusion ? item.bz : item.bz;
              });
            }
          });
        } else {
          let data = {
            proId: this.focusrow.proId,
            cusId: this.tableAll.cusId,
            keyWord: this.proResult.proResult, // 修改为 proResult.proResult
            tjNum: this.tableAll.tjNumber,
            keyNum: this.proResult.proResult,
          };
          AutoGetRule(data).then((res) => {
            this.focusrow.conclusion = "";
            if (res.data) {
              this.autorule = res.data;
              this.focusrow.rulesList = res.data;
              if (row.project.sfcyyc == 1) {
                return
              } else {
                if (res.data.length > 0) {
                  const conditions = ["正常", "未见异常", "阴性", "未见明显异常"];
                  this.focusrow.exceptionDesc = !conditions.some((condition) =>
                    this.autorule[0].bz.includes(condition)
                  );
                } else {
                  this.focusrow.exceptionDesc = false;
                }
              }
              if (this.autorule.length !== 0 && (this.autorule[0] || this.autorule[0].nr)) {
                this.focusrow.proAdvice = this.autorule[0].nr;
              }
              this.autorule.forEach((item) => {
                this.focusrow.conclusion += this.focusrow.conclusion ? item.bz : item.bz;
              });
            }
          });
        }
        // 将当前行添加到 rows 中
        this.rows.push(row);
        console.log(this.rows, row);
      }
      // 现有的规则检查逻辑保持不变
      this.focusrow = row;
      this.proResult = row;
      const pattern3 = new RegExp("[0-9]+");
      if (pattern3.test(row.proResult)) {
        let data = {
          proId: this.focusrow.proId,
          cusId: this.tableAll.cusId,
          tjNum: this.tableAll.tjNumber,
          keyNum: this.proResult.proResult,
        };
        AutoGetRule(data).then((res) => {
          this.focusrow.conclusion = "";
          if (res.data) {
            this.autorule = res.data;
            this.focusrow.rulesList = res.data;
            if (row.project.sfcyyc == 1) {
              return;
            } else {
              if (res.data.length > 0) {
                const conditions = ["正常", "未见异常", "阴性", "未见明显异常"];
                this.focusrow.exceptionDesc = !conditions.some((condition) =>
                  this.autorule[0].bz.includes(condition)
                );
              } else {
                this.focusrow.exceptionDesc = false;
              }
            }
            if (this.autorule.length !== 0 && (this.autorule[0] || this.autorule[0].nr)) {
              this.focusrow.proAdvice = this.autorule[0].nr;
            }
            this.autorule.forEach((item) => {
              this.focusrow.conclusion += this.focusrow.conclusion ? item.bz : item.bz;
            });
          }
        });
      }
      this.rows.push(row);
    },
    // 初始化数据时计算 BMI
@@ -1177,8 +1192,9 @@
    },
    handleFocus(row) {
      console.log(11111)
      this.autorule = [];
      if (!row.resultType || row.resultType == 2 ) {
      if (!row.resultType || row.resultType == 2) {
        return;
      } else {
        this.curindex = row;