123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411 |
- // 判断是否选择了患者
- import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
- import {ElMessage} from "element-plus";
- import {getPatientInfo} from "@/api/inpatient/patient";
- import {BizException, ExceptionEnum} from "@/utils/BizException";
- import {ref} from "vue";
- import {getServerDateApi} from "@/api/public-api";
- 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 {hzMitt, hzMittEnum} from "@/views/hospitalization/zhu-yuan-yi-sheng/hui-zhen/hui-zhen";
- // 患者信息
- export const huanZheXinXi = ref({})
- // 是否点击了修改整个模板
- 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) {
- if (stringIsBlank(val)) return ""
- switch (val) {
- case '1':
- return "自备"
- case '2':
- return "嘱托"
- case '3':
- return "基数药"
- default:
- return "";
- }
- }
- export function shouShuDengJi(val) {
- if (stringIsBlank(val)) return ""
- switch (val) {
- case "1":
- return "四级";
- case "2":
- return "三级";
- case "3":
- return "二级";
- case "4":
- return "一级";
- default:
- return "";
- }
- }
- export let zkList = ref([])
- export const frequCodeEnum = {
- all: 'all',
- temporary: 'temporary',
- longTerm: 'longTerm',
- always: 'ALWAYS',
- takeMedicine: 'takeMedicine',
- }
- // 医嘱数据
- export const yiZhuData = ref({
- id: '',
- actOrderNo: isDev ? 'tempOrderNo' : null,
- 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: ''
- });
- export const yiZhuDataInit = () => {
- yiZhuData.value = {
- id: '',
- actOrderNo: isDev ? 'tempOrderNo' : null,
- 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',
- packSize: 0,
- }
- }
- // 保存医嘱数据
- export const yzData = ref([])
- export const jsQueryYzData = () => {
- if (stringNotBlank(huanZheXinXi.value.inpatientNo)) {
- huoQuYiZhuShuJu({
- patNo: huanZheXinXi.value.inpatientNo,
- times: huanZheXinXi.value.admissTimes
- }).then(res => {
- yzData.value = res
- });
- }
- }
- let newDate = ''
- getServerDateApi().then(res => {
- newDate = res
- })
- // 医嘱查询条件
- export const queryParam = ref({
- displayRange: 0,
- frequCode: isDev ? frequCodeEnum.all : frequCodeEnum.longTerm,
- zhuangTai: isDev ? 0 : 3,
- groupNo: '73',
- patNo: '',
- times: 0,
- });
- // 数据筛选
- export const tempYzData = computed(() => {
- return yzData.value.filter((item, index) => {
- let flag = queryParam.value.displayRange === 0
- let frequFlag = queryParam.value.frequCode === frequCodeEnum.all
- let zhuangTai = queryParam.value.zhuangTai === 0
- if (isCydy()) {
- return item.selfBuy === '4'
- }
- 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 && item.selfBuy !== '4';
- }).sort((a, b) => {
- return a.actOrderNo - b.actOrderNo
- })
- })
- // 获取医嘱的下标
- export const getYzIndex = (key) => {
- let temp = tempYzData.value.findIndex(item => {
- return item.id == key
- })
- if (typeof temp === 'undefined') {
- return '没有找到序号'
- } else {
- return temp
- }
- }
- // 错误信息
- export const errorMsg = 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([])
- /**
- * 具体的草药明细
- * @type {Ref<UnwrapRef<{weiYi: *[], list: *[]}>>}
- */
- export const mingXi = ref({
- weiYi: [],
- list: [],
- })
- /**
- * 点击查询患者信息
- * @param patNo 住院号
- */
- export const clickOnThePatient = async (patNo) => {
- switchPatients()
- huanZheXinXi.value = await getPatientInfo(patNo)
- clearAssociate()
- }
- const switchPatients = () => {
- let str = ''
- if (stringNotBlank(yiZhuData.value.actOrderNo) && yiZhuData.value.statusFlag === '1') {
- if (yiZhuData.value.actOrderNo !== 'tempOrderNo') {
- str += "存在未保存的医嘱。"
- }
- }
- if (operationApplication.value.length > 0) {
- 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)) {
- return true
- } else {
- if (stringNotBlank(str)) {
- BizException(ExceptionEnum.LOGICAL_ERROR, str);
- }
- }
- return true;
- }
- // 是出院带药
- export function isCydy() {
- return queryParam.value.frequCode === frequCodeEnum.takeMedicine;
- }
- export const associateOrders = ref({
- actOrderNo: null,
- associatedGroup: []
- })
- export const clearAssociate = () => {
- associateOrders.value = {
- actOrderNo: null,
- associatedGroup: []
- }
- for (let i = 0, len = yzData.value.length; i < len; i++) {
- let item = yzData.value[i]
- item.associationFlag = false
- }
- }
- export const drugManual = ref({
- dialog: false,
- code: '',
- open: (code, serial) => {
- drugManual.value.dialog = true
- drugManual.value.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: 'orderType'},
- {label: '毒麻类型', prop: 'drugFlagName'},
- {label: '药房', prop: 'groupName'},
- ]
- export const addJcCheck = async (data) => {
- let temp = addCheckList.value.findIndex(item => {
- return item.orderCode === data.orderCode
- })
- if (temp > -1) {
- BizException(ExceptionEnum.MESSAGE_ERROR, '请勿重复添加。')
- }
- data.startTime = await getServerDateApi()
- addCheckList.value.push(data)
- }
- export const yzMitt = new EventBus();
|