| 
					
				 | 
			
			
				@@ -23,8 +23,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <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"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      </el-switch> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 inactive-color="#13ce66" inactive-text="开启审阅" :inactive-value="true"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <span style="color: red;margin-left: 10px">{{ currentMode() }}</span> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-header> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <el-container> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -90,6 +91,9 @@ const props = defineProps({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   editor: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     type: Boolean, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     default: true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  visitor: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    type: Boolean 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -110,9 +114,7 @@ let openAssistant = $ref({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 编辑器 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-let editor = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 患者历史记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-let tempTimes = $ref(props.huanZheXinXi.admissTimes) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+let editor = $ref(null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 侧边栏 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const emrSidebarRef = ref(null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 片段预览 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -134,8 +136,18 @@ let jumpPositioning = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 创建人 id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 let createId = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const currentMode = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  return editor?.getEditorMode() === 'readonly' ? '只读' : '编辑' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+// 点击保存病历 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const clickSaveData = async () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  // 只读模式无法保存数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (editor !== null && editor.getEditorMode() === 'readonly') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    BizException(ExceptionEnum.LOGICAL_ERROR, "无法保存病历。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   waitForLoadingToComplete() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   let data = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 这个是 唯一 id 调用服务的雪花算法 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -226,12 +238,11 @@ const servicePrint = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 点击删除数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const clickDelete = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (editor !== null && editor.getEditorMode() === 'readonly') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    BizException(ExceptionEnum.LOGICAL_ERROR, "无法删除病历。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   waitForLoadingToComplete() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   whetherThereIsAMedicalRecordId() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // deletePatientEmrByDocumentId(documentId).then(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ElMessageBox.alert('是否要删除该模板。', '提示', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     type: 'warning' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }).then(() => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -273,6 +284,9 @@ const checkEmrChange = (cb) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const nodeClick = (val, jumpOrNot, templateType) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   createId = val.createId ? val.createId : null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (props.huanZheXinXi.smallDept !== userData.deptCode && createId === null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    BizException(ExceptionEnum.LOGICAL_ERROR, "无法创建病历,患者不属于您的科室") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (jumpOrNot) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (val.documentId === documentId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       positioningTime(val.value, val.code) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -339,8 +353,10 @@ const monitorPageRefresh = (event) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @param styles 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const clickSnippet = ({content, styles}) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  currentEmr.value.callMethod('setCursor', 'AREA_END') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  currentEmr.value.insertSnippet(content, styles, patientData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  if (editor !== null && editor.getEditorMode() !== 'readonly') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    currentEmr.value.callMethod('setCursor', 'AREA_END') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    currentEmr.value.insertSnippet(content, styles, patientData) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // 用户信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -357,6 +373,7 @@ const getCurrentPersonnelInformation = (data) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   patientData['编辑者科室'] = [{code: userData.deptCode, name: userData.deptName}] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   patientData['编辑者科室编码'] = userData.deptCode 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   patientData['编辑者科室名称'] = userData.deptName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   patientData.user_token = userData.token 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -378,10 +395,6 @@ const emrEvent = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       emrSidebarRef.value.changeTemplateType(2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  'insertFragment': (evt, view, nodes, fragment, defaultData) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 片段插入就会执行这个方法 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -390,14 +403,16 @@ const setEditorModeFun = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   if (props.editor) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 设置成编辑模式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     currentEmr.value.callMethod('setEditorMode', 'free') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // 创建人不是自己就只能看 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (createId !== null && createId !== userData.code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (categoryCode.includes('shoucibingchengjilu')) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 如果是病程记录就不用锁住,因为要根据片段锁住 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      currentEmr.value.callMethod('setEditorMode', 'free') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else if (createId !== null && createId !== userData.code) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 创建人不是自己就只能看 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       currentEmr.value.callMethod('setEditorMode', 'readonly') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     currentEmr.value.callMethod('setEditorMode', 'readonly') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -489,12 +504,7 @@ const reQueryPatientInformation = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  *  撤销或者重做 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const clickUndo = (val) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    editor.execute(val) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } catch (e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  editor.execute(val) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 |