Kaynağa Gözat

电子病历查看历史数据

xiaochan 2 yıl önce
ebeveyn
işleme
145ffdcb02

+ 7 - 1
src/api/zhu-yuan-yi-sheng/emr-patient.js

@@ -305,5 +305,11 @@ export function electronicMedicalRecordSequencing(data) {
 }
 
 
-
+export function getPastHistory(patNo, times) {
+    return request({
+        url: url + '/getPastHistory',
+        method: 'get',
+        params: {patNo, times}
+    })
+}
 

+ 1 - 0
src/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru.js

@@ -278,3 +278,4 @@ export function doctorAuthorizationLogin(data) {
     })
 }
 
+

+ 356 - 319
src/components/zhu-yuan-yi-sheng/emr/EmrSidebar.vue

@@ -1,59 +1,71 @@
 <template>
-    <div style="width: 215px">
-        <el-input v-model="filterText"
-                  placeholder="节点过滤"
-                  style="width: 100%"
-                  @input="filterChange" clearable/>
-        <el-radio-group v-model="templateType" @change="typeChange">
-            <el-radio-button :disabled="!editor" :label="0">全院模板</el-radio-button>
-            <el-radio-button :disabled="!editor" :label="1">科室模板</el-radio-button>
-            <el-radio-button :label="2">患者数据</el-radio-button>
-        </el-radio-group>
-        <div :style="{maxHeight : maxHeight - 100 + 'px'}"
-             style="overflow: auto; "
-             class="down-tree">
-            <el-tree :data="treeData"
-                     :props="defaultProps"
-                     @node-click="handleNodeClick"
-                     node-key="_id"
-                     ref="treeRef"
-                     draggable
-                     @node-drag-end="dragEnd"
-                     :allow-drag="allowDrag"
-                     :allow-drop="dragLimit"
-                     @node-contextmenu="contextmenuItem"
-                     highlight-current
-                     :filter-node-method="filterNode"
-                     default-expand-all>
-                <template #default="{ node, data }">
-                    <el-icon v-if="data.submit">
-                        <Lock/>
-                    </el-icon>
-                    <component :is="isItAFolder(data)"/>
-                    <span :title="fileName(data)">
+  <div style="width: 215px">
+    <el-input v-model="filterText"
+              placeholder="节点过滤"
+              style="width: 100%"
+              @input="filterChange" clearable/>
+    <el-radio-group v-model="templateType" @change="typeChange">
+      <el-radio-button :disabled="!editor" :label="0">全院</el-radio-button>
+      <el-radio-button :disabled="!editor" :label="1">科室</el-radio-button>
+      <el-radio-button :label="2">当前</el-radio-button>
+      <el-radio-button :label="3">历史</el-radio-button>
+    </el-radio-group>
+    <div :style="{maxHeight : maxHeight - 100 + 'px'}"
+         style="overflow: auto; "
+         class="down-tree">
+      <el-tree v-show="templateType === 3"
+               :props="defaultProps"
+               ref="hisTreeRef"
+               :filter-node-method="filterNode"
+               :data="hisData"
+               @node-click="hisClick">
+
+      </el-tree>
+      <el-tree v-show="templateType !== 3"
+               :data="treeData"
+               :props="defaultProps"
+               @node-click="handleNodeClick"
+               node-key="_id"
+               ref="treeRef"
+               draggable
+               @node-drag-end="dragEnd"
+               :allow-drag="allowDrag"
+               :allow-drop="dragLimit"
+               @node-contextmenu="contextmenuItem"
+               highlight-current
+               :filter-node-method="filterNode"
+               default-expand-all>
+        <template #default="{ node, data }">
+          <el-icon v-if="data.submit">
+            <Lock/>
+          </el-icon>
+          <component :is="isItAFolder(data)"/>
+          <span :title="fileName(data)">
                {{ fileName(data) }}
           </span>
-                </template>
-            </el-tree>
-        </div>
-        <right-click-menu :mouse-position="mousePosition" :config="opt"/>
+        </template>
+      </el-tree>
+
+
     </div>
+    <right-click-menu :mouse-position="mousePosition" :config="opt"/>
+  </div>
 </template>
 
 <script setup name='EmrSidebar'>
 import {
-    electronicMedicalRecordSequencing,
-    getEmrTree,
-    getPatientDataTree,
-    queryWhetherThePatientHasASpecifiedMedicalRecord,
-    whetherItExistsInTheDepartment
+  electronicMedicalRecordSequencing,
+  getEmrTree, getPastHistory,
+  getPatientDataTree,
+  queryWhetherThePatientHasASpecifiedMedicalRecord,
+  whetherItExistsInTheDepartment
 } from "@/api/zhu-yuan-yi-sheng/emr-patient";
 import {BizException, ExceptionEnum} from "@/utils/BizException";
 import {
-    canIUnlockIt,
-    emrConfig,
-    emrMitt,
-    unlockEnum
+  canIUnlockIt,
+  emrConfig,
+  emrMitt,
+  unlockEnum
 } from '@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init'
 import {stringIsBlank} from "@/utils/blank-utils";
 import {getAllWards} from "@/api/zhu-yuan-yi-sheng/resident-doctor";
