医生排班

This commit is contained in:
shidongli 2023-09-26 15:02:17 +08:00
parent 7cea6b0b31
commit b4539ddcbb
2 changed files with 790 additions and 0 deletions

View File

@ -0,0 +1,63 @@
import request from '@/utils/request'
// 医院下拉框
export function getList(query) {
return request({
url: '/system/hospital/getList',
method: 'get',
params: query
})
}
// 科室下拉框
export function hospitalDepartment(hospitalId) {
return request({
url: `/system/hospitalDepartment/getList?hospitalId=${hospitalId}`,
method: 'get',
})
}
// 查询排班计划列表
export function plan(query) {
return request({
url: '/system/schedule/plan/list',
method: 'get',
params: query
})
}
// 查询班次列表
export function schedule(hospitalId) {
return request({
url: `/system/schedule/getList?hospitalId=${hospitalId}`,
method: 'get',
})
}
// 医生姓名列表
export function hospitalPerson(departmentId,hospitalId) {
return request({
url: `/system/hospitalPerson/getList?departmentId=${departmentId}&hospitalId=${hospitalId}`,
method: 'get',
})
}
// 新增医生排班
export function add(data) {
return request({
url: '/system/schedule/plan/add',
method: 'post',
data: data
})
}
// 排班计划明细
export function plandetail(schedulePlanId) {
return request({
url: `/system/schedule/plandetail/getList?schedulePlanId=${schedulePlanId}`,
method: 'get',
})
}

View File

