浏览代码

住院规则

DESKTOP-0GD05B0\Administrator 2 年之前
父节点
当前提交
07ac52bd73

+ 2 - 2
.env.dev

@@ -1,4 +1,4 @@
 ENV = 'dev'
 
-VITE_BASE_URL = 'http://172.16.30.140:8706'
-VITE_SOCKET_URL = 'ws://172.16.30.140:8706/websocket/'
+VITE_BASE_URL = 'http://172.16.30.3:9201'
+VITE_SOCKET_URL = 'ws://172.16.30.3:9201/websocket/'

+ 18 - 0
src/api/zhu-yuan-yi-sheng/emr-control-rule.js

@@ -0,0 +1,18 @@
+import request from "@/utils/request";
+
+let url = '/emrControlRule'
+
+export function addRule(data) {
+    return request({
+        url: url + '/addRule',
+        method: 'post',
+        data
+    })
+}
+
+export function getAvailableObjects() {
+    return request({
+        url: url + '/getAvailableObjects',
+        method: 'get',
+    })
+}

+ 8 - 2
src/components/zhu-yuan-yi-sheng/emr/EmrSidebar.vue

@@ -53,7 +53,13 @@ const props = defineProps({
   },
   huanZheXinXi: {
     type: Object
-  }
+  },
+  patientData: {
+    type: Object
+  },
+  extractData: {
+    type: Object
+  },
 })
 
 let editor = emrConfig.value.editor
@@ -90,7 +96,7 @@ const treeData = computed(() => {
 })
 
 
