Browse Source

优化电子病历

xiaochan 1 year ago
parent
commit
ea7b563814

+ 35 - 50
src/layout/function-list/Theme.vue

@@ -5,10 +5,10 @@
     </div>
 
     <el-drawer v-model="drawer" title="系统设置" class="system_user-config">
+      <el-form>
 
-      <el-collapse v-model="activeNames">
-        <el-collapse-item title="医嘱录入" name="0">
-          <el-form>
+        <el-collapse v-model="activeNames">
+          <el-collapse-item title="医嘱录入" name="0">
             <el-form-item :label="`默认查询【${userConfig.yz_orderTimeDay}】天前医嘱`">
               <el-input-number
                   :min="1"
@@ -19,10 +19,8 @@
                 <xc-el-option :data="[{code: 'asc' , name : '正序'},{code: 'desc' , name : '反序'}]"/>
               </el-select>
             </el-form-item>
-          </el-form>
-        </el-collapse-item>
-        <el-collapse-item title="系统配置" name="1">
-          <el-form>
+          </el-collapse-item>
+          <el-collapse-item title="系统配置" name="1">
             <el-form-item label="布局">
               <el-switch
                   active-text="圆角布局"
@@ -41,44 +39,30 @@
                   v-model="userConfig.isCollapse"
               />
             </el-form-item>
-          </el-form>
-        </el-collapse-item>
-        <!--        <el-collapse-item title="菜单配置" name="0">-->
-        <!--          <el-form>-->
-        <!--            <el-form-item label="侧边菜单栏背景色">-->
-        <!--              <el-color-picker v-model="theme['&#45;&#45;el-menu-bg-color']"/>-->
-        <!--            </el-form-item>-->
-
-        <!--            <el-form-item label="侧边菜单文字颜色">-->
-        <!--              <el-color-picker v-model="theme['&#45;&#45;el-menu-text-color']"/>-->
-        <!--            </el-form-item>-->
-
-        <!--            <el-form-item label="侧边菜单激活项背景色">-->
-        <!--              <el-color-picker v-model="theme['&#45;&#45;el-menu-active-color']"/>-->
-        <!--            </el-form-item>-->
-        <!--          </el-form>-->
-        <!--        </el-collapse-item>-->
-
-        <!--        <el-collapse-item title="顶部配置" name="1">-->
-        <!--          <el-form>-->
-        <!--            <el-form-item label="激活菜单背景颜色">-->
-        <!--              <el-color-picker v-model="theme['&#45;&#45;xc-header-active-bg-color']"/>-->
-        <!--            </el-form-item>-->
-
-        <!--            <el-form-item label="激活菜单文字颜色">-->
-        <!--              <el-color-picker v-model="theme['&#45;&#45;xc-header-active-text-color']"/>-->
-        <!--            </el-form-item>-->
-        <!--          </el-form>-->
-        <!--        </el-collapse-item>-->
+          </el-collapse-item>
+          <el-collapse-item title="电子病历" name="2">
+            <el-form-item label="侧边栏按钮大小">
+              <el-select v-model="userConfig.emr_size"
+                         :disabled="userConfig.emr_function_button_show_text"
+              >
+                <xc-el-option :data="[{code: 'large' , name: '大'}, {code: 'default', name: '默认'}]"/>
+              </el-select>
+            </el-form-item>
+            <el-form-item label="侧边栏显示文字">
+              <el-switch
+                  @change="handelEmrfunctionButtonShowText"
+                  active-text="是"
+                  inactive-text="否"
+                  :active-value="true"
+                  :inactive-value="false"
+                  v-model="userConfig.emr_function_button_show_text"
+              >
+              </el-switch>
+            </el-form-item>
+          </el-collapse-item>
+        </el-collapse>
+      </el-form>
 
-        <!--        <el-collapse-item title="按钮配置" name="2">-->
-        <!--          <el-form>-->
-        <!--            <el-form-item label="默认按钮颜色">-->
-        <!--              <el-color-picker v-model="theme['&#45;&#45;el-color-primary']"/>-->
-        <!--            </el-form-item>-->
-        <!--          </el-form>-->
-        <!--        </el-collapse-item>-->
-      </el-collapse>
       <template #footer>
         <el-button size="large" type="primary" @click="saveUserConfig">保存</el-button>
       </template>
