su
su1124
2023-12-26 d0594c96b1905f461ebf4dbdcc49a5c6230f1102
src/views/hosp/history/index.vue
@@ -2,32 +2,107 @@
  <div class="app-container">
    <div class="hist1">
      <div class="hist2">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
        <el-form
          :model="queryParams"
          ref="queryForm"
          size="small"
          :inline="true"
          v-show="showSearch"
          label-width="68px"
        >
          <el-form-item label="姓名" prop="name">
            <el-input v-model="queryParams.name" placeholder="请输入客户名" clearable @keyup.enter.native="handleQuery" style="width:130px"/>
            <el-input
              v-model="queryParams.name"
              placeholder="请输入客户名"
              clearable
              @keyup.enter.native="handleQuery"
              style="width: 130px"
            />
          </el-form-item>
          <el-form-item label="体检号" prop="tjNum">
            <el-input ref="inputName" v-model="queryParams.tjNum" placeholder="请输入体检号" style="width: 170px" clearable @keyup.enter.native="handleQuery"/>
            <el-input
              ref="inputName"
              v-model="queryParams.tjNum"
              placeholder="请输入体检号"
              style="width: 170px"
              clearable
              @keyup.enter.native="handleQuery"
              @blur="handleQuery"
            />
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </el-form>
        <el-table :row-class-name="tableRowClassName" height="650px" v-loading="loading" :data="orderList" ref="multipleTable" @selection-change="handleSelectionChange" border style="width: 95%">
        <el-table
          :row-class-name="tableRowClassName"
          height="650px"
          v-loading="loading"
          :data="orderList"
          ref="multipleTable"
          @selection-change="handleSelectionChange"
          border
          style="width: 95%"
        >
          <el-table-column type="selection" width="40px" align="center" />
          <el-table-column label="序号" align="center" prop="newID" width="50px" :show-overflow-tooltip="true" fixed="left"/>
          <el-table-column label="姓名" align="center" prop="tjCustomerName" width="110px" :show-overflow-tooltip="true"/>
          <el-table-column label="性别" align="center" prop="tjCustomerSex" width="55px" :show-overflow-tooltip="true">
          <el-table-column
            label="序号"
            align="center"
            prop="newID"
            width="50px"
            :show-overflow-tooltip="true"
            fixed="left"
          />
          <el-table-column
            label="姓名"
            align="center"
            prop="tjCustomerName"
            width="110px"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="性别"
            align="center"
            prop="tjCustomerSex"
            width="55px"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <span v-if="scope.row.tjCustomerSex == '0'">男</span>
              <span v-if="scope.row.tjCustomerSex == '1'">女</span>
              <span v-if="scope.row.tjCustomerSex == '2'">未知</span>
            </template>
          </el-table-column>
          <el-table-column label="电话" align="center" prop="tjCustomerPhone" width="120px" :show-overflow-tooltip="true"/>
          <el-table-column label="年龄" align="center" prop="tjCustomerAge" width="70" :show-overflow-tooltip="true"
          <el-table-column
            label="电话"
            align="center"
            prop="tjCustomerPhone"
            width="120px"
            :show-overflow-tooltip="true"
          />
          <el-table-column label="年龄单位" align="center" prop="ageUnit" width="80" :show-overflow-tooltip="true">
          <el-table-column
            label="年龄"
            align="center"
            prop="tjCustomerAge"
            width="70"
            :show-overflow-tooltip="true"
          />
          <el-table-column
            label="年龄单位"
            align="center"
            prop="ageUnit"
            width="80"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.dict_ageunit"
@@ -35,7 +110,13 @@
              />
            </template>
          </el-table-column>
          <el-table-column label="职业" align="center" prop="career" width="120" :show-overflow-tooltip="true">
          <el-table-column
            label="职业"
            align="center"
            prop="career"
            width="120"
            :show-overflow-tooltip="true"
          >
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.dict_job"
@@ -79,7 +160,7 @@
                </el-form-item>
                <el-form-item label="职业" prop="work">
                  <el-select
                  filterable
                    filterable
                    v-model="form.work"
                    placeholder="请选择职业"
                    clearable
