Selaa lähdekoodia

患者开出院医嘱时校验住院时间是否小于等于4天

xiaochan 7 kuukautta sitten
vanhempi
commit
3232b49b20

+ 82 - 27
src/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/yz-edit/YzEditor.vue

@@ -257,7 +257,6 @@
 
 <script setup lang="ts">
 import {
-  analyzeSiChargeLimit,
   confirmOrders,
   copyOrder,
   enterOrders,
@@ -300,7 +299,7 @@ import {
   yzInfoPrompt,
   jsQueryYzData,
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
-import { ElMessageBox } from "element-plus";
+import { dayjs, ElMessageBox } from "element-plus";
 import YzDialog from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/dialog/YzDialog";
 import Dig from "@/utils/math";
 import SelectV4 from "@/components/xiao-chan/select-v4/SelectV4.vue";
@@ -329,6 +328,7 @@ import doctorStore, {
   YzSidebarEnum,
 } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/useDoctorStore";
 import { useDialog } from "@/components/cy/CyDialog/index";
+import { isDev } from "@/utils/public";
 
 const props = withDefaults(
   defineProps<{
@@ -403,6 +403,11 @@ const searchClickFunc = async (row: SearchOrdersType): Promise<void> => {
     .setDefaultValueByName("newOrderFlag", 1)
     .setDefaultValueByName("statusFlag", "1");
 
+  let now = await getServerDate();
+
+  setYzData("orderTime", now);
+  setYzData("startTime", now);
+
   // 查询一下父医嘱
   fuYiZhuClick();
   // 药品
@@ -461,6 +466,8 @@ const drugDefaultValue = async (
     yiZhuData.value.superiorDoctor,
     yiZhuData.value.statusFlag
   );
+
+  // @ts-ignore
   const {
     permissionPrompt,
     prompt,
@@ -477,25 +484,11 @@ const drugDefaultValue = async (
 
   // 医生没有权限
   if (permissionPrompt) {
-    await useDialog(DoctorAuthorization, {
-      params: {
-        drugCode: drugKey,
-      },
-      dialogProps: {
-        title: "医生授权",
-        closeOnPressEscape: false,
-        closeOnClickModal: false,
-        showClose: false,
-      },
-    })
-      .then(res => {
-        setYzData("superiorDoctor", res.code);
-        yzInfoPrompt.value.push("医生授权");
-      })
-      .catch(() => {
-        clearAndErrorMessage("取消授权。");
-        yzInfoPrompt.value.push("取消授权");
-      });
+    const prompt =
+      "药品分为限制等级,可通过上级医生授权的方式开出大于自身等级的药品,输入上级医生的工号和密码后,点击确认即可,请注意点击确认后该医嘱会变成这个医生开的,请不要在此医嘱上进行修改不然这条医嘱会变成另外一个医生的,如果开错了,删除重新开。";
+    await doctorAuth(drugKey, prompt).then(res => {
+      setYzData("superiorDoctor", res.code);
+    });
   }
 
   // 加载药品的计量
@@ -574,6 +567,45 @@ const itemDefaultValue = (
     yiZhuData.value.superiorDoctor,
     yiZhuData.value.statusFlag
   );
+
+  if (yiZhuData.value.orderCode === "06026") {
+    if (isDev) {
+      huanZheXinXi.value.admissDate = dayjs(new Date())
+        .subtract(3, "day")
+        .format("YYYY-MM-DD HH:mm:ss");
+    }
+
+    const diffDays = dayjs(yiZhuData.value.orderTime).diff(
+      dayjs(huanZheXinXi.value.admissDate),
+      "day"
+    );
+    if (
+      diffDays <= 4 &&
+      yiZhuData.value.superiorDoctor !== huanZheXinXi.value.deptDirector
+    ) {
+      const prompt = `患者出院天数小于等于4需要【科主任】授权,此患者的科主任设置为:【${huanZheXinXi.value.deptDirectorName}】`;
+      const beforeConfirm = value => {
+        if (value.code !== huanZheXinXi.value.deptDirector) {
+          return "授权医生不是该患者的科主任。";
+        }
+        return true;
+      };
+
+      doctorAuth(
+        `${data.orderCode}_${data.serial}`,
+        prompt,
+        beforeConfirm
+      ).then(res => {
+        if (res.code === huanZheXinXi.value.deptDirector) {
+          setYzData("superiorDoctor", res.code);
+        } else {
+          yzInfoPrompt.value.push("取消授权");
+          clearAndErrorMessage("授权医生不是该患者的科主任。");
+        }
+      });
+    }
+  }
+
   const { prompt }: FeeInfo = huoQuFeiYongXinXi(queryKey).catch(() => {
     clearAndErrorMessage("请联系管理员。");
   });
@@ -608,12 +640,6 @@ const defaultAll = async (
 ) => {
   if (isSearch) {
     doctorStore.setYzSidebar(YzSidebarEnum.YZ);
-
-    let now = await getServerDate();
-
-    setYzData("orderTime", now);
-    setYzData("startTime", now);
-
     // 如果有默认科室的话就用项目中自带的科室,没有的话就用患者的科室
     if (data.execDept) {
       setYzData("execUnit", data.execDept);
@@ -667,6 +693,35 @@ const defaultAll = async (
   }
 };
 
+const doctorAuth = async (
+  key,
+  prompt,
+  beforeConfirm: (value: any) => string | boolean = () => true
+) => {
+  return await useDialog(DoctorAuthorization, {
+    params: {
+      drugCode: key,
+      prompt,
+      beforeConfirm,
+    },
+    dialogProps: {
+      title: "医生授权",
+      closeOnPressEscape: false,
+      closeOnClickModal: false,
+      showClose: false,
+    },
+  })
+    .then(res => {
+      yzInfoPrompt.value.push("医生授权");
+      return res;
+    })
+    .catch(() => {
+      yzInfoPrompt.value.push("取消授权");
+      clearAndErrorMessage("取消授权。");
+      throw new Error("");
+    });
+};
+
 const setYzData = (name: keyof YzType, value: any): void => {
   yiZhuData.value[name] = value;
 };

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

@@ -9,7 +9,7 @@
     </el-form-item>
     <el-alert type="warning">
       电子病历签名令牌在 企业微信 > 工具台 > 工作集成平台移动端 > 我的 <br />
-      电子病历签名令牌只作用与电子病历的签名<br />
+      电子病历签名令牌只作用与电子病历的签名和这个<br />
       如果你不想把密码告诉别人又想别人可以生成你的签名可以使用这个功能
     </el-alert>
     <el-form-item label="电子病历签名令牌:">

+ 1 - 0
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.ts

@@ -56,6 +56,7 @@ export interface PatInfo {
   admissWard?: string;
   name?: string;
   smallDept?: string;
+  deptDirectorName?: string;
 }
 
 // 患者信息

+ 28 - 8
src/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/DoctorAuthorization.vue

@@ -3,22 +3,34 @@
 import { doctorAuthorizationLogin } from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru";
 import { xcMessage } from "@/utils/xiaochan-element-plus";
 import { ref } from "vue";
+import SystemStaffSelect from "@/components/system/staff-select/SystemStaffSelect.vue";
+import { BizException, ExceptionEnum } from "@/utils/BizException";
 
-const props = defineProps<{
-  drugCode: string;
-}>();
+const props = withDefaults(
+  defineProps<{
+    drugCode: string;
+    prompt: string;
+    beforeConfirm?: (value: any) => string | boolean;
+  }>(),
+  {
+    beforeConfirm: () => true,
+  }
+);
 
 const param = ref({
-  codeRs: "",
-  code: "",
   password: "",
-  name: "",
   drugCode: "",
+  signCode: "",
+  code: "",
 });
 
 const confirm = async () => {
   param.value.drugCode = props.drugCode;
   return await doctorAuthorizationLogin(param.value).then(res => {
+    const beforeConfirm = props.beforeConfirm(res);
+    if (typeof beforeConfirm == "string") {
+      BizException(ExceptionEnum.MESSAGE_ERROR, beforeConfirm);
+    }
     xcMessage.success("授权成功。");
     return res;
   });
@@ -32,17 +44,25 @@ defineExpose({
 <template>
   <div>
     <el-alert type="warning">
-      药品分为限制等级,可通过上级医生授权的方式开出大于自身等级的药品,输入上级医生的工号和密码后,点击确认即可,请注意点击确认后该医嘱会变成这个医生开的,请不要在此医嘱上进行修改不然这条医嘱会变成另外一个医生的,如果开错了,删除重新开。。
+      {{ props.prompt }}
     </el-alert>
     <hr />
     <el-form>
       <el-form-item label="工号:">
-        <el-input v-model="param.codeRs" />
+        <SystemStaffSelect style="width: 100%" v-model="param.code" />
       </el-form-item>
 
       <el-form-item label="密码:">
         <el-input v-model="param.password" class="security" />
       </el-form-item>
+      <el-alert type="warning">
+        电子病历签名令牌在 企业微信 > 工具台 > 工作集成平台移动端 > 我的 <br />
+        电子病历签名令牌只作用与电子病历的签名,<br />
+        如果你不想把密码告诉别人又想别人可以生成你的签名可以使用这个功能
+      </el-alert>
+      <el-form-item label="授权:">
+        <el-input v-model="param.signCode" class="security" />
+      </el-form-item>
     </el-form>
   </div>
 </template>