|
|
@@ -404,15 +404,15 @@
|
|
|
import {getEmrInpatientData} from "@/api/dictionary/emr-data-maintenance-api";
|
|
|
import EmrSidebar from "@/components/zhu-yuan-yi-sheng/emr/EmrSidebar.vue";
|
|
|
import {
|
|
|
- EMRInteractive,
|
|
|
- emrConfig,
|
|
|
- fontSizes,
|
|
|
availableFonts,
|
|
|
+ completeModeSwitch,
|
|
|
copyEnum,
|
|
|
- getEmrCopy,
|
|
|
delEmrCopy,
|
|
|
- completeModeSwitch,
|
|
|
- emrMitt
|
|
|
+ emrConfig,
|
|
|
+ EMRInteractive,
|
|
|
+ emrMitt,
|
|
|
+ fontSizes,
|
|
|
+ getEmrCopy
|
|
|
} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
|
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
import {BizException, ExceptionEnum} from "@/utils/BizException";
|
|
|
@@ -423,7 +423,8 @@ import {getServerDateApi, getUuid} from "@/api/public-api";
|
|
|
import {
|
|
|
audit,
|
|
|
getDrgIntelligentGrouping,
|
|
|
- getExtractDataElement, hotSearchSorting,
|
|
|
+ getExtractDataElement,
|
|
|
+ hotSearchSorting,
|
|
|
submitMedicalRecord
|
|
|
} from "@/api/zhu-yuan-yi-sheng/emr-patient";
|
|
|
import {useDocumentVisibility} from "@vueuse/core";
|
|
|
@@ -436,7 +437,7 @@ import EmrPopup from "@/components/zhu-yuan-yi-sheng/emr/EmrPopup.vue";
|
|
|
import EmrAuxiliaryTools from "@/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrAuxiliaryTools.vue";
|
|
|
import sleep from "@/utils/sleep";
|
|
|
import EmrWebSocket from "@/components/zhu-yuan-yi-sheng/emr/web-socket/EmrWebSocket.vue";
|
|
|
-import {listToStr, stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
|
|
|
+import {stringIsBlank} from "@/utils/blank-utils";
|
|
|
import {isDev, needRule} from "@/utils/public";
|
|
|
import {isThereADoctorEditing} from "@/api/zhu-yuan-yi-sheng/emr-socket";
|
|
|
import {onDeactivated} from "vue";
|
|
|
@@ -447,8 +448,11 @@ import EmrAudit
|
|
|
from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrAudit.vue";
|
|
|
import EmrConnotation
|
|
|
from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrConnotation.vue";
|
|
|
-import {save} from "@/api/zhu-yuan-yi-sheng/connotation-quality-control";
|
|
|
+import {createAnEdit, reqUnlock, save} from "@/api/emr-control/connotation-quality-control";
|
|
|
import XEUtils from 'xe-utils'
|
|
|
+import {
|
|
|
+ EmrEditCreateLimit
|
|
|
+} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-edit-create-limit";
|
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
@@ -581,6 +585,7 @@ const emrMainWidth = () => {
|
|
|
|
|
|
const emrEvent = {
|
|
|
'loaded': async (event) => {
|
|
|
+ // await 判断可否创建或编辑()
|
|
|
editor = currentEmr.value.getEditor()
|
|
|
loaded = false
|
|
|
// 获取医生等级
|
|
|
@@ -603,6 +608,8 @@ const emrEvent = {
|
|
|
// 每一个病历只能一个人编辑
|
|
|
await editJudgment()
|
|
|
openOrClosePage(isOpenPage.value)
|
|
|
+ // 如果创建人不是自己就要开启审阅
|
|
|
+ openTheTraceByUser(createId)
|
|
|
},
|
|
|
|
|
|
'contentchange': (e, op) => {
|
|
|
@@ -729,7 +736,6 @@ const editJudgment = async () => {
|
|
|
}).catch(() => {
|
|
|
})
|
|
|
// 不能编辑 不锁柱
|
|
|
- console.log(emrConfig.value.editor)
|
|
|
if (!emrConfig.value.editor) {
|
|
|
return
|
|
|
}
|
|
|
@@ -1083,46 +1089,11 @@ const 入院病历 = 'ruyuanjiluzhuanyong'
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
function generalMedicalRecords() {
|
|
|
- if (whetherToEditFunc(createId)) {
|
|
|
+ if (emrEditCreateLimit.isEdit(createId)) {
|
|
|
editor.setEditorMode('free')
|
|
|
} else {
|
|
|
editor.setEditorMode('readonly')
|
|
|
}
|
|
|
- // 如果创建人不是自己就要开启审阅
|
|
|
- openTheTraceByUser(createId)
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- *
|
|
|
- * @param create 创建人
|
|
|
- * @returns {boolean}
|
|
|
- */
|
|
|
-function whetherToEditFunc(create) {
|
|
|
- let currentCode = userData.code
|
|
|
- if (emrConfig.value.editor) {
|
|
|
- if (stringIsBlank(create)) {
|
|
|
- return true
|
|
|
- }
|
|
|
- if (create === currentCode) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- // 科室质控员
|
|
|
- if (departmentQualityController()) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- switch (doctorLevel) {
|
|
|
- case 1:
|
|
|
- return createId === userData.code
|
|
|
- case 2:
|
|
|
- // 二级医生不能改三级医生的
|
|
|
- return createId !== extractFields('主任医生编码');
|
|
|
- case 3:
|
|
|
- return true
|
|
|
- }
|
|
|
- return false
|
|
|
- } else {
|
|
|
- return false
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
// 设置编辑器的模式
|
|
|
@@ -1139,7 +1110,7 @@ const setEditorModeFun = () => {
|
|
|
// 如果没有数据说明的历史数据历史数据就不能用下面的逻辑
|
|
|
if (XEUtils.isArray(areas)) {
|
|
|
editor.setEditorMode('free')
|
|
|
- let edit = whetherToEditFunc(createId)
|
|
|
+ let edit = emrEditCreateLimit.isEdit(createId)
|
|
|
XEUtils.arrayEach(areas, (item, key) => {
|
|
|
if (edit) {
|
|
|
item.target.setReadonly(false)
|
|
|
@@ -1196,67 +1167,50 @@ const courseSegmentLocking = async () => {
|
|
|
return
|
|
|
}
|
|
|
editor.setEditorMode('free')
|
|
|
- if (documentId) {
|
|
|
- let courseTitles = [];
|
|
|
- let loginUserCode = userData.code;
|
|
|
- 循环病程返回数据元((value, node) => {
|
|
|
- let fragment = node.getAttribute('fragment')
|
|
|
- let pushData = {
|
|
|
- code: '查房时间',
|
|
|
- name: value['查房标题']?.value,
|
|
|
- value: value['查房时间']?.value,
|
|
|
- emrDocumentId: documentId,
|
|
|
- emrCategoryCode: categoryCode,
|
|
|
- jump: true,
|
|
|
- createName: createName,
|
|
|
- createDate: value['查房时间']?.value,
|
|
|
- createId: createId,
|
|
|
- type: 'category',
|
|
|
- }
|
|
|
- if (fragment != null) {
|
|
|
- pushData.trueCreationTime = fragment?.creationTime
|
|
|
- }
|
|
|
- courseTitles.push(pushData);
|
|
|
- if (emrConfig.value.editor) {
|
|
|
- let editorCode = value['编辑者']?.value[0]?.code;
|
|
|
- if (editorCode) {
|
|
|
- if (departmentQualityController()) {
|
|
|
- node.view.setReadonly(false);
|
|
|
- node.view.setDeletable(false);
|
|
|
- return
|
|
|
- }
|
|
|
- // 只有自己可以删除自己创建的片段
|
|
|
- if (editorCode === loginUserCode) {
|
|
|
- node.view.setReadonly(false);
|
|
|
- node.view.setDeletable(true);
|
|
|
- } else if (doctorLevel === 1) {
|
|
|
- if (editorCode !== loginUserCode) {
|
|
|
- node.view.setReadonly(true);
|
|
|
- node.view.setDeletable(false);
|
|
|
- } else {
|
|
|
- node.view.setReadonly(false);
|
|
|
- node.view.setDeletable(false);
|
|
|
- }
|
|
|
- } else if (doctorLevel === 2) {
|
|
|
- if (editorCode === extractFields('主任医生编码')) {
|
|
|
- node.view.setReadonly(true);
|
|
|
- node.view.setDeletable(false);
|
|
|
- } else {
|
|
|
- node.view.setReadonly(false);
|
|
|
- node.view.setDeletable(false);
|
|
|
- }
|
|
|
- } else if (doctorLevel === 3) {
|
|
|
- node.view.setReadonly(false);
|
|
|
- node.view.setDeletable(false);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
+ if (XEUtils.isEmpty(documentId)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let courseTitles = [];
|
|
|
+ 循环病程返回数据元((value, node) => {
|
|
|
+ let fragment = node.getAttribute('fragment')
|
|
|
+ let pushData = {
|
|
|
+ code: '查房时间',
|
|
|
+ name: value['查房标题']?.value,
|
|
|
+ value: value['查房时间']?.value,
|
|
|
+ emrDocumentId: documentId,
|
|
|
+ emrCategoryCode: categoryCode,
|
|
|
+ jump: true,
|
|
|
+ createName: createName,
|
|
|
+ createDate: value['查房时间']?.value,
|
|
|
+ createId: createId,
|
|
|
+ type: 'category',
|
|
|
+ }
|
|
|
+ if (fragment != null) {
|
|
|
+ pushData.trueCreationTime = fragment?.creationTime
|
|
|
+ }
|
|
|
+ courseTitles.push(pushData);
|
|
|
+ if (emrConfig.value.editor) {
|
|
|
+ let editorCode = value['编辑者']?.value[0]?.code;
|
|
|
+ if (XEUtils.isEmpty(editorCode)) {
|
|
|
node.view.setReadonly(true);
|
|
|
node.view.setDeletable(false);
|
|
|
+ } else {
|
|
|
+ let isEdit = emrEditCreateLimit.isEdit(editorCode)
|
|
|
+ if (isEdit) {
|
|
|
+ node.view.setReadonly(false);
|
|
|
+ // 自己创建的病历片段才可以删除
|
|
|
+ node.view.setDeletable(editorCode === userData.code);
|
|
|
+ } else {
|
|
|
+ node.view.setReadonly(true);
|
|
|
+ node.view.setDeletable(false);
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
- emrSidebarRef.value.diseaseDurationRecordTime(documentId, courseTitles);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ node.view.setReadonly(true);
|
|
|
+ node.view.setDeletable(false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ emrSidebarRef.value.diseaseDurationRecordTime(documentId, courseTitles);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1335,12 +1289,8 @@ const readonlyPattern = () => {
|
|
|
// 判断 一级 二级 三级医生
|
|
|
let doctorLevel = $ref(1);
|
|
|
const doctorLevelFunc = () => {
|
|
|
- doctorLevel = grade(userData.code)
|
|
|
- createLevel = grade(createId)
|
|
|
-}
|
|
|
-
|
|
|
-const departmentQualityController = () => {
|
|
|
- return userData.code === props.huanZheXinXi.zkys
|
|
|
+ doctorLevel = emrEditCreateLimit.getDoctorLevelById(userData.code)
|
|
|
+ createLevel = emrEditCreateLimit.getDoctorLevelById(createId)
|
|
|
}
|
|
|
|
|
|
function grade(userCode) {
|
|
|
@@ -1637,6 +1587,9 @@ const saveDocumentId = ref()
|
|
|
|
|
|
const visibility = useDocumentVisibility()
|
|
|
|
|
|
+// 创建和编辑病历
|
|
|
+let emrEditCreateLimit = new EmrEditCreateLimit(props.huanZheXinXi, userData)
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
pageIsZoom()
|
|
|
autoSave = store.state.app.emrAutosave;
|
|
|
@@ -1661,6 +1614,7 @@ onMounted(async () => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+
|
|
|
autoSaveFunc()
|
|
|
|
|
|
emrMitt.on('editor', () => {
|
|
|
@@ -1799,6 +1753,10 @@ const 解析病程记录 = () => {
|
|
|
saveDialog.close()
|
|
|
BizException(ExceptionEnum.MESSAGE_ERROR, '片段中存在异常查房时间,请检查。')
|
|
|
}
|
|
|
+ if (XEUtils.isEmpty(data.createId)) {
|
|
|
+ data.createId = listNull('编辑者')
|
|
|
+ }
|
|
|
+
|
|
|
node.view.setAttribute('fragment', data)
|
|
|
fragment.push(data)
|
|
|
})
|
|
|
@@ -1866,6 +1824,101 @@ function changeRatio() {
|
|
|
return ratio;
|
|
|
}
|
|
|
|
|
|
+let backToQC = {
|
|
|
+ "id": 1,
|
|
|
+ "name": "",
|
|
|
+ "code": "",
|
|
|
+ "thePromptWasNotCreated": "",
|
|
|
+ "editThePromptStatement": "",
|
|
|
+ "level1DoctorCreatesATimeLimit": 0,
|
|
|
+ "level1DoctorEditingTimeLimit": 0,
|
|
|
+ "theSeniorDoctorCreatesATimeLimit": 0,
|
|
|
+ "sqlId": 0,
|
|
|
+ "sql": "",
|
|
|
+ "sqlName": "",
|
|
|
+ "open": 1,
|
|
|
+ "timeSubtracts": 74
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 现在有两个特殊病历
|
|
|
+ * 入院病历需要填写补充诊断
|
|
|
+ * 病程记录锁住
|
|
|
+ */
|
|
|
+const 判断可否创建或编辑 = async () => {
|
|
|
+ backToQC = null
|
|
|
+ 规则不可编辑 = false
|
|
|
+ if (typeof props.huanZheXinXi.dischargeDays !== 'undefined'
|
|
|
+ && props.huanZheXinXi.dischargeDays > 7) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ code: categoryCode,
|
|
|
+ documentId,
|
|
|
+ patNo: props.huanZheXinXi.inpatientNo,
|
|
|
+ times: props.huanZheXinXi.admissTimes,
|
|
|
+ userCode: userData.code
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ backToQC = await createAnEdit(data)
|
|
|
+ if (stringIsBlank(documentId)) {
|
|
|
+ 可否创建()
|
|
|
+ } else {
|
|
|
+ 可否编辑()
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const 可否创建 = () => {
|
|
|
+ if (backToQC === null) return
|
|
|
+ let 时限 = doctorLevel === 1 ? backToQC.level1DoctorCreatesATimeLimit : backToQC.theSeniorDoctorCreatesATimeLimit;
|
|
|
+ if (backToQC.timeSubtracts > 时限) {
|
|
|
+ let str = `<span style="color: red">${backToQC.thePromptWasNotCreated}</span>
|
|
|
+ 医务部通过审核后,方可创建病历。`
|
|
|
+ ElMessageBox.prompt(str, '提示', {
|
|
|
+ type: "warning",
|
|
|
+ closeOnPressEscape: false,
|
|
|
+ closeOnClickModal: false,
|
|
|
+ inputValidator: (val) => {
|
|
|
+ if (XEUtils.isEmpty(val)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (val === null || val.length < 1 || val.length > 50) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
+ inputErrorMessage: '不能为空,最多可输入50个字符。',
|
|
|
+ }).then(({value}) => {
|
|
|
+ let data = {
|
|
|
+ inputRemark: value,
|
|
|
+ code: categoryCode,
|
|
|
+ patNo: props.huanZheXinXi.inpatientNo,
|
|
|
+ times: props.huanZheXinXi.admissTimes,
|
|
|
+ flag: 0
|
|
|
+ }
|
|
|
+ reqUnlock(data)
|
|
|
+ }).catch(() => {
|
|
|
+
|
|
|
+ }).finally(() => {
|
|
|
+ emptyEditor()
|
|
|
+ })
|
|
|
+ throw new Error('')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+let 规则不可编辑 = false
|
|
|
+const 可否编辑 = () => {
|
|
|
+ if (backToQC === null) return
|
|
|
+ if (doctorLevel === 1) {
|
|
|
+ let 时限 = backToQC.level1DoctorEditingTimeLimit
|
|
|
+ if (backToQC.timeSubtracts > 时限) {
|
|
|
+ 规则不可编辑 = true
|
|
|
+ ElMessage.error(backToQC.editThePromptStatement)
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
defineExpose({
|
|
|
closeBothSides,
|