@@ -95,7 +176,7 @@
                </el-form-item>
                <el-form-item label="工作状态" prop="workStatus">
                  <el-select
                  filterable
                    filterable
                    v-model="form.workStatus"
                    placeholder="请选择工作状态"
                    clearable
@@ -108,6 +189,15 @@
                      :value="dict.value"
                    />
                  </el-select>
                </el-form-item>
                <el-form-item label="接触毒物" prop="contactPoison">
                  <el-input
                    type="textarea"
                    rows="4"
                    v-model="form.contactPoison"
                    placeholder="请输入接触毒物"
                    style="width: 700px"
                  />
                </el-form-item>
                <el-form-item label="既往病史" prop="medicalHistory">
                  <el-input
@@ -160,7 +250,7 @@
                <el-form-item label="是否吸烟" prop="xiyan">
                  <!-- <el-input v-model="form.xiyanpinlv" placeholder="请输入吸烟频率" /> -->
                  <el-select
                  filterable
                    filterable
                    v-model="form.xiyan"
                    placeholder="请选择是否吸烟"
                    clearable
@@ -189,7 +279,7 @@
                <el-form-item label="是否饮酒" prop="yinjiu">
                  <!-- <el-input v-model="form.yinjiupinlv" placeholder="请输入饮酒频率" /> -->
                  <el-select
                  filterable
                    filterable
                    v-model="form.yinjiu"
                    placeholder="请选择是否饮酒"
                    clearable
@@ -236,7 +326,11 @@
                    </el-button>
                  </el-col>
                  <el-col :span="1.5">
                    <el-button type="danger" icon="el-icon-delete" size="mini"
                    <el-button
                      type="danger"
                      icon="el-icon-delete"
                      size="mini"
                      @click="delemembers()"
                      >删除
                    </el-button>
                  </el-col>
@@ -246,6 +340,7 @@
                  :data="form.tjAskHistorysList"
                  ref="tjAskHistorys"
                  style="width: 98%"
                  @selection-change="handlebingChange"
                >
                  <el-table-column type="selection" width="40" align="center" />
                  <!-- <el-table-column
@@ -295,7 +390,7 @@
                    <template slot-scope="scope">
                      <!-- <el-input v-model="scope.row.isOk" placeholder="请输入是否痊愈" /> -->
                      <el-select
                      filterable
                        filterable
                        size="mini"
                        v-model="scope.row.isOk"
                        placeholder="请选择是否痊愈"
@@ -322,10 +417,139 @@
                </el-table>
              </div>
            </el-collapse-item>
            <el-collapse-item title="职业史" name="7">
              <div style="width: 900px">
                <el-row :gutter="10" class="mb8">
                  <el-col :span="1.5">
                    <el-button
                      type="primary"
                      icon="el-icon-plus"
                      size="mini"
                      @click="addmemberss()"
                      >添加
                    </el-button>
                  </el-col>
                  <el-col :span="1.5">
                    <el-button
                      type="danger"
                      icon="el-icon-delete"
                      size="mini"
                      @click="delememberss()"
                      >删除
                    </el-button>
                  </el-col>
                </el-row>
                <el-table
                  border
                  :data="form.workLogs"
                  style="width: 98%"
                  @selection-change="handlezhiyeChange"
                >
                  <el-table-column type="selection" width="40" align="center" />
                  <!-- <el-table-column
            label="序号"
            align="center"
            prop="index"
            width="50"
          /> -->
                  <el-table-column label="开始时间" prop="beginTime">
                    <template slot-scope="scope">
                      <el-date-picker
                        size="mini"
                        v-model="scope.row.beginTime"
                        align="right"
                        type="date"
                        placeholder="选择日期"
                        :picker-options="pickerOptions"
                        style="width: 130px"
                        value-format="yyyy-MM-dd"
                      >
                      </el-date-picker>
                    </template>
                  </el-table-column>
                  <el-table-column label="结束时间" prop="endTime">
                    <template slot-scope="scope">
                      <el-date-picker
                        size="mini"
                        v-model="scope.row.endTime"
                        align="right"
                        type="date"
                        placeholder="选择日期"
                        :picker-options="pickerOptions"
                        style="width: 130px"
                        value-format="yyyy-MM-dd"
                      >
                      </el-date-picker>
                    </template>
                  </el-table-column>
                  <el-table-column label="工作单位" prop="workCompany">
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        v-model="scope.row.workCompany"
                        placeholder="请输入工作单位"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column label="部门" prop="workDept">
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        v-model="scope.row.workDept"
                        placeholder="请输入部门"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column label="工种" prop="workType">
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        v-model="scope.row.workType"
                        placeholder="请输入工种"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column label="有害因素" prop="harmTypeLogs">
                    <template slot-scope="scope">
                      <!-- <el-input v-model="scope.row.isOk" placeholder="请输入是否痊愈" /> -->
                      <el-select
                        filterable
                        size="mini"
                        v-model="scope.row.harmTypeLogs"
                        multiple
                        placeholder="请选择有害因素"
                        clearable
                      >
                        <el-option
                          v-for="dict in harmTypeList"
                          :key="dict.aid"
                          :label="dict.harmType"
                          :value="dict.aid"
                        />
                      </el-select>
                    </template>
                  </el-table-column>
                  <el-table-column label="防护措施" prop="fangHu">
                    <template slot-scope="scope">
                      <el-input
                        size="mini"
                        v-model="scope.row.fangHu"
                        placeholder="请输入防护措施"
                      />
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-collapse-item>
          </el-collapse>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitForm" style="margin-top: 10px" :disabled="isdisabled"
          <el-button
            type="primary"
            @click="submitForm"
            style="margin-top: 10px"
            :disabled="isdisabled"
            >提交</el-button
          >
        </div>
