lkk
2025-06-24 942697763a76be6f6e9402d34015c8a94336406c
src/views/system/biol/index.vue
@@ -1,18 +1,31 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="打印" prop="dyzt">
        <el-select v-model="queryParams.dyzt" placeholder="请选择" @change="handleDyztChange" style="width: 100px">
          <el-option v-for="item in optionsOne" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="姓名" prop="name">
        <el-input  v-model="queryParams.name" placeholder="请输入姓名" style="width:100px"
        <el-input v-model="queryParams.name" placeholder="请输入姓名" style="width: 100px"
          @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="体检号" prop="tjNum">
        <el-input style="width:170px" v-model="queryParams.tjNum" placeholder="请输入体检号" clearable
          @keyup.enter.native="handleQuery" ref="inputName" @blur="handleQuery" />
        <el-input style="width: 170px" v-model="queryParams.tjNum" placeholder="请输入体检号" clearable
          @keyup.enter.native="handleQuery" ref="inputName" @blur="hb" />
      </el-form-item>
      <el-form-item label="报告时间" prop="reportTimeList">
        <el-date-picker clearable v-model="queryParams.reportTimeList" type="daterange" range-separator="-"
          start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" value-format="yyyy-MM-dd"
          placeholder="请选择出报告时间" style="width: 240px">
      <el-form-item label="单位名称" prop="tjCompName" style="margin-left: 20px">
        <el-select :remote-method="getRemoteData" v-model="queryParams.tjCompName" value-key="drugManufacturerId"
          style="width: 180px" remote filterable placeholder="请选择单位名称" clearable @change="searchSelect">
          <el-option v-for="dict in CompanyList" :key="dict.drugManufacturerId" :label="dict.cnName" :value="dict" />
        </el-select>
      </el-form-item>
      <el-form-item label="登记时间" prop="createTimeList">
        <el-date-picker clearable v-model="createTimeList" type="daterange" range-separator="-" start-placeholder="开始日期"
          end-placeholder="结束日期" :picker-options="pickerOptions" :default-time="['00:00:00', '23:00:00']"
          format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择出报告时间"
          @change="dateChangebirthday1">
        </el-date-picker>
      </el-form-item>
      <!-- <el-form-item label="单位名称" prop="firmId">
@@ -23,14 +36,13 @@
        </el-select>
      </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-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8" style="margin-left: 10px;">
    <el-row :gutter="10" class="mb8" style="margin-left: 10px">
      <!-- <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['hosp:order:export']">导出</el-button>
@@ -39,10 +51,22 @@
        <el-button type="primary" size="mini" :disabled="multiple" @click="viewReport">批量体检报告打印</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="mini" :disabled="single" @click="jiankangReport">健康检查表打印</el-button>
      </el-col>
      <!-- <el-col :span="1.5">
        <el-button type="primary" size="mini" :disabled="multiple" @click="jiankangReport">批量体检报告导出</el-button>
      </el-col> -->
      <el-col :span="1.5">
        <el-button type="primary" size="mini" :disabled="single" :loading="isLoading"
          @click="baogaoyulan">报告预览</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" size="mini" :disabled="single" :loading="isChexiao" @click="chexiao">撤销报告</el-button>
      </el-col>
      <el-col :span="1.5">
        <div id="main111">
          <el-input  style="width: 920px;" v-model="form.name"></el-input>
          <el-input style="width: 920px" v-model="form.name"></el-input>
        </div>
      </el-col>
      <!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> -->
    </el-row>
@@ -57,7 +81,7 @@
    </div> -->
    <template>
      <el-table border style="margin: 14px; width: 99%" v-loading="loading"
      <el-table border style="margin: 14px; width: 77%" v-loading="loading"
        :default-sort="{ prop: 'reportTime', order: 'descending' }" :data="orderList"
        @selection-change="handleSelectionChange" ref="multipleTable">
        <el-table-column type="selection" width="40px" align="center" height="10px" fixed="left" />
@@ -79,16 +103,19 @@
        <el-table-column label="体检类型" align="center" prop="tjType" height="10px" width="80px"
          :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <dict-tag :options="dict.type.dict_team" :value="scope.row.tjType" />
          </template>
          <!-- <template slot-scope="scope">
            <span v-if="scope.row.tjType == '1'">团队</span>
            <span v-if="scope.row.tjType == '2'">个人</span>
          </template>
          </template> -->
        </el-table-column>
        <el-table-column label="体检号" align="center" prop="tjNumber" :show-overflow-tooltip="true" width="160px" />
        <el-table-column label="所选套餐" align="center" prop="pacName" height="10px" :show-overflow-tooltip="true"
          width="140px" />
        <el-table-column label="登记人" align="center" prop="createBy" height="10px" :show-overflow-tooltip="true"
          width="100px" />
        <el-table-column label="登记时间" align="center" prop="createTime" width="155px" height="10px"
        <el-table-column label="登记时间" align="center" prop="createTime" width="155px" height="10px"
          :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.createTime) }}</span>
