|  | @@ -60,12 +60,13 @@ import {
 | 
	
		
			
				|  |  |    courseOfDisease,
 | 
	
		
			
				|  |  |    EMRInteractive
 | 
	
		
			
				|  |  |  } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-init";
 | 
	
		
			
				|  |  | -import {ElMessageBox} from "element-plus";
 | 
	
		
			
				|  |  | +import {ElMessage, ElMessageBox} from "element-plus";
 | 
	
		
			
				|  |  |  import {uuid} from "@/utils/getUuid";
 | 
	
		
			
				|  |  |  import {BizException, ExceptionEnum} from "@/utils/BizException";
 | 
	
		
			
				|  |  |  import router from '@/router'
 | 
	
		
			
				|  |  |  import EmrSnippet from "@/components/zhu-yuan-yi-sheng/emr/EmrSnippet.vue";
 | 
	
		
			
				|  |  |  import store from "@/store";
 | 
	
		
			
				|  |  | +import {existCourseRecord} from "@/api/zhu-yuan-yi-sheng/emr-patient";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  const emit = defineEmits(['refreshPage'])
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -99,7 +100,7 @@ const updateCaseHistoryUrl = (val) => {
 | 
	
		
			
				|  |  |    isEditorChange = false
 | 
	
		
			
				|  |  |    documentId = val.emrDocumentId;
 | 
	
		
			
				|  |  |    categoryCode = valCode
 | 
	
		
			
				|  |  | -  templateName = val.emrName ? val.emrName : val.name
 | 
	
		
			
				|  |  | +  templateName = val.name
 | 
	
		
			
				|  |  |    caseHistoryUrl = `/emr/runtime/?documentId=${documentId}&categoryCode=${categoryCode}&categroyId=${categroyId}&patientId=${patientId}#/`
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -110,7 +111,11 @@ const refreshPage = () => {
 | 
	
		
			
				|  |  |    })
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -const clickSaveData = () => {
 | 
	
		
			
				|  |  | +const clickSaveData = async () => {
 | 
	
		
			
				|  |  | +  let flag = await existCourseRecord(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes)
 | 
	
		
			
				|  |  | +  if (flag && !documentId && categoryCode === courseOfDisease) {
 | 
	
		
			
				|  |  | +    BizException(ExceptionEnum.MESSAGE_ERROR, '该患者已经存在病程记录,请勿填写.')
 | 
	
		
			
				|  |  | +  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    waitForLoadingToComplete()
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -132,6 +137,7 @@ const clickSaveData = () => {
 | 
	
		
			
				|  |  |      data.name = value
 | 
	
		
			
				|  |  |      await currentEmr.value.saveDocument(data, () => {
 | 
	
		
			
				|  |  |        isEditorChange = false
 | 
	
		
			
				|  |  | +      emrSidebarRef.queryData()
 | 
	
		
			
				|  |  |      }, (err) => {
 | 
	
		
			
				|  |  |        documentId = err
 | 
	
		
			
				|  |  |        isEditorChange = true
 | 
	
	
		
			
				|  | @@ -170,10 +176,12 @@ const clickDelete = () => {
 | 
	
		
			
				|  |  |    ElMessageBox.alert('是否要删除该模板。', '提示', {
 | 
	
		
			
				|  |  |      type: 'warning'
 | 
	
		
			
				|  |  |    }).then(() => {
 | 
	
		
			
				|  |  | -    currentEmr.value.deleteDocument(documentId, function () {
 | 
	
		
			
				|  |  | -      emrSidebarRef.deleteTheSpecifiedNode(documentId)
 | 
	
		
			
				|  |  | -      nodeClick({}, 2)
 | 
	
		
			
				|  |  | -    });
 | 
	
		
			
				|  |  | +    emrSidebarRef.deleteTheSpecifiedNode(documentId)
 | 
	
		
			
				|  |  | +    nodeClick({}, 2)
 | 
	
		
			
				|  |  | +    // currentEmr.value.deleteDocument(documentId, function () {
 | 
	
		
			
				|  |  | +    //   emrSidebarRef.deleteTheSpecifiedNode(documentId)
 | 
	
		
			
				|  |  | +    //   nodeClick({}, 2)
 | 
	
		
			
				|  |  | +    // });
 | 
	
		
			
				|  |  |    }).catch(() => {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |    })
 |