@@ -344,19 +568,35 @@
</template>
<script>
import {
  updateHistory,
  getInfoById,
} from "@/api/hosp/history";
import { updateHistory, getInfoById } from "@/api/hosp/history";
import { Message } from "element-ui";
import { getOrderList } from "@/api/hosp/order";
import { listHarmType } from "@/api/hosp/harmType";
export default {
  name: "History",
  dicts: ["tj_smoking_pinlv", "sys_yes_no", "tj_work_status", "tj_work","dict_ageunit","dict_job"],
  dicts: [
    "tj_smoking_pinlv",
    "sys_yes_no",
    "tj_work_status",
    "tj_work",
    "dict_ageunit",
    "dict_job",
  ],
  data() {
    let checkPhoneNum = (rule, value, callback) => {
      console.log(value);
      let patter = new RegExp(/^1\s*[3456789]\s*(\d\s*){9}$/);
      if (value == "" && value == undefined && !value) {
        return callback("");
      } else if (value != undefined && value != "") {
        return callback();
      } else if (!patter.test(value)) {
        return callback("");
      }
    };
    return {
      selectList:[],
      selectList: [],
      dataList: [],
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() > Date.now();
@@ -419,15 +659,18 @@
        pageSize: 20,
        cusName: null,
      },
      harmTypeList: [],
      // 表单参数
      form: {},
      chageall: [],
      bingshiall: [],
      rew: [],
      // 表单校验
      rules: {
        deleted: [
          {
            required: true,
            message: "$comment不能为空",
            validator: checkPhoneNum,
            trigger: "blur",
          },
        ],
@@ -436,6 +679,11 @@
  },
  created() {
    this.getList();
  },
  mounted() {
    this.$nextTick(() => {
      this.$refs.inputName.focus();
    });
  },
  methods: {
    /** 查询问诊列表 */
@@ -456,6 +704,10 @@
    /** 查询体检记录列表 */
    getList() {
      this.loading = true;
      listHarmType().then((response) => {
        this.harmTypeList = response.rows;
        this.loading = false;
      });
      getOrderList(this.queryParams).then((response) => {
        this.orderList = response.data.list;
        if (this.orderList) {
@@ -473,6 +725,7 @@
                  true
                );
              });
              this.dataList = this.orderList[0];
            } else {
              this.$refs.multipleTable.clearSelection();
            }
@@ -535,6 +788,7 @@
    },
    // 单选框选中数据
    handleSelectionChange(selection) {
      this.dataList = [];
      this.selectList = selection;
      // this.ids = selection.map((item) => item.askId);
      // this.single = selection.length !== 1;
@@ -549,33 +803,33 @@
        let del_row = selection.shift();
        this.$refs.multipleTable.toggleRowSelection(del_row, false);
      }
      selection.forEach(item1=>{
      selection.forEach((item1) => {
        if (item1.tjCustomerSex === 1) {
        this.sex = true;
      } else {
        this.sex = false;
      }
      })
      let userId = selection.map((item) => item.userId);
      getInfoById(userId).then((response) => {
          this.sex = true;
        } else {
          this.sex = false;
        }
      });
      let tjNumber = selection.map((item) => item.tjNumber);
      getInfoById(tjNumber).then((response) => {
        this.form = response.data;
        if(this.form.xiyan == null){
          this.form.xiyan ="1"
        if (this.form.xiyan == null) {
          this.form.xiyan = "1";
        }
        if(this.form.xiyanpinlv == null){
          this.form.xiyanpinlv ="0"
        if (this.form.xiyanpinlv == null) {
          this.form.xiyanpinlv = "0";
        }
        if(this.form.xiyanyear == null){
          this.form.xiyanyear ="0"
        if (this.form.xiyanyear == null) {
          this.form.xiyanyear = "0";
        }
        if(this.form.yinjiu == null){
          this.form.yinjiu ="1"
        if (this.form.yinjiu == null) {
          this.form.yinjiu = "1";
        }
        if(this.form.yinjiupinlv == null){
          this.form.yinjiupinlv ="0"
        if (this.form.yinjiupinlv == null) {
          this.form.yinjiupinlv = "0";
        }
        if(this.form.yinjiuyear == null){
          this.form.yinjiuyear ="0"
        if (this.form.yinjiuyear == null) {
          this.form.yinjiuyear = "0";
        }
        this.form.tjAskHistorysList = response.data.tjAskHistorysList;
        // this.isdisabled= true
@@ -618,8 +872,83 @@
      }
      this.$forceUpdate();
    },
    handlebingChange(selection) {
      this.bingshiall = [];
      this.bingshiall = selection;
    },
    delemembers() {
      let that = this;
      if (that.form.tjAskHistorysList.length == that.bingshiall.length) {
        that.form.tjAskHistorysList = [];
      } else {
        that.bingshiall.forEach((item1, index1) => {
          that.form.tjAskHistorysList.forEach((item, index) => {
            if (item == item1) {
              that.form.tjAskHistorysList.splice(index, 1);
            }
          });
        });
      }
    },
    addmemberss() {
      if (this.form.cusName) {
        if (!this.form.workLogs) {
          this.form.workLogs = [];
          this.form.workLogs.push({
            id: parseInt(length),
            beginTime: "",
            endTime: "",
            workCompany: "",
            workDept: "",
            workType: "",
            harmTypeLogs: "",
            fangHu: "",
            Selection,
          });
        } else {
          this.form.workLogs.push({
            id: parseInt(length),
            beginTime: "",
            endTime: "",
            workCompany: "",
            workDept: "",
            workType: "",
            harmTypeLogs: "",
            fangHu: "",
            Selection,
          });
        }
      } else {
        Message.warning("请先填写客户名");
      }
      this.$forceUpdate();
    },
    handlezhiyeChange(selection) {
      this.chageall = [];
      this.chageall = selection;
    },
    delememberss() {
      let that = this;
      if (that.form.workLogs.length == that.chageall.length) {
        that.form.workLogs = [];
      } else {
        that.chageall.forEach((item1, index1) => {
          that.form.workLogs.forEach((item, index) => {
            if (item == item1) {
              that.form.workLogs.splice(index, 1);
            }
          });
        });
      }
    },
    /** 提交按钮 */
    submitForm() {
      this.form.tjNum = this.dataList[0].tjNumber;
      updateHistory(this.form).then((response) => {
        this.$modal.msgSuccess("修改成功");
      });
@@ -640,19 +969,24 @@
  display: flex;
  justify-content: space-evenly;
}
.hist2 {
  width: 708px;
}
.hist3 {
  margin-top: 60px;
}
.coll {
  width: 100%;
}
::v-deep .el-collapse-item__header {
  font-weight: 800;
  font-size: 16px;
}
.txt {
  font-size: 16px;
  font-weight: 800;
@@ -661,6 +995,7 @@
  justify-content: center;
  margin-bottom: 20px;
}
.el-table .warning-row {
  background: #e5f3ff !important;
}