瀏覽代碼

CA 优化

xiaochan 9 月之前
父節點
當前提交
38dac2918c

+ 28 - 15
src/components/cy/CyDialog/index.ts

@@ -7,9 +7,12 @@ interface DialogProps {
   width?: number | string;
   top?: string | number;
   showClose?: boolean;
+  alignCenter?: boolean;
+  closeOnClickModal?: boolean;
+  closeOnPressEscape?: boolean;
 }
 
-type CloseValue = "close" | "confirm" | "cancel";
+export type CloseValue = "close" | "confirm" | "cancel";
 
 export interface DialogExpose {
   // 如果报错了会阻止关闭弹窗
@@ -48,7 +51,10 @@ export interface DialogOptions<P = Component> {
   visible?: boolean;
   component?: any;
   componentRef?: DialogExpose;
-  manuallyClose?: (cb: (value: CloseValue, data: any) => void) => void;
+  manuallyClose?: (
+    cb: (value: CloseValue, data: any) => void,
+    currentItem: DialogState
+  ) => void;
 }
 
 export interface DialogState extends DialogOptions {
@@ -91,19 +97,26 @@ export function useDialog<R = any, C = Component>(
 
     if (props.manuallyClose) {
       const currentItem = dialogStore.value[pushIndex - 1];
-      currentItem.dialogProps.showClose = true;
-      currentItem.showCancel = false;
-      currentItem.showConfirm = false;
-
-      props.manuallyClose((value: CloseValue, data: any) => {
-        const item = dialogStore.value[pushIndex - 1];
-        if (value === "confirm") {
-          item.resolve(data);
-        } else {
-          item.reject({ value: item.closeValue, data });
-        }
-        item.visible = false;
-      });
+      currentItem.dialogProps.showClose = false;
+      currentItem.dialogProps.alignCenter =
+        currentItem.dialogProps.alignCenter ?? true;
+      currentItem.dialogProps.closeOnClickModal = false;
+      currentItem.dialogProps.closeOnPressEscape = false;
+
+      currentItem.showFooter = false;
+
+      props.manuallyClose(
+        (value: CloseValue, data: any) => {
+          const item = dialogStore.value[pushIndex - 1];
+          if (value === "confirm") {
+            item.resolve(data);
+          } else {
+            item.reject({ value: item.closeValue, data });
+          }
+          item.visible = false;
+        },
+        dialogStore.value[pushIndex - 1]
+      );
     }
   });
 }

+ 21 - 9
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/plugins/ca/EmrCAComp.vue

@@ -1,6 +1,11 @@
 <script setup lang="tsx">
 import { emrRootContextKey } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-func/useEmrStore";
-import { getInternalByCode, selectData, SignComp } from "./emr-ca";
+import {
+  authorizedSignatureDataElement,
+  getInternalByCode,
+  selectData,
+  SignComp,
+} from "./emr-ca";
 import XEUtils from "xe-utils";
 import { BizException, ExceptionEnum } from "@/utils/BizException";
 import { sendMoreEventSign } from "@/api/ca/ca-api";
@@ -249,6 +254,16 @@ const addCompByInternal = (name: string) => {
   change();
 };
 
+const addAuthorizedSignatureDataElement = () => {
+  const editor = store.getEditor();
+
+  editor.execute("insertContents", {
+    value: [authorizedSignatureDataElement()],
+    isPuzzlepiece: true,
+    defaultValue: "",
+  });
+};
+
 defineExpose({
   change,
 });
