|
@@ -122,6 +122,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import {nextTick, onDeactivated, onMounted, provide, ref, watch} from "vue";
|
|
|
import {
|
|
|
+ copyAsDataSource,
|
|
|
copyEnum,
|
|
|
delEmrCopy,
|
|
|
emrConfig,
|
|
@@ -180,6 +181,9 @@ import {
|
|
|
useHistoricalData
|
|
|
} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/emr-function/useEmrFunction";
|
|
|
import PatientInfoView from "@/components/zhu-yuan-yi-sheng/public/PatientInfoView.vue";
|
|
|
+import {
|
|
|
+ useEmrCache
|
|
|
+} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/useEmrCache/useEmrCache";
|
|
|
|
|
|
const EmrWebSocket = defineAsyncComponent(() =>
|
|
|
import("@/components/zhu-yuan-yi-sheng/emr/web-socket/EmrWebSocket.vue"))
|
|
@@ -216,13 +220,13 @@ let runtime: Runtime | null = null
|
|
|
let editMain: UseEmrInitReturn | null = null
|
|
|
let extractData = {}
|
|
|
|
|
|
-const emrStore: PageStore = useEmrStore()
|
|
|
+const emrStore: PageStore = useEmrStore(patientInfo.value.inpatientNo + '_' + patientInfo.value.admissTimes)
|
|
|
|
|
|
// 恢复到上一次保存的状态
|
|
|
const {openRecovery} = useHistoricalData();
|
|
|
|
|
|
provide(emrRootContextKey, {
|
|
|
- store: emrStore
|
|
|
+ store: emrStore,
|
|
|
})
|
|
|
|
|
|
const {magicScript, triggerScript, scriptLoading} = useEmrScript({
|
|
@@ -320,8 +324,6 @@ const emrEvent = {
|
|
|
// 设置病程记录跳转
|
|
|
setTheProgressAnchor()
|
|
|
maleDeleteDataElement()
|
|
|
- // 是否开启审阅模式
|
|
|
- isRevisionMode()
|
|
|
// 判断是否只读
|
|
|
readonlyPattern()
|
|
|
// 每一个病历只能一个人编辑
|
|
@@ -774,29 +776,32 @@ const whetherThereIsAMedicalRecordId = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const checkEmrChange = (cb) => {
|
|
|
- if (readonlyPattern()) {
|
|
|
- isEditorChange.value = false
|
|
|
- }
|
|
|
- if (isEditorChange.value) {
|
|
|
- CyMessageBox.confirm({
|
|
|
- message: '您改变了数据是否要保存,不保存可能会丢失数据。',
|
|
|
- title: '提示',
|
|
|
- type: 'warning',
|
|
|
- cancelButtonText: '放弃修改',
|
|
|
- confirmButtonText: '保存病历',
|
|
|
- }).then(() => {
|
|
|
- clickSaveData()
|
|
|
- }).catch(({action}) => {
|
|
|
- if (action === 'cancel') {
|
|
|
- isEditorChange.value = false
|
|
|
- cb()
|
|
|
- }
|
|
|
- })
|
|
|
- } else {
|
|
|
- isEditorChange.value = false
|
|
|
- cb()
|
|
|
- }
|
|
|
+const checkEmrChange = () => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ if (readonlyPattern()) {
|
|
|
+ isEditorChange.value = false
|
|
|
+ }
|
|
|
+ if (isEditorChange.value) {
|
|
|
+ CyMessageBox.confirm({
|
|
|
+ message: '您改变了数据是否要保存,不保存可能会丢失数据。',
|
|
|
+ title: '提示',
|
|
|
+ type: 'warning',
|
|
|
+ cancelButtonText: '放弃修改',
|
|
|
+ confirmButtonText: '保存病历',
|
|
|
+ }).then(() => {
|
|
|
+ clickSaveData()
|
|
|
+ return reject()
|
|
|
+ }).catch(({action}) => {
|
|
|
+ if (action === 'cancel') {
|
|
|
+ isEditorChange.value = false
|
|
|
+ return resolve()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ isEditorChange.value = false
|
|
|
+ return resolve()
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
const createName = ref('')
|
|
@@ -913,8 +918,10 @@ const 入院病历 = 'ruyuanjiluzhuanyong'
|
|
|
function generalMedicalRecords() {
|
|
|
if (emrEditCreateLimit.isEdit(createId)) {
|
|
|
setEditorModel('free')
|
|
|
+ editor?.setRevisionShowMode(1);
|
|
|
} else {
|
|
|
setEditorModel('readonly')
|
|
|
+ editor?.setRevisionShowMode(2);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -960,12 +967,16 @@ const setEditorModeFun = () => {
|
|
|
*/
|
|
|
const openTheTraceByUser = (editorCode) => {
|
|
|
if (readonlyPattern() || stringIsBlank(createId)) {
|
|
|
+ editor!.setRevisionMode('off')
|
|
|
+ editor!.setRevisionShowMode(1);
|
|
|
return
|
|
|
}
|
|
|
if (editorCode === userInfo.code) {
|
|
|
editor!.setRevisionMode('off')
|
|
|
+ editor!.setRevisionShowMode(1);
|
|
|
} else {
|
|
|
editor!.setRevisionMode('on')
|
|
|
+ editor!.setRevisionShowMode(2);
|
|
|
xcMessage.warning('当前病历创建人不是您,你的操作将会留痕。')
|
|
|
}
|
|
|
}
|
|
@@ -1139,15 +1150,6 @@ const extractFields = (val) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 是否开启审阅模式
|
|
|
-const isRevisionMode = () => {
|
|
|
- try {
|
|
|
- editor!.setRevisionShowMode(reviewMode.value);
|
|
|
- } catch (e) {
|
|
|
- console.error(e)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
// 电子病历排序
|
|
|
const diseaseCourseSequencing = () => {
|
|
|
if (!isCourse()) {
|
|
@@ -1160,8 +1162,8 @@ const diseaseCourseSequencing = () => {
|
|
|
fn: function () {
|
|
|
const areas = []; //区域数组
|
|
|
let walker = null; //遍历器
|
|
|
- const service = editor.ModelService; //节点工具
|
|
|
- const root = editor.model.document.getRoot(); //文档跟节点
|
|
|
+ const service = editor!.ModelService; //节点工具
|
|
|
+ const root = editor!.model.document.getRoot(); //文档跟节点
|
|
|
for (const node of root.getChildren()) { //遍历区域并把时间和区域关键放进areas
|
|
|
if (node.type === 'area') {
|
|
|
if (!walker) {
|
|
@@ -1283,9 +1285,10 @@ const currentEditorFunc = XEUtils.debounce(() => {
|
|
|
getCurrentDocumentUserCode(getId()).then(res => {
|
|
|
if (res && userInfo.code !== res.code) {
|
|
|
const str = `当前编辑人员:【${res.name}】,科室:【${res.deptName}】<br /><span style="color: red">一份病历只能一个人编辑,当前病历已被锁定。</span>`
|
|
|
- ElMessageBox.alert(str, '提示', {
|
|
|
+ CyMessageBox.alert({
|
|
|
+ message: str,
|
|
|
dangerouslyUseHTMLString: true,
|
|
|
- type: "warning"
|
|
|
+ type: 'warning'
|
|
|
}).then(() => {
|
|
|
|
|
|
}).catch(() => {
|
|
@@ -1339,11 +1342,9 @@ const fragmentJump = (param: EmrParam) => {
|
|
|
|
|
|
const restoreDefaultSettings = () => {
|
|
|
try {
|
|
|
- editor!.setRevisionMode('off')
|
|
|
editor!.setCursor('DOCUMENT_START')
|
|
|
editMain?.iframe
|
|
|
- .contentWindow
|
|
|
- .document
|
|
|
+ .contentWindow!.document
|
|
|
.getElementById('editorEl')
|
|
|
.scroll({top: 0})
|
|
|
} catch {
|
|
@@ -1351,39 +1352,61 @@ const restoreDefaultSettings = () => {
|
|
|
}
|
|
|
|
|
|
const loadDocument = (param: EmrParam): Promise<void> => {
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
const {loadDocument: load} = editMain
|
|
|
if (!(showIframeIsList(IframeTabs.正在编辑, IframeTabs.同时打开))) {
|
|
|
showIframe.value = IframeTabs.正在编辑
|
|
|
}
|
|
|
if (emrConfig.value.loadDocument) {
|
|
|
- resolve()
|
|
|
+ reject()
|
|
|
return
|
|
|
}
|
|
|
if (param.documentId && getId() === param.documentId) {
|
|
|
resolve()
|
|
|
return;
|
|
|
}
|
|
|
- checkEmrChange(() => {
|
|
|
- emrConfig.value.loadDocument = true
|
|
|
- restoreDefaultSettings()
|
|
|
- load(param).then((res) => {
|
|
|
- isEmpty = false
|
|
|
- templateName.value = param.templateName
|
|
|
- categoryCode.value = param.categoryCode
|
|
|
- createId = param.createId
|
|
|
- parent = param.parent;
|
|
|
- createName.value = param.createName
|
|
|
- editor!.setDocument(res, true);
|
|
|
- emrMitt.emit('changeRightTabs', isCourse() ? EmrRightTabs.fragment : EmrRightTabs.outline)
|
|
|
- resolve()
|
|
|
- }).catch((_err) => {
|
|
|
- emptyEditor()
|
|
|
- reject()
|
|
|
- }).finally(() => {
|
|
|
- emrConfig.value.loadDocument = false
|
|
|
- })
|
|
|
+
|
|
|
+ function setValue() {
|
|
|
+ isEmpty = false
|
|
|
+ templateName.value = param.templateName as string
|
|
|
+ categoryCode.value = param.categoryCode as string
|
|
|
+ createId = param.createId
|
|
|
+ parent = param.parent;
|
|
|
+ createName.value = param.createName as string
|
|
|
+ emrMitt.emit('changeRightTabs', isCourse() ? EmrRightTabs.fragment : EmrRightTabs.outline)
|
|
|
+ }
|
|
|
+
|
|
|
+ await checkEmrChange()
|
|
|
+
|
|
|
+ emrConfig.value.loadDocument = true
|
|
|
+ restoreDefaultSettings()
|
|
|
+
|
|
|
+ const cacheData = await emrStore.cache.reduction({
|
|
|
+ id: param.documentId,
|
|
|
+ categoryId: param.categoryId
|
|
|
+ }).then(() => {
|
|
|
+ setValue()
|
|
|
+ emrConfig.value.loadDocument = false
|
|
|
+ return true
|
|
|
+ }).catch(() => {
|
|
|
+ return false
|
|
|
})
|
|
|
+
|
|
|
+ if (cacheData) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ load(param).then((res) => {
|
|
|
+ setValue()
|
|
|
+ editor!.setDocument(res, true);
|
|
|
+ resolve()
|
|
|
+ }).catch((_err) => {
|
|
|
+ emptyEditor()
|
|
|
+ reject()
|
|
|
+ }).finally(() => {
|
|
|
+ emrConfig.value.loadDocument = false
|
|
|
+ });
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -1409,9 +1432,9 @@ const emrMittInit = () => {
|
|
|
} else {
|
|
|
showIframe.value = IframeTabs.已保存病历
|
|
|
}
|
|
|
- hisSaveEmr.loadDocument({documentId: id}).then(res => {
|
|
|
- hisSaveEmr.editor?.setDocument(res, true);
|
|
|
- hisSaveEmr.editor?.setEditorMode('readonly')
|
|
|
+ hisSaveEmr!.loadDocument({documentId: id}).then(res => {
|
|
|
+ hisSaveEmr!.editor?.setDocument(res, true);
|
|
|
+ hisSaveEmr!.editor?.setEditorMode('readonly')
|
|
|
})
|
|
|
})
|
|
|
emrMitt.on('jumpDataElementById', (id: string) => {
|
|
@@ -1494,6 +1517,7 @@ const initEdit = () => {
|
|
|
editMain = res
|
|
|
popupFunc.setShortcutKey()
|
|
|
setEditor();
|
|
|
+ emrStore.cache.open();
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -1505,7 +1529,7 @@ const hisSaveEmrInit = () => {
|
|
|
}
|
|
|
|
|
|
|
|
|
-let hisSaveEmr: UseEmrInitReturn | {} = {}
|
|
|
+let hisSaveEmr: UseEmrInitReturn | null = null
|
|
|
|
|
|
onMounted(async () => {
|
|
|
doctorLevelFunc()
|
|
@@ -1523,21 +1547,19 @@ onDeactivated(() => {
|
|
|
window.removeEventListener('beforeunload', monitorPageRefresh, {capture: true})
|
|
|
})
|
|
|
|
|
|
-onBeforeRouteLeave((to, from, next) => {
|
|
|
- checkEmrChange(() => {
|
|
|
- next();
|
|
|
- })
|
|
|
+onBeforeRouteLeave(async (to, from, next) => {
|
|
|
+ await checkEmrChange()
|
|
|
+ next()
|
|
|
})
|
|
|
|
|
|
-
|
|
|
const closeBothSides = () => {
|
|
|
foldBothSides.value.isLeft = false
|
|
|
foldBothSides.value.isRight = false
|
|
|
}
|
|
|
|
|
|
const closeWebSocket = () => {
|
|
|
- emrSocketRef.value.clearDocument()
|
|
|
- emrSocketRef.value.clearSocket()
|
|
|
+ emrSocketRef.value!.clearDocument()
|
|
|
+ emrSocketRef.value!.clearSocket()
|
|
|
}
|
|
|
|
|
|
const changeClear = () => {
|
|
@@ -1624,9 +1646,9 @@ const 解析病程记录 = (val) => {
|
|
|
}
|
|
|
|
|
|
const 循环病程返回数据元 = (callback) => {
|
|
|
- const root = editor.model.document.getRoot()
|
|
|
+ const root = editor!.model.document.getRoot()
|
|
|
let walker, values;
|
|
|
- const modelService = editor.ModelService;
|
|
|
+ const modelService = editor!.ModelService;
|
|
|
for (let node of root.getChildren()) {
|
|
|
if (node.view && node.type === 'area') {
|
|
|
if (!walker) {
|
|
@@ -1694,6 +1716,7 @@ async function handleCrb() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
function selectFill() {
|
|
|
setDialogToJs(ChooseToFillInData, {data: extractData}).then(res => {
|
|
|
if (res.length === 0) {
|
|
@@ -1704,8 +1727,6 @@ function selectFill() {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
defineExpose({
|
|
|
closeBothSides,
|
|
|
closeWebSocket,
|