WXL (wul)
16 小时以前 a9d2b856e0f6be6475319c2dc36bf405c2f908fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
  <el-dialog
    title="选择门诊记录"
    :visible.sync="dialogVisible"
    width="85%"
    append-to-body
    top="4vh"
    :close-on-click-modal="false"
    @close="handleClose"
  >
    <el-form :inline="true" size="small" label-width="56px">
      <el-form-item label="姓名">
        <el-input v-model="queryParams.patname" placeholder="请输入姓名" clearable style="width:160px" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="诊断">
        <el-input v-model="queryParams.diagname" placeholder="请输入诊断" clearable style="width:160px" @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
 
    <el-table
      v-loading="loading"
      :data="list"
      border
      highlight-current-row
      style="width: 100%"
      @current-change="handleCurrentChange"
    >
      <el-table-column label="就诊时间" align="center" width="140">
        <template slot-scope="scope">{{ formatTime(scope.row.admitdate) }}</template>
      </el-table-column>
      <el-table-column label="病案号" align="center" prop="outhospno" width="110" />
      <el-table-column label="姓名" align="center" prop="patname" width="100" />
      <el-table-column label="性别" align="center" width="60">
        <template slot-scope="scope">{{ scope.row.sex == 1 ? "男" : "女" }}</template>
      </el-table-column>
      <el-table-column label="年龄" align="center" prop="age" width="60" />
      <el-table-column label="联系电话" align="center" prop="telcode" width="120" />
      <el-table-column label="诊断" align="center" prop="diagname" show-overflow-tooltip />
      <el-table-column label="就诊科室" align="center" prop="deptname" show-overflow-tooltip />
      <el-table-column label="接诊医生" align="center" prop="drname" width="100" />
    </el-table>
 
    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
 
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" :disabled="!currentRow" @click="handleConfirm">确定</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
import { listPatouthosp } from "@/api/smartor/patouthosp";
import { loadArchives, saveArchives, buildArchiveRecord } from "../types";
import store from "@/store";
 
export default {
  name: "OutpatientPicker",
  props: {
    visible: { type: Boolean, default: false },
    type: { type: String, default: "" },
    sourcePage: { type: String, default: "outpatient" },
  },
  data() {
    return {
      dialogVisible: false,
      loading: false,
      list: [],
      total: 0,
      currentRow: null,
      queryParams: { pageNum: 1, pageSize: 10, patname: "", diagname: "", searchscope: 3, deptcodes: [] },
    };
  },
  watch: {
    visible(val) {
      this.dialogVisible = val;
      if (val) {
        this.currentRow = null;
        this.getList();
      }
    },
    dialogVisible(val) {
      if (!val) this.$emit("update:visible", false);
    },
  },
  methods: {
    getList() {
      this.loading = true;
      if (this.queryParams.searchscope == 3) {
        this.queryParams.deptcodes = store.getters.belongDepts.map((obj) => obj.deptCode);
      }
      listPatouthosp(this.queryParams)
        .then((response) => {
          this.list = response.rows || [];
          this.total = response.total || 0;
        })
        .finally(() => { this.loading = false; });
    },
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    resetQuery() {
      this.queryParams = { pageNum: 1, pageSize: 10, patname: "", diagname: "", searchscope: 3, deptcodes: [] };
      this.currentRow = null;
      this.getList();
    },
    handleCurrentChange(row) {
      this.currentRow = row;
    },
    formatTime(time) {
      if (!time) return "-";
      return String(time).substring(0, 19).replace("T", " ");
    },
    handleConfirm() {
      if (!this.currentRow) return;
      const record = buildArchiveRecord(this.currentRow, this.type, this.sourcePage);
      const all = loadArchives();
      all.push(record);
      saveArchives(all);
      this.dialogVisible = false;
      this.$emit("picked", record);
    },
    handleClose() {
      this.currentRow = null;
    },
  },
};
</script>
 
<style lang="scss" scoped>
.dialog-footer {
  text-align: right;
}
</style>