123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296 |
- // @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";
- import CopyOnceDialog from "@/views/hospitalization/zhu-yuan-yi-sheng/yi-zhu-lu-ru/components/CopyOnceDialog.vue";
- 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<PatInfo> = ref({
- zkWardName: "",
- zkWard: "",
- consultPhysician: "",
- deptDirector: "",
- referPhysician: "",
- groupInfoBl: "",
- groupInfoFeeStand: "",
- groupInfoName: "",
- groupInfoWeight: "",
- setGroupInfoProfit: "",
- ledgerSn: 0,
- admissTimes: 0,
- inpatientNo: null,
- admissDate: "",
- sex: null,
- age: null,
- });
- export function clearPatInfo() {
- huanZheXinXi.value = {
- zkWardName: "",
- zkWard: "",
- consultPhysician: "",
- deptDirector: "",
- referPhysician: "",
- groupInfoBl: "",
- groupInfoFeeStand: "",
- groupInfoName: "",
- groupInfoWeight: "",
- setGroupInfoProfit: "",
- ledgerSn: 0,
- admissTimes: 0,
- inpatientNo: null,
- admissDate: "",
- sex: null,
- age: null,
- };
- }
- // 是否点击了修改整个模板
- 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 = "";
- 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;
- genderRestriction: string;
- maxAgeRestriction: string;
- minAgeRestriction: string;
- showDialog: string;
- yzDialog: string;
- ybComment: 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;
- showDialog: string;
- yzDialog: string;
- }
- // 医嘱数据
- export const yiZhuData = ref<YzType>({
- 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: "",
- genderRestriction: "",
- maxAgeRestriction: "",
- minAgeRestriction: "",
- showDialog: "",
- yzDialog: "",
- ybComment: "",
- });
- 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: "",
- genderRestriction: "",
- maxAgeRestriction: "",
- minAgeRestriction: "",
- showDialog: "",
- yzDialog: "",
- ybComment: "",
- };
- };
- // 保存医嘱数据
- export const yzData = ref<YzType[]>([]);
- 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: null,
- 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",
- parentIcon: "┌",
- childIcon: "└",
- }
- ): YzType[] {
- if (!option?.parentIcon) {
- option.parentIcon = "┌";
- }
- if (!option?.childIcon) {
- option.childIcon = "└";
- }
- if (!option?.key) {
- option.key = "actOrderNo";
- }
- if (!option?.parentNo) {
- option.parentNo = "parentNo";
- }
- if (data.length === 0) {
- return [];
- }
- // 没有匹配到父级的子节点
- let noParent: Map<number, YzType> = new Map();
- // 克隆一下原来的数据
- let cloneData: YzType[] = JSON.parse(JSON.stringify(data));
- // 转 map
- let tempMap: Map<number, YzType> = 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 = option.parentIcon;
- 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 = option.childIcon;
- // 把 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 "大包装";
- case "99":
- 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 = useYfGroupStore().getXyCodeName(item.groupNo);
- }
- // 数据筛选
- export const tempYzData = computed<YzType[]>(() => {
- 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 => {
- console.log(key);
- return item.id == key;
- });
- };
- interface YzErrorType {
- dialog: boolean;
- data: ErrorMsgFuncAdd;
- }
- // 错误信息
- export const errorMsg: Ref<YzErrorType> = 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;
- inspectParts?: { value: string; label: string }[];
- };
- // 添加检查申请
- export const [jcList, jcProxy] = cyRefList<AddJcParams>("orderCode", null);
- // 添加检查申请
- export const [jyList, jyProxy] = cyRefList<{ orderCode: string }>("orderCode");
- export const mingXi = ref({
- weiYi: [],
- list: [],
- });
- export const jcExtraInformation = ref<ExtraInformationType>();
- export const jyExtraInformation = ref<ExtraInformationType>();
- 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(<string>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,
- },
- });
- }
- 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<void>;
- setOrderNoTwinkle: (val: number) => Promise<void>;
- getSelectedData: () => YzType[];
- toAddAnOrder: () => Promise<boolean>;
- 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<void>;
- 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;
- postPrintPoisonousHemp: (orders: number[], displayReminder: boolean) => void;
- [key: string]: (...args: any[]) => any;
- }
- export const yzMitt = new EventBus<YzMitt>();
- export const yzSize = ref({
- w: 0,
- h: 0,
- });
- export const confirmLoading = ref<boolean>(false);
- /**
- * 参数一 : 项目编码
- * 参数二:项目的类型 00 - 项目 01-小包装 09 - 大包装
- * 参数三: 患者当前科室
- * 参数四,当前选中的药房
- * 参数五:授权的医生
- * 参数六:当前医嘱的状态
- * @param val 参数
- */
- export function feeKey(...val: string[]) {
- return val.join("_");
- }
- /**
- * 两个数据中把 右边的数据根据 name 赋值给左边的数据
- */
- export class RefFillingValue<R, F> {
- private refData: Ref<R>;
- private readonly FillingData: F;
- constructor(refData: Ref<R>, 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<string[]> = ref([]);
- // 一些特殊的医嘱标志
- export const yzZdOrderItemConfirm = ref({});
- getYzZdOrderItemConfirm().then(res => {
- yzZdOrderItemConfirm.value = res;
- });
- export async function longOrderToOnce(orders: number[]) {
- let tmp = [];
- XEUtils.lastArrayEach(yzData.value, item => {
- if (
- item.frequCode !== "ONCE" &&
- XEUtils.includes(orders, item.actOrderNo)
- ) {
- tmp.push(item);
- }
- });
- if (tmp.length === 0) {
- return;
- }
- tmp = XEUtils.orderBy(tmp, [["actOrderNo", "asc"]]);
- return await useDialog(CopyOnceDialog, {
- dialogProps: {
- title: "是否生成同一天的临时医嘱",
- width: "100%",
- },
- confirmText: "生成临时医嘱",
- params: {
- patNo: huanZheXinXi.value.inpatientNo,
- times: huanZheXinXi.value.admissTimes,
- orderList: tmp,
- },
- }).then(async res => {
- await nextTick();
- const { list, data } = res;
- let temp = {};
- XEUtils.arrayEach(list, item => {
- temp[item] = true;
- });
- yzData.value.push(...yzDataToTree(data));
- yzMitt.emit("scrollEndAndTwinkle", temp);
- });
- }
|