qx
qx
2025-06-06 1e38903e0fae9c8d422de585f86914dd1d09da1d
src/views/doctor/check/index.vue
@@ -274,28 +274,25 @@
        <el-col v-show="baogaoqian">
          <template>
            <el-tabs v-model="radio" type="border-card" @tab-click="handleTabClick" style="margin-left: 10px">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index" :lazy="false">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index"
                :lazy="false">
                <el-table class="bgc" v-loading="loading" :data="proParentList.sons" border height="460px"
                  style="width: 96%; margin: 10px 10px" :row-class-name="tableRowClassName">
                  <el-table-column prop="project.proName" label="检测项目" width="150">
                  </el-table-column>
                  <el-table-column prop="proResult" label="检测结果" width="150">
                    <!-- <template slot-scope="scope">
                      <el-input type="textarea" autosize size="mini" v-model="scope.row.proResult" autocomplete="off"
                        placeholder="请输入检测结果" @focus="handleFocus(scope.row)" @blur="handleInputConfirm(scope.row)"
                        @input="vale($event, scope.row)" :disabled="scope.row.project.proName === 'BMI'"
                        ></el-input> -->
                        <template slot-scope="{ row, $index }">
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-item${index}-row${$index}`"
                      @keydown.enter.native="keyInputConfirm($event,index,$index)" @focus="handleFocus(row)"
                    <template slot-scope="{ row, $index }">
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult"
                        :ref="`input-item${index}-row${$index}`"
                        @keydown.enter.native="keyInputConfirm($event, index, $index)" @focus="handleFocus(row)"
                        @blur="handleInputConfirm(row)" @input="vale($event, row)"
                        :disabled="row.project.proName === 'BMI'"
                        ></el-input>
                        :disabled="row.project.proName === 'BMI'"></el-input>
                    </template>
                  </el-table-column>
                  <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)"></el-checkbox>
                      <el-checkbox v-model="scope.row.exceptionDesc" @change="changDesc(scope.row)"
                        :disabled="scope.row.project.sfcyyc === 1 || scope.row.project.proName === 'BMI'"></el-checkbox>
                    </template>
                  </el-table-column>
                  <el-table-column label="规则" width="70">
@@ -305,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">
@@ -420,22 +422,19 @@
        <el-col :span="18" v-show="baogaohou">
          <template>
            <el-tabs v-model="radio" type="border-card" @tab-click="handleTabClick" style="margin-left: 10px">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index" :lazy="false">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index"
                :lazy="false">
                <el-table class="bgc" v-loading="loading" :data="proParentList.sons" border height="460px"
                  style="width: 96%; margin: 10px 10px" :row-class-name="tableRowClassName">
                  <el-table-column prop="project.proName" label="检测项目" width="100">
                  </el-table-column>
                  <el-table-column prop="proResult" label="检测结果" width="150">
                    <!-- <template slot-scope="scope">
                      <el-input type="textarea" autosize size="mini" v-model="scope.row.proResult" autocomplete="off"
                        placeholder="请输入检测结果" @focus="handleFocus(scope.row)" @blur="handleInputConfirm(scope.row)"
                        @input="vale"></el-input> -->
                        <template slot-scope="{ row, $index }">
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-item${index}-row${$index}`"
                      @keydown.enter.native="keyInputConfirm($event,index,$index)" @focus="handleFocus(row)"
                    <template slot-scope="{ row, $index }">
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult"
                        :ref="`input-item${index}-row${$index}`"
                        @keydown.enter.native="keyInputConfirm($event, index, $index)" @focus="handleFocus(row)"
                        @blur="handleInputConfirm(row)" @input="vale($event, row)"
                        :disabled="row.project.proName === 'BMI'"
                        ></el-input>
                        :disabled="row.project.proName === 'BMI'"></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="规则" width="70">
@@ -450,7 +449,8 @@
                  <el-table-column prop="exceptionDesc" label="异常" width="55px" align="center">
                    <template slot-scope="scope">
                      <el-checkbox v-model="scope.row.exceptionDesc"></el-checkbox>
                      <el-checkbox v-model="scope.row.exceptionDesc"
                        :disabled="scope.row.project.sfcyyc === 1"></el-checkbox>
                    </template>
                  </el-table-column>
                  <el-table-column prop="isReturn" label="复诊" width="55px" align="center">
