@@ -0,0 +1,56 @@ | |||
import request from "@/utils/request"; | |||
const BASE_URL = "/internal"; | |||
/** | |||
* 治疗方案 | |||
*/ | |||
// 治疗方案列表 | |||
export function getTherapeuticListApi(params) { | |||
return request({ | |||
url: `${BASE_URL}/medical-treatment-plan`, | |||
method: "get", | |||
params, | |||
}); | |||
} | |||
// 新增治疗方案 | |||
export function addTherapeuticApi(data) { | |||
return request({ | |||
url: `${BASE_URL}/medical-treatment-plan`, | |||
method: "post", | |||
data, | |||
}); | |||
} | |||
// 编辑治疗方案 | |||
export function editTherapeuticApi(data) { | |||
return request({ | |||
url: `${BASE_URL}/medical-treatment-plan`, | |||
method: "put", | |||
data, | |||
}); | |||
} | |||
// 批量删除 | |||
export function batchDelTherapeuticApi(data) { | |||
return request({ | |||
url: `${BASE_URL}/medical-treatment-plan`, | |||
method: "delete", | |||
data, | |||
}); | |||
} | |||
// 治疗方案详情 | |||
export function getTherapeuticApi(id) { | |||
return request({ | |||
url: `${BASE_URL}/medical-treatment-plan/${id}`, | |||
method: "get", | |||
}); | |||
} | |||
// 治疗方案详情 | |||
export function delTherapeuticApi(id) { | |||
return request({ | |||
url: `${BASE_URL}/medical-treatment-plan/${id}`, | |||
method: "get", | |||
}); | |||
} |
@@ -20,6 +20,7 @@ | |||
:options="deptList" | |||
:autoFetch="false" | |||
:props="{ emitPath: true }" | |||
@change="onChangeDept" | |||
/> | |||
</el-form-item> | |||
<el-form-item label="疾病名称" prop="name"> | |||
@@ -108,9 +109,9 @@ | |||
<script> | |||
import ImportResultPopup from "@/components/ImportResultPopup"; | |||
import { getTreeHospDept } from "@/api/index"; | |||
import { diseasePageList, deleteDisease, batchImportDisease } from '@/api/dictManage/disease'; | |||
import { getAllHospital } from '@/api/dictManage/hosp'; | |||
import { getTreeHospDept } from "@/api/index"; | |||
import { diseasePageList, deleteDisease, batchImportDisease } from "@/api/dictManage/disease"; | |||
import { getAllHospital } from "@/api/dictManage/hosp"; | |||
import CrudPopup from "./components/CrudPopup/index.vue"; | |||
import TreeDept from "@/components/TreeDept"; | |||
@@ -119,7 +120,7 @@ export default { | |||
components: { | |||
ImportResultPopup, | |||
CrudPopup, | |||
TreeDept | |||
TreeDept, | |||
}, | |||
data() { | |||
@@ -139,12 +140,12 @@ export default { | |||
pageSize: 10, | |||
name: "", | |||
wardId: "", // 院区ID | |||
deptId: [] | |||
deptId: [], | |||
}, | |||
pageList: [], | |||
uploading: false, | |||
wardIdList: [], // 院区列表 | |||
deptList: [] // 科室数据 | |||
deptList: [], // 科室数据 | |||
}; | |||
}, | |||
created() { | |||
@@ -189,15 +190,16 @@ export default { | |||
}, | |||
/*获取科室数据*/ | |||
async getDeptList(wardId) { | |||
const res = await getTreeHospDept({ wardId : wardId }); | |||
const res = await getTreeHospDept({ wardId: wardId }); | |||
this.deptList = res.data || []; | |||
}, | |||
getList() { | |||
this.loading = true; | |||
const params = JSON.parse(JSON.stringify(this.queryParams)); | |||
params.deptId = params.deptId?.length === 2 ? | |||
params.deptId.slice(-1).toString() : | |||
params.deptId?.length === 1 && params.deptId.slice(-1).toString() || ''; | |||
params.deptId = | |||
params.deptId?.length === 2 | |||
? params.deptId.slice(-1).toString() | |||
: (params.deptId?.length === 1 && params.deptId.slice(-1).toString()) || ""; | |||
diseasePageList(this.addDateRange(params, this.dateRange)) | |||
.then((res) => { | |||
const { list, page } = res.data; | |||
@@ -1,19 +1,27 @@ | |||
<template> | |||
<vxe-modal type="modal" v-bind="modalConfig" v-model="show" :title="showTitle"> | |||
<vxe-form ref="formRef" v-bind="formConfig" :data="formData" :rules="formRules"> | |||
<vxe-form | |||
ref="formRef" | |||
v-bind="formConfig" | |||
:data="formData" | |||
:rules="formRules" | |||
:loading="loadingDetail" | |||
> | |||
<template #dept_f_d="{ data }"> | |||
<tree-dept | |||
v-model="data.deptId" | |||
clearable | |||
class="w-full" | |||
:options="deptOptions" | |||
:props="{ emitPath: false }" | |||
:props="{ emitPath: false, checkStrictly: true }" | |||
:autoFetch="false" | |||
@change="() => onChangeDept(data)" | |||
></tree-dept> | |||
</template> | |||
<template #a3_f_d="{ data }"> | |||
<div class="flex justify-center items-center"> | |||
<vxe-input | |||
v-model="data.min" | |||
v-model="data.minPrice" | |||
class="flex-1" | |||
type="float" | |||
:min="0" | |||
@@ -23,7 +31,7 @@ | |||
/> | |||
<span>——</span> | |||
<vxe-input | |||
v-model="data.max" | |||
v-model="data.maxPrice" | |||
class="flex-1" | |||
type="float" | |||
:min="0" | |||
@@ -37,7 +45,7 @@ | |||
<template #footer> | |||
<div class="flex justify-center"> | |||
<vxe-button>取 消</vxe-button> | |||
<vxe-button status="primary">确 认</vxe-button> | |||
<vxe-button status="primary" @click="onSubmit" :loading="isLoading">确 认</vxe-button> | |||
</div> | |||
</template> | |||
</vxe-modal> | |||
@@ -48,6 +56,12 @@ import { modalConfigMap } from "@/config/vxeModal"; | |||
import { requireReg } from "@/regular"; | |||
import { getTreeHospDept } from "@/api/index"; | |||
import { getAllHospital } from "@/api/dictManage/hosp"; | |||
import { diseasePageList } from "@/api/dictManage/disease"; | |||
import { | |||
getTherapeuticApi, | |||
addTherapeuticApi, | |||
editTherapeuticApi, | |||
} from "@/api/dictManage/therapeutic"; | |||
import { to } from "await-to-js"; | |||
export default { | |||
name: "AddTherapeuticDialog", | |||
@@ -59,9 +73,12 @@ export default { | |||
type: Boolean, | |||
default: false, | |||
}, | |||
initFormData: { | |||
type: Object, | |||
default: () => ({}), | |||
id: { | |||
default: () => null, | |||
}, | |||
getTableList: { | |||
type: Function, | |||
default: () => {}, | |||
}, | |||
}, | |||
computed: { | |||
@@ -74,15 +91,15 @@ export default { | |||
}, | |||
}, | |||
showTitle: function () { | |||
return this.formData.id ? "编辑治疗方案" : "新增治疗方案"; | |||
return this.id ? "编辑治疗方案" : "新增治疗方案"; | |||
}, | |||
}, | |||
data() { | |||
const priceValidator = ({ data }) => { | |||
if (!data.min || !data.max) { | |||
if (!data.minPrice || !data.maxPrice) { | |||
return new Error("请输入价格范围"); | |||
} | |||
if (data.min > data.max) { | |||
if (data.minPrice > data.maxPrice) { | |||
return new Error("请输入正确的价格范围"); | |||
} | |||
}; | |||
@@ -124,17 +141,23 @@ export default { | |||
}, | |||
}, | |||
{ | |||
field: "a1", | |||
field: "medicalLabelId", | |||
title: "疾病诊断", | |||
itemRender: { | |||
name: "VxeSelect", | |||
props: { | |||
placeholder: "请选择", | |||
filterable: true, | |||
}, | |||
options: [], | |||
optionProps: { | |||
value: "id", | |||
label: "name", | |||
}, | |||
}, | |||
}, | |||
{ | |||
field: "a2", | |||
field: "name", | |||
title: "治疗方案", | |||
itemRender: { | |||
name: "VxeInput", | |||
@@ -144,7 +167,7 @@ export default { | |||
}, | |||
}, | |||
{ | |||
field: "min", | |||
field: "minPrice", | |||
title: "价格区间", | |||
titleAsterisk: true, | |||
slots: { | |||
@@ -156,9 +179,9 @@ export default { | |||
formRules: { | |||
wardId: [requireReg("请选择所属院区")], | |||
deptId: [requireReg("请选择所属科室")], | |||
a1: [requireReg("请选择疾病诊断")], | |||
a2: [requireReg("请输入治疗方案")], | |||
min: [ | |||
medicalLabelId: [requireReg("请选择疾病诊断")], | |||
name: [requireReg("请输入治疗方案")], | |||
minPrice: [ | |||
requireReg("请输入价格范围"), | |||
{ | |||
validator: priceValidator, | |||
@@ -166,20 +189,50 @@ export default { | |||
], | |||
}, | |||
formData: { | |||
id: undefined, | |||
wardId: null, | |||
deptId: null, | |||
a1: null, | |||
a2: null, | |||
min: null, | |||
max: null, | |||
medicalLabelId: null, | |||
name: null, | |||
minPrice: null, | |||
maxPrice: null, | |||
}, | |||
deptOptions: [], | |||
isLoading: false, | |||
loadingDetail: false, | |||
}; | |||
}, | |||
methods: { | |||
init() { | |||
async init() { | |||
await this.getDetail(); | |||
this.getWardOptions(); | |||
this.getDeptOptions(); | |||
this.getDiseaseOptions(); | |||
}, | |||
// 获取详情 | |||
async getDetail() { | |||
console.log("this.editId=", this.id); | |||
if (this.id) { | |||
this.loadingDetail = true; | |||
const [err, res] = await to(getTherapeuticApi(this.id)); | |||
setTimeout(() => { | |||
this.loadingDetail = false; | |||
}, 500); | |||
if (err) { | |||
return; | |||
} | |||
const { id, wardId, deptId, medicalLabelId, name, minPrice, maxPrice } = res?.data || {}; | |||
this.formData = { | |||
id, | |||
wardId, | |||
deptId, | |||
medicalLabelId, | |||
name, | |||
minPrice, | |||
maxPrice, | |||
}; | |||
} | |||
}, | |||
// 获取院区下拉选项 | |||
async getWardOptions() { | |||
@@ -193,16 +246,20 @@ export default { | |||
} | |||
formItem[0].itemRender.options = res.data; | |||
}, | |||
// 切换院区 | |||
onChangeWard({ data }) { | |||
console.log("切换院区"); | |||
data.deptId = null; | |||
this.deptOptions = []; | |||
this.getDeptOptions(data.wardId); | |||
data.medicalLabelId = null; | |||
this.getDeptOptions(); | |||
this.getDiseaseOptions(); | |||
}, | |||
// 获取科室下拉选项 | |||
async getDeptOptions(wardId) { | |||
async getDeptOptions() { | |||
const { wardId } = this.formData; | |||
const [err, res] = await to( | |||
getTreeHospDept({ | |||
wardId: wardId || undefined, | |||
wardId, | |||
}) | |||
); | |||
console.log("err=", err); | |||
@@ -212,15 +269,70 @@ export default { | |||
} | |||
this.deptOptions = res.data || []; | |||
}, | |||
// 切换科室 | |||
onChangeDept(data) { | |||
console.log("切换科室"); | |||
// 切换科室 | |||
data.medicalLabelId = null; | |||
this.getDiseaseOptions(); | |||
}, | |||
// 获取疾病选项 | |||
async getDiseaseOptions() { | |||
const { wardId, deptId } = this.formData; | |||
const [err, res] = await to( | |||
diseasePageList({ | |||
pageNum: 1, | |||
pageSize: 100, | |||
wardId, | |||
deptId, | |||
}) | |||
); | |||
await this.$nextTick(); | |||
const formItem = this.$refs.formRef.getItems(); | |||
console.log("formItem=", formItem); | |||
if (err) { | |||
formItem[2].itemRender.options = []; | |||
return; | |||
} | |||
formItem[2].itemRender.options = res.data?.list; | |||
}, | |||
// 提交 | |||
async onSubmit() { | |||
await this.$nextTick(); | |||
const isNoPass = await this.$refs.formRef.validate(); | |||
if (isNoPass) { | |||
return; | |||
} | |||
this.isLoading = true; | |||
const { id, wardId, deptId, medicalLabelId, name, minPrice, maxPrice } = this.formData; | |||
const params = { | |||
id, | |||
wardId, | |||
deptId, | |||
medicalLabelId, | |||
name, | |||
minPrice, | |||
maxPrice, | |||
}; | |||
if (this.formData.id) { | |||
const [err, res] = await to(editTherapeuticApi(params)); | |||
this.isLoading = false; | |||
if (err) { | |||
return; | |||
} | |||
} else { | |||
const [err, res] = await to(addTherapeuticApi(params)); | |||
this.isLoading = false; | |||
if (err) { | |||
return; | |||
} | |||
} | |||
this.show = false; | |||
this.$message.success("操作成功"); | |||
this.getTableList(); | |||
}, | |||
}, | |||
created() { | |||
this.formData = { | |||
...this.formData, | |||
...this.initFormData, | |||
}; | |||
console.log("this.formData=", this.formData); | |||
}, | |||
mounted() { | |||
this.init(); | |||
}, | |||
}; | |||
@@ -30,7 +30,7 @@ | |||
批量导入数据 | |||
</vxe-button> | |||
</el-upload> | |||
<a download="批量导入治疗方案模版.xlsx"> | |||
<a :href="exportTemplateUrl" download="批量导入治疗方案模版.xlsx"> | |||
<vxe-button status="success" icon="vxe-icon-download" class="mr-10"> | |||
下载数据模板 | |||
</vxe-button> | |||
@@ -42,7 +42,9 @@ | |||
clearable | |||
class="w-240" | |||
:options="deptOptions" | |||
:props="{ emitPath: false }" | |||
:props="{ emitPath: false, checkStrictly: true }" | |||
placeholder="全部" | |||
@change="() => onChangeDept(data)" | |||
></tree-dept> | |||
</template> | |||
<template #op_t_d="{ row }"> | |||
@@ -50,7 +52,12 @@ | |||
<vxe-button type="text" status="danger" @click="onDelete(row)">删除</vxe-button> | |||
</template> | |||
</vxe-grid> | |||
<add-therapeutic-dialog v-if="visible" :visible.sync="visible" /> | |||
<add-therapeutic-dialog | |||
v-if="visible" | |||
:visible.sync="visible" | |||
:id="editId" | |||
:getTableList="getTableList" | |||
/> | |||
</div> | |||
</template> | |||
<script> | |||
@@ -59,6 +66,12 @@ import { commonGridConfig2 } from "@/config/vxeGrid"; | |||
import { getAllHospital } from "@/api/dictManage/hosp"; | |||
import TreeDept from "@/components/TreeDept"; | |||
import { getTreeHospDept } from "@/api/index"; | |||
import { | |||
getTherapeuticListApi, | |||
delTherapeuticApi, | |||
batchDelTherapeuticApi, | |||
} from "@/api/dictManage/therapeutic"; | |||
import { diseasePageList } from "@/api/dictManage/disease"; | |||
import { to } from "await-to-js"; | |||
export default { | |||
name: "TherapeuticRegimen", | |||
@@ -68,6 +81,7 @@ export default { | |||
}, | |||
data() { | |||
return { | |||
exportTemplateUrl: process.env.VUE_APP_BASE_PATH + "template/therapeuticTemplate.xlsx", | |||
gridConfig: { | |||
...commonGridConfig2, | |||
keepSource: true, | |||
@@ -85,7 +99,7 @@ export default { | |||
itemRender: { | |||
name: "VxeSelect", | |||
props: { | |||
placeholder: "请选择院区", | |||
placeholder: "全部", | |||
className: "w-240", | |||
clearable: true, | |||
filterable: true, | |||
@@ -101,7 +115,7 @@ export default { | |||
}, | |||
}, | |||
{ | |||
field: "b", | |||
field: "deptId", | |||
title: "科室", | |||
itemRender: {}, | |||
slots: { | |||
@@ -109,18 +123,25 @@ export default { | |||
}, | |||
}, | |||
{ | |||
field: "c", | |||
field: "medicalLabelId", | |||
title: "疾病诊断", | |||
itemRender: { | |||
name: "VxeInput", | |||
name: "VxeSelect", | |||
props: { | |||
placeholder: "请输入疾病诊断", | |||
placeholder: "全部", | |||
className: "w-240", | |||
clearable: true, | |||
filterable: true, | |||
}, | |||
options: [], | |||
optionProps: { | |||
value: "id", | |||
label: "name", | |||
}, | |||
}, | |||
}, | |||
{ | |||
field: "d", | |||
field: "name", | |||
title: "治疗方案", | |||
itemRender: { | |||
name: "VxeInput", | |||
@@ -152,32 +173,37 @@ export default { | |||
minWidth: 100, | |||
}, | |||
{ | |||
field: "a", | |||
field: "medicalLabelName", | |||
title: "疾病诊断", | |||
minWidth: 200, | |||
}, | |||
{ | |||
field: "b", | |||
field: "name", | |||
title: "治疗方案名称", | |||
minWidth: 200, | |||
}, | |||
{ | |||
field: "c", | |||
title: "价格", | |||
field: "minPrice", | |||
title: "最低价格", | |||
minWidth: 200, | |||
}, | |||
{ | |||
field: "maxPrice", | |||
title: "最高价格", | |||
minWidth: 200, | |||
}, | |||
{ | |||
field: "d", | |||
field: "wardName", | |||
title: "院区", | |||
minWidth: 200, | |||
}, | |||
{ | |||
field: "e", | |||
field: "level1DeptName", | |||
title: "一级科室", | |||
minWidth: 200, | |||
}, | |||
{ | |||
field: "f", | |||
field: "level2DeptName", | |||
title: "二级科室", | |||
minWidth: 200, | |||
}, | |||
@@ -213,14 +239,12 @@ export default { | |||
const { currentPage: pageNum, pageSize } = page; | |||
console.log("pageNum=", pageNum); | |||
console.log("pageSize=", pageSize); | |||
return { | |||
data: { | |||
list: [{ a: "111" }], | |||
page: { | |||
total: 10, | |||
}, | |||
}, | |||
const params = { | |||
pageNum, | |||
pageSize, | |||
...form, | |||
}; | |||
return getTherapeuticListApi(params); | |||
}, | |||
}, | |||
}, | |||
@@ -232,12 +256,14 @@ export default { | |||
}, | |||
deptOptions: [], | |||
visible: false, | |||
editId: null, | |||
}; | |||
}, | |||
methods: { | |||
init() { | |||
this.getWardOptions(); | |||
this.getDeptOptions(); | |||
this.getDiseaseOptions(); | |||
}, | |||
// 获取院区下拉选项 | |||
async getWardOptions() { | |||
@@ -254,14 +280,19 @@ export default { | |||
// 院区改变 | |||
onChangeWard({ data }) { | |||
data.deptId = null; | |||
this.deptOptions = []; | |||
this.getDeptOptions(data.wardId); | |||
data.medicalLabelId = null; | |||
const { wardId } = data; | |||
const params = { | |||
wardId, | |||
}; | |||
this.getDeptOptions(params); | |||
this.getDiseaseOptions(params); | |||
}, | |||
// 获取科室选项 | |||
async getDeptOptions(wardId) { | |||
async getDeptOptions(params = {}) { | |||
const [err, res] = await to( | |||
getTreeHospDept({ | |||
wardId: wardId || undefined, | |||
...params, | |||
}) | |||
); | |||
console.log("err=", err); | |||
@@ -271,19 +302,44 @@ export default { | |||
} | |||
this.deptOptions = res.data || []; | |||
}, | |||
onChangeDept(formData) { | |||
formData.medicalLabelId = null; | |||
console.log("deptId=", deptId); | |||
const { wardId, deptId } = formData; | |||
const params = { wardId, deptId }; | |||
this.getDiseaseOptions(params); | |||
}, | |||
// 获取疾病选项 | |||
async getDiseaseOptions(params = {}) { | |||
const [err, res] = await to( | |||
diseasePageList({ | |||
pageNum: 1, | |||
pageSize: 100, | |||
...params, | |||
}) | |||
); | |||
await this.$nextTick(); | |||
const formItem = this.$refs.gridRef.getFormItems(2); | |||
if (err) { | |||
formItem.itemRender.options = []; | |||
return; | |||
} | |||
formItem.itemRender.options = res.data?.list; | |||
}, | |||
getTableList() { | |||
this.$nextTick(() => { | |||
this.$refs.gridRef.commitProxy("query"); | |||
}); | |||
}, | |||
onAdd() { | |||
this.editId = null; | |||
this.visible = true; | |||
}, | |||
// 编辑 | |||
onEdit(row) { | |||
// const { id, deptId, name } = row; | |||
// this.initFormData = { id, deptId, name }; | |||
this.initFormData = { ...row }; | |||
console.log("row=", row); | |||
const { id } = row; | |||
this.editId = id; | |||
this.visible = true; | |||
}, | |||
// 删除 | |||
@@ -291,18 +347,13 @@ export default { | |||
this.$modal | |||
.confirm("是否确认删除?") | |||
.then(async () => { | |||
const [err, _] = await to( | |||
deleteComplexApi({ | |||
id: row.id, | |||
}) | |||
); | |||
console.log("row.id", row.id); | |||
const [err, _] = await to(delTherapeuticApi(row.id)); | |||
this.getTableList(); | |||
if (err) { | |||
this.$message.success("操作失败"); | |||
this.getTableList(); | |||
return; | |||
} | |||
this.$message.success("操作成功"); | |||
this.getTableList(); | |||
}) | |||
.catch(() => {}); | |||
}, | |||
@@ -312,13 +363,13 @@ export default { | |||
await this.$nextTick(); | |||
const checkedData = this.$refs.gridRef.getCheckboxRecords(true); | |||
console.log("checkedData=", checkedData); | |||
// const labelIdList = checkedData.map((item) => item.id); | |||
// const [err, res] = await to(batchDeleteOperatorApi({ labelIdList })); | |||
// if (err) { | |||
// return; | |||
// } | |||
// this.$message.success("操作成功"); | |||
// this.getTableList(); | |||
const ids = checkedData.map((item) => item.id); | |||
const [err, _] = await to(batchDelTherapeuticApi(ids)); | |||
this.getTableList(); | |||
if (err) { | |||
return; | |||
} | |||
this.$message.success("操作成功"); | |||
}); | |||
}, | |||
}, | |||