postdischarge-ui/src/views/unitconfig/patientConfiguration/index.vue
2024-08-12 14:54:46 +08:00

480 lines
18 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container" ref="layout">
<div ref="topform" class="form">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="患者表id" prop="patientId">
<el-input
v-model="queryParams.patientId"
placeholder="请输入患者表id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="身份证号" prop="cardNo">
<el-input
v-model="queryParams.cardNo"
placeholder="请输入身份证号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<el-form-item label="患者姓名" prop="patientName">
<el-input v-model="queryParams.patientName" placeholder="请输入患者姓名" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="患者电话" prop="patientPhone">
<el-input v-model="queryParams.patientPhone" placeholder="请输入患者电话" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<!-- <el-form-item label="家属电话" prop="familyMemberPhone">
<el-input
v-model="queryParams.familyMemberPhone"
placeholder="请输入家属电话"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input
v-model="queryParams.address"
placeholder="请输入地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="出生日期格式yyyy-MM-dd" prop="birthDate">
<el-date-picker clearable
v-model="queryParams.birthDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择出生日期格式yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item label="就诊类型门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL" prop="visitType">
<el-select v-model="queryParams.visitType" placeholder="请选择就诊类型门诊OUTPATIENT_SERVICE住院BE_IN_HOSPITAL" clearable>
<el-option
v-for="dict in dict.type.visit_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item> -->
<el-form-item label="医院" prop="hospitalAgencyId">
<el-select v-model="queryParams.hospitalAgencyId" filterable placeholder="请选择医院" style="width: 208px"
clearable>
<el-option v-for="item in hospitalAgencylist" :key="item.id" :label="item.agencyName" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="所属院区id" prop="campusAgencyId">
<el-input v-model="queryParams.campusAgencyId" placeholder="请输入所属院区id" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="所属科室id" prop="departmentId">
<el-input v-model="queryParams.departmentId" placeholder="请输入所属科室id" clearable
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="所属病区id" prop="wardId">
<el-input v-model="queryParams.wardId" placeholder="请输入所属病区id" clearable @keyup.enter.native="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-form-item>
</el-form>
</div>
<div ref="mb8" class="mb8">
<el-row :gutter="10" class="">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['unitconfig:visitRecord:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
v-hasPermi="['unitconfig:visitRecord:edit']">编辑</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['unitconfig:visitRecord:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
v-hasPermi="['unitconfig:visitRecord:export']">导出</el-button>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</div>
<div ref="table">
<el-table :max-height="maxTableHeight" v-loading="loading" :data="visitRecordList"
@selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" />
<el-table-column label="序号" type="index" width="48" align="center" />
<el-table-column label="pat_id" align="center" prop="id" />
<el-table-column label="姓名" align="center" prop="patientName" />
<el-table-column label="电话" align="center" prop="patientPhone" />
<el-table-column label="身份证号" align="center" prop="cardNo" />
<!-- <el-table-column label="家属电话" align="center" prop="familyMemberPhone" /> -->
<!-- <el-table-column label="地址" align="center" prop="address" /> -->
<el-table-column label="性别" align="center" prop="sex">
<template slot-scope="scope">
<span>{{ scope.row.sex == "MALE" ? "男" : "" }}
{{ scope.row.sex == "FEMALE" ? "女" : "" }}
</span>
</template>
</el-table-column>
<!-- <el-table-column label="出生日期格式yyyy-MM-dd" align="center" prop="birthDate" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.birthDate, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="就诊类型门诊OUTPATIENT_SERVICE住院BE_HOSPITALIZED" align="center" prop="visitType">
<template slot-scope="scope">
<dict-tag :options="dict.type.visit_type" :value="scope.row.visitType" />
</template>
</el-table-column>
<el-table-column label="所属医院名称" align="center" prop="hospitalAgencyName" />
<el-table-column label="所属院区名称" align="center" prop="campusAgencyName" />
<el-table-column label="所属科室名称" align="center" prop="departmentName" />
<el-table-column label="所属病区名称" align="center" prop="wardName" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" @click="handleUpdate(scope.row)"
v-hasPermi="['unitconfig:visitRecord:edit']">编辑</el-button>
<el-button size="mini" type="text" @click="goPatientConfigurationVisitRecords(scope.row)">就诊记录</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['unitconfig:visitRecord:remove']">删除</el-button> -->
</template>
</el-table-column>
</el-table>
</div>
<!-- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" /> -->
<myPagination v-show="total > 0" :total="total" :pageSize="queryParams.pageSize"
:indexFromWrap="queryParams.pageNum" @updateCPage="updateCPage"></myPagination>
<!-- 添加或修改患者就诊记录基本信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="患者姓名" prop="patientName">
<el-input v-model="form.patientName" placeholder="请输入患者姓名" />
</el-form-item>
<el-form-item label="患者电话" prop="patientPhone">
<el-input v-model="form.patientPhone" placeholder="请输入患者电话" maxlength="11" />
</el-form-item>
<el-form-item label="身份证号" prop="cardNo">
<el-input v-model="form.cardNo" placeholder="请输入身份证号" maxlength="18" />
</el-form-item>
<el-form-item label="所属医院" prop="hospitalAgencyId">
<el-select v-model="form.hospitalAgencyId" filterable placeholder="请选择所属医院" style="width: 380px" clearable
@change="changehospitalAgency">
<el-option v-for="item in hospitalAgencylist" :key="item.id" :label="item.agencyName" :value="item.id">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="pat_id" prop="patientId">
<el-input v-model="form.patientId" placeholder="" disabled />
</el-form-item> -->
<el-form-item label="地址" prop="address">
<el-input v-model="form.address" placeholder="请输入地址" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listVisitRecord, getVisitRecord, delVisitRecord, addVisitRecord, updateVisitRecord } from "@/api/unitconfig/patientConfiguration";
import { selectAgencyList } from "@/api/manage/selectAgencyList";
import { getAge } from "@/utils/age";
export default {
name: "patientConfiguration",
dicts: ['visit_type'],
data() {
//验证身份证
var isCardId = (rule, value, callback) => {
if (value == null) {
callback(new Error("请输入身份证号"));
} else {
const reg =
/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[0-2])(([0-2][1-9])|10|20|30|31)\d{3}(\d|X|x)$/;
const card = reg.test(value);
if (!card) {
callback(new Error("身份证号格式有误!"));
} else {
callback();
}
}
};
return {
maxTableHeight: undefined,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 患者就诊记录基本信息表格数据
visitRecordList: [],
//医院
hospitalAgencylist: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
patientId: null,
cardNo: null,
patientName: null,
patientPhone: null,
familyMemberPhone: null,
address: null,
sex: null,
birthDate: null,
visitMethod: null,
hospitalAgencyId: null,
campusAgencyId: null,
departmentId: null,
wardId: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
hospitalAgencyId: [
{ required: true, message: "所属医院不能为空", trigger: "blur" }
],
patientName: [
{ required: true, message: "患者姓名不能为空", trigger: "blur" }
],
patientPhone: [
{ required: true, message: "患者电话不能为空", trigger: "blur" },
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号",
trigger: "blur"
}
],
cardNo: [
{ required: true, message: '', validator: isCardId, trigger: 'change' }
],
// patientId: [
// { required: true, message: "患者表id不能为空", trigger: "blur" }
// ],
}
};
},
created() {
this.getList();
this.selectAgencyinfo();
},
mounted() {
this.getMaxTableHeight()
this.screenChange()
},
methods: {
updateCPage(index, size) {
this.queryParams.pageNum = index
this.queryParams.pageSize = size
this.getList();
},
changehospitalAgency(e) {
this.form.hospitalAgencyName = this.hospitalAgencylist.find(f => f.id == e)?.agencyName
},
/** 查询患者就诊记录基本信息列表 */
getList() {
this.loading = true;
listVisitRecord(this.queryParams).then(response => {
this.visitRecordList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//获取医院list
selectAgencyinfo() {
let query = {
agencyStatus: 'ON',
nodeType: 'HOSPITAL',
}
selectAgencyList(query).then(res => {
this.hospitalAgencylist = res.data
})
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
patientId: null,
cardNo: null,
patientName: null,
patientPhone: null,
familyMemberPhone: null,
address: null,
sex: null,
birthDate: null,
age: null,
nation: null,
visitMethod: null,
visitName: null,
hospitalAgencyId: null,
hospitalAgencyName: null,
campusAgencyId: null,
campusAgencyName: null,
departmentId: null,
departmentName: null,
wardId: null,
wardName: null,
attendingPhysicianId: null,
attendingPhysicianName: null,
mainDiagnosis: null,
marriage: null,
medicalHistoryNarrator: null,
admissionTime: null,
dischargeTime: null,
recordTime: null,
outpatientVisitInfo: null,
hospitalizationDays: null,
inHospitalInfo: null,
outHospitalInfo: null,
visitSerialNumber: null,
inHospitalNumber: null,
responsibleNurse: null,
surgicalName: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加患者就诊记录基本信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getVisitRecord(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改患者就诊记录基本信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateVisitRecord(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addVisitRecord(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除患者就诊记录基本信息编号为"' + ids + '"的数据项?').then(function () {
return delVisitRecord(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download('manage/visitRecord/export', {
...this.queryParams
}, `visitRecord_${new Date().getTime()}.xlsx`)
},
// 跳转就诊记录
goPatientConfigurationVisitRecords(row) {
this.$router.push({
path: "/unitconfig/PatientConfigurationVisitRecords",
query: {
path: "/unitconfig/patientConfiguration",
patientId: row.id,
cardNo: row.cardNo,
patientName: row.patientName,
patientPhone: row.patientPhone,
sex: row.sex,
age: row.birthDate ? getAge(row.birthDate) : '',
hospitalAgencyId: row.hospitalAgencyId,
hospitalAgencyName: row.hospitalAgencyName
},
});
},
// 获取表格最高高度
getMaxTableHeight() {
const windowInnerHeight = window.innerHeight // 屏幕可视高度
const layoutDiv = this.$refs.layout
const formDiv = this.$refs.topform
const mb8Div = this.$refs.mb8
this.maxTableHeight =
windowInnerHeight - 134 -
this.getBoxPadding(layoutDiv) -
this.getBoxHeight(mb8Div) -
this.getBoxHeight(formDiv)
},
// 屏幕resize监听
screenChange() {
// 屏幕resize监听事件一旦屏幕宽高发生变化就会执行resize
window.addEventListener('resize', this.getMaxTableHeight, true)
// 将屏幕监听事件移除
// 这步是必须的。离开页面时不移除,再返回,或者进入到别的有相同元素的页面会报错
// 或者将这里的方法直接写在beforeDestroy函数中也可以
this.$once('hook:beforeDestroy', () => {
window.removeEventListener('resize', this.getMaxTableHeight, true)
})
},
}
};
</script>