@@ -105,12 +89,7 @@ const tabsHook = {
 const systemStore = useSystemStore()
 const drawer = ref(false)
 const activeNames = ref(['0', '1', '2'])
-const userConfig: Ref<SystemConfig> = ref({
-  isCollapse: false,
-  layOutPageName: 'filletLayout',
-  yz_orderBySort: 'asc',
-  yz_orderTimeDay: 90,
-})
+const userConfig: Ref<SystemConfig> = ref({})
 
 function openDrawer() {
   userConfig.value = XEUtils.clone(systemStore.userConfig, true)
@@ -122,6 +101,12 @@ function saveUserConfig() {
   drawer.value = false
 }
 
+function handelEmrfunctionButtonShowText(val) {
+  if (val) {
+    userConfig.value.emr_size = 'large'
+  }
+}
+
 watch(() => theme.value, () => {
   const el = document.documentElement
   for (let key in theme.value) {

+ 1 - 2
src/layout/index.vue

@@ -18,8 +18,7 @@ const layouts: any = {
 }
 
 const pageName = computed(() => {
-  // return useSystemStore().userConfig.layOutPageName
-  return 'filletLayout'
+  return useSystemStore().userConfig.layOutPageName
 })
 const userStore = useUserStore()
 const router = useRouter()

+ 2 - 3
src/main.js

@@ -5,7 +5,6 @@ import 'element-plus/theme-chalk/dark/css-vars.css'
 import 'normalize.css' // css初始化
 import '../src/css/app.scss' // 公共css
 import App from './App.vue'
-import {createPinia} from "pinia";
 import router from './router'
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 import zhCn from 'element-plus/es/locale/lang/zh-cn'
@@ -23,8 +22,8 @@ import initVxeConfig from "@/utils/xe-utils-enhance/vxe-formatter";
 import VXETablePluginExportXLSX from 'vxe-table-plugin-export-xlsx'
 import ExcelJS from 'exceljs'
 import VWaves from "@/directives/v-waves";
+import piniaInstall from "@/pinia/pinia-install";
 
-const pinia = createPinia()
 
 DomZIndex.getNext = () => {
     return useZIndex().nextZIndex()
@@ -53,8 +52,8 @@ VXETable.use(VXETablePluginExportXLSX, {
     ExcelJS
 })
 
+piniaInstall(app)
 app.use(ElementPlus, {locale: zhCn, size: 'small'})
-app.use(pinia)
 app.use(DataVVue3)
 app.directive('el-btn', VElBtn)
 app.directive('title', VTitle)

+ 9 - 0
src/pinia/pinia-install.ts

@@ -0,0 +1,9 @@
+import {App} from "vue";
+import {createPinia} from "pinia";
+import {useSystemStore} from "@/pinia/system-store";
+
+const pinia = createPinia()
+export default function piniaInstall(app: App) {
+    app.use(pinia);
+    useSystemStore().merge();
+};

+ 20 - 6
src/pinia/system-store.ts

@@ -18,16 +18,22 @@ export interface SystemConfig {
     layOutPageName: 'defaultLayout' | 'filletLayout';
     yz_orderBySort: 'desc' | 'asc';
     yz_orderTimeDay: number | 90;
+    emr_size: 'default' | 'large';
+    emr_function_button_show_text: boolean
+}
+
+const userConfig: SystemConfig = {
+    isCollapse: true,
+    layOutPageName: 'filletLayout',
+    yz_orderBySort: 'asc',
+    yz_orderTimeDay: 90,
+    emr_size: 'large',
+    emr_function_button_show_text: true,
 }
 
 export const useSystemStore = defineStore('system', {
     state: () => useLocalStorage<systemAttr>('systemStore', ({
-        userConfig: {
-            isCollapse: true,
-            layOutPageName: 'filletLayout',
-            yz_orderBySort: 'asc',
-            yz_orderTimeDay: 90,
-        },
+        userConfig: userConfig,
         theme: {},  // 主题
         unreadMessageCount: 0, // 未查看的消息数量
         systemMessages: [], // 已经看过的系统通知id
@@ -43,6 +49,14 @@ export const useSystemStore = defineStore('system', {
         },
     },
     actions: {
+        merge() {
+            for (let key in userConfig) {
+                if (!XEUtils.has(this.userConfig, key)) {
+                    // @ts-ignore
+                    this.userConfig[key] = userConfig[key]
+                }
+            }
+        },
         setConfig(val: any) {
             this.userConfig = XEUtils.assign(this.userConfig, val)
         },

+ 1 - 1
src/pinia/user-store.ts

@@ -1,5 +1,5 @@
+//@ts-nocheck
 import {defineStore} from 'pinia';
-// @ts-ignore
 import {getUserInfoByCode} from "@/api/login";
 
 export declare type UserInfo = {

+ 3 - 1
src/types/global.d.ts

@@ -30,7 +30,9 @@ declare module "xe-utils/ctor.d.ts" {
          * @param list 数组
          * @param iteration 迭代
          */
-        eachAndReturnList<T = any>(list: T[] | Ref<T[]> | number, iteration: (item: T, index: number) => any): any[]
+        eachAndReturnList<T = any>(list: T[] | Ref<T[]> | number, iteration: (item: T, index: number) => any): any[];
+
+        noop: () => void
     }
 }
 

+ 2 - 0
src/utils/xe-utils-enhance/vxe-formatter.ts

@@ -56,6 +56,8 @@ function addVxeUtils() {
             }
             return temp;
         },
+        noop: () => {
+        }
     })
 }
 

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

@@ -223,13 +223,13 @@ let extractData = {}
 const emrStore: PageStore = useEmrStore(patientInfo.value.inpatientNo + '_' + patientInfo.value.admissTimes)
 
 // 恢复到上一次保存的状态
-const {openRecovery} = useHistoricalData();
+const openRecovery = useHistoricalData();
 
 provide(emrRootContextKey, {
   store: emrStore,
 })
 
-const {magicScript, triggerScript, scriptLoading} = useEmrScript({
+const {magicScript, triggerScript} = useEmrScript({
   getData: () => {
     return {
       editor: editor,

+ 36 - 3
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/emr-function/EmrFunctionList.vue

@@ -25,6 +25,7 @@ import {xcMessage} from "@/utils/xiaochan-element-plus";
 import {
   emrRootContextKey
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-func/useEmrStore";
+import {useSystemStore} from "@/pinia/system-store";
 
 interface EmrFunctionListProps {
   openRecovery: Function;
@@ -38,6 +39,11 @@ const props = defineProps<EmrFunctionListProps>()
 
 let zoom = 1;
 
+const size = useSystemStore().userConfig.emr_size
+const buttonSize = size === 'default' ? '28px' : '48px'
+
+console.log(size)
+
 const emits = defineEmits(['update:isOpenPage', 'update:reviewMode'])
 
 function setRevisionShowMode(value: number) {
@@ -129,6 +135,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: <RefreshLeft/>,
       title: '撤销 快捷键 Ctrl + Z',
+      name: '撤销',
       click() {
         emrMitt.emit('editor')!.execute('undo')
       }
@@ -136,6 +143,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: <RefreshRight/>,
       title: '重做 快捷键 Ctrl + Y',
+      name: '重做',
       click() {
         emrMitt.emit('editor')!.execute('redo')
       }
@@ -144,6 +152,7 @@ const functionList = ref<FunctionList[][]>([
   [
     {
       title: "",
+      name: '审阅',
       iconfontName: 'shenyue',
       dropdown: [
         {
@@ -172,6 +181,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: <Printer/>,
       title: "",
+      name: '打印',
       click() {
         emrMitt.emit('getEditMain')?.print()
       },
@@ -195,6 +205,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: <ZoomIn/>,
       title: '放大病历',
+      name: '放大',
       click() {
         emrMitt.emit('editor')!.execute('zoom', {value: zoom += 0.1})
       }
@@ -202,6 +213,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: <ZoomOut/>,
       title: '缩小病历',
+      name: '缩小',
       click() {
         emrMitt.emit('editor')!.execute('zoom', {value: zoom -= 0.1})
       }
@@ -211,6 +223,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: <SortDown/>,
       title: '仅在病程记录中生效,根据病程记录的时间来进行排序,从小到大。',
+      name: '排序',
       click() {
         emrMitt.emit('diseaseCourseSequencing')
       }
@@ -218,6 +231,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: 'chaifenyemian',
       title: "为页面添加分页标识符,分页符后强制为新页面。",
+      name: '分页符',
       click() {
         emrMitt.emit('editor')!.execute('insertContents', {value: [{type: 'pagebreak'}]})
       }
@@ -225,6 +239,7 @@ const functionList = ref<FunctionList[][]>([
     {
       iconfontName: 'xianshifenye',
       title: '病历中显示分页',
+      name: '显示分页',
       activation: false,
       click(value) {
         value.activation = !value.activation
@@ -236,6 +251,7 @@ const functionList = ref<FunctionList[][]>([
   [
     {
       title: "点击可以打开聊天室",
+      name: '聊天室',
       iconfontName: <Avatar/>,
       click() {
         emrMitt.emit('openChatRoom')
@@ -248,7 +264,8 @@ emrMitt.emit('setHeaderFunction', [...businessFunctions, ...functionList.value[0
 </script>
 
 <template>
-  <div class="emr_function-content">
+  <div
+      class="emr_function-content">
     <el-scrollbar>
       <template v-for="(item , itemIndex) in functionList">
         <div class="emr_function-action-group"
@@ -292,9 +309,25 @@ emrMitt.emit('setHeaderFunction', [...businessFunctions, ...functionList.value[0
       border: 1px solid var(--el-border-color);
     }
 
+    .emr-function-button-upright {
+
+      > span {
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+        justify-content: center;
+        height: 100%;
+        cursor: pointer;
+      }
+
+      .el-icon {
+        margin-bottom: 6px;
+      }
+    }
+
     button {
-      width: 28px;
-      height: 28px;
+      width: v-bind(buttonSize);
+      height: v-bind(buttonSize);
       font-size: 12px;
       padding: 5px;
       border-radius: 0;

+ 14 - 12
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/emr-function/useEmrFunction.tsx

@@ -6,6 +6,9 @@ import {stringIsBlank} from "@/utils/blank-utils";
 import {BizException, ExceptionEnum} from "@/utils/BizException";
 import useDialogToJs from "@/components/js-dialog-comp/useDialogToJs";
 import {getHistory} from "@/api/zhu-yuan-yi-sheng/emr-patient";
+import {useSystemStore} from "@/pinia/system-store";
+
+const showText = useSystemStore().userConfig.emr_function_button_show_text
 
 export declare type FunctionList = {
     name?: string;
@@ -36,9 +39,10 @@ export const Button = defineComponent({
     setup(props) {
         const {child, index} = props;
         const disabled = child.disabled ?? false;
+
         return () => (
             <ElButton
-                class={{activation: child.activation ?? false}}
+                class={{activation: child.activation ?? false, 'emr-function-button-upright': showText}}
                 style={{borderTop: index !== 0 ? 'none' : ''}}
                 // @ts-ignore
                 onContextmenu={(el: Event) => {
@@ -56,15 +60,16 @@ export const Button = defineComponent({
                 disabled={child.disabled ?? false}
             >
                 {{
-                    default: () => (
+                    default: () => [
                         <ElIcon size="16">
                             {{
                                 default: () => XEUtils.isString(child.iconfontName) ?
                                     <i class={`iconfont icon-${child.iconfontName}`}/> :
                                     child.iconfontName
                             }}
-                        </ElIcon>
-                    )
+                        </ElIcon>,
+                        showText ? child.name : ''
+                    ]
                 }}
             </ElButton>
         );
@@ -149,21 +154,18 @@ export const useHistoricalData = () => {
     function openDialogRecovery() {
         useDialogToJs(HistoricalEmr, {
             historicalData: historicalData.value,
-            refresh: queryHistoryFunc
-        }).then(r => {
-        })
+            refresh: () => queryHistoryFunc(false)
+        }).then(XEUtils.noop)
     }
 
-    function queryHistoryFunc() {
+    function queryHistoryFunc(openDialog = true) {
         const id = emrMitt.emit('getId')
         getHistory(id).then(res => {
             // @ts-ignore
             historicalData.value = res
-            openDialogRecovery()
+            openDialog && openDialogRecovery()
         })
     }
 
-    return {
-        openRecovery
-    }
+    return openRecovery
 }