|  | @@ -0,0 +1,258 @@
 | 
	
		
			
				|  |  | +<template>
 | 
	
		
			
				|  |  | +  <div class="doctor-duration-page">
 | 
	
		
			
				|  |  | +    <!-- 搜索区域 -->
 | 
	
		
			
				|  |  | +    <el-card shadow="never" class="search-card">
 | 
	
		
			
				|  |  | +      <el-form :inline="true" :model="searchForm" @submit.native.prevent>
 | 
	
		
			
				|  |  | +        <!-- 所属医院 -->
 | 
	
		
			
				|  |  | +        <el-form-item label="所属医院">
 | 
	
		
			
				|  |  | +          <el-select
 | 
	
		
			
				|  |  | +            v-model="searchForm.hospitalId"
 | 
	
		
			
				|  |  | +            placeholder="请选择所属医院"
 | 
	
		
			
				|  |  | +            clearable
 | 
	
		
			
				|  |  | +            size="small"
 | 
	
		
			
				|  |  | +            filterable
 | 
	
		
			
				|  |  | +          >
 | 
	
		
			
				|  |  | +            <el-option
 | 
	
		
			
				|  |  | +              v-for="dict in hospitalList"
 | 
	
		
			
				|  |  | +              :key="dict.dictValue"
 | 
	
		
			
				|  |  | +              :label="dict.dictLabel"
 | 
	
		
			
				|  |  | +              :value="dict.dictValue"
 | 
	
		
			
				|  |  | +            />
 | 
	
		
			
				|  |  | +          </el-select>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <!-- 科室 -->
 | 
	
		
			
				|  |  | +        <el-form-item label="科室">
 | 
	
		
			
				|  |  | +          <el-select
 | 
	
		
			
				|  |  | +            v-model="searchForm.deptId"
 | 
	
		
			
				|  |  | +            placeholder="请选择所属科室"
 | 
	
		
			
				|  |  | +            clearable
 | 
	
		
			
				|  |  | +            size="small"
 | 
	
		
			
				|  |  | +          >
 | 
	
		
			
				|  |  | +            <el-option
 | 
	
		
			
				|  |  | +              v-for="dict in depList"
 | 
	
		
			
				|  |  | +              :key="dict.dictValue"
 | 
	
		
			
				|  |  | +              :label="dict.dictLabel"
 | 
	
		
			
				|  |  | +              :value="dict.dictValue"
 | 
	
		
			
				|  |  | +            />
 | 
	
		
			
				|  |  | +          </el-select>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +        <el-form-item label="医生姓名">
 | 
	
		
			
				|  |  | +          <el-input
 | 
	
		
			
				|  |  | +            v-model="searchForm.doctorName"
 | 
	
		
			
				|  |  | +            placeholder="请输入医生姓名"
 | 
	
		
			
				|  |  | +            clearable
 | 
	
		
			
				|  |  | +            @keyup.enter.native="fetchList"
 | 
	
		
			
				|  |  | +          />
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <el-form-item label="开方时间">
 | 
	
		
			
				|  |  | +          <el-date-picker
 | 
	
		
			
				|  |  | +            v-model="dateRange"
 | 
	
		
			
				|  |  | +            type="datetimerange"
 | 
	
		
			
				|  |  | +            range-separator="至"
 | 
	
		
			
				|  |  | +            start-placeholder="开始时间"
 | 
	
		
			
				|  |  | +            end-placeholder="结束时间"
 | 
	
		
			
				|  |  | +            value-format="yyyy-MM-dd HH:mm:ss"
 | 
	
		
			
				|  |  | +            :picker-options="{ shortcuts: pickerShortcuts }"
 | 
	
		
			
				|  |  | +          />
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <el-form-item>
 | 
	
		
			
				|  |  | +          <el-button type="primary" @click="fetchList">搜索</el-button>
 | 
	
		
			
				|  |  | +          <el-button @click="resetSearch">重置</el-button>
 | 
	
		
			
				|  |  | +        </el-form-item>
 | 
	
		
			
				|  |  | +      </el-form>
 | 
	
		
			
				|  |  | +    </el-card>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <!-- 数据列表 -->
 | 
	
		
			
				|  |  | +    <el-card shadow="never" class="table-card">
 | 
	
		
			
				|  |  | +      <el-table
 | 
	
		
			
				|  |  | +        :data="tableData"
 | 
	
		
			
				|  |  | +        v-loading="loading"
 | 
	
		
			
				|  |  | +        border
 | 
	
		
			
				|  |  | +        style="width: 100%"
 | 
	
		
			
				|  |  | +        :default-sort="{ prop: 'avgOperateSecond', order: searchForm.sort === 'desc' ? 'descending' : 'ascending' }"
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +        <el-table-column type="index" label="序号" width="60" align="center"></el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column prop="doctorName" label="医生姓名" min-width="120"></el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column
 | 
	
		
			
				|  |  | +          prop="avgOperateSecond"
 | 
	
		
			
				|  |  | +          label="平均耗时"
 | 
	
		
			
				|  |  | +          min-width="140"
 | 
	
		
			
				|  |  | +          sortable
 | 
	
		
			
				|  |  | +          :sort-orders="['ascending', 'descending']"
 | 
	
		
			
				|  |  | +          @sort-change="handleSortChange"
 | 
	
		
			
				|  |  | +        >
 | 
	
		
			
				|  |  | +          <template slot-scope="{ row }">
 | 
	
		
			
				|  |  | +            {{ formatSeconds(row.avgOperateSecond) }}
 | 
	
		
			
				|  |  | +          </template>
 | 
	
		
			
				|  |  | +        </el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column prop="operation" label="总次数" min-width="120"></el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column prop="hospitalName" label="所属医院" min-width="120"></el-table-column>
 | 
	
		
			
				|  |  | +        <el-table-column prop="deptName" label="所属科室" min-width="120"></el-table-column>
 | 
	
		
			
				|  |  | +      </el-table>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      <!-- 分页 -->
 | 
	
		
			
				|  |  | +      <el-pagination
 | 
	
		
			
				|  |  | +        v-if="total > 0"
 | 
	
		
			
				|  |  | +        class="pagination"
 | 
	
		
			
				|  |  | +        background
 | 
	
		
			
				|  |  | +        layout="total, sizes, prev, pager, next, jumper"
 | 
	
		
			
				|  |  | +        :total="total"
 | 
	
		
			
				|  |  | +        :page-size.sync="pageSize"
 | 
	
		
			
				|  |  | +        :current-page.sync="pageNum"
 | 
	
		
			
				|  |  | +        @size-change="handleSizeChange"
 | 
	
		
			
				|  |  | +        @current-change="handleCurrentChange"
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +      </el-pagination>
 | 
	
		
			
				|  |  | +    </el-card>
 | 
	
		
			
				|  |  | +  </div>
 | 
	
		
			
				|  |  | +</template>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +<script>
 | 
	
		
			
				|  |  | +import { getDurationList } from '@/api/his//doctorDuration'
 | 
	
		
			
				|  |  | +import{listDepartment} from "@/api/his/disease";
 | 
	
		
			
				|  |  | +import{listAllHospital} from "@/api/his/hospital";
 | 
	
		
			
				|  |  | +export default {
 | 
	
		
			
				|  |  | +  name: 'DoctorDuration',
 | 
	
		
			
				|  |  | +  data() {
 | 
	
		
			
				|  |  | +    return {
 | 
	
		
			
				|  |  | +      // 分页
 | 
	
		
			
				|  |  | +      pageNum: 1,
 | 
	
		
			
				|  |  | +      pageSize: 10,
 | 
	
		
			
				|  |  | +      total: 0,
 | 
	
		
			
				|  |  | +      loading: false,
 | 
	
		
			
				|  |  | +      tableData: [],
 | 
	
		
			
				|  |  | +      //医院列表
 | 
	
		
			
				|  |  | +      hospitalList:[],
 | 
	
		
			
				|  |  | +      //科室列表
 | 
	
		
			
				|  |  | +      depList:[],
 | 
	
		
			
				|  |  | +      // 搜索表单
 | 
	
		
			
				|  |  | +      searchForm: {
 | 
	
		
			
				|  |  | +        hospitalId: null,
 | 
	
		
			
				|  |  | +        deptId: null,
 | 
	
		
			
				|  |  | +        doctorName: '',
 | 
	
		
			
				|  |  | +        startTime: null,
 | 
	
		
			
				|  |  | +        endTime: null,
 | 
	
		
			
				|  |  | +        sort: 'asc' // 默认升序
 | 
	
		
			
				|  |  | +      },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      // 时间范围绑定(用于 el-date-picker)
 | 
	
		
			
				|  |  | +      dateRange: null,
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +      // 快捷时间选项
 | 
	
		
			
				|  |  | +      pickerShortcuts: [
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +          text: '最近7天',
 | 
	
		
			
				|  |  | +          onClick(picker) {
 | 
	
		
			
				|  |  | +            const end = new Date()
 | 
	
		
			
				|  |  | +            const start = new Date()
 | 
	
		
			
				|  |  | +            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
 | 
	
		
			
				|  |  | +            picker.$emit('pick', [start, end])
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +          text: '最近30天',
 | 
	
		
			
				|  |  | +          onClick(picker) {
 | 
	
		
			
				|  |  | +            const end = new Date()
 | 
	
		
			
				|  |  | +            const start = new Date()
 | 
	
		
			
				|  |  | +            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
 | 
	
		
			
				|  |  | +            picker.$emit('pick', [start, end])
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +      ]
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  async created() {
 | 
	
		
			
				|  |  | +    await this.loadHospitals()
 | 
	
		
			
				|  |  | +    await this.loadDepartments()
 | 
	
		
			
				|  |  | +    this.fetchList()
 | 
	
		
			
				|  |  | +  },
 | 
	
		
			
				|  |  | +  methods: {
 | 
	
		
			
				|  |  | +    // 获取列表
 | 
	
		
			
				|  |  | +    async fetchList() {
 | 
	
		
			
				|  |  | +      this.loading = true
 | 
	
		
			
				|  |  | +      try {
 | 
	
		
			
				|  |  | +        const params = {
 | 
	
		
			
				|  |  | +          ...this.searchForm,
 | 
	
		
			
				|  |  | +          pageNum: this.pageNum,
 | 
	
		
			
				|  |  | +          pageSize: this.pageSize
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 处理时间范围
 | 
	
		
			
				|  |  | +        if (this.dateRange && this.dateRange.length === 2) {
 | 
	
		
			
				|  |  | +          params.startTime = this.dateRange[0]
 | 
	
		
			
				|  |  | +          params.endTime = this.dateRange[1]
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +          params.startTime = null
 | 
	
		
			
				|  |  | +          params.endTime = null
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        const res = await getDurationList(params)
 | 
	
		
			
				|  |  | +        const page = res.data
 | 
	
		
			
				|  |  | +        this.tableData = page.list || []
 | 
	
		
			
				|  |  | +        this.total = page.total || 0
 | 
	
		
			
				|  |  | +      } catch (error) {
 | 
	
		
			
				|  |  | +        this.tableData = []
 | 
	
		
			
				|  |  | +        this.total = 0
 | 
	
		
			
				|  |  | +        console.error('查询失败:', error)
 | 
	
		
			
				|  |  | +      } finally {
 | 
	
		
			
				|  |  | +        this.loading = false
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    /** 查询医院列表 */
 | 
	
		
			
				|  |  | +    async loadHospitals() {
 | 
	
		
			
				|  |  | +      listAllHospital().then(response => {
 | 
	
		
			
				|  |  | +        this.hospitalList = response.rows;
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    /** 查询科室列表 */
 | 
	
		
			
				|  |  | +    async loadDepartments() {
 | 
	
		
			
				|  |  | +      listDepartment().then(response => {
 | 
	
		
			
				|  |  | +        this.depList = response.rows;
 | 
	
		
			
				|  |  | +      });
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    // 重置搜索
 | 
	
		
			
				|  |  | +    resetSearch() {
 | 
	
		
			
				|  |  | +      this.searchForm = {
 | 
	
		
			
				|  |  | +        doctorName: '',
 | 
	
		
			
				|  |  | +        hospitalId: null,
 | 
	
		
			
				|  |  | +        deptId: null,
 | 
	
		
			
				|  |  | +        sort: 'asc'
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      this.dateRange = null
 | 
	
		
			
				|  |  | +      this.pageNum = 1
 | 
	
		
			
				|  |  | +      this.fetchList()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // 分页事件
 | 
	
		
			
				|  |  | +    handleSizeChange(val) {
 | 
	
		
			
				|  |  | +      this.pageSize = val
 | 
	
		
			
				|  |  | +      this.fetchList()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +    handleCurrentChange(val) {
 | 
	
		
			
				|  |  | +      this.pageNum = val
 | 
	
		
			
				|  |  | +      this.fetchList()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // 表格排序变化(点击表头排序)
 | 
	
		
			
				|  |  | +    handleSortChange({ order }) {
 | 
	
		
			
				|  |  | +      this.searchForm.sort = order === 'descending' ? 'desc' : 'asc'
 | 
	
		
			
				|  |  | +      this.fetchList()
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    // 秒数转“X分Y秒”
 | 
	
		
			
				|  |  | +    formatSeconds(seconds) {
 | 
	
		
			
				|  |  | +      if (seconds == null || seconds === '') return '0秒'
 | 
	
		
			
				|  |  | +      const sec = Math.floor(Number(seconds))
 | 
	
		
			
				|  |  | +      const min = Math.floor(sec / 60)
 | 
	
		
			
				|  |  | +      const remainingSec = sec % 60
 | 
	
		
			
				|  |  | +      if (min > 0) {
 | 
	
		
			
				|  |  | +        return `${min}分${remainingSec}秒`
 | 
	
		
			
				|  |  | +      }
 | 
	
		
			
				|  |  | +      return `${remainingSec}秒`
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +</script>
 |