@@ -269,7 +284,11 @@ defineExpose({
           <li>不知道选什么关系就选朋友</li>
         </ol>
       </div>
-
+      <el-button @click="addAuthorizedSignatureDataElement()"
+        >医生授权签名组件
+      </el-button>
+      <el-button @click="addCompByInternal('患者CA签名')">签名组件 </el-button>
+      <el-button @click="addCompByInternal('患者CA意见')">意见组件 </el-button>
       <el-form label-position="top">
         <el-form-item label="签名方式">
           <el-select
@@ -280,13 +299,6 @@ defineExpose({
           >
             <xc-el-option :data="signType" />
           </el-select>
-          <el-divider direction="vertical" />
-          <el-button @click="addCompByInternal('患者CA签名')"
-            >签名组件
-          </el-button>
-          <el-button @click="addCompByInternal('患者CA意见')"
-            >意见组件
-          </el-button>
         </el-form-item>
         <el-form-item>
           <el-select

+ 131 - 18
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/plugins/ca/emr-ca.tsx

@@ -3,7 +3,11 @@ import { CaSendParams, sendBatchByCode, sendByCode } from "@/api/ca/ca-api";
 import { isDev } from "@/utils/public";
 import { useUserStore } from "@/pinia/user-store";
 import XEUtils from "xe-utils";
-import { useDialog } from "@/components/cy/CyDialog/index";
+import {
+  CloseValue,
+  DialogState,
+  useDialog,
+} from "@/components/cy/CyDialog/index";
 import {
   EmrStore,
   rightCompIndex,
@@ -36,6 +40,103 @@ export type SignComp = {
   signOpinion: string;
 };
 
+export const authorizedSignatureDataElement = () => {
+  return {
+    required: false,
+    readonly: false,
+    deletable: true,
+    privacy: false,
+    script: {
+      content: null,
+      dynamicScript: "2154eae0167611ef8717efceee160e36",
+    },
+    format: {
+      dataType: null,
+      showType: null,
+      minLength: null,
+      maxLength: null,
+      minRows: null,
+      maxRows: null,
+      scale: null,
+      enums: null,
+      dictionary: null,
+    },
+    element: {
+      id: "ff105fe08f7a11ef865875b608250cef",
+      type: "element",
+      name: "授权CA签名",
+      code: {
+        business: "",
+        internal: "授权CA签名",
+        dataElement: "",
+      },
+    },
+    tips: "授权CA签名",
+    borderStyle: "none",
+    style: {
+      id: "e6aRxaE7OLt",
+    },
+    picker: {
+      type: null,
+      propertiesConfig: {
+        signCount: {
+          name: "签名数量",
+          code: "signCount",
+          category: "extend",
+          categoryName: "扩展",
+          value: 1,
+          editor: {
+            type: "numberfield",
+            minvalue: 1,
+          },
+        },
+        maxHeight: {
+          name: "最大高度",
+          code: "maxHeight",
+          category: "extend",
+          categoryName: "扩展",
+          editor: {
+            type: "numberfield",
+          },
+        },
+        valign: {
+          name: "对齐方式",
+          code: "valign",
+          category: "extend",
+          categoryName: "扩展",
+          editor: {
+            type: "select",
+            valueField: "code",
+            displayField: "name",
+            store: {
+              type: "store",
+              fields: ["code", "name"],
+              data: [
+                {
+                  code: "top",
+                  name: "上对齐",
+                },
+                {
+                  code: "middle",
+                  name: "中对齐",
+                },
+                {
+                  code: "bottom",
+                  name: "下对齐",
+                },
+              ],
+            },
+          },
+        },
+      },
+    },
+    editable: false,
+    contentWrap: true,
+    signCount: 1,
+    type: "smarttext",
+  };
+};
+
 export const selectData = [
   {
     code: 1,
@@ -66,6 +167,17 @@ type saveType =
     }
   | any;
 
+const GenerateSignatureDialog = defineComponent({
+  setup() {},
+  render() {
+    return (
+      <div style={{ padding: "20px", textAlign: "center" }}>
+        正在生成您的签名请稍后 ...
+      </div>
+    );
+  },
+});
+
 const us = useUserStore().userInfo;
 
 export function getInternalByCode(
@@ -77,7 +189,7 @@ export function getInternalByCode(
   const signatureControl = editor.getDataElements(code, false, true);
   let data = signatureControl[name] as DataElementItem[];
   if (!data) {
-    return null;
+    return [];
   }
   if (!XEUtils.isArray(data)) {
     data = [data];
@@ -100,14 +212,17 @@ function getViewById(editor: EditType, id: string) {
 }
 
 function dialog() {
-  let tmpClose = (_value, _data) => {};
+  let tmpClose = (_value: CloseValue, _data) => {};
+  let value: DialogState;
 
-  useDialog(<div>正在生成您的签名请稍后。。。</div>, {
+  useDialog(GenerateSignatureDialog, {
     dialogProps: {
       title: "生成签名中",
+      alignCenter: false,
     },
-    manuallyClose: cb => {
+    manuallyClose: (cb, v) => {
       tmpClose = cb;
+      value = v;
     },
   }).then(XEUtils.noop);
 
@@ -115,6 +230,7 @@ function dialog() {
     closed() {
       tmpClose("confirm", null);
     },
+    value,
   };
 }
 
@@ -237,19 +353,16 @@ export function emrCa() {
 
   const oldSign = () => {
     const signatureControl = getInternalByCode(editor, "自动签名", "business");
-    if (signatureControl) {
-      signatureControl.forEach(item => {
-        const element = getViewById(editor, item.id);
-        element.view.sign([
-          {
-            name: us.name,
-            code: us.code,
-            signature: `/doctorSignatureImage/${us.code}.png`,
-          },
-        ]);
-      });
-      console.log(signatureControl);
-    }
+    signatureControl.forEach(item => {
+      const element = getViewById(editor, item.id);
+      element.view.sign([
+        {
+          name: us.name,
+          code: us.code,
+          signature: `/doctorSignatureImage/${us.code}.png`,
+        },
+      ]);
+    });
   };
 
   return {

+ 1 - 2
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-func/useEmrStore.ts

@@ -86,8 +86,7 @@ export const useEmrStore = (patId: string) => {
     installPlugins(value: UseEmrInitReturn, tmpStore: any) {
       for (let key in plugins) {
         const item = plugins[key];
-        if (item.install)
-          item.install({ e: value.editor, r: value.runtime, s: tmpStore });
+        item?.install?.({ e: value.editor, r: value.runtime, s: tmpStore });
         store.plugins.push(item);
       }
     },