-const handleNodeClick = async (val, property, event) => {
+const handleNodeClick = async (val) => {
   let temp = {}
   if (templateType === 0 || templateType === 1) {
     temp = {

+ 2 - 2
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/table/YzTable.vue

@@ -246,7 +246,6 @@ const rowClick = (val) => {
 watch(() => tempYzData.value, (oldData, newData) => {
   if (oldData.length !== newData.length) {
     itemCount.value = Math.ceil(maxHeight.value / itemHeight.value)
-    virtualHeight.value = itemHeight.value * tempYzData.value.length
   }
 })
 
@@ -255,7 +254,8 @@ const elScrollbarRef = ref<InstanceType<typeof ElScrollbar>>()
 const calculateTableHeight = async () => {
   await nextTick()
   let windowSize = store.state['app']['windowSize']
-  maxHeight.value = Math.floor(windowSize.h / 2)
+  maxHeight.value = Math.ceil(windowSize.h / 2)
+  virtualHeight.value = itemHeight.value * tempYzData.value.length
 }
 
 watch(() => store.state['app']['windowSize'], () => {

+ 2 - 2
src/layout/HeaderV2/function-list/user-info/UserInfo.vue

@@ -1,6 +1,6 @@
 <template>
-  <el-popover :width="260" trigger="click" :offset="24">
-    <template #reference>
+`  <el-popover :width="260" trigger="click" :offset="24">
+    <template #reference>`
 
       <div style="white-space: nowrap;display: flex;justify-content: center;align-items: center">
         <div>

+ 173 - 27
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/EmrControlRule.vue

@@ -5,38 +5,73 @@
 
   <xc-dialog-v2 v-model="dialog"
                 title="病历时效限制">
+
+
     <el-form :label-width="120">
       <el-form-item label="入参数据元:">
-        <el-input v-model="ruleForm.ginseng"/>
+        <el-select v-model="timeRule.sqlId" @change="selectChange" ref="selectRef">
+          <el-option v-for="item in ruleDataElement"
+                     :label="item.name"
+                     :value="item.id"
+                     :key="item.id"
+                     :title="item.group_name"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="时效(小时):">
+        <el-input v-model.number="timeRule.prescription">
+          <template #prepend>
+            {{ selectRef?.selectedLabel }}
+          </template>
+          <template #append> 小时后</template>
+        </el-input>
       </el-form-item>
+
       <el-form-item label="病历编码:">
         <el-tree-select
-            class="tree-select"
             style="width: 100%"
-            :props="defaultProps"
+            class="tree-select"
+            v-model="value"
+            :data="emrTree"
+            @clear=""
+            @remove-tag="removeTag"
             multiple
-            node-key="_id"
-            :render-after-expand="false"
-            v-model="ruleForm.medicalRecordCode"
-            :data="emrTree">
-          <template #default="{ node, data }">
+            @node-click="nodeClick"
+            :props="defaultProps"
+            check-strictly
+            :render-after-expand="false">
+          <template #default="{data}">
             <div style="display: flex;justify-content: space-between;align-items: center">
-              <div>{{ data.name }}</div>
               <div>
-                <el-button text type="primary">全选</el-button>
+                {{ data.name }}
+              </div>
+              <div v-if="data.children && data.children.length > 0">
+                <el-button text @click.stop="selectAll(data.children)">全选</el-button>
               </div>
             </div>
           </template>
         </el-tree-select>
       </el-form-item>
-      <el-form-item label="时效(小时):">
-        <el-input v-model="ruleForm.prescription"/>
+
+      <el-form-item label="提示语:">
+        <el-input v-model="ruleForm.promptStatement" show-word-limit maxlength="50"/>
+      </el-form-item>
+
+      <el-form-item>
+        <el-switch
+            v-model="ruleForm.offOrOnRule"
+            :active-value="1"
+            :inactive-value="0"
+            active-text="开启"
+            inactive-text="关闭"/>
       </el-form-item>
+
     </el-form>
 
     <template #footer>
       <el-button>取消</el-button>
-      <el-button>确认</el-button>
+      <el-button @click="confirm">确认</el-button>
     </template>
   </xc-dialog-v2>
 
@@ -44,46 +79,127 @@
 
 <script setup name='EmrControlRule' lang="ts">
 import XcTable from "@/components/xiao-chan/xc-table/XcTable.vue";
-import {onMounted, Ref, ref} from "vue";
+import {nextTick, onMounted, Ref, ref} from "vue";
 import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue";
 import {
   getEmrTree,
 } from "@/api/zhu-yuan-yi-sheng/emr-patient";
+import {addRule, getAvailableObjects} from '@/api/zhu-yuan-yi-sheng/emr-control-rule'
 
 const data: Ref<Array<any>> = ref([])
 const dialog: Ref<boolean> = ref(true)
 const emrTree = ref([])
+const ruleDataElement: Ref<Array<any>> = ref([])
 
 const defaultProps = {
   children: 'children',
   label: 'name',
-  value: '_id'
+  value: '_id',
+  disabled: (data) => {
+    return data.children && data.children.length > 0;
+  }
 }
 
 interface ruleFormClass {
-  // 入参
-  ginseng: string,
+  medicalRecord: Map<string, any>,
   // 病历编码
-  medicalRecordCode: Array<any>,
-  // 时效
-  prescription: string,
-
+  medicalRecordCode: Array<string>,
+  type: number,
+  data: any,
+  offOrOnRule: number
+  promptStatement: string
 }
 
 const ruleForm: Ref<ruleFormClass> = ref({
-  ginseng: '',
-  medicalRecordCode: [],
-  prescription: '',
+  type: 1,
+  medicalRecord: {},
+  medicalRecordCode: {},
+  data: {},
+  offOrOnRule: 1,
+  promptStatement: '超过了 24 小时无法创建'
+})
+
+const timeRule = ref({
+  sqlId: null,
+  prescription: '24',
 })
 
+/**
+ * 全选
+ * @param list
+ */
+const selectAll = (list) => {
+  list.forEach(data => {
+    ruleForm.value.medicalRecord[data._id] = {
+      code: data.code,
+      name: data.name
+    }
+    if (value.value.indexOf(data._id) === -1) {
+      value.value.push(data._id);
+    }
+  })
+}
+
+/**
+ * 编码点击
+ * @param data
+ */
+const nodeClick = (data) => {
+  if (data.children) return
+  if (ruleForm.value.medicalRecord[data._id]) {
+    uncheck(data._id)
+  } else {
+    ruleForm.value.medicalRecord[data._id] = {
+      code: data.code,
+      name: data.name
+    }
+  }
+}
+
+/**
+ * 移除标签
+ * @param data
+ */
+const removeTag = (data) => {
+  uncheck(data)
+}
+
+/**
+ * 删除数据
+ * @param value
+ */
+const uncheck = (value) => {
+  delete ruleForm.value.medicalRecord[value]
+}
+
+const selectRef = ref(null)
+const selectChange = async () => {
+  await nextTick()
+}
+
+const confirm = () => {
+  let temp = new Set()
+  for (let key in ruleForm.value.medicalRecord) {
+    temp.add(ruleForm.value.medicalRecord[key].code)
+  }
+  ruleForm.value.medicalRecordCode = Array.from(temp)
+  ruleForm.value.type = 1
+  ruleForm.value.data = JSON.stringify(timeRule.value)
+  addRule(ruleForm.value)
+  console.log(ruleForm.value)
+}
+
+const value: Ref<Array<string>> = ref([])
 
 onMounted(() => {
   getEmrTree('hosp').then((res) => {
-    console.log(res)
-    emrTree.value = res.all
+    emrTree.value = res.all[0].children
+  })
+
+  getAvailableObjects().then((res) => {
+    ruleDataElement.value = res
   })
 
-  console.log(data.value);
 })
 
 </script>
@@ -96,4 +212,34 @@ onMounted(() => {
     color: black;
   }
 }
+
+.select_div {
+  min-height: 20px;
+  width: 100%;
+  border: 1px solid;
+  border-radius: 4px;
+
+  table-layout: fixed;
+  word-break: break-all;
+  overflow: hidden;
+
+  .select_input {
+    margin-left: 3px;
+  }
+
+  span {
+    border-radius: 2px;
+    background-color: #f0f2f5;
+    padding: 0 5px;
+    margin: 4px;
+
+    i {
+      cursor: pointer;
+      font-size: 12px;
+      width: 14px;
+      height: 14px;
+      border-radius: 50%;
+    }
+  }
+}
 </style>

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

@@ -119,6 +119,8 @@
                      @patient-medical-record="foldBothSides.isLeft = true"
                      v-show="foldBothSides.isLeft"
                      ref="emrSidebarRef"
+                     :extract-data="extractData"
+                     :patientData="patientData"
                      :max-height="maxHeight"
                      :huan-zhe-xin-xi="props.huanZheXinXi"/>
       </div>
@@ -282,7 +284,7 @@
             </div>
 
             <div class="edit_mode">
-              模式:{{ editorMode ? '只读' : '编辑' }}
+              模式:{{ readonlyPattern() ? '只读' : '编辑' }}
             </div>
 
           </div>
@@ -371,7 +373,7 @@ let openAssistant = $ref({
   dialog: false
 })
 // 患者数据
-let patientData = {}
+let patientData = $ref({})
 // 编辑器
 let editor = null
 // 侧边栏
@@ -395,7 +397,7 @@ let wardList = []
 // 创建人 id
 let createId = null;
 // 获取提取到的数据。
-let extractData = {}
+let extractData = $ref({})
 
 let foldBothSides = $ref({
   isLeft: true,
@@ -457,7 +459,7 @@ const emrEvent = {
   },
 
   'contentchange': (event) => {
-    if (!editorMode) {
+    if (!readonlyPattern()) {
       // 如果是空的编辑器就不触发了
       if (!emrRef.value.src.includes('/emr/runtime/#/editor')) {
         // 判断内容是否改变
@@ -491,7 +493,7 @@ const emrEvent = {
 // 点击保存病历
 const clickSaveData = async () => {
   // 只读模式无法保存数据
-  if (editorMode) {
+  if (readonlyPattern()) {
     BizException(ExceptionEnum.LOGICAL_ERROR, "当前为只读模式,无法保存病历。");
   }
   waitForLoadingToComplete()
@@ -549,7 +551,7 @@ const clickSaveData = async () => {
 
 // 添加片段
 const clickToFillInData = (value) => {
-  if (!editorMode) {
+  if (!readonlyPattern()) {
     editor.setValues(value)
   }
 }
@@ -597,7 +599,7 @@ const servicePrint = () => {
  * 点击删除数据
  */
 const clickDelete = () => {
-  if (editorMode) {
+  if (readonlyPattern()) {
     BizException(ExceptionEnum.LOGICAL_ERROR, "无法删除病历。");
   }
   waitForLoadingToComplete()
@@ -736,7 +738,7 @@ const clickSnippet = ({content, styles, code}) => {
       delEmrCopy(temp)
     }
   }
-  if (!editorMode) {
+  if (!readonlyPattern()) {
     let root = editor.model.document.getRoot()
     let lastView = root.getChild(root.childCount - 1).view
     lastView.setAttribute('readonly', false)
@@ -920,7 +922,7 @@ const reQueryPatientInformation = () => {
   // 如果不是是编辑状态
   if (!emrConfig.value.editor) return
   // 如果是只读模式就不触发这个
-  if (!editorMode) {
+  if (!readonlyPattern()) {
     // 如果没有文档 id 就说明是
     if (documentId) {
       editor.setValues(extractData)
@@ -981,11 +983,9 @@ const drgIntelligentGrouping = () => {
   })
 }
 
-let editorMode = $ref(true)
 // true 是只读 false 不是只读
 const readonlyPattern = () => {
-  editorMode = editor !== null && editor.getEditorMode() === 'readonly';
-  return editorMode
+  return editor !== null && editor.getEditorMode() === 'readonly';
 }
 
 // 判断 一级 二级 三级医生
@@ -1234,22 +1234,20 @@ const zoomFunc = (val) => {
   editor.execute('zoom', {value: zoom})
 }
 
-onMounted(() => {
-  getExtractDataElement(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes).then((res) => {
-    extractData = res
-  })
-  nextTick(async () => {
-    emrSidebarRef.value.queryData()
-    patientId = props.huanZheXinXi.inpatientNo + '_' + props.huanZheXinXi.admissTimes
-    await queryingBasicPatientInformation()
-    currentEmr.value = new EMRInteractive(patientData, emrEvent);
-    if (emrConfig.value.editor) {
-      emrSnippetRef.value.setPatientData(patientData)
-    }
-    doctorLevelFunc()
-    emrRef.value.parentElement.emr = currentEmr.value
-    window.addEventListener('beforeunload', monitorPageRefresh, {capture: true})
-  })
+onMounted(async () => {
+  extractData = await getExtractDataElement(props.huanZheXinXi.inpatientNo, props.huanZheXinXi.admissTimes)
+  await nextTick()
+  emrSidebarRef.value.queryData()
+  patientId = props.huanZheXinXi.inpatientNo + '_' + props.huanZheXinXi.admissTimes
+  await queryingBasicPatientInformation()
+  currentEmr.value = new EMRInteractive(patientData, emrEvent);
+  if (emrConfig.value.editor) {
+    emrSnippetRef.value.setPatientData(patientData)
+  }
+  doctorLevelFunc()
+  emrRef.value.parentElement.emr = currentEmr.value
+  window.addEventListener('beforeunload', monitorPageRefresh, {capture: true})
+
   getWardsApi().then((res) => {
     if (res.length > 0) {
       for (let i = 0, len = res.length; i < len; i++) {