Browse Source

优化代码

xiaochan 2 years ago
parent
commit
670169f20d

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

@@ -321,3 +321,11 @@ export function getFluorescenceSpecimenResult(patNo, times) {
         params: {patNo, times}
     })
 }
+
+export function getOpRecordList(patNo, times) {
+    return request({
+        url: url + '/getOpRecordList',
+        method: 'get',
+        params: {patNo, times}
+    })
+}

+ 2 - 1
src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrAuxiliaryTools.vue

@@ -55,7 +55,8 @@
                  :times="patInfo.admissTimes"/>
     <emr-group-consultation v-if="index === 4"/>
     <emr-operation v-if="index === 5"
-                   :emr-data="props.emrData"
+                   :pat-no="patInfo.inpatientNo"
+                   :times="patInfo.admissTimes"
                    @to-fill-in-data="toFillInData"/>
     <emr-test @close="close" v-if="index === 6"
               :pat-no="patInfo.inpatientNo"/>

+ 49 - 17
src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrOperation.vue

@@ -3,22 +3,23 @@
   <div style="height: 95%">
     <el-auto-resizer>
       <template #default="{ height, width }">
-        <vxe-table :data="props.emrData['手术']"
-                   class="vxe-padding_zero"
-                   :height="height" show-overflow
-                   :row-config="{isHover : true, isCurrent: true,height: 24}">
+        <vxe-table
+            :data="data"
+            class="vxe-padding_zero"
+            :height="height" show-overflow
+            :row-config="{isHover : true, isCurrent: true,height: 24}">
           <vxe-column title="操作" fixed="left" width="50">
             <template #default="{row}">
-              <el-button text @click="emits('to-fill-in-data',row)" type="primary">填充</el-button>
+              <el-button text @click="paddingClick(row)" type="primary">填充</el-button>
             </template>
           </vxe-column>
-          <vxe-column title="手术日期" field="手术日期"/>
-          <vxe-column title="拟行手术名称" field="拟行手术名称"/>
-          <vxe-column title="术前诊断名称" field="术前诊断名称"/>
-          <vxe-column title="一助" field="第一助手名称" width="90"/>
-          <vxe-column title="二助" field="第二助手名称" width="90"/>
-          <vxe-column title="三助" field="第三助手名称" width="90"/>
-          <vxe-column title="麻醉方式名称" field="麻醉方式名称"/>
+          <vxe-column title="手术日期" field="opDatetime"/>
+          <vxe-column title="拟行手术名称" field="opName"/>
+          <vxe-column title="术前诊断名称" field="diagBeforeOp"/>
+          <vxe-column title="一助" field="doctor1Name" width="90"/>
+          <vxe-column title="二助" field="doctor2Name" width="90"/>
+          <vxe-column title="三助" field="doctor3Name" width="90"/>
+          <vxe-column title="麻醉方式名称" field="hocusName"/>
         </vxe-table>
       </template>
     </el-auto-resizer>
@@ -26,17 +27,48 @@
 </template>
 
 <script setup name='EmrOperation'>