@@ -101,13 +128,20 @@
            <span>{{ parseTime(scope.row.reportTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="打印时间" align="center" prop="printLastTime" width="155px" height="10px"
          :show-overflow-tooltip="true">
          <template slot-scope="scope">
            <span>{{ parseTime(scope.row.printLastTime) }}</span>
          </template>
        </el-table-column>
        <el-table-column label="备注" align="center" prop="remark" height="10px" :show-overflow-tooltip="true" />
        <!-- <el-table-column
          label="备注"
          align="center"
          prop="remark"
          height="10px"
          :show-overflow-tooltip="true"
        /> -->
        <!-- <el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" height="10px"
          width="60px">
@@ -121,8 +155,8 @@
    <div class="pag">
      <div class="pag1">
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
          @pagination="getList" />
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize" @pagination="getList" />
      </div>
    </div>
@@ -209,22 +243,19 @@
      </div>
    </el-dialog>
    <el-dialog title="导诊单" :visible.sync="daoZhenDan" :close-on-click-modal="false">
      <div class="main">
        <iframe id="printIframe" :src="url" frameborder="0" style="width: 100%; height: 100%"></iframe>
      </div>
    </el-dialog>
    <div style="
                          position: absolute;
                          bottom: 100px;
                          left: 500px;
                          width: 700px;
                          display: none;
                        ">
        position: absolute;
        bottom: 100px;
        left: 500px;
        width: 700px;
        display: none;
      ">
      <div id="printBill">
        <barcode :value="barcode" :height="40" :width="2" :margin="0">条形码加载失败</barcode>
        <div style="font-size: 13px; color: #000000" v-for="(item, index) in DataList1" :key="index">
@@ -256,31 +287,68 @@
        </div>
      </div>
    </div>
    <el-dialog class="dia" title="PDF 预览" :visible.sync="dialogVisibles" :close-on-click-modal="false">
      <div class="main">
        <iframe id="printIframe" :src="url" frameborder="0" style="width: 100%; height: 100%"></iframe>
      </div>
    </el-dialog>
    <!--:before-close="handleClose"  -->
    <el-dialog title="提示" :visible.sync="dialogVisiblese" width="30%">
      <el-form :model="forms" ref="form" :inline="true" label-width="76px" style="margin-top: 10px">
        <el-form-item label="" prop="radios">
          <el-select  filterable v-model="forms.radios" placeholder="请选择打印健康检查表类型" clearable
            >
            <el-option v-for="dict in radiosList" :key="dict.dictValue" :label="dict.dictLabel"
              :value="dict.dictValue" />
          </el-select>
        </el-form-item>
      </el-form>
      <!-- <el-radio v-model="radios" label="1">从业人员检查表</el-radio>
      <el-radio v-model="radios" label="2">公共场所检查表</el-radio> -->
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisiblese = false">取 消</el-button>
        <el-button type="primary" @click="timjiao">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import print from "print-js";
import { getInfo } from "@/api/login";
import { isPdfOrJimu } from "@/api/doctor/checkAll";
import {
  listOrder,
  getNumber,
  getPdf,
  getPdfpre,
  getprint,
  hasReport,
  hasPrintCode,
  getOrderListOO,
  getNewDateList,
  getChexiao,
  xiugaidayinzhuangtai,
} from "@/api/hosp/order";
import moment from "moment";
import ViewPdf from "@/components/ViewPdf";
import { SubmitCompany, getCompany, queryCompany } from "@/api/team/tuanti";
import {
  SubmitCompany,
  getCompany,
  queryCompany,
  addbatch,
} from "@/api/team/tuanti";
import { getDicts } from "@/api/system/dict/data";
import { chownSync } from "fs";
export default {
  dicts: ["dict_team"],
  components: {
    ViewPdf,
  },
  name: "Order",
  data() {
    return {
      radios: "1",
      dialogVisiblese: false,
      isLoading: false,
      isChexiao: false,
      createTimeList: "",
      // printObj: {
      //   id: "box",             //打印的区域
@@ -308,6 +376,16 @@
      report: "",
      gation: {},
      drawer: false,
      optionsOne: [
        {
          value: "1",
          label: "已打印",
        },
        {
          value: "0",
          label: "未打印",
        },
      ],
      options: [
        {
          value: "选项1",
@@ -326,6 +404,8 @@
          label: "空号",
        },
      ],
      url: "",
      dialogVisibles: false,
      barcode: null,
      value: "",
      dialogVisible: false,
@@ -343,6 +423,10 @@
      discount: 100,
      DataList: [],
      DataList1: [],
      CheckBox: {},
      forms:{
        radios:""
      },
      // 打印失败
      failList: [],
      // 打印成功
@@ -358,7 +442,7 @@
      dialogVisible: false,
      // 遮罩层
      loading: true,
      tjNumber: "",
      tjNum: "",
      // 选中数组
      ids: [],
      // 非单个禁用
@@ -375,12 +459,14 @@
      orderList: [],
      CompanyList: [],
      ordersList: [],
      radiosList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 日期范围
      datetimerange: [],
      seleList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -396,7 +482,11 @@
        djbeginTime: undefined,
        djendTime: undefined,
        name: undefined,
        tjNum:undefined,
        tjNum: undefined,
        dyzt: "0",
        compId: null,
        dw: null,
        tjCompName: "",
      },
      startTime: "",
      // 表单参数
@@ -439,9 +529,14 @@
    };
  },
  created() {
    this.getNowTime();
    this.getList();
    // this.getNowTime();
    this.Company();
    // if (this.queryParams.dyzt === "0") {
    //   this.createTimeList = [];
    // } else {
    //   this.getdate();
    // }
    this.getdate();
  },
  mounted() {
    this.$nextTick(() => {
@@ -449,6 +544,20 @@
    });
  },
  methods: {
    getdate() {
      if (this.queryParams.dyzt === "0") {
        this.createTimeList = [];
        this.getList();
        return;
      }
      getNewDateList().then((res) => {
        this.createTimeList = [
          moment(res.data).format("YYYY-MM-DD 00:00:00"),
          moment(res.data).format("YYYY-MM-DD 23:59:00"),
        ];
        this.getList();
      });
    },
    // / 处理默认选中当前日期
    getNowTime() {
      var curDate = new Date().getTime();
@@ -480,20 +589,86 @@
        this.add0(mm)
      );
    },
    /** 点击显示体检报告报表*/
    // viewReport() {
    //   const tjNumber = this.report;
    //   const viewNum = "792997692059705344";
    //   const params = { viewNum, tjNumber };
    //   hasReportEnd(tjNumber).then((res) => {
    //     if (res == 1) {
    //       this.$tab.openPage('体检报告', '/report/viewReport', params);
    //     } else {
    //       this.$message.error("该用户体检暂未完成,无法打印体检报告!");
    //     }
    //   });
    // },
    jiankangReport() {
      this.dialogVisiblese = true;
        let dictType = "jimu_lx"
      getDicts(dictType).then(res => {
        console.log(res.data)
        this.radiosList = res.data
      })
    },
    timjiao() {
      // if (this.radios == "1") {
      //   this.mobanId = "912502827716915200";
      // } else {
      //   this.mobanId = "912519857543262208";
      // }
      const tjNum = this.report;
      const viewNum = this.forms.radios;
      const params = { viewNum, tjNum };
      this.$tab.openPage("健康证检查表", "/report/jiankangzheng", params);
      let tjNumber = this.report[0];
      xiugaidayinzhuangtai(tjNumber).then((response) => { });
      this.dialogVisiblese = false;
      this.getList();
    },
    baogaoyulan() {
      const tjNumber = this.report[0];
      this.isLoading = true;
      isPdfOrJimu(tjNumber).then((response) => {
        if (response.data.flag == "0") {
          const flag = true;
          this.isLoading = false;
          let sfdy = this.queryParams.dyzt == 0 ? 1 : 0;
          getPdfpre(tjNumber, flag, sfdy).then((response) => {
            if (response.size === 0) {
              const loading = this.$loading({
                lock: true,
                text: "Loading",
                spinner: "el-icon-loading",
                background: "rgba(0, 0, 0, 0.7)",
              });
              setTimeout(() => {
                loading.close();
              }, 3000);
              this.$message({
                message: "报告正在生成,请两分钟后预览!",
                type: "warning",
              });
            } else {
              this.dialogVisible = true;
              this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
            }
          });
        } else {
          let url = response.data.url;
          const params = { url };
          this.$tab.openPage(
            "健康证检查表",
            "/report/zongjianjiankangzheng",
            params
          );
        }
        this.isLoading = false;
      });
    },
    // 撤销打印
    chexiao() {
      const tjNUms = this.seleList.map((item) => item.tjNumber);
      this.isChexiao = true;
      getChexiao(tjNUms).then((res) => {
        console.log(res, 6666);
        if (res.code === 200) {
          this.$modal.msgSuccess("撤销成功!");
          this.getList();
        } else {
          this.$modal.msgError("撤销失败!");
        }
        this.isChexiao = false;
      });
    },
    //打印小票
    printHandle() {
      setTimeout(function () {
@@ -509,131 +684,66 @@
      }, 100);
    },
    // 体检报告
    viewReport() {
      const flag = true;
      this.failList = []
      this.form.name =  "报告打印失败:"
      if (this.report.length == 1) {
        this.report.forEach(item => {
          this.tjNumber = item;
        })
        getPdf(this.tjNumber, flag).then((response) => {
          if (response.size == 0) {
            // this.$message.error("该用户体检报告暂未完成!");
            this.dialogVisible = false;
            this.DataList1.forEach(item => {
              if (item.tjNumber === this.tjNumber) {
                this.userId = item.tjCustomerName
                this.form.name += item.tjCustomerName
              }
            })
            this.failList.push(
              {
                tjNumber: this.tjNumber,
                printStatus: 0,
                printBy: this.userId,
                createBy: this.userIds
              })
          } else {
            this.dialogVisible = true;
            this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
            this.DataList1.forEach(item => {
              if (item.tjNumber === this.tjNumber) {
                this.userId = item.tjCustomerName
                // this.form.name += item.tjCustomerName
              }
            })
            this.failList.push(
              {
                tjNumber: this.tjNumber,
                printStatus: 1,
                printBy: this.userId,
                createBy: this.userIds
              })
    base64ToBlob({ b64data = "", contentType = "", sliceSize = 512 } = {}) {
      return new Promise((resolve, reject) => {
        // 使用 atob() 方法将数据解码
        let byteCharacters = atob(b64data);
        let byteArrays = [];
        for (
          let offset = 0;
          offset < byteCharacters.length;
          offset += sliceSize
        ) {
          let slice = byteCharacters.slice(offset, offset + sliceSize);
          let byteNumbers = [];
          for (let i = 0; i < slice.length; i++) {
            byteNumbers.push(slice.charCodeAt(i));
          }
          this.joggle(this.failList)
          this.getList()
        });
      } else {
        for (let i = 0; i < this.report.length; i++) {
          if (i <= this.report.length) {
            this.tjNumber = this.report[i];
            getPdf(this.tjNumber, flag).then((response) => {
              if (response.size == 0) {
                this.failList = []
                this.DataList1.forEach(item => {
                  if (item.tjNumber === this.report[i]) {
                    this.userId = item.tjCustomerName
                    if (this.form.name) {
                      this.form.name = this.form.name + "," + item.tjCustomerName
                    }
                  }
                })
                this.failList.push(
                  {
                    tjNumber: this.report[i],
                    printStatus: 0,
                    printBy: this.userId,
                    createBy: this.userIds
                  })
                this.joggle(this.failList)
                this.getList()
                // this.$message.error("该用户体检报告暂未完成!");
                this.dialogVisible = false;
              } else {
                this.failList = []
                this.DataList1.forEach(item => {
                  if (item.tjNumber === this.report[i]) {
                    this.userId = item.tjCustomerName
                  }
                })
                this.failList.push(
                  {
                    tjNumber: this.report[i],
                    printStatus: 1,
                    printBy: this.userId,
                    createBy: this.userIds
                  })
                this.joggle(this.failList)
                this.getList()
                // this.dialogVisible = true;
                // this.url = window.webkitURL.createObjectURL(response); //将后端返回的blob文件读取出url
                const newBlob = [];
                newBlob.push(response)
                const blob = new Blob(newBlob, { type: 'application/pdf' })
                var date = (new Date()).getTime()
                var ifr = document.createElement('iframe')
                ifr.style.frameborder = 'no'
                ifr.style.display = 'none'
                ifr.style.pageBreakBefore = 'always'
                ifr.setAttribute('id', 'printPdf' + date)
                ifr.setAttribute('name', 'printPdf' + date)
                ifr.src = window.URL.createObjectURL(blob)
                document.body.appendChild(ifr)
                this.doPrint('printPdf' + date)
                window.URL.revokeObjectURL(ifr.src) // 释放URL 对象
              }
            });
          }
          // 8 位无符号整数值的类型化数组。内容将初始化为 0。
          // 如果无法分配请求数目的字节,则将引发异常。
          byteArrays.push(new Uint8Array(byteNumbers));
        }
      }
        let result = new Blob(byteArrays, {
          type: contentType,
        });
        result = Object.assign(result, {
          // jartto: 这里一定要处理一下 URL.createObjectURL
          preview: URL.createObjectURL(result),
          // name: `图片示例.png`,
        });
        resolve(result);
      });
    },
    /** 点击显示体检报告报表*/
    viewReport() {
      let data = this.report.join(",");
      addbatch(data).then((res) => {
        let base64 = res.file;
        this.base64ToBlob({
          b64data: base64,
          contentType: "application/pdf",
        }).then((res) => {
          this.dialogVisible = true;
          try {
            this.url = res.preview;
          } catch (error) {
            this.url = window.webkitURL.createObjectURL(res.preview);
          }
        });
      });
    },
    doPrint(val) {
      var ordonnance = document.getElementById(val).contentWindow
      var ordonnance = document.getElementById(val).contentWindow;
      setTimeout(() => {
        ordonnance.print()
      }, 100)
        ordonnance.print();
      }, 100);
    },
    joggle(failList) {
      getprint(failList).then((res) => {
      });
      getprint(failList).then((res) => { });
    },
    // 最近一次体检报告
@@ -675,6 +785,11 @@
        });
      });
    },
    // 选框数据
    searchSelect(val) {
      this.CheckBox = val;
      console.log(this.CheckBox, 9999);
    },
    // onSubmit() {
    //   console.log("submit!");
