版本更新
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
|
||||
// ====== 文书记录
|
||||
// 新增记录
|
||||
export function addRecord(data) {
|
||||
return request({
|
||||
@@ -22,3 +23,38 @@ export function getRecordByEncounterIdList(params) {
|
||||
params
|
||||
})
|
||||
}
|
||||
// 初始化文书定义
|
||||
export function init() {
|
||||
return request({
|
||||
url: '/document/record/init',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// ====== 文书模板
|
||||
// 新增模板
|
||||
export function addTemplate(data) {
|
||||
return request({
|
||||
url: '/document/template/add',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
//
|
||||
export function getListByDefinitionId(definitionId) {
|
||||
return request({
|
||||
url: '/document/template/getListByDefinitionId',
|
||||
method: 'get',
|
||||
params: {definitionId}
|
||||
})
|
||||
}
|
||||
// 更新模板
|
||||
export function updateTemplate(data) {
|
||||
return request({
|
||||
url: '/document/template/update',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div v-for="item in historyData" :key="item.id" class="scrollbar-item">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="`${item.definitionId}(${item.recordTime})`"
|
||||
:content="`${item.name}(${item.recordTime})`"
|
||||
placement="bottom"
|
||||
>
|
||||
<el-text class="w-150px mb-2" truncated @click="handleNodeClick(item)">
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<template>
|
||||
<div class="emr-template-container">
|
||||
<!-- <div class="search-box">
|
||||
<el-input placeholder="病历名称搜索..." v-model="queryParams.searchKey">
|
||||
<template #append>
|
||||
<el-button @click="queryList">查询</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div> -->
|
||||
<el-scrollbar class="emr-template-scrollbar-container" style="width: 100%">
|
||||
<div v-for="item in templateData" :key="item.id" class="scrollbar-item">
|
||||
<el-tooltip
|
||||
effect="dark"
|
||||
:content="`${item.name}`"
|
||||
placement="bottom"
|
||||
>
|
||||
<el-text class="2" truncated @click="handleNodeClick(item)">
|
||||
<div class="template-item">{{ item.name }}
|
||||
<el-space>
|
||||
<el-icon><Edit @click="handleEdit(item)" /></el-icon>
|
||||
</el-space></div>
|
||||
|
||||
</el-text>
|
||||
</el-tooltip>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, defineEmits, unref } from 'vue';
|
||||
import { getListByDefinitionId } from '../api';
|
||||
import { ElTree } from 'element-plus';
|
||||
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus';
|
||||
import { patientInfo } from '../../store/patient.js';
|
||||
const emits = defineEmits(['templateClick','edit']);
|
||||
const props = defineProps({
|
||||
definitionId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
const definitionId = defineModel('definitionId', {
|
||||
type: String,
|
||||
default: '',
|
||||
});
|
||||
const defaultProps = {
|
||||
children: 'children',
|
||||
label: 'name',
|
||||
};
|
||||
const queryParams = ref({
|
||||
searchKey: '',
|
||||
isPage: 0,
|
||||
});
|
||||
const templateData = ref([]);
|
||||
const queryList = async () => {
|
||||
try {
|
||||
if ( unref(definitionId)&&unref(definitionId) !== '') {
|
||||
const res = await getListByDefinitionId(unref(definitionId));
|
||||
templateData.value = res.data || [];
|
||||
}else{
|
||||
templateData.value = [];
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
ElMessage.error('获取模板失败');
|
||||
templateData.value = [];
|
||||
}
|
||||
};
|
||||
const handleNodeClick = (data) => {
|
||||
emits('templateClick', data);
|
||||
};
|
||||
const handleEdit = (data) => {
|
||||
emits('edit', data);
|
||||
};
|
||||
const currentSelectTemplate = ref({});
|
||||
defineExpose({ queryList });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.emr-template-container {
|
||||
height: 100%;
|
||||
// padding: 8px;
|
||||
|
||||
.emr-template-scrollbar-container{
|
||||
padding: 8px;
|
||||
height: 100%;
|
||||
.scrollbar-item {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
background: var(--el-color-primary-light-9);
|
||||
& + .scrollbar-item {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.el-text{
|
||||
width: calc(100% - 0px);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.template-item{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<!-- 病历文件基本信息弹窗 -->
|
||||
<el-dialog
|
||||
:title="formData.id ? '编辑模板' : '新增模板'"
|
||||
v-model="dialogVisible"
|
||||
width="900px"
|
||||
destroy-on-close
|
||||
@open="handleOpen"
|
||||
>
|
||||
<!-- 使用el-form包裹表单 -->
|
||||
<el-form :model="formData" ref="formRef" :rules="rules" label-width="120px">
|
||||
<el-row :gutter="24" class="mb8">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="模板名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入模板名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="使用范围" prop="useRange">
|
||||
<el-radio-group v-model="formData.useRange">
|
||||
<el-radio :value="0" size="large">全院</el-radio>
|
||||
<el-radio :value="1" size="large">指定机构</el-radio>
|
||||
<el-radio :value="2" size="large">指定用户</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="formData.remark" placeholder="请输入版本"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<div class="dialog-footer"></div>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="submitForm">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
import { addTemplate, updateTemplate } from '../api';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { components } from '@/template';
|
||||
const emits = defineEmits(['submitOk']);
|
||||
const props = defineProps({
|
||||
formData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const formRef = ref(null);
|
||||
|
||||
const dialogVisible = defineModel('dialogVisible', {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
});
|
||||
|
||||
// 表单数据
|
||||
const formData = ref({
|
||||
id: 0,
|
||||
name: '',
|
||||
displayOrder: 0,
|
||||
contextJson: '',
|
||||
definitionId: 0,
|
||||
useRange: 2,
|
||||
organizationId: 0,
|
||||
userId: 0,
|
||||
remark: '',
|
||||
});
|
||||
// 表单验证规则(响应式,支持动态验证)
|
||||
const rules = reactive({
|
||||
name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||
});
|
||||
const handleOpen = () => {
|
||||
if (props.formData) {
|
||||
formData.value = props.formData;
|
||||
} else {
|
||||
resetForm();
|
||||
}
|
||||
};
|
||||
|
||||
// 提交表单
|
||||
const submitForm = () => {
|
||||
formRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
// 表单验证通过,执行保存操作
|
||||
saveForm();
|
||||
} else {
|
||||
// 表单验证失败
|
||||
ElMessage.error('请填写必填项');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
// 保存表单
|
||||
const saveForm = async () => {
|
||||
try {
|
||||
// 如果有当前节点数据,表示是编辑操作
|
||||
if (formData.value.id && formData.value.id !== '') {
|
||||
const res = await updateTemplate(formData.value);
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('更新成功');
|
||||
emits('submitOk');
|
||||
} else {
|
||||
ElMessage.error('更新失败', error);
|
||||
}
|
||||
} else {
|
||||
// 新建操作
|
||||
const res = await addTemplate(formData.value);
|
||||
if (res.code == 200) {
|
||||
ElMessage.success('保存成功');
|
||||
emits('submitOk');
|
||||
} else {
|
||||
ElMessage.error('保存失败', error);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
// ElMessage.error('保存失败',error);
|
||||
}
|
||||
};
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
formRef.value?.resetFields();
|
||||
};
|
||||
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -28,10 +28,9 @@
|
||||
<div class="operate-container">
|
||||
<div class="operate-btns">
|
||||
<el-space>
|
||||
<el-button type="primary" @click="newEmr">新建</el-button>
|
||||
<!-- <el-button type="primary" @click="newEmr">新建</el-button> -->
|
||||
<el-button type="primary" @click="saveAsModel">存为模版</el-button>
|
||||
<el-button @click="refresh">刷新</el-button>
|
||||
<el-button type="danger" @click="deleteEmr">删除</el-button>
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
</el-space>
|
||||
</div>
|
||||
@@ -44,18 +43,35 @@
|
||||
<div class="quickly-container">
|
||||
<el-tabs v-model="quicklyactiveName" type="card">
|
||||
<el-tab-pane label="历史" name="history">
|
||||
<History @historyClick="handleHistoryClick" ref="historyRef" v-model:definitionId="currentSelectTemplate.id" />
|
||||
<History
|
||||
@historyClick="handleHistoryClick"
|
||||
ref="historyRef"
|
||||
v-model:definitionId="currentSelectTemplate.id"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="模版" name="model">
|
||||
<Template
|
||||
@templateClick="handleTemplateClick"
|
||||
ref="templateRef"
|
||||
v-model:definitionId="currentSelectTemplate.id"
|
||||
@edit="templateEdit"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="模版" name="model">模版</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<TemplateEdit
|
||||
ref="templateEditRef"
|
||||
:formData="editTemplateForm"
|
||||
v-model:dialogVisible="templateEditVisible"
|
||||
@submitOk="templateEditSubmitOk"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { getCurrentInstance, onBeforeMount, onMounted, reactive, ref } from 'vue';
|
||||
import { ElMessageBox, ElMessage, ElLoading } from 'element-plus';
|
||||
import { getTreeList } from '@/views/basicmanage/caseTemplates/api';
|
||||
import { addRecord } from './api';
|
||||
import { addRecord, addTemplate } from './api';
|
||||
import { patientInfo } from '../store/patient.js';
|
||||
import dayjs from 'dayjs';
|
||||
// 移除未使用的变量
|
||||
@@ -64,13 +80,15 @@ const emits = defineEmits([]);
|
||||
const props = defineProps({});
|
||||
const state = reactive({});
|
||||
import History from './components/history';
|
||||
import Template from './components/template';
|
||||
import TemplateEdit from './components/templateEdit.vue';
|
||||
// 定义响应式变量
|
||||
const templateData = ref([]);
|
||||
const queryParams = ref({
|
||||
name: '',
|
||||
});
|
||||
const currentSelectTemplate = ref({
|
||||
id:''
|
||||
id: '',
|
||||
});
|
||||
const currentComponent = ref('');
|
||||
const emrComponentRef = ref(null);
|
||||
@@ -99,14 +117,16 @@ const handleNodeClick = (data, node) => {
|
||||
if (node.isLeaf) {
|
||||
// 存储当前节点数据
|
||||
currentSelectTemplate.value = data.document;
|
||||
currentComponent.value = currentSelectTemplate.value.vueRouter || '';
|
||||
// currentComponent.value = data.document.vueRouter || '';
|
||||
} else {
|
||||
currentSelectTemplate.value = {
|
||||
id:''
|
||||
id: '',
|
||||
};
|
||||
// currentComponent.value = null;
|
||||
}
|
||||
historyRef.value?.queryList();
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
};
|
||||
|
||||
const newEmr = () => {
|
||||
@@ -119,52 +139,76 @@ const newEmr = () => {
|
||||
|
||||
const saveAsModel = async () => {
|
||||
try {
|
||||
currentOperate.value = 'addTemplate';
|
||||
await emrComponentRef.value?.submit();
|
||||
ElMessage.success('成功!');
|
||||
} catch (error) {
|
||||
ElMessage.error('存为模版失败');
|
||||
}
|
||||
};
|
||||
const editForm = ref({
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1, // 0草稿/暂存 1提交 2归档 3修改
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId:'',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
id: '',
|
||||
definitionId: '',
|
||||
definitionBusNo: '',
|
||||
contentJson: '',
|
||||
statusEnum: 1, // 0草稿/暂存 1提交 2归档 3修改
|
||||
organizationId: 0,
|
||||
encounterId: '',
|
||||
patientId: '',
|
||||
recordTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
||||
createBy: '',
|
||||
source: '',
|
||||
});
|
||||
const editTemplateForm = ref({
|
||||
id: '',
|
||||
name: '',
|
||||
displayOrder: 0,
|
||||
contextJson: '',
|
||||
definitionId: '',
|
||||
useRange: 2,
|
||||
organizationId: '',
|
||||
userId: '',
|
||||
remark: '',
|
||||
});
|
||||
const handleSubmitOk = async (data) => {
|
||||
try {
|
||||
// debugger;
|
||||
|
||||
if (!patientInfo.value?.encounterId || !patientInfo.value?.patientId) {
|
||||
ElMessage.error('请先选择患者!');
|
||||
return;
|
||||
const currentOperate = ref('add');
|
||||
const handleSubmitOk = async (data) => {
|
||||
if (currentOperate.value === 'add') {
|
||||
//
|
||||
try {
|
||||
// debugger;
|
||||
if (!patientInfo.value?.encounterId || !patientInfo.value?.patientId) {
|
||||
ElMessage.error('请先选择患者!');
|
||||
return;
|
||||
}
|
||||
editForm.value.definitionId = currentSelectTemplate.value.id;
|
||||
editForm.value.definitionBusNo = currentSelectTemplate.value.busNo;
|
||||
editForm.value.contentJson = JSON.stringify(data);
|
||||
editForm.value.encounterId = patientInfo.value.encounterId;
|
||||
editForm.value.patientId = patientInfo.value.patientId;
|
||||
editForm.value.recordTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
await addRecord(editForm.value);
|
||||
ElMessage.success('病历保存成功');
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
} catch (error) {
|
||||
ElMessage.error('提交失败');
|
||||
console.log(error);
|
||||
}
|
||||
editForm.value.definitionId = currentSelectTemplate.value.id;
|
||||
editForm.value.definitionBusNo = currentSelectTemplate.value.busNo;
|
||||
editForm.value.contentJson = JSON.stringify(data);
|
||||
editForm.value.encounterId = patientInfo.value.encounterId;
|
||||
editForm.value.patientId = patientInfo.value.patientId;
|
||||
editForm.value.recordTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
await addRecord(editForm.value);
|
||||
ElMessage.success('提交成功');
|
||||
historyRef.value?.queryList();
|
||||
} catch (error) {
|
||||
ElMessage.error('提交失败');
|
||||
console.log(error);
|
||||
} else if (currentOperate.value === 'addTemplate') {
|
||||
// 新增或者编辑模板
|
||||
// editTemplateForm.value.id=
|
||||
editTemplateForm.value.name =
|
||||
currentSelectTemplate.value.name + dayjs().format('YYYY/MM/DD HH:mm');
|
||||
editTemplateForm.value.contextJson = JSON.stringify(data);
|
||||
editTemplateForm.value.definitionId = currentSelectTemplate.value.id;
|
||||
templateEditVisible.value = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const refresh = () => {
|
||||
queryTemplateTree();
|
||||
historyRef.value?.queryList();
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
};
|
||||
|
||||
const deleteEmr = async () => {
|
||||
@@ -177,25 +221,42 @@ const deleteEmr = async () => {
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
// try {
|
||||
await emrComponentRef.value?.submit();
|
||||
// } catch (error) {
|
||||
// ElMessage.error('保存失败');
|
||||
// }
|
||||
try {
|
||||
currentOperate.value = 'add';
|
||||
await emrComponentRef.value?.submit();
|
||||
} catch (error) {
|
||||
ElMessage.error('保存失败');
|
||||
}
|
||||
};
|
||||
|
||||
const historyRef = ref(null);
|
||||
const handleHistoryClick= (data) => {
|
||||
console.log(data);
|
||||
const handleHistoryClick = (data) => {
|
||||
newEmr();
|
||||
editForm.value= data;
|
||||
editForm.value = data;
|
||||
nextTick(() => {
|
||||
emrComponentRef.value?.setFormData(JSON.parse(editForm.value.contentJson));
|
||||
|
||||
})
|
||||
emrComponentRef.value?.setFormData(JSON.parse(editForm.value.contentJson));
|
||||
});
|
||||
};
|
||||
const templateRef = ref(null);
|
||||
|
||||
}
|
||||
// 移除空的生命周期钩子
|
||||
const handleTemplateClick = (data) => {
|
||||
newEmr();
|
||||
editForm.value = data;
|
||||
nextTick(() => {
|
||||
emrComponentRef.value?.setFormData(JSON.parse(editForm.value.contextJson));
|
||||
});
|
||||
};
|
||||
const templateEdit = (data) => {
|
||||
editTemplateForm.value = data;
|
||||
templateEditVisible.value = true;
|
||||
};
|
||||
// ====dialog
|
||||
const templateEditVisible = ref(false);
|
||||
const templateEditSubmitOk = () => {
|
||||
templateEditVisible.value = false;
|
||||
historyRef.value?.queryList();
|
||||
templateRef.value?.queryList();
|
||||
};
|
||||
// onBeforeMount(() => {});
|
||||
onMounted(() => {
|
||||
queryTemplateTree();
|
||||
@@ -257,7 +318,7 @@ defineExpose({ state });
|
||||
width: 300px;
|
||||
padding: 0 8px 8px 8px;
|
||||
flex: none;
|
||||
.el-tabs{
|
||||
.el-tabs {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user