+import {getOpRecordList} from "@/api/zhu-yuan-yi-sheng/emr-patient";
+import XEUtils from 'xe-utils'
+
+const {patNo, times} = defineProps({
+  patNo: String,
+  times: Number,
 
-const props = defineProps({
-  emrData: {
-    type: Object
-  }
 })
 
 const emits = defineEmits(['to-fill-in-data'])
 
+const paddingClick = (row) => {
+  let data = {
+    术前诊断: toArray(row.diagBeforeCode, row.diagBeforeOp),
+    拟行手术: toArray(row.opCode, row.opName),
+    麻醉方式: toArray(row.hocusCode, row.hocusName),
+    术者: toArray(row.doctorZd, row.doctorZdName),
+    第一助手: toArray(row.doctor1, row.doctor1Name),
+    第二助手: toArray(row.doctor2, row.doctor2Name),
+    第三助手: toArray(row.doctor3, row.doctor3Name),
+    麻醉医生: toArray(row.doctorMzYs, row.doctorMzYsName),
+    洗手护士: toArray(row.nurseQx, row.nurseQxName),
+    巡回护士: toArray(row.nurseXh, row.nurseXhName),
+    手术日期: row.opDatetime,
+    手术者签名: toArray(row.doctorZd, row.doctorZdName),
+  }
+  emits('to-fill-in-data', data)
+}
+
+const toArray = (code, name) => {
+  if (XEUtils.isEmpty(code) || XEUtils.isEmpty(name)) {
+    return null
+  }
+  return [{code, name}];
+}
+
+const data = ref([])
+
 onMounted(() => {
-  console.log(props.emrData['手术'])
+  getOpRecordList(patNo, times).then(res => {
+    data.value = res
+  })
 })
 
 </script>

+ 1 - 2
src/components/zhu-yuan-yi-sheng/shou-shu-shen-qing/BianJiShouShu.vue

@@ -251,6 +251,7 @@ const clickToSelectSurgery = async (val) => {
   disabledOpScale.value = false
   selectOpRow.value = val
 
+  // todo 上线手术限制把这个if删除
   if (isDev) {
     let res = await getDoctorByOpCode(val.code)
     designateASurgeonInChief.value = res
@@ -264,8 +265,6 @@ const clickToSelectSurgery = async (val) => {
       xcMessage.warning('医务部锁定手术等级无法修改')
     }
   }
-
-
   buildOrderName()
 }
 

+ 15 - 16
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/EmrControlRuleDialog.vue

@@ -6,7 +6,15 @@
       <el-table-column prop="patName" label="患者名称"/>
       <el-table-column prop="emrName" label="病历"/>
       <el-table-column prop="name" label="质控意见"/>
+      <el-table-column prop="approverName" label="审核人"/>
       <el-table-column prop="scoringCriteriaName" label="等级"/>
+      <el-table-column prop="finalControl" label="是否终末">
+        <template #default="{row}">
+          <span v-if="row.finalControl === 1">
+            <el-tag>是</el-tag>
+          </span>
+        </template>
+      </el-table-column>
     </xc-table>
   </xc-dialog-v2>
 </template>
@@ -14,28 +22,19 @@
 <script setup name='EmrControlRuleDialog'>
 import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue";
 import {myPatientQualityControl} from "@/api/zhu-yuan-yi-sheng/emr-control-rule";
-import RuleSift
-  from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr_control_rule/RuleSift.vue";
-import {isDev} from "@/utils/public";
 import XcTable from "@/components/xiao-chan/xc-table/XcTable.vue";
 
-
-const suggestion = ref({})
-
+const suggestion = ref([])
 const dialog = ref(false)
 
 onMounted(() => {
-  if (!isDev) {
-    myPatientQualityControl().then((res) => {
-      suggestion.value = res
-      if (suggestion.value.length > 0) {
-        dialog.value = true
-      }
-    });
-  }
+  myPatientQualityControl().then((res) => {
+    suggestion.value = res
+    if (suggestion.value.length > 0) {
+      dialog.value = true
+    }
+  });
 })
-
-
 </script>
 
 <style scoped lang="scss">

+ 0 - 8
src/views/emr-view/emr-initialize.ts

@@ -11,12 +11,4 @@ export function EMRInteractive(data, editorEvent) {
         }
     };
 
-    this.getEditor = () => {
-        return this.editor
-    }
-
-    this.getAppContext = () => {
-        return {}
-    };
-
 }

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

@@ -140,147 +140,7 @@
     </div>
     <div class="emr-editor"
          :style="{marginTop: completeModeSwitch ? '10px' : 0 }">
