12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091 |
- 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, 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";
- import cyRefList from "@/utils/cyRefList";
- import {reportQueryCenterApiByGet} from "@/api/base-data/report-center";
- 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
- }
- // 患者信息
- 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
- data: any
- }
- // 错误信息
- export const errorMsg: Ref<YzErrorType> = ref({
- dialog: false,
- data: {}
- })
- 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: object) => {
- errorMsg.value.dialog = true
- for (let key in value) {
- // @ts-ignore
- 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<AddJcParams>('orderCode')
- // 添加检查申请
- export const [jyList, jyProxy] = cyRefList<{
- orderCode: string
- }>('orderCode')
- // 添加检验申请
- export const xuanZhongJianYan = ref({
- data: [],
- weiBianMa: [],
- })
- 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 = {
- 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;
- yzMitt.emit('setTableKey', huanZheXinXi.value!.inpatientNo)
- 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']
- }
- })
- 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();
- getAncillaryInformation(huanZheXinXi.value.inpatientNo, huanZheXinXi.value.admissTimes).then(temp => {
- 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 (!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) {
- 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}: { row: any }) => {
- 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}: { 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
- 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
- errorClick: (orderNo: any) => void;
- setTableKey: (value: string) => 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
- }
- }
- }
|