@@ -684,14 +799,35 @@
    },
    /** 查询体检记录列表 */
    getList() {
      this.queryParams.djbeginTime = this.startTime[0];
      this.queryParams.djendTime = this.startTime[1];
      console.log(this.CheckBox, 2323);
      // this.queryParams.checkStatus = this.checkStatus;
      this.queryParams.compId = this.CheckBox.drugManufacturerId;
      this.queryParams.dw = this.CheckBox.cnName;
      if (this.createTimeList) {
        this.queryParams.djbeginTime = this.createTimeList[0];
        this.queryParams.djendTime = this.createTimeList[1];
      } else if (this.createTimeList == null) {
        this.queryParams.djbeginTime = null;
        this.queryParams.djendTime = null;
      }
      this.loading = true;
      getInfo().then((response) => {
        this.userIds = response.user.userId
        this.userIds = response.user.userId;
      });
      // 获取单位信息集合
      getCompany(this.queryParams).then((response) => {
        this.CompanyList = response.data;
        console.log(this.CompanyList, 555);
        this.loading = false;
      });
      getOrderListOO(this.queryParams).then((response) => {
        this.orderList = response.data.list;
        // if (this.orderList) {
        //   this.orderList.forEach((item, index) => {
        //     item.newID =
@@ -751,19 +887,58 @@
      };
      this.resetForm("form");
    },
    hb() {
      if (this.queryParams.tjNum != undefined) {
        this.handleQuery();
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    handleDyztChange(value) {
      if (value === "0") {
        // 确认一下 "未打印" 的 value 是不是 '0'
        this.createTimeList = [];
      } else {
        // 已打印 -> 设置默认登记时间
        this.getdate();
      }
      // this.handleQuery();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        orderByColumn: "createTime",
        isAsc: "desc",
        tjType: undefined,
        tjNumber: undefined,
        firmId: undefined,
        createTime: undefined,
        finishTime: undefined,
        reportTime: undefined,
        djbeginTime: undefined,
        djendTime: undefined,
        name: undefined,
        tjNum: undefined,
        dyzt: "0",
        compId: null,
        dw: null,
        tjCompName: "",
      };
      this.createTimeList = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.orderId);
      this.seleList = selection;
      console.log(this.seleList, 222333);
      this.DataList1 = this.$refs.multipleTable.selection;
      this.DataList1.forEach((item) => {
        this.barcode = item.tjNumber;
@@ -777,13 +952,10 @@
      this.report = selection.map((item) => item.tjNumber);
    },
    investigation(row) {
      this.gation = row;
      this.drawer = true;
    },
    /** 导出按钮操作 */
    handleExport() {
@@ -815,13 +987,11 @@
}
#main111 .el-input__inner {
  border: none !important;
border: none !important;
  box-shadow: none !important;
box-shadow: none !important;
padding: 0px; //前边边距去掉
  padding: 0px; //前边边距去掉
}
#printIframe::-webkit-scrollbar {