Commit aa1953ff by wangshuangqing

病情变异接口

parent f69307aa
......@@ -2,7 +2,7 @@
* @Author: wsq
* @Date: 2022-04-22 15:20:58
* @LastEditors: wsq
* @LastEditTime: 2023-01-10 17:53:58
* @LastEditTime: 2023-01-11 15:25:24
* @Description:
-->
<template>
......@@ -30,11 +30,52 @@
</div>
<!-- 右侧按钮 -->
<div class="outClinicalpathway_top_right">
<el-button type="primary">加入医嘱</el-button>
<el-button type="primary">病情变异</el-button>
<el-button type="primary" @click="joinorder()">加入医嘱</el-button>
<el-button type="primary" @click="variation()">病情变异</el-button>
</div>
</div>
<!--病情变异弹框开始 -->
<el-dialog :visible.sync="editdialogFormVisible" width="30%" @close="close">
<el-form
ref="fromRef"
:model="form"
:label-position="labelPosition"
label-width="100px"
>
<el-form-item label="路径天数:">
<!-- <el-input v-model="form.inhosdays" /> -->
<el-select
v-model="form.inhosdays"
class="m-2"
placeholder="请选择"
size="mini"
>
<el-option
v-for="item in options"
:key="item.inhosdays"
:label="item.inhosdays"
:value="item.inhosdays"
/>
</el-select>
</el-form-item>
<el-form-item label="变异原因:">
<el-input
v-model="form.reason"
:autosize="{ minRows: 4, maxRows: 10 }"
type="textarea"
/>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button size="mini" @click="close()">取消</el-button>
<el-button size="mini" type="primary" @click="fromOKbtn()"
>确定
</el-button>
</span>
</template>
</el-dialog>
<!--病情变异弹框结束 -->
<!-- 表格 -->
<div class="outClinicalpathway_table">
<!-- 时间线 -->
......@@ -49,24 +90,35 @@
:hollow="activity.hollow"
:timestamp="activity.timestamp"
>
<span :class="timeindex==index?'outClinicalpathway_table_left_timespan':'outClinicalpathway_table_left_timespan2'" @click="timeclick(activity,index)">{{ activity.inhosdays }}</span>
<span
:class="
timeindex == index
? 'outClinicalpathway_table_left_timespan'
: 'outClinicalpathway_table_left_timespan2'
"
@click="timeclick(activity, index)"
>{{ activity.inhosdays }}</span
>
</el-timeline-item>
</el-timeline>
</div>
<!-- 表格 -->
<div class="outClinicalpathway_table_right">
<el-table
ref="multipleTableRef"
ref="multipleTable"
row-key="id"
:data="tableData"
style="width: 100%; height: 100%; overflow-y: scroll"
@selection-change="handleSelectionChange"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
:select-on-indeterminate="true"
@selection-change="SelectionChange"
@select-all="selectAll"
@select="select"
default-expand-all
>
<el-table-column type="selection" width="55" />
<el-table-column label="医嘱类型" width="180">
<template #default="scope">{{yztype[scope.row.type] }}</template>
<template #default="scope">{{ yztype[scope.row.type] }}</template>
</el-table-column>
<el-table-column
show-overflow-tooltip
......@@ -110,11 +162,10 @@ export default {
setup() {
//表格自适应高度
const route = useRoute();
const fromRef = ref();
const monthlyPlanTable = ref();
const multipleTableRef = ref();
const multipleTable = ref();
let state = reactive({
//患者信息
topdata: {
patientName: "", //患者姓名
......@@ -123,16 +174,27 @@ export default {
clinical_route_name: "", // 符合临床路径
},
multipleSelection: [], //被选择的数据
tableData: [],//表格数据
yztype:{
1:'长期医嘱',
2:'短期医嘱'
selectArr: [],
tableData: [], //表格数据
yztype: {
1: "长期医嘱",
2: "短期医嘱",
},
//被点击的index
timeindex:null,
timeindex: null,
case_routeid: null, //点击左侧时间线的天数id
inhosdays: null, //点击左侧时间线的天数
//时间线
activities: [],
labelPosition: "right",
editdialogFormVisible: false, //弹框是否显示
//表单
form: {
inhosdays: "",
reason: "",
},
//路径天数下拉数据
options: [],
});
//获取患者信息
const gettopdata = () => {
......@@ -146,16 +208,92 @@ export default {
})
.catch((error) => {});
};
const setChildren = (children, type) => {
// 编辑多个子层级
children.map((j) => {
toggleSelection(j, type);
if (j.children) {
setChildren(j.children, type);
}
});
};
// 选中父节点时,子节点一起选中取消
const select = (selection, row) => {
// 选中
if (
selection.some((el) => {
return row.id === el.id;
})
) {
if (row.children) {
row.children.map((j) => {
toggleSelection(j, true);
});
}
//取消
} else {
if (row.children) {
row.children.map((j) => {
toggleSelection(j, false);
});
}
}
};
// 控制选框是否被选中
const toggleSelection = (row, select) => {
if (row) {
nextTick(() => {
multipleTable.value &&
multipleTable.value.toggleRowSelection(row, select);
});
}
};
// 选择全部
const selectAll = (selection) => {
// tabledata第一层只要有在selection里面就是全选
const isSelect = selection.some((el) => {
const tableDataIds = state.tableData.map((j) => j.id);
return tableDataIds.includes(el.id);
});
// tableDate第一层只要有不在selection里面就是全不选
const isCancel = !state.tableData.every((el) => {
const selectIds = selection.map((j) => j.id);
return selectIds.includes(el.id);
});
if (isSelect) {
selection.map((el) => {
if (el.children) {
el.children.map((j) => {
toggleSelection(j, true);
});
}
});
}
if (isCancel) {
state.tableData.map((el) => {
if (el.children) {
el.children.map((j) => {
toggleSelection(j, false);
});
}
});
}
};
//当选择项发生变化时会触发该事件
const handleSelectionChange = (val) => {
const SelectionChange = (val) => {
state.multipleSelection = val;
console.log('val',val);
};
//递归选中
const checkFun = (data, status) => {
// data.forEach((element) => {
// element.isCheck = status;
// });
};
//获取左侧时间线数据
const getlefttime = () => {
http
......@@ -165,12 +303,15 @@ export default {
)
.then((data) => {
state.activities = data;
state.options = data;
})
.catch((error) => {});
};
//点击左侧时间线 获取右侧表格数据
const timeclick = (val,index) => {
state.timeindex=index
const timeclick = (val, index) => {
state.timeindex = index;
state.case_routeid = val.case_routeid;
state.inhosdays = val.inhosdays;
http
.post(
`/ClinicalRoute/ClinicalRoute/GetGetRouteAdvicesRight?pid=${route.value.query.pid}&case_routeid=${val.case_routeid}&searchQuery=${val.inhosdays}`,
......@@ -181,6 +322,66 @@ export default {
})
.catch((error) => {});
};
//加入医嘱
const joinorder = () => {
http
.post(
`/ClinicalRoute/ClinicalRoute/SetPatientRoutes?pid=${route.value.query.pid}`,
state.selectArr
)
.then((data) => {
// 重新加载表格数据接口
http
.post(
`/ClinicalRoute/ClinicalRoute/GetGetRouteAdvicesRight?pid=${route.value.query.pid}&case_routeid=${state.case_routeid}&searchQuery=${state.inhosdays}`,
{}
)
.then((data) => {
state.tableData = data;
})
.catch((error) => {});
Message({
message: data.message,
type: "success",
});
})
.catch((error) => {});
};
//病情变异
const variation = () => {
state.editdialogFormVisible = true;
};
//确定
const fromOKbtn = () => {
let prome = {
pid: route.value.query.pid,
reason: state.form.reason,
inhosdays: state.form.inhosdays,
};
http
.post(`/ClinicalRoute/ClinicalRoute/SetVariation`, prome)
.then((data) => {
Message({
message: data.message,
type: "success",
});
(state.form = {
inhosdays: "",
reason: "",
}),
(state.editdialogFormVisible = false);
})
.catch((error) => {});
};
//取消
const close = () => {
(state.form = {
inhosdays: "",
reason: "",
}),
(state.editdialogFormVisible = false);
};
onMounted(() => {
gettopdata();
......@@ -193,12 +394,21 @@ export default {
decimal,
monthlyPlanTable,
multipleTableRef,
handleSelectionChange,
checkFun,
multipleTable,
SelectionChange,
gettopdata,
getlefttime,
timeclick,
setChildren,
select,
toggleSelection,
selectAll,
variation,
fromOKbtn,
fromRef,
close,
joinorder,
};
},
};
......@@ -366,19 +576,17 @@ export default {
margin-right: 5px;
background-color: #ffff;
padding-top: 10px;
&_timespan{
&_timespan {
width: 80%;
height:20px;
height: 20px;
display: flex;
background-color: #f2fafd;
color: #5dbee9;
}
&_timespan2{
&_timespan2 {
width: 80%;
height:20px;
height: 20px;
display: flex;
}
}
&_right {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment