// @ts-nocheck import { stringIsBlank, stringNotBlank } from "@/utils/blank-utils"; import { ElButton, ElMessage } from "element-plus"; import { getDrgPatInfo, getPatientInfo } from "@/api/inpatient/patient"; import { BizException, ExceptionEnum } from "@/utils/BizException"; import { computed, h, nextTick, onActivated, onDeactivated, Ref, ref, } from "vue"; import { getFormatDatetime } from "@/utils/date"; import { isDev } from "@/utils/public"; import { getFrequency, getSupplyType, getYzZdOrderItemConfirm, huoQuYiZhuShuJu, } from "@/api/zhu-yuan-yi-sheng/yi-zhu-lu-ru"; import EventBus from "@/utils/mitt"; import XEUtils from "xe-utils"; import { getAncillaryInformation } from "@/api/zhu-yuan-yi-sheng/jian-yan-jian-cha-shen-qing"; import { timeLimitPromptByPatientNo } from "@/api/emr-control/emr-time-limit-prompt"; import { aFewDaysAgo, elDateRangeAddTime, getServerDate, } from "@/utils/moment-utils"; import YaoPingXiangQing from "@/components/zhu-yuan-yi-sheng/he-li-yong-yao/YaoPingXiangQing.vue"; import cyRefList from "@/utils/cyRefList"; import { reportQueryCenterApiByGet } from "@/api/base-data/report-center"; import { useSystemStore } from "@/pinia/system-store"; import { TableMethods } from "vxe-table"; import ItemInstructions from "@/components/zhu-yuan-yi-sheng/yi-zhu-lu-ru/ItemInstructions.vue"; import { useDialog } from "@/components/cy/CyDialog/index"; import { getSendDockerPrompt } from "@/api/zhu-yuan-yi-sheng/sendDockerPrompt"; import SendPromptDialog from "@/views/hospitalization/zhu-yuan-yi-sheng/comp/SendPromptDialog.vue"; import { useYfGroupStore } from "@/pinia/use-yf-group"; export interface PatInfo { inpatientNo?: string | null; admissTimes?: number; ledgerSn?: number; admissDate?: string; groupInfoName?: string; groupInfoWeight?: string; groupInfoBl?: string; setGroupInfoProfit?: string; groupInfoFeeStand?: string; referPhysician?: string; consultPhysician?: string; deptDirector?: string; zkWard?: string; zkWardName?: string; sex?: number; age?: number; admissWard?: string; name?: string; smallDept?: string; deptDirectorName?: string; } // 患者信息 export const huanZheXinXi: Ref = ref({ zkWardName: "", zkWard: "", consultPhysician: "", deptDirector: "", referPhysician: "", groupInfoBl: "", groupInfoFeeStand: "", groupInfoName: "", groupInfoWeight: "", setGroupInfoProfit: "", ledgerSn: 0, admissTimes: 0, inpatientNo: null, admissDate: "", }); export function clearPatInfo() { huanZheXinXi.value = { zkWardName: "", zkWard: "", consultPhysician: "", deptDirector: "", referPhysician: "", groupInfoBl: "", groupInfoFeeStand: "", groupInfoName: "", groupInfoWeight: "", setGroupInfoProfit: "", ledgerSn: 0, admissTimes: 0, inpatientNo: null, admissDate: "", }; } // 是否点击了修改整个模板 export const muBanMing = ref({}); // 错误信息 export const cuoWuXinXi = ref(""); // 给药方式 export const geiYaoFangShiData = ref([]); // 频率 export const yaoPinPingLvData = ref([]); getSupplyType().then(res => { geiYaoFangShiData.value = res; }); getFrequency().then(res => { yaoPinPingLvData.value = res; }); export function youWuXuanZheHuanZhe() { if (stringIsBlank(huanZheXinXi.value.inpatientNo)) { ElMessage({ message: "请先选择患者", showClose: true, type: "error", }); return true; } return false; } export function getSelfBuy(val: string) { if (stringIsBlank(val)) return ""; switch (val) { case "1": return "自备"; case "2": return "嘱托"; case "3": return "基数药"; default: return ""; } } export let zkList = ref([]); export const frequCodeEnum = { all: "all", temporary: "temporary", longTerm: "longTerm", always: "ALWAYS", takeMedicine: "takeMedicine", }; export enum OrderBy { asc = "asc", desc = "desc", } // 生成的长期医嘱频率 export const frequencyConfig = "QD"; export const addTempOrderNo: number = -1; export interface YzType { id: string; inpatientNo: string; admissTimes: number; actOrderNo: number; orderCode: string; orderName: string; nationalCode?: any; packRetprice?: any; frequCode: string; frequCodeName: string; instruction?: any; discription?: any; infantFlag: string; orderTime: string; startTime: string; endTime?: any; endTimeTemp?: any; modifier?: any; modifierName?: any; physician: string; physicianName: string; drugSpecification?: any; drugQuan?: any; drugQuanName?: any; supplyCode?: any; supplyCodeName?: any; drugFlag: string; enterOper: string; psFlag: boolean; zkObj: string; enterOperName: string; packSizeName: string; enterTime: string; signer: string; signerName: string; confirmTime: string; miniUnit?: any; miniUnitName?: any; drugWeight?: any; drugWeightUnit?: any; drugWeightUnitName?: any; statusFlag: string; statusTime?: any; selfBuy: string | null; dose?: any; doseUnit?: any; doseUnitName?: any; drugOcc?: any; drugVolume?: any; drugVolUnit?: any; parentNo?: any; parentNoName?: any; packSize: number; packUnit?: any; paySelf: string; serial: string; serialName: string; groupNo: string; groupNoName: string; doctorFlag: string; execUnit: string; execUnitName: string; regFlag: string; ybSelfFlag?: any; emergencyFlag?: any; kfFlag?: any; kjywFlag?: any; stockAmount?: any; deptRestrictions?: any; visibleFlagZy?: any; excluBackTime?: any; excluActOrderNo?: any; excluType: string; clCode?: any; endTimeB?: any; deptCode: string; deptName: string; wardCode: string; wardName: string; newFlag: string; referPhysician?: any; referPhysicianName?: any; consultPhysician?: any; consultPhysicianName?: any; yyfs?: any; ssqk?: any; yysj?: any; ypLevel?: any; delFlag?: any; zkWardCode?: any; zkDeptCode?: any; children?: any; orderGroup?: any; executer1?: any; executer2?: any; newOrderFlag: number; superiorDoctor?: any; selfBuyName: string; statusFlagName: string; // 关联标志只在前端使用 associationFlag?: boolean; doctorName: string; execDept: string; execDeptName: string; } export interface SearchOrdersType { id: string; pyCode: string; patternCode: string | null; patternName: string | null; orderCode: string; orderName: string; specification: string | null; orderType: string | null; parentCode: string | null; excluGroupType: string | null; discription: string; serial: string; groupNo: string; groupName: string; infusionFlag: string; drugFlag: string; packSize: number; packSizeName: string; orderClass: string; specPack: string | null; jsyFlag: string | null; xnhFlag: string | null; ybComment: string | null; dosage: string; ybType: string; fatherFlag: string | null; manuName: string; nationalCode: string; nationalName: string; execDept: string | null; execDeptName: string | null; chargeCode: string | null; chargeCodeName: string | null; retprice: number | null; quantity: number | null; selfFlag: string | null; supriceFlag: string | null; instruction: string | null; stockAmount: string; ybFlagNew: string; drugSpecification: string; dcode: string; drugFlagName: string; infusionFlagName: string; } // 医嘱数据 export const yiZhuData = ref({ actOrderNo: addTempOrderNo, admissTimes: 0, confirmTime: "", deptCode: "", deptName: "", doctorFlag: "", enterOper: "", enterOperName: "", enterTime: "", excluType: "", groupNoName: "", infantFlag: "", inpatientNo: "", newFlag: "", newOrderFlag: 0, paySelf: "", physician: "", regFlag: "", selfBuyName: "", serialName: "", signer: "", signerName: "", statusFlagName: "", wardCode: "", wardName: "", id: "", orderName: "", orderCode: "", // 频率 frequCode: "", frequCodeName: "", drugSpecification: "", dose: 0, // 领量 doseUnit: "", doseUnitName: "", supplyCode: "", supplyCodeName: "", startTime: "", endTime: "", orderTime: "", doctorName: "", drugFlag: "", execUnit: "", execUnitName: "", parentNo: "", parentNoName: "", physicianName: "", discription: "", instruction: null, kfFlag: null, selfBuy: null, ybSelfFlag: "0", emergencyFlag: "0", drugQuan: 0, miniUnitName: "", serial: "", miniUnit: "", psFlag: false, kjywFlag: 0, yyfs: null, ssqk: null, yysj: null, zkObj: "", zkWardCode: "", zkDeptCode: "", statusFlag: "1", groupNo: "00", // 包装规格 packSizeName: "", packUnit: "", // 执行用量 drugOcc: "", packSize: 0, execDept: "", execDeptName: "", }); export const yiZhuDataInit = (clearOrderNo: boolean = true): void => { yiZhuData.value = { id: "", actOrderNo: clearOrderNo ? addTempOrderNo : yiZhuData.value.actOrderNo, admissTimes: 0, confirmTime: "", deptCode: "", deptName: "", doctorFlag: "", enterOper: "", enterOperName: "", enterTime: "", excluType: "", groupNoName: "", infantFlag: "", inpatientNo: "", newFlag: "", newOrderFlag: 0, paySelf: "", physician: "", regFlag: "", selfBuyName: "", serialName: "", signer: "", signerName: "", statusFlagName: "", wardCode: "", wardName: "", orderName: "", orderCode: "", // 频率 frequCode: "", frequCodeName: "", drugSpecification: "", dose: 0, // 领量 doseUnit: "", doseUnitName: "", supplyCode: "", supplyCodeName: "", startTime: "", endTime: "", orderTime: "", doctorName: "", drugFlag: "", execUnit: "", execUnitName: "", parentNo: "", parentNoName: "", physicianName: "", discription: "", instruction: null, kfFlag: null, selfBuy: null, ybSelfFlag: "0", emergencyFlag: "0", drugQuan: 0, miniUnitName: "", serial: "", miniUnit: "", psFlag: false, kjywFlag: 0, yyfs: null, ssqk: null, yysj: null, zkObj: "", zkWardCode: "", zkDeptCode: "", statusFlag: "1", groupNo: "00", // 包装规格 packSizeName: "", packUnit: "", // 执行用量 drugOcc: "", packSize: 0, execDept: "", execDeptName: "", }; }; // 保存医嘱数据 export const yzData = ref([]); export const jsQueryYzData = async () => { if (stringNotBlank(huanZheXinXi.value.inpatientNo)) { const tmp = await huoQuYiZhuShuJu({ patNo: huanZheXinXi.value.inpatientNo, times: huanZheXinXi.value.admissTimes, startTime: queryParam.value.startTime, endTime: queryParam.value.endTime, }).catch(() => { return []; }); yzData.value = yzDataToTree(tmp); } }; const userConfig = useSystemStore().userConfig; let newDate = ""; getServerDate().then(res => { newDate = res; if (userConfig.yz_orderTimeDay >= 0) { const { start, end } = elDateRangeAddTime( aFewDaysAgo(res, userConfig.yz_orderTimeDay) ); queryParam.value.startTime = start; queryParam.value.endTime = end; } }); // 医嘱查询条件 export const queryParam = ref({ displayRange: 2, frequCode: isDev ? frequCodeEnum.all : frequCodeEnum.longTerm, sort: userConfig.yz_orderBySort, zhuangTai: 0, groupNo: useYfGroupStore().getDefaultXyCode, patNo: "", times: 0, startTime: "", endTime: "", }); // 设置分组符号 export function setYzOrderGroup(): void { yzData.value = yzDataToTree(yzData.value); } // yzData 转成树状图 export function yzDataToTree( data: YzType[], option = { key: "actOrderNo", parentNo: "parentNo", } ): YzType[] { if (data.length === 0) { return []; } // 没有匹配到父级的子节点 let noParent: Map = new Map(); // 克隆一下原来的数据 let cloneData: YzType[] = JSON.parse(JSON.stringify(data)); // 转 map let tempMap: Map = new Map(); let tree: YzType[] = []; // 保存子元素的数据 let children: YzType[] = []; XEUtils.arrayEach(cloneData, item => { let key: number = item[option.key]; noParent.set(key, item); tempMap.set(key, item); if ( typeof item[option.parentNo] === "undefined" || item[option.parentNo] === null ) { tree.push(item); noParent.delete(key); } else { children.push(item); } setSerialName(item); trimString(item); item.orderGroup = ""; }); XEUtils.arrayEach(children, item => { // 子节点的 key 值 let key: number = item[option.key]; if (tempMap.has(item[option.parentNo])) { noParent.delete(key); const parent = tempMap.get(item[option.parentNo]); if (parent) { parent.orderGroup = "┌"; parent.children = parent.children || []; parent.children.push(item); } item.orderGroup = "丨"; } }); // 判断 noParent 不为空 if (noParent.size > 0) { // 把 noParent 的 value 全部放到 tree 数组中 const a = Array.from(noParent.values()); tree.push(...a); } let list: YzType[] = []; //循环 tree 节点,设置结尾的 orderGroup 为 "└" 并且清空children数组 XEUtils.arrayEach(tree, item => { list.push(item); // 判断 item 的 children 节点不为空 if (item.children && item.children.length > 0) { item.children = XEUtils.orderBy(item.children, [ [option.key, OrderBy.asc], ]); item.children[item.children.length - 1].orderGroup = "└"; // 把 item 的 children 节点全部添加到 list数组 list.push(...item.children); // 在把 children 清空 item.children = []; } }); return list; } export const setOrderDataAndTwinkle = async (order: number, data: YzType[]) => { let temp = data; let tempMap = new Map(); XEUtils.arrayEach(temp, item => { tempMap.set(item.actOrderNo, item); }); for (let i = yzData.value.length - 1; i >= 0; i--) { let item = yzData.value[i]; if (item.statusFlag !== "1") { continue; } let orderNo = item.actOrderNo; if (tempMap.has(orderNo)) { yzData.value[i] = tempMap.get(orderNo); tempMap.delete(orderNo); } } if (tempMap.size > 0) { let list = Array.from(tempMap.values()); yzData.value.push(...list); } await nextTick(); setYzOrderGroup(); // 设置高亮 yzMitt.emit("setOrderNoTwinkle", order); }; // 设置项目名称 function getSerial(val: string): string { val = XEUtils.trim(val); switch (val) { case "00": return "项目"; case "01": return "小包装"; case "02": return "大包装"; default: return ""; } } // 删除对象中的 string 类型的前后空格 function trimString(obj: any) { for (let key in obj) { if (typeof obj[key] === "string") { obj[key] = XEUtils.trim(obj[key]); } } } function setSerialName(item: any) { let temp = getSerial(item.seria); item.serialName = temp; item.groupNoName = temp; } // 数据筛选 export const tempYzData = computed(() => { let temp = XEUtils.filter(yzData.value, item => { if (item.statusFlag === "6") { return true; } let flag: boolean = queryParam.value.displayRange === 0; let frequFlag: boolean = queryParam.value.frequCode === frequCodeEnum.all; let zhuangTai: boolean = queryParam.value.zhuangTai === 0; if (isCydy()) { return item.selfBuy === "4"; } if (item.statusFlag === "1") { return true; } if (queryParam.value.displayRange === 1) { // 停止的医嘱 flag = item.statusFlag === "5"; } else if (queryParam.value.displayRange === 2) { flag = item.statusFlag === "2" || item.statusFlag === "3" || item.statusFlag === "4"; } else if (queryParam.value.displayRange === 3) { flag = getFormatDatetime(newDate, "YYYY-MM-DD") === getFormatDatetime(item.startTime, "YYYY-MM-DD"); } if (queryParam.value.frequCode === frequCodeEnum.temporary) { frequFlag = item.frequCode === "ONCE"; } else if (queryParam.value.frequCode === frequCodeEnum.longTerm) { frequFlag = item.frequCode !== "ONCE"; } if (queryParam.value.zhuangTai === 1) { zhuangTai = item.statusFlag === "1"; } else if (queryParam.value.zhuangTai === 2) { zhuangTai = item.statusFlag === "2"; } else if (queryParam.value.zhuangTai === 3) { zhuangTai = item.statusFlag === "3" || item.statusFlag === "4"; } else if (queryParam.value.zhuangTai === 5) { zhuangTai = item.statusFlag === "5"; } return flag && frequFlag && zhuangTai; }); return XEUtils.orderBy(temp, [["actOrderNo", queryParam.value.sort]]); }); // 获取医嘱的下标 export const getYzIndex = (key: string | number) => { return XEUtils.findLastIndexOf(tempYzData.value, item => { return item.id == key; }); }; interface YzErrorType { dialog: boolean; data: ErrorMsgFuncAdd; } // 错误信息 export const errorMsg: Ref = ref({ dialog: false, data: {}, }); type ErrorMsgFuncAdd = { [key: number]: { error: string[]; warning: string[]; }; }; export const errorMsgFunc = { closed() { errorMsg.value.dialog = false; }, delByOrder(order: any) { delete errorMsg.value.data[XEUtils.toString(order)]; if (Object.keys(errorMsg.value.data).length === 0) { errorMsgFunc.closed(); } }, add: (value: ErrorMsgFuncAdd) => { errorMsg.value.dialog = true; for (let key in value) { errorMsg.value.data[key] = value[key]; } }, }; // 添加新地会诊申请 export const consultationApplication = ref(false); export declare type AddJcParams = { execDept: string; execDeptName: string; orderCode: string; orderName: string; note: string; collectionInfo: string; genderRestriction: number; minAgeRestriction: number; maxAgeRestriction: number; startTime: string; orderType: string; }; // 添加检查申请 export const [jcList, jcProxy] = cyRefList("orderCode"); // 添加检查申请 export const [jyList, jyProxy] = cyRefList<{ orderCode: string }>("orderCode"); export const mingXi = ref({ weiYi: [], list: [], }); export const jcExtraInformation = ref(); export const jyExtraInformation = ref(); interface ExtraInformationType { reqComment: string; reqTzComment: string; reqOtherResult: string; diagCode: string; diagText: string; } export const shouShuDiagnosis = ref([]); const defaultExtraInformation: () => ExtraInformationType = () => { return { diagCode: "", diagText: "", reqOtherResult: "", reqTzComment: "", reqComment: "", }; }; export function clickTimeLimitReminder() { timeLimitPromptByPatientNo(huanZheXinXi.value!.inpatientNo).then( res => { yzMitt.emit("setTimeLimitPrompt", res); } ); } async function queryPrompt() { const data = await getSendDockerPrompt( huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes ).catch(() => []); if (data.length === 0) { return; } useDialog(SendPromptDialog, { dialogProps: { title: "提示", closeOnClickModal: false, closeOnPressEscape: false, showClose: false, }, showCancel: false, params: { value: data, }, }).catch(XEUtils.noop); } /** * 点击查询患者信息 * @param patNo 住院号 */ export const clickOnThePatient = async (patNo: string) => { switchPatients(); huanZheXinXi.value = (await getPatientInfo(patNo)) as any; yzMitt.emit("setTableKey", huanZheXinXi.value!.inpatientNo); queryPrompt(); changePatientHook.forEach(item => { item(); }); reportQueryCenterApiByGet("/intergration/patientInfo/admissionEmr", { patNo: huanZheXinXi.value.inpatientNo, times: huanZheXinXi.value.admissTimes, }) .then(res => { shouShuDiagnosis.value = res; }) .catch(() => { shouShuDiagnosis.value = []; }); getDrgPatInfo(huanZheXinXi.value).then((res: any) => { if (res != null) { huanZheXinXi.value.groupInfoName = res["name"]; huanZheXinXi.value.groupInfoWeight = res["weight"]; huanZheXinXi.value.groupInfoBl = res["groupInfoBl"]; huanZheXinXi.value.setGroupInfoProfit = res["profit"]; huanZheXinXi.value.groupInfoFeeStand = res["fee_stand"]; } }); await jsQueryYzData(); queryParam.value.frequCode = frequCodeEnum.all; queryParam.value.zhuangTai = 0; queryParam.value.displayRange = 2; clearAssociate(); getAncillaryInformation( huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes ).then(temp => { if (temp !== null) { jcExtraInformation.value = XEUtils.cloneDeep(temp); jyExtraInformation.value = XEUtils.cloneDeep(temp); } else { jcExtraInformation.value = defaultExtraInformation(); jyExtraInformation.value = defaultExtraInformation(); } }); }; const switchPatients = (): boolean => { let str = ""; if ( stringNotBlank(yiZhuData.value.actOrderNo) && yiZhuData.value.statusFlag === "1" ) { if (yiZhuData.value.actOrderNo !== addTempOrderNo) { str += "存在未保存的医嘱。"; } } if (yzMitt.exists("ssNotSave") && yzMitt.emit("ssNotSave")) { str += "存在未保存的手术申请。"; } if (consultationApplication.value) { str += "存在未保存的会诊申请。"; } if (!jcProxy.isEmpty()) { str += "存在未保存的检查申请。"; } if (!jyProxy.isEmpty()) { str += "存在未保存的检验申请。"; } if (mingXi.value.list.length > 0) { str += "存在未保存的草药医嘱。"; } if (stringIsBlank(huanZheXinXi.value.inpatientNo)) { jcProxy.clear(); jyProxy.clear(); return true; } else { if (stringNotBlank(str)) { BizException(ExceptionEnum.LOGICAL_ERROR, str); } } return true; }; // 是出院带药 export function isCydy(): boolean { return queryParam.value.frequCode === frequCodeEnum.takeMedicine; } export const associateOrders = ref<{ actOrderNo: number | null; associatedGroup: number[]; }>({ actOrderNo: null, associatedGroup: [], }); export const clearAssociate = () => { associateOrders.value = { actOrderNo: null, associatedGroup: [], }; XEUtils.lastEach(yzData.value, (item: YzType) => { item.associationFlag = false; }); }; export function openDrugManual(code: string, serial: string) { useDialog(YaoPingXiangQing, { dialogProps: { title: "药品说明书", height: "500px", }, ignoreError: true, params: { code: code + "_" + serial, }, }); } export let tableHeader = [ { label: "编码", prop: "orderCode" }, { label: "包装", prop: "serial" }, { label: "名称", prop: "orderName", width: 220 }, { label: "规格", prop: "drugSpecification" }, { label: "描述", prop: "discription" }, { label: "库存", prop: "stockAmount" }, { label: "大包装", prop: "specPack" }, { label: "医保类型", prop: "ybFlagNew" }, { label: "医保编码", prop: "nationalCode" }, { label: "医保名称", prop: "nationalName" }, { label: "医保备注", prop: "ybComment" }, { label: "大输液", prop: "infusionFlagName" }, { label: "厂家", prop: "manuName" }, { label: "类型", prop: "drugFlagName" }, { label: "药房", prop: "groupName" }, ]; function 项目说明书(code: string) { useDialog(ItemInstructions, { dialogProps: { title: "项目详情", width: "60%", }, params: { code, }, ignoreError: true, }); } export let tableHeaderV2 = ref([ { name: "说明书", width: "60", render: ({ row }: { row: any }) => { return h( ElButton, { text: true, type: "primary", onClick: (e: Event) => { e.stopPropagation(); if (row.groupNo == "00") { return 项目说明书(row.orderCode); } else { openDrugManual(row.orderCode, row.serial); } }, }, () => "说明书" ); }, }, { name: "编码", code: "orderCode", width: 75, render: ({ row }: { row: any }) => { return h("span", null, `${row.orderCode}_${row.serial}`); }, }, { name: "名称", code: "orderName", width: 220 }, { name: "规格", code: "drugSpecification", width: 80 }, { name: "描述", code: "discription", width: 80 }, { name: "库存", code: "stockAmount", width: 80 }, { name: "大包装", code: "specPack", width: 80 }, { name: "医保类型", code: "ybFlagNew", width: 80 }, { name: "医保编码", code: "nationalCode", width: 80 }, { name: "医保名称", code: "nationalName", width: 80 }, { name: "医保备注", code: "ybComment", width: 80 }, { name: "大输液", code: "infusionFlagName", width: 80 }, { name: "厂家", code: "manuName", width: 80 }, { name: "类型", code: "drugFlagName", width: 80 }, { name: "药房", code: "groupName", width: 80 }, ]); export const jyJcRestriction = (data: AddJcParams, error: boolean = true) => { if (stringNotBlank(huanZheXinXi.value.inpatientNo)) { if ( data.genderRestriction && data.genderRestriction !== huanZheXinXi.value.sex ) { error && BizException(ExceptionEnum.MESSAGE_ERROR, "患者性别不允许开此项目。"); return false; } // @ts-ignore if ( data.minAgeRestriction && data.minAgeRestriction >= huanZheXinXi.value!.age ) { error && BizException( ExceptionEnum.MESSAGE_ERROR, "项目最小年龄限制" + data.minAgeRestriction + "岁,患者年龄不符合。" ); return false; } // @ts-ignore if ( data.maxAgeRestriction && data.maxAgeRestriction <= huanZheXinXi.value!.age ) { error && BizException( ExceptionEnum.MESSAGE_ERROR, "项目最大年龄限制" + data.maxAgeRestriction + "岁,患者年龄不符合。" ); return false; } } return true; }; export interface YzMitt { jySave: () => void; jySaveTemplate: () => void; tableScroll: (val: number) => void; clearSelected: () => void; scrollEndAndTwinkle: (val: any) => Promise; setOrderNoTwinkle: (val: number) => Promise; getSelectedData: () => YzType[]; toAddAnOrder: () => Promise; duplicateAndPaste: () => void; openTheOrderPopUpWindow: () => void; emptyTheWorkbench: () => void; copy: (actOrderNo: number, frequCode: string) => void; paste: () => void; allowReplication: () => boolean; deleteAnOrderByOrderNo: (data: YzType, clearOrNot: boolean) => void; confirmMedicalAdvice: () => void; allergen: () => void; clickOnTheOrderTemplate: () => void; clickAssociate: (data: YzType) => Promise; rowClick: (data: YzType) => void; queryFeeByOrderNo: (data: YzType) => void; setTimeLimitPrompt: (data: any) => void; ssNotSave: () => boolean; getCurrentWard: () => string; errorClick: (orderNo: any) => void; setTableKey: (value: string) => void; getTableRef: () => TableMethods; [key: string]: (...args: any[]) => any; } export const yzMitt = new EventBus(); export const yzSize = ref({ w: 0, h: 0, }); export const confirmLoading = ref(false); /** * 参数一 : 项目编码 * 参数二:项目的类型 00 - 项目 01-小包装 09 - 大包装 * 参数三: 患者当前科室 * 参数四,当前选中的药房 * 参数五:授权的医生 * 参数六:当前医嘱的状态 * @param val 参数 */ export function feeKey(...val: string[]) { return val.join("_"); } /** * 两个数据中把 右边的数据根据 name 赋值给左边的数据 */ export class RefFillingValue { private refData: Ref; private readonly FillingData: F; constructor(refData: Ref, FillingData: F) { this.refData = refData; this.FillingData = FillingData; } /** * 把左边的值填充到右边 * @param name 根据名称填充 */ setValue(name: keyof F) { // @ts-ignore this.refData.value[name] = this.FillingData[name]; return this; } /** * 为第一个数据填充默认值 * @param name ref 中的 key * @param value 要赋的值 */ setDefaultValueByName(name: keyof R, value: any) { this.refData.value[name] = value; return this; } } const changePatientHook = new Map(); let changePatientHookLength = 0; export function onChangePatient(cb: () => void) { // @ts-ignore new ChangePatient(changePatientHookLength++, cb); } function ChangePatient(index: number, cb: () => void) { onActivated(() => { changePatientHook.set(index, cb); if (huanZheXinXi.value.inpatientNo) { cb(); } }); onDeactivated(() => { changePatientHook.delete(index); }); } export const openPatientImage = ( value: string | { patNo?: string; patientUid?: string } ): void => { if (XEUtils.isString(value)) { window.open( `http://172.16.32.122:8099/index.htm?INHOSPITALNUM=${value}`, "_blank" ); } if (XEUtils.isObject(value)) { if (value.patientUid) { window.open( `http://172.16.32.122:8099/index.htm?CLINICALNUM=${value.patientUid}`, "_blank" ); return; } } }; // 医嘱的一些提示 export const yzInfoPrompt: Ref = ref([]); // 一些特殊的医嘱标志 export const yzZdOrderItemConfirm = ref({}); getYzZdOrderItemConfirm().then(res => { yzZdOrderItemConfirm.value = res; });