@@ -64,21 +76,21 @@ import {ElIcon} from "element-plus";
 import {Folder, Document, Open, Sort} from "@element-plus/icons-vue";
 
 const props = defineProps({
-    maxHeight: {
-        type: Number
-    },
-    huanZheXinXi: {
-        type: Object
-    },
-    patientData: {
-        type: Object
-    },
-    extractData: {
-        type: Object
-    },
-    doctorGrade: {
-        type: Number
-    }
+  maxHeight: {
+    type: Number
+  },
+  huanZheXinXi: {
+    type: Object
+  },
+  patientData: {
+    type: Object
+  },
+  extractData: {
+    type: Object
+  },
+  doctorGrade: {
+    type: Number
+  }
 })
 
 let editor = emrConfig.value.editor
@@ -86,9 +98,9 @@ let editor = emrConfig.value.editor
 const emit = defineEmits(['nodeClick', 'typeChange', 'patientMedicalRecord', 'openAndSaveTheMedicalRecord'])
 
 let returnData = $ref({
-    emrTree: [],
-    dept: [],
-    patientTree: []
+  emrTree: [],
+  dept: [],
+  patientTree: []
 })
 let filterText = $ref('')
 let treeRef = $ref('')
@@ -97,8 +109,8 @@ let dialog = $ref(false)
 let wardList = []
 
 const defaultProps = {
-    children: 'children',
-    label: 'name',
+  children: 'children',
+  label: 'name',
 }
 
 let templateType = $ref(0)
