diff --git a/src/api/regional/index.ts b/src/api/regional/index.ts index 131da76..9b302ea 100644 --- a/src/api/regional/index.ts +++ b/src/api/regional/index.ts @@ -48,4 +48,12 @@ export function sampleitemCount(query?: Object) { method: 'get', params: query }) +} +// 标本报表费用 +export function getallcount(query?: Object) { + return request({ + url: '/transitstat/getallcount', + method: 'get', + params: query + }) } \ No newline at end of file diff --git a/src/views/checkCode/index.vue b/src/views/checkCode/index.vue index 1d133e1..84d2538 100644 --- a/src/views/checkCode/index.vue +++ b/src/views/checkCode/index.vue @@ -15,18 +15,17 @@ --> - + - - + + - - + + @@ -97,8 +96,8 @@ - - 拆分选中项目 + + {{ row.jjzt == '1' ? '计价' : '无' }} @@ -160,7 +159,7 @@ import { ref, reactive, toRaw, computed, watch, nextTick, onMounted, } from 'vue import { HiprintPrinter } from '@/utils/hiprintPrinter'; import { classCom } from '@/utils/classCom'; import CustomTable from '@/components/elTable/index.vue' -import { useRouter } from 'vue-router' +import { useRouter, useRoute } from 'vue-router' import { usePrintStore } from '@/store/modules/printStore' import { fetchCodeList, addObj, fetchCodeDetail, fetchCodeExec, fetchCodeReqmain } from '@/api/checkCode/index' const aotuSize = classCom.useAutoSize(); @@ -169,7 +168,9 @@ import useUserStore from '@/store/modules/user' //@ts-ignore import { comDict } from '@/utils/dict' import { ElMessage, ElMessageBox } from 'element-plus' +import dayjs from 'dayjs'; const router = useRouter() +const route = useRoute() const userStore = useUserStore() const printStore = usePrintStore(); const compactForm = ref(null); @@ -182,8 +183,10 @@ interface QueryParams { times: string[]; // 明确类型为字符串元组 yljg: string; zt: string; - failed4: string; - failed5: string; + queryType: string; + queryValue: string; + ksdh: string; + userid: string; } // 提交表单数据 const queryParams = reactive({ @@ -191,9 +194,28 @@ const queryParams = reactive({ // times: [], yljg: '1', zt: '', - failed4: '', - failed5: '', + queryType: '', + queryValue: '', + ksdh: '', + userid: '' }); + + +// 获取当前日期(当天) +const today = dayjs(); + +// 计算前6天的日期(当天 + 前6天 = 7天) +const startOfWeek = today.subtract(6, 'day'); + +const startDate = route.query.startdate ? String(route.query.startdate) : startOfWeek.format('YYYY-MM-DD HH:mm:ss'); +const endDate = route.query.endate ? String(route.query.endate) : today.format('YYYY-MM-DD HH:mm:ss'); + +queryParams.times = [startDate, endDate]; +queryParams.ksdh = (route.query.deptcode as string) ? (route.query.deptcode as string) : ''; +queryParams.userid = (route.query.userid as string) ? (route.query.userid as string) : ''; +queryParams.yljg = (route.query.yljg as string) ? (route.query.yljg as string) : ''; + + const showSearch = ref(true); const queryRef = ref() // 定义校验规则 @@ -209,15 +231,15 @@ const queryRules = ref({ }) const options = [ { - value: '1', + value: 'brxm', label: '通过姓名搜索', }, { - value: '2', + value: 'brdh', label: '通过病人号搜索', }, { - value: '3', + value: 'ch', label: '通过床号搜索', }, ] @@ -236,13 +258,13 @@ const handleQuery = async () => { // 重置 const resetQuery = () => { queryRef.value?.resetFields(); - + queryParams.zt = '' + queryParams.queryType = '' + queryParams.queryValue = '' getList() } -const loading = ref(true); - - +const loading = ref(false); // 数据源 const tableData = ref([]) @@ -329,6 +351,7 @@ const lastTimeIndex = computed(() => { } }); +const Info: any = ref({}) // 点击行 const rowHandle = (row: any) => { timelineItems.value = @@ -341,6 +364,7 @@ const rowHandle = (row: any) => { { title: '标本签收', time: row.jssj }, { title: '结果审核', time: row.confirmtime }, ] + Info.value = row getRightTable(row) }; @@ -427,9 +451,9 @@ const openBlock = (value: string) => { const requests = sqhs.value.map((item: any) => { return item.sqh }); fetchCodeExec({ sqh: requests.join(','), - userid: 'lis', + userid: queryParams.userid, status: value == '采样登记' ? 12 : 13, - yljg: 1 + yljg: queryParams.yljg }).then((res: any) => { if (res.code == 0) { ElMessage.success('调用成功'); @@ -459,9 +483,9 @@ const sqdQuery = () => { if (res.code == 0 && res.data.sqh) { fetchCodeExec({ sqh: res.data.sqh, - userid: 'lis', + userid: queryParams.userid, status: 12, - yljg: 1 + yljg: queryParams.yljg }) cyTableData.value = cyTableData.value.concat(res.data) } @@ -500,7 +524,9 @@ const getRightTable = (row: any) => { const goReport = () => { // 跳转到报告查询页面 - router.push('/report?startdate=2025-08-19&endate=2025-08-19&deptcode=0210&userid=00910&brdh=') + router.push(`/report?yljg=${Info.value.yljg ? Info.value.yljg : queryParams.yljg}&deptcode=${Info.value.ksdh ? Info.value.ksdh : queryParams.ksdh}&userid=${queryParams.userid}&brdh=${Info.value.brdh ? Info.value.brdh : ''}`) + // router.push('/report?startdate=2025-08-19&endate=2025-08-19&deptcode=0210&userid=00910&brdh=') + }; const cancelHandle = () => { @@ -513,9 +539,9 @@ const cancelHandle = () => { const requests = sqhs.value.map((item: any) => { return item.sqh }); fetchCodeExec({ sqh: requests.join(','), - userid: 'lis', + userid: queryParams.userid, status: 9, - yljg: 1 + yljg: queryParams.yljg }).then((res: any) => { if (res.code == 0) { ElMessage.success('调用成功'); @@ -531,21 +557,17 @@ const cancelHandle = () => { }, }).catch(() => { }); - - } + + onMounted(async () => { // 进入页面单点登录 const result = await userStore.loginAnonymous({ name: 'admin' }) if (result) { getList() } - // 初始化3天区间(今天-前两天) - // const end = dayjs().format('YYYY-MM-DD HH:mm:ss'); - // const start = dayjs().subtract(2, 'day').format('YYYY-MM-DD HH:mm:ss'); //add 时间往后 - // queryParams.times = [start, end]; - // console.log(queryParams.times); + adjustTableHeight(); // 加载病人来源字典 @@ -582,13 +604,18 @@ function adjustTableHeight() { const handletime = (val: Array) => { // console.log('时间', val); + // 校验日期格式 + const dayDiff = getDayDiff(val[0], val[1]); + if (dayDiff === -1) return ElMessage.warning('请选择有效的日期范围'); + //校验是否超过7天 + if (dayDiff > 7) return ElMessage.warning('查询时间范围不能超过7天,请重新选择'); } // 生成条码 const printHandle = () => { const data = { - dept: '0235', - userid: 'lis', + dept: queryParams.ksdh, + userid: queryParams.userid, st: '', et: '', yljg: queryParams.yljg @@ -596,25 +623,59 @@ const printHandle = () => { if (queryParams.times && queryParams.times.length) { data.st = queryParams.times[0] data.et = queryParams.times[1] + } else { + data.st = '' + data.et = '' } addObj(data).then((res: any) => { if (res.code == 0) { getList() } }) - } +// 计算两个日期的天数差(支持带时分秒) +const getDayDiff = (start: string, end: string): number => { + const startTime = new Date(start).getTime(); + const endTime = new Date(end).getTime(); + // 校验日期有效性 + if (isNaN(startTime) || isNaN(endTime)) { + return -1; // 无效日期 + } + + // 计算毫秒差 → 转换为天数(向上取整,避免因时分秒导致的误差) + return Math.ceil((endTime - startTime) / (24 * 60 * 60 * 1000)); +}; // 查询申请单 const getList = () => { - loading.value = true; const data = { - dept: '0235', - userid: 'lis', + dept: queryParams.ksdh, + userid: queryParams.userid, st: queryParams.times[0], et: queryParams.times[1], yljg: queryParams.yljg } + + if (!data.yljg) return ElMessage.warning('医疗机构不能为空!') + if (!data.dept) return ElMessage.warning('科室代号不能为空!') + if (!data.userid) return ElMessage.warning('用户userid不能为空!') + + // 校验日期格式 + const dayDiff = getDayDiff(queryParams.times[0], queryParams.times[1]); + if (dayDiff === -1) return ElMessage.warning('请选择有效的日期范围'); + + + //校验是否超过7天 + if (dayDiff > 7) return ElMessage.warning('查询时间范围不能超过7天,请重新选择'); + if (queryParams.times && queryParams.times.length > 0) { + data.st = queryParams.times[0] + data.et = queryParams.times[1] + } else { + data.st = '' + data.et = '' + } + + loading.value = true; fetchCodeList(data).then((response: any) => { if (response.code == 0) { loading.value = false; @@ -648,9 +709,9 @@ const printPdf = () => { const requests = sqhs.value.map((item: any) => { return item.sqh }); fetchCodeExec({ sqh: requests.join(','), - userid: 'lis', + userid: queryParams.userid, status: 11, - yljg: 1 + yljg: queryParams.yljg }).then((res: any) => { if (res.code == 0) { done(); diff --git a/src/views/checkCode/report/index.vue b/src/views/checkCode/report/index.vue index 0b30da6..1c8c400 100644 --- a/src/views/checkCode/report/index.vue +++ b/src/views/checkCode/report/index.vue @@ -7,7 +7,8 @@ + start-placeholder="开始时间" end-placeholder="结束时间" format="YYYY-MM-DD" value-format="YYYY-MM-DD" + @change="handletime" /> @@ -206,7 +207,8 @@ interface QueryParams { ch: string, dybz: string, sqh: string, - userid: string + userid: string, + yljg: string, } // 提交表单数据 @@ -222,7 +224,8 @@ const queryParams = reactive({ brdh: '', ch: '', dybz: '', - userid: '' + userid: '', + yljg: '' }); // 获取当前日期(当天) const today = dayjs(); @@ -234,9 +237,10 @@ const startDate = route.query.startdate ? String(route.query.startdate) : startO const endDate = route.query.endate ? String(route.query.endate) : today.format('YYYY-MM-DD'); queryParams.times = [startDate, endDate]; -queryParams.ksdh = (route.query.deptcode as string) || ''; -queryParams.userid = (route.query.userid as string) || ''; -queryParams.brdh = (route.query.brdh as string) || ''; +queryParams.ksdh = (route.query.deptcode as string) ? (route.query.deptcode as string) : ''; +queryParams.userid = (route.query.userid as string) ? (route.query.userid as string) : ''; +queryParams.brdh = (route.query.brdh as string) ? (route.query.brdh as string) : ''; +queryParams.yljg = (route.query.yljg as string) ? (route.query.yljg as string) : ''; const single = ref(true); @@ -249,16 +253,17 @@ const queryRef = ref() const Info = ref({}) // 定义校验规则 const queryRules = ref({ - // clientId: [ - // { required: true, message: '编号不能为空', trigger: 'blur' }, - // ], - - // failed3: [ - // { required: true, message: '条码状态不能为空', trigger: 'change' }, - // ], }) +const handletime = (val: Array) => { + // console.log('时间', val); + // 校验日期格式 + const dayDiff = getDayDiff(val[0], val[1]); + if (dayDiff === -1) return ElMessage.warning('请选择有效的日期范围'); + //校验是否超过7天 + if (dayDiff > 7) return ElMessage.warning('查询时间范围不能超过7天,请重新选择'); +} // 时间线数据 const timelineItems = ref( @@ -381,11 +386,7 @@ const handleColumnDragEnd = (newColumns: any) => { const printPdf = () => { const printStore = usePrintStore(); const merge = rows.value.map((item: any) => { return `${item.jyrqname.replace(/-/g, '')}_${item.yq.trim()}_${item.ybh}` }) - // const merge = [ - // "20250819_11_1", - // "20250819_11_10", - // "20250819_11_11" - // ] + reportPrintPdf(merge).then((res: any) => { if (res.code == 0) { if (!res.data) return ElMessage.warning('未找到打印文件') @@ -490,14 +491,14 @@ const brlxFields = ref([ const rightTableData = ref([]) // 配置项 const rightColumns = ref([ - { prop: 'xmdh', label: '项目代号', align: 'center', visible: true, }, - { prop: 'xmmc', label: '项目名称', align: 'center', visible: true, }, - { prop: 'xmmc', label: '培养结果', align: 'center', visible: true, width: 150 }, - { prop: 'csjg', label: '检验结果', align: 'center', visible: true, }, - { prop: 'refs', label: '参考值', align: 'center', visible: true, }, - { prop: 'dw', label: '单位', align: 'center', visible: true, }, - { prop: 'od', label: '菌落计数', align: 'center', visible: true, }, - { prop: 'jgbz', label: '结果标志', align: 'center', visible: true, slot: 'jgbz' }, + { prop: 'xmdh', label: '项目代号', align: 'center', visible: true, }, //0 + { prop: 'xmmc', label: '项目名称', align: 'center', visible: true, }, //1 + { prop: 'xmmc', label: '培养结果', align: 'center', visible: true, width: 150 },//2 + { prop: 'csjg', label: '检验结果', align: 'center', visible: true, },//3 + { prop: 'refs', label: '参考值', align: 'center', visible: true, },//4 + { prop: 'dw', label: '单位', align: 'center', visible: true, },//5 + { prop: 'od', label: '菌落计数', align: 'center', visible: true, },//6 + // { prop: 'jgbz', label: '结果标志', align: 'center', visible: true, slot: 'jgbz' }, ]) const rightCellStyleHd = ({ row, column, rowIndex, columnIndex }: { @@ -614,41 +615,48 @@ interface copyItem { refs: string | number; dw: string; jgbz: string; + od: string; } // 复制函数 const copyData = (type: string) => { - let str = '' - const getCommonRow = (item: copyItem) => `${item.xmdh}\t${item.xmmc}\t${item.csjg}\t${item.refs}\t${item.dw}\t${item.jgbz}\t\r\n`; - rightTableData.value.forEach((v: any) => { - if (type == 'All') { - str = str + getCommonRow(v) - // str = str + v.xmmc + v.csjg + v.dw + + ','; + let str = ''; + // 处理空值的工具函数:null/undefined/空字符串都返回空白 + const getFieldValue = (value: any) => { + if (value === null || value === undefined || value === '') { + return ''; } - if (type == 'N' && v.jgbz != 'M' && v.jgbz != '') { - str = str + getCommonRow(v) - } - if (type == 'Y' && v.jgbz == 'M' && v.jgbz != '') { - str = str + getCommonRow(v) - } - }) + // 转换为字符串,避免数字等类型直接拼接 + return String(value); + }; - var input = document.createElement('textarea'); - if (!str) return ElMessage.error('没有数据可复制'); - // 把文字放进input中,供复制 + // 根据设备类型定义不同的字段拼接逻辑 + const getCommonRow = Info.value.yqdl === '细菌仪' + ? (item: copyItem) => `${getFieldValue(item.xmdh)}\t${getFieldValue(item.xmmc)}\t${getFieldValue(item.csjg)}\t${getFieldValue(item.od)}\t\r\n` + : (item: copyItem) => `${getFieldValue(item.xmdh)}\t${getFieldValue(item.xmmc)}\t${getFieldValue(item.csjg)}\t${getFieldValue(item.refs)}\t${getFieldValue(item.dw)}\t\r\n`; + + // 遍历数据拼接内容 + rightTableData.value.forEach((v: any) => { + // 根据类型过滤数据 + if (type === 'All' || + (type === 'N' && v.jgbz !== 'M' && v.jgbz !== '') || + (type === 'Y' && v.jgbz === 'M')) { + str += getCommonRow(v); + } + }); + + // 执行复制操作 + const input = document.createElement('textarea'); + if (!str) { + ElMessage.error('没有数据可复制'); + return; + } input.value = str; document.body.appendChild(input); - // 选中创建的input input.select(); - var copy_result = document.execCommand('copy'); - if (copy_result) { - ElMessage.success('复制成功'); - } else { - ElMessage.error('复制失败'); - } - // 移除 + const copyResult = document.execCommand('copy'); + copyResult ? ElMessage.success('复制成功') : ElMessage.error('复制失败'); document.body.removeChild(input); -} - +}; // 数据重组 const formatGroupedData = (data: any[]) => { if (!data || data.length === 0) return []; @@ -843,10 +851,21 @@ onMounted(async () => { }; }); +// 计算两个日期的天数差(支持带时分秒) +const getDayDiff = (start: string, end: string): number => { + const startTime = new Date(start).getTime(); + const endTime = new Date(end).getTime(); + // 校验日期有效性 + if (isNaN(startTime) || isNaN(endTime)) { + return -1; // 无效日期 + } + + // 计算毫秒差 → 转换为天数(向上取整,避免因时分秒导致的误差) + return Math.ceil((endTime - startTime) / (24 * 60 * 60 * 1000)); +}; const getList = () => { - if (!queryParams.ksdh) return ElMessage.error('科室代号不能为空'); - if (!queryParams.userid) return ElMessage.error('用户userid不能为空'); + const data = { alarmflag: alarmflag.value, jzbz: jzbz.value, @@ -859,14 +878,25 @@ const getList = () => { userid: queryParams.userid, st: '', et: '', - yljg: 1, - + yljg: queryParams.yljg, } + + if (!data.ksdh) return ElMessage.error('科室代号不能为空'); + if (!data.yljg) return ElMessage.error('医疗机构yljg不能为空'); + if (!data.userid) return ElMessage.error('用户userid不能为空'); + // 校验日期格式 + const dayDiff = getDayDiff(queryParams.times[0], queryParams.times[1]); + if (dayDiff === -1) return ElMessage.warning('请选择有效的日期范围'); + + //校验是否超过7天 + if (dayDiff > 7) return ElMessage.warning('查询时间范围不能超过7天,请重新选择'); + if (queryParams.times && queryParams.times.length) { data.st = queryParams.times[0] data.et = queryParams.times[1] } else { - return ElMessage.error('日期时间段不能为空'); + data.st = '' + data.et = '' } loading.value = true reportList(data).then((res: any) => { diff --git a/src/views/regional/statistics/overview/css/index.css b/src/views/regional/statistics/overview/css/index.css index c1c3e6c..d6b10c8 100644 --- a/src/views/regional/statistics/overview/css/index.css +++ b/src/views/regional/statistics/overview/css/index.css @@ -205,6 +205,10 @@ overflow: hidden; } +/* .leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul{ + height: 68vh; +} */ + .leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn { display: flex; @@ -255,24 +259,31 @@ } .leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_left zi { - -} + } .leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_line { width: 40%; height: 1.25rem; background: rgba(255, 255, 255, 0.5); border-radius: 125rem; + overflow: hidden; + position: relative; } .leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .liIn_line .line_lineIn { width: 100%; height: 1.25rem; background: #05d1fc; - border-radius: 6.25rem; + border-radius: 125rem; -webkit-animation: widthMove1 2s ease-in-out; } +.line_lineIn .per { + position: absolute; + top: 0; + left: 50%; +} + .leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn2 .liIn_line .line_lineIn { background: #e7feb8; -webkit-animation: widthMove2 2s ease-in-out; @@ -359,7 +370,7 @@ } .leftMain_middle .leftMain_middle_right .leftMain_middle_rightIn .biaoge_pai ul li .liIn .num { - width: 17%; + width: 18%; font-family: dig; padding-left: 0.3125rem; } diff --git a/src/views/regional/statistics/overview/index.vue b/src/views/regional/statistics/overview/index.vue index b0b1c05..b4a972b 100644 --- a/src/views/regional/statistics/overview/index.vue +++ b/src/views/regional/statistics/overview/index.vue @@ -5,50 +5,10 @@ - + - 区域机构 - 69家 - - - - - - - - - 检验人数 - 609人 - - - - - - - - - 检验管数 - 609个 - - - - - - - - - 检验报告数 - 289份 - - - - - - - - - 检验项目数 - 759个 + {{ item.name }} + {{ item.num }}{{ item.unit }} @@ -83,19 +43,22 @@ 委托机构当月送检标本占比 - - - - - {{ item.name }} - - + + + + + {{ item.groupname }} + + + {{ item.percentage }} - {{ item.pre }}% - - - + {{ item.groupsum }} + + + + @@ -139,47 +102,24 @@
69家
609人
609个
289份
759个
{{ item.num }}{{ item.unit }}
{{ item.pre }}%
{{ item.groupsum }}