|
|
@@ -22,7 +22,7 @@
|
|
|
|
|
|
<emr-assistant :data="openAssistant" :to-fill-in-data="clickToFillInData"/>
|
|
|
<el-switch v-model="reviewMode" active-color="#ff4949" active-text="关闭审阅" :active-value="false"
|
|
|
- inactive-color="#13ce66" inactive-text="开启审阅" :inactive-value="true"/>
|
|
|
+ inactive-color="#13ce66" @change="isRevisionMode" inactive-text="开启审阅" :inactive-value="true"/>
|
|
|
|
|
|
</el-header>
|
|
|
|
|
|
@@ -72,7 +72,7 @@ import {onBeforeRouteLeave} from "vue-router";
|
|
|
import {getUuid} from "@/api/public-api";
|
|
|
import {
|
|
|
deletePatientEmrByDocumentId,
|
|
|
- getDrgIntelligentGrouping, insertEmrData,
|
|
|
+ getDrgIntelligentGrouping, getExtractDataElement, insertEmrData,
|
|
|
submitMedicalRecord
|
|
|
} from "@/api/zhu-yuan-yi-sheng/emr-patient";
|
|
|
import {useDocumentVisibility} from "@vueuse/core";
|
|
|
@@ -131,7 +131,9 @@ let jumpPositioning = {
|
|
|
}
|
|
|
let wardList = []
|
|
|
// 创建人 id
|
|
|
-let createId = null
|
|
|
+let createId = null;
|
|
|
+// 获取提取到的数据。
|
|
|
+let extractData = {}
|
|
|
|
|
|
// 点击保存病历
|
|
|
const clickSaveData = async () => {
|
|
|
@@ -167,6 +169,7 @@ const clickSaveData = async () => {
|
|
|
let res = await insertEmrData(data)
|
|
|
currentEmr.value.saveDocument(data).then(emrRes => {
|
|
|
// 把提取到的数据放到 patientData 中.
|
|
|
+ extractData = res
|
|
|
Object.assign(patientData, res)
|
|
|
isEditorChange = false
|
|
|
emrSidebarRef.value.queryData()
|
|
|
@@ -251,11 +254,12 @@ const clickDelete = () => {
|
|
|
// 电子病历删除
|
|
|
await currentEmr.value.deleteDocument(documentId)
|
|
|
if (res.length > 0) {
|
|
|
- console.log('删除的数据', res)
|
|
|
for (let i = 0; i < res.length; i++) {
|
|
|
let item = res[i]
|
|
|
// 删除提取到的数据源
|
|
|
delete patientData[item]
|
|
|
+ // 删除提取到的数据
|
|
|
+ delete extractData[item]
|
|
|
}
|
|
|
}
|
|
|
isEditorChange = false
|
|
|
@@ -414,13 +418,29 @@ const setEditorModeFun = () => {
|
|
|
if (emrConfig.value.editor) {
|
|
|
// 设置成编辑模式
|
|
|
currentEmr.value.callMethod('setEditorMode', 'free')
|
|
|
- if (categoryCode.includes('shoucibingchengjilu')) {
|
|
|
- // 如果是病程记录就不用锁住,因为要根据片段锁住
|
|
|
- currentEmr.value.callMethod('setEditorMode', 'free')
|
|
|
- } else if (createId !== null && createId !== userData.code) {
|
|
|
+ // 如果不是首次病程记录就需要执行下面的代码
|
|
|
+ if (!categoryCode.includes('shoucibingchengjilu')) {
|
|
|
+ if (createId === null) {
|
|
|
+ return
|
|
|
+ }
|
|
|
// 创建人不是自己就只能看
|
|
|
- currentEmr.value.callMethod('setEditorMode', 'readonly')
|
|
|
+ if (doctorLevel === 1 && createId !== userData.code) {
|
|
|
+ currentEmr.value.callMethod('setEditorMode', 'readonly');
|
|
|
+ }
|
|
|
+ if (doctorLevel === 2) {
|
|
|
+ // 不能修改三级医生写的病历
|
|
|
+ if (createId === extractFields('主任医生编码')) {
|
|
|
+ currentEmr.value.callMethod('setEditorMode', 'readonly');
|
|
|
+ } else {
|
|
|
+ currentEmr.value.callMethod('setEditorMode', 'free');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 医生等级 3 没有限制
|
|
|
+ if (doctorLevel === 3) {
|
|
|
+ currentEmr.value.callMethod('setEditorMode', 'free');
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
currentEmr.value.callMethod('setEditorMode', 'readonly')
|
|
|
}
|
|
|
@@ -468,20 +488,35 @@ const courseSegmentLocking = () => {
|
|
|
emrCategoryCode: categoryCode,
|
|
|
jump: true
|
|
|
})
|
|
|
- // select dept_director /* 主任医生*/,
|
|
|
- // consult_physician /*主治医生*/
|
|
|
- // refer_physician /*管床医生*/,
|
|
|
- // from zy_actpatient;
|
|
|
- let editorCode = values['编辑者']?.value[0]?.code
|
|
|
- if (editorCode) {
|
|
|
- if (editorCode !== loginUserCode) {
|
|
|
- node.view.setReadonly(true);
|
|
|
- node.view.setDeletable(false);
|
|
|
+ emrSidebarRef.value.diseaseDurationRecordTime(documentId, courseTitles)
|
|
|
+ if (props.editor) {
|
|
|
+ let editorCode = values['编辑者']?.value[0]?.code;
|
|
|
+ if (editorCode) {
|
|
|
+ if (doctorLevel === 1) {
|
|
|
+ if (editorCode !== loginUserCode) {
|
|
|
+ node.view.setReadonly(true);
|
|
|
+ node.view.setDeletable(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (doctorLevel === 2) {
|
|
|
+ if (editorCode === extractFields('主任医生编码')) {
|
|
|
+ currentEmr.value.callMethod('setEditorMode', 'readonly');
|
|
|
+ } else {
|
|
|
+ currentEmr.value.callMethod('setEditorMode', 'free');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (doctorLevel === 3) {
|
|
|
+ currentEmr.value.callMethod('setEditorMode', 'free');
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
+ } else {
|
|
|
+ node.view.setReadonly(true);
|
|
|
+ node.view.setDeletable(false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- emrSidebarRef.value.diseaseDurationRecordTime(documentId, courseTitles)
|
|
|
+
|
|
|
} else {
|
|
|
for (let node of root.getChildren()) {
|
|
|
if (node.view && node.type === 'area') {
|
|
|
@@ -503,11 +538,12 @@ const deleteDataElement = () => {
|
|
|
|
|
|
// 重新设置提取的数据, 这里是强制替换
|
|
|
const reQueryPatientInformation = () => {
|
|
|
+ console.log(extractData)
|
|
|
// 如果是只读模式就不触发这个
|
|
|
if (!readonlyPattern()) {
|
|
|
// 如果没有文档 id 就说明是
|
|
|
if (documentId) {
|
|
|
- editor.setValues(patientData)
|
|
|
+ editor.setValues(extractData)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -570,7 +606,35 @@ const readonlyPattern = () => {
|
|
|
return editor !== null && editor.getEditorMode() === 'readonly';
|
|
|
}
|
|
|
|
|
|
+// 判断 一级 二级 三级医生
|
|
|
+let doctorLevel = 1;
|
|
|
+const doctorLevelFunc = () => {
|
|
|
+ if (extractFields('管床医生编码') === userData.code) {
|
|
|
+ doctorLevel = 1
|
|
|
+ } else if (extractFields('主治医生编码') === userData.code) {
|
|
|
+ doctorLevel = 2
|
|
|
+ } else if (extractFields('主任医生编码') === userData.code) {
|
|
|
+ doctorLevel = 3
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 提取字段
|
|
|
+const extractFields = (val) => {
|
|
|
+ if (patientData[val] === null) {
|
|
|
+ return ''
|
|
|
+ } else {
|
|
|
+ return patientData[val]
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const isRevisionMode = () => {
|
|
|
+ editor.isRevisionMode(reviewMode)
|
|
|
+}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
+ getExtractDataElement(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes).then((res) => {
|
|
|
+ extractData = res
|
|
|
+ })
|
|
|
nextTick(async () => {
|
|
|
emrSidebarRef.value.queryData()
|
|
|
patientId = props.huanZheXinXi.inpatientNo
|
|
|
@@ -579,6 +643,9 @@ onMounted(() => {
|
|
|
if (emrConfig.value.editor) {
|
|
|
emrSnippetRef.value.setPatientData(patientData)
|
|
|
}
|
|
|
+ doctorLevelFunc()
|
|
|
+
|
|
|
+ console.log(patientData)
|
|
|
emrRef.value.parentElement.emr = currentEmr.value
|
|
|
window.addEventListener('beforeunload', monitorPageRefresh, {capture: true})
|
|
|
})
|