|
@@ -20,7 +20,7 @@
|
|
|
@click="clickDelete">
|
|
|
删除
|
|
|
</el-button>
|
|
|
- <el-button @click="recoveryDialog = true">
|
|
|
+ <el-button @click="openRecovery">
|
|
|
恢复
|
|
|
</el-button>
|
|
|
<el-button @click="auditClick" type="primary">
|
|
@@ -44,9 +44,8 @@
|
|
|
<el-divider direction="vertical"/>
|
|
|
<!-- 恢复到上一次保存的状态 -->
|
|
|
<historical-emr v-if="recoveryDialog"
|
|
|
- @closed="recoveryDialog = false"
|
|
|
- :docunent-id="documentId"
|
|
|
- @restore-data="restoreData"/>
|
|
|
+ v-model="recoveryDialog"
|
|
|
+ :historical-data="historicalData"/>
|
|
|
<el-button-group>
|
|
|
<el-button type="primary" icon="Printer" @click="frontEndPrinting"
|
|
|
title="页面打印支持病历续打,但是可能会出现打印错误,如果页面打印无法使用请用服务打印,服务打印也不行请换win10电脑打印。">
|
|
@@ -291,11 +290,11 @@ import {
|
|
|
getDrgIntelligentGrouping,
|
|
|
getExtractDataElement,
|
|
|
hotSearchSorting,
|
|
|
- submitMedicalRecord
|
|
|
+ submitMedicalRecord,
|
|
|
+ getHistory
|
|
|
} from "@/api/zhu-yuan-yi-sheng/emr-patient";
|
|
|
import {useDocumentVisibility} from "@vueuse/core";
|
|
|
import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue";
|
|
|
-import {getWardsApi} from "@/api/login";
|
|
|
import {xcMessage} from "@/utils/xiaochan-element-plus";
|
|
|
import HistoricalEmr from "@/components/zhu-yuan-yi-sheng/emr/HistoricalEmr.vue";
|
|
|
import EmrPopup from "@/components/zhu-yuan-yi-sheng/emr/EmrPopup.vue";
|
|
@@ -341,7 +340,6 @@ const currentEmr = ref(null)
|
|
|
const emrRef = ref(null)
|
|
|
const emrSocket = ref(null)
|
|
|
|
|
|
-const recoveryDialog = ref(false)
|
|
|
const categoryCode = ref('')
|
|
|
// 文档 id 唯一值
|
|
|
const documentId = ref('')
|
|
@@ -1206,9 +1204,9 @@ const diseaseCourseSequencing = () => {
|
|
|
anchor = item.nextElementSibling
|
|
|
pos = 'beforebegin'
|
|
|
}
|
|
|
- areas.sort((item1, item2) => {
|
|
|
- return item1.time - item2.time
|
|
|
- }).forEach((item) => {
|
|
|
+
|
|
|
+ const orderAreas = XEUtils.orderBy(areas, [['time', 'asc']])
|
|
|
+ XEUtils.arrayEach(orderAreas, (item) => {
|
|
|
if (!anchor) {//无前后节点之间append
|
|
|
anchor.parentElement.appendChild(item.view.el)
|
|
|
} else {
|
|
@@ -1245,13 +1243,6 @@ const analysisIframeSrcSearch = async () => {
|
|
|
return temp
|
|
|
}
|
|
|
|
|
|
-// 恢复历史数据
|
|
|
-const restoreData = (data) => {
|
|
|
- editor.setDocument(data)
|
|
|
- xcMessage.success('恢复成功,请点击保存。')
|
|
|
- recoveryDialog.value = false
|
|
|
-}
|
|
|
-
|
|
|
const popupRef = ref(null)
|
|
|
const popupFunc = {
|
|
|
setShortcutKey: () => {
|
|
@@ -1353,6 +1344,42 @@ const monitorPageRefresh = (event) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// ----------------------------- 恢复到上一次保存的状态
|
|
|
+const recoveryDialog = ref(false)
|
|
|
+const historicalData = ref<EmrHistory[]>([])
|
|
|
+
|
|
|
+interface EmrHistory {
|
|
|
+ documentId: string
|
|
|
+ _id: string
|
|
|
+ categoryId: string
|
|
|
+}
|
|
|
+
|
|
|
+const openRecovery = () => {
|
|
|
+ if (stringIsBlank(documentId.value)) {
|
|
|
+ BizException(ExceptionEnum.MESSAGE_ERROR, "请先选择已保存的病历模板。");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (historicalData.value.length > 0) {
|
|
|
+ let [one] = historicalData.value
|
|
|
+ if (documentId.value !== one.documentId) {
|
|
|
+ historicalData.value = []
|
|
|
+ queryHistoryFunc()
|
|
|
+ } else {
|
|
|
+ recoveryDialog.value = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ queryHistoryFunc()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const queryHistoryFunc = () => {
|
|
|
+ getHistory(documentId.value).then(res => {
|
|
|
+ // @ts-ignore
|
|
|
+ historicalData.value = res as EmrHistory
|
|
|
+ recoveryDialog.value = true
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 打开已经保存了的病历
|
|
|
* @param id 病历 id
|
|
@@ -1371,24 +1398,23 @@ const visibility = useDocumentVisibility()
|
|
|
// 创建和编辑病历
|
|
|
let emrEditCreateLimit = new EmrEditCreateLimit(props.huanZheXinXi, userData)
|
|
|
|
|
|
-onMounted(async () => {
|
|
|
- // ts-ignore
|
|
|
- autoSave.value = isDev ? false : appStore.value.emrAutoSave;
|
|
|
- extractData.value = await getExtractDataElement(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes)
|
|
|
- await nextTick()
|
|
|
- patientId.value = props.huanZheXinXi.inpatientNo + '_' + props.huanZheXinXi.admissTimes
|
|
|
- await queryingBasicPatientInformation()
|
|
|
- currentEmr.value = new EMRInteractive(patientData.value, emrEvent);
|
|
|
- if (emrConfig.value.editor) {
|
|
|
- emrSnippetRef.value.setPatientData(patientData.value)
|
|
|
- }
|
|
|
- doctorLevelFunc()
|
|
|
- emrRef.value.parentElement.emr = currentEmr.value
|
|
|
|
|
|
- window.addEventListener('beforeunload', monitorPageRefresh, {capture: true})
|
|
|
-
|
|
|
- autoSaveFunc()
|
|
|
+const watchVisibility = () => {
|
|
|
+ watch(() => visibility.value, () => {
|
|
|
+ // 离开页面的时候清空定时器
|
|
|
+ if (visibility.value === 'hidden' && isEditorChange.value) {
|
|
|
+ if (interval != null) {
|
|
|
+ clearInterval(interval)
|
|
|
+ }
|
|
|
+ document.title = `患者【${props.huanZheXinXi.name}】,未保存数据`
|
|
|
+ } else {
|
|
|
+ autoSaveChange()
|
|
|
+ document.title = `电子病历-正在编辑【${props.huanZheXinXi.name}】`
|
|
|
+ }
|
|
|
+ }, {immediate: true})
|
|
|
+}
|
|
|
|
|
|
+const emrMittInit = () => {
|
|
|
emrMitt.on('editor', () => {
|
|
|
return editor
|
|
|
})
|
|
@@ -1409,18 +1435,29 @@ onMounted(async () => {
|
|
|
location.reload();
|
|
|
})
|
|
|
|
|
|
- watch(() => visibility.value, () => {
|
|
|
- // 离开页面的时候清空定时器
|
|
|
- if (visibility.value === 'hidden' && isEditorChange.value) {
|
|
|
- if (interval != null) {
|
|
|
- clearInterval(interval)
|
|
|
- }
|
|
|
- document.title = `患者【${props.huanZheXinXi.name}】,未保存数据`
|
|
|
- } else {
|
|
|
- autoSaveChange()
|
|
|
- document.title = `电子病历-正在编辑【${props.huanZheXinXi.name}】`
|
|
|
- }
|
|
|
- }, {immediate: true})
|
|
|
+ emrMitt.on('queryHistoryFunc', queryHistoryFunc)
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ autoSave.value = isDev ? false : appStore.value.emrAutoSave;
|
|
|
+ extractData.value = await getExtractDataElement(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes)
|
|
|
+ await nextTick()
|
|
|
+ patientId.value = props.huanZheXinXi.inpatientNo + '_' + props.huanZheXinXi.admissTimes
|
|
|
+ await queryingBasicPatientInformation()
|
|
|
+ currentEmr.value = new EMRInteractive(patientData.value, emrEvent);
|
|
|
+ if (emrConfig.value.editor) {
|
|
|
+ emrSnippetRef.value.setPatientData(patientData.value)
|
|
|
+ }
|
|
|
+ doctorLevelFunc()
|
|
|
+ emrRef.value.parentElement.emr = currentEmr.value
|
|
|
+
|
|
|
+ window.addEventListener('beforeunload', monitorPageRefresh, {capture: true})
|
|
|
+
|
|
|
+ autoSaveFunc()
|
|
|
+ emrMittInit()
|
|
|
+ watchVisibility()
|
|
|
})
|
|
|
|
|
|
onDeactivated(() => {
|
|
@@ -1613,6 +1650,7 @@ const setEditor = () => {
|
|
|
styleBarRef.value.setEditor(editor)
|
|
|
}
|
|
|
|
|
|
+
|
|
|
defineExpose({
|
|
|
closeBothSides,
|
|
|
headerRef,
|