1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078 |
- import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
- import {ElButton, ElMessage} from "element-plus";
- import {getPatientInfo, getDrgPatInfo} from "@/api/inpatient/patient";
- import {BizException, ExceptionEnum} from "@/utils/BizException";
- import {nextTick, Ref, ref, computed, onActivated, onDeactivated, h} from "vue";
- import {getFormatDatetime} from "@/utils/date";
- import {isDev} from "@/utils/public";
- import {getFrequency, getSupplyType, 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 {getServerDate} from "@/utils/moment-utils";
- import setDialogToJs from "@/components/js-dialog-comp/useDialogToJs";
- import YaoPingXiangQing from "@/components/zhu-yuan-yi-sheng/he-li-yong-yao/YaoPingXiangQing.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
- }
- // 患者信息
- export const huanZheXinXi: Ref<PatInfo> = 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 yzHeaderSize = ref(0)
- // 给药方式
- 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 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<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: ''
- });
- 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<Array<YzType>>([])
- export const jsQueryYzData = async () => {
- if (stringNotBlank(huanZheXinXi.value.inpatientNo)) {
- yzData.value = await huoQuYiZhuShuJu({
- patNo: huanZheXinXi.value.inpatientNo,
- times: huanZheXinXi.value.admissTimes
- })
- }
- }
- let newDate = ''
- getServerDate().then((res) => {
- newDate = res
- })
- // 医嘱查询条件
- export const queryParam = ref({
- displayRange: 2,
- frequCode: isDev ? frequCodeEnum.all : frequCodeEnum.longTerm,
- zhuangTai: 0,
- groupNo: '73',
- patNo: '',
- times: 0,
- });
- // 设置分组符号
- export function setYzOrderGroup(): void {
- yzData.value = yzDataToTree(yzData.value)
- }
- // yzData 转成树状图
- export function yzDataToTree(data: YzType[]): YzType[] {
- 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.actOrderNo
- noParent.set(key, item);
- tempMap.set(key, item)
- if (typeof item.parentNo === 'undefined' || item.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.actOrderNo;
- if (tempMap.has(item.parentNo)) {
- noParent.delete(key);
- const parent = tempMap.get(item.parentNo);
- if (parent) {
- parent.orderGroup = "┌";
- parent.children = parent.children || [];
- parent.children.push(item);
- }
- item.orderGroup = "丨";
- }
- });
- // 判断 noParent 不为空
- if (noParent.size > 0) {
- // 把 noParent 的 value 全部放到 tree 数组中
- let 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, [["actOrderNo", "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) {
- break;
- }
- }
- 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<YzType[]>(() => {
- let temp = XEUtils.filter(yzData.value, (item) => {
- 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', 'asc']])
- })
- // 获取医嘱的下标
- export const getYzIndex = (key: string | number) => {
- return XEUtils.findLastIndexOf(tempYzData.value, (item => {
- return item.id == key
- }))
- }
- interface yZErrorType {
- dialog: boolean
- type: YzErrTypeEnum
- data: any
- }
- export enum YzErrTypeEnum {
- 确认错误,
- 删除错误
- }
- // 错误信息
- export const errorMsg: Ref<yZErrorType> = ref({
- dialog: false,
- type: 1,
- data: {}
- })
- // 添加新地会诊申请
- export const consultationApplication = ref(false)
- // 添加手术申请
- export const operationApplication = ref([])
- // 添加检查申请
- export const addCheckList = ref([])
- // 添加检验申请
- export const xuanZhongJianYan = ref({
- data: [],
- weiBianMa: [],
- daiXuanZhong: [],
- })
- // 检验树状图
- export const jyTree = ref([])
- // 检查树状图
- export const jcTree = ref([])
- 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
- }
- const defaultExtraInformation: ExtraInformationType = {
- diagCode: "",
- diagText: "",
- reqOtherResult: "",
- reqTzComment: "",
- reqComment: ''
- }
- const strDefaultExtraInformation = JSON.stringify(defaultExtraInformation)
- export function clickTimeLimitReminder() {
- timeLimitPromptByPatientNo(<string>huanZheXinXi.value!.inpatientNo).then(res => {
- yzMitt.emit('setTimeLimitPrompt', res)
- })
- }
- /**
- * 点击查询患者信息
- * @param patNo 住院号
- */
- export const clickOnThePatient = async (patNo: string) => {
- switchPatients();
- huanZheXinXi.value = await getPatientInfo(patNo) as any;
- changePatientHook.forEach(item => {
- item()
- })
- 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']
- }
- })
- if (yzMitt.exists('queryYz')) {
- await nextTick();
- await yzMitt.emit('queryYz');
- } else {
- await jsQueryYzData();
- }
- queryParam.value.frequCode = frequCodeEnum.all;
- queryParam.value.zhuangTai = 0;
- queryParam.value.displayRange = 2;
- clearAssociate();
- const temp = getAncillaryInformation(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes);
- if (temp) {
- let str = JSON.stringify(temp);
- jcExtraInformation.value = JSON.parse(str);
- jyExtraInformation.value = JSON.parse(str);
- } else {
- jcExtraInformation.value = JSON.parse(strDefaultExtraInformation);
- jyExtraInformation.value = JSON.parse(strDefaultExtraInformation);
- }
- }
- 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 (addCheckList.value.length > 0) {
- str += '存在未保存的检查申请。'
- }
- if (xuanZhongJianYan.value.data.length > 0) {
- str += '存在未保存的检验申请。'
- }
- if (mingXi.value.list.length > 0) {
- str += '存在未保存的草药医嘱。'
- }
- if (stringIsBlank(huanZheXinXi.value.inpatientNo)) {
- addCheckList.value = []
- xuanZhongJianYan.value = {
- data: [],
- weiBianMa: [],
- daiXuanZhong: [],
- }
- 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) {
- return setDialogToJs(YaoPingXiangQing, {
- 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'},
- ]
- export let tableHeaderV2 = ref([
- {
- name: '说明书',
- width: '60',
- render: ({row}) => {
- if (row.groupNo == '00') {
- return null
- }
- return h(ElButton,
- {
- text: true,
- type: 'primary',
- onClick: (e: Event) => {
- e.stopPropagation();
- openDrugManual(row.orderCode, row.serial)
- }
- },
- () => '说明书')
- }
- },
- {
- name: '编码',
- code: 'orderCode',
- width: 75,
- render: ({row}) => {
- 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 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;
- isTheParentNode?: string
- }
- 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 const addJcCheck = async (data: AddJcParams) => {
- let temp = addCheckList.value.findIndex(item => {
- // @ts-ignore
- return item.orderCode === data.orderCode
- })
- if (temp > -1) {
- BizException(ExceptionEnum.MESSAGE_ERROR, '请勿重复添加。')
- }
- jyJcRestriction(data)
- data.startTime = await getServerDate();
- // @ts-ignore
- addCheckList.value.push(data)
- }
- export interface YzMitt {
- jySave: () => void,
- jySaveTemplate: () => void
- upperDoctorSetting: (data: any) => 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
- queryYz: (tableScrollTop?: boolean) => Promise<any>,
- 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
- [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:8081/Clinical?inHospitalNum=${value}`, '_blank')
- }
- if (XEUtils.isObject(value)) {
- if (value.patientUid) {
- window.open(`http://172.16.32.122:8081/Clinical?patientUid=${value.patientUid}`, '_blank')
- return
- }
- }
- }
|