@@ -106,345 +118,370 @@ let templateType = $ref(0)
 let userData = store.state.user.info
 
 const treeData = computed(() => {
-    switch (templateType) {
-        case 0 :
-            return returnData.emrTree;
-        case 1:
-            return returnData.deptTree;
-        case 2:
-            return returnData.patientTree;
-    }
+  switch (templateType) {
+    case 0 :
+      return returnData.emrTree;
+    case 1:
+      return returnData.deptTree;
+    case 2:
+      return returnData.patientTree;
+  }
 })
 
 const wardCreationJudgment = async () => {
-    if (determineWhetherItCanBeCreated()) {
-        return
-    }
-    if (await judgeTheCreationOfTransfer()) {
-        return;
-    }
-    if (canIUnlockIt(unlockEnum.转科创建病历)) {
-        return;
-    }
-    BizException(ExceptionEnum.MESSAGE_ERROR, "当前患者所在病区不在您的管理病区范围内,无法创建病历。");
+  if (determineWhetherItCanBeCreated()) {
+    return
+  }
+  if (await judgeTheCreationOfTransfer()) {
+    return;
+  }
+  if (canIUnlockIt(unlockEnum.转科创建病历)) {
+    return;
+  }
+  BizException(ExceptionEnum.MESSAGE_ERROR, "当前患者所在病区不在您的管理病区范围内,无法创建病历。");
 }
 
 const handleNodeClick = async (val, node, parent, event) => {
-    if (val.type === 'group-category') return
-    let temp = {}
-    if (templateType === 0 || templateType === 1) {
-        temp = {
-            documentId: null,
-            categoryCode: val.code,
-            categoryId: val._id,
-            patientId: null,
-            name: val.name,
-            createId: null,
-            parent: val.parent,
-        }
-        await wardCreationJudgment()
-    } else if (templateType === 2) {
-        temp = {
-            documentId: val.emrDocumentId,
-            categoryCode: val.emrCategoryCode,
-            categoryId: null,
-            patientId: null,
-            name: val.name ? val.name : val.emrName,
-            createId: val.createId,
-            createName: val.createName
-        }
-
-
-        if (val.jump) {
-            let tempVal = node.parent.data
-            emrMitt.emit('audit', {
-                id: tempVal.id,
-                code: tempVal.emrCategoryCode,
-                createId: tempVal.createId,
-                referPhysician: props.huanZheXinXi.referPhysician,
-                patNo: props.huanZheXinXi.inpatientNo,
-                times: props.huanZheXinXi.admissTimes
-            });
-        } else {
-            emrMitt.emit('audit', {
-                id: val.id,
-                code: val.emrCategoryCode,
-                createId: val.createId,
-                referPhysician: props.huanZheXinXi.referPhysician,
-                patNo: props.huanZheXinXi.inpatientNo,
-                times: props.huanZheXinXi.admissTimes
-            });
-        }
-
+  if (val.type === 'group-category') return
+  let temp = {}
+  if (templateType === 0 || templateType === 1) {
+    temp = {
+      documentId: null,
+      categoryCode: val.code,
+      categoryId: val._id,
+      patientId: null,
+      name: val.name,
+      createId: null,
+      parent: val.parent,
     }
-    if (val.children) {
-        return
-    }
-    if (val.labels) {
-        // 根据 这个编码来限制是不是唯一一个
-        if (val.labels.includes('唯一') && templateType !== 2) {
-            let flag = await queryWhetherThePatientHasASpecifiedMedicalRecord({
-                patNo: props.huanZheXinXi.inpatientNo,
-                times: props.huanZheXinXi.admissTimes,
-                emrCategoryCode: val.code
-            })
-            if (flag) {
-                BizException(ExceptionEnum.LOGICAL_ERROR, '此病历只能创建一次。')
-            }
-        }
+    await wardCreationJudgment()
+  } else if (templateType === 2) {
+    temp = {
+      documentId: val.emrDocumentId,
+      categoryCode: val.emrCategoryCode,
+      categoryId: null,
+      patientId: null,
+      name: val.name ? val.name : val.emrName,
+      createId: val.createId,
+      createName: val.createName
     }
+
+
     if (val.jump) {
-        temp.code = val.code
-        temp.value = val.value
-        emit('nodeClick', temp, true, templateType);
+      let tempVal = node.parent.data
+      emrMitt.emit('audit', {
+        id: tempVal.id,
+        code: tempVal.emrCategoryCode,
+        createId: tempVal.createId,
+        referPhysician: props.huanZheXinXi.referPhysician,
+        patNo: props.huanZheXinXi.inpatientNo,
+        times: props.huanZheXinXi.admissTimes
+      });
     } else {
-        emit('nodeClick', temp, false, templateType);
+      emrMitt.emit('audit', {
+        id: val.id,
+        code: val.emrCategoryCode,
+        createId: val.createId,
+        referPhysician: props.huanZheXinXi.referPhysician,
+        patNo: props.huanZheXinXi.inpatientNo,
+        times: props.huanZheXinXi.admissTimes
+      });
     }
+
+  }
+  if (val.children) {
+    return
+  }
+  if (val.labels) {
+    // 根据 这个编码来限制是不是唯一一个
+    if (val.labels.includes('唯一') && templateType !== 2) {
+      let flag = await queryWhetherThePatientHasASpecifiedMedicalRecord({
+        patNo: props.huanZheXinXi.inpatientNo,
+        times: props.huanZheXinXi.admissTimes,
+        emrCategoryCode: val.code
+      })
+      if (flag) {
+        BizException(ExceptionEnum.LOGICAL_ERROR, '此病历只能创建一次。')
+      }
+    }
+  }
+  if (val.jump) {
+    temp.code = val.code
+    temp.value = val.value
+    emit('nodeClick', temp, true, templateType);
+  } else {
+    emit('nodeClick', temp, false, templateType);
+  }
 }
 
 const determineWhetherItCanBeCreated = () => {
-    if (userData.code === props.patientData['管床医生编码'] || props.doctorGrade > 1) {
-        return true;
-    }
-    return wardList.includes(props.huanZheXinXi.ward);
+  if (userData.code === props.patientData['管床医生编码'] || props.doctorGrade > 1) {
+    return true;
+  }
+  return wardList.includes(props.huanZheXinXi.ward);
 }
 
 const judgeTheCreationOfTransfer = async () => {
-    let res = await whetherItExistsInTheDepartment(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes);
-    if (res === null) {
-        return false;
-    }
-    if (res.timeout) {
-        return false;
-    }
-    return wardList.includes(res.fDeptCode);
+  let res = await whetherItExistsInTheDepartment(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes);
+  if (res === null) {
+    return false;
+  }
+  if (res.timeout) {
+    return false;
+  }
+  return wardList.includes(res.fDeptCode);
 }
 
 const typeChange = (val) => {
-    emit("typeChange", val)
+  emit("typeChange", val)
 }
 
 const filterChange = (val) => {
-    treeRef.filter(val)
+  if (templateType === 3) {
+    hisTreeRef.value.filter(val)
+  } else {
+    treeRef.filter(val);
+  }
 }
 
 const filterNode = (value, data) => {
-    if (!value) return true
-    return data.name.includes(value)
+  if (!value) return true
+  return data.name.includes(value)
 }
 
 const changeTemplateType = (val) => {
-    templateType = val
-    typeChange(val)
+  templateType = val
+  typeChange(val)
 }
 
 const deleteTheSpecifiedNode = (id) => {
-    for (let i = 0, len = returnData.patientTree.length; i < len; i++) {
-        let item = returnData.patientTree[i]
-        if (item.emrDocumentId === 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
-                }
-            }
+  for (let i = 0, len = returnData.patientTree.length; i < len; i++) {
+    let item = returnData.patientTree[i]
+    if (item.emrDocumentId === 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
         }
+      }
     }
+  }
 }
 
 let findNode = false
 const diseaseDurationRecordTime = (id, list) => {
-    findNode = false;
-    findMedicalRecordById(id, list, returnData.patientTree);
+  findNode = false;
+  findMedicalRecordById(id, list, returnData.patientTree);
 }
 
 const findMedicalRecordById = (id, roundTimes, list) => {
-    for (let i = 0, len = list.length; i < len; i++) {
-        if (findNode) return;
-        let item = list[i]
-        if (item.emrDocumentId === id) {
-            findNode = true
-            item.type = 'group-category'
-            item.children = roundTimes
-            return
-        }
-
-        if (item.children) {
-            findMedicalRecordById(id, roundTimes, item.children)
-        }
+  for (let i = 0, len = list.length; i < len; i++) {
+    if (findNode) return;
+    let item = list[i]
+    if (item.emrDocumentId === id) {
+      findNode = true
+      item.type = 'group-category'
+      item.children = roundTimes
+      return
+    }
 
+    if (item.children) {
+      findMedicalRecordById(id, roundTimes, item.children)
     }
+
+  }
 }
 
 const queryData = () => {
-    getPatientDataTree(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes).then((res) => {
-        if (res?.length > 0) {
-            templateType = 2
-            emit('patientMedicalRecord')
-        }
-        returnData.patientTree = res
-    })
+  getPatientDataTree(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes).then((res) => {
+    if (res?.length > 0) {
+      templateType = 2
+      emit('patientMedicalRecord')
+    }
+    returnData.patientTree = res
+  })
 }
 
-const fileName = (val) => {
-    if (val.jump) {
-        let tempDate = val.trueCreationTime
-        if (!tempDate) {
-            tempDate = val.createDate
-        }
-        return val.name + nullToEmpty(val.createName) + nullToEmpty(tempDate)
+const hisData = ref([])
+const hisTreeRef = ref(null)
+const pastHistory = () => {
+  getPastHistory(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes).then((res) => {
+    let temp = []
+    for (let key in res) {
+      temp.push({
+        name: `第${key}次住院`,
+        children: res[key]
+      })
     }
-    if (templateType === 2) {
-        return val.name + nullToEmpty(val.createName) + nullToEmpty(val.createDate)
-    } else {
-        return val.name
+    hisData.value = temp
+  })
+}
+
+const hisClick = (val) => {
+  if (!val.emrDocumentId) return
+  emrMitt.emit('setShowIframe', 3, val.emrDocumentId)
+}
+
+const fileName = (val) => {
+  if (val.jump) {
+    let tempDate = val.trueCreationTime
+    if (!tempDate) {
+      tempDate = val.createDate
     }
+    return val.name + nullToEmpty(val.createName) + nullToEmpty(tempDate)
+  }
+  if (templateType === 2) {
+    return val.name + nullToEmpty(val.createName) + nullToEmpty(val.createDate)
+  } else {
+    return val.name
+  }
 }
 
 const nullToEmpty = (val) => {
-    return stringIsBlank(val) ? '' : ' \\ ' + val
+  return stringIsBlank(val) ? '' : ' \\ ' + val
 }
 
 const mousePosition = ref()
 const opt = [
-    {
-        name: '打开(只读)', click: (data) => {
-            if (!data.unlock.id) {
-                xcMessage.error('请选中保存的病历。')
-                return
-            }
-            emit('openAndSaveTheMedicalRecord', data.unlock.id)
-        },
-        icon: h(ElIcon, {}, () => h(Open))
+  {
+    name: '打开(只读)', click: (data) => {
+      if (!data.unlock.id) {
+        xcMessage.error('请选中保存的病历。')
+        return
+      }
+      emit('openAndSaveTheMedicalRecord', data.unlock.id)
     },
-    {
-        name: '确认排序', click: (data) => {
-            let temp = []
-            drag.forEach((value, key) => {
-                if (value.newParent !== value.oldParent) {
-                    temp.push({id: key, parent: value.newParent})
-                }
-            })
-            if (temp.length === 0) {
-                drag.clear()
-                return xcMessage.error('文件夹没有变化,无需点击。')
-            }
-            electronicMedicalRecordSequencing(temp).then(() => {
-                drag.clear()
-            })
-        },
-        validator: () => {
-            return drag.size > 0
-        },
-        icon: h(ElIcon, {}, () => h(Sort))
-    }
+    icon: h(ElIcon, {}, () => h(Open))
+  },
+  {
+    name: '确认排序', click: (data) => {
+      let temp = []
+      drag.forEach((value, key) => {
+        if (value.newParent !== value.oldParent) {
+          temp.push({id: key, parent: value.newParent})
+        }
+      })
+      if (temp.length === 0) {
+        drag.clear()
+        return xcMessage.error('文件夹没有变化,无需点击。')
+      }
+      electronicMedicalRecordSequencing(temp).then(() => {
+        drag.clear()
+      })
+    },
+    validator: () => {
+      return drag.size > 0
+    },
+    icon: h(ElIcon, {}, () => h(Sort))
+  }
 ]
 const contextmenuItem = (event, data) => {
-    let tempData;
-    if (data.emrDocumentId) {
-        tempData = {
-            id: data.emrDocumentId,
-            code: data.emrCategoryCode,
-            patNo: data.patNo,
-            times: data.times,
-            name: data.name ? data.name : data.emrName,
-        }
-    } else {
-        tempData = {
-            id: null,
-            code: data.code,
-            patNo: props.huanZheXinXi.inpatientNo,
-            times: props.huanZheXinXi.admissTimes,
-            name: data.name,
-        }
+  let tempData;
+  if (data.emrDocumentId) {
+    tempData = {
+      id: data.emrDocumentId,
+      code: data.emrCategoryCode,
+      patNo: data.patNo,
+      times: data.times,
+      name: data.name ? data.name : data.emrName,
     }
-    event.returnValue = false;
-    mousePosition.value = {
-        event,
-        index: 0,
-        data: {
-            unlock: tempData,
-            original: data
-        }
-    };
+  } else {
+    tempData = {
+      id: null,
+      code: data.code,
+      patNo: props.huanZheXinXi.inpatientNo,
+      times: props.huanZheXinXi.admissTimes,
+      name: data.name,
+    }
+  }
+  event.returnValue = false;
+  mousePosition.value = {
+    event,
+    index: 0,
+    data: {
+      unlock: tempData,
+      original: data
+    }
+  };
 }
 
 const isItAFolder = (data) => {
-    return h(ElIcon, null,
-        {
-            default: () => {
-                if (data.type === 'category') {
-                    return h(Document)
-                } else {
-                    return h(Folder)
-                }
-            }
+  return h(ElIcon, null,
+      {
+        default: () => {
+          if (data.type === 'category') {
+            return h(Document)
+          } else {
+            return h(Folder)
+          }
         }
-    )
+      }
+  )
 }
 
 const dragLimit = (moveNode, inNode, type) => {
-    if (templateType !== 2) return false;
-    if (moveNode.data.jump) return false;
-    if (inNode.data._id && type === 'inner') {
-        return true;
-    }
+  if (templateType !== 2) return false;
+  if (moveNode.data.jump) return false;
+  if (inNode.data._id && type === 'inner') {
+    return true;
+  }
 }
 
 const allowDrag = (node) => {
-    if (templateType !== 2) return false;
-    if (node.data.emrCategoryCode === 'shoucibingchengjilu') {
-        return true;
-    }
-    return node.data.type !== "group-category";
+  if (templateType !== 2) return false;
+  if (node.data.emrCategoryCode === 'shoucibingchengjilu') {
+    return true;
+  }
+  return node.data.type !== "group-category";
 }
 
 let drag = new Map();
 
 const dragEnd = (moveNode, inNode, type, event) => {
-    if (type === 'none') return
-    let temp = {
-        newParent: inNode.data._id,
-        oldParent: moveNode.data.parent
-    }
-    drag.set(moveNode.data.id, temp)
+  if (type === 'none') return
+  let temp = {
+    newParent: inNode.data._id,
+    oldParent: moveNode.data.parent
+  }
+  drag.set(moveNode.data.id, temp)
 }
 
 onMounted(() => {
 
-    emrMitt.on('患者病区判断', () => {
-        return determineWhetherItCanBeCreated()
+  emrMitt.on('患者病区判断', () => {
+    return determineWhetherItCanBeCreated()
+  })
+  pastHistory()
+  queryData()
+  if (editor) {
+    getAllWards().then((res) => {
+      if (res.length > 0) {
+        for (let i = 0, len = res.length; i < len; i++) {
+          wardList.push(res[i].code)
+        }
+      }
     })
-
-    queryData()
-    if (editor) {
-        getAllWards().then((res) => {
-            if (res.length > 0) {
-                for (let i = 0, len = res.length; i < len; i++) {
-                    wardList.push(res[i].code)
-                }
-            }
-        })
-        getEmrTree().then((res) => {
-            returnData.emrTree = res.all
-            returnData.deptTree = res.dept
-        })
-    } else {
-        templateType = 2
-    }
+    getEmrTree().then((res) => {
+      returnData.emrTree = res.all
+      returnData.deptTree = res.dept
+      console.log(returnData.emrTree)
+    })
+  } else {
+    templateType = 2
+  }
 
 })
 
 defineExpose({
-    changeTemplateType,
-    deleteTheSpecifiedNode,
-    diseaseDurationRecordTime,
-    queryData
+  changeTemplateType,
+  deleteTheSpecifiedNode,
+  diseaseDurationRecordTime,
+  queryData
 })
 
 

+ 0 - 1
src/components/zhu-yuan-yi-sheng/jian-cha-shen-qing/TianJiaJianYan.vue

@@ -308,7 +308,6 @@ onMounted(() => {
         isPathology = true
       }
     }
-
     if (isPathology) {
       if (stringIsBlank(extraInformation.reqComment)) {
         error()

+ 6 - 1
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/EmrMain.vue

@@ -763,6 +763,7 @@ const clickSaveData = async () => {
     BizException(ExceptionEnum.MESSAGE_ERROR, "当前为只读模式,无法保存病历。");
   }
   editor = currentEmr.value.getEditor()
+  if (caseHistoryUrl === '/emr/runtime/#/editor') return
   if (editor === null) return
   waitForLoadingToComplete()
   // 判断是否有必填项目
@@ -1641,10 +1642,14 @@ onMounted(async () => {
     return editor
   })
 
-  emrMitt.on('setShowIframe', (val) => {
+  emrMitt.on('setShowIframe', (val, id) => {
     showIframe.value = val
+    if (id) {
+      saveDocumentId.value = `/emr/runtime/?documentId=${id}#/`
+    }
   })
 
+
   watch(() => visibility.value, () => {
     // 离开页面的时候清空定时器
     if (visibility.value === 'hidden' && isEditorChange) {

+ 177 - 177
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrAudit.vue

@@ -1,84 +1,84 @@
 <template>
-    <el-button @click="setAuditClick" v-if="permissions()">发送</el-button>
-    <emr-audit-dialog :emr-id="emrInfo.id"/>
-    <el-table :data="data"
-              :height="getWindowSize.h / 1.1"
-              :expand-row-keys="expandRow"
-              @row-contextmenu="rowContextmenu"
-              ref="elTableRef"
-              row-key="rowId">
-        <el-table-column type="expand">
-            <template #header>
-                <el-button text @click="addAudit">添加</el-button>
-            </template>
-            <template #default="{row}">
-                <div style="width: 100%;padding: 10px">
-                    <table style="width: 100%">
-                        <tr v-if="!permissions()">
-                            <td>
-                                <el-button type="success" @click="rectification(row,1)">已整改</el-button>
-                            </td>
-                            <td>
-                                <el-button type="warning" @click="rectification(row,2)">已知无需整改</el-button>
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>
-                                审核人:{{ row.approverName }}
-                            </td>
-                            <td>
-                                审核时间:{{ row.reviewTime }}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>
-                                修改人:{{ row.modifyPersonName }}
-                            </td>
-                            <td>
-                                修改时间:{{ row.modificationTime }}
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>
-                                状态: {{ row.remediationStatusName }}
-                            </td>
-                        </tr>
-                    </table>
-                </div>
-            </template>
-        </el-table-column>
-        <el-table-column prop="name" label="项目" width="180">
-            <template #default="{row}">
-                <el-input v-model="row.name" :maxlength="100" v-if="row.disposition"/>
-            </template>
-        </el-table-column>
-        <el-table-column prop="scoringCriteriaName" label="等级" width="40">
-            <template #default="{row}">
-                <select v-model="row.scoringCriteria" v-if="row.disposition">
-                    <option v-for="item in scoringCriteriaList"
-                            :key="item.code"
-                            :value="item.code">
-                        {{ item.name }}
-                    </option>
-                </select>
-            </template>
-        </el-table-column>
-        <el-table-column prop="remark" label="备注">
-            <template #default="{row}" v-if="permissions()">
-                <el-input v-model="row.remark" :maxlength="100"></el-input>
-            </template>
-        </el-table-column>
-        <el-table-column prop="numberOfDefects" label="缺陷数">
-            <template #default="{row}" v-if="permissions()">
-                <el-input-number style="width: 40px"
-                                 v-model="row.numberOfDefects"
-                                 :min="1"
-                                 :controls="false"/>
-            </template>
-        </el-table-column>
-        <el-table-column type="selection" v-if="permissions()"/>
-    </el-table>
-    <right-click-menu v-if="!permissions()" :config="opt" :mouse-position="mousePosition"/>
+  <el-button @click="setAuditClick" v-if="permissions()">发送</el-button>
+  <emr-audit-dialog :emr-id="emrInfo.id"/>
+  <el-table :data="data"
+            :height="getWindowSize.h / 1.1"
+            :expand-row-keys="expandRow"
+            @row-contextmenu="rowContextmenu"
+            ref="elTableRef"
+            row-key="rowId">
+    <el-table-column type="expand">
+      <template #header>
+        <el-button text @click="addAudit">添加</el-button>
+      </template>
+      <template #default="{row}">
+        <div style="width: 100%;padding: 10px">
+          <table style="width: 100%">
+            <tr v-if="!permissions()">
+              <td>
+                <el-button type="success" @click="rectification(row,1)">已整改</el-button>
+              </td>
+              <td>
+                <el-button type="warning" @click="rectification(row,2)">已知无需整改</el-button>
+              </td>
+            </tr>
+            <tr>
+              <td>
+                审核人:{{ row.approverName }}
+              </td>
+              <td>
+                审核时间:{{ row.reviewTime }}
+              </td>
+            </tr>
+            <tr>
+              <td>
+                修改人:{{ row.modifyPersonName }}
+              </td>
+              <td>
+                修改时间:{{ row.modificationTime }}
+              </td>
+            </tr>
+            <tr>
+              <td>
+                状态: {{ row.remediationStatusName }}
+              </td>
+            </tr>
+          </table>
+        </div>
+      </template>
+    </el-table-column>
+    <el-table-column prop="name" label="项目" width="180">
+      <template #default="{row}">
+        <el-input v-model="row.name" :maxlength="100" v-if="row.disposition"/>
+      </template>
+    </el-table-column>
+    <el-table-column prop="scoringCriteriaName" label="等级" width="40">
+      <template #default="{row}">
+        <select v-model="row.scoringCriteria" v-if="row.disposition">
+          <option v-for="item in scoringCriteriaList"
+                  :key="item.code"
+                  :value="item.code">
+            {{ item.name }}
+          </option>
+        </select>
+      </template>
+    </el-table-column>
+    <el-table-column prop="remark" label="备注">
+      <template #default="{row}" v-if="permissions()">
+        <el-input v-model="row.remark" :maxlength="100"></el-input>
+      </template>
+    </el-table-column>
+    <el-table-column prop="numberOfDefects" label="缺陷数">
+      <template #default="{row}" v-if="permissions()">
+        <el-input-number style="width: 40px"
+                         v-model="row.numberOfDefects"
+                         :min="1"
+                         :controls="false"/>
+      </template>
+    </el-table-column>
+    <el-table-column type="selection" v-if="permissions()"/>
+  </el-table>
+  <right-click-menu v-if="!permissions()" :config="opt" :mouse-position="mousePosition"/>
 </template>
 
 <script setup name='EmrAudit'>
@@ -91,7 +91,7 @@ import {ref} from "vue";
 import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
 import {xcMessage} from "@/utils/xiaochan-element-plus";
 import EmrAuditDialog
-    from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrAuditDialog.vue";
+  from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrAuditDialog.vue";
 import {BizException, ExceptionEnum} from "@/utils/BizException";
 import {uuid} from "@/utils/getUuid";
 import {scoringCriteriaList} from "@/data";
@@ -99,136 +99,136 @@ import {scoringCriteriaList} from "@/data";
 const elTableRef = ref(null)
 
 const emrInfo = ref({
-    id: 0,
-    code: "",
-    createId: '',
-    referPhysician: "",
-    patNo: '',
-    times: 0
+  id: 0,
+  code: "",
+  createId: '',
+  referPhysician: "",
+  patNo: '',
+  times: 0
 })
 
 const data = ref([])
 const expandRow = ref([])
 
 const permissions = () => {
-    return needRule(56);
+  return needRule(56);
 }
 
 const setAuditClick = () => {
-    let temp = {
-        id: emrInfo.value.id,
-        doctor: emrInfo.value.code === 'shoucibingchengjilu' ? emrInfo.value.referPhysician : emrInfo.value.createId,
-        patNo: emrInfo.value.patNo,
-        times: emrInfo.value.times,
-        list: elTableRef.value.getSelectionRows()
-    }
-    setAudit(temp).then(() => {
-        queryAudit(emrInfo.value)
-    })
+  let temp = {
+    id: emrInfo.value.id,
+    doctor: emrInfo.value.code === 'shoucibingchengjilu' ? emrInfo.value.referPhysician : emrInfo.value.createId,
+    patNo: emrInfo.value.patNo,
+    times: emrInfo.value.times,
+    list: elTableRef.value.getSelectionRows()
+  }
+  setAudit(temp).then(() => {
+    queryAudit(emrInfo.value)
+  })
 }
 
 const mousePosition = ref()
 const opt = [
-    {
-        name: '已整改',
-        click: (data) => {
-            rectification(data, 1)
-        },
-        validator: (data) => {
-            return !!data.approver;
-        }
+  {
+    name: '已整改',
+    click: (data) => {
+      rectification(data, 1)
     },
-    {
-        name: '已知无需整改',
-        click: (data) => {
-            rectification(data, 2)
-        },
-        validator: (data) => {
-            return !!data.approver;
-        }
-    }, {
-        name: '删除',
-        click: (data) => {
-
-        },
-        validator: (data) => {
-            return !!data.disposition;
-        }
+    validator: (data) => {
+      return !!data.approver;
     }
+  },
+  {
+    name: '已知无需整改',
+    click: (data) => {
+      rectification(data, 2)
+    },
+    validator: (data) => {
+      return !!data.approver;
+    }
+  }, {
+    name: '删除',
+    click: (data) => {
+
+    },
+    validator: (data) => {
+      return !!data.disposition;
+    }
+  }
 ]
 
 const rectification = (data, flag) => {
-    if (!data.approver) {
-        return xcMessage.error('操作失败')
-    } else {
-        rectifyMedicalRecords(data.id, flag).then(() => {
-            queryAudit(emrInfo.value)
-        })
-    }
+  if (!data.approver) {
+    return xcMessage.error('操作失败')
+  } else {
+    rectifyMedicalRecords(data.id, flag).then(() => {
+      queryAudit(emrInfo.value)
+    })
+  }
 }
 
 
 const rowContextmenu = (row, column, event) => {
-    event.preventDefault()
-    mousePosition.value = {
-        event,
-        data: row,
-        index: 0
-    }
+  event.preventDefault()
+  mousePosition.value = {
+    event,
+    data: row,
+    index: 0
+  }
 }
 
 const queryAudit = (val) => {
-    emrInfo.value = val
-    getAuditMessages(emrInfo.value.id, emrInfo.value.code).then(async res => {
-        expandRow.value = []
-        data.value = res
-        elTableRef.value.clearSelection()
-        await nextTick()
-        let tempList = []
-        console.log(res)
-        for (let i = 0, len = data.value.length; i < len; i++) {
-            let item = data.value[i]
-            item.rowId = i;
-            if (stringNotBlank(item.approver)) {
-                expandRow.value.push(i);
-                elTableRef.value.toggleRowSelection(item);
-                tempList.push(item);
-            }
-        }
-
-        if (tempList.length > 0) {
-            emrMitt.emit('setShowIframe', 5)
-        }
-
-        if (!permissions()) {
-            data.value = tempList;
-        }
+  emrInfo.value = val
+  getAuditMessages(emrInfo.value.id, emrInfo.value.code).then(async res => {
+    expandRow.value = []
+    data.value = res
+    elTableRef.value.clearSelection()
+    await nextTick()
+    let tempList = []
+    console.log(res)
+    for (let i = 0, len = data.value.length; i < len; i++) {
+      let item = data.value[i]
+      item.rowId = i;
+      if (stringNotBlank(item.approver)) {
+        expandRow.value.push(i);
+        elTableRef.value.toggleRowSelection(item);
+        tempList.push(item);
+      }
+    }
 
-    })
+    if (tempList.length > 0) {
+      emrMitt.emit('setShowIframe', 5, null)
+    }
+
+    if (!permissions()) {
+      data.value = tempList;
+    }
+
+  })
 
 }
 
 const addAudit = () => {
-    let editor = emrMitt.emit('editor')
-    if (stringIsBlank(editor?.documentData._id)) {
-        BizException(ExceptionEnum.MESSAGE_ERROR, "请先选择病历。");
-    }
-    let tempData = {
-        rowId: uuid(8, 10),
-        name: '',
-        scoringCriteria: 1,
-        scoringCriteriaName: '轻',
-        numberOfDefects: 1,
-        remark: '',
-        disposition: true,
-    }
-    data.value.push(tempData)
-    elTableRef.value.toggleRowSelection(tempData);
+  let editor = emrMitt.emit('editor')
+  if (stringIsBlank(editor?.documentData._id)) {
+    BizException(ExceptionEnum.MESSAGE_ERROR, "请先选择病历。");
+  }
+  let tempData = {
+    rowId: uuid(8, 10),
+    name: '',
+    scoringCriteria: 1,
+    scoringCriteriaName: '轻',
+    numberOfDefects: 1,
+    remark: '',
+    disposition: true,
+  }
+  data.value.push(tempData)
+  elTableRef.value.toggleRowSelection(tempData);
 }
 
 
 onMounted(() => {
-    emrMitt.on('audit', queryAudit)
+  emrMitt.on('audit', queryAudit)
 })
 </script>