<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>
|