-      <div style="height: 30px" @mousewheel="mousewheel($event)">
-        <el-scrollbar ref="tootScrollRef" @scroll="scroll">
-          <div class="tool_emr">
-            <el-select style="width: 150px;"
-                       @change="textStyleFunc.fontFamily()"
-                       v-model="emrStyle.fontFamily">
-              <el-option v-for="item in availableFonts"
-                         :value="item.font"
-                         :label="item.text">
-                  <span :style="{'fontFamily':item.font }">
-                    {{ item.text }}
-                  </span>
-              </el-option>
-            </el-select>
-            <el-select style="width: 70px;"
-                       @change="textStyleFunc.fontSize()"
-                       v-model="emrStyle.fontSize">
-              <el-option v-for="item in fontSizes"
-                         :value="item.code"
-                         :label="item.name"/>
-            </el-select>
-            <el-divider direction="vertical"/>
-            <el-button-group>
-              <el-button @click="textStyleFunc.fontSizeAdjust('increase')"
-                         title="放大字体">
-                +
-              </el-button>
-              <el-button @click="textStyleFunc.fontSizeAdjust('decrease') "
-                         title="缩小字体">
-                -
-              </el-button>
-            </el-button-group>
-            <el-divider direction="vertical"/>
-            <el-button-group>
-              <el-button
-                  title="字体加粗"
-                  :class="buttonClass('fontWeight','bold')"
-                  @click="textStyleFunc.fontWeight()">
-                <i class="iconfont icon-jiacu"></i>
-              </el-button>
-              <el-button
-                  title="斜体"
-                  :class="buttonClass('fontStyle','oblique')"
-                  @click="textStyleFunc.fontStyle()">
-                <i class="iconfont icon-xieti"></i>
-              </el-button>
-              <el-button
-                  title="下划线"
-                  :class="buttonClass('underline')"
-                  @click="textStyleFunc.underline()">
-                <i class="iconfont icon-xiahuaxian"></i>
-              </el-button>
-              <el-button
-                  title="删除线"
-                  :class="buttonClass('lineThrough')"
-                  @click="textStyleFunc.lineThrough()">
-                <i class="iconfont icon-shanchuxian"></i>
-              </el-button>
-              <el-button
-                  title="上标"
-                  :class="buttonClass('super')"
-                  @click="textStyleFunc.super()">
-                <i class="iconfont icon-zitishangbiao"></i>
-              </el-button>
-              <el-button
-                  title="下标"
-                  :class="buttonClass('sub')"
-                  @click="textStyleFunc.sub()">
-                <i class="iconfont icon-zitixiabiao"></i>
-              </el-button>
-            </el-button-group>
-            <div class="color_picker"
-                 title="字体颜色">
-              <i class="iconfont icon-zitiyanse"></i>
-              <el-color-picker v-model="emrStyle.color"
-                               @change="textStyleFunc.color()"
-                               :predefine="predefineColors"/>
-            </div>
-            <div class="color_picker"
-                 title="背景颜色">
-              <i class="iconfont icon-beijingyanse"></i>
-              <el-color-picker v-model="emrStyle.backgroundColor"
-                               @change="textStyleFunc.backgroundColor()"
-                               :predefine="predefineColors"/>
-            </div>
-            <el-divider direction="vertical"/>
-            <el-button-group>
-              <el-popover
-                  :width="0"
-                  trigger="hover">
-                <template #reference>
-                  <el-button title="无序列表">
-                    <i class="iconfont icon-wuxuliebiao"></i>
-                  </el-button>
-                </template>
-                <emr-unordered-list list-type="disorder" @click-list="textStyleFunc.unorderedList"/>
-              </el-popover>
-              <el-popover
-                  :width="0"
-                  trigger="hover">
-                <template #reference>
-                  <el-button title="有序列表">
-                    <i class="iconfont icon-youxuliebiao"></i>
-                  </el-button>
-                </template>
-                <emr-unordered-list list-type="orderly" @click-list="textStyleFunc.orderedList"/>
-              </el-popover>
-            </el-button-group>
-            <el-divider direction="vertical"/>
-            <el-button-group>
-              <el-button title="左对齐"
-                         @click="textStyleFunc.alignment('left')">
-                <i class="iconfont icon-zuoduiqi"></i>
-              </el-button>
-              <el-button title="居中对其"
-                         @click="textStyleFunc.alignment('center')">
-                <i class="iconfont icon-juzhongduiqi"></i>
-              </el-button>
-              <el-button title="右对齐"
-                         @click="textStyleFunc.alignment('right')">
-                <i class="iconfont icon-youduiqi"></i>
-              </el-button>
-              <el-button title="两端对齐"
-                         @click="textStyleFunc.alignment('justify')">
-                <i class="iconfont icon-zuoyouduiqi"></i>
-              </el-button>
-            </el-button-group>
-            <el-divider direction="vertical"/>
-            <el-button-group>
-              <el-button title="增加缩进"
-                         @click="textStyleFunc.indent(1)">
-                <i class="iconfont icon-yousuojin"></i>
-              </el-button>
-              <el-button title="减小缩进"
-                         @click="textStyleFunc.indent(-1)">
-                <i class="iconfont icon-zuosuojin"></i>
-              </el-button>
-            </el-button-group>
-          </div>
-        </el-scrollbar>
-      </div>
+      <EmrStyleBar ref="styleBarRef"/>
       <div class="emr-iframe">
         <div>
           <el-button @click="showIframe  = 1" :type="showIframe === 1 ? 'primary' : ''">正在编辑</el-button>
