|
@@ -17,6 +17,10 @@
|
|
|
@node-click="handleNodeClick"
|
|
|
node-key="_id"
|
|
|
ref="treeRef"
|
|
|
+ draggable
|
|
|
+ @node-drag-end="dragEnd"
|
|
|
+ :allow-drag="allowDrag"
|
|
|
+ :allow-drop="dragLimit"
|
|
|
@node-contextmenu="contextmenuItem"
|
|
|
highlight-current
|
|
|
:filter-node-method="filterNode"
|
|
@@ -38,15 +42,18 @@
|
|
|
|
|
|
<script setup name='EmrSidebar'>
|
|
|
import {
|
|
|
+ electronicMedicalRecordSequencing,
|
|
|
getEmrTree,
|
|
|
getPatientDataTree,
|
|
|
- queryWhetherThePatientHasASpecifiedMedicalRecord, whetherItExistsInTheDepartment
|
|
|
+ queryWhetherThePatientHasASpecifiedMedicalRecord,
|
|
|
+ whetherItExistsInTheDepartment
|
|
|
} from "@/api/zhu-yuan-yi-sheng/emr-patient";
|
|
|
import {BizException, ExceptionEnum} from "@/utils/BizException";
|
|
|
import {
|
|
|
canIUnlockIt,
|
|
|
emrConfig,
|
|
|
- emrMitt, unlockEnum
|
|
|
+ emrMitt,
|
|
|
+ unlockEnum
|
|
|
} from '@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init'
|
|
|
import {stringIsBlank} from "@/utils/blank-utils";
|
|
|
import {getAllWards} from "@/api/zhu-yuan-yi-sheng/resident-doctor";
|
|
@@ -54,7 +61,7 @@ import RightClickMenu from "@/components/menu-item/RightClickMenu.vue";
|
|
|
import {xcMessage} from "@/utils/xiaochan-element-plus";
|
|
|
import store from "@/store";
|
|
|
import {ElIcon} from "element-plus";
|
|
|
-import {Folder, Document} from "@element-plus/icons-vue";
|
|
|
+import {Folder, Document, Open, Sort} from "@element-plus/icons-vue";
|
|
|
|
|
|
const props = defineProps({
|
|
|
maxHeight: {
|
|
@@ -226,14 +233,10 @@ const deleteTheSpecifiedNode = (id) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-let courseRecord = true
|
|
|
let findNode = false
|
|
|
const diseaseDurationRecordTime = (id, list) => {
|
|
|
- if (courseRecord) {
|
|
|
- findNode = false;
|
|
|
- findMedicalRecordById(id, list, returnData.patientTree)
|
|
|
- courseRecord = false
|
|
|
- }
|
|
|
+ findNode = false;
|
|
|
+ findMedicalRecordById(id, list, returnData.patientTree);
|
|
|
}
|
|
|
|
|
|
const findMedicalRecordById = (id, roundTimes, list) => {
|
|
@@ -250,18 +253,16 @@ const findMedicalRecordById = (id, roundTimes, list) => {
|
|
|
if (item.children) {
|
|
|
findMedicalRecordById(id, roundTimes, item.children)
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
const queryData = () => {
|
|
|
getPatientDataTree(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes).then((res) => {
|
|
|
if (res?.length > 0) {
|
|
|
- courseRecord = true
|
|
|
templateType = 2
|
|
|
emit('patientMedicalRecord')
|
|
|
}
|
|
|
- console.log(res)
|
|
|
returnData.patientTree = res
|
|
|
})
|
|
|
}
|
|
@@ -281,13 +282,35 @@ const nullToEmpty = (val) => {
|
|
|
const mousePosition = ref()
|
|
|
const opt = [
|
|
|
{
|
|
|
- name: '打开已保存的病历', click: (data) => {
|
|
|
+ name: '打开', click: (data) => {
|
|
|
if (!data.unlock.id) {
|
|
|
xcMessage.error('请选中保存的病历。')
|
|
|
return
|
|
|
}
|
|
|
emit('openAndSaveTheMedicalRecord', data.unlock.id)
|
|
|
- }
|
|
|
+ },
|
|
|
+ icon: h(ElIcon, {}, () => h(Open))
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: '确认排序', click: (data) => {
|
|
|
+ let temp = []
|
|
|
+ drag.forEach((value, key) => {
|
|
|
+ if (value.newParent !== value.oldParent) {
|
|
|
+ temp.push({id: key, parent: value.newParent})
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (temp.length === 0) {
|
|
|
+ drag.clear()
|
|
|
+ return xcMessage.error('文件夹没有变化,无需点击。')
|
|
|
+ }
|
|
|
+ electronicMedicalRecordSequencing(temp).then(() => {
|
|
|
+ drag.clear()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ validator: () => {
|
|
|
+ return drag.size > 0
|
|
|
+ },
|
|
|
+ icon: h(ElIcon, {}, () => h(Sort))
|
|
|
}
|
|
|
]
|
|
|
const contextmenuItem = (event, data) => {
|
|
@@ -334,11 +357,39 @@ const isItAFolder = (data) => {
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+const dragLimit = (moveNode, inNode, type) => {
|
|
|
+ if (templateType !== 2) return false;
|
|
|
+ if (moveNode.data.jump) return false;
|
|
|
+ if (inNode.data._id && type === 'inner') {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const allowDrag = (node) => {
|
|
|
+ if (templateType !== 2) return false;
|
|
|
+ if (node.data.emrCategoryCode === 'shoucibingchengjilu') {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return node.data.type !== "group-category";
|
|
|
+}
|
|
|
+
|
|
|
+let drag = new Map();
|
|
|
+
|
|
|
+const dragEnd = (moveNode, inNode, type, event) => {
|
|
|
+ if (type === 'none') return
|
|
|
+ let temp = {
|
|
|
+ newParent: inNode.data._id,
|
|
|
+ oldParent: moveNode.data.parent
|
|
|
+ }
|
|
|
+ drag.set(moveNode.data.id, temp)
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
|
|
|
emrMitt.on('患者病区判断', () => {
|
|
|
return determineWhetherItCanBeCreated()
|
|
|
})
|
|
|
+
|
|
|
queryData()
|
|
|
if (editor) {
|
|
|
getAllWards().then((res) => {
|