@@ -971,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); // 保留一位小数
@@ -984,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 === '身高'
@@ -999,10 +1017,51 @@
          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) {
@@ -1023,10 +1082,48 @@
            const weight = weightRow.proResult;
            const bmi = this.calculateBMI(height, weight);
            bmiRow.proResult = bmi || '';
            this.getBMIStatus(bmiRow); // 检查BMI状态并更新异常复选框
          }
        }
        this.rows.push(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
@@ -1068,6 +1165,7 @@
        }
        this.proParentList.sons.forEach((item) => {
          this.doctorName = item.doctorName;
          if (this.doctorName == null) {
            this.userList.forEach((element) => {
              const userName = this.$store.state.user.name;
@@ -1079,7 +1177,7 @@
          if (item.isReturn == 1) item.isReturn = true;
          if (item.isReturn == 0) item.isReturn = false;
          if (item.exceptionDesc == "1") item.exceptionDesc = true;
          if (item.exceptionDesc == "0") item.exceptionDesc = false;
          if (item.exceptionDesc == "0" || item.project.sfcyyc == 1) item.exceptionDesc = false;
        });
        if (this.proParentList.xiaoJie && this.proParentList.xiaoJie.length != 0) {
          this.Parent.forEach((item3) => {
@@ -1093,26 +1191,26 @@
      });
    },
    // 以下为其他方法,未做修改,仅保留必要部分,其余省略以保持简洁
    handleFocus(row) {
      console.log(11111)
      this.autorule = [];
      if (!row.resultType || row.resultType == 2 ) {
      if (!row.resultType || row.resultType == 2) {
        return;
      } else {
        this.curindex = row;
      selectZT({
        proId: row.proId,
      }).then((res) => {
        if (res.data.length > 0) {
          this.$refs.bbb.title = "选择检测结果";
        // this.$refs.bbb.proId = row.proId;
        this.$refs.bbb.open = true;
        this.$refs.bbb.getList(this.curindex);
        } else {
          this.$refs.bbb.open = false;
        }
      });
        selectZT({
          proId: row.proId,
        }).then((res) => {
          if (res.data.length > 0) {
            this.$refs.bbb.title = "选择检测结果";
            // this.$refs.bbb.proId = row.proId;
            this.$refs.bbb.open = true;
            this.$refs.bbb.getList(this.curindex);
          } else {
            this.$refs.bbb.open = false;
          }
        });
      }
    },
@@ -1121,7 +1219,7 @@
      this.handleInputConfirm(this.curindex, params);
    },
      handleChanges(param1, param2) {
    handleChanges(param1, param2) {
      this.row.conclusion = param1;
      this.row.rulesList = param2;
    },
@@ -1274,7 +1372,7 @@
    },
    handleClose() {
      this.$tab.refreshPage();
      this.drawer = false;  // 只关闭抽屉,不刷新页面或重置数据
    },
    handleClose1() {
@@ -1286,6 +1384,8 @@
    },
    changDesc(item) {
      item.conclusion = item.exceptionDesc ? "异常" : "正常";
    },
@@ -1325,10 +1425,10 @@
    keyInputConfirm(event,index, currentRowIndex) {
    keyInputConfirm(event, index, currentRowIndex) {
      // 阻止默认回车行为,比如提交表单
      event.preventDefault();
     event.stopPropagation()
      event.stopPropagation()
      const nextRowIndex = currentRowIndex + 1; // 计算下一行索引
      // 如果下一行存在,则聚焦该行的输入框
      if (nextRowIndex < this.proParentList.sons.length) {
@@ -1376,7 +1476,7 @@
      });
    },
    hb() {},
    hb() { },
    propoChange() {
      this.cusobj = { sex: this.tableAll.cusSex, isZj: 1 };
@@ -1768,6 +1868,7 @@
    },
    determine() {
      this.tjOrderDetail = [];
      let tjNumber = this.tableAll.tjNumber;
      this.userList.forEach((item) => {
        if (this.doctorName == item.nickName) this.doctorName = item.userId;
@@ -1804,6 +1905,7 @@
      }];
      getaddRemark(data).then((res) => {
        this.$modal.msgSuccess("提交成功");
        this.rows = []; // 提交成功后清空 this.rows
        this.drawer = false;
      });
      this.handleClose();