Browse Source

不能重复添加病程记录,和一些优化

DESKTOP-MINPJAU\Administrator 3 years ago
parent
commit
1754fbdf63

+ 9 - 0
src/api/zhu-yuan-yi-sheng/emr-patient.js

@@ -25,3 +25,12 @@ export function deletePatientEmrByDocumentId(documentId) {
         params: {documentId}
     })
 }
+
+export function existCourseRecord(patNo, times) {
+    return request({
+        url: url + 'existCourseRecord',
+        method: 'get',
+        params: {patNo, times}
+    })
+}
+

+ 37 - 13
src/components/zhu-yuan-yi-sheng/emr/EmrSidebar.vue

@@ -12,6 +12,19 @@
            ref="treeRef"
            :filter-node-method="filterNode"
            default-expand-all>
+    <template #default="{ node, data }">
+      <span v-if="templateType === 2">
+        <span v-if="data.children">
+        {{ data.name }}
+        </span>
+        <span v-else>
+        {{ data.name }}/{{ data.modifyDate ? data.modifyDate : data.createDate }}
+        </span>
+      </span>
+      <span v-else>
+        {{ data.name }}
+      </span>
+    </template>
   </el-tree>
 </template>
 
@@ -40,8 +53,6 @@ let templateType = $ref(0)
 const handleNodeClick = (val, property, event) => {
   let str = JSON.stringify(val)
   if (val.roundTime) {
-    console.log(val, property, event)
-    console.log(property.parent.data)
     emit('nodeClick', val, property.parent.data, templateType);
   } else {
     if (key !== str) {
@@ -91,11 +102,19 @@ const deleteTheSpecifiedNode = (id) => {
       returnData.patientTree.splice(i, 1)
       return
     }
+    if (item.children) {
+      for (let j = 0; j < item.children.length; j++) {
+        let child = item.children[j]
+        if (child.emrDocumentId === id) {
+          item.children.splice(i, 1)
+          return
+        }
+      }
+    }
   }
 }
 
 const diseaseDurationRecordTime = ({ward_round_time}) => {
-  console.log(ward_round_time)
   if (ward_round_time) {
     let roundTimes = []
     for (let i = 0; i < ward_round_time.length; i++) {
@@ -114,24 +133,29 @@ const diseaseDurationRecordTime = ({ward_round_time}) => {
   }
 }
 
+const queryData = () => {
+  getEmrTree(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes).then((res) => {
+    if (res.patientTree) {
+      treeData = res.patientTree
+      templateType = 2
+    } else {
+      treeData = res.emrTree
+    }
+    returnData = res
+  })
+}
+
 defineExpose({
   queryHistory,
   changeTemplateType,
   deleteTheSpecifiedNode,
-  diseaseDurationRecordTime
+  diseaseDurationRecordTime,
+  queryData
 })
 
 onMounted(() => {
   nextTick(() => {
-    getEmrTree(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes).then((res) => {
-      if (res.patientTree) {
-        treeData = res.patientTree
-        templateType = 2
-      } else {
-        treeData = res.emrTree
-      }
-      returnData = res
-    })
+    queryData()
   })
 })
 

+ 2 - 1
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-init.js

@@ -1,6 +1,6 @@
 import {ElMessage, ElMessageBox} from "element-plus";
 import {BizException, ExceptionEnum} from "@/utils/BizException";
-import {deletePatientEmrByDocumentId, insertEmrData} from "@/api/zhu-yuan-yi-sheng/emr-patient";
+import {deletePatientEmrByDocumentId, existCourseRecord, insertEmrData} from "@/api/zhu-yuan-yi-sheng/emr-patient";
 
 export let courseOfDisease = 'bingchengjiluzhuanyong'
 
@@ -67,6 +67,7 @@ export function EMRInteractive(data, endiorEvent) {
             BizException(ExceptionEnum.MESSAGE_ERROR, "没有通过校验")
         }
 
+
         this.runtime.saveDocument(data, (res) => {
             insertEmrData(value).then(() => {
                 successfullySaved()

+ 15 - 7
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/index.vue

@@ -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(() => {
 
   })