@ -0,0 +1,727 @@
<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="hospitalId">
<el-select
v-model="queryParams.hospitalId"
placeholder="请选择医院名称"
clearable
@change="hospitalNamechange"
>
<el-option
v-for="item in hospitalNamelist"
:key="item.id"
:label="item.hospitalName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="科室名称" prop="departmentId">
<el-select
v-model="queryParams.departmentId"
placeholder="请选择科室名称"
clearable
@change="departmentNameadd"
>
<el-option
v-for="item in hospitalDepartmentist"
:key="item.id"
:label="item.departmentName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="医生姓名" prop="doctorId">
<el-select
v-model="queryParams.doctorId"
placeholder="请选择医生姓名"
clearable
@change="doctorIdadd"
>
<el-option
v-for="item in personNamelist"
:key="item.id"
:label="item.personName"
:value="item.id"
>
</el-option>
</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">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
@click="handleUpdate"
>修改</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="['system:hospitalDepartment:remove']"
>删除</el-button
>
</el-col> -->
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="hospitalList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="医院名称" align="center" prop="hospitalName" />
<el-table-column label="科室名称" align="center" prop="departmentName" />
<el-table-column label="医生姓名" align="center" prop="doctorName" />
<el-table-column label="班次名称" align="center" prop="scheduleName" />
<el-table-column
label="排版开始日期"
align="center"
prop="scheduleStartDate"
/>
<el-table-column
label="排版结束日期"
align="center"
prop="scheduleEndDate"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-zoom-in"
@click="handleUpdate(scope.row)"
>查看明细</el-button
>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加医生排班管理对话框 -->
<el-dialog
:title="title"
:visible.sync="addopen"
width="850px"
append-to-body
:before-close="cancel"
>
<el-form
:inline="true"
:rules="rules"
label-width="120px"
:model="form"
ref="form"
>
<el-form-item label="医院名称" prop="hospitalId">
<el-select
v-model="form.hospitalId"
placeholder="请选择医院名称"
clearable
@change="hospitalNamechangeadd"
>
<el-option
v-for="item in hospitalNamelist"
:key="item.id"
:label="item.hospitalName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="班次名称" prop="scheduleId">
<el-select
v-model="form.scheduleId"
placeholder="请选择班次名称"
clearable
@change="scheduleIdadd"
>
<el-option
v-for="item in schedulelist"
:key="item.id"
:label="item.scheduleName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="科室名称" prop="departmentId">
<el-select
v-model="form.departmentId"
placeholder="请选择科室名称"
clearable
@change="departmentNameadd"
>
<el-option
v-for="item in hospitalDepartmentist"
:key="item.id"
:label="item.departmentName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="医生姓名" prop="doctorId">
<el-select
v-model="form.doctorId"
placeholder="请选择医生姓名"
clearable
@change="doctorIdadd"
>
<el-option
v-for="item in personNamelist"
:key="item.id"
:label="item.personName"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="排班开始日期" prop="scheduleStartDate">
<el-date-picker
v-model="form.scheduleStartDate"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
type="date"
placeholder="排班开始日期"
style="width: 220px"
:picker-options="pickerStartTime"
></el-date-picker>
</el-form-item>
<el-form-item label="排班结束日期" prop="scheduleEndDate">
<el-date-picker
v-model="form.scheduleEndDate"
format="yyyy 年 MM 月 dd 日"
value-format="yyyy-MM-dd"
type="date"
placeholder="排班结束日期"
style="width: 220px"
:picker-options="pickerEndTime"
></el-date-picker>
</el-form-item>
<el-form-item label="每人预约分钟数" prop="minutesPerPatient">
<el-input-number
style="width: 220px"
v-model="form.minutesPerPatient"
label="请输入每人预约分钟数"
:min="1"
:precision="0"
></el-input-number>
<!-- <el-input placeholder="请输入每人预约分钟数" style="width: 220px" v-model="form.minutesPerPatient"/> -->
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="form.status" placeholder="请选择状态" clearable>
<el-option
v-for="item in state"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="出诊地点" prop="scheduleAddress">
<el-input
v-model="form.scheduleAddress"
placeholder="请输入出诊地点"
type="textarea"
style="width: 570px"
/>
</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>
<!-- 查看明细对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="1000px"
append-to-body
>
<el-table
v-loading="loading"
:data="hospitalDepartmentList"
@selection-change="handleSelectionChange"
>
<el-table-column label="医院姓名" align="center" prop="doctorName" />
<el-table-column label="排班日期" align="center" prop="scheduleDate" />
<el-table-column
label="开始时间"
align="center"
prop="scheduleStartTime"
/>
<el-table-column
label="结束时间"
align="center"
prop="scheduleEndTime"
/>
<el-table-column label="预约状态" align="center" prop="applyState">
<template slot-scope="scope">
{{ scope.row.applyState == "0" ? "未预约" : "" }}
{{ scope.row.applyState == "1" ? "已预约" : "" }}
</template>
</el-table-column>
<el-table-column label="可预约状态" align="center" prop="status">
<template slot-scope="scope">
{{ scope.row.status == "0" ? "可预约" : "" }}
{{ scope.row.status == "1" ? "不可预约" : "" }}
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { getList, hospitalDepartment, plan, add, schedule, hospitalPerson, plandetail } from "@/api/system/Scheduling";
export default {
name: "Scheduling",
data() {
return {
/* start 开始时间小于今天,结束时间不能大于开始时间 */
endDisabled: {
disabledDate: time => {
if (this.form.scheduleStartDate) {
return (
time.getTime() < new Date(this.form.scheduleStartDate).getTime()
);
} else {
return time.getTime() >= Date.now();
}
}
},
//
loading: true,
//
ids: [],
hospitalqueryParams: {
pageNum: 1,
pageSize: 10,
hospitalCode: "",
hospitalName: "",
},
hospitalList: [],//
hospitalNamelist: [],//
hospitalDepartmentist: [],//
schedulelist: [],//
personNamelist: [],//
hospitalId: '',//id
departmentId: '',//id
state: [{
value: '0',
label: '启用'
},
{
value: '1',
label: '未启用'
}],
//
single: true,
addopen: false,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
hospitalDepartmentList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
departmentId: "",
departmentName: "",
doctorId: "",
doctorName: "",
hospitalId: "",
hospitalName: "",
},
//
form: {
departmentId: "",
departmentName: "",
doctorId: "",
doctorName: "",
hospitalId: "",
hospitalName: "",
minutesPerPatient: "",
scheduleAddress: "",
scheduleEndDate: "",
scheduleId: "",
scheduleName: "",
scheduleStartDate: "",
status: "0",
},
//
rules: {
hospitalDepartmentInfoList: {
hospitalId: [
{
required: true,
message: "请选择所属医院",
trigger: "blur",
},
],
departmentSort: [
{
required: true,
message: "请输入科室显示排序",
trigger: "blur",
},
],
departmentName: [
{
required: true,
message: "请输入科室名称",
trigger: "blur",
},
],
departmentPerson: [
{
required: true,
message: "请输入科室负责人",
trigger: "blur",
},
],
departmentPhone: [
{
required: true,
// validator: checkMobile,
trigger: "blur",
message: "",
},
],
departmentAddress: [
{
required: true,
message: "请输入科室地址",
trigger: "blur",
},
],
},
departmentName: [
{
required: true,
message: "请输入科室名称",
trigger: "blur",
},
],
departmentPerson: [
{
required: true,
message: "请输入科室负责人",
trigger: "blur",
},
],
departmentPhone: [
{
required: true,
// validator: checkMobile,
trigger: "blur",
message: "",
},
],
departmentAddress: [
{
required: true,
message: "请输入科室地址",
trigger: "blur",
message: "",
},
],
departmentSort: [
{
required: true,
message: "请输入科室显示顺序",
trigger: "blur",
},
],
},
};
},
created() {
this.getList();
this.hospitalName();
},
computed: {
pickerStartTime() {
return {
disabledDate: time => {
if (this.form.scheduleEndDate) {
let edtTime = this.form.scheduleEndDate.replace(/-/g, '/');
return time.getTime() > new Date(edtTime)
}
}
}
},
pickerEndTime() {
return {
disabledDate: time => {
if (this.form.scheduleStartDate) {
let startTime = this.form.scheduleStartDate.replace(/-/g, '/');
return time.getTime() < new Date(startTime)
}
}
}
}
},
methods: {
//
cancel() {
this.addopen = false;
},
/** 查询医生排班管理列表 */
getList() {
this.loading = true;
plan(this.queryParams).then((response) => {
this.hospitalList = response.rows;
if (response.total) {
this.total = response.total;
}
this.loading = false;
});
},
//
hospitalNamechange(value) {
this.hospitalId = value
this.form.hospitalName = this.hospitalNamelist.find((f) => f.id == this.hospitalId)?.hospitalName;
hospitalDepartment(this.hospitalId).then(response => {
this.hospitalDepartmentist = response.data;
});
},
//
hospitalName() {
getList().then(response => {
this.hospitalNamelist = response.data;
});
},
//
hospitalNamechangeadd(value) {
this.hospitalId = value
this.form.hospitalName = this.hospitalNamelist.find((f) => f.id == this.hospitalId)?.hospitalName;
this.form.departmentId = "",
this.form.doctorId = "",
this.form.scheduleId = "",
// this.$refs.departmentId.clear()
//
hospitalDepartment(this.hospitalId).then(response => {
this.hospitalDepartmentist = response.data;
});
//
schedule(this.hospitalId).then(response => {
this.schedulelist = response.data;
});
},
//
departmentNameadd(value) {
this.departmentId = value
this.form.departmentName = this.hospitalDepartmentist.find((f) => f.id == this.departmentId)?.departmentName;
hospitalPerson(this.departmentId, this.hospitalId).then(response => {
this.personNamelist = response.data;
});
},
//
doctorIdadd(value) {
this.form.doctorName = this.personNamelist.find((f) => f.id == value)?.personName;
},
//
scheduleIdadd(value) {
this.form.scheduleName = this.schedulelist.find((f) => f.id == value)?.scheduleName;
},
//
cancel() {
this.addopen = false;
this.open = false;
this.reset();
},
//
reset() {
this.form = {
departmentId: "",
departmentName: "",
doctorId: "",
doctorName: "",
hospitalId: "",
hospitalName: "",
minutesPerPatient: "",
scheduleAddress: "",
scheduleEndDate: "",
scheduleId: "",
scheduleName: "",
scheduleStartDate: "",
status: "0",
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams = {
pageNum: 1,
pageSize: 10,
hospitalName: "",
departmentCode: "",
departmentName: "",
};
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.hospitalName();
this.addopen = true;
this.title = "添加医生排班";
},
/** mi按钮操作 */
handleUpdate(row) {
console.log(row)
this.reset();
this.open = true;
this.title = "查看明细";
const schedulePlanId = row.id || this.ids;
// this.form.hospitalId = row.id;
plandetail(schedulePlanId).then((response) => {
this.hospitalDepartmentList = response.data;
this.open = true;
this.title = "查看明细";
});
},
/** 提交按钮 */
submitForm() {
console.log(this.form)
this.$refs["form"].validate((valid) => {
if (valid) {
add(this.form).then((response) => {
if (response.code == 200) {
this.$modal.msgSuccess("新增成功");
this.addopen = false;
this.getList();
}
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm("是否确认删除此科室的信息?")
.then(function () {
return delHospitalDepartment(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => { });
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/hospitalDepartment/export",
{
...this.queryParams,
},
`hospitalDepartment_${new Date().getTime()}.xlsx`
);
},
},
};
</script>