@@ -454,6 +314,8 @@ import XEUtils from 'xe-utils'
 import {
   EmrEditCreateLimit
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-edit-create-limit";
+import EmrStyleBar
+  from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrStyleBar.vue";
 
 
 const props = defineProps({
@@ -526,47 +388,7 @@ const isCourse = () => {
   return categoryCode === 'shoucibingchengjilu' || categoryCode === 'xinshengerjianhujilu';
 }
 
-let emrStyle = $ref({
-  // 字体样式
-  fontFamily: '"Microsoft YaHei"',
-  // 字体大小
-  fontSize: '10.5pt',
-  // 字体加粗
-  fontWeight: 'normal',
-  // 斜体
-  fontStyle: 'normal',
-  // 下划线
-  underline: false,
-  //删除线
-  lineThrough: false,
-  // 上标
-  super: false,
-  // 下标
-  sub: false,
-  // 颜色
-  color: '',
-  backgroundColor: '',
-  paragraphStyle: {}
-})
-
-const predefineColors = ref([
-  '#ff4500',
-  '#ff8c00',
-  '#ffd700',
-  '#90ee90',
-  '#00ced1',
-  '#1e90ff',
-  '#c71585',
-  'rgba(255, 69, 0, 0.68)',
-  'rgb(255, 120, 0)',
-  'hsv(51, 100, 98)',
-  'hsva(120, 40, 94, 0.5)',
-  'hsl(181, 100%, 37%)',
-  'hsla(209, 100%, 56%, 0.73)',
-  '#c7158577',
-])
-
-let autoSave = $ref(true)
+let autoSave = $ref(!isDev)
 
 const emrMainWidth = () => {
   if (showIframe.value === 3) {
@@ -586,8 +408,7 @@ const emrMainWidth = () => {
 
 const emrEvent = {
   'loaded': async (event) => {
-    // await 判断可否创建或编辑()
-    editor = currentEmr.value.getEditor()
+    setEditor()
     loaded = false
     // 获取医生等级
     doctorLevelFunc()
@@ -626,21 +447,11 @@ const emrEvent = {
   },
 
   'contextUpdate': (evt, contextMap, component, context) => {
-    emrStyle.fontSize = context.fontSize
-    emrStyle.fontFamily = context.fontFamily
-    emrStyle.fontStyle = context.italic ? 'oblique' : 'normal'
-    emrStyle.fontWeight = context.bold ? 'bold' : 'normal'
-    emrStyle.underline = context.underline
-    emrStyle.lineThrough = context.linethrough
-    emrStyle.super = context.superScript
-    emrStyle.sub = context.subScript
-    emrStyle.color = context.color
-    emrStyle.backgroundColor = context.backgroundColor
-    emrStyle.paragraphStyle = context.paragraphStyle
+    styleBarRef.value.setEmrStyleV2(context)
   },
 
   'ready': (event) => {
-    editor = currentEmr.value.getEditor()
+    setEditor()
     popupFunc.setShortcutKey()
     rightClickOnRegistration()
   },
@@ -1047,7 +858,6 @@ const clickSnippet = async ({content, styles, code}) => {
   // 移动到文档结尾
   editor.setCursor('DOCUMENT_END');
   editor.scrollToCursor()
-  console.log(data)
   let insertContent = {
     // 内容
     value: content,
@@ -1057,7 +867,6 @@ const clickSnippet = async ({content, styles, code}) => {
     // 就是在这里填充的值
     defaultData: data,
   }
-  console.log(insertContent)
   editor.setRevisionMode('off')
   editor.execute("insertContents", insertContent);
   if (isReadonly) {
@@ -1230,13 +1039,12 @@ const deleteDataElement = () => {
 // 重新设置提取的数据, 这里是强制替换
 const reQueryPatientInformation = () => {
   // 如果不是是编辑状态
-  if (!emrConfig.value.editor) return
+  if (!emrConfig.value.editor) return;
   // 如果是只读模式就不触发这个
-  if (!readonlyPattern()) {
-    // 如果没有文档 id 就说明是
-    if (documentId && extractData) {
-      editor.setValues(extractData, true, true)
-    }
+  if (readonlyPattern()) return;
+  // 如果没有文档 id 就说明是新建的,extractData如果是空就不用调用,不然他会使用 getAppContext 里面的数据
+  if (documentId && extractData) {
+    editor.setValues(extractData, true, true)
   }
 }
 
@@ -1373,101 +1181,7 @@ const paginationSymbol = () => {
   editor.execute('insertContents', {value: [{type: 'pagebreak'}]})
 }
 
-const textStyleFunc = ref({
-  fontSizeAdjust: (val) => {
-    editor.execute('fontSizeAdjust', {value: val})
-  },
-  fontFamily: () => {
-    editor.execute('fontFamily', {value: emrStyle.fontFamily})
-    editor.focus()
-  },
-  fontSize: () => {
-    editor.execute('fontSize', {value: emrStyle.fontSize})
-    editor.focus()
-  },
-  fontWeight: () => {
-    let val = emrStyle.fontWeight === 'normal' ? 'bold' : 'normal'
-    emrStyle.fontWeight = val
-    editor.execute('fontWeight', {value: val})
-    editor.focus()
-  },
-  fontStyle: () => {
-    let val = emrStyle.fontStyle === 'normal' ? 'oblique' : 'normal'
-    emrStyle.fontStyle = val
-    editor.execute('fontStyle', {value: val})
-    editor.focus()
-  },
-  underline: () => {
-    emrStyle.underline = !emrStyle.underline
-    let value = emrStyle.underline ? 'underline' : 'remove underline'
-    editor.execute('textDecoration', {value})
-  },
-  lineThrough: () => {
-    emrStyle.lineThrough = !emrStyle.lineThrough
-    let value = emrStyle.lineThrough ? 'line-through' : 'remove line-through'
-    editor.execute('textDecoration', {value})
-  },
-  super: () => {
-    emrStyle.super = !emrStyle.super
-    let value = emrStyle.super ? 'super' : 'baseline'
-    editor.execute('verticalAlign', {value})
-  },
-  sub: () => {
-    emrStyle.sub = !emrStyle.sub
-    let value = emrStyle.sub ? 'sub' : 'baseline'
-    editor.execute('verticalAlign', {value})
-  },
-  color: () => {
-    editor.execute('color', {value: emrStyle.color})
-  },
-  backgroundColor: () => {
-    editor.execute('backgroundColor', {value: emrStyle.backgroundColor})
-  },
-  alignment: (val) => {
-    editor.execute('textAlign', {value: val})
-  },
-  unorderedList: (val) => {
-    if (val === null) {
-      editor.execute("nonList", {
-        value: "none"
-      })
-    }
-    editor.execute('symbolList', {"value": val})
-  },
-  orderedList: (val) => {
-    if (val === null) {
-      editor.execute("nonList", {
-        value: "none"
-      })
-    }
-    //设置有序列表
-    editor.execute('orderList', {"value": val})
-  },
-  indent: (val) => {
-    emrStyle.paragraphStyle.paragraphIndent.left += val
-    editor.execute('paragraphStyle', {value: emrStyle.paragraphStyle})
-  }
-})
-
-const scroll = ({scrollLeft: left, scrollTop}) => {
-  scrollLeft = left
-}
-
-const tootScrollRef = ref(null)
-let scrollLeft = 0
-const mousewheel = (e) => {
-  let eventDelta = -e.wheelDelta || -e.deltaY * 40;
-  tootScrollRef.value?.setScrollLeft(scrollLeft + eventDelta);
-}
-
-const buttonClass = (val, activation = true) => {
-  if (emrStyle[val] === activation) {
-    return 'emr__button_select'
-  } else {
-    return 'button'
-  }
-}
-
+const styleBarRef = ref(null)
 
 /**
  * 解析 iframe 上面的参数保证一致
@@ -1601,7 +1315,6 @@ onMounted(async () => {
     }
   })
 
-
   autoSaveFunc()
 
   emrMitt.on('editor', () => {
@@ -1628,7 +1341,6 @@ onMounted(async () => {
       document.title = `电子病历-正在编辑【${props.huanZheXinXi.name}】`
     }
   }, {immediate: true})
-
 })
 
 onDeactivated(() => {
@@ -1811,100 +1523,9 @@ function changeRatio() {
   return ratio;
 }
 
-let backToQC = {
-  "id": 1,
-  "name": "",
-  "code": "",
-  "thePromptWasNotCreated": "",
-  "editThePromptStatement": "",
-  "level1DoctorCreatesATimeLimit": 0,
-  "level1DoctorEditingTimeLimit": 0,
-  "theSeniorDoctorCreatesATimeLimit": 0,
-  "sqlId": 0,
-  "sql": "",
-  "sqlName": "",
-  "open": 1,
-  "timeSubtracts": 74
-}
-
-/**
- * 现在有两个特殊病历
- * 入院病历需要填写补充诊断
- * 病程记录锁住
- */
-const 判断可否创建或编辑 = async () => {
-  backToQC = null
-  规则不可编辑 = false
-  if (typeof props.huanZheXinXi.dischargeDays !== 'undefined'
-      && props.huanZheXinXi.dischargeDays > 7) {
-    return
-  }
-  let data = {
-    code: categoryCode,
-    documentId,
-    patNo: props.huanZheXinXi.inpatientNo,
-    times: props.huanZheXinXi.admissTimes,
-    userCode: userData.code
-  }
-  try {
-    backToQC = await createAnEdit(data)
-    if (stringIsBlank(documentId)) {
-      可否创建()
-    } else {
-      可否编辑()
-    }
-  } catch {
-  }
-}
-
-const 可否创建 = () => {
-  if (backToQC === null) return
-  let 时限 = doctorLevel === 1 ? backToQC.level1DoctorCreatesATimeLimit : backToQC.theSeniorDoctorCreatesATimeLimit;
-  if (backToQC.timeSubtracts > 时限) {
-    let str = `<span style="color: red">${backToQC.thePromptWasNotCreated}</span>
-               医务部通过审核后,方可创建病历。`
-    ElMessageBox.prompt(str, '提示', {
-      type: "warning",
-      closeOnPressEscape: false,
-      closeOnClickModal: false,
-      inputValidator: (val) => {
-        if (XEUtils.isEmpty(val)) {
-          return false;
-        }
-        if (val === null || val.length < 1 || val.length > 50) {
-          return false;
-        }
-      },
-      dangerouslyUseHTMLString: true,
-      inputErrorMessage: '不能为空,最多可输入50个字符。',
-    }).then(({value}) => {
-      let data = {
-        inputRemark: value,
-        code: categoryCode,
-        patNo: props.huanZheXinXi.inpatientNo,
-        times: props.huanZheXinXi.admissTimes,
-        flag: 0
-      }
-      reqUnlock(data)
-    }).catch(() => {
-
-    }).finally(() => {
-      emptyEditor()
-    })
-    throw new Error('')
-  }
-}
-
-let 规则不可编辑 = false
-const 可否编辑 = () => {
-  if (backToQC === null) return
-  if (doctorLevel === 1) {
-    let 时限 = backToQC.level1DoctorEditingTimeLimit
-    if (backToQC.timeSubtracts > 时限) {
-      规则不可编辑 = true
-      ElMessage.error(backToQC.editThePromptStatement)
-    }
-  }
+const setEditor = () => {
+  editor = currentEmr.value.getEditor()
+  styleBarRef.value.setEditor(editor)
 }
 
 defineExpose({
@@ -1931,33 +1552,11 @@ defineExpose({
   position: relative;
 }
 
-.emr__button_select {
-  border: 1px solid #a0a0a0;
-  font-size: 14px;
-}
-
 .button {
   border: 1px solid transparent;
   font-size: 14px;
 }
 
-.tool_emr {
-  width: max-content;
-  height: 30px;
-  background-color: #f0f0f0;
-  display: flex;
-  align-items: center;
-}
-
-.color_picker {
-  &:hover {
-    cursor: pointer;
-    color: #409EFF;
-  }
-
-  background-color: white;
-}
-
 .emr-template-open {
   width: 215px;
   background-color: white;

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

@@ -67,9 +67,8 @@ import {
 import EmrPatientList from "@/components/zhu-yuan-yi-sheng/emr/EmrPatientList.vue";
 import EmrLeaveHospitalPatient from "@/components/zhu-yuan-yi-sheng/emr/EmrLeaveHospitalPatient.vue";
 import EmrSelectPat from "@/components/zhu-yuan-yi-sheng/EmrSelectPat.vue";
-import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue";
 import {emrSocketUnlockApi, repeatedlyOpenTheSamePatient} from "@/api/zhu-yuan-yi-sheng/emr-socket";
-import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
+import {stringNotBlank} from "@/utils/blank-utils";
 import EmrQualityControlRelieve
   from "@/components/zhu-yuan-yi-sheng/emr/EmrQualityControlRelieve/EmrQualityControlRelieve.vue";
 import {getMyUnlockByPatNo} from "@/api/zhu-yuan-yi-sheng/emr-control-rule";
@@ -129,6 +128,7 @@ const routerFunc = async () => {
       show = false
       BizException(ExceptionEnum.LOGICAL_ERROR, "请勿重复打开病历。")
     }
+    console.log(query.value)
     let reqUnlock = await getMyUnlockByPatNo(query.value.patNo, query.value.times)
     console.log('申请数据 %o', reqUnlock)
     if (reqUnlock != null) {

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

@@ -1,5 +1,6 @@
 <template>
   <el-button @click="setAuditClick" v-if="permissions()">发送</el-button>
+  <el-divider direction="vertical"/>
   <emr-audit-dialog :emr-id="emrInfo.id"
                     :final-control="patInfo.finalControl"
                     :count="historyCount"/>
@@ -7,6 +8,9 @@
     <el-divider direction="vertical"/>
     <el-button @click="finalControl">标记终末质控</el-button>
   </template>
+  <template v-else-if="permissions()">
+    <el-button>病历评分</el-button>
+  </template>
 
   <el-table :data="data"
             :height="getWindowSize.h / 1.1"

+ 397 - 0
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/EmrStyleBar.vue

@@ -0,0 +1,397 @@
+<script setup lang="ts">
+import {ref} from 'vue'
+import EmrUnorderedList from "../../../../../../components/zhu-yuan-yi-sheng/emr/EmrUnorderedList.vue";
+import {
+  availableFonts,
+  fontSizes,
+} from "../../../../../../views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init";
+
+export interface LineHeight {
+  type: string;
+  value: number;
+}
+
+export interface ParagraphSpacing {
+  before: number;
+  after: number;
+}
+
+export interface ParagraphIndent {
+  left: number;
+  right: number;
+}
+
+export interface SpecialIndent {
+  type: string;
+  value: number;
+}
+
+export interface ParagraphStyle {
+  lineHeight: LineHeight;
+  paragraphSpacing: ParagraphSpacing;
+  paragraphIndent: ParagraphIndent;
+  specialIndent: SpecialIndent;
+  textAlign?: any;
+}
+
+export interface LineHeight {
+  type: string;
+  value: number;
+}
+
+export interface ParagraphSpacing {
+  before: number;
+  after: number;
+}
+
+export interface ParagraphIndent {
+  left: number;
+  right: number;
+}
+
+export interface SpecialIndent {
+  type: string;
+  value: number;
+}
+
+export interface ParagraphSetting {
+  lineHeight: LineHeight;
+  paragraphSpacing: ParagraphSpacing;
+  paragraphIndent: ParagraphIndent;
+  specialIndent: SpecialIndent;
+  textAlign?: any;
+}
+
+export interface RootObject {
+  titleStyle: string;
+  color: string;
+  backgroundColor: string;
+  fontFamily: string;
+  fontSize: string;
+  bold: boolean;
+  italic: boolean;
+  underline: boolean;
+  linethrough: boolean;
+  checkList: boolean;
+  listType?: any;
+  listStyle?: any;
+  subScript: boolean;
+  superScript: boolean;
+  paragraphStyle: ParagraphStyle;
+  paragraphSetting: ParagraphSetting;
+}
+
+const emrStyleV2 = ref<RootObject>({
+  backgroundColor: "",
+  bold: false,
+  checkList: false,
+  color: "",
+  fontFamily: "",
+  fontSize: "",
+  italic: false,
+  linethrough: false,
+  paragraphSetting: undefined,
+  paragraphStyle: undefined,
+  subScript: false,
+  superScript: false,
+  titleStyle: "",
+  underline: false
+})
+
+const tootScrollRef = ref(null)
+
+let scrollLeft = 0
+const mousewheel = (e) => {
+  let eventDelta = -e.wheelDelta || -e.deltaY * 40;
+  tootScrollRef.value?.setScrollLeft(scrollLeft + eventDelta);
+}
+
+let editor = null
+
+const scroll = ({scrollLeft: left, scrollTop}) => {
+  scrollLeft = left
+}
+
+const buttonClass = (val) => {
+  if (emrStyleV2.value[val]) {
+    return 'primary'
+  } else {
+    return ''
+  }
+}
+
+const predefineColors = [
+  '#ff4500',
+  '#ff8c00',
+  '#ffd700',
+  '#90ee90',
+  '#00ced1',
+  '#1e90ff',
+  '#c71585',
+  'rgba(255, 69, 0, 0.68)',
+  'rgb(255, 120, 0)',
+  'hsv(51, 100, 98)',
+  'hsva(120, 40, 94, 0.5)',
+  'hsl(181, 100%, 37%)',
+  'hsla(209, 100%, 56%, 0.73)',
+  '#c7158577',
+]
+
+const textStyleFunc = ref({
+  fontSizeAdjust: (val) => {
+    editor.execute('fontSizeAdjust', {value: val})
+  },
+  fontFamily: (val) => {
+    editor.execute('fontFamily', {value: val})
+    editor.focus()
+  },
+  fontSize: (val) => {
+    editor.execute('fontSize', {value: val})
+    editor.focus()
+  },
+  fontWeight: () => {
+    emrStyleV2.value.bold = !emrStyleV2.value.bold
+    editor.execute('fontWeight', {value: emrStyleV2.value.bold ? "bold" : "normal"})
+    editor.focus()
+  },
+  fontStyle: () => {
+    emrStyleV2.value.italic = !emrStyleV2.value.italic
+    editor.execute('fontStyle', {value: emrStyleV2.value.italic ? 'oblique' : 'normal'})
+    editor.focus()
+  },
+  underline: () => {
+    emrStyleV2.value.underline = !emrStyleV2.value.underline
+    let value = emrStyleV2.value.underline ? 'underline' : 'remove underline'
+    editor.execute('textDecoration', {value})
+  },
+  linethrough: () => {
+    emrStyleV2.value.linethrough = !emrStyleV2.value.linethrough
+    let value = emrStyleV2.value.linethrough ? 'line-through' : 'remove line-through'
+    editor.execute('textDecoration', {value})
+  },
+  superScript: () => {
+    emrStyleV2.value.superScript = !emrStyleV2.value.superScript
+    let value = emrStyleV2.value.superScript ? 'super' : 'baseline'
+    editor.execute('verticalAlign', {value})
+  },
+  subScript: () => {
+    emrStyleV2.value.subScript = !emrStyleV2.value.subScript
+    let value = emrStyleV2.value.subScript ? 'sub' : 'baseline'
+    editor.execute('verticalAlign', {value})
+  },
+  color: () => {
+    editor.execute('color', {value: emrStyleV2.value.color})
+  },
+  backgroundColor: () => {
+    editor.execute('backgroundColor', {value: emrStyleV2.value.backgroundColor})
+  },
+  alignment: (val) => {
+    editor.execute('textAlign', {value: val})
+  },
+  unorderedList: (val) => {
+    if (val === null) {
+      editor.execute("nonList", {
+        value: "none"
+      })
+    }
+    editor.execute('symbolList', {"value": val})
+  },
+  orderedList: (val) => {
+    if (val === null) {
+      editor.execute("nonList", {
+        value: "none"
+      })
+    }
+    //设置有序列表
+    editor.execute('orderList', {"value": val})
+  },
+  indent: (val) => {
+    emrStyleV2.value.paragraphStyle.paragraphIndent.left += val
+    editor.execute('paragraphStyle', {value: emrStyleV2.value.paragraphStyle})
+  }
+})
+
+const setEditor = (val) => {
+  editor = val
+}
+
+const setEmrStyleV2 = (val) => {
+  if (val) {
+    emrStyleV2.value = val;
+  }
+}
+
+defineExpose({
+  setEditor,
+  setEmrStyleV2
+})
+
+</script>
+
+<template>
+  <div style="height: 30px" @mousewheel="mousewheel($event)">
+    <el-scrollbar ref="tootScrollRef" @scroll="scroll">
+      <div class="tool_emr">
+        <el-select style="width: 150px;"
+                   @change="textStyleFunc.fontFamily"
+                   v-model="emrStyleV2.fontFamily">
+          <el-option v-for="item in availableFonts"
+                     :value="item.font"
+                     :label="item.text">
+                  <span :style="{'fontFamily':item.font }">
+                    {{ item.text }}
+                  </span>
+          </el-option>
+        </el-select>
+        <el-select style="width: 70px;"
+                   @change="textStyleFunc.fontSize"
+                   v-model="emrStyleV2.fontSize">
+          <el-option v-for="item in fontSizes"
+                     :value="item.code"
+                     :label="item.name"/>
+        </el-select>
+        <el-divider direction="vertical"/>
+        <el-button-group>
+          <el-button @click="textStyleFunc.fontSizeAdjust('increase')"
+                     title="放大字体">
+            +
+          </el-button>
+          <el-button @click="textStyleFunc.fontSizeAdjust('decrease') "
+                     title="缩小字体">
+            -
+          </el-button>
+        </el-button-group>
+        <el-divider direction="vertical"/>
+        <el-button-group>
+          <el-button
+              title="字体加粗"
+              :type="buttonClass('bold')"
+              @click="textStyleFunc.fontWeight()">
+            <i class="iconfont icon-jiacu"></i>
+          </el-button>
+          <el-button
+              title="斜体"
+              :type="buttonClass('italic')"
+              @click="textStyleFunc.fontStyle()">
+            <i class="iconfont icon-xieti"></i>
+          </el-button>
+          <el-button
+              title="下划线"
+              :type="buttonClass('underline')"
+              @click="textStyleFunc.underline()">
+            <i class="iconfont icon-xiahuaxian"></i>
+          </el-button>
+          <el-button
+              title="删除线"
+              :type="buttonClass('linethrough')"
+              @click="textStyleFunc.linethrough()">
+            <i class="iconfont icon-shanchuxian"></i>
+          </el-button>
+          <el-button
+              title="上标"
+              :type="buttonClass('superScript')"
+              @click="textStyleFunc.superScript()">
+            <i class="iconfont icon-zitishangbiao"></i>
+          </el-button>
+          <el-button
+              title="下标"
+              :type="buttonClass('subScript')"
+              @click="textStyleFunc.subScript()">
+            <i class="iconfont icon-zitixiabiao"></i>
+          </el-button>
+        </el-button-group>
+        <div class="color_picker"
+             title="字体颜色">
+          <i class="iconfont icon-zitiyanse"></i>
+          <el-color-picker v-model="emrStyleV2.color"
+                           @change="textStyleFunc.color()"
+                           :predefine="predefineColors"/>
+        </div>
+        <div class="color_picker"
+             title="背景颜色">
+          <i class="iconfont icon-beijingyanse"></i>
+          <el-color-picker v-model="emrStyleV2.backgroundColor"
+                           @change="textStyleFunc.backgroundColor()"
+                           :predefine="predefineColors"/>
+        </div>
+        <el-divider direction="vertical"/>
+        <el-button-group>
+          <el-popover
+              :width="0"
+              trigger="hover">
+            <template #reference>
+              <el-button title="无序列表">
+                <i class="iconfont icon-wuxuliebiao"></i>
+              </el-button>
+            </template>
+            <emr-unordered-list list-type="disorder" @click-list="textStyleFunc.unorderedList"/>
+          </el-popover>
+          <el-popover
+              :width="0"
+              trigger="hover">
+            <template #reference>
+              <el-button title="有序列表">
+                <i class="iconfont icon-youxuliebiao"></i>
+              </el-button>
+            </template>
+            <emr-unordered-list list-type="orderly" @click-list="textStyleFunc.orderedList"/>
+          </el-popover>
+        </el-button-group>
+        <el-divider direction="vertical"/>
+        <el-button-group>
+          <el-button title="左对齐"
+                     @click="textStyleFunc.alignment('left')">
+            <i class="iconfont icon-zuoduiqi"></i>
+          </el-button>
+          <el-button title="居中对其"
+                     @click="textStyleFunc.alignment('center')">
+            <i class="iconfont icon-juzhongduiqi"></i>
+          </el-button>
+          <el-button title="右对齐"
+                     @click="textStyleFunc.alignment('right')">
+            <i class="iconfont icon-youduiqi"></i>
+          </el-button>
+          <el-button title="两端对齐"
+                     @click="textStyleFunc.alignment('justify')">
+            <i class="iconfont icon-zuoyouduiqi"></i>
+          </el-button>
+        </el-button-group>
+        <el-divider direction="vertical"/>
+        <el-button-group>
+          <el-button title="增加缩进"
+                     @click="textStyleFunc.indent(1)">
+            <i class="iconfont icon-yousuojin"></i>
+          </el-button>
+          <el-button title="减小缩进"
+                     @click="textStyleFunc.indent(-1)">
+            <i class="iconfont icon-zuosuojin"></i>
+          </el-button>
+        </el-button-group>
+      </div>
+    </el-scrollbar>
+  </div>
+</template>
+
+<style scoped lang="scss">
+.tool_emr {
+  width: max-content;
+  height: 30px;
+  background-color: #f0f0f0;
+  display: flex;
+  align-items: center;
+}
+
+.color_picker {
+  &:hover {
+    cursor: pointer;
+    color: #409EFF;
+  }
+
+  background-color: white;
+}
+
+.emr__button_select {
+  border: 1px solid #a0a0a0;
+  font-size: 14px;
+}
+</style>

+ 5 - 2
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-edit-create-limit.js

@@ -1,5 +1,8 @@
 import XEUtils from "xe-utils";
 import {needRule} from "@/utils/public";
+import store from "@/store";
+
+let userData = store.state.user.info
 
 
 export class EmrEditCreateLimit {
@@ -17,8 +20,8 @@ export class EmrEditCreateLimit {
      */
     getDoctorLevelById(userCode) {
         let pat = this.patInfo
-        if (needRule(1)) {
-            return 3;
+        if (needRule() && userCode === userData.code) {
+            return 4;
         }
         if (userCode === pat.deptDirector) {
             return 3;